Jump to content

Category tree support sub-category when on sub-category product list


Recommended Posts

For some reason, when I go into a sub-category's product_list the tree branch does not show and the currently selected category is not detected. How can this be changed to work, I'm suspecting that the line: 

isset($currentCategoryId) && $node.id == $currentCategoryId

Is returning false.

 

 

The currently template_files.

 

blockcategories.tpl

<!-- Block categories module -->
<nav id="categories_block_left" class="block">
	<p class="title_block">{l s='Categories' mod='blockcategories'}</p>
	<div class="block_content">
		<ul class="tree">
		{foreach from=$blockCategTree.children item=child name=blockCategTree}
			{include file="$branche_tpl_path" node=$child last='true'}
		{/foreach}
		</ul>
	</div>
</nav>
<!-- /Block categories module -->

Category-tree-branch.tpl

<li {if isset($currentCategoryId) && $node.id == $currentCategoryId}class="selected"{/if}>
	<a href="{$node.link|escape:'htmlall':'UTF-8'}"
		title="{$node.desc|strip_tags|trim|escape:'htmlall':'UTF-8'}">{$node.name|escape:'htmlall':'UTF-8'}</a>
	{if $node.children|@count > 0 && isset($currentCategoryId) && $node.id == $currentCategoryId}
		<ul>
		{foreach from=$node.children item=child name=categoryTreeBranch}
			{if $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>

Many thanks. This is something I thought would be natively supported.

Edited by stefandunn (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...