- if (sizeof($aPlaceIDs) && $this->sPostcode) {
- $sSQL = 'SELECT place_id FROM placex';
- $sSQL .= ' WHERE place_id in ('.join(',', $aPlaceIDs).')';
- $sSQL .= " AND postcode = '".$this->sPostcode."'";
- if (CONST_Debug) var_dump($sSQL);
- $aFilteredPlaceIDs = chksql($oDB->getCol($sSQL));
- if ($aFilteredPlaceIDs) {
- $aPlaceIDs = $aFilteredPlaceIDs;
- if (CONST_Debug) {
- echo "<br><b>Place IDs after postcode filtering:</b> ";
- var_Dump($aPlaceIDs);
+ if (sizeof($aResults) && $this->sPostcode) {
+ $sPlaceIds = Result::joinIdsByTable($aResults, Result::TABLE_PLACEX);
+ if ($sPlaceIds) {
+ $sSQL = 'SELECT place_id FROM placex';
+ $sSQL .= ' WHERE place_id in ('.$sPlaceIds.')';
+ $sSQL .= " AND postcode = '".$this->sPostcode."'";
+ if (CONST_Debug) var_dump($sSQL);
+ $aFilteredPlaceIDs = chksql($oDB->getCol($sSQL));
+ if ($aFilteredPlaceIDs) {
+ $aNewResults = array();
+ foreach ($aFilteredPlaceIDs as $iPlaceId) {
+ $aNewResults[$iPlaceId] = $aResults[$iPlaceId];
+ }
+ $aResults = $aNewResults;
+ if (CONST_Debug) {
+ echo "<br><b>Place IDs after postcode filtering:</b> ";
+ var_dump(array_keys($aResults));
+ }