Jump to content

How to display subctegories images ?


Eljaouhari

Recommended Posts

HI everyone, I hope you're having great day

 

I'm on the pos_oregon4 theme and ps 1.7 and I'd like to display subcategories images on the left column of the page.

This is the code I've edited and which does not display images for the subcategories



{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}{$node.desciption}{$node.image.medium.url}</a>
              
            {* The code below does not work *}
            {* The code below does not work *}
            {* The code below does not work *}
            {if $node.image.small.url}
                  <img src="{$node.image.small.url}" alt="{$node.image.legend}">
              {/if}
            
            
            
            
              {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}{$node.description}</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}">
      
      {* The code below is working *}
      {* The code below is working *}
      {* The code below is working *}
    {if $category.image.small.url}
        <div class="category-cover">
          <img src="{$category.image.small.url}" alt="{$category.image.legend}">
        </div>
      {/if}
    {$categories.name}
      {if $category.description}
        <div id="category-description" class="text-muted">{$category.description nofilter}</div>
      {/if}
      </a>
      </li>
    <li class="cat_list">{categories nodes=$categories.children}</li>
  </ul>
</div>

I really need your help !
Thanks in advance.

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...