1

How to save only the product ids in my custom table post saving all the product details after importing csv.

I have added custom entity type under system->import.

When i click on that, it should perform the same functionality as product import, but apart from that also the imported product ids must be saved to my custom table.

This is what i have done:

etc/di

<preference for="Vendor\Module\Model\Import" type="Magento\ImportExport\Model\Import" />
<preference for="Vendor\Module\Model\Import\DataflowProfiles" type="Magento\CatalogImportExport\Model\Import\Product" />

etc/import.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_ImportExport:etc/import.xsd">
    <entity name="catalog_product" label="Custom Dataflow-Profiles" model="Vendor\Module\Model\Import\CustomDataflowProfile" behaviorModel="Magento\ImportExport\Model\Source\Import\Behavior\Basic" />
</config>

Vendor\Module\Model\Import\CustomDataflowProfile.php

<?php
   namespace Magento\CatalogImportExport\Model\Import;

   use Vendor\Module\Model\Import\CustomDataflowProfile\RowValidatorInterface as ValidatorInterface;

   class CustomDataflowProfile extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
   {    
         ...same code as core...
   }

Vendor\Module\Model\Import\CustomDataflowProfile\RowValidatorInterface.php

same as core 

My custom table has columns: id , productid.

Now apart from saving the product details after import, i want my product ids to be saved in my custom table.

Updated error in comments

Please suggest!!

closed as primarily opinion-based by Sushivam, Amit Bera, Rakesh Jesadiya, Keyul Shah, Qaisar Satti Sep 6 '16 at 6:55

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • The problem is 1) its not overridding my customImport module, 2) if i give different entity name in import xml i get The input entity code is not equal to entity adapter code. – Sushivam Jul 30 '16 at 14:49
  • Is my etc/di wrong? Or where is the code wrong in my model im clueless – Sushivam Jul 30 '16 at 15:16
1

I think your di is wrong it should be:

<preference for="Magento\CatalogImportExport\Model\Import\Product" type="Vendor\Module\Model\Import\DataflowProfiles" />

Thanks,

Sophie

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