Hi and thanks for this module. It would fit my use case perfectly if only I could make it work.
I use D7.19 and want to setup a single filter with four terms based on a taxonomy field.
The bloc is OK, the links work as expected (appending ?myfield=xxx to the URL).
A view is set up as described in the doc (see attached screenshot).
The filter has absolutely no effect, as if the value passed in the URL was not there.
I have no doubt I'm missing something, but could use some help to figure out what.
Thanks in advance.
Comments
Comment #1
rdeboerHi CountZero,
Thanks for your interest in Views Global Filter.
Sorry to hear it's not working for you.
You say "The bloc is OK, the links work as expected (appending ?myfield=xxx to the URL)". That suggests to me that you've chosen to use the hyperlinks widget (rather than, say, a drop-down selector) and that you also chose to UNTICK on the Global Filter configuration the option Suppress URL parameters in the links of the links widget. That's ok. It should work with box ticked or unticked, i.e. both cases.
In the Global Filter block, for the driver selection and Views, for the Contextual Filter selection DO NOT PICK "Content: Has taxonomy term ID". You need to pick the taxonomy FIELD. Then all should be fine.
I'm also a little worried about this "Relationship" drop-down in your screenshot.... I don't normally see that... what else is in play on your site...?
Rik
Comment #2
Countzero commentedFirst, sorry for the french babble in the screenshot. I sometimes forget to switch languages.
I purposedly choosed to show eveything I could to try to solve the problem myself, hence the links and the unticking of the checkbox to supress the URL stuff. I tested before with less visible settings but it did't work. I plan to come back to it when everything will be OK. In fat, I plan to theme the whole block with very personal customer's graphics.
I think I have correctly choosen the taxonomy field for the filter (The tid of a taxonomy term, and not the "Display content if it has the selected taxonomy terms.".
My view uses a relationship to pull out some information it needs, that's why you see the dropdown with 'term' in the image. It also worries me, but it's mandatory for my use case and BTW for any serious Views stuff.
I'll try a test view with no relationship to see if things get better and update.
Comment #3
Countzero commentedOK, it's definitely about relationships.
I tested a view with a relationship to the term I use as a criteria for Global Filter and it works in views' preview area passing the tid via the parameter field. The real live view doesn't work though.
Problem is I need to pull info from one vocabulary (to fill my fields) and filter from another one with your module.
So, apart from the problem of the view not working in live, which we can address later, it boils down to : how do I use a relationship for the content filtering on another vocabulary ?
EDIT : I somehow managed to make the view work with both vocabularies linked via the same relationship. It produces duplicates, but definitely works in the preview. No way to make it work live though.
Comment #4
rdeboerGlobal Filter is based on Views' contextual filters. Have you tried your setup using a plain contextual filter with a default value or value taken from URL?
Also have you switched to another GF widget, the mechanism is different for hyperlinks.
Rik
Comment #5
Countzero commentedYes, yes and yes. Default fixed value and value from URL work OK. Other widgets (dropdown list or radio buttons, inherited from the field or not) don't work any better.
As i said before, the view works OK in preview. It's only about the value of the global filter not transmited to, or badly interpreted by, the view.
One more detail : I can see the debug message when I set up the module accordingly (changing from value1 to value2, GF uses the xxx widget, etc.). Don't know if it can help solve the issue.
Comment #6
rdeboerWell admittedly I have never tested Global Filter with relationships. I'm just not aware that the format for passing contextual values is different in that case....
Or what the difference is between Preview and live Views...
Guess I'll have to fire up the debugger, create a relationship and look under the hood...
Comment #7
Countzero commentedOK. In the meantime, I have started to code my own solution with $_SESSION variables and PHP provided values in contextual filters.
Comment #8
rdeboerSo the reason that the Global Filter Views plugin filters by 'all' (i.e. no filtering) is that as a result of the relationship, the name of the filtering Views field does not match that of the field selected in the global filter block.
I'll see what I can do...
Comment #9
rdeboerComment #10
Countzero commentedThe solution I found above works well for me, is quite elegant and consumes almost no resources, so I won't follow this issue closely from now on.
Glad you tracked down the problem. Hope you will find a solution with not too much hassle.
I'll try to test the corrected version when you post a patch or a new release though.
Comment #11
divined commentedWrong generated SQL query with relationship.
Original:
Code inside //-- --// must be in the inner query.
Right SQL query:
Comment #12
divined commentedTo repair it u can use another view to generate the relationship subquery. And use global filter inside subquery view instead main view.
Comment #13
Naveenchandra commentedThanks for this great module. I have come across this same issue and i am really looking forward to some alternate solution or patch for this issue.I am really struck here..So any pointers will be helpful.
Comment #14
Yuri commentedSet to major issue, if you don't mind.
Comment #15
rdeboerHave you tried the workaround by @divined in #12?
Patches based on the observation in #8 welcome! I have little time at the moment.
Comment #16
rdeboerPatch anyone?
Comment #17
rdeboer