I added the eav attribute for my Magento application product object using the installer script (basically following the procedure described here: Setting custom attributes using the Module ). Now I want to use a script update to change (fill) the values ββof this attribute for each product according to some criteria (depending on the product category). I tried using a script essentially like this:
$attributeValues = array(...) // Map from $productId to the desired $value $product = Mage::getModel('catalog/product'); foreach($attributeValues as $productId=>$value){ $product->load($productId)->setMyAttribute($value); $product->save(); }
My questions would be: Can this level of abstraction (Mage :: getModel ("catalog / product") and its methods) be used in upgrade scripts? If this is not the case, how would you recommend changing these attribute values ββusing update scripts (without sql requirement)?
script I used (so far) did not work and could not fail:
Call to a member function getStoreIds() on a non-object
in the core magento file.
I do not know if this error is a Magento error or a problem with the way I use update scripts.
I am using Magento 1.4.0.1
source share