Version Notes
Compatible 1.5
Download this release
Release Info
Developer | Berlioz |
Extension | ColiPoste_La_Poste_So_Colissimo |
Version | 1.0.8 |
Comparing to | |
See all releases |
Code changes from version 1.0.7 to 1.0.8
- app/code/community/LaPoste/SoColissimoSimplicite/Block/Form.php +17 -23
- app/code/community/LaPoste/SoColissimoSimplicite/Block/Onepage.php +7 -5
- app/code/community/LaPoste/SoColissimoSimplicite/Block/Onepage/Shipping/Method/Available.php +9 -9
- app/code/community/LaPoste/SoColissimoSimplicite/Helper/Data.php +20 -6
- app/code/community/LaPoste/SoColissimoSimplicite/Model/Carrier/ShippingMethod.php +45 -43
- app/code/community/LaPoste/SoColissimoSimplicite/Model/Mysql4/Transaction.php +3 -2
- app/code/community/LaPoste/SoColissimoSimplicite/Model/Mysql4/Transaction/Collection.php +2 -1
- app/code/community/LaPoste/SoColissimoSimplicite/Model/Observer.php +69 -64
- app/code/community/LaPoste/SoColissimoSimplicite/Model/System/Config/Source/Shipping/Amountbasetype.php +6 -6
- app/code/community/LaPoste/SoColissimoSimplicite/Model/Transaction.php +11 -9
- app/code/community/LaPoste/SoColissimoSimplicite/Test/Model/Carrier/ShippingMethodTest.php +202 -0
- app/code/community/LaPoste/SoColissimoSimplicite/controllers/FormController.php +22 -20
- app/code/community/LaPoste/SoColissimoSimplicite/controllers/OnepageController.php +27 -0
- app/code/community/LaPoste/SoColissimoSimplicite/etc/config.xml +8 -1
- app/code/community/LaPoste/SoColissimoSimplicite/sql/socolissimosimplicite_setup/mysql4-install-1.0.0.php +16 -19
- app/code/community/LaPoste/SoColissimoSimplicite/sql/socolissimosimplicite_setup/mysql4-uninstall-0.1.0.php +14 -0
- app/code/community/LaPoste/SoColissimoSimplicite/sql/socolissimosimplicite_setup/mysql4-upgrade-1.0.6-1.0.7.php +99 -63
- app/design/frontend/default/default/template/socolissimosimplicite/form.phtml +5 -3
- app/design/frontend/default/default/template/socolissimosimplicite/onepage/shipping_method/available.phtml +141 -31
- package.xml +21 -23
app/code/community/LaPoste/SoColissimoSimplicite/Block/Form.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*/
|
15 |
class LaPoste_SoColissimoSimplicite_Block_Form extends Mage_Core_Block_Template
|
16 |
{
|
17 |
-
|
18 |
|
19 |
/**
|
20 |
* Retourne la ligne n° $line des informations (rue, étage, immeuble, etc.) de l'adresse
|
@@ -22,7 +22,8 @@ class LaPoste_SoColissimoSimplicite_Block_Form extends Mage_Core_Block_Template
|
|
22 |
* @param int $line
|
23 |
* @return string
|
24 |
*/
|
25 |
-
public function getShippingAddressStreet($line = 1)
|
|
|
26 |
$arrayStreet = $this->getShippingAddress()->getStreet();
|
27 |
$streetLine = '';
|
28 |
if (0 < $line && $line <= count($arrayStreet)) {
|
@@ -31,20 +32,22 @@ class LaPoste_SoColissimoSimplicite_Block_Form extends Mage_Core_Block_Template
|
|
31 |
return $streetLine;
|
32 |
}
|
33 |
|
34 |
-
|
35 |
* Retourne le message à afficher lors de la redirection vers le front de
|
36 |
* SO Colissimo Simplicité.
|
37 |
* @return string
|
38 |
*/
|
39 |
-
public function getRedirectMessage()
|
|
|
40 |
return $this->helper('socolissimosimplicite')->getRedirectMessage();
|
41 |
}
|
42 |
-
|
43 |
-
|
44 |
* Retourne l'identifiant FO d'accès à la plateforme SO Colissimo (front-office)
|
45 |
* @return string
|
46 |
*/
|
47 |
-
public function getAccountID()
|
|
|
48 |
return $this->helper('socolissimosimplicite')->getAccountId();
|
49 |
}
|
50 |
|
@@ -52,7 +55,8 @@ class LaPoste_SoColissimoSimplicite_Block_Form extends Mage_Core_Block_Template
|
|
52 |
* Retourne la clé de cryptage pour l'accès à la plateforme SO Colissimo (front-office)
|
53 |
* @return string
|
54 |
*/
|
55 |
-
public function getEncryptionKey()
|
|
|
56 |
return $this->helper('socolissimosimplicite')->getEncryptionKey();
|
57 |
}
|
58 |
|
@@ -60,29 +64,19 @@ class LaPoste_SoColissimoSimplicite_Block_Form extends Mage_Core_Block_Template
|
|
60 |
* Retourne l'URL d'accès à la plateforme SO Colissimo (front-office)
|
61 |
* @return string
|
62 |
*/
|
63 |
-
public function getUrlFoWithReturnUrlKo()
|
|
|
64 |
$urlFo = $this->helper('socolissimosimplicite')->getUrlFo();
|
65 |
$returnUrlKo = $this->helper('socolissimosimplicite')->getFailureUrl();
|
66 |
return $urlFo.'?trReturnUrlKo='.$returnUrlKo;
|
67 |
}
|
68 |
-
|
69 |
/**
|
70 |
-
* Retourne la signature calculée à partir de certains champs.
|
71 |
-
* @return string
|
72 |
-
*/
|
73 |
-
public function getSignature() {
|
74 |
-
return $this->helper('socolissimosimplicite')->generateSignature(
|
75 |
-
$this->_carrierInstance,
|
76 |
-
$this->getShippingAddress(),
|
77 |
-
$this->_transactionId
|
78 |
-
);
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
* Retourne l'url complète appelée en cas de succès
|
83 |
* @return string
|
84 |
*/
|
85 |
-
public function getSuccessUrl()
|
|
|
86 |
return $this->helper('socolissimosimplicite')->getSuccessUrl();
|
87 |
}
|
88 |
}
|
14 |
*/
|
15 |
class LaPoste_SoColissimoSimplicite_Block_Form extends Mage_Core_Block_Template
|
16 |
{
|
17 |
+
protected $_carrierInstance;
|
18 |
|
19 |
/**
|
20 |
* Retourne la ligne n° $line des informations (rue, étage, immeuble, etc.) de l'adresse
|
22 |
* @param int $line
|
23 |
* @return string
|
24 |
*/
|
25 |
+
public function getShippingAddressStreet($line = 1)
|
26 |
+
{
|
27 |
$arrayStreet = $this->getShippingAddress()->getStreet();
|
28 |
$streetLine = '';
|
29 |
if (0 < $line && $line <= count($arrayStreet)) {
|
32 |
return $streetLine;
|
33 |
}
|
34 |
|
35 |
+
/**
|
36 |
* Retourne le message à afficher lors de la redirection vers le front de
|
37 |
* SO Colissimo Simplicité.
|
38 |
* @return string
|
39 |
*/
|
40 |
+
public function getRedirectMessage()
|
41 |
+
{
|
42 |
return $this->helper('socolissimosimplicite')->getRedirectMessage();
|
43 |
}
|
44 |
+
|
45 |
+
/**
|
46 |
* Retourne l'identifiant FO d'accès à la plateforme SO Colissimo (front-office)
|
47 |
* @return string
|
48 |
*/
|
49 |
+
public function getAccountID()
|
50 |
+
{
|
51 |
return $this->helper('socolissimosimplicite')->getAccountId();
|
52 |
}
|
53 |
|
55 |
* Retourne la clé de cryptage pour l'accès à la plateforme SO Colissimo (front-office)
|
56 |
* @return string
|
57 |
*/
|
58 |
+
public function getEncryptionKey()
|
59 |
+
{
|
60 |
return $this->helper('socolissimosimplicite')->getEncryptionKey();
|
61 |
}
|
62 |
|
64 |
* Retourne l'URL d'accès à la plateforme SO Colissimo (front-office)
|
65 |
* @return string
|
66 |
*/
|
67 |
+
public function getUrlFoWithReturnUrlKo()
|
68 |
+
{
|
69 |
$urlFo = $this->helper('socolissimosimplicite')->getUrlFo();
|
70 |
$returnUrlKo = $this->helper('socolissimosimplicite')->getFailureUrl();
|
71 |
return $urlFo.'?trReturnUrlKo='.$returnUrlKo;
|
72 |
}
|
73 |
+
|
74 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
* Retourne l'url complète appelée en cas de succès
|
76 |
* @return string
|
77 |
*/
|
78 |
+
public function getSuccessUrl()
|
79 |
+
{
|
80 |
return $this->helper('socolissimosimplicite')->getSuccessUrl();
|
81 |
}
|
82 |
}
|
app/code/community/LaPoste/SoColissimoSimplicite/Block/Onepage.php
CHANGED
@@ -16,8 +16,8 @@ class LaPoste_SoColissimoSimplicite_Block_Onepage extends Mage_Checkout_Block_On
|
|
16 |
* Met à jour les étapes précédentes lorsqu'une étape autre que la 1ère
|
17 |
* étape est à afficher
|
18 |
*/
|
19 |
-
protected function _beforeToHtml()
|
20 |
-
|
21 |
parent::_beforeToHtml();
|
22 |
|
23 |
//on cherche en session si une étape est à afficher directement
|
@@ -26,23 +26,25 @@ class LaPoste_SoColissimoSimplicite_Block_Onepage extends Mage_Checkout_Block_On
|
|
26 |
|
27 |
if ($checkout->getData('socolissimosimplicite_checkout_onepage_nextstep')) {
|
28 |
$this->_stepToActivate = $checkout->getData('socolissimosimplicite_checkout_onepage_nextstep');
|
|
|
|
|
29 |
}
|
30 |
$steps = $this->getSteps();
|
31 |
|
32 |
//on force l'activation des étapes précédant l'étape que l'on souhaite
|
33 |
//afficher + de l'étape à afficher
|
34 |
-
if ($this->_stepToActivate && array_key_exists($this->_stepToActivate
|
35 |
|
36 |
foreach ($steps as $key => $data) {
|
37 |
//permet d'afficher le contenu de l'étape en cours et de revenir
|
38 |
//sur les étapes précédentes
|
39 |
-
$this->getCheckout()->setStepData($key,'allow',true);
|
40 |
|
41 |
if ($key == $this->_stepToActivate) {
|
42 |
break;
|
43 |
}
|
44 |
//permet d'afficher la progression
|
45 |
-
$this->getCheckout()->setStepData($key,'complete',true);
|
46 |
}
|
47 |
}
|
48 |
return $this;
|
16 |
* Met à jour les étapes précédentes lorsqu'une étape autre que la 1ère
|
17 |
* étape est à afficher
|
18 |
*/
|
19 |
+
protected function _beforeToHtml()
|
20 |
+
{
|
21 |
parent::_beforeToHtml();
|
22 |
|
23 |
//on cherche en session si une étape est à afficher directement
|
26 |
|
27 |
if ($checkout->getData('socolissimosimplicite_checkout_onepage_nextstep')) {
|
28 |
$this->_stepToActivate = $checkout->getData('socolissimosimplicite_checkout_onepage_nextstep');
|
29 |
+
//supprime la variable de session pour qu'un refresh réinitialise le onepage
|
30 |
+
$checkout->unsetData('socolissimosimplicite_checkout_onepage_nextstep');
|
31 |
}
|
32 |
$steps = $this->getSteps();
|
33 |
|
34 |
//on force l'activation des étapes précédant l'étape que l'on souhaite
|
35 |
//afficher + de l'étape à afficher
|
36 |
+
if ($this->_stepToActivate && array_key_exists($this->_stepToActivate, $steps)) {
|
37 |
|
38 |
foreach ($steps as $key => $data) {
|
39 |
//permet d'afficher le contenu de l'étape en cours et de revenir
|
40 |
//sur les étapes précédentes
|
41 |
+
$this->getCheckout()->setStepData($key, 'allow', true);
|
42 |
|
43 |
if ($key == $this->_stepToActivate) {
|
44 |
break;
|
45 |
}
|
46 |
//permet d'afficher la progression
|
47 |
+
$this->getCheckout()->setStepData($key, 'complete', true);
|
48 |
}
|
49 |
}
|
50 |
return $this;
|
app/code/community/LaPoste/SoColissimoSimplicite/Block/Onepage/Shipping/Method/Available.php
CHANGED
@@ -15,21 +15,21 @@
|
|
15 |
class LaPoste_SoColissimoSimplicite_Block_Onepage_Shipping_Method_Available
|
16 |
extends Mage_Checkout_Block_Onepage_Shipping_Method_Available
|
17 |
{
|
18 |
-
|
19 |
-
|
20 |
public function __construct()
|
21 |
{
|
22 |
parent::__construct();
|
23 |
|
24 |
//Rendu par défaut
|
25 |
$this->addItemRender(
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
);
|
30 |
}
|
31 |
-
|
32 |
-
|
33 |
* Ajoute une correspondance dans la table des rendus des modes de livraison.
|
34 |
* Cela permet de personnaliser l'affichage d'un mode de livraison parmi la
|
35 |
* liste des modes proposés lors du passage d'une commande.
|
@@ -48,7 +48,7 @@ class LaPoste_SoColissimoSimplicite_Block_Onepage_Shipping_Method_Available
|
|
48 |
return $this;
|
49 |
}
|
50 |
|
51 |
-
|
52 |
* Retourne le renderer approprié selon le mode de livraison.
|
53 |
* Le renderer par défaut est "default".
|
54 |
* @param string $type exemples : default|socolissimosimplicite
|
@@ -69,7 +69,7 @@ class LaPoste_SoColissimoSimplicite_Block_Onepage_Shipping_Method_Available
|
|
69 |
return $this->_itemRenders[$type]['blockInstance'];
|
70 |
}
|
71 |
|
72 |
-
|
73 |
* Retourne le code html du mode de livraison donné.
|
74 |
* @param Mage_Shipping_Model_Carrier_Abstract $item
|
75 |
* @return string
|
15 |
class LaPoste_SoColissimoSimplicite_Block_Onepage_Shipping_Method_Available
|
16 |
extends Mage_Checkout_Block_Onepage_Shipping_Method_Available
|
17 |
{
|
18 |
+
protected $_itemRenders = array();
|
19 |
+
|
20 |
public function __construct()
|
21 |
{
|
22 |
parent::__construct();
|
23 |
|
24 |
//Rendu par défaut
|
25 |
$this->addItemRender(
|
26 |
+
'default',
|
27 |
+
'socolissimosimplicite/onepage_shipping_method_available',
|
28 |
+
'socolissimosimplicite/onepage/shipping_method/available/default.phtml'
|
29 |
);
|
30 |
}
|
31 |
+
|
32 |
+
/**
|
33 |
* Ajoute une correspondance dans la table des rendus des modes de livraison.
|
34 |
* Cela permet de personnaliser l'affichage d'un mode de livraison parmi la
|
35 |
* liste des modes proposés lors du passage d'une commande.
|
48 |
return $this;
|
49 |
}
|
50 |
|
51 |
+
/**
|
52 |
* Retourne le renderer approprié selon le mode de livraison.
|
53 |
* Le renderer par défaut est "default".
|
54 |
* @param string $type exemples : default|socolissimosimplicite
|
69 |
return $this->_itemRenders[$type]['blockInstance'];
|
70 |
}
|
71 |
|
72 |
+
/**
|
73 |
* Retourne le code html du mode de livraison donné.
|
74 |
* @param Mage_Shipping_Model_Carrier_Abstract $item
|
75 |
* @return string
|
app/code/community/LaPoste/SoColissimoSimplicite/Helper/Data.php
CHANGED
@@ -169,7 +169,7 @@ class LaPoste_SoColissimoSimplicite_Helper_Data extends Mage_Core_Helper_Abstrac
|
|
169 |
public function getMapPrefix()
|
170 |
{
|
171 |
$map = Mage::getStoreConfig('carriers/socolissimosimplicite/mapprefix');
|
172 |
-
return json_decode($map,true); //TODOpeleq gérer une erreur ds le json ?
|
173 |
}
|
174 |
|
175 |
/**
|
@@ -181,7 +181,7 @@ class LaPoste_SoColissimoSimplicite_Helper_Data extends Mage_Core_Helper_Abstrac
|
|
181 |
*/
|
182 |
public function getFormatedShippingPrice($shippingPrice,$maxDecimalDigit = 2)
|
183 |
{
|
184 |
-
$formatedPrice = number_format($shippingPrice
|
185 |
return $formatedPrice;
|
186 |
}
|
187 |
|
@@ -194,7 +194,7 @@ class LaPoste_SoColissimoSimplicite_Helper_Data extends Mage_Core_Helper_Abstrac
|
|
194 |
public function getFormatedWeight($weight)
|
195 |
{
|
196 |
$weight = str_replace(',', '.', $weight);
|
197 |
-
|
198 |
$formatedWeight = number_format($weight, 2, '.', '');
|
199 |
return $formatedWeight;
|
200 |
}
|
@@ -209,8 +209,8 @@ class LaPoste_SoColissimoSimplicite_Helper_Data extends Mage_Core_Helper_Abstrac
|
|
209 |
{
|
210 |
$prefixSoCo = '';
|
211 |
$mapPrefix = $this->getMapPrefix();
|
212 |
-
if (in_array($prefixMagento
|
213 |
-
$prefixSoCo = array_search($prefixMagento
|
214 |
}
|
215 |
return $prefixSoCo;
|
216 |
}
|
@@ -251,6 +251,20 @@ class LaPoste_SoColissimoSimplicite_Helper_Data extends Mage_Core_Helper_Abstrac
|
|
251 |
$serviceAvailable = false;
|
252 |
}
|
253 |
curl_close($c);
|
254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
}
|
256 |
}
|
169 |
public function getMapPrefix()
|
170 |
{
|
171 |
$map = Mage::getStoreConfig('carriers/socolissimosimplicite/mapprefix');
|
172 |
+
return json_decode($map, true); //TODOpeleq gérer une erreur ds le json ?
|
173 |
}
|
174 |
|
175 |
/**
|
181 |
*/
|
182 |
public function getFormatedShippingPrice($shippingPrice,$maxDecimalDigit = 2)
|
183 |
{
|
184 |
+
$formatedPrice = number_format($shippingPrice, $maxDecimalDigit, '.', '');
|
185 |
return $formatedPrice;
|
186 |
}
|
187 |
|
194 |
public function getFormatedWeight($weight)
|
195 |
{
|
196 |
$weight = str_replace(',', '.', $weight);
|
197 |
+
$weight = $weight / 1000; //converti kg en g
|
198 |
$formatedWeight = number_format($weight, 2, '.', '');
|
199 |
return $formatedWeight;
|
200 |
}
|
209 |
{
|
210 |
$prefixSoCo = '';
|
211 |
$mapPrefix = $this->getMapPrefix();
|
212 |
+
if (in_array($prefixMagento, $mapPrefix)) {
|
213 |
+
$prefixSoCo = array_search($prefixMagento, $mapPrefix);
|
214 |
}
|
215 |
return $prefixSoCo;
|
216 |
}
|
251 |
$serviceAvailable = false;
|
252 |
}
|
253 |
curl_close($c);
|
254 |
+
return $serviceAvailable;
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Vérifie si on est dans le cas du recalcul des frais de livraison
|
259 |
+
* effectué par Magento à l'étape de vérification de la commande
|
260 |
+
* dans les versions CE1.5 et EE1.10
|
261 |
+
* @return boolean
|
262 |
+
*/
|
263 |
+
public function hasToDebugModeRdv()
|
264 |
+
{
|
265 |
+
$rdvOK = Mage::getSingleton('checkout/session')->getData('socolissimosimplicite_mode_rdv');
|
266 |
+
$stepOK = Mage::getSingleton('checkout/session')->getData('socolissimosimplicite_flag');
|
267 |
+
$hasToDebug = $rdvOK && $stepOK;
|
268 |
+
return $hasToDebug;
|
269 |
}
|
270 |
}
|
app/code/community/LaPoste/SoColissimoSimplicite/Model/Carrier/ShippingMethod.php
CHANGED
@@ -28,8 +28,8 @@ class LaPoste_SoColissimoSimplicite_Model_Carrier_ShippingMethod
|
|
28 |
* @param Mage_Shipping_Model_Rate_Request $request
|
29 |
* @return Mage_Shipping_Model_Rate_Result
|
30 |
*/
|
31 |
-
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
32 |
-
|
33 |
//on stoppe si le mode de livraison n'est pas activé dans la configuration
|
34 |
if (!$this->getConfigFlag('active')) {
|
35 |
return false;
|
@@ -53,8 +53,12 @@ class LaPoste_SoColissimoSimplicite_Model_Carrier_ShippingMethod
|
|
53 |
$method->setPrice($this->getCalculatedPrice());
|
54 |
}
|
55 |
|
|
|
|
|
|
|
|
|
|
|
56 |
$result->append($method);
|
57 |
-
|
58 |
return $result;
|
59 |
}
|
60 |
|
@@ -86,6 +90,10 @@ class LaPoste_SoColissimoSimplicite_Model_Carrier_ShippingMethod
|
|
86 |
if ($shippingAddress->getData('soco_mode_rdv') == true
|
87 |
and $shippingAddress->getData('base_shipping_amount') > 0) {
|
88 |
return $shippingAddress->getData('base_shipping_amount');
|
|
|
|
|
|
|
|
|
89 |
}
|
90 |
|
91 |
// sinon calcul en fonction de la configuration
|
@@ -103,27 +111,24 @@ class LaPoste_SoColissimoSimplicite_Model_Carrier_ShippingMethod
|
|
103 |
if (is_null($rules) or empty($rules)) {
|
104 |
throw new Exception($helper->__('SoColissimo : la valeur de configuration "Calcul des frais de livraison" pour le type "tarif selon le poids" fournie "'.$amountCalculation.'" n\'est pas dans le bon format, exemple {"0":"2.90","0.5":"4.50","5":"8","10":"14"}'));
|
105 |
} else {
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
}
|
123 |
-
}
|
124 |
-
} catch (Exception $e) {
|
125 |
throw new Exception($helper->__('SoColissimo : la valeur de configuration "Calcul des frais de livraison" pour le type "tarif selon le poids" fournie "'.$amountCalculation.'" n\'est pas dans le bon format, exemple {"0":"2.90","0.5":"4.50","5":"8","10":"14"}'));
|
126 |
-
|
127 |
}
|
128 |
break;
|
129 |
case 'per_amount':
|
@@ -132,27 +137,24 @@ class LaPoste_SoColissimoSimplicite_Model_Carrier_ShippingMethod
|
|
132 |
if (is_null($rules) or empty($rules)) {
|
133 |
throw new Exception($helper->__('SoColissimo : la valeur de configuration "Calcul des frais de livraison" pour le type "tarif selon le sous-total" fournie "'.$amountCalculation.'" n\'est pas dans le bon format, exemple {"0":"3","50":"5","100":"8","250":"0"}'));
|
134 |
} else {
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
}
|
152 |
-
}
|
153 |
-
} catch (Exception $e) {
|
154 |
throw new Exception($helper->__('SoColissimo : la valeur de configuration "Calcul des frais de livraison" pour le type "tarif selon le sous-total" fournie "'.$amountCalculation.'" n\'est pas dans le bon format, exemple {"0":"3","50":"5","100":"8","250":"0"}'));
|
155 |
-
|
156 |
}
|
157 |
break;
|
158 |
default:
|
28 |
* @param Mage_Shipping_Model_Rate_Request $request
|
29 |
* @return Mage_Shipping_Model_Rate_Result
|
30 |
*/
|
31 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
32 |
+
{
|
33 |
//on stoppe si le mode de livraison n'est pas activé dans la configuration
|
34 |
if (!$this->getConfigFlag('active')) {
|
35 |
return false;
|
53 |
$method->setPrice($this->getCalculatedPrice());
|
54 |
}
|
55 |
|
56 |
+
// vérifier si la livraison collisimo est offerte via une règle de prix
|
57 |
+
if ($request->getFreeShipping()) {
|
58 |
+
$method->setPrice(0);
|
59 |
+
}
|
60 |
+
|
61 |
$result->append($method);
|
|
|
62 |
return $result;
|
63 |
}
|
64 |
|
90 |
if ($shippingAddress->getData('soco_mode_rdv') == true
|
91 |
and $shippingAddress->getData('base_shipping_amount') > 0) {
|
92 |
return $shippingAddress->getData('base_shipping_amount');
|
93 |
+
// sinon si bug des frais RDV non comptabilisés, on utilise le montant mémorisé en session
|
94 |
+
// (versions CE1.5 et EE1.10, à l'étape savePayment du onepage)
|
95 |
+
} elseif (Mage::helper('socolissimosimplicite')->hasToDebugModeRdv()) {
|
96 |
+
return Mage::getSingleton('checkout/session')->getData('socolissimosimplicite_shipping_amount');
|
97 |
}
|
98 |
|
99 |
// sinon calcul en fonction de la configuration
|
111 |
if (is_null($rules) or empty($rules)) {
|
112 |
throw new Exception($helper->__('SoColissimo : la valeur de configuration "Calcul des frais de livraison" pour le type "tarif selon le poids" fournie "'.$amountCalculation.'" n\'est pas dans le bon format, exemple {"0":"2.90","0.5":"4.50","5":"8","10":"14"}'));
|
113 |
} else {
|
114 |
+
try {
|
115 |
+
//tri par poids décroissant
|
116 |
+
krsort($rules, SORT_NUMERIC);
|
117 |
+
|
118 |
+
//récupération du poids total de la commande (en kilogrammes)
|
119 |
+
$totalWeight = $shippingAddress->getWeight();
|
120 |
+
|
121 |
+
//recherche du prix selon les fourchettes de tarifs données
|
122 |
+
$calculatedPrice = false;
|
123 |
+
foreach ($rules as $w => $p) {
|
124 |
+
$calculatedPrice = $p;
|
125 |
+
if ($w <= $totalWeight) {
|
126 |
+
break;
|
127 |
+
}
|
128 |
+
}
|
129 |
+
} catch (Exception $e) {
|
|
|
|
|
|
|
130 |
throw new Exception($helper->__('SoColissimo : la valeur de configuration "Calcul des frais de livraison" pour le type "tarif selon le poids" fournie "'.$amountCalculation.'" n\'est pas dans le bon format, exemple {"0":"2.90","0.5":"4.50","5":"8","10":"14"}'));
|
131 |
+
}
|
132 |
}
|
133 |
break;
|
134 |
case 'per_amount':
|
137 |
if (is_null($rules) or empty($rules)) {
|
138 |
throw new Exception($helper->__('SoColissimo : la valeur de configuration "Calcul des frais de livraison" pour le type "tarif selon le sous-total" fournie "'.$amountCalculation.'" n\'est pas dans le bon format, exemple {"0":"3","50":"5","100":"8","250":"0"}'));
|
139 |
} else {
|
140 |
+
try {
|
141 |
+
//tri par montant décroissant
|
142 |
+
krsort($rules, SORT_NUMERIC);
|
143 |
+
|
144 |
+
//recuperation du sous total HT du panier
|
145 |
+
$totalAmount = $shippingAddress->getSubtotal();
|
146 |
+
|
147 |
+
//recherche du prix selon les fourchettes de tarifs donnees
|
148 |
+
$calculatedPrice = false;
|
149 |
+
foreach ($rules as $w => $p) {
|
150 |
+
$calculatedPrice = $p;
|
151 |
+
if ($w <= $totalAmount) {
|
152 |
+
break;
|
153 |
+
}
|
154 |
+
}
|
155 |
+
} catch (Exception $e) {
|
|
|
|
|
|
|
156 |
throw new Exception($helper->__('SoColissimo : la valeur de configuration "Calcul des frais de livraison" pour le type "tarif selon le sous-total" fournie "'.$amountCalculation.'" n\'est pas dans le bon format, exemple {"0":"3","50":"5","100":"8","250":"0"}'));
|
157 |
+
}
|
158 |
}
|
159 |
break;
|
160 |
default:
|
app/code/community/LaPoste/SoColissimoSimplicite/Model/Mysql4/Transaction.php
CHANGED
@@ -14,7 +14,8 @@
|
|
14 |
*/
|
15 |
class LaPoste_SoColissimoSimplicite_Model_Mysql4_Transaction extends Mage_Core_Model_Mysql4_Abstract
|
16 |
{
|
17 |
-
public function _construct()
|
18 |
-
|
|
|
19 |
}
|
20 |
}
|
14 |
*/
|
15 |
class LaPoste_SoColissimoSimplicite_Model_Mysql4_Transaction extends Mage_Core_Model_Mysql4_Abstract
|
16 |
{
|
17 |
+
public function _construct()
|
18 |
+
{
|
19 |
+
$this->_init('socolissimosimplicite/transaction', 'transaction_id');
|
20 |
}
|
21 |
}
|
app/code/community/LaPoste/SoColissimoSimplicite/Model/Mysql4/Transaction/Collection.php
CHANGED
@@ -15,7 +15,8 @@
|
|
15 |
class LaPoste_SoColissimoSimplicite_Model_Mysql4_Transaction_Collection
|
16 |
extends Mage_Core_Model_Mysql4_Collection_Abstract
|
17 |
{
|
18 |
-
public function _construct()
|
|
|
19 |
$this->_init('socolissimosimplicite/transaction');
|
20 |
}
|
21 |
}
|
15 |
class LaPoste_SoColissimoSimplicite_Model_Mysql4_Transaction_Collection
|
16 |
extends Mage_Core_Model_Mysql4_Collection_Abstract
|
17 |
{
|
18 |
+
public function _construct()
|
19 |
+
{
|
20 |
$this->_init('socolissimosimplicite/transaction');
|
21 |
}
|
22 |
}
|
app/code/community/LaPoste/SoColissimoSimplicite/Model/Observer.php
CHANGED
@@ -65,10 +65,9 @@ class LaPoste_SoColissimoSimplicite_Model_Observer
|
|
65 |
//depuis SO Colissimo
|
66 |
$shippingData = $checkoutSession->getData('socolissimosimplicite_shipping_data');
|
67 |
|
68 |
-
$this->_updateQuoteAndShippingAddress($shippingAddress
|
69 |
}
|
70 |
}
|
71 |
-
|
72 |
}
|
73 |
|
74 |
public function clearCheckoutSession($observer)
|
@@ -81,6 +80,10 @@ class LaPoste_SoColissimoSimplicite_Model_Observer
|
|
81 |
$checkoutSession->unsetData('socolissimosimplicite_shipping_data');
|
82 |
$checkoutSession->unsetData('socolissimosimplicite_from_socolissimo');
|
83 |
$checkoutSession->unsetData('socolissimosimplicite_new_address_from_socolissimo');
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
}
|
86 |
|
@@ -92,55 +95,55 @@ class LaPoste_SoColissimoSimplicite_Model_Observer
|
|
92 |
|
93 |
public function addSocoAttributesToOrder($observer)
|
94 |
{
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
}
|
142 |
|
143 |
-
|
144 |
* Met à jour les données sur l'adresse de livraison à partir des
|
145 |
* informations retournées par SO Colissimo.
|
146 |
* @param Mage_Sales_Model_Quote_Address $shippingAddress
|
@@ -151,8 +154,8 @@ class LaPoste_SoColissimoSimplicite_Model_Observer
|
|
151 |
{
|
152 |
$checkoutSession = Mage::getSingleton('checkout/session');
|
153 |
if ($checkoutSession->hasData('socolissimosimplicite_new_address_from_socolissimo')) {
|
154 |
-
|
155 |
-
|
156 |
$checkoutSession->unsetData('socolissimosimplicite_new_address_from_socolissimo');
|
157 |
|
158 |
$helper = Mage::helper('socolissimosimplicite');
|
@@ -164,7 +167,7 @@ class LaPoste_SoColissimoSimplicite_Model_Observer
|
|
164 |
$customerNotesArray = array();
|
165 |
|
166 |
foreach ($shippingData as $fieldSoCo => $valueSoCo) {
|
167 |
-
if (array_key_exists($fieldSoCo
|
168 |
$fieldMagento = $this->_mapFields[$fieldSoCo];
|
169 |
$arrayData[$fieldMagento] = $valueSoCo;
|
170 |
} elseif ($valueSoCo) {
|
@@ -224,7 +227,7 @@ class LaPoste_SoColissimoSimplicite_Model_Observer
|
|
224 |
}
|
225 |
|
226 |
if (! empty($customerNotesArray)) {
|
227 |
-
$arrayData['customer_notes'] = implode("\n"
|
228 |
}
|
229 |
|
230 |
//recuperation du mode de livraison choisi
|
@@ -237,17 +240,15 @@ class LaPoste_SoColissimoSimplicite_Model_Observer
|
|
237 |
|
238 |
//en mode RDV, on ajoute dans l'adresse la notion de rendez-vous
|
239 |
if ($deliveryMode == self::modRDV) {
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
} else {
|
250 |
-
|
251 |
// marquer le mode normal au niveau de l'adresse (calcul dépend du mode)
|
252 |
$arrayData['soco_mode_rdv'] = false;
|
253 |
}
|
@@ -262,6 +263,10 @@ class LaPoste_SoColissimoSimplicite_Model_Observer
|
|
262 |
$shippingAddress->collectShippingRates();
|
263 |
|
264 |
$shippingAddress->save();
|
265 |
-
|
|
|
|
|
|
|
|
|
266 |
}
|
267 |
}
|
65 |
//depuis SO Colissimo
|
66 |
$shippingData = $checkoutSession->getData('socolissimosimplicite_shipping_data');
|
67 |
|
68 |
+
$this->_updateQuoteAndShippingAddress($shippingAddress, $shippingData);
|
69 |
}
|
70 |
}
|
|
|
71 |
}
|
72 |
|
73 |
public function clearCheckoutSession($observer)
|
80 |
$checkoutSession->unsetData('socolissimosimplicite_shipping_data');
|
81 |
$checkoutSession->unsetData('socolissimosimplicite_from_socolissimo');
|
82 |
$checkoutSession->unsetData('socolissimosimplicite_new_address_from_socolissimo');
|
83 |
+
// nettoie les variables servant à corriger le bug de frais de livraison sur rdv
|
84 |
+
$checkoutSession->unsetData('socolissimosimplicite_mode_rdv');
|
85 |
+
$checkoutSession->unsetData('socolissimosimplicite_flag');
|
86 |
+
$checkoutSession->unsetData('socolissimosimplicite_shipping_amount');
|
87 |
}
|
88 |
}
|
89 |
|
95 |
|
96 |
public function addSocoAttributesToOrder($observer)
|
97 |
{
|
98 |
+
try {
|
99 |
+
$checkoutSession = Mage::getSingleton('checkout/session');
|
100 |
+
$shippingData = $checkoutSession->getData('socolissimosimplicite_shipping_data');
|
101 |
+
|
102 |
+
//on ne fait le traitement que si le mode d'expedition est socolissimo (et donc qu'on a recupere les donnees de socolissimo)
|
103 |
+
if (isset($shippingData) && count($shippingData) > 0) {
|
104 |
+
|
105 |
+
if (isset($shippingData['DELIVERYMODE'])) {
|
106 |
+
$observer->getEvent()->getOrder()->setSocoProductCode($shippingData['DELIVERYMODE']);
|
107 |
+
}
|
108 |
+
|
109 |
+
if (isset($shippingData['CEDELIVERYINFORMATION'])) {
|
110 |
+
$observer->getEvent()->getOrder()->setSocoShippingInstruction($shippingData['CEDELIVERYINFORMATION']);
|
111 |
+
}
|
112 |
+
|
113 |
+
if (isset($shippingData['CEDOORCODE1'])) {
|
114 |
+
$observer->getEvent()->getOrder()->setSocoDoorCode1($shippingData['CEDOORCODE1']);
|
115 |
+
}
|
116 |
+
|
117 |
+
if (isset($shippingData['CEDOORCODE2'])) {
|
118 |
+
$observer->getEvent()->getOrder()->setSocoDoorCode2($shippingData['CEDOORCODE2']);
|
119 |
+
}
|
120 |
+
|
121 |
+
if (isset($shippingData['CEENTRYPHONE'])) {
|
122 |
+
$observer->getEvent()->getOrder()->setSocoInterphone($shippingData['CEENTRYPHONE']);
|
123 |
+
}
|
124 |
+
|
125 |
+
if (isset($shippingData['PRID'])) {
|
126 |
+
$observer->getEvent()->getOrder()->setSocoRelayPointCode($shippingData['PRID']);
|
127 |
+
}
|
128 |
+
|
129 |
+
if (isset($shippingData['CECIVILITY'])) {
|
130 |
+
$observer->getEvent()->getOrder()->setSocoCivility($shippingData['CECIVILITY']);
|
131 |
+
}
|
132 |
+
|
133 |
+
if (isset($shippingData['CEPHONENUMBER'])) {
|
134 |
+
$observer->getEvent()->getOrder()->setSocoPhoneNumber($shippingData['CEPHONENUMBER']);
|
135 |
+
}
|
136 |
+
|
137 |
+
if (isset($shippingData['CEEMAIL'])) {
|
138 |
+
$observer->getEvent()->getOrder()->setSocoEmail($shippingData['CEEMAIL']);
|
139 |
+
}
|
140 |
+
}
|
141 |
+
} catch (Exception $e) {
|
142 |
+
Mage::Log('Failed to save so-colissimo data : '.print_r($shippingData, true));
|
143 |
+
}
|
144 |
}
|
145 |
|
146 |
+
/**
|
147 |
* Met à jour les données sur l'adresse de livraison à partir des
|
148 |
* informations retournées par SO Colissimo.
|
149 |
* @param Mage_Sales_Model_Quote_Address $shippingAddress
|
154 |
{
|
155 |
$checkoutSession = Mage::getSingleton('checkout/session');
|
156 |
if ($checkoutSession->hasData('socolissimosimplicite_new_address_from_socolissimo')) {
|
157 |
+
|
158 |
+
// on traite la nouvelle addresse une seule fois
|
159 |
$checkoutSession->unsetData('socolissimosimplicite_new_address_from_socolissimo');
|
160 |
|
161 |
$helper = Mage::helper('socolissimosimplicite');
|
167 |
$customerNotesArray = array();
|
168 |
|
169 |
foreach ($shippingData as $fieldSoCo => $valueSoCo) {
|
170 |
+
if (array_key_exists($fieldSoCo, $this->_mapFields)) {
|
171 |
$fieldMagento = $this->_mapFields[$fieldSoCo];
|
172 |
$arrayData[$fieldMagento] = $valueSoCo;
|
173 |
} elseif ($valueSoCo) {
|
227 |
}
|
228 |
|
229 |
if (! empty($customerNotesArray)) {
|
230 |
+
$arrayData['customer_notes'] = implode("\n", $customerNotesArray);
|
231 |
}
|
232 |
|
233 |
//recuperation du mode de livraison choisi
|
240 |
|
241 |
//en mode RDV, on ajoute dans l'adresse la notion de rendez-vous
|
242 |
if ($deliveryMode == self::modRDV) {
|
243 |
+
if (isset($street['3'])) {
|
244 |
+
$street['3'] .= ' '.$helper->__('(livraison sur rendez-vous)');
|
245 |
+
} else {
|
246 |
+
$street['3'] = $helper->__('(livraison sur rendez-vous)');
|
247 |
+
}
|
248 |
+
|
249 |
+
// marquer le mode RDV au niveau de l'adresse (calcul dépend du mode)
|
250 |
+
$arrayData['soco_mode_rdv'] = true;
|
|
|
251 |
} else {
|
|
|
252 |
// marquer le mode normal au niveau de l'adresse (calcul dépend du mode)
|
253 |
$arrayData['soco_mode_rdv'] = false;
|
254 |
}
|
263 |
$shippingAddress->collectShippingRates();
|
264 |
|
265 |
$shippingAddress->save();
|
266 |
+
|
267 |
+
// sauvegarde rdv et montant livraison dans la session
|
268 |
+
$checkoutSession->setData('socolissimosimplicite_shipping_amount', $shippingData['DYFORWARDINGCHARGES']);
|
269 |
+
$checkoutSession->setData('socolissimosimplicite_mode_rdv', self::modRDV);
|
270 |
+
}
|
271 |
}
|
272 |
}
|
app/code/community/LaPoste/SoColissimoSimplicite/Model/System/Config/Source/Shipping/Amountbasetype.php
CHANGED
@@ -16,14 +16,14 @@ class LaPoste_SoColissimoSimplicite_Model_System_Config_Source_Shipping_Amountba
|
|
16 |
{
|
17 |
return array(
|
18 |
array(
|
19 |
-
|
20 |
-
|
21 |
array(
|
22 |
-
|
23 |
-
|
24 |
array(
|
25 |
-
|
26 |
-
|
27 |
);
|
28 |
}
|
29 |
}
|
16 |
{
|
17 |
return array(
|
18 |
array(
|
19 |
+
'value'=>'fixed',
|
20 |
+
'label'=>Mage::helper('socolissimosimplicite')->__('Tarif unique')),
|
21 |
array(
|
22 |
+
'value'=>'per_weight',
|
23 |
+
'label'=>Mage::helper('socolissimosimplicite')->__('Tarif selon poids')),
|
24 |
array(
|
25 |
+
'value'=>'per_amount',
|
26 |
+
'label'=>Mage::helper('socolissimosimplicite')->__('Tarif selon sous-total du panier')),
|
27 |
);
|
28 |
}
|
29 |
}
|
app/code/community/LaPoste/SoColissimoSimplicite/Model/Transaction.php
CHANGED
@@ -20,7 +20,8 @@ class LaPoste_SoColissimoSimplicite_Model_Transaction extends Mage_Core_Model_Ab
|
|
20 |
* Constructeur par défaut
|
21 |
* @return LaPoste_SoColissimoSimplicite_Model_Transaction
|
22 |
*/
|
23 |
-
public function _construct()
|
|
|
24 |
parent::_construct();
|
25 |
$this->_init('socolissimosimplicite/transaction');
|
26 |
}
|
@@ -29,7 +30,8 @@ class LaPoste_SoColissimoSimplicite_Model_Transaction extends Mage_Core_Model_Ab
|
|
29 |
* Retourne le helper principal du module.
|
30 |
* @return LaPoste_SoColissimoSimplicite_Helper_Data
|
31 |
*/
|
32 |
-
public function helper()
|
|
|
33 |
if (is_null($this->_helper)) {
|
34 |
$this->_helper = Mage::helper('socolissimosimplicite');
|
35 |
}
|
@@ -42,8 +44,8 @@ class LaPoste_SoColissimoSimplicite_Model_Transaction extends Mage_Core_Model_Ab
|
|
42 |
* @param Mage_Sales_Model_Quote_Address $shippingAddress
|
43 |
* @return LaPoste_SoColissimoSimplicite_Model_Transaction
|
44 |
*/
|
45 |
-
public function create($shippingAddress)
|
46 |
-
|
47 |
$now = date('Y-m-d h:i:s');
|
48 |
$this->setCreatedAt($now);
|
49 |
$this->setIsDone(0);
|
@@ -61,7 +63,7 @@ class LaPoste_SoColissimoSimplicite_Model_Transaction extends Mage_Core_Model_Ab
|
|
61 |
return $this;
|
62 |
}
|
63 |
|
64 |
-
|
65 |
* Génère la signature requise pour l'accès à la plateforme SO Colissimo (front-office).
|
66 |
*
|
67 |
* SPECIFICATIONS FOURNIES PAR LA POSTE :
|
@@ -107,18 +109,18 @@ class LaPoste_SoColissimoSimplicite_Model_Transaction extends Mage_Core_Model_Ab
|
|
107 |
* access to colissimo is forbidden (error code 007 signature invalide)
|
108 |
* @return string signature de 160 bits (40 caractères)
|
109 |
*/
|
110 |
-
protected function _getGeneratedSignature($shippingAddress)
|
111 |
-
|
112 |
$stringToConvert = '';
|
113 |
|
114 |
if ($this->getId() && ! is_null($shippingAddress)) {
|
115 |
$accountId = $this->helper()->getAccountId();
|
116 |
$encryptionKey = $this->helper()->getEncryptionKey();
|
117 |
-
|
118 |
$stringToConvert =
|
119 |
$accountId.
|
120 |
$shippingAddress->getLastname().
|
121 |
-
$this->helper()->getFormatedShippingPrice($
|
122 |
$shippingAddress->getCustomerId().
|
123 |
$shippingAddress->getQuoteId().
|
124 |
$this->getId().
|
20 |
* Constructeur par défaut
|
21 |
* @return LaPoste_SoColissimoSimplicite_Model_Transaction
|
22 |
*/
|
23 |
+
public function _construct()
|
24 |
+
{
|
25 |
parent::_construct();
|
26 |
$this->_init('socolissimosimplicite/transaction');
|
27 |
}
|
30 |
* Retourne le helper principal du module.
|
31 |
* @return LaPoste_SoColissimoSimplicite_Helper_Data
|
32 |
*/
|
33 |
+
public function helper()
|
34 |
+
{
|
35 |
if (is_null($this->_helper)) {
|
36 |
$this->_helper = Mage::helper('socolissimosimplicite');
|
37 |
}
|
44 |
* @param Mage_Sales_Model_Quote_Address $shippingAddress
|
45 |
* @return LaPoste_SoColissimoSimplicite_Model_Transaction
|
46 |
*/
|
47 |
+
public function create($shippingAddress)
|
48 |
+
{
|
49 |
$now = date('Y-m-d h:i:s');
|
50 |
$this->setCreatedAt($now);
|
51 |
$this->setIsDone(0);
|
63 |
return $this;
|
64 |
}
|
65 |
|
66 |
+
/**
|
67 |
* Génère la signature requise pour l'accès à la plateforme SO Colissimo (front-office).
|
68 |
*
|
69 |
* SPECIFICATIONS FOURNIES PAR LA POSTE :
|
109 |
* access to colissimo is forbidden (error code 007 signature invalide)
|
110 |
* @return string signature de 160 bits (40 caractères)
|
111 |
*/
|
112 |
+
protected function _getGeneratedSignature($shippingAddress)
|
113 |
+
{
|
114 |
$stringToConvert = '';
|
115 |
|
116 |
if ($this->getId() && ! is_null($shippingAddress)) {
|
117 |
$accountId = $this->helper()->getAccountId();
|
118 |
$encryptionKey = $this->helper()->getEncryptionKey();
|
119 |
+
$shippingPrice = ($shippingAddress->getFreeShipping() === '1')? 0 : $shippingAddress->getShippingAmount();
|
120 |
$stringToConvert =
|
121 |
$accountId.
|
122 |
$shippingAddress->getLastname().
|
123 |
+
$this->helper()->getFormatedShippingPrice($shippingPrice).
|
124 |
$shippingAddress->getCustomerId().
|
125 |
$shippingAddress->getQuoteId().
|
126 |
$this->getId().
|
app/code/community/LaPoste/SoColissimoSimplicite/Test/Model/Carrier/ShippingMethodTest.php
ADDED
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once 'PHPUnit/Framework.php';
|
3 |
+
require_once 'app/Mage.php';
|
4 |
+
/**
|
5 |
+
* Aims to test shipping method calculated price
|
6 |
+
*
|
7 |
+
* @category LaPoste
|
8 |
+
* @package LaPoste_SoColissimoSimplicite
|
9 |
+
* @see LaPoste_SoColissimoSimplicite_Model_Carrier_ShippingMethod
|
10 |
+
* @author nicolas.dupont@smile.fr
|
11 |
+
*/
|
12 |
+
class LaPoste_SoColissimoSimplicite_Test_Model_Carrier_ShippingMethodTest extends PHPUnit_Framework_TestCase
|
13 |
+
{
|
14 |
+
|
15 |
+
private $_setup;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Constructor
|
19 |
+
*/
|
20 |
+
public function __construct()
|
21 |
+
{
|
22 |
+
Mage::app('default');
|
23 |
+
// initialize setup
|
24 |
+
if (version_compare(Mage::getVersion(), '1.3.2.4', '>')) {
|
25 |
+
$this->_setup = Mage::getModel('core/resource_setup');
|
26 |
+
} else {
|
27 |
+
// TODO: how to initialize setup for v1.3 ?
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Prepare test methods
|
33 |
+
*/
|
34 |
+
public function setUp()
|
35 |
+
{
|
36 |
+
$this->setConfigData('carriers/socolissimosimplicite/active', '1');
|
37 |
+
$this->setConfigData('carriers/socolissimosimplicite/title', 'La Poste');
|
38 |
+
$this->setConfigData('carriers/socolissimosimplicite/name', 'So Colissimo');
|
39 |
+
$this->setConfigData('carriers/socolissimosimplicite/selectmessage', 'En cliquant sur Poursuivre, vous serez redirigé(e) vers la page So Colissimo afin de choisir votre mode de livraison.');
|
40 |
+
$this->setConfigData('carriers/socolissimosimplicite/redirectmessage', 'Vous allez être redirigé(e) vers So Colissimo dans un instant...');
|
41 |
+
$this->setConfigData('carriers/socolissimosimplicite/account', '05464540472665');
|
42 |
+
$this->setConfigData('carriers/socolissimosimplicite/encryption_key', '506336340381');
|
43 |
+
$this->setConfigData('carriers/socolissimosimplicite/url_fo', 'http://217.108.161.163/pudo-fo/storeCall.do');
|
44 |
+
$this->setConfigData('carriers/socolissimosimplicite/active_service_is_available', '1');
|
45 |
+
$this->setConfigData('carriers/socolissimosimplicite/url_service_is_available', 'http://ws.colissimo.fr/supervision-pudo/supervision.jsp');
|
46 |
+
$this->setConfigData('carriers/socolissimosimplicite/not_available_message', "La plateforme technique So Colissimo est temporairement indisponible. Votre commande sera livrée à l\'adresse de livraison que vous venez d\'indiquer.");
|
47 |
+
$this->setConfigData('carriers/socolissimosimplicite/sallowspecific', '1');
|
48 |
+
$this->setConfigData('carriers/socolissimosimplicite/specificcountry', 'FR');
|
49 |
+
$this->setConfigData('carriers/socolissimosimplicite/sort_order', '1');
|
50 |
+
|
51 |
+
// Mage::app('default')->cleanCache();
|
52 |
+
// Mage::app('default')->getStore()->resetConfig();
|
53 |
+
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Utility function which aims to set up config data depends on Magento version
|
58 |
+
*/
|
59 |
+
private function setConfigData($path, $value)
|
60 |
+
{
|
61 |
+
$this->_setup->setConfigData($path, $value);
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Test collect rates method
|
66 |
+
*/
|
67 |
+
public function testCollectRatesPerAmount()
|
68 |
+
{
|
69 |
+
// set up per_amount
|
70 |
+
$this->setConfigData('carriers/socolissimosimplicite/minquotepriceforfree', '200');
|
71 |
+
$this->setConfigData('carriers/socolissimosimplicite/amountbasetype', 'per_amount');
|
72 |
+
$this->setConfigData('carriers/socolissimosimplicite/amountcalculation', '{"0":"3","50":"5","100":"8","250":"0"}');
|
73 |
+
|
74 |
+
// price < 50€ -> 3
|
75 |
+
$total = 35.99;
|
76 |
+
Mage::getModel('checkout/cart')->getQuote()->getShippingAddress()->setData('subtotal', $total);
|
77 |
+
$request = new Mage_Shipping_Model_Rate_Request();
|
78 |
+
$request->setData(array('package_value_with_discount' => $total));
|
79 |
+
$carrier = new LaPoste_SoColissimoSimplicite_Model_Carrier_ShippingMethod();
|
80 |
+
$result = $carrier->collectRates($request);
|
81 |
+
$rates = $result->getAllRates();
|
82 |
+
$this->assertEquals(count($rates), 1);
|
83 |
+
$rate = current($rates);
|
84 |
+
$this->assertNotNull($rate);
|
85 |
+
$this->assertEquals($rate->getData('carrier'), 'socolissimosimplicite');
|
86 |
+
$this->assertEquals($rate->getData('price'), 3);
|
87 |
+
|
88 |
+
// 50€ < price < 100€ -> 5
|
89 |
+
$total = 99.99;
|
90 |
+
Mage::getModel('checkout/cart')->getQuote()->getShippingAddress()->setData('subtotal', $total);
|
91 |
+
$request = new Mage_Shipping_Model_Rate_Request();
|
92 |
+
$request->setData(array('package_value_with_discount' => $total));
|
93 |
+
$carrier = new LaPoste_SoColissimoSimplicite_Model_Carrier_ShippingMethod();
|
94 |
+
$result = $carrier->collectRates($request);
|
95 |
+
$rates = $result->getAllRates();
|
96 |
+
$this->assertEquals(count($rates), 1);
|
97 |
+
$rate = current($rates);
|
98 |
+
$this->assertNotNull($rate);
|
99 |
+
$this->assertEquals($rate->getData('carrier'), 'socolissimosimplicite');
|
100 |
+
$this->assertEquals($rate->getData('price'), 5);
|
101 |
+
|
102 |
+
// 100€ < price < 250€ -> 8
|
103 |
+
$total = 125.99;
|
104 |
+
Mage::getModel('checkout/cart')->getQuote()->getShippingAddress()->setData('subtotal', $total);
|
105 |
+
$request = new Mage_Shipping_Model_Rate_Request();
|
106 |
+
$request->setData(array('package_value_with_discount' => $total));
|
107 |
+
$carrier = new LaPoste_SoColissimoSimplicite_Model_Carrier_ShippingMethod();
|
108 |
+
$result = $carrier->collectRates($request);
|
109 |
+
$rates = $result->getAllRates();
|
110 |
+
$this->assertEquals(count($rates), 1);
|
111 |
+
$rate = current($rates);
|
112 |
+
$this->assertNotNull($rate);
|
113 |
+
$this->assertEquals($rate->getData('carrier'), 'socolissimosimplicite');
|
114 |
+
$this->assertEquals($rate->getData('price'), 8);
|
115 |
+
|
116 |
+
// 250€ < price
|
117 |
+
$total = 250.01;
|
118 |
+
Mage::getModel('checkout/cart')->getQuote()->getShippingAddress()->setData('subtotal', $total);
|
119 |
+
$request = new Mage_Shipping_Model_Rate_Request();
|
120 |
+
$request->setData(array('package_value_with_discount' => $total));
|
121 |
+
$carrier = new LaPoste_SoColissimoSimplicite_Model_Carrier_ShippingMethod();
|
122 |
+
$result = $carrier->collectRates($request);
|
123 |
+
$rates = $result->getAllRates();
|
124 |
+
$this->assertEquals(count($rates), 1);
|
125 |
+
$rate = current($rates);
|
126 |
+
$this->assertNotNull($rate);
|
127 |
+
$this->assertEquals($rate->getData('carrier'), 'socolissimosimplicite');
|
128 |
+
$this->assertEquals($rate->getData('price'), 0);
|
129 |
+
|
130 |
+
// free shipping if total > 200 -> false, 8
|
131 |
+
$total = 115.50;
|
132 |
+
Mage::getModel('checkout/cart')->getQuote()->getShippingAddress()->setData('subtotal', $total);
|
133 |
+
$request = new Mage_Shipping_Model_Rate_Request();
|
134 |
+
$request->setData(array('package_value_with_discount' => $total));
|
135 |
+
$carrier = new LaPoste_SoColissimoSimplicite_Model_Carrier_ShippingMethod();
|
136 |
+
$result = $carrier->collectRates($request);
|
137 |
+
$rates = $result->getAllRates();
|
138 |
+
$this->assertEquals(count($rates), 1);
|
139 |
+
$rate = current($rates);
|
140 |
+
$this->assertNotNull($rate);
|
141 |
+
$this->assertEquals($rate->getData('carrier'), 'socolissimosimplicite');
|
142 |
+
$this->assertEquals($rate->getData('price'), 8);
|
143 |
+
|
144 |
+
// free shipping if total > 200 -> true, 0
|
145 |
+
$total = 201;
|
146 |
+
Mage::getModel('checkout/cart')->getQuote()->getShippingAddress()->setData('subtotal', $total);
|
147 |
+
$request = new Mage_Shipping_Model_Rate_Request();
|
148 |
+
$request->setData(array('package_value_with_discount' => $total));
|
149 |
+
$carrier = new LaPoste_SoColissimoSimplicite_Model_Carrier_ShippingMethod();
|
150 |
+
$result = $carrier->collectRates($request);
|
151 |
+
$rates = $result->getAllRates();
|
152 |
+
$this->assertEquals(count($rates), 1);
|
153 |
+
$rate = current($rates);
|
154 |
+
$this->assertNotNull($rate);
|
155 |
+
$this->assertEquals($rate->getData('carrier'), 'socolissimosimplicite');
|
156 |
+
$this->assertEquals($rate->getData('price'), 0);
|
157 |
+
|
158 |
+
// free shipping by cart rule (free_shipping param in $request)
|
159 |
+
$total = 25;
|
160 |
+
Mage::getModel('checkout/cart')->getQuote()->getShippingAddress()->setData('subtotal', $total);
|
161 |
+
$request = new Mage_Shipping_Model_Rate_Request();
|
162 |
+
$request->setData(array('package_value_with_discount' => $total, 'free_shipping' => true));
|
163 |
+
$carrier = new LaPoste_SoColissimoSimplicite_Model_Carrier_ShippingMethod();
|
164 |
+
$result = $carrier->collectRates($request);
|
165 |
+
$rates = $result->getAllRates();
|
166 |
+
$this->assertEquals(count($rates), 1);
|
167 |
+
$rate = current($rates);
|
168 |
+
$this->assertNotNull($rate);
|
169 |
+
$this->assertEquals($rate->getData('carrier'), 'socolissimosimplicite');
|
170 |
+
$this->assertEquals($rate->getData('price'), 0);
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Test collect rates method
|
175 |
+
* TODO: set up problem to fix !!
|
176 |
+
*
|
177 |
+
public function testCollectRatesPerWeight()
|
178 |
+
{
|
179 |
+
// set up per_amount
|
180 |
+
$this->setConfigData('carriers/socolissimosimplicite/minquotepriceforfree', '200');
|
181 |
+
$this->setConfigData('carriers/socolissimosimplicite/amountbasetype', 'per_weight');
|
182 |
+
$this->setConfigData('carriers/socolissimosimplicite/amountcalculation', '{"0":"2.90","0.5":"4.50","5":"8","10":"14"}');
|
183 |
+
//Mage::app('default')->cleanCache();
|
184 |
+
|
185 |
+
// price < 0.5Kg -> 2.90€
|
186 |
+
$weight = 0.3;
|
187 |
+
$total = 35.99;
|
188 |
+
Mage::getModel('checkout/cart')->getQuote()->getShippingAddress()->setData('subtotal', $total);
|
189 |
+
Mage::getModel('checkout/cart')->getQuote()->getShippingAddress()->setData('weight', $weight);
|
190 |
+
$request = new Mage_Shipping_Model_Rate_Request();
|
191 |
+
$request->setData(array('package_value_with_discount' => $total));
|
192 |
+
$carrier = new LaPoste_SoColissimoSimplicite_Model_Carrier_ShippingMethod();
|
193 |
+
$result = $carrier->collectRates($request);
|
194 |
+
$rates = $result->getAllRates();
|
195 |
+
$this->assertEquals(count($rates), 1);
|
196 |
+
$rate = current($rates);
|
197 |
+
$this->assertNotNull($rate);
|
198 |
+
$this->assertEquals($rate->getData('carrier'), 'socolissimosimplicite');
|
199 |
+
$this->assertEquals($rate->getData('price'), 2.90);
|
200 |
+
}*/
|
201 |
+
|
202 |
+
}
|
app/code/community/LaPoste/SoColissimoSimplicite/controllers/FormController.php
CHANGED
@@ -21,14 +21,14 @@ class LaPoste_SoColissimoSimplicite_FormController extends Mage_Core_Controller_
|
|
21 |
{
|
22 |
$checkoutSession = Mage::getSingleton('checkout/session');
|
23 |
|
24 |
-
|
25 |
-
|
26 |
$helper = Mage::helper('socolissimosimplicite');
|
27 |
if ($helper->getServiceIsAvailable() and $helper->getServiceIsAvailableUrl() != '') {
|
28 |
-
|
29 |
// passer à l'étape suivante avec le mode livraison à domicile
|
30 |
if (!$serviceAvailable) {
|
31 |
-
$checkoutSession->setData('socolissimosimplicite_checkout_onepage_nextstep','payment');
|
32 |
$this->getResponse()->setRedirect(Mage::getUrl('checkout/onepage'));
|
33 |
return;
|
34 |
}
|
@@ -37,9 +37,9 @@ class LaPoste_SoColissimoSimplicite_FormController extends Mage_Core_Controller_
|
|
37 |
// utiliser un flag en session pour vérifier si l'on accède à l'action suite
|
38 |
// à un retour du site collissimo, si c'est le cas on redirige sur le checkout
|
39 |
if ($checkoutSession->hasData('socolissimosimplicite_from_socolissimo')) {
|
40 |
-
|
41 |
// sauvegarde de l'étape suivante en session (choix de la méthode de livraison)
|
42 |
-
$checkoutSession->setData('socolissimosimplicite_checkout_onepage_nextstep','shipping_method');
|
43 |
$this->getResponse()->setRedirect(Mage::getUrl('checkout/onepage'));
|
44 |
return;
|
45 |
} else {
|
@@ -76,8 +76,8 @@ class LaPoste_SoColissimoSimplicite_FormController extends Mage_Core_Controller_
|
|
76 |
*/
|
77 |
public function successAction()
|
78 |
{
|
79 |
-
|
80 |
-
|
81 |
$checkoutSession->unsetData('socolissimosimplicite_from_socolissimo');
|
82 |
|
83 |
// si l'adresse de livraison a changée, mettre à jour la signature
|
@@ -87,7 +87,7 @@ class LaPoste_SoColissimoSimplicite_FormController extends Mage_Core_Controller_
|
|
87 |
$this->_saveSoColissimoData($checkoutSession);
|
88 |
|
89 |
// sauvegarde de l'étape suivante en session
|
90 |
-
$checkoutSession->setData('socolissimosimplicite_checkout_onepage_nextstep','payment');
|
91 |
|
92 |
$this->getResponse()->setRedirect(Mage::getUrl('checkout/onepage'));
|
93 |
}
|
@@ -102,10 +102,10 @@ class LaPoste_SoColissimoSimplicite_FormController extends Mage_Core_Controller_
|
|
102 |
$checkoutSession->unsetData('socolissimosimplicite_from_socolissimo');
|
103 |
|
104 |
// sauvegarde de l'étape suivante en session (choix de la méthode de livraison)
|
105 |
-
$checkoutSession->setData('socolissimosimplicite_checkout_onepage_nextstep','shipping_method');
|
106 |
|
107 |
// récupérer le code erreur et afficher le message correspondant
|
108 |
-
|
109 |
$helper = Mage::helper('socolissimosimplicite');
|
110 |
$errCodeToLabel = array(
|
111 |
'001' => $helper->__('Identifiant FO manquant'),
|
@@ -182,15 +182,17 @@ class LaPoste_SoColissimoSimplicite_FormController extends Mage_Core_Controller_
|
|
182 |
{
|
183 |
// sauve params adresse livraison
|
184 |
$allParams = $this->getRequest()->getParams();
|
185 |
-
$paramKeysToNotSave = array_flip(
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
|
|
|
|
194 |
$checkoutSession->setData('socolissimosimplicite_shipping_data', $shippingData);
|
195 |
|
196 |
// sauve transaction id, pour éviter de créer une nouvelle transaction si retour en arrière
|
21 |
{
|
22 |
$checkoutSession = Mage::getSingleton('checkout/session');
|
23 |
|
24 |
+
// vérifier la disponibilité de la plateforme, si ce n'est pas le cas,
|
25 |
+
// sélectionner la livraison à domicile et passer à l'étape suivante
|
26 |
$helper = Mage::helper('socolissimosimplicite');
|
27 |
if ($helper->getServiceIsAvailable() and $helper->getServiceIsAvailableUrl() != '') {
|
28 |
+
$serviceAvailable = $helper->checkServiceAvailability();
|
29 |
// passer à l'étape suivante avec le mode livraison à domicile
|
30 |
if (!$serviceAvailable) {
|
31 |
+
$checkoutSession->setData('socolissimosimplicite_checkout_onepage_nextstep', 'payment');
|
32 |
$this->getResponse()->setRedirect(Mage::getUrl('checkout/onepage'));
|
33 |
return;
|
34 |
}
|
37 |
// utiliser un flag en session pour vérifier si l'on accède à l'action suite
|
38 |
// à un retour du site collissimo, si c'est le cas on redirige sur le checkout
|
39 |
if ($checkoutSession->hasData('socolissimosimplicite_from_socolissimo')) {
|
40 |
+
$checkoutSession->unsetData('socolissimosimplicite_from_socolissimo');
|
41 |
// sauvegarde de l'étape suivante en session (choix de la méthode de livraison)
|
42 |
+
$checkoutSession->setData('socolissimosimplicite_checkout_onepage_nextstep', 'shipping_method');
|
43 |
$this->getResponse()->setRedirect(Mage::getUrl('checkout/onepage'));
|
44 |
return;
|
45 |
} else {
|
76 |
*/
|
77 |
public function successAction()
|
78 |
{
|
79 |
+
// permettre de revenir en arrière pour change le mode de livraison
|
80 |
+
$checkoutSession = Mage::getSingleton('checkout/session');
|
81 |
$checkoutSession->unsetData('socolissimosimplicite_from_socolissimo');
|
82 |
|
83 |
// si l'adresse de livraison a changée, mettre à jour la signature
|
87 |
$this->_saveSoColissimoData($checkoutSession);
|
88 |
|
89 |
// sauvegarde de l'étape suivante en session
|
90 |
+
$checkoutSession->setData('socolissimosimplicite_checkout_onepage_nextstep', 'payment');
|
91 |
|
92 |
$this->getResponse()->setRedirect(Mage::getUrl('checkout/onepage'));
|
93 |
}
|
102 |
$checkoutSession->unsetData('socolissimosimplicite_from_socolissimo');
|
103 |
|
104 |
// sauvegarde de l'étape suivante en session (choix de la méthode de livraison)
|
105 |
+
$checkoutSession->setData('socolissimosimplicite_checkout_onepage_nextstep', 'shipping_method');
|
106 |
|
107 |
// récupérer le code erreur et afficher le message correspondant
|
108 |
+
$errCode = trim($this->getRequest()->getPost('ERRORCODE'));
|
109 |
$helper = Mage::helper('socolissimosimplicite');
|
110 |
$errCodeToLabel = array(
|
111 |
'001' => $helper->__('Identifiant FO manquant'),
|
182 |
{
|
183 |
// sauve params adresse livraison
|
184 |
$allParams = $this->getRequest()->getParams();
|
185 |
+
$paramKeysToNotSave = array_flip(
|
186 |
+
array(
|
187 |
+
'TRRETURNURLKO',
|
188 |
+
'PUDOFOID',
|
189 |
+
'TRPARAMPLUS',
|
190 |
+
'TRADERCOMPANYNAME',
|
191 |
+
'ORDERID',
|
192 |
+
'SIGNATURE',
|
193 |
+
)
|
194 |
+
);
|
195 |
+
$shippingData = array_diff_key($allParams, $paramKeysToNotSave);
|
196 |
$checkoutSession->setData('socolissimosimplicite_shipping_data', $shippingData);
|
197 |
|
198 |
// sauve transaction id, pour éviter de créer une nouvelle transaction si retour en arrière
|
app/code/community/LaPoste/SoColissimoSimplicite/controllers/OnepageController.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* LaPoste_SoColissimoSimplicite
|
4 |
+
*
|
5 |
+
* @category LaPoste
|
6 |
+
* @package LaPoste_SoColissimoSimplicite
|
7 |
+
* @copyright Copyright (c) 2010 La Poste
|
8 |
+
* @author Smile (http://www.smile.fr)
|
9 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
10 |
+
*/
|
11 |
+
/**
|
12 |
+
* Surcharge du onepageController pour régler le bug des frais de livraison RDV en version 1.5 / 1.10
|
13 |
+
*/
|
14 |
+
require_once 'Mage/Checkout/controllers/OnepageController.php';
|
15 |
+
class LaPoste_SoColissimoSimplicite_OnepageController extends Mage_Checkout_OnepageController
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* Valorise un flag dans la session pour que la méthode ShippingMethod->getCalculatedPrice
|
19 |
+
* utilise les variables de session plutôt que celles du shipping_address
|
20 |
+
*/
|
21 |
+
public function savePaymentAction()
|
22 |
+
{
|
23 |
+
Mage::getSingleton('checkout/session')->setData('socolissimosimplicite_flag', true);
|
24 |
+
parent::savePaymentAction();
|
25 |
+
Mage::getSingleton('checkout/session')->setData('socolissimosimplicite_flag', false);
|
26 |
+
}
|
27 |
+
}
|
app/code/community/LaPoste/SoColissimoSimplicite/etc/config.xml
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
<config>
|
14 |
<modules>
|
15 |
<LaPoste_SoColissimoSimplicite>
|
16 |
-
<version>1.0.
|
17 |
</LaPoste_SoColissimoSimplicite>
|
18 |
</modules>
|
19 |
|
@@ -77,6 +77,13 @@
|
|
77 |
</LaPoste_SoColissimoSimplicite>
|
78 |
</modules>
|
79 |
</translate>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
</global>
|
81 |
|
82 |
<frontend>
|
13 |
<config>
|
14 |
<modules>
|
15 |
<LaPoste_SoColissimoSimplicite>
|
16 |
+
<version>1.0.8</version>
|
17 |
</LaPoste_SoColissimoSimplicite>
|
18 |
</modules>
|
19 |
|
77 |
</LaPoste_SoColissimoSimplicite>
|
78 |
</modules>
|
79 |
</translate>
|
80 |
+
|
81 |
+
<rewrite>
|
82 |
+
<socolissimosimplicite_onepage>
|
83 |
+
<from><![CDATA[#^/checkout/onepage/savePayment#]]></from>
|
84 |
+
<to>socolissimosimplicite/onepage/savePayment</to>
|
85 |
+
</socolissimosimplicite_onepage>
|
86 |
+
</rewrite>
|
87 |
</global>
|
88 |
|
89 |
<frontend>
|
app/code/community/LaPoste/SoColissimoSimplicite/sql/socolissimosimplicite_setup/mysql4-install-1.0.0.php
CHANGED
@@ -14,25 +14,22 @@ $installer = $this;
|
|
14 |
$installer->startSetup();
|
15 |
|
16 |
if (!$installer->tableExists($installer->getTable('laposte_socolissimosimplicite_transaction'))) {
|
17 |
-
|
18 |
-
$installer->run(
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
`
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
");
|
35 |
-
|
36 |
}
|
37 |
|
38 |
$installer->endSetup();
|
14 |
$installer->startSetup();
|
15 |
|
16 |
if (!$installer->tableExists($installer->getTable('laposte_socolissimosimplicite_transaction'))) {
|
17 |
+
|
18 |
+
$installer->run(
|
19 |
+
"-- DROP TABLE IF EXISTS {$this->getTable('laposte_socolissimosimplicite_transaction')};
|
20 |
+
CREATE TABLE {$this->getTable('laposte_socolissimosimplicite_transaction')} (
|
21 |
+
`transaction_id` bigint(16) unsigned NOT NULL auto_increment,
|
22 |
+
`quote_id` int(10) unsigned NOT NULL default '0',
|
23 |
+
`signature` varchar(40) NOT NULL default '',
|
24 |
+
`created_at` datetime NOT NULL default '0000-00-00 00:00:00',
|
25 |
+
PRIMARY KEY (`transaction_id`),
|
26 |
+
KEY `FK_laposte_socolissimosimplicite_transaction_QUOTE_ID` (`quote_id`),
|
27 |
+
CONSTRAINT `FK_laposte_socolissimosimplicite_transaction_QUOTE_ID` FOREIGN KEY (`quote_id`) REFERENCES `{$this->getTable('sales_flat_quote')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
|
28 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT = 10000 COMMENT='colissimo transations';
|
29 |
+
|
30 |
+
-- transaction_id doit contenir entre 5 et 16 caractères
|
31 |
+
ALTER TABLE {$this->getTable('laposte_socolissimosimplicite_transaction')} AUTO_INCREMENT = 10000;"
|
32 |
+
);
|
|
|
|
|
|
|
33 |
}
|
34 |
|
35 |
$installer->endSetup();
|
app/code/community/LaPoste/SoColissimoSimplicite/sql/socolissimosimplicite_setup/mysql4-uninstall-0.1.0.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Aims to uninstall module
|
4 |
+
*/
|
5 |
+
$installer = $this;
|
6 |
+
$installer->startSetup();
|
7 |
+
|
8 |
+
$installer->run(
|
9 |
+
"DELETE
|
10 |
+
FROM {$installer->getTable('core_config_data')}
|
11 |
+
WHERE path LIKE 'carriers/socolissimosimplicite/%';"
|
12 |
+
);
|
13 |
+
|
14 |
+
$installer->endSetup();
|
app/code/community/LaPoste/SoColissimoSimplicite/sql/socolissimosimplicite_setup/mysql4-upgrade-1.0.6-1.0.7.php
CHANGED
@@ -20,76 +20,112 @@ $this->removeAttribute('order', 'soco_interphone');
|
|
20 |
$this->removeAttribute('order', 'soco_relay_point_code');
|
21 |
|
22 |
|
23 |
-
$this->addAttribute(
|
24 |
-
'
|
25 |
-
'
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
30 |
|
31 |
-
$this->addAttribute(
|
32 |
-
'
|
33 |
-
'
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
38 |
|
39 |
-
$this->addAttribute(
|
40 |
-
'
|
41 |
-
'
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
46 |
|
47 |
-
$this->addAttribute(
|
48 |
-
'
|
49 |
-
'
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
54 |
|
55 |
-
$this->addAttribute(
|
56 |
-
'
|
57 |
-
'
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
62 |
|
63 |
-
$this->addAttribute(
|
64 |
-
'
|
65 |
-
'
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
|
|
70 |
|
71 |
-
$this->addAttribute(
|
72 |
-
'
|
73 |
-
'
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
78 |
|
79 |
-
$this->addAttribute(
|
80 |
-
'
|
81 |
-
'
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
|
|
86 |
|
87 |
-
$this->addAttribute(
|
88 |
-
'
|
89 |
-
'
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
|
|
|
|
|
|
|
|
94 |
|
95 |
$installer->endSetup();
|
20 |
$this->removeAttribute('order', 'soco_relay_point_code');
|
21 |
|
22 |
|
23 |
+
$this->addAttribute(
|
24 |
+
'order',
|
25 |
+
'soco_product_code',
|
26 |
+
array(
|
27 |
+
'type' => 'varchar',
|
28 |
+
'label' => 'Code produit So Colissimo',
|
29 |
+
'visible' => true,
|
30 |
+
'required' => false,
|
31 |
+
'input' => 'text',
|
32 |
+
)
|
33 |
+
);
|
34 |
|
35 |
+
$this->addAttribute(
|
36 |
+
'order',
|
37 |
+
'soco_shipping_instruction',
|
38 |
+
array(
|
39 |
+
'type' => 'varchar',
|
40 |
+
'label' => 'Instructions de livraison So Colissimo',
|
41 |
+
'visible' => true,
|
42 |
+
'required' => false,
|
43 |
+
'input' => 'text',
|
44 |
+
)
|
45 |
+
);
|
46 |
|
47 |
+
$this->addAttribute(
|
48 |
+
'order',
|
49 |
+
'soco_door_code1',
|
50 |
+
array(
|
51 |
+
'type' => 'varchar',
|
52 |
+
'label' => 'Code porte 1 So Colissimo',
|
53 |
+
'visible' => true,
|
54 |
+
'required' => false,
|
55 |
+
'input' => 'text',
|
56 |
+
)
|
57 |
+
);
|
58 |
|
59 |
+
$this->addAttribute(
|
60 |
+
'order',
|
61 |
+
'soco_door_code2',
|
62 |
+
array(
|
63 |
+
'type' => 'varchar',
|
64 |
+
'label' => 'Code porte 2 So Colissimo',
|
65 |
+
'visible' => true,
|
66 |
+
'required' => false,
|
67 |
+
'input' => 'text',
|
68 |
+
)
|
69 |
+
);
|
70 |
|
71 |
+
$this->addAttribute(
|
72 |
+
'order',
|
73 |
+
'soco_interphone',
|
74 |
+
array(
|
75 |
+
'type' => 'varchar',
|
76 |
+
'label' => 'Interphone So Colissimo',
|
77 |
+
'visible' => true,
|
78 |
+
'required' => false,
|
79 |
+
'input' => 'text',
|
80 |
+
)
|
81 |
+
);
|
82 |
|
83 |
+
$this->addAttribute(
|
84 |
+
'order',
|
85 |
+
'soco_relay_point_code',
|
86 |
+
array(
|
87 |
+
'type' => 'varchar',
|
88 |
+
'label' => 'Code du point de retrait So Colissimo',
|
89 |
+
'visible' => true,
|
90 |
+
'required' => false,
|
91 |
+
'input' => 'text',
|
92 |
+
)
|
93 |
+
);
|
94 |
|
95 |
+
$this->addAttribute(
|
96 |
+
'order',
|
97 |
+
'soco_civility',
|
98 |
+
array(
|
99 |
+
'type' => 'varchar',
|
100 |
+
'label' => 'Civilité',
|
101 |
+
'visible' => true,
|
102 |
+
'required' => false,
|
103 |
+
'input' => 'text',
|
104 |
+
)
|
105 |
+
);
|
106 |
|
107 |
+
$this->addAttribute(
|
108 |
+
'order',
|
109 |
+
'soco_phone_number',
|
110 |
+
array(
|
111 |
+
'type' => 'varchar',
|
112 |
+
'label' => 'Numéro de portable',
|
113 |
+
'visible' => true,
|
114 |
+
'required' => false,
|
115 |
+
'input' => 'text',
|
116 |
+
)
|
117 |
+
);
|
118 |
|
119 |
+
$this->addAttribute(
|
120 |
+
'order',
|
121 |
+
'soco_email',
|
122 |
+
array(
|
123 |
+
'type' => 'varchar',
|
124 |
+
'label' => 'E-mail du destinataire',
|
125 |
+
'visible' => true,
|
126 |
+
'required' => false,
|
127 |
+
'input' => 'text',
|
128 |
+
)
|
129 |
+
);
|
130 |
|
131 |
$installer->endSetup();
|
app/design/frontend/default/default/template/socolissimosimplicite/form.phtml
CHANGED
@@ -72,9 +72,11 @@ $_helper = $this->helper('socolissimosimplicite');
|
|
72 |
<?php if ($_address->getWeight()):?>
|
73 |
<input type="hidden" name="dyWeight" value="<?php echo $_helper->getFormatedWeight($_address->getWeight()); ?>" />
|
74 |
<?php endif;?>
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
78 |
<?php if ($_address->getCustomerId()):?>
|
79 |
<input type="hidden" name="trClientNumber" value="<?php echo $_address->getCustomerId(); ?>" />
|
80 |
<?php endif;?>
|
72 |
<?php if ($_address->getWeight()):?>
|
73 |
<input type="hidden" name="dyWeight" value="<?php echo $_helper->getFormatedWeight($_address->getWeight()); ?>" />
|
74 |
<?php endif;?>
|
75 |
+
|
76 |
+
<?php // suits with free shipping which can be set up by cart rules ?>
|
77 |
+
<?php $forwardingCharges = ($_address->getFreeShipping() === '1')? 0 : $_address->getShippingAmount(); ?>
|
78 |
+
<input type="hidden" name="dyForwardingCharges" value="<?php echo $_helper->getFormatedShippingPrice($forwardingCharges); ?>" />
|
79 |
+
|
80 |
<?php if ($_address->getCustomerId()):?>
|
81 |
<input type="hidden" name="trClientNumber" value="<?php echo $_address->getCustomerId(); ?>" />
|
82 |
<?php endif;?>
|
app/design/frontend/default/default/template/socolissimosimplicite/onepage/shipping_method/available.phtml
CHANGED
@@ -9,36 +9,146 @@
|
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
10 |
*/
|
11 |
?>
|
12 |
-
<?php if (
|
13 |
-
|
14 |
-
<?php
|
15 |
-
<
|
16 |
-
<?php
|
17 |
-
|
18 |
-
|
19 |
-
<
|
20 |
-
|
21 |
-
<
|
22 |
-
|
23 |
-
<
|
24 |
-
|
25 |
-
|
26 |
-
<span class="no-display"><input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>" checked="checked" /></span>
|
27 |
<?php else: ?>
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
<?php endif; ?>
|
9 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
10 |
*/
|
11 |
?>
|
12 |
+
<?php if (version_compare(Mage::getVersion(), '1.4.2.0', '<=')
|
13 |
+
or (version_compare(Mage::getVersion(), '1.6.0.0', '>=') and version_compare(Mage::getVersion(), '1.10.0.0', '<'))): ?>
|
14 |
+
<?php if (!($_shippingRateGroups = $this->getShippingRates())): ?>
|
15 |
+
<p><?php echo $this->__('Sorry, no quotes are available for this order at this time.') ?></p>
|
16 |
+
<?php else: ?>
|
17 |
+
<dl class="sp-methods">
|
18 |
+
<?php $_sole = count($_shippingRateGroups) == 1; foreach ($_shippingRateGroups as $code => $_rates): ?>
|
19 |
+
<dt><?php echo $this->getCarrierName($code) ?></dt>
|
20 |
+
<dd>
|
21 |
+
<ul>
|
22 |
+
<?php $_sole = $_sole && count($_rates) == 1; foreach ($_rates as $_rate): ?>
|
23 |
+
<li>
|
24 |
+
<?php if ($_rate->getErrorMessage()): ?>
|
25 |
+
<ul class="messages"><li class="error-msg"><ul><li><?php echo $_rate->getErrorMessage() ?></li></ul></li></ul>
|
|
|
26 |
<?php else: ?>
|
27 |
+
<?php if ($_sole) : ?>
|
28 |
+
<span class="no-display"><input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>" checked="checked" /></span>
|
29 |
+
<?php else: ?>
|
30 |
+
<input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio" />
|
31 |
+
<?php endif; ?>
|
32 |
+
<?php echo $this->getItemHtml($_rate) ?>
|
33 |
+
<?php // disponibilité de la plateforme soco ?>
|
34 |
+
<?php if ($_rate->getCode() == 'socolissimosimplicite_socolissimosimplicite' and !$this->getServiceIsAvailable()): ?>
|
35 |
+
<ul class="messages"><li class="error-msg"><ul><li><?php echo $this->getServiceNotAvailableMessage() ?></li></ul></li></ul>
|
36 |
+
<?php endif ?>
|
37 |
+
|
38 |
+
<?php endif ?>
|
39 |
+
</li>
|
40 |
+
<?php endforeach; ?>
|
41 |
+
</ul>
|
42 |
+
</dd>
|
43 |
+
<?php endforeach; ?>
|
44 |
+
</dl>
|
45 |
+
<?php endif; ?>
|
46 |
+
|
47 |
+
<?php // Magento >= 1.5 ?>
|
48 |
+
<?php else: ?>
|
49 |
+
<?php if (!($_shippingRateGroups = $this->getShippingRates())): ?>
|
50 |
+
<p><?php echo $this->__('Sorry, no quotes are available for this order at this time.') ?></p>
|
51 |
+
<?php else: ?>
|
52 |
+
|
53 |
+
<dl class="sp-methods">
|
54 |
+
|
55 |
+
<?php // fix javascript bug on community 1.5 ?>
|
56 |
+
<?php if (version_compare(Mage::getVersion(), '1.5.0.0', '>=') and version_compare(Mage::getVersion(), '1.6.0.0', '<')): ?>
|
57 |
+
<script type="text/javascript">
|
58 |
+
//<![CDATA[
|
59 |
+
var quoteBaseGrandTotal = <?php echo (float)$this->getQuoteBaseGrandTotal(); ?>;
|
60 |
+
var checkQuoteBaseGrandTotal = quoteBaseGrandTotal;
|
61 |
+
var lastPrice;
|
62 |
+
//]]>
|
63 |
+
</script>
|
64 |
+
<?php endif; ?>
|
65 |
+
|
66 |
+
<?php $shippingMe = array(); ?>
|
67 |
+
<?php $_sole = count($_shippingRateGroups) == 1; foreach ($_shippingRateGroups as $code => $_rates): ?>
|
68 |
+
<dt><?php echo $this->getCarrierName($code) ?></dt>
|
69 |
+
<dd>
|
70 |
+
<ul>
|
71 |
+
<?php $_sole = $_sole && count($_rates) == 1; foreach ($_rates as $_rate): ?>
|
72 |
+
<?php $shippingMe[] = "'".$_rate->getCode()."':".(float)$_rate->getPrice(); ?>
|
73 |
+
<li>
|
74 |
+
<?php if ($_rate->getErrorMessage()): ?>
|
75 |
+
<ul class="messages"><li class="error-msg"><ul><li><?php echo $_rate->getErrorMessage() ?></li></ul></li></ul>
|
76 |
+
<?php else: ?>
|
77 |
+
<?php if ($_sole) : ?>
|
78 |
+
<span class="no-display"><input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>" checked="checked" /></span>
|
79 |
+
<?php else: ?>
|
80 |
+
<input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio" onchange="return includingShipping('<?php echo $_rate->getCode();?>');"/>
|
81 |
+
|
82 |
+
<script type="text/javascript">
|
83 |
+
//<![CDATA[
|
84 |
+
<?php if ($_rate->getCode()===$this->getAddressShippingMethod()): ?>
|
85 |
+
lastPrice = <?php echo (float)$_rate->getPrice(); ?>;
|
86 |
+
<?php endif; ?>
|
87 |
+
//]]>
|
88 |
+
</script>
|
89 |
+
|
90 |
+
<?php endif; ?>
|
91 |
+
|
92 |
+
<?php // socolissimo ?>
|
93 |
+
<?php if ($_rate->getCode() == 'socolissimosimplicite_socolissimosimplicite'): ?>
|
94 |
+
|
95 |
+
<?php // disponibilité de la plateforme soco ?>
|
96 |
+
<?php if ($_rate->getCode() == 'socolissimosimplicite_socolissimosimplicite' and !$this->getServiceIsAvailable()): ?>
|
97 |
+
<ul class="messages"><li class="error-msg"><ul><li><?php echo $this->getServiceNotAvailableMessage() ?></li></ul></li></ul>
|
98 |
+
<?php else: ?>
|
99 |
+
<?php
|
100 |
+
$_helper = $this->helper('socolissimosimplicite');
|
101 |
+
$_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax());
|
102 |
+
?>
|
103 |
+
<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodTitle() ?> <?php echo $_excl; ?></label>
|
104 |
+
<br />
|
105 |
+
<?php echo $_helper->getSelectMessage() ?>
|
106 |
+
<?php endif; ?>
|
107 |
+
|
108 |
+
<?php // others methods ?>
|
109 |
+
<?php else: ?>
|
110 |
+
<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodTitle() ?>
|
111 |
+
<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
|
112 |
+
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
|
113 |
+
<?php echo $_excl; ?>
|
114 |
+
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
115 |
+
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
116 |
+
<?php endif; ?>
|
117 |
+
</label>
|
118 |
+
<?php endif; ?>
|
119 |
+
|
120 |
+
<?php endif ?>
|
121 |
+
</li>
|
122 |
+
<?php endforeach; ?>
|
123 |
+
</ul>
|
124 |
+
</dd>
|
125 |
+
<?php endforeach; ?>
|
126 |
+
</dl>
|
127 |
+
<script type="text/javascript">
|
128 |
+
//<![CDATA[
|
129 |
+
<?php if (!empty($shippingMe)): ?>
|
130 |
+
var shippingMe = {<?php echo implode(',',$shippingMe); ?>};
|
131 |
+
<?php endif; ?>
|
132 |
+
|
133 |
+
function includingShipping(getShippingCode)
|
134 |
+
{
|
135 |
+
<?php if (!empty($shippingMe)): ?>
|
136 |
+
var newPrice = shippingMe[getShippingCode];
|
137 |
+
if (!lastPrice) {
|
138 |
+
lastPrice = newPrice;
|
139 |
+
quoteBaseGrandTotal += newPrice;
|
140 |
+
}
|
141 |
+
if (newPrice != lastPrice) {
|
142 |
+
quoteBaseGrandTotal += (newPrice-lastPrice);
|
143 |
+
lastPrice = newPrice;
|
144 |
+
|
145 |
+
}
|
146 |
+
<?php endif; ?>
|
147 |
+
checkQuoteBaseGrandTotal = quoteBaseGrandTotal;
|
148 |
+
return false;
|
149 |
+
}
|
150 |
+
//]]>
|
151 |
+
</script>
|
152 |
+
<?php endif; ?>
|
153 |
+
|
154 |
<?php endif; ?>
|
package.xml
CHANGED
@@ -1,32 +1,30 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ColiPoste_La_Poste_So_Colissimo</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
-
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Extension officielle permettant de proposer le mode de livraison So Colissimo de La Poste / ColisPoste</summary>
|
10 |
-
<description
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
<
|
26 |
-
<
|
27 |
-
<
|
28 |
-
<time>11:09:06</time>
|
29 |
-
<contents><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="socolissimosimplicite.xml" hash="ecb0d6e12eec4606a54b12e421e9ff72"/></dir><dir name="template"><dir name="socolissimosimplicite"><dir name="form"><file name="failure.phtml" hash="b0692966e1ed1e32d31ad676ccd3dcba"/></dir><dir name="onepage"><dir name="shipping_method"><dir name="available"><file name="default.phtml" hash="2f84bc01d0599cfe27ef03a4c2813795"/><file name="socolissimosimplicite.phtml" hash="642ba70f2faa328f7e3afc10ab3876ec"/></dir><file name="available.phtml" hash="11bdd8dccf385d4f84294da58a36ea2a"/></dir><file name="shipping_method.phtml" hash="180da1c16cff34b3d180d96720bde6f9"/></dir><file name="empty.phtml" hash="01e4359097f904f0caa50d7175d1fa3c"/><file name="form.phtml" hash="b9879cff328ee1d0151c2ccbb396524d"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="fr_FR"><file name="LaPoste_SoColissimoSimplicite.csv" hash="3b2a032525266c476fd3aec64aa81730"/></dir></target><target name="magecommunity"><dir name="LaPoste"><dir name="SoColissimoSimplicite"><dir name="Block"><dir name="Onepage"><dir name="Shipping"><dir name="Method"><dir name="Available"><file name="Item.php" hash="f53ff832b868363db948d30d66d317bc"/></dir><file name="Available.php" hash="06902ff1276c5500be2e1307c66293ce"/></dir></dir></dir><file name="Form.php" hash="62d752e713c5be1b25beabe8faa6eb2b"/><file name="Onepage.php" hash="5e69262d3c0fdf58d8ff64e7486afd9c"/></dir><dir name="controllers"><file name="FormController.php" hash="2eb7a48d3467a2ef5908a59f229b5530"/></dir><dir name="etc"><file name="config.xml" hash="fdc2ca62fa8e18222ae196353fe13b4f"/><file name="system.xml" hash="5f36300e1a679a837e23bcfa8022649a"/></dir><dir name="Helper"><file name="Data.php" hash="6f7b606d84d252187bed6e6ddb305b98"/></dir><dir name="Model"><dir name="Carrier"><file name="ShippingMethod.php" hash="3987dee10c0e61ccac36e3963eadc6b8"/></dir><dir name="Mysql4"><dir name="Transaction"><file name="Collection.php" hash="fbafc008503e549ee706d5b2410ac06e"/></dir><file name="Transaction.php" hash="6ed69152ebb4531dad115528d169b80c"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Shipping"><file name="Amountbasetype.php" hash="e355e929e174930f8a5aa2a2c1b68614"/></dir></dir></dir></dir><file name="Observer.php" hash="a7d5b1a27901349879ee1e85db1888d6"/><file name="Transaction.php" hash="b5c468478a0046c66f87d079a5df8616"/></dir><dir name="sql"><dir name="socolissimosimplicite_setup"><file name="mysql4-install-1.0.0.php" hash="552988034e08c618086f4a5d88f52d18"/><file name="mysql4-upgrade-1.0.6-1.0.7.php" hash="35274eda01ecae46c80a177a7eafeb29"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="LaPoste_SoColissimoSimplicite.xml" hash="b95ad07dda6ce0fb25d6ece5750d0f0d"/></dir></target></contents>
|
30 |
<compatible/>
|
31 |
-
<dependencies
|
32 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ColiPoste_La_Poste_So_Colissimo</name>
|
4 |
+
<version>1.0.8</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Extension officielle permettant de proposer le mode de livraison So Colissimo de La Poste / ColisPoste</summary>
|
10 |
+
<description>Cette extension officielle permet de proposer à vos clients le mode de livraison So Colissimo.
|
11 |
+

|
12 |
+
So Colissimo offre le choix parmi 5 solutions de livraison et un grand réseau de points de retraits, partout en France métropolitaine pour toutes vos commandes en ligne :
|
13 |
+

|
14 |
+
* mon domicile : livraison à l'adresse de votre choix, entre 8h et 13h.
|
15 |
+
* mon rendez-vous : livraison sur rendez-vous entre 17h et 21h30 à l'adresse de votre choix.
|
16 |
+
* mon espace cityssimo : livraison dans l'un des 31 espaces Cityssimo.
|
17 |
+
* mon bureau de poste : livraison dans l'un des 10.000 bureaux de poste de votre choix.
|
18 |
+
* mon commerçant : livraison chez l'un des nombreux commerçants de notre réseau partenaire.
|
19 |
+

|
20 |
+
Testé et validé sur Magento CE 1.4.1.1, PE 1.8, EE 1.8 et EE 1.9.
|
21 |
+

|
22 |
+
Réalisation par Smile.</description>
|
23 |
+
<notes>Compatible 1.5</notes>
|
24 |
+
<authors><author><name>Berlioz</name><user>Aline</user><email>Aline.BERLIOZ@laposte.fr</email></author></authors>
|
25 |
+
<date>2011-05-05</date>
|
26 |
+
<time>13:50:54</time>
|
27 |
+
<contents><target name="magedesign"><dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="socolissimosimplicite"><file name="empty.phtml" hash="01e4359097f904f0caa50d7175d1fa3c"/><dir name="form"><file name="failure.phtml" hash="b0692966e1ed1e32d31ad676ccd3dcba"/></dir><file name="form.phtml" hash="8b1a4b0d45e7eea0288320417f0f484d"/><dir name="onepage"><dir name="shipping_method"><dir name="available"><file name="default.phtml" hash="2f84bc01d0599cfe27ef03a4c2813795"/><file name="socolissimosimplicite.phtml" hash="642ba70f2faa328f7e3afc10ab3876ec"/></dir><file name="available.phtml" hash="fe9843962b010778fa6dd11b10828a90"/></dir><file name="shipping_method.phtml" hash="180da1c16cff34b3d180d96720bde6f9"/></dir></dir></dir><dir name="layout"><file name="socolissimosimplicite.xml" hash="ecb0d6e12eec4606a54b12e421e9ff72"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir><dir name="fr_FR"><file name="LaPoste_SoColissimoSimplicite.csv" hash="3b2a032525266c476fd3aec64aa81730"/></dir></dir></target><target name="magecommunity"><dir><dir name="LaPoste"><dir name="SoColissimoSimplicite"><dir name="Block"><file name="Form.php" hash="6bf92465fc24a46184653cb93156ef06"/><dir name="Onepage"><dir name="Shipping"><dir name="Method"><dir name="Available"><file name="Item.php" hash="f53ff832b868363db948d30d66d317bc"/></dir><file name="Available.php" hash="934af40303dc2217111d2b0bae90a0c2"/></dir></dir></dir><file name="Onepage.php" hash="79b4d36b3bff494f04605b860b2a73b0"/></dir><dir name="Helper"><file name="Data.php" hash="1c44acfd8b1f437fbbf5edc1f45d76b0"/></dir><dir name="Model"><dir name="Carrier"><file name="ShippingMethod.php" hash="519af8965e5cb1fb7b6e45a67df9f81c"/></dir><dir name="Mysql4"><dir name="Transaction"><file name="Collection.php" hash="dc2f61004ac7acd0af8f10574ec41880"/></dir><file name="Transaction.php" hash="0f5a3d0c1b36f3702c737bdec5b6a4cb"/></dir><file name="Observer.php" hash="9bb4e4f072da95f7e4cf28e774df7483"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Shipping"><file name="Amountbasetype.php" hash="bca2ac197de8909cfe622b05c2f89cca"/></dir></dir></dir></dir><file name="Transaction.php" hash="8215996b4c856f679e8038c01bba6de6"/></dir><dir name="Test"><dir name="Model"><dir name="Carrier"><file name="ShippingMethodTest.php" hash="0af0dc51d6c0b99a466d19242c4e915f"/></dir></dir></dir><dir name="controllers"><file name="FormController.php" hash="e18ee28be1be5894b4fef19b64e5426f"/><file name="OnepageController.php" hash="f0758f5e2c0873ba517ab675672b2892"/></dir><dir name="etc"><file name="config.xml" hash="1842fa190d5a9314772ab0c4178ea8b2"/><file name="system.xml" hash="5f36300e1a679a837e23bcfa8022649a"/></dir><dir name="sql"><dir name="socolissimosimplicite_setup"><file name="mysql4-install-1.0.0.php" hash="52761c955270d44c5a0ca4b28b86d70d"/><file name="mysql4-uninstall-0.1.0.php" hash="a0907ec1437960b6587d87827ad2ba24"/><file name="mysql4-upgrade-1.0.6-1.0.7.php" hash="829fcd5f192109ec0722a3269e8737c5"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="LaPoste_SoColissimoSimplicite.xml" hash="b95ad07dda6ce0fb25d6ece5750d0f0d"/></dir></dir></target></contents>
|
|
|
|
|
28 |
<compatible/>
|
29 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
30 |
</package>
|