Duckett Posted August 20, 2014 Share Posted August 20, 2014 (edited) Hi there!! I'm trying to display the title of the cms category (parent) on each CMS Page with no luck... I'm completely lost, I've tried everything! I'm using Prestashop 1.6.0.6, can somebody help me? Thanks in advance!! Edited September 6, 2014 by vekia (see edit history) Link to comment Share on other sites More sharing options...
dogsmart Posted August 29, 2014 Share Posted August 29, 2014 I have the same Problem. (1.6.0.9). Someone any ideas? Link to comment Share on other sites More sharing options...
vekia Posted August 29, 2014 Share Posted August 29, 2014 you have to add parent category variable to initContent function (to smarty array) public function initContent() { parent::initContent(); $parent_cat = new CMSCategory(1, $this->context->language->id); $this->context->smarty->assign('id_current_lang', $this->context->language->id); $this->context->smarty->assign('home_title', $parent_cat->name); $this->context->smarty->assign('cgv_id', Configuration::get('PS_CONDITIONS_CMS_ID')); 1 Link to comment Share on other sites More sharing options...
dogsmart Posted August 29, 2014 Share Posted August 29, 2014 you have to add parent category variable to initContent function (to smarty array) public function initContent() { parent::initContent(); $parent_cat = new CMSCategory(1, $this->context->language->id); $this->context->smarty->assign('id_current_lang', $this->context->language->id); $this->context->smarty->assign('home_title', $parent_cat->name); $this->context->smarty->assign('cgv_id', Configuration::get('PS_CONDITIONS_CMS_ID')); Thanks for your help. Where i have to add or edit this code? Link to comment Share on other sites More sharing options...
vekia Posted August 30, 2014 Share Posted August 30, 2014 file: /controllers/front/cmsController.php after code that i mentioned before, add this: $this->context->smarty->assign('parent',new CMSCategory(1, $this->cms->id_cms_category)); then in cms.tpl (themes/default-bootstrap/cms.tpl) you can use: {$parent->name} Link to comment Share on other sites More sharing options...
dogsmart Posted September 5, 2014 Share Posted September 5, 2014 Great that Works Do you know the variable i have to call in cms.tpl to show the CMS Page title? I tried a lot but with no effect. Link to comment Share on other sites More sharing options...
dogsmart Posted September 5, 2014 Share Posted September 5, 2014 I got the solution. Just call {$cms->meta_title} in cms.tpl Link to comment Share on other sites More sharing options...
vekia Posted September 6, 2014 Share Posted September 6, 2014 thank you for confirmation that it works also thanks for your variable related to meta title :-) i marked topic title as solved with regards, Milos Link to comment Share on other sites More sharing options...
vincent.jeandet Posted February 13, 2015 Share Posted February 13, 2015 Hi, I made this manipulation but not working for me. I'm on prestashop 1.6.0.11 Thank you for your help. Link to comment Share on other sites More sharing options...
Centaure Posted January 8, 2016 Share Posted January 8, 2016 Bonjour j'aimerai faire quelque chose de rapprochant avec ce qui est dit ici ... j'aimerai comparer la catégorie parente de la page CMS en cours avec la catégorie des block CMS afin d'afficher uniquement le block CMS associé à la page CMS en cous je ne comprends pas d'ailleurs pourquoi cela ne fonctionne pas directement comme cela ... je ne vois pas comment faire merci par avance pour votre aide --- Hello I'd like to do something closer to what is said here ... I'd like to compare the parent category of CMS current page with CMS block category to display only the CMS block associated with the current CMS page I do not understand also why it does not work directly as ... I do not see how thank you in advance for your help 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