I want to insert the entity_id of my modified products while csv import into my custom table.

My custom table "tgs_queue" columns : (id, product_id) //id-primary key

In CatalogImportExport saveProductEntity() i tried something like this:

 public function saveProductEntity(array $entityRowsIn, array $entityRowsUp)
   //custom code
    if (!$tableName) {
        $tableName = $this->_resourceFactory->create()->getTable('tgs_queue');

    if ($entityRowsUp) {
        $this->_connection->insertOnDuplicate($entityTable,$entityRowsUp, ['updated_at']);

      //custom code
        $this->_connection->insertOnDuplicate($tableName, $entityRowsUp);

I get the error for updated_at' as

General system exception happened
Additional data: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'updated_at' in 'field list', query was: INSERT INTO `tgs_queue` (`updated_at`,`entity_id`) VALUES (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), (?, ?) ON DUPLICATE KEY UPDATE `updated_at` = VALUES(`updated_at`), `entity_id` = VALUES(`entity_id`)

Whats the proper way of Inserting my data to custom table during import csv?

  • This should help magento.stackexchange.com/questions/114525/… – Atish Goswami Aug 3 '16 at 8:24
  • I tried that Atish, i want to insert product id into my custom table on csv import... – Sushivam Aug 3 '16 at 10:09
  • Do you want only the newly inserted product entity ids or all the product entity ids in your custom table ? – Atish Goswami Aug 3 '16 at 10:14
  • Only the modified product details's product ids during import to my custom table – Sushivam Aug 3 '16 at 10:20
  • Magento fires an event called catalog_product_import_finish_before after the product import is completed, vendor/magento/module-catalog-import-export/Model/Import/Product.php:890. You can use an event observer to add logic after the import process – Atish Goswami Aug 3 '16 at 13:55

Your Answer

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

Browse other questions tagged or ask your own question.