From c21ba3a194deb904aed5e2a2ab3579ecfb84373b Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 16 Oct 2023 12:06:35 +0530 Subject: [PATCH] Update OrderOpcController.php --- controllers/front/OrderOpcController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index c80313b1c..a372bd008 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -117,6 +117,7 @@ class OrderOpcControllerCore extends ParentOrderController $_POST['lastname'] = $_POST['customer_lastname']; $_POST['firstname'] = $_POST['customer_firstname']; + $this->errors = array_merge($this->errors, $this->context->customer->validateController()); $this->context->customer->newsletter = (int)Tools::isSubmit('newsletter'); $this->context->customer->optin = (int)Tools::isSubmit('optin'); $this->context->customer->is_guest = (Tools::isSubmit('is_new_customer') ? !Tools::getValue('is_new_customer', 1) : 0); @@ -126,6 +127,10 @@ class OrderOpcControllerCore extends ParentOrderController if (Validate::isLoadedObject($objAddress)) { $phoneMobile = Tools::getValue('phone_mobile'); + if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !$phoneMobile) { + $this->errors[] = Tools::displayError('Mobile phone number is a required field.', false); + } + if (!Validate::isPhoneNumber($phoneMobile)) { $this->errors[] = Tools::displayError('Please enter a valid Mobile phone number.', false); } @@ -139,7 +144,6 @@ class OrderOpcControllerCore extends ParentOrderController } } - $this->errors = array_merge($this->errors, $this->context->customer->validateController()); $return = array( 'hasError' => !empty($this->errors), 'errors' => $this->errors,