1

I can't get taxonomy menu links working properly with contextual arguments in Views.

This is what I have done:

0) I create a menu called: Catalog menu

1) I create a Vocabulary called: Catalog terms and in the Taxonomy menu area I set Catalog menu for the Menu location (I have Taxonomy menu module enabled which allow me to do this)

2) I the Catalog vocabulary I added 2 terms: Cars and Phones

3) In admin/config/search/path/patterns I set Pattern for all Catálogo taxonomy paths to catalog/[term:name]

4) In admin/structure/block I enable the Catalog menu block to the First sidebar

So far so good. I have a menu in my first sidebar with the links: cars and phones.

5) I have a content type called Products with a field of the type Term reference called: field_catalog

6) Now I create a new view called: Catalog view where I need to show Products which has an specific term in the url. The path of this view is catalog

7) I added a RELATIONSHIP called: Content (field_catalog)

8) I added a CONTEXTUAL FILTERS called Taxonomy term: Name using the previous relationship

Now if I enter "cars" in the Auto preview Preview with contextual filters: area it works fine. It only shows products that has cars term.

So the Catalog Menus is fine and the view is fine.

But if I go to the url www.mysite.com/en/catalog/cars it takes me to the list of content that has the temr cars. Here I need to show the Catalog view passing cars as an argument and not that list.

  • Slightly off topic but I like how you started your ordered list with 0. – Lester Peabody Feb 2 '12 at 14:37
2

You have made one mistake that is easy to make. The alias created in the menu doesn't change the "true" url. So when you go to catalog/cars Drupal will perceive that as taxonomy/term/[tid].

What you could do instead is to enable the default taxonomy term view that ships with Views (which uses taxonomy/term/[tid] as the path) and then set it up like you want.

See Screen shot: Views page

  • I don't get it. Could you please explain how to do it? Where do I do these changes? – chefnelone Feb 2 '12 at 15:19
  • IN the list of available views you will find one with the taxonomy/term/% path. that is the one you want to enable and create your view in. – Ashlar Feb 2 '12 at 17:45
  • Thanks what you said is useful, but I will try a different approach. I will create a view listing terms as a html list, so that I'll get the menu as a block. – chefnelone Feb 2 '12 at 19:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.