I want get Product Ids after import product using csv file.

When I go following menu System > Import/export > Import and import*.csv file of products and when finish import data one event called catalog_product_import_finish_before this event is in app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php.

This event work but not getting `ids(entity_id)` of product after imported.

Any one help me where I am going wrong ?

my app/code/local/Test1/Module1/etc/config.xml


this is defined code in app/code/local/Test1/Module1/Model/Observer.php

public function afterImportProductData(Varien_Event_Observer $observer)
        echo "<pre>";

Please help me.

  • Please post the full config.xml file. Youre using 'marketplace/observer' as the observer class name but are your models configured to be using 'marketplace' in the config.xml? Commented Feb 28, 2016 at 12:17
  • sry its other code pasted.I revert back and corrected code ..see again and help me Commented Feb 28, 2016 at 12:23

1 Answer 1


Try adding the following code inside the config tag of your config.xml:


Then to get the product Ids you can use the following piece of code in your observer:

$adapter = $observer->getEvent()->getAdapter();
$affectedEntityIds = $adapter->getAffectedEntityIds();
  • But I want to fetch new product ids which after imported it creates. Commented Feb 28, 2016 at 17:39
  • Observer working properly but any method to get in observer method product ids after imported data ? Commented Feb 28, 2016 at 17:40
  • @test see my edited answer Commented Feb 28, 2016 at 17:45
  • What a solution.Your solution is flexible.2 min ago I found solution to override app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php file and get entitiy_ids from _saveProductEntity function line number 1271 to get entity_ids from foreach loop. $newId is new entitiy_id of new product.Thanks again thank you thank u thank u. Commented Feb 28, 2016 at 17:56
  • Your solution is flexible than me. thank you for saving my time Commented Feb 28, 2016 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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