mark2 Posted April 9, 2010 Share Posted April 9, 2010 Hi,It seems that the search feature only considers the default category when matching against the search text. I would like to match all products that are within any category that matches the search text.Is this possible with Prestashop 1.2.5 ?If it is not possible is there anyone interested in providing this feature ?Regards, Mark Link to comment Share on other sites More sharing options...
mark2 Posted April 17, 2010 Author Share Posted April 17, 2010 I've attempted to implement this, here is what I changed in 1.2.5:In Search.phpadded: public static function getCategories($db, $id_product, $id_lang) { $categories = ''; $categoriesArray = $db->ExecuteS(' SELECT `id_category` FROM `'._DB_PREFIX_.'category_product` WHERE `id_product` = '.intval($id_product)); foreach ($categoriesArray as $category) { $c = new Category($category['id_category'], intval($id_lang)); $categories .= Category::hideCategoryPosition($c->name) . ' '; } return $categories; } In the public static function indexationadded to the setting of $weightArray : 'categories' => Configuration::get('PS_SEARCH_WEIGHT_CNAME') after the line: $product['features'] = self::getFeatures($db, $product['id_product'], $product['id_lang']); added $product['categories'] = self::getCategories($db, $product['id_product'], $product['id_lang']); Rebuild the search index from the admin page.Regards, Mark 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