Jump to content

Problem with "sort by" in list product inside category


Recommended Posts

Hello,

 

When I select a category on the website, the SORT BY does not seem to be working. When I choose sort from “the lowest price” or or sort from “highest price”, it works but only in current page, it doesn't work on the total list of products. When I search a word on the search box the SORT BY works very well.
 
Has anyone got a solution for this problem?

 

Sorry for my English.

Thank you.

Link to comment
Share on other sites

  • 5 weeks later...

Well, I've been struggling for same problem, and after few hours I found solution.

 

When you select something from "Sort by" dropdown menu, in the background modules/blocklayered/blocklayered-ajax.php file is making a http request and it looks something like:

 

/modules/blocklayered/blocklayered-ajax.php?id_category_layered=92&layered_price_slider=650_859&orderby=price&orderway=asctrue&_=1428532609535

 

Problem is caused by orderway GET variable, it is formed with "true" word at the end. Anyway, "orderway" variable is processed by blocklayered.php file at 2011 line:

 

Tools::getProductsOrder('way', Tools::getValue('orderway'))

 

I found error in classes/Tools.php class in line 2495, there is no code for separation of the word "true" out of passed string, so i added:

 

$value = str_replace('true', '', $value);

 

just before following declaration:

 

$value = (is_null($value) || $value === false || $value === '') ? (int)Configuration::get('PS_PRODUCTS_ORDER_WAY') : $value;
$list = array(0 => 'asc', 1 => 'desc');
return ((isset($list[$value])) ? $list[$value] : ((in_array($value, $list)) ? $value : 'asc'));
 
I hope it will help you.
Link to comment
Share on other sites

Hi suckhead,

 

That doesn't work for me, but thanks for the help.

 

In my case, when I click in "Sort by", at the URL appears: "http://theurloftheweb.com/52-namecategory?orderby=price&orderway=asc&p=1". The "sort by" works but only in current page, it doesn't work on the total list of products (on total pages).

 

Sorry for my English, again.

 

Thank you.

Link to comment
Share on other sites

×
×
  • Create New...