To create a support ticket, start a search

Product Grid: Adding 'Image URL'

Target

We'd like to add the 'Image URL field in the product grid (default image).

Setup

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

What is the field ID?: image_link

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

Field name: Image link
Table: Another table
Type: Editable

In the Advanced Properties panel on the right handside:

- select the menu PHP Get Row Data and enter:

if($col === 'image_link') {
    $link = new Link();
    $shoplink = $link->getBaseLink(SCI::getSelectedShop(),true);
    $prodrow[$col] = $shoplink.'img/p/'.getImgPath((int) $prodrow['id_product'], (int) $prodrow['id_image'], _s('CAT_PROD_GRID_IMAGE_SIZE'));
}


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.




Related articles