diff --git a/admin/themes/default/template/controllers/normal_products/informations.tpl b/admin/themes/default/template/controllers/normal_products/informations.tpl
index b1d0b9f72..a528df729 100644
--- a/admin/themes/default/template/controllers/normal_products/informations.tpl
+++ b/admin/themes/default/template/controllers/normal_products/informations.tpl
@@ -241,21 +241,21 @@
diff --git a/classes/Cart.php b/classes/Cart.php
index d544f3cf9..813ff4f89 100644
--- a/classes/Cart.php
+++ b/classes/Cart.php
@@ -827,7 +827,7 @@ class CartCore extends ObjectModel
$serviceProducts = array();
$context = Context::getContext();
foreach ($productList as $key => $product) {
- if (!$product['booking_product'] && Product::isSellableAsStandalone($product['selling_preference_type'] && !Product::isSellableWithRoomType($product['selling_preference_type']))) {
+ if (!$product['booking_product'] && Product::isSellableAsStandalone($product['id_product']) && !Product::isSellableWithRoomType($product['id_product'])) {
if (Validate::isLoadedObject(
$objProduct = new Product($product['id_product'], false, $this->id_lang)
)) {
@@ -1659,9 +1659,9 @@ class CartCore extends ObjectModel
continue;
}
- $canSellWithRoomType = Product::isSellableWithRoomType($product['selling_preference_type']);
- $canSellWithHotel = Product::isSellableWithHotel($product['selling_preference_type']);
- $canSellAsStandalone = Product::isSellableAsStandalone($product['selling_preference_type']);
+ $canSellWithRoomType = Product::isSellableWithRoomType($product['id_product']);
+ $canSellWithHotel = Product::isSellableWithHotel($product['id_product']);
+ $canSellAsStandalone = Product::isSellableAsStandalone($product['id_product']);
if ($canSellWithRoomType) {
if ($type == Cart::ONLY_STANDALONE_PRODUCTS && !$canSellAsStandalone && !$canSellWithHotel) {
@@ -1753,9 +1753,6 @@ class CartCore extends ObjectModel
$products_total[$id_tax_rules_group.'_'.$id_address] = 0;
}
if (!$product['booking_product']) {
- $canSellWithRoomType = Product::isSellableWithRoomType($product['selling_preference_type']);
- $canSellWithHotel = Product::isSellableWithHotel($product['selling_preference_type']);
- $canSellAsStandalone = Product::isSellableAsStandalone($product['selling_preference_type']);
$isRoomServiceTotalType = in_array($type, array(
Cart::ONLY_ROOM_SERVICES,
Cart::ONLY_CONVENIENCE_FEE,
@@ -1764,10 +1761,28 @@ class CartCore extends ObjectModel
Cart::ONLY_ROOM_SERVICES_WITH_AUTO_ADD_WITHOUT_CONVENIENCE_FEE,
));
- if ($canSellAsStandalone && !$isRoomServiceTotalType) {
- $idHotelCartBooking = isset($product['id_hotel_cart_booking']) ? (int)$product['id_hotel_cart_booking'] : 0;
- $idHotel = isset($product['id_hotel']) ? (int)$product['id_hotel'] : 0;
+ $singleContextSellTypes = [
+ Product::SELLING_PREFERENCE_WITH_ROOM_TYPE,
+ Product::SELLING_PREFERENCE_HOTEL_STANDALONE,
+ Product::SELLING_PREFERENCE_STANDALONE,
+ ];
+ $specificSellType = ($param_product
+ && isset($product['selling_preference_type'])
+ && in_array((int)$product['selling_preference_type'], $singleContextSellTypes))
+ ? (int)$product['selling_preference_type']
+ : null;
+ $sellsAsStandalone = $specificSellType !== null
+ ? ($specificSellType === Product::SELLING_PREFERENCE_STANDALONE)
+ : Product::isSellableAsStandalone($product['id_product']);
+ $sellsWithHotel = $specificSellType !== null
+ ? ($specificSellType === Product::SELLING_PREFERENCE_HOTEL_STANDALONE)
+ : Product::isSellableWithHotel($product['id_product']);
+ $sellsWithRoomType = $specificSellType !== null
+ ? ($specificSellType === Product::SELLING_PREFERENCE_WITH_ROOM_TYPE)
+ : Product::isSellableWithRoomType($product['id_product']);
+
+ if ($sellsAsStandalone && !$isRoomServiceTotalType) {
if ($serviceProducts = $objServiceProductCartDetail->getServiceProductsInCart(
$this->id,
[],
@@ -1791,8 +1806,8 @@ class CartCore extends ObjectModel
}
}
- }
- if ($canSellWithHotel ) {
+ }
+ if ($sellsWithHotel) {
if ($type == Cart::ONLY_ROOM_SERVICES
|| $type == Cart::ONLY_CONVENIENCE_FEE
|| $type == Cart::ONLY_ROOM_SERVICES_WITHOUT_AUTO_ADD
@@ -1829,7 +1844,7 @@ class CartCore extends ObjectModel
if ($serviceProducts) {
foreach ($serviceProducts as $serviceProduct) {
- if(!empty($serviceProduct['id_hotel']) && empty($serviceProduct['id_hotel_cart_booking'])) {
+ if (!empty($serviceProduct['id_hotel']) && empty($serviceProduct['id_hotel_cart_booking'])) {
if ($with_taxes) {
$priceAdd = $serviceProduct['total_price_tax_incl'];
} else {
@@ -1845,7 +1860,7 @@ class CartCore extends ObjectModel
}
}
}
- if ($canSellWithRoomType && $type !== Cart::ONLY_STANDALONE_PRODUCTS) {
+ if ($sellsWithRoomType && $type !== Cart::ONLY_STANDALONE_PRODUCTS) {
if ($servicesWithRoom = $objServiceProductCartDetail->getServiceProductsInCart(
$this->id,
@@ -2436,7 +2451,7 @@ class CartCore extends ObjectModel
}
}
} else {
- if (Product::isSellableWithRoomType($product['selling_preference_type'])) {
+ if (Product::isSellableWithRoomType($product['id_product'])) {
// get standard products which are booked for room types
// send id_hotel = 0 for standard products with room types
if ($selectedServiceProducts = $objServiceProductCartDetail->getServiceProductsInCart(
@@ -2509,7 +2524,7 @@ class CartCore extends ObjectModel
}
}
}
- if (Product::isSellableAsStandalone($product['selling_preference_type'])) {
+ if (Product::isSellableAsStandalone($product['id_product'])) {
if ($selectedServiceProducts = $objServiceProductCartDetail->getServiceProductsInCart(
$this->id,
[],
@@ -2566,8 +2581,7 @@ class CartCore extends ObjectModel
}
}
}
-
- if (Product::isSellableWithHotel($product['selling_preference_type'])) {
+ if (Product::isSellableWithHotel($product['id_product'])) {
if ($selectedServiceProducts = $objServiceProductCartDetail->getServiceProductsInCart(
$this->id,
[],
@@ -3198,11 +3212,9 @@ class CartCore extends ObjectModel
$id_address = HotelRoomType::getHotelIdAddressByIdProduct($id_product);
} else {
// if the product is a standard product the get the address as per the selling preference
- $sellingPreferenceType = Product::getSellingPreferenceType($id_product);
-
- $canSellWithRoomType = Product::isSellableWithRoomType($sellingPreferenceType);
- $canSellWithHotel = Product::isSellableWithHotel($sellingPreferenceType);
- $canSellAsStandalone = Product::isSellableAsStandalone($sellingPreferenceType);
+ $canSellWithRoomType = Product::isSellableWithRoomType($id_product);
+ $canSellWithHotel = Product::isSellableWithHotel($id_product);
+ $canSellAsStandalone = Product::isSellableAsStandalone($id_product);
if ($canSellWithHotel) {
if ($htlAddress = HotelBranchInformation::getAddress($id_hotel)) {
diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php
index 43158862f..8b6e57e1b 100644
--- a/classes/PaymentModule.php
+++ b/classes/PaymentModule.php
@@ -589,12 +589,11 @@ abstract class PaymentModuleCore extends Module
$virtual_product &= false;
}
- if (
- !$product['booking_product'] && !$product['id_hotel_cart_booking']
- && (
- Product::isSellableAsStandalone($product['selling_preference_type'])
- || Product::isSellableWithHotel($product['selling_preference_type'])
- )
+ if (!$product['booking_product']
+ && ($product['selling_preference_type'] == Product::SELLING_PREFERENCE_STANDALONE
+ || $product['selling_preference_type'] == Product::SELLING_PREFERENCE_HOTEL_STANDALONE
+ || $product['selling_preference_type'] == Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE
+ )
) {
$cover_image_arr = $objProduct->getCover($product['id_product']);
@@ -604,11 +603,10 @@ abstract class PaymentModuleCore extends Module
$cover_img = $this->context->link->getImageLink($product['link_rewrite'], $this->context->language->iso_code."-default", 'small_default');
}
$product_var_tpl['cover_img'] = $cover_img;
- $idHotel = isset($product['id_hotel']) ? $product['id_hotel'] : 0;
$serviceProducts = $objServiceProductCartDetail->getServiceProductsInCart(
$order->id_cart,
[],
- $idHotel,
+ null,
0,
null,
$product['id_product']
@@ -966,11 +964,9 @@ abstract class PaymentModuleCore extends Module
if (!empty($normalProducts)) {
$objServiceProductCartDetail = new ServiceProductCartDetail();
- foreach ($normalProducts as $product) {
+ foreach($normalProducts as $product) {
$idProduct = $product['id_product'];
- $productSellingType = $product['selling_preference_type'];
-
- if (Product::isSellableWithRoomType($productSellingType)) {
+ if (Product::SELLING_PREFERENCE_WITH_ROOM_TYPE == $product['selling_preference_type']) {
if ($roomTypeServices = $objServiceProductCartDetail->getServiceProductsInCart(
$this->context->cart->id,
[],
@@ -979,7 +975,6 @@ abstract class PaymentModuleCore extends Module
null,
$product['id_product']
)) {
-
$idOrderDetail = $objBookingDetail->getPsOrderDetailIdByIdProduct($idProduct, $order->id, $product['selling_preference_type']);
foreach ($roomTypeServices as $roomTypeService) {
if (!$roomTypeService['id_hotel_cart_booking']) {
@@ -1008,7 +1003,7 @@ abstract class PaymentModuleCore extends Module
$objServiceProductOrderDetail->save();
}
}
- } elseif (Product::isSellableWithHotel($productSellingType)) {
+ } elseif (Product::SELLING_PREFERENCE_HOTEL_STANDALONE == $product['selling_preference_type']) {
if ($hotelProducts = $objServiceProductCartDetail->getServiceProductsInCart(
$this->context->cart->id,
[],
@@ -1042,7 +1037,7 @@ abstract class PaymentModuleCore extends Module
}
}
- } elseif (Product::isSellableAsStandalone($productSellingType)) {
+ } elseif (Product::SELLING_PREFERENCE_STANDALONE == $product['selling_preference_type']) {
if ($standaloneProducts = $objServiceProductCartDetail->getServiceProductsInCart(
$this->context->cart->id,
[],
@@ -1067,6 +1062,63 @@ abstract class PaymentModuleCore extends Module
$objServiceProductOrderDetail->option_name = $standaloneProduct['option_name'];
$objServiceProductOrderDetail->quantity = $standaloneProduct['quantity'];
$objServiceProductOrderDetail->save();
+
+ }
+ }
+ } elseif (Product::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE == $product['selling_preference_type']) {
+ $idProductRoomType = null;
+ $idProductHotel = null;
+ if (isset($product['id_room_type']) && $product['id_room_type']) {
+ $idProductRoomType = $product['id_room_type'];
+ } elseif (isset($product['id_hotel']) && $product['id_hotel']) {
+ $idProductHotel = $product['id_hotel'];
+ }
+ if ($serviceProducts = $objServiceProductCartDetail->getServiceProductsInCart(
+ $this->context->cart->id,
+ [],
+ $idProductHotel,
+ null,
+ $idProductRoomType,
+ $product['id_product']
+ )) {
+ foreach ($serviceProducts as $serviceProduct) {
+ if ($serviceProduct['id_hotel']) {
+ $idOrderDetail = $objBookingDetail->getPsOrderDetailIdByIdProduct($idProduct, $order->id, Product::SELLING_PREFERENCE_HOTEL_STANDALONE);
+ } else {
+ $idOrderDetail = $objBookingDetail->getPsOrderDetailIdByIdProduct($idProduct, $order->id, Product::SELLING_PREFERENCE_WITH_ROOM_TYPE);
+ }
+ $objServiceProductOrderDetail = new ServiceProductOrderDetail();
+ $objServiceProductOrderDetail->id_product = $idProduct;
+ $objServiceProductOrderDetail->id_order = $order->id;
+ $objServiceProductOrderDetail->id_order_detail = $idOrderDetail;
+ $objServiceProductOrderDetail->id_cart = $this->context->cart->id;
+ $objServiceProductOrderDetail->unit_price_tax_excl = $serviceProduct['unit_price_tax_excl'];
+ $objServiceProductOrderDetail->unit_price_tax_incl = $serviceProduct['unit_price_tax_incl'];
+ $objServiceProductOrderDetail->total_price_tax_excl = $serviceProduct['total_price_tax_excl'];
+ $objServiceProductOrderDetail->total_price_tax_incl = $serviceProduct['total_price_tax_incl'];
+ $objServiceProductOrderDetail->name = $product['name'];
+ $objServiceProductOrderDetail->quantity = $serviceProduct['quantity'];
+ $objServiceProductOrderDetail->id_product_option = $serviceProduct['id_product_option'];
+ $objServiceProductOrderDetail->option_name = $serviceProduct['option_name'];
+ if ($serviceProduct['id_hotel']) {
+ $objServiceProductOrderDetail->id_hotel = $serviceProduct['id_hotel'];
+ if (Validate::isLoadedObject(
+ $objHotelBranch = new HotelBranchInformation($serviceProduct['id_hotel'], $this->context->cart->id_lang)
+ )) {
+ $objServiceProductOrderDetail->hotel_name = $objHotelBranch->hotel_name;
+ }
+ } else {
+ $roomBookingDetail = $objBookingDetail->getRowByIdOrderIdProductInDateRange(
+ $order->id,
+ $serviceProduct['id_room_type'],
+ $serviceProduct['date_from'],
+ $serviceProduct['date_to'],
+ $serviceProduct['id_room']
+ );
+ $objServiceProductOrderDetail->id_htl_booking_detail = $roomBookingDetail['id'];
+ $objServiceProductOrderDetail->auto_added = $product['auto_add_to_cart'];
+ }
+ $objServiceProductOrderDetail->save();
}
}
}
diff --git a/classes/Product.php b/classes/Product.php
index 3267ff979..32c6d0bfe 100644
--- a/classes/Product.php
+++ b/classes/Product.php
@@ -6938,64 +6938,33 @@ class ProductCore extends ObjectModel
}
}
- public static function getSellingPreferenceChannels($sellingPreferenceType)
+ public static function isSellableWithRoomType($idProduct)
{
- $channels = [
- 'with_room_type' => false,
- 'with_hotel' => false,
- 'standalone' => false,
- ];
-
- switch ((int) $sellingPreferenceType) {
- case self::SELLING_PREFERENCE_WITH_ROOM_TYPE:
- $channels['with_room_type'] = true;
- break;
-
- case self::SELLING_PREFERENCE_HOTEL_STANDALONE:
- $channels['with_hotel'] = true;
- break;
-
- case self::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE:
- $channels['with_room_type'] = true;
- $channels['with_hotel'] = true;
- break;
-
- case self::SELLING_PREFERENCE_STANDALONE:
- $channels['standalone'] = true;
- break;
-
- case self::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_STANDALONE:
- $channels['with_hotel'] = true;
- $channels['standalone'] = true;
- break;
-
- case self::SELLING_PREFERENCE_STANDALONE_AND_WITH_ROOM_TYPE:
- $channels['with_room_type'] = true;
- $channels['standalone'] = true;
- break;
-
- case self::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE_AND_WITH_STANDALONE:
- $channels['with_room_type'] = true;
- $channels['with_hotel'] = true;
- $channels['standalone'] = true;
- break;
- }
-
- return $channels;
+ return in_array((int) self::getSellingPreferenceType($idProduct), [
+ self::SELLING_PREFERENCE_WITH_ROOM_TYPE,
+ self::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE,
+ self::SELLING_PREFERENCE_STANDALONE_AND_WITH_ROOM_TYPE,
+ self::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE_AND_WITH_STANDALONE,
+ ]);
}
- public static function isSellableWithRoomType($sellingPreferenceType)
+ public static function isSellableWithHotel($idProduct)
{
- return self::getSellingPreferenceChannels($sellingPreferenceType)['with_room_type'];
+ return in_array((int) self::getSellingPreferenceType($idProduct), [
+ self::SELLING_PREFERENCE_HOTEL_STANDALONE,
+ self::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE,
+ self::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_STANDALONE,
+ self::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE_AND_WITH_STANDALONE,
+ ]);
}
- public static function isSellableWithHotel($sellingPreferenceType)
+ public static function isSellableAsStandalone($idProduct)
{
- return self::getSellingPreferenceChannels($sellingPreferenceType)['with_hotel'];
- }
-
- public static function isSellableAsStandalone($sellingPreferenceType)
- {
- return self::getSellingPreferenceChannels($sellingPreferenceType)['standalone'];
+ return in_array((int) self::getSellingPreferenceType($idProduct), [
+ self::SELLING_PREFERENCE_STANDALONE,
+ self::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_STANDALONE,
+ self::SELLING_PREFERENCE_STANDALONE_AND_WITH_ROOM_TYPE,
+ self::SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE_AND_WITH_STANDALONE,
+ ]);
}
}
diff --git a/classes/order/OrderDetail.php b/classes/order/OrderDetail.php
index 926020678..f9e165503 100644
--- a/classes/order/OrderDetail.php
+++ b/classes/order/OrderDetail.php
@@ -390,7 +390,7 @@ class OrderDetailCore extends ObjectModel
/**
* Calculate tax rule groups for the service product based on each associated room type.
*/
- if (!$this->is_booking_product && Product::isSellableWithRoomType($this->selling_preference_type)) {
+ if (!$this->is_booking_product && $this->selling_preference_type == Product::SELLING_PREFERENCE_WITH_ROOM_TYPE) {
if ($this->product_auto_add && $this->product_price_addition_type == Product::PRICE_ADDITION_TYPE_WITH_ROOM) {
return true;
}
diff --git a/classes/order/OrderInvoice.php b/classes/order/OrderInvoice.php
index 457a0baa9..f3e79c9d5 100644
--- a/classes/order/OrderInvoice.php
+++ b/classes/order/OrderInvoice.php
@@ -415,7 +415,7 @@ class OrderInvoiceCore extends ObjectModel
$order_detail = array_filter($order_detail, function($v) {
return ($v['is_booking_product']
|| ($v['product_auto_add']
- && Product::isSellableWithRoomType($v['selling_preference_type'])
+ && $v['selling_preference_type'] == Product::SELLING_PREFERENCE_WITH_ROOM_TYPE
&& $v['product_price_addition_type'] == ProductCore::PRICE_ADDITION_TYPE_WITH_ROOM)
);
});
@@ -480,7 +480,7 @@ class OrderInvoiceCore extends ObjectModel
$breakdown = array();
$order_detail = $this->getProducts();
$order_detail = array_filter($order_detail, function($v) {
- return (!$v['is_booking_product'] && !$v['product_auto_add'] && Product::isSellableWithRoomType($v['selling_preference_type']));
+ return (!$v['is_booking_product'] && !$v['product_auto_add'] && $v['selling_preference_type'] == Product::SELLING_PREFERENCE_WITH_ROOM_TYPE);
});
$details = $order->getProductTaxesDetails($order_detail, false,Product::SELLING_PREFERENCE_WITH_ROOM_TYPE);
@@ -545,7 +545,7 @@ class OrderInvoiceCore extends ObjectModel
$order_detail = array_filter($order_detail, function($v) {
return (!$v['is_booking_product']
&& $v['product_auto_add']
- && Product::isSellableWithRoomType($v['selling_preference_type'])
+ && $v['selling_preference_type'] == Product::SELLING_PREFERENCE_WITH_ROOM_TYPE
&& $v['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT
);
});
@@ -612,8 +612,8 @@ class OrderInvoiceCore extends ObjectModel
$order_detail = $this->getProducts();
$order_detail = array_filter($order_detail, function($v) {
return (!$v['is_booking_product'] && (
- Product::isSellableAsStandalone($v['selling_preference_type'])
- || Product::isSellableWithHotel($v['selling_preference_type'])
+ $v['selling_preference_type'] == Product::SELLING_PREFERENCE_STANDALONE
+ || $v['selling_preference_type'] == Product::SELLING_PREFERENCE_HOTEL_STANDALONE
));
});
diff --git a/classes/pdf/HTMLTemplateInvoice.php b/classes/pdf/HTMLTemplateInvoice.php
index 37b895353..c23fdd280 100644
--- a/classes/pdf/HTMLTemplateInvoice.php
+++ b/classes/pdf/HTMLTemplateInvoice.php
@@ -607,9 +607,8 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
foreach ($cart_htl_data[$type_key]['date_diff'] as $key => &$value) {
$value['avg_paid_unit_price_tax_excl'] = Tools::ps_round($value['avg_paid_unit_price_tax_excl'] / $value['num_rm'], 6);
}
- } else if (
- Product::isSellableWithHotel($type_value['selling_preference_type'])
- || Product::isSellableAsStandalone($type_value['selling_preference_type'])
+ } else if (Product::SELLING_PREFERENCE_HOTEL_STANDALONE == $type_value['selling_preference_type']
+ || Product::SELLING_PREFERENCE_STANDALONE == $type_value['selling_preference_type']
) {
$serviceProducts = $objServiceProductOrderDetail->getServiceProductsInOrder($order_obj->id, $type_value['id_order_detail'], $type_value['product_id']);
if ($taxes = OrderDetail::getTaxListStatic($type_value['id_order_detail'])) {
@@ -623,17 +622,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
$order_detail_tax_label = HTMLTemplateInvoice::l('No tax');
}
foreach ($serviceProducts as $serviceProduct) {
- $isStandaloneRow = empty($serviceProduct['id_hotel']) && empty($serviceProduct['id_htl_booking_detail']);
- $isHotelRow = !empty($serviceProduct['id_hotel']) && empty($serviceProduct['id_htl_booking_detail']);
-
- if (!(
- ($isStandaloneRow && Product::isSellableAsStandalone($type_value['selling_preference_type']))
- || ($isHotelRow && Product::isSellableWithHotel($type_value['selling_preference_type']))
- )) {
- continue;
- }
-
- if ($isHotelRow) {
+ if ($serviceProduct['id_hotel']) {
$objHotel = new HotelBranchInformation($serviceProduct['id_hotel'], $order_obj->id_lang);
$serviceProduct['hotel_name'] = $objHotel->hotel_name;
}
diff --git a/classes/pdf/HTMLTemplateOrderSlip.php b/classes/pdf/HTMLTemplateOrderSlip.php
index 0c2a50c86..16396243f 100644
--- a/classes/pdf/HTMLTemplateOrderSlip.php
+++ b/classes/pdf/HTMLTemplateOrderSlip.php
@@ -286,7 +286,7 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
$order_detail = array_filter($this->order->products, function($v) {
return ((isset($v['is_booking_product']) && $v['is_booking_product'])
|| ((isset($v['product_auto_add']) && $v['product_auto_add'])
- && Product::isSellableWithRoomType($v['selling_preference_type'])
+ && $v['selling_preference_type'] == Product::SELLING_PREFERENCE_WITH_ROOM_TYPE
&& $v['product_price_addition_type'] == ProductCore::PRICE_ADDITION_TYPE_WITH_ROOM)
);
});
@@ -347,14 +347,10 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
// - 'total_amount'
$breakdown = array();
$order_detail = array_filter($this->order->products, function($v) {
- return (
- !$v['is_booking_product']
- && empty($v['id_htl_booking'])
- && (
- Product::isSellableAsStandalone($v['selling_preference_type'])
- || Product::isSellableWithHotel($v['selling_preference_type'])
- )
- );
+ return (!$v['is_booking_product'] && (
+ $v['selling_preference_type'] == Product::SELLING_PREFERENCE_STANDALONE
+ || $v['selling_preference_type'] == Product::SELLING_PREFERENCE_HOTEL_STANDALONE
+ ));
});
$details = $this->order->getProductTaxesDetails($order_detail, false);
diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php
index 60cfce9a0..060a01970 100644
--- a/controllers/admin/AdminImportController.php
+++ b/controllers/admin/AdminImportController.php
@@ -1901,7 +1901,7 @@ class AdminImportControllerCore extends AdminController
}
$objServiceProduct = new Product($idServiceProduct);
- if (Product::isSellableWithRoomType($objServiceProduct->selling_preference_type)) {
+ if (Product::isSellableWithRoomType($objServiceProduct->id)) {
$objRoomTypeServiceProduct->addRoomProductLink(
$objServiceProduct->id,
$product->id,
@@ -2329,7 +2329,7 @@ class AdminImportControllerCore extends AdminController
$info['shop'] = explode($this->multiple_value_separator, $info['shop']);
RoomTypeServiceProduct::deleteRoomProductLink($product->id);
- if (Product::isSellableWithRoomType($product->selling_preference_type)) {
+ if (Product::isSellableWithRoomType($product->id)) {
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
if (isset($info['id_room_types']) && $info['id_room_types']) {
$objRoomTypeServiceProduct->addRoomProductLink(
diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php
index ba8a1e481..fcf696f8a 100644
--- a/controllers/admin/AdminOrdersController.php
+++ b/controllers/admin/AdminOrdersController.php
@@ -3357,14 +3357,14 @@ class AdminOrdersControllerCore extends AdminController
} else {
$product['image_link'] = $this->context->link->getImageLink($objProduct->link_rewrite, $this->context->language->iso_code.'-default', 'small_default');
}
- if (Product::isSellableWithHotel($product['selling_preference_type'])
- || Product::isSellableAsStandalone($product['selling_preference_type'])
+ if (Product::isSellableWithHotel($product['product_id'])
+ || Product::isSellableAsStandalone($product['product_id'])
) {
$serviceProducts = $objServiceProductOrderDetail->getServiceProductsInOrder($order->id, $product['id_order_detail'], $product['product_id']);
foreach ($serviceProducts as $serviceProduct) {
- if (!empty($serviceProduct['id_hotel']) && Product::isSellableWithHotel($product['selling_preference_type'])) {
+ if (!empty($serviceProduct['id_hotel']) && Product::isSellableWithHotel($product['product_id'])) {
$orderHotelServiceProducts[] = array_merge($product, $serviceProduct);
- } elseif (!$serviceProduct['id_hotel'] && !$serviceProduct['id_htl_booking_detail'] && Product::isSellableAsStandalone($product['selling_preference_type'])) {
+ } elseif (!$serviceProduct['id_hotel'] && !$serviceProduct['id_htl_booking_detail'] && Product::isSellableAsStandalone($product['product_id'])) {
$orderStandaloneServiceProducts[] = array_merge($product, $serviceProduct);
}
}
@@ -3702,10 +3702,10 @@ class AdminOrdersControllerCore extends AdminController
$hotelStandaloneProducts = array();
$standaloneProducts = array();
foreach ($allServiceProducts as $serviceProduct) {
- if (Product::isSellableWithHotel($serviceProduct['selling_preference_type'])) {
+ if (Product::isSellableWithHotel($serviceProduct['id_product'])) {
$hotelStandaloneProducts[] = $serviceProduct;
}
- if (Product::isSellableAsStandalone($serviceProduct['selling_preference_type'])) {
+ if (Product::isSellableAsStandalone($serviceProduct['id_product'])) {
$standaloneProducts[] = $serviceProduct;
}
}
@@ -4484,9 +4484,9 @@ class AdminOrdersControllerCore extends AdminController
if ($product->booking_product
|| (
- Product::isSellableWithRoomType($product->selling_preference_type)
- && !Product::isSellableWithHotel($product->selling_preference_type)
- && !Product::isSellableAsStandalone($product->selling_preference_type)
+ Product::isSellableWithRoomType($product->id)
+ && !Product::isSellableWithHotel($product->id)
+ && !Product::isSellableAsStandalone($product->id)
)
) { die(Tools::jsonEncode(array(
'result' => false,
@@ -5585,14 +5585,14 @@ class AdminOrdersControllerCore extends AdminController
$response['error'] = Tools::displayError('The product object cannot be loaded.');
} elseif ($objProduct->booking_product
|| (
- Product::isSellableWithRoomType($objProduct->selling_preference_type)
- && !Product::isSellableWithHotel($objProduct->selling_preference_type)
- && !Product::isSellableAsStandalone($objProduct->selling_preference_type)
+ Product::isSellableWithRoomType($objProduct->id)
+ && !Product::isSellableWithHotel($objProduct->id)
+ && !Product::isSellableAsStandalone($objProduct->id)
)
) {
$response['status'] = false;
$response['error'] = Tools::displayError('Invalid product. Please try adding any other product.');
- } elseif (!Product::isSellableAsStandalone($objProduct->selling_preference_type)
+ } elseif (!Product::isSellableAsStandalone($objProduct->id)
&& (!$addressTax->id_hotel
|| !Validate::isLoadedObject($objHotel = new HotelBranchInformation($addressTax->id_hotel)))
) {
@@ -5692,8 +5692,8 @@ class AdminOrdersControllerCore extends AdminController
if ($response['status']) {
// If product is standalone and current order is for a hotel then we have to create a new order for this product
$response['new_id_order'] = 0;
- if (Product::isSellableAsStandalone($objProduct->selling_preference_type)
- && !Product::isSellableWithHotel($objProduct->selling_preference_type)
+ if (Product::isSellableAsStandalone($objProduct->id)
+ && !Product::isSellableWithHotel($objProduct->id)
&& $addressTax->id_hotel
) {
$objPaymentModule = new BoOrder();
@@ -5777,9 +5777,9 @@ class AdminOrdersControllerCore extends AdminController
$objOrderDetail = new OrderDetail();
$cartProducts = $objCart->getProducts();
- if (Product::isSellableWithHotel($cartProducts[0]['selling_preference_type']) && $addressTax->id_hotel) {
+ if (Product::isSellableWithHotel($cartProducts[0]['id_product']) && $addressTax->id_hotel) {
$cartProducts[0]['selling_preference_type'] = Product::SELLING_PREFERENCE_HOTEL_STANDALONE;
- } elseif (Product::isSellableAsStandalone($cartProducts[0]['selling_preference_type'])) {
+ } elseif (Product::isSellableAsStandalone($cartProducts[0]['id_product'])) {
$cartProducts[0]['selling_preference_type'] = Product::SELLING_PREFERENCE_STANDALONE;
}
$objOrderDetail->createList($objOrder, $objCart, $objOrder->getCurrentOrderState(), $cartProducts, (isset($objOrderInvoice) ? $objOrderInvoice->id : 0), $useTaxes, (int)Tools::getValue('add_product_warehouse'));
@@ -7993,7 +7993,7 @@ class AdminOrdersControllerCore extends AdminController
$product['total'] = $totalPriceTaxExcl;
$product['total_wt'] = $totalPriceTaxIncl;
- if (Product::isSellableWithRoomType($product['selling_preference_type'])) {
+ if (Product::isSellableWithRoomType($product['id_product'])) {
$product['selling_preference_type'] = Product::SELLING_PREFERENCE_WITH_ROOM_TYPE;
}
}
diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php
index 29518137e..445f7ba96 100644
--- a/controllers/admin/AdminProductsController.php
+++ b/controllers/admin/AdminProductsController.php
@@ -418,7 +418,7 @@ class AdminProductsControllerCore extends AdminController
$allServiceProducts = array_values(array_filter(
$objProduct->getServiceProducts(null),
function ($serviceProduct) {
- return Product::isSellableWithRoomType($serviceProduct['selling_preference_type']);
+ return Product::isSellableWithRoomType($serviceProduct['id_product']);
}
));
$serviceProducts = array();
@@ -3227,7 +3227,7 @@ class AdminProductsControllerCore extends AdminController
$allServiceProducts = array_values(array_filter(
$obj->getServiceProducts(null),
function ($serviceProduct) {
- return Product::isSellableWithRoomType($serviceProduct['selling_preference_type']);
+ return Product::isSellableWithRoomType($serviceProduct['id_product']);
}
));
diff --git a/controllers/front/CartController.php b/controllers/front/CartController.php
index 67ee06439..10df365a1 100644
--- a/controllers/front/CartController.php
+++ b/controllers/front/CartController.php
@@ -180,8 +180,8 @@ class CartControllerCore extends FrontController
}
} else {
$idProductOption = Tools::getValue('id_product_option', null);
- $canSellWithHotel = Product::isSellableWithHotel($product->selling_preference_type);
- $canSellStandalone = Product::isSellableAsStandalone($product->selling_preference_type);
+ $canSellWithHotel = Product::isSellableWithHotel($product->id);
+ $canSellStandalone = Product::isSellableAsStandalone($product->id);
if ($canSellWithHotel && $this->id_hotel) {
$objServiceProductCartDetail = new ServiceProductCartDetail();
@@ -460,8 +460,8 @@ class CartControllerCore extends FrontController
$objHotelCartBookingData = new HotelCartBookingData();
$idProductOption = Tools::getValue('id_product_option');
$id_hotel = (int) Tools::getValue('id_hotel');
- $canSellWithHotel = Product::isSellableWithHotel($product->selling_preference_type);
- $canSellStandalone = Product::isSellableAsStandalone($product->selling_preference_type);
+ $canSellWithHotel = Product::isSellableWithHotel($product->id);
+ $canSellStandalone = Product::isSellableAsStandalone($product->id);
if ($canSellWithHotel && $id_hotel) {
if ($operator == 'up') {
@@ -643,7 +643,7 @@ class CartControllerCore extends FrontController
}
$this->context->cookie->avail_rooms = $availQty;
} elseif (
- Product::isSellableWithHotel($product->selling_preference_type)
+ Product::isSellableWithHotel($product->id)
&& $id_hotel
) {
$objServiceProductCartDetail = new ServiceProductCartDetail();
@@ -664,7 +664,7 @@ class CartControllerCore extends FrontController
'id_product_option' => isset($idProductOption) ? $idProductOption : null
));
}
- } elseif (Product::isSellableAsStandalone($product->selling_preference_type)) {
+ } elseif (Product::isSellableAsStandalone($product->id)) {
$objServiceProductCartDetail = new ServiceProductCartDetail();
$update_quantity = $objServiceProductCartDetail->updateCartServiceProduct(
$this->context->cart->id,
diff --git a/controllers/front/GuestTrackingController.php b/controllers/front/GuestTrackingController.php
index 3b6fd2b2b..991ffa5c5 100644
--- a/controllers/front/GuestTrackingController.php
+++ b/controllers/front/GuestTrackingController.php
@@ -497,7 +497,7 @@ class GuestTrackingControllerCore extends FrontController
$value['avg_price_diff_tax_excl'] = abs(Tools::ps_round($value['avg_paid_unit_price_tax_excl'] - $value['product_price_tax_excl'], 6));
$value['avg_price_diff_tax_incl'] = abs(Tools::ps_round($value['avg_paid_unit_price_tax_incl'] - $value['product_price_tax_incl'], 6));
}
- } elseif (Product::isSellableWithRoomType($type_value['selling_preference_type'])) {
+ } elseif (Product::SELLING_PREFERENCE_WITH_ROOM_TYPE == $type_value['selling_preference_type']) {
if ($type_value['product_auto_add'] && $type_value['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT) {
$total_convenience_fee_ti += $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$idOrder,
@@ -524,7 +524,7 @@ class GuestTrackingControllerCore extends FrontController
1
);
}
- } else if (Product::isSellableWithHotel($type_value['selling_preference_type'])) {
+ } else if (Product::SELLING_PREFERENCE_HOTEL_STANDALONE == $type_value['selling_preference_type']) {
$cover_image_arr = $product->getCover($type_value['product_id']);
if (!empty($cover_image_arr)) {
@@ -536,7 +536,7 @@ class GuestTrackingControllerCore extends FrontController
foreach ($hotelProducts as $hotelProduct) {
$hotelServiceProducts[] = array_merge($type_value, $hotelProduct);
}
- } else if (Product::isSellableAsStandalone($type_value['selling_preference_type'])) {
+ } else if (Product::SELLING_PREFERENCE_STANDALONE == $type_value['selling_preference_type']) {
$cover_image_arr = $product->getCover($type_value['product_id']);
if (!empty($cover_image_arr)) {
diff --git a/controllers/front/OrderConfirmationController.php b/controllers/front/OrderConfirmationController.php
index e40a7bec0..dd428dff2 100644
--- a/controllers/front/OrderConfirmationController.php
+++ b/controllers/front/OrderConfirmationController.php
@@ -362,7 +362,7 @@ class OrderConfirmationControllerCore extends FrontController
$totalRoomsBooked += 1;
}
- } else if (Product::isSellableWithHotel($type_value['selling_preference_type'])) {
+ } else if ($type_value['selling_preference_type'] == Product::SELLING_PREFERENCE_HOTEL_STANDALONE) {
$cover_image_arr = $product->getCover($type_value['product_id']);
if (!empty($cover_image_arr)) {
@@ -385,7 +385,7 @@ class OrderConfirmationControllerCore extends FrontController
}
$cart_hotel_service_products[] = $type_value;
}
- } else if (Product::isSellableAsStandalone($type_value['selling_preference_type'])) {
+ } else if ($type_value['selling_preference_type'] == Product::SELLING_PREFERENCE_STANDALONE) {
$cover_image_arr = $product->getCover($type_value['product_id']);
if (!empty($cover_image_arr)) {
diff --git a/controllers/front/OrderDetailController.php b/controllers/front/OrderDetailController.php
index c71439dab..0a949c7e4 100644
--- a/controllers/front/OrderDetailController.php
+++ b/controllers/front/OrderDetailController.php
@@ -358,7 +358,7 @@ class OrderDetailControllerCore extends FrontController
$value['avg_price_diff_tax_excl'] = abs(Tools::ps_round($value['avg_paid_unit_price_tax_excl'] - $value['product_price_tax_excl'], 6));
$value['avg_price_diff_tax_incl'] = abs(Tools::ps_round($value['avg_paid_unit_price_tax_incl'] - $value['product_price_tax_incl'], 6));
}
- } else if (Product::isSellableWithRoomType($type_value['selling_preference_type'])) {
+ } else if (Product::SELLING_PREFERENCE_WITH_ROOM_TYPE ==$type_value['selling_preference_type']) {
if ($type_value['product_auto_add'] && $type_value['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT) {
$total_convenience_fee_ti += $objServiceProductOrderDetail->getRoomTypeServiceProducts(
$id_order,
@@ -385,7 +385,7 @@ class OrderDetailControllerCore extends FrontController
1
);
}
- } else if (Product::isSellableWithHotel($type_value['selling_preference_type'])) {
+ } else if (Product::SELLING_PREFERENCE_HOTEL_STANDALONE == $type_value['selling_preference_type']) {
$hotelProducts = $objServiceProductOrderDetail->getServiceProductsInOrder($id_order, $type_value['id_order_detail'], $type_value['product_id']);
foreach ($hotelProducts as $hotelProduct) {
$hotelServiceProducts[] = array_merge($type_value, $hotelProduct);
@@ -404,7 +404,7 @@ class OrderDetailControllerCore extends FrontController
}
$serviceProductsFormatted[$hotelProduct['id_product']]['options'][] = $hotelProduct;
}
- } else if (Product::isSellableAsStandalone($type_value['selling_preference_type'])) {
+ } else if (Product::SELLING_PREFERENCE_STANDALONE == $type_value['selling_preference_type']) {
$standaloneProducts = $objServiceProductOrderDetail->getServiceProductsInOrder($id_order, $type_value['id_order_detail'], $type_value['product_id']);
foreach ($standaloneProducts as $standaloneProduct) {
$standaloneServiceProducts[] = array_merge($type_value, $standaloneProduct);
diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php
index 22e74f24b..4eeaaa987 100644
--- a/controllers/front/ProductController.php
+++ b/controllers/front/ProductController.php
@@ -135,12 +135,12 @@ class ProductControllerCore extends FrontController
// if product is a service product then check type of selling preference
if (!$this->product->booking_product) {
if (
- Product::isSellableWithRoomType($this->product->selling_preference_type)
- && !Product::isSellableWithHotel($this->product->selling_preference_type)
- && !Product::isSellableAsStandalone($this->product->selling_preference_type)
+ Product::isSellableWithRoomType($this->product->id)
+ && !Product::isSellableWithHotel($this->product->id)
+ && !Product::isSellableAsStandalone($this->product->id)
) {
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
- } elseif (Product::isSellableWithHotel($this->product->selling_preference_type)) {
+ } elseif (Product::isSellableWithHotel($this->product->id)) {
// For any hotel-sellable service product, ensure hotel associations exist.
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
$associatedHotels = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($this->product->id);
@@ -921,9 +921,9 @@ class ProductControllerCore extends FrontController
$buying_option = false
) {
$smartyVars = array();
- $smartyVars['sellable_with_hotel'] = Product::isSellableWithHotel($this->product->selling_preference_type);
- $smartyVars['sellable_as_standalone'] = Product::isSellableAsStandalone($this->product->selling_preference_type);
- if (Product::isSellableWithHotel($this->product->selling_preference_type)) {
+ $smartyVars['sellable_with_hotel'] = Product::isSellableWithHotel($this->product->id);
+ $smartyVars['sellable_as_standalone'] = Product::isSellableAsStandalone($this->product->id);
+ if (Product::isSellableWithHotel($this->product->id)) {
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
if ($associatedHotels = $objRoomTypeServiceProduct->getAssociatedHotelsAndRoomType($this->product->id)['hotel']) {
diff --git a/modules/blockcart/blockcart.php b/modules/blockcart/blockcart.php
index 2c2ea59ac..163d14acd 100644
--- a/modules/blockcart/blockcart.php
+++ b/modules/blockcart/blockcart.php
@@ -121,7 +121,7 @@ class Blockcart extends Module
if (!$product['booking_product']) {
$product['hasOptions'] = ServiceProductOption::productHasOptions($product['id_product']);
- if (Product::isSellableAsStandalone($product['selling_preference_type'])) {
+ if (Product::isSellableAsStandalone($product['id_product'])) {
$product['total_price_tax_incl'] = 0;
$product['total_price_tax_excl'] = 0;
$product['amount'] = 0;
@@ -148,7 +148,7 @@ class Blockcart extends Module
$nbTotalProducts += (int) $product['standalone_total_qty'];
}
- if (Product::isSellableWithHotel($product['selling_preference_type'])) {
+ if (Product::isSellableWithHotel($product['id_product'])) {
if ($serviceProducts = $objServiceProductCartDetail->getServiceProductsInCart(
$params['cart']->id,
[(int) $product['selling_preference_type']],
@@ -322,8 +322,8 @@ class Blockcart extends Module
$addedProduct['date_from'] = Tools::displayDate($addedProduct['date_from'], null, $fullDate);
$addedProduct['date_to'] = Tools::displayDate($addedProduct['date_to'], null, $fullDate);
} else {
- $canSellWithHotel = Product::isSellableWithHotel($objProduct->selling_preference_type);
- $canSellStandalone = Product::isSellableAsStandalone($objProduct->selling_preference_type);
+ $canSellWithHotel = Product::isSellableWithHotel($objProduct->id);
+ $canSellStandalone = Product::isSellableAsStandalone($objProduct->id);
if ($canSellWithHotel && !empty($addedProduct['id_hotel'])) {
$addedProduct['unit_price'] = RoomTypeServiceProductPrice::getPrice(
diff --git a/modules/blockcart/blockcart.tpl b/modules/blockcart/blockcart.tpl
index ec29d14f4..6caf931e7 100644
--- a/modules/blockcart/blockcart.tpl
+++ b/modules/blockcart/blockcart.tpl
@@ -63,15 +63,15 @@
{foreach from=$products key=data_k item='product' name='myLoop'}
{* only show products that are booking or global without room *}
- {if $product.booking_product || Product::isSellableAsStandalone($product.selling_preference_type) || Product::isSellableWithHotel($product.selling_preference_type)}
+ {if $product.booking_product || Product::isSellableAsStandalone($product.id_product) || Product::isSellableWithHotel($product.id_product)}
{if isset($product.hotel_wise_data) && $product.hotel_wise_data}
{foreach $product.hotel_wise_data as $hotel_wise_data}
{include file="./cartrow.tpl" hotel_wise_data=$hotel_wise_data}
{/foreach}
{/if}
{if $product.booking_product
- || (!Product::isSellableWithHotel($product.selling_preference_type) && !Product::isSellableWithRoomType($product.selling_preference_type))
- || (Product::isSellableAsStandalone($product.selling_preference_type) && $product.standalone_total_qty > 0)}
+ || (!Product::isSellableWithHotel($product.id_product) && !Product::isSellableWithRoomType($product.id_product))
+ || (Product::isSellableAsStandalone($product.id_product) && $product.standalone_total_qty > 0)}
{include file="./cartrow.tpl" hotel_wise_data=false}
{/if}
{/if}
diff --git a/modules/blockcart/cartrow.tpl b/modules/blockcart/cartrow.tpl
index 68d0cbc96..16363bca3 100644
--- a/modules/blockcart/cartrow.tpl
+++ b/modules/blockcart/cartrow.tpl
@@ -11,7 +11,7 @@
{/block}
{block name='blockcart_shopping_cart_hotel_name'}
- {if Product::isSellableWithHotel($product.selling_preference_type)}
+ {if Product::isSellableWithHotel($product.id_product)}
{$hotel_wise_data.hotel_name|escape:'html':'UTF-8'}
@@ -29,7 +29,7 @@
{if !isset($product.is_gift) || !$product.is_gift}
{if $product.booking_product}
{displayWtPrice p="`$product.bookingData.total_room_type_amount`"}
- {else if Product::isSellableWithHotel($product.selling_preference_type)}
+ {else if Product::isSellableWithHotel($product.id_product)}
{if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice p="`$hotel_wise_data.total_price_tax_excl`"}{else}{displayWtPrice p="`$hotel_wise_data.total_price_tax_incl`"}{/if}
{else}
{if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice p="`$product.total_price_tax_excl`"}{else}{displayWtPrice p="`$product.total_price_tax_incl`"}{/if}
@@ -53,9 +53,9 @@
{if $product.booking_product}
{$product.bookingData['total_num_rooms']}
{elseif $product.allow_multiple_quantity}
- {if Product::isSellableWithHotel($product.selling_preference_type)}
+ {if Product::isSellableWithHotel($product.id_product)}
{$hotel_wise_data.total_qty}
- {elseif Product::isSellableAsStandalone($product.selling_preference_type)}
+ {elseif Product::isSellableAsStandalone($product.id_product)}
{$product.cart_quantity}
{/if}
{/if}
@@ -99,9 +99,9 @@
{/block}
{else if $product.hasOptions}
{block name='blockcart_shopping_cart_options'}
- {if Product::isSellableWithHotel($product.selling_preference_type)}
+ {if Product::isSellableWithHotel($product.id_product)}
{assign var='options' value=$hotel_wise_data.options}
- {else if Product::isSellableAsStandalone($product.selling_preference_type)}
+ {else if Product::isSellableAsStandalone($product.id_product)}
{assign var='options' value=$product.options}
{/if}
diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php
index 4a8565923..b77b92d4a 100644
--- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php
+++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php
@@ -961,9 +961,9 @@ class HotelCartBookingData extends ObjectModel
if (!$product->active || (!$forAdminCart && !$product->available_for_order)) {
$toRemoveService = 1;
} else if ($checkServiceRoomLink) {
- $isSellableWithRoomType = Product::isSellableWithRoomType($product->selling_preference_type);
- $isSellableWithHotel = Product::isSellableWithHotel($product->selling_preference_type);
- $isSellableAsStandalone = Product::isSellableAsStandalone($product->selling_preference_type);
+ $isSellableWithRoomType = Product::isSellableWithRoomType($product->id);
+ $isSellableWithHotel = Product::isSellableWithHotel($product->id);
+ $isSellableAsStandalone = Product::isSellableAsStandalone($product->id);
if (ServiceProductOption::productHasOptions($service['id_product'])) {
$skipOptionValidation = false;
diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php
index 591e0d89d..e2572d465 100644
--- a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php
+++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php
@@ -624,7 +624,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
if (!$product->id || !$product->active) {
$this->errors[] = $this->l('This product is no longer available.');
}
- if ($product->booking_product || !Product::isSellableAsStandalone($product->selling_preference_type)) {
+ if ($product->booking_product || !Product::isSellableAsStandalone($product->id)) {
// cannot be added without room type or is a booking product.
$this->errors[] = $this->l('This product is either a room type or additional service and cannot be added through this method.');
} elseif (!$product->allow_multiple_quantity) {
diff --git a/themes/hotel-reservation-theme/modules/blockcart/blockcart.tpl b/themes/hotel-reservation-theme/modules/blockcart/blockcart.tpl
index 182945dfe..47121ca96 100644
--- a/themes/hotel-reservation-theme/modules/blockcart/blockcart.tpl
+++ b/themes/hotel-reservation-theme/modules/blockcart/blockcart.tpl
@@ -63,15 +63,15 @@
{foreach from=$products key=data_k item='product' name='myLoop'}
{* only show products that are booking or global without room *}
- {if $product.booking_product || Product::isSellableAsStandalone($product.selling_preference_type) || Product::isSellableWithHotel($product.selling_preference_type)}
- {if Product::isSellableWithHotel($product.selling_preference_type) && isset($product.hotel_wise_data) && $product.hotel_wise_data}
+ {if $product.booking_product || Product::isSellableAsStandalone($product.id_product) || Product::isSellableWithHotel($product.id_product)}
+ {if Product::isSellableWithHotel($product.id_product) && isset($product.hotel_wise_data) && $product.hotel_wise_data}
{foreach $product.hotel_wise_data as $hotel_wise_data}
{include file="./cartrow.tpl" hotel_wise_data=$hotel_wise_data}
{/foreach}
{/if}
{if $product.booking_product
- || (!Product::isSellableWithHotel($product.selling_preference_type) && !Product::isSellableWithRoomType($product.selling_preference_type))
- || (Product::isSellableAsStandalone($product.selling_preference_type) && $product.standalone_total_qty > 0)}
+ || (!Product::isSellableWithHotel($product.id_product) && !Product::isSellableWithRoomType($product.id_product))
+ || (Product::isSellableAsStandalone($product.id_product) && $product.standalone_total_qty > 0)}
{include file="./cartrow.tpl" hotel_wise_data=false}
{/if}
{/if}
diff --git a/themes/hotel-reservation-theme/modules/blockcart/cartrow.tpl b/themes/hotel-reservation-theme/modules/blockcart/cartrow.tpl
index f7ce76c25..8a31e3b2f 100644
--- a/themes/hotel-reservation-theme/modules/blockcart/cartrow.tpl
+++ b/themes/hotel-reservation-theme/modules/blockcart/cartrow.tpl
@@ -55,7 +55,7 @@
{elseif $product.allow_multiple_quantity}
{if isset($hotel_wise_data.id_hotel) && $hotel_wise_data.id_hotel}
{$hotel_wise_data.total_qty}
- {elseif Product::isSellableAsStandalone($product.selling_preference_type)}
+ {elseif Product::isSellableAsStandalone($product.id_product)}
{$product.standalone_total_qty|intval}
{/if}
{/if}