0

Created an observer file in Magento1, using event

catalog_product_import_finish_before

event

     $productIds = array();
            $adapter = $observer->getEvent()->getAdapter();
          $resource = $this->_stockCollection;

          if ($adapter instanceof Mage_Catalog_Model_Convert_Adapter_Product) {
            $productIds = $adapter->getAffectedEntityIds(); 
            $this->_logger->info(print_r($productIds),true);
       } else {
         Mage_ImportExport_Model_Import::getDataSourceModel()->getIterator()->rewind();
           $skus = array();
           while ($bunch = $adapter->getNextBunch()) {
              foreach ($bunch as $rowData) {
                   if (null !== $rowData['sku']) {
                   $skus[] = $rowData['sku'];
                }
              }
         }
           if (!empty($skus)) {
              $productIds = $resource->getProductsIdBySku($skus);
         }

How to get this Mage_Catalog_Model_Convert_Adapter_Product file and AffectedEntityIds in Magento2?

0

Magento 2 have same event name

app/code/Magento/CatalogImportExport/Model/Import/Product.php

catalog_product_import_finish_before

$this->_eventManager->dispatch('catalog_product_import_finish_before', ['adapter' => $this]);

You can use

 $adapter = $observer->getEvent()->getAdapter();
 $Entityids = $adapter->getAffectedEntityIds();  
  • But i can't get the $Entityids ...@Patel – Mano M Mar 15 '18 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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