Home Communication board WiKi Get Quote

Import script speed up

During the import of products using default Magento import tool or a custom configurable products import script most likely you will face slow speed problem when trying to import a huge amount of products.

During the investigation I have founded that a time period of one product import increases with each new product added. As the result it is not possible to import 1000+ products with the Magento API.

This time period was taken by afterCommitCallback function in the app/code/core/Mage/Catalog/Model/Product.php file, to be specific, within the code from the following lines:

        Mage::getSingleton('index/indexer')->processEntityAction(
            $this, self::ENTITY, Mage_Index_Model_Event::TYPE_SAVE
        );

Actually, running index after saving the product during the import process does not make any sense. Thus it was disabled in the following way:

        if (!defined('IS_IMPORT'))
        Mage::getSingleton('index/indexer')->processEntityAction(
            $this, self::ENTITY, Mage_Index_Model_Event::TYPE_SAVE
        );

and the following code was added to the import controller:

define('IS_IMPORT', 1);

As a result, we have disabled the indexer for the import process and left it unchanged for other scripts.

PS: Unfortunately it's not possible to make this modification in other ways, since in this case Magento core model has to be modified.

 
Home About us Privacy statement Terms & Conditions Refund policy © 2007–2024 ArsCommunity