rajendra_presta Posted September 19, 2012 Share Posted September 19, 2012 Hi, i want to check category exist or not in header.tpl file. i used {if isset($category)} but it is not working in header.tpl file. please help. thanks. Link to comment Share on other sites More sharing options...
yewster Posted September 19, 2012 Share Posted September 19, 2012 Hi, i want to check category exist or not in header.tpl file. i used {if isset($category)} but it is not working in header.tpl file. please help. thanks. You would need to add a line of code to FrontController.php in classes folder Add this line of code: self::$smarty->assign('category', $this->category); Add it above self::$smarty->display(_PS_THEME_DIR_.'header.tpl'); I would advise you to use the override feature of prestashop to do this modification. 1 Link to comment Share on other sites More sharing options...
rajendra_presta Posted September 20, 2012 Author Share Posted September 20, 2012 thanks, self::$smarty->assign('category', $this->category); is not working. please tell me other option . Link to comment Share on other sites More sharing options...
yewster Posted September 20, 2012 Share Posted September 20, 2012 thanks, self::$smarty->assign('category', $this->category); is not working. please tell me other option . Try adding this to the code if(isset($this->category)) { self::$smarty->assign('category', $this->category); } In header.tpl, insert the code below {if isset($category)} Viewing category {else} Not viewing category {/if} So if you're viewing a category. It will display "Viewing category" and when not viewing category it will display "Not viewing category" Link to comment Share on other sites More sharing options...
rajendra_presta Posted September 22, 2012 Author Share Posted September 22, 2012 Very thanks yewster. Your given code is working but only on category page. But according to my issue it is not helpful.Whatever i am telling you in brief my issue. --------------------- My Product Category Structure - *Cities (root category) * Cheesecakes (sub category) * Cheesecakes1 (product) * Cheesecakes2 (product) * Cheesecakes3 (product) I want to when user come first on site then pop up box will open and then he select one time root category. and then subcategory of select category will show. Thanks in advance. 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