Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I cannot get this module getting autocompletion suggestion with taxonomy terms.
- I added a hidden field of taxonomy / all terms for the chosen vocabulary
- I matched the field id and the exposed filter id
- when setting the filter, I correctly get the autocompletion for possibly preselecting terms
- in the form, the autocompletion does not suggest anything, telling either that there need a corresponding field for this filter to work or that there is no results available.
Thanks for help
Comments
Comment #1
jvieille CreditAttribution: jvieille commentedAfter trying everything related to this issue without success, I finally found a solution.
I guess that this feature would work with simple, single display views, with few fields and filters. This was definitely not my case. To make it working:
1) remember that the taxonomy terms you are going to filter must be present in every display you will filter (possibly excluded)
2) make sure that all the taxonomy fields you are going to display/filter on a single page have different IDs. Check the field name by hovering on this field - this is the last item of the url - for example tid_1.
For example, in my case, I have 6 taxonomy autocomplete filters on the same page. I had to set up to 6 taxonomy/term fields in order to get the last tid_5 field ID - Views offers no way to freely set the field identifier: it does on his own.
3) use only ONE vocabulary in filters otherwise, Autocomplete won't work
4) Use the first taxonomy filter "Taxonomy: Term Taxonomy term name" together with the last "Taxonomy: Vocabulary Filter the results of "Taxonomy: Term" - any other filter will not work
5) Set the term filter with the "contain" operator, set the filter identifier according to the field name above and check the "autocomplete" checkbox
6) set the vocabulary filter according to the vocabulary you want to filter
Envoy!
Comment #2
jvieille CreditAttribution: jvieille commentedComment #4
jvieille CreditAttribution: jvieille commentedThis does not work anymore - seems to relate to Views 2.18 last update. I tried to roll Views back to 2.16, but this is impossible, so I cannot confirm.
1) I have an autocomplete filter for terms of a vocabulary beside one other autocomplete filter for node title
2) I set a field "All terms" for that vocabulary. the id for this field is "tid"
3) I set an exposed filter "Taxonomy term name" with "content" as operator, "tid" as filter identifier
The views_autocomplete_filter.inc code is the following - some tweaks prefixed "JV" included and a dpm call for debug purpose (a single row of the views result for suggestions):
This what I get in dpm
- There is no trace of taxonomy information in vews result, the autocomplete will never get filled.
- the effect of ticking the box "Use Autocomplete" is nil: autocomplete is always active as soon as the operator is set to "contains".
By the way, taxonomy autocomplete filter in views should be a very basic requirement. If there is no way to fix this, is there any other solution beside Views hacks' autocomplete filter sub-module?
Thanks for help
Comment #5
colan