diff --git a/config/xml/themes/default.xml b/config/xml/themes/default.xml
index f7c0da20f..8337facba 100644
--- a/config/xml/themes/default.xml
+++ b/config/xml/themes/default.xml
@@ -82,6 +82,7 @@
+
diff --git a/controllers/front/ContactController.php b/controllers/front/ContactController.php
index 54c5dbe17..f4cbe4680 100644
--- a/controllers/front/ContactController.php
+++ b/controllers/front/ContactController.php
@@ -287,7 +287,8 @@ class ContactControllerCore extends FrontController
}
}
}
- $contactKey = md5(uniqid(microtime(), true));
+
+ $contactKey = md5(uniqid(microtime(), true));
$this->context->cookie->__set('contactFormKey', $contactKey);
$this->context->smarty->assign(
array(
@@ -297,7 +298,7 @@ class ContactControllerCore extends FrontController
'gblHtlAddress' => $gblHtlAddress,
'contacts' => Contact::getContacts($this->context->language->id),
'message' => html_entity_decode(Tools::getValue('message')),
- 'contactKey' => $contactKey,
+ 'contactKey' => $contactKey,
)
);
diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php
index 9b1c66ee0..d1ed6a7dc 100644
--- a/controllers/front/ProductController.php
+++ b/controllers/front/ProductController.php
@@ -63,6 +63,13 @@ class ProductControllerCore extends FrontController
if (Configuration::get('PS_DISPLAY_JQZOOM') == 1) {
$this->addJqueryPlugin('jqzoom');
}
+
+ if (($PS_API_KEY = Configuration::get('PS_API_KEY')) && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) {
+ $this->addJS(
+ 'https://maps.googleapis.com/maps/api/js?key='.$PS_API_KEY.'&libraries=places&language='.
+ $this->context->language->iso_code.'®ion='.$this->context->country->iso_code
+ );
+ }
}
public function canonicalRedirection($canonical_url = '')
@@ -324,9 +331,25 @@ class ProductControllerCore extends FrontController
}
/*End*/
+ $hotelImageLink = null;
+ if ($coverImage = HotelImage::getCover($hotel_id)) {
+ $hotelImagesBaseDir = _MODULE_DIR_.'hotelreservationsystem/views/img/hotel_img/';
+ $hotelImageLink = $this->context->link->getMediaLink(
+ $hotelImagesBaseDir.$coverImage['hotel_image_id'].'.jpg'
+ );
+ }
+
+ Media::addJsDef(array(
+ 'hotel_loc' => array(
+ 'latitude' => $hotel_branch_obj->latitude,
+ 'longitude' => $hotel_branch_obj->longitude,
+ )
+ ));
+
if (Tools::getValue('error')) {
$this->context->smarty->assign('error', Tools::getValue('error'));
}
+
if (Module::isInstalled('productcomments')) {
$this->context->smarty->assign(
array(
@@ -349,9 +372,15 @@ class ProductControllerCore extends FrontController
'hotel_check_in' => date('h:i a', strtotime($hotel_branch_obj->check_in)),
'hotel_check_out' => date('h:i a', strtotime($hotel_branch_obj->check_out)),
'hotel_location' => $hotel_location,
+ 'hotel_latitude' => $hotel_branch_obj->latitude,
+ 'hotel_longitude' => $hotel_branch_obj->longitude,
+ 'hotel_map_input_text' => $hotel_branch_obj->map_input_text,
+ 'hotel_address1' => $addressInfo['address1'],
+ 'hotel_phone' => $addressInfo['phone'],
'hotel_name' => $hotel_name,
'hotel_policies' => $hotel_policies,
'hotel_features' => $htl_features,
+ 'hotel_image_link' => $hotelImageLink,
'hotel_has_images' => (bool) HotelImage::getCover($hotel_id),
'ftr_img_src' => _PS_IMG_.'rf/',
'order_date_restrict' => $order_date_restrict
@@ -434,6 +463,7 @@ class ProductControllerCore extends FrontController
'category-'.(isset($this->category) ? $this->category->getFieldByLang('link_rewrite') : ''),
),
'display_discount_price' => Configuration::get('PS_DISPLAY_DISCOUNT_PRICE'),
+ 'display_google_maps' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'),
)
);
}
diff --git a/install/data/theme.sql b/install/data/theme.sql
index 499aa07d3..21383612a 100644
--- a/install/data/theme.sql
+++ b/install/data/theme.sql
@@ -130,6 +130,24 @@ UPDATE `PREFIX_hook_module` SET position = 3
WHERE id_module = (SELECT id_module FROM `PREFIX_module` WHERE name = 'blockbestsellers')
AND id_hook IN (@id_hook, @id_hook2);
+/* displayLeftColumn */
+SET @id_hook = (SELECT id_hook FROM `PREFIX_hook` WHERE name = 'displayLeftColumn');
+UPDATE `PREFIX_hook_module` SET position = 1
+WHERE id_module = (SELECT id_module FROM `PREFIX_module` WHERE name = 'wkroomsearchblock')
+AND id_hook = @id_hook;
+
+UPDATE `PREFIX_hook_module` SET position = 2
+WHERE id_module = (SELECT id_module FROM `PREFIX_module` WHERE name = 'wkhotelfilterblock')
+AND id_hook = @id_hook;
+
+UPDATE `PREFIX_hook_module` SET position = 3
+WHERE id_module = (SELECT id_module FROM `PREFIX_module` WHERE name = 'blockmyaccount')
+AND id_hook = @id_hook;
+
+UPDATE `PREFIX_hook_module` SET position = 4
+WHERE id_module = (SELECT id_module FROM `PREFIX_module` WHERE name = 'hotelreservationsystem')
+AND id_hook = @id_hook;
+
/* displayFooter */
SET @id_hook = (SELECT id_hook FROM `PREFIX_hook` WHERE name = 'displayFooter');
UPDATE `PREFIX_hook_module` SET position = 1
diff --git a/modules/hotelreservationsystem/classes/HotelBranchInformation.php b/modules/hotelreservationsystem/classes/HotelBranchInformation.php
index 82d061d58..6f872ef1c 100644
--- a/modules/hotelreservationsystem/classes/HotelBranchInformation.php
+++ b/modules/hotelreservationsystem/classes/HotelBranchInformation.php
@@ -554,7 +554,6 @@ class HotelBranchInformation extends ObjectModel
return Db::getInstance()->executeS($sql);
}
-
public function getAllHotels()
{
return Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'htl_branch_info`');
diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php
index 8c0d55f4f..3e2e8801f 100644
--- a/modules/hotelreservationsystem/hotelreservationsystem.php
+++ b/modules/hotelreservationsystem/hotelreservationsystem.php
@@ -100,6 +100,40 @@ class HotelReservationSystem extends Module
$this->context->controller->addJS($this->_path.'/views/js/HotelReservationFront.js');
}
+ public function hookDisplayLeftColumn()
+ {
+ if (Tools::getValue('controller') == 'category') {
+ if ($apiKey = Configuration::get('PS_API_KEY')) {
+ $idCategory = Tools::getValue('id_category');
+ $idHotel = HotelBranchInformation::getHotelIdByIdCategory($idCategory);
+ $objHotel = new HotelBranchInformation($idHotel, $this->context->language->id);
+
+ if (floatval($objHotel->latitude) != 0
+ && floatval($objHotel->longitude) != 0
+ ) {
+ Media::addJsDef(array(
+ 'hotel_location' => array(
+ 'latitude' => $objHotel->latitude,
+ 'longitude' => $objHotel->longitude,
+ 'map_input_text' => $objHotel->map_input_text,
+ ),
+ 'hotel_name' => $objHotel->hotel_name,
+ ));
+
+ $this->context->controller->addJS(
+ 'https://maps.googleapis.com/maps/api/js?key='.$apiKey.'&libraries=places&language='.
+ $this->context->language->iso_code.'®ion='.$this->context->country->iso_code
+ );
+ $this->context->controller->addJS($this->getPathUri().'views/js/searchResultsMap.js');
+ $this->context->controller->addCSS($this->getPathUri().'views/css/searchResultsMap.css');
+
+ $this->context->smarty->assign('hotel', $objHotel);
+ return $this->display(__FILE__, 'searchResultsMap.tpl');
+ }
+ }
+ }
+ }
+
public function hookDisplayAfterHookTop()
{
if (Tools::getValue('controller') == 'index') {
@@ -515,7 +549,8 @@ class HotelReservationSystem extends Module
'actionObjectProfileAddAfter',
'actionObjectProfileDeleteBefore',
'actionObjectGroupDeleteBefore',
- 'actionOrderStatusPostUpdate'
+ 'actionOrderStatusPostUpdate',
+ 'displayLeftColumn',
)
);
}
diff --git a/modules/hotelreservationsystem/views/css/searchResultsMap.css b/modules/hotelreservationsystem/views/css/searchResultsMap.css
new file mode 100644
index 000000000..bd1fa6649
--- /dev/null
+++ b/modules/hotelreservationsystem/views/css/searchResultsMap.css
@@ -0,0 +1,26 @@
+/**
+* 2010-2022 Webkul.
+*
+* NOTICE OF LICENSE
+*
+* All right is reserved,
+* Please go through LICENSE.txt file inside our module
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade this module to newer
+* versions in the future. If you wish to customize this module for your
+* needs please refer to CustomizationPolicy.txt file inside our module for more information.
+*
+* @author Webkul IN
+* @copyright 2010-2022 Webkul IN
+* @license LICENSE.txt
+*/
+
+#search-results-wrap .map-wrap {
+ height: 200px;
+}
+
+#search-results-wrap .lf_sub_cont {
+ max-height: none;
+}
diff --git a/modules/hotelreservationsystem/views/js/searchResultsMap.js b/modules/hotelreservationsystem/views/js/searchResultsMap.js
new file mode 100644
index 000000000..59a6f4047
--- /dev/null
+++ b/modules/hotelreservationsystem/views/js/searchResultsMap.js
@@ -0,0 +1,55 @@
+/**
+* 2010-2022 Webkul.
+*
+* NOTICE OF LICENSE
+*
+* All right is reserved,
+* Please go through LICENSE.txt file inside our module
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade this module to newer
+* versions in the future. If you wish to customize this module for your
+* needs please refer to CustomizationPolicy.txt file inside our module for more information.
+*
+* @author Webkul IN
+* @copyright 2010-2022 Webkul IN
+* @license LICENSE.txt
+*/
+
+function initMap() {
+ const hotelLocation = {
+ lat: Number(hotel_location.latitude),
+ lng: Number(hotel_location.longitude),
+ };
+
+ const map = new google.maps.Map($($('#search-results-wrap .map-wrap')).get(0), {
+ zoom: 10,
+ center: hotelLocation,
+ disableDefaultUI: true,
+ fullscreenControl: true,
+ });
+
+ const marker = new google.maps.Marker({
+ position: hotelLocation,
+ map: map,
+ title: hotel_name,
+ });
+
+ marker.addListener('click', function() {
+ let query = '';
+ if (hotel_location.map_input_text != '') {
+ query = hotel_location.map_input_text;
+ } else {
+ query = hotel_location.latitude + ',' + hotel_location.longitude;
+ }
+
+ window.open('https://www.google.com/maps/search/?api=1&query='+encodeURIComponent(query), '_blank');
+ });
+}
+
+$(document).ready(function() {
+ if (typeof google == 'object' && typeof hotel_location == 'object') {
+ initMap();
+ }
+});
diff --git a/modules/hotelreservationsystem/views/templates/hook/searchResultsMap.tpl b/modules/hotelreservationsystem/views/templates/hook/searchResultsMap.tpl
new file mode 100644
index 000000000..445244bdd
--- /dev/null
+++ b/modules/hotelreservationsystem/views/templates/hook/searchResultsMap.tpl
@@ -0,0 +1,34 @@
+{**
+* 2010-2022 Webkul.
+*
+* NOTICE OF LICENSE
+*
+* All right is reserved,
+* Please go through LICENSE.txt file inside our module
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade this module to newer
+* versions in the future. If you wish to customize this module for your
+* needs please refer to CustomizationPolicy.txt file inside our module for more information.
+*
+* @author Webkul IN
+* @copyright 2010-2022 Webkul IN
+* @license LICENSE.txt
+*}
+
+
+
+
+
+ {l s='Directions' mod='hotelreservationsystem'}
+
+
+
+
+
+ {if ($hotel->latitude|floatval != 0 && $hotel->longitude|floatval != 0)}
+
+ {/if}
+
+
diff --git a/themes/hotel-reservation-theme/contact-form.tpl b/themes/hotel-reservation-theme/contact-form.tpl
index dc9ae36ff..6e7cbdc7e 100644
--- a/themes/hotel-reservation-theme/contact-form.tpl
+++ b/themes/hotel-reservation-theme/contact-form.tpl
@@ -217,6 +217,7 @@
{strip}
{addJsDefL name='contact_fileDefaultHtml'}{l s='No file selected' js=1}{/addJsDefL}
{addJsDefL name='contact_fileButtonHtml'}{l s='Choose File' js=1}{/addJsDefL}
+ {addJsDefL name='contact_map_get_dirs'}{l s='Get Directions' js=1}{/addJsDefL}
{/strip}
{if isset($hotelLocationArray)}
{strip}
@@ -226,4 +227,4 @@
{strip}
{addJsDef hotelLocationArray = 0}
{/strip}
-{/if}
\ No newline at end of file
+{/if}
diff --git a/themes/hotel-reservation-theme/css/contact-form.css b/themes/hotel-reservation-theme/css/contact-form.css
index ca81ab3b9..5ffae05e0 100644
--- a/themes/hotel-reservation-theme/css/contact-form.css
+++ b/themes/hotel-reservation-theme/css/contact-form.css
@@ -126,6 +126,7 @@
float: left;
padding: 15px 0px;
width: 100%;
+ height: 90%;
}
.htl-contact-page .hotel-city-container>span {
font-size: 24px;
@@ -253,3 +254,23 @@
width: 100%;
height: 100%;
}
+
+#map .view-link {
+ padding-top: 4px;
+}
+
+.gm-btn-get-directions {
+ text-decoration: none;
+ color: #427fed;
+ font-weight: bold;
+}
+
+.gm-btn-get-directions:hover {
+ text-decoration: underline;
+ color: #427fed;
+}
+
+.gm-btn-get-directions:focus {
+ outline: none;
+ color: #427fed;
+}
diff --git a/themes/hotel-reservation-theme/css/product.css b/themes/hotel-reservation-theme/css/product.css
index 6934547bd..f166a9b05 100644
--- a/themes/hotel-reservation-theme/css/product.css
+++ b/themes/hotel-reservation-theme/css/product.css
@@ -1471,6 +1471,54 @@ Quick View Styles
border-top: 1px solid #eee;
padding-top: 15px;} */
+#room_type_map_tab .map-wrap {
+ min-height: 500px;
+}
+
+#room_type_map_tab .hotel-info-wrap {
+ max-width: 300px;
+ background-color: #fff;
+ padding: 12px;
+ margin: 0 0 20px 10px;
+ border-radius: 2px;
+ box-shadow: 0 2px 6px rgba(0,0,0,.3);
+ display: flex;
+}
+
+#room_type_map_tab .hotel-info-wrap .hotel-image-wrap {
+ padding-right: 8px;
+}
+
+#room_type_map_tab .hotel-info-wrap .hotel-image-wrap img {
+ max-width: 70px;
+ max-height: 70px;
+}
+
+#room_type_map_tab .hotel-info-wrap .name {
+ font-size: 14px;
+ font-weight: bold;
+ color: #1a73e8;
+ margin-bottom: 6px;
+}
+
+#room_type_map_tab .hotel-info-wrap .address,
+#room_type_map_tab .hotel-info-wrap .contact {
+ font-size: 13px;
+ font-weight: normal;
+ color: #555;
+}
+
+#room_type_map_tab .hotel-info-wrap .address {
+ margin-bottom: 6px;
+}
+
+#room_type_map_tab .hotel-info-wrap .view-on-map {
+ background-color: #186bd7;
+ border-radius: 2px;
+ color: #fff;
+ padding: 5px 10px;
+}
+
.room_info_hotel_images_wrap .row {
margin-left: -7.5px;
margin-right: -7.5px; }
diff --git a/themes/hotel-reservation-theme/js/contact-form.js b/themes/hotel-reservation-theme/js/contact-form.js
index 0023a18a8..cade7f70c 100644
--- a/themes/hotel-reservation-theme/js/contact-form.js
+++ b/themes/hotel-reservation-theme/js/contact-form.js
@@ -94,7 +94,13 @@ function initMap() {
// Allow each marker to have an info window
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
- infoWindow.setContent(location.map_formated_address);
+ var directionsLink = 'https://www.google.com/maps/dir/?api=1&destination='+
+ location.latitude+','+location.longitude;
+ var content = ''+location.hotel_name+'
'+
+ location.map_formated_address+
+ '';
+ infoWindow.setContent(content);
infoWindow.open(map, marker);
}
})(marker, i));
@@ -108,4 +114,4 @@ function initMap() {
// this.setZoom(8);
google.maps.event.removeListener(boundsListener);
});
-}
\ No newline at end of file
+}
diff --git a/themes/hotel-reservation-theme/js/product.js b/themes/hotel-reservation-theme/js/product.js
index ac897987f..41bc50ea6 100644
--- a/themes/hotel-reservation-theme/js/product.js
+++ b/themes/hotel-reservation-theme/js/product.js
@@ -113,7 +113,6 @@ if (typeof combinations !== 'undefined' && combinations)
}
combinations = combinationsJS;
}
-/* */
$(document).ready(function() {
var url_found = checkUrl();
@@ -861,7 +860,6 @@ function serialScrollResizeThumbContainer() {
}
}
-
// Change the current product images regarding the combination selected
function refreshProductImages(id_product_attribute) {
id_product_attribute = parseInt(id_product_attribute);
@@ -969,7 +967,6 @@ function colorPickerClick(elt) {
$(elt).parent().parent().parent().children('.color_pick_hidden').val(id_attribute);
}
-
function getProductAttribute() {
// get every attributes values
request = '';
@@ -1167,8 +1164,34 @@ $(document).ready(function() {
}
e.preventDefault();
});
+
+ if (typeof google === 'object') {
+ initMap();
+ }
});
+function initMap() {
+ const map = new google.maps.Map($('#room_type_map_tab .map-wrap').get(0), {
+ zoom: 10,
+ streetViewControl: false,
+ });
+
+ const hotelLatLng = {
+ lat: Number(hotel_loc.latitude),
+ lng: Number(hotel_loc.longitude),
+ };
+
+ map.setCenter(hotelLatLng);
+
+ const marker = new google.maps.Marker({
+ position: hotelLatLng,
+ map: map,
+ });
+
+ const uiContent = $('#room-info-map-ui-content .hotel-info-wrap').get(0);
+ map.controls[google.maps.ControlPosition.LEFT_TOP].push(uiContent);
+}
+
var BookingForm = {
currentRequest: null,
init: function() {
diff --git a/themes/hotel-reservation-theme/product.tpl b/themes/hotel-reservation-theme/product.tpl
index a69536178..69ec555e6 100644
--- a/themes/hotel-reservation-theme/product.tpl
+++ b/themes/hotel-reservation-theme/product.tpl
@@ -182,7 +182,10 @@
@@ -303,6 +306,28 @@
{l s='Non Refundable'}
{/if}
+ {if $display_google_maps && ($hotel_latitude|floatval != 0 && $hotel_longitude|floatval != 0)}
+
+
+
+
+ {if isset($hotel_image_link) && $hotel_image_link}
+
+

+
+ {/if}
+
+
{$hotel_name|escape:'html':'UTF-8'}
+
{$hotel_address1|escape:'html':'UTF-8'}
+
{l s='Contact:'} {$hotel_phone|escape:'html':'UTF-8'}
+
+ {l s='View on Map'}
+
+
+
+
+
+ {/if}
{if isset($HOOK_PRODUCT_TAB_CONTENT) && $HOOK_PRODUCT_TAB_CONTENT}{$HOOK_PRODUCT_TAB_CONTENT}{/if}