diff --git a/admin-dev/themes/default/template/controllers/features/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/features/helpers/form/form.tpl index 4e9b42939..fe4c71e17 100644 --- a/admin-dev/themes/default/template/controllers/features/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/controllers/features/helpers/form/form.tpl @@ -25,8 +25,34 @@ {extends file="helpers/form/form.tpl"} {block name="input_row"} + {$smarty.block.parent} {if $input.name == 'name'} {hook h="displayFeatureForm" id_feature=$form_id} {/if} + {if $input.name == 'logo_icon'} + + {/if} {/block} diff --git a/classes/Feature.php b/classes/Feature.php index 9b9035886..9faaa6281 100644 --- a/classes/Feature.php +++ b/classes/Feature.php @@ -29,6 +29,9 @@ class FeatureCore extends ObjectModel /** @var string Name */ public $name; public $position; + public $logo_type; + public $logo; + public $is_featured; /** * @see ObjectModel::$definition @@ -39,6 +42,9 @@ class FeatureCore extends ObjectModel 'multilang' => true, 'fields' => array( 'position' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), + 'logo_type' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 10), + 'logo' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 255), + 'is_featured' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), /* Lang fields */ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128), @@ -117,11 +123,16 @@ class FeatureCore extends ObjectModel $this->position = Feature::getHigherPosition() + 1; } - $return = parent::add($autodate, true); + $return = parent::add($autodate, $nullValues); Hook::exec('actionFeatureSave', array('id_feature' => $this->id)); return $return; } + public static function getLogoImageName($idFeature, $logo) + { + return preg_match('/^[A-Za-z0-9_]+\.jpg$/', (string) $logo) ? $logo : (int) $idFeature.'.jpg'; + } + public function delete() { /* Also delete related attributes */ diff --git a/classes/Product.php b/classes/Product.php index 4f280c742..a6c3d67b2 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -4859,7 +4859,7 @@ class ProductCore extends ObjectModel } if (!array_key_exists($id_product.'-'.$id_lang, self::$_frontFeaturesCache)) { self::$_frontFeaturesCache[$id_product.'-'.$id_lang] = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' - SELECT name, value, pf.id_feature + SELECT name, value, pf.id_feature, f.logo_type, f.logo, f.is_featured FROM '._DB_PREFIX_.'feature_product pf LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.') LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.(int)$id_lang.') @@ -4868,6 +4868,10 @@ class ProductCore extends ObjectModel WHERE pf.id_product = '.(int)$id_product.' ORDER BY f.position ASC' ); + foreach (self::$_frontFeaturesCache[$id_product.'-'.$id_lang] as &$frontFeature) { + $frontFeature['logo_image'] = Feature::getLogoImageName($frontFeature['id_feature'], $frontFeature['logo']); + } + unset($frontFeature); } return self::$_frontFeaturesCache[$id_product.'-'.$id_lang]; } @@ -7045,6 +7049,12 @@ class ProductCore extends ObjectModel $feature['value'] = (int) $feature['id_feature']; $feature['input_name'] = 'feature_value_parents'; $feature['children'] = array(); + if (!empty($feature['is_featured'])) { + $feature['badge'] = array( + 'class' => 'badge-success', + 'title' => Translate::getAdminTranslation('Featured', 'AdminProducts'), + ); + } $selectedValues = isset($selectedFeatureValues[(int) $feature['id_feature']]) ? $selectedFeatureValues[(int) $feature['id_feature']] : array(); diff --git a/classes/Validate.php b/classes/Validate.php index 7fe6ab38e..2347aaf3d 100644 --- a/classes/Validate.php +++ b/classes/Validate.php @@ -397,6 +397,8 @@ class ValidateCore */ public static function isCleanHtml($html, $allow_iframe = false) { + $html = (string) $html; + $eventAttributeRegex = '/<\s*\w+[^>]*\s(on\w+)=["\'][^"\']*["\']/ims'; $events = 'onabort|onactivate|onactive|onaddsourcebuffer|onaddstream|onaddtrack|onafterprint|onafterscriptexecute|onafterupdate|onalerting|onanimationcancel|onanimationend|onanimationiteration|onanimationstart' diff --git a/controllers/admin/AdminFeaturesController.php b/controllers/admin/AdminFeaturesController.php index c90e51990..8ec89b7ca 100644 --- a/controllers/admin/AdminFeaturesController.php +++ b/controllers/admin/AdminFeaturesController.php @@ -52,19 +52,20 @@ class AdminFeaturesControllerCore extends AdminController 'align' => 'center', 'class' => 'fixed-width-xs' ), + 'logo' => array( + 'title' => $this->l('Icon'), + 'align' => 'text-center', + 'callback' => 'displayLogo', + 'orderby' => false, + 'search' => false, + 'class' => 'fixed-width-xs' + ), 'name' => array( 'title' => $this->l('Name'), 'width' => 'auto', 'filter_key' => 'b!name' ), - 'logo' => array( - 'title' => $this->l('Icon'), - 'align' => 'text-center', - 'image' => 'rf', - 'orderby' => false, - 'search' => false, - 'class' => 'fixed-width-xs' - ),/*by webkul to show feature image*/ + /*by webkul to show feature image*/ /*'value' => array( 'title' => $this->l('Values'), 'orderby' => false, @@ -72,6 +73,16 @@ class AdminFeaturesControllerCore extends AdminController 'align' => 'center', 'class' => 'fixed-width-xs' ),*/ + 'is_featured' => array( + 'title' => $this->l('Is Featured'), + 'type' => 'bool', + 'active' => 'is_featured', + 'align' => 'center', + 'filter_key' => 'a!is_featured', + 'filter_type' => 'int', + 'class' => 'fixed-width-sm', + 'orderby' => false + ), 'position' => array( 'title' => $this->l('Position'), 'filter_key' => 'a!position', @@ -179,9 +190,9 @@ class AdminFeaturesControllerCore extends AdminController } // by webkul to get media link. // $ps_img_url = _PS_IMG_DIR_.'rf/'.$obj->id.'.jpg'; - $img_url = $this->context->link->getMediaLink(_PS_IMG_.'rf/'.$obj->id.'.jpg'); + $img_url = $this->context->link->getMediaLink(_PS_IMG_.'rf/'.Feature::getLogoImageName($obj->id, $obj->logo)); if ($img_exist = Tools::file_get_contents($img_url)) { - $image = ""; + $image = ""; } $this->toolbar_title = $this->l('Add a new room feature'); @@ -200,14 +211,50 @@ class AdminFeaturesControllerCore extends AdminController 'hint' => $this->l('Enter a name for the room feature. Invalid characters:').' <>;=#{}', 'required' => true ), + array( + 'type' => 'switch', + 'label' => $this->l('Is Featured'), + 'name' => 'is_featured', + 'is_bool' => true, + 'values' => array( + array('id' => 'is_featured_on', 'value' => 1, 'label' => $this->l('Yes')), + array('id' => 'is_featured_off', 'value' => 0, 'label' => $this->l('No')), + ), + ), + array( + 'type' => 'select', + 'label' => $this->l('Logo Type'), + 'name' => 'logo_type', + 'required' => true, + 'options' => array( + 'query' => array( + array('id' => 'image', 'name' => $this->l('Image (Upload)')), + array('id' => 'icon', 'name' => $this->l('Icon (Font Awesome)')), + ), + 'id' => 'id', + 'name' => 'name', + ), + ), array( 'type' => 'file', 'label' => $this->l('Room Feature Logo'), - 'name' => 'logo', + 'name' => 'logo_image', 'image' => $img_exist ? $image : false, 'display_image' => true, 'hint' => $this->l('Upload a room feature logo.'), 'required' => true + ), + array( + 'type' => 'text', + 'label' => $this->l('Icon Class'), + 'name' => 'logo_icon', + 'required' => true, + 'col' => 4, + 'hint' => $this->l('Font Awesome icon class. Replace fa- with icon- (e.g. fa-wifi becomes icon-wifi).'), + 'desc' => sprintf( + $this->l('Refer to %s for available icons.'), + 'https://fontawesome.com/v4/cheatsheet' + ), ) ) ); @@ -234,9 +281,51 @@ class AdminFeaturesControllerCore extends AdminController ) ); + $this->fields_value['logo_icon'] = ($obj->logo_type == 'icon') ? $obj->logo : ''; + return parent::renderForm(); } + /** + * List callback: render the feature logo as an icon or as the uploaded image thumbnail. + * + * @param string $logo Icon class (when logo type is icon) + * @param array $row List row + * @return string + */ + public function displayLogo($logo, $row) + { + if (isset($row['logo_type']) && $row['logo_type'] == 'icon') { + return $logo ? '' : ''; + } + + $imageName = Feature::getLogoImageName($row['id_feature'], $logo); + + return ImageManager::thumbnail( + _PS_IMG_DIR_.'rf/'.$imageName, + 'feature_mini_'.basename($imageName, '.jpg').'_'.(int) $this->context->shop->id.'.jpg', + 45, + 'jpg' + ); + } + + /** + * Toggle the Is Featured value from the list (like the status toggle). + */ + public function processToggleIsFeatured() + { + if (!$this->loadObject()) { + return false; + } + + $this->object->is_featured = !$this->object->is_featured; + if ($this->object->save()) { + Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&conf=4'); + } else { + $this->errors[] = $this->l('An error occurred while updating "is featured".'); + } + } + public function initPageHeaderToolbar() { if (empty($this->display)) { @@ -528,6 +617,15 @@ class AdminFeaturesControllerCore extends AdminController } parent::initProcess(); + + // Toggle Is Featured from the list + if (Tools::getIsset('is_featured'.$this->table)) { + if ($this->tabAccess['edit'] === 1) { + $this->action = 'toggleIsFeatured'; + } else { + $this->errors[] = Tools::displayError('You do not have permission to edit this.'); + } + } } public function postProcess() @@ -622,31 +720,65 @@ class AdminFeaturesControllerCore extends AdminController $_POST[$key] = str_replace('\n', '', str_replace('\r', '', $value)); } } - $featureImage = $_FILES['logo']; - if (!$idFeature || (isset($featureImage['tmp_name']) && $featureImage['tmp_name'])) { - if ($featureImage && $featureImage['tmp_name'] && $featureImage['name']) { + $logoType = Tools::getValue('logo_type'); + $featureImage = isset($_FILES['logo_image']) ? $_FILES['logo_image'] : null; + $objCurrentFeature = new Feature($idFeature); + $oldLogo = $objCurrentFeature->logo; + $oldLogoType = $objCurrentFeature->logo_type; + + if (!in_array($logoType, array('image', 'icon'))) { + $this->errors[] = $this->l('Logo type is invalid.'); + $logoType = 'image'; + } + if (!in_array(Tools::getValue('is_featured', 0), array('0', '1', 0, 1), true)) { + $this->errors[] = $this->l('Is Featured value is invalid.'); + } + $_POST['logo_type'] = $logoType; + // Empty logo would be saved as NULL (Feature::add() uses null values), so image type keeps a placeholder until the image is saved. + $_POST['logo'] = 'image'; + + if ($logoType === 'icon') { + $logoIcon = trim(Tools::getValue('logo_icon')); + if (!$logoIcon) { + $this->errors[] = $this->l('Icon class is required.'); + } elseif (Tools::strlen($logoIcon) > 255) { + $this->errors[] = $this->l('Icon class is too long.'); + } elseif (!preg_match('/^icon-[a-z0-9]+(-[a-z0-9]+)*$/', $logoIcon)) { + $this->errors[] = $this->l('Icon class is invalid. It must start with "icon-" and contain only lowercase letters, numbers and hyphens (e.g. icon-wifi).'); + } else { + $_POST['logo'] = $logoIcon; + } + } else { + $hasUpload = $featureImage && !empty($featureImage['tmp_name']); + $hasExisting = $idFeature && file_exists(_PS_IMG_DIR_.'rf/'.Feature::getLogoImageName($idFeature, $oldLogo)); + if ($hasUpload) { if ($error = ImageManager::validateUpload($featureImage, Tools::getMaxUploadSize())) { $this->errors[] = $error; } - } else { + } elseif (!$hasExisting) { $this->errors[] = $this->l('Please select a logo for this feature.'); + } elseif ($oldLogoType === 'image' && $oldLogo) { + // no new image: keep the current image name + $_POST['logo'] = $oldLogo; } } + if (count($this->errors)) { + $this->display = $idFeature ? 'edit' : 'add'; + return false; + } + $objFeature = parent::processSave(); if (!count($this->errors)) { - // save feature image - if (isset($featureImage['tmp_name']) && $featureImage['tmp_name']) { - // if already feature image then delete it once before uploading new image - if ($idFeature) { - $currentImg = _PS_TMP_IMG_DIR_.'feature_mini_'.$objFeature->id.'_'.$this->context->shop->id.'.jpg'; - if (file_exists($currentImg)) { - unlink($currentImg); - } - } - // upload feature image + // save feature image: .jpg is kept for the webservice, a random named copy is used for display + // so that browsers do not show a cached old image + if ($logoType === 'image' && isset($featureImage['tmp_name']) && $featureImage['tmp_name']) { $imgPath = _PS_IMG_DIR_.'rf/'.$objFeature->id.'.jpg'; - if (!ImageManager::resize($featureImage['tmp_name'], $imgPath)) { + $imageName = $objFeature->id.'_'.substr(md5(uniqid(mt_rand(), true)), 0, 12).'.jpg'; + if (ImageManager::resize($featureImage['tmp_name'], $imgPath) && copy($imgPath, _PS_IMG_DIR_.'rf/'.$imageName)) { + $objFeature->logo = $imageName; + $objFeature->update(); + } else { $this->errors[] = $this->l('Some error occurred while uploding room feature logo. Please try again.'); } } diff --git a/controllers/front/CategoryController.php b/controllers/front/CategoryController.php index 7be5770b7..d98e78bbf 100644 --- a/controllers/front/CategoryController.php +++ b/controllers/front/CategoryController.php @@ -183,6 +183,7 @@ class CategoryControllerCore extends FrontController $sort_value = Tools::getValue('sort_value'); $filter_data = Tools::getValue('filter_data'); $amenities = []; + $featureValues = []; $price = []; if (!empty($filter_data)) { foreach ($filter_data as $key => $value) { @@ -190,6 +191,11 @@ class CategoryControllerCore extends FrontController foreach ($value as $a_k => $a_v) { $amenities[] = $a_v; } + } elseif ($key == 'features') { + // 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]; $price['to'] = $value[1]; @@ -207,6 +213,7 @@ class CategoryControllerCore extends FrontController 'id_cart' => $this->context->cart->id, 'id_guest' => $this->context->cookie->id_guest, 'amenities' => $amenities, + 'feature_values' => $featureValues, 'price' => $price, ); diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index 1e4c5cc5d..e4d3a0389 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -411,6 +411,23 @@ class ProductControllerCore extends FrontController $roomAmenities = HotelRoomTypeAmenities::getAmenities($this->product->id, $this->context->language->id); $hotelAmenities = HotelBranchAmenities::getAmenities($hotel_id, $this->context->language->id); + // featured amenities: room type level first, then hotel level, without duplicates + $featuredAmenities = array(); + $featuredAmenitiesList = array_merge( + HotelRoomTypeAmenities::getAmenities($this->product->id, $this->context->language->id, true), + HotelBranchAmenities::getAmenities($hotel_id, $this->context->language->id, true) + ); + + $featuredAmenities = array_values(array_column( + array_reverse($featuredAmenitiesList), + null, + 'id' + )); + + usort($featuredAmenities, function ($a, $b) { + return strcmp($a['name'], $b['name']); + }); + $this->context->smarty->assign( array( 'id_hotel' => $hotel_id, @@ -440,6 +457,7 @@ class ProductControllerCore extends FrontController 'room_type_features' => $roomFeatures, 'room_dynamic_amenities' => $roomAmenities, 'hotel_dynamic_amenities' => $hotelAmenities, + 'featured_amenities' => $featuredAmenities, 'amenity_img_dir' => _MODULE_DIR_.'hotelreservationsystem/views/img/hotel_amenities/', 'hotel_image_link' => $hotelImageLink, 'hotel_has_images' => (bool) HotelImage::getCover($hotel_id), diff --git a/img/rf/1.jpg b/img/rf/1.jpg deleted file mode 100644 index 722d4ec53..000000000 Binary files a/img/rf/1.jpg and /dev/null differ diff --git a/img/rf/10.jpg b/img/rf/10.jpg deleted file mode 100644 index d6f959d54..000000000 Binary files a/img/rf/10.jpg and /dev/null differ diff --git a/img/rf/11.jpg b/img/rf/11.jpg deleted file mode 100644 index cb60b74d2..000000000 Binary files a/img/rf/11.jpg and /dev/null differ diff --git a/img/rf/4.jpg b/img/rf/4.jpg deleted file mode 100644 index 45e63101b..000000000 Binary files a/img/rf/4.jpg and /dev/null differ diff --git a/img/rf/5.jpg b/img/rf/5.jpg deleted file mode 100644 index c0149e50c..000000000 Binary files a/img/rf/5.jpg and /dev/null differ diff --git a/img/rf/9.jpg b/img/rf/9.jpg deleted file mode 100644 index 0a49d24bf..000000000 Binary files a/img/rf/9.jpg and /dev/null differ diff --git a/install-dev/data/db_structure.sql b/install-dev/data/db_structure.sql index f253ba3ff..5afa159de 100644 --- a/install-dev/data/db_structure.sql +++ b/install-dev/data/db_structure.sql @@ -824,6 +824,9 @@ CREATE TABLE `PREFIX_employee_shop` ( CREATE TABLE `PREFIX_feature` ( `id_feature` int(10) unsigned NOT NULL auto_increment, `position` int(10) unsigned NOT NULL DEFAULT '0', + `logo_type` varchar(10) NOT NULL DEFAULT 'image', + `logo` varchar(255) NOT NULL DEFAULT '', + `is_featured` tinyint(1) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id_feature`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION; diff --git a/modules/hotelreservationsystem/classes/HotelAmenities.php b/modules/hotelreservationsystem/classes/HotelAmenities.php index 8dcabfd64..f517d891d 100644 --- a/modules/hotelreservationsystem/classes/HotelAmenities.php +++ b/modules/hotelreservationsystem/classes/HotelAmenities.php @@ -59,7 +59,7 @@ class HotelAmenities extends ObjectModel public function delete() { if ($id = $this->id) { - $imgFile = dirname(__FILE__).'/../views/img/hotel_amenities/'.(int)$id.'.jpg'; + $imgFile = dirname(__FILE__).'/../views/img/hotel_amenities/'.($this->logo_type == 'image' && $this->logo ? basename($this->logo) : (int)$id.'.jpg'); if (file_exists($imgFile)) { unlink($imgFile); } diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php index c20ac7d0e..07b881afc 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php @@ -308,6 +308,9 @@ class HotelBookingDetail extends ObjectModel if (!isset($params['amenities'])) { $params['amenities'] = 0; } + if (!isset($params['feature_values'])) { + $params['feature_values'] = 0; + } if (!isset($params['price'])) { $params['price'] = 0; } @@ -1829,13 +1832,19 @@ 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 - $product_feature = HotelRoomTypeAmenities::getAmenities( + $featured_amenities = HotelRoomTypeAmenities::getAmenities( $value['id_product'], $context->language->id, true ); + if ($maxAmenities) { + $featured_amenities = array_slice($featured_amenities, 0, $maxAmenities); + } if (!empty($amenities) && $amenities) { $roomAmenityIds = array_column(HotelRoomTypeAmenities::getAmenities($value['id_product']), 'id'); if (array_diff($amenities, $roomAmenityIds)) { @@ -1843,6 +1852,16 @@ class HotelBookingDetail extends ObjectModel continue; } } + if (!empty($feature_values)) { + $roomFeatureValueIds = array_map('intval', array_column(Product::getFeaturesStatic($value['id_product']), 'id_feature_value')); + // 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']); if (!empty($price) && ((float) $price['from'] > $productFeaturePrice || (float) $price['to'] < $productFeaturePrice)) { unset($bookingData['rm_data'][$key]); @@ -1859,7 +1878,32 @@ class HotelBookingDetail extends ObjectModel $cover_img = $context->link->getImageLink($value['link_rewrite'], $context->language->iso_code.'-default', 'home_default'); } $bookingData['rm_data'][$key]['image'] = $cover_img; - $bookingData['rm_data'][$key]['feature'] = $product_feature; + $bookingData['rm_data'][$key]['featured_amenities'] = $featured_amenities; + + // featured room features (is_featured) for display below the short description + $featuredFeatures = array(); + foreach (Product::getFrontFeaturesStatic($context->language->id, $value['id_product']) as $roomFeature) { + // one entry per featured feature, its values are shown together after the feature icon + if ($roomFeature['is_featured']) { + if (!isset($featuredFeatures[$roomFeature['id_feature']])) { + $featuredFeatures[$roomFeature['id_feature']] = $roomFeature; + $featuredFeatures[$roomFeature['id_feature']]['values'] = array(); + } + $featuredFeatures[$roomFeature['id_feature']]['values'][] = $roomFeature['value']; + } + } + $featuredFeatures = array_values($featuredFeatures); + 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; $bookingData['rm_data'][$key]['price_without_reduction'] = $productPriceWithoutReduction; diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index 78822d985..43b282ee2 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -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( @@ -1596,8 +1598,29 @@ class HotelCartBookingData extends ObjectModel $hotelInfo['htl_features'] = $hotelAmenities; } } - // append roomtype features - $hotelInfo['room_features'] = $objProduct->getFrontFeatures($idLang); + // append featured roomtype features + $hotelInfo['room_features'] = array(); + foreach ($objProduct->getFrontFeatures($idLang) as $roomFeature) { + if ($roomFeature['is_featured']) { + // the values of a feature are shown together + if (!isset($hotelInfo['room_features'][$roomFeature['id_feature']])) { + $hotelInfo['room_features'][$roomFeature['id_feature']] = $roomFeature; + $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; } diff --git a/modules/hotelreservationsystem/classes/HotelHelper.php b/modules/hotelreservationsystem/classes/HotelHelper.php index f1aba02d2..b247b7dce 100644 --- a/modules/hotelreservationsystem/classes/HotelHelper.php +++ b/modules/hotelreservationsystem/classes/HotelHelper.php @@ -977,6 +977,66 @@ class HotelHelper ); // lang fields $languages = Language::getLanguages(false); + // FontAwesome icons (admin/front icon- classes) for default amenities, keyed by amenity position. + // Amenities without a suitable icon keep their default image. + $amenityIcons = array( + 1 => 'icon-building', + 2 => 'icon-video-camera', + 3 => 'icon-users', + 4 => 'icon-microphone', + 5 => 'icon-pencil', + 6 => 'icon-fax', + 7 => 'icon-wifi', + 8 => 'icon-wifi', + 9 => 'icon-bus', + 10 => 'icon-newspaper-o', + 11 => 'icon-shopping-cart', + 12 => 'icon-glass', + 14 => 'icon-diamond', + 16 => 'icon-music', + 17 => 'icon-microphone', + 18 => 'icon-film', + 21 => 'icon-plug', + 22 => 'icon-credit-card', + 23 => 'icon-money', + 25 => 'icon-book', + 26 => 'icon-medkit', + 27 => 'icon-gift', + 29 => 'icon-paw', + 30 => 'icon-child', + 32 => 'icon-fire', + 33 => 'icon-bell', + 34 => 'icon-cutlery', + 35 => 'icon-car', + 37 => 'icon-shopping-cart', + 38 => 'icon-hospital-o', + 39 => 'icon-envelope', + 41 => 'icon-language', + 42 => 'icon-car', + 45 => 'icon-wifi', + 46 => 'icon-fax', + 47 => 'icon-tree', + 48 => 'icon-car', + 49 => 'icon-fire', + 50 => 'icon-child', + 53 => 'icon-car', + 55 => 'icon-leaf', + 56 => 'icon-car', + 57 => 'icon-car', + 58 => 'icon-key', + 59 => 'icon-heartbeat', + 60 => 'icon-bicycle', + 64 => 'icon-ship', + 69 => 'icon-life-ring', + 70 => 'icon-gamepad', + 72 => 'icon-anchor', + 73 => 'icon-leaf', + 87 => 'icon-glass', + 88 => 'icon-cutlery', + 90 => 'icon-coffee', + 91 => 'icon-cutlery', + 98 => 'icon-leaf', + ); $imgDir = dirname(__FILE__).'/../views/img/hotel_amenities/'; $i = 1; $defaultImageIndex = 0; @@ -1009,6 +1069,13 @@ class HotelHelper $obj_amenity->id_parent = $idParent; $obj_amenity->save(); + if (isset($amenityIcons[$defaultImageIndex])) { + $obj_amenity->logo_type = 'icon'; + $obj_amenity->logo = $amenityIcons[$defaultImageIndex]; + $obj_amenity->save(); + continue; + } + $srcImg = $imgDir.'_default/'.$defaultImageIndex.'.jpg'; if (file_exists($srcImg)) { if (ImageManager::resize($srcImg, $imgDir.$obj_amenity->id.'.jpg')) { @@ -1114,6 +1181,9 @@ class HotelHelper Configuration::updateValue('PS_MIN_BOOKING_OFFSET', 0); 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); @@ -1165,6 +1235,9 @@ class HotelHelper { $idLang = (int) Configuration::get('PS_LANG_DEFAULT'); $position = 0; + $featureIcons = $this->getDefaultRoomFeatureIcons(); + // features marked as featured by default + $featuredFeatures = array('Bed Type', 'Room Size', 'Balcony Type', 'Wi-Fi Speed', 'AC Type', 'TV Type'); foreach ($this->getDefaultRoomFeatures() as $featureName => $featureValues) { $idFeature = (int) Feature::addFeatureImport($featureName, $position); @@ -1172,6 +1245,15 @@ class HotelHelper return false; } + $objFeature = new Feature($idFeature); + $objFeature->is_featured = in_array($featureName, $featuredFeatures); + // features without an icon keep their default image (img/rf/.jpg) + if (isset($featureIcons[$featureName])) { + $objFeature->logo_type = 'icon'; + $objFeature->logo = $featureIcons[$featureName]; + } + $objFeature->update(); + foreach ($featureValues as $featureValue) { $idFeatureValue = (int) FeatureValue::addFeatureValueImport($idFeature, $featureValue, null, $idLang, false); if (!$idFeatureValue) { @@ -1185,6 +1267,23 @@ class HotelHelper return true; } + /** + * Return the icon class (admin/front icon- classes) of each default room feature. + * + * @return array + */ + protected function getDefaultRoomFeatureIcons() + { + return array( + 'Bed Type' => 'icon-bed', + 'Room Size' => 'icon-arrows-alt', + 'View' => 'icon-eye', + 'Heating Type' => 'icon-fire', + 'TV Type' => 'icon-desktop', + 'Wi-Fi Speed' => 'icon-wifi', + ); + } + /** * Return the default room feature/value seed set. * @@ -2192,6 +2291,73 @@ class HotelHelper // save advance payment information $this->saveAdvancedPaymentInfo($product_id); + + // assign features to the room type as per the room type + $roomTypeFeatures = $this->getDefaultRoomTypeFeatures(); + if (isset($roomTypeFeatures[$roomTypeDataDefult['name']])) { + $this->saveDummyRoomTypeFeatures($product, $roomTypeFeatures[$roomTypeDataDefult['name']]); + } + } + } + + /** + * Return the features (and their values) of each demo room type, keyed by the room type name. + * + * @return array + */ + protected function getDefaultRoomTypeFeatures() + { + return array( + 'General Rooms' => array( + 'Bed Type' => array('Double', 'Bunk Bed'), + 'Room Size' => array('300 sq ft'), + 'Balcony Type' => array('None'), + 'AC Type' => array('Fan Only'), + 'TV Type' => array('LED TV'), + 'Wi-Fi Speed' => array('Basic'), + ), + 'Delux Rooms' => array( + 'Bed Type' => array('Queen'), + 'Room Size' => array('400 sq ft'), + 'Balcony Type' => array('Private Balcony'), + 'AC Type' => array('Split AC'), + 'TV Type' => array('Smart TV'), + 'Wi-Fi Speed' => array('High Speed'), + ), + 'Executive Rooms' => array( + 'Bed Type' => array('King'), + 'Room Size' => array('600 sq ft'), + 'Balcony Type' => array('Juliet Balcony', 'Patio'), + 'AC Type' => array('Central AC'), + 'TV Type' => array('Smart TV'), + 'Wi-Fi Speed' => array('High Speed'), + ), + 'Luxury Rooms' => array( + 'Bed Type' => array('Super King'), + 'Room Size' => array('800 sq ft'), + 'Balcony Type' => array('Rooftop Access', 'Veranda'), + 'AC Type' => array('Central AC'), + 'TV Type' => array('OLED TV'), + 'Wi-Fi Speed' => array('Premium/Fiber'), + ), + ); + } + + /** + * Assign the given features to a demo room type. + * + * @param Product $objProduct + * @param array $features Feature name => array of feature values + */ + public function saveDummyRoomTypeFeatures($objProduct, $features) + { + $idLang = (int) Configuration::get('PS_LANG_DEFAULT'); + foreach ($features as $featureName => $featureValues) { + $idFeature = (int) Feature::addFeatureImport($featureName); + foreach ($featureValues as $featureValue) { + $idFeatureValue = (int) FeatureValue::addFeatureValueImport($idFeature, $featureValue, null, $idLang, false); + $objProduct->addFeaturesToDB($idFeature, $idFeatureValue); + } } } diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelAmenitiesController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelAmenitiesController.php index 6001b3546..14b3c2c3e 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelAmenitiesController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelAmenitiesController.php @@ -127,12 +127,12 @@ class AdminHotelAmenitiesController extends ModuleAdminController } } - $imgPath = $this->module->getLocalPath().self::IMG_DIR.$idAmenity.'.jpg'; + $logoFile = (isset($amenity['logo_type']) && $amenity['logo_type'] == 'image') ? $amenity['logo'] : ''; $this->context->smarty->assign(array( 'amenity' => $amenity, 'id_category' => $idCategory, - 'existing_img' => ($idAmenity && file_exists($imgPath)) - ? $this->module->getPathUri().self::IMG_DIR.$idAmenity.'.jpg' + 'existing_img' => ($logoFile && file_exists($this->module->getLocalPath().self::IMG_DIR.$logoFile)) + ? $this->module->getPathUri().self::IMG_DIR.$logoFile : false, )); } else { @@ -236,7 +236,9 @@ class AdminHotelAmenitiesController extends ModuleAdminController } } else { $hasUpload = isset($_FILES['logo_image']) && !empty($_FILES['logo_image']['tmp_name']); - $hasExisting = $idAmenity && file_exists($this->module->getLocalPath().self::IMG_DIR.$idAmenity.'.jpg'); + $objCurrent = new HotelAmenities($idAmenity); + $hasExisting = $idAmenity && $objCurrent->logo_type == 'image' && $objCurrent->logo + && file_exists($this->module->getLocalPath().self::IMG_DIR.$objCurrent->logo); if (!$hasUpload && !$hasExisting) { $this->errors[] = $this->l('Please upload an image for this amenity.'); } @@ -248,6 +250,7 @@ class AdminHotelAmenitiesController extends ModuleAdminController } $objHotelAmenities = $idAmenity ? new HotelAmenities($idAmenity) : new HotelAmenities(); + $oldImage = ($objHotelAmenities->logo_type == 'image') ? $objHotelAmenities->logo : ''; foreach ($languages as $lang) { $val = trim(Tools::getValue('amenity_name_'.$lang['id_lang'])); $objHotelAmenities->name[$lang['id_lang']] = $val ?: $nameDefault; @@ -263,8 +266,8 @@ class AdminHotelAmenitiesController extends ModuleAdminController return; } - if ($logoType === 'icon') { - $imgFile = $this->module->getLocalPath().self::IMG_DIR.$objHotelAmenities->id.'.jpg'; + if ($logoType === 'icon' && $oldImage) { + $imgFile = $this->module->getLocalPath().self::IMG_DIR.$oldImage; if (file_exists($imgFile)) { unlink($imgFile); } @@ -279,8 +282,13 @@ class AdminHotelAmenitiesController extends ModuleAdminController if (!is_dir($imgDir)) { mkdir($imgDir, 0755, true); } - if (ImageManager::resize($imgFile['tmp_name'], $imgDir.$objHotelAmenities->id.'.jpg')) { - $objHotelAmenities->logo = $objHotelAmenities->id.'.jpg'; + // random file name so that browsers do not show a cached old image + $imageName = $objHotelAmenities->id.'_'.substr(md5(uniqid(mt_rand(), true)), 0, 12).'.jpg'; + if (ImageManager::resize($imgFile['tmp_name'], $imgDir.$imageName)) { + if ($oldImage && file_exists($imgDir.$oldImage)) { + unlink($imgDir.$oldImage); + } + $objHotelAmenities->logo = $imageName; $objHotelAmenities->save(); } else { $this->errors[] = $this->l('Error uploading amenity image.'); diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php index 1797295e6..f978ca93e 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php @@ -165,6 +165,33 @@ 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 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 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', + 'cast' => 'intval', + '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')), ), @@ -529,6 +556,15 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController } elseif (Tools::getValue('WK_ADVANCED_PAYMENT_GLOBAL_MIN_AMOUNT') > 100) { $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 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 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')) { $this->errors[] = $this->l('Please enter Google API key.'); diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index c9a8521e3..d7b613ef9 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -607,6 +607,9 @@ class HotelReservationSystem extends Module 'WK_CUSTOMER_SUPPORT_PHONE_NUMBER', 'WK_CUSTOMER_SUPPORT_EMAIL', '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', diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/1.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/1.jpg deleted file mode 100644 index a3ca11b20..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/1.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/10.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/10.jpg deleted file mode 100644 index 548af697d..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/10.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/11.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/11.jpg deleted file mode 100644 index 7b76b5c8e..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/11.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/12.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/12.jpg deleted file mode 100644 index 12b2e96fc..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/12.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/14.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/14.jpg deleted file mode 100644 index 1e627e70b..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/14.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/16.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/16.jpg deleted file mode 100644 index 3cf466634..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/16.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/17.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/17.jpg deleted file mode 100644 index 83caa28bc..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/17.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/18.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/18.jpg deleted file mode 100644 index 98ae378c3..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/18.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/2.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/2.jpg deleted file mode 100644 index 1b93c0b78..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/2.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/21.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/21.jpg deleted file mode 100644 index 00ce92b18..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/21.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/22.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/22.jpg deleted file mode 100644 index c575a9575..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/22.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/23.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/23.jpg deleted file mode 100644 index 7d8725672..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/23.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/25.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/25.jpg deleted file mode 100644 index 94d457477..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/25.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/26.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/26.jpg deleted file mode 100644 index 948a7f2c3..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/26.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/27.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/27.jpg deleted file mode 100644 index ab81b6aa4..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/27.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/29.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/29.jpg deleted file mode 100644 index 2a51ba4c3..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/29.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/3.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/3.jpg deleted file mode 100644 index 81b917dc3..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/3.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/30.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/30.jpg deleted file mode 100644 index 5b2be3134..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/30.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/32.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/32.jpg deleted file mode 100644 index c12ccfa1d..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/32.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/33.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/33.jpg deleted file mode 100644 index 41079f334..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/33.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/34.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/34.jpg deleted file mode 100644 index c3f3b8c61..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/34.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/35.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/35.jpg deleted file mode 100644 index 79e4974df..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/35.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/37.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/37.jpg deleted file mode 100644 index 485db1b53..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/37.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/38.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/38.jpg deleted file mode 100644 index 1e0308503..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/38.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/39.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/39.jpg deleted file mode 100644 index cae4f9409..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/39.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/4.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/4.jpg deleted file mode 100644 index a609dbc90..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/4.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/41.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/41.jpg deleted file mode 100644 index 1a46bc56f..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/41.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/42.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/42.jpg deleted file mode 100644 index b8a3981ee..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/42.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/45.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/45.jpg deleted file mode 100644 index cb60b74d2..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/45.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/46.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/46.jpg deleted file mode 100644 index 616f13c29..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/46.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/47.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/47.jpg deleted file mode 100644 index 76c45c4c6..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/47.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/48.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/48.jpg deleted file mode 100644 index c8b6c160b..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/48.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/49.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/49.jpg deleted file mode 100644 index 09df629ca..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/49.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/5.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/5.jpg deleted file mode 100644 index e7126905f..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/5.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/50.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/50.jpg deleted file mode 100644 index ba9f839e7..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/50.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/53.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/53.jpg deleted file mode 100644 index 9f7c7a6c6..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/53.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/55.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/55.jpg deleted file mode 100644 index 6e28c9627..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/55.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/56.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/56.jpg deleted file mode 100644 index ec18d3d44..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/56.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/57.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/57.jpg deleted file mode 100644 index b8a3981ee..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/57.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/58.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/58.jpg deleted file mode 100644 index 080603f14..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/58.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/59.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/59.jpg deleted file mode 100644 index 25b3c49c1..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/59.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/6.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/6.jpg deleted file mode 100644 index b108df6ee..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/6.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/60.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/60.jpg deleted file mode 100644 index 06009d4c9..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/60.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/64.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/64.jpg deleted file mode 100644 index 249211644..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/64.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/7.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/7.jpg deleted file mode 100644 index 1951723ba..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/7.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/70.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/70.jpg deleted file mode 100644 index b49af88d2..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/70.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/72.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/72.jpg deleted file mode 100644 index 561c29fed..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/72.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/73.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/73.jpg deleted file mode 100644 index 01dc8c214..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/73.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/8.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/8.jpg deleted file mode 100644 index 7747b2a7e..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/8.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/87.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/87.jpg deleted file mode 100644 index d0a005131..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/87.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/88.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/88.jpg deleted file mode 100644 index a8014f8bb..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/88.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/9.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/9.jpg deleted file mode 100644 index f3b1cc74c..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/9.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/90.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/90.jpg deleted file mode 100644 index 7fd04e01d..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/90.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/91.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/91.jpg deleted file mode 100644 index 63ab0172d..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/91.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/98.jpg b/modules/hotelreservationsystem/views/img/hotel_amenities/_default/98.jpg deleted file mode 100644 index d403392e0..000000000 Binary files a/modules/hotelreservationsystem/views/img/hotel_amenities/_default/98.jpg and /dev/null differ diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_amenities/helpers/view/view.tpl b/modules/hotelreservationsystem/views/templates/admin/hotel_amenities/helpers/view/view.tpl index 1a1585bef..2f2db5340 100644 --- a/modules/hotelreservationsystem/views/templates/admin/hotel_amenities/helpers/view/view.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_amenities/helpers/view/view.tpl @@ -68,9 +68,9 @@ {if $amenity.logo_type == 'icon' && $amenity.logo} - + {elseif $amenity.logo_type == 'image' && $amenity.logo} - {$amenity.name|escape:'htmlall':'UTF-8'} {else} diff --git a/modules/wkhotelfilterblock/views/css/wkhotelfilterblock.css b/modules/wkhotelfilterblock/views/css/wkhotelfilterblock.css index b0c3a78be..5c2e5cdbd 100644 --- a/modules/wkhotelfilterblock/views/css/wkhotelfilterblock.css +++ b/modules/wkhotelfilterblock/views/css/wkhotelfilterblock.css @@ -61,6 +61,22 @@ margin-bottom: 5px; } +.layered_filt_category +{ + margin-bottom: 10px; +} + +.layered_filt_category_name +{ + margin-bottom: 5px; +} + +.layered_filt_category_children +{ + padding-left: 15px; + border-left: 1px solid #d6d4d4; +} + .filters_name, .price_filter_subcont span { font-size: 16px; diff --git a/modules/wkhotelfilterblock/views/js/wkhotelfilterblock.js b/modules/wkhotelfilterblock/views/js/wkhotelfilterblock.js index e88cc649d..bfa546c65 100644 --- a/modules/wkhotelfilterblock/views/js/wkhotelfilterblock.js +++ b/modules/wkhotelfilterblock/views/js/wkhotelfilterblock.js @@ -26,7 +26,7 @@ $(document).ready(function() { var filter_wrapper = $(this).parents(".layered_filter_heading").siblings(".lf_sub_cont"); var make_diff = filter_wrapper.children("div"); //use to make difference between checkbox and price slider - if (make_diff.hasClass("layered_filt")) // for checkbox + if (make_diff.hasClass("layered_filt") || make_diff.hasClass("layered_filt_category")) // for checkbox (flat or tree) { var selected_filter = filter_wrapper.find("div.layered_filt input.filter:checked").prop("checked", false); selected_filter.parent("span.checked").removeClass("checked"); @@ -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()); } diff --git a/modules/wkhotelfilterblock/views/templates/hook/htlfilterblock.tpl b/modules/wkhotelfilterblock/views/templates/hook/htlfilterblock.tpl index 7f72fdca6..0fab3ecf3 100644 --- a/modules/wkhotelfilterblock/views/templates/hook/htlfilterblock.tpl +++ b/modules/wkhotelfilterblock/views/templates/hook/htlfilterblock.tpl @@ -23,6 +23,29 @@ {block name='room_types_filters_block'}
+ {block name='room_types_price_filter'} + {if isset($config) && $config['SHOW_PRICE_FILTER']} +
+
+
+
+ {l s='Price' mod='wkhotelfilterblock'} +
+
+ {l s='Clear Filter' mod='wkhotelfilterblock'} +
+
+
+
+ {displayPrice price=$min_price} + {displayPrice price=$max_price} +
+
+
+
+ {/if} + {/block} + {block name='room_types_amenities_filter'} {if isset($config) && $config['SHOW_AMENITIES_FILTER'] && $all_amenities}
@@ -47,26 +70,29 @@ {/if} {/block} - {block name='room_types_price_filter'} - {if isset($config) && $config['SHOW_PRICE_FILTER']} -
-
-
-
- {l s='Price' mod='wkhotelfilterblock'} -
+ {block name='room_types_features_filter'} + {if isset($config) && $config['SHOW_FEATURES_FILTER'] && isset($room_type_features) && $room_type_features} + {foreach $room_type_features as $feature} +
+
+
+
+ {$feature.name|escape:'html':'UTF-8'} +
+
+ {l s='Clear Filter' mod='wkhotelfilterblock'}
- {l s='Clear Filter' mod='wkhotelfilterblock'} +
+
+ {foreach $feature.values as $featureValue} +
+ + {$featureValue.value|escape:'html':'UTF-8'} +
+ {/foreach}
-
-
- {displayPrice price=$min_price} - {displayPrice price=$max_price} -
-
-
-
+ {/foreach} {/if} {/block}
diff --git a/modules/wkhotelfilterblock/wkhotelfilterblock.php b/modules/wkhotelfilterblock/wkhotelfilterblock.php index c801b81f7..689fe40f5 100644 --- a/modules/wkhotelfilterblock/wkhotelfilterblock.php +++ b/modules/wkhotelfilterblock/wkhotelfilterblock.php @@ -61,6 +61,15 @@ class wkhotelfilterblock extends Module public function renderForm() { + + + $features = array(); + $featuresList = Feature::getFeatures($this->context->language->id); + foreach ($featuresList as $feature) { + $features[] = array('id_group' => (int) $feature['id_feature'], 'name' => $feature['name']); + } + + $fields_form = array(); $fields_form['form'] = array( 'legend' => array( @@ -102,6 +111,33 @@ class wkhotelfilterblock extends Module ), 'hint' => $this->l('Enable to display Price filter.'), ), + array( + 'type' => 'switch', + 'label' => $this->l('Show Features filter'), + 'name' => 'SHOW_FEATURES_FILTER', + 'is_bool' => true, + 'values' => array( + array( + 'id' => 'features_on', + 'value' => 1, + ), + array( + 'id' => 'features_off', + 'value' => 0, + ), + ), + 'hint' => $this->l('Enable to display Room Features filter.'), + ), + array( + 'type' => 'group', + 'label' => $this->l('Features'), + 'name' => 'FEATURES_FILTER_BOX', + 'form_group_class' => 'features_filter_group', + 'groups_id_title' => $this->l('ID'), + 'groups_title' => $this->l('Feature name'), + 'values' => $features, + 'hint' => $this->l('Mark the features that will be displayed in the Features filter.'), + ), ), 'submit' => array( 'title' => $this->l('Save'), @@ -120,24 +156,54 @@ class wkhotelfilterblock extends Module '&configure='.$this->name.'&module_name='.$this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); + $fieldsValue = $this->getConfigFieldsValues(); + $selectedFeatures = $this->getSelectedFeatureIds(); + foreach ($features as $feature) { + $fieldsValue['FEATURES_FILTER_BOX_'.$feature['id_group']] = in_array($feature['id_group'], $selectedFeatures); + } + $helper->tpl_vars = array( - 'fields_value' => $this->getConfigFieldsValues(), + 'fields_value' => $fieldsValue, 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id, ); - return $helper->generateForm(array($fields_form)); + // show the features list only when the Features filter is enabled + $script = ''; + + return $helper->generateForm(array($fields_form)).$script; } 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') ); Configuration::updateValue('SHOW_PRICE_FILTER', Tools::getValue('SHOW_PRICE_FILTER')); - + Configuration::updateValue('SHOW_FEATURES_FILTER', (int) Tools::getValue('SHOW_FEATURES_FILTER')); + if(Tools::getValue('SHOW_FEATURES_FILTER')){ + Configuration::updateValue( + 'FEATURES_FILTER_IDS', + implode(',', array_map('intval', (array) Tools::getValue('FEATURES_FILTER_BOX', array()))) + ); + }else{ + Configuration::updateValue('FEATURES_FILTER_IDS', ''); + } // redirect after saving the configuration Tools::redirectAdmin( $this->context->link->getAdminLink('AdminModules').'&configure='.$this->name.'&tab_module='.$this->tab. @@ -154,6 +220,8 @@ class wkhotelfilterblock extends Module || !$this->registerHook('displayLeftColumn') || !Configuration::updateValue('SHOW_AMENITIES_FILTER', 1) || !Configuration::updateValue('SHOW_PRICE_FILTER', 1) + || !Configuration::updateValue('SHOW_FEATURES_FILTER', 0) + || !Configuration::updateValue('FEATURES_FILTER_IDS', '') ) { return false; } @@ -229,6 +297,20 @@ class wkhotelfilterblock extends Module $currency = $this->context->currency; $config = $this->getConfigFieldsValues(); + // features with their values for the features tree filter + $room_type_features = array(); + if ($config['SHOW_FEATURES_FILTER'] && Feature::isFeatureActive()) { + $selectedFeatures = $this->getSelectedFeatureIds(); + foreach (Feature::getFeatures($id_lang) as $feature) { + if (!in_array((int) $feature['id_feature'], $selectedFeatures)) { + continue; + } + if ($values = FeatureValue::getFeatureValuesWithLang($id_lang, (int) $feature['id_feature'])) { + $feature['values'] = $values; + $room_type_features[] = $feature; + } + } + } $num_days = HotelHelper::getNumberOfDays($date_from, $date_to); @@ -236,6 +318,7 @@ class wkhotelfilterblock extends Module $this->context->smarty->assign(array( 'warning_num' => $warning_num, 'all_amenities' => $all_amenities, + 'room_type_features' => $room_type_features, 'max_adult' => $max_adult, 'max_child' => $max_child, 'cat_link' => $categoryUrl, @@ -259,14 +342,29 @@ class wkhotelfilterblock extends Module return array( 'SHOW_AMENITIES_FILTER' => Configuration::get('SHOW_AMENITIES_FILTER'), 'SHOW_PRICE_FILTER' => Configuration::get('SHOW_PRICE_FILTER'), + 'SHOW_FEATURES_FILTER' => Configuration::get('SHOW_FEATURES_FILTER'), ); } + /** + * Get the ids of the features selected in the configuration for the Features filter. + * + * @return int[] + */ + public function getSelectedFeatureIds() + { + $ids = (string) Configuration::get('FEATURES_FILTER_IDS'); + + return $ids === '' ? array() : array_map('intval', explode(',', $ids)); + } + public function uninstall() { if (!parent::uninstall() || !Configuration::deleteByName('SHOW_AMENITIES_FILTER') || !Configuration::deleteByName('SHOW_PRICE_FILTER') + || !Configuration::deleteByName('SHOW_FEATURES_FILTER') + || !Configuration::deleteByName('FEATURES_FILTER_IDS') ) { return false; } diff --git a/themes/hotel-reservation-theme/_partials/booking-form.tpl b/themes/hotel-reservation-theme/_partials/booking-form.tpl index 91a662fa1..c0109f278 100644 --- a/themes/hotel-reservation-theme/_partials/booking-form.tpl +++ b/themes/hotel-reservation-theme/_partials/booking-form.tpl @@ -103,7 +103,7 @@

