Skip to content

Commit

Permalink
Fixed miles searching
Browse files Browse the repository at this point in the history
  • Loading branch information
Tam committed Nov 3, 2017
1 parent 5cbeb9d commit 530f363
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/services/MapService.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,10 @@ private function _searchLocation (ElementQuery $query, $value)
}

if ($unit == 'km') $distanceUnit = 111.045;
else $distanceUnit = 69.0;
else $distanceUnit = '69.0'; // String to force float in SQL

$this->searchLatLng = $location;
$this->searchDistanceUnit = $distanceUnit;
$this->searchDistanceUnit = (float)$distanceUnit;

$distanceSearch = "(
$distanceUnit
Expand Down Expand Up @@ -465,8 +465,6 @@ private function _searchLocation (ElementQuery $query, $value)
]
];

\Craft::dd([$distanceSearch, $restrict]);

if (array_key_exists('distance', $query->orderBy)) {
$this->_replaceOrderBy($query, $distanceSearch);
}
Expand Down

0 comments on commit 530f363

Please sign in to comment.