From 13e3b59f6e5d7d6d23ef8bdf980cc43942e5d485 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 30 Apr 2024 16:16:09 +0530 Subject: [PATCH] Fixed: Fixed the warning for price of additional facilities on the AdminProductsController, which occured whenever there was an error in the controller --- controllers/admin/AdminProductsController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 811207d39..b86d926db 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -3672,6 +3672,7 @@ class AdminProductsControllerCore extends AdminController public function processAdditionalFacilities() { if ($idProduct = Tools::getValue('id_product')) { + $errors = array(); $objRoomTypeDemand = new HotelRoomTypeDemand(); $objRoomTypeDemandPrice = new HotelRoomTypeDemandPrice(); // first delete all the previously saved prices and demands of this room type @@ -3699,7 +3700,7 @@ class AdminProductsControllerCore extends AdminController $objRoomTypeDemandPrice->save(); } } else { - $this->errors[] = Tools::displayError('Invalid demand price of facility.'). + $errors[] = Tools::displayError('Invalid demand price of facility.'). ' : '.$objGlobalDemand->name[$this->context->language->id]; } if ($advOptions = $objAdvOption->getGlobalDemandAdvanceOptions($idGlobalDemand)) { @@ -3716,15 +3717,16 @@ class AdminProductsControllerCore extends AdminController $objRoomTypeDemandPrice->save(); } } else { - $this->errors[] = Tools::displayError('Invalid price of advanced option: ').$objAdvOption->name[$this->context->language->id]; + $errors[] = Tools::displayError('Invalid price of advanced option: ').$objAdvOption->name[$this->context->language->id]; } } } } } } - if (count($this->errors)) { + if (count($errors)) { $this->warnings[] = Tools::displayError('Invalid price values are not saved. Please correct them and save again.'); + $this->errors = array_merge($this->errors, $errors); } $objCartBookingData = new HotelCartBookingData();