{l s='qty'}: {$product['quantity']}

{/if}
-
+

{displayPrice price=$product['price']}

diff --git a/themes/hotel-reservation-theme/_partials/room_type_list.tpl b/themes/hotel-reservation-theme/_partials/room_type_list.tpl index e6d8288c4..6dd5d8152 100644 --- a/themes/hotel-reservation-theme/_partials/room_type_list.tpl +++ b/themes/hotel-reservation-theme/_partials/room_type_list.tpl @@ -53,18 +53,36 @@ {block name='room_type_list_room_description'}
{$room_v['description_short']|truncate:190:"":true} {l s='View More'}....
{/block} + {block name='room_type_list_room_featured_features'} + {if !empty($room_v['featured_features'])} +
+ +
+ {/if} + {/block}
{block name='room_type_list_room_features'}
- {if !empty($room_v['feature'])} + {if !empty($room_v['featured_amenities'])}

- {foreach from=$room_v['feature'] key=feat_k item=feat_v} + {foreach from=$room_v['featured_amenities'] key=feat_k item=feat_v} {if $feat_v.logo_type == 'icon' && $feat_v.logo} {elseif $feat_v.logo_type == 'image' && $feat_v.logo} {/if} {/foreach} diff --git a/themes/hotel-reservation-theme/css/category.css b/themes/hotel-reservation-theme/css/category.css index 93ac147ef..d0ea2e9e3 100644 --- a/themes/hotel-reservation-theme/css/category.css +++ b/themes/hotel-reservation-theme/css/category.css @@ -83,9 +83,10 @@ color: #555555; font-size: 14px; font-weight: 400; - margin-bottom: 15px; } - +.room_featured_features, .room_features_cont{ + margin-top: 10px; +} .rm_desc p { display: inline; @@ -108,9 +109,6 @@ p.capa_txt { margin-bottom: 15px; } -.visible-md .capa_txt { - padding-left: 15px; -} .rm_review_cont { @@ -155,10 +153,31 @@ p.capa_txt { .rm_amen { - width: 20px; + color: #555555; + width: 18px; display: inline-block; margin-right: 10px; margin-bottom: 5px; + font-size: 16px; + color: #555555; +} + +.room_featured_feature +{ + display: inline-block; + margin: 0 10px 10px 0; + color: #555; +} +.room_featured_feature i{ + + font-size: 16px; + color: #555555; +} + +.room_featured_feature img +{ + max-height: 20px; + max-width: 20px; } .rm_price_val @@ -258,7 +277,6 @@ p.capa_txt { left: unset; } .room_features_cont > div { - min-height: 47px; display: flex; flex-wrap: wrap; align-items: center; diff --git a/themes/hotel-reservation-theme/css/order-opc.css b/themes/hotel-reservation-theme/css/order-opc.css index 573f07c24..f3f8fb381 100644 --- a/themes/hotel-reservation-theme/css/order-opc.css +++ b/themes/hotel-reservation-theme/css/order-opc.css @@ -200,15 +200,38 @@ margin-bottom: 5px; } .order-detail-content span.room-type-feature { - white-space: nowrap; - line-height: 35px; + display: inline-block; + max-width: 100%; + line-height: 24px; background-color: #eee; - border-radius: 10px; - margin-right: 10px; - padding: 3px 10px 6px 0px; - font-size: 14px; + 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: 12px; + color: #555555; +} +.room-type-feature img { + padding: 3px; +} .order-detail-content .room_duration_block_head { font-size: 12px; color: #777777; diff --git a/themes/hotel-reservation-theme/css/product.css b/themes/hotel-reservation-theme/css/product.css index 1d6f56ecb..ae9d789e8 100644 --- a/themes/hotel-reservation-theme/css/product.css +++ b/themes/hotel-reservation-theme/css/product.css @@ -1294,14 +1294,13 @@ Quick View Styles .room_info_content.row .col-sm-4 .amenity-name { white-space: nowrap; overflow: hidden;} -.room_feature_group { - margin-bottom: 15px;} .room_feature_group .room_info_heading { display: flex; align-items: center; gap: 5px; margin-bottom: 3px;} - +.room_info_heading i { + font-size: 16px;} .product_wrapper .form-control { background-color: transparent!important; border: 1px solid #999999; @@ -1442,6 +1441,24 @@ Quick View Styles color: #505050; } +/* featured amenities (room type + hotel) */ +.featured_amenities .featured_amenity { + display: inline-block; + margin: 0 20px 8px 0; +} +.featured_amenities .featured_amenity img { + 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 */ .services-info-tooltip-cont { min-width: 240px; @@ -1471,6 +1488,18 @@ Quick View Styles flex-wrap: wrap; justify-content: space-between; } +.extra-service-panel .services-list .services-list-row { + align-items: center; +} +.extra-service-panel .services-list .services-list-row .service-price-action { + display: flex; + align-items: center; + justify-content: flex-end; + gap: 10px; +} +.extra-service-panel .services-list .services-list-row .service-price-action p { + margin: 0; +} .extra-service-panel .summary-row .service_price { font-weight: 700; } diff --git a/themes/hotel-reservation-theme/product.tpl b/themes/hotel-reservation-theme/product.tpl index 4a1b2ff4a..cd9a33c9b 100644 --- a/themes/hotel-reservation-theme/product.tpl +++ b/themes/hotel-reservation-theme/product.tpl @@ -261,40 +261,69 @@

