Jump to content

How to display the description for each subctegory ?


Eljaouhari

Recommended Posts

Helo everyone,

i'm trying to display the description of the subcategories on the ps_categorytree module (of course not a classic theme).

Here's the non-edited code of the module



{function name="categories" nodes=[] depth=0}
  {strip}
    {if $nodes|count}
      <ul class="category-sub-menu">
        {foreach from=$nodes item=node}
          <li data-depth="{$depth}">
            {if $depth===0}
              <a href="{$node.link}">{$node.name}</a>
              {if $node.children}
                <div class="navbar-toggler collapse-icons" data-toggle="collapse" data-target="#exCollapsingNavbar{$node.id}">
                  <i class="ion-ios-arrow-right add"></i>
                  <i class="ion-ios-arrow-down remove"></i>
                </div>
                <div class="collapse" id="exCollapsingNavbar{$node.id}">
                  {categories nodes=$node.children depth=$depth+1}
                </div>
              {/if}
            {else}
              <a class="category-sub-link" href="{$node.link}">{$node.name}</a>
              {if $node.children}
                <span class="arrows" data-toggle="collapse" data-target="#exCollapsingNavbar{$node.id}">
                  <i class="ion-ios-arrow-right"></i>
                  <i class="ion-ios-arrow-down"></i>
                </span>
                <div class="collapse" id="exCollapsingNavbar{$node.id}">
                  {categories nodes=$node.children depth=$depth+1}
                </div>
              {/if}
            {/if}
          </li>
        {/foreach}
      </ul>
    {/if}
  {/strip}
{/function}

<div class="block-categories">
  <ul class="category-top-menu">
    <li class="cat_header"><a href="{$categories.link nofilter}">{$categories.name}</a></li>
    <li class="cat_list">{categories nodes=$categories.children}</li>
  </ul>
</div>

And I've tried to add this code

{if $node.description}
<div id="category-description" class="text-muted">{$node.description nofilter}</div>
{/if}

After this line

              <a href="{$node.link}">{$node.name}</a>

It doesn't work... I've tried to add the code into multiple places but it just doesn't work either.

I need your help!

Thanks a lot !

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...