1

OK, so I have my product in Drupal Commerce basically sorted by two major taxonomies - Sport and Product Category.

What I want to do is set up a view that prints out the available product categories for a particular sport (i.e. if a product has a particular sport associated with it, then sort through that list and find what product categories are available for that sport).

I have the view somewhat figured out - but it keeps giving me repeats of the product category, where I only want a particular product category name to show up once.

For instance, if I search for the sport 'Football' - I get a list that looks like this: - Balls & Tees - Shirts - Balls & Tees - Balls & Tees - Pads - Shirts - Shoes etc. . .

What I want is for those duplicates to be removed (so Balls & Tees only show up once).

In my current view, I have it set up to return fields of content - with the Taxonomy name of Product Category as my only field.

I have a conditional filter of the parameter set.

I do have a relationship set of Content: Taxonomy terms on node.

I tried using aggregation DISTINCT option, but that doesn't seem to help.

I have looked through this topic -https://drupal.org/node/1200536#comment-4957410 - but I am not sure if its related or not.

Any ideas?

0

Did you build your view based on nodes or on taxonomy terms? (https://drupal.org/node/770782)

I think a taxonomy terms based view is the preferred way. Maybe you already did this.

1) add a new view of view type "term" (not the default "node" option!) by ticking the correct option after clicking 'add view'

2) add the Taxonomy Term to the list of Fields

3) Add a relationship "Taxonomy: Node" and make it obligatory

4) In the basic settings enable the 'distinct' option.

5) Add some filters to narrow the results as needed.

When setting filters you can try to use a contextual filter Term-ID with a default value set from the node page, only from the term list sports. You will also need to set a normal filter with term list product category.

  • Yes, as soon as I asked this question - I updated my view to check taxonomy terms instead of content, and I got the result I was looking for. I was going to post my response, but you beat me to it! – Waterskier19 Feb 20 '14 at 16:16

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.