Fixed: undefined indexes issues and auto added service not being removed on room delete

This commit is contained in:
vishalsingh.qlo325
2025-06-04 16:51:14 +05:30
parent d80ffeb55e
commit f3a640094d
5 changed files with 19 additions and 10 deletions

View File

@@ -652,7 +652,7 @@ class DispatcherCore
if (!isset($this->routes[$id_shop][$id_lang][$route_id])) {
$query = http_build_query($params, '', '&');
$index_link = $this->use_routes ? '' : 'index.php';
return ($route_id == 'index') ? $index_link.(($query) ? '?'.$query : '') : ((trim($route_id) == '') ? '' : 'index.php?controller='.$route_id).(($query) ? '&'.$query : '').$anchor;
return ($route_id == 'index') ? $index_link.(($query) ? '?'.$query : '') : ((!is_null($route_id) ? (trim($route_id) == '') : 1) ? '' : 'index.php?controller='.$route_id).(($query) ? '&'.$query : '').$anchor;
}
$route = $this->routes[$id_shop][$id_lang][$route_id];
// Check required fields

View File

@@ -3854,14 +3854,14 @@ class AdminNormalProductsControllerCore extends AdminController
}
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
$selectetRoomTypes = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product->id, RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE);
$selectetHotels = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product->id, RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL);
$selectedRoomTypes = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product->id, RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE);
$selectedHotels = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($product->id, RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL);
$tree = new HelperTree('hotels-room-tree');
$tree->setData(HotelHelper::generateTreeData([
'rootNode' => HotelHelper::NODE_HOTEL,
'leafNode' => HotelHelper::NODE_ROOM_TYPE,
'selectedElements' => $selectetRoomTypes
'selectedElements' => $selectedRoomTypes
]))
->setUseCheckBox(true)
->setAutoSelectChildren(true)
@@ -3873,7 +3873,7 @@ class AdminNormalProductsControllerCore extends AdminController
$tree->setData(HotelHelper::generateTreeData([
'rootNode' => HotelHelper::NODE_HOTEL,
'leafNode' => HotelHelper::NODE_HOTEL,
'selectedElements' => $selectetHotels
'selectedElements' => $selectedHotels
]))
->setUseCheckBox(true)
->setAutoSelectChildren(true)

View File

@@ -6222,7 +6222,7 @@ class AdminOrdersControllerCore extends AdminController
0,
1,
1,
0,
null, // to get the auto added services.
null,
0,
$idHotelBooking
@@ -6238,7 +6238,7 @@ class AdminOrdersControllerCore extends AdminController
0,
1,
0,
0,
null, // to get the auto added services.
null,
0,
$idHotelBooking
@@ -6254,7 +6254,7 @@ class AdminOrdersControllerCore extends AdminController
0,
0,
null,
0,
null, // to get the auto added services.
null,
0,
$idHotelBooking

View File

@@ -168,7 +168,7 @@ class ServiceProductCartDetail extends ObjectModel
$sql = 'SELECT spc.*, p.`selling_preference_type`, hcbd.`date_from`, spc.`id_cart` as service_id_cart, hcbd.`date_to`, p.`price_calculation_method`, hcbd.`id_product` as `id_product_room_type`';
if (!$getTotalPrice) {
$sql .= ', hbil.`hotel_name` ';
$sql .= ', hbil.`hotel_name`, p.`auto_add_to_cart`, p.`price_addition_type` ';
}
$sql .= ' FROM `'._DB_PREFIX_.'service_product_cart_detail` spc';
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = spc.`id_product`)';
@@ -310,6 +310,9 @@ class ServiceProductCartDetail extends ObjectModel
'total_price_tax_excl' => $priceTaxExcl * (int)$product['quantity'] * $numDays,
'cover_img' => $coverImg,
'price_calculation_method' => $product['price_calculation_method'],
'auto_add_to_cart' => $product['auto_add_to_cart'],
'price_addition_type' => $product['price_addition_type'],
'total_price' => ($useTax ? $priceTaxIncl * (int)$product['quantity'] * $numDays : $priceTaxExcl * (int)$product['quantity'] * $numDays),
);
if ($product['htl_cart_booking_id']) {

View File

@@ -127,7 +127,9 @@ class ServiceProductOrderDetail extends ObjectModel
$sql = 'SELECT spod.*';
if (!$getTotalPrice) {
$sql .= ', hbd.`id_product` as `id_room_type`, od.`product_allow_multiple_quantity`, od.`product_price_calculation_method`, hbd.`id_room`, hbd.`adults`, hbd.`children`, hbd.`id_product`, hbd.`date_from`, hbd.`date_to`, hbd.`room_type_name`, spod.`id_product` as id_product';
$sql .= ', hbd.`id_product` as `id_room_type`, od.`product_allow_multiple_quantity`, od.`product_price_calculation_method`,
hbd.`id_room`, hbd.`adults`, hbd.`children`, hbd.`id_product`, hbd.`date_from`, hbd.`date_to`, hbd.`room_type_name`,
spod.`id_product` as id_product, od.`product_allow_multiple_quantity`, od.`product_price_calculation_method`, od.`product_auto_add`, od.`product_price_addition_type`';
}
$sql .= ' FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
LEFT JOIN `'._DB_PREFIX_.'service_product_order_detail` spod ON(spod.`id_htl_booking_detail` = hbd.`id`)';
@@ -210,6 +212,8 @@ class ServiceProductOrderDetail extends ObjectModel
'total_price_tax_incl' => $product['total_price_tax_incl'],
'unit_price_tax_excl' => $product['unit_price_tax_excl'],
'unit_price_tax_incl' => $product['unit_price_tax_incl'],
'product_auto_add' => $product['product_auto_add'],
'product_price_addition_type' => $product['product_price_addition_type'],
);
} else {
$selectedAdditionalServices[$product['id_htl_booking_detail']]['id_order'] = $product['id_order'];
@@ -240,6 +244,8 @@ class ServiceProductOrderDetail extends ObjectModel
'total_price_tax_incl' => $product['total_price_tax_incl'],
'unit_price_tax_excl' => $product['unit_price_tax_excl'],
'unit_price_tax_incl' => $product['unit_price_tax_incl'],
'product_auto_add' => $product['product_auto_add'],
'product_price_addition_type' => $product['product_price_addition_type'],
),
);
}