Updated: code changes done after the code review

Co-authored-by: Name <sumit201@webkul.in>
This commit is contained in:
shazar rahman
2026-10-19 19:47:39 +05:30
parent ba19945bd1
commit 64bf1564ef
75 changed files with 111 additions and 41 deletions

View File

@@ -192,8 +192,9 @@ class CategoryControllerCore extends FrontController
$amenities[] = $a_v;
}
} elseif ($key == 'features') {
foreach ($value as $idFeatureValue) {
$featureValues[] = (int) $idFeatureValue;
// one group of feature value ids per feature
foreach ($value as $idFeatureValues) {
$featureValues[] = array_map('intval', (array) $idFeatureValues);
}
} elseif ($key == 'price') {
$price['from'] = $value[0];

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -1832,6 +1832,9 @@ class HotelBookingDetail extends ObjectModel
if (!$only_search_data) {
if (!empty($bookingData)) {
$maxAmenities = (int) Configuration::get('WK_MAX_AMENITIES_ROOM_SEARCH');
$maxFeatures = (int) Configuration::get('WK_MAX_FEATURES_ROOM_SEARCH');
$maxFeatureValues = (int) Configuration::get('WK_MAX_FEATURE_VALUES_ROOM_SEARCH');
foreach ($bookingData['rm_data'] as $key => $value) {
// featured amenities for display in room type list
$featured_amenities = HotelRoomTypeAmenities::getAmenities(
@@ -1839,7 +1842,7 @@ class HotelBookingDetail extends ObjectModel
$context->language->id,
true
);
if ($maxAmenities = (int) Configuration::get('WK_MAX_AMENITIES_ROOM_SEARCH')) {
if ($maxAmenities) {
$featured_amenities = array_slice($featured_amenities, 0, $maxAmenities);
}
if (!empty($amenities) && $amenities) {
@@ -1851,9 +1854,12 @@ class HotelBookingDetail extends ObjectModel
}
if (!empty($feature_values)) {
$roomFeatureValueIds = array_map('intval', array_column(Product::getFeaturesStatic($value['id_product']), 'id_feature_value'));
if (!array_intersect($feature_values, $roomFeatureValueIds)) {
unset($bookingData['rm_data'][$key]);
continue;
// AND between features, OR between the values of one feature
foreach ($feature_values as $featureValueGroup) {
if (!array_intersect($featureValueGroup, $roomFeatureValueIds)) {
unset($bookingData['rm_data'][$key]);
continue 2;
}
}
}
$productFeaturePrice = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($value['id_product'], $date_from, $date_to, self::useTax(), 0, 0, 0, 0, 1, 1, $bookingParams['occupancy']);
@@ -1881,15 +1887,22 @@ class HotelBookingDetail extends ObjectModel
if ($roomFeature['is_featured']) {
if (!isset($featuredFeatures[$roomFeature['id_feature']])) {
$featuredFeatures[$roomFeature['id_feature']] = $roomFeature;
} else {
$featuredFeatures[$roomFeature['id_feature']]['value'] .= ', '.$roomFeature['value'];
$featuredFeatures[$roomFeature['id_feature']]['values'] = array();
}
$featuredFeatures[$roomFeature['id_feature']]['values'][] = $roomFeature['value'];
}
}
$featuredFeatures = array_values($featuredFeatures);
if ($maxFeatures = (int) Configuration::get('WK_MAX_FEATURES_ROOM_SEARCH')) {
if ($maxFeatures) {
$featuredFeatures = array_slice($featuredFeatures, 0, $maxFeatures);
}
foreach ($featuredFeatures as &$featuredFeature) {
if ($maxFeatureValues) {
$featuredFeature['values'] = array_slice($featuredFeature['values'], 0, $maxFeatureValues);
}
$featuredFeature['value'] = implode(', ', $featuredFeature['values']);
}
unset($featuredFeature);
$bookingData['rm_data'][$key]['featured_features'] = $featuredFeatures;
$bookingData['rm_data'][$key]['price'] = $prod_price;
$bookingData['rm_data'][$key]['feature_price'] = $productFeaturePrice;

View File

@@ -1515,6 +1515,8 @@ class HotelCartBookingData extends ObjectModel
$objCartBookingData = new HotelCartBookingData();
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
$objServiceProductCartDetail = new ServiceProductCartDetail();
$maxFeatures = (int) Configuration::get('WK_MAX_FEATURES_ROOM_SEARCH');
$maxFeatureValues = (int) Configuration::get('WK_MAX_ROOM_TYPE_FEATURE_VALUES');
foreach ($cartRoomTypes as $prodKey => $product) {
if (Validate::isLoadedObject(
@@ -1603,11 +1605,22 @@ class HotelCartBookingData extends ObjectModel
// the values of a feature are shown together
if (!isset($hotelInfo['room_features'][$roomFeature['id_feature']])) {
$hotelInfo['room_features'][$roomFeature['id_feature']] = $roomFeature;
} else {
$hotelInfo['room_features'][$roomFeature['id_feature']]['value'] .= ', '.$roomFeature['value'];
$hotelInfo['room_features'][$roomFeature['id_feature']]['values'] = array();
}
$hotelInfo['room_features'][$roomFeature['id_feature']]['values'][] = $roomFeature['value'];
}
}
$hotelInfo['room_features'] = array_values($hotelInfo['room_features']);
if ($maxFeatures) {
$hotelInfo['room_features'] = array_slice($hotelInfo['room_features'], 0, $maxFeatures);
}
foreach ($hotelInfo['room_features'] as &$roomFeature) {
if ($maxFeatureValues) {
$roomFeature['values'] = array_slice($roomFeature['values'], 0, $maxFeatureValues);
}
$roomFeature['value'] = implode(', ', $roomFeature['values']);
}
unset($roomFeature);
$cartHotelData[$prodKey]['hotel_info'] = $hotelInfo;
}

View File

@@ -992,12 +992,10 @@ class HotelHelper
10 => 'icon-newspaper-o',
11 => 'icon-shopping-cart',
12 => 'icon-glass',
13 => 'icon-music',
14 => 'icon-diamond',
16 => 'icon-music',
17 => 'icon-microphone',
18 => 'icon-film',
19 => 'icon-moon-o',
21 => 'icon-plug',
22 => 'icon-credit-card',
23 => 'icon-money',
@@ -1035,14 +1033,8 @@ class HotelHelper
73 => 'icon-leaf',
87 => 'icon-glass',
88 => 'icon-cutlery',
89 => 'icon-cutlery',
90 => 'icon-coffee',
91 => 'icon-cutlery',
93 => 'icon-cutlery',
94 => 'icon-cutlery',
95 => 'icon-coffee',
96 => 'icon-beer',
97 => 'icon-cutlery',
98 => 'icon-leaf',
);
$imgDir = dirname(__FILE__).'/../views/img/hotel_amenities/';
@@ -1191,6 +1183,7 @@ class HotelHelper
Configuration::updateValue('HTL_FEATURE_PRICING_PRIORITY', 'specific_date;special_day;date_range');
Configuration::updateValue('WK_MAX_AMENITIES_ROOM_SEARCH', 0);
Configuration::updateValue('WK_MAX_FEATURES_ROOM_SEARCH', 0);
Configuration::updateValue('WK_MAX_ROOM_TYPE_FEATURE_VALUES', 0);
Configuration::updateValue('WK_GOOGLE_ACTIVE_MAP', 0);
Configuration::updateValue('WK_MAP_HOTEL_ACTIVE_ONLY', 1);
@@ -1283,17 +1276,11 @@ class HotelHelper
{
return array(
'Bed Type' => 'icon-bed',
'Extra Bed Available' => 'icon-plus-square',
'Crib/Cot Available' => 'icon-child',
'Room Size' => 'icon-arrows-alt',
'View' => 'icon-eye',
'Balcony Type' => 'icon-home',
'Bathroom Type' => 'icon-tint',
'Heating Type' => 'icon-fire',
'TV Type' => 'icon-desktop',
'Wi-Fi Speed' => 'icon-wifi',
'Smoke Detection' => 'icon-fire-extinguisher',
'Smoking Policy' => 'icon-ban',
);
}

View File

@@ -166,16 +166,16 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
'hint' => $this->l('Enable to display hotels list on the contact us page.'),
),
'WK_MAX_AMENITIES_ROOM_SEARCH' => array(
'title' => $this->l('Maximum amenities in room search'),
'hint' => $this->l('Maximum number of amenities to display for each room type on the front office room search page.'),
'desc' => $this->l('Set to 0 to display all amenities.'),
'title' => $this->l('Maximum featured amenities in room search'),
'hint' => $this->l('Maximum number of featured amenities to display for each room type on the front office room search page.'),
'desc' => $this->l('Set to 0 to display all featured amenities.'),
'type' => 'text',
'cast' => 'intval',
'class' => 'fixed-width-xl',
'default' => '0',
),
'WK_MAX_FEATURES_ROOM_SEARCH' => array(
'title' => $this->l('Maximum features in room search'),
'title' => $this->l('Maximum featured features in room search'),
'hint' => $this->l('Maximum number of featured features to display for each room type on the front office room search page.'),
'desc' => $this->l('Set to 0 to display all featured features.'),
'type' => 'text',
@@ -183,6 +183,15 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
'class' => 'fixed-width-xl',
'default' => '0',
),
'WK_MAX_ROOM_TYPE_FEATURE_VALUES' => array(
'title' => $this->l('Maximum room type feature values per featured feature'),
'hint' => $this->l('Maximum number of room type feature values to display for each featured feature on the front office room search and order pages. For example, if the featured feature Bed Type has the values Single, Double and Queen and this is set to 2, only "Single, Double" is displayed.'),
'desc' => $this->l('Set to 0 to display all values of each featured feature.'),
'type' => 'text',
'cast' => 'intval',
'class' => 'fixed-width-xl',
'default' => '0',
),
),
'submit' => array('title' => $this->l('Save')),
),
@@ -548,10 +557,13 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
$this->errors[] = $this->l('Minimum partial payment percentage should not be more than 100.');
}
if (!Validate::isUnsignedInt(Tools::getValue('WK_MAX_AMENITIES_ROOM_SEARCH'))) {
$this->errors[] = $this->l('Maximum amenities in room search is invalid. Enter 0 or a positive number.');
$this->errors[] = $this->l('Maximum featured amenities in room search is invalid. Enter 0 or a positive number.');
}
if (!Validate::isUnsignedInt(Tools::getValue('WK_MAX_FEATURES_ROOM_SEARCH'))) {
$this->errors[] = $this->l('Maximum features in room search is invalid. Enter 0 or a positive number.');
$this->errors[] = $this->l('Maximum featured features in room search is invalid. Enter 0 or a positive number.');
}
if (!Validate::isUnsignedInt(Tools::getValue('WK_MAX_ROOM_TYPE_FEATURE_VALUES'))) {
$this->errors[] = $this->l('Maximum room type feature values per featured feature is invalid. Enter 0 or a positive number.');
}
if (Tools::getValue('WK_GOOGLE_ACTIVE_MAP')) {
if (!Tools::getValue('PS_API_KEY')) {

View File

@@ -609,6 +609,7 @@ class HotelReservationSystem extends Module
'WK_DISPLAY_CONTACT_PAGE_HOTEL_LIST',
'WK_MAX_AMENITIES_ROOM_SEARCH',
'WK_MAX_FEATURES_ROOM_SEARCH',
'WK_MAX_ROOM_TYPE_FEATURE_VALUES',
'QLO_HEADER_MEDIA_TYPE',
'QLO_HEADER_CONTENT_ALIGN',
'QLO_HEADER_VIDEO_SOURCE_TYPE',

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -68,7 +68,7 @@
<tr id="amenity_row_{$amenity.id}">
<td class="fixed-width-xs">
{if $amenity.logo_type == 'icon' && $amenity.logo}
<i class="{$amenity.logo|escape:'htmlall':'UTF-8'}"></i>
<i class="{$amenity.logo|escape:'htmlall':'UTF-8'}" style="color: #555555;"></i>
{elseif $amenity.logo_type == 'image' && $amenity.logo}
<img src="{$img_base_url}{$amenity.logo|escape:'htmlall':'UTF-8'}"
alt="{$amenity.name|escape:'htmlall':'UTF-8'}"

View File

@@ -142,7 +142,15 @@ $(document).ready(function()
if ($(this).is(':checked'))
{
var temp_type = $(this).attr('data-type');
if (typeof filter[temp_type] != 'undefined')
var feature_group = $(this).attr('data-feature-group');
if (typeof feature_group != 'undefined')
{
// features: values of one feature are grouped (OR inside, AND between features)
filter[temp_type] = filter[temp_type] || {};
filter[temp_type][feature_group] = filter[temp_type][feature_group] || [];
filter[temp_type][feature_group].push($(this).val());
}
else if (typeof filter[temp_type] != 'undefined')
{
filter[temp_type].push($(this).val());
}

View File

@@ -86,7 +86,7 @@
<div class="col-sm-12 lf_sub_cont">
{foreach $feature.values as $featureValue}
<div class="layered_filt">
<input type="checkbox" class="filter" data-type="features" value="{$featureValue.id_feature_value|intval}">
<input type="checkbox" class="filter" data-type="features" data-feature-group="{$feature.id_feature|intval}" value="{$featureValue.id_feature_value|intval}">
<span class="filters_name">{$featureValue.value|escape:'html':'UTF-8'}</span>
</div>
{/foreach}

View File

@@ -185,6 +185,11 @@ class wkhotelfilterblock extends Module
public function postProcess()
{
if (Tools::isSubmit('btnConfigSubmit')) {
if (Tools::getValue('SHOW_FEATURES_FILTER') && !array_filter((array) Tools::getValue('FEATURES_FILTER_BOX', array()))) {
$this->html .= $this->displayError($this->l('Please select at least one feature to show in the Features filter.'));
return;
}
Configuration::updateValue(
'SHOW_AMENITIES_FILTER',
Tools::getValue('SHOW_AMENITIES_FILTER')

View File

@@ -153,6 +153,7 @@ p.capa_txt {
.rm_amen
{
color: #555555;
width: 18px;
display: inline-block;
margin-right: 10px;
@@ -165,6 +166,7 @@ p.capa_txt {
{
display: inline-block;
margin: 0 10px 10px 0;
color: #555;
}
.room_featured_feature i{
@@ -275,7 +277,6 @@ p.capa_txt {
left: unset;
}
.room_features_cont > div {
min-height: 47px;
display: flex;
flex-wrap: wrap;
align-items: center;

View File

@@ -200,16 +200,38 @@
margin-bottom: 5px;
}
.order-detail-content span.room-type-feature {
white-space: nowrap;
line-height: 35px;
margin-right: 5px;
font-size: 14px;
display: inline-block;
max-width: 100%;
line-height: 24px;
background-color: #eee;
border-radius: 10px 10px 10px 11px;
margin: 0 10px 10px 0;
padding: 0px 8px 0px 0px;
font-size: 12px;
color: #555555;
}
.room-type-feature i,
.room-type-feature img {
display: inline-flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
box-sizing: border-box;
border: 1px solid #000000;
border-radius: 50%;
background-color: #ffffff;
color: #000000;
vertical-align: middle;
margin-right: 5px;
}
.room-type-feature i {
font-size: 16px;
font-size: 12px;
color: #555555;
}
.room-type-feature img {
padding: 3px;
}
.order-detail-content .room_duration_block_head {
font-size: 12px;
color: #777777;

View File

@@ -1450,6 +1450,13 @@ Quick View Styles
max-height: 20px;
max-width: 20px;
}
/* font icons use the same color as the amenity/feature jpg images */
.featured_amenities .featured_amenity i,
.info_margin_div .col-sm-4 > i,
.room_info_heading i {
color: #555555;
}
/* end */
/* service popup design */

View File

@@ -88,7 +88,7 @@
{else}
<img src="{$smarty.const._PS_IMG_}rf/{$feature['logo_image']|escape:'html':'UTF-8'}" alt="" onerror="this.style.display='none'" />
{/if}
{$feature['value']|escape:'html':'UTF-8'}{if !$feature@last} &nbsp;|{/if}
{$feature['value']|escape:'html':'UTF-8'}
</span>
{/foreach}
</div>