Community

how to work with taxonomy exposed filters?

Hi all,

Although very well familiar with Drupal for years I am unable to tackle the following situation.

Suppose you want your visitors to select a taxonomy term on which a page is being delivered with all items with the respected term. Add an exposed taxonomy filter, right?

So then you have a filter in which users can select, term1 or term3 or whatever, hit the search/filter button and there you go, a page with items including term1, term3 is being presented.

the url looks like www.mydomain.com/taxonomy/term/all?tid=1 (selecting all taxonomy terms and show term 1)

If you know execute the taxonomy exposed filter and tell it to select term 3, the url will become
www.mydomain.com/taxonomy/term/all?tid=3 (selecting all taxonomy terms and show term 3)

BUT when you visit the taxonomy/term/3 page. Which shows the same as the above url and you THEN select term 1 with the taxonomy exposed filter you get the following url
www.mydomain.com/taxonomy/term/3?tid=1 (selecting all content with taxonomy term 3 and show which also have term 1)

The result will be emtpy as long as you do not have any content with term 3 and 1.

How can I setup the filter so that it will only look at term 1 when I select term 1 with the exposed filter when I am on a taxonomy/term/ page?

Comments

Exposed Taxonomy terms

I created a view of type content and created a page.
I exposed taxonomy term which I used in the content
I kept the selection type as "Dropdown"
I checked "Allow multiple selections" checkbox in the configurations and kept the settings as "is one of"
In "Advanced"--> Query settings, I made Distinct so that contents don't get repeated.
Saved this view.

The resultant page shows exposed taxonomy filter which shows all three contents (content1, content2, content3, content 4)
When you filter using term1 you get nodes having term1 shows only two contents(content1, content3)
When you filter using term2 you get nodes having term2 shows only two contents(content1, content2)
When you filter using term1, term2 you get nodes having term1 or term2 shows only three contents(content1, content2, content3)

content1 was assigned term1, term2
content2 was assigned term2
content3 was assigned term1
content4 was assigned term4

Hth,
Sadashiv.

The issue is you have both a

The issue is you have both a contextual filter (argument) and exposed filter. By default they do not play nice together. I seem to recall a module that is meant to help in situations like this. You could search for 'filter' under modules download restricting the search to 'views' and 'D7'.

Yes if we use contextual

Yes if we use contextual filter and exposed filter together then will cause problem as contextual filter will filter separately and the exposed term with other and the query build will have condition which will contradict either condition i.e. term all in contextual filter and term id in exposed filter won't give a list of all contents.