{if not $fromCache}
   {$topMenuLimit = $cfg.topMenuLimit|default:4}

   {foreach $categories|array_slice:0:$topMenuLimit as $item}
      <li class="nav-item nav-item-{$item.id} {if $item.submenu}has-submenu{/if}">
         <a href="{url s=category IDcat=$item.id}" class="nav-link">
            {$item.title_short}
         </a>

         {if $item.submenu}
            <div class="submenu">
               <div class="submenu-wrapper">
                  {if $item.id == 1} {* Za ženske *}
                     {insert_products type="campaign_product" campaign="PW" in_store=1 image=2 count=1 template="block.products.topmenu.tpl"
                     catalog_class="col-md-3 col-sm-6" variations=true random=1 action_name="{t}Akční cena{/t}"}
                  {elseif $item.id == 2} {* Za moške *}
                     {insert_products type="campaign_product" campaign="PM" in_store=1 image=2 count=1 template="block.products.topmenu.tpl"
                     catalog_class="col-md-3 col-sm-6" variations=true random=1 action_name="{t}Akční cena{/t}"}
                  {elseif $item.id == 4} {* Za otroke *}
                     {insert_products type="campaign_product" campaign="PK" in_store=1 image=2 count=1 template="block.products.topmenu.tpl"
                     catalog_class="col-md-3 col-sm-6" variations=true random=1 action_name="{t}Akční cena{/t}"}
                  {/if}

                  <ul class="menu-list-2">
                     {foreach array_slice($item.submenu, 0, 5) as $subitem}
                        {if $subitem.virtual == "Y" or ($item.id == 2 and $subitem@index == 4)}{continue}{/if} {* nezobrazovat VK a darkove poukazy *}
                        <li class="menu-item">
                           <a href="{url s=category IDcat=$subitem.id}" class="menu-link">{$subitem.title_short}</a>

                           {if $subitem.submenu}
                              <ul class="menu-list-3">
                                 {foreach array_slice($subitem.submenu, 0, 5) as $subsubitem}
                                    <li class="menu-item">
                                       <a href="{url s=category IDcat=$subsubitem.id}"
                                          class="menu-link">{$subsubitem.title_short}</a>
                                    </li>
                                 {/foreach}
                              </ul>
                              <a href="{url s=category IDcat=$subitem.id}"
                                 class="btn btn-link">{t}Celý sortiment{/t}</a>
                           {/if}

                        </li>
                     {/foreach}
                  </ul>

                  <div class="brands">
                     {block "topmenu-brands-slider"}
                        {if $item.id == 1} {* Za ženske *}
                           {insert_slider id=9 template="block.slider.topsections_brands.tpl"}
                        {elseif $item.id == 2} {* Za moške *}
                           {insert_slider id=10 template="block.slider.topsections_brands.tpl"}
                        {elseif $item.id == 4} {* Za otroke *}
                           {insert_slider id=11 template="block.slider.topsections_brands.tpl"}
                        {/if}
                     {/block}
                  </div>
               </div>
            </div>
         {/if}
      </li>
   {/foreach}
{else}
   <script>
      wpj.onReady.push(function() {
         {if $selection}
         {foreach $selection as $item}
         $(".nav-item-{$item}").addClass('active');
         {/foreach}
         {/if}
         {if $ctrl.currUrl.Rel == "/"}
         $('.nav-item.home').addClass('active');
         {/if}
      });
   </script>
{/if}
