[12/11/2025] Après CapBretagne, correction du problème de conflit Google Maps entre ColissimoPickupPoint et MondialRelay
This commit is contained in:
@@ -4,13 +4,13 @@
|
|||||||
<td colspan="3">
|
<td colspan="3">
|
||||||
<div id="point-colissimo-pickup-point">
|
<div id="point-colissimo-pickup-point">
|
||||||
<div id="google-map-colissimo-pickup-point">
|
<div id="google-map-colissimo-pickup-point">
|
||||||
{* Point relais *}
|
{* Point relais *}
|
||||||
{* Check if Colissimo webservice is up *}
|
{* Check if Colissimo webservice is up *}
|
||||||
{assign var="isColissimoPickupPointUp" value=0}
|
{assign var="isColissimoPickupPointUp" value=0}
|
||||||
{colissimoPickupPointDeliveryPrice country=$country}<h1>{$isValidMode}</h1>
|
{colissimoPickupPointDeliveryPrice country=$country}<h1>{$isValidMode}</h1>
|
||||||
{if $isValidMode !== false}
|
{if $isValidMode !== false}
|
||||||
{loop name="is.colissimo.pickup.point.up" type="colissimo.pickup.point.around"}{/loop}
|
{loop name="is.colissimo.pickup.point.up" type="colissimo.pickup.point.around"}{/loop}
|
||||||
{ifloop rel="is.colissimo.pickup.point.up"}
|
{ifloop rel="is.colissimo.pickup.point.up"}
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<strong>{intl l="Near you" d='colissimopickuppoint.fo.default'}</strong> / {$deliveryPrice} {currency attr="symbol"}
|
<strong>{intl l="Near you" d='colissimopickuppoint.fo.default'}</strong> / {$deliveryPrice} {currency attr="symbol"}
|
||||||
@@ -40,9 +40,9 @@
|
|||||||
function updatemap_colissimo_pickup_point(adr_geoloc, locations) {
|
function updatemap_colissimo_pickup_point(adr_geoloc, locations) {
|
||||||
|
|
||||||
var buf = "",
|
var buf = "",
|
||||||
marker,
|
marker,
|
||||||
loc,
|
loc,
|
||||||
i;
|
i;
|
||||||
|
|
||||||
// save current search
|
// save current search
|
||||||
if (adr_geoloc !== undefined && locations !== undefined) {
|
if (adr_geoloc !== undefined && locations !== undefined) {
|
||||||
@@ -54,7 +54,8 @@
|
|||||||
// Define MAP
|
// Define MAP
|
||||||
var mapOptions = {
|
var mapOptions = {
|
||||||
zoom: 13,
|
zoom: 13,
|
||||||
mapTypeId: google.maps.MapTypeId.ROADMAP
|
mapTypeId: google.maps.MapTypeId.ROADMAP,
|
||||||
|
mapId: "COLISSIMO_MAP_ID"
|
||||||
}
|
}
|
||||||
// On va créer la map dans la div qui a l'id relaymap
|
// On va créer la map dans la div qui a l'id relaymap
|
||||||
mapSOC.map = new google.maps.Map(document.getElementById('colissimopickuppointmap'), mapOptions);
|
mapSOC.map = new google.maps.Map(document.getElementById('colissimopickuppointmap'), mapOptions);
|
||||||
@@ -71,11 +72,12 @@
|
|||||||
if (status == google.maps.GeocoderStatus.OK) {
|
if (status == google.maps.GeocoderStatus.OK) {
|
||||||
// Et on centre la map sur cette position
|
// Et on centre la map sur cette position
|
||||||
mapSOC.map.setCenter(results[0].geometry.location);
|
mapSOC.map.setCenter(results[0].geometry.location);
|
||||||
marker = new google.maps.Marker({
|
marker = new google.maps.marker.AdvancedMarkerElement({
|
||||||
position: new google.maps.LatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng()),
|
position: new google.maps.LatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng()),
|
||||||
map: mapSOC.map,
|
map: mapSOC.map/*,
|
||||||
icon: "{image file='assets/img/maison.png' source='ColissimoPickupPoint'}"
|
icon: "{image file='assets/img/maison.png' source='ColissimoPickupPoint'}"*/
|
||||||
});
|
});
|
||||||
|
|
||||||
if (mapSOC.position != null){
|
if (mapSOC.position != null){
|
||||||
mapSOC.position.setMap(null);
|
mapSOC.position.setMap(null);
|
||||||
}
|
}
|
||||||
@@ -124,31 +126,32 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
buf += '<tr>' +
|
buf += '<tr>' +
|
||||||
'<td>' +
|
'<td>' +
|
||||||
'<img src="' + mapSOC.images[loc.type] + '">' +
|
'<img src="' + mapSOC.images[loc.type] + '">' +
|
||||||
'<strong>' + loc.name + '</strong> ' +
|
'<strong>' + loc.name + '</strong> ' +
|
||||||
'<br>' +
|
'<br>' +
|
||||||
loc.address +
|
loc.address +
|
||||||
'<br>' +
|
'<br>' +
|
||||||
loc.zipcode + ' ' + loc.city +
|
loc.zipcode + ' ' + loc.city +
|
||||||
' - ' + loc.distance;
|
' - ' + loc.distance;
|
||||||
|
|
||||||
if (loc.disabledPerson == "1"){
|
if (loc.disabledPerson == "1"){
|
||||||
buf += ' <img src="' + mapSOC.images["HANDICAPE"] + '">';
|
buf += ' <img src="' + mapSOC.images["HANDICAPE"] + '">';
|
||||||
}
|
}
|
||||||
|
|
||||||
buf += '</td>' +
|
buf += '</td>' +
|
||||||
'<td>' +
|
'<td>' +
|
||||||
'<div class="radio">' +
|
'<div class="radio">' +
|
||||||
'<input type="radio" name="colissimo_pickup_point_code" data-marker=' + i + ' class="colissimo_pickup_point" id="colissimo_pickup_point' + loc.id + '" value="' + loc.id + ':'+ loc.type + ':'+ loc.countrycode + '">' +
|
'<input type="radio" name="colissimo_pickup_point_code" data-marker=' + i + ' class="colissimo_pickup_point" id="colissimo_pickup_point' + loc.id + '" value="' + loc.id + ':'+ loc.type + ':'+ loc.countrycode + '">' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'</td>' +
|
'</td>' +
|
||||||
'</tr>';
|
'</tr>';
|
||||||
|
|
||||||
marker = new google.maps.Marker({
|
marker = new google.maps.marker.AdvancedMarkerElement({
|
||||||
position: new google.maps.LatLng(loc.lat, loc.lng),
|
position: new google.maps.LatLng(loc.lat, loc.lng),
|
||||||
map: mapSOC.map,
|
map: mapSOC.map/*,
|
||||||
icon: mapSOC.images[loc.type]
|
icon: mapSOC.images[loc.type]
|
||||||
|
*/
|
||||||
});
|
});
|
||||||
|
|
||||||
mapSOC.listMarker.push(marker);
|
mapSOC.listMarker.push(marker);
|
||||||
@@ -162,28 +165,28 @@
|
|||||||
$("#colissimo-pickup-point" + data.id).prop('checked', true);
|
$("#colissimo-pickup-point" + data.id).prop('checked', true);
|
||||||
//verifyRadio();
|
//verifyRadio();
|
||||||
mapSOC.infowindow.setContent(
|
mapSOC.infowindow.setContent(
|
||||||
'<img src="' + mapSOC.images[data.type] + '">' +
|
'<img src="' + mapSOC.images[data.type] + '">' +
|
||||||
'<strong>' + data.name + '</strong>' +
|
'<strong>' + data.name + '</strong>' +
|
||||||
'<address style="margin: 0">' +
|
'<address style="margin: 0">' +
|
||||||
data.address +
|
data.address +
|
||||||
'<br>' +
|
'<br>' +
|
||||||
data.zipcode +
|
data.zipcode +
|
||||||
' ' +
|
' ' +
|
||||||
data.city +
|
data.city +
|
||||||
'</address>' +
|
'</address>' +
|
||||||
'<p>' + data.distance +
|
'<p>' + data.distance +
|
||||||
' ' +
|
' ' +
|
||||||
((data.disabledPerson) ? '<img src="' + mapSOC.images["HANDICAPE"] + '">' : "") +
|
((data.disabledPerson) ? '<img src="' + mapSOC.images["HANDICAPE"] + '">' : "") +
|
||||||
'</p>' +
|
'</p>' +
|
||||||
'<table class="table table-condensed table-striped table-bordered" style="width: 100%;">' +
|
'<table class="table table-condensed table-striped table-bordered" style="width: 100%;">' +
|
||||||
getHoraireRow('{intl l="Monday" d='colissimopickuppoint.fo.default'}', data.monday) +
|
getHoraireRow('{intl l="Monday" d='colissimopickuppoint.fo.default'}', data.monday) +
|
||||||
getHoraireRow('{intl l="Tuesday" d='colissimopickuppoint.fo.default'}', data.tuesday) +
|
getHoraireRow('{intl l="Tuesday" d='colissimopickuppoint.fo.default'}', data.tuesday) +
|
||||||
getHoraireRow('{intl l="Wednesday" d='colissimopickuppoint.fo.default'}', data.wednesday) +
|
getHoraireRow('{intl l="Wednesday" d='colissimopickuppoint.fo.default'}', data.wednesday) +
|
||||||
getHoraireRow('{intl l="Friday" d='colissimopickuppoint.fo.default'}', data.friday) +
|
getHoraireRow('{intl l="Friday" d='colissimopickuppoint.fo.default'}', data.friday) +
|
||||||
getHoraireRow('{intl l="Thursday" d='colissimopickuppoint.fo.default'}', data.thursday) +
|
getHoraireRow('{intl l="Thursday" d='colissimopickuppoint.fo.default'}', data.thursday) +
|
||||||
getHoraireRow('{intl l="Saturday" d='colissimopickuppoint.fo.default'}', data.saturday) +
|
getHoraireRow('{intl l="Saturday" d='colissimopickuppoint.fo.default'}', data.saturday) +
|
||||||
getHoraireRow('{intl l="Sunday" d='colissimopickuppoint.fo.default'}', data.sunday) +
|
getHoraireRow('{intl l="Sunday" d='colissimopickuppoint.fo.default'}', data.sunday) +
|
||||||
'</table>');
|
'</table>');
|
||||||
mapSOC.infowindow.open(mapSOC.map, marker);
|
mapSOC.infowindow.open(mapSOC.map, marker);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -200,8 +203,8 @@
|
|||||||
function initialize_so() {
|
function initialize_so() {
|
||||||
// Get the selected customer address
|
// Get the selected customer address
|
||||||
var $selectedAddressInput = $('#form-cart-delivery')
|
var $selectedAddressInput = $('#form-cart-delivery')
|
||||||
.find('[name="thelia_order_delivery[delivery-address]"]')
|
.find('[name="thelia_order_delivery[delivery-address]"]')
|
||||||
.filter(':checked');
|
.filter(':checked');
|
||||||
|
|
||||||
var selectedAddressId = $selectedAddressInput.val();
|
var selectedAddressId = $selectedAddressInput.val();
|
||||||
|
|
||||||
@@ -209,53 +212,53 @@
|
|||||||
|
|
||||||
var addresses_geoloc = [];
|
var addresses_geoloc = [];
|
||||||
{loop type="address" name="delivery-selection-colissimo-pickup-point" customer="current"}
|
{loop type="address" name="delivery-selection-colissimo-pickup-point" customer="current"}
|
||||||
addresses_geoloc[{$ID}] = "{$ADDRESS1}, {$ZIPCODE} {$CITY}";
|
addresses_geoloc[{$ID}] = "{$ADDRESS1}, {$ZIPCODE} {$CITY}";
|
||||||
{/loop}
|
{/loop}
|
||||||
|
|
||||||
var adr_geoloc = addresses_geoloc[selectedAddressId];
|
var adr_geoloc = addresses_geoloc[selectedAddressId];
|
||||||
|
|
||||||
// Get every relay around customer's address
|
// Get every relay around customer's address
|
||||||
var locations = [];
|
var locations = [];
|
||||||
$.get(
|
$.get(
|
||||||
locationsSearchUrl + "?address=" + selectedAddressId,
|
locationsSearchUrl + "?address=" + selectedAddressId,
|
||||||
function(data) {
|
function(data) {
|
||||||
locations = data.locations;
|
locations = data.locations;
|
||||||
updatemap_colissimo_pickup_point(adr_geoloc, locations);
|
updatemap_colissimo_pickup_point(adr_geoloc, locations);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
var normalize = (function () {
|
var normalize = (function () {
|
||||||
var a = ['À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ď', 'ď', 'Đ', 'đ', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ĩ', 'ĩ', 'Ī', 'ī', 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'IJ', 'ij', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'Ĺ', 'ĺ', 'Ļ', 'ļ', 'Ľ', 'ľ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'Ń', 'ń', 'Ņ', 'ņ', 'Ň', 'ň', 'ʼn', 'Ō', 'ō', 'Ŏ', 'ŏ', 'Ő', 'ő', 'Œ', 'œ', 'Ŕ', 'ŕ', 'Ŗ', 'ŗ', 'Ř', 'ř', 'Ś', 'ś', 'Ŝ', 'ŝ', 'Ş', 'ş', 'Š', 'š', 'Ţ', 'ţ', 'Ť', 'ť', 'Ŧ', 'ŧ', 'Ũ', 'ũ', 'Ū', 'ū', 'Ŭ', 'ŭ', 'Ů', 'ů', 'Ű', 'ű', 'Ų', 'ų', 'Ŵ', 'ŵ', 'Ŷ', 'ŷ', 'Ÿ', 'Ź', 'ź', 'Ż', 'ż', 'Ž', 'ž', 'ſ', 'ƒ', 'Ơ', 'ơ', 'Ư', 'ư', 'Ǎ', 'ǎ', 'Ǐ', 'ǐ', 'Ǒ', 'ǒ', 'Ǔ', 'ǔ', 'Ǖ', 'ǖ', 'Ǘ', 'ǘ', 'Ǚ', 'ǚ', 'Ǜ', 'ǜ', 'Ǻ', 'ǻ', 'Ǽ', 'ǽ', 'Ǿ', 'ǿ'];
|
var a = ['À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ď', 'ď', 'Đ', 'đ', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ĩ', 'ĩ', 'Ī', 'ī', 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'IJ', 'ij', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'Ĺ', 'ĺ', 'Ļ', 'ļ', 'Ľ', 'ľ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'Ń', 'ń', 'Ņ', 'ņ', 'Ň', 'ň', 'ʼn', 'Ō', 'ō', 'Ŏ', 'ŏ', 'Ő', 'ő', 'Œ', 'œ', 'Ŕ', 'ŕ', 'Ŗ', 'ŗ', 'Ř', 'ř', 'Ś', 'ś', 'Ŝ', 'ŝ', 'Ş', 'ş', 'Š', 'š', 'Ţ', 'ţ', 'Ť', 'ť', 'Ŧ', 'ŧ', 'Ũ', 'ũ', 'Ū', 'ū', 'Ŭ', 'ŭ', 'Ů', 'ů', 'Ű', 'ű', 'Ų', 'ų', 'Ŵ', 'ŵ', 'Ŷ', 'ŷ', 'Ÿ', 'Ź', 'ź', 'Ż', 'ż', 'Ž', 'ž', 'ſ', 'ƒ', 'Ơ', 'ơ', 'Ư', 'ư', 'Ǎ', 'ǎ', 'Ǐ', 'ǐ', 'Ǒ', 'ǒ', 'Ǔ', 'ǔ', 'Ǖ', 'ǖ', 'Ǘ', 'ǘ', 'Ǚ', 'ǚ', 'Ǜ', 'ǜ', 'Ǻ', 'ǻ', 'Ǽ', 'ǽ', 'Ǿ', 'ǿ'];
|
||||||
var b = ['A', 'A', 'A', 'A', 'A', 'A', 'AE', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'D', 'N', 'O', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', 's', 'a', 'a', 'a', 'a', 'a', 'a', 'ae', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y', 'A', 'a', 'A', 'a', 'A', 'a', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'D', 'd', 'D', 'd', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'G', 'g', 'G', 'g', 'G', 'g', 'G', 'g', 'H', 'h', 'H', 'h', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'IJ', 'ij', 'J', 'j', 'K', 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'l', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'O', 'o', 'O', 'o', 'O', 'o', 'OE', 'oe', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', 'Y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 's', 'f', 'O', 'o', 'U', 'u', 'A', 'a', 'I', 'i', 'O', 'o', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'A', 'a', 'AE', 'ae', 'O', 'o'];
|
var b = ['A', 'A', 'A', 'A', 'A', 'A', 'AE', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'D', 'N', 'O', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', 's', 'a', 'a', 'a', 'a', 'a', 'a', 'ae', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y', 'A', 'a', 'A', 'a', 'A', 'a', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'D', 'd', 'D', 'd', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'G', 'g', 'G', 'g', 'G', 'g', 'G', 'g', 'H', 'h', 'H', 'h', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'IJ', 'ij', 'J', 'j', 'K', 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'l', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'O', 'o', 'O', 'o', 'O', 'o', 'OE', 'oe', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', 'Y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 's', 'f', 'O', 'o', 'U', 'u', 'A', 'a', 'I', 'i', 'O', 'o', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'A', 'a', 'AE', 'ae', 'O', 'o'];
|
||||||
|
|
||||||
return function (str) {
|
return function (str) {
|
||||||
var i = a.length;
|
var i = a.length;
|
||||||
while (i--) str = str.replace(a[i], b[i]);
|
while (i--) str = str.replace(a[i], b[i]);
|
||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
}());
|
}());
|
||||||
|
|
||||||
function search_city_colissimo_pickup_point() {
|
function search_city_colissimo_pickup_point() {
|
||||||
var address = document.getElementById("search-address-colissimo-pickup-point").value;
|
var address = document.getElementById("search-address-colissimo-pickup-point").value;
|
||||||
var zipcode = document.getElementById("search-zipcode-colissimo-pickup-point").value;
|
var zipcode = document.getElementById("search-zipcode-colissimo-pickup-point").value;
|
||||||
var city = document.getElementById("search-city-colissimo-pickup-point").value;
|
var city = document.getElementById("search-city-colissimo-pickup-point").value;
|
||||||
var countryid = $("#search-countryid-colissimo-pickup-point").val();
|
var countryid = $("#search-countryid-colissimo-pickup-point").val();
|
||||||
if (zipcode == "" || city == "") {
|
if (zipcode == "" || city == "") {
|
||||||
alert("{intl l="Please enter a city and a zipcode" d='colissimopickuppoint.fo.default'}");
|
alert("{intl l="Please enter a city and a zipcode" d='colissimopickuppoint.fo.default'}");
|
||||||
} else {
|
} else {
|
||||||
// Get site base url
|
// Get site base url
|
||||||
var url_site = '{url path="/"}module/ColissimoPickupPoint/'
|
var url_site = '{url path="/"}module/ColissimoPickupPoint/'
|
||||||
+ encodeURIComponent(countryid) + '/'
|
+ encodeURIComponent(countryid) + '/'
|
||||||
+ encodeURIComponent(zipcode) + '/'
|
+ encodeURIComponent(zipcode) + '/'
|
||||||
+ encodeURIComponent(normalize(city));
|
+ encodeURIComponent(normalize(city));
|
||||||
if (address != ""){
|
if (address != ""){
|
||||||
url_site += '/' + encodeURIComponent(normalize(address));
|
url_site += '/' + encodeURIComponent(normalize(address));
|
||||||
}
|
}
|
||||||
// Get search address
|
// Get search address
|
||||||
var adr_geoloc = address + " " + zipcode + " " + city;
|
var adr_geoloc = address + " " + zipcode + " " + city;
|
||||||
// Get every relay around customer's address
|
// Get every relay around customer's address
|
||||||
var locations = [];
|
var locations = [];
|
||||||
$.getJSON(url_site)
|
$.getJSON(url_site)
|
||||||
.done(function(data) {
|
.done(function(data) {
|
||||||
if (!$.isEmptyObject(data)) {
|
if (!$.isEmptyObject(data)) {
|
||||||
locations = data.locations;
|
locations = data.locations;
|
||||||
@@ -267,8 +270,8 @@
|
|||||||
.fail(function( jqxhr, textStatus, error ) {
|
.fail(function( jqxhr, textStatus, error ) {
|
||||||
var err = textStatus + ", " + error;
|
var err = textStatus + ", " + error;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -315,7 +318,7 @@
|
|||||||
<div class="col-md-4 col-sm-4">
|
<div class="col-md-4 col-sm-4">
|
||||||
<div style="padding-top: 5px; padding-bottom: 5px;">
|
<div style="padding-top: 5px; padding-bottom: 5px;">
|
||||||
{images file="assets/img/CIT.png" source="ColissimoPickupPoint"}
|
{images file="assets/img/CIT.png" source="ColissimoPickupPoint"}
|
||||||
<img src="{$asset_url}" class="pull-left">
|
<img src="{$asset_url}" class="pull-left">
|
||||||
{/images}
|
{/images}
|
||||||
<h5 class="title-colissimo-pickup-point-pickup-type">{intl l="Automatic pickup point" d='colissimopickuppoint.fo.default'}</h5>
|
<h5 class="title-colissimo-pickup-point-pickup-type">{intl l="Automatic pickup point" d='colissimopickuppoint.fo.default'}</h5>
|
||||||
<p>{intl l="Delivery in France in one of the 500 automatic instructions 7/7 and 24h/24." d='colissimopickuppoint.fo.default'}</p>
|
<p>{intl l="Delivery in France in one of the 500 automatic instructions 7/7 and 24h/24." d='colissimopickuppoint.fo.default'}</p>
|
||||||
@@ -374,15 +377,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<select id="search-countryid-colissimo-pickup-point" class="form-control">
|
<select id="search-countryid-colissimo-pickup-point" class="form-control">
|
||||||
{loop type="country" name="country.list"}
|
{loop type="country" name="country.list"}
|
||||||
<option value="{$ID}"
|
<option value="{$ID}"
|
||||||
{if $value != ""}
|
{if $value != ""}
|
||||||
{if $value == $ID}selected{/if}
|
{if $value == $ID}selected{/if}
|
||||||
{else}
|
{else}
|
||||||
{if $IS_DEFAULT}selected{/if}
|
{if $IS_DEFAULT}selected{/if}
|
||||||
{/if}
|
{/if}
|
||||||
>{$TITLE}</option>
|
>{$TITLE}</option>
|
||||||
{/loop}
|
{/loop}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
@@ -397,35 +400,64 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- // Search city -->
|
<!-- // Search city -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/ifloop}
|
{/ifloop}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function loadScript() {
|
|
||||||
|
|
||||||
console.log("loadScript");
|
function loadScript() {
|
||||||
|
console.log("loadScript ColissimoPickupPoint");
|
||||||
|
|
||||||
|
if (window.ModulesGoogleMaps.loading) {
|
||||||
|
// Si déjà en cours de chargement, ajouter le callback
|
||||||
|
window.ModulesGoogleMaps.callbacks.push(ColissimoPickupPointInitialize);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.ModulesGoogleMaps.loading = true;
|
||||||
|
|
||||||
|
// Callback global qui sera appelé par Google Maps
|
||||||
|
window.ModulesGoogleMapsCallback = function() {
|
||||||
|
window.ModulesGoogleMaps.loaded = true;
|
||||||
|
window.ModulesGoogleMaps.loading = false;
|
||||||
|
|
||||||
|
// Exécuter tous les callbacks en attente
|
||||||
|
window.ModulesGoogleMaps.callbacks.forEach(function(callback) {
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
window.ModulesGoogleMaps.callbacks = [];
|
||||||
|
};
|
||||||
|
|
||||||
var script = document.createElement('script');
|
var script = document.createElement('script');
|
||||||
script.type = 'text/javascript';
|
script.type = 'text/javascript';
|
||||||
|
script.defer = true;
|
||||||
script.src = 'https://maps.googleapis.com/maps/api/js'
|
script.src = 'https://maps.googleapis.com/maps/api/js'
|
||||||
+ '?callback=ColissimoPickupPointInitialize'
|
+ '?callback=ModulesGoogleMapsCallback'
|
||||||
+ '&key={colissimoPickupPointGoogleApiKey}';
|
+ '&libraries=marker'
|
||||||
|
+ '&key={colissimoPickupPointGoogleApiKey}';
|
||||||
document.body.appendChild(script);
|
document.body.appendChild(script);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof(google) == 'undefined') {
|
if (typeof(google) == 'undefined' || typeof(google.maps) == 'undefined') {
|
||||||
loadScript();
|
if (!window.ModulesGoogleMaps.loaded && !window.ModulesGoogleMaps.loading) {
|
||||||
|
// Ajouter le callback et charger le script
|
||||||
|
window.ModulesGoogleMaps.callbacks.push(ColissimoPickupPointInitialize);
|
||||||
|
loadScript();
|
||||||
|
console.log('Colissimo : Maps pas encore déclarée');
|
||||||
|
|
||||||
|
} else if (window.ModulesGoogleMaps.loading) {
|
||||||
|
// Script en cours de chargement, ajouter juste le callback
|
||||||
|
window.ModulesGoogleMaps.callbacks.push(ColissimoPickupPointInitialize);
|
||||||
|
console.log('Colissimo : Maps déjà déclaré');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ColissimoPickupPointInitialize();
|
ColissimoPickupPointInitialize();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,135 +1,136 @@
|
|||||||
<script type="text/html" id="mondialrelay_ui">
|
<script type="text/html" id="mondialrelay_ui">
|
||||||
<td colspan="3">
|
<td colspan="3">
|
||||||
<input type="hidden" name="mondial-relay-selected-delivery-mode" value="none">
|
<input type="hidden" name="mondial-relay-selected-delivery-mode" value="none">
|
||||||
|
|
||||||
{$withHome = false}
|
{$withHome = false}
|
||||||
{loop type="mondialrelay.delivery-price" name="home-prices" mode="home" country_id=$country state_id=$state}
|
{loop type="mondialrelay.delivery-price" name="home-prices" mode="home" country_id=$country state_id=$state}
|
||||||
{$withHome = true}
|
{$withHome = true}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-6">
|
||||||
<label for="mondialrelay_home">
|
<label for="mondialrelay_home">
|
||||||
{form name="thelia.order.delivery"}
|
{form name="thelia.order.delivery"}
|
||||||
{form_field field='delivery-module'}
|
{form_field field='delivery-module'}
|
||||||
<label for="delivery-method_{$module_id}_home">
|
<label for="delivery-method_{$module_id}_home">
|
||||||
<input type="radio" data-mondial-relay-delivery-mode="home" name="{$name}" id="delivery-method_{$module_id}_home" value="{$module_id}">
|
<input type="radio" data-mondial-relay-delivery-mode="home" name="{$name}" id="delivery-method_{$module_id}_home" value="{$module_id}">
|
||||||
<strong>{intl d="mondialrelay.fo.default" l="Mondial Relay home delivery"}</strong>
|
<strong>{intl d="mondialrelay.fo.default" l="Mondial Relay home delivery"}</strong>
|
||||||
<br>
|
<br>
|
||||||
<span class="help-block">
|
<span class="help-block">
|
||||||
{intl l="Expected delivery date: %delivery_date" delivery_date={format_date date=$DELIVERY_DATE output="date"} d="mondialrelay.fo.default" }
|
{intl l="Expected delivery date: %delivery_date" delivery_date={format_date date=$DELIVERY_DATE output="date"} d="mondialrelay.fo.default" }
|
||||||
</span>
|
</span>
|
||||||
</label>
|
|
||||||
{/form_field}
|
|
||||||
{/form}
|
|
||||||
</label>
|
</label>
|
||||||
</div>
|
{/form_field}
|
||||||
|
{/form}
|
||||||
<div class="col-sm-4 hidden-xs text-center">
|
</label>
|
||||||
{loop type="image" name="deliveryspicture" source="module" source_id=$module_id force_return="true" width="100" height="72"}
|
|
||||||
<img src="{$IMAGE_URL nofilter}" alt="{$TITLE}">
|
|
||||||
{/loop}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-4">
|
|
||||||
<div class="price text-right">
|
|
||||||
{format_money number=$PRICE symbol={currency attr='symbol'}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{/loop}
|
|
||||||
|
|
||||||
{$withRelay = false}
|
|
||||||
|
|
||||||
{loop type="mondialrelay.delivery-price" name="relay-prices" mode="relay" country_id=$country state_id=$state}
|
|
||||||
<div {if $withHome}class="pickup-home-separator"{/if}></div>
|
|
||||||
|
|
||||||
{$withRelay = true}
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-4">
|
|
||||||
<label for="mondialrelay_pickup">
|
|
||||||
{form name="thelia.order.delivery"}
|
|
||||||
{form_field field='delivery-module'}
|
|
||||||
<label for="delivery-method_{$module_id}_pickup">
|
|
||||||
<input type="radio" data-mondial-relay-delivery-mode="pickup" name="{$name}" id="delivery-method_{$module_id}_pickup" value="{$module_id}">
|
|
||||||
<strong>{intl d="mondialrelay.fo.default" l="Mondial Relay pickup location"}</strong>
|
|
||||||
<br>
|
|
||||||
<span class="help-block">
|
|
||||||
{intl l="Expected delivery date: %delivery_date" delivery_date={format_date date=$DELIVERY_DATE output="date"} d="mondialrelay.fo.default" }
|
|
||||||
</span>
|
|
||||||
</label>
|
|
||||||
{/form_field}
|
|
||||||
{/form}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-4 hidden-xs text-center">
|
|
||||||
{loop type="image" name="deliveryspicture" source="module" source_id=$module_id force_return="true" width="100" height="72"}
|
|
||||||
<img src="{$IMAGE_URL nofilter}" alt="{$TITLE}">
|
|
||||||
{/loop}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-4">
|
|
||||||
<div class="price text-right">
|
|
||||||
{format_money number=$PRICE symbol={currency attr='symbol'}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="mondial-relay-pickup">
|
|
||||||
<div class="row">
|
|
||||||
<div class="location-form clearfix">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<h4>{intl d="mondialrelay.fo.default" l="Find a pickup location around you"}</h4>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{loop type="address" name="adr" id=$address_id}
|
<div class="col-sm-2 hidden-xs text-center">
|
||||||
<div class="col-sm-2">
|
{loop type="image" name="deliveryspicture" source="module" source_id=$module_id force_return="true" width="100" height="72"}
|
||||||
<input type="text" required class="form-control" id="mondial_relay_zipcode" name="mondial_relay_zipcode" placeholder="{intl l="Zip code" d="mondialrelay.fo.default"}" value="{$ZIPCODE}">
|
<img src="{$IMAGE_URL nofilter}" alt="{$TITLE}">
|
||||||
</div>
|
{/loop}
|
||||||
|
</div>
|
||||||
<div class="col-sm-4">
|
|
||||||
<input type="text" class="form-control" id="mondial_relay_city" name="mondial_relay_city" placeholder="{intl l="City" d="mondialrelay.fo.default"}" value="{$CITY}">
|
<div class="col-sm-4">
|
||||||
</div>
|
<div class="price text-right">
|
||||||
|
{format_money number=$PRICE symbol={currency attr='symbol'}}
|
||||||
<div class="col-sm-3">
|
</div>
|
||||||
<select class="form-control" id="mondial_relay_country_id" name="mondial_relay_country_id">
|
</div>
|
||||||
{loop type="country" name="cntry"}
|
</div>
|
||||||
<option value="{$ID}"{if $COUNTRY == $ID} selected{/if}>{$TITLE}</option>
|
{/loop}
|
||||||
{/loop}
|
|
||||||
</select>
|
{$withRelay = false}
|
||||||
</div>
|
|
||||||
|
{loop type="mondialrelay.delivery-price" name="relay-prices" mode="relay" country_id=$country state_id=$state}
|
||||||
<div class="col-sm-2">
|
<div {if $withHome}class="pickup-home-separator"{/if}></div>
|
||||||
<div class="input-group">
|
|
||||||
<input type="text" class="form-control" id="mondial_relay_radius" name="mondial_relay_radius" placeholder="{intl l="Search radius" d="mondialrelay.fo.default"}" value="10">
|
{$withRelay = true}
|
||||||
<span class="input-group-addon">{intl d="mondialrelay.fo.default" l="km"}</span>
|
<div class="row">
|
||||||
</div>
|
<div class="col-sm-6">
|
||||||
</div>
|
<label for="mondialrelay_pickup">
|
||||||
|
{form name="thelia.order.delivery"}
|
||||||
<div class="col-sm-1">
|
{form_field field='delivery-module'}
|
||||||
<button id="search-mr-relay" class="form-submit-button btn btn-block btn-default" type="button">{intl d="mondialrelay.fo.default" l="Find"}</button>
|
<label for="delivery-method_{$module_id}_pickup">
|
||||||
</div>
|
<input type="radio" data-mondial-relay-delivery-mode="pickup" name="{$name}" id="delivery-method_{$module_id}_pickup" value="{$module_id}">
|
||||||
{/loop}
|
<strong>{intl d="mondialrelay.fo.default" l="Mondial Relay pickup location"}</strong>
|
||||||
|
<br>
|
||||||
|
<span class="help-block">
|
||||||
|
{intl l="Expected delivery date: %delivery_date" delivery_date={format_date date=$DELIVERY_DATE output="date"} d="mondialrelay.fo.default" }
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
{/form_field}
|
||||||
|
{/form}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-2 hidden-xs text-center">
|
||||||
|
{loop type="image" name="deliveryspicture" source="module" source_id=$module_id force_return="true" width="100" height="72"}
|
||||||
|
<img src="{$IMAGE_URL nofilter}" alt="{$TITLE}">
|
||||||
|
{/loop}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<div class="price text-right">
|
||||||
|
{format_money number=$PRICE symbol={currency attr='symbol'}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="mondial-relay-pickup">
|
||||||
|
<div class="row">
|
||||||
|
<div class="location-form clearfix">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<h4>{intl d="mondialrelay.fo.default" l="Find a pickup location around you"}</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{loop type="address" name="adr" id=$address_id}
|
||||||
|
<div class="col-sm-2">
|
||||||
|
<input type="text" required class="form-control" id="mondial_relay_zipcode" name="mondial_relay_zipcode" placeholder="{intl l="Zip code" d="mondialrelay.fo.default"}" value="{$ZIPCODE}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<input type="text" class="form-control" id="mondial_relay_city" name="mondial_relay_city" placeholder="{intl l="City" d="mondialrelay.fo.default"}" value="{$CITY}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<select class="form-control" id="mondial_relay_country_id" name="mondial_relay_country_id">
|
||||||
|
{loop type="country" name="cntry"}
|
||||||
|
<option value="{$ID}"{if $COUNTRY == $ID} selected{/if}>{$TITLE}</option>
|
||||||
|
{/loop}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-2">
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" class="form-control" id="mondial_relay_radius" name="mondial_relay_radius" placeholder="{intl l="Search radius" d="mondialrelay.fo.default"}" value="10">
|
||||||
|
<span class="input-group-addon">{intl d="mondialrelay.fo.default" l="km"}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-1">
|
||||||
|
<button id="search-mr-relay" class="form-submit-button btn btn-block btn-default" type="button">{intl d="mondialrelay.fo.default" l="Find"}</button>
|
||||||
|
</div>
|
||||||
|
{/loop}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<div id="relay_info">
|
||||||
|
<p>{intl d="mondialrelay.fo.default" l="Loading..."}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="col-md-7">
|
||||||
<div class="col-md-5">
|
<div id="mondialrelay_map" style="width: 100%; height: 450px;">
|
||||||
<div id="relay_info">
|
|
||||||
<p>{intl d="mondialrelay.fo.default" l="Loading..."}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-7">
|
|
||||||
<div id="mondialrelay_map" style="width: 100%; height: 450px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
{/loop}
|
{/loop}
|
||||||
</td>
|
</td>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$("#delivery-module-{$module_id}").html($('#mondialrelay_ui').html());
|
$("#delivery-module-{$module_id}").html($('#mondialrelay_ui').html());
|
||||||
|
|
||||||
jQuery.fn.scrollTo = function(elem, speed) {
|
jQuery.fn.scrollTo = function(elem, speed) {
|
||||||
@@ -138,8 +139,8 @@
|
|||||||
}, speed === undefined ? 1000 : speed);
|
}, speed === undefined ? 1000 : speed);
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
{if $withRelay}
|
{if $withRelay}
|
||||||
var MRData = {
|
var MRData = {
|
||||||
markers: [],
|
markers: [],
|
||||||
map: null,
|
map: null,
|
||||||
@@ -153,124 +154,142 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
function loadScript() {
|
function loadScript() {
|
||||||
|
console.log("loadScript ColissimoPickupPoint");
|
||||||
|
|
||||||
|
if (window.ModulesGoogleMaps.loading) {
|
||||||
|
// Si déjà en cours de chargement, ajouter le callback
|
||||||
|
window.ModulesGoogleMaps.callbacks.push(mondialRelaySetup);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.ModulesGoogleMaps.loading = true;
|
||||||
|
|
||||||
|
// Callback global qui sera appelé par Google Maps
|
||||||
|
window.ModulesGoogleMapsCallback = function() {
|
||||||
|
window.ModulesGoogleMaps.loaded = true;
|
||||||
|
window.ModulesGoogleMaps.loading = false;
|
||||||
|
|
||||||
|
// Exécuter tous les callbacks en attente
|
||||||
|
window.ModulesGoogleMaps.callbacks.forEach(function(callback) {
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
window.ModulesGoogleMaps.callbacks = [];
|
||||||
|
};
|
||||||
|
|
||||||
var script = document.createElement('script');
|
var script = document.createElement('script');
|
||||||
script.type = 'text/javascript';
|
script.type = 'text/javascript';
|
||||||
|
script.defer = true;
|
||||||
script.src = 'https://maps.googleapis.com/maps/api/js'
|
script.src = 'https://maps.googleapis.com/maps/api/js'
|
||||||
+ '?callback=mondialRelaySetup'
|
+ '?callback=ModulesGoogleMapsCallback'
|
||||||
|
+ '&libraries=marker'
|
||||||
+ '&key={module_config module="MondialRelay" key="google_maps_api_key" locale="en_US"}';
|
+ '&key={module_config module="MondialRelay" key="google_maps_api_key" locale="en_US"}';
|
||||||
script.async = true;
|
|
||||||
document.body.appendChild(script);
|
document.body.appendChild(script);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadRelayMap() {
|
function loadRelayMap() {
|
||||||
var $relayInfo = $('#relay_info');
|
var $relayInfo = $('#relay_info');
|
||||||
|
|
||||||
MRData.bounds = new google.maps.LatLngBounds();
|
|
||||||
|
|
||||||
|
MRData.bounds = new google.maps.LatLngBounds();
|
||||||
for(var idx = 0; idx < MRData.markers.length; idx++) {
|
for(var idx = 0; idx < MRData.markers.length; idx++) {
|
||||||
MRData.markers[idx].setMap(null);
|
MRData.markers[idx].setMap(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
MRData.markers.length = 0;
|
MRData.markers.length = 0;
|
||||||
|
|
||||||
$relayInfo.html('');
|
$relayInfo.html('');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{url path="MondialRelay/relay-map"}",
|
url: "{url path="MondialRelay/relay-map"}",
|
||||||
data : {
|
data : {
|
||||||
country_id: $('#mondial_relay_country_id').val(),
|
country_id: $('#mondial_relay_country_id').val(),
|
||||||
city: $('#mondial_relay_city').val(),
|
city: $('#mondial_relay_city').val(),
|
||||||
zipcode: $('#mondial_relay_zipcode').val(),
|
zipcode: $('#mondial_relay_zipcode').val(),
|
||||||
radius: $('#mondial_relay_radius').val()
|
radius: $('#mondial_relay_radius').val()
|
||||||
},
|
},
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
var html, item, opening, marker;
|
var html, item, opening, marker;
|
||||||
|
|
||||||
if (data.error !== '') {
|
if (data.error !== '') {
|
||||||
var errMsg = "{intl d="mondialrelay.fo.default" l="Sorry, we failed to get pickup locations. Error is : __ERR__." js=1}";
|
var errMsg = "{intl d="mondialrelay.fo.default" l="Sorry, we failed to get pickup locations. Error is : __ERR__." js=1}";
|
||||||
alert(errMsg.replace('__ERR__', data.error));
|
alert(errMsg.replace('__ERR__', data.error));
|
||||||
} else if (data.points.length === 0) {
|
} else if (data.points.length === 0) {
|
||||||
html = '<div class="alert alert-danger">{intl d="mondialrelay.fo.default" l="No pickup locations were found for this address." js=1}</div>';
|
html = '<div class="alert alert-danger">{intl d="mondialrelay.fo.default" l="No pickup locations were found for this address." js=1}</div>';
|
||||||
} else {
|
} else {
|
||||||
html = '<table class="pickup-points">';
|
html = '<table class="pickup-points">';
|
||||||
|
|
||||||
// Build point data and map points from json data
|
// Build point data and map points from json data
|
||||||
for (var idx = 0; idx < data.points.length; idx++) {
|
for (var idx = 0; idx < data.points.length; idx++) {
|
||||||
item = data.points[idx];
|
item = data.points[idx];
|
||||||
|
|
||||||
marker = new google.maps.Marker({
|
marker = new google.maps.marker.AdvancedMarkerElement({
|
||||||
map: MRData.map,
|
map: MRData.map,
|
||||||
position: new google.maps.LatLng(item.latitude, item.longitude),
|
position: new google.maps.LatLng(item.latitude, item.longitude),
|
||||||
title: (idx + 1) + ' : ' + item.name,
|
title: (idx + 1) + ' : ' + item.name
|
||||||
icon: MRData.pinImages[idx],
|
});
|
||||||
relay_id: item.id
|
|
||||||
});
|
google.maps.event.addListener(marker, 'click', function () {
|
||||||
|
$relayInfo.scrollTo("#pickup-point-" + this.relay_id);
|
||||||
google.maps.event.addListener(marker, 'click', function () {
|
});
|
||||||
$relayInfo.scrollTo("#pickup-point-" + this.relay_id);
|
|
||||||
});
|
MRData.bounds.extend(marker.position);
|
||||||
|
MRData.markers.push(marker);
|
||||||
MRData.bounds.extend(marker.getPosition());
|
|
||||||
MRData.markers.push(marker);
|
html +=
|
||||||
|
'<tr class="pickup-point" data-pickup-id="' + item.id + '" id="pickup-point-' + item.id + '">'
|
||||||
html +=
|
+ '<td>'
|
||||||
'<tr class="pickup-point" data-pickup-id="' + item.id + '" id="pickup-point-' + item.id + '">'
|
+ ' <label for="" class="name">'
|
||||||
+ '<td>'
|
+ ' <span class="numero">' + (idx + 1) + '</span> ' + item.name + ' (' + item.distance_km + ' km)'
|
||||||
+ ' <label for="" class="name">'
|
+ ' </label>'
|
||||||
+ ' <span class="numero">' + (idx + 1) + '</span> ' + item.name + ' (' + item.distance_km + ' km)'
|
+ ' <div class="address">' + item.address + '</div>'
|
||||||
+ ' </label>'
|
+ ' <div class="zipcode">' + item.zipcode + ' ' + item.city + '</div>'
|
||||||
+ ' <div class="address">' + item.address + '</div>'
|
;
|
||||||
+ ' <div class="zipcode">' + item.zipcode + ' ' + item.city + '</div>'
|
|
||||||
;
|
if (item.openings.length > 0) {
|
||||||
|
html += '<table class="opening-hours">';
|
||||||
if (item.openings.length > 0) {
|
|
||||||
html += '<table class="opening-hours">';
|
for (var jdx = 0; jdx < item.openings.length; jdx++) {
|
||||||
|
opening = item.openings[jdx];
|
||||||
for (var jdx = 0; jdx < item.openings.length; jdx++) {
|
|
||||||
opening = item.openings[jdx];
|
html += '<tr>';
|
||||||
|
html += '<td class="day">' + opening.day + '</td> ';
|
||||||
html += '<tr>';
|
if (opening.opening_time_1 !== undefined) {
|
||||||
|
html += '<td>' + opening.opening_time_1 + ' - ' + opening.closing_time_1 + '</td>';
|
||||||
html += '<td class="day">' + opening.day + '</td> ';
|
|
||||||
|
|
||||||
if (opening.opening_time_1 !== undefined) {
|
|
||||||
html += '<td>' + opening.opening_time_1 + ' - ' + opening.closing_time_1 + '</td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opening.opening_time_2 !== undefined) {
|
|
||||||
html += '<td>' + opening.opening_time_2 + ' - ' + opening.closing_time_2 + '</td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
html += '</tr>';
|
|
||||||
}
|
}
|
||||||
|
if (opening.opening_time_2 !== undefined) {
|
||||||
html += '</table>';
|
html += '<td>' + opening.opening_time_2 + ' - ' + opening.closing_time_2 + '</td>';
|
||||||
|
}
|
||||||
|
html += '</tr>';
|
||||||
}
|
}
|
||||||
|
html += '</table>';
|
||||||
html += '</td>';
|
|
||||||
|
|
||||||
html += '<td><input type="radio" name="mondialrelay_relay" value="' + item.id + '"></td>';
|
|
||||||
|
|
||||||
html += '</tr>';
|
|
||||||
}
|
}
|
||||||
|
html += '</td>';
|
||||||
html += '</table>';
|
html += '<td><input type="radio" name="mondialrelay_relay" value="' + item.id + '"></td>';
|
||||||
|
html += '</tr>';
|
||||||
}
|
}
|
||||||
|
html += '</table>';
|
||||||
$relayInfo.html(html);
|
|
||||||
|
|
||||||
// View all markers
|
|
||||||
MRData.map.fitBounds(MRData.bounds);
|
|
||||||
},
|
|
||||||
error: function() {
|
|
||||||
alert("{intl d="mondialrelay.fo.default" l="Oops, something goes wrong, please try again." js=1}")
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
$relayInfo.html(html);
|
||||||
|
|
||||||
|
// View all markers
|
||||||
|
MRData.map.fitBounds(MRData.bounds);
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
alert("{intl d="mondialrelay.fo.default" l="Oops, something goes wrong, please try again." js=1}")
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof(google) == 'undefined' || typeof(google.maps) == 'undefined') {
|
||||||
|
if (!window.ModulesGoogleMaps.loaded && !window.ModulesGoogleMaps.loading) {
|
||||||
|
// Ajouter le callback et charger le script
|
||||||
|
window.ModulesGoogleMaps.callbacks.push(mondialRelaySetup);
|
||||||
|
loadScript();
|
||||||
|
console.log('MR : Maps pas encore déclarée');
|
||||||
|
|
||||||
if (typeof(google) === 'undefined') {
|
} else if (window.ModulesGoogleMaps.loading) {
|
||||||
loadScript();
|
// Script en cours de chargement, ajouter juste le callback
|
||||||
|
window.ModulesGoogleMaps.callbacks.push(mondialRelaySetup);
|
||||||
|
console.log('MR : Maps déjà déclaré');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mondialRelaySetup();
|
mondialRelaySetup();
|
||||||
}
|
}
|
||||||
@@ -279,70 +298,70 @@
|
|||||||
// Google Map
|
// Google Map
|
||||||
var MRData_mapOptions = {
|
var MRData_mapOptions = {
|
||||||
zoom: 13,
|
zoom: 13,
|
||||||
mapTypeId: google.maps.MapTypeId.ROADMAP
|
mapTypeId: google.maps.MapTypeId.ROADMAP,
|
||||||
|
mapId: "MONDIALRELAY_MAP_ID"
|
||||||
};
|
};
|
||||||
|
|
||||||
MRData.map = new google.maps.Map(document.getElementById('mondialrelay_map'), MRData_mapOptions);
|
MRData.map = new google.maps.Map(document.getElementById('mondialrelay_map'), MRData_mapOptions);
|
||||||
MRData.geocoder = new google.maps.Geocoder();
|
MRData.geocoder = new google.maps.Geocoder();
|
||||||
|
|
||||||
// Center map on the current customer address
|
// Center map on the current customer address
|
||||||
{loop type="address" name="adr" id=$address_id}
|
{loop type="address" name="adr" id=$address_id}
|
||||||
var MRDataAddress = [];
|
var MRDataAddress = [];
|
||||||
MRDataAddress['address'] = "{$ADDRESS1|replace:'"':'\\"'}, {$ZIPCODE} {$CITY|replace:'"':'\\"'}";
|
MRDataAddress['address'] = "{$ADDRESS1|replace:'"':'\\"'}, {$ZIPCODE} {$CITY|replace:'"':'\\"'}";
|
||||||
|
|
||||||
MRData.geocoder.geocode(MRDataAddress, function (results, status) {
|
MRData.geocoder.geocode(MRDataAddress, function (results, status) {
|
||||||
if (status === google.maps.GeocoderStatus.OK) {
|
if (status === google.maps.GeocoderStatus.OK) {
|
||||||
MRData.map.setCenter(results[0].geometry.location);
|
MRData.map.setCenter(results[0].geometry.location);
|
||||||
marker = new google.maps.Marker({
|
marker = new google.maps.marker.AdvancedMarkerElement({
|
||||||
position: new google.maps.LatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng()),
|
position: new google.maps.LatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng()),
|
||||||
map: MRData.map,
|
map: MRData.map/*,
|
||||||
icon: "{image file='mondialrelay/assets/img/maison.png' source='MondialRelay'}"
|
icon: "{image file='mondialrelay/assets/img/maison.png' source='MondialRelay'}"*/
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Sinon on met le centre de la map sur Clermont-Ferrand ;)
|
// Sinon on met le centre de la map sur Clermont-Ferrand ;)
|
||||||
alert("{intl d="mondialrelay.fo.default" l="Current address can't be geolocated" js=1}");
|
alert("{intl d="mondialrelay.fo.default" l="Current address can't be geolocated" js=1}");
|
||||||
|
|
||||||
var myLatLng = new google.maps.LatLng(45.7789, 3.0782);
|
var myLatLng = new google.maps.LatLng(45.7789, 3.0782);
|
||||||
MRData.map.setCenter(myLatLng);
|
MRData.map.setCenter(myLatLng);
|
||||||
MRData.map.setZoom(3);
|
MRData.map.setZoom(3);
|
||||||
}
|
|
||||||
});
|
|
||||||
{/loop}
|
|
||||||
|
|
||||||
loadRelayMap();
|
|
||||||
|
|
||||||
$(document).on('click', '.pickup-point', function(ev) {
|
|
||||||
var pointId = $(this).data('pickup-id');
|
|
||||||
$('input[value='+pointId+']').prop("checked", true)
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#search-mr-relay').off().click(function(ev) {
|
|
||||||
loadRelayMap();
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#form-cart-delivery").off('submit').submit(function(ev) {
|
|
||||||
if ($('[data-mondial-relay-delivery-mode=pickup]').is(':checked')
|
|
||||||
&&
|
|
||||||
$('input[name=mondialrelay_relay]:checked').length === 0) {
|
|
||||||
alert("{intl d="mondialrelay.fo.default" l="Please select a pickup location." js=1}");
|
|
||||||
ev.preventDefault();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
{/loop}
|
||||||
{/if}
|
|
||||||
|
loadRelayMap();
|
||||||
$('[data-mondial-relay-delivery-mode]').change(function() {
|
$(document).on('click', '.pickup-point', function(ev) {
|
||||||
$('input[name=mondial-relay-selected-delivery-mode]').val($(this).data('mondial-relay-delivery-mode'));
|
var pointId = $(this).data('pickup-id');
|
||||||
});
|
$('input[value='+pointId+']').prop("checked", true)
|
||||||
|
});
|
||||||
// Hide / Show pickeup selection UI
|
|
||||||
$('input[type=radio]').click(function() {
|
$('#search-mr-relay').off().click(function(ev) {
|
||||||
if ($('[data-mondial-relay-delivery-mode=pickup]').is(':checked')) {
|
loadRelayMap();
|
||||||
$('#mondial-relay-pickup').slideDown('fast');
|
});
|
||||||
// Show a descent map
|
$("#form-cart-delivery").off('submit').submit(function(ev) {
|
||||||
MRData.map.fitBounds(MRData.bounds);
|
|
||||||
} else {
|
if ($('[data-mondial-relay-delivery-mode=pickup]').is(':checked')
|
||||||
$('#mondial-relay-pickup').slideUp('fast');
|
&&
|
||||||
|
$('input[name=mondialrelay_relay]:checked').length === 0) {
|
||||||
|
alert("{intl d="mondialrelay.fo.default" l="Please select a pickup location." js=1}");
|
||||||
|
ev.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
{/if}
|
||||||
|
|
||||||
|
$('[data-mondial-relay-delivery-mode]').change(function() {
|
||||||
|
$('input[name=mondial-relay-selected-delivery-mode]').val($(this).data('mondial-relay-delivery-mode'));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Hide / Show pickeup selection UI
|
||||||
|
$('input[type=radio]').click(function() {
|
||||||
|
if ($('[data-mondial-relay-delivery-mode=pickup]').is(':checked')) {
|
||||||
|
$('#mondial-relay-pickup').slideDown('fast');
|
||||||
|
// Show a descent map
|
||||||
|
MRData.map.fitBounds(MRData.bounds);
|
||||||
|
} else {
|
||||||
|
$('#mondial-relay-pickup').slideUp('fast');
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -151,6 +151,15 @@
|
|||||||
|
|
||||||
{block name="javascript-initialization"}
|
{block name="javascript-initialization"}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Namespace global pour gérer Google Maps entre modules
|
||||||
|
window.ModulesGoogleMaps = window.ModulesGoogleMaps || {
|
||||||
|
loaded: false,
|
||||||
|
loading: false,
|
||||||
|
callbacks: []
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
jQuery(function($) {
|
jQuery(function($) {
|
||||||
$('.js-change-delivery-address').change(function(e) {
|
$('.js-change-delivery-address').change(function(e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user