Jump to content

Recommended Posts

Есть меню категорий с подкатегориями

 

 

{* Рекурсивная функция вывода дерева категорий *}
{function name=categories_tree}
  {if $categories}
  <ul>
    {foreach $categories as $c}
    {* Показываем только видимые категории *}
    {if $c->visible}
    <li>
      <a href="catalog/{$c->url}" data-category="{$c->id}">{$c->name}</a>
      {if $c->subcategories}
      <ul>
        {foreach $c->subcategories as $cat}
        {if $cat->visible}
        <li>
          <a href="catalog/{$cat->url}" data-category="{$cat->id}">
          {if $cat->image}<img src="{$config->categories_images_dir}{$cat->image}" alt="{$cat->name}">{/if}
          {$cat->name}</a>
        </li>
        {/if}             
        {/foreach}
      </ul>
      {/if}
    </li>
    {/if}
    {/foreach}
  </ul>
  {/if}
{/function}
{categories_tree categories=$categories} 
 

 

 

Как вывести подкатегории подкатегорий - 3-4 уровень вложености?

Edited by Nikolas
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...