Billy Posted June 6, 2011 Share Posted June 6, 2011 Well after testing this on prestashop 1.2.5 all the way to 1.4.2.5 it still hosed. The front office search is totally different code. Why is that? The back office search works flawlessly! The front office search is broken bad and is responsible for lost sales daily.Bug Report-----Hey Billy, check out the search on the store and see if something has gotten out of wack. For example, search for a 74LS377 and see what you come up with. If you type in the whole prefix it comes up just fine. If you only type LS377 nothing will show. However, in the store admin the search works great. Check it out and see what you think. I bet its a setting that needs to be tweaked.----- Link to comment Share on other sites More sharing options...
Billy Posted June 6, 2011 Author Share Posted June 6, 2011 Here is the same bug report I did in January... http://www.prestashop.com/forums/viewthread/87682/configuring___using_prestashop/why_does_the_bo_search_work_perfect_but_the_fo_doesnt__63Seriously the Front Office Search is hosed! Can any one tell me how I can use the code from the BO Search on the FO??? 1 Link to comment Share on other sites More sharing options...
thienxu Posted June 17, 2012 Share Posted June 17, 2012 Are there any update on this problem? I am waiting for a solution from prestashop admin Thanks, Thienxu Link to comment Share on other sites More sharing options...
thienxu Posted June 17, 2012 Share Posted June 17, 2012 My solution is replacing code of FO search by BO search. FO search uses search_word and search_index tables but BO search uses SQL query directly. Find these code in /classes/search.php: foreach ($words AS $key => $word) if (!empty($word) AND strlen($word) >= (int)Configuration::get('PS_SEARCH_MINWORDLEN')) { $word = str_replace('%', '\\%', $word); $word = str_replace('_', '\\_', $word); $intersectArray[] = 'SELECT 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.word LIKE '.($word[0] == '-' ? ' \''.pSQL(Tools::substr($word, 1, PS_SEARCH_MAX_WORD_LENGTH)).'%\'' : '\''.pSQL(Tools::substr($word, 0, PS_SEARCH_MAX_WORD_LENGTH)).'%\'' ); if ($word[0] != '-') $scoreArray[] = 'sw.word LIKE \''.pSQL(Tools::substr($word, 0, PS_SEARCH_MAX_WORD_LENGTH)).'%\''; } else unset($words[$key]); replace by: $intersectArray[] = 'SELECT distinct p.id_product FROM ps_product p LEFT JOIN ps_product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$id_lang.') WHERE pl.name LIKE \'%'.pSQL($expr).'%\''; 1 Link to comment Share on other sites More sharing options...
vive Posted December 19, 2012 Share Posted December 19, 2012 Thanks very much Link to comment Share on other sites More sharing options...
anves Posted January 7, 2013 Share Posted January 7, 2013 I tried this solution for v 1.52 and it did not solve the issue, enfact the first 2 items in my database appeared no matter what I searched for Any Ideas Link to comment Share on other sites More sharing options...
Gipielle Posted February 20, 2017 Share Posted February 20, 2017 I'm looking for a fix like this for ps 1.5 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now