To create a support ticket, start a search

Orders Grid: adding 'Feature' field

Target

We would like to add a column displaying a feature associated to a product within an order.

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?: myfeature

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

Field name: Feature
Table: Another table
Type: only display

From the Advanced Properties panel on the right handside:

- select the menu SQL Select and enter:

return ', (SELECT GROUP_CONCAT(fvl.value)
            FROM '._DB_PREFIX_.'feature_product fp
            RIGHT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = fp.id_feature_value AND fvl.id_lang = '.(int)$id_lang.')
            WHERE fp.id_product = od.product_id 
            AND fp.id_feature = 2) AS myfeature';

In this example, we use the feature group ID 2: adapt to your needs.

Exit the editing window.

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




Related articles