Filter Geocoder multi-map based on field info
6 posts by 3 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: March 26, 2012 (RSS)
By 4cdg - September 8, 2011
When the page loads it shows all the records in the listings table, I need it to show only the records where category = For Sale.
Once i do a proximity search i filter the results with a hidden field in the search form, but the map that loads initially i don't know how to only show records marked for sale.
I have attached the page
Re: [4cdg] Filter Geocoder multi-map based on field info
By 4cdg - September 8, 2011
any way to manually enter the latitude and longitude when geocoder is activated?
Re: [4cdg] Filter Geocoder multi-map based on field info
By Jason - September 8, 2011
For your first issue, you can manually add that condition to your WHERE clause like this:
list($addressRecords, $addressMetaData) = getRecords(array(
'tableName' => 'listings',
'addSelectExpr' => geocoder_getSelectExprForDistance($myLat, $myLng, '_distance', $kmOrMiles), // adds '_distance' field to output records
'where' => geocoder_getWhereForDistanceWithin($myLat, $myLng, $maxDist, $kmOrMiles)." AND status = 'For Sale'", // optimization: remove results outside of minimum bounding rectangle
'having' => "_distance <= " . $maxDist, // only show results within max distance
'orderBy' => 'ISNULL(_distance), _distance', // sort nearest records first -and- unknown or undefined distances last
));
For your second issue, you can set the plugin so that it doesn't automatically overwrite/set the lat and long field when you save but setting this in the plugin:
$GLOBALS['GEOCODER_AUTOSET_LAT_LNG_FIELDS'] = false;
Please note that this means that you will either have to manually enter your lat and long values, or use the "Geocode Table" function from the plugins page.
Hope this helps
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Filter Geocoder multi-map based on field info
By 4cdg - March 23, 2012
Re: [4cdg] Filter Geocoder multi-map based on field info
By (Deleted User) - March 26, 2012
Which part of the code isn't working for you - the "for sale" filter or disabling the lat/long auto-overwrite for the geocoder?
If it's the former we'd need to see the script that's generating the page and the input method for the data so we can make some more suggestions - please submit a second level support request https://www.interactivetools.com/support/email_support_form.php.
If the latter - we would need to look at customizing the geocoder to not overwrite extant lat/long (eg only complete those that are not already present). This would be a consulting job so you'd have to send details to consulting@interactivetools.com so we can spec up what needs to be done for you.
Let me know if this helps,
Tom
Re: [Tom P] Filter Geocoder multi-map based on field info
By 4cdg - March 26, 2012