-
- {if (!$allow_oosp && $product->quantity <= 0) || !$product->available_for_order || (isset($restricted_country_mode) && $restricted_country_mode) || $PS_CATALOG_MODE}
+ {if $is_out_of_stock}
+
+ {l s='Product is out of stock!'}
+
+ {else if $max_qty_reached}
+
+ {l s='Max. quantity reached for cart!'}
+
{else}
{block name='booking_form_book_now_button'}
diff --git a/themes/hotel-reservation-theme/js/contact-form.js b/themes/hotel-reservation-theme/js/contact-form.js
index 4f8f51dc2..9b16260d5 100644
--- a/themes/hotel-reservation-theme/js/contact-form.js
+++ b/themes/hotel-reservation-theme/js/contact-form.js
@@ -48,15 +48,6 @@ $(document).ready(function() {
});
showProductSelect($('select[name=id_order]').attr('value'));
-
- //By Webkul JS for Map locations of the hotels on google Map
- if (typeof hotelLocationArray != 'undefined'
- && $('#map').length
- && typeof google == 'object'
- && typeof google.maps == 'object'
- ) {
- initMap();
- }
});
function showProductSelect(id_order) {
@@ -75,7 +66,7 @@ function initMap() {
hotelLocationArray = JSON.parse(hotelLocationArray);
// Display a map on the page
- map = new google.maps.Map(document.getElementById("map"));
+ map = new google.maps.Map(document.getElementById("map"), {mapId: PS_MAP_ID});
google.maps.event.trigger(map, 'resize');
map.setTilt(45);
@@ -88,14 +79,17 @@ function initMap() {
$.each(hotelLocationArray, function(i, location) {
var position = new google.maps.LatLng(location.latitude, location.longitude);
bounds.extend(position);
- marker = new google.maps.Marker({
- position: position,
- map: map,
- title: location.hotel_name,
- animation: google.maps.Animation.DROP,
- icon: PS_STORES_ICON
- });
+ let icon = document.createElement('img');
+ icon.src = PS_STORES_ICON;
+ icon.style.width = '24px';
+ icon.style.height = '24px';
+ marker = new google.maps.marker.AdvancedMarkerElement({
+ map: map,
+ position: position,
+ title: location.hotel_name,
+ content: icon,
+ });
// Allow each marker to have an info window
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
diff --git a/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js b/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js
index 47836bee8..e3e4ac26f 100644
--- a/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js
+++ b/themes/hotel-reservation-theme/js/modules/blockcart/ajax-cart.js
@@ -432,6 +432,10 @@ var ajaxCart = {
resetRoomtypeServices();
+ if (parseInt($('#product_page_booking_product').val()) == 0) {
+ $('#service_product_qty').val(1);
+ }
+
BookingForm.refresh(true);
}
@@ -874,7 +878,7 @@ var ajaxCart = {
content += '
';
if ((parseInt(product.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE
|| parseInt(product.selling_preference_type) == SELLING_PREFERENCE_HOTEL_STANDALONE_AND_WITH_ROOM_TYPE)
- && (typeof(hotel_wise_data) != 'undefined' && hotel_wise_data.length)
+ && (typeof(hotel_wise_data) != 'undefined' && typeof(hotel_wise_data.hotel_name) != 'undefined')
) {
content += '
' + hotel_wise_data.hotel_name + '
';
}
diff --git a/themes/hotel-reservation-theme/js/order-detail.js b/themes/hotel-reservation-theme/js/order-detail.js
index b60101ccf..800440304 100644
--- a/themes/hotel-reservation-theme/js/order-detail.js
+++ b/themes/hotel-reservation-theme/js/order-detail.js
@@ -144,24 +144,36 @@ function initMap() {
center: hotelLocation,
disableDefaultUI: true,
fullscreenControl: true,
+ mapId: PS_MAP_ID
});
- const marker = new google.maps.Marker({
+ let icon = document.createElement('img');
+ icon.src = PS_STORES_ICON;
+ icon.style.width = '24px';
+ icon.style.height = '24px';
+
+ const marker = new google.maps.marker.AdvancedMarkerElement({
position: hotelLocation,
map: map,
- title: $(this).attr('title'),
- icon: PS_STORES_ICON
+ title: location.hotel_name,
+ content: icon,
});
+ marker.query = location.query || null;
+ marker.latitude = hotelLocation.lat;
+ marker.longitude = hotelLocation.lng;
+
marker.addListener('click', function() {
let query = '';
- if ($(this).attr('query') != '') {
- query = $(this).attr('query');
- } else {
- query = $(this).attr('latitude') + ',' + $(this).attr('longitude');
+ if (this.query) {
+ query = this.query;
+ } else if (this.latitude && this.longitude) {
+ query = `${this.latitude},${this.longitude}`;
}
- window.open('https://www.google.com/maps/search/?api=1&query='+encodeURIComponent(query), '_blank');
+ if (query) {
+ window.open(`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(query)}`, '_blank');
+ }
});
});
}
@@ -376,14 +388,5 @@ $(document).ready(function () {
});
initPriceTooltip();
-
- if (typeof google === 'object'
- && typeof google.maps === 'object'
- && typeof initiateMap !== 'undefined'
- && initiateMap === 1
- ) {
- initMap();
- }
-
initRefundDeniedTooltip();
});
diff --git a/themes/hotel-reservation-theme/js/our-properties.js b/themes/hotel-reservation-theme/js/our-properties.js
index ba9408875..81a0d0be9 100644
--- a/themes/hotel-reservation-theme/js/our-properties.js
+++ b/themes/hotel-reservation-theme/js/our-properties.js
@@ -21,15 +21,6 @@
*/
$(document).ready(function() {
- //By Webkul JS for Map locations of the hotels on google Map
- if (typeof hotelLocationArray != 'undefined'
- && $('#map').length
- && typeof google == 'object'
- && typeof google.maps == 'object'
- ) {
- initMap();
- }
-
$(document).on('click', 'ul.pagination li a', function(e){
e.preventDefault();
$('#pagination').val($(this).data('pagination'));
@@ -43,7 +34,7 @@ function initMap() {
hotelLocationArray = JSON.parse(hotelLocationArray);
// Display a map on the page
- map = new google.maps.Map(document.getElementById("map"));
+ map = new google.maps.Map(document.getElementById("map"), {mapId: PS_MAP_ID});
google.maps.event.trigger(map, 'resize');
map.setTilt(45);
@@ -56,12 +47,16 @@ function initMap() {
$.each(hotelLocationArray, function(i, location) {
var position = new google.maps.LatLng(location.latitude, location.longitude);
bounds.extend(position);
- marker = new google.maps.Marker({
- position: position,
+ let icon = document.createElement('img');
+ icon.src = PS_STORES_ICON;
+ icon.style.width = '24px';
+ icon.style.height = '24px';
+
+ marker = new google.maps.marker.AdvancedMarkerElement({
map: map,
+ position: position,
title: location.hotel_name,
- animation: google.maps.Animation.DROP,
- icon: PS_STORES_ICON
+ content: icon,
});
// Allow each marker to have an info window
diff --git a/themes/hotel-reservation-theme/js/product.js b/themes/hotel-reservation-theme/js/product.js
index 22e483de5..b0771177c 100644
--- a/themes/hotel-reservation-theme/js/product.js
+++ b/themes/hotel-reservation-theme/js/product.js
@@ -1089,15 +1089,6 @@ $(document).ready(function() {
}
e.preventDefault();
});
-
- if (typeof hotel_location == 'object'
- && $('#room_type_map_tab .map-wrap').length
- && typeof google == 'object'
- && typeof google.maps == 'object'
- ) {
- initMap();
- }
-
// normal product
$(document).on('click', '.add_roomtype_product', function(e){
e.preventDefault();
@@ -1206,13 +1197,29 @@ $(document).ready(function() {
e.preventDefault();
qtyfield = $(this).closest('.qty_container').find('input.service_product_qty');
var newQuantity = parseInt(qtyfield.val()) + 1;
- if (qtyfield.data('max_quantity') && qtyfield.data('max_quantity') < newQuantity) {
- // if max quantity is reached
- newQuantity = qtyfield.data('max_quantity');
-
- showErrorMessage(max_service_product_qty_txt+' '+qtyfield.data('max_quantity'));
+ let hasStockError = false;
+ if (parseInt($('#product_page_booking_product').val()) == 0) {
+ let stockQty = parseInt($(this).closest('.qty_container').find('.stock_qty').data('stock_quantity'));
+ let allow_oosp = parseInt($(this).closest('.qty_container').find('.stock_qty').data('allow_oosp'));
+ if (!allow_oosp && (stockQty < newQuantity)) {
+ showErrorMessage(out_of_stock_text);
+ newQuantity = stockQty;
+ hasStockError = true;
+ }
+ }
+ if (!hasStockError) {
+ if (qtyfield.data('max_quantity') && qtyfield.data('max_quantity') < newQuantity) {
+ // if max quantity is reached
+ newQuantity = qtyfield.data('max_quantity');
+ let cartQty = parseInt(qtyfield.data('cart_quantity'));
+ if (isNaN(cartQty)) {
+ cartQty = 0;
+ }
+
+ showErrorMessage(max_service_product_qty_txt+' '+ (parseInt(qtyfield.data('max_quantity')) + cartQty));
+ }
+ $(this).closest('.qty_container').find('.qty_count span').text(newQuantity);
}
- $(this).closest('.qty_container').find('.qty_count span').text(newQuantity);
qtyfield.val(newQuantity);
clearTimeout(timer);
timer = setTimeout(function() {
@@ -1306,6 +1313,7 @@ function initMap() {
const map = new google.maps.Map($('#room_type_map_tab .map-wrap').get(0), {
zoom: 10,
streetViewControl: false,
+ mapId: PS_MAP_ID
});
const hotelLatLng = {
@@ -1314,11 +1322,14 @@ function initMap() {
};
map.setCenter(hotelLatLng);
-
- const marker = new google.maps.Marker({
+ let icon = document.createElement('img');
+ icon.src = PS_STORES_ICON;
+ icon.style.width = '24px';
+ icon.style.height = '24px';
+ let marker = new google.maps.marker.AdvancedMarkerElement({
position: hotelLatLng,
map: map,
- icon: PS_STORES_ICON
+ content: icon,
});
const uiContent = $('#room-info-map-ui-content .hotel-info-wrap').get(0);
diff --git a/themes/hotel-reservation-theme/product.tpl b/themes/hotel-reservation-theme/product.tpl
index 351edf8f8..9492fbc86 100644
--- a/themes/hotel-reservation-theme/product.tpl
+++ b/themes/hotel-reservation-theme/product.tpl
@@ -877,6 +877,7 @@
{addJsDefL name=service_removed_txt}{l s='Service removed' js=1}{/addJsDefL}
{addJsDefL name=service_updated_txt}{l s='Service updated' js=1}{/addJsDefL}
{addJsDefL name=max_service_product_qty_txt}{l s='Maximum allowed quantity in the cart is' js=1}{/addJsDefL}
+ {addJsDefL name=out_of_stock_text}{l s='Requested quantitity is out of stock' js=1}{/addJsDefL}
{/strip}
{/block}
{/if}