To create a support ticket, start a search

Orders Grid: Adding Default Group

Target

We would like to add a column displaying the name of the customers default group

Setup

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

What is the field ID?: id_default_group

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

Field name: Default Group
Table: Another table
Type: Just display

From the Advanced Properties panel on the right handside:

- select the menu SQLSelect and enter:

return ' ,c.id_default_group ';


- select the menu PHP Get Row Data and enter:

if($col=="id_default_group")
{
  $sql = "SELECT gl.name
				FROM "._DB_PREFIX_."group_lang gl 
    WHERE gl.id_group = '".(int)$orderrow[$col]."' AND gl.id_lang = '".(int)$id_lang."'";
		$res=Db::getInstance()->getValue($sql);
 $orderrow[$col] = $res;
}


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