Para crear un ticket de soporte, comience con una búsqueda

Customer Interface: Number of validated orders (period)


We would like to add a column displaying the number of validated orders on a specific period of time within the customer interface.



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

What is the field ID?: valid_orders_periode


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

Field name: Validated orders (period)
Table: Another table
Type: only display


From the Advanced Properties panel on the right handside:

- select the menu SQL Select and enter:

return ' , 0 as valid_orders_periode ';


- select the menu PHP Get Row Data and enter:

if($col=="valid_orders_periode") {  $valid_orders_sql = Db::getInstance()->getValue('                     SELECT COUNT(id_order)                     FROM '._DB_PREFIX_.'orders                     WHERE `id_customer` = '.(int)$gridrow['id_customer'].'       AND invoice_date >= "2019-01-01 00:00:00" AND invoice_date <= "2019-12-31 23:59:59"                         AND valid="1"');                 if(!empty($valid_orders_sql))                     $gridrow[$col] = $valid_orders_sql; }


Exit the editing window.

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