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

Instructions for adding a column to your Sc interface, indicating whether the product has attached documents (yes/no values)

Prerequisites

Access the PRO section of the tool to add custom fields:

Instructions for adding a column to your Sc interface, indicating whether the product has attached documents (yes/no values)

Ensure you select the right grid : ‘Catalog: Products grids’:

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

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

Table

Another table

Field name

Attachments?

Type

Just display

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.