To create a support ticket, start a search

Orders Grid: adding 'Discount code' field


We would like to add a column displaying the discount code(s) used in orders.


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

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

Field name: Discount code
Table: Another table
Type: only display

From the Advanced Properties panel on the right handside:

- select the menu SQL Select and enter:

return ', GROUP_CONCAT(cr.code) AS reduction_code';

- select the menu SQL Left Join and enter:

return ' LEFT JOIN '._DB_PREFIX_.'order_cart_rule ocr ON ocr.id_order = o.id_order
LEFT JOIN '._DB_PREFIX_.'cart_rule cr ON cr.id_cart_rule = ocr.id_cart_rule AND cr.code <> ""';

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