Browse Source

#2135 Search by radius in custom search forms - fix

RomanL 7 years ago
parent
commit
b56f7e40b2
1 changed files with 5 additions and 3 deletions
  1. 5 3
      modules/base/general/classes/BxBaseModGeneralDb.php

+ 5 - 3
modules/base/general/classes/BxBaseModGeneralDb.php

@@ -194,9 +194,11 @@ class BxBaseModGeneralDb extends BxDolModuleDb
                     if(!isset($CNF['OBJECT_METATAGS']))
                         break;
                     if ($aSearchParam['type'] == 'location_radius'){
-                        list($fLatitude, $fLongitude, $sCountry, $sState, $sCity, $sZip, $sStreet, $sStreetNumber, $iRadius) = $aSearchParam['value']['array'];
-                        $aBounds = bx_get_location_bounds_latlng($fLatitude, $fLongitude, $iRadius);   
-                        $aSql = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS'])->locationsGetAsSQLPart($CNF['TABLE_ENTRIES'], $CNF['FIELD_ID'], '', '', '', '', $aBounds);
+                        if ($aSearchParam['value']['string'] != ''){
+                            list($fLatitude, $fLongitude, $sCountry, $sState, $sCity, $sZip, $sStreet, $sStreetNumber, $iRadius) = $aSearchParam['value']['array'];
+                            $aBounds = bx_get_location_bounds_latlng($fLatitude, $fLongitude, $iRadius);   
+                            $aSql = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS'])->locationsGetAsSQLPart($CNF['TABLE_ENTRIES'], $CNF['FIELD_ID'], '', '', '', '', $aBounds);
+                        }
                     }
                     else{
                         list($fLatitude, $fLongitude, $sCountry, $sState, $sCity, $sZip) = $aSearchParam['value']['array'];