Hi.
First, thanks very much for a brilliant module. I needed to create a search functionality based on post code and this module not only gave me everything I needed to create this, it also provided geo-coding and easy integration with various maps. Brilliant.
So, I set up a view and exposed the location filter which quickly and easily allowed me to search by postcode for a given distance. I then added a "Distance" field to the resultant table of results and this worked as expected, no postcode filter, no distance. This distance field is also used to sort my result set.
Now, the issue...
I've hidden the exposed filter and I'm trying to use a contextual filter to supply the postcode. Initially this was got cleaner URLs but I've since changed to using https://drupal.org/project/global_filter so the same post code selection can be shared between the table described above, and the Google Map.
I can't get the distance field to show up any more.
I've got the Proximity field set to "Use Distance / Proximity filter" as it was, and removed the exposed filter, replacing it with the Contextual Filter. I've also tried supplying %1 as the default to the postcode lookup, but without anything in the URL, this didn't work.
Is there any way to use the value supplied as a contextual filter from global filters as the postcode to generate a distance for my table.
I hope that is clear.
Thanks.
Martin...
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | location-showing_distance_from_a_contextual_filter-2102985.patch | 762 bytes | prathamesh.save |
| #11 | location-distance.patch | 869 bytes | darksnow |
| #1 | arguments.patch | 742 bytes | darksnow |
Comments
Comment #1
darksnowMore digging done.
I've found that the views handling code in location doesn't check contextual filters for arguments. The query generated contains 'Unknown' AS location_distance and you therefore don't get a distance that can be used in views for display or sorting.
I've attached a patch for location.views.inc which checks arguments if there are no filters for a 'tied' origin.
If there's an issue with the patch, let me know and I'll see if I can create a better version.
Comment #2
darksnowChanged to a code issue and assigned to me.
Please can somebody review this patch. Cheers.
Comment #3
marnix_werners commentedI used this patch and it worked like a charm.
I don't feel like being the one to change the status, but worked for me.
Thanks darksnow...
Comment #4
podarokbot
Comment #5
podarok#1 commited pushed to both 6.x-3.x and 7.x-3.x-dev
Thanks!!!
Comment #6
darksnowNo problem at all, happy to help.
Can I ask if there are any plans for another stable release any time soon?
Comment #7
podarokyup
Comment #9
darksnowComment #10
darksnowHi, sorry to reopen this but I found a bug.
If there is the contextual filter results in a failed looked we get errors on screen. Essentially, using my patch above we fall through to checking the contextual filter and the entered and configured values are in there, so it knows the distance from the match and the string you entered to search.
If the lookup on that string, be it post code or place name, fails then there is no latitude and longitude set in $argument->value
This patch just puts in a simple sanity check before using the non-existent values.
Comment #11
darksnowComment #13
prathamesh.save commentedComment #14
darksnowSorry about that, wrong diff format since the project I'm working on here is using SVN instead of GIT.
Cheers for sorting that out for me prathamesh.save
Comment #15
podarok#13 commited
Thanks!
Will be tagged for upcoming alpha release