To create a support ticket, start a search

Products Grid: Adding a Product Display SQL condition: WHERE


Target

We would like to restrict the display of products in one view. For example, in a view called 'Brand XY' that you would have created beforehand, we would display only products associated to this brand.

Note: with Store Commander's User Permissions, you can allow an employee to modify only products associated to a specific brand and he/she will not have access to any other products.

 

Setup

In the Grids Editor Advanced section, select 'Products Grid' on the left handside.

Select the corresponding field, or create a virtual field if it does not exist (in the database):

ID: testColor
Table: Another table
Name: testColor
Type: Display only

 

From the Advanced Properties panel on the right handside:

- select the menu SQLSelect and enter:

return " AND p.id_manufacturer = 3 ";

 

In this example id_manufacturer 3 corresponds to 'Brand XY' as per target.
Adapt the 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.

 




Related articles