Jump to content

Recommended Posts

There is a bug in search function in Prestashop of version 1.6 in my opinion.

The problem appears under following conditions:

 

Search successfully found e.g. 25 products. It is shown just 15 products on a current page (pagination setup is 15/45/90). Now the page 2 is shown with last 10 products. Till now everything is correct. Problem occurs when now is pagination switch from 15 to 45 products on page. It is ended with fault message "please enter a search keyword".

 

After looking at this problem the cause where localized in model of search (Search.php), namely in the function find. There is formula for offset of LIMIT:

 

LIMIT '.(int)(($page_number - 1) * $page_size).','.(int)$page_size;

 

...but page_number is 2, so offset is calculated as (2-1) * 45 = 45, but total number of found products is just 25 (as meantioned above). And that´s cause of the problem.

 

I was thinking how shall I fix it and my solution is make a redirect within the SearchController (function initContent) after the function Search::find is called. Redirect I used to set the same URL with same values of all variables with only one change - variable p set to 1 to start pagination from first page. 

 

Because I´m newbie in Prestashop I´d like to start a discussion about what is the best practice for such case.

 

Beside that if I already revealed I used the function redirect, I´d like to know, what is the best way to get completely URL with all vars and change just one of them, namely var p.

Link to comment
Share on other sites

  • 1 month later...

Hi,

 

I have another problem with  a search.

Let's say I have a product with a name PM5005.

When I enter 500 in a search, I finds many products including PM5005.

When I enter PM5, it also finds this product.

When I enter 5005, it finds nothing!

 

Same is with other products.

 

Is there a solution for this bug? 

Link to comment
Share on other sites

I have another problem with 1.6.11 search !

 

By search it found only the last product inserted by PS 1.6 version.  All another products imported from 1.5.6.1 are not visible for search also after regeneration product search in backoffice.

 

The problem can be resolved by  re-editing and save each old products.

 

Ufff.....

Link to comment
Share on other sites

  • 3 weeks later...

The search bug I was describing above is still present in new version 1.6.11. 

I can´t really believe nobody struggles with such problem. And also I´m surprised moderators are not curious about it. I understand there is no chance to solve all topics but in this particular case I carefuly described the issue and nobody cares....

Link to comment
Share on other sites

×
×
  • Create New...