If you have a batch operation for thousands of products, categories, customers or any other Magento entity that uses Magentos’ EAV-structure, speed and memory usage are important factors to consider. Especially when you only need to change one or two attributes of a product or category there’s no point in loading the entire model for it. Things just get too heavy too soon.
In those cases you might want to save a single EAV-attribute. This can be done easily with the saveAttribute() -method of Mage_Eav_Model_Entity_Abstract . For example, if you only need to save the is_active -flag for a category, you can do:
// Update EAV-attribute:
$data = new Varien_Object();
The same pattern can be applied to products, customers, etc. Just set the value you want to save and do it directly on the resource model.
Visitors give this article an average rating of 4.3 out of 5.
How would you rate this article?
★ ★ ★ ★ ★