How to save value for a Specific[custom] Product Attribute from Product Model ?
I have found the below script from here :
$product = Mage::getModel('catalog/product')->load(1);
$product->setName('Some Random Name');
$product->getResource()->saveAttribute($product, 'name');
Best Answer
There are 2 ways to go about this, one is by getting the Magento
catalog/product
model and loading the product by ID which will give you the whole product, then setting the name and saving it.As OP pointed out, this is quite heavy just for changing one attribute. I kind of figured that the attribute mass update tool should use a cleaner way to do this and found the
Mage_Catalog_Model_Resource_Product_Action
class[UPDATE] benchmark
So did a quick benchmark script and the results speak for itself.