Here is the scenario. I have a vocabulary attached to a content type. Only one term can be selected to categorize a node made with this content type. The vocabulary is called Vehicles and has terms 'cars, trucks, boats.' The content type is also named Vehicles.

I use path auto so that it shows [vocabulary:name]/[term:name] so when rendered it will show site.com/vehicles/trucks, for example, which will show all the trucks... typical Drupal stuff.. Ok...

Now, I have a View that is a page with a path 'vehicles.' It is setup to to display all of the items of content type 'vehicles.' This page view is also setup to take an argument 'taxonomy term id.'

Note that when the taxonomy term is present, the url alias generated for the taxonomy path is the exact same as as the Views page with an argument supplied:

URL Aliased taxonomy path = vehicles/trucks.
Views page with argument = vehicles/trucks.

This is on purpose. My goal was to show all results of that content type when an argument was not present, and when it was present, it would most importantly filter the results based on that taxonomy term AND keep the same fields and structure as without the argument (same as site.com/vehicles).

The problem is, this is not working as expected.
site.com/vehicles correctly shows my view and related filters.
site.com/vehicles/trucks shows just the regular, unformated taxonomy list supplied by Drupal.

Is this because Taxonomy term ID argument is not configured correctly?

Is this a weight issue where taxonomy hooks are firing after Views? If so, how can I rearrange the weights here so that it fires correctly and gives me the results I need?

I know what you are going to suggest - that Views comes with taxonomy/term/% view to override drupal default views.

However, this is not going to work in my case. I have multiple content types each with its own vocabulary and each with its on view and distinct set of fields (houses and cars, for example have very different field sets). The taxonomy/term/% would work if all content types had the same fields, then I could just mimic those in that override, but since that is not the case, how can I correctly get my path with argument to show the results based on that vocabulary term and keep my field structure?

Sorry if that was confusing. A link to the site for reference http://www.buyagainbaby.com. The site does currently use taxonomy/term/% as an override, but again, that has to change so that each view is responsible for how it renders its result set based on taxonomy.

Thanks!

Comments

Yaazkal’s picture

Hello, I have the same issue. Have you find a solution?

Can anyone tell us how can we solve this?

Thanks !

Gastonia’s picture

I did find a solution yes. I answered my own question on the stack exchange. It is an interesting thread with many solutions, so here is a link if you would like to follow along.

http://drupal.stackexchange.com/questions/27682/how-do-i-override-a-taxo...

My response was the last answer. For convenience though, I will reprint it here.

I found a solution that works great for my situation, and I will share that in case it may help you guys too.

As I explained above, the my problem was that my view, with no argument, supplied the results I wanted, but the default taxonomy view with an argument, which was not what I wanted.

To solve this, I installed the module Taxonomy Display http://drupal.org/project/taxonomy_display. I then reconfigured each view to have Taxonomy Term ID as an argument.

Taxonomy display lets you associate a vocabulary with a particular view. Now, when I click on vehicles/trucks, which is an alias for taxonomy/term/3, the view takes over and this is actually rendered correctly maintaining the integrity of the field structure.

hope this helps!

end user’s picture

Normally what I've done is set up the view and use in Contextual Filters > Content: Has taxonomy term ID (with depth) > Provide Default Value > Taxonomy Term ID from URL

Now I insert that view/block into a region or custom region and it should display all nodes related to the term that you are visiting. Just set the visibility for that block to which paths you want it to show.

Babu Ankaian’s picture

Contextual Filters > Content: Has taxonomy term ID (with depth) > Provide Default Value > Taxonomy Term ID from URL

I am using provide default value in contextual filter. its working fine

Rizwan Siddiquee’s picture

set your page path to

/taxonomy/term/% instead of
/categories/%
and

Configure contextual filter: Content: Has taxonomy term ID

turpentyne’s picture

disregard. Posted a comment on the wrong conversation.