Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Unable to update product attribute
 
mojojojo
Jr. Member
 
Total Posts:  4
Joined:  2009-07-16
 

Hi to all,

I am trying to update a product attribute every time the quantity of the product is updated (e.g. the product is added to cart).

I have edited the function registerItemSale in Mage/CatalogInventory/Model/Stock.php by adding:

$product = Mage::getModel(’catalog/product’)
->setStoreId($item->getStoreId())
->load($productId);
$qty2 = $product->getQty2();
$product->setData(’qty2’, ($qty2-$item->getQtyOrdered()));
$product->save();

This is supposed to update an attribute Qty2 and reduce its value. However $product->save() doesn’t seem to work, it gives an error. Any ideas why?

Thank you in advance!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Hugoto
Member
 
Avatar
Total Posts:  33
Joined:  2008-08-11
 

I have a similar problem with a custom attribute, when I call save() it gives an error.... 1.3. bug ???

 
Magento Community Magento Community
Magento Community
Magento Community
 
mojojojo
Jr. Member
 
Total Posts:  4
Joined:  2009-07-16
 

Actually I found out that you can save an attribute like this:

$product->addAttributeUpdate('attribute_code''attribute_value'$storeId);
 
Magento Community Magento Community
Magento Community
Magento Community
 
Abhijit123
Jr. Member
 
Total Posts:  7
Joined:  2009-05-05
 

Can anybody out here tell me how to set the filter category wise ???

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top