Jump to content

[SOLVED] Show CMS Category Title on each CMS Page


Recommended Posts

  • 2 weeks later...

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'));
  • Like 1
Link to comment
Share on other sites

 

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

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

  • 5 months later...
  • 10 months later...

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...