Magento: How to update custom attributes product values by script

This should give you an idea for how to run a script to perform a mass update on your products.

/*
 * Script to update custom attributes product values
 */
 
$_productCollection=Mage::getModel('catalog/product')
                    ->getCollection()
                    ->addAttributeToSelect('*');
$storeId=0;
 
foreach($_productCollection as $_product)  {
    $product = Mage::getModel('catalog/product')->load($_product->getId());   
    $data=array(
                'custom_attribute_1' = 'VALUE_OF_ATTRIBUTE1',
                'custom_attribute_2 '= 'VALUE_OF_ATTRIBUTE2',); 
    Mage::getSingleton('catalog/product_action')->updateAttributes(array($product->getId()), $data, $storeId); 
}
Comments
My Cart
loading