In a beautiful day, my client requires updating the product stock status for around 200,000 products in Magento, the data gets from the XML files. The issue is the XML files will be renewed every day, it means I need to finish updating all products within 24 hours.
There is a problem for 200,000 products if I use the normal way to update products.
Generally, it only can update some thousand products every day with the method save() in product action.
I have found out the faster way to update 200,000 products within 24 hours.
Here is how to do
$product = Mage::getModel('catalog/product')->load($product_id); $resource = $product->getResource(); $product->setData($attribue_code, $value); $resource->saveAttribute($product, $attribute_code);This method requires loading the product, but it doesn't trigger the reindex event, that is the reason why it is faster.
Hope it is useful for you 🙂
- September 21, 2017 @ 16:31:39 [Current Revision] by Sharing Solution
- September 21, 2017 @ 16:31:39 by Sharing Solution
No comments yet.