Tom1369 Posted December 18, 2020 Share Posted December 18, 2020 Hello I add own filters by hook. Its working but If i go on next page the filter is not saved. public function hookActionAdminProductsListingFieldsModifier($list) { if (isset($list['sql_select'])) { $list['sql_select']['manufacturer_name'] = array( "table" => "man", "field" => "name", "filtering" => \PrestaShop\PrestaShop\Adapter\Admin\AbstractAdminQueryBuilder::FILTERING_LIKE_BOTH ); } if (isset($list['sql_table'])) { $list['sql_table']['man'] = array( "table" => "manufacturer", "join" => "LEFT JOIN", "on" => "p.`id_manufacturer` = man.`id_manufacturer`" ); } $manufacturer_name = Tools::getValue('filter_column_manufacturer_name', false); if ($manufacturer_name && $manufacturer_name != '') { $list['sql_where'][] .= "man.name LIKE '%" . $manufacturer_name . "%'"; } } Link to comment Share on other sites More sharing options...
zolwix Posted October 7, 2021 Share Posted October 7, 2021 (edited) @Tom1369 Did you resolve this issue? I have the same. I have custom field in product list in admin and filter by this field not working. I add custom filter like you but when I go to the next page from pagination of filter result - filter reset and show list of all products... Please help! Edited October 7, 2021 by zolwix (see edit history) Link to comment Share on other sites More sharing options...
zolwix Posted October 9, 2021 Share Posted October 9, 2021 @Tom1369 I found a solution - need to add a new column filter variable in the file /src/PrestaShopBundle/Entity/AdminFilter.php to 2 function: getProductCatalogEmptyFilter () and sanitizeFilterParameters () Now searching, paging and sorting with the new field search results works fine. Here you will find additional information with fles to download https://github.com/FuenRob/Modules-Prestashop-1.7/issues/1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now