Merge branch 'ticket-13798-ChangeAddressMR' into develop
This commit is contained in:
commit
1466d522d1
@ -3,7 +3,7 @@ require_once(dirname(__FILE__).'/../config/config.inc.php');
|
||||
require_once(dirname(__FILE__).'/init.php');
|
||||
|
||||
if($cookie->isLoggedBack() && $cart = Tools::getValue('id_cart')) {
|
||||
$address = Db::getInstance()->getRow('
|
||||
$address = Db::getInstance()->getRow('
|
||||
SELECT s.*, m.*, r.`narel`
|
||||
FROM `'._DB_PREFIX_.'mr_selected` s
|
||||
INNER JOIN `'._DB_PREFIX_.'mr_method` m
|
||||
@ -12,18 +12,18 @@ $address = Db::getInstance()->getRow('
|
||||
ON SUBSTRING(s.`MR_Selected_Num`, 2) = r.`direction`
|
||||
AND s.`MR_Selected_Pays` = r.`prpay`
|
||||
WHERE `id_cart` = '.pSQL(intval(Tools::getValue('id_cart'))).'
|
||||
');
|
||||
if($address['MR_Selected_Pays'] == 'F' || $address['MR_Selected_Pays'] == '') {
|
||||
');
|
||||
if($address['MR_Selected_Pays'] == 'F' || $address['MR_Selected_Pays'] == '') {
|
||||
$address['MR_Selected_Pays'] = 'FR';
|
||||
}
|
||||
$deliv_address = Db::getInstance()->getRow('
|
||||
}
|
||||
$deliv_address = Db::getInstance()->getRow('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'address` a
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o
|
||||
ON a.`id_address` = o.`id_address_delivery`
|
||||
WHERE o.`id_cart` = '.(int) Tools::getValue('id_cart').'
|
||||
');
|
||||
if($address) {
|
||||
');
|
||||
if($address) {
|
||||
if(isset($_POST['submitMR'])) {
|
||||
$num = Tools::getValue('MR_Selected_Num', '');
|
||||
if($num != '') {
|
||||
@ -59,103 +59,90 @@ if($address) {
|
||||
FROM `'._DB_PREFIX_.'order_detail`
|
||||
WHERE `id_order` = '.(int) $order['id_order'].'
|
||||
');
|
||||
require_once _PS_MODULE_DIR_.'mondialrelay/classes/MRGetRelayPoint.php';
|
||||
require_once _PS_MODULE_DIR_.'mondialrelay/classes/MRRelayDetail.php';
|
||||
$mr = new MondialRelay();
|
||||
$delivery_mode = $address['dlv_mode'];
|
||||
$params = array(
|
||||
'action' => $delivery_mode,
|
||||
'id_carrier' => $order['id_carrier'],
|
||||
'weight' => Tools::ps_round($weight, 2),
|
||||
'id_address_delivery' => $order['id_address_delivery'],
|
||||
);
|
||||
$api = new MRGetRelayPoint($params, $mr);
|
||||
$api->init();
|
||||
$api->send();
|
||||
$result = $api->getResult();
|
||||
$relay_points = array();
|
||||
if(count($result['error']) === 0) {
|
||||
$success = (array)$result['success'];
|
||||
ksort($success);
|
||||
$relay_points = array_values($success);
|
||||
?>
|
||||
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
|
||||
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo __PS_BASE_URI__.'adm/helpers/includes/js/bootstrap.min.js';?>"></script>
|
||||
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
|
||||
<script type="text/javascript" src="https://widget.mondialrelay.com/parcelshop-picker/v3_2_1/scripts/jquery.plugin.mondialrelay.parcelshoppicker.min.js"></script>
|
||||
<style>
|
||||
@import url("<?php echo __PS_BASE_URI__.'adm/helpers/includes/css/bootstrap.min.css';?>");
|
||||
@import url("<?php echo __PS_BASE_URI__.'adm/helpers/includes/jquery-ui-1.8.20.custom.css';?>");
|
||||
@import url("<?php echo __PS_BASE_URI__.'adm/helpers/includes/css/custom.css';?>");
|
||||
</style>
|
||||
|
||||
<?php
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
function updateForm(delivery_mode, address1, address2, address3, address4, postcode, city, prid) {
|
||||
$("select[name=delivery_mode]").val("");
|
||||
$("input[name=MR_Selected_LgAdr1]").val("");
|
||||
$("input[name=MR_Selected_LgAdr2]").val("");
|
||||
$("input[name=MR_Selected_LgAdr3]").val("");
|
||||
$("input[name=MR_Selected_LgAdr4]").val("");
|
||||
$("input[name=MR_Selected_CP]").val("");
|
||||
$("input[name=MR_Selected_Ville]").val("");
|
||||
$("input[name=MR_Selected_Num]").val("");
|
||||
|
||||
$("select[name=delivery_mode]").val(delivery_mode);
|
||||
$("input[name=MR_Selected_LgAdr1]").val(address1);
|
||||
$("input[name=MR_Selected_LgAdr2]").val(address2);
|
||||
$("input[name=MR_Selected_LgAdr3]").val(address3);
|
||||
$("input[name=MR_Selected_LgAdr4]").val(address4);
|
||||
$("input[name=MR_Selected_CP]").val(postcode);
|
||||
$("input[name=MR_Selected_Ville]").val(city);
|
||||
$("input[name=MR_Selected_Num]").val(prid);
|
||||
}
|
||||
?>
|
||||
<!doctype html>
|
||||
<html><head>
|
||||
<meta charset="utf-8" />
|
||||
<style type="text/css">
|
||||
body {
|
||||
overflow: auto;
|
||||
font-size: 12px;
|
||||
color: #222222;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
label {
|
||||
font-weight: bold;
|
||||
display: block;
|
||||
}
|
||||
fieldset {
|
||||
overflow: auto;
|
||||
float: left;
|
||||
width: 200px;
|
||||
}
|
||||
p {
|
||||
overflow: auto;
|
||||
}
|
||||
#map_canvas {
|
||||
width: 470px;
|
||||
height: 300px;
|
||||
display: inline-block;
|
||||
}
|
||||
h1 {
|
||||
clear: both;
|
||||
font-size: 16px;
|
||||
padding-top: 20px;
|
||||
}
|
||||
#pr_list {
|
||||
width: 200px;
|
||||
height: 300px;
|
||||
overflow-y: auto;
|
||||
display: inline-block;
|
||||
margin-left: 10px;
|
||||
}
|
||||
#pr_chooser {
|
||||
clear: both;
|
||||
}
|
||||
#pr_chooser ul {
|
||||
list-style: outside none;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
#pr_chooser li {
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
margin: 10px 10px 10px 0px;
|
||||
padding: 10px;
|
||||
}
|
||||
#pr_chooser li:hover {
|
||||
background: #ccddee;
|
||||
}
|
||||
.maplink {
|
||||
color: #1122ff;
|
||||
cursor: pointer;
|
||||
}
|
||||
.maplink:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
|
||||
<script type="text/javascript" src="/js/jquery/jquery-1.4.4.min.js"></script>
|
||||
<script type="text/javascript" src="/js/jquery/jquery.ui.map.js"></script>
|
||||
<script type="text/javascript" src="/js/jquery/jquery.ui.map.services.js"></script>
|
||||
</head><body onload="<?php if(isset($_POST['submitMR'])) { ?>window.close();<?php } ?>">
|
||||
<?php
|
||||
if($order['id_carrier'] == 216) {
|
||||
echo '<p style="border: 1px solid #ff0000; background: #ffeeee; font-weight: bold; padding: 10px 20px;">La modification des livraisons en point relais XL n\'est pas possible.</p>';
|
||||
} else {
|
||||
?>
|
||||
<form action="" method="post">
|
||||
<fieldset>
|
||||
|
||||
var enseigne = "F1BEBEBO";
|
||||
var isocode = "'.$address['MR_Selected_Pays'].'";
|
||||
var postcode = "'.$address['MR_Selected_CP'].'";
|
||||
var mode = "24R";
|
||||
var weight = '.(int)$weight.';
|
||||
if( weight == 0 ) weight = 100;
|
||||
var t;
|
||||
$(document).ready(function () {
|
||||
$("#Zone_Widget").MR_ParcelShopPicker({
|
||||
UseSSL : true,
|
||||
Target: "#Target_Widget",
|
||||
TargetDisplay: "#TargetDisplay_Widget",
|
||||
TargetDisplayInfoPR: "#TargetDisplayInfoPR_Widget",
|
||||
Brand: enseigne,
|
||||
Country: isocode,
|
||||
PostCode: postcode,
|
||||
ColLivMod: mode,
|
||||
NbResults: "7",
|
||||
DisplayMapInfo: true,
|
||||
OnParcelShopSelected: function (data) {
|
||||
console.log(data);
|
||||
updateForm("24R",data.Nom,"",data.Adresse1,data.Adresse2,data.CP,data.Ville,data.ID);
|
||||
$("#cb_ID").html(data.ID);
|
||||
$("#cb_Nom").html(data.Nom);
|
||||
$("#cb_Adresse").html(data.Adresse1 + " " + data.Adresse2);
|
||||
$("#cb_CP").html(data.CP);
|
||||
$("#cb_Ville").html(data.Ville);
|
||||
$("#cb_Pays").html(data.Pays);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
?>
|
||||
</head>
|
||||
<body onload="<?php if(isset($_POST['submitMR'])) { ?>window.close();<?php } ?>">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-xs-4">
|
||||
<div class="panel">
|
||||
<div class="panel-title">
|
||||
<h2>Info Destinataire</h2>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="panel-content">
|
||||
<p>
|
||||
<label>Nom destinataire</label>
|
||||
<span style="display: block; min-height: 1em;"><?php echo htmlentities($deliv_address['lastname'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?></span>
|
||||
@ -176,184 +163,80 @@ if($order['id_carrier'] == 216) {
|
||||
<label>Email</label>
|
||||
<span style="display: block; min-height: 1em;"><?php echo htmlentities($deliv_address['email'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?></span>
|
||||
</p>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<p style="display: none;">
|
||||
<label>Mode de livraison</label>
|
||||
<select autocomplete="off" name="delivery_mode">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
<div class="panel">
|
||||
<div class="panel-title">
|
||||
<h2>Information Point relais</h2>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="panel-content">
|
||||
<div class="row">
|
||||
<div class="col-xs-7 col-xs-offset-3" style="margin-bottom: 20px;">
|
||||
<span id="TargetDisplayInfoPR_Widget" />
|
||||
</div>
|
||||
</div>
|
||||
<form class="form-horizontal" action="" method="post">
|
||||
<div class="form-group">
|
||||
<label class="col-xs-4 control-label">Adresse 1</label>
|
||||
<div class="col-xs-8">
|
||||
<input class="form-control" autocomplete="off" type="text" name="MR_Selected_LgAdr1" readonly="true" value="<?php echo htmlentities($address['MR_Selected_LgAdr1'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-4 control-label">Adresse 2</label>
|
||||
<div class="col-xs-8">
|
||||
<input class="form-control" autocomplete="off" type="text" name="MR_Selected_LgAdr2" readonly="true" value="<?php echo htmlentities($address['MR_Selected_LgAdr2'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-4 control-label">Adresse 3</label>
|
||||
<div class="col-xs-8">
|
||||
<input class="form-control" autocomplete="off" type="text" name="MR_Selected_LgAdr3" readonly="true" value="<?php echo htmlentities($address['MR_Selected_LgAdr3'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-4 control-label">Adresse 4</label>
|
||||
<div class="col-xs-8">
|
||||
<input class="form-control" autocomplete="off" type="text" name="MR_Selected_LgAdr4" readonly="true" value="<?php echo htmlentities($address['MR_Selected_LgAdr4'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-4 control-label">Code postal</label>
|
||||
<div class="col-xs-8">
|
||||
<input class="form-control" autocomplete="off" type="text" name="MR_Selected_CP" readonly="true" value="<?php echo htmlentities($address['MR_Selected_CP'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-4 control-label">Ville</label>
|
||||
<div class="col-xs-8">
|
||||
<input class="form-control" autocomplete="off" type="text" name="MR_Selected_Ville" readonly="true" value="<?php echo htmlentities($address['MR_Selected_Ville'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-4 control-label">ID point retrait</label>
|
||||
<div class="col-xs-8">
|
||||
<input class="form-control" autocomplete="off" type="text" name="MR_Selected_Num" readonly="true" value="<?php echo htmlentities($address['MR_Selected_Num'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input class="btn btn-primary pull-right" type="submit" value="Envoyer" name="submitMR" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
<div id="Zone_Widget"></div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
$modes = array('24R' => 'Point relais (24R)',
|
||||
'24L' => 'Point relais XL (24L)', '24X' => 'Point relais XXL (24X)', 'HOM' => 'Livraison à domicile Home (HOM)', 'LD1' => 'Livraison à domicile 1 personne (LD1)',
|
||||
'LDS' => 'Livraison à domicile 2 personnes (LDS)', 'DRI' => 'Livraison Colis Drive (DRI)');
|
||||
foreach($modes as $k => $v) {
|
||||
echo '<option value="'.$k.'"'.($delivery_mode == $k? ' selected="selected"': '').'>'.$v.'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<label>Adresse 1</label>
|
||||
<input autocomplete="off" type="text" name="MR_Selected_LgAdr1" readonly="true" value="<?php echo htmlentities($address['MR_Selected_LgAdr1'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label>Adresse 2</label>
|
||||
<input autocomplete="off" type="text" name="MR_Selected_LgAdr2" readonly="true" value="<?php echo htmlentities($address['MR_Selected_LgAdr2'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label>Adresse 3</label>
|
||||
<input autocomplete="off" type="text" name="MR_Selected_LgAdr3" readonly="true" value="<?php echo htmlentities($address['MR_Selected_LgAdr3'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label>Adresse 4</label>
|
||||
<input autocomplete="off" type="text" name="MR_Selected_LgAdr4" readonly="true" value="<?php echo htmlentities($address['MR_Selected_LgAdr4'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label>Code postal</label>
|
||||
<input autocomplete="off" type="text" name="MR_Selected_CP" readonly="true" value="<?php echo htmlentities($address['MR_Selected_CP'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label>Ville</label>
|
||||
<input autocomplete="off" type="text" name="MR_Selected_Ville" readonly="true" value="<?php echo htmlentities($address['MR_Selected_Ville'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?>" />
|
||||
</p>
|
||||
<p>
|
||||
<label>ID point retrait</label>
|
||||
<input autocomplete="off" type="text" name="MR_Selected_Num" readonly="true" value="<?php echo htmlentities($address['MR_Selected_Num'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?>" />
|
||||
</p>
|
||||
<p><input type="submit" value="Envoyer" name="submitMR" /></p>
|
||||
</fieldset>
|
||||
</form>
|
||||
<?php
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
markers = [];
|
||||
-->
|
||||
</script>
|
||||
<div id="pr_chooser"><h1>Livraison hors domicile - Recherche d\'un point de retrait</h1>
|
||||
<div id="map_canvas"></div><div id="pr_list"><ul></ul></div>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
function updateForm(delivery_mode, address1, address2, address3, address4, postcode, city, prid) {
|
||||
$("select[name=delivery_mode]").val("");
|
||||
$("input[name=MR_Selected_LgAdr1]").val("");
|
||||
$("input[name=MR_Selected_LgAdr2]").val("");
|
||||
$("input[name=MR_Selected_LgAdr3]").val("");
|
||||
$("input[name=MR_Selected_LgAdr4]").val("");
|
||||
$("input[name=MR_Selected_CP]").val("");
|
||||
$("input[name=MR_Selected_Ville]").val("");
|
||||
$("input[name=MR_Selected_Num]").val("");
|
||||
$("select[name=delivery_mode]").val(delivery_mode);
|
||||
$("input[name=MR_Selected_LgAdr1]").val(address1);
|
||||
$("input[name=MR_Selected_LgAdr2]").val(address2);
|
||||
$("input[name=MR_Selected_LgAdr3]").val(address3);
|
||||
$("input[name=MR_Selected_LgAdr4]").val(address4);
|
||||
$("input[name=MR_Selected_CP]").val(postcode);
|
||||
$("input[name=MR_Selected_Ville]").val(city);
|
||||
$("input[name=MR_Selected_Num]").val(prid);
|
||||
}
|
||||
function displayMap(results, status, is_city) {
|
||||
if ( status === "OK" ) {
|
||||
var lat = null;
|
||||
var lng = null;
|
||||
|
||||
if(results[0].geometry.location.H) {
|
||||
lat = results[0].geometry.location.H;
|
||||
lng = results[0].geometry.location.L;
|
||||
} else if(results[0].geometry.location.G) {
|
||||
lat = results[0].geometry.location.G;
|
||||
lng = results[0].geometry.location.K;
|
||||
} else {
|
||||
var loc = results[0].geometry.location.toString().replace("(", "").replace(")", "").replace(" ", "").split(",");
|
||||
lat = loc[0];
|
||||
lng = loc[1];
|
||||
}
|
||||
|
||||
if(!is_city) {
|
||||
$("#map_canvas").gmap("addMarker", {"icon": "http://static.privatesportshop.com/img/admin/marker_home.png", "idpr": "pr_home", "position": lat + "," + lng, "bounds": true}).click(function() {
|
||||
$("#map_canvas").gmap("openInfoWindow", {"content": "Adresse actuelle"}, this);
|
||||
});
|
||||
}
|
||||
|
||||
';
|
||||
|
||||
for($i= 0, $l = count($relay_points); $i < $l; $i++) {
|
||||
$relay = $relay_points[$i];
|
||||
|
||||
if($relay->Pays == "") {
|
||||
continue;
|
||||
}
|
||||
|
||||
echo '
|
||||
$("#map_canvas").gmap("search", {"address": "'.htmlentities(preg_replace('/(, ){2,}/', ', ', preg_replace('/(, ){2,}/', ', ', implode(', ', array(trim($relay->LgAdr3), trim($relay->LgAdr2), trim($relay->LgAdr4), trim($relay->CP).' '.trim($relay->Ville), Country::getNameById(2, $relay->Pays != 'FR'? Country::getByIso($relay->Pays): 8))))), ENT_COMPAT | ENT_HTML401, 'UTF-8').'"}, function(results, status) {
|
||||
if ( status === "OK" ) {
|
||||
var lat = null;
|
||||
var lng = null;
|
||||
|
||||
if(results[0].geometry.location.H) {
|
||||
lat = results[0].geometry.location.H;
|
||||
lng = results[0].geometry.location.L;
|
||||
} else if(results[0].geometry.location.G) {
|
||||
lat = results[0].geometry.location.G;
|
||||
lng = results[0].geometry.location.K;
|
||||
} else {
|
||||
var loc = results[0].geometry.location.toString().replace("(", "").replace(")", "").replace(" ", "").split(",");
|
||||
lat = loc[0];
|
||||
lng = loc[1];
|
||||
}
|
||||
|
||||
var prtext = ["", "'.htmlentities(trim($relay->LgAdr1), ENT_COMPAT | ENT_HTML401, 'UTF-8').'", "'.htmlentities(trim($relay->LgAdr2), ENT_COMPAT | ENT_HTML401, 'UTF-8').'", "'.htmlentities(trim($relay->LgAdr3), ENT_COMPAT | ENT_HTML401, 'UTF-8').'", "'.htmlentities(trim($relay->LgAdr4), ENT_COMPAT | ENT_HTML401, 'UTF-8').'", "'.htmlentities($relay->CP, ENT_COMPAT | ENT_HTML401, 'UTF-8').' '.htmlentities($relay->Ville, ENT_COMPAT | ENT_HTML401, 'UTF-8').'"].filter(function(x) { return x != ""; }).join("<br />");
|
||||
var prtext_action = "<br /><a class=\"maplink\" onclick=\"$(\'#pr_list li[data-index='.$i.']\').trigger(\'click\'); return false;\">Sélectionner</a>";
|
||||
|
||||
markers.push($("#map_canvas").gmap("addMarker", { "id": "pr_'.htmlentities($relay->Num, ENT_COMPAT | ENT_HTML401, 'UTF-8').'", "position": lat + "," +lng, "bounds": true, "content": prtext + prtext_action }));
|
||||
markers[markers.length - 1].click(function() {
|
||||
$("#map_canvas").gmap("openInfoWindow", {"content": $(this).attr("content")}, this);
|
||||
});
|
||||
|
||||
var litem = $("<li />").attr("data-index", '.$i.').html(prtext).click(function() {
|
||||
$.each(markers, function(id, el) {
|
||||
if(el[0].id == "pr_'.htmlentities(trim($relay->Num), ENT_COMPAT | ENT_HTML401, 'UTF-8').'") {
|
||||
google.maps.event.trigger(el[0], "click");
|
||||
}
|
||||
});
|
||||
$("#map_canvas").gmap("option", "center", markers[parseInt($(this).attr("data-index"))][0].getPosition());
|
||||
updateForm("24R", "'.htmlentities(trim($relay->LgAdr1), ENT_COMPAT | ENT_HTML401, 'UTF-8').'", "'.htmlentities(trim($relay->LgAdr2), ENT_COMPAT | ENT_HTML401, 'UTF-8').'", "'.htmlentities(trim($relay->LgAdr3), ENT_COMPAT | ENT_HTML401, 'UTF-8').'", "'.htmlentities(trim($relay->LgAdr4), ENT_COMPAT | ENT_HTML401, 'UTF-8').'", "'.htmlentities(trim($relay->CP), ENT_COMPAT | ENT_HTML401, 'UTF-8').'", "'.htmlentities(trim($relay->Ville), ENT_COMPAT | ENT_HTML401, 'UTF-8').'", "'.htmlentities(trim($relay->Num), ENT_COMPAT | ENT_HTML401, 'UTF-8').'");
|
||||
});
|
||||
|
||||
$("#pr_list ul").append(litem);
|
||||
}
|
||||
});';
|
||||
}
|
||||
echo '
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
delivery_modes = {};
|
||||
$("select[name=delivery_mode] option").each(function(id, el) {
|
||||
delivery_modes[$(el).attr("value")] = $(el).text();
|
||||
});
|
||||
|
||||
$("#map_canvas").gmap('.($pr_coords? '{ "center": "'.(float) $pr_coords['xcoords'].','.(float) $pr_coords['ycoords'].'" }': '').').bind("init", function(ev, map) {';
|
||||
$current_address = htmlentities(preg_replace('/(, ){2,}/', ', ', preg_replace('/(, ){2,}/', ', ', implode(', ', array(trim($deliv_address['address1']), trim($deliv_address['address2'])))).', '.trim($deliv_address['postcode']).' '.$deliv_address['city'].', '.Country::getNameById(2, $deliv_address['id_country'])), ENT_COMPAT | ENT_HTML401, 'UTF-8');
|
||||
echo '
|
||||
$("#map_canvas").gmap("search", {"address": "'.$current_address.'"}, function(results, status) {
|
||||
if(results.length == 0) {
|
||||
$("#map_canvas").gmap("search", {"address": "'.htmlentities(trim($deliv_address['postcode']).' '.$deliv_address['city'].', '.Country::getNameById(2, $deliv_address['id_country']), ENT_COMPAT | ENT_HTML401, 'UTF-8').'"}, function(results, status) {
|
||||
displayMap(results, status, true);
|
||||
});
|
||||
} else {
|
||||
displayMap(results, status);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
-->
|
||||
</script>
|
||||
</div>';
|
||||
}
|
||||
?>
|
||||
</body></html>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
@ -268,6 +268,9 @@ class MondialrelayCarrier {
|
||||
AND `direction` = "'.pSQL($delivery_infos['MR_Selected_Num']).'"
|
||||
AND `prpay` = "'.pSQL($delivery_infos['MR_Selected_Pays']).'"
|
||||
');
|
||||
if(!$mr_relais){
|
||||
return false;
|
||||
}
|
||||
$mode = $delivery_infos['dlv_mode'];
|
||||
if($mode == '24R') {
|
||||
if($mr_relais['narel'] == 'F') {
|
||||
@ -485,6 +488,9 @@ class MondialrelayCarrier {
|
||||
AND `direction` = "'.pSQL($delivery_infos['MR_Selected_Num']).'"
|
||||
AND `prpay` = "'.pSQL($delivery_infos['MR_Selected_Pays']).'"
|
||||
');
|
||||
if(!$mr_relais){
|
||||
return array('<p class="error">Point relais not found</p><br />', array());
|
||||
}
|
||||
$mode = $delivery_infos['dlv_mode'];
|
||||
if($mode == '24R') {
|
||||
if($mr_relais['narel'] == 'F') {
|
||||
@ -508,7 +514,7 @@ class MondialrelayCarrier {
|
||||
|
||||
if(!$plantri) {
|
||||
// TODO: error handling
|
||||
return;
|
||||
return array('<p class="error">Tri not found</p><br />', array());
|
||||
}
|
||||
|
||||
$sequence = $this->getShippingNumber((int) $order->id);
|
||||
@ -826,7 +832,7 @@ class MondialrelayCarrier {
|
||||
}
|
||||
|
||||
$templateVars = array(
|
||||
'{followup}' => str_replace('@', $shipping_data['shipping_number'], $carrier->url),
|
||||
'{followup}' => "https://www.mondialrelay.fr/suivi-de-colis?numeroExpedition=".$shipping_data['shipping_number'],
|
||||
'{firstname}' => $customer->firstname,
|
||||
'{lastname}' => $customer->lastname,
|
||||
'{id_order}' => (int) $order->id,
|
||||
|
@ -466,7 +466,7 @@ class MondialRelay extends Module
|
||||
ON o.`id_address_delivery` = a.`id_address`
|
||||
WHERE o.`id_order` = '.(int) $params['id_order'].'
|
||||
'),
|
||||
'edit_url' => '<div style="float: right;"><a style="cursor: pointer;" onclick="var p = window.open(\''.'mraddressedit.php?id_cart='.$id_cart.'\', \'Modification Mondial Relay\', \'width=720, height=390, resizable=1, scrollbars=1\'); p.onunload = function(){window.location.reload();}; return false;"><img src="../img/admin/edit.gif" alt="" /></a></div>',
|
||||
'edit_url' => '<div style="float: right;"><a style="cursor: pointer;" onclick="var p = window.open(\''.'mraddressedit.php?id_cart='.$id_cart.'\', \'Modification Mondial Relay\', \'width=720, height=700, resizable=1, scrollbars=1\'); p.onunload = function(){window.location.reload();}; return false;"><img src="../img/admin/edit.gif" alt="" /></a></div>',
|
||||
));
|
||||
|
||||
return $this->fetchTemplate('/views/templates/admin/', 'admin_order');
|
||||
|
Loading…
Reference in New Issue
Block a user