From 90ca3d8f1ff09e7ae69b37ae8c41d2dc90a710ef Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 7 Oct 2024 16:18:05 +0530 Subject: [PATCH 1/3] Fixed: The hotel and rooms categories are not updated properly while updating the hotel using the API --- .../classes/HotelBranchInformation.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelBranchInformation.php b/modules/hotelreservationsystem/classes/HotelBranchInformation.php index 1ef15dc79..5a45f9f2a 100644 --- a/modules/hotelreservationsystem/classes/HotelBranchInformation.php +++ b/modules/hotelreservationsystem/classes/HotelBranchInformation.php @@ -1022,6 +1022,9 @@ class HotelBranchInformation extends ObjectModel // set categories of the hotel $this->setWsHotelCategories(); + // update room categories after the hotel category is updated. + $this->updateRoomTypeCategories(); + return true; } @@ -1229,14 +1232,7 @@ class HotelBranchInformation extends ObjectModel if ($catState) { if ($catCity = $this->addCategory($this->city, $catState, $groupIds)) { $hotelCatName = $this->hotel_name[Configuration::get('PS_LANG_DEFAULT')]; - if ($this->id_category) { - $objCategory = new Category($this->id_category); - $objCategory->name = $this->hotel_name; - $objCategory->link_rewrite = $linkRewriteArray; - $objCategory->id_parent = $catCity; - $objCategory->save(); - Category::regenerateEntireNtree(); - } else if ($catHotel = $this->addCategory( + if ($catHotel = $this->addCategory( $hotelCatName, $catCity, $groupIds, 1, $this->id, $linkRewriteArray )) { $this->id_category = $catHotel; From c4647866bfbb9e4ba3734c1f45c5d8365434ee0d Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 7 Oct 2024 17:42:18 +0530 Subject: [PATCH 2/3] Removed: id_category of the hotel form the hidden fields --- .../hotelreservationsystem/classes/HotelBranchInformation.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/hotelreservationsystem/classes/HotelBranchInformation.php b/modules/hotelreservationsystem/classes/HotelBranchInformation.php index 5a45f9f2a..c2779a01e 100644 --- a/modules/hotelreservationsystem/classes/HotelBranchInformation.php +++ b/modules/hotelreservationsystem/classes/HotelBranchInformation.php @@ -111,9 +111,6 @@ class HotelBranchInformation extends ObjectModel 'use_global_preparation_time' => array(), 'preparation_time' => array(), ), - 'hidden_fields' => array ( - 'id_category', - ), 'associations' => array( 'room_types' => array( 'setter' => false, From 96fd21dc5275d253168f5dd5d6f6f3284895395c Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 7 Oct 2024 18:53:13 +0530 Subject: [PATCH 3/3] Fixed: Room type categories not updated while updating the hotel using the CSV import --- controllers/admin/AdminImportController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index 43ee57298..761b3459a 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -1399,6 +1399,8 @@ class AdminImportControllerCore extends AdminController } } + // Updating the room type categories if exists. + $objHotelBranch->updateRoomTypeCategories(); $objHotelOrderRestrictDate = new HotelOrderRestrictDate(); $restrictDateInfo = HotelOrderRestrictDate::getDataByHotelId($objHotelBranch->id); if ($restrictDateInfo) {