To create a support ticket, start a search

Products Grid: Adding a field 'Combination yes/no'


Target

We would like to add the field 'Combination yes/no' to show whether products use combinations or not.


Setup

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

What is the field ID?: has_combi

 

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

Field name: Combination?
Table: Another table
Type: Just displayed
Refresh combinations: No

 

In the Advanced Properties panel on the right handside :

- select SQL Select and add:

return ' , 0 AS has_combi ';


- select PHP Get Row data and add:

if($col=="has_combi")
{
$value = _l("No");
$sql_qty = "SELECT id_product_attribute FROM "._DB_PREFIX_."product_attribute WHERE id_product='".(int)$prodrow['id_product']."'";
$res=Db::getInstance()->ExecuteS($sql_qty);
if(!empty($res))
 $value = _l("Yes");
$prodrow[$col] = $value;
}


Exit the editing window.

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

To use the choice list, select 'multiple choice' in the Type column (Type A) for your field.
 




Related articles