BeamerInTilburg.nl Posted May 22, 2012 Share Posted May 22, 2012 Hi, The title (alt) in my category tree links are now showing the category description (which is quite long). I want to show the meta description instead. I (guess I) know which files I have to edit: modules/blockcategories/blockcategories.php public function getTree($resultParents, $resultIds, $maxDepth, $id_category = 1, $currentDepth = 0) { global $link; $children = array(); if (isset($resultParents[$id_category]) AND sizeof($resultParents[$id_category]) AND ($maxDepth == 0 OR $currentDepth < $maxDepth)) foreach ($resultParents[$id_category] as $subcat) $children[] = $this->getTree($resultParents, $resultIds, $maxDepth, $subcat['id_category'], $currentDepth + 1); if (!isset($resultIds[$id_category])) return false; return array('id' => $id_category, 'link' => $link->getCategoryLink($id_category, $resultIds[$id_category]['link_rewrite']), 'name' => $resultIds[$id_category]['name'], 'desc'=> $resultIds[$id_category]['description'], 'children' => $children); } modules/blockcategories/category-tree-branch.tpl <a href="{$node.link}" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> I kinda understand the code, however I lack the skill of adding new features. Can someone help to let the function getTree also return the category's meta description? Thanks! Link to comment Share on other sites More sharing options...
BeamerInTilburg.nl Posted May 26, 2012 Author Share Posted May 26, 2012 (edited) Anyone? Seems to me like an important feature, which should be as default in Prestashop? This is what you want for SEO, right? Edited May 26, 2012 by dries863 (see edit history) Link to comment Share on other sites More sharing options...
feroca Posted May 1, 2013 Share Posted May 1, 2013 Any solution to this question...? It's hard to find out there... Help will be appreciated. Thanks a lot. Link to comment Share on other sites More sharing options...
DelaneySecure Posted October 6, 2013 Share Posted October 6, 2013 Anyone? I've found '$node.title' or '$node.desc' but I cannot work out how to get the meta description value to come through in category-tree-branch.tpl. Would we get penalised for duplicate content on 2 pages if we use $node.desc? Link to comment Share on other sites More sharing options...
vkmaxx Posted August 20, 2018 Share Posted August 20, 2018 (edited) I'm testing a solution for this meta title -> category link problem on this gift shop. If it will be OK I will post solution (just give me 2 days). Edited August 20, 2018 by vkmaxx (see edit history) Link to comment Share on other sites More sharing options...
vkmaxx Posted August 23, 2018 Share Posted August 23, 2018 OK, in blockcategories.php you need to change: if (isset($resultIds[$id_category])) { $link = $this->context->link->getCategoryLink($id_category, $resultIds[$id_category]['link_rewrite']); $name = $resultIds[$id_category]['name']; $desc = $resultIds[$id_category]['description']; } else $link = $name = $desc = ''; $return = array( 'id' => $id_category, 'link' => $link, 'name' => $name, 'desc'=> $desc, 'children' => $children ); return $return; to if (isset($resultIds[$id_category])) { $link = $this->context->link->getCategoryLink($id_category, $resultIds[$id_category]['link_rewrite']); $name = $resultIds[$id_category]['name']; $desc = $resultIds[$id_category]['description']; $meta = ("" == $resultIds[$id_category]['meta_title']) ? $resultIds[$id_category]['name'] : $resultIds[$id_category]['meta_title']; } else $link = $name = $desc = $meta = ''; $return = array( 'id' => $id_category, 'link' => $link, 'name' => $name, 'desc'=> $desc, 'children' => $children, 'meta' => $meta ); return $return; then SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite to SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite, cl.meta_title and finaly in category-tree-branch.tpl from <a href="{$node.link|escape:'html':'UTF-8'}"{if isset($currentCategoryId) && $node.id == $currentCategoryId} class="selected"{/if} title="{$node.desc|strip_tags|trim|truncate:255:'...'|escape:'html':'UTF-8'}"> {$node.name|escape:'html':'UTF-8'} </a> to <a href="{$node.link|escape:'html':'UTF-8'}" {if isset($currentCategoryId) && $node.id == $currentCategoryId}class="selected"{/if} title="{$node.meta|escape:'html':'UTF-8'}">{$node.name|escape:'html':'UTF-8'}</a> More details in Polish are available here on my blog. Best Regards! Link to comment Share on other sites More sharing options...
Guest Posted August 27, 2018 Share Posted August 27, 2018 Then why are you posting in the ENGLISH section? 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