diff --git a/app/api/lists/store/SystemStoreLists.php b/app/api/lists/store/SystemStoreLists.php index 4462b893..c730b1ae 100644 --- a/app/api/lists/store/SystemStoreLists.php +++ b/app/api/lists/store/SystemStoreLists.php @@ -93,10 +93,17 @@ class SystemStoreLists extends BaseAdminDataLists implements ListsSearchInterfac } }else{ - foreach ($data as &$value){ - $value['distance'] = haversineDistance($value['latitude'],$value['longitude'],$latitude,$longitude); + if($latitude && $longitude){ + foreach ($data as &$value){ + $value['distance'] = haversineDistance($value['latitude'],$value['longitude'],$latitude,$longitude); + } + }else{ + foreach ($data as &$values){ + $values['distance'] = 0; + } } + } usort($data, function ($a, $b) {