Emenu categories

Greetings,



Does anyone know how to have the categories emenu not pop up the subcategories menu? I would like the customer to click on the root category menu in order to see the subcategory and not have the subcategories pop up if the mouse is hovered over it.



www.paintballave.com



Thanks for your help!

[quote name=‘paintballave’]Greetings,



Does anyone know how to have the categories emenu not pop up the subcategories menu? I would like the customer to click on the root category menu in order to see the subcategory and not have the subcategories pop up if the mouse is hovered over it.



www.paintballave.com



Thanks for your help![/QUOTE]



I am thinking there is a seperate CSS file for the categories menu where you can actually specify the number of levels to display, I will take a peek and see if I can locate this.

[quote name=‘paintballave’]Greetings,



Does anyone know how to have the categories emenu not pop up the subcategories menu? I would like the customer to click on the root category menu in order to see the subcategory and not have the subcategories pop up if the mouse is hovered over it.



www.paintballave.com



Thanks for your help![/QUOTE]

You only need to choose Dynamic in admin…

Well, my template might look a little different than yours because I have mine to only go one sub-category deep, but here is how I would do it.



In skins/basic/customer/views/categories/components/menu_items.tpl



This is my code:


```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 == "0"}

      {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 make this not show any subcategories I would comment out or remove:

    ```php {if $category.subcategories && $category.level == "0"}

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

    {/if} ```

    Like I said, my code might look different, but you should get the idea.

    By the way I got the one sub-category code from here:

    [URL="http://forum.cs-cart.com/showthread.php?t=8037&highlight=sub+categories"]http://forum.cs-cart.com/showthread.php?t=8037&highlight=sub+categories[/URL]

    Brandon

    [quote name=‘brandonvd’]Well, my template might look a little different than yours because I have mine to only go one sub-category deep, but here is how I would do it.



    In skins/basic/customer/views/categories/components/menu_items.tpl



    This is my code:


    ```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 == "0"}

      {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 make this not show any subcategories I would comment out or remove:

    ```php {if $category.subcategories && $category.level == "0"}

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

    {/if} ```

    Like I said, my code might look different, but you should get the idea.

    By the way I got the one sub-category code from here:

    [URL="http://forum.cs-cart.com/showthread.php?t=8037&highlight=sub+categories"]http://forum.cs-cart.com/showthread.php?t=8037&highlight=sub+categories[/URL]

    Brandon[/QUOTE]

    Thanks Brandon. Do you know what I should add or remove if my code for the menu_items.tpl looks 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} {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} ```

    Don’t hold me to it, but I think I would comment out:


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

    {/if}




    Brandon

    Wouldn’t you just change submenu=true to submenu=false

    [quote name=‘Struck’]Wouldn’t you just change submenu=true to submenu=false[/QUOTE]



    I tried both and it does not work. The thing with changing the settings to dynamic menu in admin is that it changes the way thhe menu bar looks. It becomes a list rather than blocks.

    [quote name=‘paintballave’]Greetings,



    Does anyone know how to have the categories emenu not pop up the subcategories menu? I would like the customer to click on the root category menu in order to see the subcategory and not have the subcategories pop up if the mouse is hovered over it.



    www.paintballave.com



    Thanks for your help![/QUOTE]





    From the customer standpoint I think it looks good how you currently have it. However go into your admin panel under appearance and select dynamic instead of emenu.

    Did you try clearing your cache?



    Add &cc to one of your admin url pages

    [quote name=‘Struck’]Did you try clearing your cache?



    Add &cc to one of your admin url pages[/QUOTE]



    Thanks, it doesnt seem to be working even after i did that. What’s weird is now, that if i click on the products page, my categories menu shows as dynamic. I checked my admin and all of my blocks are set to the emenu option.



    [url]http://www.paintballave.com/catalog.html[/url]

    For those saying that he should just select the Dynamic option, that’s not the point.



    I am trying to do the same thing.



    Here’s the reason:



    If you have ever heard of Siloing, then you will know about website structure as it relates to Categories. In the current setup, the search engines actually see a huge abundance of links, to include the Categories & Subcategories, which can really litter your structure when it comes to SEO.



    My intention is to get Google and co. to only see the main category links. Then if the user clicks the Cat. link, they will be taken to the page where all the subcats are located. This is much better where it relates to SEO.



    So if anybody knows how to do this, I would appreciate your advice.



    Thank you.



    Bryan R.

    I figured it out. I just removed this code and it works perfectly:


    {if $category.subcategories}


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

    {/if}






    Bryan Robinson

    [quote name=‘animatedmarketing’]I figured it out. I just removed this code and it works perfectly:


    {if $category.subcategories}


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

    {/if}


    Bryan Robinson[/quote]



    Thanks Bryan! I have been looking for a solution to this myself (for the reasons you stated) but have had no luck. A little too late for me to test tonight but plan on fixing this tomorrow.

    [quote name='animatedmarketing' timestamp='1265441499' post='69738']

    I figured it out. I just removed this code and it works perfectly:


    {if $category.subcategories}


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

    {/if}






    Bryan Robinson

    [/quote]

    Any update on this for 2.1? I tried doing this with no luck. I've been living with it for about a year now and would like to fix if possible.

    So you don't want to display any subcategories, right? If so, replace your skins/your-skin/customer/views/categories/components/menu_items.tpl with:


    ```php {* $Id: menu_items.tpl 9353 2010-05-04 06:10:09Z klerik $ *}

    {strip}

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

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


  • {if $category.subcategories && $category.level < "0"}

      {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} ```

    The part that controls the flyout is:

    ```php if $category.subcategories && $category.level < "0" ```

    Note that it is there twice.

    Whey it is < "0" then no fly out. If it is == "0" then just one level. If it is == "1" then two fly outs.

    I hope that helps,

    Brandon

    Thanks Brandon, that did the trick. Make sure to clear cache to get it to work.

    Has anyone gotten this to work on 3.0.3? I have tried the above code, and can not get it to work. Any help would be greatly appreciated.