Hi

I setup some categories for my site, with sub-categories. However, when I got to a main category page like:

taxonomy/term/45

It only shows nodes that are published as that category, and not the nodes that are in the sub-category under it. How do I make all they nodes with in a category (and sub-categories) show up on one page?

Thanks!

Comments

Sic-1’s picture

I'd go as far as to say it's CRAP
Plus, the integration with the views module is even worse. (try to filter on category term)

novon’s picture

Please help - this is the only thing that's holding my site back from going live...

Thanks

hsalazar’s picture

novon:

You're already on the right path. To show the nodes belonging to a term you use:

taxonomy/term/x -- where x is the term id to show, a number.

However, to show children nodes you need to add a depth variable. The syntax is:

taxonomy/term/x/y -- where x is the term id to show, and y is the depth to go below x.

An example will explain this better. Let's assume you have a structure such as this:

America (tid=1)
--Canada (tid=3)
--United States (tid=4)
----Texas (tid=9)
------Amarillo (tid=11)
------Austin (tid=12)
----California (tid=10)
------San Diego (tid=13)
------Los Angeles (tid=14)
--México (tid=5)
Europe (tid=2)
--France (tid=7)
--Spain (tid=8)... and so on...

If you use taxonomy/term/1, you'll see only entries catalogued under America (tid=1), but not its children.

If you use taxonomy/term/4/1, you'll see entries for United States (tid=4) and its children to a depth of one; that is, you'll see entries catalogued under Texas (tid=9) and California (tid=10).

If you use taxonomy/term/4/2, you'll see entries for United States (tid=4) and its children to a depth of two; that is, you'll see entries catalogued under Texas (tid=9) and California (tid=10) [this is the first level of depth], but also entries catalogued under Amarillo (tid=11), Austin(tid=12), San Diego(tid=13) and Los Angeles(tid=14).

In other words, if you need to see all the children, just make sure to specify enough depth.

Hope this helps.

hsalazar

novon’s picture

I have pathauto setup - would that affect it?

I have a structure like this:

Dogs (taxonomy/term/45/)
-Breeds taxonomy/term/74/
--(node)

I changed taxonomy/term/45/ to taxonomy/term/45/5

but still the nodes that's under Breeds doesn't show either directly at taxonomy/term/45/5 or through the pathauto alias.

Please advise...

adrienf’s picture

hsalazar,

I used your method and it works in a classic usage. I used it in a view, so I defined an argument to this view (Taxonomy: Term ID) with an option equals to '1' (this is the depth you were talking about). One more time, it works... BUT I finally wanted to sort this view by Taxonomy name (Taxonomy: Term Name), and it unfortunately doesn't work.

Indeed, if I put the argument in my URL (http://mysite/en/myview/myargument), results are not sorted, but if I remove this argument (http://mysite/en/myview) and specify to display all values if argument is not provided, results are well sorted. So, the sorting argument seems to not be taken into account if argument is provided.

I hope my explanations are clear enough...
Do you have any idea about this issue?

Thx in advance

venkat-rk’s picture

Here's what you want. No need to fiddle with clumsy urls:
http://drupal.org/node/41349#comment-145632

But please read the whole thread to be sure it's the same as what you are asking. And if you choose to edit taxonomy.module, please remember the change as it is a core module.

novon’s picture

Hi

I tried the hack you mentioned, but it doesn't work either. I have multiple heiarchy set in categories. Don't know what else it could be that's causing it not to show the sub-nodes. Any help would be appreciated.

I'm using Drupal 5.1 if that helps.

Thanks

PRFB’s picture

I followed http://drupal.org/node/41349#comment-145632, and it worked like a charm on my 5.1 site
But as it says there, if you use Taxonomy_Breadcrumbs, you need to tweak that module instead

gkanski’s picture

taxonomy/term/45/all should work as you expect

rockgeek’s picture

What if I the URLs were in the shape of:

http://www.site.com/festivals/advice

Making it into: http://www.site.com/festivals/advice/all wouldn't show anything

Any further help?

Mark Vincent Verallo’s picture

Exactly, that is what I am trying to achieve also, anybody could help?

lukesideris’s picture

For anyone else who finds this old post: I achieved this using pathauto.

shihabukp’s picture

yes its works for me..thanks

navykat’s picture

I was having the same problem and came to the forums for help, which is how I found your question. And none of the suggestions worked for me either.

I then accidentally stumbled upon a solution. It's inelegant, but it works. Depending on how many child nodes you have, this may work for you too.

For your example:

Dogs (taxonomy/term/45/)
-Breeds taxonomy/term/74/
--(node)

To show both "Dogs" and "Breeds" on the same page, the url would be:

/?q=taxonomy/term/45+74

Summit’s picture

Hi,

Can you also only show childterms on a page with using only the parent term tid in the url?

greetings,
Martijn

Rameez’s picture

Force parent term to show child term nodes? i'm using drupal 6.15, any idea how to implement it?

RaulMuroc’s picture

I am trying different alternatives as well and nothing.

It looks like if Drupal did not expect to show child terms, just parent terms.

Drupal Association individual member

ajayg’s picture

You can do this using views.
Using Views argument, choose taxonomy Term id with depth as argument type. and then decide how far you want to go to include children. E.g Choosing 1 goes to 1 level deep etc.
And then pass this argument to your view and see all the children are automatically included.

This works for showing nodes belonging to child terms (based on a node view)
I still haven't figured how to show children terms only.

agira’s picture

This solution works fine!

rogeriodec’s picture

I was trying to use the hidden built-in view "taxonomy_term (default) " and it was working just for the last level.
I just changed the "depth" to 3 (in my case) in the Term-ID argument and it worked!
Thank you very much!

WilliamB’s picture

Any way to get this to work for Drupal 7 without using view?

nklsf’s picture

+1

elgandoz’s picture

I'm looking for the same feature, possibly without using view, because i used some fields (old cck) in taxonomy like any other content-type (formatted with the powerful display suite). These fields have to appear on the page, before listing the categorized nodes (a sort of category description). I didn't find a way to replicate this behavior with views.

elgandoz’s picture

I finally find a way. A good developer did this awesome module Taxonomy_display for a precise control.
You have to activate, the module, then go to taxonomy -> [your vocab] -> Manage display -> and then follow the short instructions to apply the display properties. You can use "core" display or an override.
Then go to views, clone the "taxonomy_term" view, and then delete only the page visualization (if not it will override the taxonomy display - PS: I suggest to set views options in manner to always see "master" view) and obviously change the Contextual filter "taxonomy term ID (with depth)" according to your needs.
Come back to taxonomy -> [your vocab] -> Manage display -> taxonomy page and then choose your master view and voila, you have your precise customized taxonomy.

SunnyGambino’s picture

Nice shot! This is my solution also! :)

stef266’s picture

Hello!! I now it's an old post but I need to do the same thing... I don't understand very well what should I do. I've installed the module but I don't understand well what should I do next. Please can you tell me step by step?
Thank you in advice!

artatac’s picture

If running d7 got to views and enable the one that emulates this built in function. Then go to filter anfpd replace with taxonomy with depth 2

stef266’s picture

Thank you very much!! It was my mistake. The depth was set to - not to +. Now everythnig works perfect. Great! Thank you.

fweiss’s picture

Worked GREAT!