Performance optimized attribute saving

Sometimes, when you have to handle many data-sets, it is more efficient to save only those attributes that have changed:

// load product
$product = Mage::getModel("catalog/product")->load(142);
 
// change attribute
$product->setTitle("Test");
 
// tell resource attribute to save only the specified field
$product->getResource()->saveAttribute($product, "title");

 

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.