Jump to content

Make parent categories selected on menu


Recommended Posts

Hi!

I'm using PS version 1.3.5 with ddsmoothmenu created by Marghoob Suleman ()link here

I've tried, with no success, to highlight the parent category buttons with a ".selected" class (I want that when the user clicks the 3rd level button, that button become selected as well as the related 2nd and 1st levels).

I'm using the following code in "category-tree-branch.tpl", which highlights the 3rd level, but not the others:

>



        
       {if $node.id == $currentCategoryId} class="selected"
       {elseif $node.id == $currentParentId || $node.id == $currentRootId} class="previousselected"{/if}

       >{$node.name|escape:htmlall:'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 last='true'}
           {else}
                       {include file=$tpl_dir./category-tree-branch.tpl node=$child last='false'}
           {/if}
       {/foreach}
</ul>
<br>   {/if}<br><br


Note: I'm higlighting not the "a" tag itself but a "span" inside.

I guess the problem is in the second line of this:

{if $node.id == $currentCategoryId} class="selected"
       {elseif $node.id == $currentParentId || $node.id == $currentRootId} class="previousselected"{/if}



Can anybody help me with this problem?

Thanks.

Link to comment
Share on other sites

  • 1 year later...

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...