diff --git a/admin/themes/default/sass/controllers/_order.sass b/admin/themes/default/sass/controllers/_order.sass index c5ccaa579..fab2d5f1c 100644 --- a/admin/themes/default/sass/controllers/_order.sass +++ b/admin/themes/default/sass/controllers/_order.sass @@ -4,10 +4,20 @@ #customization_list border: 0px +.booking_occupancy_edit, .booking_occupancy + .occupancy-info-separator + margin-top: 0px + margin-bottom: 10px + .close_occupancy + text-decoration: underline + .booking_occupancy .booking_occupancy_wrapper max-height: 250px overflow-x: auto + label.room_num_wrapper + text-decoration: underline + margin-bottom: 10px #booking-documents-modal .documents-list @@ -16,3 +26,5 @@ img max-height: 55px max-width: 55px + + diff --git a/admin/themes/default/template/controllers/orders/_new_product.tpl b/admin/themes/default/template/controllers/orders/_new_product.tpl index 2aed227d3..4082199eb 100644 --- a/admin/themes/default/template/controllers/orders/_new_product.tpl +++ b/admin/themes/default/template/controllers/orders/_new_product.tpl @@ -74,9 +74,6 @@ -
-
- {l s='Add Room'} -
+
+
+ {l s='Add Room'} + {l s='close'} +
diff --git a/admin/themes/default/template/controllers/orders/_product_line.tpl b/admin/themes/default/template/controllers/orders/_product_line.tpl index e68b185df..f89971808 100644 --- a/admin/themes/default/template/controllers/orders/_product_line.tpl +++ b/admin/themes/default/template/controllers/orders/_product_line.tpl @@ -79,7 +79,7 @@ {/if} - {if $order->with_occupancy && $data['children']} + {if $data['children']} - - {else} - - {/if} + + diff --git a/classes/pdf/HTMLTemplateInvoice.php b/classes/pdf/HTMLTemplateInvoice.php index 236780c7d..073fbe697 100644 --- a/classes/pdf/HTMLTemplateInvoice.php +++ b/classes/pdf/HTMLTemplateInvoice.php @@ -353,10 +353,8 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate } else { $order_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($this->order->id, $customer->id_guest, $type_value['product_id']); } - $rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['product_id']); $cart_htl_data[$type_key]['id_product'] = $type_value['product_id']; - $cart_htl_data[$type_key]['hotel_name'] = $rm_dtl['hotel_name']; $objBookingDemand = new HotelBookingDemands(); foreach ($order_bk_data as $data_k => $data_v) { $date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']); @@ -368,6 +366,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate $unit_price_tax_excl = $order_details_obj->unit_price_tax_excl; $unit_price_tax_incl = $order_details_obj->unit_price_tax_incl; + $cart_htl_data[$type_key]['hotel_name'] = $data_v['hotel_name']; $cart_htl_data[$type_key]['name'] = $order_details_obj->product_name; $cart_htl_data[$type_key]['unit_price_tax_excl'] = $unit_price_tax_excl; $cart_htl_data[$type_key]['unit_price_tax_incl'] = $unit_price_tax_incl; diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 63a271ecd..7d97a1202 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -1517,7 +1517,7 @@ class AdminOrdersControllerCore extends AdminController // if the current stock requires a warning if ($product['current_stock'] <= 0 && $display_out_of_stock_warning) { - $this->displayWarning($this->l('This product is out of stock: ').' '.$product['product_name']); + $this->displayWarning($this->l('This booked room type is not found: ').' '.$product['product_name']); } if ($product['id_warehouse'] != 0) { $warehouse = new Warehouse((int)$product['id_warehouse']); @@ -2812,8 +2812,9 @@ class AdminOrdersControllerCore extends AdminController $objCartBookingData->children = $room_occupancy['children']; $objCartBookingData->child_ages = $room_occupancy['children'] ? json_encode($room_occupancy['child_ages']) : json_encode(array()); } else { + // if room is being booked without occupancy selection the for adults set base occupancy and children will be 0 $objCartBookingData->adults = $room_info_by_id_product['adults']; - $objCartBookingData->children = $room_info_by_id_product['children']; + $objCartBookingData->children = 0; $objCartBookingData->child_ages = json_encode(array()); } $objCartBookingData->save(); @@ -3250,14 +3251,6 @@ class AdminOrdersControllerCore extends AdminController 'error' => Tools::displayError('The OrderDetail object cannot be loaded.') ))); - $product = new Product($order_detail->product_id); - if (!Validate::isLoadedObject($product)) { - die(json_encode(array( - 'result' => false, - 'error' => Tools::displayError('The product object cannot be loaded.') - ))); - } - $address = new Address(Tools::getValue('id_address')); if (!Validate::isLoadedObject($address)) { die(json_encode(array( @@ -3268,14 +3261,6 @@ class AdminOrdersControllerCore extends AdminController die(json_encode(array( 'result' => true, - 'product' => $product, - 'tax_rate' => $product->getTaxesRate($address), - /*Original*/ - 'price_tax_incl' => Product::getPriceStatic($product->id, true, $order_detail->product_attribute_id, 2), - 'price_tax_excl' => Product::getPriceStatic($product->id, false, $order_detail->product_attribute_id, 2), - /*Changed by webkul because attribute_id will always be 0 (No combination)*/ - // 'price_tax_incl' => Product::getPriceStatic($product->id, true, 0, 2), - // 'price_tax_excl' => Product::getPriceStatic($product->id, false, 0, 2), 'reduction_percent' => $order_detail->reduction_percent ))); } @@ -3335,12 +3320,10 @@ class AdminOrdersControllerCore extends AdminController $product_quantity = (int) $obj_booking_detail->getNumberOfDays($new_date_from, $new_date_to); $old_product_quantity = (int) $obj_booking_detail->getNumberOfDays($old_date_from, $old_date_to); $qty_diff = $product_quantity - $old_product_quantity; - if ($order->with_occupancy) { - $occupancy = array_shift(Tools::getValue('occupancy')); - $adults = $occupancy['adults']; - $children = $occupancy['children']; - $child_ages = $occupancy['child_ages']; - } + $occupancy = array_shift(Tools::getValue('occupancy')); + $adults = $occupancy['adults']; + $children = $occupancy['children']; + $child_ages = $occupancy['child_ages']; /*By webkul to validate fields before deleting the cart and order data form the tables*/ if ($id_hotel == '') { @@ -3401,33 +3384,31 @@ class AdminOrdersControllerCore extends AdminController } // validations if order is with occupancy - if ($order->with_occupancy) { - if (!isset($adults) || !$adults || !Validate::isUnsignedInt($adults)) { - die(json_encode(array( - 'result' => false, - 'error' => Tools::displayError('Invalid number of adults.'), - ))); - } elseif (!Validate::isUnsignedInt($children)) { - die(json_encode(array( - 'result' => false, - 'error' => Tools::displayError('Invalid number of children.'), - ))); - } + if (!isset($adults) || !$adults || !Validate::isUnsignedInt($adults)) { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('Invalid number of adults.'), + ))); + } elseif (!Validate::isUnsignedInt($children)) { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('Invalid number of children.'), + ))); + } - if ($children > 0) { - if (!isset($child_ages) || ($children != count($child_ages))) { - die(json_encode(array( - 'result' => false, - 'error' => Tools::displayError('Please provide all children age.'), - ))); - } else { - foreach($child_ages as $childAge) { - if (!Validate::isUnsignedInt($childAge)) { - die(json_encode(array( - 'result' => false, - 'error' => Tools::displayError('Invalid children age.'), - ))); - } + if ($children > 0) { + if (!isset($child_ages) || ($children != count($child_ages))) { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('Please provide all children age.'), + ))); + } else { + foreach($child_ages as $childAge) { + if (!Validate::isUnsignedInt($childAge)) { + die(json_encode(array( + 'result' => false, + 'error' => Tools::displayError('Invalid children age.'), + ))); } } } @@ -3464,26 +3445,46 @@ class AdminOrdersControllerCore extends AdminController $params['id_room'] = $roomInfo['id_room']; if ($roomInfo['id_room'] == $id_room && (strtotime($roomInfo['date_from']) == strtotime($old_date_from))) { - $params = array_merge($params, array('date_from' => $new_date_from, 'date_to' => $new_date_to)); - $this->createFeaturePrice($params); + // Check if room type is still not deleted + if (Validate::isLoadedObject($objProduct = new Product($roomInfo['id_product']))) { + // If room type is NOT DELETED then use current room type price calculation + $params = array_merge($params, array('date_from' => $new_date_from, 'date_to' => $new_date_to)); + $this->createFeaturePrice($params); - $roomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( - $roomInfo['id_product'], - $new_date_from, - $new_date_to, - 0, - Group::getCurrent()->id, - $cart->id, - $cart->id_guest, - $roomInfo['id_room'], - 0 - ); + $roomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( + $roomInfo['id_product'], + $new_date_from, + $new_date_to, + 0, + Group::getCurrent()->id, + $cart->id, + $cart->id_guest, + $roomInfo['id_room'], + 0 + ); - $totalProductPriceAfterTE += (float) $roomTotalPrice['total_price_tax_excl']; - $totalProductPriceAfterTI += (float) $roomTotalPrice['total_price_tax_incl']; + $totalProductPriceAfterTE += (float) $roomTotalPrice['total_price_tax_excl']; + $totalProductPriceAfterTI += (float) $roomTotalPrice['total_price_tax_incl']; - $totalRoomPriceAfterTE += (float) $roomTotalPrice['total_price_tax_excl']; - $totalRoomPriceAfterTI += (float) $roomTotalPrice['total_price_tax_incl']; + $totalRoomPriceAfterTE += (float) $roomTotalPrice['total_price_tax_excl']; + $totalRoomPriceAfterTI += (float) $roomTotalPrice['total_price_tax_incl']; + } else { + // If room type is DELETED use order details information for price calculation + $taxCalculator = $order_detail->getTaxCalculator(); + // room price with tax + $roomPriceTI = $taxCalculator->addTaxes($room_unit_price); + + $totalRoomPriceTE = Tools::ps_round(($room_unit_price * $product_quantity), _PS_PRICE_COMPUTE_PRECISION_); + $totalRoomPriceTI = Tools::ps_round(($roomPriceTI * $product_quantity), _PS_PRICE_COMPUTE_PRECISION_); + + // room price changes + $totalRoomPriceAfterTE += (float) $totalRoomPriceTE; + $totalRoomPriceAfterTI += (float) $totalRoomPriceTI; + + // Total product price changes + $totalProductPriceAfterTE += (float) $totalRoomPriceTE; + $totalProductPriceAfterTI += (float) $totalRoomPriceTI; + } } else { $totalProductPriceAfterTE += (float) $roomInfo['total_price_tax_excl']; $totalProductPriceAfterTI += (float) $roomInfo['total_price_tax_incl']; @@ -5494,4 +5495,4 @@ class AdminOrdersControllerCore extends AdminController } } } -} \ No newline at end of file +} diff --git a/js/admin/orders.js b/js/admin/orders.js index c3780bac7..b2a5de42d 100644 --- a/js/admin/orders.js +++ b/js/admin/orders.js @@ -483,13 +483,6 @@ function initProductEvents() { $('tr#new_product input, tr#new_product select, tr#new_product button').removeAttr('disabled'); $('tr#new_product .booking_guest_occupancy').removeClass('disabled'); - if (data.room_type_info) { - $('tr#new_product .max_adults').val(data.room_type_info.max_adults); - $('tr#new_product .max_children').val(data.room_type_info.max_children); - $('tr#new_product .max_guests').val(data.room_type_info.max_guests); - $('tr#new_product .num_adults').attr('max', data.room_type_info.max_adults); - $('tr#new_product .num_children').attr('max', data.room_type_info.max_children); - } // Keep product variable current_product = data; @@ -563,52 +556,30 @@ function initProductEvents() addProductRefreshTotal(); }); - - $(document).on('change', '.num_occupancy', function(e) { let current_room_occupancy = 0; $(this).closest('.occupancy_info_block').find('.num_occupancy').each(function(){ current_room_occupancy += parseInt($(this).val()); }); - let max_guests_in_room = $(this).closest(".booking_occupancy_wrapper").find('.max_guests').val(); - let max_allowed_for_current = (max_guests_in_room - current_room_occupancy) + parseInt($(this).val()); - if ($(this).val() > $(this).attr('max')) { - $(this).val($(this).attr('max')); - } - if ($(this).val() < $(this).attr('min')) { - $(this).val($(this).attr('min')); - } - if ($(this).val() > max_allowed_for_current) { - $(this).val(max_allowed_for_current); - } - if ($(this).hasClass('num_children')) { + + if ($(this).hasClass('num_children')) { var totalChilds = $(this).closest('.occupancy_info_block').find('.guest_child_age').length; if (totalChilds < $(this).val()) { - let max_child_in_room; - if ($(this).closest(".booking_occupancy_wrapper").find('.max_children').val()) { - max_child_in_room = $(this).closest(".booking_occupancy_wrapper").find('.max_children').val(); - } else { - max_child_in_room = window.max_child_in_room; - } - if (totalChilds < max_child_in_room) { - $(this).closest('.occupancy_info_block').find('.children_age_info_block').show(); - while ($(this).closest('.occupancy_info_block').find('.guest_child_age').length < $(this).val()) { + $(this).closest('.occupancy_info_block').find('.children_age_info_block').show(); + while ($(this).closest('.occupancy_info_block').find('.guest_child_age').length < $(this).val()) { + var roomBlockIndex = parseInt($(this).closest('.occupancy_info_block').attr('occ_block_index')); - - var roomBlockIndex = parseInt($(this).closest('.occupancy_info_block').attr('occ_block_index')); - - var childAgeSelect = '

'; - childAgeSelect += ''; - childAgeSelect += '

'; - $(this).closest('.occupancy_info_block').find('.children_ages').append(childAgeSelect); - } - } + var childAgeSelect = '

'; + childAgeSelect += ''; + childAgeSelect += '

'; + $(this).closest('.occupancy_info_block').find('.children_ages').append(childAgeSelect); + } } else { let child = $(this).val(); $(this).closest('.occupancy_info_block').find('.guest_child_age').each(function(ind, element) { @@ -622,8 +593,8 @@ function initProductEvents() } } - setRoomTypeGuestOccupancy($(this).closest('.booking_occupancy_wrapper')); + setRoomTypeGuestOccupancy($(this).closest('.booking_occupancy_wrapper')); }); @@ -635,7 +606,7 @@ function initProductEvents() if ($('.booking_occupancy_wrapper:visible').length) { var occupancy_wrapper = $('.booking_occupancy_wrapper:visible'); $(occupancy_wrapper).find(".occupancy_info_block").addClass('selected'); - if (!($(e.target).closest(".booking_occupancy_wrapper").length || $(e.target).closest(".booking_guest_occupancy").length || $(e.target).closest(".ajax_add_to_cart_button").length || $(e.target).closest(".exclusive.book_now_submit").length || $(e.target).closest(".remove-room-link").length)) { + if (!($(e.target).closest(".booking_guest_occupancy").length || $(e.target).closest(".ajax_add_to_cart_button").length || $(e.target).closest(".exclusive.book_now_submit").length || $(e.target).closest(".remove-room-link").length)) { let hasErrors = 0; let adults = $(occupancy_wrapper).find(".num_adults").map(function(){return $(this).val();}).get(); @@ -647,54 +618,59 @@ function initProductEvents() hasErrors = 1; showErrorMessage(invalid_occupancy_txt); } else { - $(occupancy_wrapper).find('.occupancy_count').removeClass('error_border'); + $(occupancy_wrapper).find('.num_occupancy').removeClass('alert-danger'); // validate values of adults and children adults.forEach(function (item, index) { - if (isNaN(item) || parseInt(item) < 1) { + if (item == '' || isNaN(item) || parseInt(item) < 1) { hasErrors = 1; - $(occupancy_wrapper).find(".num_adults").eq(index).closest('.occupancy_count_block').find('.occupancy_count').addClass('error_border'); + $(occupancy_wrapper).find(".num_adults").eq(index).closest('.occupancy_count_block').find('.num_adults').addClass('alert-danger'); } - if (isNaN(children[index])) { + + if (children[index] == '' || isNaN(children[index])) { hasErrors = 1; - $(occupancy_wrapper).find(".num_children").eq(index).closest('.occupancy_count_block').find('.occupancy_count').addClass('error_border'); + $(occupancy_wrapper).find(".num_children").eq(index).closest('.occupancy_count_block').find('.num_children').addClass('alert-danger'); } }); // validate values of selected child ages - $(occupancy_wrapper).find('.guest_child_age').parent().removeClass('has-error'); + $(occupancy_wrapper).find('.guest_child_age').removeClass('alert-danger'); child_ages.forEach(function (age, index) { age = parseInt(age); if (isNaN(age) || (age < 0) || (age >= parseInt(max_child_age))) { hasErrors = 1; - $(occupancy_wrapper).find(".guest_child_age").eq(index).parent().addClass('has-error'); + $(occupancy_wrapper).find(".guest_child_age").eq(index).addClass('alert-danger'); } }); } if (hasErrors == 0) { - $(occupancy_wrapper).parent().removeClass('open'); - $(document).trigger( "QloApps:updateRoomOccupancy", [occupancy_wrapper]); + // Close the occupancy block only if click element is not occupancy block OR close link of the occupancy block + if (!($(e.target).closest(".booking_occupancy_wrapper").length) || $(e.target).hasClass("close_occupancy_link")) { + $(occupancy_wrapper).parent().removeClass('open'); + $(document).trigger( "QloApps:updateRoomOccupancy", [occupancy_wrapper]); + } } } } }); + // Close occupancy link default redirect action prevent + $(document).on('click', '.close_occupancy_link', function(e) { + e.preventDefault(); + }); + $('.booking_occupancy_wrapper .add_new_occupancy_btn').on('click', function(e) { e.preventDefault(); var booking_occupancy_wrapper = $(this).closest('.booking_occupancy_wrapper'); - var occupancy_block = ''; var roomBlockIndex = parseInt($(booking_occupancy_wrapper).find(".occupancy_info_block").last().attr('occ_block_index')); roomBlockIndex += 1; - let max_child_in_room; - if ($(this).closest(".booking_occupancy_wrapper").find('.max_children').val()) { - max_child_in_room = $(this).closest(".booking_occupancy_wrapper").find('.max_children').val(); - } else { - max_child_in_room = window.max_child_in_room; - } var countRooms = parseInt($(booking_occupancy_wrapper).find('.occupancy_info_block').length); countRooms += 1 + + var occupancy_block = ''; occupancy_block += '
'; + occupancy_block += '
'; occupancy_block += '
' + remove_txt + '
'; occupancy_block += '
'; occupancy_block += '
'; @@ -704,7 +680,7 @@ function initProductEvents() occupancy_block += '
'; occupancy_block += '
'; occupancy_block += ''; - occupancy_block += '(' + below_txt + ' ' + max_child_age + ' ' + years_txt + ')'; + occupancy_block += '(' + below_txt + ' ' + max_child_age + ' ' + years_txt + ')'; occupancy_block += '
'; occupancy_block += '
'; occupancy_block += ''; occupancy_block += '
'; occupancy_block += ''; - occupancy_block += '
'; occupancy_block += ''; $(booking_occupancy_wrapper).find('.booking_occupancy_inner').append(occupancy_block); @@ -1139,13 +1114,6 @@ function initRoomEvents() $('tr#new_product .booking_guest_occupancy').removeClass('disabled'); setRoomTypeGuestOccupancy($('tr#new_product .booking_occupancy_wrapper')); } - if (data.room_type_info) { - $('tr#new_product .max_adults').val(data.room_type_info.max_adults); - $('tr#new_product .max_children').val(data.room_type_info.max_children); - $('tr#new_product .max_guests').val(data.room_type_info.max_guests); - $('tr#new_product .num_adults').attr('max', data.room_type_info.max_adults); - $('tr#new_product .num_children').attr('max', data.room_type_info.max_children); - } // Keep product variable current_product = data; @@ -1358,7 +1326,6 @@ function initRoomEvents() $('th.edit_product_fields').attr('colspan', 2); element_list.find('td.product_action').attr('colspan', 1); element.parent().children('.edit_room_change_link').parent().hide(); - console.log(element.parent().parent()); element.parent().parent().find('button.submitRoomChange').show(); element.parent().parent().find('.cancel_room_change_link').show(); @@ -1594,37 +1561,41 @@ function initRoomEvents() } function setRoomTypeGuestOccupancy(booking_occupancy_wrapper) - { - var adults = 0; - var children = 0; - var rooms = $(booking_occupancy_wrapper).find('.occupancy_info_block').length; +{ + var adults = 0; + var children = 0; + var rooms = $(booking_occupancy_wrapper).find('.occupancy_info_block').length; - $(booking_occupancy_wrapper).find(".num_adults" ).each(function(key, val) { - adults += parseInt($(this).val()); - }); - $(booking_occupancy_wrapper).find(".num_children" ).each(function(key, val) { - children += parseInt($(this).val()); - }); + $(booking_occupancy_wrapper).find(".num_adults" ).each(function(key, val) { + if ($(this).val() != '' && !isNaN($(this).val()) && parseInt($(this).val()) >= 1) { + adults += parseInt($(this).val()); + } + }); + $(booking_occupancy_wrapper).find(".num_children" ).each(function(key, val) { + if ($(this).val() != '' && !isNaN($(this).val()) && parseInt($(this).val()) >= 0) { + children += parseInt($(this).val()); + } + }); - var guestButtonVal = parseInt(adults) + ' '; - if (parseInt(adults) > 1) { - guestButtonVal += adults_txt; - } else { - guestButtonVal += adult_txt; - } - if (parseInt(children) > 0) { - if (parseInt(children) > 1) { - guestButtonVal += ', ' + parseInt(children) + ' ' + children_txt; - } else { - guestButtonVal += ', ' + parseInt(children) + ' ' + child_txt; - } - } - if (parseInt(rooms) > 1) { - guestButtonVal += ', ' + parseInt(rooms) + ' ' + rooms_txt; - } + var guestButtonVal = parseInt(adults) + ' '; + if (parseInt(adults) > 1) { + guestButtonVal += adults_txt; + } else { + guestButtonVal += adult_txt; + } + if (parseInt(children) > 0) { + if (parseInt(children) > 1) { + guestButtonVal += ', ' + parseInt(children) + ' ' + children_txt; + } else { + guestButtonVal += ', ' + parseInt(children) + ' ' + child_txt; + } + } + if (parseInt(rooms) > 1) { + guestButtonVal += ', ' + parseInt(rooms) + ' ' + rooms_txt; + } - $(booking_occupancy_wrapper).siblings('.booking_guest_occupancy').find('span').text(guestButtonVal); - } + $(booking_occupancy_wrapper).siblings('.booking_guest_occupancy').find('span').text(guestButtonVal); +} /* Refund system script */ var flagRefund = ''; diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php index 8f2b3ad49..950d8521c 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php @@ -2030,13 +2030,16 @@ class HotelBookingDetail extends ObjectModel $objHtlBranchInfo = new HotelBranchInformation(); foreach ($order_detail_data as $key => $value) { - $product_image_id = Product::getCover($value['id_product']); - $link_rewrite = ((new Product((int) $value['id_product'], Configuration::get('PS_LANG_DEFAULT')))->link_rewrite[Configuration::get('PS_LANG_DEFAULT')]); - - if ($product_image_id) { - $order_detail_data[$key]['image_link'] = $context->link->getImageLink($link_rewrite, $product_image_id['id_image'], 'small_default'); + // Check if product is still available + if (Validate::isLoadedObject($objProduct = new Product((int) $value['id_product'], Configuration::get('PS_LANG_DEFAULT'))) + && $productCoverImg = Product::getCover($value['id_product']) + ) { + $order_detail_data[$key]['image_link'] = $context->link->getImageLink( + $objProduct->link_rewrite[Configuration::get('PS_LANG_DEFAULT')], + $productCoverImg['id_image'], 'small_default' + ); } else { - $order_detail_data[$key]['image_link'] = $context->link->getImageLink($link_rewrite, $context->language->iso_code.'-default', 'small_default'); + $order_detail_data[$key]['image_link'] = $context->link->getImageLink('', $context->language->iso_code.'-default', 'small_default'); } $objOrderDetail = new OrderDetail($value['id_order_detail']); diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index afae39dcb..32d8a6cbb 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -486,8 +486,9 @@ class HotelCartBookingData extends ObjectModel $obj_htl_cart_booking_data->children = $room_occupancy['children']; $obj_htl_cart_booking_data->child_ages = $room_occupancy['children'] ? json_encode($room_occupancy['child_ages']) : json_encode(array()); } else { + // if room is being booked without occupancy selection the for adults set base occupancy and children will be 0 $obj_htl_cart_booking_data->adults = $roomTypeInfo['adults']; - $obj_htl_cart_booking_data->children = $roomTypeInfo['children']; + $obj_htl_cart_booking_data->children = 0; $obj_htl_cart_booking_data->child_ages = json_encode(array()); } if ($res &= $obj_htl_cart_booking_data->save()) {