Jump to content

Filters in list in backoffice are not saved in next page


Tom1369

Recommended Posts

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

  • 9 months later...

@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 by zolwix (see edit history)
Link to comment
Share on other sites

@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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...