Re: [4cdg] Filter Geocoder multi-map based on field info
Hi,
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/