I'm trying to speed up the process of updating the description and category image in a few hundred categories in 16 storeviews. Each storeview has an different description and category image.
Using the save()-Method on the category object works ok, but is quite slow.
I tried using
$_category->getResource()->saveAttribute( $_category, "description" );
but that does not work for me.
Is there any other way for faster updating of single category attributes, maybe something like
Mage::getSingleton('catalog/resource_product_action')
(i could not find anything similar for categories)?
Best Answer
Your initial code should be working; see:
So, that's the basic save approach for one attribute at a time.
You might want to create a category action resource, e.g.
Mage_Catalog_Model_Resource_Category_Action
(drop it in local codepool to keep the kids from weeping), however, you'll need to adjust theupdateAttributes
method to save different store scopes and attribute values per entity - this is different from the catalog action resource behavior.Obviously you should change the array structure to whatever works for you. Test data & script for the above class & method are below, and will work for sample data.