X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   2nd Level Categories Menu (https://forum.x-cart.com/showthread.php?t=67758)

Wazowski 09-13-2013 05:10 PM

2nd Level Categories Menu
 
Hi all!

I have a flyout (not tree-like) menu on the website. How doI make it to show items starting with 2nd level categories?

For example, now it shows this:
- level 1 > level 2 > level 3
- - - - - - -> level 2
- - - - - - -> level 2 > level 3

I want it to skip the first parent category so it wouldbe:
level 2 > level 3
level 2
level 2 > level 3


Thanks!
X-cart 4.5.5

DrQuietus 01-02-2014 02:11 AM

Re: 2nd Level Categories Menu
 
I have been trying to do this as well. With no success. Any Help?

DrQuietus 01-02-2014 06:28 AM

Re: 2nd Level Categories Menu
 
I figured it out.

I have the second and all following levels showing based on the current location being a top level category, in this case "Seals" or "Hose and Fittings". Also in the code below when a person is not in a Seals or Hose and Fittings category, the menu will just show the root categories. This is using the fancy flyout menu template.

You will also need to go into webmaster mode, and get the main categories child's array number from the {$categories_menu_list} and place it where the below template has $categories_menu_list.1.childs.


Code:

{if $location[1].0 == "Seals"}

{if $level == "0"}
  {assign var="cats" value=$categories_menu_list.1.childs}
{/if}
{assign var="loop_name" value="subcat`$parentid`"}
<ul class="fancycat-icons-level-{$level}">
  {assign var="loop_name" value="subcat`$parentid`"}
  {foreach from=$cats item=c key=catid name=$loop_name}
    <li{interline name=$loop_name} style="z-index: {$smarty.foreach.$loop_name.total|dec:$smarty.foreach.$loop_name.iteration|inc:1|inc:1001};"> 
      {strip}
      <a href="home.php?cat={$catid}" class="{if $config.Flyout_Menus.icons_icons_in_categories gte $level+1}icon-link{/if}{if $config.Flyout_Menus.icons_disable_subcat_triangle eq 'Y' and $c.subcategory_count gt 0} sub-link{/if}{if $config.Flyout_Menus.icons_empty_category_vis eq 'Y' and not $c.childs and not $c.product_count} empty-link{/if}{if $config.Flyout_Menus.icons_nowrap_category ne 'Y'} nowrap-link{/if}">
        {if $config.Flyout_Menus.icons_icons_in_categories gte $level+1 and $c.is_icon}
          <img src="{$c.thumb_url|amp}" alt="" width="{$c.thumb_x}" height="{$c.thumb_y}" />
        {/if}
        {$c.category|amp}
        {if $config.Flyout_Menus.icons_display_products_cnt eq 'Y' and $c.top_product_count gt 0}
          ({$c.top_product_count})
        {/if}
      </a>
      {/strip}
      {if $c.childs}
        {include file="`$fc_skin_path`/fancy_subcategories.tpl" cats=$c.childs parentid=$catid level=$level+1}
      {/if}
    </li>
  {/foreach}
</ul>

{elseif  $location[1].0 == "Hose and Fittings"}

{if $level == "0"}
  {assign var="cats" value=$categories_menu_list.1886.childs}
{/if}
<ul class="fancycat-icons-level-{$level}">
  {assign var="loop_name" value="subcat`$parentid`"}
  {foreach from=$cats item=c key=catid name=$loop_name}
    <li{interline name=$loop_name} style="z-index: {$smarty.foreach.$loop_name.total|dec:$smarty.foreach.$loop_name.iteration|inc:1|inc:1001};"> 
      {strip}
      <a href="home.php?cat={$catid}" class="{if $config.Flyout_Menus.icons_icons_in_categories gte $level+1}icon-link{/if}{if $config.Flyout_Menus.icons_disable_subcat_triangle eq 'Y' and $c.subcategory_count gt 0} sub-link{/if}{if $config.Flyout_Menus.icons_empty_category_vis eq 'Y' and not $c.childs and not $c.product_count} empty-link{/if}{if $config.Flyout_Menus.icons_nowrap_category ne 'Y'} nowrap-link{/if}">
        {if $config.Flyout_Menus.icons_icons_in_categories gte $level+1 and $c.is_icon}
          <img src="{$c.thumb_url|amp}" alt="" width="{$c.thumb_x}" height="{$c.thumb_y}" />
        {/if}
        {$c.category|amp}
        {if $config.Flyout_Menus.icons_display_products_cnt eq 'Y' and $c.top_product_count gt 0}
          ({$c.top_product_count})
        {/if}
      </a>
      {/strip}
      {if $c.childs and $c.subcategory_count gt 0 and ($config.Flyout_Menus.icons_levels_limit eq 0 or $config.Flyout_Menus.icons_levels_limit gt $level)}
        {include file="`$fc_skin_path`/fancy_subcategories.tpl" cats=$c.childs parentid=$catid level=$level+1}
      {/if}
    </li>
  {/foreach}
</ul>

{else}

<ul class="fancycat-icons-level-{$level}">
  {assign var="loop_name" value="subcat`$parentid`"}
  {foreach from=$categories_menu_list item=c key=catid name=$loop_name}
    <li{interline name=$loop_name} style="z-index: {$smarty.foreach.$loop_name.total|dec:$smarty.foreach.$loop_name.iteration|inc:1|inc:1001};"> 
      {strip}
      <a href="home.php?cat={$catid}" class="{if $config.Flyout_Menus.icons_icons_in_categories gte $level+1}icon-link{/if}{if $config.Flyout_Menus.icons_disable_subcat_triangle eq 'Y' and $c.subcategory_count gt 0} sub-link{/if}{if $config.Flyout_Menus.icons_empty_category_vis eq 'Y' and not $c.childs and not $c.product_count} empty-link{/if}{if $config.Flyout_Menus.icons_nowrap_category ne 'Y'} nowrap-link{/if}">
        {if $config.Flyout_Menus.icons_icons_in_categories gte $level+1 and $c.is_icon}
          <img src="{$c.thumb_url|amp}" alt="" width="{$c.thumb_x}" height="{$c.thumb_y}" />
        {/if}
        {$c.category|amp}
        {if $config.Flyout_Menus.icons_display_products_cnt eq 'Y' and $c.top_product_count gt 0}
          ({$c.top_product_count})
        {/if}
      </a>
      {/strip}
    </li>
  {/foreach}
</ul>
{/if}



All times are GMT -8. The time now is 11:15 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.