Products Grid: Adding a field added to ps_product table by the installation of a 3rd party module

Instructions for adding a column to your Sc interface, indicating the value of a field from a third-party module located in the ps_product table.

Prerequisites

Access the PRO section of the tool to add custom fields:

Ensure you select the right grid : ‘Catalog: Products grids’:

Adding the field

Click on the add icon to create the new field line and enter its ID id_logistician (must match the field name in the database exactly)

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

Table

product -

Name

Logisticien

Type

Multiple choices

From the Advanced Properties panel on the right handside:

- select the menu Select options and enter:

$sql = 'SELECT id_logistician,name_logistician FROM '._DB_PREFIX.'logistician ORDER BY name_logistician';$res = Db::getInstance()->ExecuteS($sql);$tmp = array(0 => 'NA');foreach ($res AS $row) {    $tmp[$row['id_logistician']] = $row['name_logistician'];}return $tmp;

Adapt this code to your specific needs.

Exit the editing window.

The new field is now present in the list of available fields and you can add it to your product grids.