Fixed: Room type categories were not updated when hotel name or location is updated
This commit is contained in:
@@ -825,6 +825,23 @@ class HotelBranchInformation extends ObjectModel
|
||||
return true;
|
||||
}
|
||||
|
||||
public function updateRoomTypeCategories()
|
||||
{
|
||||
if (!Validate::isLoadedObject($this)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$hotelCategories = $this->getAllHotelCategories();
|
||||
$objHotelRoomType = new HotelRoomType();
|
||||
if ($roomTypes = $objHotelRoomType->getRoomTypeByHotelId($this->id, Context::getContext()->language->id)) {
|
||||
foreach ($roomTypes as $roomType) {
|
||||
$objProduct = new Product($roomType['id_product']);
|
||||
$productCategories = $objProduct->getCategories();
|
||||
$objProduct->updateCategories($hotelCategories);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function isRefundable()
|
||||
{
|
||||
return (Configuration::get('WK_ORDER_REFUND_ALLOWED') && $this->active_refund);
|
||||
|
||||
@@ -534,7 +534,9 @@ class AdminAddHotelController extends ModuleAdminController
|
||||
if ($objHotelBranch->id_category) {
|
||||
$objCategory = new Category($objHotelBranch->id_category);
|
||||
$objCategory->name = $objHotelBranch->hotel_name;
|
||||
$objCategory->id_parent = $catCity;
|
||||
$objCategory->save();
|
||||
Category::regenerateEntireNtree();
|
||||
} else {
|
||||
if ($catHotel = $objHotelBranch->addCategory(
|
||||
$hotelCatName, $catCity, $groupIds, 1, $newIdHotel, $linkRewriteArray
|
||||
@@ -566,6 +568,9 @@ class AdminAddHotelController extends ModuleAdminController
|
||||
}
|
||||
}
|
||||
|
||||
// update room types association after category update
|
||||
$objHotelBranch->updateRoomTypeCategories();
|
||||
|
||||
if ($idHotel) {
|
||||
// save maximum booking date and preparation time
|
||||
$objHotelOrderRestrictDate = new HotelOrderRestrictDate();
|
||||
|
||||
Reference in New Issue
Block a user