To create a support ticket, start a search

Combinations Grid: Adding a field from ps_product_attribute table


Target

We would like to add the field 'BIO Label' which will allow to differentiate this type of products in the grids.

For this example, this field is located in ps_label table id_product_attribute ; label_bio (0/1) ).

We will then be able to:

  • use the filters in the grids to optimize the selection of combinations
  • mass-edit this field using Store Commander's copy/paste option
  • rapidly export the combinations grid with this field

 

Setup

To add the field to the list of available fields for your products grids, click on the in the 'Add a field' panel and enter the following information:

What is the field ID?: label_bio (should be exactly the name as it is in the database).

 

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

Field name: BIO Label
Table: product_attribute
Type: multiple choices

 

From the Advanced Properties panel on the right handside:

- select the menu SQLSelect and enter:

return ' ,pa.label_bio';

 

From the Advanced Properties panel on the right handside:

- select the menu PHP definition and enter:

$combArray[$combinaison['id_product_attribute']]['label_bio'] = $combinaison['label_bio'];

 

- to add a yes/no choice, select the menu List of choices and enter:

return array(1=>_l('Yes') , 0=>_l('No'));

 

Exit the editing window.

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

To use the list of choice, select 'Type: multiple choice (Type A) for this field.

 




Related articles