Set default occupancy chosen on room type detail page

This commit is contained in:
Abhishek Kumar
2023-08-21 18:51:53 +05:30
parent ccace94c38
commit 27e228818c
2 changed files with 11 additions and 3 deletions

View File

@@ -411,6 +411,14 @@ class ProductControllerCore extends FrontController
$occupancy_value = array();
if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_QUANTITY) {
$occupancy_value = 1;
} else {
$occupancy_value = array(
array(
'adults' => $room_info_by_product_id['adults'],
'children' => 0,
'child_ages' => array(),
),
);
}
$this->assignBookingFormVars($this->product->id, $date_from, $date_to, $occupancy_value);
$this->assignServiceProductVars();
@@ -728,7 +736,7 @@ class ProductControllerCore extends FrontController
// calculate total price
$totalPrice = $totalRoomPrice + $demandsPrice;
// send occupancy information searched by the user
if ($this->ajax && $occupancy && is_array($occupancy)) {
if ($occupancy && is_array($occupancy)) {
$smartyVars['occupancies'] = $occupancy;
$smartyVars['occupancy_adults'] = array_sum(array_column($occupancy, 'adults'));
$smartyVars['occupancy_children'] = array_sum(array_column($occupancy, 'children'));

View File

@@ -63,8 +63,8 @@
</div>
<div class="form-group col-sm-7 col-xs-6 occupancy_count_block">
<div class="row">
<label class="col-sm-12 clearfix">{l s='Children'}</label>
<div class="col-sm-12">
<label class="col-sm-12">{l s='Children'}</label>
<div class="col-sm-12 clearfix">
<input type="hidden" class="num_occupancy num_children room_occupancies" name="occupancy[{$key|escape:'htmlall':'UTF-8'}][children]" max="{}" value="{$occupancy['children']|escape:'htmlall':'UTF-8'}">
<div class="occupancy_count pull-left">
<span>{$occupancy['children']|escape:'htmlall':'UTF-8'}</span>