changement module mr
This commit is contained in:
parent
9047143c5b
commit
ecf1a87507
@ -110,12 +110,6 @@ switch ($method)
|
||||
$params['id_carrier'] = Tools::getValue('id_carrier');
|
||||
$params['weight'] = Context::getContext()->cart->getTotalWeight();
|
||||
$params['id_address_delivery'] = Context::getContext()->cart->id_address_delivery;
|
||||
|
||||
if (Tools::getValue('weight') && Tools::getValue('id_address_delivery') && Tools::getValue('process_selection')){
|
||||
$params['weight'] = (int) Tools::getValue('weight');
|
||||
$params['id_address_delivery'] = (int) Tools::getValue('id_address_delivery');
|
||||
}
|
||||
|
||||
break;
|
||||
case 'addSelectedCarrierToDB':
|
||||
$params['id_carrier'] = Tools::getValue('id_carrier');
|
||||
@ -123,14 +117,6 @@ switch ($method)
|
||||
$params['id_customer'] = Context::getContext()->customer->id;
|
||||
$params['id_mr_method'] = Tools::getValue('id_mr_method');
|
||||
$params['relayPointInfo'] = Tools::getValue('relayPointInfo');
|
||||
|
||||
|
||||
if (Tools::getValue('id_cart') && Tools::getValue('process_selection')){
|
||||
$params['id_cart'] = 0;
|
||||
$tmp_cart = new Cart(Tools::getValue('id_cart'));
|
||||
if ($tmp_cart->id_customer == (int) Context::getContext()->customer->id)
|
||||
$params['id_cart'] = $tmp_cart->id;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
@ -87,6 +87,12 @@ class MRGetRelayPoint implements IMondialRelayWSMethod
|
||||
|
||||
public function __construct($params, $object)
|
||||
{
|
||||
if(isset($params['action'])) {
|
||||
$this->_action = $params['action'];
|
||||
}
|
||||
if(isset($params['taille'])) {
|
||||
$this->_taille = $params['taille'];
|
||||
}
|
||||
$this->_mondialRelay = $object;
|
||||
$this->_id_address_delivery = (int)($params['id_address_delivery']);
|
||||
$this->_id_carrier = (int)($params['id_carrier']);
|
||||
@ -107,7 +113,13 @@ class MRGetRelayPoint implements IMondialRelayWSMethod
|
||||
|
||||
if (!$address)
|
||||
throw new Exception($this->_mondialrelay->l('Customer address can\'t be found'));
|
||||
|
||||
|
||||
if(isset($this->_action)) {
|
||||
$this->_fields['list']['Action']['value'] = $this->_action;
|
||||
}
|
||||
if(isset($this->_taille)) {
|
||||
$this->_fields['list']['Taille']['value'] = $this->_taille;
|
||||
}
|
||||
$this->_fields['list']['Enseigne']['value'] = $this->_mondialRelay->account_shop['MR_ENSEIGNE_WEBSERVICE'];
|
||||
$this->_fields['list']['Poids']['value'] = ($weight < 100) ? 100 : $weight;
|
||||
$this->_fields['list']['Pays']['value'] = trim(Country::getIsoById($address->id_country));
|
||||
|
@ -72,8 +72,8 @@ class MRRelayDetail implements IMondialRelayWSMethod
|
||||
|
||||
$this->_relayPointNumList = $params['relayPointNumList'];
|
||||
$this->_id_address_delivery = (int)($params['id_address_delivery']);
|
||||
$this->_webServiceKey = $this->_mondialRelay->account_shop['MR_KEY_WEBSERVICE'];
|
||||
$this->_markCode = $this->_mondialRelay->account_shop['MR_CODE_MARQUE'];
|
||||
$this->_webServiceKey = $this->_mondialrelay->account_shop['MR_KEY_WEBSERVICE'];
|
||||
$this->_markCode = $this->_mondialrelay->account_shop['MR_CODE_MARQUE'];
|
||||
$this->_webserviceURL = MondialRelay::MR_URL.'webservice/Web_Services.asmx?WSDL';
|
||||
}
|
||||
|
||||
@ -88,8 +88,8 @@ class MRRelayDetail implements IMondialRelayWSMethod
|
||||
|
||||
if (!$address)
|
||||
throw new Exception($this->_mondialrelay->l('Customer address can\'t be found'));
|
||||
|
||||
$this->_fields['list']['Enseigne']['value'] = $this->_mondialRelay->account_shop['MR_ENSEIGNE_WEBSERVICE'];
|
||||
|
||||
$this->_fields['list']['Enseigne']['value'] = $this->_mondialrelay->account_shop['MR_ENSEIGNE_WEBSERVICE'];
|
||||
$this->_fields['list']['Pays']['value'] = Country::getIsoById($address->id_country);
|
||||
|
||||
foreach ($this->_relayPointNumList as $num)
|
||||
@ -188,13 +188,13 @@ class MRRelayDetail implements IMondialRelayWSMethod
|
||||
foreach ($HDayList as $day => $tradDayName)
|
||||
{
|
||||
$mr_day = $result->{$day};
|
||||
foreach ($mr_day['string'] as &$value)
|
||||
foreach ($mr_day->string as &$value)
|
||||
if ($value == '0000')
|
||||
$value = '';
|
||||
else
|
||||
$value = implode('h', str_split($value, 2));
|
||||
$orderedDate[$priority++] = array('name' => $tradDayName, 'list' => $mr_day);
|
||||
unset($result[$day]);
|
||||
unset($result->{$day});
|
||||
}
|
||||
$result->orderedDate = $orderedDate;
|
||||
$this->_resultList['success'][$result->Num] = $result;
|
||||
|
@ -33,7 +33,7 @@ var Widgets = Widgets || function () {
|
||||
bounds: null,
|
||||
map: null,
|
||||
overlays: [],
|
||||
infowindows: [],
|
||||
infowindows: [],
|
||||
InfoWindow: null,
|
||||
container: null,
|
||||
callback: null,
|
||||
@ -51,11 +51,19 @@ var Widgets = Widgets || function () {
|
||||
paramList += paramArray[i] + '=' + paramArray[i + 1] + '&';
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================
|
||||
// CORRECTION PROFILEO
|
||||
// =======================================
|
||||
$.getJSON(private.protocol + private.sw_url + '/' + fn + '?' + paramList + 'method=?', callbackFn);
|
||||
|
||||
// =======================================
|
||||
// CORRECTION PROFILEO
|
||||
// =======================================
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: private.protocol + private.sw_url + '/' + fn + '?' + paramList + 'method=?',
|
||||
dataType: 'json',
|
||||
headers: {
|
||||
'Accept-Language': 'fr-fr'
|
||||
},
|
||||
success: callbackFn
|
||||
});
|
||||
},
|
||||
|
||||
loadhtml: function (container, urlraw, callback) {
|
||||
@ -65,14 +73,14 @@ var Widgets = Widgets || function () {
|
||||
private.container = container;
|
||||
private.callback = callback;
|
||||
private.jsonpcall(private.ashx, ['downloadurl', escape(url)],
|
||||
function (msg) {
|
||||
// gets the contents of the Html in the 'msg'
|
||||
// todo: apply selector
|
||||
private.container.html(msg);
|
||||
if ($.isFunction(private.callback)) {
|
||||
private.callback();
|
||||
}
|
||||
});
|
||||
function (msg) {
|
||||
// gets the contents of the Html in the 'msg'
|
||||
// todo: apply selector
|
||||
private.container.html(msg);
|
||||
if ($.isFunction(private.callback)) {
|
||||
private.callback();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Manage_Response: function (result, container, Target, TargetDisplay, TargetDisplayInfoPR) {
|
||||
@ -94,15 +102,15 @@ var Widgets = Widgets || function () {
|
||||
// Ajout d'un marker pour chaque Point Relais
|
||||
|
||||
private.MR_AddGmapMarker(
|
||||
private.map,
|
||||
new google.maps.LatLng(result.PRList[i].Lat.replace(',', '.'), result.PRList[i].Long.replace(',', '.')),
|
||||
result.PRList[i],
|
||||
i,
|
||||
private.sw_url,
|
||||
Target,
|
||||
TargetDisplay,
|
||||
TargetDisplayInfoPR
|
||||
);
|
||||
private.map,
|
||||
new google.maps.LatLng(result.PRList[i].Lat.replace(',', '.'), result.PRList[i].Long.replace(',', '.')),
|
||||
result.PRList[i],
|
||||
i,
|
||||
private.sw_url,
|
||||
Target,
|
||||
TargetDisplay,
|
||||
TargetDisplayInfoPR
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@ -166,10 +174,10 @@ var Widgets = Widgets || function () {
|
||||
var a9 = private.params.VacationAfter || '';
|
||||
|
||||
private.jsonpcall(private.w_name + "/" + private.svc + "/SearchPR",
|
||||
["Brand", a0, "Country", a1, "PostCode", a2, "ColLivMod", a3, "Weight", a4, "NbResults", a5, "SearchDelay", a6, "SearchFar", a7, "ClientContainerId", private.containerId, "VacationBefore", a8, "VacationAfter", a9],
|
||||
function (result) {
|
||||
private.Manage_Response(result, container, Target, TargetDisplay, TargetDisplayInfoPR);
|
||||
});
|
||||
["Brand", a0, "Country", a1, "PostCode", a2, "ColLivMod", a3, "Weight", a4, "NbResults", a5, "SearchDelay", a6, "SearchFar", a7, "ClientContainerId", private.containerId, "VacationBefore", a8, "VacationAfter", a9],
|
||||
function (result) {
|
||||
private.Manage_Response(result, container, Target, TargetDisplay, TargetDisplayInfoPR);
|
||||
});
|
||||
},
|
||||
MR_LoadMap: function (prms) {
|
||||
var myOptions = {
|
||||
@ -186,7 +194,7 @@ var Widgets = Widgets || function () {
|
||||
private.map = new google.maps.Map(document.getElementById('MRW-Map'), myOptions);
|
||||
private.bounds = new google.maps.LatLngBounds();
|
||||
private.overlays = [];
|
||||
private.infowindows = [];
|
||||
private.infowindows = [];
|
||||
},
|
||||
MR_clearOverlays: function () {
|
||||
for (var n = 0, overlay; overlay = private.overlays[n]; n++) {
|
||||
@ -194,7 +202,7 @@ var Widgets = Widgets || function () {
|
||||
}
|
||||
// Clear overlays from collection
|
||||
private.overlays = [];
|
||||
private.infowindows = [];
|
||||
private.infowindows = [];
|
||||
private.bounds = new google.maps.LatLngBounds();
|
||||
},
|
||||
MR_FocusOnMaker: function (id) {
|
||||
@ -222,17 +230,17 @@ var Widgets = Widgets || function () {
|
||||
google.maps.event.addListener(marker, 'click', function () {
|
||||
// Fermeture de la fenêtre précédente
|
||||
for(i in private.infowindows)
|
||||
if(private.infowindows[i] != null)
|
||||
private.infowindows[i].close();
|
||||
if(private.infowindows[i] != null)
|
||||
private.infowindows[i].close();
|
||||
|
||||
private.InfoWindow = new google.maps.InfoWindow({
|
||||
content: private.MR_BuildparcelShopDetails(PRI)
|
||||
});
|
||||
|
||||
private.InfoWindow = new google.maps.InfoWindow({
|
||||
content: private.MR_BuildparcelShopDetails(PRI)
|
||||
});
|
||||
|
||||
private.InfoWindow.open(private.map, marker);
|
||||
|
||||
private.infowindows.push(private.InfoWindow);
|
||||
|
||||
|
||||
private.infowindows.push(private.InfoWindow);
|
||||
|
||||
private.map.setCenter(marker.getPosition());
|
||||
});
|
||||
|
||||
@ -267,18 +275,18 @@ var Widgets = Widgets || function () {
|
||||
|
||||
MR_BuildparcelShopDetails: function (PRI) {
|
||||
var content = '<div class="InfoWindow">'
|
||||
+ '<div class="PR-Name">' + PRI.Nom + '</div>'
|
||||
+ '<div class="Tabs-Btns">'
|
||||
+ '<span class="Tabs-Btn Tabs-Btn-Selected" id="btn_01" onclick="$(\'#' + private.containerId + '\').trigger(\'TabSelect\',\'01\');">Info</span>'
|
||||
+ '<span class="Tabs-Btn" id="btn_02" onclick="$(\'#' + private.containerId + '\').trigger(\'TabSelect\',\'02\');">Photo</span>'
|
||||
+ '</div>'
|
||||
+ '<div class="Tabs-Tabs">'
|
||||
+ '<div class="Tabs-Tab Tabs-Tab-Selected" id="tab_01">' + PRI.HoursHtmlTable + '</div>'
|
||||
+ '<div class="Tabs-Tab" id="tab_02">'
|
||||
+ '<img src="' + private.protocol + private.img_url + '/img/dynamique/pr.aspx?id=' + PRI.Pays + private.MR_pad_left(PRI.ID, '0', 6) + '" width="182" height="112"/>'
|
||||
+ '</div>'
|
||||
+ '</div>'
|
||||
+ '</div>'
|
||||
+ '<div class="PR-Name">' + PRI.Nom + '</div>'
|
||||
+ '<div class="Tabs-Btns">'
|
||||
+ '<span class="Tabs-Btn Tabs-Btn-Selected" id="btn_01" onclick="$(\'#' + private.containerId + '\').trigger(\'TabSelect\',\'01\');">Info</span>'
|
||||
+ '<span class="Tabs-Btn" id="btn_02" onclick="$(\'#' + private.containerId + '\').trigger(\'TabSelect\',\'02\');">Photo</span>'
|
||||
+ '</div>'
|
||||
+ '<div class="Tabs-Tabs">'
|
||||
+ '<div class="Tabs-Tab Tabs-Tab-Selected" id="tab_01">' + PRI.HoursHtmlTable + '</div>'
|
||||
+ '<div class="Tabs-Tab" id="tab_02">'
|
||||
+ '<img src="' + private.protocol + private.img_url + '/img/dynamique/pr.aspx?id=' + PRI.Pays + private.MR_pad_left(PRI.ID, '0', 6) + '" width="182" height="112"/>'
|
||||
+ '</div>'
|
||||
+ '</div>'
|
||||
+ '</div>'
|
||||
return content;
|
||||
},
|
||||
MR_loadjscssfile: function (filename, filetype) {
|
||||
@ -367,26 +375,26 @@ var Widgets = Widgets || function () {
|
||||
container.find('.PR-AutoCplCity').css("left", (this.offsetLeft) + "px");
|
||||
|
||||
private.jsonpcall(private.w_name + "/" + private.svc + "/AutoCPLCity",
|
||||
["PostCode", a2, "Country", a1, "City", ia0],
|
||||
function (result) {
|
||||
container.find('.PR-AutoCplCity').html("");
|
||||
["PostCode", a2, "Country", a1, "City", ia0],
|
||||
function (result) {
|
||||
container.find('.PR-AutoCplCity').html("");
|
||||
|
||||
for (var i = 0; i < result.Value.length; i++) {
|
||||
var elm = $("<div>");
|
||||
elm.attr("title", result.Value[i].PostCode);
|
||||
elm.attr("name", result.Value[i].Name);
|
||||
elm.addClass("PR-City");
|
||||
for (var i = 0; i < result.Value.length; i++) {
|
||||
var elm = $("<div>");
|
||||
elm.attr("title", result.Value[i].PostCode);
|
||||
elm.attr("name", result.Value[i].Name);
|
||||
elm.addClass("PR-City");
|
||||
|
||||
elm.html(result.Value[i].Name + " (" + result.Value[i].PostCode + ")");
|
||||
container.find('.PR-AutoCplCity').append(elm);
|
||||
elm.click(function () {
|
||||
container.find('input.Arg2')[0].value = $(this).attr("title");
|
||||
container.find('input.iArg0')[0].value = $(this).attr("name");
|
||||
container.find('.PR-AutoCplCity').html("").slideUp("fast");
|
||||
});
|
||||
}
|
||||
container.find('.PR-AutoCplCity').slideDown("fast");
|
||||
});
|
||||
elm.html(result.Value[i].Name + " (" + result.Value[i].PostCode + ")");
|
||||
container.find('.PR-AutoCplCity').append(elm);
|
||||
elm.click(function () {
|
||||
container.find('input.Arg2')[0].value = $(this).attr("title");
|
||||
container.find('input.iArg0')[0].value = $(this).attr("name");
|
||||
container.find('.PR-AutoCplCity').html("").slideUp("fast");
|
||||
});
|
||||
}
|
||||
container.find('.PR-AutoCplCity').slideDown("fast");
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@ -481,7 +489,7 @@ var Widgets = Widgets || function () {
|
||||
}
|
||||
private.container = Div;
|
||||
private.loadhtml(private.container, private.protocol + private.sw_url + "/" + private.w_name + "/services/widget.v2.0.0.aspx?allowedCountries=" + settings.AllowedCountries + "&Country=" + settings.Country + "&UseSSL=" + settings.UseSSL,
|
||||
function () { private.MR_Widget_Init(private.container, settings); });
|
||||
function () { private.MR_Widget_Init(private.container, settings); });
|
||||
|
||||
return this;
|
||||
},
|
||||
|
@ -1176,7 +1176,6 @@ var PS_MRObject = (function($, undefined) {
|
||||
// Hide MR input if one of them is not selected
|
||||
if($(e).val() == carrier_selected)
|
||||
{
|
||||
console.log(carrier_selected);
|
||||
if(MR_carrier != false) {
|
||||
PS_MRCarrierMethodList[MR_idcarrier] = MR_carrier.id_mr_method;
|
||||
PS_MRSelectedRelayPoint['carrier_id'] = MR_idcarrier;
|
||||
|
@ -255,4 +255,11 @@
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if ($('input[name="id_carrier"]').length) {
|
||||
var _tmp_id_carrier = $('input[name="id_carrier"]').val();
|
||||
if ($('#id_carrier' + parseInt(_tmp_id_carrier)).length) {
|
||||
$('#id_carrier' + parseInt(_tmp_id_carrier)).click();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -74,9 +74,10 @@ class MondialRelay extends Module
|
||||
$this->tab = 'shipping_logistics';
|
||||
$this->version = '2.1.3';
|
||||
$this->installed_version = '';
|
||||
// $this->module_key = '366584e511d311cfaa899fc2d9ec1bd0';
|
||||
$this->author = 'PrestaShop';
|
||||
|
||||
$this->url = 'http://'.htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'modules/'.$this->name;
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Mondial Relay');
|
||||
@ -204,6 +205,8 @@ class MondialRelay extends Module
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
return false;
|
||||
|
||||
if (!parent::uninstall())
|
||||
return false;
|
||||
|
||||
@ -430,6 +433,45 @@ class MondialRelay extends Module
|
||||
}
|
||||
}
|
||||
|
||||
public function hookAdminOrder($params) {
|
||||
if(!Mondialrelay::isMondialRelayCarrier(Db::getInstance()->getValue('
|
||||
SELECT `id_carrier`
|
||||
FROM `'._DB_PREFIX_.'orders`
|
||||
WHERE `id_order` = '.(int) $params['id_order'].'
|
||||
'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
$id_cart = (int) Db::getInstance()->getValue('
|
||||
SELECT `id_cart`
|
||||
FROM `'._DB_PREFIX_.'orders`
|
||||
WHERE `id_order` = '.(int) $params['id_order'].'
|
||||
');
|
||||
|
||||
$info = Db::getInstance()->getRow('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'mr_selected` s
|
||||
INNER JOIN `'._DB_PREFIX_.'mr_method` m
|
||||
ON m.`id_mr_method` = s.`id_method`
|
||||
WHERE `id_cart` = '.(int) $id_cart.'
|
||||
');
|
||||
|
||||
$this->smarty->assign(array(
|
||||
'mondialrelay_delivery_address' => $info,
|
||||
'mondialrelay_logo' => $this->url.'/logo_64.png',
|
||||
'mondialrelay_recipient' => Db::getInstance()->getRow('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'address` a
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o
|
||||
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>',
|
||||
));
|
||||
|
||||
return $this->fetchTemplate('/views/templates/admin/', 'admin_order');
|
||||
}
|
||||
|
||||
public function hookOrderDetailDisplayed($params)
|
||||
{
|
||||
if (!Mondialrelay::isMondialRelayCarrier($params['order']->id_carrier))
|
||||
@ -536,8 +578,8 @@ class MondialRelay extends Module
|
||||
LEFT JOIN `'._DB_PREFIX_.'mr_method_shop` ms
|
||||
ON m.`id_mr_method` = ms.`id_mr_method`
|
||||
WHERE c.`deleted` = 0
|
||||
AND ms.`id_shop` = '.$this->account_shop['id_shop'].'
|
||||
AND cl.id_lang = '.$this->context->language->id.'
|
||||
AND ms.`id_shop` = '.(int) $this->account_shop['id_shop'].'
|
||||
AND cl.id_lang = '.(int) $this->context->language->id.'
|
||||
AND c.`active` = 1
|
||||
AND m.`is_deleted` = 0';
|
||||
|
||||
@ -577,10 +619,7 @@ class MondialRelay extends Module
|
||||
if (in_array($file, array('order-opc', 'order', 'orderopc')))
|
||||
{
|
||||
|
||||
$mr_valid_steps = array(2,3);
|
||||
if (Tools::display_cart_v2()){
|
||||
$mr_valid_steps = array(1,2,3);
|
||||
}
|
||||
$mr_valid_steps = array(1,2,3);
|
||||
|
||||
if (!Tools::getValue('step') ||
|
||||
!in_array((int) Tools::getValue('step'), $mr_valid_steps))
|
||||
@ -591,30 +630,16 @@ class MondialRelay extends Module
|
||||
global $cookie, $cart;
|
||||
if (isset($cart->id_carrier) && $this->isMondialRelayCarrier($cart->id_carrier)){
|
||||
$mr_selected = Db::getInstance()->getRow('SELECT * FROM `' . _DB_PREFIX_ . 'mr_selected` WHERE `id_cart` = ' . (int) $cart->id);
|
||||
if (!$mr_selected || !$mr_selected['MR_Selected_Num']){
|
||||
if (Tools::display_cart_v2())
|
||||
Tools::redirect('order.php?step=1&no_mr_selected=1');
|
||||
else
|
||||
Tools::redirect('order.php?step=2&no_mr_selected=1');
|
||||
if (!$mr_selected || !$mr_selected['MR_Selected_Num'])
|
||||
{
|
||||
Tools::redirect('order.php?step=1&no_mr_selected=1');
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
if (Tools::display_cart_v2()){
|
||||
if (!in_array((int) Tools::getValue('step'), array(1,2)))
|
||||
if (!in_array((int) Tools::getValue('step'), array(1,2)))
|
||||
return '';
|
||||
}
|
||||
else{
|
||||
if ((int) Tools::getValue('step') != 2)
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
// if (!Tools::getValue('id_address_delivery') ||
|
||||
// !Tools::getValue('step') ||
|
||||
// Tools::getValue('step') != 2)
|
||||
// return '';
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'one_page_checkout' => (Configuration::get('PS_ORDER_PROCESS_TYPE') ? Configuration::get('PS_ORDER_PROCESS_TYPE') : 0),
|
||||
@ -632,9 +657,8 @@ class MondialRelay extends Module
|
||||
'addJsInTemplate' => true
|
||||
));
|
||||
|
||||
if (Tools::display_cart_v2()){
|
||||
return $this->fetchTemplate('/views/templates/front/', 'header_widget');
|
||||
}
|
||||
|
||||
return $this->fetchTemplate('/views/templates/front/', 'header_widget');
|
||||
|
||||
if (Configuration::get('MONDIAL_RELAY_MODE') == 'widget' && !_PS_MOBILE_)
|
||||
return $this->fetchTemplate('/views/templates/front/', 'header_widget');
|
||||
@ -661,6 +685,22 @@ class MondialRelay extends Module
|
||||
if (!MondialRelay::isAccountSet())
|
||||
return '';
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'one_page_checkout' => (Configuration::get('PS_ORDER_PROCESS_TYPE') ? Configuration::get('PS_ORDER_PROCESS_TYPE') : 0),
|
||||
'new_base_dir' => '/modules/mondialrelay/',
|
||||
'MR_local_path' => MondialRelay::$modulePath,
|
||||
'MRToken' => MondialRelay::$MRFrontToken,
|
||||
'MR_MONDIAL_RELAY_MODE' => Configuration::get('MONDIAL_RELAY_MODE'),
|
||||
)
|
||||
);
|
||||
|
||||
global $smarty;
|
||||
$smarty->assign('gmap_loaded', TRUE);
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'addJsInTemplate' => true
|
||||
));
|
||||
|
||||
$id_carrier = false;
|
||||
$preSelectedRelay = $this->getRelayPointSelected($this->context->cart->id);
|
||||
$carriersList = MondialRelay::_getCarriers();
|
||||
@ -668,9 +708,26 @@ class MondialRelay extends Module
|
||||
$country = new Country($address->id_country);
|
||||
$id_zone = Address::getZoneById((int)($address->id));
|
||||
|
||||
$cart_weight = $this->context->cart->getTotalWeight();
|
||||
|
||||
/* Check if the defined carrier are ok */
|
||||
$change_modes = array();
|
||||
|
||||
foreach ($carriersList as $k => $row)
|
||||
{
|
||||
if($row['dlv_mode'] == '24L' && $cart_weight >= 50)
|
||||
{
|
||||
$change_modes[$k] = '24X';
|
||||
}
|
||||
elseif($row['dlv_mode'] == '24R')
|
||||
{
|
||||
if($cart_weight >= 50) {
|
||||
$change_modes[$k] = '24X';
|
||||
} elseif($cart_weight >= 30) {
|
||||
$change_modes[$k] = '24L';
|
||||
}
|
||||
}
|
||||
|
||||
/* For now works only with single shipping (>= 1.5 compatibility) */
|
||||
if (method_exists($this->context->cart, 'carrierIsSelected'))
|
||||
{
|
||||
@ -697,12 +754,31 @@ class MondialRelay extends Module
|
||||
}
|
||||
}
|
||||
|
||||
foreach($change_modes as $k => $v) {
|
||||
if(isset($carriersList[$k])) {
|
||||
$carriersList[$k]['dlv_mode'] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
$carrier = null;
|
||||
if ($id_carrier && ($method = MondialRelay::getMethodByIdCarrier($id_carrier)))
|
||||
{
|
||||
$carrier = new Carrier((int)$id_carrier);
|
||||
/* Add dynamically a new field */
|
||||
$carrier->id_mr_method = $method['id_mr_method'];
|
||||
if($method['dlv_mode'] == '24L' && $cart_weight >= 50)
|
||||
{
|
||||
$method['dlv_mode'] = '24X';
|
||||
}
|
||||
elseif($method['dlv_mode'] == '24R')
|
||||
{
|
||||
if($cart_weight >= 50) {
|
||||
$method['dlv_mode'] = '24X';
|
||||
} elseif($cart_weight >= 30) {
|
||||
$method['dlv_mode'] = '24L';
|
||||
}
|
||||
}
|
||||
|
||||
$carrier->mr_dlv_mode = $method['dlv_mode'];
|
||||
}
|
||||
|
||||
@ -788,7 +864,7 @@ class MondialRelay extends Module
|
||||
$this->_postErrors[] = $this->l('Invalid carrier name');
|
||||
if (Tools::getValue('mr_ModeCol') != 'CCC')
|
||||
$this->_postErrors[] = $this->l('Invalid Col mode');
|
||||
if (!preg_match('#^REL|24R|ESP|DRI|LDS|LDR|LD1|HOM$#', Tools::getValue('mr_ModeLiv')))
|
||||
if (!preg_match('#^REL|24R|24L|24X|ESP|DRI|LDS|LDR|LD1|HOM$#', Tools::getValue('mr_ModeLiv')))
|
||||
$this->_postErrors[] = $this->l('Invalid delivery mode');
|
||||
if (!Validate::isInt(Tools::getValue('mr_ModeAss')) || Tools::getValue('mr_ModeAss') > 5 || Tools::getValue('mr_ModeAss') < 0)
|
||||
$this->_postErrors[] = $this->l('Invalid Assurance mode');
|
||||
@ -831,6 +907,15 @@ class MondialRelay extends Module
|
||||
|
||||
if (Tools::isSubmit('submitAdvancedSettings'))
|
||||
Configuration::updateValue('MONDIAL_RELAY_MODE', Tools::getValue('mode', 'widget'));
|
||||
elseif(Tools::isSubmit('submitSizeSettings'))
|
||||
{
|
||||
$mrSizeSettings = array(
|
||||
'24R' => Tools::getValue('24R'),
|
||||
'24L' => Tools::getValue('24L'),
|
||||
'24X' => Tools::getValue('24X')
|
||||
);
|
||||
Configuration::updateValue('MONDIAL_RELAY_SIZE_SETTINGS', Tools::jsonEncode($mrSizeSettings));
|
||||
}
|
||||
else if (Tools::isSubmit('submit_account_detail'))
|
||||
{
|
||||
$this->account_shop = array(
|
||||
@ -898,7 +983,7 @@ class MondialRelay extends Module
|
||||
'MR_enseigne_webservice' => Tools::getValue('MR_enseigne_webservice') ? Tools::getValue('MR_enseigne_webservice') : $this->account_shop['MR_ENSEIGNE_WEBSERVICE'],
|
||||
'MR_code_marque' => Tools::getValue('MR_code_marque') ? Tools::getValue('MR_code_marque') : $this->account_shop['MR_CODE_MARQUE'],
|
||||
'MR_webservice_key' => Tools::getValue('MR_webservice_key') ? Tools::getValue('MR_webservice_key') : $this->account_shop['MR_KEY_WEBSERVICE'],
|
||||
'MR_available_languages' => Language::getLanguages(),
|
||||
'MR_available_languages' => Language::getLanguages(FALSE),
|
||||
'MR_selected_language' => $this->account_shop['MR_LANGUAGE'],
|
||||
'MR_weight_coefficient' => Tools::getValue('MR_weight_coefficient') ? Tools::getValue('MR_weight_coefficient') : $this->account_shop['MR_WEIGHT_COEFFICIENT'],
|
||||
'MR_PS_WEIGHT_UNIT' => Configuration::get('PS_WEIGHT_UNIT'),
|
||||
@ -918,7 +1003,8 @@ class MondialRelay extends Module
|
||||
'MR_account_set' => MondialRelay::isAccountSet(),
|
||||
'MR_base_dir' => MondialRelay::$moduleURL,
|
||||
'MR_MONDIAL_RELAY_MODE' => Configuration::get('MONDIAL_RELAY_MODE'),
|
||||
)
|
||||
'MR_size' => Tools::jsonDecode(Configuration::get('MONDIAL_RELAY_SIZE_SETTINGS'), TRUE),
|
||||
)
|
||||
);
|
||||
return $this->fetchTemplate('/views/templates/admin/', 'configuration');
|
||||
}
|
||||
@ -1003,6 +1089,8 @@ class MondialRelay extends Module
|
||||
/* Default Range value depending of the delivery mode */
|
||||
$range_weight = array(
|
||||
'24R' => array(0, 30000 / $weight_coef),
|
||||
'24L' => array(0, 50000 / $weight_coef),
|
||||
'24X' => array(0, 130000 / $weight_coef),
|
||||
'DRI' => array(30000 / $weight_coef, 130000 / $weight_coef),
|
||||
'LD1' => array(0, 60000 / $weight_coef),
|
||||
'HOM' => array(0, 60000 / $weight_coef),
|
||||
@ -1013,7 +1101,7 @@ class MondialRelay extends Module
|
||||
if (!Db::getInstance()->execute(
|
||||
'INSERT INTO `'._DB_PREFIX_.'range_weight`
|
||||
(`id_carrier`, `delimiter1`, `delimiter2`)
|
||||
VALUES ('.(int)$id_carrier.', '.$range_weight[$dlv_mode][0].', '.$range_weight[$dlv_mode][1].')'))
|
||||
VALUES ('.(int)$id_carrier.', '.(float) $range_weight[$dlv_mode][0].', '.(float) $range_weight[$dlv_mode][1].')'))
|
||||
{
|
||||
$this->_postErrors[] = $this->l('Range weight can\'t be added');
|
||||
return false;
|
||||
@ -1096,7 +1184,7 @@ class MondialRelay extends Module
|
||||
$values = array();
|
||||
foreach ($fields as $key => $value)
|
||||
{
|
||||
$keys[] = '`'.str_replace('MR_', '', $key).'`';
|
||||
$keys[] = '`'.str_replace('MR_', '', MRTools::bqSQL($key)).'`';
|
||||
$values[] = '\''.(is_array($value) ? pSQL(implode(',', $value)) : pSQL($value)).'\'';
|
||||
}
|
||||
$query = sprintf($query, implode(',', $keys), implode(',', $values));
|
||||
|
@ -102,11 +102,6 @@
|
||||
<b>{l s='For further information please see the FAQ section of our website:' mod='mondialrelay'}</b>
|
||||
<br /><a href="http://www.mondialrelay.fr/public/mr_faq.aspx" target="_blank" style="color:#CA0046;">http://www.mondialrelay.fr</a>
|
||||
</li>
|
||||
<!--li style="float:left; width:320px;">
|
||||
<div style="text-align:center;">
|
||||
<img src="http://www.mondialrelay.fr/img/FR/BLOCCPourtoi_FR.gif"/>
|
||||
</div>
|
||||
</li//-->
|
||||
</ul>
|
||||
<br clear="all" />
|
||||
</fieldset>
|
||||
@ -239,6 +234,114 @@
|
||||
</ul>
|
||||
</fieldset>
|
||||
|
||||
<input type="hidden" name="MR_tab_name" value="settings_form" />
|
||||
</form>
|
||||
<br />
|
||||
<form action="{$smarty.server.REQUEST_URI|escape:'htmlall':'UTF-8'}" method="post" >
|
||||
<fieldset class="PS_MRFormSizeSettings">
|
||||
<legend>
|
||||
<img src="../modules/mondialrelay/img/logo.gif" />{l s='Size Settings' mod='mondialrelay'}
|
||||
</legend>
|
||||
<p>{l s='Set MondialRelay product size limits for each delivery mode' mod='mondialrelay'}<br/>
|
||||
{l s='Le mode de livraison sera choisi pour le transporteur MondialRelay si au moins une des dimensions d\'un des produits du panier client dépassent une de limites autorisées' mod='mondialrelay'}<br/>
|
||||
<em>{l s='Ie: if one product width is greatter than ' mod='mondialrelay'}{$MR_size.24L.width}{l s='cm 24L will be choosen for MondialRelay' mod='mondialrelay'}</em></p>
|
||||
<p class="info">{l s='Sizes are in cm and weight in kg.' mod='mondialrelay'}</p>
|
||||
|
||||
<h3>{l s='24R' mod='mondialrelay'}</h3><br/>
|
||||
<label for="24R_width">{l s='24R width' mod='mondialrelay'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="24R_width" name="24R[width]" value="{$MR_size.24R.width}" />
|
||||
</div>
|
||||
<label for="24R_height">{l s='24R height' mod='mondialrelay'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="24R_height" name="24R[height]" value="{$MR_size.24R.height}" />
|
||||
</div>
|
||||
<label for="24R_depth">{l s='24R depth' mod='mondialrelay'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="24R_depth" name="24R[depth]" value="{$MR_size.24R.depth}" />
|
||||
</div>
|
||||
<label for="24R_volume">{l s='24R volume' mod='mondialrelay'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="24R_volume" name="24R[volume]" value="{$MR_size.24R.volume}" /> <span>({l s='width * height * depth' mod='mondialrelay'})</span>
|
||||
</div>
|
||||
<label for="24R_developed">{l s='24R developed' mod='mondialrelay'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="24R_developed" name="24R[developed]" value="{$MR_size.24R.developed}" /> <span>({l s='2x width + 2x height + depth' mod='mondialrelay'})</span>
|
||||
</div>
|
||||
<label for="24R_cumulative">{l s='24R cumulative' mod='mondialrelay'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="24R_cumulative" name="24R[cumulative]" value="{$MR_size.24R.cumulative}" /> <span>({l s='width + height + depth' mod='mondialrelay'})</span>
|
||||
</div>
|
||||
<label for="24R_weight">{l s='24R weight' mod='mondialrelay'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="24R_weight" name="24R[weight]" value="{$MR_size.24R.weight}" />
|
||||
</div>
|
||||
|
||||
<h3>{l s='24L' mod='mondialrelay'}</h3>
|
||||
<br/>
|
||||
<label for="24L_width">{l s='24L width' mod='mondialrelay'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="24L_width" name="24L[width]" value="{$MR_size.24L.width}" />
|
||||
</div>
|
||||
<label for="24L_height">{l s='24L height' mod='mondialrelay'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="24L_height" name="24L[height]" value="{$MR_size.24L.height}" />
|
||||
</div>
|
||||
<label for="24L_depth">{l s='24L depth' mod='mondialrelay'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="24L_depth" name="24L[depth]" value="{$MR_size.24L.depth}" />
|
||||
</div>
|
||||
<label for="24L_volume">{l s='24L volume' mod='mondialrelay'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="24L_volume" name="24L[volume]" value="{$MR_size.24L.volume}" /> <span>({l s='width * height * depth' mod='mondialrelay'})</span>
|
||||
</div>
|
||||
<label for="24L_developed">{l s='24L developed' mod='mondialrelay'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="24L_developed" name="24L[developed]" value="{$MR_size.24L.developed}" /> <span>({l s='2x width + 2x height + depth' mod='mondialrelay'})</span>
|
||||
</div>
|
||||
<label for="24L_cumulative">{l s='24L cumulative' mod='mondialrelay'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="24L_cumulative" name="24L[cumulative]" value="{$MR_size.24L.cumulative}" /> <span>({l s='width + height + depth' mod='mondialrelay'})</span>
|
||||
</div>
|
||||
<label for="24L_weight">{l s='24L weight' mod='mondialrelay'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="24L_weight" name="24L[weight]" value="{$MR_size.24L.weight}" />
|
||||
</div>
|
||||
|
||||
<h3>{l s='24X' mod='mondialrelay'}</h3>
|
||||
<br/>
|
||||
<label for="24X_width">{l s='24X width' mod='mondialrelay'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="24X_width" name="24X[width]" value="{$MR_size.24X.width}" />
|
||||
</div>
|
||||
<label for="24X_height">{l s='24X height' mod='mondialrelay'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="24X_height" name="24X[height]" value="{$MR_size.24X.height}" />
|
||||
</div>
|
||||
<label for="24X_depth">{l s='24X depth' mod='mondialrelay'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="24X_depth" name="24X[depth]" value="{$MR_size.24X.depth}" />
|
||||
</div>
|
||||
<label for="24X_volume">{l s='24X volume' mod='mondialrelay'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="24X_volume" name="24X[volume]" value="{$MR_size.24X.volume}" /> <span>({l s='width * height * depth' mod='mondialrelay'})</span>
|
||||
</div>
|
||||
<label for="24X_developed">{l s='24X developed' mod='mondialrelay'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="24X_developed" name="24X[developed]" value="{$MR_size.24X.developed}" /> <span>({l s='2x width + 2x height + depth' mod='mondialrelay'})</span>
|
||||
</div>
|
||||
<label for="24X_cumulative">{l s='24X cumulative' mod='mondialrelay'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="24X_cumulative" name="24X[cumulative]" value="{$MR_size.24X.cumulative}" /> <span>({l s='width + height + depth' mod='mondialrelay'})</span>
|
||||
</div>
|
||||
<label for="24X_weight">{l s='24X weight' mod='mondialrelay'}</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="24X_weight" name="24X[weight]" value="{$MR_size.24X.weight}" />
|
||||
</div>
|
||||
|
||||
<p class="center"><input type="submit" name="submitSizeSettings" value="{l s='Update Size Settings' mod='mondialrelay'}" class="button" /></p>
|
||||
</fieldset>
|
||||
|
||||
<input type="hidden" name="MR_tab_name" value="settings_form" />
|
||||
</form>
|
||||
</div>
|
||||
@ -267,6 +370,8 @@
|
||||
<label for="MR_dlv_mode" class="shipLabel">{l s='Delivery mode' mod='mondialrelay'}</label>
|
||||
<select name="MR_dlv_mode" id="MR_dlv_mode" style="width:200px">
|
||||
<option value="24R">24R : {l s='Delivery to a relay point' mod='mondialrelay'}</option>
|
||||
<option value="24L">24L : {l s='Delivery to a relay point XL' mod='mondialrelay'}</option>
|
||||
<option value="24X">24X : {l s='Delivery to a relay point XXL' mod='mondialrelay'}</option>
|
||||
<option value="DRI">DRI : {l s='Colis Drive delivery' mod='mondialrelay'}</option>
|
||||
<option value="LD1">LD1 : {l s='Home delivery RDC (1 person)' mod='mondialrelay'}</option>
|
||||
<option value="LDS">LDS : {l s='Special Home delivery (2 persons)' mod='mondialrelay'}</option>
|
||||
|
Loading…
Reference in New Issue
Block a user