To create a support ticket, start a search

Products Grid: Adding a field from ps_product table (with yes/no choice)


Prerequisites
  • The field needs to exist in your database
  • The field needs to exist in PrestaShop Product Class to be used in your Front Office templates (optional)

 

Target

We would like to add the field 'BIO Label' to be able to differentiate the product type in the grids.

We will then be able to:

- use the filters in the grids to optimize the selection of products
- mass-edit this field using Store Commander's copy/paste option by language used on the store
- rapidly export the products grid with this field

 

Setup

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

What is the field ID?: BIO Label (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
Type: multiple choices
Refresh combinations: No

 

If you wish to add a yes/no option, go to the Advanced Properties panel on the right handside :

- select the menu Select Options 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 product grids.

To use the choice list, select 'multiple choice' in the Type column (Type A) for your field.

Note that you can rename the fields displayed in Sc interface by modifying the text in brackets, for example :

return array("valeur 1"=>"Text 1" , "valeur 2"=>"Text 2");

 




Related articles