0

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?

asked Aug 3, 2016 at 7:11
5
  • This should help magento.stackexchange.com/questions/114525/… Commented Aug 3, 2016 at 8:24
  • I tried that Atish, i want to insert product id into my custom table on csv import... Commented Aug 3, 2016 at 10:09
  • Do you want only the newly inserted product entity ids or all the product entity ids in your custom table ? Commented Aug 3, 2016 at 10:14
  • Only the modified product details's product ids during import to my custom table Commented Aug 3, 2016 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 Commented Aug 3, 2016 at 13:55

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.