Jump to content

Category tree depth in custom page


mayid
 Share

Recommended Posts

I'm using the categories tree to display a catalog in a custom page (catalogo.php). The code i'm using is the one in blockcategories (i have a special hook to display it in catalogo.php, but nevermind that).

I need to list the subcategories of each category. Problem is that i have a three levels tree, so the code separates my subcategories in more parts that what i'd wish. I mean, i just need to show the category name and all it's depth.

Isn't there something like $node.parents? All i want is a good conditional for the else clause:

{if $node.children|@count == 0}





   {$node.name|escape:html:'UTF-8'}


   {else}

{$node.name}

   {/if}

Share this post


Link to post
Share on other sites

  • 2 weeks later...

I solved this by defining more information for the nodes. Now it works like this:

{if $node.children|@count == 0 || $node.parent != 1}

And the trick was adding this to the getTree array (in the php file):
'parent' => $resultIds[$id_category]['id_parent']);

So, now i have a catalogue, separated by main categories and not by second level categories.

Cheers!

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More