Friday, 27 September 2013

Magento needs a storeview set to update attribute on website scope

Magento needs a storeview set to update attribute on website scope

It seems like I have to set a store view before I can update an attribute
on website scope – is that correct?
My code:
Mage::app('admin');
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$product = Mage::getModel('catalog/product');
$product->load(123);
$product->setStoreId('1'); // without this line the attribute is not updated
$product->setSomeattribute("abc");
$product->save();

No comments:

Post a Comment