phpmagento

Call a function when product imported successfully in magento


Hello I am importing products in magneto programatically using Advance import profile and I want to run re-index after the whole import is finished. I have tried digging the magento, But can't find any function that is being called after importing is finished...

I have found a file process.phtml that is calling ajax for each csv row /app/design/adminhtml/default/default/template/system/convert/profile

So I have created a file on the root and call it via ajax to import each row, But it created a deadlock in Mysql and import throws error SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get locked; try restarting transaction.

function reIndexData(){
                        var url = '<?php echo str_replace("index.php/","",Mage::getBaseUrl()); ?>';
                         new Ajax.Request(url+'reindex.php', {
                          method: "post",
                          parameters: 'data',
                          onSuccess: function(transport) {}
                        });
                    }

Solution

  • Go with this path.. app/code/core/Mage/Adminhtml/controllers/System/Convert

    You will find the file ProfileController.php there is a function called batchFinishAction() which is getting called when import profile complete

    Phew... Got it!! Thanks all for your kind help..