{/if} {/block} + {block name='product_info_tab_featured_amenities'} + {if isset($featured_amenities) && $featured_amenities} + + {/if} + {/block} {block name='product_info_tab_room_features'} {if isset($room_type_features) && $room_type_features} -
- {assign var="current_feature_name" value=""} - {assign var="current_feature_values" value=""} - {assign var="current_feature_id" value=0} - {foreach from=$room_type_features item=feature} - {if $feature.name != $current_feature_name} - {if $current_feature_name != ""} -
-
- {$current_feature_name|escape:'html':'UTF-8'} - {$current_feature_name|escape:'html':'UTF-8'} -
-
{$current_feature_values|escape:'html':'UTF-8'}
-
- {/if} - {assign var="current_feature_name" value=$feature.name} - {assign var="current_feature_id" value=$feature.id_feature} - {assign var="current_feature_values" value=$feature.value} - {else} - {assign var="current_feature_values" value="`$current_feature_values`, `$feature.value`"} - {/if} - {if $feature@last} -
+ {assign var="current_feature_name" value=""} + {assign var="current_feature_values" value=""} + {assign var="current_feature_id" value=0} + {assign var="current_feature_logo_type" value=""} + {assign var="current_feature_logo" value=""} + {assign var="current_feature_logo_image" value=""} + {foreach from=$room_type_features item=feature} + {if $feature.name != $current_feature_name} + {if $current_feature_name != ""} +
- {$current_feature_name|escape:'html':'UTF-8'} + {if $current_feature_logo_type == 'icon' && $current_feature_logo}{else}{$current_feature_name|escape:'html':'UTF-8'}{/if} {$current_feature_name|escape:'html':'UTF-8'}
{$current_feature_values|escape:'html':'UTF-8'}
{/if} - {/foreach} -
+ {assign var="current_feature_name" value=$feature.name} + {assign var="current_feature_id" value=$feature.id_feature} + {assign var="current_feature_logo_type" value=$feature.logo_type} + {assign var="current_feature_logo" value=$feature.logo} + {assign var="current_feature_logo_image" value=$feature.logo_image} + {assign var="current_feature_values" value=$feature.value} + {else} + {assign var="current_feature_values" value="`$current_feature_values`, `$feature.value`"} + {/if} + {if $feature@last} +
+
+ {if $current_feature_logo_type == 'icon' && $current_feature_logo}{else}{$current_feature_name|escape:'html':'UTF-8'}{/if} + {$current_feature_name|escape:'html':'UTF-8'} +
+
{$current_feature_values|escape:'html':'UTF-8'}
+
+ {/if} + {/foreach} {/if} {/block} {* Block for booking products *} @@ -303,15 +332,15 @@ {if isset($room_dynamic_amenities) && $room_dynamic_amenities}
- {l s='%s Amenities' sprintf=$property_type} + {l s='%s Amenities' sprintf=$room_type_info['selling_object_name']}
{foreach from=$room_dynamic_amenities item=amenity} -
+
{if $amenity.logo_type == 'icon' && $amenity.logo} {elseif $amenity.logo_type == 'image' && $amenity.logo} - {$amenity.name|escape:'html':'UTF-8'} @@ -331,11 +360,11 @@
{foreach from=$hotel_dynamic_amenities item=amenity} -
+
{if $amenity.logo_type == 'icon' && $amenity.logo} {elseif $amenity.logo_type == 'image' && $amenity.logo} - {$amenity.name|escape:'html':'UTF-8'} diff --git a/themes/hotel-reservation-theme/shopping-cart-detail.tpl b/themes/hotel-reservation-theme/shopping-cart-detail.tpl index a185db778..ef6c6e4ae 100644 --- a/themes/hotel-reservation-theme/shopping-cart-detail.tpl +++ b/themes/hotel-reservation-theme/shopping-cart-detail.tpl @@ -79,11 +79,16 @@ {/block}
{block name='shopping_cart_room_type_features'} - {if isset($data_v['hotel_info']['room_features'])} + {if !empty($data_v['hotel_info']['room_features'])}
{foreach $data_v['hotel_info']['room_features'] as $feature} - {$feature['value']|escape:'html':'UTF-8'} + {if $feature['logo_type'] == 'icon' && $feature['logo']} + + {else} + + {/if} + {$feature['value']|escape:'html':'UTF-8'} {/foreach}