To create a support ticket, start a search

Products Grid: Adding a Product Display SQL condition: WHERE

Prerequisites

  • Store Commander version 2015-07-01
  • SC Grids Editor Pro Add-on - version 1.2

 

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: none
Name: testColor
Type: Display only

 

  • In the right handside, select Advanced Properties: SQL and enter:

return " AND p.id_manufacturer = 3 ";

 

You will need to adapt this code to your needs. In this example id_manufacturer 3 corresponds to 'Brand XY' as per target.

 

  • Exit the editing window and add the field to your grids
  • Eventually add this new field to a view and refresh the grid of that view to see the result.