Version Notes
Lire le manuel d'installation
Download this release
Release Info
| Developer | Magento Core Team |
| Extension | ColiPoste_La_Poste_So_Colissimo |
| Version | 1.0.5 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.4 to 1.0.5
- app/code/community/LaPoste/SoColissimoSimplicite/Model/Carrier/ShippingMethod.php +12 -2
- app/code/community/LaPoste/SoColissimoSimplicite/Model/Observer.php +37 -8
- app/code/community/LaPoste/SoColissimoSimplicite/controllers/FormController.php +5 -0
- app/locale/fr_FR/LaPoste_SoColissimoSimplicite.csv +2 -1
- package.xml +4 -4
app/code/community/LaPoste/SoColissimoSimplicite/Model/Carrier/ShippingMethod.php
CHANGED
|
@@ -87,6 +87,18 @@ class LaPoste_SoColissimoSimplicite_Model_Carrier_ShippingMethod
|
|
| 87 |
$amountBaseType = $this->getConfigData('amountbasetype');
|
| 88 |
$amountCalculation = $this->getConfigData('amountcalculation');
|
| 89 |
$helper = Mage::helper('socolissimosimplicite');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
switch ($amountBaseType) {
|
| 91 |
case 'fixed':
|
| 92 |
if (is_numeric($amountCalculation)) {
|
|
@@ -106,8 +118,6 @@ class LaPoste_SoColissimoSimplicite_Model_Carrier_ShippingMethod
|
|
| 106 |
krsort($rules,SORT_NUMERIC);
|
| 107 |
|
| 108 |
//récupération du poids total de la commande (en kilogrammes)
|
| 109 |
-
$shippingAddress = Mage::getModel('checkout/cart')
|
| 110 |
-
->getQuote()->getShippingAddress();
|
| 111 |
$totalWeight = $shippingAddress->getWeight();
|
| 112 |
|
| 113 |
//recherche du prix selon les fourchettes de tarifs données
|
| 87 |
$amountBaseType = $this->getConfigData('amountbasetype');
|
| 88 |
$amountCalculation = $this->getConfigData('amountcalculation');
|
| 89 |
$helper = Mage::helper('socolissimosimplicite');
|
| 90 |
+
|
| 91 |
+
// récupérer l'adresse
|
| 92 |
+
$shippingAddress = Mage::getModel('checkout/cart')->getQuote()->getShippingAddress();
|
| 93 |
+
|
| 94 |
+
// en mode rendez-vous, on utilise directement le prix transmis par socolissimo
|
| 95 |
+
// on ne re-calcule pas (supplément de 4€)
|
| 96 |
+
if ($shippingAddress->getData('soco_mode_rdv') == true
|
| 97 |
+
and $shippingAddress->getData('base_shipping_amount') > 0) {
|
| 98 |
+
return $shippingAddress->getData('base_shipping_amount');
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
// sinon calcul en fonction de la configuration
|
| 102 |
switch ($amountBaseType) {
|
| 103 |
case 'fixed':
|
| 104 |
if (is_numeric($amountCalculation)) {
|
| 118 |
krsort($rules,SORT_NUMERIC);
|
| 119 |
|
| 120 |
//récupération du poids total de la commande (en kilogrammes)
|
|
|
|
|
|
|
| 121 |
$totalWeight = $shippingAddress->getWeight();
|
| 122 |
|
| 123 |
//recherche du prix selon les fourchettes de tarifs données
|
app/code/community/LaPoste/SoColissimoSimplicite/Model/Observer.php
CHANGED
|
@@ -24,6 +24,9 @@
|
|
| 24 |
*/
|
| 25 |
class LaPoste_SoColissimoSimplicite_Model_Observer
|
| 26 |
{
|
|
|
|
|
|
|
|
|
|
| 27 |
/**
|
| 28 |
* Tableau de correspondance les champs simples retournés par SO COlissimo
|
| 29 |
* et les champs d'une adresse de livraison dans Magento.
|
|
@@ -37,10 +40,10 @@ class LaPoste_SoColissimoSimplicite_Model_Observer
|
|
| 37 |
'CEEMAIL' => 'email',
|
| 38 |
'CEPHONENUMBER' => 'telephone',
|
| 39 |
'CECOMPANYNAME' => 'company',
|
| 40 |
-
'DYFORWARDINGCHARGES' => '
|
| 41 |
'PRZIPCODE' => 'postcode',
|
| 42 |
'PRTOWN' => 'city'
|
| 43 |
-
);
|
| 44 |
|
| 45 |
/**
|
| 46 |
* Met à jour les données de livraison à partir des infos récupérées depuis
|
|
@@ -64,7 +67,7 @@ class LaPoste_SoColissimoSimplicite_Model_Observer
|
|
| 64 |
//on regarde s'il s'agit d'une adresse de livraison
|
| 65 |
$shippingAddress = Mage::getModel('checkout/cart')
|
| 66 |
->getQuote()->getShippingAddress();
|
| 67 |
-
|
| 68 |
if ($shippingAddress) {
|
| 69 |
//les données de l'adresse de livraison sont réinitialisées avec l'adresse par défaut
|
| 70 |
//du client automatiquement lorsque l'on est sur le tunnel de commande,
|
|
@@ -75,6 +78,7 @@ class LaPoste_SoColissimoSimplicite_Model_Observer
|
|
| 75 |
$this->_updateQuoteAndShippingAddress($shippingAddress,$shippingData);
|
| 76 |
}
|
| 77 |
}
|
|
|
|
| 78 |
}
|
| 79 |
|
| 80 |
public function clearCheckoutSession($observer)
|
|
@@ -112,7 +116,7 @@ class LaPoste_SoColissimoSimplicite_Model_Observer
|
|
| 112 |
|
| 113 |
$street = array();
|
| 114 |
$customerNotesArray = array();
|
| 115 |
-
|
| 116 |
foreach ($shippingData as $fieldSoCo => $valueSoCo) {
|
| 117 |
if (array_key_exists($fieldSoCo,$this->_mapFields)) {
|
| 118 |
$fieldMagento = $this->_mapFields[$fieldSoCo];
|
|
@@ -166,7 +170,7 @@ class LaPoste_SoColissimoSimplicite_Model_Observer
|
|
| 166 |
case 'CEDELIVERYINFORMATION':
|
| 167 |
$customerNotesArray['3'] = $shippingData[$fieldSoCo];
|
| 168 |
break;
|
| 169 |
-
|
| 170 |
default:
|
| 171 |
break;
|
| 172 |
}
|
|
@@ -177,16 +181,41 @@ class LaPoste_SoColissimoSimplicite_Model_Observer
|
|
| 177 |
$arrayData['customer_notes'] = implode("\n",$customerNotesArray);
|
| 178 |
}
|
| 179 |
|
| 180 |
-
//
|
| 181 |
$deliveryMode = isset($shippingData['DELIVERYMODE'])? $shippingData['DELIVERYMODE'] : null;
|
| 182 |
-
|
|
|
|
|
|
|
| 183 |
$arrayData['save_in_address_book'] = 0;
|
| 184 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
|
| 186 |
// sauvegarder l'adresse
|
| 187 |
$shippingAddress->addData($arrayData);
|
| 188 |
$shippingAddress->setStreet($street);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
$shippingAddress->save();
|
| 190 |
}
|
| 191 |
}
|
| 192 |
-
}
|
| 24 |
*/
|
| 25 |
class LaPoste_SoColissimoSimplicite_Model_Observer
|
| 26 |
{
|
| 27 |
+
const modRDV = 'RDV';
|
| 28 |
+
const modDOM = 'DOM';
|
| 29 |
+
|
| 30 |
/**
|
| 31 |
* Tableau de correspondance les champs simples retournés par SO COlissimo
|
| 32 |
* et les champs d'une adresse de livraison dans Magento.
|
| 40 |
'CEEMAIL' => 'email',
|
| 41 |
'CEPHONENUMBER' => 'telephone',
|
| 42 |
'CECOMPANYNAME' => 'company',
|
| 43 |
+
'DYFORWARDINGCHARGES' => 'base_shipping_amount',
|
| 44 |
'PRZIPCODE' => 'postcode',
|
| 45 |
'PRTOWN' => 'city'
|
| 46 |
+
);
|
| 47 |
|
| 48 |
/**
|
| 49 |
* Met à jour les données de livraison à partir des infos récupérées depuis
|
| 67 |
//on regarde s'il s'agit d'une adresse de livraison
|
| 68 |
$shippingAddress = Mage::getModel('checkout/cart')
|
| 69 |
->getQuote()->getShippingAddress();
|
| 70 |
+
|
| 71 |
if ($shippingAddress) {
|
| 72 |
//les données de l'adresse de livraison sont réinitialisées avec l'adresse par défaut
|
| 73 |
//du client automatiquement lorsque l'on est sur le tunnel de commande,
|
| 78 |
$this->_updateQuoteAndShippingAddress($shippingAddress,$shippingData);
|
| 79 |
}
|
| 80 |
}
|
| 81 |
+
|
| 82 |
}
|
| 83 |
|
| 84 |
public function clearCheckoutSession($observer)
|
| 116 |
|
| 117 |
$street = array();
|
| 118 |
$customerNotesArray = array();
|
| 119 |
+
|
| 120 |
foreach ($shippingData as $fieldSoCo => $valueSoCo) {
|
| 121 |
if (array_key_exists($fieldSoCo,$this->_mapFields)) {
|
| 122 |
$fieldMagento = $this->_mapFields[$fieldSoCo];
|
| 170 |
case 'CEDELIVERYINFORMATION':
|
| 171 |
$customerNotesArray['3'] = $shippingData[$fieldSoCo];
|
| 172 |
break;
|
| 173 |
+
|
| 174 |
default:
|
| 175 |
break;
|
| 176 |
}
|
| 181 |
$arrayData['customer_notes'] = implode("\n",$customerNotesArray);
|
| 182 |
}
|
| 183 |
|
| 184 |
+
//recuperation du mode de livraison choisi
|
| 185 |
$deliveryMode = isset($shippingData['DELIVERYMODE'])? $shippingData['DELIVERYMODE'] : null;
|
| 186 |
+
|
| 187 |
+
// sauvegarde dans le carnet d'adresse seulement pour le mode domicile
|
| 188 |
+
if ($deliveryMode != self::modDOM) {
|
| 189 |
$arrayData['save_in_address_book'] = 0;
|
| 190 |
}
|
| 191 |
+
|
| 192 |
+
//en mode RDV, on ajoute dans l'adresse la notion de rendez-vous
|
| 193 |
+
if ($deliveryMode == self::modRDV) {
|
| 194 |
+
if (isset($street['3'])) {
|
| 195 |
+
$street['3'] .= ' '.$helper->__('(livraison sur rendez-vous)');
|
| 196 |
+
} else {
|
| 197 |
+
$street['3'] = $helper->__('(livraison sur rendez-vous)');
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
// marquer le mode RDV au niveau de l'adresse (calcul dépend du mode)
|
| 201 |
+
$arrayData['soco_mode_rdv'] = true;
|
| 202 |
+
|
| 203 |
+
} else {
|
| 204 |
+
|
| 205 |
+
// marquer le mode normal au niveau de l'adresse (calcul dépend du mode)
|
| 206 |
+
$arrayData['soco_mode_rdv'] = false;
|
| 207 |
+
}
|
| 208 |
|
| 209 |
// sauvegarder l'adresse
|
| 210 |
$shippingAddress->addData($arrayData);
|
| 211 |
$shippingAddress->setStreet($street);
|
| 212 |
+
|
| 213 |
+
// relancer le calcul du prix (modification du shipping amount via socolissimo)
|
| 214 |
+
// voir getCalculatedPrice() de ShippingMethod
|
| 215 |
+
$shippingAddress->setCollectShippingRates(true);
|
| 216 |
+
$shippingAddress->collectShippingRates();
|
| 217 |
+
|
| 218 |
$shippingAddress->save();
|
| 219 |
}
|
| 220 |
}
|
| 221 |
+
}
|
app/code/community/LaPoste/SoColissimoSimplicite/controllers/FormController.php
CHANGED
|
@@ -59,6 +59,11 @@ class LaPoste_SoColissimoSimplicite_FormController extends Mage_Core_Controller_
|
|
| 59 |
//récupération de l'adresse de livraison de la commande en cours
|
| 60 |
$shippingAddress = $this->getShippingAddress();
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
//création d'une nouvelle transaction à partir de l'adresse de livraison.
|
| 63 |
$transaction = Mage::getModel('socolissimosimplicite/transaction')
|
| 64 |
->create($shippingAddress);
|
| 59 |
//récupération de l'adresse de livraison de la commande en cours
|
| 60 |
$shippingAddress = $this->getShippingAddress();
|
| 61 |
|
| 62 |
+
// on relance le calcul du prix de livraison pour gérer le cas du choix
|
| 63 |
+
// du mode RDV puis du retour en arrière et du choix du mode classique
|
| 64 |
+
$shippingAddress->setCollectShippingRates(true);
|
| 65 |
+
$shippingAddress->collectShippingRates();
|
| 66 |
+
|
| 67 |
//création d'une nouvelle transaction à partir de l'adresse de livraison.
|
| 68 |
$transaction = Mage::getModel('socolissimosimplicite/transaction')
|
| 69 |
->create($shippingAddress);
|
app/locale/fr_FR/LaPoste_SoColissimoSimplicite.csv
CHANGED
|
@@ -1,3 +1,4 @@
|
|
| 1 |
"Code porte","Code porte"
|
| 2 |
"Code porte 2","Code porte 2"
|
| 3 |
-
"Interphone","Interphone"
|
|
|
| 1 |
"Code porte","Code porte"
|
| 2 |
"Code porte 2","Code porte 2"
|
| 3 |
+
"Interphone","Interphone"
|
| 4 |
+
"(livraison sur rendez-vous)", "(livraison sur rendez-vous)"
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 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>GPL</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -20,9 +20,9 @@
|
|
| 20 |
<p>R&eacute;alisation par Smile.</p></description>
|
| 21 |
<notes>Lire le manuel d'installation</notes>
|
| 22 |
<authors><author><name>Berlioz</name><user>auto-converted</user><email>Aline.BERLIOZ@laposte.fr</email></author></authors>
|
| 23 |
-
<date>2010-
|
| 24 |
-
<time>
|
| 25 |
-
<contents><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="socolissimosimplicite.xml" hash="e192bb74c6bbfce2cbcb8981c068f028"/></dir><dir name="template"><dir name="socolissimosimplicite"><dir name="form"><file name="failure.phtml" hash="7ef359d8037ba844f513ef2f7dbab93c"/></dir><dir name="onepage"><dir name="shipping_method"><dir name="available"><file name="default.phtml" hash="2bdafa2212776b9a4caa968dbe2bcbff"/><file name="socolissimosimplicite.phtml" hash="c904763758add06b6272ef8ff885bad9"/></dir><file name="available.phtml" hash="c4554f687752ccf1572b42d910c2976e"/></dir><file name="shipping_method.phtml" hash="294cbb06b60a6013cc85dd302543aafc"/></dir><file name="form.phtml" hash="5a5a4f6195e79e08797d63f618d5ac24"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="fr_FR"><file name="LaPoste_SoColissimoSimplicite.csv" hash="
|
| 26 |
<compatible/>
|
| 27 |
<dependencies/>
|
| 28 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>ColiPoste_La_Poste_So_Colissimo</name>
|
| 4 |
+
<version>1.0.5</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>GPL</license>
|
| 7 |
<channel>community</channel>
|
| 20 |
<p>R&eacute;alisation par Smile.</p></description>
|
| 21 |
<notes>Lire le manuel d'installation</notes>
|
| 22 |
<authors><author><name>Berlioz</name><user>auto-converted</user><email>Aline.BERLIOZ@laposte.fr</email></author></authors>
|
| 23 |
+
<date>2010-11-02</date>
|
| 24 |
+
<time>16:19:20</time>
|
| 25 |
+
<contents><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="socolissimosimplicite.xml" hash="e192bb74c6bbfce2cbcb8981c068f028"/></dir><dir name="template"><dir name="socolissimosimplicite"><dir name="form"><file name="failure.phtml" hash="7ef359d8037ba844f513ef2f7dbab93c"/></dir><dir name="onepage"><dir name="shipping_method"><dir name="available"><file name="default.phtml" hash="2bdafa2212776b9a4caa968dbe2bcbff"/><file name="socolissimosimplicite.phtml" hash="c904763758add06b6272ef8ff885bad9"/></dir><file name="available.phtml" hash="c4554f687752ccf1572b42d910c2976e"/></dir><file name="shipping_method.phtml" hash="294cbb06b60a6013cc85dd302543aafc"/></dir><file name="form.phtml" hash="5a5a4f6195e79e08797d63f618d5ac24"/></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="db3aeb1f3631ab238060532d754d6e0f"/></dir><file name="Available.php" hash="f87e3de8eb02e26142e2827a4cd855eb"/></dir></dir></dir><file name="Form.php" hash="fa23f5274d6d871bd84665d8aac33abc"/><file name="Onepage.php" hash="92cb8a36e4d641cd92cd2fbc78859876"/></dir><dir name="controllers"><file name="FormController.php" hash="61764d636e34db9f4a296532ad09c33e"/></dir><dir name="etc"><file name="config.xml" hash="f47431c49d437c24661874ebe7ecdf90"/><file name="system.xml" hash="16d1a33347d48c79c5d9e5e56b941d76"/></dir><dir name="Helper"><file name="Data.php" hash="071f9e214a69a27a259eb509fab77c3e"/></dir><dir name="Model"><dir name="Carrier"><file name="ShippingMethod.php" hash="45dea36317526f2ae19424070398f3c2"/></dir><dir name="Mysql4"><dir name="Transaction"><file name="Collection.php" hash="1460d058d25faef4cad2f9037449e0b0"/></dir><file name="Transaction.php" hash="ff3144312e5b109612429add23061085"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Shipping"><file name="Amountbasetype.php" hash="c3dde687fbae69562b6dbeeecd7ea272"/></dir></dir></dir></dir><file name="Observer.php" hash="6065defe71691b2c3145bf6d74881821"/><file name="Transaction.php" hash="b8378ab4b5850cf3b982699c212d41b4"/></dir><dir name="sql"><dir name="socolissimosimplicite_setup"><file name="mysql4-install-1.0.0.php" hash="e811e69cb081e6d9ffc4b01ccb65b8d8"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="LaPoste_SoColissimoSimplicite.xml" hash="c4fb0c85f8e71d3cd5b37f869b1e6190"/></dir></target></contents>
|
| 26 |
<compatible/>
|
| 27 |
<dependencies/>
|
| 28 |
</package>
|
