How to Improve Prestashop Search Results

May 5, 2014390
How to Improve Prestashop Search Results

I found out a problem. If your store has a product with an article ABC12345, you can find it inserting in search field ABC12345, ABC123, ABC1 and so on. But if you write there 12345 or 123, there’s going to be no results. Regular phrases like * do not work. Is there any other way to find product with 12345?

I have a solution. We need to redefine method find of Search class. In sql-request that does the search process you need to add %-symbol at the beginning of the line, that we are searching for. Find in file classes/Search.php this code:

Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Igor

And change it for that:

It’s better to override the file  classes/Search.php.

I have this part of the code from 209th line.

Post on the forum.

Partner With Us Looking for a partner to grow your business? We are the right company to bring your webstore to success. Talk to Igor


  1. чуть ниже тоже желательно поправить

    if ($word[0] != ‘-‘)
    $score_array[] = ‘sw.word LIKE \’%’.pSQL(Tools::substr($word, 0, PS_SEARCH_MAX_WORD_LENGTH)).’%\”;

  2. I’m followed your guide but it seems that nothing happened on PS1.6.0.9.
    I also tried to empty the cache. There’s something else that i should do?

  3. I’ve a problem with 1.6

    Search engine is a disaster. If you search for “woman orange shirt” it shows a lot of irrelevant results because it will find any product that contains just one single word: woman, orange, shirt.

    It’s a OR and not an AND search.

    Is there any way to improve search and let it show ONLY the exact phrase?

    Hope you can help me


  4. Hi, Luca!
    It is impossible to improve search in such a way you are talking about through the admin panel of PrestaShop. It can be done by code changing.
    Please, contact our support team They will help you with this problem.

Post a new comment

BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *