To create a support ticket, start a search

Product Import: Importing a field in a table (insert and update)


  • Store Commander version 2015-07-01
  • SC Grids Editor Pro Add-on - version 1.2
  • The field has to be present in the database



We would like to import additional information onto a product from a CSV file to a field in a table. If the information already exists in a table, it will be updated. If the information does not exist yet, it will be created.



  • To add the field to the list of available fields to import, click on the add.png in the 'Add a field' panel and enter the following information:


What is the field ID?: my_field (has to correspond exactly to the field name in Product Class)


  • SC creates the field, you now need to populate the grid with:

ID: my_field

Name: my_field


  • From the Advanced Properties panel (right hanside) > Import Process, add the following


if ($switchObject=='my_field')
$sql = "SELECT * FROM "._DB_PREFIX_."my_table WHERE id_product=".intval($id_product);
$exist = Db::getInstance()->ExecuteS($sql);
$TODO[]="UPDATE "._DB_PREFIX_."my_table SET my_field='".pSQL($GLOBALS["import_value"],true)."' WHERE id_product=".intval($id_product);
$TODO[]="INSERT INTO "._DB_PREFIX_."my_table(id_product, my_field) 
VALUES ('".intval($id_product)."','".pSQL($GLOBALS["import_value"],true)."')";


You will need to adapt this code to your needs.


  • Exit the editing window and you can use the field in your import mapping