Hi,
I want to combine 2 exposed taxonomy filter into one so that when one search for a term it looks in two taxonomies.
I tried using the "Global: Combine fields filter" filter criteria of my view pointing to my taxononies, but even though it doesnt return errors, it seems it is searching on the taxonomy term ID and not its value, wich makes it pretty useless...
Is there some option or workarround to get this working ?

I'm using Views 7.x-3.5 with Drupal 7

thanks,

P.

Comments

ttronslien’s picture

I'm in the same situation. Did you get a solution and if so, can you please share?

Thanks

Jaesin’s picture

Try adding a relationship to the term reference field.

Then add a "Taxonomy term: Name " field using the relationship you just created. Set it to hidden if you like.
Then include this new field in your "Combine fields filter".

<8)[=<

langelhc’s picture

@Jaesin, thnks so much, I was breaking my head more than one month ;)
Works for me.

edutrul’s picture

Thanks @Jaesln

You made my day!
Jaesln++

Blessings

1st Drupal 8 backend specialist acquia certified in Perú!
CTO / Software Architect / Senior Developer

a.milkovsky’s picture

Thanks. but what if I have 5 term fields. It causes duplicates in my view. Even with DISTINCT

a.milkovsky’s picture

Mackee’s picture

@Jaesin You save my day! Thanks!

yusufsarac’s picture

Oh yeass!!! great solution man :)

ahughes3’s picture

Worked like a charm! Thank you sir!!

cm1se7en’s picture

@Jaesin, thnks so much.

icf-vpathak’s picture

Thanks Jaesin..
Worked in my case.

vishal.jathod’s picture

Thanks Jaesin...! You save my time!

evets33’s picture

Hello
Thank you for your answer
Do you know how to to this when there is several taxonomy term linked to ?
In fact i have Tag1 and Tag2 linked to my content and combine filters doesn't work in this case, because instead of retrieving all related tags , the request down by taxonomy term.

This is my request :

SELECT DISTINCT node.title AS node_title, node.nid AS nid, node.language AS node_language, .......  ........taxonomy_term_data_node__taxonomy_vocabulary ON taxonomy_term_data_node.vid = taxonomy_term_data_node__taxonomy_vocabulary.vid
WHERE (( (node.status = '1') AND (node.type IN  ('procedures')) AND( (CONCAT_WS(' ', taxonomy_term_data_field_data_field_tagsprocedures.name) LIKE '%Tag1%') AND (CONCAT_WS(' ', taxonomy_term_data_field_data_field_tagsprocedures.name) LIKE '%Tag2%') )))
GROUP BY nid, field_data_field_tagsprocedures_node_entity_type
ORDER BY node_title ASC, node_created DESC

However, "taxonomy_term_data_field_data_field_tagsprocedures.name" always returns the first tag of the list.

joekers’s picture

Thanks, this wasn't my exact solution but it certainly helped me find it!

I was trying to combine a term filter across two different fields that were both a term reference to the same vocabulary.

I added a relationship "Taxonomy terms on node" and was able to add a Term widget filter that filtered both fields.

SebastianOrtiz’s picture

Hello, I am new to Drupal and I have problems doing what you just said, I created a Term reference type field, but now I do not know how to create a Term reference:name field, I can not find that type of field in the selection Of types, can you help me explain the procedure in a more detailed way if possible please?

Thanks

Miri Meltzer’s picture

Thanks @Jaesln. Work fine in Drupal 8 also. 

murphyca’s picture

Posting screen cap for future users:

https://pbs.twimg.com/media/D3u-4_JWAAMrett.png:large

Only local images are allowed.

codebern’s picture

Thanks @Jaesin, this was exactly what I was looking. I was struggling to find the issue.

sambot’s picture

...and this still saved my butt! Many thanks!

appaulmac’s picture

I've added a comment on a separate thread that managed to deal with the duplicate records after following the (great) advice here for getting the taxonomy term: name field in to my combined filter box. It involved using MYMODULE_views_query_alter to add a groupby parameter to the query.

http://drupal.stackexchange.com/questions/73620/group-by-in-hook-views-q...

mfrosch’s picture

in order to solve the multiply / duplicate problem it just made a checkmark on distinct on query settings and also putted "use aggregation" to yes.

cheers,
Matthias
http://www.trust-design.net

francescosciamanna’s picture

Just for whom not used to manage views, youcan find above mentioned settings on your views setting page:
>(in the right)Advanced Settings
>OTHER
>Use aggregation
>Query settings

kamranafzal’s picture

Thanks @Jaesln it worked for me.