Version Notes
Corrige le cas où un accent se trouve dans la ville de l'expéditeur (merci Antoine).
En mode debug, ajoute les paramètres d'appel au web service au message d'erreur.
Facilitation de l'adaptation aux thèmes tiers et aux anciens navigateurs (merci Yannick)
Correction d'un bug provoquant la création d'une entrée indésirable dans la table sales_flat_order_address (merci Jean-Yves)
Corrige la disparition des points relais lors de la réouverture du formulaire de sélection sur carte
Download this release
Release Info
Developer | Emmanuel Catrysse |
Extension | man4x_mondialrelay |
Version | 1.4.4 |
Comparing to | |
See all releases |
Code changes from version 1.4.3 to 1.4.4
- app/code/community/Man4x/MondialRelay/Model/Carrier/Abstract.php +5 -4
- app/code/community/Man4x/MondialRelay/Model/Carrier/_notes/dwsync.xml +4 -0
- app/code/community/Man4x/MondialRelay/Model/Observer.php +10 -3
- app/code/community/Man4x/MondialRelay/etc/_notes/dwsync.xml +4 -0
- app/code/community/Man4x/MondialRelay/etc/config.xml +1 -1
- app/design/frontend/base/default/template/Man4x_MondialRelay/pickuppopup.phtml +57 -82
- app/design/frontend/base/default/template/Man4x_MondialRelay/shippingmethods.phtml +20 -7
- package.xml +9 -5
app/code/community/Man4x/MondialRelay/Model/Carrier/Abstract.php
CHANGED
@@ -532,10 +532,11 @@ class Man4x_MondialRelay_Model_Carrier_Abstract extends Mage_Shipping_Model_Carr
|
|
532 |
// Debugging Log
|
533 |
Mage::helper('mondialrelay')->logDebugData($_params);
|
534 |
}
|
535 |
-
//die(var_dump($_params));
|
536 |
// Web Service Connection
|
537 |
$_client = new SoapClient($this->_getGenericConfigData('url_ws', $order->getStore()));
|
538 |
$_wsResult = $_client->WSI2_CreationExpedition($_params)->WSI2_CreationExpeditionResult;
|
|
|
|
|
539 |
return $_wsResult;
|
540 |
}
|
541 |
|
@@ -572,9 +573,9 @@ class Man4x_MondialRelay_Model_Carrier_Abstract extends Mage_Shipping_Model_Carr
|
|
572 |
'Expe_Ad2' => $_helper->removeAccent($_senderAddress[1]),
|
573 |
'Expe_Ad3' => $_helper->removeAccent($_senderAddress[2]),
|
574 |
'Expe_Ad4' => $_helper->removeAccent($_senderAddress[3]),
|
575 |
-
'Expe_Ville' =>
|
576 |
'Expe_CP' => $this->_getGenericConfigData('sender_postcode', $_store),
|
577 |
-
'Expe_Pays' =>
|
578 |
'Expe_Tel1' => $this->_getGenericConfigData('sender_phone', $_store),
|
579 |
'Expe_Tel2' => $this->_getGenericConfigData('sender_mobile', $_store),
|
580 |
'Expe_Mail' => $this->_getGenericConfigData('sender_email', $_store),
|
@@ -595,7 +596,7 @@ class Man4x_MondialRelay_Model_Carrier_Abstract extends Mage_Shipping_Model_Carr
|
|
595 |
'CRT_Devise' => 'EUR',
|
596 |
'Exp_Valeur' => '0',
|
597 |
'Exp_Devise' => 'EUR',
|
598 |
-
'COL_Rel_Pays' =>
|
599 |
'COL_Rel' => (('CCC' === $this->_getGenericConfigData('collection_mode', $_store)) ? '' : $this->_getGenericConfigData('collection_pickup', $_store)),
|
600 |
'LIV_Rel_Pays' => $order->getShippingAddress()->getCountryId(),
|
601 |
'LIV_Rel' => '0', // Pickup store ID
|
532 |
// Debugging Log
|
533 |
Mage::helper('mondialrelay')->logDebugData($_params);
|
534 |
}
|
|
|
535 |
// Web Service Connection
|
536 |
$_client = new SoapClient($this->_getGenericConfigData('url_ws', $order->getStore()));
|
537 |
$_wsResult = $_client->WSI2_CreationExpedition($_params)->WSI2_CreationExpeditionResult;
|
538 |
+
// We save the WS params in the result for debugging purposes
|
539 |
+
$_wsResult->wsParams = $_params;
|
540 |
return $_wsResult;
|
541 |
}
|
542 |
|
573 |
'Expe_Ad2' => $_helper->removeAccent($_senderAddress[1]),
|
574 |
'Expe_Ad3' => $_helper->removeAccent($_senderAddress[2]),
|
575 |
'Expe_Ad4' => $_helper->removeAccent($_senderAddress[3]),
|
576 |
+
'Expe_Ville' => $_helper->removeAccent($this->_getGenericConfigData('sender_city', $_store)),
|
577 |
'Expe_CP' => $this->_getGenericConfigData('sender_postcode', $_store),
|
578 |
+
'Expe_Pays' => $_helper->removeAccent($this->_getGenericConfigData('sender_country', $_store)),
|
579 |
'Expe_Tel1' => $this->_getGenericConfigData('sender_phone', $_store),
|
580 |
'Expe_Tel2' => $this->_getGenericConfigData('sender_mobile', $_store),
|
581 |
'Expe_Mail' => $this->_getGenericConfigData('sender_email', $_store),
|
596 |
'CRT_Devise' => 'EUR',
|
597 |
'Exp_Valeur' => '0',
|
598 |
'Exp_Devise' => 'EUR',
|
599 |
+
'COL_Rel_Pays' => $_helper->removeAccent($this->_getGenericConfigData('sender_country', $_store)),
|
600 |
'COL_Rel' => (('CCC' === $this->_getGenericConfigData('collection_mode', $_store)) ? '' : $this->_getGenericConfigData('collection_pickup', $_store)),
|
601 |
'LIV_Rel_Pays' => $order->getShippingAddress()->getCountryId(),
|
602 |
'LIV_Rel' => '0', // Pickup store ID
|
app/code/community/Man4x/MondialRelay/Model/Carrier/_notes/dwsync.xml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8" ?>
|
2 |
+
<dwsync>
|
3 |
+
<file name="Abstract.php" local="130335471880000000" remote="130335471880000000" testing="0" />
|
4 |
+
</dwsync>
|
app/code/community/Man4x/MondialRelay/Model/Observer.php
CHANGED
@@ -59,7 +59,8 @@ class Man4x_MondialRelay_Model_Observer
|
|
59 |
$_order->setShippingMethod($_pickupMethod);
|
60 |
|
61 |
// We convert quote address model to order address model
|
62 |
-
$_osAddress = Mage::getModel('Sales/Convert_Quote')->addressToOrderAddress($_address);
|
|
|
63 |
|
64 |
// Shipping address replacement with pick-up data
|
65 |
$_osAddress->setCompany($_selpickup['name'])
|
@@ -69,7 +70,8 @@ class Man4x_MondialRelay_Model_Observer
|
|
69 |
->setCountryId($_selpickup['country_id'])
|
70 |
->setShippingMethod($_pickupMethod);
|
71 |
|
72 |
-
|
|
|
73 |
}
|
74 |
}
|
75 |
}
|
@@ -101,11 +103,16 @@ class Man4x_MondialRelay_Model_Observer
|
|
101 |
$_wsResult = $_carrier->wsRegisterShipment($_order);
|
102 |
if (!property_exists($_wsResult, 'ExpeditionNum'))
|
103 |
{
|
|
|
|
|
|
|
|
|
|
|
104 |
Mage::throwException(
|
105 |
Mage::helper('mondialrelay')->__(
|
106 |
'Mondial Relay shipment error for order #%s (%s)',
|
107 |
$_order->getIncrementId(),
|
108 |
-
|
109 |
)
|
110 |
);
|
111 |
}
|
59 |
$_order->setShippingMethod($_pickupMethod);
|
60 |
|
61 |
// We convert quote address model to order address model
|
62 |
+
// $_osAddress = Mage::getModel('Sales/Convert_Quote')->addressToOrderAddress($_address);
|
63 |
+
$_osAddress = $_address;
|
64 |
|
65 |
// Shipping address replacement with pick-up data
|
66 |
$_osAddress->setCompany($_selpickup['name'])
|
70 |
->setCountryId($_selpickup['country_id'])
|
71 |
->setShippingMethod($_pickupMethod);
|
72 |
|
73 |
+
Mage::helper('checkout/cart')->getQuote()->setShippingAddress($_osAddress);
|
74 |
+
// $_order->setShippingAddress($_osAddress);
|
75 |
}
|
76 |
}
|
77 |
}
|
103 |
$_wsResult = $_carrier->wsRegisterShipment($_order);
|
104 |
if (!property_exists($_wsResult, 'ExpeditionNum'))
|
105 |
{
|
106 |
+
$_errMsg = Mage::helper('mondialrelay')->convertStatToTxt($_wsResult->STAT);
|
107 |
+
if (Mage::getStoreConfig('carriers/mondialrelay/debug_mode', $_order->getStore()))
|
108 |
+
{
|
109 |
+
$_errMsg .= ' [Debug data || ' . print_r($_wsResult->wsParams, true) . ']';
|
110 |
+
}
|
111 |
Mage::throwException(
|
112 |
Mage::helper('mondialrelay')->__(
|
113 |
'Mondial Relay shipment error for order #%s (%s)',
|
114 |
$_order->getIncrementId(),
|
115 |
+
$_errMsg
|
116 |
)
|
117 |
);
|
118 |
}
|
app/code/community/Man4x/MondialRelay/etc/_notes/dwsync.xml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8" ?>
|
2 |
+
<dwsync>
|
3 |
+
<file name="config.xml" local="130309197300000000" remote="130309197300000000" testing="0" />
|
4 |
+
</dwsync>
|
app/code/community/Man4x/MondialRelay/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Man4x_MondialRelay>
|
5 |
-
<version>1.4.
|
6 |
<depends>
|
7 |
<Mage_Adminhtml />
|
8 |
<Mage_Shipping />
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Man4x_MondialRelay>
|
5 |
+
<version>1.4.4</version>
|
6 |
<depends>
|
7 |
<Mage_Adminhtml />
|
8 |
<Mage_Shipping />
|
app/design/frontend/base/default/template/Man4x_MondialRelay/pickuppopup.phtml
CHANGED
@@ -22,10 +22,13 @@
|
|
22 |
|
23 |
<script type="text/javascript">
|
24 |
//<![CDATA[
|
|
|
|
|
|
|
|
|
25 |
function PickupForm(localeStr)
|
26 |
{
|
27 |
//google.maps.visualRefresh = true;
|
28 |
-
|
29 |
this.cityFld = $('pickup_city');
|
30 |
this.postcodeFld = $('pickup_postcode');
|
31 |
this.countryFld = $('pickup_country_id');
|
@@ -49,16 +52,13 @@
|
|
49 |
|
50 |
this.closeForm = function() {$('pickup-bkg').ancestors()[0].hide();}
|
51 |
|
52 |
-
this.searchPickups = function()
|
53 |
-
{
|
54 |
if (this.postcodeFld.getValue().replace(/\s/g, '') == '') {
|
55 |
-
window.alert(this.localeStr['empty_postcode']);
|
56 |
-
return;
|
57 |
}
|
58 |
this.clearPickupSet();
|
59 |
this.pleaseWait(true);
|
60 |
-
var _this = this;
|
61 |
-
|
62 |
new Ajax.Request('<?php echo $this->getPickupGatheringUrl(); ?>',
|
63 |
{
|
64 |
evalScripts: true,
|
@@ -71,14 +71,11 @@
|
|
71 |
);
|
72 |
}
|
73 |
|
74 |
-
this.fetchResult = function(result)
|
75 |
-
|
76 |
-
if (result instanceof Object)
|
77 |
-
{
|
78 |
this.pleaseWait(false);
|
79 |
if (result.type == 'error') {alert(result.title)}
|
80 |
-
else
|
81 |
-
{
|
82 |
this.resultTitleElmt.update(result.title);
|
83 |
if (result.type == 'pickup-list') {this.buildPickupSet(result.data)}
|
84 |
else {this.displayCitySet(result.data);}
|
@@ -87,39 +84,32 @@
|
|
87 |
}
|
88 |
|
89 |
this.displayCitytSet = function(city) {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
-
this.
|
92 |
-
{
|
93 |
-
var clone = element.cloneNode(true);
|
94 |
-
clone._prototypeUID = void 0;
|
95 |
-
var descendants = Element.select(clone, '*'), i = descendants.length;
|
96 |
-
while (i--) {descendants[i]._prototypeUID = void 0;}
|
97 |
-
return Element.extend(clone);
|
98 |
-
}
|
99 |
-
|
100 |
-
this.buildPickupSet = function(pickup)
|
101 |
-
{
|
102 |
var _infoElmt = new Element('a', {href: 'javascript:void(0)', 'class': 'info-link'}).update(this.localeStr['info']);
|
103 |
-
var _selectElmt = new Element('a', {href: 'javascript:void(0)', 'class': 'select-link'}).update(this.localeStr['select']);
|
104 |
-
|
105 |
this.area = new google.maps.LatLngBounds();
|
106 |
-
var _i = 0;
|
107 |
-
|
108 |
-
while (pickup.length)
|
109 |
-
{
|
110 |
_i++;
|
111 |
var _pickup = pickup.shift();
|
112 |
-
var _htmltitle =
|
113 |
-
"</h1><p class='p-address'>" + _pickup.street + "<br/>" +
|
114 |
-
_pickup.postcode + " " + _pickup.city + "</p>";
|
115 |
var _div = new Element('div', {id: 'pid_' + _pickup.id, 'class': 'p-item icon-' + _i}).update(_htmltitle);
|
116 |
var __info = this.cloneElmt(_infoElmt);
|
117 |
var __select = this.cloneElmt(_selectElmt);
|
118 |
_div.insert(__info);
|
119 |
_div.insert({bottom: __select});
|
120 |
this.resultDataElmt.insert(_div);
|
121 |
-
_pickup.divData = _div;
|
122 |
-
|
123 |
var _markerOptions = {
|
124 |
map: this.googleMap,
|
125 |
icon: this.iconBaseUrl + _i + '.png',
|
@@ -127,13 +117,10 @@
|
|
127 |
position: new google.maps.LatLng(_pickup.latitude, _pickup.longitude),
|
128 |
pickup: _pickup
|
129 |
};
|
130 |
-
var _marker = new google.maps.Marker(_markerOptions);
|
131 |
-
|
132 |
_pickup.markerEventId = google.maps.event.addListener(_marker, 'click',
|
133 |
-
(function(marker, obj){return function() {obj.highlightPickup(marker.pickup, false, true);}})(_marker, this));
|
134 |
-
|
135 |
-
_pickup.marker = _marker;
|
136 |
-
|
137 |
this.area.extend(_markerOptions.position);
|
138 |
this.pickupSet[_pickup.id] = _pickup;
|
139 |
}
|
@@ -142,51 +129,41 @@
|
|
142 |
this.pleaseWait(false);
|
143 |
}
|
144 |
|
145 |
-
this.clearPickupSet = function()
|
146 |
-
{
|
147 |
this.activePickup = null;
|
148 |
var _key;
|
149 |
-
for (_key in this.pickupSet)
|
150 |
-
|
151 |
-
if (this.pickupSet[_key].id)
|
152 |
-
{
|
153 |
var _pickup = this.pickupSet[_key];
|
154 |
_pickup.divData.remove();
|
155 |
-
if (_pickup.markerEventId) {
|
156 |
-
google.maps.event.removeListener(_pickup.markerEventId);}
|
157 |
_pickup.marker.setMap(null);
|
158 |
delete this.pickupSet[_key];
|
159 |
}
|
160 |
}
|
161 |
}
|
162 |
|
163 |
-
this.highlightPickup = function(pickup, center, scroll)
|
164 |
-
{
|
165 |
if (pickup instanceof Element) {pickup = this.pickupSet[pickup.getAttribute('id').substring(4)];}
|
166 |
-
if (pickup != this.activePickup)
|
167 |
-
|
168 |
-
if (this.activePickup)
|
169 |
-
{
|
170 |
this.activePickup.marker.setAnimation(null);
|
171 |
this.activePickup.divData.removeClassName('is-active');
|
172 |
}
|
173 |
pickup.marker.setAnimation(google.maps.Animation.BOUNCE);
|
174 |
pickup.divData.addClassName('is-active');
|
175 |
-
|
176 |
if (center) {this.googleMap.panTo(pickup.marker.position);}
|
177 |
this.activePickup = pickup;
|
178 |
}
|
179 |
}
|
180 |
|
181 |
-
this.displayDetails = function(linkElmt)
|
182 |
-
{
|
183 |
this.pleaseWait(true);
|
184 |
var _id = $(linkElmt.parentNode).getAttribute('id').substring(4);
|
185 |
-
if (this.pickupSet[_id])
|
186 |
-
{
|
187 |
var _this = this;
|
188 |
-
new Ajax.Request('<?php echo $this->getPickupDetailsUrl(); ?>',
|
189 |
-
{
|
190 |
evalScripts: true,
|
191 |
parameters: {pickup_id: _id, country_id: this.pickupSet[_id].country_id},
|
192 |
onSuccess: function(transport) {_this.displayDetailsResult(_id, transport.responseJSON);}
|
@@ -195,38 +172,36 @@
|
|
195 |
}
|
196 |
}
|
197 |
|
198 |
-
this.displayDetailsResult = function(id, result)
|
199 |
-
{
|
200 |
this.pleaseWait(false);
|
201 |
-
if (result instanceof Object)
|
202 |
-
{
|
203 |
if (result.type == 'error') {alert(result.title);}
|
204 |
-
else
|
205 |
-
{
|
206 |
var _div = this.pickupSet[id].divData;
|
207 |
-
_div.select('.info-link')[0].
|
|
|
208 |
var _tablehtml = '<table class="opening-hours">';
|
209 |
-
while (result.data.length)
|
210 |
-
{
|
211 |
var _day = result.data.shift();
|
212 |
_tablehtml += '<tr><td class="day">' + _day['day'] + '</td><td class="hours">' + _day['hours'] + '</td><tr>';
|
213 |
}
|
214 |
-
var _table = new Element('table'
|
|
|
|
|
215 |
_div.insert(_table);
|
216 |
}
|
217 |
}
|
218 |
}
|
219 |
|
220 |
-
this.selectPickup = function(linkElmt)
|
221 |
-
{
|
222 |
var _id = $(linkElmt.parentNode).getAttribute('id').substring(4);
|
223 |
if (this.pickupSet[_id]) {
|
224 |
this.pleaseWait(true);
|
225 |
var _pickup = this.pickupSet[_id];
|
226 |
$('pickup-address').update('<span class="name">' + _pickup.name + '</span> <span class="address">' + _pickup.street + '</span> <span class="postcode">' + _pickup.postcode + '</span> <span class="city">' + _pickup.city + '</span>');
|
227 |
$('pickup-selected').show();
|
228 |
-
|
229 |
-
|
230 |
parameters: { id: _id,
|
231 |
name: _pickup.name,
|
232 |
street: _pickup.street,
|
@@ -235,6 +210,7 @@
|
|
235 |
country_id: _pickup.country_id
|
236 |
},
|
237 |
onSuccess: function(transport) {
|
|
|
238 |
$('pickup-selected').show();
|
239 |
$('s_method_mondialrelaypickup_24R').enable();
|
240 |
$('s_method_mondialrelaypickup_24R').checked = true;
|
@@ -246,14 +222,13 @@
|
|
246 |
}
|
247 |
}
|
248 |
|
249 |
-
this.clickHandler = function(event)
|
250 |
-
{
|
251 |
var _elmt = event.findElement();
|
252 |
-
if (_elmt.hasClassName('info-link')) {this.displayDetails(_elmt);}
|
253 |
-
else if (_elmt.hasClassName('select-link')) {this.selectPickup(_elmt);}
|
254 |
else {
|
255 |
-
var _elmt = event.findElement('.p-item');
|
256 |
-
if (_elmt != document) {this.highlightPickup(_elmt, true, false);}
|
257 |
}
|
258 |
}
|
259 |
|
22 |
|
23 |
<script type="text/javascript">
|
24 |
//<![CDATA[
|
25 |
+
if(!String.prototype.trim){ // for JS<1.8.1
|
26 |
+
String.prototype.trim = function(){return this.replace(/^\s+|\s+$/g,'');};
|
27 |
+
}
|
28 |
+
|
29 |
function PickupForm(localeStr)
|
30 |
{
|
31 |
//google.maps.visualRefresh = true;
|
|
|
32 |
this.cityFld = $('pickup_city');
|
33 |
this.postcodeFld = $('pickup_postcode');
|
34 |
this.countryFld = $('pickup_country_id');
|
52 |
|
53 |
this.closeForm = function() {$('pickup-bkg').ancestors()[0].hide();}
|
54 |
|
55 |
+
this.searchPickups = function() {
|
|
|
56 |
if (this.postcodeFld.getValue().replace(/\s/g, '') == '') {
|
57 |
+
window.alert(this.localeStr['empty_postcode']); return;
|
|
|
58 |
}
|
59 |
this.clearPickupSet();
|
60 |
this.pleaseWait(true);
|
61 |
+
var _this = this;
|
|
|
62 |
new Ajax.Request('<?php echo $this->getPickupGatheringUrl(); ?>',
|
63 |
{
|
64 |
evalScripts: true,
|
71 |
);
|
72 |
}
|
73 |
|
74 |
+
this.fetchResult = function(result) {
|
75 |
+
if (result instanceof Object) {
|
|
|
|
|
76 |
this.pleaseWait(false);
|
77 |
if (result.type == 'error') {alert(result.title)}
|
78 |
+
else {
|
|
|
79 |
this.resultTitleElmt.update(result.title);
|
80 |
if (result.type == 'pickup-list') {this.buildPickupSet(result.data)}
|
81 |
else {this.displayCitySet(result.data);}
|
84 |
}
|
85 |
|
86 |
this.displayCitytSet = function(city) {}
|
87 |
+
|
88 |
+
// for Prototype < 1.7.1
|
89 |
+
this.cloneElmt = function(element) {
|
90 |
+
var clone = element.cloneNode(true);
|
91 |
+
clone._prototypeUID = void 0;
|
92 |
+
var descendants = Element.select(clone, '*'), i = descendants.length;
|
93 |
+
while (i--) {descendants[i]._prototypeUID = void 0;}
|
94 |
+
return Element.extend(clone);
|
95 |
+
}
|
96 |
|
97 |
+
this.buildPickupSet = function(pickup) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
var _infoElmt = new Element('a', {href: 'javascript:void(0)', 'class': 'info-link'}).update(this.localeStr['info']);
|
99 |
+
var _selectElmt = new Element('a', {href: 'javascript:void(0)', 'class': 'select-link'}).update(this.localeStr['select']);
|
|
|
100 |
this.area = new google.maps.LatLngBounds();
|
101 |
+
var _i = 0;
|
102 |
+
while (pickup.length) {
|
|
|
|
|
103 |
_i++;
|
104 |
var _pickup = pickup.shift();
|
105 |
+
var _htmltitle = "<h1>" + _pickup.name + "</h1><p class='p-address'>" + _pickup.street + "<br/>" + _pickup.postcode + " " + _pickup.city + "</p>";
|
|
|
|
|
106 |
var _div = new Element('div', {id: 'pid_' + _pickup.id, 'class': 'p-item icon-' + _i}).update(_htmltitle);
|
107 |
var __info = this.cloneElmt(_infoElmt);
|
108 |
var __select = this.cloneElmt(_selectElmt);
|
109 |
_div.insert(__info);
|
110 |
_div.insert({bottom: __select});
|
111 |
this.resultDataElmt.insert(_div);
|
112 |
+
_pickup.divData = _div;
|
|
|
113 |
var _markerOptions = {
|
114 |
map: this.googleMap,
|
115 |
icon: this.iconBaseUrl + _i + '.png',
|
117 |
position: new google.maps.LatLng(_pickup.latitude, _pickup.longitude),
|
118 |
pickup: _pickup
|
119 |
};
|
120 |
+
var _marker = new google.maps.Marker(_markerOptions);
|
|
|
121 |
_pickup.markerEventId = google.maps.event.addListener(_marker, 'click',
|
122 |
+
(function(marker, obj){return function() {obj.highlightPickup(marker.pickup, false, true);}})(_marker, this));
|
123 |
+
_pickup.marker = _marker;
|
|
|
|
|
124 |
this.area.extend(_markerOptions.position);
|
125 |
this.pickupSet[_pickup.id] = _pickup;
|
126 |
}
|
129 |
this.pleaseWait(false);
|
130 |
}
|
131 |
|
132 |
+
this.clearPickupSet = function() {
|
|
|
133 |
this.activePickup = null;
|
134 |
var _key;
|
135 |
+
for (_key in this.pickupSet) {
|
136 |
+
if (this.pickupSet[_key].id) {
|
|
|
|
|
137 |
var _pickup = this.pickupSet[_key];
|
138 |
_pickup.divData.remove();
|
139 |
+
if (_pickup.markerEventId) {google.maps.event.removeListener(_pickup.markerEventId);}
|
|
|
140 |
_pickup.marker.setMap(null);
|
141 |
delete this.pickupSet[_key];
|
142 |
}
|
143 |
}
|
144 |
}
|
145 |
|
146 |
+
this.highlightPickup = function(pickup, center, scroll) {
|
|
|
147 |
if (pickup instanceof Element) {pickup = this.pickupSet[pickup.getAttribute('id').substring(4)];}
|
148 |
+
if (pickup != this.activePickup) {
|
149 |
+
if (this.activePickup) {
|
|
|
|
|
150 |
this.activePickup.marker.setAnimation(null);
|
151 |
this.activePickup.divData.removeClassName('is-active');
|
152 |
}
|
153 |
pickup.marker.setAnimation(google.maps.Animation.BOUNCE);
|
154 |
pickup.divData.addClassName('is-active');
|
155 |
+
if (scroll) {this.resultDataElmt.scrollTop = pickup.divData.positionedOffset()[1];}
|
156 |
if (center) {this.googleMap.panTo(pickup.marker.position);}
|
157 |
this.activePickup = pickup;
|
158 |
}
|
159 |
}
|
160 |
|
161 |
+
this.displayDetails = function(linkElmt) {
|
|
|
162 |
this.pleaseWait(true);
|
163 |
var _id = $(linkElmt.parentNode).getAttribute('id').substring(4);
|
164 |
+
if (this.pickupSet[_id]) {
|
|
|
165 |
var _this = this;
|
166 |
+
new Ajax.Request('<?php echo $this->getPickupDetailsUrl(); ?>', {
|
|
|
167 |
evalScripts: true,
|
168 |
parameters: {pickup_id: _id, country_id: this.pickupSet[_id].country_id},
|
169 |
onSuccess: function(transport) {_this.displayDetailsResult(_id, transport.responseJSON);}
|
172 |
}
|
173 |
}
|
174 |
|
175 |
+
this.displayDetailsResult = function(id, result) {
|
|
|
176 |
this.pleaseWait(false);
|
177 |
+
if (result instanceof Object) {
|
|
|
178 |
if (result.type == 'error') {alert(result.title);}
|
179 |
+
else {
|
|
|
180 |
var _div = this.pickupSet[id].divData;
|
181 |
+
var _link = _div.select('.info-link')[0] || _div.down('a');
|
182 |
+
_link.remove();
|
183 |
var _tablehtml = '<table class="opening-hours">';
|
184 |
+
while (result.data.length) {
|
|
|
185 |
var _day = result.data.shift();
|
186 |
_tablehtml += '<tr><td class="day">' + _day['day'] + '</td><td class="hours">' + _day['hours'] + '</td><tr>';
|
187 |
}
|
188 |
+
var _table = $(new Element('table'));
|
189 |
+
_table.innerHTML = _tablehtml;
|
190 |
+
_table.addClassName('p-details');
|
191 |
_div.insert(_table);
|
192 |
}
|
193 |
}
|
194 |
}
|
195 |
|
196 |
+
this.selectPickup = function(linkElmt) {
|
|
|
197 |
var _id = $(linkElmt.parentNode).getAttribute('id').substring(4);
|
198 |
if (this.pickupSet[_id]) {
|
199 |
this.pleaseWait(true);
|
200 |
var _pickup = this.pickupSet[_id];
|
201 |
$('pickup-address').update('<span class="name">' + _pickup.name + '</span> <span class="address">' + _pickup.street + '</span> <span class="postcode">' + _pickup.postcode + '</span> <span class="city">' + _pickup.city + '</span>');
|
202 |
$('pickup-selected').show();
|
203 |
+
var _this = this;
|
204 |
+
new Ajax.Request('<?php echo $this->getSavePickupinSessionUrl(); ?>', {
|
205 |
parameters: { id: _id,
|
206 |
name: _pickup.name,
|
207 |
street: _pickup.street,
|
210 |
country_id: _pickup.country_id
|
211 |
},
|
212 |
onSuccess: function(transport) {
|
213 |
+
_this.pleaseWait(false);
|
214 |
$('pickup-selected').show();
|
215 |
$('s_method_mondialrelaypickup_24R').enable();
|
216 |
$('s_method_mondialrelaypickup_24R').checked = true;
|
222 |
}
|
223 |
}
|
224 |
|
225 |
+
this.clickHandler = function(event) {
|
|
|
226 |
var _elmt = event.findElement();
|
227 |
+
if (_elmt.hasClassName('info-link') || (_elmt.getAttribute('className') == 'info-link')) {this.displayDetails(_elmt);}
|
228 |
+
else if (_elmt.hasClassName('select-link') || (_elmt.getAttribute('className') == 'select-link')) {this.selectPickup(_elmt);}
|
229 |
else {
|
230 |
+
var _elmt = event.findElement('.p-item') || event.findElement().up('div');
|
231 |
+
if (_elmt && _elmt != document) {this.highlightPickup(_elmt, true, false);}
|
232 |
}
|
233 |
}
|
234 |
|
app/design/frontend/base/default/template/Man4x_MondialRelay/shippingmethods.phtml
CHANGED
@@ -22,7 +22,19 @@
|
|
22 |
?>
|
23 |
|
24 |
<script type="text/javascript">
|
25 |
-
//<![CDATA[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
<?php echo $this->getMethodsDescription() ?>
|
27 |
// Add description for Mondial Relay shipping methods
|
28 |
// Add a link to open pick-up selection form, a div to show the selected pick-up and an hidden form field
|
@@ -30,19 +42,19 @@
|
|
30 |
function(e) {
|
31 |
e = $(e);
|
32 |
Event.observe(e, 'click', function() {
|
|
|
33 |
e.readAttribute('id') == 's_method_mondialrelaypickup_24R' ? $('pickup-selected').show() : $('pickup-selected').hide();
|
34 |
-
});
|
35 |
-
|
36 |
var _method = e.readAttribute('id');
|
37 |
if (_method.indexOf('mondialrelay') != -1) {
|
38 |
-
var _parent =
|
39 |
-
_parent.insert("<p class='method-description'>" + _methodsDesc[_method.substring(9)] + "</p>");
|
40 |
-
|
41 |
if (_method.indexOf('pickup') != -1) {
|
42 |
if (<?php echo $this->onMapSelection() ?>) {
|
43 |
e.checked = false;
|
44 |
e.disable();
|
45 |
var _link = new Element('a', {id: 'pickup-selection-link', href: 'javascript:void(0)'}).update("<?php echo (Mage::helper('mondialrelay')->__('Click to select your pick-up location')); ?>");
|
|
|
46 |
_parent.insert(_link);
|
47 |
|
48 |
Event.observe(_link, 'click', function() {
|
@@ -72,7 +84,8 @@
|
|
72 |
}
|
73 |
else if (_method.split('_').length === 5) {
|
74 |
var _link = new Element('a', {'class': 'pickup-details-link', href: 'javascript:void(0)'}).update("<?php echo (Mage::helper('mondialrelay')->__('(More info)')); ?>");
|
75 |
-
e
|
|
|
76 |
|
77 |
Event.observe(_link, 'click', function() {
|
78 |
var _docDim = document.viewport.getDimensions();
|
22 |
?>
|
23 |
|
24 |
<script type="text/javascript">
|
25 |
+
//<![CDATA[
|
26 |
+
function anchorToMethodDescription(e) {
|
27 |
+
// return element where to insert method description
|
28 |
+
return $(e.parentNode);
|
29 |
+
}
|
30 |
+
function anchorToPickupSelectionLink(e) {
|
31 |
+
// return element where to insert pickup selection link
|
32 |
+
return $(e.parentNode);
|
33 |
+
}
|
34 |
+
function anchorToInfoLink(e) {
|
35 |
+
// return element where to insert pickup info link
|
36 |
+
return $(e.next('p'));
|
37 |
+
}
|
38 |
<?php echo $this->getMethodsDescription() ?>
|
39 |
// Add description for Mondial Relay shipping methods
|
40 |
// Add a link to open pick-up selection form, a div to show the selected pick-up and an hidden form field
|
42 |
function(e) {
|
43 |
e = $(e);
|
44 |
Event.observe(e, 'click', function() {
|
45 |
+
// Enable/disable the selected pickup div
|
46 |
e.readAttribute('id') == 's_method_mondialrelaypickup_24R' ? $('pickup-selected').show() : $('pickup-selected').hide();
|
47 |
+
});
|
|
|
48 |
var _method = e.readAttribute('id');
|
49 |
if (_method.indexOf('mondialrelay') != -1) {
|
50 |
+
var _parent = anchorToMethodDescription(e);
|
51 |
+
_parent.insert("<p class='method-description'>" + _methodsDesc[_method.substring(9)] + "</p>");
|
|
|
52 |
if (_method.indexOf('pickup') != -1) {
|
53 |
if (<?php echo $this->onMapSelection() ?>) {
|
54 |
e.checked = false;
|
55 |
e.disable();
|
56 |
var _link = new Element('a', {id: 'pickup-selection-link', href: 'javascript:void(0)'}).update("<?php echo (Mage::helper('mondialrelay')->__('Click to select your pick-up location')); ?>");
|
57 |
+
_parent = anchorToPickupSelectionLink(e);
|
58 |
_parent.insert(_link);
|
59 |
|
60 |
Event.observe(_link, 'click', function() {
|
84 |
}
|
85 |
else if (_method.split('_').length === 5) {
|
86 |
var _link = new Element('a', {'class': 'pickup-details-link', href: 'javascript:void(0)'}).update("<?php echo (Mage::helper('mondialrelay')->__('(More info)')); ?>");
|
87 |
+
var _anchor = anchorToInfoLink(e);
|
88 |
+
_anchor.insert(_link);
|
89 |
|
90 |
Event.observe(_link, 'click', function() {
|
91 |
var _docDim = document.viewport.getDimensions();
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>man4x_mondialrelay</name>
|
4 |
-
<version>1.4.
|
5 |
<stability>stable</stability>
|
6 |
<license>Massachusetts Institute of Technology License (MITL)</license>
|
7 |
<channel>community</channel>
|
@@ -13,11 +13,15 @@ WARNING: this module is not compatible with MondialRelay_Pointsrelais unless man
|
|
13 |
------------------------------------------------------------
|
14 |
(FR) Ce module a été inspiré par le module MondialRelay_Pointsrelais disponible sur Magento Connect dans le but de corriger certaines limitations de ce dernier (expéditions par lot, sélection des points relais sur carte ou par liste, interception des erreurs d'enregistrement...)
|
15 |
ATTENTION: ce module n'est pas compatible en l'état avec le module MondialRelay_Pointsrelais (voir documentation).</description>
|
16 |
-
<notes>
|
|
|
|
|
|
|
|
|
17 |
<authors><author><name>Emmanuel Catrysse</name><user>Peppermay</user><email>man4x@hotmail.fr</email></author></authors>
|
18 |
-
<date>2014-
|
19 |
-
<time>
|
20 |
-
<contents><target name="magecommunity"><dir name="Man4x"><dir name="MondialRelay"><dir name="Block"><dir name="Checkout"><file name="Pickupinfo.php" hash="b774e5e1cca5083c9a84745670a74570"/><file name="Pickuppopup.php" hash="c53b342e9204420d786d8b4fc3650d20"/><file name="Shippingmethods.php" hash="90341019c54dbf5d8e1d5cad5f78c39c"/></dir><dir name="Sales"><dir name="Labelprinting"><file name="Grid.php" hash="1a65b8aa1c348dc5e9a6023892d79723"/></dir><file name="Labelprinting.php" hash="81ebc053dc63066e0a80b24c40f2e13d"/><dir name="Massshipping"><file name="Grid.php" hash="d8fb048cae771ce4e68af7e99da4600b"/></dir><file name="Massshipping.php" hash="7c07785430761c0dbfb774e03787fe2e"/></dir></dir><dir name="Helper"><file name="Data.php" hash="14fc41549fecddbf58b6526bc61748c9"/></dir><dir name="Model"><dir name="Carrier"><file name="Abstract.php" hash="
|
21 |
<compatible/>
|
22 |
<dependencies><required><php><min>5.0.0</min><max>5.5.3</max></php></required></dependencies>
|
23 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>man4x_mondialrelay</name>
|
4 |
+
<version>1.4.4</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>Massachusetts Institute of Technology License (MITL)</license>
|
7 |
<channel>community</channel>
|
13 |
------------------------------------------------------------
|
14 |
(FR) Ce module a été inspiré par le module MondialRelay_Pointsrelais disponible sur Magento Connect dans le but de corriger certaines limitations de ce dernier (expéditions par lot, sélection des points relais sur carte ou par liste, interception des erreurs d'enregistrement...)
|
15 |
ATTENTION: ce module n'est pas compatible en l'état avec le module MondialRelay_Pointsrelais (voir documentation).</description>
|
16 |
+
<notes>Corrige le cas où un accent se trouve dans la ville de l'expéditeur (merci Antoine).
|
17 |
+
En mode debug, ajoute les paramètres d'appel au web service au message d'erreur.
|
18 |
+
Facilitation de l'adaptation aux thèmes tiers et aux anciens navigateurs (merci Yannick)
|
19 |
+
Correction d'un bug provoquant la création d'une entrée indésirable dans la table sales_flat_order_address (merci Jean-Yves)
|
20 |
+
Corrige la disparition des points relais lors de la réouverture du formulaire de sélection sur carte</notes>
|
21 |
<authors><author><name>Emmanuel Catrysse</name><user>Peppermay</user><email>man4x@hotmail.fr</email></author></authors>
|
22 |
+
<date>2014-02-13</date>
|
23 |
+
<time>19:48:13</time>
|
24 |
+
<contents><target name="magecommunity"><dir name="Man4x"><dir name="MondialRelay"><dir name="Block"><dir name="Checkout"><file name="Pickupinfo.php" hash="b774e5e1cca5083c9a84745670a74570"/><file name="Pickuppopup.php" hash="c53b342e9204420d786d8b4fc3650d20"/><file name="Shippingmethods.php" hash="90341019c54dbf5d8e1d5cad5f78c39c"/></dir><dir name="Sales"><dir name="Labelprinting"><file name="Grid.php" hash="1a65b8aa1c348dc5e9a6023892d79723"/></dir><file name="Labelprinting.php" hash="81ebc053dc63066e0a80b24c40f2e13d"/><dir name="Massshipping"><file name="Grid.php" hash="d8fb048cae771ce4e68af7e99da4600b"/></dir><file name="Massshipping.php" hash="7c07785430761c0dbfb774e03787fe2e"/></dir></dir><dir name="Helper"><file name="Data.php" hash="14fc41549fecddbf58b6526bc61748c9"/></dir><dir name="Model"><dir name="Carrier"><file name="Abstract.php" hash="ad65414f0acd79bbfce611732bee7ff9"/><file name="Home.php" hash="1e995970559481c69b92d3de35b929c2"/><file name="Pickup.php" hash="49b54427377802f572aa3b40f0e10c5a"/><dir name="_notes"><file name="dwsync.xml" hash="a494e9d4cf1e2a9cae531cd64db0144e"/></dir></dir><file name="Observer.php" hash="34ed3366f06eb39b58f6016593ee66d1"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Collectionmode.php" hash="42afabe9e62a9ece2b5eb35d0e0883fc"/><file name="Condition.php" hash="e33f3bc3382d364d081ddd7aeaf88554"/><file name="Weightunit.php" hash="57ffe1e480b53851363b5b2a190b3d6d"/></dir><dir name="Validation"><file name="Senderaddress.php" hash="fc948ec1b7b0e8fb78d7e2bfcdee1cbb"/><file name="Tablerate.php" hash="d19a6de215b020bb2ad1f8cd3017b4d5"/></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="21397051d1e5ecd38b36468c7991a9ec"/><dir name="Sales"><file name="ShippingController.php" hash="d1d78f0b02edf964677700268e4e4062"/></dir></dir><dir name="doc"><file name="guide_man4x_mondialrelay_1_4_0_fr.pdf" hash="c1cba4b3f469096c935268377a932ef2"/></dir><dir name="etc"><dir name="_notes"><file name="dwsync.xml" hash="080663fcb4b12277da7e534655358e9c"/></dir><file name="adminhtml.xml" hash="8c62dc7ecb883783e2e65d46a60b154f"/><file name="config.xml" hash="8fcdb109af1b1c7d6c5e19e41cef1e61"/><file name="system.xml" hash="e6af84a3a6b40a3920a54b308cd03c78"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="Man4x_MondialRelay.xml" hash="eaf0e0972f6ab93544fdd8a6ca45a244"/></dir><dir name="template"><dir name="Man4x_MondialRelay"><file name="pickupinfo.phtml" hash="2dc3181d30a0aa6fd025efed6125e105"/><file name="pickuppopup.phtml" hash="6e5a7e48e007b3e5003ce3dc92b75782"/><file name="shippingmethods.phtml" hash="6811bdcf9e0689aafe858539772586e1"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Man4x_MondialRelay.xml" hash="cbf764631c906fbf3b9bcee94199d078"/></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Man4x_MondialRelay.csv" hash="a67c688d803084ae05cbbfb8df0d806e"/></dir><dir name="fr_FR"><file name="Man4x_MondialRelay.csv" hash="1a64300dfa05e8a4f4f12ed55cce7723"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="Man4x_MondialRelay.css" hash="5d5d0a2daee798a4d8ea5f921c0b8bd4"/></dir><dir name="images"><dir name="Man4x_MondialRelay"><file name="btn_details.png" hash="39a00ac148c2e3dc44bd42670ee74c5b"/><file name="btn_search.png" hash="56fb89eea54a9804059dcd146dfaaadd"/><file name="close_icon.png" hash="f8422d11f273f2690226160682d80f10"/><file name="logo_mondialrelay.gif" hash="95bc996ef1c8fce2b8cc7b0b864d6f52"/><file name="logo_mondialrelay_20.gif" hash="ac7ca03f8638455ce33dd8ca9c17c475"/><file name="mondialrelay_ajax_loading.gif" hash="ef4b7ef99db4254577aac23fff5ff50b"/><file name="mondialrelay_ajax_loading_50x55.gif" hash="b260ebcedb57b84557917ecc748469ff"/><file name="mondialrelay_mapicon.png" hash="42af394899f3cb4dee42dacea2acb5b5"/><file name="mondialrelay_mapicon_1.png" hash="3511c130456b2458d79479d45795905d"/><file name="mondialrelay_mapicon_10.png" hash="69b080af207b00e483cf5d8f777f97c1"/><file name="mondialrelay_mapicon_2.png" hash="77c3d618194755e5a010af27dd41f0fa"/><file name="mondialrelay_mapicon_3.png" hash="1a7f0e3de53a15fcf941ae3c525eb933"/><file name="mondialrelay_mapicon_4.png" hash="c4cc20ceddec609055b4ba475d1ce97a"/><file name="mondialrelay_mapicon_5.png" hash="facfda8086ddfecc7994114c32c64a06"/><file name="mondialrelay_mapicon_6.png" hash="f0f599ec3b987ee47ae00faf8cb220f0"/><file name="mondialrelay_mapicon_7.png" hash="0d37a31e4efaf6262a4e752955904c69"/><file name="mondialrelay_mapicon_8.png" hash="46254dd13dfc515edc66281f708f2f26"/><file name="mondialrelay_mapicon_9.png" hash="304700bc1fa27f97e5b45e5b8bba593f"/></dir></dir></dir></dir></dir></target></contents>
|
25 |
<compatible/>
|
26 |
<dependencies><required><php><min>5.0.0</min><max>5.5.3</max></php></required></dependencies>
|
27 |
</package>
|