Papaya Posted March 17, 2010 Share Posted March 17, 2010 Hope someone can help me...I just want to create a page like this: http://www.wowo.fr/97-20-eurosIf I go to Shoes I want to find this: Shoes: Running Boots Heels and not go to the Shoes category and see the other categories too! -Shoes: Running Boots Heels -T-shirt -Skirt How can I do this?Thanks! Link to comment Share on other sites More sharing options...
rocky Posted March 18, 2010 Share Posted March 18, 2010 Try changing lines 9-13 of modules/blockcategories/blockcategories.tpl from: {if $smarty.foreach.blockCategTree.last} {include file=$branche_tpl_path node=$child last='true'} {else} {include file=$branche_tpl_path node=$child} {/if} to: {if $smarty.foreach.blockCategTree.last} {include file=$branche_tpl_path node=$child depth=1 last='true'} {else} {include file=$branche_tpl_path node=$child depth=1} {/if} then change modules/blockcategories/category-tree-branch.tpl to: > {assign var='childSelected' value='0'} {foreach from=$node.children item=child}{if $child.id == $smarty.get.id_category}{assign var='childSelected' value='1'}{/if}{/foreach} {if $page_name != 'category' OR $depth != 1 OR $node.id == $smarty.get.id_category OR $childSelected} {$node.name|escape:html:'UTF-8'} {if $node.children|@count > 0} </pre> <ul> {foreach from=$node.children item=child name=categoryTreeBranch} {if $smarty.foreach.categoryTreeBranch.last} {include file=$tpl_dir./category-tree-branch.tpl node=$child depth=$depth+1 last='true'} {else} {include file=$tpl_dir./category-tree-branch.tpl node=$child depth=$depth+1 last='false'} {/if} {/foreach} </ul> <br> {/if}<br><br>{/if This should do what you want as long as the category depth is no more than 2. 1 Link to comment Share on other sites More sharing options...
Papaya Posted March 18, 2010 Author Share Posted March 18, 2010 Thanks Rocky!!!This is what I want!!!!! I have already tried and it works!!!!Thank you so much Rocky!!! Link to comment Share on other sites More sharing options...
BillyD Posted April 1, 2010 Share Posted April 1, 2010 Thanks your subcategory fix is working well, however when I click on a product in a subcategory, the product.php page loads and I loose my "subcategory only" listing from the Category Block? Link to comment Share on other sites More sharing options...
sandipk Posted July 4, 2010 Share Posted July 4, 2010 Thanks your subcategory fix is working well, however when I click on a product in a subcategory, the product.php page loads and I loose my “subcategory only” listing from the Category Block? Link to comment Share on other sites More sharing options...
nilady Posted July 15, 2010 Share Posted July 15, 2010 how about if when clicks one of the category : example accessoris-earing and the view is all the product in list without see the categories again, how to do it? Link to comment Share on other sites More sharing options...
imsocial Posted July 21, 2010 Share Posted July 21, 2010 Im sorry to bring up an old thread. But like the previous 2 comments have said. This only works in the category page. How would I get it to keep the same format in the product page and others?Thanks Link to comment Share on other sites More sharing options...
mel- Posted September 9, 2010 Share Posted September 9, 2010 I couldn't get this to work at all. the theme I have is using a dhtml menu. is that why? I am using 1.3. thanks. Link to comment Share on other sites More sharing options...
johny2k Posted September 30, 2010 Share Posted September 30, 2010 Dear Rocky, sorry for head up this issue again. Because I have been try the solution as you provide, then I still found that it still have some problem.1. When I click the main categories mobile phone (picture cate01.jpg), then left column categories place will show Mobile Phone > BlackBerry & HTC. (picture cate01.jpg)2. When I click the sub categorie which Mobile Phone > BlackBerry (picture cate02.jpg), then left column categories will only show Categories Mobile Phone, no more show as Mobile Phone > BlackBerry & HTC (picture cate03.jpg).Hope you can provide help again, thanks a lot Rocky. Regards,John Link to comment Share on other sites More sharing options...
rocky Posted September 30, 2010 Share Posted September 30, 2010 My AJAX Sliding Categories module has the option to display just the subcategories of the current category and has many more options. It is hard to justify sifting through my code and extracting just the part that does this. Link to comment Share on other sites More sharing options...
pldtm Posted December 2, 2010 Share Posted December 2, 2010 hi rocky,your solution works fine for me, but i have just one question.Is it possible to have the option to hide all categories when they are not selected (for example when you are on the homepage no categories are selected and so no categories have to be visible.thanks a lotpldtm Link to comment Share on other sites More sharing options...
rocky Posted December 3, 2010 Share Posted December 3, 2010 You could add code like the following to the top of modules/blockcategoriesnc/blockcategoriesnc.tpl: {if $page_name != 'index'} and the following at the bottom: {/if} This will hide the category block altogether on the homepage. Link to comment Share on other sites More sharing options...
Don Camillo Posted February 16, 2011 Share Posted February 16, 2011 Hi, I asked my question in a different post, but I think you guys know what to do... PLEASE HELP!When I take the steps as written on page 1, I have this, for example;(Categoryblock1):boxershortsboxershorts Aboxershorts Bboxershorts C(+)t-shirts: t-shirt A, t-shirt B, t-shirt C (<-- subcategory with ID as used in step 4 of page1, permanently visable. And unfolding when clicking in Category2. I want this not showing up here, only in category2block).boxershort Dboxershort E(Categoryblock2):t-shirtst-shirt At-shirt Bt-shirt CAs you can see my second categoriesblock appears also as a subcategory in between other products in category1.I tried a lot of ways, but this is the only way I can get it done. How can I just make 2 categories; cat.1 for only product A, and cat.2 for only product B. (not showing B at A)?Can anyone help me please? I tried everything I know, maybe its in the php files?Thanks in advance!Grtz, Don C. Link to comment Share on other sites More sharing options...
tip98 Posted August 20, 2011 Share Posted August 20, 2011 (edited) @rocky thanks for help! Your post http://www.prestashop.com/forums/topic/48033-solved-categories/page__view__findpost__p__321549 is great and it helped me much. But there is one little issue related more to this forum than to your code. Code snippet in this forum is stripping your code from ul's and li's html tags so sometimes is hard to understand it for the first time. One more thing: when I go to product page all categories are visible like in standard blockcategories. It is possible to get same effect in product page like in category and product-list pages? edit: I've figured it out myself. I've changed: {foreach from=$node.children item=child}{if $child.id == $smarty.get.id_category}{assign var='childSelected' value='1'}{/if}{/foreach} {if $page_name != 'category' OR $depth != 1 OR $node.id == $smarty.get.id_category OR $childSelected} to {foreach from=$node.children item=child}{if $child.id == $currentCategoryId}{assign var='childSelected' value='1'}{/if}{/foreach} {if $depth != 1 OR $node.id == $currentCategoryId OR $childSelected} and now itis working both in categories and in product pages. btw I'm using v 1.3.1 Edited August 21, 2011 by tip98 (see edit history) Link to comment Share on other sites More sharing options...
andresdez Posted September 18, 2011 Share Posted September 18, 2011 Sorry, but I don't know how to proceed to change the category-tree-branc.tpl. Actually I am using the version 1.4 and the code inside is: <li {if isset($last) && $last == 'true'}class="last"{/if}> <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> {if $node.children|@count > 0} <ul> {foreach from=$node.children item=child name=categoryTreeBranch} {if isset($smarty.foreach.categoryTreeBranch) && $smarty.foreach.categoryTreeBranch.last} {include file="$branche_tpl_path" node=$child last='true'} {else} {include file="$branche_tpl_path" node=$child last='false'} {/if} {/foreach} </ul> {/if} </li> I replace this code by the one you write, and it doesn't work...I am doing something wrong? Thanks in advance Link to comment Share on other sites More sharing options...
[email protected] Posted September 21, 2011 Share Posted September 21, 2011 Hi Rocky, thanks for u r continuous support for the new users in Prestashop, Iam very new to prestashop and am using version 1.4.1 now i have an issue regarding displaying the categories, the thing is that i want to display only active Category (the one i have selected) and its Subcategories in my page and other categories should not be displayed is that possible and please brief me all the steps in respective files to do the needed changes that will help me a lot. Anil Bangalore Link to comment Share on other sites More sharing options...
rob84 Posted October 27, 2011 Share Posted October 27, 2011 I have a problem with a 3th level category: a > b > c > product list . When I click on "c" category, simply disappear all categories, nothing are loaded. Can someone help for that ? Otherwise great mod. Thanks, Robert Link to comment Share on other sites More sharing options...
dawb Posted November 23, 2011 Share Posted November 23, 2011 Hi, I have managed to get this working in 1.5 by replacing file=$tpl_dir./category-tree-branch.tpl with file="$branche_tpl_path", but am having issues where if you are on the product page it displays all subcategories it belongs to eg: cat 1 - sub cat 1 - sub cat 2 cat 2 -sub cat1 Does anyone know how to resolve this? Also having an issue where the menu is not showing at all if you are on one of the sub category pages. Thanks for your help Link to comment Share on other sites More sharing options...
maricarmen Posted February 28, 2012 Share Posted February 28, 2012 Hi, File code "category-tree-branch.tpl" for version 1.4, how would it be? Thanks Link to comment Share on other sites More sharing options...
luconelucone Posted April 19, 2012 Share Posted April 19, 2012 I have a problem with a 3th level category: a > b > c > product list . When I click on "c" category, simply disappear all categories, nothing are loaded. Can someone help for that ? Otherwise great mod. Thanks, Robert Hi, have you find a solution?? I have the same problem! I try to set max depth, but it doesn't work! Help! Link to comment Share on other sites More sharing options...
luconelucone Posted April 20, 2012 Share Posted April 20, 2012 The problem is here: {assign var='childSelected' value='0'} {foreach from=$node.children item=child}{if $child.id == $currentCategoryId}{assign var='childSelected' value='1'}{/if}{/foreach} {if $depth != 1 OR $node.id == $currentCategoryId OR $childSelected} It check only if in sucategories there is a category with the current category id, but if the current category is is the sub-subcategory it doesn't work!! I try this {foreach from=$node.children item=child}{if $child.id == $currentCategoryId}{assign var='childSelected' value='1'} {else}{foreach from=$node.children item=child}{if $child.id == $currentCategoryId}{assign var='childSelected' value='1'}bb{/if}{/foreach} {/if}{/foreach} {if $depth != 1 OR $node.id == $currentCategoryId OR $childSelected==1} but it doesn't work! Have you idea?? Link to comment Share on other sites More sharing options...
Nozonda Posted April 20, 2012 Share Posted April 20, 2012 (edited) Today I'm working on a shop that has a top menu (blocktopmenu) with the categories. The menu on the left (blockcategories) should show only the subcategories (or only the main categories on the homepage and information pages.) Example, these are the categories: -Shoes: Running Boots Heels -T-shirt Blue Red Yellow What I wanted for this shop: On the home page it would show: Shoes, T-shirt And when you go to Shoes it would show: Running, Boots, Heels And when you go to Boots it would still show: Running, Boots, Heels So I changed my category-tree-branch.tpl, here is my code: /themes/theme-name/modules/blockcategories/category-tree-branch.tpl {assign var="show_child" value="false"} {if !isset($currentCategoryId)} <li {if isset($last) && $last == 'true'}class="last"{/if}> <a href="{$node.link}" title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> </li> {/if} {if isset($currentCategoryId) && ($node.id == $currentCategoryId)} {assign var="show_child" value="true"} {/if} {if $node.children|@count > 0} {foreach from=$node.children item=child name=categoryTreeBranch} {if isset($currentCategoryId) && ($child.id == $currentCategoryId)} {assign var="show_child" value="true"} {/if} {/foreach} {/if} {if $show_child == 'true'} {if $node.children|@count > 0} {foreach from=$node.children item=child name=categoryTreeBranch} {if isset($smarty.foreach.categoryTreeBranch) && $smarty.foreach.categoryTreeBranch.last} {include file="$branche_tpl_path" node=$child show='true' last='true'} {else} {include file="$branche_tpl_path" node=$child show='true' last='false'} {/if} {/foreach} {if $child.children|@count > 0} {foreach from=$child.children item=child2 name=categoryTreeBranch2} {if isset($currentCategoryId) && ($child2.id == $currentCategoryId)} {assign var="show_child" value="true"} {/if} {/foreach} {/if} {/if} {/if} {if isset($show)} <li {if isset($last) && $last == 'true'}class="last"{/if}> <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> {if $node.children|@count > 0} <ul> {foreach from=$node.children item=child name=categoryTreeBranch} {if isset($smarty.foreach.categoryTreeBranch) && $smarty.foreach.categoryTreeBranch.last} {include file="$branche_tpl_path" node=$child show='true' last='true'} {else} {include file="$branche_tpl_path" node=$child show='true' last='false'} {/if} {/foreach} </ul> {/if} </li> {/if} Not sure if this example is what you guys want, but I though I will just share it. Also perhaps this code is not optiomal, but at least it works for me Edited December 5, 2012 by Nozonda (see edit history) Link to comment Share on other sites More sharing options...
otiz Posted November 27, 2012 Share Posted November 27, 2012 If you want more depth: edit category-tree-branch.tpl {foreach from=$node.children item=child} {if $child.id == $smarty.get.id_category} {assign var='childSelected' value='1'} {/if} {foreach from=$child.children item=child2} {if $child2.id == $smarty.get.id_category} {assign var='childSelected' value='1'} {/if} {foreach from=$child2.children item=child3} {if $child3.id == $smarty.get.id_category} {assign var='childSelected' value='1'} {/if} {/foreach} {/foreach} {/foreach} Link to comment Share on other sites More sharing options...
nimaesalehi Posted December 26, 2012 Share Posted December 26, 2012 Any body knows how to make changes of html tags in first node of category lists in top menu? top menu Module / blocktopmenu.php line:645 // filter the categories that the user is allowed to see and browse if (!empty($is_intersected)) { if(count($children)){ $this->_menu .= '<dd id="4" '.$selected.'>'; $this->_menu .= '<a href="'.$category_link.'">'.$category->name.'</a>';} else{$this->_menu .= '<li class="medb" id="9" '.$selected.'>'; $this->_menu .= '<a class="norm five area-christmas" href="'.$category_link.'">'.$category->name.'</a>';} if (count($children)) { if($node.children){ $this->_menu .= '<li id="10">'; foreach ($children as $child) $this->getCategory((int)$child['id_category'], (int)$id_lang, (int)$child['id_shop']); $this->_menu .= '</li>';} else if($show_child == 'true'){$this->_menu .= '<dl>'; foreach ($children as $child) $this->getCategory((int)$child['id_category'], (int)$id_lang, (int)$child['id_shop']); $this->_menu .= '</dl>';} } if($node.children){$this->_menu .= '</dd>';} else{$this->_menu .= '</li>';} } line:684 if (count($categories) || count($pages)) { $this->_menu .= '<dl class="1">'; foreach ($categories as $category) { $this->_menu .= '<dd id="1" >'; $this->_menu .= '<a id="1" href="#">'.$category['name'].'</a>'; $this->getCMSMenuItems($category['id_cms_category'], (int)$depth + 1); $this->_menu .= '</dd>'; } foreach ($pages as $page) { $cms = new CMS($page['id_cms'], (int)$id_lang); $links = $cms->getLinks((int)$id_lang, array((int)$cms->id)); $selected = ($this->page_name == 'cms' && ((int)Tools::getValue('id_cms') == $page['id_cms'])) ? ' class="sfHoverForce"' : ''; $this->_menu .= '<dd id="2" '.$selected.'>'; $this->_menu .= '<a id="2" href="'.$links[0]['link'].'">'.$cms->meta_title.'</a>'; $this->_menu .= '</dd>'; } $this->_menu .= '</ul>'; }; line: Link to comment Share on other sites More sharing options...
nimaesalehi Posted December 26, 2012 Share Posted December 26, 2012 if (!empty($is_intersected)) { if (false){ } else{ $this->_menu .= '<li class="medb" id="3" '.$selected.'>'; $this->_menu .= '<a class="norm five area-christmas" href="'.$category_link.'">'.$category->name.'</a>'; } if (count($children)) { $this->_menu .= '<dl>'; foreach ($children as $child) $this->getCategory((int)$child['id_category'], (int)$id_lang, (int)$child['id_shop']); $this->_menu .= '</dl>'; } if(false){ } else{ $this->_menu .= '</li>'; } } Link to comment Share on other sites More sharing options...
nimaesalehi Posted December 26, 2012 Share Posted December 26, 2012 (edited) Any body knows how to add proper condition for if that contains false condition in this code to apply changes only for first node of categories? (!empty($is_intersected)) { if (false){ $this->_menu .= '<dd id="3" '.$selected.'>'; $this->_menu .= '<a href="'.$category_link.'">'.$category->name.'</a>'; } else{ $this->_menu .= '<li class="medb" id="3" '.$selected.'>'; $this->_menu .= '<a class="norm five area-christmas" href="'.$category_link.'">'.$category->name.'</a>'; } if (count($children)) { $this->_menu .= '<dl>'; foreach ($children as $child) $this->getCategory((int)$child['id_category'], (int)$id_lang, (int)$child['id_shop']); $this->_menu .= '</dl>'; } if(false){ $this->_menu .= '</dd>'; } else{ $this->_menu .= '</li>'; } } Edited December 26, 2012 by nimaesalehi (see edit history) Link to comment Share on other sites More sharing options...
builders Posted January 25, 2013 Share Posted January 25, 2013 Today I'm working on a shop that has a top menu (blocktopmenu) with the categories. The menu on the left (blockcategories) should show only the subcategories (or only the main categories on the homepage and information pages.) Example, these are the categories: -Shoes: Running Boots Heels -T-shirt Blue Red Yellow What I wanted for this shop: On the home page it would show: Shoes, T-shirt And when you go to Shoes it would show: Running, Boots, Heels And when you go to Boots it would still show: Running, Boots, Heels So I changed my category-tree-branch.tpl, here is my code: /themes/theme-name/modules/blockcategories/category-tree-branch.tpl {assign var="show_child" value="false"} {if !isset($currentCategoryId)} <li {if isset($last) && $last == 'true'}class="last"{/if}> <a href="{$node.link}" title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> </li> {/if} {if isset($currentCategoryId) && ($node.id == $currentCategoryId)} {assign var="show_child" value="true"} {/if} {if $node.children|@count > 0} {foreach from=$node.children item=child name=categoryTreeBranch} {if isset($currentCategoryId) && ($child.id == $currentCategoryId)} {assign var="show_child" value="true"} {/if} {/foreach} {/if} {if $show_child == 'true'} {if $node.children|@count > 0} {foreach from=$node.children item=child name=categoryTreeBranch} {if isset($smarty.foreach.categoryTreeBranch) && $smarty.foreach.categoryTreeBranch.last} {include file="$branche_tpl_path" node=$child show='true' last='true'} {else} {include file="$branche_tpl_path" node=$child show='true' last='false'} {/if} {/foreach} {if $child.children|@count > 0} {foreach from=$child.children item=child2 name=categoryTreeBranch2} {if isset($currentCategoryId) && ($child2.id == $currentCategoryId)} {assign var="show_child" value="true"} {/if} {/foreach} {/if} {/if} {/if} {if isset($show)} <li {if isset($last) && $last == 'true'}class="last"{/if}> <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> {if $node.children|@count > 0} <ul> {foreach from=$node.children item=child name=categoryTreeBranch} {if isset($smarty.foreach.categoryTreeBranch) && $smarty.foreach.categoryTreeBranch.last} {include file="$branche_tpl_path" node=$child show='true' last='true'} {else} {include file="$branche_tpl_path" node=$child show='true' last='false'} {/if} {/foreach} </ul> {/if} </li> {/if} Not sure if this example is what you guys want, but I though I will just share it. Also perhaps this code is not optiomal, but at least it works for me That Worked BUT only with first level categories !!! When i navigate at subcategory i would like to show ONLY the Sub-subcategories at the left and instead i get again the whole tree. Can you help me on that ?? Thanks 1 Link to comment Share on other sites More sharing options...
Supermanzo Posted February 13, 2013 Share Posted February 13, 2013 (edited) I tried following what is written in this post to have hints on how to accomplish this: on 1.5.3.1 block categories i'm trying to show only level 1 category and related subcategories example: home --shoes -----runners -----boots --clothes -----shirts -----pants when i'm inside shoes i want only to see shoes and related subcategories and not clothes or other categories at the same level as shoes. When i'm in a subcategory (lvl2) i want to see only the parent category (lvl1 parent cat (shoes)) and the others subcategory at the same level (lvl2(runner,boots)). Can anyone help me on how to do it? Thanks Edited February 13, 2013 by Supermanzo (see edit history) 1 Link to comment Share on other sites More sharing options...
Claudio DiSouza Posted April 4, 2013 Share Posted April 4, 2013 Today I'm working on a shop that has a top menu (blocktopmenu) with the categories. The menu on the left (blockcategories) should show only the subcategories (or only the main categories on the homepage and information pages.) Example, these are the categories: -Shoes: Running Boots Heels -T-shirt Blue Red Yellow What I wanted for this shop: On the home page it would show: Shoes, T-shirt And when you go to Shoes it would show: Running, Boots, Heels And when you go to Boots it would still show: Running, Boots, Heels So I changed my category-tree-branch.tpl, here is my code: /themes/theme-name/modules/blockcategories/category-tree-branch.tpl {assign var="show_child" value="false"} {if !isset($currentCategoryId)} <li {if isset($last) && $last == 'true'}class="last"{/if}> <a href="{$node.link}" title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> </li> {/if} {if isset($currentCategoryId) && ($node.id == $currentCategoryId)} {assign var="show_child" value="true"} {/if} {if $node.children|@count > 0} {foreach from=$node.children item=child name=categoryTreeBranch} {if isset($currentCategoryId) && ($child.id == $currentCategoryId)} {assign var="show_child" value="true"} {/if} {/foreach} {/if} {if $show_child == 'true'} {if $node.children|@count > 0} {foreach from=$node.children item=child name=categoryTreeBranch} {if isset($smarty.foreach.categoryTreeBranch) && $smarty.foreach.categoryTreeBranch.last} {include file="$branche_tpl_path" node=$child show='true' last='true'} {else} {include file="$branche_tpl_path" node=$child show='true' last='false'} {/if} {/foreach} {if $child.children|@count > 0} {foreach from=$child.children item=child2 name=categoryTreeBranch2} {if isset($currentCategoryId) && ($child2.id == $currentCategoryId)} {assign var="show_child" value="true"} {/if} {/foreach} {/if} {/if} {/if} {if isset($show)} <li {if isset($last) && $last == 'true'}class="last"{/if}> <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> {if $node.children|@count > 0} <ul> {foreach from=$node.children item=child name=categoryTreeBranch} {if isset($smarty.foreach.categoryTreeBranch) && $smarty.foreach.categoryTreeBranch.last} {include file="$branche_tpl_path" node=$child show='true' last='true'} {else} {include file="$branche_tpl_path" node=$child show='true' last='false'} {/if} {/foreach} </ul> {/if} </li> {/if} Not sure if this example is what you guys want, but I though I will just share it. Also perhaps this code is not optiomal, but at least it works for me Another version of this code... PLEASE HELP US... http://pastebin.com/0ZPJsMaz Link to comment Share on other sites More sharing options...
neller Posted August 28, 2013 Share Posted August 28, 2013 Is there any way of getting the blockcategories to display when you are deeper than 3 categories? I have added this slightly modded code from above; {assign var="show_child" value="false"} {if !isset($currentCategoryId)} <li {if isset($last) && $last == 'true'}class="last"{/if}> <a href="{$node.link}" title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> </li> {/if} {if isset($currentCategoryId) && ($node.id == $currentCategoryId)} {assign var="show_child" value="true"} {/if} {if $node.children|@count > 0} {foreach from=$node.children item=child name=categoryTreeBranch} {if isset($currentCategoryId) && ($child.id == $currentCategoryId)} {assign var="show_child" value="true"} {/if} {/foreach} {/if} {if $show_child == 'true'} {if $node.children|@count > 0} {foreach from=$node.children item=child name=categoryTreeBranch} {if isset($smarty.foreach.categoryTreeBranch) && $smarty.foreach.categoryTreeBranch.last} {else} {include file="$branche_tpl_path" node=$child show='true' last='false'} {/if} {/foreach} {if $child.children|@count > 0} {foreach from=$child.children item=child2 name=categoryTreeBranch2} {if isset($currentCategoryId) && ($child2.id == $currentCategoryId)} {assign var="show_child" value="true"} {/if} {/foreach} {/if} {/if} {/if} {if isset($show)} <li {if isset($last) && $last == 'true'}class="last"{/if}> <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> {if $node.children|@count > 0} <ul> {foreach from=$node.children item=child name=categoryTreeBranch} {if isset($smarty.foreach.categoryTreeBranch) && $smarty.foreach.categoryTreeBranch.last} {include file="$branche_tpl_path" node=$child show='true' last='true'} {else} {/if} {/foreach} </ul> {/if} </li> {/if} But when I am navigating to a 3rd level category, the block is empty. I need it to return the sub categories from where ever the user is. I have set the configuration to a maximum depth of 0 (infinate), 3,4,5,6 etc. but nothing was displaying. on level 1 and 2, this works fine. Any pointers to what might be missing? Link to comment Share on other sites More sharing options...
kevin78 Posted January 2, 2014 Share Posted January 2, 2014 does it work on 1.5.4 ? Link to comment Share on other sites More sharing options...
pherson Posted April 12, 2014 Share Posted April 12, 2014 Today I'm working on a shop that has a top menu (blocktopmenu) with the categories. The menu on the left (blockcategories) should show only the subcategories (or only the main categories on the homepage and information pages.) Example, these are the categories: -Shoes: Running Boots Heels -T-shirt Blue Red YellowWhat I wanted for this shop: On the home page it would show: Shoes, T-shirt And when you go to Shoes it would show: Running, Boots, Heels And when you go to Boots it would still show: Running, Boots, Heels So I changed my category-tree-branch.tpl, here is my code: /themes/theme-name/modules/blockcategories/category-tree-branch.tpl {assign var="show_child" value="false"} {if !isset($currentCategoryId)} <li {if isset($last) && $last == 'true'}class="last"{/if}> <a href="{$node.link}" title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a> </li> {/if} {if isset($currentCategoryId) && ($node.id == $currentCategoryId)} {assign var="show_child" value="true"} {/if} {if $node.children|@count > 0} {foreach from=$node.children item=child name=categoryTreeBranch} {if isset($currentCategoryId) && ($child.id == $currentCategoryId)} {assign var="show_child" value="true"} {/if} {/foreach} {/if} {if $show_child == 'true'} {if $node.children|@count > 0} {foreach from=$node.children item=child name=categoryTreeBranch} {if isset($smarty.foreach.categoryTreeBranch) && $smarty.foreach.categoryTreeBranch.last} {include file="$branche_tpl_path" node=$child show='true' last='true'} {else} {include file="$branche_tpl_path" node=$child show='true' last='false'} {/if} {/foreach} {if $child.children|@count > 0} {foreach from=$child.children item=child2 name=categoryTreeBranch2} {if isset($currentCategoryId) && ($child2.id == $currentCategoryId)} {assign var="show_child" value="true"} {/if} {/foreach} {/if} {/if} {/if} {if isset($show)} <li {if isset($last) && $last == 'true'}class="last"{/if}> <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> {if $node.children|@count > 0} <ul> {foreach from=$node.children item=child name=categoryTreeBranch} {if isset($smarty.foreach.categoryTreeBranch) && $smarty.foreach.categoryTreeBranch.last} {include file="$branche_tpl_path" node=$child show='true' last='true'} {else} {include file="$branche_tpl_path" node=$child show='true' last='false'} {/if} {/foreach} </ul> {/if} </li> {/if}Not sure if this example is what you guys want, but I though I will just share it. Also perhaps this code is not optiomal, but at least it works for me Thank you, your code works correctly, a greeting! Tested on prestashop 1.6.0.5! Link to comment Share on other sites More sharing options...
diabolus Posted June 11, 2014 Share Posted June 11, 2014 Hi All Have a question how to add manufacturers menu to categories ? is this posiible in Prestashop 1.6 regards 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