MrGubu Posted April 29, 2011 Share Posted April 29, 2011 Hello to everybodyI want that the <title> of a product page also shows the category (and subcategorys) of that product.I think that the easiest way to achieve this is to get the breadcrumb and show it in the <title>, but I don't know how to do itCould anybody help me?Thanks Link to comment Share on other sites More sharing options...
jaimemm Posted April 29, 2011 Share Posted April 29, 2011 Hello to everybodyI want that the <title> of a product page also shows the category (and subcategorys) of that product.I think that the easiest way to achieve this is to get the breadcrumb and show it in the <title>, but I don't know how to do itCould anybody help me?Thanks Which version of prestashop 1.4 or earlier?I did something similar for 1.4 but be prepared for touching the core files.Cheers Link to comment Share on other sites More sharing options...
MrGubu Posted April 29, 2011 Author Share Posted April 29, 2011 Which version of prestashop 1.4 or earlier?I did something similar for 1.4 but be prepared for touching the core files.Cheers 1.3.1 Link to comment Share on other sites More sharing options...
jaimemm Posted April 29, 2011 Share Posted April 29, 2011 Any development skills? Link to comment Share on other sites More sharing options...
MrGubu Posted April 29, 2011 Author Share Posted April 29, 2011 yes, php developer level medium Link to comment Share on other sites More sharing options...
jaimemm Posted April 29, 2011 Share Posted April 29, 2011 Make sure you get all the categories till the root level (you probably do not want to display the root title), and make them available in your tplIn classes/Category.php there're 2 key variables for doing that: /** @var integer Parent category ID */ public $id_parent; /** @var integer Parents number */ public $level_depth;Hope it helps Link to comment Share on other sites More sharing options...
MrGubu Posted April 29, 2011 Author Share Posted April 29, 2011 Make sure you get all the categories till the root level (you probably do not want to display the root title), and make them available in your tplIn classes/Category.php there're 2 key variables for doing that: /** @var integer Parent category ID */ public $id_parent; /** @var integer Parents number */ public $level_depth;Hope it helps jaimemm please I need more information: -To start, i don't know the file where the <title> is set.-Which tpl are you talking about?-What I should do with these two variables that are you talking about?Thanks Link to comment Share on other sites More sharing options...
jaimemm Posted April 29, 2011 Share Posted April 29, 2011 -To start, i don’t know the file where the <title> is set.When you say tittle are you talking about the "name" of the category or the SEO "title" for the category?Both are properties of the category.In the tpl (I think is product.tpl), you have to get that variable.-Which tpl are you talking about?I think is product.tpl (copy your theme folders and play around)-What I should do with these two variables that are you talking about?get every level_depth-1 categories ,and put into an array the name of each of themid_parent will be necessary to find the parent category.quickly,something like: counter=0;array names;while counter < level_depth-1 do{ names[counter]=catAux.name;catAux=catAux.getParent(id_parent);counter++;}Hope it helps Link to comment Share on other sites More sharing options...
jeevanoss Posted April 30, 2011 Share Posted April 30, 2011 You can change title in themes/your-theme-dir/header.tpl <title>{$meta_title|escape:'htmlall':'UTF-8'}</title> Link to comment Share on other sites More sharing options...
Recommended Posts