Hi all, thank you thank you thank you for developing these modules all together! Please forgive me for not touching the status of this, as I do not know how to commit a patch. my locations and geo-encoding works, views: check, gmap:check - everything all happy, except with the proximity option when making a view of locations, like a store locator:
Problem:
I had a problem with my Proximity filter working on my drupal site when searching with views. I installed all the modules required, and added the zipcodes into my database and still nothing on my views search. I read for the better part of this afternoon and could not figure out for the life of me what was going on. I ran into a post: http://drupal.org/node/132181 and http://drupal.org/node/326749#comment-1155243 but none of these solutions seemed to work, but they were all pointing ultimately to the right direction in solving the over all problem. No output, just my "empty text" message from my view.
Solution:
Ok, long story short - what was happening for me is that the $filter['value']['latitude'] and $filter['value']['longitude'] were always populating with a value, specifically the first number of the queried postalcode. So if the zip was 8xxxxx, then the $filter['value']['latitude'] and $filter['value']['longitude'] value was populated with 8 - weird huh?
So, what I did was this on approx line 948:
if (!empty($filter['value'])) {
$zip = $filter['value'];
// @@@ This needs to factor in country.
$result = db_query("SELECT * FROM {zipcodes} WHERE zip = '%s'", $zip);
while ($arr = db_fetch_array($result)) {
$lat = $arr['latitude'];
$lon = $arr['longitude'];
}
}
else {
$lat = $filter['value']['latitude'];
$lon = $filter['value']['longitude'];
}
So that if the postal code is empty, then use the lat an lon from wherever that comes from.
if the postal code is populated, then it takes that. Bam, everything works as expected.
I can't see anything that is being affected by my change, so if you guys think it's cool i would humbly suggest making this change.
My environment:
Drupal 5.12
Location: 5.x-3.0
GMAP 5.x-1.x-dev
CCK 5.x-1.10
Location CCK 5.x-3.0
Views 5.x-1.6
Thanks for taking a look at this!
Comments
Comment #1
kirikintha commentedi just read this again - and realized I forgot to specify which file, which is location_views.module
Comment #2
steveoliver commentedThis worked for me too.
I just replaced
with
Comment #3
mikezhou commentedlist($lat, $lon) = explode(',', $filter['value');
Comment #4
kirikintha commentedCan you post the code for the section in question? I have not used list() in the whole function - I'm just interested in your solution! Thanks!
Comment #5
bdragon commentedResetting title
Comment #6
yrre7 commentedsubscribe
Comment #7
kirikintha commentedBTW - it looks like the new GMAP and Location modules resolves these problems - they rock!
Comment #8
yesct commentedSounds like this was fixed for the original poster by upgrading to the most recent versions. If there is still a bug in the most recent versions, just post back.