Informatica Ros Posted May 26, 2016 Share Posted May 26, 2016 (edited) Hi I moved the search module to the column left, and I set the column left only to be displayed on category view. Then I edited Seach.php class to recive a new parameter for the category id, and use it on searches. public static function find($id_lang, $expr, $page_number = 1, $page_size = 1, $order_by = 'position', $order_way = 'desc',$cat_id, $ajax = false, $use_cookie = true, Context $context = null) //... $results = $db->executeS(' SELECT cp.`id_product` FROM `'._DB_PREFIX_.'category_product` cp '.(Group::isFeatureActive() ? 'INNER JOIN `'._DB_PREFIX_.'category_group` cg ON cp.`id_category` = cg.`id_category`' : '').' INNER JOIN `'._DB_PREFIX_.'category` c ON cp.`id_category` = c.`id_category` INNER JOIN `'._DB_PREFIX_.'product` p ON cp.`id_product` = p.`id_product` '.Shop::addSqlAssociation('product', 'p', false).' WHERE c.`active` = 1 AND product_shop.`active` = 1 AND product_shop.`visibility` IN ("both", "search") AND c.`id_category` = ' . $cat_id.' AND product_shop.indexed = 1 '.$sql_groups, true, false); But no matter how I try, I can't get the category id on SearchController.php to send it to the find function. Any one can help me? Thanks //EDIT Ok, I solved by myself using: $url = $_SERVER['HTTP_REFERER']; preg_match_all('!\d+!', $url, $matches); $arr1=array_shift($matches); $cid=array_shift($arr1); In SearchController.php As the only way to go to search is in a category view, the referer url always contains a category id Edited May 26, 2016 by Informatica Ros (see edit history) 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