Magento retention for a very long time

In Magento, I write several small command line scripts to do things like set a new attribute for a number of products. I find that the time it takes to update 900 products takes about 6 hours.

The time taken to download individual products is as fast as I am, except for, but the save action after I made the changes takes a lot of time.

I add how I download products if there is something that I can do to better optimize the process. Any help here would be greatly appreciated.

$product = Mage::getModel('catalog/product')->load($magento_id);
$product->setMadeInUsa(1);
try {
    $product->save();
} catch(Exception $e) {
    echo "ERROR: " . $e->getMessage() . "\n";
}

The code works without errors, but it lasts forever.

+3
source share
2 answers
Mage::getSingleton('catalog/product_action')
            ->updateAttributes(array($product->getId()), $attributesData, $storeId);

, . - , - , - , .

, .

+4

, . . , , , , , .

0

Source: https://habr.com/ru/post/1763832/


All Articles