Depth of Categories Box

Hi All,



Could any of the gurus and experts please point me out How to limit the depth of sub-categories go?



What I mean is the “Categories” box which slides the sub-categories out when mouse-over. I want it to end at level 2 or 3 even I have 5 levels of sub-cats.



Many thanks in advance.



Andrew

Take a look at brandondvd’s solution:



[url]http://forum.cs-cart.com/showthread.php?t=13579&highlight=categories+level[/url]

Thanks nedd. Brandon’s solution help a bit to set to One-Level of sub-cat, but I need 2 or 3 levels.



I have tried to edit Brandon’s code but have no luck. Thanks for pointing me there anyway.



Any further hints would be highly appreciated.

Ok, I think I’ve had the problem solved. Inspired from Brandon’s post.



Here is the solution in case any of you need to do the same. Just make the contents of the file “/skins/YOUR_SKIN_NAME/customer/views/categories/components/menu_item.tpl” to look like this

```php

{* $Id: menu_items.tpl 6971 2009-03-05 09:28:18Z zeke $ *}

{strip}

{assign var=“foreach_name” value=“cats_$cid”}

{foreach from=$items item=“category” name=$foreach_name}


  • {if $category.subcategories && $category.level != "2"}

      {include file="views/categories/components/menu_items.tpl" items=$category.subcategories separated=true submenu=true cid=$category.category_id}

    {/if}
    {$category.category}

  • {if $separated && !$smarty.foreach.$foreach_name.last}

  • {/if}
    {/foreach}
    {/strip} ```

    To change the level you want the menu to display change the $category.level != "2" to match your needs. E.g. to show 3 sub-cat levels, make the line look like
    ```php {if $category.subcategories && $category.level != "3"} ```

    Hope this help all others.

    Thanks for posting the solution. I’m sure this will go a long way towards helping someone else.

    This seems to disable the background icons on the menu…any idea why?