guest* Posted August 1, 2011 Share Posted August 1, 2011 Hi, somebody knows how I can integrate the compare possibility also on the search.tpl ? I tried by adding {include file="$tpl_dir./product-compare.tpl"} after de /product-list.tpl, but it does not work. Link to comment Share on other sites More sharing options...
vivek tripathi Posted August 1, 2011 Share Posted August 1, 2011 To Achieve compare Functionality on search.tpl Replace following function in searchController.php public function displayContent() { parent::displayContent(); self::$smarty->assign('comparator_max_item', (int)(Configuration::get('PS_COMPARATOR_MAX_ITEM'))); self::$smarty->display(_PS_THEME_DIR_.'search.tpl'); } public function setMedia() { parent::setMedia(); if (!$this->instantSearch AND !$this->ajaxSearch) Tools::addCSS(_THEME_CSS_DIR_.'product_list.css'); if (Configuration::get('PS_COMPARATOR_MAX_ITEM') > 0) Tools::addJS(_THEME_JS_DIR_.'products-comparison.js'); } with the following function public function displayContent() { parent::displayContent(); self::$smarty->display(_PS_THEME_DIR_.'search.tpl'); } public function setMedia() { parent::setMedia(); if (!$this->instantSearch AND !$this->ajaxSearch) Tools::addCSS(_THEME_CSS_DIR_.'product_list.css'); } And Replace following line in search.tpl Replace {if !isset($instantSearch) || (isset($instantSearch) && !$instantSearch)} {include file="$tpl_dir./product-sort.tpl"}{/if} With the {if !isset($instantSearch) || (isset($instantSearch) && !$instantSearch)} {include file="$tpl_dir./product-compare.tpl"}[attachment=41582:search-compare.txt] {include file="$tpl_dir./product-sort.tpl"}{/if} For the shake of Convenience I have attached a file having all Necessary code search-compare.txt Link to comment Share on other sites More sharing options...
guest* Posted August 7, 2011 Author Share Posted August 7, 2011 Hi Vivek, ths for the hack I will try. If I understand right, so the code in searchController.php was already prepared to assign the comparator, but it doesn't ? Regards Conny Link to comment Share on other sites More sharing options...
guest* Posted August 8, 2011 Author Share Posted August 8, 2011 Hi Vivek, I tried, but it does not work. Are you sure it works with 1.4.0.17 ? On the SearchController.php I have originally another code: public function displayContent() { parent::displayContent(); self::$smarty->display(_PS_THEME_DIR_.'search.tpl'); } public function displayFooter() { if (!$this->instantSearch AND !$this->ajaxSearch) parent::displayFooter(); } By replacing the hack on both files, comparator does not appear and it duplicates my filterby search on the top of the page. Yes I also cleaned browser cache and smarty cache. 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