The idea here is simple. Prestashop displays "Category Tree" module all the time. Even if we are browsing the last sub-sub-sub...category and there's only 1 item to display.

This is what I mean:

So the quest now is to change it to this:

In other words: to hide the Category Tree module if there's only 1 item.

How to hide the module?

Open this file:
/your_theme/modules/ps_categorytree/views/templates/hook/ps_categorytree.tpl

Find this piece of code:

<div class="block-categories hidden-sm-down">
  <ul class="category-top-menu">
    <li><a class="text-uppercase h6" href="{$categories.link nofilter}">{$categories.name}</a></li>
    <li>{categories nodes=$categories.children}</li>
  </ul>
</div>

And change it to this:

{if isset($nodes) && ($nodes|count > 1)}
<div class="block-categories hidden-sm-down">
  <ul class="category-top-menu">
    <li><a class="text-uppercase h6" href="{$categories.link nofilter}">{$categories.name}</a></li>
    <li>{categories nodes=$categories.children}</li>
  </ul>
</div>
{/if}

And that is it! :)


Andrej Staš

Andrej is a Prestashop enthusiast. He started by developing his own themes and then formed the idea of creating Theme Maker. He enjoys finding ways to make his life simpler, and that is the philosophy he incorporates into all his projects. Andrej is also interested in WordPress, Amazon FBA, drop shipping, studying languages, and reading books.

No Comments

Post your comment