Active tab for top menu

{if $category.category_id == $smarty.session.current_category_id} cm-active{/if}



that works fine as expected, but how can you set the active status for the menu when a sub category is selected?



Anyone have any ideas?

which version are you using? I think 2.1.1 already solved the problem.

I’m having these same issues.



I have 4 tabs for product ranges, I need to have the top menu tab highlight when the user is in that category or any subcategory. Does anyone have any idea how to do this?



I’ve tried everything I can think of and can’t find anything that helps so far in the forums, this should be so simple.



Thanks





Lee

I’m having these same issues.



I have 4 tabs for product ranges, I need to have the top menu tab highlight when the user is in that category or any subcategory. Does anyone have any idea how to do this?



I’ve tried everything I can think of and can’t find anything that helps so far in the forums, this should be so simple.



I know how to highlight for all categories etc, and how to show for pages



Also I do not want to use drop down menus, just take users to the top level category



This did not seem to work for me even on the top level, never mind subcategories



{if $category.category_id == $smarty.session.current_category_id} cm-active{/if}





What I really need is something like this, but looking for the menu id compared to the root category ID



This is available in the breadcrumbs, can anyone help pulling out the second item only from the array?





Thanks





Lee

it seems hard to make this function out

Has anybody got this working? or Is any willing to create a commercial addon to accomplish this? That will be great.



Recap: The question is how to keep “cm-active” class in the top menu when browsing sub-categories.


  1. Normally, if you leave “Activate menu tab for” in blank, the categories links created in the top menu will work fine, but if you go into any subcategory, the “cm-active” tab is lost. You loose sense of were you are in the website.


  2. If instead of leave the option blank, you add “categories.view, subcategories.view” then it will work, but only for one category and their subcategories. But other categories will not get highlighted.



    Any ideas how to make it work?. Keeping an active highlighted top menu category will improve navigation.



    This is the part in the top_menu.tpl file (cs 2.1.4) :

```php {if $top_menu}


{strip}

    {foreach from=$top_menu item="m"}

  • {$m.item}
    {if $m.subitems}
    {include file="top_menu.tpl" items=$m.subitems top_menu="" dir=$m.param_4}
    {/if}

  • {/foreach}

{/strip}
```

Thank in advance.