简体   繁体   中英

Prestashop admin panel custom filter for comma-separated column

here my comma separated column is shops(eg. 1,2,3,4), and with the call back i am already displaying the multiple shops names. with call back i am showing the related shop-names(values shows eg. Shop1,Shop2,Shop3,Shop4).

is there a way i can filter it with the values i am displaying.

$this->fields_list = array(
    'id_push' => array('title' => $this->l('ID')),
    'shops' => array('title' => $this->l('Shop(s)'),'callback' => 'getShopName','type'=>'editable')
);

You should include a concatenated shop name field in your controller SELECT. Then you should specify filter_key parameter in your shops fieldlist field. Something like this:

$this->_select = ' a.`correct_field_name` AS `shopnames_custom_field`';

$this->fields_list = array(
    'id_push' => array('title' => $this->l('ID')),
    'shops' => array('title' => $this->l('Shop(s)'),'callback' => 'getShopName','type'=>'editable', 'filter_key' => 'shopnames_custom_field')
);

If this solution does not work you should modify getList function to custom filter results.

Good luck

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM