Jump to content

Search by ref in prestashop 1.5.6.2


aluminoter

Recommended Posts

Please help!!!

 

I have presta 1.5.6.2, i can search product by ref if i type ref from the beginning.

So if type from the begin, search is normal. But very often i need to search product from the end by 3 or 4 char.

 

I was advised that need to edit /class/search.php class find. Can any help me by hint or for money to this???

Link to comment
Share on other sites

I find the solution:

 

how to improve search in prestashop, we need to correct /classes/search.php

in ''.pSQL we insert %
Result: in '%'.pSQL
$intersect_array[] = 'SELECT si.id_product
    FROM '._DB_PREFIX_.'search_word sw
LEFT JOIN '._DB_PREFIX_.'search_index si ON sw.id_word = si.id_word
    WHERE sw.id_lang = '.(int)$id_lang.'
    AND sw.id_shop = '.$context->shop->id.'
    AND sw.word LIKE
    '.($word[0] == '-'
    ? ' \'%'.pSQL(Tools::substr($word, 1, PS_SEARCH_MAX_WORD_LENGTH)).'%\''
	: '\'%'.pSQL(Tools::substr($word, 0, PS_SEARCH_MAX_WORD_LENGTH)).'%\''
);
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...