From 2a4950bdaa2632f50d4f129d23762a488aa2d37e Mon Sep 17 00:00:00 2001 From: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com> Date: Sat, 24 Sep 2022 08:56:04 +0100 Subject: [PATCH] Checks the user has entered a full address with street name Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com> --- language/en/default.php | 1 + traits/SearchesNearby.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/language/en/default.php b/language/en/default.php index d424111..13dfbcf 100644 --- a/language/en/default.php +++ b/language/en/default.php @@ -139,6 +139,7 @@ 'alert_no_search_setting' => 'Location Search By setting has not been specified.', 'alert_no_search_query' => 'Please type in a address or postcode to check if we can deliver to you.', 'alert_invalid_search_query' => 'We couldn\'t locate the entered address or postcode, please enter a valid address or postcode.', + 'alert_missing_street_address' => 'Please enter your street address.', 'alert_no_found_restaurant' => 'We do not have any local restaurant near you.', 'alert_location_required' => 'No location found or selected', 'alert_order_type_required' => 'There\'s no active online ordering option for this location', diff --git a/traits/SearchesNearby.php b/traits/SearchesNearby.php index 42d5b5f..140e8ce 100644 --- a/traits/SearchesNearby.php +++ b/traits/SearchesNearby.php @@ -106,6 +106,9 @@ protected function handleGeocodeResponse($collection) if (!$userLocation->hasCoordinates()) throw new ApplicationException(lang('igniter.local::default.alert_invalid_search_query')); + if (!$userLocation->getStreetName()) + throw new ApplicationException(lang('igniter.local::default.alert_missing_street_address')); + Location::updateUserPosition($userLocation); return $userLocation;