ienabellamy Posted August 30, 2012 Share Posted August 30, 2012 Hi ! when i try to search a product in BO with proper product name, it doesn't work very well. Example: Product name: " Kawasaki Racing Filter " if i try to search " Kawasaki Racing " it's ok...the product appear in the results.. but if i try to search " Kawasaki Filter " the product doesn't appear... is there a way to correct this ? because is real hard searching a product when you have more than 30.000 articles... Thanks to all Link to comment Share on other sites More sharing options...
shokinro Posted August 31, 2012 Share Posted August 31, 2012 I don't think prestashop can search like Google. It does not implemented in that way. When you search "Kawasaki Racing", it will take a connected one word, not separated two words. So it is not that easy to make that changes. I am not sure if there is any 3rd party modules to do that. Link to comment Share on other sites More sharing options...
ienabellamy Posted August 31, 2012 Author Share Posted August 31, 2012 Hi Shokinro ! yeah, probably it's not so easy, but now i'll try to modify the sql with wildcard %. If i resolv i'll post the mod. Thanks to all Link to comment Share on other sites More sharing options...
ienabellamy Posted August 31, 2012 Author Share Posted August 31, 2012 ok, the file to edit is: AdminProductsController.php here we go: public function ajaxProcessCheckProductName() { if ($this->tabAccess['view'] === '1') { $search = Tools::getValue('q'); /* Here we have the string. So, the scope is substitute the space in 2 or more words, like "Kawasaki Racing FIlter" to "Kawasaki%Racing%Filter" */ $search = str_replace('', '%', $search); $id_lang = Tools::getValue('id_lang'); $limit = Tools::getValue('limit'); $result = Db::getInstance()->executeS(' SELECT DISTINCT pl.`name`, p.`id_product`, pl.`id_shop` FROM `'._DB_PREFIX_.'product` p LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$id_lang.') WHERE pl.`name` LIKE "%'.pSQL($search).'%" GROUP BY pl.`id_product` LIMIT '.(int)$limit); die(Tools::jsonEncode($result)); } } but it doesn't work is there here some good programmers that can help me ? I'll appreciate. Thanks again dudes Link to comment Share on other sites More sharing options...
Recommended Posts