To create a support ticket, start a search

Product grids: how to add a field 'Attachments (yes/no)'

Target

We would like to add the field 'Attachment yes/no' to show whether products have attachments associated.


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

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

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

In the Advanced Properties panel on the right handside :

- select SQL Select and add:

return ' ,IF((SELECT COUNT(pat.id_product) FROM '._DB_PREFIX_.'product_attachment pat WHERE pat.id_product = p.id_product) > 0, "'._l("Yes").'", "'._l("No").'") as available_attachments';

Save and 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