To create a support ticket, start a search

Images Grid: Adding a field from image_shop table (editable)


Target

We would like to add the field 'specific action' stored in ps_image_shop table.

 

Setup

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

What is the field ID?: specific_action (should be exactly the name as it is in the database).

 

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

Field name: Specific Action
Table: enter: Another table
Type: editable

 

From the Advanced Properties panel on the right handside:

- select the menu SQLSelect and enter:

return ' , ims.specific_action';
 
- select the menu Grid JS on EditCell and enter:
idx_specific_action = prop_tb._imagesGrid.getColIndexById('specific_action');
if (stage == 2) {
    if (cInd == idx_specific_action) {
        $.post("index.php?ajax=1&act=cat_image_update&action=update&id_lang=" + SC_ID_LANG + "&" + new Date().getTime(), {
            'id_product': lastProductSelID,
            col: 'specific_action',
            val: nValue.replace(/#/g, ''),
            'list_id_image': prop_tb._imagesGrid.getSelectedRowId()
        }, function (data) {
        });
    }
}
 
 
- select the menu PHP onAfterUpdateSQL and enter:
 
idx_specific_action = prop_tb._imagesGrid.getColIndexById('specific_action');
if (stage == 2) {
    if (cInd == idx_specific_action) {
        $.post("index.php?ajax=1&act=cat_image_update&action=update&id_lang=" + SC_ID_LANG + "&" + new Date().getTime(), {
            'id_product': lastProductSelID,
            col: 'specific_action',
            val: nValue.replace(/#/g, ''),
            'list_id_image': prop_tb._imagesGrid.getSelectedRowId()
        }, function (data) {
        });
    }
}

 

Exit the editing window.

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

 




Related articles