Poehnixzz Posted May 16, 2021 Share Posted May 16, 2021 (edited) Hello, I am trying to get the child title from the categories. I already tried this: theme/classic/templates/cms/category.tpl {foreach from=$sub_categories item=sub_category} <li class="col-md-3"> <a href="{$sub_category.link}"><h2>{$sub_category.name}</h2></a> {foreach from=CMS::getCMSPages({$cookie->id_lang|intval},{$sub_category.id_cms_category},true) item=cmspages} <p> <a href="{$link->getCMSLink($cmspages.id_cms, $cmspages.link_rewrite)|escape:'htmlall':'UTF-8'}"> {$cmspages.meta_title|escape:'htmlall':'UTF-8'} </a> </p> {/foreach} </li> {/foreach} The link is showing correctly, but when I want to get the name out of the url, it is not working. PrestaShop version: 1.7.6.9 Edited November 10, 2021 by Poehnixzz (see edit history) Link to comment Share on other sites More sharing options...
Poehnixzz Posted May 19, 2021 Author Share Posted May 19, 2021 No one has a solution to this? I want te sub pages from the categorie show on the page. Link to comment Share on other sites More sharing options...
Poehnixzz Posted May 23, 2021 Author Share Posted May 23, 2021 I solved this issue! I added this to classes/Tools.php public static function getCMSTitle($id_cms,$id_lang){ $cms = new CMS($id_cms, $id_lang); return $cms->meta_title; } Then you can call this in the category.tpl <a href="{$link->getCMSLink(1)}">{Tools::getCMSTitle(1,$cookie->id_lang)}</a> Bron: https://toniravsadhu.wordpress.com/2014/02/27/prestashop-how-can-i-get-a-cms-page-title-in-a-tpltemplate-file/ 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