Jump to content
robinbrorsson

Search result order is reversed

Recommended Posts

I have a problem with my prestashop version 1.7.2.2. 

When I search for a reference. for example: TB-BOX-IP44 I get many results, most of them seem to react on the "BOX" part. Since there is many other products that have box in reference or description. however there is one product that has an exact match. But the exact match product almost allways comes last in the results. Seems there relevance order is reversed somehow. any ideas?

 

/Robin

Share this post


Link to post
Share on other sites

Hi guys,

after strugling with this issue for quite some time I finally found a solution.

This fix involves changes in "Src" folder, so it isn't "elegant".

My version of Presta is 1.7.2.4.

Here goes:

1)  in file "./src/Core/Product/Search/SortOrderFactory.php" change line 44

from:

           (new SortOrder('product', 'position', 'asc'))->setLabel(

to:

           (new SortOrder('product', 'position', 'desc'))->setLabel(

2) in file "./controllers/front/listing/SearchController.php" change line 67

from:

           ->setSortOrder(new SortOrder('product', Tools::getProductsOrder('by'), Tools::getProductsOrder('way')))

to

           ->setSortOrder(new SortOrder('product', Tools::getProductsOrder('by'), 'desc'))

 

  • Like 1

Share this post


Link to post
Share on other sites
On 2/8/2018 at 1:47 PM, bTk said:

Hi guys,

after strugling with this issue for quite some time I finally found a solution.

This fix involves changes in "Src" folder, so it isn't "elegant".

My version of Presta is 1.7.2.4.

Here goes:

1)  in file "./src/Core/Product/Search/SortOrderFactory.php" change line 44

from:


           (new SortOrder('product', 'position', 'asc'))->setLabel(

to:


           (new SortOrder('product', 'position', 'desc'))->setLabel(

2) in file "./controllers/front/listing/SearchController.php" change line 67

from:


           ->setSortOrder(new SortOrder('product', Tools::getProductsOrder('by'), Tools::getProductsOrder('way')))

to


           ->setSortOrder(new SortOrder('product', Tools::getProductsOrder('by'), 'desc'))

 

this absolute work! Thanks

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More