Closed (fixed)
Project:
Views Filter Harmonizer
Version:
7.x-1.0-beta3
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
9 Jul 2013 at 06:42 UTC
Updated:
27 Jul 2013 at 04:31 UTC
I have two identical views - one with a single exposed proximity filter and one with grouped exposed proximity filters. Both are also using identical contextual proximity filters. The view with the grouped filters seems to be interfering with the contextual filter. It's showing all results whereas the view with a single exposed filter is working properly.
You can see the view with the single exposed proximity filter here:
http://town1.biz/homes1/hartville/oh/
and the view with the grouped filters here:
http://town1.biz/homes/hartville/oh/
Comments
Comment #1
rdeboerHi John,
You may be skipping to conclusions... or I may...
From those links I cannot tell for sure what the default contextual filter is set at, so hard to determine whether there's interference at play or not.
I can till you this: when both a contextual filter and an exposed filter are defined for the same field BOTH get applied ALWAYS (unless you have the Views Filter Harmonizer module enabled, see http://drupal.org/project/filter_harmonizer).
If the contextual (default) filter is configured such that a result set returned is in fact a SUPERSET of the exposed filter, then it will appear that there is no interference (but in reality there is).
However, as you are saying the contextual filters are set up identically... I may have to adjust my thinking....
Rik
Comment #2
johnhorning commentedRik - I do have the Views Filter Harmonizer module enabled (with Ignore any contextual filter that also has an exposed filter value set for the same field checked) and these views are clones of one another except for the exposed proximity filters. The contextual filters for both views are configured for a radius of 5 miles from Hartville, Ohio (which is taken from the URL). I don't have a source set for the exposed proximity filters for either view.
John
Comment #3
rdeboerHi John,
Re #2: Got you now -- you didn't mention that before
Then it's probably appropriate to move this issue from the Geofield 7.x-2.0 queue to the VIews Filter Harmonizer queue -- done.
Will look into it.
Rik
Comment #4
johnhorning commentedI didn't think it had anything to do with Harmonizer, but I guess you're right - the filters work properly without Harmonizer enabled, although there's still something wrong with the grouped exposed proximity filter. There's no place to enter the source.
Comment #5
rdeboer"...the filters work properly without Harmonizer enabled..."
John, the above cannot be true, unless by "work properly" you mean what I mentioned earlier:
"If the contextual (default) filter is configured such that the result set returned is in fact a SUPERSET of what would be returned if only the exposed filter was present, then it will appear that there is no interference "
So if the contextual filter is set to a proximity of 10 miles and you only ever use the exposed filter for proximities of 10 miles or less, then, yes, it will "work properly". But if you set the exposed filter to 15, 20, 50... then you will get the results for 10.
I'm looking at Filter Harmonizer at the moment. The problem is that the Geofield Proximity form has multiple values... That's why it is not working... yet...
Rik
Comment #6
johnhorning commentedI just meant that the contextual filter seemed to be working again without Harmonizer. I was getting the expected results, anyway.
Any thoughts as to why there's no place to enter the source when grouping proximity filters? Maybe that should be a new issue. Not that I really want to enter a source. As I mentioned elsewhere, I would be happy if the exposed filter would use arguments from the URL as the source.
John
Comment #7
rdeboerAny thoughts as to why there's no place to enter the source when grouping proximity filters? Maybe that should be a new issue.
Yes against Geofield 7.x-2.x
"I would be happy if the exposed filter would use arguments from the URL as the source."
I'm looking into that now as an extension to Filter Harmonizer. In the case of Geofield fields it's a bit harder than when dealing with single value fields. The contextual filter argument string, needs to be parsed, split and mapped to the boxes on the form.
When using the "free format" contextual arguments (e.g. "/Ohio/Hartville/10") that are passed to Geocoder, it gets harder still....
Comment #8
johnhorning commentedWell - all I can say is you are the man for the job! ;)
Thanks for all your effort.
John
PS I will submit an issue about the missing source field after I've done a little more testing.
Comment #9
rdeboer@johnhorning:
Man, you sure opened up a can of worms! I thought this would be a quick-and-easy module, but is there ever such a thing in Drupal?
Supporting Geofield really threw a spanner in the works... but getting there... beta2 on its way...
Geofield has made me realise that multi-valued fields (like those from the AddressField module) may bring their own complexities to the table...
I'll have to reserve a space --in my mind and in the Views Filter Harmonizer module-- for 3rd party modules that feature string values as contextual filter arguments that expand into multiple exposed filter form fields... hmmm.... food for thought...
And then there's these damned grouped filters...
Rik
Comment #10
johnhorning commentedI don't know much about the inner workings of Drupal Views, but it seems like the simplest way to handle this would be to extend the capabilities of exposed filters rather than trying to harmonize them with contextual filters. You'd have an exposed filter that was also working off arguments - at least for the initial page load.
Just a thought...
Comment #11
rdeboerYep -- that sounds the way to go... for the Views maintainers....
I don't think they'll be interested in patches at this stage of D7's life cycle, so I need a solution based on hooks that does not require any code changes in Views itself.
Not sure your approach would qualify... but I could be wrong. Views is such a big beast...
Rik
Comment #12
rdeboerFilter Harmonizer was only working for simple fields, not Geofields.
Fixed in 7.x-1.0-beta2. This small patch to Geofield 7.x-2.x is required: https://drupal.org/node/2014345#comment-7638461 for Filter Harmonizer to work with Geofield.
The contextual values used in initial filtering are auto-inserted in the exposed filter (new feature, requested in #6 of this thread). You could add CSS to hide (not remove!) the location field, so that all the user can change is the distance field, with the location provided by the contextual filter arguments (whether these are defaults or appended to the URL).
May not work on grouped exposed filters. I can't even get grouped filters to do anything without Filter Harmonizer.
Comment #13
johnhorning commentedDoesn't seem to work without entering a value for origin point. This view just has a single exposed proximity filter, along with the contextual proximity filter:
http://town1.biz/homes1/hartville/oh/
Of course, I applied the patch manually so may have done it wrong - will test this out more later when I have time.
Comment #14
rdeboerHmm... the new code should have auto-filled the fields of the exposed form including that reference/origin point...
Something wrong there.
By the way... I found out what's going wrong with Geofield when using Exposed Filters that for your use-case need to take some of their missing input form the new Contextual Proximity plugin. It's because Geofield's default validation on input is too stringent for your use-case. It won't do much, unless both distance and origin are filled-out. I have a patch against Geofield waiting in the wing...
Rik
Comment #15
rdeboerPatch mentioned in #14: https://drupal.org/node/2014345#comment-7638425
For Filter Harmonizer to work with Geofield, the Geofield Exposed Proximity Filter needs to have its Source of Origin Point set to Geocoded Location not Contextual Geofield Proximity Filter.
At the same time to display distances the Geofield Proximity Field needs to have the Source or Origin Point set to Exposed Geofield Proximity Filter, so that the distances shown reflect what is being filtered on.
Comment #16
rdeboerFixed and available in 7.x-1.0-beta3. Note that the patch to Geofield mentioned in #14/#15 is required: https://drupal.org/node/2014345#comment-7638425