0

My configurable product prices are updated with Lowest Price simple product on Save.

As I have thousands of configurable products I can't manually open and save all of them.

Is there any way I can Open/Save all configurable products with a cron/script etc.

0

To get only configurable products (since you need to update PRICE) below is the code:

$configurableProducts = Mage::getModel('catalog/product')
                          ->getCollection()
                          ->joinAttribute(
                                        'price',
                                        'catalog_product/price',
                                        'entity_id',
                                        null,
                                        'left',
                                        1 //key in your store id which I am guessing to be '1'
                                      );

$configurableProducts->addAttributeToSelect('*')->addAttributeToFilter('type_id', 4);

To save each configurable product below is the code:

foreach ($configurableProducts as $_product)
{
   Mage::getModel('catalog/product')->load($_product->getId())->save(); 
   //This is not the best practice to load Model inside a FOREACH loop. However, this is going to be a standalone SCRIPT.
}

Quickest / Simplest script.

Happy Coding...

  • The prices are not updating. Im using This to change the configurable product price on save – Mike Tim Turner Feb 3 '16 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.