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...

Comments

darksnow’s picture

StatusFileSize
new742 bytes

More 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.

darksnow’s picture

Version: 7.x-3.0-rc5 » 7.x-3.x-dev
Component: Documentation » Code
Assigned: Unassigned » darksnow
Category: support » bug

Changed to a code issue and assigned to me.

Please can somebody review this patch. Cheers.

marnix_werners’s picture

I 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...

podarok’s picture

Status: Active » Needs review

bot

podarok’s picture

Status: Needs review » Fixed

#1 commited pushed to both 6.x-3.x and 7.x-3.x-dev
Thanks!!!

darksnow’s picture

No problem at all, happy to help.

Can I ask if there are any plans for another stable release any time soon?

podarok’s picture

yup

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

darksnow’s picture

Status: Closed (fixed) » Needs review
darksnow’s picture

Hi, 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.

darksnow’s picture

StatusFileSize
new869 bytes

Status: Needs review » Needs work

The last submitted patch, 11: location-distance.patch, failed testing.

prathamesh.save’s picture

Status: Needs work » Needs review
StatusFileSize
new762 bytes
darksnow’s picture

Sorry 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

podarok’s picture

Status: Needs review » Fixed

#13 commited
Thanks!
Will be tagged for upcoming alpha release

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.