Jump to content

Categoryblock with subcategories


ande85

Recommended Posts

Hi,
We want to add subcategories to our webshop and present them in the categoryblock. We want the subcategory to be presented att the same li level as the main category but we want it to use another css class. How can this be done?

The code in category-tree-bransch.tpl look like this:


{$node.name|escape:html:'UTF-8'}
{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 last='true'}
    {else}
    {include file="$branche_tpl_path" node=$child last='false'}
    {/if}
    {/foreach}

{/if}


Hope you understand what i want to do and thanks for your answer if you have any suggestions on how this can be done.
Link to comment
Share on other sites

  • 2 weeks later...

Replace module->blockcategory->category-tree-branch.tpl code with this new one

here is two class associated with the li either last or last-vivek through which you can differentiate you custom css

 

 

<li {if isset($last) && $last == 'true'}class="last-vivek"{else}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}

	{foreach from=$node.children item=child name=categoryTreeBranch}
		{if isset($smarty.foreach.categoryTreeBranch) && $smarty.foreach.categoryTreeBranch.last}
			{include file="$branche_tpl_path" node=$child parr=$node.name last='true'}
		{else}
			{include file="$branche_tpl_path" node=$child parr=$child.name last='false'}
		{/if}
	{/foreach}

{/if}

</li>

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...