Version Notes
Version destinée à Magento 1.6.X et supérieures. Testée sur Magento 1.9.2.
------------
Intégration du mode de livraison Chrono Europe
Download this release
Release Info
Developer | Benjamin GOSSELET |
Extension | Chronopost |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.6 to 1.2.0
- app/code/community/Chronopost/Chronorelais/Block/Adminhtml/Form/Renderer/Config/Date.php +23 -0
- app/code/community/Chronopost/Chronorelais/Block/Adminhtml/Notification.php +81 -81
- app/code/community/Chronopost/Chronorelais/Block/Adminhtml/System/Config/Checklogin.php +44 -44
- app/code/community/Chronopost/Chronorelais/Block/Adminhtml/System/Config/Form/Fieldsetconflicts.php +47 -46
- app/code/community/Chronopost/Chronorelais/Block/Adminhtml/System/Config/Rdvconfig.php +29 -0
- app/code/community/Chronopost/Chronorelais/Block/Checkout/Onepage/Shipping/Method/Chronopostsrdv.php +18 -0
- app/code/community/Chronopost/Chronorelais/Block/Checkout/Onepage/Shipping/Method/Chronorelais.php +15 -14
- app/code/community/Chronopost/Chronorelais/Block/Detail.php +6 -17
- app/code/community/Chronopost/Chronorelais/Block/Export/Orders/Grid.php +278 -270
- app/code/community/Chronopost/Chronorelais/Block/Filter.php +10 -25
- app/code/community/Chronopost/Chronorelais/Block/Sales/Bordereau/Grid.php +161 -161
- app/code/community/Chronopost/Chronorelais/Block/Sales/Order/Shipment/View.php +27 -27
- app/code/community/Chronopost/Chronorelais/Block/Sales/Shipment/Grid.php +259 -254
- app/code/community/Chronopost/Chronorelais/Block/Sales/Shipment/Grid/Renderer/Retoursav.php +31 -28
- app/code/community/Chronopost/Chronorelais/Controller/Abstract.php +9 -5
- app/code/community/Chronopost/Chronorelais/Helper/Conflicts.php +159 -161
- app/code/community/Chronopost/Chronorelais/Helper/Data.php +463 -350
- app/code/community/Chronopost/Chronorelais/Helper/Webservice.php +727 -449
- app/code/community/Chronopost/Chronorelais/Model/Carrier/AbstractChronorelaisShipping.php +517 -522
- app/code/community/Chronopost/Chronorelais/Model/Carrier/Chronoexpress.php +1 -2
- app/code/community/Chronopost/Chronorelais/Model/Carrier/Chronopost.php +1 -2
- app/code/community/Chronopost/Chronorelais/Model/Carrier/ChronopostC10.php +2 -2
- app/code/community/Chronopost/Chronorelais/Model/Carrier/ChronopostC18.php +2 -2
- app/code/community/Chronopost/Chronorelais/Model/Carrier/ChronopostCClassic.php +2 -2
- app/code/community/Chronopost/Chronorelais/Model/Carrier/Chronopostsameday.php +33 -0
- app/code/community/Chronopost/Chronorelais/Model/Carrier/Chronopostsrdv.php +85 -0
- app/code/community/Chronopost/Chronorelais/Model/Carrier/Chronorelais.php +2 -2
- app/code/community/Chronopost/Chronorelais/Model/Carrier/Chronorelaisdom.php +7 -0
- app/code/community/Chronopost/Chronorelais/Model/Carrier/Chronorelaiseurope.php +7 -0
- app/code/community/Chronopost/Chronorelais/Model/Config/Backend/Date.php +17 -0
- app/code/community/Chronopost/Chronorelais/Model/Config/Source/Civility.php +2 -2
- app/code/community/Chronopost/Chronorelais/Model/Config/Source/Day.php +16 -0
- app/code/community/Chronopost/Chronorelais/Model/Config/Source/FieldDelimiter.php +2 -2
- app/code/community/Chronopost/Chronorelais/Model/Config/Source/FileCharset.php +2 -2
- app/code/community/Chronopost/Chronorelais/Model/Config/Source/FileExtension.php +1 -1
- app/code/community/Chronopost/Chronorelais/Model/Config/Source/Hour.php +13 -0
- app/code/community/Chronopost/Chronorelais/Model/Config/Source/Margetype.php +11 -0
- app/code/community/Chronopost/Chronorelais/Model/Config/Source/Minute.php +13 -0
- app/code/community/Chronopost/Chronorelais/Model/Config/Source/PrintMode.php +1 -1
- app/code/community/Chronopost/Chronorelais/Model/Config/Source/Time.php +31 -0
- app/code/community/Chronopost/Chronorelais/Model/Observer.php +271 -0
- app/code/community/Chronopost/Chronorelais/Model/Sales/Quote/Address/Total/Shipping.php +206 -207
- app/code/community/Chronopost/Chronorelais/Model/Sales/Quote/Address/Total/Shipping.toDel.php +206 -207
- app/code/community/Chronopost/Chronorelais/controllers/Adminhtml/Chronorelais/AjaxController.php +432 -446
- app/code/community/Chronopost/Chronorelais/controllers/Adminhtml/Chronorelais/ExportController.php +634 -447
- app/code/community/Chronopost/Chronorelais/controllers/Adminhtml/Chronorelais/ImportController.php +0 -8
- app/code/community/Chronopost/Chronorelais/controllers/Adminhtml/Chronorelais/Sales/BordereauController.php +3 -6
- app/code/community/Chronopost/Chronorelais/controllers/Adminhtml/Chronorelais/Sales/ImpressionController.php +1135 -1049
- app/code/community/Chronopost/Chronorelais/controllers/Adminhtml/Chronorelais/Sales/Order/ShipmentController.php +429 -386
- app/code/community/Chronopost/Chronorelais/controllers/Checkout/MultishippingController.php +13 -19
- app/code/community/Chronopost/Chronorelais/controllers/Checkout/OnepageController.php +0 -249
- app/code/community/Chronopost/Chronorelais/controllers/IndexController.php +11 -0
- app/code/community/Chronopost/Chronorelais/controllers/RelaisController.php +97 -8
- app/code/community/Chronopost/Chronorelais/controllers/SrdvController.php +38 -0
- app/code/community/Chronopost/Chronorelais/etc/config.xml +673 -465
- app/code/community/Chronopost/Chronorelais/etc/system.xml +2433 -1583
- app/code/community/Chronopost/Chronorelais/includes/ChronorelaisShippingHelper.php +1465 -1368
- app/code/community/Chronopost/Chronorelais/includes/countries.inc.php +141 -524
app/code/community/Chronopost/Chronorelais/Block/Adminhtml/Form/Renderer/Config/Date.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Chronopost_Chronorelais_Block_Adminhtml_Form_Renderer_Config_Date extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
$element->setStyle('width:70px;')
|
8 |
+
->setName($element->getName() . '[]');
|
9 |
+
|
10 |
+
if ($element->getValue()) {
|
11 |
+
$values = explode(':', $element->getValue());
|
12 |
+
} else {
|
13 |
+
$values = array();
|
14 |
+
}
|
15 |
+
|
16 |
+
$date = $element->setValues(Mage::getSingleton('chronorelais/config_source_day')->toOptionArray())->setValue(isset($values[0]) ? $values[0] : null)->getElementHtml();
|
17 |
+
$heure = $element->setValues(Mage::getSingleton('chronorelais/config_source_hour')->toOptionArray())->setValue(isset($values[1]) ? $values[1] : null)->getElementHtml();
|
18 |
+
$minutes = $element->setValues(Mage::getSingleton('chronorelais/config_source_minute')->toOptionArray())->setValue(isset($values[2]) ? $values[2] : null)->getElementHtml();
|
19 |
+
return Mage::helper('adminhtml')->__('Date') . ' : ' . $date
|
20 |
+
. ' '
|
21 |
+
. Mage::helper('adminhtml')->__('Heure') . ' : ' . $heure.' '.$minutes;
|
22 |
+
}
|
23 |
+
}
|
app/code/community/Chronopost/Chronorelais/Block/Adminhtml/Notification.php
CHANGED
@@ -1,81 +1,81 @@
|
|
1 |
-
<?php
|
2 |
-
class Chronopost_Chronorelais_Block_Adminhtml_Notification extends Mage_Core_Block_Template
|
3 |
-
{
|
4 |
-
const XML_SEVERITY_ICONS_URL_PATH = 'system/adminnotification/severity_icons_url';
|
5 |
-
|
6 |
-
const MODULE_RELEASES_XML_URL = 'http://connect20.magentocommerce.com/community/Chronopost/releases.xml';
|
7 |
-
//all community packages => http://connect20.magentocommerce.com/community/packages.xml
|
8 |
-
|
9 |
-
protected function _prepareLayout()
|
10 |
-
{
|
11 |
-
parent::_prepareLayout();
|
12 |
-
if (!$this->getTemplate()) {
|
13 |
-
$this->setTemplate('chronorelais/notification.phtml');
|
14 |
-
}
|
15 |
-
return $this;
|
16 |
-
}
|
17 |
-
|
18 |
-
public function getSeverityIconsUrl()
|
19 |
-
{
|
20 |
-
return (Mage::app()->getFrontController()->getRequest()->isSecure() ? 'https://' : 'http://')
|
21 |
-
. sprintf(Mage::getStoreConfig(self::XML_SEVERITY_ICONS_URL_PATH), Mage::getVersion(),
|
22 |
-
'SEVERITY_NOTICE');
|
23 |
-
}
|
24 |
-
|
25 |
-
public function canShow()
|
26 |
-
{
|
27 |
-
if (!Mage::getSingleton('admin/session')->isFirstPageAfterLogin()) {
|
28 |
-
return false;
|
29 |
-
}
|
30 |
-
return true;
|
31 |
-
}
|
32 |
-
|
33 |
-
public function getNotifications()
|
34 |
-
{
|
35 |
-
$notifications = array();
|
36 |
-
/* test if WS is ok */
|
37 |
-
$_helper = Mage::helper('chronorelais');
|
38 |
-
$account_number = $_helper->getConfigurationAccountNumber();
|
39 |
-
$password = $_helper->getConfigurationAccountPass();
|
40 |
-
$origin_postcode = $_helper->getConfigurationShipperInfo('zipcode');
|
41 |
-
|
42 |
-
$WSParams = array(
|
43 |
-
'accountNumber' => $account_number,
|
44 |
-
'password' => $password,
|
45 |
-
'depCountryCode' => $_helper->getConfigurationShipperInfo('country'),
|
46 |
-
'depZipCode' => $origin_postcode,
|
47 |
-
'arrCountryCode' => $_helper->getConfigurationShipperInfo('country'),
|
48 |
-
'arrZipCode' => $origin_postcode,
|
49 |
-
'arrCity' => $_helper->getConfigurationShipperInfo('city'),
|
50 |
-
'type' => 'M',
|
51 |
-
'weight' => 1
|
52 |
-
);
|
53 |
-
|
54 |
-
$helperWS = Mage::helper('chronorelais/webservice');
|
55 |
-
$webservbt = $helperWS->checkLogin($WSParams);
|
56 |
-
|
57 |
-
if(!$webservbt) {
|
58 |
-
$notifications[] = 'quickcost_not_available';
|
59 |
-
} else {
|
60 |
-
$webservbt = (array)$webservbt;
|
61 |
-
if(isset($webservbt['errorCode']) && $webservbt['errorCode'] != 0) {
|
62 |
-
$notifications[] = 'quickcost_not_available';
|
63 |
-
}
|
64 |
-
}
|
65 |
-
|
66 |
-
/* test if new version is available */
|
67 |
-
$currentVersion = (string)Mage::getConfig()->getModuleConfig("Chronopost_Chronorelais")->version;
|
68 |
-
|
69 |
-
$xml = simplexml_load_file(self::MODULE_RELEASES_XML_URL);
|
70 |
-
$nbRelease = count($xml->children());
|
71 |
-
$releases = $xml->children();
|
72 |
-
$lastRelease = $releases[
|
73 |
-
if(version_compare($
|
74 |
-
$notifications[] = 'new_version';
|
75 |
-
}
|
76 |
-
|
77 |
-
return $notifications;
|
78 |
-
|
79 |
-
}
|
80 |
-
|
81 |
-
}
|
1 |
+
<?php
|
2 |
+
class Chronopost_Chronorelais_Block_Adminhtml_Notification extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
const XML_SEVERITY_ICONS_URL_PATH = 'system/adminnotification/severity_icons_url';
|
5 |
+
|
6 |
+
const MODULE_RELEASES_XML_URL = 'http://connect20.magentocommerce.com/community/Chronopost/releases.xml';
|
7 |
+
//all community packages => http://connect20.magentocommerce.com/community/packages.xml
|
8 |
+
|
9 |
+
protected function _prepareLayout()
|
10 |
+
{
|
11 |
+
parent::_prepareLayout();
|
12 |
+
if (!$this->getTemplate()) {
|
13 |
+
$this->setTemplate('chronorelais/notification.phtml');
|
14 |
+
}
|
15 |
+
return $this;
|
16 |
+
}
|
17 |
+
|
18 |
+
public function getSeverityIconsUrl()
|
19 |
+
{
|
20 |
+
return (Mage::app()->getFrontController()->getRequest()->isSecure() ? 'https://' : 'http://')
|
21 |
+
. sprintf(Mage::getStoreConfig(self::XML_SEVERITY_ICONS_URL_PATH), Mage::getVersion(),
|
22 |
+
'SEVERITY_NOTICE');
|
23 |
+
}
|
24 |
+
|
25 |
+
public function canShow()
|
26 |
+
{
|
27 |
+
if (!Mage::getSingleton('admin/session')->isFirstPageAfterLogin()) {
|
28 |
+
return false;
|
29 |
+
}
|
30 |
+
return true;
|
31 |
+
}
|
32 |
+
|
33 |
+
public function getNotifications()
|
34 |
+
{
|
35 |
+
$notifications = array();
|
36 |
+
/* test if WS is ok */
|
37 |
+
$_helper = Mage::helper('chronorelais');
|
38 |
+
$account_number = $_helper->getConfigurationAccountNumber();
|
39 |
+
$password = $_helper->getConfigurationAccountPass();
|
40 |
+
$origin_postcode = $_helper->getConfigurationShipperInfo('zipcode');
|
41 |
+
|
42 |
+
$WSParams = array(
|
43 |
+
'accountNumber' => $account_number,
|
44 |
+
'password' => $password,
|
45 |
+
'depCountryCode' => $_helper->getConfigurationShipperInfo('country'),
|
46 |
+
'depZipCode' => $origin_postcode,
|
47 |
+
'arrCountryCode' => $_helper->getConfigurationShipperInfo('country'),
|
48 |
+
'arrZipCode' => $origin_postcode,
|
49 |
+
'arrCity' => $_helper->getConfigurationShipperInfo('city'),
|
50 |
+
'type' => 'M',
|
51 |
+
'weight' => 1
|
52 |
+
);
|
53 |
+
|
54 |
+
$helperWS = Mage::helper('chronorelais/webservice');
|
55 |
+
$webservbt = $helperWS->checkLogin($WSParams);
|
56 |
+
|
57 |
+
if(!$webservbt) {
|
58 |
+
$notifications[] = 'quickcost_not_available';
|
59 |
+
} else {
|
60 |
+
$webservbt = (array)$webservbt;
|
61 |
+
if(isset($webservbt['errorCode']) && $webservbt['errorCode'] != 0) {
|
62 |
+
$notifications[] = 'quickcost_not_available';
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
/* test if new version is available */
|
67 |
+
$currentVersion = (string)Mage::getConfig()->getModuleConfig("Chronopost_Chronorelais")->version;
|
68 |
+
|
69 |
+
$xml = simplexml_load_file(self::MODULE_RELEASES_XML_URL);
|
70 |
+
$nbRelease = count($xml->children());
|
71 |
+
$releases = $xml->children();
|
72 |
+
$lastRelease = $releases[0];
|
73 |
+
if(version_compare($lastRelease->v, $currentVersion, '>')) {
|
74 |
+
$notifications[] = 'new_version';
|
75 |
+
}
|
76 |
+
|
77 |
+
return $notifications;
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
}
|
app/code/community/Chronopost/Chronorelais/Block/Adminhtml/System/Config/Checklogin.php
CHANGED
@@ -1,44 +1,44 @@
|
|
1 |
-
<?php
|
2 |
-
class Chronopost_Chronorelais_Block_Adminhtml_System_Config_Checklogin extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
-
{
|
4 |
-
protected function _prepareLayout()
|
5 |
-
{
|
6 |
-
parent::_prepareLayout();
|
7 |
-
if (!$this->getTemplate()) {
|
8 |
-
$this->setTemplate('chronorelais/config/checklogin.phtml');
|
9 |
-
}
|
10 |
-
return $this;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Unset some non-related element parameters
|
15 |
-
*
|
16 |
-
* @param Varien_Data_Form_Element_Abstract $element
|
17 |
-
* @return string
|
18 |
-
*/
|
19 |
-
public function render(Varien_Data_Form_Element_Abstract $element)
|
20 |
-
{
|
21 |
-
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
|
22 |
-
return parent::render($element);
|
23 |
-
}
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Get the button and scripts contents
|
27 |
-
*
|
28 |
-
* @param Varien_Data_Form_Element_Abstract $element
|
29 |
-
* @return string
|
30 |
-
*/
|
31 |
-
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
32 |
-
{
|
33 |
-
$html = parent::_getElementHtml($element);
|
34 |
-
$originalData = $element->getOriginalData();
|
35 |
-
$this->addData(array(
|
36 |
-
'button_label' => Mage::helper('chronorelais')->__($originalData['button_label']),
|
37 |
-
'html_id' => $element->getHtmlId(),
|
38 |
-
'ajax_url' => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/chronorelais_ajax/checklogin')
|
39 |
-
));
|
40 |
-
|
41 |
-
|
42 |
-
return $html.$this->_toHtml();
|
43 |
-
}
|
44 |
-
}
|
1 |
+
<?php
|
2 |
+
class Chronopost_Chronorelais_Block_Adminhtml_System_Config_Checklogin extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
protected function _prepareLayout()
|
5 |
+
{
|
6 |
+
parent::_prepareLayout();
|
7 |
+
if (!$this->getTemplate()) {
|
8 |
+
$this->setTemplate('chronorelais/config/checklogin.phtml');
|
9 |
+
}
|
10 |
+
return $this;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Unset some non-related element parameters
|
15 |
+
*
|
16 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
17 |
+
* @return string
|
18 |
+
*/
|
19 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
20 |
+
{
|
21 |
+
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
|
22 |
+
return parent::render($element);
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Get the button and scripts contents
|
27 |
+
*
|
28 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
29 |
+
* @return string
|
30 |
+
*/
|
31 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
32 |
+
{
|
33 |
+
$html = parent::_getElementHtml($element);
|
34 |
+
$originalData = $element->getOriginalData();
|
35 |
+
$this->addData(array(
|
36 |
+
'button_label' => Mage::helper('chronorelais')->__($originalData['button_label']),
|
37 |
+
'html_id' => $element->getHtmlId(),
|
38 |
+
'ajax_url' => Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/chronorelais_ajax/checklogin')
|
39 |
+
));
|
40 |
+
|
41 |
+
|
42 |
+
return $html.$this->_toHtml();
|
43 |
+
}
|
44 |
+
}
|
app/code/community/Chronopost/Chronorelais/Block/Adminhtml/System/Config/Form/Fieldsetconflicts.php
CHANGED
@@ -1,46 +1,47 @@
|
|
1 |
-
<?php
|
2 |
-
class Chronopost_Chronorelais_Block_Adminhtml_System_Config_Form_Fieldsetconflicts
|
3 |
-
extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
4 |
-
{
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Return footer html for fieldset
|
8 |
-
* Add extra tooltip comments to elements
|
9 |
-
*
|
10 |
-
* @param Varien_Data_Form_Element_Abstract $element
|
11 |
-
* @return string
|
12 |
-
*/
|
13 |
-
protected function _getFooterHtml($element)
|
14 |
-
{
|
15 |
-
$
|
16 |
-
|
17 |
-
|
18 |
-
$html .= '<
|
19 |
-
$html .= '
|
20 |
-
$html .= '</
|
21 |
-
$html .= '
|
22 |
-
$html .= '
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
$html .= '
|
28 |
-
$html .= '
|
29 |
-
$html .= '
|
30 |
-
$html .= '
|
31 |
-
$html .= '
|
32 |
-
$html .= '
|
33 |
-
$html .= '
|
34 |
-
$html .= '
|
35 |
-
$html .= '
|
36 |
-
$html .= '
|
37 |
-
$html .= '
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
}
|
|
1 |
+
<?php
|
2 |
+
class Chronopost_Chronorelais_Block_Adminhtml_System_Config_Form_Fieldsetconflicts
|
3 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
4 |
+
{
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Return footer html for fieldset
|
8 |
+
* Add extra tooltip comments to elements
|
9 |
+
*
|
10 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
11 |
+
* @return string
|
12 |
+
*/
|
13 |
+
protected function _getFooterHtml($element)
|
14 |
+
{
|
15 |
+
$tooltipsExist = false;
|
16 |
+
$html = '</tbody></table>';
|
17 |
+
|
18 |
+
$html .= '<div class="chronorelais_conflicts">';
|
19 |
+
$html .= '<button onclick="javascript:checkConflicts(); return false;" class="scalable" type="button" id="chronorelais_conflicts">';
|
20 |
+
$html .= ' <span>Lancer la vérification</span>';
|
21 |
+
$html .= '</button>';
|
22 |
+
$html .= '<div id="chronorelais_conflicts_result"></div>';
|
23 |
+
$html .= '</div>';
|
24 |
+
|
25 |
+
$html .= '</fieldset>' . $this->_getExtraJs($element, $tooltipsExist);
|
26 |
+
|
27 |
+
$html .= '<script type="text/javascript">' . "\r\n";
|
28 |
+
$html .= '//<![CDATA[' . "\r\n";
|
29 |
+
$html .= ' function checkConflicts() {' . "\r\n";
|
30 |
+
$html .= ' new Ajax.Request(\'' . Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/chronorelais_ajax/checkConflicts') . '\', {' . "\r\n";
|
31 |
+
$html .= ' onSuccess: function(data) {' . "\r\n";
|
32 |
+
$html .= ' var response = data.responseText;' . "\r\n";
|
33 |
+
$html .= ' $(\'chronorelais_conflicts_result\').update(response).show();' . "\r\n";
|
34 |
+
$html .= ' }' . "\r\n";
|
35 |
+
$html .= ' });' . "\r\n";
|
36 |
+
$html .= ' }' . "\r\n";
|
37 |
+
$html .= '//]]>' . "\r\n";
|
38 |
+
$html .= '</script>' . "\r\n";
|
39 |
+
|
40 |
+
if ($element->getIsNested()) {
|
41 |
+
$html .= '</div></td></tr>';
|
42 |
+
} else {
|
43 |
+
$html .= '</div>';
|
44 |
+
}
|
45 |
+
return $html;
|
46 |
+
}
|
47 |
+
}
|
app/code/community/Chronopost/Chronorelais/Block/Adminhtml/System/Config/Rdvconfig.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Chronopost_Chronorelais_Block_Adminhtml_System_Config_Rdvconfig extends Mage_Adminhtml_Block_System_Config_Form_Field
|
3 |
+
{
|
4 |
+
protected function _prepareLayout()
|
5 |
+
{
|
6 |
+
parent::_prepareLayout();
|
7 |
+
if (!$this->getTemplate()) {
|
8 |
+
$this->setTemplate('chronorelais/config/rdvconfig.phtml');
|
9 |
+
}
|
10 |
+
return $this;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Get the button and scripts contents
|
15 |
+
*
|
16 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
17 |
+
* @return string
|
18 |
+
*/
|
19 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
20 |
+
{
|
21 |
+
$html = parent::_getElementHtml($element);
|
22 |
+
$this->addData(array(
|
23 |
+
'html_id' => $element->getHtmlId(),
|
24 |
+
'value' => $element->getValue()
|
25 |
+
));
|
26 |
+
|
27 |
+
return $html.$this->_toHtml();
|
28 |
+
}
|
29 |
+
}
|
app/code/community/Chronopost/Chronorelais/Block/Checkout/Onepage/Shipping/Method/Chronopostsrdv.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Chronopost_Chronorelais_Block_Checkout_Onepage_Shipping_Method_Chronopostsrdv extends Mage_Checkout_Block_Onepage_Abstract {
|
4 |
+
|
5 |
+
protected function getCarrierModel() {
|
6 |
+
return Mage::getSingleton("chronorelais/carrier_chronopostsrdv");
|
7 |
+
}
|
8 |
+
public function getSearchDeliverySlot() {
|
9 |
+
/* appel WS SearchDeliverySlot pour récupérer les créneaux de livraison permettant de construire le semainier */
|
10 |
+
$helper = Mage::helper('chronorelais/webservice');
|
11 |
+
return $helper->getSearchDeliverySlot($this->getSrdvConfig());
|
12 |
+
}
|
13 |
+
|
14 |
+
public function getSrdvConfig() {
|
15 |
+
$carrierModel = $this->getCarrierModel();
|
16 |
+
return Mage::getStoreConfig('carriers/'.$carrierModel->getCarrierCode().'/rdv_config');
|
17 |
+
}
|
18 |
+
}
|
app/code/community/Chronopost/Chronorelais/Block/Checkout/Onepage/Shipping/Method/Chronorelais.php
CHANGED
@@ -38,22 +38,23 @@ class Chronopost_Chronorelais_Block_Checkout_Onepage_Shipping_Method_Chronorelai
|
|
38 |
protected $_chronorelais;
|
39 |
|
40 |
public function getChronorelais() {
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
$
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
$
|
54 |
}
|
55 |
-
$
|
56 |
}
|
|
|
57 |
|
58 |
return $this->_chronorelais;
|
59 |
}
|
38 |
protected $_chronorelais;
|
39 |
|
40 |
public function getChronorelais() {
|
41 |
+
$quote = Mage::getSingleton('checkout/cart')->getQuote();
|
42 |
+
$helper = Mage::helper('chronorelais/webservice');
|
43 |
+
$params = $this->getRequest()->getParams();
|
44 |
+
if(isset($params['mappostalcode']))
|
45 |
+
{
|
46 |
+
$webservbt = $helper->getPointsRelaisByCp($params['mappostalcode']);
|
47 |
+
}
|
48 |
+
else
|
49 |
+
{
|
50 |
+
$shippingMethodCode = '';
|
51 |
+
if(isset($params['shipping_method'])) {
|
52 |
+
$shippingMethodCode = explode("_", $params['shipping_method']);
|
53 |
+
$shippingMethodCode = $shippingMethodCode[0];
|
54 |
}
|
55 |
+
$webservbt = $helper->getPointRelaisByAddress($shippingMethodCode);
|
56 |
}
|
57 |
+
$this->_chronorelais = $webservbt;
|
58 |
|
59 |
return $this->_chronorelais;
|
60 |
}
|
app/code/community/Chronopost/Chronorelais/Block/Detail.php
CHANGED
@@ -1,29 +1,18 @@
|
|
1 |
<?php
|
2 |
class Chronopost_Chronorelais_Block_Detail extends Mage_Core_Block_Template
|
3 |
{
|
|
|
4 |
|
5 |
-
public function _prepareLayout()
|
6 |
-
{
|
7 |
-
return parent::_prepareLayout();
|
8 |
-
}
|
9 |
|
10 |
-
public function getRelaisPoint(){
|
11 |
-
|
12 |
-
|
13 |
$btcode = $this->getRequest()->getParam ( 'btcode' );
|
14 |
|
15 |
if($btcode){
|
16 |
-
$result = Mage::getModel('shipping/rate_result');
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
return $webservbt;
|
22 |
-
}
|
23 |
-
else{
|
24 |
-
return false;
|
25 |
}
|
|
|
26 |
}
|
27 |
-
|
28 |
}
|
29 |
?>
|
1 |
<?php
|
2 |
class Chronopost_Chronorelais_Block_Detail extends Mage_Core_Block_Template
|
3 |
{
|
4 |
+
public function getRelaisPoint(){
|
5 |
|
|
|
|
|
|
|
|
|
6 |
|
|
|
|
|
|
|
7 |
$btcode = $this->getRequest()->getParam ( 'btcode' );
|
8 |
|
9 |
if($btcode){
|
10 |
+
$result = Mage::getModel('shipping/rate_result');
|
11 |
+
ini_set("soap.wsdl_cache_enabled", "0");
|
12 |
+
$helper = Mage::helper('chronorelais/webservice');
|
13 |
+
return $helper->getDetailRelaisPoint($btcode);
|
|
|
|
|
|
|
|
|
|
|
14 |
}
|
15 |
+
return false;
|
16 |
}
|
|
|
17 |
}
|
18 |
?>
|
app/code/community/Chronopost/Chronorelais/Block/Export/Orders/Grid.php
CHANGED
@@ -1,270 +1,278 @@
|
|
1 |
-
<?php
|
2 |
-
class Chronopost_Chronorelais_Block_Export_Orders_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
3 |
-
{
|
4 |
-
|
5 |
-
public function __construct()
|
6 |
-
{
|
7 |
-
parent::__construct();
|
8 |
-
$this->setId('chronorelais_export_order_grid');
|
9 |
-
$this->setUseAjax(false);
|
10 |
-
$this->setDefaultSort('created_at');
|
11 |
-
$this->setDefaultDir('DESC');
|
12 |
-
$this->setSaveParametersInSession(true);
|
13 |
-
}
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Retrieve collection class
|
17 |
-
*
|
18 |
-
* @return string
|
19 |
-
*/
|
20 |
-
protected function _getCollectionClass()
|
21 |
-
{
|
22 |
-
return 'sales/order_grid_collection';
|
23 |
-
}
|
24 |
-
|
25 |
-
protected function _prepareCollection()
|
26 |
-
{
|
27 |
-
$_chronopost_deliver_saturday = Mage::helper('chronorelais')->getConfigData('carriers/chronopost/deliver_on_saturday');
|
28 |
-
$_chronorelais_deliver_saturday = Mage::helper('chronorelais')->getConfigData('carriers/chronorelais/deliver_on_saturday');
|
29 |
-
if($_chronopost_deliver_saturday==1) {
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
$this->addColumn('
|
90 |
-
'header' => Mage::helper('sales')->__('
|
91 |
-
'index' => '
|
92 |
-
'
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
'
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
'
|
105 |
-
'
|
106 |
-
'filter' => false,
|
107 |
-
));
|
108 |
-
|
109 |
-
$this->addColumn('
|
110 |
-
'header' => Mage::helper('sales')->__('G.T. (
|
111 |
-
'index' => '
|
112 |
-
'type' => 'currency',
|
113 |
-
'currency' => '
|
114 |
-
'filter' => false,
|
115 |
-
));
|
116 |
-
|
117 |
-
|
118 |
-
'header'=> Mage::helper('sales')->__('
|
119 |
-
'
|
120 |
-
'type' => '
|
121 |
-
'
|
122 |
-
'filter' => false,
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
'
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
'
|
168 |
-
'
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
$this->
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
return
|
247 |
-
}
|
248 |
-
|
249 |
-
public function
|
250 |
-
{
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Chronopost_Chronorelais_Block_Export_Orders_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
3 |
+
{
|
4 |
+
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('chronorelais_export_order_grid');
|
9 |
+
$this->setUseAjax(false);
|
10 |
+
$this->setDefaultSort('created_at');
|
11 |
+
$this->setDefaultDir('DESC');
|
12 |
+
$this->setSaveParametersInSession(true);
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Retrieve collection class
|
17 |
+
*
|
18 |
+
* @return string
|
19 |
+
*/
|
20 |
+
protected function _getCollectionClass()
|
21 |
+
{
|
22 |
+
return 'sales/order_grid_collection';
|
23 |
+
}
|
24 |
+
|
25 |
+
protected function _prepareCollection()
|
26 |
+
{
|
27 |
+
$_chronopost_deliver_saturday = Mage::helper('chronorelais')->getConfigData('carriers/chronopost/deliver_on_saturday');
|
28 |
+
$_chronorelais_deliver_saturday = Mage::helper('chronorelais')->getConfigData('carriers/chronorelais/deliver_on_saturday');
|
29 |
+
if($_chronopost_deliver_saturday==1) {
|
30 |
+
$_chronopost_deliver_saturday = 'Yes';
|
31 |
+
} else {
|
32 |
+
$_chronopost_deliver_saturday = 'No';
|
33 |
+
}
|
34 |
+
if($_chronorelais_deliver_saturday==1) {
|
35 |
+
$_chronorelais_deliver_saturday = 'Yes';
|
36 |
+
} else {
|
37 |
+
$_chronorelais_deliver_saturday = 'No';
|
38 |
+
}
|
39 |
+
|
40 |
+
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
41 |
+
$collection->join('order', 'main_table.entity_id = order.entity_id', 'shipping_description');
|
42 |
+
$collection->join('order_payment', 'main_table.entity_id = order_payment.parent_id', 'method');
|
43 |
+
$collection->getSelect()->joinLeft(array('oes' => Mage::getSingleton('core/resource')->getTableName('sales_chronopost_order_export_status')), 'main_table.entity_id = oes.order_id', array(new Zend_Db_Expr("if(isNull(oes.livraison_le_samedi), CASE LOWER(SUBSTRING_INDEX(order.shipping_method,'_','1')) WHEN 'chronopost' THEN '$_chronopost_deliver_saturday' WHEN 'chronorelais' THEN '$_chronorelais_deliver_saturday' WHEN 'chronoexpress' THEN '--' ELSE 'No' END, oes.livraison_le_samedi) as livraison_le_samedi")));
|
44 |
+
$collection->getSelect()->where('order.shipping_method LIKE "chronorelais%" OR order.shipping_method LIKE "chronopost%" OR order.shipping_method LIKE "chronoexpress%"');
|
45 |
+
|
46 |
+
$this->setCollection($collection);
|
47 |
+
return parent::_prepareCollection();
|
48 |
+
}
|
49 |
+
|
50 |
+
protected function _addColumnFilterToCollection($column)
|
51 |
+
{
|
52 |
+
if ($this->getCollection()) {
|
53 |
+
$field = ( $column->getFilterIndex() ) ? $column->getFilterIndex() : $column->getIndex();
|
54 |
+
if ($column->getFilterConditionCallback()) {
|
55 |
+
call_user_func($column->getFilterConditionCallback(), $this->getCollection(), $column);
|
56 |
+
} else {
|
57 |
+
$cond = $column->getFilter()->getCondition();
|
58 |
+
if ($field && isset($cond)) {
|
59 |
+
// Le champ status est ambigu, il faut donc sp�cifier sa table lors de l'ajout pour filtrage
|
60 |
+
$this->getCollection()->addFieldToFilter($field == "status" ? "main_table.status" : $field, $cond);
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
64 |
+
return $this;
|
65 |
+
}
|
66 |
+
|
67 |
+
protected function _prepareColumns()
|
68 |
+
{
|
69 |
+
|
70 |
+
$this->addColumn('real_order_id', array(
|
71 |
+
'header'=> Mage::helper('sales')->__('Order #'),
|
72 |
+
'width' => '80px',
|
73 |
+
'type' => 'text',
|
74 |
+
'index' => 'increment_id',
|
75 |
+
'filter' => false,
|
76 |
+
));
|
77 |
+
|
78 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
79 |
+
$this->addColumn('store_id', array(
|
80 |
+
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
|
81 |
+
'index' => 'store_id',
|
82 |
+
'type' => 'store',
|
83 |
+
'store_view'=> true,
|
84 |
+
'display_deleted' => true,
|
85 |
+
'filter' => false,
|
86 |
+
));
|
87 |
+
}
|
88 |
+
|
89 |
+
$this->addColumn('created_at', array(
|
90 |
+
'header' => Mage::helper('sales')->__('Purchased On'),
|
91 |
+
'index' => 'created_at',
|
92 |
+
'type' => 'datetime',
|
93 |
+
'width' => '100px',
|
94 |
+
'filter' => false,
|
95 |
+
));
|
96 |
+
|
97 |
+
$this->addColumn('billing_name', array(
|
98 |
+
'header' => Mage::helper('sales')->__('Bill to Name'),
|
99 |
+
'index' => 'billing_name',
|
100 |
+
'filter' => false,
|
101 |
+
));
|
102 |
+
|
103 |
+
$this->addColumn('shipping_name', array(
|
104 |
+
'header' => Mage::helper('sales')->__('Ship to Name'),
|
105 |
+
'index' => 'shipping_name',
|
106 |
+
'filter' => false,
|
107 |
+
));
|
108 |
+
|
109 |
+
$this->addColumn('base_grand_total', array(
|
110 |
+
'header' => Mage::helper('sales')->__('G.T. (Base)'),
|
111 |
+
'index' => 'base_grand_total',
|
112 |
+
'type' => 'currency',
|
113 |
+
'currency' => 'base_currency_code',
|
114 |
+
'filter' => false,
|
115 |
+
));
|
116 |
+
|
117 |
+
$this->addColumn('grand_total', array(
|
118 |
+
'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
|
119 |
+
'index' => 'grand_total',
|
120 |
+
'type' => 'currency',
|
121 |
+
'currency' => 'order_currency_code',
|
122 |
+
'filter' => false,
|
123 |
+
));
|
124 |
+
|
125 |
+
$this->addColumn('shipping_description', array(
|
126 |
+
'header'=> Mage::helper('sales')->__('Shipping Method'),
|
127 |
+
'width' => '80px',
|
128 |
+
'type' => 'text',
|
129 |
+
'index' => 'shipping_description',
|
130 |
+
'filter' => false,
|
131 |
+
'truncate' => 30,
|
132 |
+
'escape' => true,
|
133 |
+
));
|
134 |
+
|
135 |
+
$this->addColumn('payment', array(
|
136 |
+
'header' => Mage::helper('sales')->__('Mode de Paiement'),
|
137 |
+
'index' => 'method',
|
138 |
+
'width' => '100px',
|
139 |
+
'type' => 'text',
|
140 |
+
'filter' => false,
|
141 |
+
));
|
142 |
+
|
143 |
+
if(Mage::helper('chronorelais')->isSendingDay()) {
|
144 |
+
$this->addColumn('livraison_le_samedi', array(
|
145 |
+
'header' => Mage::helper('sales')->__('Livraison le Samedi'),
|
146 |
+
'index' => 'livraison_le_samedi',
|
147 |
+
'width' => '100px',
|
148 |
+
'class' => 'a-center',
|
149 |
+
'filter' => false,
|
150 |
+
));
|
151 |
+
}
|
152 |
+
|
153 |
+
$this->addColumn('status', array(
|
154 |
+
'header' => Mage::helper('sales')->__('Status'),
|
155 |
+
'index' => 'status',
|
156 |
+
'type' => 'options',
|
157 |
+
'width' => '70px',
|
158 |
+
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
|
159 |
+
));
|
160 |
+
|
161 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
162 |
+
$this->addColumn('action',
|
163 |
+
array(
|
164 |
+
'header' => Mage::helper('sales')->__('Action'),
|
165 |
+
'width' => '50px',
|
166 |
+
'type' => 'action',
|
167 |
+
'getter' => 'getId',
|
168 |
+
'actions' => array(
|
169 |
+
array(
|
170 |
+
'caption' => Mage::helper('sales')->__('View'),
|
171 |
+
'url' => array('base'=>'adminhtml/sales_order/view'),
|
172 |
+
'field' => 'order_id'
|
173 |
+
)
|
174 |
+
),
|
175 |
+
'filter' => false,
|
176 |
+
'sortable' => false,
|
177 |
+
'index' => 'stores',
|
178 |
+
'is_system' => true,
|
179 |
+
));
|
180 |
+
}
|
181 |
+
|
182 |
+
return parent::_prepareColumns();
|
183 |
+
}
|
184 |
+
|
185 |
+
protected function _prepareMassaction111()
|
186 |
+
{
|
187 |
+
$this->setMassactionIdField('entity_id');
|
188 |
+
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
189 |
+
$this->getMassactionBlock()->setUseSelectAll(false);
|
190 |
+
|
191 |
+
$this->getMassactionBlock()->addItem('export_css', array(
|
192 |
+
'label'=> Mage::helper('chronorelais')->__('Export CSS'),
|
193 |
+
'url' => $this->getUrl('*/*/exportcss'),
|
194 |
+
));
|
195 |
+
$this->getMassactionBlock()->addItem('export_cso', array(
|
196 |
+
'label'=> Mage::helper('chronorelais')->__('Export CSO'),
|
197 |
+
'url' => $this->getUrl('*/*/exportcso'),
|
198 |
+
));
|
199 |
+
|
200 |
+
return $this;
|
201 |
+
}
|
202 |
+
|
203 |
+
protected function _prepareMassaction()
|
204 |
+
{
|
205 |
+
$this->setMassactionIdField('entity_id');
|
206 |
+
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
207 |
+
$this->getMassactionBlock()->setUseSelectAll(false);
|
208 |
+
|
209 |
+
if(Mage::helper('chronorelais')->isSendingDay()) {
|
210 |
+
$shipping = array(
|
211 |
+
'Yes' => Mage::helper('chronorelais')->__('Yes'),
|
212 |
+
'No' => Mage::helper('chronorelais')->__('No'));
|
213 |
+
$this->getMassactionBlock()->addItem('shipping', array(
|
214 |
+
'label' => Mage::helper('chronorelais')->__('Livraison le Samedi'),
|
215 |
+
'url' => $this->getUrl('*/*/massLivraisonSamediStatus', array('_current'=>true)),
|
216 |
+
'additional' => array(
|
217 |
+
'visibility' => array(
|
218 |
+
'name' => 'status',
|
219 |
+
'type' => 'select',
|
220 |
+
'class' => 'required-entry',
|
221 |
+
'style' => 'width:80px',
|
222 |
+
'label' => Mage::helper('chronorelais')->__('Status'),
|
223 |
+
'values' => $shipping
|
224 |
+
)
|
225 |
+
)
|
226 |
+
));
|
227 |
+
}
|
228 |
+
|
229 |
+
$export = array(
|
230 |
+
'css' => Mage::helper('chronorelais')->__('CSS Format'),
|
231 |
+
'cso' => Mage::helper('chronorelais')->__('CSO Format'));
|
232 |
+
array_unshift($export, array('label'=>'', 'value'=>''));
|
233 |
+
$this->getMassactionBlock()->addItem('export', array(
|
234 |
+
'label'=> Mage::helper('chronorelais')->__('Export'),
|
235 |
+
'url' => $this->getUrl('*/*/massExport', array('_current'=>true)),
|
236 |
+
'additional' => array(
|
237 |
+
'visibility' => array(
|
238 |
+
'name' => 'format',
|
239 |
+
'type' => 'select',
|
240 |
+
'class' => 'required-entry',
|
241 |
+
'label' => Mage::helper('chronorelais')->__('Format'),
|
242 |
+
'values' => $export
|
243 |
+
)
|
244 |
+
)
|
245 |
+
));
|
246 |
+
return $this;
|
247 |
+
}
|
248 |
+
|
249 |
+
public function getRowUrl($row)
|
250 |
+
{
|
251 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
252 |
+
return $this->getUrl('adminhtml/sales_order/view', array('order_id' => $row->getId()));
|
253 |
+
}
|
254 |
+
return false;
|
255 |
+
}
|
256 |
+
|
257 |
+
public function getGridUrl()
|
258 |
+
{
|
259 |
+
return $this->getUrl('*/*/*', array('_current'=>true));
|
260 |
+
}
|
261 |
+
|
262 |
+
public function getAdditionalJavaScript()
|
263 |
+
{
|
264 |
+
echo "
|
265 |
+
var element = document.getElementById('chronorelais_export_order_grid_massaction-select');
|
266 |
+
element.selectedIndex = 1;
|
267 |
+
if ('fireEvent' in element)
|
268 |
+
element.fireEvent('onchange');
|
269 |
+
else
|
270 |
+
{
|
271 |
+
var evt = document.createEvent('HTMLEvents');
|
272 |
+
evt.initEvent('change', false, true);
|
273 |
+
element.dispatchEvent(evt);
|
274 |
+
}
|
275 |
+
";
|
276 |
+
}
|
277 |
+
|
278 |
+
}
|
app/code/community/Chronopost/Chronorelais/Block/Filter.php
CHANGED
@@ -1,44 +1,29 @@
|
|
1 |
<?php
|
2 |
class Chronopost_Chronorelais_Block_Filter extends Mage_Core_Block_Template
|
3 |
{
|
4 |
-
|
5 |
-
public function _prepareLayout()
|
6 |
-
{
|
7 |
-
return parent::_prepareLayout();
|
8 |
-
}
|
9 |
-
|
10 |
-
|
11 |
public function getRelaisPoints(){
|
12 |
-
|
13 |
$zipcode = $this->getRequest()->getParam ( 'zipcode' );
|
14 |
|
15 |
if( $zipcode && $zipcode!="" ){
|
16 |
-
$result = Mage::getModel('shipping/rate_result');
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
return $webservbt;
|
21 |
-
}
|
22 |
-
else{
|
23 |
-
return false;
|
24 |
}
|
|
|
25 |
}
|
26 |
|
27 |
public function getmethodeCode(){
|
28 |
-
|
29 |
$zipcode = $this->getRequest()->getParam ( 'methodecode' );
|
30 |
|
31 |
if($zipcode){
|
32 |
-
$result = Mage::getModel('shipping/rate_result');
|
33 |
ini_set("soap.wsdl_cache_enabled", "0");
|
34 |
-
|
35 |
-
|
36 |
-
return $webservbt;
|
37 |
-
}
|
38 |
-
else{
|
39 |
-
return false;
|
40 |
}
|
|
|
41 |
}
|
42 |
-
|
43 |
}
|
44 |
?>
|
1 |
<?php
|
2 |
class Chronopost_Chronorelais_Block_Filter extends Mage_Core_Block_Template
|
3 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
public function getRelaisPoints(){
|
5 |
+
|
6 |
$zipcode = $this->getRequest()->getParam ( 'zipcode' );
|
7 |
|
8 |
if( $zipcode && $zipcode!="" ){
|
9 |
+
$result = Mage::getModel('shipping/rate_result');
|
10 |
+
$helper = Mage::helper('chronorelais/webservice');
|
11 |
+
return $helper->getPointsRelaisByCp($zipcode);
|
|
|
|
|
|
|
|
|
|
|
12 |
}
|
13 |
+
return false;
|
14 |
}
|
15 |
|
16 |
public function getmethodeCode(){
|
17 |
+
|
18 |
$zipcode = $this->getRequest()->getParam ( 'methodecode' );
|
19 |
|
20 |
if($zipcode){
|
21 |
+
$result = Mage::getModel('shipping/rate_result');
|
22 |
ini_set("soap.wsdl_cache_enabled", "0");
|
23 |
+
$helper = Mage::helper('chronorelais/webservice');
|
24 |
+
return $helper->getPointsRelaisByCp($zipcode);
|
|
|
|
|
|
|
|
|
25 |
}
|
26 |
+
return false;
|
27 |
}
|
|
|
28 |
}
|
29 |
?>
|
app/code/community/Chronopost/Chronorelais/Block/Sales/Bordereau/Grid.php
CHANGED
@@ -1,162 +1,162 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Chronopost_Chronorelais_Block_Sales_Bordereau_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
4 |
-
|
5 |
-
public function __construct() {
|
6 |
-
parent::__construct();
|
7 |
-
$this->setTemplate('chronorelais/bordereau/grid.phtml'); /* Pour ajouter la phrase d'impression des bordereaux enxemplaires */
|
8 |
-
$this->setId('sales_order_grid');
|
9 |
-
$this->setDefaultSort('created_at');
|
10 |
-
$this->setDefaultDir('DESC');
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Retrieve collection class
|
15 |
-
*
|
16 |
-
* @return string
|
17 |
-
*/
|
18 |
-
protected function _getCollectionClass() {
|
19 |
-
return 'sales/order_grid_collection';
|
20 |
-
}
|
21 |
-
|
22 |
-
protected function _prepareCollection() {
|
23 |
-
$_chronopost_deliver_saturday = Mage::helper('chronorelais')->getConfigData('carriers/chronopost/deliver_on_saturday');
|
24 |
-
$_chronorelais_deliver_saturday = Mage::helper('chronorelais')->getConfigData('carriers/chronorelais/deliver_on_saturday');
|
25 |
-
if ($_chronopost_deliver_saturday == 1) {
|
26 |
-
$_chronopost_deliver_saturday = 'Yes';
|
27 |
-
} else {
|
28 |
-
$_chronopost_deliver_saturday = 'No';
|
29 |
-
}
|
30 |
-
if ($_chronorelais_deliver_saturday == 1) {
|
31 |
-
$_chronorelais_deliver_saturday = 'Yes';
|
32 |
-
} else {
|
33 |
-
$_chronorelais_deliver_saturday = 'No';
|
34 |
-
}
|
35 |
-
|
36 |
-
$trackNumberFieldName = Mage::helper('chronorelais')->getTrackNumberFieldName();
|
37 |
-
|
38 |
-
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
39 |
-
$collection->getSelect()->joinLeft(array('og' => $collection->getTable('sales/order')), 'main_table.entity_id = og.entity_id', array('CASE LOWER(SUBSTRING_INDEX(og.shipping_method,"_","1")) WHEN "chronoexpress" THEN "Chrono Express" WHEN "chronorelais" THEN "Chrono Relais" ELSE CONCAT(UCASE(SUBSTRING(SUBSTRING_INDEX(og.shipping_method,"_","1"),1,1)),LOWER(SUBSTRING(SUBSTRING_INDEX(og.shipping_method,"_","1"), 2))) END as chrono_shipping_method', 'og.total_qty_ordered'));
|
40 |
-
$collection->getSelect()->joinLeft(array('osg' => $collection->getTable('sales/shipment_grid')), 'main_table.entity_id = osg.order_id', array(new Zend_Db_Expr('if(isNull(osg.increment_id) , "--" , GROUP_CONCAT(DISTINCT osg.increment_id SEPARATOR \', \')) as shipment_increment_id', 'GROUP_CONCAT(DISTINCT osg.created_at SEPARATOR \', \') as shipment_created_at')));
|
41 |
-
$collection->getSelect()->joinLeft(array('ost' => $collection->getTable('sales/shipment_track')), 'main_table.entity_id = ost.order_id', array(new Zend_Db_Expr('if(isNull(ost.'.$trackNumberFieldName.') , "--" , GROUP_CONCAT(DISTINCT ost.'.$trackNumberFieldName.' SEPARATOR \', \')) as track_number', 'if(isNull(ost.title) , "--" , GROUP_CONCAT(DISTINCT ost.title SEPARATOR \', \')) as title')));
|
42 |
-
$collection->getSelect()->joinLeft(array('oes' => Mage::getSingleton('core/resource')->getTableName('sales_chronopost_order_export_status')), 'main_table.entity_id = oes.order_id', array(new Zend_Db_Expr("if(isNull(oes.livraison_le_samedi), CASE LOWER(SUBSTRING_INDEX(og.shipping_method,'_','1')) WHEN 'chronopost' THEN '$_chronopost_deliver_saturday' WHEN 'chronorelais' THEN '$_chronorelais_deliver_saturday' WHEN 'chronoexpress' THEN '--' ELSE 'No' END, oes.livraison_le_samedi) as livraison_le_samedi")));
|
43 |
-
$collection->getSelect()->where('og.shipping_method LIKE "chronorelais%" OR og.shipping_method LIKE "chronopost%" OR og.shipping_method LIKE "chronoexpress%"');
|
44 |
-
$collection->getSelect()->group('main_table.entity_id');
|
45 |
-
$sql = $collection->getSelectSql(true);
|
46 |
-
$collection->getSelect()->reset()->from(
|
47 |
-
array('e' => new Zend_Db_Expr("({$sql})")), array('e' => "*")
|
48 |
-
);
|
49 |
-
|
50 |
-
$this->setCollection($collection);
|
51 |
-
return parent::_prepareCollection();
|
52 |
-
}
|
53 |
-
|
54 |
-
protected function _prepareColumns() {
|
55 |
-
|
56 |
-
$this->addColumn('real_order_id', array(
|
57 |
-
'header' => Mage::helper('sales')->__('Order #'),
|
58 |
-
'width' => '100px',
|
59 |
-
'type' => 'text',
|
60 |
-
'index' => 'increment_id',
|
61 |
-
'filter' => false,
|
62 |
-
));
|
63 |
-
|
64 |
-
$this->addColumn('created_at', array(
|
65 |
-
'header' => Mage::helper('sales')->__('Order Date'),
|
66 |
-
'index' => 'created_at',
|
67 |
-
'type' => 'datetime',
|
68 |
-
'filter' => false,
|
69 |
-
));
|
70 |
-
|
71 |
-
$this->addColumn('shipment_increment_id', array(
|
72 |
-
'header' => Mage::helper('sales')->__('Shipment #'),
|
73 |
-
'index' => 'shipment_increment_id',
|
74 |
-
'type' => 'text',
|
75 |
-
'width' => '100px',
|
76 |
-
'filter' => false,
|
77 |
-
));
|
78 |
-
|
79 |
-
$this->addColumn('shipment_created_at', array(
|
80 |
-
'header' => Mage::helper('sales')->__('Date Shipped'),
|
81 |
-
'index' => 'shipment_created_at',
|
82 |
-
'type' => 'datetime',
|
83 |
-
'filter' => false,
|
84 |
-
));
|
85 |
-
|
86 |
-
$this->addColumn('shipping_name', array(
|
87 |
-
'header' => Mage::helper('sales')->__('Ship to Name'),
|
88 |
-
'index' => 'shipping_name',
|
89 |
-
'filter' => false,
|
90 |
-
));
|
91 |
-
|
92 |
-
$this->addColumn('total_qty_ordered', array(
|
93 |
-
'header' => Mage::helper('sales')->__('Total Qty'),
|
94 |
-
'index' => 'total_qty_ordered',
|
95 |
-
'type' => 'number',
|
96 |
-
'filter' => false,
|
97 |
-
));
|
98 |
-
|
99 |
-
$this->addColumn('track_number', array(
|
100 |
-
'header' => Mage::helper('sales')->__('Tracking'),
|
101 |
-
'index' => 'track_number',
|
102 |
-
'filter' => false,
|
103 |
-
));
|
104 |
-
|
105 |
-
$this->addColumn('chrono_shipping_method', array(
|
106 |
-
'header' => Mage::helper('sales')->__('Mode de transport'),
|
107 |
-
'index' => 'chrono_shipping_method',
|
108 |
-
'type' => 'text',
|
109 |
-
'filter' => false,
|
110 |
-
));
|
111 |
-
|
112 |
-
$this->addColumn('status', array(
|
113 |
-
'header' => Mage::helper('sales')->__('Status'),
|
114 |
-
'index' => 'status',
|
115 |
-
'type' => 'options',
|
116 |
-
'width' => '90px',
|
117 |
-
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
|
118 |
-
));
|
119 |
-
|
120 |
-
if (
|
121 |
-
$this->addColumn('livraison_le_samedi', array(
|
122 |
-
'header' => Mage::helper('sales')->__('Livraison le Samedi'),
|
123 |
-
'index' => 'livraison_le_samedi',
|
124 |
-
'width' => '100px',
|
125 |
-
'class' => 'a-center',
|
126 |
-
'filter' => false,
|
127 |
-
));
|
128 |
-
}
|
129 |
-
|
130 |
-
return parent::_prepareColumns();
|
131 |
-
}
|
132 |
-
|
133 |
-
public function getRowUrl($row) {
|
134 |
-
if (!Mage::getSingleton('admin/session')->isAllowed('sales/order/shipment')) {
|
135 |
-
return false;
|
136 |
-
}
|
137 |
-
|
138 |
-
return $this->getUrl('adminhtml/sales_order/view', array(
|
139 |
-
'order_id' => $row->getId(),
|
140 |
-
)
|
141 |
-
);
|
142 |
-
}
|
143 |
-
|
144 |
-
protected function _prepareMassaction() {
|
145 |
-
|
146 |
-
$this->setMassactionIdField('entity_id');
|
147 |
-
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
148 |
-
$this->getMassactionBlock()->setUseSelectAll(false);
|
149 |
-
|
150 |
-
$this->getMassactionBlock()->addItem('print_bordereau', array(
|
151 |
-
'label' => Mage::helper('chronorelais')->__('Imprimer le bordereau'),
|
152 |
-
'url' => $this->getUrl('*/*/massPrintBordereau', array('_current' => true)),
|
153 |
-
'selected' => true,
|
154 |
-
));
|
155 |
-
|
156 |
-
return $this;
|
157 |
-
}
|
158 |
-
|
159 |
-
public function getGridUrl() {
|
160 |
-
return $this->getUrl('*/*/*', array('_current' => true));
|
161 |
-
}
|
162 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Chronopost_Chronorelais_Block_Sales_Bordereau_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
4 |
+
|
5 |
+
public function __construct() {
|
6 |
+
parent::__construct();
|
7 |
+
$this->setTemplate('chronorelais/bordereau/grid.phtml'); /* Pour ajouter la phrase d'impression des bordereaux enxemplaires */
|
8 |
+
$this->setId('sales_order_grid');
|
9 |
+
$this->setDefaultSort('created_at');
|
10 |
+
$this->setDefaultDir('DESC');
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Retrieve collection class
|
15 |
+
*
|
16 |
+
* @return string
|
17 |
+
*/
|
18 |
+
protected function _getCollectionClass() {
|
19 |
+
return 'sales/order_grid_collection';
|
20 |
+
}
|
21 |
+
|
22 |
+
protected function _prepareCollection() {
|
23 |
+
$_chronopost_deliver_saturday = Mage::helper('chronorelais')->getConfigData('carriers/chronopost/deliver_on_saturday');
|
24 |
+
$_chronorelais_deliver_saturday = Mage::helper('chronorelais')->getConfigData('carriers/chronorelais/deliver_on_saturday');
|
25 |
+
if ($_chronopost_deliver_saturday == 1) {
|
26 |
+
$_chronopost_deliver_saturday = 'Yes';
|
27 |
+
} else {
|
28 |
+
$_chronopost_deliver_saturday = 'No';
|
29 |
+
}
|
30 |
+
if ($_chronorelais_deliver_saturday == 1) {
|
31 |
+
$_chronorelais_deliver_saturday = 'Yes';
|
32 |
+
} else {
|
33 |
+
$_chronorelais_deliver_saturday = 'No';
|
34 |
+
}
|
35 |
+
|
36 |
+
$trackNumberFieldName = Mage::helper('chronorelais')->getTrackNumberFieldName();
|
37 |
+
|
38 |
+
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
39 |
+
$collection->getSelect()->joinLeft(array('og' => $collection->getTable('sales/order')), 'main_table.entity_id = og.entity_id', array('CASE LOWER(SUBSTRING_INDEX(og.shipping_method,"_","1")) WHEN "chronoexpress" THEN "Chrono Express" WHEN "chronorelais" THEN "Chrono Relais" ELSE CONCAT(UCASE(SUBSTRING(SUBSTRING_INDEX(og.shipping_method,"_","1"),1,1)),LOWER(SUBSTRING(SUBSTRING_INDEX(og.shipping_method,"_","1"), 2))) END as chrono_shipping_method', 'og.total_qty_ordered'));
|
40 |
+
$collection->getSelect()->joinLeft(array('osg' => $collection->getTable('sales/shipment_grid')), 'main_table.entity_id = osg.order_id', array(new Zend_Db_Expr('if(isNull(osg.increment_id) , "--" , GROUP_CONCAT(DISTINCT osg.increment_id SEPARATOR \', \')) as shipment_increment_id', 'GROUP_CONCAT(DISTINCT osg.created_at SEPARATOR \', \') as shipment_created_at')));
|
41 |
+
$collection->getSelect()->joinLeft(array('ost' => $collection->getTable('sales/shipment_track')), 'main_table.entity_id = ost.order_id', array(new Zend_Db_Expr('if(isNull(ost.'.$trackNumberFieldName.') , "--" , GROUP_CONCAT(DISTINCT ost.'.$trackNumberFieldName.' SEPARATOR \', \')) as track_number', 'if(isNull(ost.title) , "--" , GROUP_CONCAT(DISTINCT ost.title SEPARATOR \', \')) as title')));
|
42 |
+
$collection->getSelect()->joinLeft(array('oes' => Mage::getSingleton('core/resource')->getTableName('sales_chronopost_order_export_status')), 'main_table.entity_id = oes.order_id', array(new Zend_Db_Expr("if(isNull(oes.livraison_le_samedi), CASE LOWER(SUBSTRING_INDEX(og.shipping_method,'_','1')) WHEN 'chronopost' THEN '$_chronopost_deliver_saturday' WHEN 'chronorelais' THEN '$_chronorelais_deliver_saturday' WHEN 'chronoexpress' THEN '--' ELSE 'No' END, oes.livraison_le_samedi) as livraison_le_samedi")));
|
43 |
+
$collection->getSelect()->where('og.shipping_method LIKE "chronorelais%" OR og.shipping_method LIKE "chronopost%" OR og.shipping_method LIKE "chronoexpress%"');
|
44 |
+
$collection->getSelect()->group('main_table.entity_id');
|
45 |
+
$sql = $collection->getSelectSql(true);
|
46 |
+
$collection->getSelect()->reset()->from(
|
47 |
+
array('e' => new Zend_Db_Expr("({$sql})")), array('e' => "*")
|
48 |
+
);
|
49 |
+
|
50 |
+
$this->setCollection($collection);
|
51 |
+
return parent::_prepareCollection();
|
52 |
+
}
|
53 |
+
|
54 |
+
protected function _prepareColumns() {
|
55 |
+
|
56 |
+
$this->addColumn('real_order_id', array(
|
57 |
+
'header' => Mage::helper('sales')->__('Order #'),
|
58 |
+
'width' => '100px',
|
59 |
+
'type' => 'text',
|
60 |
+
'index' => 'increment_id',
|
61 |
+
'filter' => false,
|
62 |
+
));
|
63 |
+
|
64 |
+
$this->addColumn('created_at', array(
|
65 |
+
'header' => Mage::helper('sales')->__('Order Date'),
|
66 |
+
'index' => 'created_at',
|
67 |
+
'type' => 'datetime',
|
68 |
+
'filter' => false,
|
69 |
+
));
|
70 |
+
|
71 |
+
$this->addColumn('shipment_increment_id', array(
|
72 |
+
'header' => Mage::helper('sales')->__('Shipment #'),
|
73 |
+
'index' => 'shipment_increment_id',
|
74 |
+
'type' => 'text',
|
75 |
+
'width' => '100px',
|
76 |
+
'filter' => false,
|
77 |
+
));
|
78 |
+
|
79 |
+
$this->addColumn('shipment_created_at', array(
|
80 |
+
'header' => Mage::helper('sales')->__('Date Shipped'),
|
81 |
+
'index' => 'shipment_created_at',
|
82 |
+
'type' => 'datetime',
|
83 |
+
'filter' => false,
|
84 |
+
));
|
85 |
+
|
86 |
+
$this->addColumn('shipping_name', array(
|
87 |
+
'header' => Mage::helper('sales')->__('Ship to Name'),
|
88 |
+
'index' => 'shipping_name',
|
89 |
+
'filter' => false,
|
90 |
+
));
|
91 |
+
|
92 |
+
$this->addColumn('total_qty_ordered', array(
|
93 |
+
'header' => Mage::helper('sales')->__('Total Qty'),
|
94 |
+
'index' => 'total_qty_ordered',
|
95 |
+
'type' => 'number',
|
96 |
+
'filter' => false,
|
97 |
+
));
|
98 |
+
|
99 |
+
$this->addColumn('track_number', array(
|
100 |
+
'header' => Mage::helper('sales')->__('Tracking'),
|
101 |
+
'index' => 'track_number',
|
102 |
+
'filter' => false,
|
103 |
+
));
|
104 |
+
|
105 |
+
$this->addColumn('chrono_shipping_method', array(
|
106 |
+
'header' => Mage::helper('sales')->__('Mode de transport'),
|
107 |
+
'index' => 'chrono_shipping_method',
|
108 |
+
'type' => 'text',
|
109 |
+
'filter' => false,
|
110 |
+
));
|
111 |
+
|
112 |
+
$this->addColumn('status', array(
|
113 |
+
'header' => Mage::helper('sales')->__('Status'),
|
114 |
+
'index' => 'status',
|
115 |
+
'type' => 'options',
|
116 |
+
'width' => '90px',
|
117 |
+
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
|
118 |
+
));
|
119 |
+
|
120 |
+
if (Mage::helper('chronorelais')->isSendingDay()) {
|
121 |
+
$this->addColumn('livraison_le_samedi', array(
|
122 |
+
'header' => Mage::helper('sales')->__('Livraison le Samedi'),
|
123 |
+
'index' => 'livraison_le_samedi',
|
124 |
+
'width' => '100px',
|
125 |
+
'class' => 'a-center',
|
126 |
+
'filter' => false,
|
127 |
+
));
|
128 |
+
}
|
129 |
+
|
130 |
+
return parent::_prepareColumns();
|
131 |
+
}
|
132 |
+
|
133 |
+
public function getRowUrl($row) {
|
134 |
+
if (!Mage::getSingleton('admin/session')->isAllowed('sales/order/shipment')) {
|
135 |
+
return false;
|
136 |
+
}
|
137 |
+
|
138 |
+
return $this->getUrl('adminhtml/sales_order/view', array(
|
139 |
+
'order_id' => $row->getId(),
|
140 |
+
)
|
141 |
+
);
|
142 |
+
}
|
143 |
+
|
144 |
+
protected function _prepareMassaction() {
|
145 |
+
|
146 |
+
$this->setMassactionIdField('entity_id');
|
147 |
+
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
148 |
+
$this->getMassactionBlock()->setUseSelectAll(false);
|
149 |
+
|
150 |
+
$this->getMassactionBlock()->addItem('print_bordereau', array(
|
151 |
+
'label' => Mage::helper('chronorelais')->__('Imprimer le bordereau'),
|
152 |
+
'url' => $this->getUrl('*/*/massPrintBordereau', array('_current' => true)),
|
153 |
+
'selected' => true,
|
154 |
+
));
|
155 |
+
|
156 |
+
return $this;
|
157 |
+
}
|
158 |
+
|
159 |
+
public function getGridUrl() {
|
160 |
+
return $this->getUrl('*/*/*', array('_current' => true));
|
161 |
+
}
|
162 |
}
|
app/code/community/Chronopost/Chronorelais/Block/Sales/Order/Shipment/View.php
CHANGED
@@ -1,28 +1,28 @@
|
|
1 |
-
<?php
|
2 |
-
class Chronopost_Chronorelais_Block_Sales_Order_Shipment_View extends Mage_Adminhtml_Block_Sales_Order_Shipment_View
|
3 |
-
{
|
4 |
-
|
5 |
-
public function __construct()
|
6 |
-
{
|
7 |
-
parent::__construct();
|
8 |
-
|
9 |
-
//Ajout de l'impression de l'étiquette Chronopost
|
10 |
-
$_order = $this->getShipment()->getOrder();
|
11 |
-
$_shippingMethod = explode("_",$_order->getShippingMethod());
|
12 |
-
if (($_shippingMethod[0] == 'chronorelais' || $_shippingMethod[0] == 'chronopost' || $_shippingMethod[0] == 'chronoexpress')) {
|
13 |
-
$this->_addButton('etiquette', array(
|
14 |
-
'label' => Mage::helper('chronorelais')->__('Etiquette Chronopost'),
|
15 |
-
'class' => 'save',
|
16 |
-
'onclick' => 'setLocation(\'' . $this->getPrintChronopostUrl() . '\')'
|
17 |
-
)
|
18 |
-
);
|
19 |
-
}
|
20 |
-
}
|
21 |
-
|
22 |
-
public function getPrintChronopostUrl()
|
23 |
-
{
|
24 |
-
return $this->getUrl('adminhtml/chronorelais_sales_impression/print', array(
|
25 |
-
'shipment_id' => $this->getShipment()->getId()
|
26 |
-
));
|
27 |
-
}
|
28 |
}
|
1 |
+
<?php
|
2 |
+
class Chronopost_Chronorelais_Block_Sales_Order_Shipment_View extends Mage_Adminhtml_Block_Sales_Order_Shipment_View
|
3 |
+
{
|
4 |
+
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
|
9 |
+
//Ajout de l'impression de l'étiquette Chronopost
|
10 |
+
$_order = $this->getShipment()->getOrder();
|
11 |
+
$_shippingMethod = explode("_",$_order->getShippingMethod());
|
12 |
+
if (($_shippingMethod[0] == 'chronorelais' || $_shippingMethod[0] == 'chronopost' || $_shippingMethod[0] == 'chronoexpress')) {
|
13 |
+
$this->_addButton('etiquette', array(
|
14 |
+
'label' => Mage::helper('chronorelais')->__('Etiquette Chronopost'),
|
15 |
+
'class' => 'save',
|
16 |
+
'onclick' => 'setLocation(\'' . $this->getPrintChronopostUrl() . '\')'
|
17 |
+
)
|
18 |
+
);
|
19 |
+
}
|
20 |
+
}
|
21 |
+
|
22 |
+
public function getPrintChronopostUrl()
|
23 |
+
{
|
24 |
+
return $this->getUrl('adminhtml/chronorelais_sales_impression/print', array(
|
25 |
+
'shipment_id' => $this->getShipment()->getId()
|
26 |
+
));
|
27 |
+
}
|
28 |
}
|
app/code/community/Chronopost/Chronorelais/Block/Sales/Shipment/Grid.php
CHANGED
@@ -1,254 +1,259 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Chronopost_Chronorelais_Block_Sales_Shipment_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
4 |
-
|
5 |
-
public function __construct() {
|
6 |
-
parent::__construct();
|
7 |
-
$this->setId('sales_order_grid');
|
8 |
-
$this->setDefaultSort('created_at');
|
9 |
-
$this->setDefaultDir('DESC');
|
10 |
-
}
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Retrieve collection class
|
14 |
-
*
|
15 |
-
* @return string
|
16 |
-
*/
|
17 |
-
protected function _getCollectionClass() {
|
18 |
-
return 'sales/order_grid_collection';
|
19 |
-
}
|
20 |
-
|
21 |
-
protected function _prepareCollection() {
|
22 |
-
$_chronopost_deliver_saturday = Mage::helper('chronorelais')->getConfigData('carriers/chronopost/deliver_on_saturday');
|
23 |
-
$_chronorelais_deliver_saturday = Mage::helper('chronorelais')->getConfigData('carriers/chronorelais/deliver_on_saturday');
|
24 |
-
if ($_chronopost_deliver_saturday == 1) {
|
25 |
-
$_chronopost_deliver_saturday = 'Yes';
|
26 |
-
} else {
|
27 |
-
$_chronopost_deliver_saturday = 'No';
|
28 |
-
}
|
29 |
-
if ($_chronorelais_deliver_saturday == 1) {
|
30 |
-
$_chronorelais_deliver_saturday = 'Yes';
|
31 |
-
} else {
|
32 |
-
$_chronorelais_deliver_saturday = 'No';
|
33 |
-
}
|
34 |
-
|
35 |
-
$trackNumberFieldName = Mage::helper('chronorelais')->getTrackNumberFieldName();
|
36 |
-
|
37 |
-
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
38 |
-
$collection->getSelect()->joinLeft(array('og' => $collection->getTable('sales/order')), 'main_table.entity_id = og.entity_id', array('CASE LOWER(SUBSTRING_INDEX(og.shipping_method,"_","1")) WHEN "chronoexpress" THEN "Chrono Express" WHEN "chronorelais" THEN "Chrono Relais" ELSE CONCAT(UCASE(SUBSTRING(SUBSTRING_INDEX(og.shipping_method,"_","1"),1,1)),LOWER(SUBSTRING(SUBSTRING_INDEX(og.shipping_method,"_","1"), 2))) END as chrono_shipping_method', 'og.total_qty_ordered'));
|
39 |
-
$collection->getSelect()->joinLeft(array('osg' => $collection->getTable('sales/shipment_grid')), 'main_table.entity_id = osg.order_id', array(new Zend_Db_Expr('if(isNull(osg.increment_id) , "--" , GROUP_CONCAT(DISTINCT osg.increment_id SEPARATOR \', \')) as shipment_increment_id', 'GROUP_CONCAT(DISTINCT osg.created_at SEPARATOR \', \') as shipment_created_at')));
|
40 |
-
$collection->getSelect()->joinLeft(array('ost' => $collection->getTable('sales/shipment_track')), 'main_table.entity_id = ost.order_id', array(new Zend_Db_Expr('if(isNull(ost.'.$trackNumberFieldName.') , "--" , GROUP_CONCAT(DISTINCT ost.'.$trackNumberFieldName.' SEPARATOR \', \')) as track_number', 'if(isNull(ost.title) , "--" , GROUP_CONCAT(DISTINCT ost.title SEPARATOR \', \')) as title')));
|
41 |
-
$collection->getSelect()->joinLeft(array('oes' => Mage::getSingleton('core/resource')->getTableName('sales_chronopost_order_export_status')), 'main_table.entity_id = oes.order_id', array(new Zend_Db_Expr("if(isNull(oes.livraison_le_samedi), CASE LOWER(SUBSTRING_INDEX(og.shipping_method,'_','1')) WHEN 'chronopost' THEN '$_chronopost_deliver_saturday' WHEN 'chronorelais' THEN '$_chronorelais_deliver_saturday' WHEN 'chronoexpress' THEN '--' ELSE 'No' END, oes.livraison_le_samedi) as livraison_le_samedi")));
|
42 |
-
$collection->getSelect()->where('og.shipping_method LIKE "chronorelais%" OR og.shipping_method LIKE "chronopost%" OR og.shipping_method LIKE "chronoexpress%"');
|
43 |
-
$collection->getSelect()->group('main_table.entity_id');
|
44 |
-
$sql = $collection->getSelectSql(true);
|
45 |
-
$collection->getSelect()->reset()->from(
|
46 |
-
array('e' => new Zend_Db_Expr("({$sql})")), array('e' => "*")
|
47 |
-
);
|
48 |
-
|
49 |
-
$this->setCollection($collection);
|
50 |
-
return parent::_prepareCollection();
|
51 |
-
}
|
52 |
-
|
53 |
-
protected function _prepareColumns() {
|
54 |
-
|
55 |
-
$this->addColumn('real_order_id', array(
|
56 |
-
'header' => Mage::helper('sales')->__('Order #'),
|
57 |
-
'width' => '100px',
|
58 |
-
'type' => 'text',
|
59 |
-
'index' => 'increment_id',
|
60 |
-
'filter' => false,
|
61 |
-
));
|
62 |
-
|
63 |
-
$this->addColumn('created_at', array(
|
64 |
-
'header' => Mage::helper('sales')->__('Order Date'),
|
65 |
-
'index' => 'created_at',
|
66 |
-
'type' => 'datetime',
|
67 |
-
'filter' => false,
|
68 |
-
));
|
69 |
-
|
70 |
-
$this->addColumn('shipment_increment_id', array(
|
71 |
-
'header' => Mage::helper('sales')->__('Shipment #'),
|
72 |
-
'index' => 'shipment_increment_id',
|
73 |
-
'type' => 'text',
|
74 |
-
'width' => '100px',
|
75 |
-
'filter' => false,
|
76 |
-
'column_css_class' => 'shipment_ids'
|
77 |
-
));
|
78 |
-
|
79 |
-
$this->addColumn('shipment_created_at', array(
|
80 |
-
'header' => Mage::helper('sales')->__('Date Shipped'),
|
81 |
-
'index' => 'shipment_created_at',
|
82 |
-
'type' => 'datetime',
|
83 |
-
'filter' => false,
|
84 |
-
));
|
85 |
-
|
86 |
-
$this->addColumn('shipping_name', array(
|
87 |
-
'header' => Mage::helper('sales')->__('Ship to Name'),
|
88 |
-
'index' => 'shipping_name',
|
89 |
-
'filter' => false,
|
90 |
-
));
|
91 |
-
|
92 |
-
$this->addColumn('total_qty_ordered', array(
|
93 |
-
'header' => Mage::helper('sales')->__('Total Qty'),
|
94 |
-
'index' => 'total_qty_ordered',
|
95 |
-
'type' => 'number',
|
96 |
-
'filter' => false,
|
97 |
-
));
|
98 |
-
|
99 |
-
$this->addColumn('track_number', array(
|
100 |
-
'header' => Mage::helper('sales')->__('Tracking'),
|
101 |
-
'index' => 'track_number',
|
102 |
-
'filter' => false,
|
103 |
-
));
|
104 |
-
|
105 |
-
$this->addColumn('chrono_shipping_method', array(
|
106 |
-
'header' => Mage::helper('sales')->__('Mode de transport'),
|
107 |
-
'index' => 'chrono_shipping_method',
|
108 |
-
'type' => 'text',
|
109 |
-
'filter' => false,
|
110 |
-
));
|
111 |
-
|
112 |
-
if (
|
113 |
-
$this->addColumn('livraison_le_samedi', array(
|
114 |
-
'header' => Mage::helper('sales')->__('Livraison le Samedi'),
|
115 |
-
'index' => 'livraison_le_samedi',
|
116 |
-
'width' => '100px',
|
117 |
-
'class' => 'a-center',
|
118 |
-
'filter' => false,
|
119 |
-
));
|
120 |
-
}
|
121 |
-
|
122 |
-
$this->addColumn('etiquette_expedition', array(
|
123 |
-
'header' => Mage::helper('chronorelais')->__('Impression étiquette expédition'),
|
124 |
-
'type' => 'action',
|
125 |
-
'getter' => 'getId',
|
126 |
-
'column_css_class' => 'etiquette_expedition',
|
127 |
-
'actions' => array(
|
128 |
-
array(
|
129 |
-
'caption' => Mage::helper('chronorelais')->__('Expédition'),
|
130 |
-
'url' => array(
|
131 |
-
'base' => '*/*/print'
|
132 |
-
),
|
133 |
-
'field' => 'order_id'
|
134 |
-
)
|
135 |
-
),
|
136 |
-
'filter' => false,
|
137 |
-
'sortable' => false,
|
138 |
-
'index' => 'stores'
|
139 |
-
));
|
140 |
-
|
141 |
-
$this->addColumn('etiquette_retour', array(
|
142 |
-
'header' => Mage::helper('chronorelais')->__('Impression étiquette retour'),
|
143 |
-
'type' => 'action',
|
144 |
-
'getter' => 'getId',
|
145 |
-
'column_css_class' => 'etiquette_retour',
|
146 |
-
'actions' => array(
|
147 |
-
array(
|
148 |
-
'caption' => Mage::helper('chronorelais')->__('Retour SAV'),
|
149 |
-
'url' => array(
|
150 |
-
'base' => '*/*/printEtiquetteRetour'
|
151 |
-
),
|
152 |
-
'field' => 'order_id'
|
153 |
-
)
|
154 |
-
),
|
155 |
-
'filter' => false,
|
156 |
-
'renderer' => 'Chronopost_Chronorelais_Block_Sales_Shipment_Grid_Renderer_Retoursav',
|
157 |
-
'sortable' => false,
|
158 |
-
'index' => 'stores'
|
159 |
-
));
|
160 |
-
|
161 |
-
return parent::_prepareColumns();
|
162 |
-
}
|
163 |
-
|
164 |
-
public function getRowUrl($row) {
|
165 |
-
if (!Mage::getSingleton('admin/session')->isAllowed('sales/order/shipment')) {
|
166 |
-
return false;
|
167 |
-
}
|
168 |
-
|
169 |
-
return $this->getUrl('adminhtml/sales_order/view', array(
|
170 |
-
'order_id' => $row->getId(),
|
171 |
-
)
|
172 |
-
);
|
173 |
-
}
|
174 |
-
|
175 |
-
protected function _prepareMassaction() {
|
176 |
-
|
177 |
-
$this->setMassactionIdField('entity_id');
|
178 |
-
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
179 |
-
$this->getMassactionBlock()->setUseSelectAll(false);
|
180 |
-
|
181 |
-
$
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
'
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
'
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
lienRetour.
|
236 |
-
}
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
}
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Chronopost_Chronorelais_Block_Sales_Shipment_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
4 |
+
|
5 |
+
public function __construct() {
|
6 |
+
parent::__construct();
|
7 |
+
$this->setId('sales_order_grid');
|
8 |
+
$this->setDefaultSort('created_at');
|
9 |
+
$this->setDefaultDir('DESC');
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Retrieve collection class
|
14 |
+
*
|
15 |
+
* @return string
|
16 |
+
*/
|
17 |
+
protected function _getCollectionClass() {
|
18 |
+
return 'sales/order_grid_collection';
|
19 |
+
}
|
20 |
+
|
21 |
+
protected function _prepareCollection() {
|
22 |
+
$_chronopost_deliver_saturday = Mage::helper('chronorelais')->getConfigData('carriers/chronopost/deliver_on_saturday');
|
23 |
+
$_chronorelais_deliver_saturday = Mage::helper('chronorelais')->getConfigData('carriers/chronorelais/deliver_on_saturday');
|
24 |
+
if ($_chronopost_deliver_saturday == 1) {
|
25 |
+
$_chronopost_deliver_saturday = 'Yes';
|
26 |
+
} else {
|
27 |
+
$_chronopost_deliver_saturday = 'No';
|
28 |
+
}
|
29 |
+
if ($_chronorelais_deliver_saturday == 1) {
|
30 |
+
$_chronorelais_deliver_saturday = 'Yes';
|
31 |
+
} else {
|
32 |
+
$_chronorelais_deliver_saturday = 'No';
|
33 |
+
}
|
34 |
+
|
35 |
+
$trackNumberFieldName = Mage::helper('chronorelais')->getTrackNumberFieldName();
|
36 |
+
|
37 |
+
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
38 |
+
$collection->getSelect()->joinLeft(array('og' => $collection->getTable('sales/order')), 'main_table.entity_id = og.entity_id', array('CASE LOWER(SUBSTRING_INDEX(og.shipping_method,"_","1")) WHEN "chronoexpress" THEN "Chrono Express" WHEN "chronorelais" THEN "Chrono Relais" ELSE CONCAT(UCASE(SUBSTRING(SUBSTRING_INDEX(og.shipping_method,"_","1"),1,1)),LOWER(SUBSTRING(SUBSTRING_INDEX(og.shipping_method,"_","1"), 2))) END as chrono_shipping_method', 'og.total_qty_ordered'));
|
39 |
+
$collection->getSelect()->joinLeft(array('osg' => $collection->getTable('sales/shipment_grid')), 'main_table.entity_id = osg.order_id', array(new Zend_Db_Expr('if(isNull(osg.increment_id) , "--" , GROUP_CONCAT(DISTINCT osg.increment_id SEPARATOR \', \')) as shipment_increment_id', 'GROUP_CONCAT(DISTINCT osg.created_at SEPARATOR \', \') as shipment_created_at')));
|
40 |
+
$collection->getSelect()->joinLeft(array('ost' => $collection->getTable('sales/shipment_track')), 'main_table.entity_id = ost.order_id', array(new Zend_Db_Expr('if(isNull(ost.'.$trackNumberFieldName.') , "--" , GROUP_CONCAT(DISTINCT ost.'.$trackNumberFieldName.' SEPARATOR \', \')) as track_number', 'if(isNull(ost.title) , "--" , GROUP_CONCAT(DISTINCT ost.title SEPARATOR \', \')) as title')));
|
41 |
+
$collection->getSelect()->joinLeft(array('oes' => Mage::getSingleton('core/resource')->getTableName('sales_chronopost_order_export_status')), 'main_table.entity_id = oes.order_id', array(new Zend_Db_Expr("if(isNull(oes.livraison_le_samedi), CASE LOWER(SUBSTRING_INDEX(og.shipping_method,'_','1')) WHEN 'chronopost' THEN '$_chronopost_deliver_saturday' WHEN 'chronorelais' THEN '$_chronorelais_deliver_saturday' WHEN 'chronoexpress' THEN '--' ELSE 'No' END, oes.livraison_le_samedi) as livraison_le_samedi")));
|
42 |
+
$collection->getSelect()->where('og.shipping_method LIKE "chronorelais%" OR og.shipping_method LIKE "chronopost%" OR og.shipping_method LIKE "chronoexpress%"');
|
43 |
+
$collection->getSelect()->group('main_table.entity_id');
|
44 |
+
$sql = $collection->getSelectSql(true);
|
45 |
+
$collection->getSelect()->reset()->from(
|
46 |
+
array('e' => new Zend_Db_Expr("({$sql})")), array('e' => "*")
|
47 |
+
);
|
48 |
+
|
49 |
+
$this->setCollection($collection);
|
50 |
+
return parent::_prepareCollection();
|
51 |
+
}
|
52 |
+
|
53 |
+
protected function _prepareColumns() {
|
54 |
+
|
55 |
+
$this->addColumn('real_order_id', array(
|
56 |
+
'header' => Mage::helper('sales')->__('Order #'),
|
57 |
+
'width' => '100px',
|
58 |
+
'type' => 'text',
|
59 |
+
'index' => 'increment_id',
|
60 |
+
'filter' => false,
|
61 |
+
));
|
62 |
+
|
63 |
+
$this->addColumn('created_at', array(
|
64 |
+
'header' => Mage::helper('sales')->__('Order Date'),
|
65 |
+
'index' => 'created_at',
|
66 |
+
'type' => 'datetime',
|
67 |
+
'filter' => false,
|
68 |
+
));
|
69 |
+
|
70 |
+
$this->addColumn('shipment_increment_id', array(
|
71 |
+
'header' => Mage::helper('sales')->__('Shipment #'),
|
72 |
+
'index' => 'shipment_increment_id',
|
73 |
+
'type' => 'text',
|
74 |
+
'width' => '100px',
|
75 |
+
'filter' => false,
|
76 |
+
'column_css_class' => 'shipment_ids'
|
77 |
+
));
|
78 |
+
|
79 |
+
$this->addColumn('shipment_created_at', array(
|
80 |
+
'header' => Mage::helper('sales')->__('Date Shipped'),
|
81 |
+
'index' => 'shipment_created_at',
|
82 |
+
'type' => 'datetime',
|
83 |
+
'filter' => false,
|
84 |
+
));
|
85 |
+
|
86 |
+
$this->addColumn('shipping_name', array(
|
87 |
+
'header' => Mage::helper('sales')->__('Ship to Name'),
|
88 |
+
'index' => 'shipping_name',
|
89 |
+
'filter' => false,
|
90 |
+
));
|
91 |
+
|
92 |
+
$this->addColumn('total_qty_ordered', array(
|
93 |
+
'header' => Mage::helper('sales')->__('Total Qty'),
|
94 |
+
'index' => 'total_qty_ordered',
|
95 |
+
'type' => 'number',
|
96 |
+
'filter' => false,
|
97 |
+
));
|
98 |
+
|
99 |
+
$this->addColumn('track_number', array(
|
100 |
+
'header' => Mage::helper('sales')->__('Tracking'),
|
101 |
+
'index' => 'track_number',
|
102 |
+
'filter' => false,
|
103 |
+
));
|
104 |
+
|
105 |
+
$this->addColumn('chrono_shipping_method', array(
|
106 |
+
'header' => Mage::helper('sales')->__('Mode de transport'),
|
107 |
+
'index' => 'chrono_shipping_method',
|
108 |
+
'type' => 'text',
|
109 |
+
'filter' => false,
|
110 |
+
));
|
111 |
+
|
112 |
+
if (Mage::helper('chronorelais')->isSendingDay()) {
|
113 |
+
$this->addColumn('livraison_le_samedi', array(
|
114 |
+
'header' => Mage::helper('sales')->__('Livraison le Samedi'),
|
115 |
+
'index' => 'livraison_le_samedi',
|
116 |
+
'width' => '100px',
|
117 |
+
'class' => 'a-center',
|
118 |
+
'filter' => false,
|
119 |
+
));
|
120 |
+
}
|
121 |
+
|
122 |
+
$this->addColumn('etiquette_expedition', array(
|
123 |
+
'header' => Mage::helper('chronorelais')->__('Impression étiquette expédition'),
|
124 |
+
'type' => 'action',
|
125 |
+
'getter' => 'getId',
|
126 |
+
'column_css_class' => 'etiquette_expedition',
|
127 |
+
'actions' => array(
|
128 |
+
array(
|
129 |
+
'caption' => Mage::helper('chronorelais')->__('Expédition'),
|
130 |
+
'url' => array(
|
131 |
+
'base' => '*/*/print'
|
132 |
+
),
|
133 |
+
'field' => 'order_id'
|
134 |
+
)
|
135 |
+
),
|
136 |
+
'filter' => false,
|
137 |
+
'sortable' => false,
|
138 |
+
'index' => 'stores'
|
139 |
+
));
|
140 |
+
|
141 |
+
$this->addColumn('etiquette_retour', array(
|
142 |
+
'header' => Mage::helper('chronorelais')->__('Impression étiquette retour'),
|
143 |
+
'type' => 'action',
|
144 |
+
'getter' => 'getId',
|
145 |
+
'column_css_class' => 'etiquette_retour',
|
146 |
+
'actions' => array(
|
147 |
+
array(
|
148 |
+
'caption' => Mage::helper('chronorelais')->__('Retour SAV'),
|
149 |
+
'url' => array(
|
150 |
+
'base' => '*/*/printEtiquetteRetour'
|
151 |
+
),
|
152 |
+
'field' => 'order_id'
|
153 |
+
)
|
154 |
+
),
|
155 |
+
'filter' => false,
|
156 |
+
'renderer' => 'Chronopost_Chronorelais_Block_Sales_Shipment_Grid_Renderer_Retoursav',
|
157 |
+
'sortable' => false,
|
158 |
+
'index' => 'stores'
|
159 |
+
));
|
160 |
+
|
161 |
+
return parent::_prepareColumns();
|
162 |
+
}
|
163 |
+
|
164 |
+
public function getRowUrl($row) {
|
165 |
+
if (!Mage::getSingleton('admin/session')->isAllowed('sales/order/shipment')) {
|
166 |
+
return false;
|
167 |
+
}
|
168 |
+
|
169 |
+
return $this->getUrl('adminhtml/sales_order/view', array(
|
170 |
+
'order_id' => $row->getId(),
|
171 |
+
)
|
172 |
+
);
|
173 |
+
}
|
174 |
+
|
175 |
+
protected function _prepareMassaction() {
|
176 |
+
|
177 |
+
$this->setMassactionIdField('entity_id');
|
178 |
+
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
179 |
+
$this->getMassactionBlock()->setUseSelectAll(false);
|
180 |
+
|
181 |
+
$this->getMassactionBlock()->addItem('cancel', array(
|
182 |
+
'label' => Mage::helper('chronorelais')->__('Annuler les étiquettes'),
|
183 |
+
'url' => $this->getUrl('*/*/cancelMass', array('_current' => true)),
|
184 |
+
));
|
185 |
+
|
186 |
+
$cmd = Mage::helper('chronorelais')->getConfigData('chronorelais/shipping/gs_path')." -v";
|
187 |
+
$res_shell = shell_exec($cmd);
|
188 |
+
if($res_shell !== null) {
|
189 |
+
$this->getMassactionBlock()->addItem('print', array(
|
190 |
+
'label' => Mage::helper('chronorelais')->__('Imprimer les étiquettes'),
|
191 |
+
'url' => $this->getUrl('*/*/printMass', array('_current' => true)),
|
192 |
+
));
|
193 |
+
}
|
194 |
+
|
195 |
+
if (Mage::helper('chronorelais')->isSendingDay()) {
|
196 |
+
|
197 |
+
$shipping = array(
|
198 |
+
'Yes' => Mage::helper('chronorelais')->__('Yes'),
|
199 |
+
'No' => Mage::helper('chronorelais')->__('No'));
|
200 |
+
$this->getMassactionBlock()->addItem('shipping', array(
|
201 |
+
'label' => Mage::helper('chronorelais')->__('Livraison le Samedi'),
|
202 |
+
'url' => $this->getUrl('*/*/massLivraisonSamediStatus', array('_current' => true)),
|
203 |
+
'additional' => array(
|
204 |
+
'visibility' => array(
|
205 |
+
'name' => 'status',
|
206 |
+
'type' => 'select',
|
207 |
+
'class' => 'required-entry',
|
208 |
+
'style' => 'width:80px',
|
209 |
+
'label' => Mage::helper('chronorelais')->__('Status'),
|
210 |
+
'values' => $shipping
|
211 |
+
)
|
212 |
+
)
|
213 |
+
));
|
214 |
+
}
|
215 |
+
return $this;
|
216 |
+
}
|
217 |
+
|
218 |
+
public function getGridUrl() {
|
219 |
+
return $this->getUrl('*/*/*', array('_current' => true));
|
220 |
+
}
|
221 |
+
|
222 |
+
public function getAdditionalJavaScript() {
|
223 |
+
echo "
|
224 |
+
var tds = $$('#sales_order_grid_table tr td.shipment_ids');
|
225 |
+
tds.each(function(item) {
|
226 |
+
var chaine = item.innerHTML.replace(/^\s+/g,'').replace(/\s+$/g,'');
|
227 |
+
var lienExpedition = $(item).next('.etiquette_expedition').down('a');
|
228 |
+
var lienRetour = $(item).next('.etiquette_retour').down('a');
|
229 |
+
if (chaine.split(', ').length > 1) {
|
230 |
+
var contentExpedition = '';
|
231 |
+
var contentRetour = '';
|
232 |
+
var numbers = chaine.split(', ');
|
233 |
+
for (var i=0; i<numbers.length; i++) {
|
234 |
+
contentExpedition += '<a href=\"' + lienExpedition.href.replace(/\/order_id\/\d+\//, '/shipment_increment_id/' + numbers[i] + '/') + '\">Expédition ' + numbers[i] + '</a><br />';
|
235 |
+
contentRetour += '<a href=\"' + lienRetour.href.replace(/\/order_id\/\d+\//, '/shipment_increment_id/' + numbers[i] + '/') + '\" >Retour SAV ' + numbers[i] + '</a><br />';
|
236 |
+
}
|
237 |
+
lienExpedition.up().innerHTML = contentExpedition;
|
238 |
+
if(typeof lienRetour !== 'undefined')
|
239 |
+
{
|
240 |
+
lienRetour.up().innerHTML = contentRetour;
|
241 |
+
}
|
242 |
+
}
|
243 |
+
else if(chaine.length > 2) {
|
244 |
+
lienExpedition.up().innerHTML = '<a href=\"' + lienExpedition.href.replace(/\/order_id\/\d+\//, '/shipment_increment_id/' + chaine + '/') + '\">Expédition</a><br />';
|
245 |
+
if(typeof lienRetour !== 'undefined')
|
246 |
+
{
|
247 |
+
lienRetour.up().innerHTML = '<a href=\"' + lienRetour.href.replace(/\/order_id\/\d+\//, '/shipment_increment_id/' + chaine + '/') + '\" >Retour SAV</a><br />';
|
248 |
+
}
|
249 |
+
}
|
250 |
+
else {
|
251 |
+
if(typeof lienRetour !== 'undefined')
|
252 |
+
{
|
253 |
+
lienRetour.up().innerHTML = '';
|
254 |
+
}
|
255 |
+
}
|
256 |
+
});";
|
257 |
+
}
|
258 |
+
|
259 |
+
}
|
app/code/community/Chronopost/Chronorelais/Block/Sales/Shipment/Grid/Renderer/Retoursav.php
CHANGED
@@ -1,28 +1,31 @@
|
|
1 |
-
<?php
|
2 |
-
class Chronopost_Chronorelais_Block_Sales_Shipment_Grid_Renderer_Retoursav
|
3 |
-
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
|
4 |
-
{
|
5 |
-
|
6 |
-
public function render(Varien_Object $row)
|
7 |
-
{
|
8 |
-
$actions = $this->getColumn()->getActions();
|
9 |
-
if ( empty($actions) || !is_array($actions) ) {
|
10 |
-
return ' ';
|
11 |
-
}
|
12 |
-
$countryId = $row->getShippingAddress()->getCountryId();
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
$
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
}
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Chronopost_Chronorelais_Block_Sales_Shipment_Grid_Renderer_Retoursav
|
3 |
+
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
public function render(Varien_Object $row)
|
7 |
+
{
|
8 |
+
$actions = $this->getColumn()->getActions();
|
9 |
+
if ( empty($actions) || !is_array($actions) ) {
|
10 |
+
return ' ';
|
11 |
+
}
|
12 |
+
$countryId = $row->getShippingAddress()->getCountryId();
|
13 |
+
$shippingMethodCode = strtolower($row->getChronoShippingMethod());
|
14 |
+
|
15 |
+
if($countryId != 'FR' && strpos($shippingMethodCode, 'chronorelaiseurope') === false) {
|
16 |
+
return '';
|
17 |
+
}
|
18 |
+
$out = '';
|
19 |
+
$i = 0;
|
20 |
+
foreach ($actions as $action){
|
21 |
+
if (is_array($action) ) {
|
22 |
+
if($i > 0) {
|
23 |
+
$out .= '<br />';
|
24 |
+
}
|
25 |
+
$out .= $this->_toLinkHtml($action, $row);
|
26 |
+
$i++;
|
27 |
+
}
|
28 |
+
}
|
29 |
+
return $out;
|
30 |
+
}
|
31 |
+
}
|
app/code/community/Chronopost/Chronorelais/Controller/Abstract.php
CHANGED
@@ -29,17 +29,22 @@ class Chronopost_Chronorelais_Controller_Abstract extends Mage_Adminhtml_Control
|
|
29 |
$args = $message->args;
|
30 |
$message = $message->message;
|
31 |
}
|
32 |
-
|
33 |
$output = Mage::helper('shipping')->__($message);
|
34 |
-
if (count($args)==0)
|
|
|
|
|
35 |
|
36 |
-
if (!isset($this->_translate_inline))
|
|
|
|
|
37 |
if ($this->_translate_inline) {
|
38 |
$parts = explode('}}{{',$output);
|
39 |
$parts[0] = vsprintf($parts[0],$args);
|
40 |
return implode('}}{{',$parts);
|
|
|
|
|
41 |
}
|
42 |
-
else return vsprintf($output,$args);
|
43 |
}
|
44 |
|
45 |
protected function getIncludingPath($path) {
|
@@ -81,7 +86,6 @@ class Chronopost_Chronorelais_Controller_Abstract extends Mage_Adminhtml_Control
|
|
81 |
header('Content-disposition: attachment; filename="'.$filename.'"');
|
82 |
header('Content-Type: application/force-download');
|
83 |
header('Content-Transfer-Encoding: '.$mime_type."\n"); // Surtout ne pas enlever le \n
|
84 |
-
//header('Content-Length: '.filesize($filename));
|
85 |
header('Pragma: no-cache');
|
86 |
header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
|
87 |
header('Expires: 0');
|
29 |
$args = $message->args;
|
30 |
$message = $message->message;
|
31 |
}
|
32 |
+
|
33 |
$output = Mage::helper('shipping')->__($message);
|
34 |
+
if (count($args)==0) {
|
35 |
+
return $output;
|
36 |
+
}
|
37 |
|
38 |
+
if (!isset($this->_translate_inline)) {
|
39 |
+
$this->_translate_inline = Mage::getSingleton('core/translate')->getTranslateInline();
|
40 |
+
}
|
41 |
if ($this->_translate_inline) {
|
42 |
$parts = explode('}}{{',$output);
|
43 |
$parts[0] = vsprintf($parts[0],$args);
|
44 |
return implode('}}{{',$parts);
|
45 |
+
} else {
|
46 |
+
return vsprintf($output,$args);
|
47 |
}
|
|
|
48 |
}
|
49 |
|
50 |
protected function getIncludingPath($path) {
|
86 |
header('Content-disposition: attachment; filename="'.$filename.'"');
|
87 |
header('Content-Type: application/force-download');
|
88 |
header('Content-Transfer-Encoding: '.$mime_type."\n"); // Surtout ne pas enlever le \n
|
|
|
89 |
header('Pragma: no-cache');
|
90 |
header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
|
91 |
header('Expires: 0');
|
app/code/community/Chronopost/Chronorelais/Helper/Conflicts.php
CHANGED
@@ -1,161 +1,159 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Chronopost_Chronorelais_Helper_Conflicts extends Mage_Core_Helper_Abstract {
|
4 |
-
|
5 |
-
const DEBUG = false;
|
6 |
-
|
7 |
-
var $rewrites;
|
8 |
-
|
9 |
-
var $whiteList = array("Mage_Adminhtml_Controller_Action", "Mage_Core_Controller_Front_Action");
|
10 |
-
|
11 |
-
public function checkForConflicts() {
|
12 |
-
$this->rewrites = array(
|
13 |
-
"chrono" => array(
|
14 |
-
"blocks" => array(),
|
15 |
-
"helpers" => array(),
|
16 |
-
"models" => array(),
|
17 |
-
"controllers" => array(),
|
18 |
-
),
|
19 |
-
"other" => array(
|
20 |
-
"blocks" => array(),
|
21 |
-
"helpers" => array(),
|
22 |
-
"models" => array(),
|
23 |
-
"controllers" => array(),
|
24 |
-
),
|
25 |
-
);
|
26 |
-
|
27 |
-
// Define pathes to check
|
28 |
-
$mageCodeDir = Mage::getBaseDir() . DS . 'app' . DS . 'code' . DS;
|
29 |
-
$modulePathes = array($mageCodeDir . 'local', $mageCodeDir . 'community');
|
30 |
-
|
31 |
-
$result = "";
|
32 |
-
|
33 |
-
// Recursively browse pathes
|
34 |
-
foreach ($modulePathes as $modulePath) {
|
35 |
-
|
36 |
-
if(!is_dir($modulePath)) {
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
if (self::DEBUG)
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
$scope = "
|
74 |
-
}
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
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 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
$result = "
|
154 |
-
}
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Chronopost_Chronorelais_Helper_Conflicts extends Mage_Core_Helper_Abstract {
|
4 |
+
|
5 |
+
const DEBUG = false;
|
6 |
+
|
7 |
+
var $rewrites;
|
8 |
+
|
9 |
+
var $whiteList = array("Mage_Adminhtml_Controller_Action", "Mage_Core_Controller_Front_Action");
|
10 |
+
|
11 |
+
public function checkForConflicts() {
|
12 |
+
$this->rewrites = array(
|
13 |
+
"chrono" => array(
|
14 |
+
"blocks" => array(),
|
15 |
+
"helpers" => array(),
|
16 |
+
"models" => array(),
|
17 |
+
"controllers" => array(),
|
18 |
+
),
|
19 |
+
"other" => array(
|
20 |
+
"blocks" => array(),
|
21 |
+
"helpers" => array(),
|
22 |
+
"models" => array(),
|
23 |
+
"controllers" => array(),
|
24 |
+
),
|
25 |
+
);
|
26 |
+
|
27 |
+
// Define pathes to check
|
28 |
+
$mageCodeDir = Mage::getBaseDir() . DS . 'app' . DS . 'code' . DS;
|
29 |
+
$modulePathes = array($mageCodeDir . 'local', $mageCodeDir . 'community');
|
30 |
+
|
31 |
+
$result = "";
|
32 |
+
|
33 |
+
// Recursively browse pathes
|
34 |
+
foreach ($modulePathes as $modulePath) {
|
35 |
+
|
36 |
+
if(!is_dir($modulePath)) {
|
37 |
+
continue;
|
38 |
+
}
|
39 |
+
|
40 |
+
$dir = new RecursiveDirectoryIterator($modulePath, FilesystemIterator::SKIP_DOTS);
|
41 |
+
$ite = new RecursiveIteratorIterator($dir, RecursiveIteratorIterator::SELF_FIRST);
|
42 |
+
|
43 |
+
// Get config.xml files
|
44 |
+
$configXmls = new RegexIterator($ite, '/^.+config\.xml$/i', RecursiveRegexIterator::GET_MATCH);
|
45 |
+
|
46 |
+
foreach ($configXmls as $configXml) {
|
47 |
+
if (self::DEBUG) {
|
48 |
+
$result .= '' . $configXml[0] . "\n";
|
49 |
+
}
|
50 |
+
|
51 |
+
// Parse XML to look for rewrites
|
52 |
+
$xml = simplexml_load_file($configXml[0]);
|
53 |
+
$rewrites = $xml->xpath('//rewrite');
|
54 |
+
|
55 |
+
while(list( , $node) = each($rewrites)) {
|
56 |
+
$moduleNode = $node->xpath("..");
|
57 |
+
$moduleName = $moduleNode[0]->getName();
|
58 |
+
|
59 |
+
// Filter route rewrites
|
60 |
+
if ($moduleName != "global") {
|
61 |
+
$typeNode = $moduleNode[0]->xpath("..");
|
62 |
+
$typeName = $typeNode[0]->getName();
|
63 |
+
|
64 |
+
foreach ($node->children() as $child) {
|
65 |
+
$rewriteFrom = "Mage_" . str_replace(" ", "_", ucwords($moduleName . " " . substr($typeName, 0, -1) . " " . str_replace("_", " ", $child->getName())));
|
66 |
+
|
67 |
+
if (self::DEBUG) {
|
68 |
+
$result .= "Rewrite from : " . $rewriteFrom . "\n";
|
69 |
+
$result .= "Rewrite to : " . $child->__toString() . "\n";
|
70 |
+
}
|
71 |
+
|
72 |
+
if (strpos($child->__toString(), "Chronopost_Chronorelais") !== false) {
|
73 |
+
$scope = "chrono";
|
74 |
+
} else {
|
75 |
+
$scope = "other";
|
76 |
+
}
|
77 |
+
|
78 |
+
if (!isset($this->rewrites[$scope][$typeName][$rewriteFrom])) {
|
79 |
+
$this->rewrites[$scope][$typeName][$rewriteFrom] = array();
|
80 |
+
}
|
81 |
+
$this->rewrites[$scope][$typeName][$rewriteFrom][] = $child->__toString();
|
82 |
+
}
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
if (self::DEBUG) {
|
87 |
+
$result .= "\n";
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
// Get controllers PHP files
|
92 |
+
$controllerPhps = new RegexIterator($ite, '/^.+controllers.+\.php$/i', RecursiveRegexIterator::GET_MATCH);
|
93 |
+
|
94 |
+
foreach ($controllerPhps as $controllerPhp) {
|
95 |
+
$className = "";
|
96 |
+
$scope = "";
|
97 |
+
|
98 |
+
$php_file = file_get_contents($controllerPhp[0]);
|
99 |
+
$tokens = token_get_all($php_file);
|
100 |
+
$class_token = false;
|
101 |
+
$extends_token = false;
|
102 |
+
foreach ($tokens as $token) {
|
103 |
+
if (is_array($token)) {
|
104 |
+
if ($token[0] == T_CLASS) {
|
105 |
+
$class_token = true;
|
106 |
+
} else if ($class_token && $token[0] == T_STRING) {
|
107 |
+
$className = $token[1];
|
108 |
+
$class_token = false;
|
109 |
+
} else if ($token[0] == T_EXTENDS) {
|
110 |
+
$extends_token = true;
|
111 |
+
} else if ($extends_token && $token[0] == T_STRING) {
|
112 |
+
if (self::DEBUG) {
|
113 |
+
$result .= 'File ' . $controllerPhp[0] . ":\n" .
|
114 |
+
" Class " . $className . "\n" .
|
115 |
+
" Extends " . $token[1] . "\n\n";
|
116 |
+
}
|
117 |
+
|
118 |
+
if (empty($scope)) {
|
119 |
+
if (strpos($className, "Chronopost_Chronorelais") !== false) {
|
120 |
+
$scope = "chrono";
|
121 |
+
} else {
|
122 |
+
$scope = "other";
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
if (!isset($this->rewrites[$scope]["controllers"][$token[1]])) {
|
127 |
+
$this->rewrites[$scope]["controllers"][$token[1]] = array();
|
128 |
+
}
|
129 |
+
$this->rewrites[$scope]["controllers"][$token[1]][] = $className;
|
130 |
+
|
131 |
+
$className = "";
|
132 |
+
$extends_token = false;
|
133 |
+
}
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
// Parse rewrites table to check for conflicts
|
140 |
+
|
141 |
+
foreach ($this->rewrites['chrono'] as $type => $rewrites) {
|
142 |
+
foreach ($rewrites as $from => $tos) {
|
143 |
+
if (!in_array($from, $this->whiteList) && isset($this->rewrites['other'][$type][$from])) {
|
144 |
+
// Houston, we have a rewrite
|
145 |
+
$result .= "<p>[" . $type . "] La réécriture de la Classe <u>" . $from . "</u> par <u>" . implode(', ', $tos) . "</u> pourrait entrer en conflit avec les réécritures faites par <u>" . implode(', ', $this->rewrites['other'][$type][$from]) . "</u></p>\r\n";
|
146 |
+
}
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
if (empty($result)) {
|
151 |
+
$result = "Aucun conflit n'a été detecté au niveau des controleurs, des classes de block, des helpers ou des modèles.";
|
152 |
+
} else {
|
153 |
+
$result = "<p>Des conflits potentiels ont été détectés :</p>" . $result . "<p>Ces résultats sont à analyser individuellement. Ils offrent des pistes à étudier et ne remplacent pas une étude approfondie du code.</p>";
|
154 |
+
}
|
155 |
+
|
156 |
+
return $result;
|
157 |
+
}
|
158 |
+
|
159 |
+
}
|
|
|
|
app/code/community/Chronopost/Chronorelais/Helper/Data.php
CHANGED
@@ -1,350 +1,463 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Chronopost_Chronorelais_Helper_Data extends Mage_Core_Helper_Abstract {
|
4 |
-
//Choronorelais settings for productCode
|
5 |
-
const CHRONO_POST = '01'; // for France
|
6 |
-
const CHRONO_POST_BAL = '58'; // For france avec option BAL
|
7 |
-
const CHRONO_EXPRESS = '17'; // for Interantional
|
8 |
-
const CHRONORELAIS = '86'; // for Chronorelais
|
9 |
-
const CHRONOPOST_C10 = '02'; // for Chronopost C10
|
10 |
-
const CHRONOPOST_C18 = '16'; // for Chronopost C18
|
11 |
-
const CHRONOPOST_C18_BAL = '2M'; // for Chronopost C18 avec option BAL
|
12 |
-
const CHRONOPOST_CClassic = '44'; // for Chronopost CClassic
|
13 |
-
const CHRONOPOST_13H = '13H'; // for France
|
14 |
-
const CHRONOPOST_13H_BAL = '13H BAL'; // for France BAL
|
15 |
-
const CHRONOPOST_C10_STR = '10H'; // for Chronopost C10
|
16 |
-
const CHRONOPOST_C18_STR = '18H'; // for Chronopost C18
|
17 |
-
const CHRONOPOST_C18_BAL_STR = '18H BAL'; // for Chronopost C18 BAL
|
18 |
-
const CHRONOPOST_CClassic_STR = 'CClassic'; // for Chronopost CClassic
|
19 |
-
const CHRONOEXPRESS_EI = 'EI'; // for Interantional
|
20 |
-
const CHRONORELAIS_PR = 'PR'; // for Chronorelais
|
21 |
-
const CHRONOPOST_DEFAULT_COUNTRY = 'FR';
|
22 |
-
const CHRONOPOST_TRACKING_URL = 'http://wsshipping.chronopost.fr/shipping/services/getReservedSkybill?reservationNumber={trackingNumber}';
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
public function
|
45 |
-
$
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
$
|
52 |
-
|
53 |
-
$
|
54 |
-
|
55 |
-
$
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
public function
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
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 |
-
case '
|
120 |
-
$productcode =
|
121 |
-
break;
|
122 |
-
case '
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
case '
|
159 |
-
|
160 |
-
|
161 |
-
case '
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
case '
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
$productcode =
|
178 |
-
}
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
public function
|
308 |
-
return
|
309 |
-
}
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
$
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
return $
|
321 |
-
}
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
public function
|
335 |
-
return $this->getConfigData('
|
336 |
-
}
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Chronopost_Chronorelais_Helper_Data extends Mage_Core_Helper_Abstract {
|
4 |
+
//Choronorelais settings for productCode
|
5 |
+
const CHRONO_POST = '01'; // for France
|
6 |
+
const CHRONO_POST_BAL = '58'; // For france avec option BAL
|
7 |
+
const CHRONO_EXPRESS = '17'; // for Interantional
|
8 |
+
const CHRONORELAIS = '86'; // for Chronorelais
|
9 |
+
const CHRONOPOST_C10 = '02'; // for Chronopost C10
|
10 |
+
const CHRONOPOST_C18 = '16'; // for Chronopost C18
|
11 |
+
const CHRONOPOST_C18_BAL = '2M'; // for Chronopost C18 avec option BAL
|
12 |
+
const CHRONOPOST_CClassic = '44'; // for Chronopost CClassic
|
13 |
+
const CHRONOPOST_13H = '13H'; // for France
|
14 |
+
const CHRONOPOST_13H_BAL = '13H BAL'; // for France BAL
|
15 |
+
const CHRONOPOST_C10_STR = '10H'; // for Chronopost C10
|
16 |
+
const CHRONOPOST_C18_STR = '18H'; // for Chronopost C18
|
17 |
+
const CHRONOPOST_C18_BAL_STR = '18H BAL'; // for Chronopost C18 BAL
|
18 |
+
const CHRONOPOST_CClassic_STR = 'CClassic'; // for Chronopost CClassic
|
19 |
+
const CHRONOEXPRESS_EI = 'EI'; // for Interantional
|
20 |
+
const CHRONORELAIS_PR = 'PR'; // for Chronorelais
|
21 |
+
const CHRONOPOST_DEFAULT_COUNTRY = 'FR';
|
22 |
+
const CHRONOPOST_TRACKING_URL = 'http://wsshipping.chronopost.fr/shipping/services/getReservedSkybill?reservationNumber={trackingNumber}';
|
23 |
+
|
24 |
+
const CHRONORELAISEUROPE = '49'; // for Chronorelais Europe
|
25 |
+
const CHRONORELAISEUROPE_STR = 'PRU'; // for Chronorelais Europe
|
26 |
+
|
27 |
+
const CHRONORELAISDOM = '4P'; // for Chronorelais DOM
|
28 |
+
const CHRONORELAISDOM_STR = 'PRDOM'; // for Chronorelais DOM
|
29 |
+
|
30 |
+
const CHRONOPOST_SMD = '4I'; // for Chronopost SAMEDAY
|
31 |
+
const CHRONOPOST_SMD_STR = 'SMD'; // for Chronopost SAMEDAY
|
32 |
+
|
33 |
+
const CHRONOPOST_SRDV = '2O'; // for Chronopost Sur Rendez-vous 'O' majuscule et non 0
|
34 |
+
const CHRONOPOST_SRDV_STR = 'SRDV'; // for Chronopost Sur Rendez-vous
|
35 |
+
|
36 |
+
// if you are in a period outside thursday 18:00 to friday 15:00, there is no shipping on saturday
|
37 |
+
var $SaturdayShippingDays = array(
|
38 |
+
'startday' => 'thursday',
|
39 |
+
'endday' => 'friday',
|
40 |
+
'starttime' => '18:00:00',
|
41 |
+
'endtime' => '15:00:00'
|
42 |
+
);
|
43 |
+
|
44 |
+
public function getConfigData($path) {
|
45 |
+
return Mage::getStoreConfig($path, Mage::app()->getStore());
|
46 |
+
}
|
47 |
+
|
48 |
+
public function getSaturdayShippingDays() {
|
49 |
+
|
50 |
+
$starday = explode(":",$this->getConfigData("chronorelais/saturday/startday"));
|
51 |
+
$endday = explode(":",$this->getConfigData("chronorelais/saturday/endday"));
|
52 |
+
|
53 |
+
$saturdayDays = array();
|
54 |
+
$saturdayDays['startday'] = (count($starday) == 3 && isset($starday[0])) ? $starday[0] : $this->SaturdayShippingDays['startday'];
|
55 |
+
$saturdayDays['starttime'] = (count($starday) == 3 && isset($starday[1])) ? $starday[1].':'.$starday[2].':00' : $this->SaturdayShippingDays['starttime'];
|
56 |
+
$saturdayDays['endday'] = (count($endday) == 3 && isset($endday[0])) ? $endday[0] : $this->SaturdayShippingDays['endday'];
|
57 |
+
$saturdayDays['endtime'] = (count($endday) == 3 && isset($endday[1])) ? $endday[1].':'.$endday[2].':00' : $this->SaturdayShippingDays['endtime'];
|
58 |
+
|
59 |
+
return $saturdayDays;
|
60 |
+
}
|
61 |
+
|
62 |
+
public function getCurrentTimeByZone($timezone="Europe/Paris", $format="l H:i") {
|
63 |
+
$d = new DateTime("now", new DateTimeZone($timezone));
|
64 |
+
return $d->format($format);
|
65 |
+
}
|
66 |
+
|
67 |
+
public function isSendingDay() {
|
68 |
+
$shipping_days = $this->getSaturdayShippingDays();
|
69 |
+
$current_day = strtolower($this->getCurrentTimeByZone("Europe/Paris", "l"));
|
70 |
+
$current_date = $this->getCurrentTimeByZone("Europe/Paris", "Y-m-d H:i:s");
|
71 |
+
$current_datetime = explode(' ', $current_date);
|
72 |
+
|
73 |
+
//get timestamps
|
74 |
+
$start_timestamp = strtotime($current_datetime[0] . " " . $shipping_days['starttime']);
|
75 |
+
$end_timestamp = strtotime($current_datetime[0] . " " . $shipping_days['endtime']);
|
76 |
+
$current_timestamp = strtotime($current_date);
|
77 |
+
|
78 |
+
$sending_day = false;
|
79 |
+
/*if ( ($shipping_days['startday'] == $current_day && $current_timestamp >= $start_timestamp) || ($shipping_days['endday'] == $current_day && $current_timestamp <= $end_timestamp) ) {
|
80 |
+
$sending_day = true;
|
81 |
+
}*/
|
82 |
+
if ( $current_timestamp >= $start_timestamp && $current_timestamp <= $end_timestamp ) {
|
83 |
+
$sending_day = true;
|
84 |
+
}
|
85 |
+
return $sending_day;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* General Shipping configuration
|
90 |
+
*/
|
91 |
+
public function getConfigurationAccountNumber() {
|
92 |
+
return $this->getConfigData('chronorelais/shipping/account_number');
|
93 |
+
}
|
94 |
+
|
95 |
+
public function getConfigurationSubAccountNumber() {
|
96 |
+
return $this->getConfigData('chronorelais/shipping/sub_account_number');
|
97 |
+
}
|
98 |
+
|
99 |
+
public function getConfigurationAccountPass() {
|
100 |
+
return $this->getConfigData('chronorelais/shipping/account_pass');
|
101 |
+
}
|
102 |
+
|
103 |
+
public function getConfigurationTrackingViewUrl() {
|
104 |
+
return $this->getConfigData('chronorelais/shipping/tracking_view_url');
|
105 |
+
}
|
106 |
+
|
107 |
+
public function getConfigurationGoogleMapAPIKey() {
|
108 |
+
return $this->getConfigData('chronorelais/shipping/google_map_api');
|
109 |
+
}
|
110 |
+
|
111 |
+
public function getChronoProductCode($country, $code='') {
|
112 |
+
$productcode = '';
|
113 |
+
$code = strtolower($code);
|
114 |
+
|
115 |
+
switch($code) {
|
116 |
+
case 'chronorelais' :
|
117 |
+
$productcode = static::CHRONORELAIS;
|
118 |
+
break;
|
119 |
+
case 'chronopost' :
|
120 |
+
$productcode = static::CHRONO_POST;
|
121 |
+
break;
|
122 |
+
case 'chronoexpress' :
|
123 |
+
$productcode = static::CHRONO_EXPRESS;
|
124 |
+
break;
|
125 |
+
case 'chronopostc10' :
|
126 |
+
$productcode = static::CHRONOPOST_C10;
|
127 |
+
break;
|
128 |
+
case 'chronopostc18' :
|
129 |
+
$productcode = static::CHRONOPOST_C18;
|
130 |
+
break;
|
131 |
+
case 'chronopostcclassic' :
|
132 |
+
$productcode = static::CHRONOPOST_CClassic;
|
133 |
+
break;
|
134 |
+
case 'chronorelaiseurope' :
|
135 |
+
$productcode = static::CHRONORELAISEUROPE;
|
136 |
+
break;
|
137 |
+
case 'chronorelaisdom' :
|
138 |
+
$productcode = static::CHRONORELAISDOM;
|
139 |
+
break;
|
140 |
+
case 'chronopostsameday' :
|
141 |
+
$productcode = static::CHRONOPOST_SMD;
|
142 |
+
break;
|
143 |
+
case 'chronopostsrdv' :
|
144 |
+
$productcode = static::CHRONOPOST_SRDV;
|
145 |
+
break;
|
146 |
+
default :
|
147 |
+
$productcode = static::CHRONO_POST;
|
148 |
+
break;
|
149 |
+
}
|
150 |
+
return $productcode;
|
151 |
+
}
|
152 |
+
|
153 |
+
public function getChronoProductCodeToShipment($code='') {
|
154 |
+
$productcode = '';
|
155 |
+
$code = strtolower($code);
|
156 |
+
|
157 |
+
switch($code) {
|
158 |
+
case 'chronorelais' :
|
159 |
+
$productcode = static::CHRONORELAIS;
|
160 |
+
break;
|
161 |
+
case 'chronopost' :
|
162 |
+
if($this->getConfigOptionBAL()) {
|
163 |
+
$productcode = static::CHRONO_POST_BAL;
|
164 |
+
}
|
165 |
+
else {
|
166 |
+
$productcode = static::CHRONO_POST;
|
167 |
+
}
|
168 |
+
break;
|
169 |
+
case 'chronoexpress' :
|
170 |
+
$productcode = static::CHRONO_EXPRESS;
|
171 |
+
break;
|
172 |
+
case 'chronopostc10' :
|
173 |
+
$productcode = static::CHRONOPOST_C10;
|
174 |
+
break;
|
175 |
+
case 'chronopostc18' :
|
176 |
+
if($this->getConfigOptionBAL()) {
|
177 |
+
$productcode = static::CHRONOPOST_C18_BAL;
|
178 |
+
}
|
179 |
+
else {
|
180 |
+
$productcode = static::CHRONOPOST_C18;
|
181 |
+
}
|
182 |
+
break;
|
183 |
+
case 'chronopostcclassic' :
|
184 |
+
$productcode = static::CHRONOPOST_CClassic;
|
185 |
+
break;
|
186 |
+
case 'chronorelaiseurope' :
|
187 |
+
$productcode = static::CHRONORELAISEUROPE;
|
188 |
+
break;
|
189 |
+
case 'chronorelaisdom' :
|
190 |
+
$productcode = static::CHRONORELAISDOM;
|
191 |
+
break;
|
192 |
+
case 'chronopostsameday' :
|
193 |
+
$productcode = static::CHRONOPOST_SMD;
|
194 |
+
break;
|
195 |
+
case 'chronopostsrdv' :
|
196 |
+
$productcode = static::CHRONOPOST_SRDV;
|
197 |
+
break;
|
198 |
+
default :
|
199 |
+
$productcode = static::CHRONO_POST;
|
200 |
+
break;
|
201 |
+
}
|
202 |
+
return $productcode;
|
203 |
+
}
|
204 |
+
|
205 |
+
public function getChronoProductCodeString($code='') {
|
206 |
+
$productcode = '';
|
207 |
+
$code = strtolower($code);
|
208 |
+
|
209 |
+
switch($code) {
|
210 |
+
case 'chronorelais' :
|
211 |
+
$productcode = static::CHRONORELAIS_PR;
|
212 |
+
break;
|
213 |
+
case 'chronopost' :
|
214 |
+
$productcode = static::CHRONOPOST_13H;
|
215 |
+
break;
|
216 |
+
case 'chronoexpress' :
|
217 |
+
$productcode = static::CHRONOEXPRESS_EI;
|
218 |
+
break;
|
219 |
+
case 'chronopostc10' :
|
220 |
+
$productcode = static::CHRONOPOST_C10_STR;
|
221 |
+
break;
|
222 |
+
case 'chronopostc18' :
|
223 |
+
$productcode = static::CHRONOPOST_C18_STR;
|
224 |
+
break;
|
225 |
+
case 'chronopostcclassic' :
|
226 |
+
$productcode = static::CHRONOPOST_CClassic_STR;
|
227 |
+
break;
|
228 |
+
case 'chronorelaiseurope' :
|
229 |
+
$productcode = static::CHRONORELAISEUROPE_STR;
|
230 |
+
break;
|
231 |
+
case 'chronorelaisdom' :
|
232 |
+
$productcode = static::CHRONORELAISDOM_STR;
|
233 |
+
break;
|
234 |
+
case 'chronopostsameday' :
|
235 |
+
$productcode = static::CHRONOPOST_SMD_STR;
|
236 |
+
break;
|
237 |
+
case 'chronopostsrdv' :
|
238 |
+
$productcode = static::CHRONOPOST_SRDV_STR;
|
239 |
+
break;
|
240 |
+
default :
|
241 |
+
$productcode = static::CHRONOPOST_13H;
|
242 |
+
break;
|
243 |
+
}
|
244 |
+
return $productcode;
|
245 |
+
}
|
246 |
+
|
247 |
+
public function getChronoProductCodeStringWithBAL($code='') {
|
248 |
+
$productcode = '';
|
249 |
+
$code = strtolower($code);
|
250 |
+
|
251 |
+
switch($code) {
|
252 |
+
case 'chronorelais' :
|
253 |
+
$productcode = static::CHRONORELAIS_PR;
|
254 |
+
break;
|
255 |
+
case 'chronopost' :
|
256 |
+
if($this->getConfigOptionBAL()) {
|
257 |
+
$productcode = static::CHRONOPOST_13H_BAL;
|
258 |
+
}
|
259 |
+
else {
|
260 |
+
$productcode = static::CHRONOPOST_13H;
|
261 |
+
}
|
262 |
+
break;
|
263 |
+
case 'chronoexpress' :
|
264 |
+
$productcode = static::CHRONOEXPRESS_EI;
|
265 |
+
break;
|
266 |
+
case 'chronopostc10' :
|
267 |
+
$productcode = static::CHRONOPOST_C10_STR;
|
268 |
+
break;
|
269 |
+
case 'chronopostc18' :
|
270 |
+
if($this->getConfigOptionBAL()) {
|
271 |
+
$productcode = static::CHRONOPOST_C18_BAL_STR;
|
272 |
+
}
|
273 |
+
else {
|
274 |
+
$productcode = static::CHRONOPOST_C18_STR;
|
275 |
+
}
|
276 |
+
break;
|
277 |
+
case 'chronopostcclassic' :
|
278 |
+
$productcode = static::CHRONOPOST_CClassic_STR;
|
279 |
+
break;
|
280 |
+
case 'chronorelaiseurope' :
|
281 |
+
$productcode = static::CHRONORELAISEUROPE_STR;
|
282 |
+
break;
|
283 |
+
case 'chronorelaisdom' :
|
284 |
+
$productcode = static::CHRONORELAISDOM_STR;
|
285 |
+
break;
|
286 |
+
case 'chronopostsrdv' :
|
287 |
+
$productcode = static::CHRONOPOST_SRDV_STR;
|
288 |
+
break;
|
289 |
+
default :
|
290 |
+
$productcode = static::CHRONOPOST_13H;
|
291 |
+
break;
|
292 |
+
}
|
293 |
+
return $productcode;
|
294 |
+
}
|
295 |
+
|
296 |
+
public function getConfigurationTrackingUrl() {
|
297 |
+
return static::CHRONOPOST_TRACKING_URL;
|
298 |
+
}
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Export configuration
|
302 |
+
*/
|
303 |
+
public function getConfigurationFileExtension($export_type='css') {
|
304 |
+
return $this->getConfigData('chronorelais/export_' . $export_type . '/file_extension');
|
305 |
+
}
|
306 |
+
|
307 |
+
public function getConfigurationFileCharset($export_type='css') {
|
308 |
+
return $this->getConfigData('chronorelais/export_' . $export_type . '/file_charset');
|
309 |
+
}
|
310 |
+
|
311 |
+
public function getConfigurationEndOfLineCharacter($export_type='css') {
|
312 |
+
return $this->getConfigData('chronorelais/export_' . $export_type . '/endofline_character');
|
313 |
+
}
|
314 |
+
|
315 |
+
public function getConfigurationFieldDelimiter($export_type='css') {
|
316 |
+
return $this->getConfigData('chronorelais/export_' . $export_type . '/field_delimiter');
|
317 |
+
}
|
318 |
+
|
319 |
+
public function getConfigurationFieldSeparator($export_type='css') {
|
320 |
+
return $this->getConfigData('chronorelais/export_' . $export_type . '/field_separator');
|
321 |
+
}
|
322 |
+
|
323 |
+
/**
|
324 |
+
* Import configuration
|
325 |
+
*/
|
326 |
+
public function getConfigurationSendEmail() {
|
327 |
+
return $this->getConfigData('chronorelais/import/send_email');
|
328 |
+
}
|
329 |
+
|
330 |
+
public function getConfigurationIncludeComment() {
|
331 |
+
return $this->getConfigData('chronorelais/import/include_comment');
|
332 |
+
}
|
333 |
+
|
334 |
+
public function getConfigurationDefaultTrackingTitle() {
|
335 |
+
return $this->getConfigData('chronorelais/import/default_tracking_title');
|
336 |
+
}
|
337 |
+
|
338 |
+
public function getConfigurationShippingComment() {
|
339 |
+
return $this->getConfigData('chronorelais/import/shipping_comment');
|
340 |
+
}
|
341 |
+
|
342 |
+
/**
|
343 |
+
* Shipper Information
|
344 |
+
*/
|
345 |
+
public function getConfigurationShipperInfo($field) {
|
346 |
+
$fieldValue = '';
|
347 |
+
if ($field && $this->getConfigData('chronorelais/shipperinformation/' . $field)) {
|
348 |
+
$fieldValue = $this->getConfigData('chronorelais/shipperinformation/' . $field);
|
349 |
+
}
|
350 |
+
return $fieldValue;
|
351 |
+
}
|
352 |
+
|
353 |
+
/**
|
354 |
+
* Chronopost Customer Information
|
355 |
+
*/
|
356 |
+
public function getConfigurationCustomerInfo($field) {
|
357 |
+
$fieldValue = '';
|
358 |
+
if ($field && $this->getConfigData('chronorelais/customerinformation/' . $field)) {
|
359 |
+
$fieldValue = $this->getConfigData('chronorelais/customerinformation/' . $field);
|
360 |
+
}
|
361 |
+
return $fieldValue;
|
362 |
+
}
|
363 |
+
|
364 |
+
/**
|
365 |
+
* Import configuration
|
366 |
+
*/
|
367 |
+
public function getConfigurationSkybillParam() {
|
368 |
+
return $this->getConfigData('chronorelais/skybillparam/mode');
|
369 |
+
}
|
370 |
+
|
371 |
+
/*
|
372 |
+
* Weight unit
|
373 |
+
*/
|
374 |
+
public function getConfigWeightUnit() {
|
375 |
+
return $this->getConfigData('chronorelais/weightunit/unit');
|
376 |
+
}
|
377 |
+
|
378 |
+
/*
|
379 |
+
* Option BAL
|
380 |
+
*/
|
381 |
+
public function getConfigOptionBAL() {
|
382 |
+
return $this->getConfigData('chronorelais/optionbal/enabled');
|
383 |
+
}
|
384 |
+
|
385 |
+
public function hasOptionBAL($order) {
|
386 |
+
$shippingMethod = explode('_',$order->getShippingMethod());
|
387 |
+
$shippingMethod = $shippingMethod[1];
|
388 |
+
$shippingMethodAllowBAL = array('chronopost','chronopostc18');
|
389 |
+
if(in_array(strtolower($shippingMethod), $shippingMethodAllowBAL) && $this->getConfigOptionBAL()) {
|
390 |
+
return true;
|
391 |
+
}
|
392 |
+
return false;
|
393 |
+
}
|
394 |
+
|
395 |
+
/*
|
396 |
+
* Assurance Ad Valorem
|
397 |
+
*/
|
398 |
+
public function assuranceAdValoremEnabled() {
|
399 |
+
return $this->getConfigData('chronorelais/assurance/enabled');
|
400 |
+
}
|
401 |
+
public function assuranceAdValoremAmount() {
|
402 |
+
return $this->getConfigData('chronorelais/assurance/amount');
|
403 |
+
}
|
404 |
+
public function getMaxAdValoremAmount() {
|
405 |
+
return 20000;
|
406 |
+
}
|
407 |
+
|
408 |
+
/* Get Livraison le Samedi status by orderid */
|
409 |
+
|
410 |
+
public function getLivraisonSamediStatus($order_id) {
|
411 |
+
$_connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
412 |
+
$_table = Mage::getSingleton('core/resource')->getTableName('sales_chronopost_order_export_status');
|
413 |
+
$select = $_connection->select()
|
414 |
+
->from($_table, 'livraison_le_samedi')
|
415 |
+
->where('order_id=?', $order_id);
|
416 |
+
$status = $_connection->fetchOne($select);
|
417 |
+
return $status;
|
418 |
+
}
|
419 |
+
|
420 |
+
|
421 |
+
/*
|
422 |
+
* Return true si la méthode de livraison fait partie du contrat du marchant
|
423 |
+
*/
|
424 |
+
public function shippingMethodEnabled($shippingMethod) {
|
425 |
+
return true;
|
426 |
+
}
|
427 |
+
|
428 |
+
/*
|
429 |
+
* Return true if we can show google map
|
430 |
+
*/
|
431 |
+
public function canShowGoogleMap() {
|
432 |
+
return $this->getConfigData('carriers/chronorelais/show_google_map');
|
433 |
+
}
|
434 |
+
|
435 |
+
/* return track number field name */
|
436 |
+
public function getTrackNumberFieldName() {
|
437 |
+
if (version_compare(Mage::getVersion(), '1.5.1.0', '>')) {
|
438 |
+
return "track_number";
|
439 |
+
} else {
|
440 |
+
return "number";
|
441 |
+
}
|
442 |
+
|
443 |
+
}
|
444 |
+
|
445 |
+
public function addMargeToQuickcost($quickcost_val,$carrierCode = '', $firstPassage = true) {
|
446 |
+
if($carrierCode) {
|
447 |
+
|
448 |
+
$quickcostMarge = Mage::getStoreConfig('carriers/' . $carrierCode . '/quickcost_marge');
|
449 |
+
$quickcostMargeType = Mage::getStoreConfig('carriers/' . $carrierCode . '/quickcost_marge_type');
|
450 |
+
|
451 |
+
if($quickcostMarge) {
|
452 |
+
if($quickcostMargeType == 'amount') {
|
453 |
+
$quickcost_val += $quickcostMarge;
|
454 |
+
} elseif($quickcostMargeType == 'prcent') {
|
455 |
+
$quickcost_val += $quickcost_val * $quickcostMarge / 100;
|
456 |
+
}
|
457 |
+
}
|
458 |
+
}
|
459 |
+
|
460 |
+
return $quickcost_val;
|
461 |
+
}
|
462 |
+
|
463 |
+
}
|
app/code/community/Chronopost/Chronorelais/Helper/Webservice.php
CHANGED
@@ -1,449 +1,727 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Chronopost_Chronorelais_Helper_Webservice extends Mage_Core_Helper_Abstract {
|
4 |
-
|
5 |
-
var $methodsAllowed = false;
|
6 |
-
|
7 |
-
public function getPointsRelaisByCp($cp) {
|
8 |
-
|
9 |
-
try {
|
10 |
-
$client = new SoapClient("http://wsshipping.chronopost.fr/soap.point.relais/services/ServiceRechercheBt?wsdl",array('trace'=> 0,'connection_timeout'=>10));
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
$quote = Mage::getSingleton('checkout/cart')->getQuote();
|
24 |
-
$address = $quote->getShippingAddress();
|
25 |
-
$helperData = Mage::helper('chronorelais');
|
26 |
-
|
27 |
-
try {
|
28 |
-
|
29 |
-
|
30 |
-
$
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
*
|
73 |
-
*
|
74 |
-
*
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
localite
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
*
|
93 |
-
*
|
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 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
{
|
175 |
-
$newPr =
|
176 |
-
|
177 |
-
|
178 |
-
$newPr->
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Chronopost_Chronorelais_Helper_Webservice extends Mage_Core_Helper_Abstract {
|
4 |
+
|
5 |
+
var $methodsAllowed = false;
|
6 |
+
|
7 |
+
public function getPointsRelaisByCp($cp) {
|
8 |
+
|
9 |
+
try {
|
10 |
+
$client = new SoapClient("http://wsshipping.chronopost.fr/soap.point.relais/services/ServiceRechercheBt?wsdl",array('trace'=> 0,'connection_timeout'=>10));
|
11 |
+
return $client->__call("rechercheBtParCodeproduitEtCodepostalEtDate",array(0,$cp,0));
|
12 |
+
} catch (Exception $e) {
|
13 |
+
return $this->getPointsRelaisByPudo('',$cp);
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
/* get point relais by address */
|
18 |
+
public function getPointRelaisByAddress($shippingMethodCode = 'chronorelais') {
|
19 |
+
|
20 |
+
if(!$shippingMethodCode) {
|
21 |
+
return false;
|
22 |
+
}
|
23 |
+
$quote = Mage::getSingleton('checkout/cart')->getQuote();
|
24 |
+
$address = $quote->getShippingAddress();
|
25 |
+
$helperData = Mage::helper('chronorelais');
|
26 |
+
|
27 |
+
try {
|
28 |
+
|
29 |
+
$pointRelaisWs = 'https://www.chronopost.fr/recherchebt-ws-cxf/PointRelaisServiceWS?wsdl';
|
30 |
+
$pointRelaisWsMethod = Mage::getStoreConfig('carriers/'.$shippingMethodCode.'/point_relai_ws_method');
|
31 |
+
$pointRelaisProductCode = $helperData->getChronoProductCode($address->getCountryId(),$shippingMethodCode);
|
32 |
+
$pointRelaisService = 'T';
|
33 |
+
$addAddressToWs = Mage::getStoreConfig('carriers/'.$shippingMethodCode.'/add_address_to_ws');
|
34 |
+
$maxPointChronopost = Mage::getStoreConfig('carriers/'.$shippingMethodCode.'/max_point_chronopost');
|
35 |
+
|
36 |
+
$maxDistanceSearch = Mage::getStoreConfig('carriers/'.$shippingMethodCode.'/max_distance_search');
|
37 |
+
|
38 |
+
$client = new SoapClient($pointRelaisWs, array('trace' => 0, 'connection_timeout' => 10));
|
39 |
+
|
40 |
+
/* si dom => on ne met pas le code ISO mais un code spécifique, sinon le relai dom ne fonctionne pas */
|
41 |
+
$countryDomCode = $this->getCountryDomCode();
|
42 |
+
$countryId = $address->getCountryId();
|
43 |
+
|
44 |
+
if(isset($countryDomCode[$countryId])) {
|
45 |
+
$countryId = $countryDomCode[$countryId];
|
46 |
+
}
|
47 |
+
|
48 |
+
$params = array(
|
49 |
+
'accountNumber' => $helperData->getConfigurationAccountNumber(),
|
50 |
+
'password' => $helperData->getConfigurationAccountPass(),
|
51 |
+
'zipCode' => $this->getFilledValue($address->getPostcode()),
|
52 |
+
'city' => $this->getFilledValue($address->getCity()),
|
53 |
+
'countryCode' => $this->getFilledValue($countryId),
|
54 |
+
'type' => 'P',
|
55 |
+
'productCode' => $pointRelaisProductCode,
|
56 |
+
'service' => $pointRelaisService,
|
57 |
+
'weight' => 2000,
|
58 |
+
'shippingDate' => date('d/m/Y'),
|
59 |
+
'maxPointChronopost' => $maxPointChronopost,
|
60 |
+
'maxDistanceSearch' => $maxDistanceSearch,
|
61 |
+
'holidayTolerant' => 1
|
62 |
+
);
|
63 |
+
if($addAddressToWs) {
|
64 |
+
$params['address'] = $this->getFilledValue($address->getStreet(1));
|
65 |
+
}
|
66 |
+
$webservbt = $client->$pointRelaisWsMethod($params);
|
67 |
+
|
68 |
+
/* format $webservbt pour avoir le meme format que lors de l'appel du WS par code postal */
|
69 |
+
if($webservbt->return->errorCode == 0)
|
70 |
+
{
|
71 |
+
/*
|
72 |
+
* Format entrée
|
73 |
+
*
|
74 |
+
* accesPersonneMobiliteReduite
|
75 |
+
actif
|
76 |
+
adresse1
|
77 |
+
adresse2
|
78 |
+
adresse3
|
79 |
+
codePays
|
80 |
+
codePostal
|
81 |
+
coordGeolocalisationLatitude
|
82 |
+
coordGeolocalisationLongitude
|
83 |
+
distanceEnMetre
|
84 |
+
identifiant
|
85 |
+
indiceDeLocalisation
|
86 |
+
listeHoraireOuverture
|
87 |
+
localite
|
88 |
+
nom
|
89 |
+
poidsMaxi
|
90 |
+
typeDePoint
|
91 |
+
urlGoogleMaps
|
92 |
+
*
|
93 |
+
* Format sortie
|
94 |
+
* adresse1
|
95 |
+
adresse2
|
96 |
+
adresse3
|
97 |
+
codePostal
|
98 |
+
dateArriveColis
|
99 |
+
horairesOuvertureDimanche ("10:00-12:30 14:30-19:00")
|
100 |
+
horairesOuvertureJeudi
|
101 |
+
horairesOuvertureLundi
|
102 |
+
horairesOuvertureMardi
|
103 |
+
horairesOuvertureMercredi
|
104 |
+
horairesOuvertureSamedi
|
105 |
+
horairesOuvertureVendredi
|
106 |
+
identifiantChronopostPointA2PAS
|
107 |
+
localite
|
108 |
+
nomEnseigne
|
109 |
+
*
|
110 |
+
*
|
111 |
+
*
|
112 |
+
* 2013-02-19T10:42:40.196Z
|
113 |
+
*
|
114 |
+
*/
|
115 |
+
$listePr = $webservbt->return->listePointRelais;
|
116 |
+
if(count($webservbt->return->listePointRelais) == 1) {
|
117 |
+
$listePr = array($listePr);
|
118 |
+
}
|
119 |
+
$return = array();
|
120 |
+
foreach($listePr as $pr)
|
121 |
+
{
|
122 |
+
$newPr = (object)array();
|
123 |
+
$newPr->adresse1 = $pr->adresse1;
|
124 |
+
$newPr->adresse2 = $pr->adresse2;
|
125 |
+
$newPr->adresse3 = $pr->adresse3;
|
126 |
+
$newPr->codePostal = $pr->codePostal;
|
127 |
+
$newPr->identifiantChronopostPointA2PAS = $pr->identifiant;
|
128 |
+
$newPr->localite = $pr->localite;
|
129 |
+
$newPr->nomEnseigne = $pr->nom;
|
130 |
+
$time = new DateTime;
|
131 |
+
$newPr->dateArriveColis = $time->format(DateTime::ATOM);
|
132 |
+
$newPr->horairesOuvertureLundi = $newPr->horairesOuvertureMardi = $newPr->horairesOuvertureMercredi = $newPr->horairesOuvertureJeudi = $newPr->horairesOuvertureVendredi = $newPr->horairesOuvertureSamedi = $newPr->horairesOuvertureDimanche = '';
|
133 |
+
foreach($pr->listeHoraireOuverture as $horaire) {
|
134 |
+
switch($horaire->jour) {
|
135 |
+
case '1' :
|
136 |
+
$newPr->horairesOuvertureLundi = $horaire->horairesAsString;
|
137 |
+
break;
|
138 |
+
case '2' :
|
139 |
+
$newPr->horairesOuvertureMardi = $horaire->horairesAsString;
|
140 |
+
break;
|
141 |
+
case '3' :
|
142 |
+
$newPr->horairesOuvertureMercredi = $horaire->horairesAsString;
|
143 |
+
break;
|
144 |
+
case '4' :
|
145 |
+
$newPr->horairesOuvertureJeudi = $horaire->horairesAsString;
|
146 |
+
break;
|
147 |
+
case '5' :
|
148 |
+
$newPr->horairesOuvertureVendredi = $horaire->horairesAsString;
|
149 |
+
break;
|
150 |
+
case '6' :
|
151 |
+
$newPr->horairesOuvertureSamedi = $horaire->horairesAsString;
|
152 |
+
break;
|
153 |
+
case '7' :
|
154 |
+
$newPr->horairesOuvertureDimanche = $horaire->horairesAsString;
|
155 |
+
break;
|
156 |
+
default : break;
|
157 |
+
}
|
158 |
+
}
|
159 |
+
if(empty($newPr->horairesOuvertureLundi)) {
|
160 |
+
$newPr->horairesOuvertureLundi = "00:00-00:00 00:00-00:00";
|
161 |
+
}
|
162 |
+
if(empty($newPr->horairesOuvertureMardi)) {
|
163 |
+
$newPr->horairesOuvertureMardi = "00:00-00:00 00:00-00:00";
|
164 |
+
}
|
165 |
+
if(empty($newPr->horairesOuvertureMercredi)) {
|
166 |
+
$newPr->horairesOuvertureMercredi = "00:00-00:00 00:00-00:00";
|
167 |
+
}
|
168 |
+
if(empty($newPr->horairesOuvertureJeudi)) {
|
169 |
+
$newPr->horairesOuvertureJeudi = "00:00-00:00 00:00-00:00";
|
170 |
+
}
|
171 |
+
if(empty($newPr->horairesOuvertureVendredi)) {
|
172 |
+
$newPr->horairesOuvertureVendredi = "00:00-00:00 00:00-00:00";
|
173 |
+
}
|
174 |
+
if(empty($newPr->horairesOuvertureSamedi)) {
|
175 |
+
$newPr->horairesOuvertureSamedi = "00:00-00:00 00:00-00:00";
|
176 |
+
}
|
177 |
+
if(empty($newPr->horairesOuvertureDimanche)) {
|
178 |
+
$newPr->horairesOuvertureDimanche = "00:00-00:00 00:00-00:00";
|
179 |
+
}
|
180 |
+
|
181 |
+
$return[] = $newPr;
|
182 |
+
}
|
183 |
+
return $return;
|
184 |
+
}
|
185 |
+
} catch (Exception $e) {
|
186 |
+
return $this->getPointsRelaisByPudo($address);
|
187 |
+
}
|
188 |
+
}
|
189 |
+
|
190 |
+
protected function getCountryDomCode() {
|
191 |
+
return array(
|
192 |
+
'RE' => 'REU',
|
193 |
+
'MQ' => 'MTQ',
|
194 |
+
'GP' => 'GLP',
|
195 |
+
'MX' => 'MYT',
|
196 |
+
'GF' => 'GUF'
|
197 |
+
);
|
198 |
+
}
|
199 |
+
|
200 |
+
public function getDetailRelaisPoint($btcode) {
|
201 |
+
try {
|
202 |
+
$helperData = Mage::helper('chronorelais');
|
203 |
+
$params = array(
|
204 |
+
'accountNumber' => $helperData->getConfigurationAccountNumber(),
|
205 |
+
'password' => $helperData->getConfigurationAccountPass(),
|
206 |
+
'identifiant' => $btcode
|
207 |
+
);
|
208 |
+
|
209 |
+
$client = new SoapClient("https://www.chronopost.fr/recherchebt-ws-cxf/PointRelaisServiceWS");
|
210 |
+
$webservbt = $client->__call("rechercheDetailPointChronopost",$params);
|
211 |
+
|
212 |
+
return $webservbt[0];
|
213 |
+
} catch (Exception $e) {
|
214 |
+
return $this->getDetailRelaisPointByPudo($btcode);
|
215 |
+
}
|
216 |
+
}
|
217 |
+
|
218 |
+
|
219 |
+
/*
|
220 |
+
*
|
221 |
+
* WS de secours
|
222 |
+
*/
|
223 |
+
|
224 |
+
public function getDetailRelaisPointByPudo($btcode) {
|
225 |
+
$params = array(
|
226 |
+
'carrier' => 'CHR',
|
227 |
+
'key' => '75f6fe195dc88ceecbc0f8a2f70a8f3a',
|
228 |
+
'pudo_id' => $btcode,
|
229 |
+
);
|
230 |
+
|
231 |
+
try {
|
232 |
+
$client = new SoapClient("http://mypudo.pickup-services.com/mypudo/mypudo.asmx?wsdl", array('trace' => 0, 'connection_timeout' => 10));
|
233 |
+
$webservbt = $client->GetPudoDetails($params);
|
234 |
+
$webservbt = json_decode(json_encode((object) simplexml_load_string($webservbt->GetPudoDetailsResult->any)), 1);
|
235 |
+
if(!isset($webservbt['ERROR'])) {
|
236 |
+
$pr = $webservbt['PUDO_ITEMS']['PUDO_ITEM'];
|
237 |
+
if($pr && $pr['@attributes']['active'] == 'true') {
|
238 |
+
$newPr = (object)array();
|
239 |
+
$newPr->adresse1 = $pr['ADDRESS1'];
|
240 |
+
$newPr->adresse2 = is_array($pr['ADDRESS2']) ? implode(' ', $pr['ADDRESS2']) : $pr['ADDRESS2'];
|
241 |
+
$newPr->adresse3 = is_array($pr['ADDRESS3']) ? implode(' ', $pr['ADDRESS3']) : $pr['ADDRESS3'];
|
242 |
+
$newPr->codePostal = $pr['ZIPCODE'];
|
243 |
+
$newPr->identifiantChronopostPointA2PAS = $pr['PUDO_ID'];
|
244 |
+
$newPr->localite = $pr['CITY'];
|
245 |
+
$newPr->nomEnseigne = $pr['NAME'];
|
246 |
+
$time = new DateTime;
|
247 |
+
$newPr->dateArriveColis = $time->format(DateTime::ATOM);
|
248 |
+
$newPr->horairesOuvertureLundi = $newPr->horairesOuvertureMardi = $newPr->horairesOuvertureMercredi = $newPr->horairesOuvertureJeudi = $newPr->horairesOuvertureVendredi = $newPr->horairesOuvertureSamedi = $newPr->horairesOuvertureDimanche = '';
|
249 |
+
|
250 |
+
if(isset($pr['OPENING_HOURS_ITEMS']['OPENING_HOURS_ITEM'])) {
|
251 |
+
$listeHoraires = $pr['OPENING_HOURS_ITEMS']['OPENING_HOURS_ITEM'];
|
252 |
+
foreach($listeHoraires as $horaire) {
|
253 |
+
switch($horaire['DAY_ID']) {
|
254 |
+
case '1' :
|
255 |
+
if(!empty($newPr->horairesOuvertureLundi)) {
|
256 |
+
$newPr->horairesOuvertureLundi .= ' ';
|
257 |
+
}
|
258 |
+
$newPr->horairesOuvertureLundi .= $horaire['START_TM'].'-'.$horaire['END_TM'];
|
259 |
+
break;
|
260 |
+
case '2' :
|
261 |
+
if(!empty($newPr->horairesOuvertureMardi)) {
|
262 |
+
$newPr->horairesOuvertureMardi .= ' ';
|
263 |
+
}
|
264 |
+
$newPr->horairesOuvertureMardi .= $horaire['START_TM'].'-'.$horaire['END_TM'];
|
265 |
+
break;
|
266 |
+
case '3' :
|
267 |
+
if(!empty($newPr->horairesOuvertureMercredi)) {
|
268 |
+
$newPr->horairesOuvertureMercredi .= ' ';
|
269 |
+
}
|
270 |
+
$newPr->horairesOuvertureMercredi .= $horaire['START_TM'].'-'.$horaire['END_TM'];
|
271 |
+
break;
|
272 |
+
case '4' :
|
273 |
+
if(!empty($newPr->horairesOuvertureJeudi)) {
|
274 |
+
$newPr->horairesOuvertureJeudi .= ' ';
|
275 |
+
}
|
276 |
+
$newPr->horairesOuvertureJeudi .= $horaire['START_TM'].'-'.$horaire['END_TM'];
|
277 |
+
break;
|
278 |
+
case '5' :
|
279 |
+
if(!empty($newPr->horairesOuvertureVendredi)) {
|
280 |
+
$newPr->horairesOuvertureVendredi .= ' ';
|
281 |
+
}
|
282 |
+
$newPr->horairesOuvertureVendredi .= $horaire['START_TM'].'-'.$horaire['END_TM'];
|
283 |
+
break;
|
284 |
+
case '6' :
|
285 |
+
if(!empty($newPr->horairesOuvertureSamedi)) {
|
286 |
+
$newPr->horairesOuvertureSamedi .= ' ';
|
287 |
+
}
|
288 |
+
$newPr->horairesOuvertureSamedi .= $horaire['START_TM'].'-'.$horaire['END_TM'];
|
289 |
+
break;
|
290 |
+
case '7' :
|
291 |
+
if(!empty($newPr->horairesOuvertureDimanche)) {
|
292 |
+
$newPr->horairesOuvertureDimanche .= ' ';
|
293 |
+
}
|
294 |
+
$newPr->horairesOuvertureDimanche .= $horaire['START_TM'].'-'.$horaire['END_TM'];
|
295 |
+
break;
|
296 |
+
default :
|
297 |
+
break;
|
298 |
+
}
|
299 |
+
}
|
300 |
+
}
|
301 |
+
if(empty($newPr->horairesOuvertureLundi)) {
|
302 |
+
$newPr->horairesOuvertureLundi = "00:00-00:00 00:00-00:00";
|
303 |
+
}
|
304 |
+
if(empty($newPr->horairesOuvertureMardi)) {
|
305 |
+
$newPr->horairesOuvertureMardi = "00:00-00:00 00:00-00:00";
|
306 |
+
}
|
307 |
+
if(empty($newPr->horairesOuvertureMercredi)) {
|
308 |
+
$newPr->horairesOuvertureMercredi = "00:00-00:00 00:00-00:00";
|
309 |
+
}
|
310 |
+
if(empty($newPr->horairesOuvertureJeudi)) {
|
311 |
+
$newPr->horairesOuvertureJeudi = "00:00-00:00 00:00-00:00";
|
312 |
+
}
|
313 |
+
if(empty($newPr->horairesOuvertureVendredi)) {
|
314 |
+
$newPr->horairesOuvertureVendredi = "00:00-00:00 00:00-00:00";
|
315 |
+
}
|
316 |
+
if(empty($newPr->horairesOuvertureSamedi)) {
|
317 |
+
$newPr->horairesOuvertureSamedi = "00:00-00:00 00:00-00:00";
|
318 |
+
}
|
319 |
+
if(empty($newPr->horairesOuvertureDimanche)) {
|
320 |
+
$newPr->horairesOuvertureDimanche = "00:00-00:00 00:00-00:00";
|
321 |
+
}
|
322 |
+
|
323 |
+
return $newPr;
|
324 |
+
}
|
325 |
+
}
|
326 |
+
}
|
327 |
+
catch (Exception $e) {
|
328 |
+
return false;
|
329 |
+
}
|
330 |
+
return false;
|
331 |
+
}
|
332 |
+
|
333 |
+
public function getPointsRelaisByPudo($address = '', $cp = '') {
|
334 |
+
|
335 |
+
$params = array(
|
336 |
+
'carrier' => 'CHR',
|
337 |
+
'key' => '75f6fe195dc88ceecbc0f8a2f70a8f3a',
|
338 |
+
'address' => $address ? $this->getFilledValue($address->getStreet(1)) : '',
|
339 |
+
'zipCode' => $address ? $this->getFilledValue($address->getPostcode()) : $cp,
|
340 |
+
'city' => $address ? $this->getFilledValue($address->getCity()) : 'Lille',
|
341 |
+
'countrycode' => $address ? $this->getFilledValue($address->getCountryId()) : '',
|
342 |
+
'requestID' => '1',
|
343 |
+
'date_from' => date('d/m/Y'),
|
344 |
+
'max_pudo_number' => 5,
|
345 |
+
'max_distance_search' => 10,
|
346 |
+
'weight' => 1,
|
347 |
+
'category' => '',
|
348 |
+
'holiday_tolerant' => 1,
|
349 |
+
);
|
350 |
+
try {
|
351 |
+
$client = new SoapClient("http://mypudo.pickup-services.com/mypudo/mypudo.asmx?wsdl", array('trace' => 0, 'connection_timeout' => 10));
|
352 |
+
$webservbt = $client->GetPudoList($params);
|
353 |
+
$webservbt = json_decode(json_encode((object) simplexml_load_string($webservbt->GetPudoListResult->any)), 1);
|
354 |
+
if(!isset($webservbt['ERROR'])) {
|
355 |
+
$return = array();
|
356 |
+
|
357 |
+
$listePr = $webservbt['PUDO_ITEMS']['PUDO_ITEM'];
|
358 |
+
if($listePr) {
|
359 |
+
foreach($listePr as $pr)
|
360 |
+
{
|
361 |
+
if($pr['@attributes']['active'] == 'true')
|
362 |
+
{
|
363 |
+
$newPr = (object)array();
|
364 |
+
$newPr->adresse1 = $pr['ADDRESS1'];
|
365 |
+
$newPr->adresse2 = is_array($pr['ADDRESS2']) ? implode(' ', $pr['ADDRESS2']) : $pr['ADDRESS2'];
|
366 |
+
$newPr->adresse3 = is_array($pr['ADDRESS3']) ? implode(' ', $pr['ADDRESS3']) : $pr['ADDRESS3'];
|
367 |
+
$newPr->codePostal = $pr['ZIPCODE'];
|
368 |
+
$newPr->identifiantChronopostPointA2PAS = $pr['PUDO_ID'];
|
369 |
+
$newPr->localite = $pr['CITY'];
|
370 |
+
$newPr->nomEnseigne = $pr['NAME'];
|
371 |
+
$time = new DateTime;
|
372 |
+
$newPr->dateArriveColis = $time->format(DateTime::ATOM);
|
373 |
+
$newPr->horairesOuvertureLundi = $newPr->horairesOuvertureMardi = $newPr->horairesOuvertureMercredi = $newPr->horairesOuvertureJeudi = $newPr->horairesOuvertureVendredi = $newPr->horairesOuvertureSamedi = $newPr->horairesOuvertureDimanche = '';
|
374 |
+
|
375 |
+
if(isset($pr['OPENING_HOURS_ITEMS']['OPENING_HOURS_ITEM'])) {
|
376 |
+
$listeHoraires = $pr['OPENING_HOURS_ITEMS']['OPENING_HOURS_ITEM'];
|
377 |
+
foreach($listeHoraires as $horaire) {
|
378 |
+
switch($horaire['DAY_ID']) {
|
379 |
+
case '1' :
|
380 |
+
if(!empty($newPr->horairesOuvertureLundi)) {
|
381 |
+
$newPr->horairesOuvertureLundi .= ' ';
|
382 |
+
}
|
383 |
+
$newPr->horairesOuvertureLundi .= $horaire['START_TM'].'-'.$horaire['END_TM'];
|
384 |
+
break;
|
385 |
+
case '2' :
|
386 |
+
if(!empty($newPr->horairesOuvertureMardi)) {
|
387 |
+
$newPr->horairesOuvertureMardi .= ' ';
|
388 |
+
}
|
389 |
+
$newPr->horairesOuvertureMardi .= $horaire['START_TM'].'-'.$horaire['END_TM'];
|
390 |
+
break;
|
391 |
+
case '3' :
|
392 |
+
if(!empty($newPr->horairesOuvertureMercredi)) {
|
393 |
+
$newPr->horairesOuvertureMercredi .= ' ';
|
394 |
+
}
|
395 |
+
$newPr->horairesOuvertureMercredi .= $horaire['START_TM'].'-'.$horaire['END_TM'];
|
396 |
+
break;
|
397 |
+
case '4' :
|
398 |
+
if(!empty($newPr->horairesOuvertureJeudi)) {
|
399 |
+
$newPr->horairesOuvertureJeudi .= ' ';
|
400 |
+
}
|
401 |
+
$newPr->horairesOuvertureJeudi .= $horaire['START_TM'].'-'.$horaire['END_TM'];
|
402 |
+
break;
|
403 |
+
case '5' :
|
404 |
+
if(!empty($newPr->horairesOuvertureVendredi)) {
|
405 |
+
$newPr->horairesOuvertureVendredi .= ' ';
|
406 |
+
}
|
407 |
+
$newPr->horairesOuvertureVendredi .= $horaire['START_TM'].'-'.$horaire['END_TM'];
|
408 |
+
break;
|
409 |
+
case '6' :
|
410 |
+
if(!empty($newPr->horairesOuvertureSamedi)) {
|
411 |
+
$newPr->horairesOuvertureSamedi .= ' ';
|
412 |
+
}
|
413 |
+
$newPr->horairesOuvertureSamedi .= $horaire['START_TM'].'-'.$horaire['END_TM'];
|
414 |
+
break;
|
415 |
+
case '7' :
|
416 |
+
if(!empty($newPr->horairesOuvertureDimanche)) {
|
417 |
+
$newPr->horairesOuvertureDimanche .= ' ';
|
418 |
+
}
|
419 |
+
$newPr->horairesOuvertureDimanche .= $horaire['START_TM'].'-'.$horaire['END_TM'];
|
420 |
+
break;
|
421 |
+
}
|
422 |
+
}
|
423 |
+
}
|
424 |
+
if(empty($newPr->horairesOuvertureLundi)) {
|
425 |
+
$newPr->horairesOuvertureLundi = "00:00-00:00 00:00-00:00";
|
426 |
+
}
|
427 |
+
if(empty($newPr->horairesOuvertureMardi)) {
|
428 |
+
$newPr->horairesOuvertureMardi = "00:00-00:00 00:00-00:00";
|
429 |
+
}
|
430 |
+
if(empty($newPr->horairesOuvertureMercredi)) {
|
431 |
+
$newPr->horairesOuvertureMercredi = "00:00-00:00 00:00-00:00";
|
432 |
+
}
|
433 |
+
if(empty($newPr->horairesOuvertureJeudi)) {
|
434 |
+
$newPr->horairesOuvertureJeudi = "00:00-00:00 00:00-00:00";
|
435 |
+
}
|
436 |
+
if(empty($newPr->horairesOuvertureVendredi)) {
|
437 |
+
$newPr->horairesOuvertureVendredi = "00:00-00:00 00:00-00:00";
|
438 |
+
}
|
439 |
+
if(empty($newPr->horairesOuvertureSamedi)) {
|
440 |
+
$newPr->horairesOuvertureSamedi = "00:00-00:00 00:00-00:00";
|
441 |
+
}
|
442 |
+
if(empty($newPr->horairesOuvertureDimanche)) {
|
443 |
+
$newPr->horairesOuvertureDimanche = "00:00-00:00 00:00-00:00";
|
444 |
+
}
|
445 |
+
|
446 |
+
$return[] = $newPr;
|
447 |
+
}
|
448 |
+
}
|
449 |
+
return $return;
|
450 |
+
}
|
451 |
+
}
|
452 |
+
}
|
453 |
+
catch (Exception $e) {
|
454 |
+
return false;
|
455 |
+
}
|
456 |
+
return false;
|
457 |
+
}
|
458 |
+
|
459 |
+
|
460 |
+
public function getQuickcost($quickCost,$quickcost_url = '') {
|
461 |
+
if (!$quickcost_url) {
|
462 |
+
$quickcost_url = "https://www.chronopost.fr/quickcost-cxf/QuickcostServiceWS?wsdl";
|
463 |
+
}
|
464 |
+
try {
|
465 |
+
$client = new SoapClient($quickcost_url);
|
466 |
+
$webservbt = $client->quickCost($quickCost);
|
467 |
+
|
468 |
+
return $webservbt->return;
|
469 |
+
} catch (Exception $e) {
|
470 |
+
return false;
|
471 |
+
}
|
472 |
+
}
|
473 |
+
|
474 |
+
public function checkLogin($quickCost,$quickcost_url = '') {
|
475 |
+
if (!$quickcost_url) {
|
476 |
+
$quickcost_url = "https://www.chronopost.fr/quickcost-cxf/QuickcostServiceWS?wsdl";
|
477 |
+
}
|
478 |
+
try {
|
479 |
+
$client = new SoapClient($quickcost_url);
|
480 |
+
$webservbt = $client->calculateProducts($quickCost);
|
481 |
+
return $webservbt;
|
482 |
+
} catch (Exception $e) {
|
483 |
+
return false;
|
484 |
+
}
|
485 |
+
}
|
486 |
+
|
487 |
+
/*
|
488 |
+
* Return true si la méthode de livraison fait partie du contrat
|
489 |
+
*/
|
490 |
+
public function getMethodIsAllowed($code,$quote = '') {
|
491 |
+
$quote = Mage::getSingleton('checkout/cart')->getQuote();
|
492 |
+
$address = $quote->getShippingAddress();
|
493 |
+
$helperData = Mage::helper('chronorelais');
|
494 |
+
$code = $helperData->getChronoProductCode('',$code);
|
495 |
+
try {
|
496 |
+
if($this->methodsAllowed === false) {
|
497 |
+
$this->methodsAllowed = array();
|
498 |
+
$client = new SoapClient("https://www.chronopost.fr/quickcost-cxf/QuickcostServiceWS?wsdl", array('trace' => 0, 'connection_timeout' => 10));
|
499 |
+
$params = array(
|
500 |
+
'accountNumber' => $helperData->getConfigurationAccountNumber(),
|
501 |
+
'password' => $helperData->getConfigurationAccountPass(),
|
502 |
+
'depCountryCode' => $helperData->getConfigurationShipperInfo('country'),
|
503 |
+
'depZipCode' => $helperData->getConfigurationShipperInfo('zipcode'),
|
504 |
+
'arrCountryCode' => $this->getFilledValue($address->getCountryId()),
|
505 |
+
'arrZipCode' => $this->getFilledValue($address->getPostcode()),
|
506 |
+
'arrCity' => $address->getCity() ? $this->getFilledValue($address->getCity()) : '-',
|
507 |
+
'type' => 'M',
|
508 |
+
'weight' => 1
|
509 |
+
);
|
510 |
+
$webservbt = $client->calculateProducts($params);
|
511 |
+
if($webservbt->return->errorCode == 0 && $webservbt->return->productList)
|
512 |
+
{
|
513 |
+
if(is_array($webservbt->return->productList)) {
|
514 |
+
foreach($webservbt->return->productList as $product) {
|
515 |
+
$this->methodsAllowed[] = $product->productCode;
|
516 |
+
}
|
517 |
+
} else { /* cas ou il y a un seul résultat */
|
518 |
+
$product = $webservbt->return->productList;
|
519 |
+
$this->methodsAllowed[] = $product->productCode;
|
520 |
+
}
|
521 |
+
}
|
522 |
+
}
|
523 |
+
if(!empty($this->methodsAllowed) && in_array($code, $this->methodsAllowed)) {
|
524 |
+
return true;
|
525 |
+
}
|
526 |
+
return false;
|
527 |
+
}catch(Exception $e) {
|
528 |
+
return false;
|
529 |
+
}
|
530 |
+
}
|
531 |
+
|
532 |
+
|
533 |
+
public function getFilledValue($value) {
|
534 |
+
if ($value) {
|
535 |
+
return $this->removeaccents(trim($value));
|
536 |
+
} else {
|
537 |
+
return '';
|
538 |
+
}
|
539 |
+
}
|
540 |
+
|
541 |
+
public function removeaccents($string) {
|
542 |
+
$stringToReturn = str_replace(
|
543 |
+
array('à', 'á', 'â', 'ã', 'ä', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', '/', '\xa8'), array('a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y', 'A', 'A', 'A', 'A', 'A', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'N', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', ' ', 'e'), $string);
|
544 |
+
// Remove all remaining other unknown characters
|
545 |
+
$stringToReturn = preg_replace('/[^a-zA-Z0-9\-]/', ' ', $stringToReturn);
|
546 |
+
$stringToReturn = preg_replace('/^[\-]+/', '', $stringToReturn);
|
547 |
+
$stringToReturn = preg_replace('/[\-]+$/', '', $stringToReturn);
|
548 |
+
$stringToReturn = preg_replace('/[\-]{2,}/', ' ', $stringToReturn);
|
549 |
+
return $stringToReturn;
|
550 |
+
}
|
551 |
+
|
552 |
+
public function cancelSkybill($skybillNumber = '') {
|
553 |
+
if($skybillNumber) {
|
554 |
+
try {
|
555 |
+
|
556 |
+
$client = new SoapClient("https://www.chronopost.fr/tracking-cxf/TrackingServiceWS?wsdl",array('trace'=> 0,'connection_timeout'=>10));
|
557 |
+
|
558 |
+
$helperData = Mage::helper('chronorelais');
|
559 |
+
$params = array(
|
560 |
+
'accountNumber' => $helperData->getConfigurationAccountNumber(),
|
561 |
+
'password' => $helperData->getConfigurationAccountPass(),
|
562 |
+
'skybillNumber' => $skybillNumber,
|
563 |
+
'language' => Mage::app()->getLocale()->getLocaleCode()
|
564 |
+
);
|
565 |
+
|
566 |
+
return $client->cancelSkybill($params);
|
567 |
+
} catch (Exception $e) {
|
568 |
+
return false;
|
569 |
+
}
|
570 |
+
}
|
571 |
+
return false;
|
572 |
+
}
|
573 |
+
|
574 |
+
/* Livraison sur rendez-vous */
|
575 |
+
public function getSearchDeliverySlot($_srdvConfig = '') {
|
576 |
+
$quote = Mage::getSingleton('checkout/cart')->getQuote();
|
577 |
+
|
578 |
+
$_shippingAddress = $quote->getShippingAddress();
|
579 |
+
$recipient_address = $_shippingAddress->getStreet();
|
580 |
+
if (!isset($recipient_address[1])) {
|
581 |
+
$recipient_address[1] = '';
|
582 |
+
}
|
583 |
+
|
584 |
+
$_helper = Mage::helper('chronorelais');
|
585 |
+
try {
|
586 |
+
|
587 |
+
$soapHeaders = array();
|
588 |
+
$namespace = 'http://cxf.soap.ws.creneau.chronopost.fr/';
|
589 |
+
$soapHeaders[] = new SoapHeader($namespace, 'password', $_helper->getConfigurationAccountPass());
|
590 |
+
$soapHeaders[] = new SoapHeader($namespace, 'accountNumber', $_helper->getConfigurationAccountNumber());
|
591 |
+
|
592 |
+
$client = new SoapClient("https://www.chronopost.fr/rdv-cxf/services/CreneauServiceWS?wsdl", array('trace' => 1, 'connection_timeout' => 10));
|
593 |
+
$client->__setSoapHeaders($soapHeaders);
|
594 |
+
|
595 |
+
$_srdvConfig = json_decode($_srdvConfig,true);
|
596 |
+
|
597 |
+
/* definition date de debut */
|
598 |
+
$dateBegin = date('Y-m-d H:i:s');
|
599 |
+
if(isset($_srdvConfig['dateRemiseColis_nbJour']) && $_srdvConfig['dateRemiseColis_nbJour'] > 0) {
|
600 |
+
$dateBegin = date('Y-m-d', strtotime('+'.(int)$_srdvConfig['dateRemiseColis_nbJour'].' day'));
|
601 |
+
} elseif(isset($_srdvConfig['dateRemiseColis_jour']) && isset($_srdvConfig['dateRemiseColis_heures'])) {
|
602 |
+
$jour_text = date('l', strtotime("Sunday +".$_srdvConfig['dateRemiseColis_jour']." days"));
|
603 |
+
$dateBegin = date('Y-m-d', strtotime('next '.$jour_text)).' '.$_srdvConfig['dateRemiseColis_heures'].':'.$_srdvConfig['dateRemiseColis_minutes'].':00';
|
604 |
+
}
|
605 |
+
$dateBegin = date('Y-m-d',strtotime($dateBegin)).'T'.date('H:i:s',strtotime($dateBegin));
|
606 |
+
|
607 |
+
$params = array(
|
608 |
+
|
609 |
+
'callerTool' => 'RDVWS',
|
610 |
+
'productType' => 'RDV',
|
611 |
+
|
612 |
+
'shipperAdress1' => $_helper->getConfigurationShipperInfo('address1'),
|
613 |
+
'shipperAdress2' => $_helper->getConfigurationShipperInfo('address2'),
|
614 |
+
'shipperZipCode' => $_helper->getConfigurationShipperInfo('zipcode'),
|
615 |
+
'shipperCity' => $_helper->getConfigurationShipperInfo('city'),
|
616 |
+
'shipperCountry' => $_helper->getConfigurationShipperInfo('country'),
|
617 |
+
|
618 |
+
'recipientAdress1' => substr($this->getFilledValue($recipient_address[0]), 0, 38),
|
619 |
+
'recipientAdress2' => substr($this->getFilledValue($recipient_address[1]), 0, 38),
|
620 |
+
'recipientZipCode' => $this->getFilledValue($_shippingAddress->getPostcode()),
|
621 |
+
'recipientCity' => $this->getFilledValue($_shippingAddress->getCity()),
|
622 |
+
'recipientCountry' => $this->getFilledValue($_shippingAddress->getCountryId()),
|
623 |
+
|
624 |
+
'weight' => 1,
|
625 |
+
'dateBegin' => $dateBegin,
|
626 |
+
'shipperDeliverySlotClosed' => '',
|
627 |
+
'currency' => 'EUR',
|
628 |
+
'isDeliveryDate' => 0,
|
629 |
+
'slotType' => 'J'
|
630 |
+
);
|
631 |
+
|
632 |
+
|
633 |
+
for($i = 1; $i <= 4; $i++) {
|
634 |
+
|
635 |
+
/* tarif des niveaux tarifaires */
|
636 |
+
if(isset($_srdvConfig['N'.$i.'_price'])) {
|
637 |
+
$params['rateN'.$i] = $_srdvConfig['N'.$i.'_price'];
|
638 |
+
}
|
639 |
+
|
640 |
+
/* niveaux tarifaires fermés */
|
641 |
+
if(isset($_srdvConfig['N'.$i.'_status']) && $_srdvConfig['N'.$i.'_status'] == 0) {
|
642 |
+
if(!isset($params['rateLevelsNotShow'])) {
|
643 |
+
$params['rateLevelsNotShow'] = array();
|
644 |
+
}
|
645 |
+
$params['rateLevelsNotShow'][]= 'N'.$i;
|
646 |
+
}
|
647 |
+
}
|
648 |
+
|
649 |
+
/* creneaux à fermer */
|
650 |
+
if(isset($_srdvConfig['creneaux'])) {
|
651 |
+
foreach($_srdvConfig['creneaux'] as $_creneau) {
|
652 |
+
|
653 |
+
$jour_debut_text = date('l', Mage::getModel('core/date')->timestamp(strtotime("Sunday +".$_creneau['creneaux_debut_jour']." days")));
|
654 |
+
$jour_fin_text = date('l', Mage::getModel('core/date')->timestamp(strtotime("Sunday +".$_creneau['creneaux_fin_jour']." days")));
|
655 |
+
|
656 |
+
$dateDebut = '';
|
657 |
+
$dateFin = '';
|
658 |
+
|
659 |
+
/* creation de creneaux aux bons formats, pour 6 semaines consécutives */
|
660 |
+
for($indiceWeek = 0; $indiceWeek < 6; $indiceWeek++) {
|
661 |
+
|
662 |
+
if(empty($dateDebut)) {
|
663 |
+
$dateDebut = date('Y-m-d', Mage::getModel('core/date')->timestamp(strtotime('next '.$jour_debut_text))).' '.(int)$_creneau['creneaux_debut_heures'].':'.(int)$_creneau['creneaux_debut_minutes'].':00';
|
664 |
+
$dateFin = date('Y-m-d', Mage::getModel('core/date')->timestamp(strtotime('next '.$jour_fin_text))).' '.(int)$_creneau['creneaux_fin_heures'].':'.(int)$_creneau['creneaux_fin_minutes'].':00';
|
665 |
+
if(date('N') >= $_creneau['creneaux_debut_jour']) {
|
666 |
+
$dateDebut = date('Y-m-d', Mage::getModel('core/date')->timestamp(strtotime(date('Y-m-d',strtotime($dateDebut)).' -7 day'))).' '.(int)$_creneau['creneaux_debut_heures'].':'.(int)$_creneau['creneaux_debut_minutes'].':00';
|
667 |
+
}
|
668 |
+
if(date('N') >= $_creneau['creneaux_fin_jour']) {
|
669 |
+
$dateFin = date('Y-m-d', Mage::getModel('core/date')->timestamp(strtotime(date('Y-m-d',strtotime($dateFin)).' -7 day'))).' '.(int)$_creneau['creneaux_fin_heures'].':'.(int)$_creneau['creneaux_fin_minutes'].':00';
|
670 |
+
}
|
671 |
+
|
672 |
+
} else {
|
673 |
+
$dateDebut = date('Y-m-d', Mage::getModel('core/date')->timestamp(strtotime($jour_debut_text.' next week '.date('Y-m-d',Mage::getModel('core/date')->timestamp(strtotime($dateDebut)))))).' '.(int)$_creneau['creneaux_debut_heures'].':'.(int)$_creneau['creneaux_debut_minutes'].':00';
|
674 |
+
$dateFin = date('Y-m-d', Mage::getModel('core/date')->timestamp(strtotime($jour_fin_text.' next week '.date('Y-m-d',Mage::getModel('core/date')->timestamp(strtotime($dateFin)))))).' '.(int)$_creneau['creneaux_fin_heures'].':'.(int)$_creneau['creneaux_fin_minutes'].':00';
|
675 |
+
}
|
676 |
+
|
677 |
+
$dateDebutStr = date('Y-m-d',Mage::getModel('core/date')->timestamp(strtotime($dateDebut))).'T'.date('H:i:s',Mage::getModel('core/date')->timestamp(strtotime($dateDebut)));
|
678 |
+
$dateFinStr = date('Y-m-d',Mage::getModel('core/date')->timestamp(strtotime($dateFin))).'T'.date('H:i:s',Mage::getModel('core/date')->timestamp(strtotime($dateFin)));
|
679 |
+
|
680 |
+
if(!isset($params['shipperDeliverySlotClosed'])) {
|
681 |
+
$params['shipperDeliverySlotClosed'] = array();
|
682 |
+
}
|
683 |
+
$params['shipperDeliverySlotClosed'][] = $dateDebutStr."/".$dateFinStr;
|
684 |
+
}
|
685 |
+
}
|
686 |
+
}
|
687 |
+
|
688 |
+
$webservbt = $client->searchDeliverySlot($params);
|
689 |
+
if($webservbt->return->code == 0) {
|
690 |
+
return $webservbt;
|
691 |
+
}
|
692 |
+
return false;
|
693 |
+
}catch(Exception $e) {
|
694 |
+
return false;
|
695 |
+
}
|
696 |
+
}
|
697 |
+
|
698 |
+
public function confirmDeliverySlot($rdvInfo = '') {
|
699 |
+
$_helper = Mage::helper('chronorelais');
|
700 |
+
try {
|
701 |
+
|
702 |
+
$soapHeaders = array();
|
703 |
+
$namespace = 'http://cxf.soap.ws.creneau.chronopost.fr/';
|
704 |
+
$soapHeaders[] = new SoapHeader($namespace, 'password', $_helper->getConfigurationAccountPass());
|
705 |
+
$soapHeaders[] = new SoapHeader($namespace, 'accountNumber', $_helper->getConfigurationAccountNumber());
|
706 |
+
|
707 |
+
$client = new SoapClient("https://www.chronopost.fr/rdv-cxf/services/CreneauServiceWS?wsdl", array('trace' => 1, 'connection_timeout' => 10));
|
708 |
+
$client->__setSoapHeaders($soapHeaders);
|
709 |
+
|
710 |
+
$params = array(
|
711 |
+
'callerTool' => 'RDVWS',
|
712 |
+
'productType' => 'RDV',
|
713 |
+
|
714 |
+
'codeSlot' => $rdvInfo['deliverySlotCode'],
|
715 |
+
'meshCode' => $rdvInfo['meshCode'],
|
716 |
+
'transactionID' => $rdvInfo['transactionID'],
|
717 |
+
'rank' => $rdvInfo['rank'],
|
718 |
+
'position' => $rdvInfo['rank'],
|
719 |
+
'dateSelected' => $rdvInfo['deliveryDate']
|
720 |
+
);
|
721 |
+
|
722 |
+
return $client->confirmDeliverySlot($params);
|
723 |
+
}catch(Exception $e) {
|
724 |
+
return false;
|
725 |
+
}
|
726 |
+
}
|
727 |
+
}
|
app/code/community/Chronopost/Chronorelais/Model/Carrier/AbstractChronorelaisShipping.php
CHANGED
@@ -1,523 +1,518 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Magento Chronopost Chronorelais Module
|
5 |
-
*
|
6 |
-
* NOTICE OF LICENSE
|
7 |
-
*
|
8 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
-
* that is bundled with this package in the file LICENSE.txt.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://opensource.org/licenses/osl-3.0.php
|
12 |
-
* If you did not receive a copy of the license and are unable to
|
13 |
-
* obtain it through the world-wide-web, please send an email
|
14 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
-
*
|
16 |
-
* @category Chronopost
|
17 |
-
* @package Chronopost_Chronorelais
|
18 |
-
* @copyright Copyright (c) 2008-10 Owebia (http://www.owebia.com/)
|
19 |
-
* @author Antoine Lemoine
|
20 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
-
*/
|
22 |
-
|
23 |
-
// Pour
|
24 |
-
if (file_exists(dirname(__FILE__).'/Chronopost_Chronorelais_includes_ChronorelaisShippingHelper.php'))
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
private $
|
33 |
-
private $
|
34 |
-
private $
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
$this->
|
40 |
-
$this->
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
$value
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
protected $
|
116 |
-
protected $
|
117 |
-
protected $
|
118 |
-
protected $
|
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 |
-
|
145 |
-
'
|
146 |
-
'
|
147 |
-
'cart.
|
148 |
-
'
|
149 |
-
'
|
150 |
-
'
|
151 |
-
'
|
152 |
-
'
|
153 |
-
'
|
154 |
-
'
|
155 |
-
'
|
156 |
-
'
|
157 |
-
'
|
158 |
-
'
|
159 |
-
'
|
160 |
-
'
|
161 |
-
'
|
162 |
-
'
|
163 |
-
'store.
|
164 |
-
'
|
165 |
-
'
|
166 |
-
'
|
167 |
-
'
|
168 |
-
'date.
|
169 |
-
'date.
|
170 |
-
'date.
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
->
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
$
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
'
|
264 |
-
'
|
265 |
-
'
|
266 |
-
'
|
267 |
-
'
|
268 |
-
'
|
269 |
-
'
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
$
|
314 |
-
$
|
315 |
-
|
316 |
-
|
317 |
-
$
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
$
|
324 |
-
$
|
325 |
-
$
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
$
|
364 |
-
$
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
$
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
$
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
$process
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
}
|
461 |
-
|
462 |
-
protected function
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
if ($this->
|
475 |
-
$
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
$
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
}
|
519 |
-
return $tax_amount;
|
520 |
-
}
|
521 |
-
}
|
522 |
-
|
523 |
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magento Chronopost Chronorelais Module
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Chronopost
|
17 |
+
* @package Chronopost_Chronorelais
|
18 |
+
* @copyright Copyright (c) 2008-10 Owebia (http://www.owebia.com/)
|
19 |
+
* @author Antoine Lemoine
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
|
23 |
+
// Pour gérer les cas où il y a eu compilation
|
24 |
+
if (file_exists(dirname(__FILE__).'/Chronopost_Chronorelais_includes_ChronorelaisShippingHelper.php')) {
|
25 |
+
include_once 'Chronopost_Chronorelais_includes_ChronorelaisShippingHelper.php';
|
26 |
+
}
|
27 |
+
else {
|
28 |
+
include_once Mage::getBaseDir('code').'/community/Chronopost/Chronorelais/includes/ChronorelaisShippingHelper.php';
|
29 |
+
}
|
30 |
+
|
31 |
+
class OCS_Magento_Product implements OCS_Product {
|
32 |
+
private $parent_cart_item;
|
33 |
+
private $cart_item;
|
34 |
+
private $cart_product;
|
35 |
+
private $loaded_product;
|
36 |
+
private $quantity;
|
37 |
+
|
38 |
+
public function OCS_Magento_Product($cart_item, $parent_cart_item) {
|
39 |
+
$this->cart_item = $cart_item;
|
40 |
+
$this->cart_product = $cart_item->getProduct();
|
41 |
+
$this->parent_cart_item = $parent_cart_item;
|
42 |
+
$this->quantity = isset($parent_cart_item) ? $parent_cart_item->getQty() : $cart_item->getQty();
|
43 |
+
}
|
44 |
+
|
45 |
+
public function getOption($option_name, $get_by_id=false) {
|
46 |
+
$value = null;
|
47 |
+
$product = $this->cart_product;
|
48 |
+
foreach ($product->getOptions() as $option) {
|
49 |
+
if ($option->getTitle()==$option_name) {
|
50 |
+
$custom_option = $product->getCustomOption('option_'.$option->getId());
|
51 |
+
if ($custom_option) {
|
52 |
+
$value = $custom_option->getValue();
|
53 |
+
if ($option->getType()=='drop_down' && !$get_by_id) {
|
54 |
+
$option_value = $option->getValueById($value);
|
55 |
+
if ($option_value) {
|
56 |
+
$value = $option_value->getTitle();
|
57 |
+
}
|
58 |
+
}
|
59 |
+
}
|
60 |
+
break;
|
61 |
+
}
|
62 |
+
}
|
63 |
+
return $value;
|
64 |
+
}
|
65 |
+
|
66 |
+
public function getAttribute($attribute_name, $get_by_id=false) {
|
67 |
+
$value = null;
|
68 |
+
$product = $this->_getLoadedProduct();
|
69 |
+
$attribute = $product->getResource()->getAttribute($attribute_name);
|
70 |
+
if ($attribute) {
|
71 |
+
$input_type = $attribute->getFrontend()->getInputType();
|
72 |
+
if($input_type == 'select') {
|
73 |
+
$value = $get_by_id ? $product->getData($attribute_name) : $product->getAttributeText($attribute_name);
|
74 |
+
} else {
|
75 |
+
$value = $product->getData($attribute_name);
|
76 |
+
}
|
77 |
+
}
|
78 |
+
return $value;
|
79 |
+
}
|
80 |
+
|
81 |
+
private function _getLoadedProduct() {
|
82 |
+
if (!isset($this->loaded_product)) {
|
83 |
+
$this->loaded_product = Mage::getModel('catalog/product')->load($this->cart_product->getId());
|
84 |
+
}
|
85 |
+
return $this->loaded_product;
|
86 |
+
}
|
87 |
+
|
88 |
+
public function getQuantity() {
|
89 |
+
return $this->quantity;
|
90 |
+
}
|
91 |
+
|
92 |
+
public function getName() {
|
93 |
+
return $this->cart_product->getName();
|
94 |
+
}
|
95 |
+
|
96 |
+
public function getSku() {
|
97 |
+
return $this->cart_product->getSku();
|
98 |
+
}
|
99 |
+
|
100 |
+
public function getStockData($key) {
|
101 |
+
$stock = $this->cart_product->getStockItem();
|
102 |
+
if($key == 'is_in_stock') {
|
103 |
+
return (bool)$stock->getIsInStock();
|
104 |
+
} elseif($key == 'quantity') {
|
105 |
+
$quantity = $stock->getQty();
|
106 |
+
return $stock->getIsQtyDecimal() ? (float)$quantity : (int)$quantity;
|
107 |
+
}
|
108 |
+
return null;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
abstract class Chronopost_Chronorelais_Model_Carrier_AbstractChronorelaisShipping
|
113 |
+
extends Mage_Shipping_Model_Carrier_Abstract
|
114 |
+
{
|
115 |
+
protected $_translate_inline;
|
116 |
+
protected $_result;
|
117 |
+
protected $_config;
|
118 |
+
protected $_countries;
|
119 |
+
protected $_helper;
|
120 |
+
protected $_messages;
|
121 |
+
|
122 |
+
protected $_checkContract = false;
|
123 |
+
protected $_checkRelaiWs = false;
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Collect rates for this shipping method based on information in $request
|
127 |
+
*
|
128 |
+
* @param Mage_Shipping_Model_Rate_Request $data
|
129 |
+
* @return Mage_Shipping_Model_Rate_Result
|
130 |
+
*/
|
131 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
|
132 |
+
// skip if not enabled
|
133 |
+
if (!$this->__getConfigData('active')) {
|
134 |
+
return false;
|
135 |
+
}
|
136 |
+
|
137 |
+
$helper = Mage::helper('chronorelais');
|
138 |
+
|
139 |
+
$process = array(
|
140 |
+
'request' => $request,
|
141 |
+
'result' => Mage::getModel('shipping/rate_result'),
|
142 |
+
'cart.items' => array(),
|
143 |
+
'products' => array(),
|
144 |
+
'data' => array(
|
145 |
+
'module.version' => null,
|
146 |
+
'carrier.code' => $this->_code,
|
147 |
+
'cart.price_excluding_tax' => $request->_data['package_value_with_discount'],
|
148 |
+
'cart.price_including_tax' => null,
|
149 |
+
'cart.weight' => $request->_data['package_weight'],
|
150 |
+
'cart.weight.unit' => $helper->getConfigWeightUnit(),
|
151 |
+
'cart.quantity' => $request->_data['package_qty'],
|
152 |
+
'destination.country.code' => $request->_data['dest_country_id'],
|
153 |
+
'destination.country.name' => null,
|
154 |
+
'destination.region.code' => $request->_data['dest_region_code'],
|
155 |
+
'destination.postcode' => $request->_data['dest_postcode'],
|
156 |
+
'origin.country.code' => $request->_data['country_id'],
|
157 |
+
'origin.country.name' => null,
|
158 |
+
'origin.region.code' => $request->_data['region_id'],
|
159 |
+
'origin.postcode' => $request->_data['postcode'],
|
160 |
+
'customer.group.id' => null,
|
161 |
+
'customer.group.code' => null,
|
162 |
+
'free_shipping' => $request->getFreeShipping(),
|
163 |
+
'store.id' => $request->_data['store_id'],
|
164 |
+
'store.code' => null,
|
165 |
+
'store.name' => null,
|
166 |
+
'store.address' => null,
|
167 |
+
'store.phone' => null,
|
168 |
+
'date.timestamp' => null,
|
169 |
+
'date.year' => null,
|
170 |
+
'date.month' => null,
|
171 |
+
'date.day' => null,
|
172 |
+
'date.hour' => null,
|
173 |
+
'date.minute' => null,
|
174 |
+
'date.second' => null,
|
175 |
+
),
|
176 |
+
'stop_to_first_match' => null,
|
177 |
+
'config' => null,
|
178 |
+
);
|
179 |
+
|
180 |
+
$items = $request->getAllItems();
|
181 |
+
for ($i=0, $n=count($items); $i<$n; $i++) {
|
182 |
+
$item = $items[$i];
|
183 |
+
if ($item->getProduct() instanceof Mage_Catalog_Model_Product) {
|
184 |
+
$process['cart.items'][$item->getId()] = $item;
|
185 |
+
}
|
186 |
+
}
|
187 |
+
|
188 |
+
$this->_process($process);
|
189 |
+
|
190 |
+
return $process['result'];
|
191 |
+
}
|
192 |
+
|
193 |
+
|
194 |
+
public function getAllowedMethods() {
|
195 |
+
$config = $this->_getConfig();
|
196 |
+
$allowed_methods = array();
|
197 |
+
if (count($config)>0) {
|
198 |
+
foreach ($config as $row) {
|
199 |
+
$allowed_methods[$row['*code']] = isset($row['label']) ? $row['label']['value'] : 'No label';
|
200 |
+
}
|
201 |
+
}
|
202 |
+
return $allowed_methods;
|
203 |
+
}
|
204 |
+
|
205 |
+
public function isTrackingAvailable() {
|
206 |
+
return true;
|
207 |
+
}
|
208 |
+
|
209 |
+
public function getTrackingInfo($tracking_number) {
|
210 |
+
$tracking_url = Mage::helper('chronorelais')->getConfigurationTrackingViewUrl();
|
211 |
+
$parts = explode(':',$tracking_number);
|
212 |
+
if (count($parts)>=2) {
|
213 |
+
$tracking_number = $parts[1];
|
214 |
+
|
215 |
+
$config = $this->_getConfig();
|
216 |
+
|
217 |
+
if (isset($config[$parts[0]]['tracking_url'])) {
|
218 |
+
$row = $config[$parts[0]];
|
219 |
+
$tmp_tracking_url = $this->_helper->getRowProperty($row,'tracking_url');
|
220 |
+
if (isset($tmp_tracking_url)) {
|
221 |
+
$tracking_url = $tmp_tracking_url;
|
222 |
+
}
|
223 |
+
}
|
224 |
+
}
|
225 |
+
|
226 |
+
$tracking_status = Mage::getModel('shipping/tracking_result_status')
|
227 |
+
->setCarrier($this->_code)
|
228 |
+
->setCarrierTitle($this->__getConfigData('title'))
|
229 |
+
->setTracking($tracking_number)
|
230 |
+
->addData(
|
231 |
+
array(
|
232 |
+
'status'=>'<a target="_blank" href="'.str_replace('{tracking_number}',$tracking_number,$tracking_url).'">'.__('track the package').'</a>'
|
233 |
+
)
|
234 |
+
);
|
235 |
+
$tracking_result = Mage::getModel('shipping/tracking_result')
|
236 |
+
->append($tracking_status);
|
237 |
+
|
238 |
+
if ($trackings = $tracking_result->getAllTrackings()) {
|
239 |
+
return $trackings[0];
|
240 |
+
}
|
241 |
+
return false;
|
242 |
+
}
|
243 |
+
|
244 |
+
|
245 |
+
/***************************************************************************************************************************/
|
246 |
+
|
247 |
+
protected function _process(&$process) {
|
248 |
+
$store = Mage::app()->getStore($process['data']['store.id']);
|
249 |
+
$mage_config = Mage::getConfig();
|
250 |
+
$timestamp = time();
|
251 |
+
$customer_group_id = Mage::getSingleton('customer/session')->getCustomerGroupId();
|
252 |
+
$helper = Mage::helper('chronorelais');
|
253 |
+
// Pour les commandes depuis Adminhtml
|
254 |
+
if ($customer_group_id==0) {
|
255 |
+
$customer_group_id2 = Mage::getSingleton('adminhtml/session_quote')->getQuote()->getCustomerGroupId();
|
256 |
+
if (isset($customer_group_id2)) {
|
257 |
+
$customer_group_id = $customer_group_id2;
|
258 |
+
}
|
259 |
+
}
|
260 |
+
|
261 |
+
$customer_group_code = Mage::getSingleton('customer/group')->load($customer_group_id)->getData('customer_group_code');
|
262 |
+
$process['data'] = array_merge($process['data'],array(
|
263 |
+
'customer.group.id' => $customer_group_id,
|
264 |
+
'customer.group.code' => $customer_group_code,
|
265 |
+
'destination.country.name' => $this->__getCountryName($process['data']['destination.country.code']),
|
266 |
+
'origin.country.name' => $this->__getCountryName($process['data']['origin.country.code']),
|
267 |
+
'cart.weight.unit' => $helper->getConfigWeightUnit(),
|
268 |
+
'store.code' => $store->getCode(),
|
269 |
+
'store.name' => $store->getConfig('general/store_information/name'),
|
270 |
+
'store.address' => $store->getConfig('general/store_information/address'),
|
271 |
+
'store.phone' => $store->getConfig('general/store_information/phone'),
|
272 |
+
'date.timestamp' => $timestamp,
|
273 |
+
'date.year' => (int)date('Y',$timestamp),
|
274 |
+
'date.month' => (int)date('m',$timestamp),
|
275 |
+
'date.day' => (int)date('d',$timestamp),
|
276 |
+
'date.hour' => (int)date('H',$timestamp),
|
277 |
+
'date.minute' => (int)date('i',$timestamp),
|
278 |
+
'date.second' => (int)date('s',$timestamp),
|
279 |
+
'module.version' => (string)$mage_config->getNode('modules/Chronopost_Chronorelais/version'),
|
280 |
+
));
|
281 |
+
|
282 |
+
$weight_limit = $this->__getConfigData('weight_limit'); /* weight_limit in kg */
|
283 |
+
$productWeightOverLimit = false;
|
284 |
+
|
285 |
+
foreach ($process['cart.items'] as $item) {
|
286 |
+
if ($item->getProduct()->getTypeId()!='configurable') {
|
287 |
+
$parent_item_id = $item->getParentItemId();
|
288 |
+
$itemWeight = $item->getWeight();
|
289 |
+
if($helper->getConfigWeightUnit() == 'g')
|
290 |
+
{
|
291 |
+
$itemWeight = $itemWeight / 1000; // conversion g => kg
|
292 |
+
}
|
293 |
+
if($itemWeight > $weight_limit) {
|
294 |
+
$productWeightOverLimit = true;
|
295 |
+
}
|
296 |
+
$process['products'][] = new OCS_Magento_Product($item, isset($process['cart.items'][$parent_item_id]) ? $process['cart.items'][$parent_item_id] : null);
|
297 |
+
}
|
298 |
+
}
|
299 |
+
|
300 |
+
if (!$process['data']['free_shipping']) {
|
301 |
+
foreach ($process['cart.items'] as $item) {
|
302 |
+
if ($item->getProduct() instanceof Mage_Catalog_Model_Product) {
|
303 |
+
if ($item->getFreeShipping()) {
|
304 |
+
$process['data']['free_shipping'] = true;
|
305 |
+
} else {
|
306 |
+
$process['data']['free_shipping'] = false;
|
307 |
+
break;
|
308 |
+
}
|
309 |
+
}
|
310 |
+
}
|
311 |
+
}
|
312 |
+
|
313 |
+
$process['data']['cart.price_including_tax'] = $this->__getCartTaxAmount($process)+$process['data']['cart.price_excluding_tax'];
|
314 |
+
$process['stop_to_first_match'] = $this->__getConfigData('stop_to_first_match');
|
315 |
+
$process['config'] = $this->_getConfig();
|
316 |
+
$compression = $this->__getConfigData('auto_compression');
|
317 |
+
if ($compression=='compress') {
|
318 |
+
Mage::getConfig()->saveConfig('carriers/'.$this->_code.'/config',$this->_helper->formatConfig(true));
|
319 |
+
} else if ($compression=='uncompress') {
|
320 |
+
Mage::getConfig()->saveConfig('carriers/'.$this->_code.'/config',$this->_helper->formatConfig(false));
|
321 |
+
}
|
322 |
+
|
323 |
+
$this->_helper->debug = (int)(isset($_GET['debug']) ? $_GET['debug'] : $this->__getConfigData('debug'));
|
324 |
+
$http_request = Mage::app()->getFrontController()->getRequest();
|
325 |
+
$this->_helper->debug = $this->_helper->debug && $http_request->getRouteName()=='checkout' && $http_request->getControllerName()=='cart';
|
326 |
+
if ($this->_helper->debug) {
|
327 |
+
$this->_helper->setDebugHeader($process);
|
328 |
+
}
|
329 |
+
|
330 |
+
$value_found = false;
|
331 |
+
$process_continue = true;
|
332 |
+
|
333 |
+
//Set error messages if not any matching
|
334 |
+
$freeShippingEnable = $this->__getConfigData('free_shipping_enable');
|
335 |
+
$freeShippingSubtotal = $this->__getConfigData('free_shipping_subtotal');
|
336 |
+
$applicationFee = $this->__getConfigData('application_fee');
|
337 |
+
$handlingFee = $this->__getConfigData('handling_fee');
|
338 |
+
|
339 |
+
/* On autorise chronopost > 30 Kg si tous les produits sont <= 30 Kg */
|
340 |
+
if($productWeightOverLimit) {
|
341 |
+
$value_found = false;
|
342 |
+
$process_continue = false;
|
343 |
+
}
|
344 |
+
|
345 |
+
$process_continue = $this->validateMethod();
|
346 |
+
|
347 |
+
if($process_continue) {
|
348 |
+
foreach ($process['config'] as $row) {
|
349 |
+
$result = $this->_helper->processRow($process,$row);
|
350 |
+
$this->_addMessages($this->_helper->getMessages());
|
351 |
+
if ($result && $result->success) {
|
352 |
+
$value_found = true;
|
353 |
+
$fees = $result->result;
|
354 |
+
if($applicationFee) {
|
355 |
+
$fees += $applicationFee;
|
356 |
+
}
|
357 |
+
if($handlingFee) {
|
358 |
+
$fees += $handlingFee;
|
359 |
+
}
|
360 |
+
if($freeShippingEnable && ($freeShippingSubtotal<=$process['data']['cart.price_excluding_tax'])) {
|
361 |
+
$fees = 0;
|
362 |
+
}
|
363 |
+
$this->__appendMethod($process,$row,$fees);
|
364 |
+
if ($process['stop_to_first_match']) {
|
365 |
+
break;
|
366 |
+
}
|
367 |
+
}
|
368 |
+
}
|
369 |
+
}
|
370 |
+
|
371 |
+
$this->_helper->printDebug();
|
372 |
+
}
|
373 |
+
|
374 |
+
/* Additional conditions to show shipping method, each shipping method model might have their own validateMethod function */
|
375 |
+
protected function validateMethod() {
|
376 |
+
$helperWS = Mage::helper('chronorelais/webservice');
|
377 |
+
|
378 |
+
/* Chronorelais => test Si WS fonctionne */
|
379 |
+
if($this->_checkRelaiWs) {
|
380 |
+
$shippingAddress = Mage::getSingleton('adminhtml/session_quote')->getQuote()->getShippingAddress();
|
381 |
+
$webservice = $helperWS->getPointsRelaisByCp($shippingAddress->getPostcode());
|
382 |
+
if($webservice === false) {
|
383 |
+
return false;
|
384 |
+
}
|
385 |
+
}
|
386 |
+
|
387 |
+
if($this->_checkContract) {
|
388 |
+
$isAllowed = $helperWS->getMethodIsAllowed($this->_code);
|
389 |
+
if($isAllowed === false) {
|
390 |
+
return false;
|
391 |
+
}
|
392 |
+
}
|
393 |
+
return true;
|
394 |
+
}
|
395 |
+
|
396 |
+
protected function _getConfig() {
|
397 |
+
if (!isset($this->_config)) {
|
398 |
+
$this->_helper = new ChronorelaisShippingHelper($this->__getConfigData('config'));
|
399 |
+
$this->_config = $this->_helper->getConfig();
|
400 |
+
$this->_addMessages($this->_helper->getMessages());
|
401 |
+
}
|
402 |
+
return $this->_config;
|
403 |
+
}
|
404 |
+
|
405 |
+
protected function _getMethodText($process, $row, $property) {
|
406 |
+
if (!isset($row[$property])) {
|
407 |
+
return '';
|
408 |
+
}
|
409 |
+
|
410 |
+
$output = '';
|
411 |
+
|
412 |
+
return $output . ' '.$this->_helper->evalInput($process,$row,$property,str_replace(
|
413 |
+
array('{cart.weight}','{cart.price_including_tax}','{cart.price_excluding_tax}'),
|
414 |
+
array(
|
415 |
+
$process['data']['cart.weight'].$process['data']['cart.weight.unit'],
|
416 |
+
$this->__formatPrice($process['data']['cart.price_including_tax']),
|
417 |
+
$this->__formatPrice($process['data']['cart.price_excluding_tax'])
|
418 |
+
),
|
419 |
+
$this->_helper->getRowProperty($row,$property)
|
420 |
+
));
|
421 |
+
}
|
422 |
+
|
423 |
+
protected function _addMessages($messages) {
|
424 |
+
if (!is_array($messages)) {
|
425 |
+
$messages = array($messages);
|
426 |
+
}
|
427 |
+
if (!is_array($this->_messages)) {
|
428 |
+
$this->_messages = $messages;
|
429 |
+
} else {
|
430 |
+
$this->_messages = array_merge($this->_messages,$messages);
|
431 |
+
}
|
432 |
+
}
|
433 |
+
|
434 |
+
protected function _appendErrors(&$process, $messages) {
|
435 |
+
if (is_array($messages)) {
|
436 |
+
foreach ($messages as $message) {
|
437 |
+
$this->__appendError($process,$this->__($message));
|
438 |
+
}
|
439 |
+
}
|
440 |
+
}
|
441 |
+
|
442 |
+
/***************************************************************************************************************************/
|
443 |
+
|
444 |
+
protected function __getConfigData($key) {
|
445 |
+
return $this->getConfigData($key);
|
446 |
+
}
|
447 |
+
|
448 |
+
protected function __appendMethod(&$process, $row, $fees) {
|
449 |
+
$method = Mage::getModel('shipping/rate_result_method')
|
450 |
+
->setCarrier($this->_code)
|
451 |
+
->setCarrierTitle($this->__getConfigData('title'))
|
452 |
+
->setMethod($row['*code'])
|
453 |
+
->setMethodTitle($this->_getMethodText($process,$row,'label'))
|
454 |
+
->setMethodDescription($this->_getMethodText($process,$row,'description'))
|
455 |
+
->setMethodLogo($this->__getConfigData('logo_url'))
|
456 |
+
->setPrice($fees)
|
457 |
+
->setCost($fees)
|
458 |
+
;
|
459 |
+
$process['result']->append($method);
|
460 |
+
}
|
461 |
+
|
462 |
+
protected function __appendError(&$process, $message) {
|
463 |
+
if (isset($process['result'])) {
|
464 |
+
$error = Mage::getModel('shipping/rate_result_error')
|
465 |
+
->setCarrier($this->_code)
|
466 |
+
->setCarrierTitle($this->__getConfigData('title'))
|
467 |
+
->setErrorMessage($message)
|
468 |
+
;
|
469 |
+
$process['result']->append($error);
|
470 |
+
}
|
471 |
+
}
|
472 |
+
|
473 |
+
protected function __formatPrice($price) {
|
474 |
+
if (!isset($this->_core_helper)) {
|
475 |
+
$this->_core_helper = Mage::helper('core');
|
476 |
+
}
|
477 |
+
return $this->_core_helper->currency($price);
|
478 |
+
}
|
479 |
+
|
480 |
+
protected function __($message) {
|
481 |
+
$args = func_get_args();
|
482 |
+
$message = array_shift($args);
|
483 |
+
if ($message instanceof OCS_Message) {
|
484 |
+
$args = $message->args;
|
485 |
+
$message = $message->message;
|
486 |
+
}
|
487 |
+
|
488 |
+
$output = Mage::helper('shipping')->__($message);
|
489 |
+
if (count($args)==0) {
|
490 |
+
return $output;
|
491 |
+
}
|
492 |
+
|
493 |
+
if (!isset($this->_translate_inline)) {
|
494 |
+
$this->_translate_inline = Mage::getSingleton('core/translate')->getTranslateInline();
|
495 |
+
}
|
496 |
+
if ($this->_translate_inline) {
|
497 |
+
$parts = explode('}}{{',$output);
|
498 |
+
$parts[0] = vsprintf($parts[0],$args);
|
499 |
+
return implode('}}{{',$parts);
|
500 |
+
} else {
|
501 |
+
return vsprintf($output,$args);
|
502 |
+
}
|
503 |
+
}
|
504 |
+
|
505 |
+
protected function __getCountryName($country_code) {
|
506 |
+
return Mage::getModel('directory/country')->load($country_code)->getName();
|
507 |
+
}
|
508 |
+
|
509 |
+
protected function __getCartTaxAmount($process) {
|
510 |
+
$tax_amount = 0;
|
511 |
+
foreach ($process['cart.items'] as $item) {
|
512 |
+
$tax_amount += $item->getData('tax_amount');
|
513 |
+
}
|
514 |
+
return $tax_amount;
|
515 |
+
}
|
516 |
+
}
|
517 |
+
|
|
|
|
|
|
|
|
|
|
|
518 |
?>
|
app/code/community/Chronopost/Chronorelais/Model/Carrier/Chronoexpress.php
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
<?php
|
2 |
class Chronopost_Chronorelais_Model_Carrier_Chronoexpress extends Chronopost_Chronorelais_Model_Carrier_AbstractChronorelaisShipping
|
3 |
{
|
4 |
-
|
5 |
-
|
6 |
}
|
1 |
<?php
|
2 |
class Chronopost_Chronorelais_Model_Carrier_Chronoexpress extends Chronopost_Chronorelais_Model_Carrier_AbstractChronorelaisShipping
|
3 |
{
|
4 |
+
protected $_code = 'chronoexpress';
|
|
|
5 |
}
|
app/code/community/Chronopost/Chronorelais/Model/Carrier/Chronopost.php
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
<?php
|
2 |
class Chronopost_Chronorelais_Model_Carrier_Chronopost extends Chronopost_Chronorelais_Model_Carrier_AbstractChronorelaisShipping
|
3 |
{
|
4 |
-
|
5 |
-
|
6 |
}
|
1 |
<?php
|
2 |
class Chronopost_Chronorelais_Model_Carrier_Chronopost extends Chronopost_Chronorelais_Model_Carrier_AbstractChronorelaisShipping
|
3 |
{
|
4 |
+
protected $_code = 'chronopost';
|
|
|
5 |
}
|
app/code/community/Chronopost/Chronorelais/Model/Carrier/ChronopostC10.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
class Chronopost_Chronorelais_Model_Carrier_ChronopostC10 extends Chronopost_Chronorelais_Model_Carrier_AbstractChronorelaisShipping
|
3 |
{
|
4 |
-
|
5 |
-
|
6 |
}
|
1 |
<?php
|
2 |
class Chronopost_Chronorelais_Model_Carrier_ChronopostC10 extends Chronopost_Chronorelais_Model_Carrier_AbstractChronorelaisShipping
|
3 |
{
|
4 |
+
protected $_code = 'chronopostc10';
|
5 |
+
protected $_checkContract = true;
|
6 |
}
|
app/code/community/Chronopost/Chronorelais/Model/Carrier/ChronopostC18.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
class Chronopost_Chronorelais_Model_Carrier_ChronopostC18 extends Chronopost_Chronorelais_Model_Carrier_AbstractChronorelaisShipping
|
3 |
{
|
4 |
-
|
5 |
-
|
6 |
}
|
1 |
<?php
|
2 |
class Chronopost_Chronorelais_Model_Carrier_ChronopostC18 extends Chronopost_Chronorelais_Model_Carrier_AbstractChronorelaisShipping
|
3 |
{
|
4 |
+
protected $_code = 'chronopostc18';
|
5 |
+
protected $_checkContract = true;
|
6 |
}
|
app/code/community/Chronopost/Chronorelais/Model/Carrier/ChronopostCClassic.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
class Chronopost_Chronorelais_Model_Carrier_ChronopostCClassic extends Chronopost_Chronorelais_Model_Carrier_AbstractChronorelaisShipping
|
3 |
{
|
4 |
-
|
5 |
-
|
6 |
}
|
1 |
<?php
|
2 |
class Chronopost_Chronorelais_Model_Carrier_ChronopostCClassic extends Chronopost_Chronorelais_Model_Carrier_AbstractChronorelaisShipping
|
3 |
{
|
4 |
+
protected $_code = 'chronopostcclassic';
|
5 |
+
protected $_checkContract = true;
|
6 |
}
|
app/code/community/Chronopost/Chronorelais/Model/Carrier/Chronopostsameday.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Chronopost_Chronorelais_Model_Carrier_Chronopostsameday extends Chronopost_Chronorelais_Model_Carrier_AbstractChronorelaisShipping
|
4 |
+
{
|
5 |
+
|
6 |
+
protected $_code = 'chronopostsameday';
|
7 |
+
protected $_checkContract = true;
|
8 |
+
|
9 |
+
protected function validateMethod()
|
10 |
+
{
|
11 |
+
$validate = parent::validateMethod();
|
12 |
+
|
13 |
+
// Check if we should auto disable the module (it's past hour)
|
14 |
+
$deliveryTimeLimitConf = Mage::getStoreConfig('carriers/' . $this->getCarrierCode() . '/delivery_time_limit');
|
15 |
+
// Safe fallback
|
16 |
+
if (!$deliveryTimeLimitConf) {
|
17 |
+
$deliveryTimeLimitConf = '15:00';
|
18 |
+
}
|
19 |
+
$deliveryTimeLimit = new DateTime(date('Y-m-d') . ' ' . $deliveryTimeLimitConf . ':00');
|
20 |
+
$currentTime = new DateTime('NOW');
|
21 |
+
|
22 |
+
if ($validate === true) {
|
23 |
+
if (Mage::getModel('core/date')->timestamp($currentTime->getTimestamp())
|
24 |
+
<= $deliveryTimeLimit->getTimestamp()) {
|
25 |
+
$validate = true;
|
26 |
+
} else {
|
27 |
+
$validate = false;
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
return $validate;
|
32 |
+
}
|
33 |
+
}
|
app/code/community/Chronopost/Chronorelais/Model/Carrier/Chronopostsrdv.php
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Chronopost_Chronorelais_Model_Carrier_Chronopostsrdv extends Chronopost_Chronorelais_Model_Carrier_AbstractChronorelaisShipping
|
4 |
+
{
|
5 |
+
|
6 |
+
protected $_code = 'chronopostsrdv';
|
7 |
+
protected $_checkContract = true;
|
8 |
+
|
9 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
|
10 |
+
$result = parent::collectRates($request);
|
11 |
+
return $this->updatePriceAndLabel($result);
|
12 |
+
}
|
13 |
+
|
14 |
+
/* update shipping method price and label to add date and hours */
|
15 |
+
public function updatePriceAndLabel($result) {
|
16 |
+
$rates = $result->getAllRates();
|
17 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
18 |
+
|
19 |
+
if(!$quote) {
|
20 |
+
return $result;
|
21 |
+
}
|
22 |
+
|
23 |
+
$shippingAddress = $quote->getShippingAddress();
|
24 |
+
|
25 |
+
if(!$shippingAddress || !$shippingAddress->getShippingMethod()) { // || !isset($_SESSION['chronopostsrdv_creneaux_info'])
|
26 |
+
//return $result;
|
27 |
+
}
|
28 |
+
|
29 |
+
// We will rebuild it later
|
30 |
+
$result->reset();
|
31 |
+
|
32 |
+
/*$price = $_srdvConfig[$tarifLevel."_price"];
|
33 |
+
$price = $_helper->addMargeToQuickcost($price,$this->_code, false);*/
|
34 |
+
|
35 |
+
foreach ($rates as $rate) {
|
36 |
+
|
37 |
+
if($rate->getMethod() == $this->_code) {
|
38 |
+
|
39 |
+
/*if(!$rate->getOriginalPrice()) {
|
40 |
+
$rate->setOriginalPrice($rate->getPrice());
|
41 |
+
}*/
|
42 |
+
|
43 |
+
|
44 |
+
$_srdvConfig = Mage::getStoreConfig('carriers/chronopostsrdv/rdv_config');
|
45 |
+
$_srdvConfig = json_decode($_srdvConfig,true);
|
46 |
+
|
47 |
+
$_helper = Mage::helper('chronorelais');
|
48 |
+
|
49 |
+
if(isset($_SESSION['chronopostsrdv_creneaux_info'])) {
|
50 |
+
$chronopostsrdv_creneaux_info = $_SESSION['chronopostsrdv_creneaux_info'];
|
51 |
+
$tarifLevel = $chronopostsrdv_creneaux_info['tariffLevel'];
|
52 |
+
$price = $_srdvConfig[$tarifLevel."_price"] + $rate->getCost();
|
53 |
+
|
54 |
+
$_dateRdvStart = new DateTime($chronopostsrdv_creneaux_info['deliveryDate']);
|
55 |
+
$_dateRdvStart->setTime($chronopostsrdv_creneaux_info['startHour'],$chronopostsrdv_creneaux_info['startMinutes']);
|
56 |
+
|
57 |
+
$_dateRdvEnd = new DateTime($chronopostsrdv_creneaux_info['deliveryDate']);
|
58 |
+
$_dateRdvEnd->setTime($chronopostsrdv_creneaux_info['endHour'],$chronopostsrdv_creneaux_info['endMinutes']);
|
59 |
+
|
60 |
+
$methodTitle = $rate->getMethodTitle();
|
61 |
+
$methodTitle .= ' - '.$_helper->__('Le').' '.$_dateRdvStart->format('d/m/Y');
|
62 |
+
$methodTitle .= ' '.$_helper->__('entre %s et %s',$_dateRdvStart->format('H:i'),$_dateRdvEnd->format('H:i'));
|
63 |
+
$rate->setData('method_title',$methodTitle);
|
64 |
+
|
65 |
+
} else {
|
66 |
+
$minimal_price = '';
|
67 |
+
for($i = 1; $i <= 4; $i++) {
|
68 |
+
if($minimal_price === '' || isset($_srdvConfig["N".$i."_price"]) && $_srdvConfig["N".$i."_price"] < $minimal_price) {
|
69 |
+
$minimal_price = $_srdvConfig["N".$i."_price"];
|
70 |
+
}
|
71 |
+
}
|
72 |
+
$price = $minimal_price + $rate->getCost();
|
73 |
+
}
|
74 |
+
|
75 |
+
$rate->setPrice($price);
|
76 |
+
|
77 |
+
$shippingAddress->setShippingDescription($methodTitle);
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
$result->append($rate);
|
82 |
+
}
|
83 |
+
return $result;
|
84 |
+
}
|
85 |
+
}
|
app/code/community/Chronopost/Chronorelais/Model/Carrier/Chronorelais.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
class Chronopost_Chronorelais_Model_Carrier_Chronorelais extends Chronopost_Chronorelais_Model_Carrier_AbstractChronorelaisShipping
|
3 |
{
|
4 |
-
|
5 |
-
|
6 |
}
|
1 |
<?php
|
2 |
class Chronopost_Chronorelais_Model_Carrier_Chronorelais extends Chronopost_Chronorelais_Model_Carrier_AbstractChronorelaisShipping
|
3 |
{
|
4 |
+
protected $_code = 'chronorelais';
|
5 |
+
protected $_checkRelaiWs = true;
|
6 |
}
|
app/code/community/Chronopost/Chronorelais/Model/Carrier/Chronorelaisdom.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Chronopost_Chronorelais_Model_Carrier_Chronorelaisdom extends Chronopost_Chronorelais_Model_Carrier_AbstractChronorelaisShipping
|
3 |
+
{
|
4 |
+
protected $_code = 'chronorelaisdom';
|
5 |
+
protected $_checkContract = true;
|
6 |
+
protected $_checkRelaiWs = true;
|
7 |
+
}
|
app/code/community/Chronopost/Chronorelais/Model/Carrier/Chronorelaiseurope.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Chronopost_Chronorelais_Model_Carrier_Chronorelaiseurope extends Chronopost_Chronorelais_Model_Carrier_AbstractChronorelaisShipping
|
3 |
+
{
|
4 |
+
protected $_code = 'chronorelaiseurope';
|
5 |
+
protected $_checkContract = true;
|
6 |
+
protected $_checkRelaiWs = true;
|
7 |
+
}
|
app/code/community/Chronopost/Chronorelais/Model/Config/Backend/Date.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* System config file field backend model
|
4 |
+
*
|
5 |
+
* @category Adexos
|
6 |
+
* @package Adexos_Productcustomizer
|
7 |
+
* @author Adexos
|
8 |
+
*/
|
9 |
+
class Chronopost_Chronorelais_Model_Config_Backend_Date extends Mage_Core_Model_Config_Data
|
10 |
+
{
|
11 |
+
protected function _beforeSave()
|
12 |
+
{
|
13 |
+
$range = $this->getValue();
|
14 |
+
$this->setValue($range[0].':'.$range[1].':'.$range[2]);
|
15 |
+
return $this;
|
16 |
+
}
|
17 |
+
}
|
app/code/community/Chronopost/Chronorelais/Model/Config/Source/Civility.php
CHANGED
@@ -6,7 +6,7 @@ class Chronopost_Chronorelais_Model_Config_Source_Civility
|
|
6 |
return array(
|
7 |
array('value'=>'E', 'label'=>Mage::helper('chronorelais')->__('Madame')),
|
8 |
array('value'=>'L', 'label'=>Mage::helper('chronorelais')->__('Mademoiselle')),
|
9 |
-
|
10 |
);
|
11 |
}
|
12 |
-
}
|
6 |
return array(
|
7 |
array('value'=>'E', 'label'=>Mage::helper('chronorelais')->__('Madame')),
|
8 |
array('value'=>'L', 'label'=>Mage::helper('chronorelais')->__('Mademoiselle')),
|
9 |
+
array('value'=>'M', 'label'=>Mage::helper('chronorelais')->__('Monsieur'))
|
10 |
);
|
11 |
}
|
12 |
+
}
|
app/code/community/Chronopost/Chronorelais/Model/Config/Source/Day.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Chronopost_Chronorelais_Model_Config_Source_Day
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
return array(
|
7 |
+
array('value'=>'monday', 'label'=>Mage::helper('chronorelais')->__('Monday')),
|
8 |
+
array('value'=>'tuesday', 'label'=>Mage::helper('chronorelais')->__('Tuesday')),
|
9 |
+
array('value'=>'wednesday', 'label'=>Mage::helper('chronorelais')->__('Wednesday')),
|
10 |
+
array('value'=>'thursday', 'label'=>Mage::helper('chronorelais')->__('Thursday')),
|
11 |
+
array('value'=>'friday', 'label'=>Mage::helper('chronorelais')->__('Friday')),
|
12 |
+
array('value'=>'saturday', 'label'=>Mage::helper('chronorelais')->__('Saturday')),
|
13 |
+
array('value'=>'sunday', 'label'=>Mage::helper('chronorelais')->__('Sunday'))
|
14 |
+
);
|
15 |
+
}
|
16 |
+
}
|
app/code/community/Chronopost/Chronorelais/Model/Config/Source/FieldDelimiter.php
CHANGED
@@ -4,9 +4,9 @@ class Chronopost_Chronorelais_Model_Config_Source_FieldDelimiter
|
|
4 |
public function toOptionArray()
|
5 |
{
|
6 |
return array(
|
7 |
-
|
8 |
array('value'=>'simple_quote', 'label'=>Mage::helper('chronorelais')->__('Simple Quote')),
|
9 |
array('value'=>'double_quotes', 'label'=>Mage::helper('chronorelais')->__('Double Quotes'))
|
10 |
);
|
11 |
}
|
12 |
-
}
|
4 |
public function toOptionArray()
|
5 |
{
|
6 |
return array(
|
7 |
+
array('value'=>'none', 'label'=>Mage::helper('chronorelais')->__('None')),
|
8 |
array('value'=>'simple_quote', 'label'=>Mage::helper('chronorelais')->__('Simple Quote')),
|
9 |
array('value'=>'double_quotes', 'label'=>Mage::helper('chronorelais')->__('Double Quotes'))
|
10 |
);
|
11 |
}
|
12 |
+
}
|
app/code/community/Chronopost/Chronorelais/Model/Config/Source/FileCharset.php
CHANGED
@@ -6,7 +6,7 @@ class Chronopost_Chronorelais_Model_Config_Source_FileCharset
|
|
6 |
return array(
|
7 |
array('value'=>'ISO-8859-1', 'label'=>Mage::helper('chronorelais')->__('ISO-8859-1')),
|
8 |
array('value'=>'UTF-8', 'label'=>Mage::helper('chronorelais')->__('UTF-8')),
|
9 |
-
|
10 |
);
|
11 |
}
|
12 |
-
}
|
6 |
return array(
|
7 |
array('value'=>'ISO-8859-1', 'label'=>Mage::helper('chronorelais')->__('ISO-8859-1')),
|
8 |
array('value'=>'UTF-8', 'label'=>Mage::helper('chronorelais')->__('UTF-8')),
|
9 |
+
array('value'=>'ASCII-7', 'label'=>Mage::helper('chronorelais')->__('ASCII-7 Bits'))
|
10 |
);
|
11 |
}
|
12 |
+
}
|
app/code/community/Chronopost/Chronorelais/Model/Config/Source/FileExtension.php
CHANGED
@@ -6,7 +6,7 @@ class Chronopost_Chronorelais_Model_Config_Source_FileExtension
|
|
6 |
return array(
|
7 |
array('value'=>'.txt', 'label'=>Mage::helper('chronorelais')->__('.txt')),
|
8 |
array('value'=>'.csv', 'label'=>Mage::helper('chronorelais')->__('.csv')),
|
9 |
-
|
10 |
);
|
11 |
}
|
12 |
}
|
6 |
return array(
|
7 |
array('value'=>'.txt', 'label'=>Mage::helper('chronorelais')->__('.txt')),
|
8 |
array('value'=>'.csv', 'label'=>Mage::helper('chronorelais')->__('.csv')),
|
9 |
+
array('value'=>'.chr', 'label'=>Mage::helper('chronorelais')->__('.chr'))
|
10 |
);
|
11 |
}
|
12 |
}
|
app/code/community/Chronopost/Chronorelais/Model/Config/Source/Hour.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Chronopost_Chronorelais_Model_Config_Source_Hour
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
$hour = array();
|
7 |
+
for($i = 0; $i <= 23; $i++) {
|
8 |
+
$hour_str = str_pad($i, 2, '0',STR_PAD_LEFT);
|
9 |
+
$hour[] = array('value' => $hour_str, 'label' => $hour_str);
|
10 |
+
}
|
11 |
+
return $hour;
|
12 |
+
}
|
13 |
+
}
|
app/code/community/Chronopost/Chronorelais/Model/Config/Source/Margetype.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Chronopost_Chronorelais_Model_Config_Source_Margetype
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
return array(
|
7 |
+
array('value'=>'prcent', 'label'=>Mage::helper('chronorelais')->__('Percentage')." (%)"),
|
8 |
+
array('value'=>'amount', 'label'=>Mage::helper('chronorelais')->__('Amount')." (€)")
|
9 |
+
);
|
10 |
+
}
|
11 |
+
}
|
app/code/community/Chronopost/Chronorelais/Model/Config/Source/Minute.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Chronopost_Chronorelais_Model_Config_Source_Minute
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
$minute = array();
|
7 |
+
for($i = 0; $i <= 59; $i++) {
|
8 |
+
$minute_str = str_pad($i, 2, '0',STR_PAD_LEFT);
|
9 |
+
$minute[] = array('value' => $minute_str, 'label' => $minute_str);
|
10 |
+
}
|
11 |
+
return $minute;
|
12 |
+
}
|
13 |
+
}
|
app/code/community/Chronopost/Chronorelais/Model/Config/Source/PrintMode.php
CHANGED
@@ -6,7 +6,7 @@ class Chronopost_Chronorelais_Model_Config_Source_PrintMode
|
|
6 |
return array(
|
7 |
array('value'=>'PDF', 'label'=>Mage::helper('chronorelais')->__('Print PDF Laser with proof')),
|
8 |
array('value'=>'SPD', 'label'=>Mage::helper('chronorelais')->__('Print PDF laser without proof')),
|
9 |
-
|
10 |
);
|
11 |
}
|
12 |
}
|
6 |
return array(
|
7 |
array('value'=>'PDF', 'label'=>Mage::helper('chronorelais')->__('Print PDF Laser with proof')),
|
8 |
array('value'=>'SPD', 'label'=>Mage::helper('chronorelais')->__('Print PDF laser without proof')),
|
9 |
+
array('value'=>'THE', 'label'=>Mage::helper('chronorelais')->__('Print PDF thermal'))
|
10 |
);
|
11 |
}
|
12 |
}
|
app/code/community/Chronopost/Chronorelais/Model/Config/Source/Time.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Chronopost_Chronorelais_Model_Config_Source_Time
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* 07:00 / 07 :30 / 08:00 / 08 :30 / 09:00 / 09 :30 / 10:00 / 10 :30 / 11:00
|
6 |
+
* 11:30 / 12:00 / 12 :30 / 13:00 / 13 :30 / 14:00 / 14 :30 / 15:00
|
7 |
+
* @return type
|
8 |
+
*/
|
9 |
+
public function toOptionArray()
|
10 |
+
{
|
11 |
+
return array(
|
12 |
+
array('value'=>'07:00', 'label'=>Mage::helper('chronorelais')->__('7 AM')),
|
13 |
+
array('value'=>'07:30', 'label'=>Mage::helper('chronorelais')->__('7.30 AM')),
|
14 |
+
array('value'=>'08:00', 'label'=>Mage::helper('chronorelais')->__('8 AM')),
|
15 |
+
array('value'=>'08:30', 'label'=>Mage::helper('chronorelais')->__('8.30 AM')),
|
16 |
+
array('value'=>'09:00', 'label'=>Mage::helper('chronorelais')->__('9 AM')),
|
17 |
+
array('value'=>'09:30', 'label'=>Mage::helper('chronorelais')->__('9.30 AM')),
|
18 |
+
array('value'=>'10:00', 'label'=>Mage::helper('chronorelais')->__('10 AM')),
|
19 |
+
array('value'=>'10:30', 'label'=>Mage::helper('chronorelais')->__('10.30 AM')),
|
20 |
+
array('value'=>'11:00', 'label'=>Mage::helper('chronorelais')->__('11 AM')),
|
21 |
+
array('value'=>'11:30', 'label'=>Mage::helper('chronorelais')->__('11.30 AM')),
|
22 |
+
array('value'=>'12:00', 'label'=>Mage::helper('chronorelais')->__('12 AM')),
|
23 |
+
array('value'=>'12:30', 'label'=>Mage::helper('chronorelais')->__('12.30 AM')),
|
24 |
+
array('value'=>'13:00', 'label'=>Mage::helper('chronorelais')->__('1 PM')),
|
25 |
+
array('value'=>'13:30', 'label'=>Mage::helper('chronorelais')->__('1.30 PM')),
|
26 |
+
array('value'=>'14:00', 'label'=>Mage::helper('chronorelais')->__('2 PM')),
|
27 |
+
array('value'=>'14:30', 'label'=>Mage::helper('chronorelais')->__('2.30 PM')),
|
28 |
+
array('value'=>'15:00', 'label'=>Mage::helper('chronorelais')->__('3 PM'))
|
29 |
+
);
|
30 |
+
}
|
31 |
+
}
|
app/code/community/Chronopost/Chronorelais/Model/Observer.php
ADDED
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Chronopost_Chronorelais_Model_Observer
|
4 |
+
{
|
5 |
+
public function checkSoapExists() {
|
6 |
+
if (!extension_loaded('soap') && (Mage::helper('chronorelais')->getConfigData('carriers/chronopost/active') || Mage::helper('chronorelais')->getConfigData('carriers/chronorelais/active') || Mage::helper('chronorelais')->getConfigData('carriers/chronoexpress/active'))) {
|
7 |
+
Mage::getSingleton('checkout/session')->addError(Mage::helper('chronorelais')->__('The SOAP extension is not installed in the server. Please contact the site administrator. Sorry for inconvenience.'));
|
8 |
+
Mage::app()->getResponse()->setRedirect(Mage::getUrl("checkout/cart"));
|
9 |
+
return;
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
public function saveBillingBefore() {
|
14 |
+
$request = Mage::app()->getRequest();
|
15 |
+
$data = $request->getPost('billing', array());
|
16 |
+
$customerAddressId = $request->getPost('billing_address_id', false);
|
17 |
+
|
18 |
+
if (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
|
19 |
+
|
20 |
+
//WEC chronorelais
|
21 |
+
if (isset($_SESSION["customer_shipping_address_reference"])) {
|
22 |
+
unset($_SESSION["customer_shipping_address_reference"]);
|
23 |
+
}
|
24 |
+
|
25 |
+
if (!array_key_exists("company", $data)) {
|
26 |
+
$data["company"] = "";
|
27 |
+
}
|
28 |
+
|
29 |
+
$_SESSION["customer_shipping_address_reference"]["data"] = $data;
|
30 |
+
$_SESSION["customer_shipping_address_reference"]["customerAddressId"] = $customerAddressId;
|
31 |
+
$_SESSION["customer_shipping_address_reference"]["available"] = false;
|
32 |
+
//ENDWEC
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
public function saveShippingBefore() {
|
37 |
+
$request = Mage::app()->getRequest();
|
38 |
+
$data = $request->getPost('shipping', array());
|
39 |
+
$customerAddressId = $request->getPost('shipping_address_id', false);
|
40 |
+
|
41 |
+
//WEC chronorelais
|
42 |
+
if (isset($_SESSION["customer_shipping_address_reference"])) {
|
43 |
+
unset($_SESSION["customer_shipping_address_reference"]);
|
44 |
+
}
|
45 |
+
if (!array_key_exists("company", $data)) {
|
46 |
+
$data["company"] = "";
|
47 |
+
}
|
48 |
+
$_SESSION["customer_shipping_address_reference"]["data"] = $data;
|
49 |
+
$_SESSION["customer_shipping_address_reference"]["customerAddressId"] = $customerAddressId;
|
50 |
+
$_SESSION["customer_shipping_address_reference"]["available"] = false;
|
51 |
+
//ENDWEC
|
52 |
+
}
|
53 |
+
|
54 |
+
public function saveShippingMethodBefore() {
|
55 |
+
$request = Mage::app()->getRequest();
|
56 |
+
$onepage = Mage::getSingleton('checkout/type_onepage');
|
57 |
+
//WEC chronorelais
|
58 |
+
|
59 |
+
if ($_SESSION["customer_shipping_address_reference"]["available"]) {
|
60 |
+
$data = $_SESSION["customer_shipping_address_reference"]["data"];
|
61 |
+
$customerAddressId = $_SESSION["customer_shipping_address_reference"]["customerAddressId"];
|
62 |
+
$_SESSION["customer_shipping_address_reference"]["available"] = false;
|
63 |
+
|
64 |
+
$result = $onepage->saveShipping($data, $customerAddressId);
|
65 |
+
if(!Mage::getStoreConfig('onestepcheckout/general/rewrite_checkout_links')) {
|
66 |
+
Mage::app()->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
$method = $request->getParam('shipping_method');
|
71 |
+
$quote = Mage::getSingleton('checkout/cart')->getQuote();
|
72 |
+
$address = $quote->getShippingAddress();
|
73 |
+
|
74 |
+
$shippingMethodSelected = $request->getParam('shipping_method');
|
75 |
+
|
76 |
+
$methodTitle = "";
|
77 |
+
|
78 |
+
/* Chronorelais */
|
79 |
+
if(strpos($shippingMethodSelected,'chronorelais') !== false) {
|
80 |
+
$relaisId = $request->getParam('shipping_method_chronorelais');
|
81 |
+
if ($relaisId != "") {
|
82 |
+
$helper = Mage::helper('chronorelais/webservice');
|
83 |
+
$relais = $helper->getDetailRelaisPoint($relaisId);
|
84 |
+
|
85 |
+
if ($relais) {
|
86 |
+
$address->setCity($relais->localite)
|
87 |
+
->setPostcode($relais->codePostal)
|
88 |
+
->setStreet(trim($relais->adresse1 . "\n" . $relais->adresse2 . " " . $relais->adresse3))
|
89 |
+
->setCompany($relais->nomEnseigne)
|
90 |
+
->setWRelayPointCode($relais->identifiantChronopostPointA2PAS)
|
91 |
+
->save()
|
92 |
+
->setCollectShippingRates(true);
|
93 |
+
|
94 |
+
$_SESSION['chronopost_relais_id'] = $relaisId;
|
95 |
+
|
96 |
+
$_SESSION["customer_shipping_address_reference"]["available"] = true;
|
97 |
+
|
98 |
+
if (isset($relais->localite)) {
|
99 |
+
$methodTitle = ' - ' . $relais->nomEnseigne . ' - ' . trim($relais->adresse1 . " " . $relais->adresse2 . " " . $relais->adresse3) . ' - ' . $relais->codePostal . ' - ' . $relais->localite;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
} else {
|
103 |
+
if(!Mage::getStoreConfig('onestepcheckout/general/rewrite_checkout_links')) {
|
104 |
+
$result['error'] = true;
|
105 |
+
$result['message'] = Mage::helper('chronorelais')->__('Veuillez sélectionner votre point relais');
|
106 |
+
echo Mage::helper('core')->jsonEncode($result);
|
107 |
+
exit;
|
108 |
+
}
|
109 |
+
}
|
110 |
+
} else {
|
111 |
+
unset($_SESSION['chronopost_relais_id']);
|
112 |
+
}
|
113 |
+
|
114 |
+
/* Chronopostsrdv */
|
115 |
+
if(strpos($shippingMethodSelected,'chronopostsrdv') !== false) {
|
116 |
+
$rdvInfo = $request->getParam('chronopostsrdv_creneaux_info');
|
117 |
+
|
118 |
+
if ($rdvInfo != "") {
|
119 |
+
$helper = Mage::helper('chronorelais/webservice');
|
120 |
+
|
121 |
+
/* vérification creneau ok */
|
122 |
+
$rdvInfo = json_decode($rdvInfo,true);
|
123 |
+
|
124 |
+
$confirm = $helper->confirmDeliverySlot($rdvInfo);
|
125 |
+
if($confirm->return->code == 0) {
|
126 |
+
|
127 |
+
$rdvInfo['productCode'] = $confirm->return->productService->productCode;
|
128 |
+
$rdvInfo['serviceCode'] = $confirm->return->productService->serviceCode;
|
129 |
+
|
130 |
+
$_SESSION['chronopostsrdv_creneaux_info'] = $rdvInfo;
|
131 |
+
|
132 |
+
/* Important : permet de mettre à jour libellé method + prix */
|
133 |
+
$address->setChronopostsrdvCreneauxInfo(json_encode($rdvInfo))
|
134 |
+
->save()
|
135 |
+
->setCollectShippingRates(true);
|
136 |
+
|
137 |
+
} else {
|
138 |
+
$result['error'] = true;
|
139 |
+
$result['message'] = Mage::helper('chronorelais')->__($confirm->return->message);
|
140 |
+
echo Mage::helper('core')->jsonEncode($result);
|
141 |
+
exit;
|
142 |
+
}
|
143 |
+
|
144 |
+
} else {
|
145 |
+
if(!Mage::getStoreConfig('onestepcheckout/general/rewrite_checkout_links')) {
|
146 |
+
$result['error'] = true;
|
147 |
+
$result['message'] = Mage::helper('chronorelais')->__('Veuillez sélectionner votre horaire de rendez-vous');
|
148 |
+
echo Mage::helper('core')->jsonEncode($result);
|
149 |
+
exit;
|
150 |
+
}
|
151 |
+
}
|
152 |
+
} else {
|
153 |
+
unset($_SESSION['chronopostsrdv_creneaux_info']);
|
154 |
+
}
|
155 |
+
|
156 |
+
if ($method) {
|
157 |
+
foreach ($address->getAllShippingRates() as $rate) {
|
158 |
+
if ($rate->getCode() == $method) {
|
159 |
+
$address->setShippingDescription($rate->getCarrierTitle() . ' - ' . $rate->getMethodTitle() . $methodTitle);
|
160 |
+
break;
|
161 |
+
}
|
162 |
+
}
|
163 |
+
}
|
164 |
+
//ENDWEC chronorelais
|
165 |
+
}
|
166 |
+
|
167 |
+
public function updateShippingAddress($observer) {
|
168 |
+
|
169 |
+
$address = $observer->getEvent()->getAddress();
|
170 |
+
$shippingMethodSelected = $address->getShippingMethod();
|
171 |
+
|
172 |
+
$onepage = Mage::getSingleton('checkout/type_onepage');
|
173 |
+
//WEC chronorelais
|
174 |
+
|
175 |
+
if(strpos($shippingMethodSelected,'chronorelais') !== false) {
|
176 |
+
$relaisId = $_SESSION['chronopost_relais_id'];
|
177 |
+
if ($relaisId != "") {
|
178 |
+
$helper = Mage::helper('chronorelais/webservice');
|
179 |
+
$relais = $helper->getDetailRelaisPoint($relaisId);
|
180 |
+
|
181 |
+
if ($relais) {
|
182 |
+
$address->setCity($relais->localite)
|
183 |
+
->setPostcode($relais->codePostal)
|
184 |
+
->setStreet(trim($relais->adresse1 . "\n" . $relais->adresse2 . " " . $relais->adresse3))
|
185 |
+
->setCompany($relais->nomEnseigne)
|
186 |
+
->setWRelayPointCode($relais->identifiantChronopostPointA2PAS)
|
187 |
+
->save()
|
188 |
+
->setCollectShippingRates(true);
|
189 |
+
|
190 |
+
$_SESSION["customer_shipping_address_reference"]["available"] = true;
|
191 |
+
}
|
192 |
+
} else {
|
193 |
+
/*$result['error'] = true;
|
194 |
+
$result['message'] = Mage::helper('chronorelais')->__('Veuillez sélectionner votre point relais');
|
195 |
+
echo Mage::helper('core')->jsonEncode($result);
|
196 |
+
exit;*/
|
197 |
+
}
|
198 |
+
}
|
199 |
+
|
200 |
+
/* Chronopostsrdv */
|
201 |
+
if(strpos($shippingMethodSelected,'chronopostsrdv') !== false) {
|
202 |
+
$rdvInfo = $_SESSION['chronopostsrdv_creneaux_info'];
|
203 |
+
|
204 |
+
if ($rdvInfo != "") {
|
205 |
+
$helper = Mage::helper('chronorelais/webservice');
|
206 |
+
|
207 |
+
/* vérification creneau ok */
|
208 |
+
$confirm = $helper->confirmDeliverySlot($rdvInfo);
|
209 |
+
|
210 |
+
if($confirm->return->code == 0) {
|
211 |
+
|
212 |
+
$rdvInfo['productCode'] = $confirm->return->productService->productCode;
|
213 |
+
$rdvInfo['serviceCode'] = $confirm->return->productService->serviceCode;
|
214 |
+
|
215 |
+
/* Important : permet de mettre à jour libellé method + prix */
|
216 |
+
$address->setChronopostsrdvCreneauxInfo(json_encode($rdvInfo))
|
217 |
+
->setCollectShippingRates(true)->collectShippingRates()->save();
|
218 |
+
|
219 |
+
} else {
|
220 |
+
$result['error'] = true;
|
221 |
+
$result['message'] = Mage::helper('chronorelais')->__($confirm->return->message);
|
222 |
+
echo Mage::helper('core')->jsonEncode($result);
|
223 |
+
exit;
|
224 |
+
}
|
225 |
+
|
226 |
+
} else {
|
227 |
+
if(!Mage::getStoreConfig('onestepcheckout/general/rewrite_checkout_links')) {
|
228 |
+
$result['error'] = true;
|
229 |
+
$result['message'] = Mage::helper('chronorelais')->__('Veuillez sélectionner votre horaire de rendez-vous');
|
230 |
+
echo Mage::helper('core')->jsonEncode($result);
|
231 |
+
exit;
|
232 |
+
}
|
233 |
+
}
|
234 |
+
}
|
235 |
+
|
236 |
+
$methodTitle = "";
|
237 |
+
if (isset($relais->localite)) {
|
238 |
+
$methodTitle = ' - ' . $relais->nomEnseigne . ' - ' . trim($relais->adresse1 . " " . $relais->adresse2 . " " . $relais->adresse3) . ' - ' . $relais->codePostal . ' - ' . $relais->localite;
|
239 |
+
}
|
240 |
+
if ($method) {
|
241 |
+
foreach ($address->getAllShippingRates() as $rate) {
|
242 |
+
if ($rate->getCode() == $method) {
|
243 |
+
$address->setShippingDescription($rate->getCarrierTitle() . ' - ' . $rate->getMethodTitle() . $methodTitle);
|
244 |
+
break;
|
245 |
+
}
|
246 |
+
}
|
247 |
+
}
|
248 |
+
//ENDWEC chronorelais
|
249 |
+
}
|
250 |
+
|
251 |
+
public function checkRelayPoint($observer) {
|
252 |
+
|
253 |
+
if(Mage::getStoreConfig('onestepcheckout/general/rewrite_checkout_links')) {
|
254 |
+
$_quote = Mage::helper('checkout')->getQuote();
|
255 |
+
$address = $_quote->getShippingAddress();
|
256 |
+
|
257 |
+
$shippingMethodSelected = $address->getShippingMethod();
|
258 |
+
|
259 |
+
if(strpos($shippingMethodSelected,'chronorelais') !== false) {
|
260 |
+
$relaisId = $_SESSION['chronopost_relais_id'];
|
261 |
+
if ($relaisId == "") {
|
262 |
+
Mage::throwException(Mage::helper('checkout')->__('Veuillez sélectionner votre point relais'));
|
263 |
+
}
|
264 |
+
}
|
265 |
+
}
|
266 |
+
|
267 |
+
unset($_SESSION['chronopostsrdv_creneaux_info']);
|
268 |
+
}
|
269 |
+
|
270 |
+
|
271 |
+
}
|
app/code/community/Chronopost/Chronorelais/Model/Sales/Quote/Address/Total/Shipping.php
CHANGED
@@ -1,207 +1,206 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_Sales
|
23 |
-
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
|
28 |
-
class Chronopost_Chronorelais_Model_Sales_Quote_Address_Total_Shipping extends Mage_Sales_Model_Quote_Address_Total_Abstract
|
29 |
-
{
|
30 |
-
public function __construct()
|
31 |
-
{
|
32 |
-
$this->setCode('shipping');
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Collect totals information about shipping
|
37 |
-
*
|
38 |
-
* @param Mage_Sales_Model_Quote_Address $address
|
39 |
-
* @return Mage_Sales_Model_Quote_Address_Total_Shipping
|
40 |
-
*/
|
41 |
-
public function collect(Mage_Sales_Model_Quote_Address $address)
|
42 |
-
{
|
43 |
-
parent::collect($address);
|
44 |
-
|
45 |
-
$
|
46 |
-
$address->
|
47 |
-
$
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
$
|
57 |
-
|
58 |
-
|
59 |
-
$
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
$
|
88 |
-
$
|
89 |
-
$
|
90 |
-
$
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
$freeQty
|
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 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
$address->
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
$
|
166 |
-
$this->
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
*
|
181 |
-
*
|
182 |
-
* @
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
$amount
|
188 |
-
|
189 |
-
|
190 |
-
'
|
191 |
-
'
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
*
|
200 |
-
*
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Sales
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
class Chronopost_Chronorelais_Model_Sales_Quote_Address_Total_Shipping extends Mage_Sales_Model_Quote_Address_Total_Abstract
|
29 |
+
{
|
30 |
+
public function __construct()
|
31 |
+
{
|
32 |
+
$this->setCode('shipping');
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Collect totals information about shipping
|
37 |
+
*
|
38 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
39 |
+
* @return Mage_Sales_Model_Quote_Address_Total_Shipping
|
40 |
+
*/
|
41 |
+
public function collect(Mage_Sales_Model_Quote_Address $address)
|
42 |
+
{
|
43 |
+
parent::collect($address);
|
44 |
+
|
45 |
+
$address->setWeight(0);
|
46 |
+
$address->setFreeMethodWeight(0);
|
47 |
+
$this->_setAmount(0)
|
48 |
+
->_setBaseAmount(0);
|
49 |
+
|
50 |
+
$items = $this->_getAddressItems($address);
|
51 |
+
if (!count($items)) {
|
52 |
+
return $this;
|
53 |
+
}
|
54 |
+
|
55 |
+
$method = $address->getShippingMethod();
|
56 |
+
$freeAddress= $address->getFreeShipping();
|
57 |
+
|
58 |
+
$addressWeight = $address->getWeight();
|
59 |
+
$freeMethodWeight = $address->getFreeMethodWeight();
|
60 |
+
|
61 |
+
$addressQty = 0;
|
62 |
+
|
63 |
+
foreach ($items as $item) {
|
64 |
+
/**
|
65 |
+
* Skip if this item is virtual
|
66 |
+
*/
|
67 |
+
if ($item->getProduct()->isVirtual()) {
|
68 |
+
continue;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Children weight we calculate for parent
|
73 |
+
*/
|
74 |
+
if ($item->getParentItem()) {
|
75 |
+
continue;
|
76 |
+
}
|
77 |
+
|
78 |
+
if ($item->getHasChildren() && $item->isShipSeparately()) {
|
79 |
+
foreach ($item->getChildren() as $child) {
|
80 |
+
if ($child->getProduct()->isVirtual()) {
|
81 |
+
continue;
|
82 |
+
}
|
83 |
+
$addressQty += $child->getTotalQty();
|
84 |
+
|
85 |
+
if (!$item->getProduct()->getWeightType()) {
|
86 |
+
$itemWeight = $child->getWeight();
|
87 |
+
$itemQty = $child->getTotalQty();
|
88 |
+
$rowWeight = $itemWeight*$itemQty;
|
89 |
+
$addressWeight += $rowWeight;
|
90 |
+
if ($freeAddress || $child->getFreeShipping()===true) {
|
91 |
+
$rowWeight = 0;
|
92 |
+
} elseif (is_numeric($child->getFreeShipping())) {
|
93 |
+
$freeQty = $child->getFreeShipping();
|
94 |
+
if ($itemQty>$freeQty) {
|
95 |
+
$rowWeight = $itemWeight*($itemQty-$freeQty);
|
96 |
+
}
|
97 |
+
else {
|
98 |
+
$rowWeight = 0;
|
99 |
+
}
|
100 |
+
}
|
101 |
+
$freeMethodWeight += $rowWeight;
|
102 |
+
$item->setRowWeight($rowWeight);
|
103 |
+
}
|
104 |
+
}
|
105 |
+
if ($item->getProduct()->getWeightType()) {
|
106 |
+
$itemWeight = $item->getWeight();
|
107 |
+
$rowWeight = $itemWeight*$item->getQty();
|
108 |
+
$addressWeight+= $rowWeight;
|
109 |
+
if ($freeAddress || $item->getFreeShipping()===true) {
|
110 |
+
$rowWeight = 0;
|
111 |
+
} elseif (is_numeric($item->getFreeShipping())) {
|
112 |
+
$freeQty = $item->getFreeShipping();
|
113 |
+
if ($item->getQty()>$freeQty) {
|
114 |
+
$rowWeight = $itemWeight*($item->getQty()-$freeQty);
|
115 |
+
}
|
116 |
+
else {
|
117 |
+
$rowWeight = 0;
|
118 |
+
}
|
119 |
+
}
|
120 |
+
$freeMethodWeight+= $rowWeight;
|
121 |
+
$item->setRowWeight($rowWeight);
|
122 |
+
}
|
123 |
+
}
|
124 |
+
else {
|
125 |
+
if (!$item->getProduct()->isVirtual()) {
|
126 |
+
$addressQty += $item->getQty();
|
127 |
+
}
|
128 |
+
$itemWeight = $item->getWeight();
|
129 |
+
$rowWeight = $itemWeight*$item->getQty();
|
130 |
+
$addressWeight+= $rowWeight;
|
131 |
+
if ($freeAddress || $item->getFreeShipping()===true) {
|
132 |
+
$rowWeight = 0;
|
133 |
+
} elseif (is_numeric($item->getFreeShipping())) {
|
134 |
+
$freeQty = $item->getFreeShipping();
|
135 |
+
if ($item->getQty()>$freeQty) {
|
136 |
+
$rowWeight = $itemWeight*($item->getQty()-$freeQty);
|
137 |
+
}
|
138 |
+
else {
|
139 |
+
$rowWeight = 0;
|
140 |
+
}
|
141 |
+
}
|
142 |
+
$freeMethodWeight+= $rowWeight;
|
143 |
+
$item->setRowWeight($rowWeight);
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
if (isset($addressQty)) {
|
148 |
+
$address->setItemQty($addressQty);
|
149 |
+
}
|
150 |
+
|
151 |
+
$address->setWeight($addressWeight);
|
152 |
+
$address->setFreeMethodWeight($freeMethodWeight);
|
153 |
+
|
154 |
+
$address->collectShippingRates();
|
155 |
+
|
156 |
+
$this->_setAmount(0)
|
157 |
+
->_setBaseAmount(0);
|
158 |
+
|
159 |
+
$method = $address->getShippingMethod();
|
160 |
+
|
161 |
+
if ($method) {
|
162 |
+
foreach ($address->getAllShippingRates() as $rate) {
|
163 |
+
if ($rate->getCode()==$method) {
|
164 |
+
$amountPrice = $address->getQuote()->getStore()->convertPrice($rate->getPrice(), false);
|
165 |
+
$this->_setAmount($amountPrice);
|
166 |
+
$this->_setBaseAmount($rate->getPrice());
|
167 |
+
if(!$address->getShippingDescription()) {
|
168 |
+
$address->setShippingDescription($rate->getCarrierTitle().' - '.$rate->getMethodTitle());
|
169 |
+
}
|
170 |
+
break;
|
171 |
+
}
|
172 |
+
}
|
173 |
+
}
|
174 |
+
|
175 |
+
return $this;
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Add shipping totals information to address object
|
180 |
+
*
|
181 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
182 |
+
* @return Mage_Sales_Model_Quote_Address_Total_Shipping
|
183 |
+
*/
|
184 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address)
|
185 |
+
{
|
186 |
+
$amount = $address->getShippingAmount();
|
187 |
+
if ($amount!=0 || $address->getShippingDescription()) {
|
188 |
+
$address->addTotal(array(
|
189 |
+
'code'=>$this->getCode(),
|
190 |
+
'title'=>Mage::helper('sales')->__('Shipping & Handling').' ('.$address->getShippingDescription().')',
|
191 |
+
'value'=>$address->getShippingAmount()
|
192 |
+
));
|
193 |
+
}
|
194 |
+
return $this;
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Get Shipping label
|
199 |
+
*
|
200 |
+
* @return string
|
201 |
+
*/
|
202 |
+
public function getLabel()
|
203 |
+
{
|
204 |
+
return Mage::helper('sales')->__('Shipping');
|
205 |
+
}
|
206 |
+
}
|
|
app/code/community/Chronopost/Chronorelais/Model/Sales/Quote/Address/Total/Shipping.toDel.php
CHANGED
@@ -1,207 +1,206 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_Sales
|
23 |
-
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
|
28 |
-
class Chronopost_Chronorelais_Model_Sales_Quote_Address_Total_Shipping extends Mage_Sales_Model_Quote_Address_Total_Abstract
|
29 |
-
{
|
30 |
-
public function __construct()
|
31 |
-
{
|
32 |
-
$this->setCode('shipping');
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Collect totals information about shipping
|
37 |
-
*
|
38 |
-
* @param Mage_Sales_Model_Quote_Address $address
|
39 |
-
* @return Mage_Sales_Model_Quote_Address_Total_Shipping
|
40 |
-
*/
|
41 |
-
public function collect(Mage_Sales_Model_Quote_Address $address)
|
42 |
-
{
|
43 |
-
parent::collect($address);
|
44 |
-
|
45 |
-
$
|
46 |
-
$address->
|
47 |
-
$
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
$
|
57 |
-
|
58 |
-
|
59 |
-
$
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
$
|
88 |
-
$
|
89 |
-
$
|
90 |
-
$
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
$freeQty
|
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 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
$address->
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
$
|
166 |
-
$this->
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
*
|
181 |
-
*
|
182 |
-
* @
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
$amount
|
188 |
-
|
189 |
-
|
190 |
-
'
|
191 |
-
'
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
*
|
200 |
-
*
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Sales
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
class Chronopost_Chronorelais_Model_Sales_Quote_Address_Total_Shipping extends Mage_Sales_Model_Quote_Address_Total_Abstract
|
29 |
+
{
|
30 |
+
public function __construct()
|
31 |
+
{
|
32 |
+
$this->setCode('shipping');
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Collect totals information about shipping
|
37 |
+
*
|
38 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
39 |
+
* @return Mage_Sales_Model_Quote_Address_Total_Shipping
|
40 |
+
*/
|
41 |
+
public function collect(Mage_Sales_Model_Quote_Address $address)
|
42 |
+
{
|
43 |
+
parent::collect($address);
|
44 |
+
|
45 |
+
$address->setWeight(0);
|
46 |
+
$address->setFreeMethodWeight(0);
|
47 |
+
$this->_setAmount(0)
|
48 |
+
->_setBaseAmount(0);
|
49 |
+
|
50 |
+
$items = $this->_getAddressItems($address);
|
51 |
+
if (!count($items)) {
|
52 |
+
return $this;
|
53 |
+
}
|
54 |
+
|
55 |
+
$method = $address->getShippingMethod();
|
56 |
+
$freeAddress= $address->getFreeShipping();
|
57 |
+
|
58 |
+
$addressWeight = $address->getWeight();
|
59 |
+
$freeMethodWeight = $address->getFreeMethodWeight();
|
60 |
+
|
61 |
+
$addressQty = 0;
|
62 |
+
|
63 |
+
foreach ($items as $item) {
|
64 |
+
/**
|
65 |
+
* Skip if this item is virtual
|
66 |
+
*/
|
67 |
+
if ($item->getProduct()->isVirtual()) {
|
68 |
+
continue;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Children weight we calculate for parent
|
73 |
+
*/
|
74 |
+
if ($item->getParentItem()) {
|
75 |
+
continue;
|
76 |
+
}
|
77 |
+
|
78 |
+
if ($item->getHasChildren() && $item->isShipSeparately()) {
|
79 |
+
foreach ($item->getChildren() as $child) {
|
80 |
+
if ($child->getProduct()->isVirtual()) {
|
81 |
+
continue;
|
82 |
+
}
|
83 |
+
$addressQty += $child->getTotalQty();
|
84 |
+
|
85 |
+
if (!$item->getProduct()->getWeightType()) {
|
86 |
+
$itemWeight = $child->getWeight();
|
87 |
+
$itemQty = $child->getTotalQty();
|
88 |
+
$rowWeight = $itemWeight*$itemQty;
|
89 |
+
$addressWeight += $rowWeight;
|
90 |
+
if ($freeAddress || $child->getFreeShipping()===true) {
|
91 |
+
$rowWeight = 0;
|
92 |
+
} elseif (is_numeric($child->getFreeShipping())) {
|
93 |
+
$freeQty = $child->getFreeShipping();
|
94 |
+
if ($itemQty>$freeQty) {
|
95 |
+
$rowWeight = $itemWeight*($itemQty-$freeQty);
|
96 |
+
}
|
97 |
+
else {
|
98 |
+
$rowWeight = 0;
|
99 |
+
}
|
100 |
+
}
|
101 |
+
$freeMethodWeight += $rowWeight;
|
102 |
+
$item->setRowWeight($rowWeight);
|
103 |
+
}
|
104 |
+
}
|
105 |
+
if ($item->getProduct()->getWeightType()) {
|
106 |
+
$itemWeight = $item->getWeight();
|
107 |
+
$rowWeight = $itemWeight*$item->getQty();
|
108 |
+
$addressWeight+= $rowWeight;
|
109 |
+
if ($freeAddress || $item->getFreeShipping()===true) {
|
110 |
+
$rowWeight = 0;
|
111 |
+
} elseif (is_numeric($item->getFreeShipping())) {
|
112 |
+
$freeQty = $item->getFreeShipping();
|
113 |
+
if ($item->getQty()>$freeQty) {
|
114 |
+
$rowWeight = $itemWeight*($item->getQty()-$freeQty);
|
115 |
+
}
|
116 |
+
else {
|
117 |
+
$rowWeight = 0;
|
118 |
+
}
|
119 |
+
}
|
120 |
+
$freeMethodWeight+= $rowWeight;
|
121 |
+
$item->setRowWeight($rowWeight);
|
122 |
+
}
|
123 |
+
}
|
124 |
+
else {
|
125 |
+
if (!$item->getProduct()->isVirtual()) {
|
126 |
+
$addressQty += $item->getQty();
|
127 |
+
}
|
128 |
+
$itemWeight = $item->getWeight();
|
129 |
+
$rowWeight = $itemWeight*$item->getQty();
|
130 |
+
$addressWeight+= $rowWeight;
|
131 |
+
if ($freeAddress || $item->getFreeShipping()===true) {
|
132 |
+
$rowWeight = 0;
|
133 |
+
} elseif (is_numeric($item->getFreeShipping())) {
|
134 |
+
$freeQty = $item->getFreeShipping();
|
135 |
+
if ($item->getQty()>$freeQty) {
|
136 |
+
$rowWeight = $itemWeight*($item->getQty()-$freeQty);
|
137 |
+
}
|
138 |
+
else {
|
139 |
+
$rowWeight = 0;
|
140 |
+
}
|
141 |
+
}
|
142 |
+
$freeMethodWeight+= $rowWeight;
|
143 |
+
$item->setRowWeight($rowWeight);
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
if (isset($addressQty)) {
|
148 |
+
$address->setItemQty($addressQty);
|
149 |
+
}
|
150 |
+
|
151 |
+
$address->setWeight($addressWeight);
|
152 |
+
$address->setFreeMethodWeight($freeMethodWeight);
|
153 |
+
|
154 |
+
$address->collectShippingRates();
|
155 |
+
|
156 |
+
$this->_setAmount(0)
|
157 |
+
->_setBaseAmount(0);
|
158 |
+
|
159 |
+
$method = $address->getShippingMethod();
|
160 |
+
|
161 |
+
if ($method) {
|
162 |
+
foreach ($address->getAllShippingRates() as $rate) {
|
163 |
+
if ($rate->getCode()==$method) {
|
164 |
+
$amountPrice = $address->getQuote()->getStore()->convertPrice($rate->getPrice(), false);
|
165 |
+
$this->_setAmount($amountPrice);
|
166 |
+
$this->_setBaseAmount($rate->getPrice());
|
167 |
+
if(!$address->getShippingDescription()) {
|
168 |
+
$address->setShippingDescription($rate->getCarrierTitle().' - '.$rate->getMethodTitle());
|
169 |
+
}
|
170 |
+
break;
|
171 |
+
}
|
172 |
+
}
|
173 |
+
}
|
174 |
+
|
175 |
+
return $this;
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Add shipping totals information to address object
|
180 |
+
*
|
181 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
182 |
+
* @return Mage_Sales_Model_Quote_Address_Total_Shipping
|
183 |
+
*/
|
184 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address)
|
185 |
+
{
|
186 |
+
$amount = $address->getShippingAmount();
|
187 |
+
if ($amount!=0 || $address->getShippingDescription()) {
|
188 |
+
$address->addTotal(array(
|
189 |
+
'code'=>$this->getCode(),
|
190 |
+
'title'=>Mage::helper('sales')->__('Shipping & Handling').' ('.$address->getShippingDescription().')',
|
191 |
+
'value'=>$address->getShippingAmount()
|
192 |
+
));
|
193 |
+
}
|
194 |
+
return $this;
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Get Shipping label
|
199 |
+
*
|
200 |
+
* @return string
|
201 |
+
*/
|
202 |
+
public function getLabel()
|
203 |
+
{
|
204 |
+
return Mage::helper('sales')->__('Shipping');
|
205 |
+
}
|
206 |
+
}
|
|
app/code/community/Chronopost/Chronorelais/controllers/Adminhtml/Chronorelais/AjaxController.php
CHANGED
@@ -1,446 +1,432 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Magento Chronopost Chronorelais Module
|
5 |
-
*
|
6 |
-
* NOTICE OF LICENSE
|
7 |
-
*
|
8 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
-
* that is bundled with this package in the file LICENSE.txt.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://opensource.org/licenses/osl-3.0.php
|
12 |
-
* If you did not receive a copy of the license and are unable to
|
13 |
-
* obtain it through the world-wide-web, please send an email
|
14 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
-
*
|
16 |
-
* @category Chronopost
|
17 |
-
* @package Chronopost_Chronorelais
|
18 |
-
* @copyright Copyright (c) 2008-10 Owebia (http://www.owebia.com/)
|
19 |
-
* @author Antoine Lemoine
|
20 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
-
*/
|
22 |
-
class Chronopost_Chronorelais_Adminhtml_Chronorelais_AjaxController extends Chronopost_Chronorelais_Controller_Abstract {
|
23 |
-
|
24 |
-
private function getPropertyHelper($row_id, $property_key, $property) {
|
25 |
-
$cleaned_property = $this->cleanKey($property_key);
|
26 |
-
$prefix = "r-" . $row_id . "-p-" . $cleaned_property;
|
27 |
-
$value = isset($property['original_value']) ? $property['original_value'] : (isset($property['value']) ? $property['value'] : '');
|
28 |
-
|
29 |
-
switch ($property_key) {
|
30 |
-
case 'enabled':
|
31 |
-
$enabled = $value !== false;
|
32 |
-
return "<p><select id=\"" . $prefix . "\" class=\"field\">"
|
33 |
-
. "<option value=\"0\"" . ($enabled ? '' : ' selected="selected"') . ">" . $this->__('Disabled') . "</option>"
|
34 |
-
. "<option value=\"1\"" . ($enabled ? ' selected="selected"' : '') . ">" . $this->__('Enabled') . "</option>"
|
35 |
-
. "</select><p>";
|
36 |
-
break;
|
37 |
-
case 'label':
|
38 |
-
case 'description':
|
39 |
-
return "<textarea id=\"" . $prefix . "\" class=\"field\">" . $value . "</textarea>"
|
40 |
-
. "<fieldset class=\"buttons-set\"><legend>" . $this->__('Insert') . "</legend>"
|
41 |
-
. "<p>"
|
42 |
-
. $this->button('Destination country', "ocseditor.insertAtCaret(this,'{destination.country.name}');")
|
43 |
-
. $this->button('Cart weight', "ocseditor.insertAtCaret(this,'{cart.weight}');")
|
44 |
-
. $this->button('Cart quantity', "ocseditor.insertAtCaret(this,'{cart.quantity}');")
|
45 |
-
. $this->button('Price including tax', "ocseditor.insertAtCaret(this,'{cart.price_including_tax}');")
|
46 |
-
. $this->button('Price excluding tax', "ocseditor.insertAtCaret(this,'{cart.price_excluding_tax}');")
|
47 |
-
. "</p>"
|
48 |
-
. "</fieldset>";
|
49 |
-
break;
|
50 |
-
case 'fees':
|
51 |
-
return "<textarea id=\"" . $prefix . "\" class=\"field\">" . $value . "</textarea>"
|
52 |
-
. "<fieldset class=\"buttons-set\"><legend>" . $this->__('Insert') . "</legend>"
|
53 |
-
. "<p><span class=\"buttons-set-label\">" . $this->__('Cart') . "</span>"
|
54 |
-
. $this->button('Weight', "ocseditor.insertAtCaret(this,'{cart.weight}');")
|
55 |
-
. $this->button('Products quantity', "ocseditor.insertAtCaret(this,'{cart.quantity}');")
|
56 |
-
. $this->button('Price including tax', "ocseditor.insertAtCaret(this,'{cart.price_including_tax}');")
|
57 |
-
. $this->button('Price excluding tax', "ocseditor.insertAtCaret(this,'{cart.price_excluding_tax}');")
|
58 |
-
. "</p>"
|
59 |
-
. "<p><span class=\"buttons-set-label\">" . $this->__('Selection') . "</span>"
|
60 |
-
. $this->button('Weight', "ocseditor.insertAtCaret(this,'{selection.weight}');")
|
61 |
-
. $this->button('Products quantity', "ocseditor.insertAtCaret(this,'{selection.quantity}');")
|
62 |
-
. "</p>"
|
63 |
-
. "<p><span class=\"buttons-set-label\">" . $this->__('Product') . "</span>"
|
64 |
-
. $this->button('Weight', "ocseditor.insertAtCaret(this,'{product.weight}');")
|
65 |
-
. $this->button('Quantity', "ocseditor.insertAtCaret(this,'{product.quantity}');")
|
66 |
-
. "</p>"
|
67 |
-
. "</fieldset>";
|
68 |
-
break;
|
69 |
-
case 'conditions':
|
70 |
-
return "<textarea id=\"" . $prefix . "\" class=\"field\">" . $value . "</textarea>"
|
71 |
-
. "<fieldset class=\"buttons-set\"><legend>" . $this->__('Insert') . "</legend>"
|
72 |
-
. "<p><span class=\"buttons-set-label\">" . $this->__('Cart') . "</span>"
|
73 |
-
. $this->button('Weight', "ocseditor.insertAtCaret(this,'{cart.weight}');")
|
74 |
-
. $this->button('Products quantity', "ocseditor.insertAtCaret(this,'{cart.quantity}');")
|
75 |
-
. $this->button('Price including tax', "ocseditor.insertAtCaret(this,'{cart.price_including_tax}');")
|
76 |
-
. $this->button('Price excluding tax', "ocseditor.insertAtCaret(this,'{cart.price_excluding_tax}');")
|
77 |
-
. "</p>"
|
78 |
-
. "</fieldset>";
|
79 |
-
break;
|
80 |
-
case 'customer_groups':
|
81 |
-
return "<textarea id=\"" . $prefix . "\" class=\"field\">" . $value . "</textarea>"
|
82 |
-
. "<fieldset class=\"buttons-set\"><legend>" . $this->__('Insert') . "</legend>"
|
83 |
-
. "<p>"
|
84 |
-
. $this->button('Not logged in', "ocseditor.insertAtCaret(this,'NOT LOGGED IN');")
|
85 |
-
. "</p>"
|
86 |
-
. "</fieldset>";
|
87 |
-
break;
|
88 |
-
case 'tracking_url':
|
89 |
-
return "<textarea id=\"" . $prefix . "\" class=\"field\">" . $value . "</textarea>"
|
90 |
-
. "<fieldset class=\"buttons-set\"><legend>" . $this->__('Insert') . "</legend>"
|
91 |
-
. "<p>"
|
92 |
-
. $this->button('Tracking number', "ocseditor.insertAtCaret(this,'{tracking_number}');")
|
93 |
-
. "</p>"
|
94 |
-
. "</fieldset>";
|
95 |
-
break;
|
96 |
-
case 'destination':
|
97 |
-
case 'origin':
|
98 |
-
$parsed_value = $this->parseAddressFilter($value);
|
99 |
-
$excluding = $parsed_value['excluding'];
|
100 |
-
return "<div class=\"address-filters-property\"><p>"
|
101 |
-
. "<input type=\"radio\" class=\"excluding\" id=\"" . $prefix . "-exluding-0\" name=\"" . $prefix . "-exluding\""
|
102 |
-
. " value=\"0\"" . (!$excluding ? " checked=\"checked\"" : '') . " onclick=\"ocseditor.updateCountries(this);\"/>"
|
103 |
-
. "<label for=\"" . $prefix . "-exluding-0\"> " . $this->__('Limit to') . "</label> "
|
104 |
-
. "<input type=\"radio\" class=\"excluding\" id=\"" . $prefix . "-exluding-1\" name=\"" . $prefix . "-exluding\""
|
105 |
-
. " value=\"1\"" . ($excluding ? " checked=\"checked\"" : '') . " onclick=\"ocseditor.updateCountries(this);\"/>"
|
106 |
-
. "<label for=\"" . $prefix . "-exluding-1\"> " . $this->__('Exclude') . "</label></p>"
|
107 |
-
. "<textarea id=\"" . $prefix . "\" class=\"field\">" . $value . "</textarea>"
|
108 |
-
. "<fieldset class=\"buttons-set\"><legend>" . $this->__('Display') . "</legend>"
|
109 |
-
. "<p>"
|
110 |
-
. $this->button('Display original input', "ocseditor.displayCountry('original-value',this,false);")
|
111 |
-
. $this->button('Display corrected names', "ocseditor.displayCountry('full-value',this,false);")
|
112 |
-
. $this->button('Display codes', "ocseditor.displayCountry('compact-value',this,true);")
|
113 |
-
. "</p>"
|
114 |
-
. "</fieldset>"
|
115 |
-
. "<fieldset class=\"buttons-set\"><legend>" . $this->__('Preview') . "</legend>"
|
116 |
-
. "<div class=\"address-filter-list\">" . $this->getAddressFilters($parsed_value) . "</div>"
|
117 |
-
. "</fieldset>"
|
118 |
-
. "</div>"
|
119 |
-
;
|
120 |
-
break;
|
121 |
-
case '*comment' :
|
122 |
-
$lines = explode("\n", trim($value));
|
123 |
-
for ($i = 0; $i < count($lines); $i++) {
|
124 |
-
$lines[$i] = preg_replace('/^# ?/', '', $lines[$i]);
|
125 |
-
}
|
126 |
-
$value = implode("\n", $lines);
|
127 |
-
return "<textarea id=\"" . $prefix . "\" class=\"field\">" . $value . "</textarea>";
|
128 |
-
default :
|
129 |
-
return "<textarea id=\"" . $prefix . "\" class=\"field\">" . $value . "</textarea>";
|
130 |
-
}
|
131 |
-
}
|
132 |
-
|
133 |
-
private function getAddressFilters($data) {
|
134 |
-
$address_filters = array();
|
135 |
-
foreach ($data['countries'] as $country) {
|
136 |
-
$address_filters[] = new AddressFilter($country);
|
137 |
-
}
|
138 |
-
return implode('', $address_filters);
|
139 |
-
}
|
140 |
-
|
141 |
-
private function parseAddressFilter($address_filter) {
|
142 |
-
$output = array(
|
143 |
-
'excluding' => false,
|
144 |
-
'countries' => array(),
|
145 |
-
'original' => $address_filter,
|
146 |
-
);
|
147 |
-
|
148 |
-
$address_filter = str_replace(array("\r\n", "\r", "\n"), array(',', ',', ','), $address_filter);
|
149 |
-
|
150 |
-
if (preg_match('# *\* *- *\((.*)\) *#s', $address_filter, $result)) {
|
151 |
-
$address_filter = $result[1];
|
152 |
-
$output['excluding'] = true;
|
153 |
-
}
|
154 |
-
|
155 |
-
$tmp_address_filter_array = explode(',', trim($address_filter));
|
156 |
-
|
157 |
-
$concat = false;
|
158 |
-
$concatened = '';
|
159 |
-
$address_filter_array = array();
|
160 |
-
$i = 0;
|
161 |
-
|
162 |
-
foreach ($tmp_address_filter_array as $address_filter) {
|
163 |
-
if ($concat)
|
164 |
-
$concatened .= ',' . $address_filter;
|
165 |
-
else {
|
166 |
-
if ($i < count($tmp_address_filter_array) - 1 && preg_match('#\(#', $address_filter)) {
|
167 |
-
$concat = true;
|
168 |
-
$concatened .= $address_filter;
|
169 |
-
} else
|
170 |
-
$address_filter_array[] = $address_filter;
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
$
|
175 |
-
$
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
$
|
190 |
-
for ($i = count($region_codes); --$i >= 0;) {
|
191 |
-
$code = trim($region_codes[$i]);
|
192 |
-
$region_codes[$i] = $code;
|
193 |
-
}
|
194 |
-
}
|
195 |
-
|
196 |
-
|
197 |
-
$
|
198 |
-
|
199 |
-
'
|
200 |
-
'
|
201 |
-
'
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
'
|
207 |
-
'
|
208 |
-
'
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
$
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
. "<div class=\"row-
|
224 |
-
.
|
225 |
-
. $this->button('
|
226 |
-
.
|
227 |
-
. "</div>"
|
228 |
-
. "<div class=\"
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
'
|
239 |
-
'
|
240 |
-
'
|
241 |
-
'
|
242 |
-
'
|
243 |
-
'
|
244 |
-
'
|
245 |
-
'
|
246 |
-
'
|
247 |
-
'
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
$
|
252 |
-
|
253 |
-
. "<div class=\"row-
|
254 |
-
. "<div class=\"
|
255 |
-
|
256 |
-
$
|
257 |
-
$
|
258 |
-
|
259 |
-
$
|
260 |
-
$
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
. (
|
265 |
-
|
266 |
-
|
267 |
-
.
|
268 |
-
.
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
$
|
275 |
-
$
|
276 |
-
$
|
277 |
-
|
278 |
-
. (
|
279 |
-
|
280 |
-
|
281 |
-
.
|
282 |
-
.
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
$output
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
$
|
293 |
-
|
294 |
-
|
295 |
-
$
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
}
|
302 |
-
foreach ($row as $property_key => $property) {
|
303 |
-
if (isset($property['messages'])) {
|
304 |
-
$error = '';
|
305 |
-
foreach ($property['messages'] as $message) {
|
306 |
-
$error .= "<p>" . $this->__($message) . "</p>";
|
307 |
-
}
|
308 |
-
if ($error != '') {
|
309 |
-
$script .= "ocseditor.setError('" . $row['_ID_']['value'] . "','" . $property_key . "','"
|
310 |
-
. $this->jsEscape($error
|
311 |
-
. ($property['value'] != $property['original_value'] ?
|
312 |
-
"<p>"
|
313 |
-
. $this->button('Correct', "ocseditor.correct('" . $row['_ID_']['value'] . "','" . $property_key . "','" . $this->jsEscape($property['value']) . "');")
|
314 |
-
. "</p>" : '')
|
315 |
-
) . "');";
|
316 |
-
}
|
317 |
-
}
|
318 |
-
}
|
319 |
-
}
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
$helper
|
328 |
-
$helper->
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
//
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
)
|
362 |
-
.
|
363 |
-
. "
|
364 |
-
. "
|
365 |
-
. $this->
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
;
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
$
|
394 |
-
$
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
$
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
'weight' => 1
|
434 |
-
);
|
435 |
-
|
436 |
-
$helperWS = Mage::helper('chronorelais/webservice');
|
437 |
-
$webservbt = (array)$helperWS->checkLogin($WSParams);
|
438 |
-
|
439 |
-
echo json_encode($webservbt);
|
440 |
-
}
|
441 |
-
|
442 |
-
public function checkConflictsAction() {
|
443 |
-
// Vérification
|
444 |
-
echo '<pre style="background: #000; color: #FFF; padding: 5px 10px; margin-top: 5px; border: 1px solid #0F0; font-family: Courier, Sans Serif; white-space: normal; text-indent: -20px; padding-left: 30px; line-height: 15px;">' . Mage::helper('chronorelais/conflicts')->checkForConflicts() . '</pre>';
|
445 |
-
}
|
446 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magento Chronopost Chronorelais Module
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Chronopost
|
17 |
+
* @package Chronopost_Chronorelais
|
18 |
+
* @copyright Copyright (c) 2008-10 Owebia (http://www.owebia.com/)
|
19 |
+
* @author Antoine Lemoine
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Chronopost_Chronorelais_Adminhtml_Chronorelais_AjaxController extends Chronopost_Chronorelais_Controller_Abstract {
|
23 |
+
|
24 |
+
private function getPropertyHelper($row_id, $property_key, $property) {
|
25 |
+
$cleaned_property = $this->cleanKey($property_key);
|
26 |
+
$prefix = "r-" . $row_id . "-p-" . $cleaned_property;
|
27 |
+
$value = isset($property['original_value']) ? $property['original_value'] : (isset($property['value']) ? $property['value'] : '');
|
28 |
+
|
29 |
+
switch ($property_key) {
|
30 |
+
case 'enabled':
|
31 |
+
$enabled = $value !== false;
|
32 |
+
return "<p><select id=\"" . $prefix . "\" class=\"field\">"
|
33 |
+
. "<option value=\"0\"" . ($enabled ? '' : ' selected="selected"') . ">" . $this->__('Disabled') . "</option>"
|
34 |
+
. "<option value=\"1\"" . ($enabled ? ' selected="selected"' : '') . ">" . $this->__('Enabled') . "</option>"
|
35 |
+
. "</select><p>";
|
36 |
+
break;
|
37 |
+
case 'label':
|
38 |
+
case 'description':
|
39 |
+
return "<textarea id=\"" . $prefix . "\" class=\"field\">" . $value . "</textarea>"
|
40 |
+
. "<fieldset class=\"buttons-set\"><legend>" . $this->__('Insert') . "</legend>"
|
41 |
+
. "<p>"
|
42 |
+
. $this->button('Destination country', "ocseditor.insertAtCaret(this,'{destination.country.name}');")
|
43 |
+
. $this->button('Cart weight', "ocseditor.insertAtCaret(this,'{cart.weight}');")
|
44 |
+
. $this->button('Cart quantity', "ocseditor.insertAtCaret(this,'{cart.quantity}');")
|
45 |
+
. $this->button('Price including tax', "ocseditor.insertAtCaret(this,'{cart.price_including_tax}');")
|
46 |
+
. $this->button('Price excluding tax', "ocseditor.insertAtCaret(this,'{cart.price_excluding_tax}');")
|
47 |
+
. "</p>"
|
48 |
+
. "</fieldset>";
|
49 |
+
break;
|
50 |
+
case 'fees':
|
51 |
+
return "<textarea id=\"" . $prefix . "\" class=\"field\">" . $value . "</textarea>"
|
52 |
+
. "<fieldset class=\"buttons-set\"><legend>" . $this->__('Insert') . "</legend>"
|
53 |
+
. "<p><span class=\"buttons-set-label\">" . $this->__('Cart') . "</span>"
|
54 |
+
. $this->button('Weight', "ocseditor.insertAtCaret(this,'{cart.weight}');")
|
55 |
+
. $this->button('Products quantity', "ocseditor.insertAtCaret(this,'{cart.quantity}');")
|
56 |
+
. $this->button('Price including tax', "ocseditor.insertAtCaret(this,'{cart.price_including_tax}');")
|
57 |
+
. $this->button('Price excluding tax', "ocseditor.insertAtCaret(this,'{cart.price_excluding_tax}');")
|
58 |
+
. "</p>"
|
59 |
+
. "<p><span class=\"buttons-set-label\">" . $this->__('Selection') . "</span>"
|
60 |
+
. $this->button('Weight', "ocseditor.insertAtCaret(this,'{selection.weight}');")
|
61 |
+
. $this->button('Products quantity', "ocseditor.insertAtCaret(this,'{selection.quantity}');")
|
62 |
+
. "</p>"
|
63 |
+
. "<p><span class=\"buttons-set-label\">" . $this->__('Product') . "</span>"
|
64 |
+
. $this->button('Weight', "ocseditor.insertAtCaret(this,'{product.weight}');")
|
65 |
+
. $this->button('Quantity', "ocseditor.insertAtCaret(this,'{product.quantity}');")
|
66 |
+
. "</p>"
|
67 |
+
. "</fieldset>";
|
68 |
+
break;
|
69 |
+
case 'conditions':
|
70 |
+
return "<textarea id=\"" . $prefix . "\" class=\"field\">" . $value . "</textarea>"
|
71 |
+
. "<fieldset class=\"buttons-set\"><legend>" . $this->__('Insert') . "</legend>"
|
72 |
+
. "<p><span class=\"buttons-set-label\">" . $this->__('Cart') . "</span>"
|
73 |
+
. $this->button('Weight', "ocseditor.insertAtCaret(this,'{cart.weight}');")
|
74 |
+
. $this->button('Products quantity', "ocseditor.insertAtCaret(this,'{cart.quantity}');")
|
75 |
+
. $this->button('Price including tax', "ocseditor.insertAtCaret(this,'{cart.price_including_tax}');")
|
76 |
+
. $this->button('Price excluding tax', "ocseditor.insertAtCaret(this,'{cart.price_excluding_tax}');")
|
77 |
+
. "</p>"
|
78 |
+
. "</fieldset>";
|
79 |
+
break;
|
80 |
+
case 'customer_groups':
|
81 |
+
return "<textarea id=\"" . $prefix . "\" class=\"field\">" . $value . "</textarea>"
|
82 |
+
. "<fieldset class=\"buttons-set\"><legend>" . $this->__('Insert') . "</legend>"
|
83 |
+
. "<p>"
|
84 |
+
. $this->button('Not logged in', "ocseditor.insertAtCaret(this,'NOT LOGGED IN');")
|
85 |
+
. "</p>"
|
86 |
+
. "</fieldset>";
|
87 |
+
break;
|
88 |
+
case 'tracking_url':
|
89 |
+
return "<textarea id=\"" . $prefix . "\" class=\"field\">" . $value . "</textarea>"
|
90 |
+
. "<fieldset class=\"buttons-set\"><legend>" . $this->__('Insert') . "</legend>"
|
91 |
+
. "<p>"
|
92 |
+
. $this->button('Tracking number', "ocseditor.insertAtCaret(this,'{tracking_number}');")
|
93 |
+
. "</p>"
|
94 |
+
. "</fieldset>";
|
95 |
+
break;
|
96 |
+
case 'destination':
|
97 |
+
case 'origin':
|
98 |
+
$parsed_value = $this->parseAddressFilter($value);
|
99 |
+
$excluding = $parsed_value['excluding'];
|
100 |
+
return "<div class=\"address-filters-property\"><p>"
|
101 |
+
. "<input type=\"radio\" class=\"excluding\" id=\"" . $prefix . "-exluding-0\" name=\"" . $prefix . "-exluding\""
|
102 |
+
. " value=\"0\"" . (!$excluding ? " checked=\"checked\"" : '') . " onclick=\"ocseditor.updateCountries(this);\"/>"
|
103 |
+
. "<label for=\"" . $prefix . "-exluding-0\"> " . $this->__('Limit to') . "</label> "
|
104 |
+
. "<input type=\"radio\" class=\"excluding\" id=\"" . $prefix . "-exluding-1\" name=\"" . $prefix . "-exluding\""
|
105 |
+
. " value=\"1\"" . ($excluding ? " checked=\"checked\"" : '') . " onclick=\"ocseditor.updateCountries(this);\"/>"
|
106 |
+
. "<label for=\"" . $prefix . "-exluding-1\"> " . $this->__('Exclude') . "</label></p>"
|
107 |
+
. "<textarea id=\"" . $prefix . "\" class=\"field\">" . $value . "</textarea>"
|
108 |
+
. "<fieldset class=\"buttons-set\"><legend>" . $this->__('Display') . "</legend>"
|
109 |
+
. "<p>"
|
110 |
+
. $this->button('Display original input', "ocseditor.displayCountry('original-value',this,false);")
|
111 |
+
. $this->button('Display corrected names', "ocseditor.displayCountry('full-value',this,false);")
|
112 |
+
. $this->button('Display codes', "ocseditor.displayCountry('compact-value',this,true);")
|
113 |
+
. "</p>"
|
114 |
+
. "</fieldset>"
|
115 |
+
. "<fieldset class=\"buttons-set\"><legend>" . $this->__('Preview') . "</legend>"
|
116 |
+
. "<div class=\"address-filter-list\">" . $this->getAddressFilters($parsed_value) . "</div>"
|
117 |
+
. "</fieldset>"
|
118 |
+
. "</div>"
|
119 |
+
;
|
120 |
+
break;
|
121 |
+
case '*comment' :
|
122 |
+
$lines = explode("\n", trim($value));
|
123 |
+
for ($i = 0; $i < count($lines); $i++) {
|
124 |
+
$lines[$i] = preg_replace('/^# ?/', '', $lines[$i]);
|
125 |
+
}
|
126 |
+
$value = implode("\n", $lines);
|
127 |
+
return "<textarea id=\"" . $prefix . "\" class=\"field\">" . $value . "</textarea>";
|
128 |
+
default :
|
129 |
+
return "<textarea id=\"" . $prefix . "\" class=\"field\">" . $value . "</textarea>";
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
private function getAddressFilters($data) {
|
134 |
+
$address_filters = array();
|
135 |
+
foreach ($data['countries'] as $country) {
|
136 |
+
$address_filters[] = new AddressFilter($country);
|
137 |
+
}
|
138 |
+
return implode('', $address_filters);
|
139 |
+
}
|
140 |
+
|
141 |
+
private function parseAddressFilter($address_filter) {
|
142 |
+
$output = array(
|
143 |
+
'excluding' => false,
|
144 |
+
'countries' => array(),
|
145 |
+
'original' => $address_filter,
|
146 |
+
);
|
147 |
+
|
148 |
+
$address_filter = str_replace(array("\r\n", "\r", "\n"), array(',', ',', ','), $address_filter);
|
149 |
+
|
150 |
+
if (preg_match('# *\* *- *\((.*)\) *#s', $address_filter, $result)) {
|
151 |
+
$address_filter = $result[1];
|
152 |
+
$output['excluding'] = true;
|
153 |
+
}
|
154 |
+
|
155 |
+
$tmp_address_filter_array = explode(',', trim($address_filter));
|
156 |
+
|
157 |
+
$concat = false;
|
158 |
+
$concatened = '';
|
159 |
+
$address_filter_array = array();
|
160 |
+
$i = 0;
|
161 |
+
|
162 |
+
foreach ($tmp_address_filter_array as $address_filter) {
|
163 |
+
if ($concat) {
|
164 |
+
$concatened .= ',' . $address_filter;
|
165 |
+
} else {
|
166 |
+
if ($i < count($tmp_address_filter_array) - 1 && preg_match('#\(#', $address_filter)) {
|
167 |
+
$concat = true;
|
168 |
+
$concatened .= $address_filter;
|
169 |
+
} else {
|
170 |
+
$address_filter_array[] = $address_filter;
|
171 |
+
}
|
172 |
+
}
|
173 |
+
if (preg_match('#\)#', $address_filter)) {
|
174 |
+
$address_filter_array[] = $concatened;
|
175 |
+
$concatened = '';
|
176 |
+
$concat = false;
|
177 |
+
}
|
178 |
+
$i++;
|
179 |
+
}
|
180 |
+
|
181 |
+
foreach ($address_filter_array as $address_filter) {
|
182 |
+
$address_filter = trim($address_filter);
|
183 |
+
if (trim($address_filter) != '') {
|
184 |
+
if (preg_match('# *([^,(]+) *(-)? *(?:\( *(-)? *(.*)\))? *#s', $address_filter, $result)) {
|
185 |
+
$country_code = $result[1];
|
186 |
+
|
187 |
+
$region_codes = array();
|
188 |
+
if(isset($result[4])) {
|
189 |
+
$region_codes = explode(',', $result[4]);
|
190 |
+
for ($i = count($region_codes); --$i >= 0;) {
|
191 |
+
$code = trim($region_codes[$i]);
|
192 |
+
$region_codes[$i] = $code;
|
193 |
+
}
|
194 |
+
}
|
195 |
+
|
196 |
+
$excluding_region = (isset($result[2]) && $result[2] == '-') || (isset($result[3]) && $result[3] == '-');
|
197 |
+
$output['countries'][] = array(
|
198 |
+
'excluding' => $excluding_region,
|
199 |
+
'country_code' => $country_code,
|
200 |
+
'region_codes' => implode(',', $region_codes),
|
201 |
+
'original' => $address_filter,
|
202 |
+
);
|
203 |
+
} else {
|
204 |
+
$output['countries'][] = array(
|
205 |
+
'excluding' => null,
|
206 |
+
'country_code' => $address_filter,
|
207 |
+
'region_codes' => null,
|
208 |
+
'original' => $address_filter,
|
209 |
+
);
|
210 |
+
}
|
211 |
+
}
|
212 |
+
}
|
213 |
+
return $output;
|
214 |
+
}
|
215 |
+
|
216 |
+
private function getRowUI($row, $selected) {
|
217 |
+
$row['_ID_']['value'] = isset($row['_ID_']['value']) ? $row['_ID_']['value'] : uniqid('c');
|
218 |
+
$row_id = $row['_ID_']['value'];
|
219 |
+
|
220 |
+
if (isset($row['lines'])) {
|
221 |
+
$output = "<div id=\"r-" . $row_id . "-container\" class=\"row-container has-error ignored-lines" . ($selected ? ' selected' : '') . "\">"
|
222 |
+
. "<div class=\"row-header\" onclick=\"ocseditor.selectRow('" . $row_id . "');\">"
|
223 |
+
. "<div class=\"row-actions\">"
|
224 |
+
. $this->button('Apply changes', "ocseditor.applyChanges();")
|
225 |
+
. $this->button('Delete', "ocseditor.removeRow(this);", 'delete')
|
226 |
+
. "</div>"
|
227 |
+
. "<div class=\"row-title\">" . $this->__('Ignored lines') . "</div></div>"
|
228 |
+
. "<div class=\"properties-container\"><textarea class=\"field\">" . $row['lines'] . "</textarea></div></div>";
|
229 |
+
return $output;
|
230 |
+
}
|
231 |
+
|
232 |
+
if (!isset($row['label'])) {
|
233 |
+
$row['label']['value'] = $this->__('New shipping method');
|
234 |
+
}
|
235 |
+
|
236 |
+
$properties = array(
|
237 |
+
'enabled' => 'Enabled',
|
238 |
+
'code' => 'Code',
|
239 |
+
'label' => 'Label',
|
240 |
+
'description' => 'Description',
|
241 |
+
'destination' => 'Destination',
|
242 |
+
'origin' => 'Origin',
|
243 |
+
'conditions' => 'Conditions',
|
244 |
+
'fees' => 'Fees',
|
245 |
+
'customer_groups' => 'Customer groups',
|
246 |
+
'tracking_url' => 'Tracking url',
|
247 |
+
'*comment' => 'Comment',
|
248 |
+
);
|
249 |
+
|
250 |
+
$label = $row['label']['value'];
|
251 |
+
$output = "<div id=\"r-" . $row_id . "-container\" class=\"row-container" . ($selected ? ' selected' : '') . "\">"
|
252 |
+
. "<div class=\"row-header\" onclick=\"ocseditor.selectRow('" . $row_id . "');\">"
|
253 |
+
. "<div class=\"row-actions\">" . $this->button('Delete', "ocseditor.removeRow(this);", 'delete') . "</div><div class=\"row-title\">" . $label . "</div></div>"
|
254 |
+
. "<div class=\"properties-container\">";
|
255 |
+
$list = "<ul class=\"properties-list\">";
|
256 |
+
$j = 0;
|
257 |
+
foreach ($properties as $property_key => $label) {
|
258 |
+
$cleaned_property = $this->cleanKey($property_key);
|
259 |
+
$value = isset($row[$property_key]) ? trim($row[$property_key]['value']) : '';
|
260 |
+
$property = isset($row[$property_key]) ? $row[$property_key] : '';
|
261 |
+
|
262 |
+
$list .= "<li id=\"r-" . $row_id . "-p-" . $cleaned_property . "-item\" class=\"property-item" . ($j == 0 ? ' selected' : '')
|
263 |
+
. (empty($value) ? ' empty' : '')
|
264 |
+
. "\" onclick=\"ocseditor.selectProperty('" . $row_id . "','" . $cleaned_property . "');\">" . $this->__($label) . "</li>";
|
265 |
+
$output .= "<div id=\"r-" . $row_id . "-p-" . $cleaned_property . "-container\" class=\"property-container"
|
266 |
+
. ($j == 0 ? ' selected' : '') . "\" property-name=\"" . $property_key . "\">"
|
267 |
+
. "<div class=\"buttons-set\" style=\"text-align:right;\">" . $this->button('Help', "ocseditor.help('property." . $property_key . "');", 'help') . "</div>"
|
268 |
+
. $this->getPropertyHelper($row_id, $property_key, $property) . "</div>";
|
269 |
+
$j++;
|
270 |
+
}
|
271 |
+
foreach ($row as $property_key => $property) {
|
272 |
+
if (!isset($properties[$property_key]) && substr($property_key, 0, 1) != '*') {
|
273 |
+
$label = $property_key;
|
274 |
+
$cleaned_property = $this->cleanKey($property_key);
|
275 |
+
$value = isset($row[$property_key]) ? trim($row[$property_key]['value']) : '';
|
276 |
+
$list .= "<li id=\"r-" . $row_id . "-p-" . $cleaned_property . "-item\" class=\"property-item" . ($j == 0 ? ' selected' : '')
|
277 |
+
. (empty($value) ? ' empty' : '') . ($cleaned_property == '_ID_' ? ' hide' : '')
|
278 |
+
. "\" onclick=\"ocseditor.selectProperty('" . $row_id . "','" . $cleaned_property . "');\">" . $this->__($label) . "</li>";
|
279 |
+
$output .= "<div id=\"r-" . $row_id . "-p-" . $cleaned_property . "-container\" class=\"property-container"
|
280 |
+
. ($j == 0 ? ' selected' : '') . "\" property-name=\"" . $property_key . "\">"
|
281 |
+
. "<div class=\"buttons-set\" style=\"text-align:right;\">" . $this->button('Help', "ocseditor.help('property." . $property_key . "');", 'help') . "</div>"
|
282 |
+
. $this->getPropertyHelper($row_id, $property_key, $property) . "</div>";
|
283 |
+
$j++;
|
284 |
+
}
|
285 |
+
}
|
286 |
+
$output .= $list . "</div></div>";
|
287 |
+
return $output;
|
288 |
+
}
|
289 |
+
|
290 |
+
private function getConfigErrors($config) {
|
291 |
+
$script = "ocseditor.resetErrors();";
|
292 |
+
foreach ($config as $row) {
|
293 |
+
if (isset($row['*messages'])) {
|
294 |
+
$error = '';
|
295 |
+
foreach ($row['*messages'] as $message) {
|
296 |
+
$error .= "<p>" . $this->__($message) . "</p>";
|
297 |
+
}
|
298 |
+
if ($error != '') {
|
299 |
+
$script .= "ocseditor.setError('" . $row['_ID_']['value'] . "','','" . $this->jsEscape($error) . "');";
|
300 |
+
}
|
301 |
+
}
|
302 |
+
foreach ($row as $property_key => $property) {
|
303 |
+
if (isset($property['messages'])) {
|
304 |
+
$error = '';
|
305 |
+
foreach ($property['messages'] as $message) {
|
306 |
+
$error .= "<p>" . $this->__($message) . "</p>";
|
307 |
+
}
|
308 |
+
if ($error != '') {
|
309 |
+
$script .= "ocseditor.setError('" . $row['_ID_']['value'] . "','" . $property_key . "','"
|
310 |
+
. $this->jsEscape($error
|
311 |
+
. ($property['value'] != $property['original_value'] ?
|
312 |
+
"<p>"
|
313 |
+
. $this->button('Correct', "ocseditor.correct('" . $row['_ID_']['value'] . "','" . $property_key . "','" . $this->jsEscape($property['value']) . "');")
|
314 |
+
. "</p>" : '')
|
315 |
+
) . "');";
|
316 |
+
}
|
317 |
+
}
|
318 |
+
}
|
319 |
+
}
|
320 |
+
return $script;
|
321 |
+
}
|
322 |
+
|
323 |
+
private function loadConfig($input) {
|
324 |
+
include_once $this->getIncludingPath('ChronorelaisShippingHelper.php');
|
325 |
+
|
326 |
+
$helper = new ChronorelaisShippingHelper($input);
|
327 |
+
$helper->checkConfig();
|
328 |
+
$config = $helper->getConfig();
|
329 |
+
|
330 |
+
$output = "<div class=\"buttons-set\">"
|
331 |
+
. $this->button('Add a shipping method', "ocseditor.addRow();", 'add')
|
332 |
+
. "</div><div class=\"config-container\">";
|
333 |
+
$i = 0;
|
334 |
+
foreach ($config as &$row) {
|
335 |
+
$output .= $this->getRowUI($row, $i == 0);
|
336 |
+
$i++;
|
337 |
+
}
|
338 |
+
$output .= "</div><script type=\"text/javascript\">" . $this->getConfigErrors($config) . "</script>";
|
339 |
+
return $output;
|
340 |
+
}
|
341 |
+
|
342 |
+
public function indexAction() {
|
343 |
+
header('Content-Type: text/html; charset=UTF-8');
|
344 |
+
|
345 |
+
include_once $this->getIncludingPath('countries.inc.php');
|
346 |
+
|
347 |
+
switch ($_POST['what']) {
|
348 |
+
case 'open':
|
349 |
+
$output = ""
|
350 |
+
// Help page
|
351 |
+
. $this->page('help', "Chronorelais Shipping extension help", '')
|
352 |
+
// Main page
|
353 |
+
. $this->pageHeader("Chronorelais Shipping configuration editor", $this->button('Save', "ocseditor.save();", 'save')
|
354 |
+
. $this->button('Export', "ocseditor.saveToFile();", '')
|
355 |
+
. $this->button('Load', "ocseditor.showConfigLoader();", '')
|
356 |
+
. $this->button('Close', "ocseditor.close();", 'cancel')
|
357 |
+
)
|
358 |
+
. "<div id=\"ocs-editor-config-loader\">"
|
359 |
+
. "<textarea></textarea>"
|
360 |
+
. "<div class=\"buttons-set\">"
|
361 |
+
. $this->button('Load', "ocseditor.loadConfig();", '')
|
362 |
+
. $this->button('Cancel', "ocseditor.hideConfigLoader();", 'cancel')
|
363 |
+
. "</div>"
|
364 |
+
. "</div>"
|
365 |
+
. "<div id=\"ocs-editor-config-container\">" . $this->loadConfig($_POST['input']) . "</div>";
|
366 |
+
echo $output;
|
367 |
+
exit;
|
368 |
+
case 'help':
|
369 |
+
echo $this->__('{ocseditor.help.' . $_POST['input'] . '}');
|
370 |
+
exit;
|
371 |
+
case 'add-row':
|
372 |
+
echo $this->getRowUI(array(), true);
|
373 |
+
exit;
|
374 |
+
case 'load-config':
|
375 |
+
echo $this->loadConfig($_POST['config']);
|
376 |
+
exit;
|
377 |
+
case 'check-config':
|
378 |
+
include_once $this->getIncludingPath('ChronorelaisShippingHelper.php');
|
379 |
+
|
380 |
+
$helper = new ChronorelaisShippingHelper(urldecode($_POST['config']));
|
381 |
+
$helper->checkConfig();
|
382 |
+
print_r($helper->getConfig(), $out);
|
383 |
+
$script = $this->getConfigErrors($helper->getConfig());
|
384 |
+
break;
|
385 |
+
case 'save-to-file':
|
386 |
+
include_once $this->getIncludingPath('ChronorelaisShippingHelper.php');
|
387 |
+
|
388 |
+
$helper = new ChronorelaisShippingHelper(urldecode($_POST['config']));
|
389 |
+
$formatted_config = $helper->formatConfig(false);
|
390 |
+
$this->forceDownload('chronorelais-shipping-config.txt', $formatted_config);
|
391 |
+
exit;
|
392 |
+
case 'get-address-filters':
|
393 |
+
$result = $this->parseAddressFilter($_POST['input']);
|
394 |
+
echo $this->getAddressFilters($result);
|
395 |
+
exit;
|
396 |
+
default:
|
397 |
+
break;
|
398 |
+
}
|
399 |
+
|
400 |
+
echo "<script type=\"text/javascript\">" . $script . "</script>";
|
401 |
+
exit;
|
402 |
+
}
|
403 |
+
|
404 |
+
public function checkloginAction() {
|
405 |
+
$params = $this->getRequest()->getParams();
|
406 |
+
$account_number = $params['account_number'];
|
407 |
+
$account_pass = $params['account_pass'];
|
408 |
+
$helper = Mage::helper('chronorelais');
|
409 |
+
|
410 |
+
$WSParams = array(
|
411 |
+
'accountNumber' => $account_number,
|
412 |
+
'password' => $account_pass,
|
413 |
+
'depCountryCode' => $helper->getConfigurationShipperInfo('country'),
|
414 |
+
'depZipCode' => $helper->getConfigurationShipperInfo('zipcode'),
|
415 |
+
'arrCountryCode' => $helper->getConfigurationShipperInfo('country'),
|
416 |
+
'arrZipCode' => $helper->getConfigurationShipperInfo('zipcode'),
|
417 |
+
'arrCity' => $helper->getConfigurationShipperInfo('city'),
|
418 |
+
'type' => 'M',
|
419 |
+
'weight' => 1
|
420 |
+
);
|
421 |
+
|
422 |
+
$helperWS = Mage::helper('chronorelais/webservice');
|
423 |
+
$webservbt = (array)$helperWS->checkLogin($WSParams);
|
424 |
+
|
425 |
+
echo json_encode($webservbt);
|
426 |
+
}
|
427 |
+
|
428 |
+
public function checkConflictsAction() {
|
429 |
+
// Vérification
|
430 |
+
echo '<pre style="background: #000; color: #FFF; padding: 5px 10px; margin-top: 5px; border: 1px solid #0F0; font-family: Courier, Sans Serif; white-space: normal; text-indent: -20px; padding-left: 30px; line-height: 15px;">' . Mage::helper('chronorelais/conflicts')->checkForConflicts() . '</pre>';
|
431 |
+
}
|
432 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Chronopost/Chronorelais/controllers/Adminhtml/Chronorelais/ExportController.php
CHANGED
@@ -1,448 +1,635 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Chronopost_Chronorelais_Adminhtml_Chronorelais_ExportController extends Mage_Adminhtml_Controller_Action {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Constructor
|
7 |
-
*/
|
8 |
-
protected function _construct() {
|
9 |
-
$this->setUsedModuleName('Chronopost_Chronorelais');
|
10 |
-
}
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
}
|
25 |
-
|
26 |
-
public function
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
$
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
$
|
79 |
-
|
80 |
-
/*
|
81 |
-
$
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
$
|
93 |
-
|
94 |
-
|
95 |
-
$
|
96 |
-
|
97 |
-
/*
|
98 |
-
|
99 |
-
$content
|
100 |
-
|
101 |
-
|
102 |
-
$content
|
103 |
-
|
104 |
-
|
105 |
-
$content
|
106 |
-
$content
|
107 |
-
$content
|
108 |
-
|
109 |
-
|
110 |
-
$content
|
111 |
-
$content
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
$content
|
117 |
-
|
118 |
-
/*
|
119 |
-
$
|
120 |
-
$
|
121 |
-
|
122 |
-
$content
|
123 |
-
|
124 |
-
|
125 |
-
$content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($
|
126 |
-
$content .= $separator;
|
127 |
-
/*
|
128 |
-
$
|
129 |
-
$
|
130 |
-
|
131 |
-
$content
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
$content = $this->_addFieldToCsv($content, $delimiter,
|
142 |
-
$content .= $separator;
|
143 |
-
|
144 |
-
/* productCode */
|
145 |
-
$productCode = '';
|
146 |
-
$
|
147 |
-
$content
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
$
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
$
|
192 |
-
|
193 |
-
|
194 |
-
$
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
$
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
$content
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
$
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
$content
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
$content =
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
$
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
$
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
$
|
425 |
-
|
426 |
-
$
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Chronopost_Chronorelais_Adminhtml_Chronorelais_ExportController extends Mage_Adminhtml_Controller_Action {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Constructor
|
7 |
+
*/
|
8 |
+
protected function _construct() {
|
9 |
+
$this->setUsedModuleName('Chronopost_Chronorelais');
|
10 |
+
}
|
11 |
+
|
12 |
+
protected function _isAllowed(){
|
13 |
+
return true;
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Main action : show orders list
|
18 |
+
*/
|
19 |
+
public function indexAction() {
|
20 |
+
$this->loadLayout()
|
21 |
+
->_setActiveMenu('sales/chronorelais/export')
|
22 |
+
->_addContent($this->getLayout()->createBlock('chronorelais/export_orders'))
|
23 |
+
->renderLayout();
|
24 |
+
}
|
25 |
+
|
26 |
+
public function getValue($value) {
|
27 |
+
return ($value != '' ? $value : '');
|
28 |
+
}
|
29 |
+
|
30 |
+
public function removeSpclChars($text) {
|
31 |
+
return preg_replace("/[^0-9a-zA-Z]/", "", $text);
|
32 |
+
}
|
33 |
+
|
34 |
+
public function massLivraisonSamediStatusAction() {
|
35 |
+
if ($this->getRequest()->getPost('status')) {
|
36 |
+
$this->saveLivraisonSamediStatusAction();
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
public function massExportAction() {
|
41 |
+
if ($this->getRequest()->getPost('format') == 'css') {
|
42 |
+
$this->exportcssAction();
|
43 |
+
} elseif ($this->getRequest()->getPost('format') == 'cso') {
|
44 |
+
$this->exportcsoAction();
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Export CSS Action
|
50 |
+
* Generates a CSV file to download (CSS format)
|
51 |
+
*/
|
52 |
+
public function exportcssAction() {
|
53 |
+
/* get the orders */
|
54 |
+
$orderIds = $this->getRequest()->getPost('order_ids');
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Get configuration
|
58 |
+
*/
|
59 |
+
$separator = Mage::helper('chronorelais')->getConfigurationFieldSeparator('css');
|
60 |
+
$delimiter = Mage::helper('chronorelais')->getConfigurationFieldDelimiter('css');
|
61 |
+
|
62 |
+
if ($delimiter == 'simple_quote') {
|
63 |
+
$delimiter = "'";
|
64 |
+
} else if ($delimiter == 'double_quotes') {
|
65 |
+
$delimiter = '"';
|
66 |
+
} else {
|
67 |
+
$delimiter = '';
|
68 |
+
}
|
69 |
+
$lineBreak = Mage::helper('chronorelais')->getConfigurationEndOfLineCharacter('css');
|
70 |
+
if ($lineBreak == 'lf') {
|
71 |
+
$lineBreak = "\n";
|
72 |
+
} else if ($lineBreak == 'cr') {
|
73 |
+
$lineBreak = "\r";
|
74 |
+
} else if ($lineBreak == 'crlf') {
|
75 |
+
$lineBreak = "\r\n";
|
76 |
+
}
|
77 |
+
$fileExtension = Mage::helper('chronorelais')->getConfigurationFileExtension('css');
|
78 |
+
$fileCharset = Mage::helper('chronorelais')->getConfigurationFileCharset('css');
|
79 |
+
|
80 |
+
/* set the filename */
|
81 |
+
$filename = 'orders_exportcss_' . Mage::getSingleton('core/date')->date('Ymd_His') . $fileExtension;
|
82 |
+
|
83 |
+
/* initialize the content variable */
|
84 |
+
$content = '';
|
85 |
+
$helper = Mage::helper('chronorelais');
|
86 |
+
$weightUnit = $helper->getConfigWeightUnit();
|
87 |
+
if (!empty($orderIds)) {
|
88 |
+
foreach ($orderIds as $orderId) {
|
89 |
+
|
90 |
+
/* get the order */
|
91 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
92 |
+
$address = $order->getShippingAddress();
|
93 |
+
$billingAddress = $order->getBillingAddress();
|
94 |
+
|
95 |
+
$_shippingMethod = explode('_', $order->getShippingMethod());
|
96 |
+
|
97 |
+
/* customer id */
|
98 |
+
$content = $this->_addFieldToCsv($content, $delimiter, ($order->getCustomerId() ? $order->getCustomerId() : $address->getLastname()));
|
99 |
+
$content .= $separator;
|
100 |
+
/* Nom du point relais OU société si livraison à domicile */
|
101 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $address->getCompany());
|
102 |
+
$content .= $separator;
|
103 |
+
/* customer name */
|
104 |
+
$content = $this->_addFieldToCsv($content, $delimiter, ($address->getFirstname() ? $address->getFirstname() : $billingAddress->getFirstname()));
|
105 |
+
$content .= $separator;
|
106 |
+
$content = $this->_addFieldToCsv($content, $delimiter, ($address->getLastname() ? $address->getLastname() : $billingAddress->getLastname()));
|
107 |
+
$content .= $separator;
|
108 |
+
/* street address */
|
109 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getStreet(1)));
|
110 |
+
$content .= $separator;
|
111 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getStreet(2)));
|
112 |
+
$content .= $separator;
|
113 |
+
|
114 |
+
/* digicode (vide)*/
|
115 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
116 |
+
$content .= $separator;
|
117 |
+
|
118 |
+
/* postal code */
|
119 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getPostcode()));
|
120 |
+
$content .= $separator;
|
121 |
+
/* city */
|
122 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getCity()));
|
123 |
+
$content .= $separator;
|
124 |
+
/* country code */
|
125 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getCountry()));
|
126 |
+
$content .= $separator;
|
127 |
+
/* telephone */
|
128 |
+
$telephone = trim(ereg_replace("[^0-9.-]", " ", $address->getTelephone()));
|
129 |
+
$telephone = (strlen($telephone) >= 10 ? $telephone : '');
|
130 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $telephone);
|
131 |
+
$content .= $separator;
|
132 |
+
/* email */
|
133 |
+
$customer_email = ($address->getEmail()) ? $address->getEmail() : ($billingAddress->getEmail() ? $billingAddress->getEmail() : $order->getCustomerEmail());
|
134 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($customer_email));
|
135 |
+
$content .= $separator;
|
136 |
+
/* real order id */
|
137 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($order->getRealOrderId()));
|
138 |
+
$content .= $separator;
|
139 |
+
|
140 |
+
/* code barre client (vide) */
|
141 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
142 |
+
$content .= $separator;
|
143 |
+
|
144 |
+
/* productCode */
|
145 |
+
$productCode = Mage::helper('chronorelais')->getChronoProductCodeString($_shippingMethod[0]);
|
146 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $productCode);
|
147 |
+
$content .= $separator;
|
148 |
+
|
149 |
+
/* compte (vide) */
|
150 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
151 |
+
$content .= $separator;
|
152 |
+
|
153 |
+
/* sous compte (vide) */
|
154 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
155 |
+
$content .= $separator;
|
156 |
+
|
157 |
+
/* empty fields */
|
158 |
+
$content = $this->_addFieldToCsv($content, $delimiter, 0);
|
159 |
+
$content .= $separator;
|
160 |
+
$content = $this->_addFieldToCsv($content, $delimiter, 0);
|
161 |
+
$content .= $separator;
|
162 |
+
|
163 |
+
/* document / marchandise (vide) */
|
164 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
165 |
+
$content .= $separator;
|
166 |
+
|
167 |
+
/* description contenu (vide) */
|
168 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
169 |
+
$content .= $separator;
|
170 |
+
|
171 |
+
/* Livraison Samedi */
|
172 |
+
$SaturdayShipping = 'L'; //default value for the saturday shipping
|
173 |
+
if ($_shippingMethod[0] == "chronopost" || $_shippingMethod[0] == "chronorelais") {
|
174 |
+
if (!$_deliver_on_saturday = Mage::helper('chronorelais')->getLivraisonSamediStatus($orderId)) {
|
175 |
+
$_deliver_on_saturday = Mage::helper('chronorelais')->getConfigData('carriers/' . $_shippingMethod[0] . '/deliver_on_saturday');
|
176 |
+
} else {
|
177 |
+
if ($_deliver_on_saturday == 'Yes') {
|
178 |
+
$_deliver_on_saturday = 1;
|
179 |
+
} else {
|
180 |
+
$_deliver_on_saturday = 0;
|
181 |
+
}
|
182 |
+
}
|
183 |
+
$is_sending_day = Mage::helper('chronorelais')->isSendingDay();
|
184 |
+
if ($_deliver_on_saturday && $is_sending_day == true) {
|
185 |
+
$SaturdayShipping = 'S';
|
186 |
+
} elseif (!$_deliver_on_saturday && $is_sending_day == true) {
|
187 |
+
$SaturdayShipping = 'L';
|
188 |
+
}
|
189 |
+
}
|
190 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $SaturdayShipping);
|
191 |
+
$content .= $separator;
|
192 |
+
|
193 |
+
/* chronorelay point */
|
194 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getWRelayPointCode()));
|
195 |
+
$content .= $separator;
|
196 |
+
|
197 |
+
/* total weight (in kg) */
|
198 |
+
$order_weight = number_format($order->getWeight(), 2, '.', '');
|
199 |
+
if($weightUnit == 'g') {
|
200 |
+
$order_weight = $order_weight / 1000;
|
201 |
+
}
|
202 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $order_weight);
|
203 |
+
$content .= $separator;
|
204 |
+
|
205 |
+
|
206 |
+
/* largeur (vide) */
|
207 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
208 |
+
$content .= $separator;
|
209 |
+
|
210 |
+
/* longueur (vide) */
|
211 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
212 |
+
$content .= $separator;
|
213 |
+
|
214 |
+
/* hauteur (vide) */
|
215 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
216 |
+
$content .= $separator;
|
217 |
+
|
218 |
+
/* avertir destinataire (vide) */
|
219 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
220 |
+
$content .= $separator;
|
221 |
+
|
222 |
+
/* nb colis (vide) */
|
223 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
224 |
+
$content .= $separator;
|
225 |
+
|
226 |
+
/* date envoi */
|
227 |
+
$content = $this->_addFieldToCsv($content, $delimiter, date('d/m/Y'));
|
228 |
+
$content .= $separator;
|
229 |
+
|
230 |
+
/* a intégrer (vide) */
|
231 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
232 |
+
$content .= $separator;
|
233 |
+
|
234 |
+
/* avertir expéditeur (vide) */
|
235 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
236 |
+
$content .= $separator;
|
237 |
+
|
238 |
+
/* DLC (vide) */
|
239 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
240 |
+
$content .= $separator;
|
241 |
+
|
242 |
+
/* champ specifique rdv */
|
243 |
+
$chronopostsrdv_creneaux_info = $address->getData('chronopostsrdv_creneaux_info');
|
244 |
+
if($chronopostsrdv_creneaux_info) {
|
245 |
+
$chronopostsrdv_creneaux_info = json_decode($chronopostsrdv_creneaux_info,true);
|
246 |
+
$_dateRdvStart = new DateTime($chronopostsrdv_creneaux_info['deliveryDate']);
|
247 |
+
$_dateRdvStart->setTime($chronopostsrdv_creneaux_info['startHour'],$chronopostsrdv_creneaux_info['startMinutes']);
|
248 |
+
|
249 |
+
$_dateRdvEnd = new DateTime($chronopostsrdv_creneaux_info['deliveryDate']);
|
250 |
+
$_dateRdvEnd->setTime($chronopostsrdv_creneaux_info['endHour'],$chronopostsrdv_creneaux_info['endMinutes']);
|
251 |
+
|
252 |
+
/* date debut rdv */
|
253 |
+
//$content = $this->_addFieldToCsv($content, $delimiter, $_dateRdvStart->format("Y-m-d")."T".$_dateRdvStart->format("H:i:s"));
|
254 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $_dateRdvStart->format("dmyHi"));
|
255 |
+
$content .= $separator;
|
256 |
+
|
257 |
+
/* date fin rdv */
|
258 |
+
//$content = $this->_addFieldToCsv($content, $delimiter, $_dateRdvEnd->format("Y-m-d")."T".$_dateRdvEnd->format("H:i:s"));
|
259 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $_dateRdvEnd->format("dmyHi"));
|
260 |
+
$content .= $separator;
|
261 |
+
|
262 |
+
/* Niveau tarifaire */
|
263 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $chronopostsrdv_creneaux_info['tariffLevel']);
|
264 |
+
$content .= $separator;
|
265 |
+
|
266 |
+
/* code service */
|
267 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $chronopostsrdv_creneaux_info['serviceCode']);
|
268 |
+
$content .= $separator;
|
269 |
+
|
270 |
+
} else {
|
271 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
272 |
+
$content .= $separator;
|
273 |
+
|
274 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
275 |
+
$content .= $separator;
|
276 |
+
|
277 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
278 |
+
$content .= $separator;
|
279 |
+
|
280 |
+
/* code service */
|
281 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
282 |
+
$content .= $separator;
|
283 |
+
}
|
284 |
+
|
285 |
+
|
286 |
+
|
287 |
+
$content .= $lineBreak;
|
288 |
+
|
289 |
+
}
|
290 |
+
|
291 |
+
/* decode the content, depending on the charset */
|
292 |
+
if ($fileCharset == 'ISO-8859-1') {
|
293 |
+
$content = utf8_decode($content);
|
294 |
+
}
|
295 |
+
|
296 |
+
/* pick file mime type, depending on the extension */
|
297 |
+
switch ($fileExtension) {
|
298 |
+
case '.csv':
|
299 |
+
$fileMimeType = 'application/csv';
|
300 |
+
break;
|
301 |
+
case '.chr':
|
302 |
+
$fileMimeType = 'application/chr';
|
303 |
+
break;
|
304 |
+
default:
|
305 |
+
$fileMimeType = 'text/plain';
|
306 |
+
break;
|
307 |
+
}
|
308 |
+
/* download the file */
|
309 |
+
return $this->_prepareDownloadResponse($filename, $content, $fileMimeType . '; charset="' . $fileCharset . '"');
|
310 |
+
} else {
|
311 |
+
$this->_getSession()->addError($this->__('No Order has been selected'));
|
312 |
+
}
|
313 |
+
}
|
314 |
+
|
315 |
+
/**
|
316 |
+
* Export CSO Action
|
317 |
+
* Generates a CSV file to download (CSO format)
|
318 |
+
*/
|
319 |
+
public function exportcsoAction() {
|
320 |
+
/* get the orders */
|
321 |
+
$orderIds = $this->getRequest()->getPost('order_ids');
|
322 |
+
|
323 |
+
/**
|
324 |
+
* Get configuration
|
325 |
+
*/
|
326 |
+
$separator = Mage::helper('chronorelais')->getConfigurationFieldSeparator('cso');
|
327 |
+
$delimiter = Mage::helper('chronorelais')->getConfigurationFieldDelimiter('cso');
|
328 |
+
if ($delimiter == 'simple_quote') {
|
329 |
+
$delimiter = "'";
|
330 |
+
} else if ($delimiter == 'double_quotes') {
|
331 |
+
$delimiter = '"';
|
332 |
+
} else {
|
333 |
+
$delimiter = '';
|
334 |
+
}
|
335 |
+
$lineBreak = Mage::helper('chronorelais')->getConfigurationEndOfLineCharacter('cso');
|
336 |
+
if ($lineBreak == 'lf') {
|
337 |
+
$lineBreak = "\n";
|
338 |
+
} else if ($lineBreak == 'cr') {
|
339 |
+
$lineBreak = "\r";
|
340 |
+
} else if ($lineBreak == 'crlf') {
|
341 |
+
$lineBreak = "\r\n";
|
342 |
+
}
|
343 |
+
$fileExtension = Mage::helper('chronorelais')->getConfigurationFileExtension('cso');
|
344 |
+
$fileCharset = Mage::helper('chronorelais')->getConfigurationFileCharset('cso');
|
345 |
+
|
346 |
+
/* set the filename */
|
347 |
+
$filename = 'orders_exportcso_' . Mage::getSingleton('core/date')->date('Ymd_His') . $fileExtension;
|
348 |
+
|
349 |
+
/* initialize the content variable */
|
350 |
+
$content = '';
|
351 |
+
$helper = Mage::helper('chronorelais');
|
352 |
+
$weightUnit = $helper->getConfigWeightUnit();
|
353 |
+
if (!empty($orderIds)) {
|
354 |
+
foreach ($orderIds as $orderId) {
|
355 |
+
|
356 |
+
/* get the order */
|
357 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
358 |
+
$address = $order->getShippingAddress();
|
359 |
+
$billingAddress = $order->getBillingAddress();
|
360 |
+
|
361 |
+
$_shippingMethod = explode('_', $order->getShippingMethod());
|
362 |
+
|
363 |
+
/* customer id */
|
364 |
+
$content = $this->_addFieldToCsv($content, $delimiter, ($order->getCustomerId() ? $order->getCustomerId() : $address->getLastname()));
|
365 |
+
$content .= $separator;
|
366 |
+
/* Nom du point relais OU société si livraison à domicile */
|
367 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $address->getCompany());
|
368 |
+
$content .= $separator;
|
369 |
+
/* customer name */
|
370 |
+
$content = $this->_addFieldToCsv($content, $delimiter, ($address->getFirstname() ? $address->getFirstname() : $billingAddress->getFirstname()));
|
371 |
+
$content .= $separator;
|
372 |
+
$content = $this->_addFieldToCsv($content, $delimiter, ($address->getLastname() ? $address->getLastname() : $billingAddress->getLastname()));
|
373 |
+
$content .= $separator;
|
374 |
+
/* street address */
|
375 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getStreet(1)));
|
376 |
+
$content .= $separator;
|
377 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getStreet(2)));
|
378 |
+
$content .= $separator;
|
379 |
+
|
380 |
+
/* digicode (vide)*/
|
381 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
382 |
+
$content .= $separator;
|
383 |
+
|
384 |
+
/* postal code */
|
385 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getPostcode()));
|
386 |
+
$content .= $separator;
|
387 |
+
/* city */
|
388 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getCity()));
|
389 |
+
$content .= $separator;
|
390 |
+
/* country code */
|
391 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getCountry()));
|
392 |
+
$content .= $separator;
|
393 |
+
/* telephone */
|
394 |
+
$telephone = trim(ereg_replace("[^0-9.-]", " ", $address->getTelephone()));
|
395 |
+
$telephone = (strlen($telephone) >= 10 ? $telephone : '');
|
396 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $telephone);
|
397 |
+
$content .= $separator;
|
398 |
+
/* email */
|
399 |
+
$customer_email = ($address->getEmail()) ? $address->getEmail() : ($billingAddress->getEmail() ? $billingAddress->getEmail() : $order->getCustomerEmail());
|
400 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($customer_email));
|
401 |
+
$content .= $separator;
|
402 |
+
/* real order id */
|
403 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($order->getRealOrderId()));
|
404 |
+
$content .= $separator;
|
405 |
+
|
406 |
+
/* code barre client (vide) */
|
407 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
408 |
+
$content .= $separator;
|
409 |
+
|
410 |
+
/* productCode */
|
411 |
+
$productCode = Mage::helper('chronorelais')->getChronoProductCodeString($_shippingMethod[0]);
|
412 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $productCode);
|
413 |
+
$content .= $separator;
|
414 |
+
|
415 |
+
/* compte (vide) */
|
416 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
417 |
+
$content .= $separator;
|
418 |
+
|
419 |
+
/* sous compte (vide) */
|
420 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
421 |
+
$content .= $separator;
|
422 |
+
|
423 |
+
/* empty fields */
|
424 |
+
$content = $this->_addFieldToCsv($content, $delimiter, 0);
|
425 |
+
$content .= $separator;
|
426 |
+
$content = $this->_addFieldToCsv($content, $delimiter, 0);
|
427 |
+
$content .= $separator;
|
428 |
+
|
429 |
+
/* document / marchandise (vide) */
|
430 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
431 |
+
$content .= $separator;
|
432 |
+
|
433 |
+
/* description contenu (vide) */
|
434 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
435 |
+
$content .= $separator;
|
436 |
+
|
437 |
+
/* Livraison Samedi */
|
438 |
+
$SaturdayShipping = 'L'; //default value for the saturday shipping
|
439 |
+
if ($_shippingMethod[0] == "chronopost" || $_shippingMethod[0] == "chronorelais") {
|
440 |
+
if (!$_deliver_on_saturday = Mage::helper('chronorelais')->getLivraisonSamediStatus($orderId)) {
|
441 |
+
$_deliver_on_saturday = Mage::helper('chronorelais')->getConfigData('carriers/' . $_shippingMethod[0] . '/deliver_on_saturday');
|
442 |
+
} else {
|
443 |
+
if ($_deliver_on_saturday == 'Yes') {
|
444 |
+
$_deliver_on_saturday = 1;
|
445 |
+
} else {
|
446 |
+
$_deliver_on_saturday = 0;
|
447 |
+
}
|
448 |
+
}
|
449 |
+
$is_sending_day = Mage::helper('chronorelais')->isSendingDay();
|
450 |
+
if ($_deliver_on_saturday && $is_sending_day == true) {
|
451 |
+
$SaturdayShipping = 'S';
|
452 |
+
} elseif (!$_deliver_on_saturday && $is_sending_day == true) {
|
453 |
+
$SaturdayShipping = 'L';
|
454 |
+
}
|
455 |
+
}
|
456 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $SaturdayShipping);
|
457 |
+
$content .= $separator;
|
458 |
+
|
459 |
+
/* chronorelay point */
|
460 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getWRelayPointCode()));
|
461 |
+
$content .= $separator;
|
462 |
+
|
463 |
+
/* total weight (in kg) */
|
464 |
+
$order_weight = number_format($order->getWeight(), 2, '.', '');
|
465 |
+
if($weightUnit == 'g') {
|
466 |
+
$order_weight = $order_weight / 1000;
|
467 |
+
}
|
468 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $order_weight);
|
469 |
+
$content .= $separator;
|
470 |
+
|
471 |
+
|
472 |
+
/* largeur (vide) */
|
473 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
474 |
+
$content .= $separator;
|
475 |
+
|
476 |
+
/* longueur (vide) */
|
477 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
478 |
+
$content .= $separator;
|
479 |
+
|
480 |
+
/* hauteur (vide) */
|
481 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
482 |
+
$content .= $separator;
|
483 |
+
|
484 |
+
/* avertir destinataire (vide) */
|
485 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
486 |
+
$content .= $separator;
|
487 |
+
|
488 |
+
/* nb colis (vide) */
|
489 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
490 |
+
$content .= $separator;
|
491 |
+
|
492 |
+
/* date envoi */
|
493 |
+
$content = $this->_addFieldToCsv($content, $delimiter, date('d/m/Y'));
|
494 |
+
$content .= $separator;
|
495 |
+
|
496 |
+
/* a intégrer (vide) */
|
497 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
498 |
+
$content .= $separator;
|
499 |
+
|
500 |
+
/* avertir expéditeur (vide) */
|
501 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
502 |
+
$content .= $separator;
|
503 |
+
|
504 |
+
/* DLC (vide) */
|
505 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
506 |
+
$content .= $separator;
|
507 |
+
|
508 |
+
/* champ specifique rdv */
|
509 |
+
$chronopostsrdv_creneaux_info = $address->getData('chronopostsrdv_creneaux_info');
|
510 |
+
if($chronopostsrdv_creneaux_info) {
|
511 |
+
$chronopostsrdv_creneaux_info = json_decode($chronopostsrdv_creneaux_info,true);
|
512 |
+
$_dateRdvStart = new DateTime($chronopostsrdv_creneaux_info['deliveryDate']);
|
513 |
+
$_dateRdvStart->setTime($chronopostsrdv_creneaux_info['startHour'],$chronopostsrdv_creneaux_info['startMinutes']);
|
514 |
+
|
515 |
+
$_dateRdvEnd = new DateTime($chronopostsrdv_creneaux_info['deliveryDate']);
|
516 |
+
$_dateRdvEnd->setTime($chronopostsrdv_creneaux_info['endHour'],$chronopostsrdv_creneaux_info['endMinutes']);
|
517 |
+
|
518 |
+
/* date debut rdv */
|
519 |
+
//$content = $this->_addFieldToCsv($content, $delimiter, $_dateRdvStart->format("Y-m-d")."T".$_dateRdvStart->format("H:i:s"));
|
520 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $_dateRdvStart->format("dmyHi"));
|
521 |
+
$content .= $separator;
|
522 |
+
|
523 |
+
/* date fin rdv */
|
524 |
+
//$content = $this->_addFieldToCsv($content, $delimiter, $_dateRdvEnd->format("Y-m-d")."T".$_dateRdvEnd->format("H:i:s"));
|
525 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $_dateRdvEnd->format("dmyHi"));
|
526 |
+
$content .= $separator;
|
527 |
+
|
528 |
+
/* Niveau tarifaire */
|
529 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $chronopostsrdv_creneaux_info['tariffLevel']);
|
530 |
+
$content .= $separator;
|
531 |
+
|
532 |
+
/* code service */
|
533 |
+
$content = $this->_addFieldToCsv($content, $delimiter, $chronopostsrdv_creneaux_info['serviceCode']);
|
534 |
+
$content .= $separator;
|
535 |
+
|
536 |
+
} else {
|
537 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
538 |
+
$content .= $separator;
|
539 |
+
|
540 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
541 |
+
$content .= $separator;
|
542 |
+
|
543 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
544 |
+
$content .= $separator;
|
545 |
+
|
546 |
+
/* code service */
|
547 |
+
$content = $this->_addFieldToCsv($content, $delimiter, '');
|
548 |
+
$content .= $separator;
|
549 |
+
}
|
550 |
+
|
551 |
+
|
552 |
+
|
553 |
+
$content .= $lineBreak;
|
554 |
+
|
555 |
+
}
|
556 |
+
|
557 |
+
/* decode the content, depending on the charset */
|
558 |
+
if ($fileCharset == 'ISO-8859-1') {
|
559 |
+
$content = utf8_decode($content);
|
560 |
+
}
|
561 |
+
|
562 |
+
/* pick file mime type, depending on the extension */
|
563 |
+
switch ($fileExtension) {
|
564 |
+
case '.csv':
|
565 |
+
$fileMimeType = 'application/csv';
|
566 |
+
break;
|
567 |
+
case '.chr':
|
568 |
+
$fileMimeType = 'application/chr';
|
569 |
+
break;
|
570 |
+
default:
|
571 |
+
$fileMimeType = 'text/plain';
|
572 |
+
break;
|
573 |
+
}
|
574 |
+
/* download the file */
|
575 |
+
return $this->_prepareDownloadResponse($filename, $content, $fileMimeType . '; charset="' . $fileCharset . '"');
|
576 |
+
} else {
|
577 |
+
$this->_getSession()->addError($this->__('No Order has been selected'));
|
578 |
+
}
|
579 |
+
}
|
580 |
+
|
581 |
+
/* Save the Livraison le Samedi status to orders */
|
582 |
+
|
583 |
+
public function saveLivraisonSamediStatusAction() {
|
584 |
+
/* get the orders */
|
585 |
+
$orderIds = $this->getRequest()->getPost('order_ids');
|
586 |
+
$status = $this->getRequest()->getPost('status');
|
587 |
+
$_connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
588 |
+
$_table = Mage::getSingleton('core/resource')->getTableName('sales_chronopost_order_export_status');
|
589 |
+
$exceptions = array();
|
590 |
+
|
591 |
+
foreach ($orderIds as $orderId) {
|
592 |
+
$order_details = Mage::getModel('sales/order')->load($orderId);
|
593 |
+
$shipping_method = '';
|
594 |
+
$livraison_le_samedi = $status;
|
595 |
+
if ($shipping_method = $order_details->getShippingMethod()) {
|
596 |
+
$shipping_method = explode('_', $shipping_method);
|
597 |
+
if ($shipping_method[0] == 'chronoexpress') {
|
598 |
+
$livraison_le_samedi = '--';
|
599 |
+
}
|
600 |
+
}
|
601 |
+
$condition = array(
|
602 |
+
$_connection->quoteInto('order_id = ?', $orderId),
|
603 |
+
);
|
604 |
+
$_connection->delete($_table, $condition);
|
605 |
+
|
606 |
+
$dataLine = array(
|
607 |
+
'order_id' => $orderId,
|
608 |
+
'livraison_le_samedi' => $livraison_le_samedi
|
609 |
+
);
|
610 |
+
try {
|
611 |
+
$_connection->insert($_table, $dataLine);
|
612 |
+
} catch (Exception $e) {
|
613 |
+
$exceptions[] = Mage::helper('chronorelais')->__('Order assigning error: ' . $e->getMessage());
|
614 |
+
}
|
615 |
+
}
|
616 |
+
if ($exceptions) {
|
617 |
+
$this->_getSession()->addError($exceptions);
|
618 |
+
} else {
|
619 |
+
$this->_getSession()->addSuccess($this->__('Livraison le Samedi statut a été ajouté'));
|
620 |
+
}
|
621 |
+
$this->_redirect('*/*/index');
|
622 |
+
}
|
623 |
+
|
624 |
+
/**
|
625 |
+
* Add a new field to the csv file
|
626 |
+
* @param csvContent : the current csv content
|
627 |
+
* @param fieldDelimiter : the delimiter character
|
628 |
+
* @param fieldContent : the content to add
|
629 |
+
* @return : the concatenation of current content and content to add
|
630 |
+
*/
|
631 |
+
private function _addFieldToCsv($csvContent, $fieldDelimiter, $fieldContent) {
|
632 |
+
return $csvContent . $fieldDelimiter . $fieldContent . $fieldDelimiter;
|
633 |
+
}
|
634 |
+
|
635 |
}
|
app/code/community/Chronopost/Chronorelais/controllers/Adminhtml/Chronorelais/ImportController.php
CHANGED
@@ -74,9 +74,6 @@ class Chronopost_Chronorelais_Adminhtml_Chronorelais_ImportController extends Ma
|
|
74 |
$comment = Mage::helper('chronorelais')->getConfigurationShippingComment();
|
75 |
$includeComment = Mage::helper('chronorelais')->getConfigurationIncludeComment();
|
76 |
|
77 |
-
/* debug */
|
78 |
-
//$this->_getSession()->addSuccess($this->__('%s - %s - %s - %s', $sendEmail, $comment, $includeComment, $trackingTitle));
|
79 |
-
|
80 |
/**
|
81 |
* $k is line number
|
82 |
* $v is line content array
|
@@ -104,9 +101,6 @@ class Chronopost_Chronorelais_Adminhtml_Chronorelais_ImportController extends Ma
|
|
104 |
$orderId = $v[0];
|
105 |
$trackingNumber = $v[1];
|
106 |
|
107 |
-
/* for debug */
|
108 |
-
//$this->_getSession()->addSuccess($this->__('Lecture ligne %s: %s - %s', $k, $orderId, $trackingNumber));
|
109 |
-
|
110 |
/**
|
111 |
* Try to load the order
|
112 |
*/
|
@@ -188,8 +182,6 @@ class Chronopost_Chronorelais_Adminhtml_Chronorelais_ImportController extends Ma
|
|
188 |
case "chronoexpress":
|
189 |
$carrier_code = $_shippingMethod[0];
|
190 |
$popup = 1;
|
191 |
-
/*$hash = Mage::helper('core')->urlEncode("order_id:{$order->getId()}:{$order->getProtectCode()}");
|
192 |
-
$tracking_url = Mage::getBaseUrl().'chronorelais/relais/tracking/hash/'.$hash.'/';*/
|
193 |
$tracking_url = str_replace('{tracking_number}', $trackingNumber, Mage::helper('chronorelais')->getConfigurationTrackingViewUrl());
|
194 |
$tracking_title = $this->__('Track Your Order');
|
195 |
$tracking_order = '<p><a title="'.$tracking_title.'" href="'.$tracking_url.'"><b>'.$tracking_title.'</b></a></p>';
|
74 |
$comment = Mage::helper('chronorelais')->getConfigurationShippingComment();
|
75 |
$includeComment = Mage::helper('chronorelais')->getConfigurationIncludeComment();
|
76 |
|
|
|
|
|
|
|
77 |
/**
|
78 |
* $k is line number
|
79 |
* $v is line content array
|
101 |
$orderId = $v[0];
|
102 |
$trackingNumber = $v[1];
|
103 |
|
|
|
|
|
|
|
104 |
/**
|
105 |
* Try to load the order
|
106 |
*/
|
182 |
case "chronoexpress":
|
183 |
$carrier_code = $_shippingMethod[0];
|
184 |
$popup = 1;
|
|
|
|
|
185 |
$tracking_url = str_replace('{tracking_number}', $trackingNumber, Mage::helper('chronorelais')->getConfigurationTrackingViewUrl());
|
186 |
$tracking_title = $this->__('Track Your Order');
|
187 |
$tracking_order = '<p><a title="'.$tracking_title.'" href="'.$tracking_url.'"><b>'.$tracking_title.'</b></a></p>';
|
app/code/community/Chronopost/Chronorelais/controllers/Adminhtml/Chronorelais/Sales/BordereauController.php
CHANGED
@@ -64,7 +64,6 @@ class Chronopost_Chronorelais_Adminhtml_Chronorelais_Sales_BordereauController e
|
|
64 |
/* items */
|
65 |
$items = $shipment->getAllItems();
|
66 |
$weightTotal = 0;
|
67 |
-
$nbTotal = 0;
|
68 |
|
69 |
$maxAmount = $helper->getMaxAdValoremAmount();
|
70 |
$adValoremAmount = $helper->assuranceAdValoremAmount();
|
@@ -74,17 +73,15 @@ class Chronopost_Chronorelais_Adminhtml_Chronorelais_Sales_BordereauController e
|
|
74 |
foreach($items as $item) {
|
75 |
$weightTotal += $item->getWeight() * $item->getQty();
|
76 |
$totalAdValorem += $item->getPrice() * $item->getQty();
|
77 |
-
/*$price = min($item->getPrice(),$maxAmount);
|
78 |
-
if($price <= $maxAmount) {
|
79 |
-
$totalAdValorem += $price * $item->getQty();
|
80 |
-
}*/
|
81 |
}
|
82 |
/* Si montant < au montant minimum ad valorem => pas d'assurance */
|
83 |
$totalAdValorem = 0;
|
84 |
if($adValoremEnabled)
|
85 |
{
|
86 |
$totalAdValorem = min($totalAdValorem,$maxAmount);
|
87 |
-
if($totalAdValorem < $adValoremAmount)
|
|
|
|
|
88 |
}
|
89 |
|
90 |
/* Shipping address */
|
64 |
/* items */
|
65 |
$items = $shipment->getAllItems();
|
66 |
$weightTotal = 0;
|
|
|
67 |
|
68 |
$maxAmount = $helper->getMaxAdValoremAmount();
|
69 |
$adValoremAmount = $helper->assuranceAdValoremAmount();
|
73 |
foreach($items as $item) {
|
74 |
$weightTotal += $item->getWeight() * $item->getQty();
|
75 |
$totalAdValorem += $item->getPrice() * $item->getQty();
|
|
|
|
|
|
|
|
|
76 |
}
|
77 |
/* Si montant < au montant minimum ad valorem => pas d'assurance */
|
78 |
$totalAdValorem = 0;
|
79 |
if($adValoremEnabled)
|
80 |
{
|
81 |
$totalAdValorem = min($totalAdValorem,$maxAmount);
|
82 |
+
if($totalAdValorem < $adValoremAmount) {
|
83 |
+
$totalAdValorem = 0;
|
84 |
+
}
|
85 |
}
|
86 |
|
87 |
/* Shipping address */
|
app/code/community/Chronopost/Chronorelais/controllers/Adminhtml/Chronorelais/Sales/ImpressionController.php
CHANGED
@@ -1,1050 +1,1136 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
require_once 'Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php';
|
4 |
-
|
5 |
-
class Chronopost_Chronorelais_Adminhtml_Chronorelais_Sales_ImpressionController extends Mage_Adminhtml_Sales_Order_ShipmentController {
|
6 |
-
|
7 |
-
protected $_trackingNumbers = '';
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Additional initialization
|
11 |
-
*
|
12 |
-
*/
|
13 |
-
protected function _construct() {
|
14 |
-
$this->setUsedModuleName('Chronopost_Chronorelais');
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Shipping grid
|
19 |
-
*/
|
20 |
-
public function indexAction() {
|
21 |
-
if (!extension_loaded('soap')) {
|
22 |
-
$this->_getSession()->addError($this->__('The SOAP extension is not installed in the server. Please contact the site administrator. Sorry for inconvenience.'));
|
23 |
-
return $this->_redirectReferer();
|
24 |
-
}
|
25 |
-
$cmdTestGs = Mage::helper('chronorelais')->getConfigData('chronorelais/shipping/gs_path')." -v";
|
26 |
-
if(shell_exec($cmdTestGs) === null) {
|
27 |
-
$this->_getSession()->addNotice($this->__('Please install %s on your server to print mass','<a href="http://www.ghostscript.com/download/" target="_blank">Ghostscript</a>'));
|
28 |
-
}
|
29 |
-
$this->loadLayout()
|
30 |
-
->_setActiveMenu('sales/chronorelais')
|
31 |
-
->_addContent($this->getLayout()->createBlock('chronorelais/sales_impression'))
|
32 |
-
->renderLayout();
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Save shipment and order in one transaction
|
37 |
-
* @param Mage_Sales_Model_Order_Shipment $shipment
|
38 |
-
*/
|
39 |
-
protected function _saveShipment($shipment) {
|
40 |
-
$shipment->getOrder()->setIsInProcess(true);
|
41 |
-
$transactionSave = Mage::getModel('core/resource_transaction')
|
42 |
-
->addObject($shipment)
|
43 |
-
->addObject($shipment->getOrder())
|
44 |
-
->save();
|
45 |
-
|
46 |
-
return $this;
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Declare headers and content file in response for file download
|
51 |
-
*
|
52 |
-
* @param string $fileName
|
53 |
-
* @param string|array $content set to null to avoid starting output, $contentLength should be set explicitly in
|
54 |
-
* that case
|
55 |
-
* @param string $contentType
|
56 |
-
* @param int $contentLength explicit content length, if strlen($content) isn't applicable
|
57 |
-
* @return Mage_Core_Controller_Varien_Action
|
58 |
-
*/
|
59 |
-
protected function _prepareDownloadResponse(
|
60 |
-
|
61 |
-
$
|
62 |
-
$
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
->
|
86 |
-
->setHeader('
|
87 |
-
->setHeader('
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
$
|
96 |
-
$
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
$ioAdapter->
|
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 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
'
|
213 |
-
'
|
214 |
-
'
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
'
|
228 |
-
'
|
229 |
-
'
|
230 |
-
'
|
231 |
-
'
|
232 |
-
'
|
233 |
-
'
|
234 |
-
'
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
$
|
244 |
-
$
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
'
|
252 |
-
'
|
253 |
-
'
|
254 |
-
'
|
255 |
-
'
|
256 |
-
'
|
257 |
-
'
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
$
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
$
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
'
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
$
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
'
|
334 |
-
'
|
335 |
-
'
|
336 |
-
'
|
337 |
-
'
|
338 |
-
'
|
339 |
-
'
|
340 |
-
'
|
341 |
-
'
|
342 |
-
'
|
343 |
-
'
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
'
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
'
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
'
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
'
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
}
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
$
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
$
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
$
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
$
|
638 |
-
|
639 |
-
$
|
640 |
-
|
641 |
-
$
|
642 |
-
$
|
643 |
-
|
644 |
-
$
|
645 |
-
}
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
$
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
$
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
$
|
747 |
-
|
748 |
-
$
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
}
|
765 |
-
|
766 |
-
/*
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
$
|
774 |
-
$
|
775 |
-
$
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
$
|
798 |
-
|
799 |
-
$
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
$
|
804 |
-
|
805 |
-
$mail
|
806 |
-
$mail->
|
807 |
-
$mail->
|
808 |
-
|
809 |
-
$
|
810 |
-
|
811 |
-
$
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
$
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
$
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
'
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
'
|
860 |
-
'
|
861 |
-
'
|
862 |
-
'
|
863 |
-
'
|
864 |
-
'
|
865 |
-
'
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
'
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
'
|
878 |
-
'
|
879 |
-
'
|
880 |
-
'
|
881 |
-
'
|
882 |
-
'
|
883 |
-
'
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
$
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
$
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
$
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
'
|
914 |
-
'
|
915 |
-
'
|
916 |
-
'
|
917 |
-
'
|
918 |
-
'
|
919 |
-
'
|
920 |
-
'
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
);
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
}
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
'
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
'
|
980 |
-
'
|
981 |
-
'
|
982 |
-
'
|
983 |
-
'
|
984 |
-
'
|
985 |
-
'
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
'
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
'
|
994 |
-
'
|
995 |
-
'
|
996 |
-
'
|
997 |
-
'
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1050 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once 'Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php';
|
4 |
+
|
5 |
+
class Chronopost_Chronorelais_Adminhtml_Chronorelais_Sales_ImpressionController extends Mage_Adminhtml_Sales_Order_ShipmentController {
|
6 |
+
|
7 |
+
protected $_trackingNumbers = '';
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Additional initialization
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
protected function _construct() {
|
14 |
+
$this->setUsedModuleName('Chronopost_Chronorelais');
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Shipping grid
|
19 |
+
*/
|
20 |
+
public function indexAction() {
|
21 |
+
if (!extension_loaded('soap')) {
|
22 |
+
$this->_getSession()->addError($this->__('The SOAP extension is not installed in the server. Please contact the site administrator. Sorry for inconvenience.'));
|
23 |
+
return $this->_redirectReferer();
|
24 |
+
}
|
25 |
+
$cmdTestGs = Mage::helper('chronorelais')->getConfigData('chronorelais/shipping/gs_path')." -v";
|
26 |
+
if(shell_exec($cmdTestGs) === null) {
|
27 |
+
$this->_getSession()->addNotice($this->__('Please install %s on your server to print mass','<a href="http://www.ghostscript.com/download/" target="_blank">Ghostscript</a>'));
|
28 |
+
}
|
29 |
+
$this->loadLayout()
|
30 |
+
->_setActiveMenu('sales/chronorelais')
|
31 |
+
->_addContent($this->getLayout()->createBlock('chronorelais/sales_impression'))
|
32 |
+
->renderLayout();
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Save shipment and order in one transaction
|
37 |
+
* @param Mage_Sales_Model_Order_Shipment $shipment
|
38 |
+
*/
|
39 |
+
protected function _saveShipment($shipment) {
|
40 |
+
$shipment->getOrder()->setIsInProcess(true);
|
41 |
+
$transactionSave = Mage::getModel('core/resource_transaction')
|
42 |
+
->addObject($shipment)
|
43 |
+
->addObject($shipment->getOrder())
|
44 |
+
->save();
|
45 |
+
|
46 |
+
return $this;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Declare headers and content file in response for file download
|
51 |
+
*
|
52 |
+
* @param string $fileName
|
53 |
+
* @param string|array $content set to null to avoid starting output, $contentLength should be set explicitly in
|
54 |
+
* that case
|
55 |
+
* @param string $contentType
|
56 |
+
* @param int $contentLength explicit content length, if strlen($content) isn't applicable
|
57 |
+
* @return Mage_Core_Controller_Varien_Action
|
58 |
+
*/
|
59 |
+
protected function _prepareDownloadResponse($fileName,$content,$contentType = 'application/octet-stream',$contentLength = null)
|
60 |
+
{
|
61 |
+
$session = Mage::getSingleton('admin/session');
|
62 |
+
if ($session->isFirstPageAfterLogin()) {
|
63 |
+
$this->_redirect($session->getUser()->getStartupPageUrl());
|
64 |
+
return $this;
|
65 |
+
}
|
66 |
+
|
67 |
+
$isFile = false;
|
68 |
+
$file = null;
|
69 |
+
if (is_array($content)) {
|
70 |
+
if (!isset($content['type']) || !isset($content['value'])) {
|
71 |
+
return $this;
|
72 |
+
}
|
73 |
+
if ($content['type'] == 'filename') {
|
74 |
+
$isFile = true;
|
75 |
+
$file = $content['value'];
|
76 |
+
$contentLength = filesize($file);
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
$this->getResponse()
|
81 |
+
->setHttpResponseCode(200)
|
82 |
+
->setHeader('Pragma', 'public', true)
|
83 |
+
->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)
|
84 |
+
->setHeader('Content-type', $contentType, true)
|
85 |
+
->setHeader('Content-Length', is_null($contentLength) ? strlen($content) : $contentLength, true)
|
86 |
+
->setHeader('Content-Disposition', 'attachment; filename="'.$fileName.'"', true)
|
87 |
+
->setHeader('Last-Modified', date('r'), true);
|
88 |
+
|
89 |
+
if (!is_null($content)) {
|
90 |
+
if ($isFile) {
|
91 |
+
$this->getResponse()->clearBody();
|
92 |
+
$this->getResponse()->sendHeaders();
|
93 |
+
|
94 |
+
$ioAdapter = new Varien_Io_File();
|
95 |
+
$ioAdapter->open(array('path' => $ioAdapter->dirname($file)));
|
96 |
+
$ioAdapter->streamOpen($file, 'r');
|
97 |
+
while ($buffer = $ioAdapter->streamRead()) {
|
98 |
+
print $buffer;
|
99 |
+
}
|
100 |
+
$ioAdapter->streamClose();
|
101 |
+
if (!empty($content['rm'])) {
|
102 |
+
$ioAdapter->rm($file);
|
103 |
+
}
|
104 |
+
|
105 |
+
exit(0);
|
106 |
+
} else {
|
107 |
+
$this->getResponse()->setBody($content);
|
108 |
+
}
|
109 |
+
}
|
110 |
+
return $this;
|
111 |
+
}
|
112 |
+
|
113 |
+
protected function _processDownloadMass($pdf_contents) {
|
114 |
+
|
115 |
+
$paths = array();
|
116 |
+
$this->createMediaChronopostFolder();
|
117 |
+
foreach ($pdf_contents as $pdf_content) {
|
118 |
+
$fileName = 'tmp-etiquette-'.date('H-i-s');
|
119 |
+
/* save pdf file */
|
120 |
+
$path = Mage::getBaseDir('media').'/chronopost/' . $fileName . '.pdf';
|
121 |
+
file_put_contents($path, $pdf_content);
|
122 |
+
$paths[] = $path;
|
123 |
+
}
|
124 |
+
|
125 |
+
/* creation d'un pdf unique */
|
126 |
+
$pdfMergeFileName = "merged-".date('YmdHis').".pdf";
|
127 |
+
$pathMerge = Mage::getBaseDir('media')."/chronopost/".$pdfMergeFileName;
|
128 |
+
$cmd = Mage::helper('chronorelais')->getConfigData('chronorelais/shipping/gs_path').' -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile="'.$pathMerge.'" -dBATCH '. implode(' ', $paths);
|
129 |
+
$res_shell = shell_exec($cmd);
|
130 |
+
|
131 |
+
/* suppression des pdf temp */
|
132 |
+
foreach ($paths as $path) {
|
133 |
+
if(is_file($path)) {
|
134 |
+
unlink($path);
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
if ($res_shell === null) {
|
139 |
+
return $this->_redirectReferer();
|
140 |
+
}
|
141 |
+
else {
|
142 |
+
$this->_prepareDownloadResponse($pdfMergeFileName,array(
|
143 |
+
'type' => 'filename',
|
144 |
+
'value' => $pathMerge
|
145 |
+
));
|
146 |
+
unlink($pathMerge);
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
protected function getTrackingNumber($shipmentId) {
|
151 |
+
$shipment = Mage::getModel('sales/order_shipment')->load($shipmentId);
|
152 |
+
|
153 |
+
//On récupère le numéro de tracking
|
154 |
+
$tracks = $shipment->getTracksCollection();
|
155 |
+
foreach ($tracks as $track) {
|
156 |
+
if ($track->getParentId() == $shipmentId) {
|
157 |
+
$this->_trackingNumbers .= $track->getnumber();
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
return $this->_trackingNumbers;
|
162 |
+
}
|
163 |
+
|
164 |
+
protected function getFilledValue($value) {
|
165 |
+
if ($value) {
|
166 |
+
return $this->removeaccents(trim($value));
|
167 |
+
} else {
|
168 |
+
return '';
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
+
protected function checkMobileNumber($value) {
|
173 |
+
if ($reqvalue = trim($value)) {
|
174 |
+
$_number = substr($reqvalue, 0, 2);
|
175 |
+
$fixed_array = array('01', '02', '03', '04', '05', '06', '06');
|
176 |
+
if (in_array($_number, $fixed_array)) {
|
177 |
+
return $reqvalue;
|
178 |
+
} else {
|
179 |
+
return '';
|
180 |
+
}
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
protected function getExpeditionParams($shipment, $_shippingMethod) {
|
185 |
+
$_order = $shipment->getOrder();
|
186 |
+
$_shippingAddress = $shipment->getShippingAddress();
|
187 |
+
$_billingAddress = $shipment->getBillingAddress();
|
188 |
+
$_helper = Mage::helper('chronorelais');
|
189 |
+
|
190 |
+
$shippingMethodAllow = array('chronorelais','chronopost','chronoexpress','chronopostc10','chronopostc18','chronopostcclassic','chronorelaiseurope','chronorelaisdom','chronopostsrdv','chronopostsameday');
|
191 |
+
if (in_array($_shippingMethod[0],$shippingMethodAllow)) {
|
192 |
+
$esdParams = $header = $shipper = $customer = $recipient = $ref = $skybill = $skybillParams = $password = array();
|
193 |
+
|
194 |
+
//header parameters
|
195 |
+
$header = array(
|
196 |
+
'idEmit' => 'MAG',
|
197 |
+
'accountNumber' => $_helper->getConfigurationAccountNumber(),
|
198 |
+
'subAccount' => $_helper->getConfigurationSubAccountNumber()
|
199 |
+
);
|
200 |
+
|
201 |
+
//shipper parameters
|
202 |
+
$shipperMobilePhone = $this->checkMobileNumber($_helper->getConfigurationShipperInfo('mobilephone'));
|
203 |
+
$shipper = array(
|
204 |
+
'shipperAdress1' => $_helper->getConfigurationShipperInfo('address1'),
|
205 |
+
'shipperAdress2' => $_helper->getConfigurationShipperInfo('address2'),
|
206 |
+
'shipperCity' => $_helper->getConfigurationShipperInfo('city'),
|
207 |
+
'shipperCivility' => $_helper->getConfigurationShipperInfo('civility'),
|
208 |
+
'shipperContactName' => $_helper->getConfigurationShipperInfo('contactname'),
|
209 |
+
'shipperCountry' => $_helper->getConfigurationShipperInfo('country'),
|
210 |
+
'shipperEmail' => $_helper->getConfigurationShipperInfo('email'),
|
211 |
+
'shipperMobilePhone' => $shipperMobilePhone,
|
212 |
+
'shipperName' => $_helper->getConfigurationShipperInfo('name'),
|
213 |
+
'shipperName2' => $_helper->getConfigurationShipperInfo('name2'),
|
214 |
+
'shipperPhone' => $_helper->getConfigurationShipperInfo('phone'),
|
215 |
+
'shipperPreAlert' => '',
|
216 |
+
'shipperZipCode' => $_helper->getConfigurationShipperInfo('zipcode')
|
217 |
+
);
|
218 |
+
|
219 |
+
//customer parameters
|
220 |
+
$customerMobilePhone = $this->checkMobileNumber($_helper->getConfigurationCustomerInfo('mobilephone'));
|
221 |
+
$customer = array(
|
222 |
+
'customerAdress1' => $_helper->getConfigurationCustomerInfo('address1'),
|
223 |
+
'customerAdress2' => $_helper->getConfigurationCustomerInfo('address2'),
|
224 |
+
'customerCity' => $_helper->getConfigurationCustomerInfo('city'),
|
225 |
+
'customerCivility' => $_helper->getConfigurationCustomerInfo('civility'),
|
226 |
+
'customerContactName' => $_helper->getConfigurationCustomerInfo('contactname'),
|
227 |
+
'customerCountry' => $_helper->getConfigurationCustomerInfo('country'),
|
228 |
+
'customerEmail' => $_helper->getConfigurationCustomerInfo('email'),
|
229 |
+
'customerMobilePhone' => $customerMobilePhone,
|
230 |
+
'customerName' => $_helper->getConfigurationCustomerInfo('name'),
|
231 |
+
'customerName2' => $_helper->getConfigurationCustomerInfo('name2'),
|
232 |
+
'customerPhone' => $_helper->getConfigurationCustomerInfo('phone'),
|
233 |
+
'customerPreAlert' => '',
|
234 |
+
'customerZipCode' => $_helper->getConfigurationCustomerInfo('zipcode')
|
235 |
+
);
|
236 |
+
|
237 |
+
//recipient parameters
|
238 |
+
$recipient_address = $_shippingAddress->getStreet();
|
239 |
+
if (!isset($recipient_address[1])) {
|
240 |
+
$recipient_address[1] = '';
|
241 |
+
}
|
242 |
+
$customer_email = ($_shippingAddress->getEmail()) ? $_shippingAddress->getEmail() : ($_billingAddress->getEmail() ? $_billingAddress->getEmail() : $_order->getCustomerEmail());
|
243 |
+
$recipientMobilePhone = $this->checkMobileNumber($_shippingAddress->getTelephone());
|
244 |
+
$recipientName = $this->getFilledValue($_shippingAddress->getCompany()); //RelayPoint Name if chronorelais or Companyname if chronopost and
|
245 |
+
$recipientName2 = $this->getFilledValue($_shippingAddress->getFirstname() . ' ' . $_shippingAddress->getLastname());
|
246 |
+
//remove any alphabets in phone number
|
247 |
+
|
248 |
+
$recipientPhone = trim(preg_replace("/[^0-9\.\-]/", " ", $_shippingAddress->getTelephone()));
|
249 |
+
|
250 |
+
$recipient = array(
|
251 |
+
'recipientAdress1' => substr($this->getFilledValue($recipient_address[0]), 0, 38),
|
252 |
+
'recipientAdress2' => substr($this->getFilledValue($recipient_address[1]), 0, 38),
|
253 |
+
'recipientCity' => $this->getFilledValue($_shippingAddress->getCity()),
|
254 |
+
'recipientContactName' => $recipientName2,
|
255 |
+
'recipientCountry' => $this->getFilledValue($_shippingAddress->getCountryId()),
|
256 |
+
'recipientEmail' => $customer_email,
|
257 |
+
'recipientMobilePhone' => $recipientMobilePhone,
|
258 |
+
'recipientName' => $recipientName,
|
259 |
+
'recipientName2' => $recipientName2,
|
260 |
+
'recipientPhone' => $recipientPhone,
|
261 |
+
'recipientPreAlert' => '',
|
262 |
+
'recipientZipCode' => $this->getFilledValue($_shippingAddress->getPostcode()),
|
263 |
+
);
|
264 |
+
|
265 |
+
//ref parameters
|
266 |
+
$recipientRef = $this->getFilledValue($_shippingAddress->getWRelayPointCode());
|
267 |
+
if (!$recipientRef) {
|
268 |
+
$recipientRef = $_order->getCustomerId();
|
269 |
+
}
|
270 |
+
$shipperRef = $_order->getRealOrderId();
|
271 |
+
|
272 |
+
$ref = array(
|
273 |
+
'recipientRef' => $recipientRef,
|
274 |
+
'shipperRef' => $shipperRef
|
275 |
+
);
|
276 |
+
|
277 |
+
//skybill parameters
|
278 |
+
/* Livraison Samedi (Delivery Saturday) field */
|
279 |
+
$SaturdayShipping = 0; //default value for the saturday shipping
|
280 |
+
if ($_shippingMethod[0] == "chronopost" || $_shippingMethod[0] == "chronorelais" || $_shippingMethod[0] == "chronorelaisdom") {
|
281 |
+
if (!$_deliver_on_saturday = Mage::helper('chronorelais')->getLivraisonSamediStatus($_order->getEntityId())) {
|
282 |
+
$_deliver_on_saturday = Mage::helper('chronorelais')->getConfigData('carriers/' . $_shippingMethod[0] . '/deliver_on_saturday');
|
283 |
+
} else {
|
284 |
+
if ($_deliver_on_saturday == 'Yes') {
|
285 |
+
$_deliver_on_saturday = 1;
|
286 |
+
} else {
|
287 |
+
$_deliver_on_saturday = 0;
|
288 |
+
}
|
289 |
+
}
|
290 |
+
$is_sending_day = Mage::helper('chronorelais')->isSendingDay();
|
291 |
+
|
292 |
+
if($_shippingMethod[0] == "chronorelaisdom") {
|
293 |
+
if ($_deliver_on_saturday && $is_sending_day) {
|
294 |
+
$SaturdayShipping = 369;
|
295 |
+
} else {
|
296 |
+
$SaturdayShipping = 368;
|
297 |
+
}
|
298 |
+
} else {
|
299 |
+
if ($_deliver_on_saturday && $is_sending_day) {
|
300 |
+
$SaturdayShipping = 6;
|
301 |
+
} elseif (!$_deliver_on_saturday && $is_sending_day) {
|
302 |
+
$SaturdayShipping = 1;
|
303 |
+
}
|
304 |
+
}
|
305 |
+
|
306 |
+
}
|
307 |
+
|
308 |
+
$weight = 0;
|
309 |
+
foreach ($shipment->getItemsCollection() as $item) {
|
310 |
+
$weight += $item->weight * $item->qty;
|
311 |
+
}
|
312 |
+
if ($_helper->getConfigWeightUnit() == 'g') {
|
313 |
+
$weight = $weight / 1000; /* conversion g => kg */
|
314 |
+
}
|
315 |
+
|
316 |
+
/* si chronorelaiseurope : service : 337 si poids < 3kg ou 338 si > 3kg */
|
317 |
+
if($_shippingMethod[0] == "chronorelaiseurope") {
|
318 |
+
$weight <= 3 ? $SaturdayShipping = '337' : $SaturdayShipping = '338';
|
319 |
+
}
|
320 |
+
|
321 |
+
|
322 |
+
$weight = 0; /* On met le poids à 0 car les colis sont pesé sur place */
|
323 |
+
|
324 |
+
$skybill = array(
|
325 |
+
'codCurrency' => 'EUR',
|
326 |
+
'codValue' => '',
|
327 |
+
'content1' => '',
|
328 |
+
'content2' => '',
|
329 |
+
'content3' => '',
|
330 |
+
'content4' => '',
|
331 |
+
'content5' => '',
|
332 |
+
'customsCurrency' => 'EUR',
|
333 |
+
'customsValue' => '',
|
334 |
+
'evtCode' => 'DC',
|
335 |
+
'insuredCurrency' => 'EUR',
|
336 |
+
'insuredValue' => '',
|
337 |
+
'objectType' => 'MAR',
|
338 |
+
'productCode' => $_helper->getChronoProductCodeToShipment($_shippingMethod[0]),
|
339 |
+
'service' => $SaturdayShipping,
|
340 |
+
'shipDate' => date('c'),
|
341 |
+
'shipHour' => date('H'),
|
342 |
+
'weight' => $weight,
|
343 |
+
'weightUnit' => 'KGM'
|
344 |
+
);
|
345 |
+
|
346 |
+
$skybillParams = array(
|
347 |
+
'mode' => $_helper->getConfigurationSkybillParam()
|
348 |
+
);
|
349 |
+
|
350 |
+
$expeditionArray = array(
|
351 |
+
'headerValue' => $header,
|
352 |
+
'shipperValue' => $shipper,
|
353 |
+
'customerValue' => $customer,
|
354 |
+
'recipientValue' => $recipient,
|
355 |
+
'refValue' => $ref,
|
356 |
+
'skybillValue' => $skybill,
|
357 |
+
'skybillParamsValue' => $skybillParams,
|
358 |
+
'password' => $_helper->getConfigurationAccountPass()
|
359 |
+
);
|
360 |
+
|
361 |
+
/* si chronopostsrdv : ajout parametres supplementaires */
|
362 |
+
if($_shippingMethod[0] == "chronopostsrdv") {
|
363 |
+
|
364 |
+
$chronopostsrdv_creneaux_info = $_shippingAddress->getData('chronopostsrdv_creneaux_info');
|
365 |
+
$chronopostsrdv_creneaux_info = json_decode($chronopostsrdv_creneaux_info,true);
|
366 |
+
|
367 |
+
$_dateRdvStart = new DateTime($chronopostsrdv_creneaux_info['deliveryDate']);
|
368 |
+
$_dateRdvStart->setTime($chronopostsrdv_creneaux_info['startHour'],$chronopostsrdv_creneaux_info['startMinutes']);
|
369 |
+
|
370 |
+
$_dateRdvEnd = new DateTime($chronopostsrdv_creneaux_info['deliveryDate']);
|
371 |
+
$_dateRdvEnd->setTime($chronopostsrdv_creneaux_info['endHour'],$chronopostsrdv_creneaux_info['endMinutes']);
|
372 |
+
|
373 |
+
|
374 |
+
$scheduledValue = array(
|
375 |
+
'appointmentValue' => array(
|
376 |
+
'timeSlotStartDate' => $_dateRdvStart->format("Y-m-d")."T".$_dateRdvStart->format("H:i:s"),
|
377 |
+
'timeSlotEndDate' => $_dateRdvEnd->format("Y-m-d")."T".$_dateRdvEnd->format("H:i:s"),
|
378 |
+
'timeSlotTariffLevel' => $chronopostsrdv_creneaux_info['tariffLevel']
|
379 |
+
)
|
380 |
+
);
|
381 |
+
$expeditionArray['scheduledValue'] = $scheduledValue;
|
382 |
+
|
383 |
+
/* modification productCode et service car dynamique pour ce mode de livraison */
|
384 |
+
|
385 |
+
$expeditionArray['skybillValue']['productCode'] = $chronopostsrdv_creneaux_info['productCode'];
|
386 |
+
$expeditionArray['skybillValue']['service'] = $chronopostsrdv_creneaux_info['serviceCode'];
|
387 |
+
|
388 |
+
}
|
389 |
+
|
390 |
+
return $expeditionArray;
|
391 |
+
}
|
392 |
+
}
|
393 |
+
|
394 |
+
protected function getEtiquetteUrl($shipmentId) {
|
395 |
+
//On récupère les infos d'expédition
|
396 |
+
$_helper = Mage::helper('chronorelais');
|
397 |
+
|
398 |
+
$shipment = Mage::getModel('sales/order_shipment')->load($shipmentId);
|
399 |
+
if ($_shipTracks = $shipment->getAllTracks()) {
|
400 |
+
foreach ($_shipTracks as $_shipTrack) {
|
401 |
+
if ($_shipTrack->getNumber() && $_shipTrack->getChronoReservationNumber()) {
|
402 |
+
$skybill = base64_decode($_shipTrack->getChronoReservationNumber());
|
403 |
+
break;
|
404 |
+
}
|
405 |
+
}
|
406 |
+
if ($skybill) {
|
407 |
+
return $skybill;
|
408 |
+
}
|
409 |
+
}
|
410 |
+
|
411 |
+
$_order = $shipment->getOrder();
|
412 |
+
$_shippingMethod = explode("_", $_order->getShippingMethod());
|
413 |
+
|
414 |
+
$expeditionArray = $this->getExpeditionParams($shipment, $_shippingMethod);
|
415 |
+
$tracking_number = '';
|
416 |
+
if ($expeditionArray) {
|
417 |
+
$client = new SoapClient("https://www.chronopost.fr/shipping-cxf/ShippingServiceWS?wsdl", array('trace' => true));
|
418 |
+
try {
|
419 |
+
$webservbt = $client->shippingV3($expeditionArray);
|
420 |
+
if (!$webservbt->return->errorCode && $webservbt->return->skybill) {
|
421 |
+
$tracking_number = $webservbt->return->skybillNumber;
|
422 |
+
// Add tracking number for the shipment if not already exists.
|
423 |
+
if (!$this->_trackingNumbers && $webservbt->return->skybillNumber) {
|
424 |
+
$track = Mage::getModel('sales/order_shipment_track')
|
425 |
+
->setNumber($webservbt->return->skybillNumber)
|
426 |
+
->setChronoReservationNumber(base64_encode($webservbt->return->skybill))
|
427 |
+
->setCarrier(ucwords($_shippingMethod[0]))
|
428 |
+
->setCarrierCode($_shippingMethod[0])
|
429 |
+
->setTitle(ucwords($_shippingMethod[0]))
|
430 |
+
->setPopup(1);
|
431 |
+
$shipment->addTrack($track);
|
432 |
+
|
433 |
+
$tracking_url = str_replace('{tracking_number}', $tracking_number, Mage::helper('chronorelais')->getConfigurationTrackingViewUrl());
|
434 |
+
$tracking_title = $this->__('Track Your Order');
|
435 |
+
$tracking_order = '<p><a title="' . $tracking_title . '" href="' . $tracking_url . '"><b>' . $tracking_title . '</b></a></p>';
|
436 |
+
|
437 |
+
$comment = '';
|
438 |
+
$shipment->setEmailSent(true);
|
439 |
+
$this->_saveShipment($shipment);
|
440 |
+
$shipment->sendEmail(1, $tracking_order . $comment);
|
441 |
+
}
|
442 |
+
return $webservbt->return->skybill; // pdf base64
|
443 |
+
} else {
|
444 |
+
$this->_getSession()->addError($_helper->__($webservbt->return->errorMessage));
|
445 |
+
}
|
446 |
+
} catch (SoapFault $fault) {
|
447 |
+
$this->_getSession()->addError($_helper->__($fault->faultstring));
|
448 |
+
}
|
449 |
+
}
|
450 |
+
}
|
451 |
+
|
452 |
+
public function getShipmentByOrderId($orderId) {
|
453 |
+
$_shipment = Mage::getResourceModel('sales/order_shipment_grid_collection')
|
454 |
+
->addAttributeToFilter('order_id', $orderId)
|
455 |
+
->getAllIds();
|
456 |
+
return $_shipment;
|
457 |
+
}
|
458 |
+
|
459 |
+
public function getShipmentByIncrementId($incrementId) {
|
460 |
+
$_shipment = Mage::getResourceModel('sales/order_shipment_grid_collection')
|
461 |
+
->addAttributeToFilter('increment_id', $incrementId)
|
462 |
+
->getAllIds();
|
463 |
+
return $_shipment;
|
464 |
+
}
|
465 |
+
|
466 |
+
public function initShipment($orderId,$savedQtys = '') {
|
467 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
468 |
+
|
469 |
+
/**
|
470 |
+
* Check order existing
|
471 |
+
*/
|
472 |
+
if (!$order->getId()) {
|
473 |
+
$this->_getSession()->addError($this->__('The order no longer exists.'));
|
474 |
+
return false;
|
475 |
+
}
|
476 |
+
/**
|
477 |
+
* Check shipment is available to create separate from invoice
|
478 |
+
*/
|
479 |
+
if ($order->getForcedDoShipmentWithInvoice()) {
|
480 |
+
$this->_getSession()->addError($this->__('Cannot do shipment for the order separately from invoice.'));
|
481 |
+
return false;
|
482 |
+
}
|
483 |
+
/**
|
484 |
+
* Check shipment create availability
|
485 |
+
*/
|
486 |
+
if(empty($savedQtys)) {
|
487 |
+
$savedQtys = $this->_getItemQtys();
|
488 |
+
}
|
489 |
+
$shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($savedQtys);
|
490 |
+
if(Mage::registry('current_shipment')) {
|
491 |
+
Mage::unregister ('current_shipment');
|
492 |
+
}
|
493 |
+
Mage::register('current_shipment', $shipment);
|
494 |
+
return $shipment;
|
495 |
+
}
|
496 |
+
|
497 |
+
public function createNewShipment($orderId,$savedQtys = '') {
|
498 |
+
$_helper = Mage::helper('chronorelais');
|
499 |
+
$skybill = '';
|
500 |
+
try {
|
501 |
+
if ($shipment = $this->initShipment($orderId,$savedQtys)) {
|
502 |
+
$shipment->register();
|
503 |
+
|
504 |
+
$_order = $shipment->getOrder();
|
505 |
+
$_shippingMethod = explode("_", $_order->getShippingMethod());
|
506 |
+
|
507 |
+
$expeditionArray = $this->getExpeditionParams($shipment, $_shippingMethod);
|
508 |
+
$tracking_number = '';
|
509 |
+
if ($expeditionArray) {
|
510 |
+
|
511 |
+
$client = new SoapClient("https://www.chronopost.fr/shipping-cxf/ShippingServiceWS?wsdl", array('trace' => true));
|
512 |
+
try {
|
513 |
+
$expedition = $client->shippingV3($expeditionArray);
|
514 |
+
if (!$expedition->return->errorCode && $expedition->return->skybillNumber) {
|
515 |
+
$tracking_number = $expedition->return->skybillNumber;
|
516 |
+
$track = Mage::getModel('sales/order_shipment_track')
|
517 |
+
->setNumber($expedition->return->skybillNumber)
|
518 |
+
->setChronoReservationNumber(base64_encode($expedition->return->skybill))
|
519 |
+
->setCarrier(ucwords($_shippingMethod[0]))
|
520 |
+
->setCarrierCode($_shippingMethod[0])
|
521 |
+
->setTitle(ucwords($_shippingMethod[0]))
|
522 |
+
->setPopup(1);
|
523 |
+
$shipment->addTrack($track);
|
524 |
+
$skybill = $expedition->return->skybill;
|
525 |
+
} else {
|
526 |
+
$this->_getSession()->addError($_helper->__($expedition->return->errorMessage));
|
527 |
+
return;
|
528 |
+
}
|
529 |
+
} catch (SoapFault $fault) {
|
530 |
+
$this->_getSession()->addError($_helper->__($fault->faultstring));
|
531 |
+
return;
|
532 |
+
}
|
533 |
+
}
|
534 |
+
|
535 |
+
$tracking_url = str_replace('{tracking_number}', $tracking_number, Mage::helper('chronorelais')->getConfigurationTrackingViewUrl());
|
536 |
+
$tracking_title = $this->__('Track Your Order');
|
537 |
+
$tracking_order = '<p><a title="' . $tracking_title . '" href="' . $tracking_url . '"><b>' . $tracking_title . '</b></a></p>';
|
538 |
+
|
539 |
+
$comment = '';
|
540 |
+
$shipment->setEmailSent(true);
|
541 |
+
$this->_saveShipment($shipment);
|
542 |
+
$shipment->sendEmail(1, $tracking_order . $comment);
|
543 |
+
$this->_getSession()->addSuccess($this->__('Shipment was successfully created.'));
|
544 |
+
return $skybill;
|
545 |
+
} else {
|
546 |
+
$this->_forward('noRoute');
|
547 |
+
return;
|
548 |
+
}
|
549 |
+
} catch (Mage_Core_Exception $e) {
|
550 |
+
$this->_getSession()->addError($e->getMessage());
|
551 |
+
return;
|
552 |
+
} catch (Exception $e) {
|
553 |
+
$this->_getSession()->addError($this->__('Can not save shipment: ' . $e->getMessage()));
|
554 |
+
return;
|
555 |
+
}
|
556 |
+
}
|
557 |
+
|
558 |
+
public function printMassAction() {
|
559 |
+
$orderIds = $this->getRequest()->getParam('order_ids');
|
560 |
+
$skybillArr = array();
|
561 |
+
$helper = Mage::helper('chronorelais');
|
562 |
+
foreach ($orderIds as $orderId) {
|
563 |
+
if ($_shipments = $this->getShipmentByOrderId($orderId)) {
|
564 |
+
if (count($_shipments) == 1) {
|
565 |
+
$shipmentId = $_shipments[0];
|
566 |
+
$skybill = $this->getEtiquetteUrl($shipmentId);
|
567 |
+
if ($skybill) {
|
568 |
+
$skybillArr[] = $skybill;
|
569 |
+
}
|
570 |
+
} else {
|
571 |
+
foreach ($_shipments as $_shipment) {
|
572 |
+
$skybill = $this->getEtiquetteUrl($_shipment);
|
573 |
+
if ($skybill) {
|
574 |
+
$skybillArr[] = $skybill;
|
575 |
+
}
|
576 |
+
}
|
577 |
+
}
|
578 |
+
} else {
|
579 |
+
|
580 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
581 |
+
|
582 |
+
/* If shipping method is Chronopost => check if shipping weight isn't over limit */
|
583 |
+
$chronopostMethods = array('chronorelais','chronopost','chronoexpress','chronopostc10','chronopostc18','chronopostcclassic','chronorelaiseurope','chronorelaisdom','chronopostsrdv','chronopostsameday');
|
584 |
+
$shippingMethod = $order->getShippingMethod();
|
585 |
+
$shippingMethod = explode("_", $shippingMethod);
|
586 |
+
$shippingMethod = $shippingMethod[0];
|
587 |
+
if(in_array($shippingMethod, $chronopostMethods)) {
|
588 |
+
$weightShipping = 0;
|
589 |
+
$weight_limit = Mage::getStoreConfig('carriers/'.$shippingMethod.'/weight_limit');
|
590 |
+
foreach ($order->getItemsCollection() as $item) {
|
591 |
+
$weightShipping += $item->getWeight()*$item->getQtyOrdered();
|
592 |
+
}
|
593 |
+
if($helper->getConfigWeightUnit() == 'g')
|
594 |
+
{
|
595 |
+
$weightShipping = $weightShipping / 1000; // conversion g => kg
|
596 |
+
}
|
597 |
+
if($weightShipping > $weight_limit) {
|
598 |
+
/* multi shipping. 1 shipment by product */
|
599 |
+
foreach ($order->getItemsCollection() as $item) {
|
600 |
+
$qty = $item->getQtyOrdered();
|
601 |
+
for($i = 1; $i <= $qty; $i++) {
|
602 |
+
$skybill = $this->createNewShipment($orderId,array($item->getId() => '1'));
|
603 |
+
if ($skybill)
|
604 |
+
$skybillArr[] = $skybill;
|
605 |
+
}
|
606 |
+
}
|
607 |
+
}
|
608 |
+
else {
|
609 |
+
$skybill = $this->createNewShipment($orderId);
|
610 |
+
if ($skybill) {
|
611 |
+
$skybillArr[] = $skybill;
|
612 |
+
}
|
613 |
+
}
|
614 |
+
}
|
615 |
+
else {
|
616 |
+
$skybill = $this->createNewShipment($orderId);
|
617 |
+
if ($skybill) {
|
618 |
+
$skybillArr[] = $skybill;
|
619 |
+
}
|
620 |
+
}
|
621 |
+
}
|
622 |
+
}
|
623 |
+
if (count($skybillArr)) {
|
624 |
+
$this->_processDownloadMass($skybillArr);
|
625 |
+
}
|
626 |
+
else {
|
627 |
+
return $this->_redirectReferer();
|
628 |
+
}
|
629 |
+
}
|
630 |
+
|
631 |
+
public function printAction() {
|
632 |
+
// Appel via order_id
|
633 |
+
$orderId = $this->getRequest()->getParam('order_id');
|
634 |
+
$helper = Mage::helper('chronorelais');
|
635 |
+
if ($orderId) {
|
636 |
+
if ($_shipments = $this->getShipmentByOrderId($orderId)) {
|
637 |
+
if (count($_shipments) == 1) {
|
638 |
+
$shipmentId = $_shipments[0];
|
639 |
+
$skybillArr = $this->getEtiquetteUrl($shipmentId);
|
640 |
+
} else {
|
641 |
+
$track = "Cette commande contient plusieurs expéditions, cliquez sur chaque lien pour obtenir les étiquettes :<br>";
|
642 |
+
/*foreach ($_shipments as $_shipment) {
|
643 |
+
$url = str_replace('{trackingNumber}', $this->getEtiquetteUrl($_shipment), $helper->getConfigurationTrackingUrl());
|
644 |
+
$track .= '<a target="_blank" href="' . $url . '">' . $url . '</a><br />';
|
645 |
+
}*/
|
646 |
+
echo $track;
|
647 |
+
return;
|
648 |
+
}
|
649 |
+
} else {
|
650 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
651 |
+
|
652 |
+
/* If shipping method is Chronopost => check if shipping weight isn't over limit */
|
653 |
+
$chronopostMethods = array('chronorelais','chronopost','chronoexpress','chronopostc10','chronopostc18','chronopostcclassic','chronorelaiseurope','chronorelaisdom','chronopostsrdv','chronopostsameday');
|
654 |
+
$shippingMethod = $order->getShippingMethod();
|
655 |
+
$shippingMethod = explode("_", $shippingMethod);
|
656 |
+
$shippingMethod = $shippingMethod[0];
|
657 |
+
if(in_array($shippingMethod, $chronopostMethods)) {
|
658 |
+
$weightShipping = 0;
|
659 |
+
$shippingMethod = explode("_", $shippingMethod);
|
660 |
+
$shippingMethod = $shippingMethod[0];
|
661 |
+
$weight_limit = Mage::getStoreConfig('carriers/'.$shippingMethod.'/weight_limit');
|
662 |
+
foreach ($order->getItemsCollection() as $item) {
|
663 |
+
$weightShipping += $item->getWeight()*$item->getQtyOrdered();
|
664 |
+
}
|
665 |
+
if($helper->getConfigWeightUnit() == 'g')
|
666 |
+
{
|
667 |
+
$weightShipping = $weightShipping / 1000; // conversion g => kg
|
668 |
+
}
|
669 |
+
if($weightShipping > $weight_limit) {
|
670 |
+
/* multi shipping. 1 shipment by product */
|
671 |
+
$skybillArr = array();
|
672 |
+
foreach ($order->getItemsCollection() as $item) {
|
673 |
+
$qty = $item->getQtyOrdered();
|
674 |
+
for($i = 1; $i <= $qty; $i++) {
|
675 |
+
$skybillArr[] = $this->createNewShipment($orderId,array($item->getId() => '1'));
|
676 |
+
}
|
677 |
+
}
|
678 |
+
}
|
679 |
+
else {
|
680 |
+
$skybillArr = $this->createNewShipment($orderId);
|
681 |
+
}
|
682 |
+
}
|
683 |
+
else {
|
684 |
+
$skybillArr = $this->createNewShipment($orderId);
|
685 |
+
}
|
686 |
+
}
|
687 |
+
} else {
|
688 |
+
$shipmentId = $this->getRequest()->getParam('shipment_id');
|
689 |
+
if ($shipmentId) {
|
690 |
+
$skybillArr = $this->getEtiquetteUrl($shipmentId);
|
691 |
+
} else {
|
692 |
+
$shipmentIncrementId = $this->getRequest()->getParam('shipment_increment_id');
|
693 |
+
$shipmentId = $this->getShipmentByIncrementId($shipmentIncrementId);
|
694 |
+
$skybillArr = $this->getEtiquetteUrl($shipmentId[0]);
|
695 |
+
}
|
696 |
+
}
|
697 |
+
|
698 |
+
|
699 |
+
if ($skybillArr) {
|
700 |
+
try {
|
701 |
+
if(is_array($skybillArr)) {
|
702 |
+
$this->_processDownloadMass($skybillArr);
|
703 |
+
}
|
704 |
+
else {
|
705 |
+
$this->_prepareDownloadResponse('Etiquette_chronopost.pdf', $skybillArr);
|
706 |
+
|
707 |
+
}
|
708 |
+
} catch (Mage_Core_Exception $e) {
|
709 |
+
$this->_getSession()->addError($helper->__('Désolé, une erreur est survenu lors de la récupération de l\'étiquettes. Merci de contacter Chronopost ou de réessayer plus tard'));
|
710 |
+
}
|
711 |
+
}
|
712 |
+
else {
|
713 |
+
return $this->_redirectReferer();
|
714 |
+
}
|
715 |
+
}
|
716 |
+
|
717 |
+
public function massLivraisonSamediStatusAction() {
|
718 |
+
if ($this->getRequest()->getPost('status')) {
|
719 |
+
$this->saveLivraisonSamediStatusAction();
|
720 |
+
}
|
721 |
+
}
|
722 |
+
|
723 |
+
/* Save the Livraison le Samedi status to orders */
|
724 |
+
|
725 |
+
public function saveLivraisonSamediStatusAction() {
|
726 |
+
/* get the orders */
|
727 |
+
$orderIds = $this->getRequest()->getPost('order_ids');
|
728 |
+
$status = $this->getRequest()->getPost('status');
|
729 |
+
$_connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
730 |
+
$_table = Mage::getSingleton('core/resource')->getTableName('sales_chronopost_order_export_status');
|
731 |
+
$exceptions = array();
|
732 |
+
|
733 |
+
foreach ($orderIds as $orderId) {
|
734 |
+
$order_details = Mage::getModel('sales/order')->load($orderId);
|
735 |
+
$shipping_method = '';
|
736 |
+
$livraison_le_samedi = $status;
|
737 |
+
if ($shipping_method = $order_details->getShippingMethod()) {
|
738 |
+
$shipping_method = explode('_', $shipping_method);
|
739 |
+
if ($shipping_method[0] == 'chronoexpress') {
|
740 |
+
$livraison_le_samedi = '--';
|
741 |
+
}
|
742 |
+
}
|
743 |
+
$condition = array(
|
744 |
+
$_connection->quoteInto('order_id = ?', $orderId),
|
745 |
+
);
|
746 |
+
$_connection->delete($_table, $condition);
|
747 |
+
|
748 |
+
$dataLine = array(
|
749 |
+
'order_id' => $orderId,
|
750 |
+
'livraison_le_samedi' => $livraison_le_samedi
|
751 |
+
);
|
752 |
+
try {
|
753 |
+
$_connection->insert($_table, $dataLine);
|
754 |
+
} catch (Exception $e) {
|
755 |
+
$exceptions[] = Mage::helper('chronorelais')->__('Order assigning error: ' . $e->getMessage());
|
756 |
+
}
|
757 |
+
}
|
758 |
+
if ($exceptions) {
|
759 |
+
$this->_getSession()->addError($exceptions);
|
760 |
+
} else {
|
761 |
+
$this->_getSession()->addSuccess($this->__('Livraison le Samedi statut a été ajouté'));
|
762 |
+
}
|
763 |
+
$this->_redirect('*/*/index');
|
764 |
+
}
|
765 |
+
|
766 |
+
/* Remove accents characters */
|
767 |
+
|
768 |
+
public function removeaccents($string) {
|
769 |
+
$stringToReturn = str_replace(
|
770 |
+
array('à', 'á', 'â', 'ã', 'ä', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', '/', '\xa8'), array('a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y', 'A', 'A', 'A', 'A', 'A', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'N', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', ' ', 'e'), $string);
|
771 |
+
// Remove all remaining other unknown characters
|
772 |
+
$stringToReturn = preg_replace('/[^a-zA-Z0-9\-]/', ' ', $stringToReturn);
|
773 |
+
$stringToReturn = preg_replace('/^[\-]+/', '', $stringToReturn);
|
774 |
+
$stringToReturn = preg_replace('/[\-]+$/', '', $stringToReturn);
|
775 |
+
$stringToReturn = preg_replace('/[\-]{2,}/', ' ', $stringToReturn);
|
776 |
+
return $stringToReturn;
|
777 |
+
}
|
778 |
+
|
779 |
+
/*
|
780 |
+
* *******************************************************************
|
781 |
+
* ******************** ETIQUETTE DE RETOUR **************************
|
782 |
+
* *******************************************************************
|
783 |
+
*/
|
784 |
+
|
785 |
+
public function printEtiquetteRetourAction() {
|
786 |
+
$shipmentIncrementId = $this->getRequest()->getParam('shipment_increment_id');
|
787 |
+
$shipmentId = $this->getShipmentByIncrementId($shipmentIncrementId);
|
788 |
+
$shipmentId = $shipmentId[0];
|
789 |
+
$shipment = Mage::getModel('sales/order_shipment')->load($shipmentId);
|
790 |
+
$_order = $shipment->getOrder();
|
791 |
+
$_shippingAddress = $shipment->getShippingAddress();
|
792 |
+
$_billingAddress = $shipment->getBillingAddress();
|
793 |
+
$skillbill = $this->getEtiquetteRetourUrl($shipment); /* skillbill pdf encode base64*/
|
794 |
+
|
795 |
+
if ($skillbill) {
|
796 |
+
try {
|
797 |
+
$path = $this->savePdfWithContent($skillbill, $shipmentId);
|
798 |
+
|
799 |
+
$message_email = 'Bonjour,
|
800 |
+
<br />Vous allez bientôt effectuer un envoi Chronopost. La personne qui vous a adressé ce mail a déjà préparé la lettre de transport que vous utiliserez. Après impression, apposez la lettre de transport dans une pochette plastique adhésive et collez la sur votre envoi. Attention le code à barres doit être bien apparent.
|
801 |
+
<br />Cordialement,';
|
802 |
+
|
803 |
+
$customer_email = ($_shippingAddress->getEmail()) ? $_shippingAddress->getEmail() : ($_billingAddress->getEmail() ? $_billingAddress->getEmail() : $_order->getCustomerEmail());
|
804 |
+
|
805 |
+
$mail = new Zend_Mail('utf-8');
|
806 |
+
$mail->setBodyHtml($message_email);
|
807 |
+
$mail->setFrom(Mage::getStoreConfig('contacts/email/recipient_email'));
|
808 |
+
$mail->setSubject($_order->getStoreName(1) . ' : Etiquette de retour chronopost');
|
809 |
+
$mail->createAttachment(file_get_contents($path), Zend_Mime::TYPE_OCTETSTREAM, Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, 'etiquette_retour.pdf');
|
810 |
+
|
811 |
+
$mail->addTo($customer_email);
|
812 |
+
$mail->send();
|
813 |
+
|
814 |
+
$mail->clearRecipients();
|
815 |
+
$mail->addTo(Mage::getStoreConfig('contacts/email/recipient_email'));
|
816 |
+
$mail->send();
|
817 |
+
|
818 |
+
$this->_getSession()->addSuccess(Mage::helper('chronorelais')->__('L\'etiquette de retour à bien été envoyée au client.'));
|
819 |
+
} catch (Mage_Core_Exception $e) {
|
820 |
+
$this->_getSession()->addError(Mage::helper('chronorelais')->__('Désolé, une erreure est survenu lors de la récupération de l\'étiquettes. Merci de contacter Chronopost ou de réessayer plus tard'));
|
821 |
+
}
|
822 |
+
}
|
823 |
+
return $this->_redirectReferer();
|
824 |
+
}
|
825 |
+
|
826 |
+
protected function getEtiquetteRetourParams($shipment, $_shippingMethod) {
|
827 |
+
$_order = $shipment->getOrder();
|
828 |
+
$_shippingAddress = $shipment->getShippingAddress();
|
829 |
+
$_billingAddress = $shipment->getBillingAddress();
|
830 |
+
$_helper = Mage::helper('chronorelais');
|
831 |
+
|
832 |
+
if ($_shippingAddress->getCountryId() != 'FR'
|
833 |
+
&& strpos($_shippingMethod[0], 'chronorelaiseurope') === false
|
834 |
+
&& strpos($_shippingMethod[0], 'chronorelaisdom') === false
|
835 |
+
&& strpos($_shippingMethod[0], 'chronopostsrdv') === false
|
836 |
+
) {
|
837 |
+
$this->_getSession()->addError($_helper->__('Les retours sont disponibles uniquement pour la France'));
|
838 |
+
return;
|
839 |
+
}
|
840 |
+
$shippingMethodAllow = array('chronorelaiseurope','chronorelais','chronopost','chronopostc10','chronopostc18','chronopostsrdv');
|
841 |
+
if (!in_array($_shippingMethod[0], $shippingMethodAllow)) {
|
842 |
+
$this->_getSession()->addError($_helper->__('Les retours ne sont pas disponibles pour le mode de livraison ' . $_shippingMethod[0]));
|
843 |
+
return;
|
844 |
+
}
|
845 |
+
|
846 |
+
if (in_array($_shippingMethod[0], $shippingMethodAllow)) {
|
847 |
+
$esdParams = $header = $shipper = $customer = $recipient = $ref = $skybill = $skybillParams = $password = array();
|
848 |
+
|
849 |
+
//header parameters
|
850 |
+
$header = array(
|
851 |
+
'idEmit' => 'MAG',
|
852 |
+
'accountNumber' => $_helper->getConfigurationAccountNumber(),
|
853 |
+
'subAccount' => $_helper->getConfigurationSubAccountNumber()
|
854 |
+
);
|
855 |
+
|
856 |
+
//shipper parameters
|
857 |
+
$shipperMobilePhone = $this->checkMobileNumber($_helper->getConfigurationShipperInfo('mobilephone'));
|
858 |
+
$recipient = array(
|
859 |
+
'recipientAdress1' => $_helper->getConfigurationShipperInfo('address1'),
|
860 |
+
'recipientAdress2' => $_helper->getConfigurationShipperInfo('address2'),
|
861 |
+
'recipientCity' => $_helper->getConfigurationShipperInfo('city'),
|
862 |
+
'recipientCivility' => $_helper->getConfigurationShipperInfo('civility'),
|
863 |
+
'recipientContactName' => $_helper->getConfigurationShipperInfo('contactname'),
|
864 |
+
'recipientCountry' => $_helper->getConfigurationShipperInfo('country'),
|
865 |
+
'recipientEmail' => $_helper->getConfigurationShipperInfo('email'),
|
866 |
+
'recipientMobilePhone' => $shipperMobilePhone,
|
867 |
+
'recipientName' => $_helper->getConfigurationShipperInfo('name'),
|
868 |
+
'recipientName2' => $_helper->getConfigurationShipperInfo('name2'),
|
869 |
+
'recipientPhone' => $_helper->getConfigurationShipperInfo('phone'),
|
870 |
+
'recipientPreAlert' => '',
|
871 |
+
'recipientZipCode' => $_helper->getConfigurationShipperInfo('zipcode')
|
872 |
+
);
|
873 |
+
|
874 |
+
//customer parameters
|
875 |
+
$customerMobilePhone = $this->checkMobileNumber($_helper->getConfigurationCustomerInfo('mobilephone'));
|
876 |
+
$customer = array(
|
877 |
+
'customerAdress1' => $_helper->getConfigurationCustomerInfo('address1'),
|
878 |
+
'customerAdress2' => $_helper->getConfigurationCustomerInfo('address2'),
|
879 |
+
'customerCity' => $_helper->getConfigurationCustomerInfo('city'),
|
880 |
+
'customerCivility' => $_helper->getConfigurationCustomerInfo('civility'),
|
881 |
+
'customerContactName' => $_helper->getConfigurationCustomerInfo('contactname'),
|
882 |
+
'customerCountry' => $_helper->getConfigurationCustomerInfo('country'),
|
883 |
+
'customerEmail' => $_helper->getConfigurationCustomerInfo('email'),
|
884 |
+
'customerMobilePhone' => $customerMobilePhone,
|
885 |
+
'customerName' => $_helper->getConfigurationCustomerInfo('name'),
|
886 |
+
'customerName2' => $_helper->getConfigurationCustomerInfo('name2'),
|
887 |
+
'customerPhone' => $_helper->getConfigurationCustomerInfo('phone'),
|
888 |
+
'customerPreAlert' => '',
|
889 |
+
'customerZipCode' => $_helper->getConfigurationCustomerInfo('zipcode')
|
890 |
+
);
|
891 |
+
|
892 |
+
//recipient parameters
|
893 |
+
$_recipientAddress = $_shippingAddress;
|
894 |
+
if(strpos($_shippingMethod[0],'chronorelais') !== false) {
|
895 |
+
// Nicolas, le 27/11/2014 : si Chronorelais, on doit utiliser l'adresse de facturation, non de livraison (qui est celle du relais)
|
896 |
+
$_recipientAddress = $_billingAddress;
|
897 |
+
}
|
898 |
+
$recipient_address = $_recipientAddress->getStreet();
|
899 |
+
|
900 |
+
// Champs forcément basés sur l'adresse de livraison
|
901 |
+
$customer_email = ($_shippingAddress->getEmail()) ? $_shippingAddress->getEmail() : ($_billingAddress->getEmail() ? $_billingAddress->getEmail() : $_order->getCustomerEmail());
|
902 |
+
$recipientMobilePhone = $this->checkMobileNumber($_shippingAddress->getTelephone());
|
903 |
+
$recipientName = $this->getFilledValue($_recipientAddress->getCompany()); //RelayPoint Name if chronorelais or Companyname if chronopost and
|
904 |
+
$recipientName2 = $this->getFilledValue($_shippingAddress->getFirstname() . ' ' . $_shippingAddress->getLastname());
|
905 |
+
//remove any alphabets in phone number
|
906 |
+
|
907 |
+
$recipientPhone = trim(preg_replace("/[^0-9\.\-]/", " ", $_shippingAddress->getTelephone()));
|
908 |
+
if (!isset($recipient_address[1])) {
|
909 |
+
$recipient_address[1] = '';
|
910 |
+
}
|
911 |
+
|
912 |
+
$shipper = array(
|
913 |
+
'shipperAdress1' => substr($this->getFilledValue($recipient_address[0]), 0, 38),
|
914 |
+
'shipperAdress2' => $recipient_address[1] ? substr($this->getFilledValue($recipient_address[1]), 0, 38) : '',
|
915 |
+
'shipperCity' => $this->getFilledValue($_recipientAddress->getCity()),
|
916 |
+
'shipperCivility' => 'M',
|
917 |
+
'shipperContactName' => $recipientName2,
|
918 |
+
'shipperCountry' => $this->getFilledValue($_recipientAddress->getCountryId()),
|
919 |
+
'shipperEmail' => $customer_email,
|
920 |
+
'shipperMobilePhone' => $recipientMobilePhone,
|
921 |
+
'shipperName' => $recipientName,
|
922 |
+
'shipperName2' => $recipientName2,
|
923 |
+
'shipperPhone' => $recipientPhone,
|
924 |
+
'shipperPreAlert' => '',
|
925 |
+
'shipperZipCode' => $this->getFilledValue($_recipientAddress->getPostcode()),
|
926 |
+
);
|
927 |
+
|
928 |
+
//ref parameters
|
929 |
+
$recipientRef = $this->getFilledValue($_shippingAddress->getWRelayPointCode());
|
930 |
+
if (!$recipientRef) {
|
931 |
+
$recipientRef = $_order->getCustomerId();
|
932 |
+
}
|
933 |
+
$shipperRef = $_order->getRealOrderId();
|
934 |
+
|
935 |
+
$ref = array(
|
936 |
+
'recipientRef' => $recipientRef,
|
937 |
+
'shipperRef' => $shipperRef
|
938 |
+
);
|
939 |
+
|
940 |
+
//skybill parameters
|
941 |
+
/* Livraison Samedi (Delivery Saturday) field */
|
942 |
+
$SaturdayShipping = 0; //default value for the saturday shipping
|
943 |
+
if ($_shippingMethod[0] == "chronopost" || $_shippingMethod[0] == "chronorelais") {
|
944 |
+
if (!$_deliver_on_saturday = Mage::helper('chronorelais')->getLivraisonSamediStatus($_order->getEntityId())) {
|
945 |
+
$_deliver_on_saturday = Mage::helper('chronorelais')->getConfigData('carriers/' . $_shippingMethod[0] . '/deliver_on_saturday');
|
946 |
+
} else {
|
947 |
+
if ($_deliver_on_saturday == 'Yes') {
|
948 |
+
$_deliver_on_saturday = 1;
|
949 |
+
} else {
|
950 |
+
$_deliver_on_saturday = 0;
|
951 |
+
}
|
952 |
+
}
|
953 |
+
$is_sending_day = Mage::helper('chronorelais')->isSendingDay();
|
954 |
+
if ($_deliver_on_saturday && $is_sending_day) {
|
955 |
+
$SaturdayShipping = 6;
|
956 |
+
} elseif (!$_deliver_on_saturday && $is_sending_day) {
|
957 |
+
$SaturdayShipping = 1;
|
958 |
+
}
|
959 |
+
}
|
960 |
+
|
961 |
+
$weight = 0;
|
962 |
+
foreach ($shipment->getItemsCollection() as $item) {
|
963 |
+
$weight += $item->weight * $item->qty;
|
964 |
+
}
|
965 |
+
if ($_helper->getConfigWeightUnit() == 'g') {
|
966 |
+
$weight = $weight / 1000; /* conversion g => kg */
|
967 |
+
}
|
968 |
+
|
969 |
+
$productCode = Chronopost_Chronorelais_Helper_Data::CHRONO_POST;
|
970 |
+
if($_shippingMethod[0] == 'chronorelaiseurope') {
|
971 |
+
$productCode = '3T';
|
972 |
+
//$weight <= 3 ? $SaturdayShipping = '337' : $SaturdayShipping = '338';
|
973 |
+
$SaturdayShipping = '332';
|
974 |
+
}
|
975 |
+
|
976 |
+
$weight = 0; /* On met le poids à 0 car les colis sont pesé sur place */
|
977 |
+
|
978 |
+
$skybill = array(
|
979 |
+
'codCurrency' => 'EUR',
|
980 |
+
'codValue' => '',
|
981 |
+
'content1' => '',
|
982 |
+
'content2' => '',
|
983 |
+
'content3' => '',
|
984 |
+
'content4' => '',
|
985 |
+
'content5' => '',
|
986 |
+
'customsCurrency' => 'EUR',
|
987 |
+
'customsValue' => '',
|
988 |
+
'evtCode' => 'DC',
|
989 |
+
'insuredCurrency' => 'EUR',
|
990 |
+
'insuredValue' => '',
|
991 |
+
'objectType' => 'MAR',
|
992 |
+
'productCode' => $productCode,
|
993 |
+
'service' => $SaturdayShipping,
|
994 |
+
'shipDate' => date('c'),
|
995 |
+
'shipHour' => date('H'),
|
996 |
+
'weight' => $weight,
|
997 |
+
'weightUnit' => 'KGM'
|
998 |
+
);
|
999 |
+
|
1000 |
+
$mode = $_helper->getConfigurationSkybillParam();
|
1001 |
+
if($_shippingMethod[0] == 'chronorelaiseurope') {
|
1002 |
+
$mode = 'PPR';
|
1003 |
+
}
|
1004 |
+
$skybillParams = array(
|
1005 |
+
'mode' => $mode
|
1006 |
+
);
|
1007 |
+
|
1008 |
+
$expeditionArray = array(
|
1009 |
+
'headerValue' => $header,
|
1010 |
+
'shipperValue' => $shipper,
|
1011 |
+
'customerValue' => $customer,
|
1012 |
+
'recipientValue' => $recipient,
|
1013 |
+
'refValue' => $ref,
|
1014 |
+
'skybillValue' => $skybill,
|
1015 |
+
'skybillParamsValue' => $skybillParams,
|
1016 |
+
'password' => $_helper->getConfigurationAccountPass()
|
1017 |
+
);
|
1018 |
+
return $expeditionArray;
|
1019 |
+
}
|
1020 |
+
}
|
1021 |
+
|
1022 |
+
protected function getEtiquetteRetourUrl($shipment) {
|
1023 |
+
//On récupère les infos d'expédition
|
1024 |
+
$_helper = Mage::helper('chronorelais');
|
1025 |
+
|
1026 |
+
$_order = $shipment->getOrder();
|
1027 |
+
$_shippingMethod = explode("_", $_order->getShippingMethod());
|
1028 |
+
|
1029 |
+
$expeditionArray = $this->getEtiquetteRetourParams($shipment, $_shippingMethod);
|
1030 |
+
if ($expeditionArray) {
|
1031 |
+
$client = new SoapClient("https://www.chronopost.fr/shipping-cxf/ShippingServiceWS?wsdl", array('trace' => true));
|
1032 |
+
try {
|
1033 |
+
$webservbt = $client->shippingV3($expeditionArray);
|
1034 |
+
|
1035 |
+
if (!$webservbt->return->errorCode && $webservbt->return->skybill) {
|
1036 |
+
return $webservbt->return->skybill;
|
1037 |
+
} else {
|
1038 |
+
$this->_getSession()->addError($_helper->__($webservbt->return->errorMessage));
|
1039 |
+
}
|
1040 |
+
} catch (SoapFault $fault) {
|
1041 |
+
$this->_getSession()->addError($_helper->__($fault->faultstring));
|
1042 |
+
}
|
1043 |
+
}
|
1044 |
+
}
|
1045 |
+
|
1046 |
+
protected function savePdf($url, $shipmentId) {
|
1047 |
+
$this->createMediaChronopostFolder();
|
1048 |
+
$path = 'media/chronopost/etiquetteRetour-' . $shipmentId . '.pdf';
|
1049 |
+
file_put_contents($path, file_get_contents($url));
|
1050 |
+
return $path;
|
1051 |
+
}
|
1052 |
+
|
1053 |
+
protected function savePdfWithContent($content_base64, $shipmentId) {
|
1054 |
+
$this->createMediaChronopostFolder();
|
1055 |
+
$path = 'media/chronopost/etiquetteRetour-' . $shipmentId . '.pdf';
|
1056 |
+
file_put_contents($path, $content_base64);
|
1057 |
+
return $path;
|
1058 |
+
}
|
1059 |
+
|
1060 |
+
/* create folder media/chronopost if not exist */
|
1061 |
+
protected function createMediaChronopostFolder() {
|
1062 |
+
$path = 'media/chronopost';
|
1063 |
+
if(!is_dir($path)) {
|
1064 |
+
mkdir($path,0777);
|
1065 |
+
}
|
1066 |
+
}
|
1067 |
+
|
1068 |
+
protected function getShipmentObjectByOrderId($orderId) {
|
1069 |
+
$_shipment = Mage::getResourceModel('sales/order_shipment_collection')
|
1070 |
+
->addAttributeToFilter('order_id', $orderId);
|
1071 |
+
return $_shipment;
|
1072 |
+
}
|
1073 |
+
|
1074 |
+
public function cancelMassAction() {
|
1075 |
+
$orderIds = $this->getRequest()->getParam('order_ids');
|
1076 |
+
|
1077 |
+
if($orderIds) {
|
1078 |
+
$nbEtiquettesDelete = 0;
|
1079 |
+
foreach($orderIds as $orderId) {
|
1080 |
+
$shipments = $this->getShipmentObjectByOrderId($orderId);
|
1081 |
+
if($shipments) {
|
1082 |
+
foreach($shipments as $shipment) {
|
1083 |
+
|
1084 |
+
$tracks = $shipment->getTracksCollection();
|
1085 |
+
foreach ($tracks as $track) {
|
1086 |
+
|
1087 |
+
/* numero chrono si getChronoReservationNumber non null */
|
1088 |
+
if($track->getChronoReservationNumber()) {
|
1089 |
+
|
1090 |
+
/* appel WS pour annuler LT */
|
1091 |
+
$webservbt = Mage::helper('chronorelais/webservice')->cancelSkybill($track->getNumber());
|
1092 |
+
if($webservbt) {
|
1093 |
+
/* suppression du numéro de tracking */
|
1094 |
+
if($webservbt->return->errorCode == 0) {
|
1095 |
+
$nbEtiquettesDelete++;
|
1096 |
+
$track->delete();
|
1097 |
+
} else {
|
1098 |
+
switch($webservbt->return->errorCode) {
|
1099 |
+
case "1" :
|
1100 |
+
$errorMessage = $this->__("Une erreur système est survenue");
|
1101 |
+
break;
|
1102 |
+
case "2" :
|
1103 |
+
$errorMessage = $this->__("le colis n'appartient pas au contrat passé en paramètre ou n'a pas encore été enregistré dans le système de tracking Chronopost");
|
1104 |
+
break;
|
1105 |
+
case "3" :
|
1106 |
+
$errorMessage = $this->__("Le colis ne peut être pas annulé car il a été pris en charge par Chronopost");
|
1107 |
+
break;
|
1108 |
+
default :
|
1109 |
+
$errorMessage = '';
|
1110 |
+
break;
|
1111 |
+
}
|
1112 |
+
$this->_getSession()->addError($this->__("Erreur lors de la suppression de l'étiquettes %s : %s.",$track->getNumber(),$errorMessage));
|
1113 |
+
}
|
1114 |
+
} else {
|
1115 |
+
$this->_getSession()->addError($this->__('Désolé, une erreur est survenu lors de la suppression de l\'étiquette %s. Merci de contacter Chronopost ou de réessayer plus tard',$track->getNumber()));
|
1116 |
+
}
|
1117 |
+
}
|
1118 |
+
}
|
1119 |
+
}
|
1120 |
+
}
|
1121 |
+
}
|
1122 |
+
if($nbEtiquettesDelete > 0) {
|
1123 |
+
if($nbEtiquettesDelete > 1) {
|
1124 |
+
$this->_getSession()->addSuccess($this->__('%s étiquettes de transport ont bien été annulées.',$nbEtiquettesDelete));
|
1125 |
+
} else {
|
1126 |
+
$this->_getSession()->addSuccess($this->__('%s étiquette de transport a bien été annulée.',$nbEtiquettesDelete));
|
1127 |
+
}
|
1128 |
+
|
1129 |
+
}
|
1130 |
+
} else {
|
1131 |
+
$this->_getSession()->addError($this->__("Veuillez sélectionner au moins une lettre de transport."));
|
1132 |
+
}
|
1133 |
+
$this->_redirect('*/*/index');
|
1134 |
+
}
|
1135 |
+
|
1136 |
}
|
app/code/community/Chronopost/Chronorelais/controllers/Adminhtml/Chronorelais/Sales/Order/ShipmentController.php
CHANGED
@@ -1,386 +1,429 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
require_once 'Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php';
|
4 |
-
|
5 |
-
class Chronopost_Chronorelais_Adminhtml_Chronorelais_Sales_Order_ShipmentController extends Mage_Adminhtml_Sales_Order_ShipmentController {
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Save shipment
|
9 |
-
* We can save only new shipment. Existing shipments are not editable
|
10 |
-
*/
|
11 |
-
public function getFilledValue($value) {
|
12 |
-
if ($value) {
|
13 |
-
return $this->removeaccents(trim($value));
|
14 |
-
} else {
|
15 |
-
return '';
|
16 |
-
}
|
17 |
-
}
|
18 |
-
|
19 |
-
public function checkMobileNumber($value) {
|
20 |
-
if ($reqvalue = trim($value)) {
|
21 |
-
$_number = substr($reqvalue, 0, 2);
|
22 |
-
$fixed_array = array('01', '02', '03', '04', '05', '06', '06');
|
23 |
-
if (in_array($_number, $fixed_array)) {
|
24 |
-
return $reqvalue;
|
25 |
-
} else {
|
26 |
-
return '';
|
27 |
-
}
|
28 |
-
}
|
29 |
-
}
|
30 |
-
|
31 |
-
protected function saveAndCreateEtiquette($shipment,$data) {
|
32 |
-
$shipment->register();
|
33 |
-
|
34 |
-
//Si l'expedition est réalisé par Mondial Relay, on créé le tracking automatiquement.
|
35 |
-
|
36 |
-
$_order = $shipment->getOrder();
|
37 |
-
$_shippingMethod = explode("_", $_order->getShippingMethod());
|
38 |
-
|
39 |
-
$_shippingAddress = $shipment->getShippingAddress();
|
40 |
-
$_billingAddress = $shipment->getBillingAddress();
|
41 |
-
$_helper = Mage::helper('chronorelais');
|
42 |
-
|
43 |
-
$shippingMethodAllow = array('chronorelais','chronopost','chronoexpress','chronopostc10','chronopostc18','chronopostcclassic');
|
44 |
-
if (in_array($_shippingMethod[0],$shippingMethodAllow)) {
|
45 |
-
|
46 |
-
$esdParams = $header = $shipper = $customer = $recipient = $ref = $skybill = $skybillParams = $password = array();
|
47 |
-
|
48 |
-
//
|
49 |
-
$
|
50 |
-
'
|
51 |
-
'
|
52 |
-
'
|
53 |
-
);
|
54 |
-
|
55 |
-
//
|
56 |
-
$
|
57 |
-
|
58 |
-
'
|
59 |
-
'
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
'
|
66 |
-
'
|
67 |
-
'
|
68 |
-
'
|
69 |
-
'
|
70 |
-
'
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
'
|
77 |
-
'
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
'
|
84 |
-
'
|
85 |
-
'
|
86 |
-
'
|
87 |
-
'
|
88 |
-
'
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
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 |
-
|
145 |
-
|
146 |
-
|
147 |
-
if ($_deliver_on_saturday
|
148 |
-
$
|
149 |
-
} else {
|
150 |
-
$
|
151 |
-
}
|
152 |
-
}
|
153 |
-
|
154 |
-
|
155 |
-
$
|
156 |
-
|
157 |
-
|
158 |
-
}
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
'
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
'
|
180 |
-
'
|
181 |
-
'
|
182 |
-
'
|
183 |
-
'
|
184 |
-
'
|
185 |
-
'
|
186 |
-
'
|
187 |
-
'
|
188 |
-
'
|
189 |
-
'
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
'
|
194 |
-
'
|
195 |
-
'
|
196 |
-
'
|
197 |
-
'
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
'
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
$
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
}
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
{
|
323 |
-
$shipment
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
if(
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once 'Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php';
|
4 |
+
|
5 |
+
class Chronopost_Chronorelais_Adminhtml_Chronorelais_Sales_Order_ShipmentController extends Mage_Adminhtml_Sales_Order_ShipmentController {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Save shipment
|
9 |
+
* We can save only new shipment. Existing shipments are not editable
|
10 |
+
*/
|
11 |
+
public function getFilledValue($value) {
|
12 |
+
if ($value) {
|
13 |
+
return $this->removeaccents(trim($value));
|
14 |
+
} else {
|
15 |
+
return '';
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
public function checkMobileNumber($value) {
|
20 |
+
if ($reqvalue = trim($value)) {
|
21 |
+
$_number = substr($reqvalue, 0, 2);
|
22 |
+
$fixed_array = array('01', '02', '03', '04', '05', '06', '06');
|
23 |
+
if (in_array($_number, $fixed_array)) {
|
24 |
+
return $reqvalue;
|
25 |
+
} else {
|
26 |
+
return '';
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
protected function saveAndCreateEtiquette($shipment,$data) {
|
32 |
+
$shipment->register();
|
33 |
+
|
34 |
+
//Si l'expedition est réalisé par Mondial Relay, on créé le tracking automatiquement.
|
35 |
+
|
36 |
+
$_order = $shipment->getOrder();
|
37 |
+
$_shippingMethod = explode("_", $_order->getShippingMethod());
|
38 |
+
|
39 |
+
$_shippingAddress = $shipment->getShippingAddress();
|
40 |
+
$_billingAddress = $shipment->getBillingAddress();
|
41 |
+
$_helper = Mage::helper('chronorelais');
|
42 |
+
|
43 |
+
$shippingMethodAllow = array('chronorelais','chronopost','chronoexpress','chronopostc10','chronopostc18','chronopostcclassic','chronorelaiseurope','chronorelaisdom','chronopostsrdv','chronopostsameday');
|
44 |
+
if (in_array($_shippingMethod[0],$shippingMethodAllow)) {
|
45 |
+
|
46 |
+
$esdParams = $header = $shipper = $customer = $recipient = $ref = $skybill = $skybillParams = $password = array();
|
47 |
+
|
48 |
+
//header parameters
|
49 |
+
$header = array(
|
50 |
+
'idEmit' => 'MAG',
|
51 |
+
'accountNumber' => $_helper->getConfigurationAccountNumber(),
|
52 |
+
'subAccount' => $_helper->getConfigurationSubAccountNumber()
|
53 |
+
);
|
54 |
+
|
55 |
+
//shipper parameters
|
56 |
+
$shipperMobilePhone = $this->checkMobileNumber($_helper->getConfigurationShipperInfo('mobilephone'));
|
57 |
+
$shipper = array(
|
58 |
+
'shipperAdress1' => $_helper->getConfigurationShipperInfo('address1'),
|
59 |
+
'shipperAdress2' => $_helper->getConfigurationShipperInfo('address2'),
|
60 |
+
'shipperCity' => $_helper->getConfigurationShipperInfo('city'),
|
61 |
+
'shipperCivility' => $_helper->getConfigurationShipperInfo('civility'),
|
62 |
+
'shipperContactName' => $_helper->getConfigurationShipperInfo('contactname'),
|
63 |
+
'shipperCountry' => $_helper->getConfigurationShipperInfo('country'),
|
64 |
+
'shipperEmail' => $_helper->getConfigurationShipperInfo('email'),
|
65 |
+
'shipperMobilePhone' => $shipperMobilePhone,
|
66 |
+
'shipperName' => $_helper->getConfigurationShipperInfo('name'),
|
67 |
+
'shipperName2' => $_helper->getConfigurationShipperInfo('name2'),
|
68 |
+
'shipperPhone' => $_helper->getConfigurationShipperInfo('phone'),
|
69 |
+
'shipperPreAlert' => '',
|
70 |
+
'shipperZipCode' => $_helper->getConfigurationShipperInfo('zipcode')
|
71 |
+
);
|
72 |
+
|
73 |
+
//customer parameters
|
74 |
+
$customerMobilePhone = $this->checkMobileNumber($_helper->getConfigurationCustomerInfo('mobilephone'));
|
75 |
+
$customer = array(
|
76 |
+
'customerAdress1' => $_helper->getConfigurationCustomerInfo('address1'),
|
77 |
+
'customerAdress2' => $_helper->getConfigurationCustomerInfo('address2'),
|
78 |
+
'customerCity' => $_helper->getConfigurationCustomerInfo('city'),
|
79 |
+
'customerCivility' => $_helper->getConfigurationCustomerInfo('civility'),
|
80 |
+
'customerContactName' => $_helper->getConfigurationCustomerInfo('contactname'),
|
81 |
+
'customerCountry' => $_helper->getConfigurationCustomerInfo('country'),
|
82 |
+
'customerEmail' => $_helper->getConfigurationCustomerInfo('email'),
|
83 |
+
'customerMobilePhone' => $customerMobilePhone,
|
84 |
+
'customerName' => $_helper->getConfigurationCustomerInfo('name'),
|
85 |
+
'customerName2' => $_helper->getConfigurationCustomerInfo('name2'),
|
86 |
+
'customerPhone' => $_helper->getConfigurationCustomerInfo('phone'),
|
87 |
+
'customerPreAlert' => '',
|
88 |
+
'customerZipCode' => $_helper->getConfigurationCustomerInfo('zipcode')
|
89 |
+
);
|
90 |
+
|
91 |
+
//recipient parameters
|
92 |
+
$recipient_address = $_shippingAddress->getStreet();
|
93 |
+
if (!isset($recipient_address[1])) {
|
94 |
+
$recipient_address[1] = '';
|
95 |
+
}
|
96 |
+
$customer_email = ($_shippingAddress->getEmail()) ? $_shippingAddress->getEmail() : ($_billingAddress->getEmail() ? $_billingAddress->getEmail() : $_order->getCustomerEmail());
|
97 |
+
$recipientMobilePhone = $this->checkMobileNumber($_shippingAddress->getTelephone());
|
98 |
+
$recipientName = $this->getFilledValue($_shippingAddress->getCompany()); //RelayPoint Name if chronorelais or Companyname if chronopost and
|
99 |
+
$recipientName2 = $this->getFilledValue($_shippingAddress->getFirstname() . ' ' . $_shippingAddress->getLastname());
|
100 |
+
|
101 |
+
//remove any alphabets in phone number
|
102 |
+
$recipientPhone = trim(preg_replace("/[^0-9\.\-]/", " ", $_shippingAddress->getTelephone()));
|
103 |
+
|
104 |
+
$recipient = array(
|
105 |
+
'recipientAdress1' => substr($this->getFilledValue($recipient_address[0]), 0, 38),
|
106 |
+
'recipientAdress2' => substr($this->getFilledValue($recipient_address[1]), 0, 38),
|
107 |
+
'recipientCity' => $this->getFilledValue($_shippingAddress->getCity()),
|
108 |
+
'recipientContactName' => $recipientName2,
|
109 |
+
'recipientCountry' => $this->getFilledValue($_shippingAddress->getCountryId()),
|
110 |
+
'recipientEmail' => $customer_email,
|
111 |
+
'recipientMobilePhone' => $recipientMobilePhone,
|
112 |
+
'recipientName' => $recipientName,
|
113 |
+
'recipientName2' => $recipientName2,
|
114 |
+
'recipientPhone' => $recipientPhone,
|
115 |
+
'recipientPreAlert' => '',
|
116 |
+
'recipientZipCode' => $this->getFilledValue($_shippingAddress->getPostcode()),
|
117 |
+
);
|
118 |
+
|
119 |
+
//ref parameters
|
120 |
+
$recipientRef = $this->getFilledValue($_shippingAddress->getWRelayPointCode());
|
121 |
+
if (!$recipientRef) {
|
122 |
+
$recipientRef = $_order->getCustomerId();
|
123 |
+
}
|
124 |
+
$shipperRef = $_order->getRealOrderId();
|
125 |
+
|
126 |
+
$ref = array(
|
127 |
+
'recipientRef' => $recipientRef,
|
128 |
+
'shipperRef' => $shipperRef
|
129 |
+
);
|
130 |
+
|
131 |
+
//skybill parameters
|
132 |
+
/* Livraison Samedi (Delivery Saturday) field */
|
133 |
+
$SaturdayShipping = 0; //default value for the saturday shipping
|
134 |
+
if ($_shippingMethod[0] == "chronopost" || $_shippingMethod[0] == "chronorelais" || $_shippingMethod[0] == "chronorelaisdom") {
|
135 |
+
if (!$_deliver_on_saturday = Mage::helper('chronorelais')->getLivraisonSamediStatus($_order->getEntityId())) {
|
136 |
+
$_deliver_on_saturday = Mage::helper('chronorelais')->getConfigData('carriers/' . $_shippingMethod[0] . '/deliver_on_saturday');
|
137 |
+
} else {
|
138 |
+
if ($_deliver_on_saturday == 'Yes') {
|
139 |
+
$_deliver_on_saturday = 1;
|
140 |
+
} else {
|
141 |
+
$_deliver_on_saturday = 0;
|
142 |
+
}
|
143 |
+
}
|
144 |
+
$is_sending_day = Mage::helper('chronorelais')->isSendingDay();
|
145 |
+
|
146 |
+
if($_shippingMethod[0] == "chronorelaisdom") {
|
147 |
+
if ($_deliver_on_saturday && $is_sending_day) {
|
148 |
+
$SaturdayShipping = 369;
|
149 |
+
} else {
|
150 |
+
$SaturdayShipping = 368;
|
151 |
+
}
|
152 |
+
} else {
|
153 |
+
if ($_deliver_on_saturday && $is_sending_day) {
|
154 |
+
$SaturdayShipping = 6;
|
155 |
+
} elseif (!$_deliver_on_saturday && $is_sending_day) {
|
156 |
+
$SaturdayShipping = 1;
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
}
|
161 |
+
|
162 |
+
$weight = 0;
|
163 |
+
foreach ($shipment->getItemsCollection() as $item) {
|
164 |
+
$weight += $item->weight * $item->qty;
|
165 |
+
}
|
166 |
+
if ($_helper->getConfigWeightUnit() == 'g') {
|
167 |
+
$weight = $weight / 1000; /* conversion g => kg */
|
168 |
+
}
|
169 |
+
|
170 |
+
/* si chronorelaiseurope : service : 337 si poids < 3kg ou 338 si > 3kg */
|
171 |
+
if($_shippingMethod[0] == "chronorelaiseurope") {
|
172 |
+
$weight <= 3 ? $SaturdayShipping = '337' : $SaturdayShipping = '338';
|
173 |
+
}
|
174 |
+
|
175 |
+
|
176 |
+
$weight = 0; /* On met le poids à 0 car les colis sont pesé sur place */
|
177 |
+
|
178 |
+
$skybill = array(
|
179 |
+
'codCurrency' => 'EUR',
|
180 |
+
'codValue' => '',
|
181 |
+
'content1' => '',
|
182 |
+
'content2' => '',
|
183 |
+
'content3' => '',
|
184 |
+
'content4' => '',
|
185 |
+
'content5' => '',
|
186 |
+
'customsCurrency' => 'EUR',
|
187 |
+
'customsValue' => '',
|
188 |
+
'evtCode' => 'DC',
|
189 |
+
'insuredCurrency' => 'EUR',
|
190 |
+
'insuredValue' => '',
|
191 |
+
'objectType' => 'MAR',
|
192 |
+
'productCode' => $_helper->getChronoProductCodeToShipment($_shippingMethod[0]),
|
193 |
+
'service' => $SaturdayShipping,
|
194 |
+
'shipDate' => date('c'),
|
195 |
+
'shipHour' => date('H'),
|
196 |
+
'weight' => $weight,
|
197 |
+
'weightUnit' => 'KGM'
|
198 |
+
);
|
199 |
+
|
200 |
+
$skybillParams = array(
|
201 |
+
'mode' => $_helper->getConfigurationSkybillParam()
|
202 |
+
);
|
203 |
+
|
204 |
+
$expeditionArray = array(
|
205 |
+
'headerValue' => $header,
|
206 |
+
'shipperValue' => $shipper,
|
207 |
+
'customerValue' => $customer,
|
208 |
+
'recipientValue' => $recipient,
|
209 |
+
'refValue' => $ref,
|
210 |
+
'skybillValue' => $skybill,
|
211 |
+
'skybillParamsValue' => $skybillParams,
|
212 |
+
'password' => $_helper->getConfigurationAccountPass()
|
213 |
+
);
|
214 |
+
|
215 |
+
/* si chronopostsrdv : ajout parametres supplementaires */
|
216 |
+
if($_shippingMethod[0] == "chronopostsrdv") {
|
217 |
+
|
218 |
+
$chronopostsrdv_creneaux_info = $_shippingAddress->getData('chronopostsrdv_creneaux_info');
|
219 |
+
$chronopostsrdv_creneaux_info = json_decode($chronopostsrdv_creneaux_info,true);
|
220 |
+
|
221 |
+
$_dateRdvStart = new DateTime($chronopostsrdv_creneaux_info['deliveryDate']);
|
222 |
+
$_dateRdvStart->setTime($chronopostsrdv_creneaux_info['startHour'],$chronopostsrdv_creneaux_info['startMinutes']);
|
223 |
+
|
224 |
+
$_dateRdvEnd = new DateTime($chronopostsrdv_creneaux_info['deliveryDate']);
|
225 |
+
$_dateRdvEnd->setTime($chronopostsrdv_creneaux_info['endHour'],$chronopostsrdv_creneaux_info['endMinutes']);
|
226 |
+
|
227 |
+
|
228 |
+
$scheduledValue = array(
|
229 |
+
'appointmentValue' => array(
|
230 |
+
'timeSlotStartDate' => $_dateRdvStart->format("Y-m-d")."T".$_dateRdvStart->format("H:i:s"),
|
231 |
+
'timeSlotEndDate' => $_dateRdvEnd->format("Y-m-d")."T".$_dateRdvEnd->format("H:i:s"),
|
232 |
+
'timeSlotTariffLevel' => $chronopostsrdv_creneaux_info['tariffLevel']
|
233 |
+
)
|
234 |
+
);
|
235 |
+
$expeditionArray['scheduledValue'] = $scheduledValue;
|
236 |
+
|
237 |
+
/* modification productCode et service car dynamique pour ce mode de livraison */
|
238 |
+
|
239 |
+
$expeditionArray['skybillValue']['productCode'] = $chronopostsrdv_creneaux_info['productCode'];
|
240 |
+
$expeditionArray['skybillValue']['service'] = $chronopostsrdv_creneaux_info['serviceCode'];
|
241 |
+
|
242 |
+
}
|
243 |
+
|
244 |
+
$tracking_order = '';
|
245 |
+
|
246 |
+
$client = new SoapClient("https://www.chronopost.fr/shipping-cxf/ShippingServiceWS?wsdl", array('trace' => true));
|
247 |
+
try {
|
248 |
+
$expedition = $client->shippingV3($expeditionArray);
|
249 |
+
|
250 |
+
if (!$expedition->return->errorCode && $expedition->return->skybillNumber) {
|
251 |
+
$track = Mage::getModel('sales/order_shipment_track')
|
252 |
+
->setNumber($expedition->return->skybillNumber)
|
253 |
+
->setChronoReservationNumber(base64_encode($expedition->return->skybill))
|
254 |
+
->setCarrier(ucwords($_shippingMethod[0]))
|
255 |
+
->setCarrierCode($_shippingMethod[0])
|
256 |
+
->setTitle(ucwords($_shippingMethod[0]))
|
257 |
+
->setPopup(1);
|
258 |
+
$shipment->addTrack($track);
|
259 |
+
|
260 |
+
$tracking_number = $expedition->return->skybillNumber;
|
261 |
+
|
262 |
+
$tracking_url = str_replace('{tracking_number}', $tracking_number, Mage::helper('chronorelais')->getConfigurationTrackingViewUrl());
|
263 |
+
$tracking_title = $this->__('Track Your Order');
|
264 |
+
$tracking_order = '<p><a title="' . $tracking_title . '" href="' . $tracking_url . '"><b>' . $tracking_title . '</b></a></p>';
|
265 |
+
|
266 |
+
} else {
|
267 |
+
$this->_getSession()->addError($_helper->__($expedition->return->errorMessage));
|
268 |
+
$this->_redirect('*/*/new', array('order_id' => $this->getRequest()->getParam('order_id')));
|
269 |
+
return;
|
270 |
+
}
|
271 |
+
} catch (SoapFault $fault) {
|
272 |
+
$this->_getSession()->addError($_helper->__($fault->faultstring));
|
273 |
+
$this->_redirect('*/*/new', array('order_id' => $this->getRequest()->getParam('order_id')));
|
274 |
+
return;
|
275 |
+
}
|
276 |
+
}
|
277 |
+
|
278 |
+
$comment = '';
|
279 |
+
if (!empty($data['comment_text'])) {
|
280 |
+
$shipment->addComment($data['comment_text'], isset($data['comment_customer_notify']));
|
281 |
+
$comment = $data['comment_text'];
|
282 |
+
}
|
283 |
+
|
284 |
+
if (!empty($data['send_email'])) {
|
285 |
+
$shipment->setEmailSent(true);
|
286 |
+
}
|
287 |
+
|
288 |
+
$this->_saveShipment($shipment);
|
289 |
+
$shipment->sendEmail(!empty($data['send_email']), $tracking_order . $comment);
|
290 |
+
$this->_getSession()->addSuccess($this->__('Shipment was successfully created.'));
|
291 |
+
$this->_redirect('adminhtml/sales_order/view', array('order_id' => $shipment->getOrderId()));
|
292 |
+
return;
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Initialize shipment model instance
|
297 |
+
*
|
298 |
+
* @return Mage_Sales_Model_Order_Shipment|bool
|
299 |
+
*/
|
300 |
+
protected function _initShipment()
|
301 |
+
{
|
302 |
+
$this->_title($this->__('Sales'))->_title($this->__('Shipments'));
|
303 |
+
$helper = Mage::helper('chronorelais');
|
304 |
+
$shipment = false;
|
305 |
+
$shipmentId = $this->getRequest()->getParam('shipment_id');
|
306 |
+
$orderId = $this->getRequest()->getParam('order_id');
|
307 |
+
if ($shipmentId) {
|
308 |
+
$shipment = Mage::getModel('sales/order_shipment')->load($shipmentId);
|
309 |
+
} elseif ($orderId) {
|
310 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
311 |
+
|
312 |
+
/**
|
313 |
+
* Check order existing
|
314 |
+
*/
|
315 |
+
if (!$order->getId()) {
|
316 |
+
$this->_getSession()->addError($this->__('The order no longer exists.'));
|
317 |
+
return false;
|
318 |
+
}
|
319 |
+
/**
|
320 |
+
* Check shipment is available to create separate from invoice
|
321 |
+
*/
|
322 |
+
if ($order->getForcedDoShipmentWithInvoice()) {
|
323 |
+
$this->_getSession()->addError($this->__('Cannot do shipment for the order separately from invoice.'));
|
324 |
+
return false;
|
325 |
+
}
|
326 |
+
/**
|
327 |
+
* Check shipment create availability
|
328 |
+
*/
|
329 |
+
if (!$order->canShip()) {
|
330 |
+
$this->_getSession()->addError($this->__('Cannot do shipment for the order.'));
|
331 |
+
return false;
|
332 |
+
}
|
333 |
+
$savedQtys = $this->_getItemQtys();
|
334 |
+
|
335 |
+
/* If shipping method is Chronopost => check if shipping weight isn't over limit */
|
336 |
+
$chronopostMethods = array('chronopost_chronopost','chronoexpress_chronoexpress','chronorelais_chronorelais','chronopostc10_chronopostC10','chronopostc18_chronopostC18','chronopostcclassic_chronopostCClassic','chronopostsrdv_chronopostsrdv','chronopostsameday_chronopostsameday');
|
337 |
+
$shippingMethod = $order->getShippingMethod();
|
338 |
+
if(in_array($shippingMethod, $chronopostMethods)) {
|
339 |
+
$weightShipping = 0;
|
340 |
+
$shippingMethod = explode("_", $shippingMethod);
|
341 |
+
$shippingMethod = $shippingMethod[0];
|
342 |
+
$weight_limit = Mage::getStoreConfig('carriers/'.$shippingMethod.'/weight_limit');
|
343 |
+
foreach($savedQtys as $iditem => $qty) {
|
344 |
+
$item = $order->getItemById($iditem);
|
345 |
+
$weightShipping += $item->getWeight()*$qty;
|
346 |
+
}
|
347 |
+
if($helper->getConfigWeightUnit() == 'g')
|
348 |
+
{
|
349 |
+
$weightShipping = $weightShipping / 1000; // conversion g => kg
|
350 |
+
}
|
351 |
+
if($weightShipping > $weight_limit) {
|
352 |
+
|
353 |
+
/* Create one shipment by product ordered */
|
354 |
+
foreach($savedQtys as $iditem => $qty) {
|
355 |
+
$item = $order->getItemById($iditem);
|
356 |
+
$weightShipping += $item->getWeight()*$qty;
|
357 |
+
for($i = 1; $i <= $qty; $i++) {
|
358 |
+
$shipment[] = Mage::getModel('sales/service_order', $order)->prepareShipment(array($item->getId() => '1'));
|
359 |
+
|
360 |
+
}
|
361 |
+
}
|
362 |
+
}
|
363 |
+
}
|
364 |
+
|
365 |
+
|
366 |
+
if(!$shipment)
|
367 |
+
{
|
368 |
+
$shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($savedQtys);
|
369 |
+
|
370 |
+
$tracks = $this->getRequest()->getPost('tracking');
|
371 |
+
if ($tracks) {
|
372 |
+
foreach ($tracks as $data) {
|
373 |
+
if (empty($data['number'])) {
|
374 |
+
Mage::throwException($this->__('Tracking number cannot be empty.'));
|
375 |
+
}
|
376 |
+
$track = Mage::getModel('sales/order_shipment_track')
|
377 |
+
->addData($data);
|
378 |
+
$shipment->addTrack($track);
|
379 |
+
}
|
380 |
+
}
|
381 |
+
}
|
382 |
+
}
|
383 |
+
|
384 |
+
Mage::register('current_shipment', $shipment);
|
385 |
+
return $shipment;
|
386 |
+
}
|
387 |
+
|
388 |
+
public function saveAction() {
|
389 |
+
$data = $this->getRequest()->getPost('shipment');
|
390 |
+
$orderId = $this->getRequest()->getParam('order_id');
|
391 |
+
|
392 |
+
try {
|
393 |
+
|
394 |
+
if ($shipment = $this->_initShipment()) {
|
395 |
+
if(is_array($shipment))
|
396 |
+
{
|
397 |
+
foreach($shipment as $ship) {
|
398 |
+
$this->saveAndCreateEtiquette($ship,$data);
|
399 |
+
}
|
400 |
+
}
|
401 |
+
else
|
402 |
+
{
|
403 |
+
$this->saveAndCreateEtiquette($shipment,$data);
|
404 |
+
}
|
405 |
+
} else {
|
406 |
+
$this->_redirect('*/*/new', array('order_id' => $this->getRequest()->getParam('order_id')));
|
407 |
+
return;
|
408 |
+
}
|
409 |
+
|
410 |
+
} catch (Mage_Core_Exception $e) {
|
411 |
+
$this->_getSession()->addError($e->getMessage());
|
412 |
+
} catch (Exception $e) {
|
413 |
+
$this->_getSession()->addError($this->__('Can not save shipment: ' . $e->getMessage()));
|
414 |
+
}
|
415 |
+
$this->_redirect('adminhtml/sales_order/view', array('order_id' => $orderId));
|
416 |
+
}
|
417 |
+
|
418 |
+
public function removeaccents($string) {
|
419 |
+
$stringToReturn = str_replace(
|
420 |
+
array('�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '�', '/', '\xa8'), array('a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y', 'A', 'A', 'A', 'A', 'A', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'N', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', ' ', 'e'), $string);
|
421 |
+
// Remove all remaining other unknown characters
|
422 |
+
$stringToReturn = preg_replace('/[^a-zA-Z0-9\-]/', ' ', $stringToReturn);
|
423 |
+
$stringToReturn = preg_replace('/^[\-]+/', '', $stringToReturn);
|
424 |
+
$stringToReturn = preg_replace('/[\-]+$/', '', $stringToReturn);
|
425 |
+
$stringToReturn = preg_replace('/[\-]{2,}/', ' ', $stringToReturn);
|
426 |
+
return $stringToReturn;
|
427 |
+
}
|
428 |
+
|
429 |
+
}
|
app/code/community/Chronopost/Chronorelais/controllers/Checkout/MultishippingController.php
CHANGED
@@ -25,24 +25,21 @@ class Chronopost_Chronorelais_Checkout_MultishippingController extends Mage_Chec
|
|
25 |
$addresses = $this->_getCheckout()->getQuote()->getAllShippingAddresses();
|
26 |
$relays = $this->getRequest()->getParam('shipping_method_chronorelais');
|
27 |
foreach ($addresses as $address) {
|
28 |
-
if (isset($shippingMethods[$address->getId()])) {
|
29 |
-
|
|
|
30 |
|
31 |
-
$
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
$
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
->setWRelayPointCode($relais->identifiantChronopostPointA2PAS)
|
43 |
-
->save()
|
44 |
-
->setCollectShippingRates(true);
|
45 |
-
}
|
46 |
}
|
47 |
}
|
48 |
}
|
@@ -73,9 +70,6 @@ class Chronopost_Chronorelais_Checkout_MultishippingController extends Mage_Chec
|
|
73 |
$addresses = $this->_getCheckout()->getQuote()->getAllShippingAddresses();
|
74 |
foreach ($addresses as $address) {
|
75 |
if ($address->getId() == $this->getRequest()->get('index')) {
|
76 |
-
/* $address->setPostcode($postcode)
|
77 |
-
->save()
|
78 |
-
->setCollectShippingRates(true); */
|
79 |
|
80 |
$helper = Mage::helper('chronorelais/webservice');
|
81 |
$webservbt = $helper->getPointsRelaisByCp($postcode);
|
25 |
$addresses = $this->_getCheckout()->getQuote()->getAllShippingAddresses();
|
26 |
$relays = $this->getRequest()->getParam('shipping_method_chronorelais');
|
27 |
foreach ($addresses as $address) {
|
28 |
+
if (isset($shippingMethods[$address->getId()]) && substr($shippingMethods[$address->getId()], 0, 12) == "chronorelais" ) {
|
29 |
+
$relaisId = $relays[$address->getId()];
|
30 |
+
if ($relaisId != "") {
|
31 |
|
32 |
+
$helper = Mage::helper('chronorelais/webservice');
|
33 |
+
$relais = $helper->getDetailRelaisPoint($relaisId);
|
34 |
|
35 |
+
if ($relais) {
|
36 |
+
$address->setCity($relais->localite)
|
37 |
+
->setPostcode($relais->codePostal)
|
38 |
+
->setStreet(trim($relais->adresse1 . "\n" . $relais->adresse2 . " " . $relais->adresse3))
|
39 |
+
->setCompany($relais->nomEnseigne)
|
40 |
+
->setWRelayPointCode($relais->identifiantChronopostPointA2PAS)
|
41 |
+
->save()
|
42 |
+
->setCollectShippingRates(true);
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
}
|
45 |
}
|
70 |
$addresses = $this->_getCheckout()->getQuote()->getAllShippingAddresses();
|
71 |
foreach ($addresses as $address) {
|
72 |
if ($address->getId() == $this->getRequest()->get('index')) {
|
|
|
|
|
|
|
73 |
|
74 |
$helper = Mage::helper('chronorelais/webservice');
|
75 |
$webservbt = $helper->getPointsRelaisByCp($postcode);
|
app/code/community/Chronopost/Chronorelais/controllers/Checkout/OnepageController.php
DELETED
@@ -1,249 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
require_once 'Mage/Checkout/controllers/OnepageController.php';
|
4 |
-
|
5 |
-
class Chronopost_Chronorelais_Checkout_OnepageController extends Mage_Checkout_OnepageController {
|
6 |
-
|
7 |
-
protected $_sectionUpdateFunctions = array(
|
8 |
-
'payment-method' => '_getPaymentMethodsHtml',
|
9 |
-
'shipping-method' => '_getShippingMethodsHtml',
|
10 |
-
'review' => '_getReviewHtml',
|
11 |
-
'shipping-method-chronorelais' => '_getReviewHtml',
|
12 |
-
);
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Get payment method step html
|
16 |
-
*
|
17 |
-
* @return string
|
18 |
-
*/
|
19 |
-
protected function _getChronoRelaisHtml() {
|
20 |
-
return $this->getLayout()->getBlock('root')->toHtml();
|
21 |
-
}
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Checkout page
|
25 |
-
*/
|
26 |
-
public function indexAction() {
|
27 |
-
if (!extension_loaded('soap')) {
|
28 |
-
if (Mage::helper('chronorelais')->getConfigData('carriers/chronopost/active') || Mage::helper('chronorelais')->getConfigData('carriers/chronorelais/active') || Mage::helper('chronorelais')->getConfigData('carriers/chronoexpress/active')) {
|
29 |
-
Mage::getSingleton('checkout/session')->addError($this->__('The SOAP extension is not installed in the server. Please contact the site administrator. Sorry for inconvenience.'));
|
30 |
-
$this->_redirect('checkout/cart');
|
31 |
-
return;
|
32 |
-
}
|
33 |
-
}
|
34 |
-
parent::indexAction();
|
35 |
-
}
|
36 |
-
|
37 |
-
/**
|
38 |
-
* save checkout billing address
|
39 |
-
*/
|
40 |
-
public function saveBillingAction() {
|
41 |
-
if ($this->_expireAjax()) {
|
42 |
-
return;
|
43 |
-
}
|
44 |
-
if ($this->getRequest()->isPost()) {
|
45 |
-
// $postData = $this->getRequest()->getPost('billing', array());
|
46 |
-
// $data = $this->_filterPostData($postData);
|
47 |
-
$data = $this->getRequest()->getPost('billing', array());
|
48 |
-
$customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
|
49 |
-
|
50 |
-
if (isset($data['email'])) {
|
51 |
-
$data['email'] = trim($data['email']);
|
52 |
-
}
|
53 |
-
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);
|
54 |
-
|
55 |
-
if (!isset($result['error'])) {
|
56 |
-
/* check quote for virtual */
|
57 |
-
if ($this->getOnepage()->getQuote()->isVirtual()) {
|
58 |
-
$result['goto_section'] = 'payment';
|
59 |
-
$result['update_section'] = array(
|
60 |
-
'name' => 'payment-method',
|
61 |
-
'html' => $this->_getPaymentMethodsHtml()
|
62 |
-
);
|
63 |
-
} elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
|
64 |
-
$result['goto_section'] = 'shipping_method';
|
65 |
-
$result['update_section'] = array(
|
66 |
-
'name' => 'shipping-method',
|
67 |
-
'html' => $this->_getShippingMethodsHtml()
|
68 |
-
);
|
69 |
-
|
70 |
-
$result['allow_sections'] = array('shipping');
|
71 |
-
$result['duplicateBillingInfo'] = 'true';
|
72 |
-
|
73 |
-
//WEC chronorelais
|
74 |
-
if (isset($_SESSION["customer_shipping_address_reference"])) {
|
75 |
-
unset($_SESSION["customer_shipping_address_reference"]);
|
76 |
-
}
|
77 |
-
|
78 |
-
if (!array_key_exists("company", $data)) {
|
79 |
-
$data["company"] = "";
|
80 |
-
}
|
81 |
-
|
82 |
-
$_SESSION["customer_shipping_address_reference"]["data"] = $data;
|
83 |
-
$_SESSION["customer_shipping_address_reference"]["customerAddressId"] = $customerAddressId;
|
84 |
-
$_SESSION["customer_shipping_address_reference"]["available"] = false;
|
85 |
-
//ENDWEC
|
86 |
-
} else {
|
87 |
-
$result['goto_section'] = 'shipping';
|
88 |
-
}
|
89 |
-
}
|
90 |
-
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
91 |
-
}
|
92 |
-
}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Shipping address save action
|
96 |
-
*/
|
97 |
-
public function saveShippingAction() {
|
98 |
-
parent::saveShippingAction();
|
99 |
-
|
100 |
-
//WEC chronorelais
|
101 |
-
if (isset($_SESSION["customer_shipping_address_reference"])) {
|
102 |
-
unset($_SESSION["customer_shipping_address_reference"]);
|
103 |
-
}
|
104 |
-
if (!array_key_exists("company", $data)) {
|
105 |
-
$data["company"] = "";
|
106 |
-
}
|
107 |
-
$_SESSION["customer_shipping_address_reference"]["data"] = $data;
|
108 |
-
$_SESSION["customer_shipping_address_reference"]["customerAddressId"] = $customerAddressId;
|
109 |
-
$_SESSION["customer_shipping_address_reference"]["available"] = false;
|
110 |
-
//ENDWEC
|
111 |
-
}
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Shipping method save action
|
115 |
-
*/
|
116 |
-
public function saveShippingMethodAction() {
|
117 |
-
if ($this->_expireAjax()) {
|
118 |
-
return;
|
119 |
-
}
|
120 |
-
if ($this->getRequest()->isPost()) {
|
121 |
-
|
122 |
-
//WEC chronorelais
|
123 |
-
if ($_SESSION["customer_shipping_address_reference"]["available"]) {
|
124 |
-
$data = $_SESSION["customer_shipping_address_reference"]["data"];
|
125 |
-
$customerAddressId = $_SESSION["customer_shipping_address_reference"]["customerAddressId"];
|
126 |
-
$_SESSION["customer_shipping_address_reference"]["available"] = false;
|
127 |
-
|
128 |
-
$result = $this->getOnepage()->saveShipping($data, $customerAddressId);
|
129 |
-
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
130 |
-
}
|
131 |
-
|
132 |
-
$method = $this->getRequest()->getParam('shipping_method');
|
133 |
-
$quote = $this->getOnepage()->getQuote(); //Mage::getSingleton('checkout/cart')->init()->getQuote();
|
134 |
-
$address = $quote->getShippingAddress();
|
135 |
-
|
136 |
-
if (substr($this->getRequest()->getParam('shipping_method'), 0, 12) == "chronorelais") {
|
137 |
-
$relaisId = $this->getRequest()->getParam('shipping_method_chronorelais');
|
138 |
-
if ($relaisId != "") {
|
139 |
-
|
140 |
-
$helper = Mage::helper('chronorelais/webservice');
|
141 |
-
$relais = $helper->getDetailRelaisPoint($relaisId);
|
142 |
-
|
143 |
-
if ($relais) {
|
144 |
-
$address->setCity($relais->localite)
|
145 |
-
->setPostcode($relais->codePostal)
|
146 |
-
->setStreet(trim($relais->adresse1 . "\n" . $relais->adresse2 . " " . $relais->adresse3))
|
147 |
-
->setCompany($relais->nomEnseigne)
|
148 |
-
->setWRelayPointCode($relais->identifiantChronopostPointA2PAS)
|
149 |
-
->save()
|
150 |
-
->setCollectShippingRates(true);
|
151 |
-
|
152 |
-
$_SESSION["customer_shipping_address_reference"]["available"] = true;
|
153 |
-
}
|
154 |
-
}
|
155 |
-
}
|
156 |
-
|
157 |
-
$methodTitle = "";
|
158 |
-
if (isset($relais->localite)) {
|
159 |
-
$methodTitle = ' - ' . $relais->nomEnseigne . ' - ' . trim($relais->adresse1 . " " . $relais->adresse2 . " " . $relais->adresse3) . ' - ' . $relais->codePostal . ' - ' . $relais->localite;
|
160 |
-
}
|
161 |
-
if ($method) {
|
162 |
-
foreach ($address->getAllShippingRates() as $rate) {
|
163 |
-
if ($rate->getCode() == $method) {
|
164 |
-
$address->setShippingDescription($rate->getCarrierTitle() . ' - ' . $rate->getMethodTitle() . $methodTitle);
|
165 |
-
break;
|
166 |
-
}
|
167 |
-
}
|
168 |
-
}
|
169 |
-
//ENDWEC chronorelais
|
170 |
-
|
171 |
-
parent::saveShippingMethodAction();
|
172 |
-
}
|
173 |
-
}
|
174 |
-
|
175 |
-
/**
|
176 |
-
* Get relais
|
177 |
-
*/
|
178 |
-
public function getRelaisAction() {
|
179 |
-
if ($this->_expireAjax()) {
|
180 |
-
return;
|
181 |
-
}
|
182 |
-
$result = array();
|
183 |
-
$quote = $this->getOnepage()->getQuote(); //Mage::getSingleton('checkout/cart')->init()->getQuote();
|
184 |
-
$address = $quote->getShippingAddress();
|
185 |
-
$postcode = $address->getPostcode();
|
186 |
-
$shippingMethod = $this->getRequest()->getPost('shipping_method');
|
187 |
-
|
188 |
-
if (extension_loaded('soap')) {
|
189 |
-
|
190 |
-
$helper = Mage::helper('chronorelais/webservice');
|
191 |
-
$webservbt = $helper->getPointRelaisByAddress();
|
192 |
-
|
193 |
-
if ($webservbt) {
|
194 |
-
$this->loadLayout('checkout_onepage_shippingchronorelais');
|
195 |
-
$result['goto_section'] = 'shipping-method';
|
196 |
-
$result['update_section'] = array(
|
197 |
-
'name' => 'shipping-method-'.$shippingMethod,
|
198 |
-
'html' => $this->_getChronoRelaisHtml()
|
199 |
-
);
|
200 |
-
$result['relaypoints'] = $webservbt;
|
201 |
-
} else {
|
202 |
-
$result['error'] = true;
|
203 |
-
$result['message'] = $this->__('No point relay is associated with this postcode');
|
204 |
-
}
|
205 |
-
} else {
|
206 |
-
$result['error'] = true;
|
207 |
-
$result['message'] = $this->__('Sorry for inconvenience, The SOAP extension is not installed in the server. Please contact the site administrator.');
|
208 |
-
}
|
209 |
-
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
210 |
-
}
|
211 |
-
|
212 |
-
/**
|
213 |
-
* Change shipping postal code
|
214 |
-
*/
|
215 |
-
public function changePostalCodeAction() {
|
216 |
-
if ($this->_expireAjax()) {
|
217 |
-
return;
|
218 |
-
}
|
219 |
-
$result = array();
|
220 |
-
$webservbt = array();
|
221 |
-
$postcode = $this->getRequest()->getPost('mappostalcode');
|
222 |
-
$shippingMethod = $this->getRequest()->getPost('shipping_method');
|
223 |
-
if ($postcode) {
|
224 |
-
$quote = $this->getOnepage()->getQuote(); //Mage::getSingleton('checkout/cart')->init()->getQuote();
|
225 |
-
$address = $quote->getShippingAddress();
|
226 |
-
$address->setPostcode($postcode)
|
227 |
-
->save()
|
228 |
-
->setCollectShippingRates(true);
|
229 |
-
|
230 |
-
$helper = Mage::helper('chronorelais/webservice');
|
231 |
-
$webservbt = $helper->getPointsRelaisByCp($postcode);
|
232 |
-
|
233 |
-
}
|
234 |
-
if ($webservbt) {
|
235 |
-
$this->loadLayout('checkout_onepage_shippingchronorelais');
|
236 |
-
$result['goto_section'] = 'shipping-method';
|
237 |
-
$result['update_section'] = array(
|
238 |
-
'name' => 'shipping-method-'.$shippingMethod,
|
239 |
-
'html' => $this->_getChronoRelaisHtml()
|
240 |
-
);
|
241 |
-
$result['relaypoints'] = $webservbt;
|
242 |
-
} else {
|
243 |
-
$result['error'] = true;
|
244 |
-
$result['message'] = $this->__('No point relay is associated with this postcode');
|
245 |
-
}
|
246 |
-
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
247 |
-
}
|
248 |
-
|
249 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Chronopost/Chronorelais/controllers/IndexController.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Chronopost_Chronorelais_IndexController extends Mage_Core_Controller_Front_Action {
|
3 |
+
|
4 |
+
public function shippingmethodimageAction() {
|
5 |
+
$this->loadLayout();
|
6 |
+
echo $this->getLayout()
|
7 |
+
->createBlock("checkout/onepage_shipping_method_available")
|
8 |
+
->setTemplate("chronorelais/checkout/onepage/shipping_method_images.phtml")
|
9 |
+
->toHtml();
|
10 |
+
}
|
11 |
+
}
|
app/code/community/Chronopost/Chronorelais/controllers/RelaisController.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<?php
|
2 |
class Chronopost_Chronorelais_RelaisController extends Mage_Core_Controller_Front_Action {
|
3 |
-
|
4 |
public function filterAction() {
|
5 |
-
$this->loadLayout();
|
6 |
$this->renderLayout();
|
7 |
}
|
8 |
-
|
9 |
public function detailAction() {
|
10 |
-
$this->loadLayout();
|
11 |
$this->renderLayout();
|
12 |
}
|
13 |
|
@@ -23,10 +23,99 @@ class Chronopost_Chronorelais_RelaisController extends Mage_Core_Controller_Fron
|
|
23 |
if($req_values) {
|
24 |
$order = Mage::getModel('sales/order')->load($req_values['id']);
|
25 |
$popup_url = Mage::helper('shipping')->getTrackingPopupUrlBySalesModel($order);
|
26 |
-
header('location: '.$popup_url);
|
|
|
27 |
}
|
28 |
}
|
29 |
-
}
|
30 |
-
}
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
}
|
1 |
<?php
|
2 |
class Chronopost_Chronorelais_RelaisController extends Mage_Core_Controller_Front_Action {
|
3 |
+
|
4 |
public function filterAction() {
|
5 |
+
$this->loadLayout();
|
6 |
$this->renderLayout();
|
7 |
}
|
8 |
+
|
9 |
public function detailAction() {
|
10 |
+
$this->loadLayout();
|
11 |
$this->renderLayout();
|
12 |
}
|
13 |
|
23 |
if($req_values) {
|
24 |
$order = Mage::getModel('sales/order')->load($req_values['id']);
|
25 |
$popup_url = Mage::helper('shipping')->getTrackingPopupUrlBySalesModel($order);
|
26 |
+
header('location: '.$popup_url);
|
27 |
+
exit();
|
28 |
}
|
29 |
}
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Get payment method step html
|
35 |
+
*
|
36 |
+
* @return string
|
37 |
+
*/
|
38 |
+
protected function _getChronoRelaisHtml($shippingMethodCode = 'chronorelais') {
|
39 |
+
return $this->getLayout()->getBlock('root')->setMethodCode($shippingMethodCode)->toHtml();
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Get relais
|
44 |
+
*/
|
45 |
+
public function getRelaisAction() {
|
46 |
+
$result = array();
|
47 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
48 |
+
$address = $quote->getShippingAddress();
|
49 |
+
$shippingMethod = $this->getRequest()->getPost('shipping_method');
|
50 |
+
|
51 |
+
if (extension_loaded('soap')) {
|
52 |
+
|
53 |
+
$shippingMethodCode = explode("_", $shippingMethod);
|
54 |
+
$shippingMethodCode = $shippingMethodCode[0];
|
55 |
+
|
56 |
+
$helper = Mage::helper('chronorelais/webservice');
|
57 |
+
$webservbt = $helper->getPointRelaisByAddress($shippingMethodCode);
|
58 |
+
|
59 |
+
if ($webservbt) {
|
60 |
+
$this->loadLayout('checkout_onepage_shippingchronorelais');
|
61 |
+
$result['goto_section'] = 'shipping-method';
|
62 |
+
$result['update_section'] = array(
|
63 |
+
'name' => 'shipping-method-'.$shippingMethod,
|
64 |
+
'html' => $this->_getChronoRelaisHtml($shippingMethodCode)
|
65 |
+
);
|
66 |
+
$result['relaypoints'] = $webservbt;
|
67 |
+
} else {
|
68 |
+
$result['error'] = true;
|
69 |
+
$result['message'] = $this->__('No point relay is associated with this postcode');
|
70 |
+
}
|
71 |
+
} else {
|
72 |
+
$result['error'] = true;
|
73 |
+
$result['message'] = $this->__('Sorry for inconvenience, The SOAP extension is not installed in the server. Please contact the site administrator.');
|
74 |
+
}
|
75 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Change shipping postal code
|
80 |
+
*/
|
81 |
+
public function changePostalCodeAction() {
|
82 |
+
|
83 |
+
$result = array();
|
84 |
+
$webservbt = array();
|
85 |
+
$postcode = $this->getRequest()->getPost('mappostalcode');
|
86 |
+
$shippingMethod = $this->getRequest()->getPost('shipping_method');
|
87 |
+
|
88 |
+
$shippingMethodCode = explode("_", $shippingMethod);
|
89 |
+
$shippingMethodCode = $shippingMethodCode[0];
|
90 |
+
|
91 |
+
if ($postcode) {
|
92 |
+
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
93 |
+
$address = $quote->getShippingAddress();
|
94 |
+
$address->setPostcode($postcode)
|
95 |
+
->save()
|
96 |
+
->setCollectShippingRates(true);
|
97 |
+
|
98 |
+
$helper = Mage::helper('chronorelais/webservice');
|
99 |
+
$webservbt = $helper->getPointsRelaisByCp($postcode);
|
100 |
+
|
101 |
+
}
|
102 |
+
if ($webservbt) {
|
103 |
+
$this->loadLayout('checkout_onepage_shippingchronorelais');
|
104 |
+
$result['goto_section'] = 'shipping-method';
|
105 |
+
$result['update_section'] = array(
|
106 |
+
'name' => 'shipping-method-'.$shippingMethod,
|
107 |
+
'html' => $this->_getChronoRelaisHtml($shippingMethodCode)
|
108 |
+
);
|
109 |
+
$result['relaypoints'] = $webservbt;
|
110 |
+
} else {
|
111 |
+
$result['error'] = true;
|
112 |
+
$result['message'] = $this->__('No point relay is associated with this postcode');
|
113 |
+
}
|
114 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
115 |
+
}
|
116 |
+
|
117 |
+
public function resetSessionRelaiAction() {
|
118 |
+
unset($_SESSION['chronopost_relais_id']);
|
119 |
+
}
|
120 |
+
|
121 |
}
|
app/code/community/Chronopost/Chronorelais/controllers/SrdvController.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Chronopost_Chronorelais_SrdvController extends Mage_Core_Controller_Front_Action {
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Get payment method step html
|
6 |
+
*
|
7 |
+
* @return string
|
8 |
+
*/
|
9 |
+
protected function _getChronopostSrdvHtml() {
|
10 |
+
return $this->getLayout()->getBlock('root')->toHtml();
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Get planning
|
15 |
+
*/
|
16 |
+
public function getPlanningAction() {
|
17 |
+
$result = array();
|
18 |
+
$shippingMethod = $this->getRequest()->getPost('shipping_method');
|
19 |
+
|
20 |
+
if (extension_loaded('soap')) {
|
21 |
+
|
22 |
+
$shippingMethodCode = explode("_", $shippingMethod);
|
23 |
+
$shippingMethodCode = $shippingMethodCode[0];
|
24 |
+
|
25 |
+
$this->loadLayout('checkout_onepage_shippingchronopostsrdv');
|
26 |
+
$result['goto_section'] = 'shipping-method';
|
27 |
+
$result['update_section'] = array(
|
28 |
+
'name' => 'shipping-method-'.$shippingMethod,
|
29 |
+
'html' => $this->_getChronopostSrdvHtml()
|
30 |
+
);
|
31 |
+
$result['planning'] = true;
|
32 |
+
} else {
|
33 |
+
$result['error'] = true;
|
34 |
+
$result['message'] = $this->__('Sorry for inconvenience, The SOAP extension is not installed in the server. Please contact the site administrator.');
|
35 |
+
}
|
36 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
37 |
+
}
|
38 |
+
}
|
app/code/community/Chronopost/Chronorelais/etc/config.xml
CHANGED
@@ -1,465 +1,673 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Chronopost_Chronorelais>
|
5 |
-
<version>1.0
|
6 |
-
<depends>
|
7 |
-
<Mage_Shipping />
|
8 |
-
<Mage_Sales />
|
9 |
-
<Mage_Adminhtml />
|
10 |
-
</depends>
|
11 |
-
</Chronopost_Chronorelais>
|
12 |
-
</modules>
|
13 |
-
|
14 |
-
<global>
|
15 |
-
<models>
|
16 |
-
<chronorelais>
|
17 |
-
<class>Chronopost_Chronorelais_Model</class>
|
18 |
-
</chronorelais>
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
</
|
23 |
-
</
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
</
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
</
|
33 |
-
</
|
34 |
-
</
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
</
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
<connection>
|
63 |
-
<use>
|
64 |
-
</connection>
|
65 |
-
</
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
<
|
81 |
-
<from><![CDATA[#^/
|
82 |
-
</from>
|
83 |
-
<to
|
84 |
-
</
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
<
|
99 |
-
<w_relay_point_code>
|
100 |
-
<
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
<
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
<
|
112 |
-
</w_relay_point_code>
|
113 |
-
</
|
114 |
-
<
|
115 |
-
<w_relay_point_code>
|
116 |
-
<to_quote_address>*</to_quote_address>
|
117 |
-
</w_relay_point_code>
|
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 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
<
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
<
|
183 |
-
<
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
<
|
342 |
-
|
343 |
-
|
344 |
-
<
|
345 |
-
|
346 |
-
|
347 |
-
<
|
348 |
-
<
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
<
|
362 |
-
<
|
363 |
-
<
|
364 |
-
<
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
<
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
}
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
<
|
402 |
-
<
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
<
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
<
|
426 |
-
<
|
427 |
-
<
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
<
|
453 |
-
<
|
454 |
-
<
|
455 |
-
<
|
456 |
-
<
|
457 |
-
<
|
458 |
-
|
459 |
-
|
460 |
-
<
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Chronopost_Chronorelais>
|
5 |
+
<version>1.3.0</version>
|
6 |
+
<depends>
|
7 |
+
<Mage_Shipping />
|
8 |
+
<Mage_Sales />
|
9 |
+
<Mage_Adminhtml />
|
10 |
+
</depends>
|
11 |
+
</Chronopost_Chronorelais>
|
12 |
+
</modules>
|
13 |
+
|
14 |
+
<global>
|
15 |
+
<models>
|
16 |
+
<chronorelais>
|
17 |
+
<class>Chronopost_Chronorelais_Model</class>
|
18 |
+
</chronorelais>
|
19 |
+
</models>
|
20 |
+
<blocks>
|
21 |
+
<chronorelais>
|
22 |
+
<class>Chronopost_Chronorelais_Block</class>
|
23 |
+
</chronorelais>
|
24 |
+
<adminhtml>
|
25 |
+
<rewrite>
|
26 |
+
<sales_order_shipment_view>Chronopost_Chronorelais_Block_Sales_Order_Shipment_View</sales_order_shipment_view>
|
27 |
+
</rewrite>
|
28 |
+
</adminhtml>
|
29 |
+
</blocks>
|
30 |
+
<helpers>
|
31 |
+
<chronorelais>
|
32 |
+
<class>Chronopost_Chronorelais_Helper</class>
|
33 |
+
</chronorelais>
|
34 |
+
</helpers>
|
35 |
+
|
36 |
+
<resources>
|
37 |
+
<sales>
|
38 |
+
<shipping>
|
39 |
+
<carriers>
|
40 |
+
<chronorelais>
|
41 |
+
<class>Chronopost_Chronorelais_Model_Carrier_Chronorelais</class>
|
42 |
+
</chronorelais>
|
43 |
+
<chronopost>
|
44 |
+
<class>Chronopost_Chronorelais_Model_Carrier_Chronopost</class>
|
45 |
+
</chronopost>
|
46 |
+
<chronoexpress>
|
47 |
+
<class>Chronopost_Chronorelais_Model_Carrier_Chronoexpress</class>
|
48 |
+
</chronoexpress>
|
49 |
+
</carriers>
|
50 |
+
</shipping>
|
51 |
+
</sales>
|
52 |
+
<chronorelais_setup>
|
53 |
+
<setup>
|
54 |
+
<module>Chronopost_Chronorelais</module>
|
55 |
+
<class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
|
56 |
+
</setup>
|
57 |
+
<connection>
|
58 |
+
<use>core_setup</use>
|
59 |
+
</connection>
|
60 |
+
</chronorelais_setup>
|
61 |
+
<chronorelais_write>
|
62 |
+
<connection>
|
63 |
+
<use>core_write</use>
|
64 |
+
</connection>
|
65 |
+
</chronorelais_write>
|
66 |
+
|
67 |
+
<chronorelais_read>
|
68 |
+
<connection>
|
69 |
+
<use>core_read</use>
|
70 |
+
</connection>
|
71 |
+
</chronorelais_read>
|
72 |
+
</resources>
|
73 |
+
|
74 |
+
<rewrite>
|
75 |
+
<chronopost_chronorelais_checkout_multishipping>
|
76 |
+
<from><![CDATA[#^/checkout/multishipping/#]]>
|
77 |
+
</from>
|
78 |
+
<to>/chronorelais/checkout_multishipping/</to>
|
79 |
+
</chronopost_chronorelais_checkout_multishipping>
|
80 |
+
<chronopost_chronorelais_sales_order_shipment>
|
81 |
+
<from><![CDATA[#^/(.*)sales_order_shipment/save/#]]>
|
82 |
+
</from>
|
83 |
+
<to><![CDATA[/$1chronorelais_sales_order_shipment/save/]]></to>
|
84 |
+
</chronopost_chronorelais_sales_order_shipment>
|
85 |
+
</rewrite>
|
86 |
+
|
87 |
+
<fieldsets>
|
88 |
+
<sales_copy_order_billing_address>
|
89 |
+
<w_relay_point_code>
|
90 |
+
<to_order>*</to_order>
|
91 |
+
</w_relay_point_code>
|
92 |
+
</sales_copy_order_billing_address>
|
93 |
+
<sales_copy_order_shipping_address>
|
94 |
+
<w_relay_point_code>
|
95 |
+
<to_order>*</to_order>
|
96 |
+
</w_relay_point_code>
|
97 |
+
</sales_copy_order_shipping_address>
|
98 |
+
<sales_convert_quote_address>
|
99 |
+
<w_relay_point_code>
|
100 |
+
<to_order_address>*</to_order_address>
|
101 |
+
<to_customer_address>*</to_customer_address>
|
102 |
+
</w_relay_point_code>
|
103 |
+
<chronopostsrdv_creneaux_info>
|
104 |
+
<to_order_address>*</to_order_address>
|
105 |
+
<to_customer_address>*</to_customer_address>
|
106 |
+
<to_order>*</to_order>
|
107 |
+
</chronopostsrdv_creneaux_info>
|
108 |
+
</sales_convert_quote_address>
|
109 |
+
<sales_convert_order_address>
|
110 |
+
<w_relay_point_code>
|
111 |
+
<to_quote_address>*</to_quote_address>
|
112 |
+
</w_relay_point_code>
|
113 |
+
</sales_convert_order_address>
|
114 |
+
<customer_address>
|
115 |
+
<w_relay_point_code>
|
116 |
+
<to_quote_address>*</to_quote_address>
|
117 |
+
</w_relay_point_code>
|
118 |
+
</customer_address>
|
119 |
+
</fieldsets>
|
120 |
+
|
121 |
+
</global>
|
122 |
+
|
123 |
+
<frontend>
|
124 |
+
<routers>
|
125 |
+
<chronorelais>
|
126 |
+
<use>standard</use>
|
127 |
+
<args>
|
128 |
+
<module>Chronopost_Chronorelais</module>
|
129 |
+
<frontName>chronorelais</frontName>
|
130 |
+
</args>
|
131 |
+
</chronorelais>
|
132 |
+
</routers>
|
133 |
+
|
134 |
+
<layout>
|
135 |
+
<updates>
|
136 |
+
<chronorelais>
|
137 |
+
<file>chronorelais.xml</file>
|
138 |
+
</chronorelais>
|
139 |
+
</updates>
|
140 |
+
</layout>
|
141 |
+
<translate>
|
142 |
+
<modules>
|
143 |
+
<Chronopost_Chronorelais>
|
144 |
+
<files>
|
145 |
+
<default>Chronopost_Chronorelais.csv</default>
|
146 |
+
</files>
|
147 |
+
</Chronopost_Chronorelais>
|
148 |
+
</modules>
|
149 |
+
</translate>
|
150 |
+
|
151 |
+
<events>
|
152 |
+
<controller_action_predispatch_checkout_onepage_index>
|
153 |
+
<observers>
|
154 |
+
<check_soap_exists>
|
155 |
+
<class>chronorelais/observer</class>
|
156 |
+
<method>checkSoapExists</method>
|
157 |
+
</check_soap_exists>
|
158 |
+
</observers>
|
159 |
+
</controller_action_predispatch_checkout_onepage_index>
|
160 |
+
|
161 |
+
<controller_action_predispatch_checkout_onepage_saveBilling>
|
162 |
+
<observers>
|
163 |
+
<savebilling_before>
|
164 |
+
<class>chronorelais/observer</class>
|
165 |
+
<method>saveBillingBefore</method>
|
166 |
+
</savebilling_before>
|
167 |
+
</observers>
|
168 |
+
</controller_action_predispatch_checkout_onepage_saveBilling>
|
169 |
+
|
170 |
+
<controller_action_predispatch_checkout_onepage_saveShipping>
|
171 |
+
<observers>
|
172 |
+
<saveshipping_before>
|
173 |
+
<class>chronorelais/observer</class>
|
174 |
+
<method>saveShippingBefore</method>
|
175 |
+
</saveshipping_before>
|
176 |
+
</observers>
|
177 |
+
</controller_action_predispatch_checkout_onepage_saveShipping>
|
178 |
+
|
179 |
+
<controller_action_predispatch_checkout_onepage_saveShippingMethod>
|
180 |
+
<observers>
|
181 |
+
<saveshippingmethod_before>
|
182 |
+
<class>chronorelais/observer</class>
|
183 |
+
<method>saveShippingMethodBefore</method>
|
184 |
+
</saveshippingmethod_before>
|
185 |
+
</observers>
|
186 |
+
</controller_action_predispatch_checkout_onepage_saveShippingMethod>
|
187 |
+
|
188 |
+
<controller_action_predispatch_onestepcheckout_ajax_set_methods_separate>
|
189 |
+
<observers>
|
190 |
+
<saveshippingmethod_idev_onestepcheckout_before>
|
191 |
+
<class>chronorelais/observer</class>
|
192 |
+
<method>saveShippingMethodBefore</method>
|
193 |
+
</saveshippingmethod_idev_onestepcheckout_before>
|
194 |
+
</observers>
|
195 |
+
</controller_action_predispatch_onestepcheckout_ajax_set_methods_separate>
|
196 |
+
|
197 |
+
<sales_order_place_before>
|
198 |
+
<observers>
|
199 |
+
<check_relay_point>
|
200 |
+
<type>singleton</type>
|
201 |
+
<class>chronorelais/observer</class>
|
202 |
+
<method>checkRelayPoint</method>
|
203 |
+
</check_relay_point>
|
204 |
+
</observers>
|
205 |
+
</sales_order_place_before>
|
206 |
+
|
207 |
+
<sales_convert_quote_address_to_order>
|
208 |
+
<observers>
|
209 |
+
<update_order_with_relay_address>
|
210 |
+
<type>singleton</type>
|
211 |
+
<class>chronorelais/observer</class>
|
212 |
+
<method>updateShippingAddress</method>
|
213 |
+
</update_order_with_relay_address>
|
214 |
+
</observers>
|
215 |
+
</sales_convert_quote_address_to_order>
|
216 |
+
|
217 |
+
</events>
|
218 |
+
</frontend>
|
219 |
+
|
220 |
+
<!-- <admin>
|
221 |
+
<routers>
|
222 |
+
<chronorelais>
|
223 |
+
<use>admin</use>
|
224 |
+
<args>
|
225 |
+
<module>Chronopost_Chronorelais</module>
|
226 |
+
<frontName>chronorelais</frontName>
|
227 |
+
</args>
|
228 |
+
</chronorelais>
|
229 |
+
</routers>
|
230 |
+
</admin> -->
|
231 |
+
<adminhtml>
|
232 |
+
<layout>
|
233 |
+
<updates>
|
234 |
+
<chronorelais>
|
235 |
+
<file>chronorelais.xml</file>
|
236 |
+
</chronorelais>
|
237 |
+
</updates>
|
238 |
+
</layout>
|
239 |
+
<menu>
|
240 |
+
<sales>
|
241 |
+
<children>
|
242 |
+
<chronorelais translate="title"> <!-- TODO faire marcher : module="chronorelais" (aussi dans les children) -->
|
243 |
+
<title>Chronopost</title>
|
244 |
+
<sort_order>15</sort_order>
|
245 |
+
<children>
|
246 |
+
<export translate="title">
|
247 |
+
<title>Export</title>
|
248 |
+
<action>adminhtml/chronorelais_export</action>
|
249 |
+
<sort_order>10</sort_order>
|
250 |
+
</export>
|
251 |
+
<import translate="title">
|
252 |
+
<title>Import</title>
|
253 |
+
<action>adminhtml/chronorelais_import</action>
|
254 |
+
<sort_order>20</sort_order>
|
255 |
+
</import>
|
256 |
+
<impression translate="title" module="sales">
|
257 |
+
<title>Impression des étiquettes</title>
|
258 |
+
<action>adminhtml/chronorelais_sales_impression</action>
|
259 |
+
<sort_order>30</sort_order>
|
260 |
+
</impression>
|
261 |
+
<bordereau translate="title" module="sales">
|
262 |
+
<title>Bordereau de fin de journée</title>
|
263 |
+
<action>adminhtml/chronorelais_sales_bordereau</action>
|
264 |
+
<sort_order>40</sort_order>
|
265 |
+
</bordereau>
|
266 |
+
</children>
|
267 |
+
</chronorelais>
|
268 |
+
</children>
|
269 |
+
</sales>
|
270 |
+
</menu>
|
271 |
+
<acl>
|
272 |
+
<resources>
|
273 |
+
<admin>
|
274 |
+
<children>
|
275 |
+
<sales>
|
276 |
+
<children>
|
277 |
+
<chronorelais translate="title">
|
278 |
+
<title>Chronopost</title>
|
279 |
+
<sort_order>15</sort_order>
|
280 |
+
<children>
|
281 |
+
<export translate="title">
|
282 |
+
<title>Export</title>
|
283 |
+
<sort_order>10</sort_order>
|
284 |
+
</export>
|
285 |
+
<import translate="title">
|
286 |
+
<title>Import</title>
|
287 |
+
<sort_order>20</sort_order>
|
288 |
+
</import>
|
289 |
+
<impression translate="title" module="sales">
|
290 |
+
<title>Impression des étiquettes</title>
|
291 |
+
<sort_order>30</sort_order>
|
292 |
+
</impression>
|
293 |
+
</children>
|
294 |
+
</chronorelais>
|
295 |
+
</children>
|
296 |
+
</sales>
|
297 |
+
<system>
|
298 |
+
<children>
|
299 |
+
<config>
|
300 |
+
<children>
|
301 |
+
<chronorelais translate="title" module="chronorelais">
|
302 |
+
<title>Chronopost</title>
|
303 |
+
<sort_order>100</sort_order>
|
304 |
+
</chronorelais>
|
305 |
+
</children>
|
306 |
+
</config>
|
307 |
+
</children>
|
308 |
+
</system>
|
309 |
+
</children>
|
310 |
+
</admin>
|
311 |
+
</resources>
|
312 |
+
</acl>
|
313 |
+
|
314 |
+
<translate>
|
315 |
+
<modules>
|
316 |
+
<Chronopost_Chronorelais>
|
317 |
+
<files>
|
318 |
+
<default>Chronopost_Chronorelais.csv</default>
|
319 |
+
</files>
|
320 |
+
</Chronopost_Chronorelais>
|
321 |
+
</modules>
|
322 |
+
</translate>
|
323 |
+
|
324 |
+
</adminhtml>
|
325 |
+
|
326 |
+
<admin>
|
327 |
+
<routers>
|
328 |
+
<adminhtml>
|
329 |
+
<args>
|
330 |
+
<modules>
|
331 |
+
<Chronopost_Chronorelais before="Mage_Adminhtml">Chronopost_Chronorelais_Adminhtml</Chronopost_Chronorelais>
|
332 |
+
</modules>
|
333 |
+
</args>
|
334 |
+
</adminhtml>
|
335 |
+
</routers>
|
336 |
+
</admin>
|
337 |
+
|
338 |
+
<default>
|
339 |
+
<chronorelais>
|
340 |
+
<shipping>
|
341 |
+
<google_map_api></google_map_api>
|
342 |
+
<tracking_view_url><![CDATA[http://www.chronopost.fr/expedier/inputLTNumbersNoJahia.do?lang=fr_FR&listeNumeros={tracking_number}]]>
|
343 |
+
</tracking_view_url>
|
344 |
+
<gs_path>/usr/bin/gs</gs_path>
|
345 |
+
</shipping>
|
346 |
+
<export_css>
|
347 |
+
<file_extension>.chr</file_extension>
|
348 |
+
<file_charset>ASCII-7</file_charset>
|
349 |
+
<endofline_character>crlf</endofline_character>
|
350 |
+
<field_delimiter>none</field_delimiter>
|
351 |
+
<field_separator>;</field_separator>
|
352 |
+
</export_css>
|
353 |
+
<export_cso>
|
354 |
+
<file_extension>.txt</file_extension>
|
355 |
+
<file_charset>ISO-8859-1</file_charset>
|
356 |
+
<endofline_character>crlf</endofline_character>
|
357 |
+
<field_delimiter>none</field_delimiter>
|
358 |
+
<field_separator>;</field_separator>
|
359 |
+
</export_cso>
|
360 |
+
<import>
|
361 |
+
<default_tracking_title>Chronopost - Chronopost livraison express à domicile</default_tracking_title>
|
362 |
+
<send_email>1</send_email>
|
363 |
+
<shipping_comment></shipping_comment>
|
364 |
+
<include_comment>0</include_comment>
|
365 |
+
</import>
|
366 |
+
<saturday>
|
367 |
+
<startday>thursday:18:00</startday>
|
368 |
+
<endday>friday:15:00</endday>
|
369 |
+
</saturday>
|
370 |
+
</chronorelais>
|
371 |
+
<carriers>
|
372 |
+
<chronopost>
|
373 |
+
<active>0</active>
|
374 |
+
<title>Chronopost-Livraison express à domicile avant 13H</title>
|
375 |
+
<model>Chronopost_Chronorelais_Model_Carrier_Chronopost</model>
|
376 |
+
<tracking_view_url></tracking_view_url>
|
377 |
+
<config>
|
378 |
+
# Chronopost
|
379 |
+
{
|
380 |
+
label: "Chronopost-Livraison express à domicile avant 13H",
|
381 |
+
code: "chronopost",
|
382 |
+
description: "En 24h à votre domicile! Commande livrée le lendemain matin avant 13h.
|
383 |
+
Vous pouvez reprogrammer votre livraison en cas d'absence.",
|
384 |
+
tracking_url: "http://www.fr.chronopost.com/fr/tracking/result?listeNumeros={tracking_number}",
|
385 |
+
destination: "FR,MC",
|
386 |
+
fees: "{table {cart.weight} in 2.00:17.56, 3.00:18.40, 4.00:19.24, 5.00:20.08, 6.00:20.92, 7.00:21.76, 8.00:22.60, 9.00:23.44, 10.00:24.28, 15.00:28.48, 20.00:32.68, 25.00:36.88, 30.00:41.08}",
|
387 |
+
}
|
388 |
+
|
389 |
+
# Chronopost Corse
|
390 |
+
{
|
391 |
+
label: "Chronopost livraison express à domicile en Corse",
|
392 |
+
code: "chronopost_corse",
|
393 |
+
description: "Colis livré le lendemain avant 13h, à l’adresse de votre choix.
|
394 |
+
Délai à compter de la prise en charge du colis par Chronopost, pour une livraison en France métropolitaine.
|
395 |
+
En cas d’absence, le colis est mis en instance dans le bureau de Poste le plus proche.",
|
396 |
+
tracking_url: "http://www.fr.chronopost.com/fr/tracking/result?listeNumeros={tracking_number}",
|
397 |
+
destination: "FR(20*)",
|
398 |
+
fees: "{table {cart.weight} in 2.00:19.56, 3.00:20.40, 4.00:21.24, 5.00:22.08, 6.00:22.92, 7.00:23.76, 8.00:24.60, 9.00:25.44, 10.00:26.28, 15.00:30.48, 20.00:34.68, 25.00:38.88, 30.00:43.08}",
|
399 |
+
}
|
400 |
+
</config>
|
401 |
+
<weight_limit>30</weight_limit>
|
402 |
+
<quickcost_url>https://www.chronopost.fr/quickcost-cxf/QuickcostServiceWS?wsdl</quickcost_url>
|
403 |
+
<logo_url>chronopost.png</logo_url>
|
404 |
+
<debug>0</debug>
|
405 |
+
<stop_to_first_match>0</stop_to_first_match>
|
406 |
+
<!--<specificerrmsg>This shipping method is currently unavailable.</specificerrmsg>-->
|
407 |
+
<sort_order>1</sort_order>
|
408 |
+
</chronopost>
|
409 |
+
<chronoexpress>
|
410 |
+
<active>0</active>
|
411 |
+
<title>Chronopost Livraison express partout dans le monde</title>
|
412 |
+
<model>Chronopost_Chronorelais_Model_Carrier_Chronoexpress</model>
|
413 |
+
<tracking_view_url></tracking_view_url>
|
414 |
+
<config>
|
415 |
+
# Chronoexpress
|
416 |
+
{
|
417 |
+
label: "Chronopost Livraison express partout dans le monde",
|
418 |
+
code: "chronoexpress",
|
419 |
+
description: "En express à votre domicile! Commande livrée en Express à l'adresse de votre choix.",
|
420 |
+
tracking_url: "http://www.fr.chronopost.com/fr/tracking/result?listeNumeros={tracking_number}",
|
421 |
+
destination: "DE,BE,BG,CY,DK,ES,EE,FI,GR,IE,IT,LV,LT,MT,NL,PL,PT,CZ,RO,SK,AT,HU,LU,GB,SI,SE,GF,YT,GP,MQ,RE",
|
422 |
+
fees: "{table {cart.weight} in 0.50:30.94, 1.00:45.07, 1.50:55.26, 2.00:65.45, 2.50:75.64, 3.00:85.83, 3.50:88.72, 4.00:91.61, 4.50:94.50, 5.00:97.39, 30.00:97.39}",
|
423 |
+
}
|
424 |
+
</config>
|
425 |
+
<weight_limit>30</weight_limit>
|
426 |
+
<quickcost_url>https://www.chronopost.fr/quickcost-cxf/QuickcostServiceWS?wsdl</quickcost_url>
|
427 |
+
<logo_url>Logo-Chronopost.jpg</logo_url>
|
428 |
+
<debug>0</debug>
|
429 |
+
<stop_to_first_match>0</stop_to_first_match>
|
430 |
+
<!--<specificerrmsg>This shipping method is currently unavailable.</specificerrmsg>-->
|
431 |
+
<sort_order>2</sort_order>
|
432 |
+
</chronoexpress>
|
433 |
+
<chronorelais>
|
434 |
+
<active>0</active>
|
435 |
+
<title>Chrono Relais</title>
|
436 |
+
<model>Chronopost_Chronorelais_Model_Carrier_Chronorelais</model>
|
437 |
+
<tracking_view_url></tracking_view_url>
|
438 |
+
<config>
|
439 |
+
# Chronorelais
|
440 |
+
{
|
441 |
+
label: "Chrono Relais : livraison express en relais Pickup",
|
442 |
+
code: "chronorelais",
|
443 |
+
description: "En 24h en relais Pickup! Commande livrée le lendemain dans le relais
|
444 |
+
Pickup de votre choix, parmi 7500 points répartis sur toute la France.",
|
445 |
+
tracking_url: "http://www.fr.chronopost.com/fr/tracking/result?listeNumeros={tracking_number}",
|
446 |
+
destination: "FR",
|
447 |
+
fees: "{table {cart.weight} in 2.00:17.56, 3.00:18.40, 4.00:19.24, 5.00:20.08, 6.00:20.92, 7.00:21.76, 8.00:22.60, 9.00:23.44, 10.00:24.28, 15.00:28.48, 20.00:32.68, 25.00:36.88, 30.00:41.08}",
|
448 |
+
}
|
449 |
+
|
450 |
+
# Voir exemple sur mode "Chronopost" pour un tarif spécifique pour la Corse
|
451 |
+
</config>
|
452 |
+
<weight_limit>20</weight_limit>
|
453 |
+
<quickcost_url>https://www.chronopost.fr/quickcost-cxf/QuickcostServiceWS?wsdl</quickcost_url>
|
454 |
+
<show_google_map>1</show_google_map>
|
455 |
+
<logo_url>chronorelais.png</logo_url>
|
456 |
+
<debug>0</debug>
|
457 |
+
<stop_to_first_match>0</stop_to_first_match>
|
458 |
+
<!--<specificerrmsg>This shipping method is currently unavailable.</specificerrmsg>-->
|
459 |
+
<sort_order>3</sort_order>
|
460 |
+
<max_distance_search>15</max_distance_search>
|
461 |
+
<max_point_chronopost>5</max_point_chronopost>
|
462 |
+
<point_relai_ws_method>recherchePointChronopost</point_relai_ws_method>
|
463 |
+
<add_address_to_ws>1</add_address_to_ws>
|
464 |
+
<can_change_postcode>1</can_change_postcode>
|
465 |
+
</chronorelais>
|
466 |
+
<chronopostc10>
|
467 |
+
<active>0</active>
|
468 |
+
<title>Chronopost-Livraison express à domicile avant 10H</title>
|
469 |
+
<model>Chronopost_Chronorelais_Model_Carrier_ChronopostC10</model>
|
470 |
+
<tracking_view_url></tracking_view_url>
|
471 |
+
<config>
|
472 |
+
# ChronopostC10
|
473 |
+
{
|
474 |
+
label: "Chronopost-Livraison express à domicile avant 10H",
|
475 |
+
code: "chronopostC10",
|
476 |
+
description: "En 24h à votre domicile! Commande livrée le lendemain matin avant 10h.
|
477 |
+
Vous pouvez reprogrammer votre livraison en cas d'absence.",
|
478 |
+
tracking_url: "http://www.fr.chronopost.com/fr/tracking/result?listeNumeros={tracking_number}",
|
479 |
+
destination: "FR,MC",
|
480 |
+
fees: "{table {cart.weight} in 2.00:17.56, 3.00:18.40, 4.00:19.24, 5.00:20.08, 6.00:20.92, 7.00:21.76, 8.00:22.60, 9.00:23.44, 10.00:24.28, 15.00:28.48, 20.00:32.68, 25.00:36.88, 30.00:41.08}",
|
481 |
+
}
|
482 |
+
</config>
|
483 |
+
<weight_limit>30</weight_limit>
|
484 |
+
<quickcost_url>https://www.chronopost.fr/quickcost-cxf/QuickcostServiceWS?wsdl</quickcost_url>
|
485 |
+
<logo_url>chronopost.png</logo_url>
|
486 |
+
<debug>0</debug>
|
487 |
+
<stop_to_first_match>0</stop_to_first_match>
|
488 |
+
<!--<specificerrmsg>This shipping method is currently unavailable.</specificerrmsg>-->
|
489 |
+
<sort_order>4</sort_order>
|
490 |
+
</chronopostc10>
|
491 |
+
<chronopostc18>
|
492 |
+
<active>0</active>
|
493 |
+
<title>Chronopost-Livraison express à domicile avant 18H</title>
|
494 |
+
<model>Chronopost_Chronorelais_Model_Carrier_ChronopostC18</model>
|
495 |
+
<tracking_view_url></tracking_view_url>
|
496 |
+
<config>
|
497 |
+
# ChronopostC18
|
498 |
+
{
|
499 |
+
label: "Chronopost-Livraison express à domicile avant 18H",
|
500 |
+
code: "chronopostC18",
|
501 |
+
description: "En 24h à votre domicile! Commande livrée le lendemain matin avant 18h.
|
502 |
+
Vous pouvez reprogrammer votre livraison en cas d'absence.",
|
503 |
+
tracking_url: "http://www.fr.chronopost.com/fr/tracking/result?listeNumeros={tracking_number}",
|
504 |
+
destination: "FR,MC",
|
505 |
+
fees: "{table {cart.weight} in 2.00:17.56, 3.00:18.40, 4.00:19.24, 5.00:20.08, 6.00:20.92, 7.00:21.76, 8.00:22.60, 9.00:23.44, 10.00:24.28, 15.00:28.48, 20.00:32.68, 25.00:36.88, 30.00:41.08}",
|
506 |
+
}
|
507 |
+
</config>
|
508 |
+
<weight_limit>30</weight_limit>
|
509 |
+
<quickcost>0</quickcost>
|
510 |
+
<quickcost_url>https://www.chronopost.fr/quickcost-cxf/QuickcostServiceWS?wsdl</quickcost_url>
|
511 |
+
<logo_url>chronopost.png</logo_url>
|
512 |
+
<debug>0</debug>
|
513 |
+
<stop_to_first_match>0</stop_to_first_match>
|
514 |
+
<!--<specificerrmsg>This shipping method is currently unavailable.</specificerrmsg>-->
|
515 |
+
<sort_order>5</sort_order>
|
516 |
+
</chronopostc18>
|
517 |
+
<chronopostcclassic>
|
518 |
+
<active>0</active>
|
519 |
+
<title>Chronopost Livraison dans certaines villes Européennes</title>
|
520 |
+
<model>Chronopost_Chronorelais_Model_Carrier_ChronopostCClassic</model>
|
521 |
+
<tracking_view_url></tracking_view_url>
|
522 |
+
<config>
|
523 |
+
# CClassic
|
524 |
+
{
|
525 |
+
label: "Chronopost Livraison dans certaines villes Européennes",
|
526 |
+
code: "chronopostcclassic",
|
527 |
+
description: "A domicile! Commande livrée à l'adresse de votre choix. Vous pouvez reprogrammer votre livraison en cas d’absence.",
|
528 |
+
tracking_url: "http://www.fr.chronopost.com/fr/tracking/result?listeNumeros={tracking_number}",
|
529 |
+
destination: "DE,BE,BG,CY,DK,ES,EE,FI,GR,IE,IT,LV,LT,MT,NL,PL,PT,CZ,RO,SK,AT,HU,LU,GB,SI,SE,GF,YT,GP,MQ,RE",
|
530 |
+
fees: "{table {cart.weight} in 0.50:30.94, 1.00:45.07, 1.50:55.26, 2.00:65.45, 2.50:75.64, 3.00:85.83, 3.50:88.72, 4.00:91.61, 4.50:94.50, 5.00:97.39, 30.00:97.39}",
|
531 |
+
}
|
532 |
+
</config>
|
533 |
+
<weight_limit>30</weight_limit>
|
534 |
+
<quickcost_url>https://www.chronopost.fr/quickcost-cxf/QuickcostServiceWS?wsdl</quickcost_url>
|
535 |
+
<logo_url>chronopost.png</logo_url>
|
536 |
+
<debug>0</debug>
|
537 |
+
<stop_to_first_match>0</stop_to_first_match>
|
538 |
+
<!--<specificerrmsg>This shipping method is currently unavailable.</specificerrmsg>-->
|
539 |
+
<sort_order>6</sort_order>
|
540 |
+
</chronopostcclassic>
|
541 |
+
<chronorelaiseurope>
|
542 |
+
<active>0</active>
|
543 |
+
<title>Chrono Relais Europe</title>
|
544 |
+
<model>Chronopost_Chronorelais_Model_Carrier_Chronorelaiseurope</model>
|
545 |
+
<tracking_view_url></tracking_view_url>
|
546 |
+
<config>
|
547 |
+
# ChronorelaisEurope
|
548 |
+
{
|
549 |
+
label: "Chronopost Livraison en point relais",
|
550 |
+
description: "En relais Pickup! Commande livrée dans le relais Pickup de votre choix.",
|
551 |
+
code: "chronorelaiseurope",
|
552 |
+
description: "Colis livré en Chronopost",
|
553 |
+
tracking_url: "http://www.chronopost.fr/expedier/inputLTNumbersNoJahia.do?lang=fr_FR&listeNumeros=@",
|
554 |
+
destination: "DE,AT,BE,BG,CY,DK,ES,EE,FI,GR,HU,IE,IT,LV,LT,LU,MT,NL,PL,PT,CZ,RO,GB,SK,SI,SE",
|
555 |
+
fees: "{table {cart.weight} in 2.00:17.56, 3.00:18.40, 4.00:19.24, 5.00:20.08, 6.00:20.92, 7.00:21.76, 8.00:22.60, 9.00:23.44, 10.00:24.28, 15.00:28.48, 20.00:32.68, 25.00:36.88, 30.00:41.08}",
|
556 |
+
}
|
557 |
+
</config>
|
558 |
+
<weight_limit>20</weight_limit>
|
559 |
+
<quickcost_url>https://www.chronopost.fr/quickcost-cxf/QuickcostServiceWS?wsdl</quickcost_url>
|
560 |
+
<show_google_map>1</show_google_map>
|
561 |
+
<logo_url>chronorelais.png</logo_url>
|
562 |
+
<debug>0</debug>
|
563 |
+
<stop_to_first_match>0</stop_to_first_match>
|
564 |
+
<deliver_on_saturday>0</deliver_on_saturday>
|
565 |
+
<sort_order>7</sort_order>
|
566 |
+
<max_distance_search>15</max_distance_search>
|
567 |
+
<max_point_chronopost>10</max_point_chronopost>
|
568 |
+
<point_relai_ws_method>recherchePointChronopostInter</point_relai_ws_method>
|
569 |
+
<add_address_to_ws>0</add_address_to_ws>
|
570 |
+
<can_change_postcode>0</can_change_postcode>
|
571 |
+
</chronorelaiseurope>
|
572 |
+
<!--<chronorelaisdom>
|
573 |
+
<active>0</active>
|
574 |
+
<title>Chrono Relais DOM</title>
|
575 |
+
<model>Chronopost_Chronorelais_Model_Carrier_Chronorelaisdom</model>
|
576 |
+
<tracking_view_url></tracking_view_url>
|
577 |
+
<config>
|
578 |
+
# ChronorelaisDom
|
579 |
+
{
|
580 |
+
label: "Chronopost - Livraison en point relais",
|
581 |
+
description: "En relais Pickup! Commande livrée dans le relais Pickup de votre choix.",
|
582 |
+
code: "chronorelaisdom",
|
583 |
+
description: "Colis livré en Chronopost",
|
584 |
+
tracking_url: "http://www.chronopost.fr/expedier/inputLTNumbersNoJahia.do?lang=fr_FR&listeNumeros=@",
|
585 |
+
destination: "GP,MQ,GF,RE",
|
586 |
+
fees: "{table {cart.weight} in 2.00:17.56, 3.00:18.40, 4.00:19.24, 5.00:20.08, 6.00:20.92, 7.00:21.76, 8.00:22.60, 9.00:23.44, 10.00:24.28, 15.00:28.48, 20.00:32.68, 25.00:36.88, 30.00:41.08}",
|
587 |
+
}
|
588 |
+
</config>
|
589 |
+
<weight_limit>20</weight_limit>
|
590 |
+
<quickcost_url>https://www.chronopost.fr/quickcost-cxf/QuickcostServiceWS?wsdl</quickcost_url>
|
591 |
+
<show_google_map>1</show_google_map>
|
592 |
+
<logo_url>chronorelais.png</logo_url>
|
593 |
+
<debug>0</debug>
|
594 |
+
<stop_to_first_match>0</stop_to_first_match>
|
595 |
+
<deliver_on_saturday>0</deliver_on_saturday>
|
596 |
+
<sort_order>8</sort_order>
|
597 |
+
<max_distance_search>15</max_distance_search>
|
598 |
+
<max_point_chronopost>10</max_point_chronopost>
|
599 |
+
<point_relai_ws_method>recherchePointChronopostInter</point_relai_ws_method>
|
600 |
+
<add_address_to_ws>1</add_address_to_ws>
|
601 |
+
<can_change_postcode>0</can_change_postcode>
|
602 |
+
</chronorelaisdom>-->
|
603 |
+
<chronopostsameday>
|
604 |
+
<active>0</active>
|
605 |
+
<title>Chronopost-Livraison express à domicile le même jour</title>
|
606 |
+
<model>Chronopost_Chronorelais_Model_Carrier_Chronopostsameday</model>
|
607 |
+
<tracking_view_url></tracking_view_url>
|
608 |
+
<config>
|
609 |
+
# Chronopost
|
610 |
+
{
|
611 |
+
label: "Chronopost-Livraison express à domicile le même jour",
|
612 |
+
code: "chronopostsameday",
|
613 |
+
description: "Ce soir à votre domicile! Commande livrée ce soir entre 19h et 22h.
|
614 |
+
Vous pouvez reprogrammer votre livraison en cas d'absence.",
|
615 |
+
tracking_url: "http://www.fr.chronopost.com/fr/tracking/result?listeNumeros={tracking_number}",
|
616 |
+
destination: "FR,MC",
|
617 |
+
fees: "{table {cart.weight} in 2.00:17.56, 3.00:18.40, 4.00:19.24, 5.00:20.08, 6.00:20.92, 7.00:21.76, 8.00:22.60, 9.00:23.44, 10.00:24.28, 15.00:28.48, 20.00:32.68, 25.00:36.88, 30.00:41.08}",
|
618 |
+
}
|
619 |
+
</config>
|
620 |
+
<weight_limit>30</weight_limit>
|
621 |
+
<quickcost_url>https://www.chronopost.fr/quickcost-cxf/QuickcostServiceWS?wsdl</quickcost_url>
|
622 |
+
<logo_url>chronopost.png</logo_url>
|
623 |
+
<debug>0</debug>
|
624 |
+
<stop_to_first_match>0</stop_to_first_match>
|
625 |
+
<!--<specificerrmsg>This shipping method is currently unavailable.</specificerrmsg>-->
|
626 |
+
<sort_order>9</sort_order>
|
627 |
+
</chronopostsameday>
|
628 |
+
<chronopostsrdv>
|
629 |
+
<active>0</active>
|
630 |
+
<title>Chronopost-Livraison sur Rendez-vous</title>
|
631 |
+
<model>Chronopost_Chronorelais_Model_Carrier_Chronopostsrdv</model>
|
632 |
+
<tracking_view_url></tracking_view_url>
|
633 |
+
<config>
|
634 |
+
# Chronopost
|
635 |
+
{
|
636 |
+
label: "Chronopost-Livraison sur Rendez-vous",
|
637 |
+
code: "chronopostsrdv",
|
638 |
+
description: "Sur RDV à votre domicile! Commande livrée au jour de votre choix dans un créneau horaire de 2h.
|
639 |
+
Vous pouvez reprogrammer votre livraison en cas d'absence.",
|
640 |
+
tracking_url: "http://www.fr.chronopost.com/fr/tracking/result?listeNumeros={tracking_number}",
|
641 |
+
destination: "FR",
|
642 |
+
fees: "0",
|
643 |
+
}
|
644 |
+
</config>
|
645 |
+
<weight_limit>30</weight_limit>
|
646 |
+
<quickcost_url>https://www.chronopost.fr/quickcost-cxf/QuickcostServiceWS?wsdl</quickcost_url>
|
647 |
+
<logo_url>chronopost.png</logo_url>
|
648 |
+
<debug>0</debug>
|
649 |
+
<stop_to_first_match>0</stop_to_first_match>
|
650 |
+
<!--<specificerrmsg>This shipping method is currently unavailable.</specificerrmsg>-->
|
651 |
+
<rdv_config>
|
652 |
+
{
|
653 |
+
"dateRemiseColis_nbJour": "1",
|
654 |
+
"dateRemiseColis_jour": "0",
|
655 |
+
"dateRemiseColis_heures": "0",
|
656 |
+
"dateRemiseColis_minutes": "0",
|
657 |
+
"niveauTarifaire_show": 1,
|
658 |
+
"N1_status": "1",
|
659 |
+
"N2_status": "1",
|
660 |
+
"N3_status": "1",
|
661 |
+
"N4_status": "1",
|
662 |
+
"N1_price": "0",
|
663 |
+
"N2_price": "0",
|
664 |
+
"N3_price": "0",
|
665 |
+
"N4_price": "0"
|
666 |
+
}
|
667 |
+
</rdv_config>
|
668 |
+
<sort_order>10</sort_order>
|
669 |
+
</chronopostsrdv>
|
670 |
+
</carriers>
|
671 |
+
</default>
|
672 |
+
|
673 |
+
</config>
|
app/code/community/Chronopost/Chronorelais/etc/system.xml
CHANGED
@@ -1,1583 +1,2433 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<tabs>
|
4 |
-
<chronopost translate="label" module="chronorelais">
|
5 |
-
<label>Chronopost</label>
|
6 |
-
<sort_order>200</sort_order>
|
7 |
-
</chronopost>
|
8 |
-
</tabs>
|
9 |
-
<sections>
|
10 |
-
<carriers>
|
11 |
-
<groups>
|
12 |
-
<chronopost translate="label">
|
13 |
-
<label>Chronopost</label>
|
14 |
-
<frontend_type>text</frontend_type>
|
15 |
-
<sort_order>20</sort_order>
|
16 |
-
<show_in_default>1</show_in_default>
|
17 |
-
<show_in_website>1</show_in_website>
|
18 |
-
<show_in_store>1</show_in_store>
|
19 |
-
<fields>
|
20 |
-
<active translate="label">
|
21 |
-
<label>Enabled</label>
|
22 |
-
<frontend_type>select</frontend_type>
|
23 |
-
<frontend_model>chronorelais/adminhtml_system_config_form_field_enabled</frontend_model>
|
24 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
25 |
-
<sort_order>1</sort_order>
|
26 |
-
<show_in_default>1</show_in_default>
|
27 |
-
<show_in_website>1</show_in_website>
|
28 |
-
<show_in_store>1</show_in_store>
|
29 |
-
</active>
|
30 |
-
<title translate="label">
|
31 |
-
<label>Title</label>
|
32 |
-
<frontend_type>text</frontend_type>
|
33 |
-
<sort_order>2</sort_order>
|
34 |
-
<show_in_default>1</show_in_default>
|
35 |
-
<show_in_website>1</show_in_website>
|
36 |
-
<show_in_store>1</show_in_store>
|
37 |
-
</title>
|
38 |
-
<config translate="label">
|
39 |
-
<label>Configuration</label>
|
40 |
-
<frontend_model>chronorelais/adminhtml_system_config_form_field_config</frontend_model>
|
41 |
-
<comment>{configuration_syntax_help}</comment>
|
42 |
-
<frontend_type>textarea</frontend_type>
|
43 |
-
<sort_order>3</sort_order>
|
44 |
-
<show_in_default>1</show_in_default>
|
45 |
-
<show_in_website>1</show_in_website>
|
46 |
-
<show_in_store>1</show_in_store>
|
47 |
-
</config>
|
48 |
-
<weight_limit translate="label">
|
49 |
-
<label>Weight Limit</label>
|
50 |
-
<frontend_type>text</frontend_type>
|
51 |
-
<comment>in Kg</comment>
|
52 |
-
<sort_order>7</sort_order>
|
53 |
-
<show_in_default>1</show_in_default>
|
54 |
-
<show_in_website>1</show_in_website>
|
55 |
-
<show_in_store>1</show_in_store>
|
56 |
-
</weight_limit>
|
57 |
-
<quickcost translate="label">
|
58 |
-
<label>Quickcost</label>
|
59 |
-
<frontend_type>select</frontend_type>
|
60 |
-
<comment>No : cost is obtained from your rate grid ; Yes : cost is fetched from URL below</comment>
|
61 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
62 |
-
<sort_order>10</sort_order>
|
63 |
-
<show_in_default>1</show_in_default>
|
64 |
-
<show_in_website>1</show_in_website>
|
65 |
-
<show_in_store>0</show_in_store>
|
66 |
-
</quickcost>
|
67 |
-
<
|
68 |
-
<label>
|
69 |
-
<frontend_type>text</frontend_type>
|
70 |
-
<sort_order>11</sort_order>
|
71 |
-
<show_in_default>1</show_in_default>
|
72 |
-
<show_in_website>1</show_in_website>
|
73 |
-
<show_in_store>
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
<
|
78 |
-
<
|
79 |
-
<
|
80 |
-
<
|
81 |
-
<
|
82 |
-
<
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
<
|
87 |
-
<
|
88 |
-
<
|
89 |
-
<
|
90 |
-
<
|
91 |
-
|
92 |
-
|
93 |
-
|
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 |
-
<frontend_type>text</frontend_type>
|
121 |
-
<sort_order>
|
122 |
-
<show_in_default>1</show_in_default>
|
123 |
-
<show_in_website>1</show_in_website>
|
124 |
-
<show_in_store>1</show_in_store>
|
125 |
-
</
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
</
|
135 |
-
<
|
136 |
-
<label>
|
137 |
-
<comment>
|
138 |
-
<frontend_type>
|
139 |
-
<
|
140 |
-
<
|
141 |
-
<
|
142 |
-
<
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
<
|
157 |
-
<
|
158 |
-
<
|
159 |
-
<
|
160 |
-
<
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
<
|
165 |
-
<
|
166 |
-
<
|
167 |
-
<
|
168 |
-
<
|
169 |
-
<
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
<
|
184 |
-
<
|
185 |
-
<
|
186 |
-
<
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
<
|
202 |
-
<frontend_model>chronorelais/
|
203 |
-
<
|
204 |
-
<
|
205 |
-
<
|
206 |
-
<
|
207 |
-
<
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
<
|
212 |
-
<
|
213 |
-
<
|
214 |
-
<
|
215 |
-
<
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
<
|
221 |
-
<frontend_type>
|
222 |
-
<
|
223 |
-
<
|
224 |
-
<
|
225 |
-
<
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
<
|
231 |
-
<
|
232 |
-
<
|
233 |
-
<
|
234 |
-
<
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
<
|
239 |
-
<
|
240 |
-
<source_model>adminhtml/
|
241 |
-
<sort_order>
|
242 |
-
<show_in_default>1</show_in_default>
|
243 |
-
<show_in_website>1</show_in_website>
|
244 |
-
<show_in_store>
|
245 |
-
</
|
246 |
-
<
|
247 |
-
<label>
|
248 |
-
<frontend_type>text</frontend_type>
|
249 |
-
<sort_order>
|
250 |
-
<show_in_default>1</show_in_default>
|
251 |
-
<show_in_website>1</show_in_website>
|
252 |
-
<show_in_store>
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
<
|
257 |
-
<
|
258 |
-
<
|
259 |
-
<
|
260 |
-
<
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
<
|
266 |
-
<
|
267 |
-
<
|
268 |
-
<
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
<
|
274 |
-
<
|
275 |
-
<
|
276 |
-
<
|
277 |
-
<
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
<
|
283 |
-
<
|
284 |
-
<
|
285 |
-
<
|
286 |
-
<
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
</
|
297 |
-
|
298 |
-
|
299 |
-
<
|
300 |
-
<
|
301 |
-
<
|
302 |
-
<
|
303 |
-
<
|
304 |
-
|
305 |
-
|
306 |
-
<
|
307 |
-
|
308 |
-
|
309 |
-
<
|
310 |
-
<
|
311 |
-
<
|
312 |
-
<
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
<
|
318 |
-
<
|
319 |
-
<
|
320 |
-
<
|
321 |
-
<
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
<
|
337 |
-
<
|
338 |
-
<
|
339 |
-
<
|
340 |
-
<
|
341 |
-
<
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
<
|
347 |
-
<
|
348 |
-
<
|
349 |
-
<
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
<
|
355 |
-
<
|
356 |
-
<
|
357 |
-
<
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
<
|
374 |
-
<
|
375 |
-
<
|
376 |
-
<
|
377 |
-
<
|
378 |
-
<
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
<
|
384 |
-
<
|
385 |
-
<
|
386 |
-
<
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
<
|
392 |
-
<frontend_type>
|
393 |
-
<
|
394 |
-
<
|
395 |
-
<
|
396 |
-
<
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
<
|
401 |
-
<
|
402 |
-
<
|
403 |
-
<
|
404 |
-
<
|
405 |
-
<
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
<
|
410 |
-
<
|
411 |
-
<
|
412 |
-
<
|
413 |
-
<
|
414 |
-
<
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
<
|
419 |
-
<
|
420 |
-
<
|
421 |
-
<
|
422 |
-
<
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
<
|
428 |
-
<
|
429 |
-
<
|
430 |
-
<
|
431 |
-
|
432 |
-
|
433 |
-
<
|
434 |
-
|
435 |
-
|
436 |
-
<
|
437 |
-
<
|
438 |
-
<
|
439 |
-
<
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
<
|
445 |
-
<
|
446 |
-
<
|
447 |
-
<
|
448 |
-
<
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
<
|
462 |
-
<frontend_type>select</frontend_type>
|
463 |
-
<source_model>adminhtml/
|
464 |
-
<sort_order>
|
465 |
-
<show_in_default>1</show_in_default>
|
466 |
-
<show_in_website>1</show_in_website>
|
467 |
-
<show_in_store>1</show_in_store>
|
468 |
-
</
|
469 |
-
|
470 |
-
<label>
|
471 |
-
<frontend_type>
|
472 |
-
<sort_order>
|
473 |
-
<
|
474 |
-
<
|
475 |
-
<
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
<
|
481 |
-
<
|
482 |
-
<
|
483 |
-
<
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
<
|
489 |
-
<
|
490 |
-
<
|
491 |
-
<
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
<
|
509 |
-
<
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
<
|
522 |
-
<
|
523 |
-
<
|
524 |
-
|
525 |
-
|
526 |
-
<
|
527 |
-
<
|
528 |
-
|
529 |
-
|
530 |
-
<
|
531 |
-
<
|
532 |
-
<
|
533 |
-
<
|
534 |
-
|
535 |
-
|
536 |
-
<
|
537 |
-
<
|
538 |
-
|
539 |
-
|
540 |
-
<
|
541 |
-
<
|
542 |
-
<
|
543 |
-
|
544 |
-
|
545 |
-
<
|
546 |
-
|
547 |
-
|
548 |
-
<
|
549 |
-
<
|
550 |
-
<
|
551 |
-
<
|
552 |
-
<
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
<
|
569 |
-
<
|
570 |
-
|
571 |
-
|
572 |
-
<
|
573 |
-
<
|
574 |
-
<
|
575 |
-
<
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
<
|
581 |
-
<
|
582 |
-
<
|
583 |
-
<
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
<
|
589 |
-
<frontend_type>
|
590 |
-
<sort_order>
|
591 |
-
<show_in_default>1</show_in_default>
|
592 |
-
<show_in_website>1</show_in_website>
|
593 |
-
<show_in_store>1</show_in_store>
|
594 |
-
</
|
595 |
-
<
|
596 |
-
<label>
|
597 |
-
<frontend_type>text</frontend_type>
|
598 |
-
<comment>
|
599 |
-
<sort_order>
|
600 |
-
<show_in_default>1</show_in_default>
|
601 |
-
<show_in_website>1</show_in_website>
|
602 |
-
<show_in_store>1</show_in_store>
|
603 |
-
</
|
604 |
-
<
|
605 |
-
<label>
|
606 |
-
<
|
607 |
-
<
|
608 |
-
<
|
609 |
-
<
|
610 |
-
<
|
611 |
-
<
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
<
|
625 |
-
<frontend_type>select</frontend_type>
|
626 |
-
<source_model>
|
627 |
-
<sort_order>
|
628 |
-
<show_in_default>1</show_in_default>
|
629 |
-
<show_in_website>1</show_in_website>
|
630 |
-
<show_in_store>1</show_in_store>
|
631 |
-
</
|
632 |
-
|
633 |
-
<label>
|
634 |
-
<frontend_type>
|
635 |
-
<sort_order>
|
636 |
-
<
|
637 |
-
<
|
638 |
-
<
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
<
|
644 |
-
<
|
645 |
-
<
|
646 |
-
<
|
647 |
-
<
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
<
|
652 |
-
<
|
653 |
-
<
|
654 |
-
<
|
655 |
-
<
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
<
|
672 |
-
|
673 |
-
|
674 |
-
<
|
675 |
-
<
|
676 |
-
<
|
677 |
-
<
|
678 |
-
<
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
<
|
684 |
-
<
|
685 |
-
<
|
686 |
-
<
|
687 |
-
|
688 |
-
|
689 |
-
<
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
<
|
702 |
-
<
|
703 |
-
<
|
704 |
-
<
|
705 |
-
<
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
<
|
711 |
-
<
|
712 |
-
<sort_order>
|
713 |
-
<
|
714 |
-
<
|
715 |
-
<
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
<
|
721 |
-
<
|
722 |
-
<
|
723 |
-
<
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
<
|
729 |
-
<
|
730 |
-
<
|
731 |
-
<
|
732 |
-
<
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
<
|
749 |
-
|
750 |
-
|
751 |
-
<
|
752 |
-
<
|
753 |
-
<
|
754 |
-
<
|
755 |
-
<
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
<
|
760 |
-
<
|
761 |
-
<
|
762 |
-
<
|
763 |
-
<
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
<
|
769 |
-
<
|
770 |
-
<
|
771 |
-
<
|
772 |
-
<
|
773 |
-
<
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
<
|
787 |
-
<comment>
|
788 |
-
<
|
789 |
-
<
|
790 |
-
<
|
791 |
-
<
|
792 |
-
<
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
<
|
797 |
-
<
|
798 |
-
<
|
799 |
-
<
|
800 |
-
<
|
801 |
-
<
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
<
|
807 |
-
<
|
808 |
-
<
|
809 |
-
<
|
810 |
-
<
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
<
|
815 |
-
<
|
816 |
-
<
|
817 |
-
<
|
818 |
-
<
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
<
|
835 |
-
<
|
836 |
-
|
837 |
-
|
838 |
-
<
|
839 |
-
<
|
840 |
-
<
|
841 |
-
<
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
<
|
847 |
-
<
|
848 |
-
<
|
849 |
-
<
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
<
|
855 |
-
<frontend_type>
|
856 |
-
<
|
857 |
-
<
|
858 |
-
<
|
859 |
-
<
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
<
|
864 |
-
<comment>
|
865 |
-
<
|
866 |
-
<
|
867 |
-
<
|
868 |
-
<
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
</
|
880 |
-
<
|
881 |
-
<label>
|
882 |
-
<frontend_type>
|
883 |
-
<
|
884 |
-
<
|
885 |
-
<
|
886 |
-
<
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
<
|
891 |
-
<
|
892 |
-
<sort_order>
|
893 |
-
<
|
894 |
-
<
|
895 |
-
<
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
<
|
901 |
-
<
|
902 |
-
<
|
903 |
-
<
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
<
|
909 |
-
<
|
910 |
-
<
|
911 |
-
<
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
<
|
929 |
-
|
930 |
-
|
931 |
-
<
|
932 |
-
<
|
933 |
-
<
|
934 |
-
<
|
935 |
-
<
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
<
|
950 |
-
<
|
951 |
-
<
|
952 |
-
<
|
953 |
-
<
|
954 |
-
|
955 |
-
|
956 |
-
<
|
957 |
-
|
958 |
-
|
959 |
-
<
|
960 |
-
<
|
961 |
-
<
|
962 |
-
<
|
963 |
-
|
964 |
-
|
965 |
-
<
|
966 |
-
<
|
967 |
-
|
968 |
-
|
969 |
-
<
|
970 |
-
<
|
971 |
-
<
|
972 |
-
<
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
<
|
978 |
-
<
|
979 |
-
<
|
980 |
-
<
|
981 |
-
<
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
<
|
1010 |
-
<label>
|
1011 |
-
<frontend_type>text</frontend_type>
|
1012 |
-
<sort_order>
|
1013 |
-
<show_in_default>1</show_in_default>
|
1014 |
-
<show_in_website>1</show_in_website>
|
1015 |
-
<show_in_store>
|
1016 |
-
</
|
1017 |
-
<
|
1018 |
-
<label>
|
1019 |
-
<
|
1020 |
-
<
|
1021 |
-
<
|
1022 |
-
<
|
1023 |
-
<
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
<
|
1028 |
-
<
|
1029 |
-
<
|
1030 |
-
<
|
1031 |
-
<
|
1032 |
-
|
1033 |
-
|
1034 |
-
<
|
1035 |
-
|
1036 |
-
|
1037 |
-
<
|
1038 |
-
<
|
1039 |
-
<
|
1040 |
-
<
|
1041 |
-
|
1042 |
-
|
1043 |
-
<
|
1044 |
-
|
1045 |
-
|
1046 |
-
<
|
1047 |
-
<
|
1048 |
-
<
|
1049 |
-
<
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
<
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
<
|
1076 |
-
<
|
1077 |
-
<
|
1078 |
-
|
1079 |
-
|
1080 |
-
<
|
1081 |
-
<
|
1082 |
-
|
1083 |
-
|
1084 |
-
<
|
1085 |
-
<
|
1086 |
-
|
1087 |
-
|
1088 |
-
<
|
1089 |
-
<
|
1090 |
-
<
|
1091 |
-
|
1092 |
-
|
1093 |
-
<
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
<
|
1108 |
-
<
|
1109 |
-
|
1110 |
-
|
1111 |
-
<
|
1112 |
-
<
|
1113 |
-
<
|
1114 |
-
<
|
1115 |
-
|
1116 |
-
|
1117 |
-
<
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
<
|
1131 |
-
<
|
1132 |
-
<
|
1133 |
-
|
1134 |
-
|
1135 |
-
<
|
1136 |
-
<
|
1137 |
-
|
1138 |
-
|
1139 |
-
<
|
1140 |
-
<
|
1141 |
-
<
|
1142 |
-
|
1143 |
-
|
1144 |
-
<
|
1145 |
-
<
|
1146 |
-
|
1147 |
-
|
1148 |
-
<
|
1149 |
-
<
|
1150 |
-
<
|
1151 |
-
<
|
1152 |
-
|
1153 |
-
|
1154 |
-
<
|
1155 |
-
|
1156 |
-
|
1157 |
-
<
|
1158 |
-
<
|
1159 |
-
<
|
1160 |
-
<
|
1161 |
-
|
1162 |
-
|
1163 |
-
<
|
1164 |
-
|
1165 |
-
|
1166 |
-
<
|
1167 |
-
<
|
1168 |
-
<
|
1169 |
-
<
|
1170 |
-
|
1171 |
-
|
1172 |
-
<
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
<
|
1186 |
-
<
|
1187 |
-
|
1188 |
-
|
1189 |
-
<
|
1190 |
-
<
|
1191 |
-
<
|
1192 |
-
|
1193 |
-
|
1194 |
-
<
|
1195 |
-
|
1196 |
-
|
1197 |
-
<
|
1198 |
-
<
|
1199 |
-
<
|
1200 |
-
<
|
1201 |
-
<
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
<
|
1207 |
-
<
|
1208 |
-
<
|
1209 |
-
<
|
1210 |
-
<
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
<
|
1215 |
-
<
|
1216 |
-
<sort_order>
|
1217 |
-
<show_in_default>1</show_in_default>
|
1218 |
-
<show_in_website>1</show_in_website>
|
1219 |
-
<show_in_store>1</show_in_store>
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
<
|
1235 |
-
<
|
1236 |
-
<
|
1237 |
-
|
1238 |
-
|
1239 |
-
<
|
1240 |
-
<
|
1241 |
-
|
1242 |
-
|
1243 |
-
<
|
1244 |
-
<
|
1245 |
-
<
|
1246 |
-
|
1247 |
-
|
1248 |
-
<
|
1249 |
-
<
|
1250 |
-
|
1251 |
-
|
1252 |
-
<
|
1253 |
-
<
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
<
|
1270 |
-
<
|
1271 |
-
<sort_order>
|
1272 |
-
<show_in_default>1</show_in_default>
|
1273 |
-
<show_in_website>1</show_in_website>
|
1274 |
-
<show_in_store>1</show_in_store>
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
<
|
1279 |
-
<
|
1280 |
-
<
|
1281 |
-
<
|
1282 |
-
<
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
<
|
1287 |
-
<
|
1288 |
-
<
|
1289 |
-
<
|
1290 |
-
<
|
1291 |
-
<
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
<
|
1296 |
-
<
|
1297 |
-
<
|
1298 |
-
<
|
1299 |
-
<
|
1300 |
-
<
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
<
|
1305 |
-
<
|
1306 |
-
<
|
1307 |
-
<
|
1308 |
-
<
|
1309 |
-
|
1310 |
-
|
1311 |
-
<
|
1312 |
-
|
1313 |
-
|
1314 |
-
<
|
1315 |
-
<
|
1316 |
-
<
|
1317 |
-
<
|
1318 |
-
|
1319 |
-
|
1320 |
-
<
|
1321 |
-
|
1322 |
-
|
1323 |
-
<
|
1324 |
-
<
|
1325 |
-
<
|
1326 |
-
<
|
1327 |
-
|
1328 |
-
|
1329 |
-
<
|
1330 |
-
|
1331 |
-
|
1332 |
-
<
|
1333 |
-
<
|
1334 |
-
<
|
1335 |
-
<
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
<
|
1349 |
-
<label>
|
1350 |
-
<frontend_type>
|
1351 |
-
<
|
1352 |
-
<
|
1353 |
-
<
|
1354 |
-
<
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
<
|
1359 |
-
<
|
1360 |
-
<sort_order>
|
1361 |
-
<show_in_default>1</show_in_default>
|
1362 |
-
<show_in_website>1</show_in_website>
|
1363 |
-
<show_in_store>1</show_in_store>
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
<
|
1368 |
-
<
|
1369 |
-
<
|
1370 |
-
<
|
1371 |
-
<
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
<
|
1377 |
-
<
|
1378 |
-
<
|
1379 |
-
<
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
<
|
1385 |
-
<
|
1386 |
-
<
|
1387 |
-
<
|
1388 |
-
|
1389 |
-
|
1390 |
-
<
|
1391 |
-
|
1392 |
-
|
1393 |
-
<
|
1394 |
-
<
|
1395 |
-
<
|
1396 |
-
<
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
<
|
1402 |
-
<
|
1403 |
-
<
|
1404 |
-
<
|
1405 |
-
<
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
<
|
1410 |
-
<
|
1411 |
-
<sort_order>
|
1412 |
-
<
|
1413 |
-
<
|
1414 |
-
<
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
<
|
1419 |
-
<
|
1420 |
-
<
|
1421 |
-
<
|
1422 |
-
<
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
<
|
1437 |
-
<
|
1438 |
-
<
|
1439 |
-
<
|
1440 |
-
<
|
1441 |
-
<
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
<
|
1447 |
-
<
|
1448 |
-
<
|
1449 |
-
<
|
1450 |
-
<
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
<
|
1464 |
-
<label>
|
1465 |
-
<frontend_type>
|
1466 |
-
<
|
1467 |
-
<sort_order>
|
1468 |
-
<show_in_default>1</show_in_default>
|
1469 |
-
<show_in_website>1</show_in_website>
|
1470 |
-
<show_in_store>1</show_in_store>
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
<
|
1486 |
-
<
|
1487 |
-
<
|
1488 |
-
<
|
1489 |
-
<
|
1490 |
-
|
1491 |
-
|
1492 |
-
<
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
<
|
1507 |
-
|
1508 |
-
|
1509 |
-
<
|
1510 |
-
<
|
1511 |
-
<
|
1512 |
-
<
|
1513 |
-
<
|
1514 |
-
<
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
<
|
1530 |
-
<
|
1531 |
-
<
|
1532 |
-
|
1533 |
-
|
1534 |
-
<
|
1535 |
-
<
|
1536 |
-
<
|
1537 |
-
|
1538 |
-
|
1539 |
-
<
|
1540 |
-
|
1541 |
-
|
1542 |
-
<
|
1543 |
-
<
|
1544 |
-
<
|
1545 |
-
<
|
1546 |
-
<
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
<
|
1570 |
-
<
|
1571 |
-
<
|
1572 |
-
<
|
1573 |
-
<
|
1574 |
-
<
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<chronopost translate="label" module="chronorelais">
|
5 |
+
<label>Chronopost</label>
|
6 |
+
<sort_order>200</sort_order>
|
7 |
+
</chronopost>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<carriers>
|
11 |
+
<groups>
|
12 |
+
<chronopost translate="label">
|
13 |
+
<label>Chronopost</label>
|
14 |
+
<frontend_type>text</frontend_type>
|
15 |
+
<sort_order>20</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>1</show_in_store>
|
19 |
+
<fields>
|
20 |
+
<active translate="label">
|
21 |
+
<label>Enabled</label>
|
22 |
+
<frontend_type>select</frontend_type>
|
23 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_field_enabled</frontend_model>
|
24 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
25 |
+
<sort_order>1</sort_order>
|
26 |
+
<show_in_default>1</show_in_default>
|
27 |
+
<show_in_website>1</show_in_website>
|
28 |
+
<show_in_store>1</show_in_store>
|
29 |
+
</active>
|
30 |
+
<title translate="label">
|
31 |
+
<label>Title</label>
|
32 |
+
<frontend_type>text</frontend_type>
|
33 |
+
<sort_order>2</sort_order>
|
34 |
+
<show_in_default>1</show_in_default>
|
35 |
+
<show_in_website>1</show_in_website>
|
36 |
+
<show_in_store>1</show_in_store>
|
37 |
+
</title>
|
38 |
+
<config translate="label">
|
39 |
+
<label>Configuration</label>
|
40 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_field_config</frontend_model>
|
41 |
+
<comment>{configuration_syntax_help}</comment>
|
42 |
+
<frontend_type>textarea</frontend_type>
|
43 |
+
<sort_order>3</sort_order>
|
44 |
+
<show_in_default>1</show_in_default>
|
45 |
+
<show_in_website>1</show_in_website>
|
46 |
+
<show_in_store>1</show_in_store>
|
47 |
+
</config>
|
48 |
+
<weight_limit translate="label">
|
49 |
+
<label>Weight Limit</label>
|
50 |
+
<frontend_type>text</frontend_type>
|
51 |
+
<comment>in Kg</comment>
|
52 |
+
<sort_order>7</sort_order>
|
53 |
+
<show_in_default>1</show_in_default>
|
54 |
+
<show_in_website>1</show_in_website>
|
55 |
+
<show_in_store>1</show_in_store>
|
56 |
+
</weight_limit>
|
57 |
+
<quickcost translate="label">
|
58 |
+
<label>Quickcost</label>
|
59 |
+
<frontend_type>select</frontend_type>
|
60 |
+
<comment>No : cost is obtained from your rate grid ; Yes : cost is fetched from URL below</comment>
|
61 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
62 |
+
<sort_order>10</sort_order>
|
63 |
+
<show_in_default>1</show_in_default>
|
64 |
+
<show_in_website>1</show_in_website>
|
65 |
+
<show_in_store>0</show_in_store>
|
66 |
+
</quickcost>
|
67 |
+
<quickcost_marge translate="label">
|
68 |
+
<label>Value to add to quickcost</label>
|
69 |
+
<frontend_type>text</frontend_type>
|
70 |
+
<sort_order>11</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>1</show_in_website>
|
73 |
+
<show_in_store>1</show_in_store>
|
74 |
+
<validate>validate-number</validate>
|
75 |
+
</quickcost_marge>
|
76 |
+
<quickcost_marge_type translate="label">
|
77 |
+
<label>Type value to add</label>
|
78 |
+
<frontend_type>select</frontend_type>
|
79 |
+
<source_model>chronorelais/config_source_margetype</source_model>
|
80 |
+
<sort_order>12</sort_order>
|
81 |
+
<show_in_default>1</show_in_default>
|
82 |
+
<show_in_website>1</show_in_website>
|
83 |
+
<show_in_store>1</show_in_store>
|
84 |
+
</quickcost_marge_type>
|
85 |
+
<quickcost_url>
|
86 |
+
<label>Quickcost Url</label>
|
87 |
+
<frontend_type>text</frontend_type>
|
88 |
+
<sort_order>13</sort_order>
|
89 |
+
<show_in_default>1</show_in_default>
|
90 |
+
<show_in_website>1</show_in_website>
|
91 |
+
<show_in_store>0</show_in_store>
|
92 |
+
</quickcost_url>
|
93 |
+
<free_shipping_enable translate="label">
|
94 |
+
<label>Free Shipping on the Amount</label>
|
95 |
+
<frontend_type>select</frontend_type>
|
96 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
97 |
+
<sort_order>20</sort_order>
|
98 |
+
<show_in_default>1</show_in_default>
|
99 |
+
<show_in_website>1</show_in_website>
|
100 |
+
<show_in_store>1</show_in_store>
|
101 |
+
</free_shipping_enable>
|
102 |
+
<free_shipping_subtotal translate="label">
|
103 |
+
<label>Minimum Amount for Free Shipping</label>
|
104 |
+
<frontend_type>text</frontend_type>
|
105 |
+
<sort_order>30</sort_order>
|
106 |
+
<show_in_default>1</show_in_default>
|
107 |
+
<show_in_website>1</show_in_website>
|
108 |
+
<show_in_store>0</show_in_store>
|
109 |
+
</free_shipping_subtotal>
|
110 |
+
<application_fee translate="label">
|
111 |
+
<label>Application Fee</label>
|
112 |
+
<frontend_type>text</frontend_type>
|
113 |
+
<sort_order>40</sort_order>
|
114 |
+
<show_in_default>1</show_in_default>
|
115 |
+
<show_in_website>1</show_in_website>
|
116 |
+
<show_in_store>1</show_in_store>
|
117 |
+
</application_fee>
|
118 |
+
<handling_fee translate="label">
|
119 |
+
<label>Handling Fee</label>
|
120 |
+
<frontend_type>text</frontend_type>
|
121 |
+
<sort_order>50</sort_order>
|
122 |
+
<show_in_default>1</show_in_default>
|
123 |
+
<show_in_website>1</show_in_website>
|
124 |
+
<show_in_store>1</show_in_store>
|
125 |
+
</handling_fee>
|
126 |
+
<logo_url>
|
127 |
+
<label>Logo Url</label>
|
128 |
+
<frontend_type>text</frontend_type>
|
129 |
+
<comment>{logo_ulr_help}</comment>
|
130 |
+
<sort_order>60</sort_order>
|
131 |
+
<show_in_default>1</show_in_default>
|
132 |
+
<show_in_website>1</show_in_website>
|
133 |
+
<show_in_store>1</show_in_store>
|
134 |
+
</logo_url>
|
135 |
+
<debug>
|
136 |
+
<label>Debug</label>
|
137 |
+
<comment>{debug_help}</comment>
|
138 |
+
<frontend_type>text</frontend_type>
|
139 |
+
<sort_order>70</sort_order>
|
140 |
+
<show_in_default>1</show_in_default>
|
141 |
+
<show_in_website>1</show_in_website>
|
142 |
+
<show_in_store>1</show_in_store>
|
143 |
+
</debug>
|
144 |
+
<!--<stop_to_first_match translate="label">
|
145 |
+
<label>Stop to first match</label>
|
146 |
+
<frontend_type>select</frontend_type>
|
147 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
148 |
+
<sort_order>80</sort_order>
|
149 |
+
<show_in_default>1</show_in_default>
|
150 |
+
<show_in_website>1</show_in_website>
|
151 |
+
<show_in_store>1</show_in_store>
|
152 |
+
</stop_to_first_match>-->
|
153 |
+
<deliver_on_saturday translate="label comment">
|
154 |
+
<label>Livraison le Samedi</label>
|
155 |
+
<frontend_type>select</frontend_type>
|
156 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
157 |
+
<sort_order>90</sort_order>
|
158 |
+
<show_in_default>1</show_in_default>
|
159 |
+
<show_in_website>1</show_in_website>
|
160 |
+
<show_in_store>1</show_in_store>
|
161 |
+
</deliver_on_saturday>
|
162 |
+
<!--<showmethod translate="label">
|
163 |
+
<label>Show Method if Not Applicable</label>
|
164 |
+
<frontend_type>select</frontend_type>
|
165 |
+
<sort_order>100</sort_order>
|
166 |
+
<frontend_class>shipping-skip-hide</frontend_class>
|
167 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
168 |
+
<show_in_default>1</show_in_default>
|
169 |
+
<show_in_website>1</show_in_website>
|
170 |
+
<show_in_store>0</show_in_store>
|
171 |
+
</showmethod>
|
172 |
+
<specificerrmsg translate="label">
|
173 |
+
<label>Displayed Error Message</label>
|
174 |
+
<frontend_type>textarea</frontend_type>
|
175 |
+
<sort_order>110</sort_order>
|
176 |
+
<show_in_default>1</show_in_default>
|
177 |
+
<show_in_website>1</show_in_website>
|
178 |
+
<show_in_store>1</show_in_store>
|
179 |
+
</specificerrmsg>-->
|
180 |
+
<sort_order translate="label">
|
181 |
+
<label>Sort order</label>
|
182 |
+
<frontend_type>text</frontend_type>
|
183 |
+
<sort_order>120</sort_order>
|
184 |
+
<show_in_default>1</show_in_default>
|
185 |
+
<show_in_website>1</show_in_website>
|
186 |
+
<show_in_store>1</show_in_store>
|
187 |
+
</sort_order>
|
188 |
+
</fields>
|
189 |
+
</chronopost>
|
190 |
+
|
191 |
+
<chronoexpress translate="label">
|
192 |
+
<label>Chrono Express</label>
|
193 |
+
<frontend_type>text</frontend_type>
|
194 |
+
<sort_order>21</sort_order>
|
195 |
+
<show_in_default>1</show_in_default>
|
196 |
+
<show_in_website>1</show_in_website>
|
197 |
+
<show_in_store>1</show_in_store>
|
198 |
+
<fields>
|
199 |
+
<active translate="label">
|
200 |
+
<label>Enabled</label>
|
201 |
+
<frontend_type>select</frontend_type>
|
202 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_field_enabled</frontend_model>
|
203 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
204 |
+
<sort_order>1</sort_order>
|
205 |
+
<show_in_default>1</show_in_default>
|
206 |
+
<show_in_website>1</show_in_website>
|
207 |
+
<show_in_store>1</show_in_store>
|
208 |
+
</active>
|
209 |
+
<title translate="label">
|
210 |
+
<label>Title</label>
|
211 |
+
<frontend_type>text</frontend_type>
|
212 |
+
<sort_order>2</sort_order>
|
213 |
+
<show_in_default>1</show_in_default>
|
214 |
+
<show_in_website>1</show_in_website>
|
215 |
+
<show_in_store>1</show_in_store>
|
216 |
+
</title>
|
217 |
+
<config translate="label">
|
218 |
+
<label>Configuration</label>
|
219 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_field_config</frontend_model>
|
220 |
+
<comment>{configuration_syntax_help}</comment>
|
221 |
+
<frontend_type>textarea</frontend_type>
|
222 |
+
<sort_order>3</sort_order>
|
223 |
+
<show_in_default>1</show_in_default>
|
224 |
+
<show_in_website>1</show_in_website>
|
225 |
+
<show_in_store>1</show_in_store>
|
226 |
+
</config>
|
227 |
+
<weight_limit translate="label">
|
228 |
+
<label>Weight Limit</label>
|
229 |
+
<frontend_type>text</frontend_type>
|
230 |
+
<comment>in Kg</comment>
|
231 |
+
<sort_order>7</sort_order>
|
232 |
+
<show_in_default>1</show_in_default>
|
233 |
+
<show_in_website>1</show_in_website>
|
234 |
+
<show_in_store>1</show_in_store>
|
235 |
+
</weight_limit>
|
236 |
+
<quickcost translate="label">
|
237 |
+
<label>Quickcost</label>
|
238 |
+
<frontend_type>select</frontend_type>
|
239 |
+
<comment>No : cost is obtained from your rate grid ; Yes : cost is fetched from URL below</comment>
|
240 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
241 |
+
<sort_order>10</sort_order>
|
242 |
+
<show_in_default>1</show_in_default>
|
243 |
+
<show_in_website>1</show_in_website>
|
244 |
+
<show_in_store>0</show_in_store>
|
245 |
+
</quickcost>
|
246 |
+
<quickcost_marge translate="label">
|
247 |
+
<label>Value to add to quickcost</label>
|
248 |
+
<frontend_type>text</frontend_type>
|
249 |
+
<sort_order>11</sort_order>
|
250 |
+
<show_in_default>1</show_in_default>
|
251 |
+
<show_in_website>1</show_in_website>
|
252 |
+
<show_in_store>1</show_in_store>
|
253 |
+
<validate>validate-number</validate>
|
254 |
+
</quickcost_marge>
|
255 |
+
<quickcost_marge_type translate="label">
|
256 |
+
<label>Type value to add</label>
|
257 |
+
<frontend_type>select</frontend_type>
|
258 |
+
<source_model>chronorelais/config_source_margetype</source_model>
|
259 |
+
<sort_order>12</sort_order>
|
260 |
+
<show_in_default>1</show_in_default>
|
261 |
+
<show_in_website>1</show_in_website>
|
262 |
+
<show_in_store>1</show_in_store>
|
263 |
+
</quickcost_marge_type>
|
264 |
+
<quickcost_url>
|
265 |
+
<label>Quickcost Url</label>
|
266 |
+
<frontend_type>text</frontend_type>
|
267 |
+
<sort_order>13</sort_order>
|
268 |
+
<show_in_default>1</show_in_default>
|
269 |
+
<show_in_website>1</show_in_website>
|
270 |
+
<show_in_store>0</show_in_store>
|
271 |
+
</quickcost_url>
|
272 |
+
<free_shipping_enable translate="label">
|
273 |
+
<label>Free Shipping on the Amount</label>
|
274 |
+
<frontend_type>select</frontend_type>
|
275 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
276 |
+
<sort_order>20</sort_order>
|
277 |
+
<show_in_default>1</show_in_default>
|
278 |
+
<show_in_website>1</show_in_website>
|
279 |
+
<show_in_store>1</show_in_store>
|
280 |
+
</free_shipping_enable>
|
281 |
+
<free_shipping_subtotal translate="label">
|
282 |
+
<label>Minimum Amount for Free Shipping</label>
|
283 |
+
<frontend_type>text</frontend_type>
|
284 |
+
<sort_order>30</sort_order>
|
285 |
+
<show_in_default>1</show_in_default>
|
286 |
+
<show_in_website>1</show_in_website>
|
287 |
+
<show_in_store>0</show_in_store>
|
288 |
+
</free_shipping_subtotal>
|
289 |
+
<application_fee translate="label">
|
290 |
+
<label>Application Fee</label>
|
291 |
+
<frontend_type>text</frontend_type>
|
292 |
+
<sort_order>40</sort_order>
|
293 |
+
<show_in_default>1</show_in_default>
|
294 |
+
<show_in_website>1</show_in_website>
|
295 |
+
<show_in_store>1</show_in_store>
|
296 |
+
</application_fee>
|
297 |
+
<handling_fee translate="label">
|
298 |
+
<label>Handling Fee</label>
|
299 |
+
<frontend_type>text</frontend_type>
|
300 |
+
<sort_order>50</sort_order>
|
301 |
+
<show_in_default>1</show_in_default>
|
302 |
+
<show_in_website>1</show_in_website>
|
303 |
+
<show_in_store>1</show_in_store>
|
304 |
+
</handling_fee>
|
305 |
+
<logo_url>
|
306 |
+
<label>Logo Url</label>
|
307 |
+
<frontend_type>text</frontend_type>
|
308 |
+
<comment>{logo_ulr_help}</comment>
|
309 |
+
<sort_order>60</sort_order>
|
310 |
+
<show_in_default>1</show_in_default>
|
311 |
+
<show_in_website>1</show_in_website>
|
312 |
+
<show_in_store>1</show_in_store>
|
313 |
+
</logo_url>
|
314 |
+
<debug>
|
315 |
+
<label>Debug</label>
|
316 |
+
<comment>{debug_help}</comment>
|
317 |
+
<frontend_type>text</frontend_type>
|
318 |
+
<sort_order>70</sort_order>
|
319 |
+
<show_in_default>1</show_in_default>
|
320 |
+
<show_in_website>1</show_in_website>
|
321 |
+
<show_in_store>1</show_in_store>
|
322 |
+
</debug>
|
323 |
+
<!--<stop_to_first_match translate="label">
|
324 |
+
<label>Stop to first match</label>
|
325 |
+
<frontend_type>select</frontend_type>
|
326 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
327 |
+
<sort_order>80</sort_order>
|
328 |
+
<show_in_default>1</show_in_default>
|
329 |
+
<show_in_website>1</show_in_website>
|
330 |
+
<show_in_store>1</show_in_store>
|
331 |
+
</stop_to_first_match>-->
|
332 |
+
<!-- deliver_on_saturday not included in chronoexpress only -->
|
333 |
+
<!--<showmethod translate="label">
|
334 |
+
<label>Show Method if Not Applicable</label>
|
335 |
+
<frontend_type>select</frontend_type>
|
336 |
+
<sort_order>90</sort_order>
|
337 |
+
<frontend_class>shipping-skip-hide</frontend_class>
|
338 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
339 |
+
<show_in_default>1</show_in_default>
|
340 |
+
<show_in_website>1</show_in_website>
|
341 |
+
<show_in_store>0</show_in_store>
|
342 |
+
</showmethod>
|
343 |
+
<specificerrmsg translate="label">
|
344 |
+
<label>Displayed Error Message</label>
|
345 |
+
<frontend_type>textarea</frontend_type>
|
346 |
+
<sort_order>100</sort_order>
|
347 |
+
<show_in_default>1</show_in_default>
|
348 |
+
<show_in_website>1</show_in_website>
|
349 |
+
<show_in_store>1</show_in_store>
|
350 |
+
</specificerrmsg>-->
|
351 |
+
<sort_order translate="label">
|
352 |
+
<label>Sort order</label>
|
353 |
+
<frontend_type>text</frontend_type>
|
354 |
+
<sort_order>120</sort_order>
|
355 |
+
<show_in_default>1</show_in_default>
|
356 |
+
<show_in_website>1</show_in_website>
|
357 |
+
<show_in_store>1</show_in_store>
|
358 |
+
</sort_order>
|
359 |
+
</fields>
|
360 |
+
</chronoexpress>
|
361 |
+
|
362 |
+
<chronorelais translate="label">
|
363 |
+
<label>Chrono Relais</label>
|
364 |
+
<frontend_type>text</frontend_type>
|
365 |
+
<sort_order>22</sort_order>
|
366 |
+
<show_in_default>1</show_in_default>
|
367 |
+
<show_in_website>1</show_in_website>
|
368 |
+
<show_in_store>1</show_in_store>
|
369 |
+
<fields>
|
370 |
+
<active translate="label">
|
371 |
+
<label>Enabled</label>
|
372 |
+
<frontend_type>select</frontend_type>
|
373 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_field_enabled</frontend_model>
|
374 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
375 |
+
<sort_order>1</sort_order>
|
376 |
+
<show_in_default>1</show_in_default>
|
377 |
+
<show_in_website>1</show_in_website>
|
378 |
+
<show_in_store>1</show_in_store>
|
379 |
+
</active>
|
380 |
+
<title translate="label">
|
381 |
+
<label>Title</label>
|
382 |
+
<frontend_type>text</frontend_type>
|
383 |
+
<sort_order>2</sort_order>
|
384 |
+
<show_in_default>1</show_in_default>
|
385 |
+
<show_in_website>1</show_in_website>
|
386 |
+
<show_in_store>1</show_in_store>
|
387 |
+
</title>
|
388 |
+
<config translate="label">
|
389 |
+
<label>Configuration</label>
|
390 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_field_config</frontend_model>
|
391 |
+
<comment>{configuration_syntax_help}</comment>
|
392 |
+
<frontend_type>textarea</frontend_type>
|
393 |
+
<sort_order>3</sort_order>
|
394 |
+
<show_in_default>1</show_in_default>
|
395 |
+
<show_in_website>1</show_in_website>
|
396 |
+
<show_in_store>1</show_in_store>
|
397 |
+
</config>
|
398 |
+
<weight_limit translate="label">
|
399 |
+
<label>Weight Limit</label>
|
400 |
+
<frontend_type>text</frontend_type>
|
401 |
+
<comment>in Kg</comment>
|
402 |
+
<sort_order>7</sort_order>
|
403 |
+
<show_in_default>1</show_in_default>
|
404 |
+
<show_in_website>1</show_in_website>
|
405 |
+
<show_in_store>1</show_in_store>
|
406 |
+
</weight_limit>
|
407 |
+
<quickcost translate="label">
|
408 |
+
<label>Quickcost</label>
|
409 |
+
<frontend_type>select</frontend_type>
|
410 |
+
<comment>No : cost is obtained from your rate grid ; Yes : cost is fetched from URL below</comment>
|
411 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
412 |
+
<sort_order>10</sort_order>
|
413 |
+
<show_in_default>1</show_in_default>
|
414 |
+
<show_in_website>1</show_in_website>
|
415 |
+
<show_in_store>0</show_in_store>
|
416 |
+
</quickcost>
|
417 |
+
<quickcost_marge translate="label">
|
418 |
+
<label>Value to add to quickcost</label>
|
419 |
+
<frontend_type>text</frontend_type>
|
420 |
+
<sort_order>11</sort_order>
|
421 |
+
<show_in_default>1</show_in_default>
|
422 |
+
<show_in_website>1</show_in_website>
|
423 |
+
<show_in_store>1</show_in_store>
|
424 |
+
<validate>validate-number</validate>
|
425 |
+
</quickcost_marge>
|
426 |
+
<quickcost_marge_type translate="label">
|
427 |
+
<label>Type value to add</label>
|
428 |
+
<frontend_type>select</frontend_type>
|
429 |
+
<source_model>chronorelais/config_source_margetype</source_model>
|
430 |
+
<sort_order>12</sort_order>
|
431 |
+
<show_in_default>1</show_in_default>
|
432 |
+
<show_in_website>1</show_in_website>
|
433 |
+
<show_in_store>1</show_in_store>
|
434 |
+
</quickcost_marge_type>
|
435 |
+
<quickcost_url>
|
436 |
+
<label>Quickcost Url</label>
|
437 |
+
<frontend_type>text</frontend_type>
|
438 |
+
<sort_order>13</sort_order>
|
439 |
+
<show_in_default>1</show_in_default>
|
440 |
+
<show_in_website>1</show_in_website>
|
441 |
+
<show_in_store>0</show_in_store>
|
442 |
+
</quickcost_url>
|
443 |
+
<show_google_map translate="label">
|
444 |
+
<label>Show Google Map</label>
|
445 |
+
<frontend_type>select</frontend_type>
|
446 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
447 |
+
<sort_order>20</sort_order>
|
448 |
+
<show_in_default>1</show_in_default>
|
449 |
+
<show_in_website>1</show_in_website>
|
450 |
+
<show_in_store>1</show_in_store>
|
451 |
+
</show_google_map>
|
452 |
+
<max_distance_search translate="label">
|
453 |
+
<label>Max distance search</label>
|
454 |
+
<frontend_type>text</frontend_type>
|
455 |
+
<sort_order>30</sort_order>
|
456 |
+
<show_in_default>1</show_in_default>
|
457 |
+
<show_in_website>1</show_in_website>
|
458 |
+
<show_in_store>0</show_in_store>
|
459 |
+
</max_distance_search>
|
460 |
+
<free_shipping_enable translate="label">
|
461 |
+
<label>Free Shipping with Minimum Order Amount</label>
|
462 |
+
<frontend_type>select</frontend_type>
|
463 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
464 |
+
<sort_order>40</sort_order>
|
465 |
+
<show_in_default>1</show_in_default>
|
466 |
+
<show_in_website>1</show_in_website>
|
467 |
+
<show_in_store>1</show_in_store>
|
468 |
+
</free_shipping_enable>
|
469 |
+
<free_shipping_subtotal translate="label">
|
470 |
+
<label>Minimum Order Amount for Free Shipping</label>
|
471 |
+
<frontend_type>text</frontend_type>
|
472 |
+
<sort_order>50</sort_order>
|
473 |
+
<show_in_default>1</show_in_default>
|
474 |
+
<show_in_website>1</show_in_website>
|
475 |
+
<show_in_store>1</show_in_store>
|
476 |
+
</free_shipping_subtotal>
|
477 |
+
<application_fee translate="label">
|
478 |
+
<label>Application Fee</label>
|
479 |
+
<frontend_type>text</frontend_type>
|
480 |
+
<sort_order>60</sort_order>
|
481 |
+
<show_in_default>1</show_in_default>
|
482 |
+
<show_in_website>1</show_in_website>
|
483 |
+
<show_in_store>1</show_in_store>
|
484 |
+
</application_fee>
|
485 |
+
<handling_fee translate="label">
|
486 |
+
<label>Handling Fee</label>
|
487 |
+
<frontend_type>text</frontend_type>
|
488 |
+
<sort_order>70</sort_order>
|
489 |
+
<show_in_default>1</show_in_default>
|
490 |
+
<show_in_website>1</show_in_website>
|
491 |
+
<show_in_store>1</show_in_store>
|
492 |
+
</handling_fee>
|
493 |
+
<logo_url>
|
494 |
+
<label>Logo Url</label>
|
495 |
+
<frontend_type>text</frontend_type>
|
496 |
+
<comment>{logo_ulr_help}</comment>
|
497 |
+
<sort_order>80</sort_order>
|
498 |
+
<show_in_default>1</show_in_default>
|
499 |
+
<show_in_website>1</show_in_website>
|
500 |
+
<show_in_store>1</show_in_store>
|
501 |
+
</logo_url>
|
502 |
+
<debug>
|
503 |
+
<label>Debug</label>
|
504 |
+
<comment>{debug_help}</comment>
|
505 |
+
<frontend_type>text</frontend_type>
|
506 |
+
<sort_order>90</sort_order>
|
507 |
+
<show_in_default>1</show_in_default>
|
508 |
+
<show_in_website>1</show_in_website>
|
509 |
+
<show_in_store>1</show_in_store>
|
510 |
+
</debug>
|
511 |
+
<!--<stop_to_first_match translate="label">
|
512 |
+
<label>Stop to first match</label>
|
513 |
+
<frontend_type>select</frontend_type>
|
514 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
515 |
+
<sort_order>100</sort_order>
|
516 |
+
<show_in_default>1</show_in_default>
|
517 |
+
<show_in_website>1</show_in_website>
|
518 |
+
<show_in_store>1</show_in_store>
|
519 |
+
</stop_to_first_match>-->
|
520 |
+
<deliver_on_saturday translate="label comment">
|
521 |
+
<label>Livraison le Samedi</label>
|
522 |
+
<frontend_type>select</frontend_type>
|
523 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
524 |
+
<sort_order>110</sort_order>
|
525 |
+
<show_in_default>1</show_in_default>
|
526 |
+
<show_in_website>1</show_in_website>
|
527 |
+
<show_in_store>1</show_in_store>
|
528 |
+
</deliver_on_saturday>
|
529 |
+
<!--<showmethod translate="label">
|
530 |
+
<label>Show Method if Not Applicable</label>
|
531 |
+
<frontend_type>select</frontend_type>
|
532 |
+
<sort_order>120</sort_order>
|
533 |
+
<frontend_class>shipping-skip-hide</frontend_class>
|
534 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
535 |
+
<show_in_default>1</show_in_default>
|
536 |
+
<show_in_website>1</show_in_website>
|
537 |
+
<show_in_store>0</show_in_store>
|
538 |
+
</showmethod>
|
539 |
+
<specificerrmsg translate="label">
|
540 |
+
<label>Displayed Error Message</label>
|
541 |
+
<frontend_type>textarea</frontend_type>
|
542 |
+
<sort_order>130</sort_order>
|
543 |
+
<show_in_default>1</show_in_default>
|
544 |
+
<show_in_website>1</show_in_website>
|
545 |
+
<show_in_store>1</show_in_store>
|
546 |
+
</specificerrmsg>-->
|
547 |
+
<sort_order translate="label">
|
548 |
+
<label>Sort order</label>
|
549 |
+
<frontend_type>text</frontend_type>
|
550 |
+
<sort_order>140</sort_order>
|
551 |
+
<show_in_default>1</show_in_default>
|
552 |
+
<show_in_website>1</show_in_website>
|
553 |
+
<show_in_store>1</show_in_store>
|
554 |
+
</sort_order>
|
555 |
+
</fields>
|
556 |
+
</chronorelais>
|
557 |
+
|
558 |
+
<!-- C10 Livraison avant 10H -->
|
559 |
+
<chronopostc10 translate="label">
|
560 |
+
<label>Chronopost C10</label>
|
561 |
+
<frontend_type>text</frontend_type>
|
562 |
+
<sort_order>23</sort_order>
|
563 |
+
<show_in_default>1</show_in_default>
|
564 |
+
<show_in_website>1</show_in_website>
|
565 |
+
<show_in_store>1</show_in_store>
|
566 |
+
<fields>
|
567 |
+
<active translate="label">
|
568 |
+
<label>Enabled</label>
|
569 |
+
<frontend_type>select</frontend_type>
|
570 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_field_enabled</frontend_model>
|
571 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
572 |
+
<sort_order>1</sort_order>
|
573 |
+
<show_in_default>1</show_in_default>
|
574 |
+
<show_in_website>1</show_in_website>
|
575 |
+
<show_in_store>1</show_in_store>
|
576 |
+
</active>
|
577 |
+
<title translate="label">
|
578 |
+
<label>Title</label>
|
579 |
+
<frontend_type>text</frontend_type>
|
580 |
+
<sort_order>2</sort_order>
|
581 |
+
<show_in_default>1</show_in_default>
|
582 |
+
<show_in_website>1</show_in_website>
|
583 |
+
<show_in_store>1</show_in_store>
|
584 |
+
</title>
|
585 |
+
<config translate="label">
|
586 |
+
<label>Configuration</label>
|
587 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_field_config</frontend_model>
|
588 |
+
<comment>{configuration_syntax_help}</comment>
|
589 |
+
<frontend_type>textarea</frontend_type>
|
590 |
+
<sort_order>3</sort_order>
|
591 |
+
<show_in_default>1</show_in_default>
|
592 |
+
<show_in_website>1</show_in_website>
|
593 |
+
<show_in_store>1</show_in_store>
|
594 |
+
</config>
|
595 |
+
<weight_limit translate="label">
|
596 |
+
<label>Weight Limit</label>
|
597 |
+
<frontend_type>text</frontend_type>
|
598 |
+
<comment>in Kg</comment>
|
599 |
+
<sort_order>7</sort_order>
|
600 |
+
<show_in_default>1</show_in_default>
|
601 |
+
<show_in_website>1</show_in_website>
|
602 |
+
<show_in_store>1</show_in_store>
|
603 |
+
</weight_limit>
|
604 |
+
<quickcost translate="label">
|
605 |
+
<label>Quickcost</label>
|
606 |
+
<frontend_type>select</frontend_type>
|
607 |
+
<comment>No : cost is obtained from your rate grid ; Yes : cost is fetched from URL below</comment>
|
608 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
609 |
+
<sort_order>10</sort_order>
|
610 |
+
<show_in_default>1</show_in_default>
|
611 |
+
<show_in_website>1</show_in_website>
|
612 |
+
<show_in_store>0</show_in_store>
|
613 |
+
</quickcost>
|
614 |
+
<quickcost_marge translate="label">
|
615 |
+
<label>Value to add to quickcost</label>
|
616 |
+
<frontend_type>text</frontend_type>
|
617 |
+
<sort_order>11</sort_order>
|
618 |
+
<show_in_default>1</show_in_default>
|
619 |
+
<show_in_website>1</show_in_website>
|
620 |
+
<show_in_store>1</show_in_store>
|
621 |
+
<validate>validate-number</validate>
|
622 |
+
</quickcost_marge>
|
623 |
+
<quickcost_marge_type translate="label">
|
624 |
+
<label>Type value to add</label>
|
625 |
+
<frontend_type>select</frontend_type>
|
626 |
+
<source_model>chronorelais/config_source_margetype</source_model>
|
627 |
+
<sort_order>12</sort_order>
|
628 |
+
<show_in_default>1</show_in_default>
|
629 |
+
<show_in_website>1</show_in_website>
|
630 |
+
<show_in_store>1</show_in_store>
|
631 |
+
</quickcost_marge_type>
|
632 |
+
<quickcost_url>
|
633 |
+
<label>Quickcost Url</label>
|
634 |
+
<frontend_type>text</frontend_type>
|
635 |
+
<sort_order>13</sort_order>
|
636 |
+
<show_in_default>1</show_in_default>
|
637 |
+
<show_in_website>1</show_in_website>
|
638 |
+
<show_in_store>0</show_in_store>
|
639 |
+
</quickcost_url>
|
640 |
+
<free_shipping_enable translate="label">
|
641 |
+
<label>Free Shipping on the Amount</label>
|
642 |
+
<frontend_type>select</frontend_type>
|
643 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
644 |
+
<sort_order>20</sort_order>
|
645 |
+
<show_in_default>1</show_in_default>
|
646 |
+
<show_in_website>1</show_in_website>
|
647 |
+
<show_in_store>1</show_in_store>
|
648 |
+
</free_shipping_enable>
|
649 |
+
<free_shipping_subtotal translate="label">
|
650 |
+
<label>Minimum Amount for Free Shipping</label>
|
651 |
+
<frontend_type>text</frontend_type>
|
652 |
+
<sort_order>30</sort_order>
|
653 |
+
<show_in_default>1</show_in_default>
|
654 |
+
<show_in_website>1</show_in_website>
|
655 |
+
<show_in_store>0</show_in_store>
|
656 |
+
</free_shipping_subtotal>
|
657 |
+
<application_fee translate="label">
|
658 |
+
<label>Application Fee</label>
|
659 |
+
<frontend_type>text</frontend_type>
|
660 |
+
<sort_order>40</sort_order>
|
661 |
+
<show_in_default>1</show_in_default>
|
662 |
+
<show_in_website>1</show_in_website>
|
663 |
+
<show_in_store>1</show_in_store>
|
664 |
+
</application_fee>
|
665 |
+
<handling_fee translate="label">
|
666 |
+
<label>Handling Fee</label>
|
667 |
+
<frontend_type>text</frontend_type>
|
668 |
+
<sort_order>50</sort_order>
|
669 |
+
<show_in_default>1</show_in_default>
|
670 |
+
<show_in_website>1</show_in_website>
|
671 |
+
<show_in_store>1</show_in_store>
|
672 |
+
</handling_fee>
|
673 |
+
<logo_url>
|
674 |
+
<label>Logo Url</label>
|
675 |
+
<frontend_type>text</frontend_type>
|
676 |
+
<comment>{logo_ulr_help}</comment>
|
677 |
+
<sort_order>60</sort_order>
|
678 |
+
<show_in_default>1</show_in_default>
|
679 |
+
<show_in_website>1</show_in_website>
|
680 |
+
<show_in_store>1</show_in_store>
|
681 |
+
</logo_url>
|
682 |
+
<debug>
|
683 |
+
<label>Debug</label>
|
684 |
+
<comment>{debug_help}</comment>
|
685 |
+
<frontend_type>text</frontend_type>
|
686 |
+
<sort_order>70</sort_order>
|
687 |
+
<show_in_default>1</show_in_default>
|
688 |
+
<show_in_website>1</show_in_website>
|
689 |
+
<show_in_store>1</show_in_store>
|
690 |
+
</debug>
|
691 |
+
<!--<stop_to_first_match translate="label">
|
692 |
+
<label>Stop to first match</label>
|
693 |
+
<frontend_type>select</frontend_type>
|
694 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
695 |
+
<sort_order>80</sort_order>
|
696 |
+
<show_in_default>1</show_in_default>
|
697 |
+
<show_in_website>1</show_in_website>
|
698 |
+
<show_in_store>1</show_in_store>
|
699 |
+
</stop_to_first_match>-->
|
700 |
+
<deliver_on_saturday translate="label comment">
|
701 |
+
<label>Livraison le Samedi</label>
|
702 |
+
<frontend_type>select</frontend_type>
|
703 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
704 |
+
<sort_order>90</sort_order>
|
705 |
+
<show_in_default>1</show_in_default>
|
706 |
+
<show_in_website>1</show_in_website>
|
707 |
+
<show_in_store>1</show_in_store>
|
708 |
+
</deliver_on_saturday>
|
709 |
+
<!--<showmethod translate="label">
|
710 |
+
<label>Show Method if Not Applicable</label>
|
711 |
+
<frontend_type>select</frontend_type>
|
712 |
+
<sort_order>100</sort_order>
|
713 |
+
<frontend_class>shipping-skip-hide</frontend_class>
|
714 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
715 |
+
<show_in_default>1</show_in_default>
|
716 |
+
<show_in_website>1</show_in_website>
|
717 |
+
<show_in_store>0</show_in_store>
|
718 |
+
</showmethod>
|
719 |
+
<specificerrmsg translate="label">
|
720 |
+
<label>Displayed Error Message</label>
|
721 |
+
<frontend_type>textarea</frontend_type>
|
722 |
+
<sort_order>110</sort_order>
|
723 |
+
<show_in_default>1</show_in_default>
|
724 |
+
<show_in_website>1</show_in_website>
|
725 |
+
<show_in_store>1</show_in_store>
|
726 |
+
</specificerrmsg>-->
|
727 |
+
<sort_order translate="label">
|
728 |
+
<label>Sort order</label>
|
729 |
+
<frontend_type>text</frontend_type>
|
730 |
+
<sort_order>120</sort_order>
|
731 |
+
<show_in_default>1</show_in_default>
|
732 |
+
<show_in_website>1</show_in_website>
|
733 |
+
<show_in_store>1</show_in_store>
|
734 |
+
</sort_order>
|
735 |
+
</fields>
|
736 |
+
</chronopostc10>
|
737 |
+
|
738 |
+
<!-- C18 Livraison avant 18H -->
|
739 |
+
<chronopostc18 translate="label">
|
740 |
+
<label>Chronopost C18</label>
|
741 |
+
<frontend_type>text</frontend_type>
|
742 |
+
<sort_order>24</sort_order>
|
743 |
+
<show_in_default>1</show_in_default>
|
744 |
+
<show_in_website>1</show_in_website>
|
745 |
+
<show_in_store>1</show_in_store>
|
746 |
+
<fields>
|
747 |
+
<active translate="label">
|
748 |
+
<label>Enabled</label>
|
749 |
+
<frontend_type>select</frontend_type>
|
750 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_field_enabled</frontend_model>
|
751 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
752 |
+
<sort_order>1</sort_order>
|
753 |
+
<show_in_default>1</show_in_default>
|
754 |
+
<show_in_website>1</show_in_website>
|
755 |
+
<show_in_store>1</show_in_store>
|
756 |
+
</active>
|
757 |
+
<title translate="label">
|
758 |
+
<label>Title</label>
|
759 |
+
<frontend_type>text</frontend_type>
|
760 |
+
<sort_order>2</sort_order>
|
761 |
+
<show_in_default>1</show_in_default>
|
762 |
+
<show_in_website>1</show_in_website>
|
763 |
+
<show_in_store>1</show_in_store>
|
764 |
+
</title>
|
765 |
+
<config translate="label">
|
766 |
+
<label>Configuration</label>
|
767 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_field_config</frontend_model>
|
768 |
+
<comment>{configuration_syntax_help}</comment>
|
769 |
+
<frontend_type>textarea</frontend_type>
|
770 |
+
<sort_order>3</sort_order>
|
771 |
+
<show_in_default>1</show_in_default>
|
772 |
+
<show_in_website>1</show_in_website>
|
773 |
+
<show_in_store>1</show_in_store>
|
774 |
+
</config>
|
775 |
+
<weight_limit translate="label">
|
776 |
+
<label>Weight Limit</label>
|
777 |
+
<frontend_type>text</frontend_type>
|
778 |
+
<comment>in Kg</comment>
|
779 |
+
<sort_order>7</sort_order>
|
780 |
+
<show_in_default>1</show_in_default>
|
781 |
+
<show_in_website>1</show_in_website>
|
782 |
+
<show_in_store>1</show_in_store>
|
783 |
+
</weight_limit>
|
784 |
+
<quickcost translate="label">
|
785 |
+
<label>Quickcost</label>
|
786 |
+
<frontend_type>select</frontend_type>
|
787 |
+
<comment>No : cost is obtained from your rate grid ; Yes : cost is fetched from URL below</comment>
|
788 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
789 |
+
<sort_order>10</sort_order>
|
790 |
+
<show_in_default>0</show_in_default>
|
791 |
+
<show_in_website>0</show_in_website>
|
792 |
+
<show_in_store>0</show_in_store>
|
793 |
+
</quickcost>
|
794 |
+
<quickcost_marge translate="label">
|
795 |
+
<label>Value to add to quickcost</label>
|
796 |
+
<frontend_type>text</frontend_type>
|
797 |
+
<sort_order>11</sort_order>
|
798 |
+
<show_in_default>1</show_in_default>
|
799 |
+
<show_in_website>1</show_in_website>
|
800 |
+
<show_in_store>1</show_in_store>
|
801 |
+
<validate>validate-number</validate>
|
802 |
+
</quickcost_marge>
|
803 |
+
<quickcost_marge_type translate="label">
|
804 |
+
<label>Type value to add</label>
|
805 |
+
<frontend_type>select</frontend_type>
|
806 |
+
<source_model>chronorelais/config_source_margetype</source_model>
|
807 |
+
<sort_order>12</sort_order>
|
808 |
+
<show_in_default>1</show_in_default>
|
809 |
+
<show_in_website>1</show_in_website>
|
810 |
+
<show_in_store>1</show_in_store>
|
811 |
+
</quickcost_marge_type>
|
812 |
+
<quickcost_url>
|
813 |
+
<label>Quickcost Url</label>
|
814 |
+
<frontend_type>text</frontend_type>
|
815 |
+
<sort_order>13</sort_order>
|
816 |
+
<show_in_default>0</show_in_default>
|
817 |
+
<show_in_website>0</show_in_website>
|
818 |
+
<show_in_store>0</show_in_store>
|
819 |
+
</quickcost_url>
|
820 |
+
<free_shipping_enable translate="label">
|
821 |
+
<label>Free Shipping on the Amount</label>
|
822 |
+
<frontend_type>select</frontend_type>
|
823 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
824 |
+
<sort_order>20</sort_order>
|
825 |
+
<show_in_default>1</show_in_default>
|
826 |
+
<show_in_website>1</show_in_website>
|
827 |
+
<show_in_store>1</show_in_store>
|
828 |
+
</free_shipping_enable>
|
829 |
+
<free_shipping_subtotal translate="label">
|
830 |
+
<label>Minimum Amount for Free Shipping</label>
|
831 |
+
<frontend_type>text</frontend_type>
|
832 |
+
<sort_order>30</sort_order>
|
833 |
+
<show_in_default>1</show_in_default>
|
834 |
+
<show_in_website>1</show_in_website>
|
835 |
+
<show_in_store>0</show_in_store>
|
836 |
+
</free_shipping_subtotal>
|
837 |
+
<application_fee translate="label">
|
838 |
+
<label>Application Fee</label>
|
839 |
+
<frontend_type>text</frontend_type>
|
840 |
+
<sort_order>40</sort_order>
|
841 |
+
<show_in_default>1</show_in_default>
|
842 |
+
<show_in_website>1</show_in_website>
|
843 |
+
<show_in_store>1</show_in_store>
|
844 |
+
</application_fee>
|
845 |
+
<handling_fee translate="label">
|
846 |
+
<label>Handling Fee</label>
|
847 |
+
<frontend_type>text</frontend_type>
|
848 |
+
<sort_order>50</sort_order>
|
849 |
+
<show_in_default>1</show_in_default>
|
850 |
+
<show_in_website>1</show_in_website>
|
851 |
+
<show_in_store>1</show_in_store>
|
852 |
+
</handling_fee>
|
853 |
+
<logo_url>
|
854 |
+
<label>Logo Url</label>
|
855 |
+
<frontend_type>text</frontend_type>
|
856 |
+
<comment>{logo_ulr_help}</comment>
|
857 |
+
<sort_order>60</sort_order>
|
858 |
+
<show_in_default>1</show_in_default>
|
859 |
+
<show_in_website>1</show_in_website>
|
860 |
+
<show_in_store>1</show_in_store>
|
861 |
+
</logo_url>
|
862 |
+
<debug>
|
863 |
+
<label>Debug</label>
|
864 |
+
<comment>{debug_help}</comment>
|
865 |
+
<frontend_type>text</frontend_type>
|
866 |
+
<sort_order>70</sort_order>
|
867 |
+
<show_in_default>1</show_in_default>
|
868 |
+
<show_in_website>1</show_in_website>
|
869 |
+
<show_in_store>1</show_in_store>
|
870 |
+
</debug>
|
871 |
+
<!--<stop_to_first_match translate="label">
|
872 |
+
<label>Stop to first match</label>
|
873 |
+
<frontend_type>select</frontend_type>
|
874 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
875 |
+
<sort_order>80</sort_order>
|
876 |
+
<show_in_default>1</show_in_default>
|
877 |
+
<show_in_website>1</show_in_website>
|
878 |
+
<show_in_store>1</show_in_store>
|
879 |
+
</stop_to_first_match>-->
|
880 |
+
<deliver_on_saturday translate="label comment">
|
881 |
+
<label>Livraison le Samedi</label>
|
882 |
+
<frontend_type>select</frontend_type>
|
883 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
884 |
+
<sort_order>90</sort_order>
|
885 |
+
<show_in_default>1</show_in_default>
|
886 |
+
<show_in_website>1</show_in_website>
|
887 |
+
<show_in_store>1</show_in_store>
|
888 |
+
</deliver_on_saturday>
|
889 |
+
<!--<showmethod translate="label">
|
890 |
+
<label>Show Method if Not Applicable</label>
|
891 |
+
<frontend_type>select</frontend_type>
|
892 |
+
<sort_order>100</sort_order>
|
893 |
+
<frontend_class>shipping-skip-hide</frontend_class>
|
894 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
895 |
+
<show_in_default>1</show_in_default>
|
896 |
+
<show_in_website>1</show_in_website>
|
897 |
+
<show_in_store>0</show_in_store>
|
898 |
+
</showmethod>
|
899 |
+
<specificerrmsg translate="label">
|
900 |
+
<label>Displayed Error Message</label>
|
901 |
+
<frontend_type>textarea</frontend_type>
|
902 |
+
<sort_order>110</sort_order>
|
903 |
+
<show_in_default>1</show_in_default>
|
904 |
+
<show_in_website>1</show_in_website>
|
905 |
+
<show_in_store>1</show_in_store>
|
906 |
+
</specificerrmsg>-->
|
907 |
+
<sort_order translate="label">
|
908 |
+
<label>Sort order</label>
|
909 |
+
<frontend_type>text</frontend_type>
|
910 |
+
<sort_order>120</sort_order>
|
911 |
+
<show_in_default>1</show_in_default>
|
912 |
+
<show_in_website>1</show_in_website>
|
913 |
+
<show_in_store>1</show_in_store>
|
914 |
+
</sort_order>
|
915 |
+
</fields>
|
916 |
+
</chronopostc18>
|
917 |
+
|
918 |
+
<!-- CClassic Livraison dans certaines villes Européennes -->
|
919 |
+
<chronopostcclassic translate="label">
|
920 |
+
<label>Chronopost CClassic</label>
|
921 |
+
<frontend_type>text</frontend_type>
|
922 |
+
<sort_order>25</sort_order>
|
923 |
+
<show_in_default>1</show_in_default>
|
924 |
+
<show_in_website>1</show_in_website>
|
925 |
+
<show_in_store>1</show_in_store>
|
926 |
+
<fields>
|
927 |
+
<active translate="label">
|
928 |
+
<label>Enabled</label>
|
929 |
+
<frontend_type>select</frontend_type>
|
930 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_field_enabled</frontend_model>
|
931 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
932 |
+
<sort_order>1</sort_order>
|
933 |
+
<show_in_default>1</show_in_default>
|
934 |
+
<show_in_website>1</show_in_website>
|
935 |
+
<show_in_store>1</show_in_store>
|
936 |
+
</active>
|
937 |
+
<title translate="label">
|
938 |
+
<label>Title</label>
|
939 |
+
<frontend_type>text</frontend_type>
|
940 |
+
<sort_order>2</sort_order>
|
941 |
+
<show_in_default>1</show_in_default>
|
942 |
+
<show_in_website>1</show_in_website>
|
943 |
+
<show_in_store>1</show_in_store>
|
944 |
+
</title>
|
945 |
+
<config translate="label">
|
946 |
+
<label>Configuration</label>
|
947 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_field_config</frontend_model>
|
948 |
+
<comment>{configuration_syntax_help}</comment>
|
949 |
+
<frontend_type>textarea</frontend_type>
|
950 |
+
<sort_order>3</sort_order>
|
951 |
+
<show_in_default>1</show_in_default>
|
952 |
+
<show_in_website>1</show_in_website>
|
953 |
+
<show_in_store>1</show_in_store>
|
954 |
+
</config>
|
955 |
+
<weight_limit translate="label">
|
956 |
+
<label>Weight Limit</label>
|
957 |
+
<frontend_type>text</frontend_type>
|
958 |
+
<comment>in Kg</comment>
|
959 |
+
<sort_order>7</sort_order>
|
960 |
+
<show_in_default>1</show_in_default>
|
961 |
+
<show_in_website>1</show_in_website>
|
962 |
+
<show_in_store>1</show_in_store>
|
963 |
+
</weight_limit>
|
964 |
+
<quickcost translate="label">
|
965 |
+
<label>Quickcost</label>
|
966 |
+
<frontend_type>select</frontend_type>
|
967 |
+
<comment>No : cost is obtained from your rate grid ; Yes : cost is fetched from URL below</comment>
|
968 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
969 |
+
<sort_order>10</sort_order>
|
970 |
+
<show_in_default>1</show_in_default>
|
971 |
+
<show_in_website>1</show_in_website>
|
972 |
+
<show_in_store>0</show_in_store>
|
973 |
+
</quickcost>
|
974 |
+
<quickcost_marge translate="label">
|
975 |
+
<label>Value to add to quickcost</label>
|
976 |
+
<frontend_type>text</frontend_type>
|
977 |
+
<sort_order>11</sort_order>
|
978 |
+
<show_in_default>1</show_in_default>
|
979 |
+
<show_in_website>1</show_in_website>
|
980 |
+
<show_in_store>1</show_in_store>
|
981 |
+
<validate>validate-number</validate>
|
982 |
+
</quickcost_marge>
|
983 |
+
<quickcost_marge_type translate="label">
|
984 |
+
<label>Type value to add</label>
|
985 |
+
<frontend_type>select</frontend_type>
|
986 |
+
<source_model>chronorelais/config_source_margetype</source_model>
|
987 |
+
<sort_order>12</sort_order>
|
988 |
+
<show_in_default>1</show_in_default>
|
989 |
+
<show_in_website>1</show_in_website>
|
990 |
+
<show_in_store>1</show_in_store>
|
991 |
+
</quickcost_marge_type>
|
992 |
+
<quickcost_url>
|
993 |
+
<label>Quickcost Url</label>
|
994 |
+
<frontend_type>text</frontend_type>
|
995 |
+
<sort_order>13</sort_order>
|
996 |
+
<show_in_default>1</show_in_default>
|
997 |
+
<show_in_website>1</show_in_website>
|
998 |
+
<show_in_store>0</show_in_store>
|
999 |
+
</quickcost_url>
|
1000 |
+
<free_shipping_enable translate="label">
|
1001 |
+
<label>Free Shipping on the Amount</label>
|
1002 |
+
<frontend_type>select</frontend_type>
|
1003 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
1004 |
+
<sort_order>20</sort_order>
|
1005 |
+
<show_in_default>1</show_in_default>
|
1006 |
+
<show_in_website>1</show_in_website>
|
1007 |
+
<show_in_store>1</show_in_store>
|
1008 |
+
</free_shipping_enable>
|
1009 |
+
<free_shipping_subtotal translate="label">
|
1010 |
+
<label>Minimum Amount for Free Shipping</label>
|
1011 |
+
<frontend_type>text</frontend_type>
|
1012 |
+
<sort_order>30</sort_order>
|
1013 |
+
<show_in_default>1</show_in_default>
|
1014 |
+
<show_in_website>1</show_in_website>
|
1015 |
+
<show_in_store>0</show_in_store>
|
1016 |
+
</free_shipping_subtotal>
|
1017 |
+
<application_fee translate="label">
|
1018 |
+
<label>Application Fee</label>
|
1019 |
+
<frontend_type>text</frontend_type>
|
1020 |
+
<sort_order>40</sort_order>
|
1021 |
+
<show_in_default>1</show_in_default>
|
1022 |
+
<show_in_website>1</show_in_website>
|
1023 |
+
<show_in_store>1</show_in_store>
|
1024 |
+
</application_fee>
|
1025 |
+
<handling_fee translate="label">
|
1026 |
+
<label>Handling Fee</label>
|
1027 |
+
<frontend_type>text</frontend_type>
|
1028 |
+
<sort_order>50</sort_order>
|
1029 |
+
<show_in_default>1</show_in_default>
|
1030 |
+
<show_in_website>1</show_in_website>
|
1031 |
+
<show_in_store>1</show_in_store>
|
1032 |
+
</handling_fee>
|
1033 |
+
<logo_url>
|
1034 |
+
<label>Logo Url</label>
|
1035 |
+
<frontend_type>text</frontend_type>
|
1036 |
+
<comment>{logo_ulr_help}</comment>
|
1037 |
+
<sort_order>60</sort_order>
|
1038 |
+
<show_in_default>1</show_in_default>
|
1039 |
+
<show_in_website>1</show_in_website>
|
1040 |
+
<show_in_store>1</show_in_store>
|
1041 |
+
</logo_url>
|
1042 |
+
<debug>
|
1043 |
+
<label>Debug</label>
|
1044 |
+
<comment>{debug_help}</comment>
|
1045 |
+
<frontend_type>text</frontend_type>
|
1046 |
+
<sort_order>70</sort_order>
|
1047 |
+
<show_in_default>1</show_in_default>
|
1048 |
+
<show_in_website>1</show_in_website>
|
1049 |
+
<show_in_store>1</show_in_store>
|
1050 |
+
</debug>
|
1051 |
+
<!--<stop_to_first_match translate="label">
|
1052 |
+
<label>Stop to first match</label>
|
1053 |
+
<frontend_type>select</frontend_type>
|
1054 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1055 |
+
<sort_order>80</sort_order>
|
1056 |
+
<show_in_default>1</show_in_default>
|
1057 |
+
<show_in_website>1</show_in_website>
|
1058 |
+
<show_in_store>1</show_in_store>
|
1059 |
+
</stop_to_first_match>-->
|
1060 |
+
<deliver_on_saturday translate="label comment">
|
1061 |
+
<label>Livraison le Samedi</label>
|
1062 |
+
<frontend_type>select</frontend_type>
|
1063 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1064 |
+
<sort_order>90</sort_order>
|
1065 |
+
<show_in_default>1</show_in_default>
|
1066 |
+
<show_in_website>1</show_in_website>
|
1067 |
+
<show_in_store>1</show_in_store>
|
1068 |
+
</deliver_on_saturday>
|
1069 |
+
<!--<showmethod translate="label">
|
1070 |
+
<label>Show Method if Not Applicable</label>
|
1071 |
+
<frontend_type>select</frontend_type>
|
1072 |
+
<sort_order>100</sort_order>
|
1073 |
+
<frontend_class>shipping-skip-hide</frontend_class>
|
1074 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1075 |
+
<show_in_default>1</show_in_default>
|
1076 |
+
<show_in_website>1</show_in_website>
|
1077 |
+
<show_in_store>0</show_in_store>
|
1078 |
+
</showmethod>
|
1079 |
+
<specificerrmsg translate="label">
|
1080 |
+
<label>Displayed Error Message</label>
|
1081 |
+
<frontend_type>textarea</frontend_type>
|
1082 |
+
<sort_order>110</sort_order>
|
1083 |
+
<show_in_default>1</show_in_default>
|
1084 |
+
<show_in_website>1</show_in_website>
|
1085 |
+
<show_in_store>1</show_in_store>
|
1086 |
+
</specificerrmsg>-->
|
1087 |
+
<sort_order translate="label">
|
1088 |
+
<label>Sort order</label>
|
1089 |
+
<frontend_type>text</frontend_type>
|
1090 |
+
<sort_order>120</sort_order>
|
1091 |
+
<show_in_default>1</show_in_default>
|
1092 |
+
<show_in_website>1</show_in_website>
|
1093 |
+
<show_in_store>1</show_in_store>
|
1094 |
+
</sort_order>
|
1095 |
+
</fields>
|
1096 |
+
</chronopostcclassic>
|
1097 |
+
|
1098 |
+
<chronorelaiseurope translate="label">
|
1099 |
+
<label>Chrono Relais Europe</label>
|
1100 |
+
<frontend_type>text</frontend_type>
|
1101 |
+
<sort_order>26</sort_order>
|
1102 |
+
<show_in_default>1</show_in_default>
|
1103 |
+
<show_in_website>1</show_in_website>
|
1104 |
+
<show_in_store>1</show_in_store>
|
1105 |
+
<fields>
|
1106 |
+
<active translate="label">
|
1107 |
+
<label>Enabled</label>
|
1108 |
+
<frontend_type>select</frontend_type>
|
1109 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_field_enabled</frontend_model>
|
1110 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1111 |
+
<sort_order>1</sort_order>
|
1112 |
+
<show_in_default>1</show_in_default>
|
1113 |
+
<show_in_website>1</show_in_website>
|
1114 |
+
<show_in_store>1</show_in_store>
|
1115 |
+
</active>
|
1116 |
+
<title translate="label">
|
1117 |
+
<label>Title</label>
|
1118 |
+
<frontend_type>text</frontend_type>
|
1119 |
+
<sort_order>2</sort_order>
|
1120 |
+
<show_in_default>1</show_in_default>
|
1121 |
+
<show_in_website>1</show_in_website>
|
1122 |
+
<show_in_store>1</show_in_store>
|
1123 |
+
</title>
|
1124 |
+
<config translate="label">
|
1125 |
+
<label>Configuration</label>
|
1126 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_field_config</frontend_model>
|
1127 |
+
<comment>{configuration_syntax_help}</comment>
|
1128 |
+
<frontend_type>textarea</frontend_type>
|
1129 |
+
<sort_order>3</sort_order>
|
1130 |
+
<show_in_default>1</show_in_default>
|
1131 |
+
<show_in_website>1</show_in_website>
|
1132 |
+
<show_in_store>1</show_in_store>
|
1133 |
+
</config>
|
1134 |
+
<weight_limit translate="label">
|
1135 |
+
<label>Weight Limit</label>
|
1136 |
+
<frontend_type>text</frontend_type>
|
1137 |
+
<comment>in Kg</comment>
|
1138 |
+
<sort_order>7</sort_order>
|
1139 |
+
<show_in_default>1</show_in_default>
|
1140 |
+
<show_in_website>1</show_in_website>
|
1141 |
+
<show_in_store>1</show_in_store>
|
1142 |
+
</weight_limit>
|
1143 |
+
<quickcost translate="label">
|
1144 |
+
<label>Quickcost</label>
|
1145 |
+
<frontend_type>select</frontend_type>
|
1146 |
+
<comment>No : cost is obtained from your rate grid ; Yes : cost is fetched from URL below</comment>
|
1147 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1148 |
+
<sort_order>10</sort_order>
|
1149 |
+
<show_in_default>1</show_in_default>
|
1150 |
+
<show_in_website>1</show_in_website>
|
1151 |
+
<show_in_store>0</show_in_store>
|
1152 |
+
</quickcost>
|
1153 |
+
<quickcost_marge translate="label">
|
1154 |
+
<label>Value to add to quickcost</label>
|
1155 |
+
<frontend_type>text</frontend_type>
|
1156 |
+
<sort_order>11</sort_order>
|
1157 |
+
<show_in_default>1</show_in_default>
|
1158 |
+
<show_in_website>1</show_in_website>
|
1159 |
+
<show_in_store>1</show_in_store>
|
1160 |
+
<validate>validate-number</validate>
|
1161 |
+
</quickcost_marge>
|
1162 |
+
<quickcost_marge_type translate="label">
|
1163 |
+
<label>Type value to add</label>
|
1164 |
+
<frontend_type>select</frontend_type>
|
1165 |
+
<source_model>chronorelais/config_source_margetype</source_model>
|
1166 |
+
<sort_order>12</sort_order>
|
1167 |
+
<show_in_default>1</show_in_default>
|
1168 |
+
<show_in_website>1</show_in_website>
|
1169 |
+
<show_in_store>1</show_in_store>
|
1170 |
+
</quickcost_marge_type>
|
1171 |
+
<quickcost_url>
|
1172 |
+
<label>Quickcost Url</label>
|
1173 |
+
<frontend_type>text</frontend_type>
|
1174 |
+
<sort_order>13</sort_order>
|
1175 |
+
<show_in_default>1</show_in_default>
|
1176 |
+
<show_in_website>1</show_in_website>
|
1177 |
+
<show_in_store>0</show_in_store>
|
1178 |
+
</quickcost_url>
|
1179 |
+
<show_google_map translate="label">
|
1180 |
+
<label>Show Google Map</label>
|
1181 |
+
<frontend_type>select</frontend_type>
|
1182 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1183 |
+
<sort_order>20</sort_order>
|
1184 |
+
<show_in_default>1</show_in_default>
|
1185 |
+
<show_in_website>1</show_in_website>
|
1186 |
+
<show_in_store>1</show_in_store>
|
1187 |
+
</show_google_map>
|
1188 |
+
<max_distance_search translate="label">
|
1189 |
+
<label>Max distance search</label>
|
1190 |
+
<frontend_type>text</frontend_type>
|
1191 |
+
<sort_order>30</sort_order>
|
1192 |
+
<show_in_default>1</show_in_default>
|
1193 |
+
<show_in_website>1</show_in_website>
|
1194 |
+
<show_in_store>0</show_in_store>
|
1195 |
+
</max_distance_search>
|
1196 |
+
<free_shipping_enable translate="label">
|
1197 |
+
<label>Free Shipping with Minimum Order Amount</label>
|
1198 |
+
<frontend_type>select</frontend_type>
|
1199 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
1200 |
+
<sort_order>40</sort_order>
|
1201 |
+
<show_in_default>1</show_in_default>
|
1202 |
+
<show_in_website>1</show_in_website>
|
1203 |
+
<show_in_store>1</show_in_store>
|
1204 |
+
</free_shipping_enable>
|
1205 |
+
<free_shipping_subtotal translate="label">
|
1206 |
+
<label>Minimum Order Amount for Free Shipping</label>
|
1207 |
+
<frontend_type>text</frontend_type>
|
1208 |
+
<sort_order>50</sort_order>
|
1209 |
+
<show_in_default>1</show_in_default>
|
1210 |
+
<show_in_website>1</show_in_website>
|
1211 |
+
<show_in_store>1</show_in_store>
|
1212 |
+
</free_shipping_subtotal>
|
1213 |
+
<application_fee translate="label">
|
1214 |
+
<label>Application Fee</label>
|
1215 |
+
<frontend_type>text</frontend_type>
|
1216 |
+
<sort_order>60</sort_order>
|
1217 |
+
<show_in_default>1</show_in_default>
|
1218 |
+
<show_in_website>1</show_in_website>
|
1219 |
+
<show_in_store>1</show_in_store>
|
1220 |
+
</application_fee>
|
1221 |
+
<handling_fee translate="label">
|
1222 |
+
<label>Handling Fee</label>
|
1223 |
+
<frontend_type>text</frontend_type>
|
1224 |
+
<sort_order>70</sort_order>
|
1225 |
+
<show_in_default>1</show_in_default>
|
1226 |
+
<show_in_website>1</show_in_website>
|
1227 |
+
<show_in_store>1</show_in_store>
|
1228 |
+
</handling_fee>
|
1229 |
+
<logo_url>
|
1230 |
+
<label>Logo Url</label>
|
1231 |
+
<frontend_type>text</frontend_type>
|
1232 |
+
<comment>{logo_ulr_help}</comment>
|
1233 |
+
<sort_order>80</sort_order>
|
1234 |
+
<show_in_default>1</show_in_default>
|
1235 |
+
<show_in_website>1</show_in_website>
|
1236 |
+
<show_in_store>1</show_in_store>
|
1237 |
+
</logo_url>
|
1238 |
+
<debug>
|
1239 |
+
<label>Debug</label>
|
1240 |
+
<comment>{debug_help}</comment>
|
1241 |
+
<frontend_type>text</frontend_type>
|
1242 |
+
<sort_order>90</sort_order>
|
1243 |
+
<show_in_default>1</show_in_default>
|
1244 |
+
<show_in_website>1</show_in_website>
|
1245 |
+
<show_in_store>1</show_in_store>
|
1246 |
+
</debug>
|
1247 |
+
<sort_order translate="label">
|
1248 |
+
<label>Sort order</label>
|
1249 |
+
<frontend_type>text</frontend_type>
|
1250 |
+
<sort_order>100</sort_order>
|
1251 |
+
<show_in_default>1</show_in_default>
|
1252 |
+
<show_in_website>1</show_in_website>
|
1253 |
+
<show_in_store>1</show_in_store>
|
1254 |
+
</sort_order>
|
1255 |
+
</fields>
|
1256 |
+
</chronorelaiseurope>
|
1257 |
+
|
1258 |
+
<!--<chronorelaisdom translate="label">
|
1259 |
+
<label>Chrono Relais DOM</label>
|
1260 |
+
<frontend_type>text</frontend_type>
|
1261 |
+
<sort_order>27</sort_order>
|
1262 |
+
<show_in_default>1</show_in_default>
|
1263 |
+
<show_in_website>1</show_in_website>
|
1264 |
+
<show_in_store>1</show_in_store>
|
1265 |
+
<fields>
|
1266 |
+
<active translate="label">
|
1267 |
+
<label>Enabled</label>
|
1268 |
+
<frontend_type>select</frontend_type>
|
1269 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_field_enabled</frontend_model>
|
1270 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1271 |
+
<sort_order>1</sort_order>
|
1272 |
+
<show_in_default>1</show_in_default>
|
1273 |
+
<show_in_website>1</show_in_website>
|
1274 |
+
<show_in_store>1</show_in_store>
|
1275 |
+
</active>
|
1276 |
+
<title translate="label">
|
1277 |
+
<label>Title</label>
|
1278 |
+
<frontend_type>text</frontend_type>
|
1279 |
+
<sort_order>2</sort_order>
|
1280 |
+
<show_in_default>1</show_in_default>
|
1281 |
+
<show_in_website>1</show_in_website>
|
1282 |
+
<show_in_store>1</show_in_store>
|
1283 |
+
</title>
|
1284 |
+
<config translate="label">
|
1285 |
+
<label>Configuration</label>
|
1286 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_field_config</frontend_model>
|
1287 |
+
<comment>{configuration_syntax_help}</comment>
|
1288 |
+
<frontend_type>textarea</frontend_type>
|
1289 |
+
<sort_order>3</sort_order>
|
1290 |
+
<show_in_default>1</show_in_default>
|
1291 |
+
<show_in_website>1</show_in_website>
|
1292 |
+
<show_in_store>1</show_in_store>
|
1293 |
+
</config>
|
1294 |
+
<weight_limit translate="label">
|
1295 |
+
<label>Weight Limit</label>
|
1296 |
+
<frontend_type>text</frontend_type>
|
1297 |
+
<comment>in Kg</comment>
|
1298 |
+
<sort_order>7</sort_order>
|
1299 |
+
<show_in_default>1</show_in_default>
|
1300 |
+
<show_in_website>1</show_in_website>
|
1301 |
+
<show_in_store>1</show_in_store>
|
1302 |
+
</weight_limit>
|
1303 |
+
<quickcost translate="label">
|
1304 |
+
<label>Quickcost</label>
|
1305 |
+
<frontend_type>select</frontend_type>
|
1306 |
+
<comment>No : cost is obtained from your rate grid ; Yes : cost is fetched from URL below</comment>
|
1307 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1308 |
+
<sort_order>10</sort_order>
|
1309 |
+
<show_in_default>1</show_in_default>
|
1310 |
+
<show_in_website>1</show_in_website>
|
1311 |
+
<show_in_store>0</show_in_store>
|
1312 |
+
</quickcost>
|
1313 |
+
<quickcost_marge translate="label">
|
1314 |
+
<label>Value to add to quickcost</label>
|
1315 |
+
<frontend_type>text</frontend_type>
|
1316 |
+
<sort_order>11</sort_order>
|
1317 |
+
<show_in_default>1</show_in_default>
|
1318 |
+
<show_in_website>1</show_in_website>
|
1319 |
+
<show_in_store>1</show_in_store>
|
1320 |
+
<validate>validate-number</validate>
|
1321 |
+
</quickcost_marge>
|
1322 |
+
<quickcost_marge_type translate="label">
|
1323 |
+
<label>Type value to add</label>
|
1324 |
+
<frontend_type>select</frontend_type>
|
1325 |
+
<source_model>chronorelais/config_source_margetype</source_model>
|
1326 |
+
<sort_order>12</sort_order>
|
1327 |
+
<show_in_default>1</show_in_default>
|
1328 |
+
<show_in_website>1</show_in_website>
|
1329 |
+
<show_in_store>1</show_in_store>
|
1330 |
+
</quickcost_marge_type>
|
1331 |
+
<quickcost_url>
|
1332 |
+
<label>Quickcost Url</label>
|
1333 |
+
<frontend_type>text</frontend_type>
|
1334 |
+
<sort_order>13</sort_order>
|
1335 |
+
<show_in_default>1</show_in_default>
|
1336 |
+
<show_in_website>1</show_in_website>
|
1337 |
+
<show_in_store>0</show_in_store>
|
1338 |
+
</quickcost_url>
|
1339 |
+
<show_google_map translate="label">
|
1340 |
+
<label>Show Google Map</label>
|
1341 |
+
<frontend_type>select</frontend_type>
|
1342 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1343 |
+
<sort_order>20</sort_order>
|
1344 |
+
<show_in_default>1</show_in_default>
|
1345 |
+
<show_in_website>1</show_in_website>
|
1346 |
+
<show_in_store>1</show_in_store>
|
1347 |
+
</show_google_map>
|
1348 |
+
<max_distance_search translate="label">
|
1349 |
+
<label>Max distance search</label>
|
1350 |
+
<frontend_type>text</frontend_type>
|
1351 |
+
<sort_order>30</sort_order>
|
1352 |
+
<show_in_default>1</show_in_default>
|
1353 |
+
<show_in_website>1</show_in_website>
|
1354 |
+
<show_in_store>0</show_in_store>
|
1355 |
+
</max_distance_search>
|
1356 |
+
<free_shipping_enable translate="label">
|
1357 |
+
<label>Free Shipping with Minimum Order Amount</label>
|
1358 |
+
<frontend_type>select</frontend_type>
|
1359 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
1360 |
+
<sort_order>40</sort_order>
|
1361 |
+
<show_in_default>1</show_in_default>
|
1362 |
+
<show_in_website>1</show_in_website>
|
1363 |
+
<show_in_store>1</show_in_store>
|
1364 |
+
</free_shipping_enable>
|
1365 |
+
<free_shipping_subtotal translate="label">
|
1366 |
+
<label>Minimum Order Amount for Free Shipping</label>
|
1367 |
+
<frontend_type>text</frontend_type>
|
1368 |
+
<sort_order>50</sort_order>
|
1369 |
+
<show_in_default>1</show_in_default>
|
1370 |
+
<show_in_website>1</show_in_website>
|
1371 |
+
<show_in_store>1</show_in_store>
|
1372 |
+
</free_shipping_subtotal>
|
1373 |
+
<application_fee translate="label">
|
1374 |
+
<label>Application Fee</label>
|
1375 |
+
<frontend_type>text</frontend_type>
|
1376 |
+
<sort_order>60</sort_order>
|
1377 |
+
<show_in_default>1</show_in_default>
|
1378 |
+
<show_in_website>1</show_in_website>
|
1379 |
+
<show_in_store>1</show_in_store>
|
1380 |
+
</application_fee>
|
1381 |
+
<handling_fee translate="label">
|
1382 |
+
<label>Handling Fee</label>
|
1383 |
+
<frontend_type>text</frontend_type>
|
1384 |
+
<sort_order>70</sort_order>
|
1385 |
+
<show_in_default>1</show_in_default>
|
1386 |
+
<show_in_website>1</show_in_website>
|
1387 |
+
<show_in_store>1</show_in_store>
|
1388 |
+
</handling_fee>
|
1389 |
+
<logo_url>
|
1390 |
+
<label>Logo Url</label>
|
1391 |
+
<frontend_type>text</frontend_type>
|
1392 |
+
<comment>{logo_ulr_help}</comment>
|
1393 |
+
<sort_order>80</sort_order>
|
1394 |
+
<show_in_default>1</show_in_default>
|
1395 |
+
<show_in_website>1</show_in_website>
|
1396 |
+
<show_in_store>1</show_in_store>
|
1397 |
+
</logo_url>
|
1398 |
+
<debug>
|
1399 |
+
<label>Debug</label>
|
1400 |
+
<comment>{debug_help}</comment>
|
1401 |
+
<frontend_type>text</frontend_type>
|
1402 |
+
<sort_order>90</sort_order>
|
1403 |
+
<show_in_default>1</show_in_default>
|
1404 |
+
<show_in_website>1</show_in_website>
|
1405 |
+
<show_in_store>1</show_in_store>
|
1406 |
+
</debug>
|
1407 |
+
<deliver_on_saturday translate="label comment">
|
1408 |
+
<label>Livraison le Samedi</label>
|
1409 |
+
<frontend_type>select</frontend_type>
|
1410 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1411 |
+
<sort_order>100</sort_order>
|
1412 |
+
<show_in_default>1</show_in_default>
|
1413 |
+
<show_in_website>1</show_in_website>
|
1414 |
+
<show_in_store>1</show_in_store>
|
1415 |
+
</deliver_on_saturday>
|
1416 |
+
<sort_order translate="label">
|
1417 |
+
<label>Sort order</label>
|
1418 |
+
<frontend_type>text</frontend_type>
|
1419 |
+
<sort_order>110</sort_order>
|
1420 |
+
<show_in_default>1</show_in_default>
|
1421 |
+
<show_in_website>1</show_in_website>
|
1422 |
+
<show_in_store>1</show_in_store>
|
1423 |
+
</sort_order>
|
1424 |
+
</fields>
|
1425 |
+
</chronorelaisdom>-->
|
1426 |
+
|
1427 |
+
<chronopostsameday translate="label">
|
1428 |
+
<label>Chronopost SAMEDAY</label>
|
1429 |
+
<frontend_type>text</frontend_type>
|
1430 |
+
<sort_order>28</sort_order>
|
1431 |
+
<show_in_default>1</show_in_default>
|
1432 |
+
<show_in_website>1</show_in_website>
|
1433 |
+
<show_in_store>1</show_in_store>
|
1434 |
+
<fields>
|
1435 |
+
<active translate="label">
|
1436 |
+
<label>Enabled</label>
|
1437 |
+
<frontend_type>select</frontend_type>
|
1438 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_field_enabled</frontend_model>
|
1439 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1440 |
+
<sort_order>1</sort_order>
|
1441 |
+
<show_in_default>1</show_in_default>
|
1442 |
+
<show_in_website>1</show_in_website>
|
1443 |
+
<show_in_store>1</show_in_store>
|
1444 |
+
</active>
|
1445 |
+
<title translate="label">
|
1446 |
+
<label>Title</label>
|
1447 |
+
<frontend_type>text</frontend_type>
|
1448 |
+
<sort_order>2</sort_order>
|
1449 |
+
<show_in_default>1</show_in_default>
|
1450 |
+
<show_in_website>1</show_in_website>
|
1451 |
+
<show_in_store>1</show_in_store>
|
1452 |
+
</title>
|
1453 |
+
<config translate="label">
|
1454 |
+
<label>Configuration</label>
|
1455 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_field_config</frontend_model>
|
1456 |
+
<comment>{configuration_syntax_help}</comment>
|
1457 |
+
<frontend_type>textarea</frontend_type>
|
1458 |
+
<sort_order>3</sort_order>
|
1459 |
+
<show_in_default>1</show_in_default>
|
1460 |
+
<show_in_website>1</show_in_website>
|
1461 |
+
<show_in_store>1</show_in_store>
|
1462 |
+
</config>
|
1463 |
+
<weight_limit translate="label">
|
1464 |
+
<label>Weight Limit</label>
|
1465 |
+
<frontend_type>text</frontend_type>
|
1466 |
+
<comment>in Kg</comment>
|
1467 |
+
<sort_order>7</sort_order>
|
1468 |
+
<show_in_default>1</show_in_default>
|
1469 |
+
<show_in_website>1</show_in_website>
|
1470 |
+
<show_in_store>1</show_in_store>
|
1471 |
+
</weight_limit>
|
1472 |
+
<quickcost translate="label">
|
1473 |
+
<label>Quickcost</label>
|
1474 |
+
<frontend_type>select</frontend_type>
|
1475 |
+
<comment>No : cost is obtained from your rate grid ; Yes : cost is fetched from URL below</comment>
|
1476 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1477 |
+
<sort_order>10</sort_order>
|
1478 |
+
<show_in_default>1</show_in_default>
|
1479 |
+
<show_in_website>1</show_in_website>
|
1480 |
+
<show_in_store>0</show_in_store>
|
1481 |
+
</quickcost>
|
1482 |
+
<quickcost_marge translate="label">
|
1483 |
+
<label>Value to add to quickcost</label>
|
1484 |
+
<frontend_type>text</frontend_type>
|
1485 |
+
<sort_order>11</sort_order>
|
1486 |
+
<show_in_default>1</show_in_default>
|
1487 |
+
<show_in_website>1</show_in_website>
|
1488 |
+
<show_in_store>1</show_in_store>
|
1489 |
+
<validate>validate-number</validate>
|
1490 |
+
</quickcost_marge>
|
1491 |
+
<quickcost_marge_type translate="label">
|
1492 |
+
<label>Type value to add</label>
|
1493 |
+
<frontend_type>select</frontend_type>
|
1494 |
+
<source_model>chronorelais/config_source_margetype</source_model>
|
1495 |
+
<sort_order>12</sort_order>
|
1496 |
+
<show_in_default>1</show_in_default>
|
1497 |
+
<show_in_website>1</show_in_website>
|
1498 |
+
<show_in_store>1</show_in_store>
|
1499 |
+
</quickcost_marge_type>
|
1500 |
+
<quickcost_url>
|
1501 |
+
<label>Quickcost Url</label>
|
1502 |
+
<frontend_type>text</frontend_type>
|
1503 |
+
<sort_order>13</sort_order>
|
1504 |
+
<show_in_default>1</show_in_default>
|
1505 |
+
<show_in_website>1</show_in_website>
|
1506 |
+
<show_in_store>0</show_in_store>
|
1507 |
+
</quickcost_url>
|
1508 |
+
<free_shipping_enable translate="label">
|
1509 |
+
<label>Free Shipping on the Amount</label>
|
1510 |
+
<frontend_type>select</frontend_type>
|
1511 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
1512 |
+
<sort_order>20</sort_order>
|
1513 |
+
<show_in_default>1</show_in_default>
|
1514 |
+
<show_in_website>1</show_in_website>
|
1515 |
+
<show_in_store>1</show_in_store>
|
1516 |
+
</free_shipping_enable>
|
1517 |
+
<free_shipping_subtotal translate="label">
|
1518 |
+
<label>Minimum Amount for Free Shipping</label>
|
1519 |
+
<frontend_type>text</frontend_type>
|
1520 |
+
<sort_order>30</sort_order>
|
1521 |
+
<show_in_default>1</show_in_default>
|
1522 |
+
<show_in_website>1</show_in_website>
|
1523 |
+
<show_in_store>0</show_in_store>
|
1524 |
+
</free_shipping_subtotal>
|
1525 |
+
<application_fee translate="label">
|
1526 |
+
<label>Application Fee</label>
|
1527 |
+
<frontend_type>text</frontend_type>
|
1528 |
+
<sort_order>40</sort_order>
|
1529 |
+
<show_in_default>1</show_in_default>
|
1530 |
+
<show_in_website>1</show_in_website>
|
1531 |
+
<show_in_store>1</show_in_store>
|
1532 |
+
</application_fee>
|
1533 |
+
<handling_fee translate="label">
|
1534 |
+
<label>Handling Fee</label>
|
1535 |
+
<frontend_type>text</frontend_type>
|
1536 |
+
<sort_order>50</sort_order>
|
1537 |
+
<show_in_default>1</show_in_default>
|
1538 |
+
<show_in_website>1</show_in_website>
|
1539 |
+
<show_in_store>1</show_in_store>
|
1540 |
+
</handling_fee>
|
1541 |
+
<logo_url>
|
1542 |
+
<label>Logo Url</label>
|
1543 |
+
<frontend_type>text</frontend_type>
|
1544 |
+
<comment>{logo_ulr_help}</comment>
|
1545 |
+
<sort_order>60</sort_order>
|
1546 |
+
<show_in_default>1</show_in_default>
|
1547 |
+
<show_in_website>1</show_in_website>
|
1548 |
+
<show_in_store>1</show_in_store>
|
1549 |
+
</logo_url>
|
1550 |
+
<debug>
|
1551 |
+
<label>Debug</label>
|
1552 |
+
<comment>{debug_help}</comment>
|
1553 |
+
<frontend_type>text</frontend_type>
|
1554 |
+
<sort_order>70</sort_order>
|
1555 |
+
<show_in_default>1</show_in_default>
|
1556 |
+
<show_in_website>1</show_in_website>
|
1557 |
+
<show_in_store>1</show_in_store>
|
1558 |
+
</debug>
|
1559 |
+
<!--<stop_to_first_match translate="label">
|
1560 |
+
<label>Stop to first match</label>
|
1561 |
+
<frontend_type>select</frontend_type>
|
1562 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1563 |
+
<sort_order>80</sort_order>
|
1564 |
+
<show_in_default>1</show_in_default>
|
1565 |
+
<show_in_website>1</show_in_website>
|
1566 |
+
<show_in_store>1</show_in_store>
|
1567 |
+
</stop_to_first_match>-->
|
1568 |
+
<deliver_on_saturday translate="label comment">
|
1569 |
+
<label>Livraison le Samedi</label>
|
1570 |
+
<frontend_type>select</frontend_type>
|
1571 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1572 |
+
<sort_order>90</sort_order>
|
1573 |
+
<show_in_default>1</show_in_default>
|
1574 |
+
<show_in_website>1</show_in_website>
|
1575 |
+
<show_in_store>1</show_in_store>
|
1576 |
+
</deliver_on_saturday>
|
1577 |
+
<delivery_time_limit>
|
1578 |
+
<label>Disable after</label>
|
1579 |
+
<comment>The module will be disabled after the selected hour. If it is not working, check your timezone settings in General config.</comment>
|
1580 |
+
<frontend_type>select</frontend_type>
|
1581 |
+
<source_model>chronorelais/config_source_time</source_model>
|
1582 |
+
<sort_order>100</sort_order>
|
1583 |
+
<show_in_default>1</show_in_default>
|
1584 |
+
<show_in_website>1</show_in_website>
|
1585 |
+
<show_in_store>1</show_in_store>
|
1586 |
+
</delivery_time_limit>
|
1587 |
+
<!--<showmethod translate="label">
|
1588 |
+
<label>Show Method if Not Applicable</label>
|
1589 |
+
<frontend_type>select</frontend_type>
|
1590 |
+
<sort_order>100</sort_order>
|
1591 |
+
<frontend_class>shipping-skip-hide</frontend_class>
|
1592 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1593 |
+
<show_in_default>1</show_in_default>
|
1594 |
+
<show_in_website>1</show_in_website>
|
1595 |
+
<show_in_store>0</show_in_store>
|
1596 |
+
</showmethod>
|
1597 |
+
<specificerrmsg translate="label">
|
1598 |
+
<label>Displayed Error Message</label>
|
1599 |
+
<frontend_type>textarea</frontend_type>
|
1600 |
+
<sort_order>110</sort_order>
|
1601 |
+
<show_in_default>1</show_in_default>
|
1602 |
+
<show_in_website>1</show_in_website>
|
1603 |
+
<show_in_store>1</show_in_store>
|
1604 |
+
</specificerrmsg>-->
|
1605 |
+
<sort_order translate="label">
|
1606 |
+
<label>Sort order</label>
|
1607 |
+
<frontend_type>text</frontend_type>
|
1608 |
+
<sort_order>120</sort_order>
|
1609 |
+
<show_in_default>1</show_in_default>
|
1610 |
+
<show_in_website>1</show_in_website>
|
1611 |
+
<show_in_store>1</show_in_store>
|
1612 |
+
</sort_order>
|
1613 |
+
</fields>
|
1614 |
+
</chronopostsameday>
|
1615 |
+
|
1616 |
+
<chronopostsrdv translate="label">
|
1617 |
+
<label>Chronopost Sur Rendez-vous</label>
|
1618 |
+
<frontend_type>text</frontend_type>
|
1619 |
+
<sort_order>30</sort_order>
|
1620 |
+
<show_in_default>1</show_in_default>
|
1621 |
+
<show_in_website>1</show_in_website>
|
1622 |
+
<show_in_store>1</show_in_store>
|
1623 |
+
<fields>
|
1624 |
+
<active translate="label">
|
1625 |
+
<label>Enabled</label>
|
1626 |
+
<frontend_type>select</frontend_type>
|
1627 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_field_enabled</frontend_model>
|
1628 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1629 |
+
<sort_order>1</sort_order>
|
1630 |
+
<show_in_default>1</show_in_default>
|
1631 |
+
<show_in_website>1</show_in_website>
|
1632 |
+
<show_in_store>1</show_in_store>
|
1633 |
+
</active>
|
1634 |
+
<title translate="label">
|
1635 |
+
<label>Title</label>
|
1636 |
+
<frontend_type>text</frontend_type>
|
1637 |
+
<sort_order>2</sort_order>
|
1638 |
+
<show_in_default>1</show_in_default>
|
1639 |
+
<show_in_website>1</show_in_website>
|
1640 |
+
<show_in_store>1</show_in_store>
|
1641 |
+
</title>
|
1642 |
+
<config translate="label">
|
1643 |
+
<label>Configuration</label>
|
1644 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_field_config</frontend_model>
|
1645 |
+
<comment>{configuration_syntax_help}</comment>
|
1646 |
+
<frontend_type>textarea</frontend_type>
|
1647 |
+
<sort_order>3</sort_order>
|
1648 |
+
<show_in_default>1</show_in_default>
|
1649 |
+
<show_in_website>1</show_in_website>
|
1650 |
+
<show_in_store>1</show_in_store>
|
1651 |
+
</config>
|
1652 |
+
<weight_limit translate="label">
|
1653 |
+
<label>Weight Limit</label>
|
1654 |
+
<frontend_type>text</frontend_type>
|
1655 |
+
<comment>in Kg</comment>
|
1656 |
+
<sort_order>7</sort_order>
|
1657 |
+
<show_in_default>1</show_in_default>
|
1658 |
+
<show_in_website>1</show_in_website>
|
1659 |
+
<show_in_store>1</show_in_store>
|
1660 |
+
</weight_limit>
|
1661 |
+
<quickcost translate="label">
|
1662 |
+
<label>Quickcost</label>
|
1663 |
+
<frontend_type>select</frontend_type>
|
1664 |
+
<comment>No : cost is obtained from your rate grid ; Yes : cost is fetched from URL below</comment>
|
1665 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1666 |
+
<sort_order>10</sort_order>
|
1667 |
+
<show_in_default>1</show_in_default>
|
1668 |
+
<show_in_website>1</show_in_website>
|
1669 |
+
<show_in_store>0</show_in_store>
|
1670 |
+
</quickcost>
|
1671 |
+
<quickcost_marge translate="label">
|
1672 |
+
<label>Value to add to quickcost</label>
|
1673 |
+
<frontend_type>text</frontend_type>
|
1674 |
+
<sort_order>11</sort_order>
|
1675 |
+
<show_in_default>1</show_in_default>
|
1676 |
+
<show_in_website>1</show_in_website>
|
1677 |
+
<show_in_store>1</show_in_store>
|
1678 |
+
<validate>validate-number</validate>
|
1679 |
+
</quickcost_marge>
|
1680 |
+
<quickcost_marge_type translate="label">
|
1681 |
+
<label>Type value to add</label>
|
1682 |
+
<frontend_type>select</frontend_type>
|
1683 |
+
<source_model>chronorelais/config_source_margetype</source_model>
|
1684 |
+
<sort_order>12</sort_order>
|
1685 |
+
<show_in_default>1</show_in_default>
|
1686 |
+
<show_in_website>1</show_in_website>
|
1687 |
+
<show_in_store>1</show_in_store>
|
1688 |
+
</quickcost_marge_type>
|
1689 |
+
<quickcost_url>
|
1690 |
+
<label>Quickcost Url</label>
|
1691 |
+
<frontend_type>text</frontend_type>
|
1692 |
+
<sort_order>13</sort_order>
|
1693 |
+
<show_in_default>1</show_in_default>
|
1694 |
+
<show_in_website>1</show_in_website>
|
1695 |
+
<show_in_store>0</show_in_store>
|
1696 |
+
</quickcost_url>
|
1697 |
+
<free_shipping_enable translate="label">
|
1698 |
+
<label>Free Shipping on the Amount</label>
|
1699 |
+
<frontend_type>select</frontend_type>
|
1700 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
1701 |
+
<sort_order>20</sort_order>
|
1702 |
+
<show_in_default>1</show_in_default>
|
1703 |
+
<show_in_website>1</show_in_website>
|
1704 |
+
<show_in_store>1</show_in_store>
|
1705 |
+
</free_shipping_enable>
|
1706 |
+
<free_shipping_subtotal translate="label">
|
1707 |
+
<label>Minimum Amount for Free Shipping</label>
|
1708 |
+
<frontend_type>text</frontend_type>
|
1709 |
+
<sort_order>30</sort_order>
|
1710 |
+
<show_in_default>1</show_in_default>
|
1711 |
+
<show_in_website>1</show_in_website>
|
1712 |
+
<show_in_store>0</show_in_store>
|
1713 |
+
</free_shipping_subtotal>
|
1714 |
+
<application_fee translate="label">
|
1715 |
+
<label>Application Fee</label>
|
1716 |
+
<frontend_type>text</frontend_type>
|
1717 |
+
<sort_order>40</sort_order>
|
1718 |
+
<show_in_default>1</show_in_default>
|
1719 |
+
<show_in_website>1</show_in_website>
|
1720 |
+
<show_in_store>1</show_in_store>
|
1721 |
+
</application_fee>
|
1722 |
+
<handling_fee translate="label">
|
1723 |
+
<label>Handling Fee</label>
|
1724 |
+
<frontend_type>text</frontend_type>
|
1725 |
+
<sort_order>50</sort_order>
|
1726 |
+
<show_in_default>1</show_in_default>
|
1727 |
+
<show_in_website>1</show_in_website>
|
1728 |
+
<show_in_store>1</show_in_store>
|
1729 |
+
</handling_fee>
|
1730 |
+
<rdv_config translate="label">
|
1731 |
+
<label>Configuration RDV</label>
|
1732 |
+
<frontend_type>text</frontend_type>
|
1733 |
+
<frontend_model>chronorelais/adminhtml_system_config_rdvconfig</frontend_model>
|
1734 |
+
<sort_order>55</sort_order>
|
1735 |
+
<show_in_default>1</show_in_default>
|
1736 |
+
<show_in_website>1</show_in_website>
|
1737 |
+
<show_in_store>1</show_in_store>
|
1738 |
+
</rdv_config>
|
1739 |
+
<logo_url>
|
1740 |
+
<label>Logo Url</label>
|
1741 |
+
<frontend_type>text</frontend_type>
|
1742 |
+
<comment>{logo_ulr_help}</comment>
|
1743 |
+
<sort_order>60</sort_order>
|
1744 |
+
<show_in_default>1</show_in_default>
|
1745 |
+
<show_in_website>1</show_in_website>
|
1746 |
+
<show_in_store>1</show_in_store>
|
1747 |
+
</logo_url>
|
1748 |
+
<debug>
|
1749 |
+
<label>Debug</label>
|
1750 |
+
<comment>{debug_help}</comment>
|
1751 |
+
<frontend_type>text</frontend_type>
|
1752 |
+
<sort_order>70</sort_order>
|
1753 |
+
<show_in_default>1</show_in_default>
|
1754 |
+
<show_in_website>1</show_in_website>
|
1755 |
+
<show_in_store>1</show_in_store>
|
1756 |
+
</debug>
|
1757 |
+
<!--<stop_to_first_match translate="label">
|
1758 |
+
<label>Stop to first match</label>
|
1759 |
+
<frontend_type>select</frontend_type>
|
1760 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1761 |
+
<sort_order>80</sort_order>
|
1762 |
+
<show_in_default>1</show_in_default>
|
1763 |
+
<show_in_website>1</show_in_website>
|
1764 |
+
<show_in_store>1</show_in_store>
|
1765 |
+
</stop_to_first_match>-->
|
1766 |
+
<deliver_on_saturday translate="label comment">
|
1767 |
+
<label>Livraison le Samedi</label>
|
1768 |
+
<frontend_type>select</frontend_type>
|
1769 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1770 |
+
<sort_order>90</sort_order>
|
1771 |
+
<show_in_default>1</show_in_default>
|
1772 |
+
<show_in_website>1</show_in_website>
|
1773 |
+
<show_in_store>1</show_in_store>
|
1774 |
+
</deliver_on_saturday>
|
1775 |
+
<!--<showmethod translate="label">
|
1776 |
+
<label>Show Method if Not Applicable</label>
|
1777 |
+
<frontend_type>select</frontend_type>
|
1778 |
+
<sort_order>100</sort_order>
|
1779 |
+
<frontend_class>shipping-skip-hide</frontend_class>
|
1780 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
1781 |
+
<show_in_default>1</show_in_default>
|
1782 |
+
<show_in_website>1</show_in_website>
|
1783 |
+
<show_in_store>0</show_in_store>
|
1784 |
+
</showmethod>
|
1785 |
+
<specificerrmsg translate="label">
|
1786 |
+
<label>Displayed Error Message</label>
|
1787 |
+
<frontend_type>textarea</frontend_type>
|
1788 |
+
<sort_order>110</sort_order>
|
1789 |
+
<show_in_default>1</show_in_default>
|
1790 |
+
<show_in_website>1</show_in_website>
|
1791 |
+
<show_in_store>1</show_in_store>
|
1792 |
+
</specificerrmsg>-->
|
1793 |
+
<sort_order translate="label">
|
1794 |
+
<label>Sort order</label>
|
1795 |
+
<frontend_type>text</frontend_type>
|
1796 |
+
<sort_order>120</sort_order>
|
1797 |
+
<show_in_default>1</show_in_default>
|
1798 |
+
<show_in_website>1</show_in_website>
|
1799 |
+
<show_in_store>1</show_in_store>
|
1800 |
+
</sort_order>
|
1801 |
+
</fields>
|
1802 |
+
</chronopostsrdv>
|
1803 |
+
|
1804 |
+
</groups>
|
1805 |
+
</carriers>
|
1806 |
+
</sections>
|
1807 |
+
|
1808 |
+
<sections>
|
1809 |
+
<chronorelais>
|
1810 |
+
<label>Configuration</label>
|
1811 |
+
<tab>chronopost</tab>
|
1812 |
+
<frontend_type>text</frontend_type>
|
1813 |
+
<sort_order>2000</sort_order>
|
1814 |
+
<show_in_default>1</show_in_default>
|
1815 |
+
<show_in_website>1</show_in_website>
|
1816 |
+
<show_in_store>1</show_in_store>
|
1817 |
+
<groups>
|
1818 |
+
<shipping translate="label">
|
1819 |
+
<label>General</label>
|
1820 |
+
<frontend_type>text</frontend_type>
|
1821 |
+
<sort_order>10</sort_order>
|
1822 |
+
<show_in_default>1</show_in_default>
|
1823 |
+
<show_in_website>1</show_in_website>
|
1824 |
+
<show_in_store>1</show_in_store>
|
1825 |
+
<fields>
|
1826 |
+
<account_number translate="label">
|
1827 |
+
<label>N° de compte Chronopost</label>
|
1828 |
+
<frontend_type>text</frontend_type>
|
1829 |
+
<sort_order>7</sort_order>
|
1830 |
+
<show_in_default>1</show_in_default>
|
1831 |
+
<show_in_website>1</show_in_website>
|
1832 |
+
<show_in_store>1</show_in_store>
|
1833 |
+
</account_number>
|
1834 |
+
<sub_account_number translate="label">
|
1835 |
+
<label>N° de sous-compte</label>
|
1836 |
+
<comment>must be 3 digits or empty</comment>
|
1837 |
+
<frontend_type>text</frontend_type>
|
1838 |
+
<sort_order>8</sort_order>
|
1839 |
+
<show_in_default>1</show_in_default>
|
1840 |
+
<show_in_website>1</show_in_website>
|
1841 |
+
<show_in_store>1</show_in_store>
|
1842 |
+
</sub_account_number>
|
1843 |
+
<account_pass translate="label">
|
1844 |
+
<label>Mot de passe Chronopost</label>
|
1845 |
+
<frontend_type>text</frontend_type>
|
1846 |
+
<button_label>Vérifier mes identifiants</button_label>
|
1847 |
+
<frontend_model>chronorelais/adminhtml_system_config_checklogin</frontend_model>
|
1848 |
+
<sort_order>9</sort_order>
|
1849 |
+
<show_in_default>1</show_in_default>
|
1850 |
+
<show_in_website>1</show_in_website>
|
1851 |
+
<show_in_store>1</show_in_store>
|
1852 |
+
</account_pass>
|
1853 |
+
<google_map_api translate="label">
|
1854 |
+
<label>Google Map v3 API Key</label>
|
1855 |
+
<comment>The Google Maps JavaScript API Version 2 has been officially deprecated. Please use v3 API now. Get your key at https://code.google.com/apis/console/.</comment>
|
1856 |
+
<frontend_type>text</frontend_type>
|
1857 |
+
<sort_order>10</sort_order>
|
1858 |
+
<show_in_default>1</show_in_default>
|
1859 |
+
<show_in_website>1</show_in_website>
|
1860 |
+
<show_in_store>1</show_in_store>
|
1861 |
+
</google_map_api>
|
1862 |
+
<tracking_view_url translate="label">
|
1863 |
+
<label>Tracking URL</label>
|
1864 |
+
<comment>For English language, replace fr_FR with en_GB in the above url</comment>
|
1865 |
+
<frontend_type>text</frontend_type>
|
1866 |
+
<sort_order>20</sort_order>
|
1867 |
+
<show_in_default>1</show_in_default>
|
1868 |
+
<show_in_website>1</show_in_website>
|
1869 |
+
<show_in_store>1</show_in_store>
|
1870 |
+
</tracking_view_url>
|
1871 |
+
<gs_path translate="label">
|
1872 |
+
<label>Chemin GS</label>
|
1873 |
+
<comment>Chemin d'accès à la commande gs (Ghostscript)</comment>
|
1874 |
+
<frontend_type>text</frontend_type>
|
1875 |
+
<sort_order>21</sort_order>
|
1876 |
+
<show_in_default>1</show_in_default>
|
1877 |
+
<show_in_website>0</show_in_website>
|
1878 |
+
<show_in_store>0</show_in_store>
|
1879 |
+
</gs_path>
|
1880 |
+
|
1881 |
+
</fields>
|
1882 |
+
</shipping>
|
1883 |
+
<export_css translate="label">
|
1884 |
+
<label>Export Configuration CSS</label>
|
1885 |
+
<frontend_type>text</frontend_type>
|
1886 |
+
<sort_order>20</sort_order>
|
1887 |
+
<show_in_default>1</show_in_default>
|
1888 |
+
<show_in_website>1</show_in_website>
|
1889 |
+
<show_in_store>1</show_in_store>
|
1890 |
+
<fields>
|
1891 |
+
<file_extension translate="label">
|
1892 |
+
<label>File Extension</label>
|
1893 |
+
<frontend_type>select</frontend_type>
|
1894 |
+
<source_model>chronorelais/config_source_fileExtension</source_model>
|
1895 |
+
<sort_order>10</sort_order>
|
1896 |
+
<show_in_default>1</show_in_default>
|
1897 |
+
<show_in_website>1</show_in_website>
|
1898 |
+
<show_in_store>1</show_in_store>
|
1899 |
+
</file_extension>
|
1900 |
+
<file_charset translate="label">
|
1901 |
+
<label>File Charset</label>
|
1902 |
+
<frontend_type>select</frontend_type>
|
1903 |
+
<source_model>chronorelais/config_source_fileCharset</source_model>
|
1904 |
+
<sort_order>20</sort_order>
|
1905 |
+
<show_in_default>1</show_in_default>
|
1906 |
+
<show_in_website>1</show_in_website>
|
1907 |
+
<show_in_store>1</show_in_store>
|
1908 |
+
</file_charset>
|
1909 |
+
<endofline_character translate="label">
|
1910 |
+
<label>End Of Line Character</label>
|
1911 |
+
<frontend_type>select</frontend_type>
|
1912 |
+
<source_model>chronorelais/config_source_endOfLineCharacter</source_model>
|
1913 |
+
<sort_order>30</sort_order>
|
1914 |
+
<show_in_default>1</show_in_default>
|
1915 |
+
<show_in_website>1</show_in_website>
|
1916 |
+
<show_in_store>1</show_in_store>
|
1917 |
+
</endofline_character>
|
1918 |
+
<field_delimiter translate="label">
|
1919 |
+
<label>Field Delimiter</label>
|
1920 |
+
<frontend_type>select</frontend_type>
|
1921 |
+
<source_model>chronorelais/config_source_fieldDelimiter</source_model>
|
1922 |
+
<sort_order>40</sort_order>
|
1923 |
+
<show_in_default>1</show_in_default>
|
1924 |
+
<show_in_website>1</show_in_website>
|
1925 |
+
<show_in_store>1</show_in_store>
|
1926 |
+
</field_delimiter>
|
1927 |
+
<field_separator translate="label">
|
1928 |
+
<label>Field Separator</label>
|
1929 |
+
<frontend_type>select</frontend_type>
|
1930 |
+
<source_model>chronorelais/config_source_fieldSeparator</source_model>
|
1931 |
+
<sort_order>50</sort_order>
|
1932 |
+
<show_in_default>1</show_in_default>
|
1933 |
+
<show_in_website>1</show_in_website>
|
1934 |
+
<show_in_store>1</show_in_store>
|
1935 |
+
</field_separator>
|
1936 |
+
</fields>
|
1937 |
+
</export_css>
|
1938 |
+
<export_cso translate="label">
|
1939 |
+
<label>Export Configuration CSO</label>
|
1940 |
+
<frontend_type>text</frontend_type>
|
1941 |
+
<sort_order>21</sort_order>
|
1942 |
+
<show_in_default>1</show_in_default>
|
1943 |
+
<show_in_website>1</show_in_website>
|
1944 |
+
<show_in_store>1</show_in_store>
|
1945 |
+
<fields>
|
1946 |
+
<file_extension translate="label">
|
1947 |
+
<label>File Extension</label>
|
1948 |
+
<frontend_type>select</frontend_type>
|
1949 |
+
<source_model>chronorelais/config_source_fileExtension</source_model>
|
1950 |
+
<sort_order>10</sort_order>
|
1951 |
+
<show_in_default>1</show_in_default>
|
1952 |
+
<show_in_website>1</show_in_website>
|
1953 |
+
<show_in_store>1</show_in_store>
|
1954 |
+
</file_extension>
|
1955 |
+
<file_charset translate="label">
|
1956 |
+
<label>File Charset</label>
|
1957 |
+
<frontend_type>select</frontend_type>
|
1958 |
+
<source_model>chronorelais/config_source_fileCharset</source_model>
|
1959 |
+
<sort_order>20</sort_order>
|
1960 |
+
<show_in_default>1</show_in_default>
|
1961 |
+
<show_in_website>1</show_in_website>
|
1962 |
+
<show_in_store>1</show_in_store>
|
1963 |
+
</file_charset>
|
1964 |
+
<endofline_character translate="label">
|
1965 |
+
<label>End Of Line Character</label>
|
1966 |
+
<frontend_type>select</frontend_type>
|
1967 |
+
<source_model>chronorelais/config_source_endOfLineCharacter</source_model>
|
1968 |
+
<sort_order>30</sort_order>
|
1969 |
+
<show_in_default>1</show_in_default>
|
1970 |
+
<show_in_website>1</show_in_website>
|
1971 |
+
<show_in_store>1</show_in_store>
|
1972 |
+
</endofline_character>
|
1973 |
+
<field_delimiter translate="label">
|
1974 |
+
<label>Field Delimiter</label>
|
1975 |
+
<frontend_type>select</frontend_type>
|
1976 |
+
<source_model>chronorelais/config_source_fieldDelimiter</source_model>
|
1977 |
+
<sort_order>40</sort_order>
|
1978 |
+
<show_in_default>1</show_in_default>
|
1979 |
+
<show_in_website>1</show_in_website>
|
1980 |
+
<show_in_store>1</show_in_store>
|
1981 |
+
</field_delimiter>
|
1982 |
+
<field_separator translate="label">
|
1983 |
+
<label>Field Separator</label>
|
1984 |
+
<frontend_type>select</frontend_type>
|
1985 |
+
<source_model>chronorelais/config_source_fieldSeparator</source_model>
|
1986 |
+
<sort_order>50</sort_order>
|
1987 |
+
<show_in_default>1</show_in_default>
|
1988 |
+
<show_in_website>1</show_in_website>
|
1989 |
+
<show_in_store>1</show_in_store>
|
1990 |
+
</field_separator>
|
1991 |
+
</fields>
|
1992 |
+
</export_cso>
|
1993 |
+
<import translate="label">
|
1994 |
+
<label>Import Configuration</label>
|
1995 |
+
<frontend_type>text</frontend_type>
|
1996 |
+
<sort_order>30</sort_order>
|
1997 |
+
<show_in_default>1</show_in_default>
|
1998 |
+
<show_in_website>1</show_in_website>
|
1999 |
+
<show_in_store>1</show_in_store>
|
2000 |
+
<fields>
|
2001 |
+
<default_tracking_title translate="label comment">
|
2002 |
+
<label>Default Tracking Title</label>
|
2003 |
+
<frontend_type>text</frontend_type>
|
2004 |
+
<sort_order>10</sort_order>
|
2005 |
+
<show_in_default>1</show_in_default>
|
2006 |
+
<show_in_website>1</show_in_website>
|
2007 |
+
<show_in_store>1</show_in_store>
|
2008 |
+
<comment>This value can be changed in the import form</comment>
|
2009 |
+
</default_tracking_title>
|
2010 |
+
<send_email translate="label comment">
|
2011 |
+
<label>Send an e-mail</label>
|
2012 |
+
<frontend_type>select</frontend_type>
|
2013 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
2014 |
+
<sort_order>20</sort_order>
|
2015 |
+
<show_in_default>1</show_in_default>
|
2016 |
+
<show_in_website>1</show_in_website>
|
2017 |
+
<show_in_store>1</show_in_store>
|
2018 |
+
<comment>Send shipping confirmation to the customer</comment>
|
2019 |
+
</send_email>
|
2020 |
+
<shipping_comment translate="label comment">
|
2021 |
+
<label>Shipping Comment</label>
|
2022 |
+
<frontend_type>text</frontend_type>
|
2023 |
+
<sort_order>30</sort_order>
|
2024 |
+
<show_in_default>1</show_in_default>
|
2025 |
+
<show_in_website>1</show_in_website>
|
2026 |
+
<show_in_store>1</show_in_store>
|
2027 |
+
<comment>Internal comment, can be left empty</comment>
|
2028 |
+
</shipping_comment>
|
2029 |
+
<include_comment translate="label comment">
|
2030 |
+
<label>Include comment into e-mail</label>
|
2031 |
+
<frontend_type>select</frontend_type>
|
2032 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
2033 |
+
<sort_order>40</sort_order>
|
2034 |
+
<show_in_default>1</show_in_default>
|
2035 |
+
<show_in_website>1</show_in_website>
|
2036 |
+
<show_in_store>1</show_in_store>
|
2037 |
+
<comment>Only applies if the shipping comment is set</comment>
|
2038 |
+
</include_comment>
|
2039 |
+
</fields>
|
2040 |
+
</import>
|
2041 |
+
|
2042 |
+
<shipperinformation translate="label">
|
2043 |
+
<label>Shipper Information for Labels printing</label>
|
2044 |
+
<frontend_type>text</frontend_type>
|
2045 |
+
<sort_order>40</sort_order>
|
2046 |
+
<show_in_default>1</show_in_default>
|
2047 |
+
<show_in_website>1</show_in_website>
|
2048 |
+
<show_in_store>1</show_in_store>
|
2049 |
+
<fields>
|
2050 |
+
<civility translate="label">
|
2051 |
+
<label>Shipper Civility</label>
|
2052 |
+
<frontend_type>select</frontend_type>
|
2053 |
+
<source_model>chronorelais/config_source_civility</source_model>
|
2054 |
+
<sort_order>10</sort_order>
|
2055 |
+
<show_in_default>1</show_in_default>
|
2056 |
+
<show_in_website>1</show_in_website>
|
2057 |
+
<show_in_store>1</show_in_store>
|
2058 |
+
</civility>
|
2059 |
+
<name translate="label comment">
|
2060 |
+
<label>Shipper Name</label>
|
2061 |
+
<frontend_type>text</frontend_type>
|
2062 |
+
<sort_order>20</sort_order>
|
2063 |
+
<show_in_default>1</show_in_default>
|
2064 |
+
<show_in_website>1</show_in_website>
|
2065 |
+
<show_in_store>1</show_in_store>
|
2066 |
+
<comment>Company name</comment>
|
2067 |
+
</name>
|
2068 |
+
<name2 translate="label comment">
|
2069 |
+
<label>Shipper Name2</label>
|
2070 |
+
<frontend_type>text</frontend_type>
|
2071 |
+
<sort_order>30</sort_order>
|
2072 |
+
<show_in_default>1</show_in_default>
|
2073 |
+
<show_in_website>1</show_in_website>
|
2074 |
+
<show_in_store>1</show_in_store>
|
2075 |
+
<comment>[Optional]</comment>
|
2076 |
+
</name2>
|
2077 |
+
<address1 translate="label">
|
2078 |
+
<label>Shipper Address1</label>
|
2079 |
+
<frontend_type>text</frontend_type>
|
2080 |
+
<sort_order>40</sort_order>
|
2081 |
+
<show_in_default>1</show_in_default>
|
2082 |
+
<show_in_website>1</show_in_website>
|
2083 |
+
<show_in_store>1</show_in_store>
|
2084 |
+
</address1>
|
2085 |
+
<address2 translate="label comment">
|
2086 |
+
<label>Shipper Address2</label>
|
2087 |
+
<frontend_type>text</frontend_type>
|
2088 |
+
<sort_order>50</sort_order>
|
2089 |
+
<show_in_default>1</show_in_default>
|
2090 |
+
<show_in_website>1</show_in_website>
|
2091 |
+
<show_in_store>1</show_in_store>
|
2092 |
+
<comment>[Optional]</comment>
|
2093 |
+
</address2>
|
2094 |
+
<zipcode translate="label">
|
2095 |
+
<label>Shipper Zipcode</label>
|
2096 |
+
<frontend_type>text</frontend_type>
|
2097 |
+
<sort_order>60</sort_order>
|
2098 |
+
<show_in_default>1</show_in_default>
|
2099 |
+
<show_in_website>1</show_in_website>
|
2100 |
+
<show_in_store>1</show_in_store>
|
2101 |
+
</zipcode>
|
2102 |
+
<city translate="label">
|
2103 |
+
<label>Shipper City</label>
|
2104 |
+
<frontend_type>text</frontend_type>
|
2105 |
+
<sort_order>70</sort_order>
|
2106 |
+
<show_in_default>1</show_in_default>
|
2107 |
+
<show_in_website>1</show_in_website>
|
2108 |
+
<show_in_store>1</show_in_store>
|
2109 |
+
</city>
|
2110 |
+
<country translate="label">
|
2111 |
+
<label>Shipper Country</label>
|
2112 |
+
<frontend_type>select</frontend_type>
|
2113 |
+
<sort_order>80</sort_order>
|
2114 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
2115 |
+
<show_in_default>1</show_in_default>
|
2116 |
+
<show_in_website>1</show_in_website>
|
2117 |
+
<show_in_store>1</show_in_store>
|
2118 |
+
</country>
|
2119 |
+
<contactname translate="label">
|
2120 |
+
<label>Shipper Contact Name</label>
|
2121 |
+
<frontend_type>text</frontend_type>
|
2122 |
+
<sort_order>90</sort_order>
|
2123 |
+
<show_in_default>1</show_in_default>
|
2124 |
+
<show_in_website>1</show_in_website>
|
2125 |
+
<show_in_store>1</show_in_store>
|
2126 |
+
</contactname>
|
2127 |
+
<email translate="label">
|
2128 |
+
<label>Shipper Email</label>
|
2129 |
+
<frontend_type>text</frontend_type>
|
2130 |
+
<sort_order>100</sort_order>
|
2131 |
+
<show_in_default>1</show_in_default>
|
2132 |
+
<show_in_website>1</show_in_website>
|
2133 |
+
<show_in_store>1</show_in_store>
|
2134 |
+
<comment>[Optional]</comment>
|
2135 |
+
</email>
|
2136 |
+
<phone translate="label comment">
|
2137 |
+
<label>Shipper Telephone</label>
|
2138 |
+
<frontend_type>text</frontend_type>
|
2139 |
+
<sort_order>110</sort_order>
|
2140 |
+
<show_in_default>1</show_in_default>
|
2141 |
+
<show_in_website>1</show_in_website>
|
2142 |
+
<show_in_store>1</show_in_store>
|
2143 |
+
<comment>[Optional]</comment>
|
2144 |
+
</phone>
|
2145 |
+
<mobilephone translate="label comment">
|
2146 |
+
<label>Shipper Mobile</label>
|
2147 |
+
<frontend_type>text</frontend_type>
|
2148 |
+
<sort_order>120</sort_order>
|
2149 |
+
<show_in_default>1</show_in_default>
|
2150 |
+
<show_in_website>1</show_in_website>
|
2151 |
+
<show_in_store>1</show_in_store>
|
2152 |
+
<comment>[Optional]</comment>
|
2153 |
+
</mobilephone>
|
2154 |
+
</fields>
|
2155 |
+
</shipperinformation>
|
2156 |
+
|
2157 |
+
<customerinformation translate="label">
|
2158 |
+
<label>Chronopost Customer Account Information for Labels printing</label>
|
2159 |
+
<frontend_type>text</frontend_type>
|
2160 |
+
<sort_order>50</sort_order>
|
2161 |
+
<show_in_default>1</show_in_default>
|
2162 |
+
<show_in_website>1</show_in_website>
|
2163 |
+
<show_in_store>1</show_in_store>
|
2164 |
+
<fields>
|
2165 |
+
<civility translate="label">
|
2166 |
+
<label>Customer Civility</label>
|
2167 |
+
<frontend_type>select</frontend_type>
|
2168 |
+
<source_model>chronorelais/config_source_civility</source_model>
|
2169 |
+
<sort_order>10</sort_order>
|
2170 |
+
<show_in_default>1</show_in_default>
|
2171 |
+
<show_in_website>1</show_in_website>
|
2172 |
+
<show_in_store>1</show_in_store>
|
2173 |
+
</civility>
|
2174 |
+
<name translate="label comment">
|
2175 |
+
<label>Customer Name </label>
|
2176 |
+
<frontend_type>text</frontend_type>
|
2177 |
+
<sort_order>20</sort_order>
|
2178 |
+
<show_in_default>1</show_in_default>
|
2179 |
+
<show_in_website>1</show_in_website>
|
2180 |
+
<show_in_store>1</show_in_store>
|
2181 |
+
<comment>Company name</comment>
|
2182 |
+
</name>
|
2183 |
+
<name2 translate="label comment">
|
2184 |
+
<label>Customer Name2</label>
|
2185 |
+
<frontend_type>text</frontend_type>
|
2186 |
+
<sort_order>30</sort_order>
|
2187 |
+
<show_in_default>1</show_in_default>
|
2188 |
+
<show_in_website>1</show_in_website>
|
2189 |
+
<show_in_store>1</show_in_store>
|
2190 |
+
<comment>[Optional]</comment>
|
2191 |
+
</name2>
|
2192 |
+
<address1 translate="label">
|
2193 |
+
<label>Customer Address1</label>
|
2194 |
+
<frontend_type>text</frontend_type>
|
2195 |
+
<sort_order>40</sort_order>
|
2196 |
+
<show_in_default>1</show_in_default>
|
2197 |
+
<show_in_website>1</show_in_website>
|
2198 |
+
<show_in_store>1</show_in_store>
|
2199 |
+
</address1>
|
2200 |
+
<address2 translate="label comment">
|
2201 |
+
<label>Customer Address2</label>
|
2202 |
+
<frontend_type>text</frontend_type>
|
2203 |
+
<sort_order>50</sort_order>
|
2204 |
+
<show_in_default>1</show_in_default>
|
2205 |
+
<show_in_website>1</show_in_website>
|
2206 |
+
<show_in_store>1</show_in_store>
|
2207 |
+
<comment>[Optional]</comment>
|
2208 |
+
</address2>
|
2209 |
+
<zipcode translate="label">
|
2210 |
+
<label>Customer Zipcode</label>
|
2211 |
+
<frontend_type>text</frontend_type>
|
2212 |
+
<sort_order>60</sort_order>
|
2213 |
+
<show_in_default>1</show_in_default>
|
2214 |
+
<show_in_website>1</show_in_website>
|
2215 |
+
<show_in_store>1</show_in_store>
|
2216 |
+
</zipcode>
|
2217 |
+
<city translate="label">
|
2218 |
+
<label>Customer City</label>
|
2219 |
+
<frontend_type>text</frontend_type>
|
2220 |
+
<sort_order>70</sort_order>
|
2221 |
+
<show_in_default>1</show_in_default>
|
2222 |
+
<show_in_website>1</show_in_website>
|
2223 |
+
<show_in_store>1</show_in_store>
|
2224 |
+
</city>
|
2225 |
+
<country translate="label">
|
2226 |
+
<label>Customer Country</label>
|
2227 |
+
<frontend_type>select</frontend_type>
|
2228 |
+
<sort_order>80</sort_order>
|
2229 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
2230 |
+
<show_in_default>1</show_in_default>
|
2231 |
+
<show_in_website>1</show_in_website>
|
2232 |
+
<show_in_store>1</show_in_store>
|
2233 |
+
</country>
|
2234 |
+
<contactname translate="label">
|
2235 |
+
<label>Customer Contact Name</label>
|
2236 |
+
<frontend_type>text</frontend_type>
|
2237 |
+
<sort_order>90</sort_order>
|
2238 |
+
<show_in_default>1</show_in_default>
|
2239 |
+
<show_in_website>1</show_in_website>
|
2240 |
+
<show_in_store>1</show_in_store>
|
2241 |
+
</contactname>
|
2242 |
+
<email translate="label">
|
2243 |
+
<label>Customer Email</label>
|
2244 |
+
<frontend_type>text</frontend_type>
|
2245 |
+
<sort_order>100</sort_order>
|
2246 |
+
<show_in_default>1</show_in_default>
|
2247 |
+
<show_in_website>1</show_in_website>
|
2248 |
+
<show_in_store>1</show_in_store>
|
2249 |
+
<comment>[Optional]</comment>
|
2250 |
+
</email>
|
2251 |
+
<phone translate="label comment">
|
2252 |
+
<label>Customer Telephone</label>
|
2253 |
+
<frontend_type>text</frontend_type>
|
2254 |
+
<sort_order>110</sort_order>
|
2255 |
+
<show_in_default>1</show_in_default>
|
2256 |
+
<show_in_website>1</show_in_website>
|
2257 |
+
<show_in_store>1</show_in_store>
|
2258 |
+
<comment>[Optional]</comment>
|
2259 |
+
</phone>
|
2260 |
+
<mobilephone translate="label comment">
|
2261 |
+
<label>Customer Mobile</label>
|
2262 |
+
<frontend_type>text</frontend_type>
|
2263 |
+
<sort_order>120</sort_order>
|
2264 |
+
<show_in_default>1</show_in_default>
|
2265 |
+
<show_in_website>1</show_in_website>
|
2266 |
+
<show_in_store>1</show_in_store>
|
2267 |
+
<comment>[Optional]</comment>
|
2268 |
+
</mobilephone>
|
2269 |
+
</fields>
|
2270 |
+
</customerinformation>
|
2271 |
+
|
2272 |
+
<skybillparam translate="label">
|
2273 |
+
<label>Skybill Parameters for Labels printing</label>
|
2274 |
+
<frontend_type>text</frontend_type>
|
2275 |
+
<sort_order>60</sort_order>
|
2276 |
+
<show_in_default>1</show_in_default>
|
2277 |
+
<show_in_website>1</show_in_website>
|
2278 |
+
<show_in_store>1</show_in_store>
|
2279 |
+
<fields>
|
2280 |
+
<mode translate="label">
|
2281 |
+
<label>Print Mode</label>
|
2282 |
+
<frontend_type>select</frontend_type>
|
2283 |
+
<source_model>chronorelais/config_source_printMode</source_model>
|
2284 |
+
<sort_order>10</sort_order>
|
2285 |
+
<show_in_default>1</show_in_default>
|
2286 |
+
<show_in_website>1</show_in_website>
|
2287 |
+
<show_in_store>1</show_in_store>
|
2288 |
+
<required>1</required>
|
2289 |
+
</mode>
|
2290 |
+
</fields>
|
2291 |
+
</skybillparam>
|
2292 |
+
|
2293 |
+
<weightunit translate="label">
|
2294 |
+
<label>Weight unit for the store</label>
|
2295 |
+
<frontend_type>text</frontend_type>
|
2296 |
+
<sort_order>70</sort_order>
|
2297 |
+
<show_in_default>1</show_in_default>
|
2298 |
+
<show_in_website>1</show_in_website>
|
2299 |
+
<show_in_store>1</show_in_store>
|
2300 |
+
<fields>
|
2301 |
+
<unit translate="label">
|
2302 |
+
<label>Weight unit</label>
|
2303 |
+
<frontend_type>select</frontend_type>
|
2304 |
+
<source_model>chronorelais/config_source_weightUnit</source_model>
|
2305 |
+
<sort_order>10</sort_order>
|
2306 |
+
<show_in_default>1</show_in_default>
|
2307 |
+
<show_in_website>1</show_in_website>
|
2308 |
+
<show_in_store>1</show_in_store>
|
2309 |
+
<required>1</required>
|
2310 |
+
</unit>
|
2311 |
+
</fields>
|
2312 |
+
</weightunit>
|
2313 |
+
|
2314 |
+
<optionbal translate="label">
|
2315 |
+
<label>Option BAL</label>
|
2316 |
+
<frontend_type>text</frontend_type>
|
2317 |
+
<sort_order>80</sort_order>
|
2318 |
+
<show_in_default>1</show_in_default>
|
2319 |
+
<show_in_website>1</show_in_website>
|
2320 |
+
<show_in_store>1</show_in_store>
|
2321 |
+
<fields>
|
2322 |
+
<enabled translate="label">
|
2323 |
+
<label>Activer l'option BAL de Chronopost</label>
|
2324 |
+
<frontend_type>select</frontend_type>
|
2325 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
2326 |
+
<comment>Vérifiez que cette option figure dans votre contrat</comment>
|
2327 |
+
<sort_order>10</sort_order>
|
2328 |
+
<show_in_default>1</show_in_default>
|
2329 |
+
<show_in_website>1</show_in_website>
|
2330 |
+
<show_in_store>1</show_in_store>
|
2331 |
+
<required>1</required>
|
2332 |
+
</enabled>
|
2333 |
+
</fields>
|
2334 |
+
</optionbal>
|
2335 |
+
|
2336 |
+
<assurance translate="label">
|
2337 |
+
<label>Assurance Ad Valorem</label>
|
2338 |
+
<frontend_type>text</frontend_type>
|
2339 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_fieldsetassurance</frontend_model>
|
2340 |
+
<sort_order>90</sort_order>
|
2341 |
+
<show_in_default>1</show_in_default>
|
2342 |
+
<show_in_website>1</show_in_website>
|
2343 |
+
<show_in_store>1</show_in_store>
|
2344 |
+
<fields>
|
2345 |
+
<enabled translate="label">
|
2346 |
+
<label>Activer l'Ad Valorem</label>
|
2347 |
+
<frontend_type>select</frontend_type>
|
2348 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
2349 |
+
<sort_order>1</sort_order>
|
2350 |
+
<show_in_default>1</show_in_default>
|
2351 |
+
<show_in_website>1</show_in_website>
|
2352 |
+
<show_in_store>1</show_in_store>
|
2353 |
+
<required>1</required>
|
2354 |
+
</enabled>
|
2355 |
+
<amount translate="label">
|
2356 |
+
<label>Montant minimum à assurer</label>
|
2357 |
+
<frontend_type>text</frontend_type>
|
2358 |
+
<sort_order>2</sort_order>
|
2359 |
+
<show_in_default>1</show_in_default>
|
2360 |
+
<show_in_website>1</show_in_website>
|
2361 |
+
<show_in_store>1</show_in_store>
|
2362 |
+
<required>0</required>
|
2363 |
+
<validate>validate-number</validate>
|
2364 |
+
</amount>
|
2365 |
+
</fields>
|
2366 |
+
</assurance>
|
2367 |
+
|
2368 |
+
<conflicts translate="label">
|
2369 |
+
<label>Vérificateur de conflits</label>
|
2370 |
+
<frontend_type>text</frontend_type>
|
2371 |
+
<frontend_model>chronorelais/adminhtml_system_config_form_fieldsetconflicts</frontend_model>
|
2372 |
+
<sort_order>100</sort_order>
|
2373 |
+
<show_in_default>1</show_in_default>
|
2374 |
+
<show_in_website>1</show_in_website>
|
2375 |
+
<show_in_store>1</show_in_store>
|
2376 |
+
<comment>
|
2377 |
+
<![CDATA[
|
2378 |
+
Chronopost fournit cet outil de vérification de conflits avec d'autres modules. Il vérifie si d'autres modules suchargent les classes, modèles, helpers et controlleurs personnalisés par le module Chronopost.<br />
|
2379 |
+
Cet outil vise à vous faciliter le débogage en cas de dysfonctionnement. En cas de doute sur son utilisation, rapprochez-vous de votre agence, ou contactez le support technique Chronopost au 0825 885 866 (numéro Indigo).
|
2380 |
+
]]>
|
2381 |
+
</comment>
|
2382 |
+
<!--<fields>
|
2383 |
+
<conflicts translate="label">
|
2384 |
+
<label>Mot de passe Chronopost</label>
|
2385 |
+
<frontend_type>text</frontend_type>
|
2386 |
+
<button_label>Vérifier mes identifiants</button_label>
|
2387 |
+
<frontend_model>chronorelais/adminhtml_system_config_checklogin</frontend_model>
|
2388 |
+
<sort_order>9</sort_order>
|
2389 |
+
<show_in_default>1</show_in_default>
|
2390 |
+
<show_in_website>1</show_in_website>
|
2391 |
+
<show_in_store>1</show_in_store>
|
2392 |
+
</conflicts>
|
2393 |
+
</fields>-->
|
2394 |
+
</conflicts>
|
2395 |
+
|
2396 |
+
<saturday translate="label">
|
2397 |
+
<label>Option samedi</label>
|
2398 |
+
<frontend_type>text</frontend_type>
|
2399 |
+
<sort_order>110</sort_order>
|
2400 |
+
<show_in_default>1</show_in_default>
|
2401 |
+
<show_in_website>0</show_in_website>
|
2402 |
+
<show_in_store>0</show_in_store>
|
2403 |
+
<fields>
|
2404 |
+
<startday translate="label">
|
2405 |
+
<label>Option samedi activé du</label>
|
2406 |
+
<frontend_type>select</frontend_type>
|
2407 |
+
<frontend_model>chronorelais/adminhtml_form_renderer_config_date</frontend_model>
|
2408 |
+
<backend_model>chronorelais/config_backend_date</backend_model>
|
2409 |
+
<sort_order>1</sort_order>
|
2410 |
+
<show_in_default>1</show_in_default>
|
2411 |
+
<show_in_website>0</show_in_website>
|
2412 |
+
<show_in_store>0</show_in_store>
|
2413 |
+
<required>0</required>
|
2414 |
+
</startday>
|
2415 |
+
<endday translate="label">
|
2416 |
+
<label>Au</label>
|
2417 |
+
<frontend_type>select</frontend_type>
|
2418 |
+
<frontend_model>chronorelais/adminhtml_form_renderer_config_date</frontend_model>
|
2419 |
+
<backend_model>chronorelais/config_backend_date</backend_model>
|
2420 |
+
<sort_order>2</sort_order>
|
2421 |
+
<show_in_default>1</show_in_default>
|
2422 |
+
<show_in_website>0</show_in_website>
|
2423 |
+
<show_in_store>0</show_in_store>
|
2424 |
+
<required>0</required>
|
2425 |
+
</endday>
|
2426 |
+
</fields>
|
2427 |
+
</saturday>
|
2428 |
+
|
2429 |
+
</groups>
|
2430 |
+
</chronorelais>
|
2431 |
+
</sections>
|
2432 |
+
|
2433 |
+
</config>
|
app/code/community/Chronopost/Chronorelais/includes/ChronorelaisShippingHelper.php
CHANGED
@@ -1,1368 +1,1465 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Magento Chronopost Chronorelais Module
|
5 |
-
*
|
6 |
-
* NOTICE OF LICENSE
|
7 |
-
*
|
8 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
-
* that is bundled with this package in the file LICENSE.txt.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://opensource.org/licenses/osl-3.0.php
|
12 |
-
* If you did not receive a copy of the license and are unable to
|
13 |
-
* obtain it through the world-wide-web, please send an email
|
14 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
-
*
|
16 |
-
* @category Chronopost
|
17 |
-
* @package Chronopost_Chronorelais
|
18 |
-
* @copyright Copyright (c) 2008-10 Owebia (http://www.owebia.com/)
|
19 |
-
* @author Antoine Lemoine
|
20 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
-
*/
|
22 |
-
class ChronorelaisShippingHelper {
|
23 |
-
|
24 |
-
public static $DEBUG_INDEX_COUNTER = 0;
|
25 |
-
public static $FLOAT_REGEX = '[-]?\d+(?:[.]\d+)?';
|
26 |
-
public static $POSITIVE_FLOAT_REGEX = '\d+(?:[.]\d+)?';
|
27 |
-
public static $COUPLE_REGEX = '(?:[0-9.]+|\*) *(?:\[|\])? *\: *[0-9.]+';
|
28 |
-
public static $UNCOMPRESSED_STRINGS = array(
|
29 |
-
' product.attribute.',
|
30 |
-
' product.option.',
|
31 |
-
' product.stock.',
|
32 |
-
'{product.attribute.',
|
33 |
-
'{product.option.',
|
34 |
-
'{product.stock.',
|
35 |
-
'{product.weight}',
|
36 |
-
'{product.quantity}',
|
37 |
-
'{cart.weight}',
|
38 |
-
'{cart.quantity}',
|
39 |
-
'{cart.price_including_tax}',
|
40 |
-
'{cart.price_excluding_tax}',
|
41 |
-
'{cart.',
|
42 |
-
'{customvar.',
|
43 |
-
'{selection.weight}',
|
44 |
-
'{selection.quantity}',
|
45 |
-
'{selection.',
|
46 |
-
'{destination.country.',
|
47 |
-
'{foreach ',
|
48 |
-
'{/foreach}',
|
49 |
-
);
|
50 |
-
public static $COMPRESSED_STRINGS = array(
|
51 |
-
' p.a.',
|
52 |
-
' p.o.',
|
53 |
-
' p.s.',
|
54 |
-
'{p.a.',
|
55 |
-
'{p.o.',
|
56 |
-
'{p.s.',
|
57 |
-
'{p.w}',
|
58 |
-
'{p.qty}',
|
59 |
-
'{c.w}',
|
60 |
-
'{c.qty}',
|
61 |
-
'{c.pit}',
|
62 |
-
'{c.pet}',
|
63 |
-
'{c.',
|
64 |
-
'{v.',
|
65 |
-
'{s.w}',
|
66 |
-
'{s.qty}',
|
67 |
-
'{s.',
|
68 |
-
'{dest.ctry.',
|
69 |
-
'{each ',
|
70 |
-
'{/each}',
|
71 |
-
);
|
72 |
-
protected $_input;
|
73 |
-
protected $_config;
|
74 |
-
protected $_messages;
|
75 |
-
protected $_formula_cache;
|
76 |
-
protected $_expression_cache;
|
77 |
-
public $debug = 0;
|
78 |
-
public $debug_output = '';
|
79 |
-
public $debug_header = null;
|
80 |
-
|
81 |
-
public function ChronorelaisShippingHelper($input) {
|
82 |
-
$this->_formula_cache = array();
|
83 |
-
$this->_messages = array();
|
84 |
-
$this->_input = $input;
|
85 |
-
$this->_config = array();
|
86 |
-
$this->_parseInput();
|
87 |
-
}
|
88 |
-
|
89 |
-
private function debug($text, $level = 10) {
|
90 |
-
if ($this->debug >= $level)
|
91 |
-
$this->debug_output .= "<p>" . $text . "</p>";
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
. ".osh-
|
101 |
-
. ".osh-
|
102 |
-
. ".osh-
|
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 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
'
|
172 |
-
'
|
173 |
-
'
|
174 |
-
'
|
175 |
-
'
|
176 |
-
'
|
177 |
-
'
|
178 |
-
'
|
179 |
-
'
|
180 |
-
'
|
181 |
-
'
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
}
|
211 |
-
|
212 |
-
$
|
213 |
-
if (isset($
|
214 |
-
$
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
$
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
$
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
}
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
$
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
}
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
return
|
385 |
-
}
|
386 |
-
|
387 |
-
protected function
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
$
|
422 |
-
|
423 |
-
$
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
$this->
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
$
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
}
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
$
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
);
|
662 |
-
}
|
663 |
-
|
664 |
-
public function
|
665 |
-
if (preg_match_all("/{table (.*) in (" . self::$COUPLE_REGEX . "(?:, *" . self::$COUPLE_REGEX . ")*)}/
|
666 |
-
foreach ($result as $result_i) {
|
667 |
-
$fees_table = explode(',', $result_i[2]);
|
668 |
-
$
|
669 |
-
|
670 |
-
|
671 |
-
$last_char
|
672 |
-
|
673 |
-
$
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
$
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
$input = str_replace($result_i[1], trim($result_i[1]), $input);
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
$
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
case '
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
}
|
766 |
-
}
|
767 |
-
|
768 |
-
$
|
769 |
-
if (preg_match('/' . $
|
770 |
-
$this->addMessage('warning', $row, $key, 'Usage of deprecated syntax %s', '<span class="osh-formula">' . $resi[0] . '</span>');
|
771 |
-
while (preg_match('/' . $
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
if ($
|
865 |
-
$
|
866 |
-
|
867 |
-
$
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
$
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
$
|
880 |
-
if (
|
881 |
-
$
|
882 |
-
$
|
883 |
-
}
|
884 |
-
if (
|
885 |
-
$
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
$
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
$
|
946 |
-
|
947 |
-
|
948 |
-
$
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
$
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
$
|
995 |
-
if ($
|
996 |
-
$
|
997 |
-
|
998 |
-
$
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
$
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
$
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
$
|
1036 |
-
|
1037 |
-
$
|
1038 |
-
|
1039 |
-
|
1040 |
-
$
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
$
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
}
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
$
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
if (
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
$this->
|
1106 |
-
|
1107 |
-
$
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
$
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
$
|
1177 |
-
$
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
}
|
1182 |
-
if (
|
1183 |
-
$
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
if (
|
1192 |
-
$
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
if (
|
1271 |
-
$
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
$
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
$
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
}
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magento Chronopost Chronorelais Module
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Chronopost
|
17 |
+
* @package Chronopost_Chronorelais
|
18 |
+
* @copyright Copyright (c) 2008-10 Owebia (http://www.owebia.com/)
|
19 |
+
* @author Antoine Lemoine
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class ChronorelaisShippingHelper {
|
23 |
+
|
24 |
+
public static $DEBUG_INDEX_COUNTER = 0;
|
25 |
+
public static $FLOAT_REGEX = '[-]?\d+(?:[.]\d+)?';
|
26 |
+
public static $POSITIVE_FLOAT_REGEX = '\d+(?:[.]\d+)?';
|
27 |
+
public static $COUPLE_REGEX = '(?:[0-9.]+|\*) *(?:\[|\])? *\: *[0-9.]+';
|
28 |
+
public static $UNCOMPRESSED_STRINGS = array(
|
29 |
+
' product.attribute.',
|
30 |
+
' product.option.',
|
31 |
+
' product.stock.',
|
32 |
+
'{product.attribute.',
|
33 |
+
'{product.option.',
|
34 |
+
'{product.stock.',
|
35 |
+
'{product.weight}',
|
36 |
+
'{product.quantity}',
|
37 |
+
'{cart.weight}',
|
38 |
+
'{cart.quantity}',
|
39 |
+
'{cart.price_including_tax}',
|
40 |
+
'{cart.price_excluding_tax}',
|
41 |
+
'{cart.',
|
42 |
+
'{customvar.',
|
43 |
+
'{selection.weight}',
|
44 |
+
'{selection.quantity}',
|
45 |
+
'{selection.',
|
46 |
+
'{destination.country.',
|
47 |
+
'{foreach ',
|
48 |
+
'{/foreach}',
|
49 |
+
);
|
50 |
+
public static $COMPRESSED_STRINGS = array(
|
51 |
+
' p.a.',
|
52 |
+
' p.o.',
|
53 |
+
' p.s.',
|
54 |
+
'{p.a.',
|
55 |
+
'{p.o.',
|
56 |
+
'{p.s.',
|
57 |
+
'{p.w}',
|
58 |
+
'{p.qty}',
|
59 |
+
'{c.w}',
|
60 |
+
'{c.qty}',
|
61 |
+
'{c.pit}',
|
62 |
+
'{c.pet}',
|
63 |
+
'{c.',
|
64 |
+
'{v.',
|
65 |
+
'{s.w}',
|
66 |
+
'{s.qty}',
|
67 |
+
'{s.',
|
68 |
+
'{dest.ctry.',
|
69 |
+
'{each ',
|
70 |
+
'{/each}',
|
71 |
+
);
|
72 |
+
protected $_input;
|
73 |
+
protected $_config;
|
74 |
+
protected $_messages;
|
75 |
+
protected $_formula_cache;
|
76 |
+
protected $_expression_cache;
|
77 |
+
public $debug = 0;
|
78 |
+
public $debug_output = '';
|
79 |
+
public $debug_header = null;
|
80 |
+
|
81 |
+
public function ChronorelaisShippingHelper($input) {
|
82 |
+
$this->_formula_cache = array();
|
83 |
+
$this->_messages = array();
|
84 |
+
$this->_input = $input;
|
85 |
+
$this->_config = array();
|
86 |
+
$this->_parseInput();
|
87 |
+
}
|
88 |
+
|
89 |
+
private function debug($text, $level = 10) {
|
90 |
+
if ($this->debug >= $level) {
|
91 |
+
$this->debug_output .= "<p>" . $text . "</p>";
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
public function printDebug() {
|
96 |
+
if ($this->debug > 0) {
|
97 |
+
$index = static::$DEBUG_INDEX_COUNTER;
|
98 |
+
static::$DEBUG_INDEX_COUNTER++;
|
99 |
+
echo "<style rel=\"stylesheet\" type=\"text/css\">"
|
100 |
+
. ".osh-formula{color:#f90;} .osh-key{color:#0099f7;}"
|
101 |
+
. ".osh-error{color:#f00;} .osh-warning{color:#ff0;} .osh-info{color:#7bf700;}"
|
102 |
+
. ".osh-debug{background:#000;color:#bbb;position:absolute;top:0;left:0;width:100%;z-index:100;-moz-opacity:0.9;opacity:0.9;text-align:left;white-space:pre-wrap;}"
|
103 |
+
. ".osh-debug-content{padding:10px;}"
|
104 |
+
. ".osh-replacement{color:#ff3000;}"
|
105 |
+
. "</style>"
|
106 |
+
. "<div id=\"osh-debug-" . $index . "\" class=\"osh-debug\"><pre class=\"osh-debug-content\"><span style=\"float:right;cursor:pointer;\" onclick=\"document.getElementById('osh-debug-" . $index . "').style.display = 'none';\">[<span style=\"padding:0 5px;color:#f00;\">X</span>]</span>"
|
107 |
+
. "<p>" . $this->debug_header . "</p>" . $this->debug_output . "</pre></div>";
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
public function setDebugHeader($process) {
|
112 |
+
$header = 'DEBUG app/code/community/Chronopost/Chronorelais/Model/Carrier/ChronorelaisShippingHelper.php<br/>';
|
113 |
+
foreach ($process['data'] as $key => $data) {
|
114 |
+
$header .= ' <span class="osh-key">' . $key . '</span> = <span class="osh-formula">' . $this->_toString($data) . '</span><br/>';
|
115 |
+
}
|
116 |
+
$this->debug_header = $header;
|
117 |
+
}
|
118 |
+
|
119 |
+
public function getConfig() {
|
120 |
+
return $this->_config;
|
121 |
+
}
|
122 |
+
|
123 |
+
public function getMessages() {
|
124 |
+
$messages = $this->_messages;
|
125 |
+
$this->_messages = array();
|
126 |
+
return $messages;
|
127 |
+
}
|
128 |
+
|
129 |
+
public function formatConfig($compress) {
|
130 |
+
$output = '';
|
131 |
+
foreach ($this->_config as $row) {
|
132 |
+
if (!isset($row['lines'])) {
|
133 |
+
if (isset($row['*comment']['value'])) {
|
134 |
+
$output .= trim($row['*comment']['value']) . "\n";
|
135 |
+
}
|
136 |
+
$output .= '{' . ($compress ? '' : "\n");
|
137 |
+
foreach ($row as $key => $property) {
|
138 |
+
if (substr($key, 0, 1) != '*') {
|
139 |
+
$value = $property['value'];
|
140 |
+
if (isset($property['comment'])) {
|
141 |
+
$output .= ($compress ? '' : "\t") . '/* ' . $property['comment'] . ' */' . ($compress ? '' : "\n");
|
142 |
+
}
|
143 |
+
$output .= ($compress ? '' : "\t") . $key . ':' . ($compress ? '' : ' ');
|
144 |
+
if (is_bool($value)) {
|
145 |
+
$output .= $value ? 'true' : 'false';
|
146 |
+
} else if (is_int($value)) {
|
147 |
+
$output .= $value;
|
148 |
+
} else if ((string) ((float) $value) == $value) {
|
149 |
+
$output .= $value;
|
150 |
+
} else {
|
151 |
+
$output .= '"' . str_replace('"', '\\"', $value) . '"';
|
152 |
+
}
|
153 |
+
$output .= ',' . ($compress ? '' : "\n");
|
154 |
+
}
|
155 |
+
}
|
156 |
+
if ($compress) {
|
157 |
+
$output = preg_replace('/,$/', '', $output);
|
158 |
+
}
|
159 |
+
$output .= "}\n" . ($compress ? '' : "\n");
|
160 |
+
} else {
|
161 |
+
$output .= $row['lines'] . "\n";
|
162 |
+
}
|
163 |
+
}
|
164 |
+
return $compress ? $this->compress($output) : $this->uncompress($output);
|
165 |
+
}
|
166 |
+
|
167 |
+
public function checkConfig() {
|
168 |
+
$process = array(
|
169 |
+
'result' => null,
|
170 |
+
'data' => array(
|
171 |
+
'cart.price_excluding_tax' => 0,
|
172 |
+
'cart.price_including_tax' => 0,
|
173 |
+
'destination.country.code' => '',
|
174 |
+
'destination.country.name' => '',
|
175 |
+
'destination.region.code' => '',
|
176 |
+
'destination.postcode' => '',
|
177 |
+
'origin.country.code' => '',
|
178 |
+
'origin.country.name' => '',
|
179 |
+
'origin.region.code' => '',
|
180 |
+
'origin.postcode' => '',
|
181 |
+
'free_shipping' => false,
|
182 |
+
'customer.group.id' => '',
|
183 |
+
'customer.group.code' => '',
|
184 |
+
'cart.weight' => 0,
|
185 |
+
'cart.weight.unit' => 'kg',
|
186 |
+
'cart.quantity' => 0,
|
187 |
+
),
|
188 |
+
'cart.items' => array(),
|
189 |
+
'products' => array(),
|
190 |
+
'config' => $this->_config,
|
191 |
+
);
|
192 |
+
foreach ($this->_config as &$row) {
|
193 |
+
$this->processRow($process, $row, $check_all_conditions = true);
|
194 |
+
foreach ($row as $property_key => $property_value) {
|
195 |
+
if (substr($property_key, 0, 1) != '*') {
|
196 |
+
$this->getRowProperty($row, $property_key);
|
197 |
+
}
|
198 |
+
}
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
public function processRow($process, &$row, $is_checking = false) {
|
203 |
+
if (!isset($row['*code']) || !isset($process['data']['carrier.code'])) {
|
204 |
+
return;
|
205 |
+
}
|
206 |
+
|
207 |
+
self::debug('process row <span class="osh-key">' . $row['*code'] . '</span>', 1);
|
208 |
+
if (!isset($row['label']['value'])) {
|
209 |
+
$row['label']['value'] = '***';
|
210 |
+
}
|
211 |
+
|
212 |
+
$enabled = $this->getRowProperty($row, 'enabled');
|
213 |
+
if (isset($enabled) && !$is_checking && !$enabled) {
|
214 |
+
$this->addMessage('info', $row, 'enabled', 'Configuration disabled');
|
215 |
+
return new OCS_Result(false);
|
216 |
+
}
|
217 |
+
|
218 |
+
$conditions = $this->getRowProperty($row, 'conditions');
|
219 |
+
if (isset($conditions)) {
|
220 |
+
$result = $this->_processFormula($process, $row, 'conditions', $conditions, $is_checking);
|
221 |
+
if (!$is_checking) {
|
222 |
+
if (!$result->success) {
|
223 |
+
return $result;
|
224 |
+
}
|
225 |
+
if (!$result->result) {
|
226 |
+
$this->addMessage('info', $row, 'conditions', "The cart doesn't match conditions");
|
227 |
+
return new OCS_Result(false);
|
228 |
+
}
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
$destination = $this->getRowProperty($row, 'destination');
|
233 |
+
if (isset($destination)) {
|
234 |
+
$destination_match = $this->_addressMatch($destination, array(
|
235 |
+
'country_code' => $process['data']['destination.country.code'],
|
236 |
+
'region_code' => $process['data']['destination.region.code'],
|
237 |
+
'postcode' => $process['data']['destination.postcode']
|
238 |
+
));
|
239 |
+
if (!$is_checking && !$destination_match) {
|
240 |
+
$this->addMessage('info', $row, 'destination', "The shipping method doesn't cover the zone");
|
241 |
+
return new OCS_Result(false);
|
242 |
+
}
|
243 |
+
}
|
244 |
+
|
245 |
+
$origin = $this->getRowProperty($row, 'origin');
|
246 |
+
if (isset($origin)) {
|
247 |
+
$origin_match = $this->_addressMatch($origin, array(
|
248 |
+
'country_code' => $process['data']['origin.country.code'],
|
249 |
+
'region_code' => $process['data']['origin.region.code'],
|
250 |
+
'postcode' => $process['data']['origin.postcode']
|
251 |
+
));
|
252 |
+
if (!$is_checking && !$origin_match) {
|
253 |
+
$this->addMessage('info', $row, 'origin', "The shipping method doesn't match to shipping origin");
|
254 |
+
return new OCS_Result(false);
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
$customer_groups = $this->getRowProperty($row, 'customer_groups');
|
259 |
+
if (isset($customer_groups)) {
|
260 |
+
$groups = explode(',', $customer_groups);
|
261 |
+
$group_match = false;
|
262 |
+
foreach ($groups as $group) {
|
263 |
+
$group = trim($group);
|
264 |
+
if ($group == $process['data']['customer.group.code'] || is_int($group) && $group == $process['data']['customer.group.id'] || $group == '*') {
|
265 |
+
$group_match = true;
|
266 |
+
break;
|
267 |
+
}
|
268 |
+
}
|
269 |
+
if (!$is_checking && !$group_match) {
|
270 |
+
$this->addMessage('info', $row, 'customer_groups', "The shipping method doesn't match to customer group (%s)", $process['data']['customer.group.code']);
|
271 |
+
return new OCS_Result(false);
|
272 |
+
}
|
273 |
+
}
|
274 |
+
|
275 |
+
$quickcost_val = false;
|
276 |
+
//Chronopost quickcost method for dynamic price if it is set enabled
|
277 |
+
$quickcost = Mage::getStoreConfig('carriers/' . $process['data']['carrier.code'] . '/quickcost');
|
278 |
+
if ($quickcost) {
|
279 |
+
if ($quickCostValues = $this->getQuickCostValue($process['data'])) {
|
280 |
+
if ($quickCostValues->errorCode == 0) {
|
281 |
+
$quickcost_val = (float) $quickCostValues->amountTTC;
|
282 |
+
|
283 |
+
/* Ajout marge au quickcost */
|
284 |
+
if($quickcost_val !== false) {
|
285 |
+
$quickcost_val = Mage::helper('chronorelais')->addMargeToQuickcost($quickcost_val,$process['data']['carrier.code']);
|
286 |
+
return new OCS_Result(true, (float) $quickcost_val);
|
287 |
+
}
|
288 |
+
|
289 |
+
} else {
|
290 |
+
$this->addMessage('error', $row, 'chronopost', $quickCostValues->errorMessage);
|
291 |
+
}
|
292 |
+
} else { /* if false => WS inaccessible donc on prend les prix de la grille */
|
293 |
+
|
294 |
+
}
|
295 |
+
}
|
296 |
+
|
297 |
+
/* Prix via la grille du BO */
|
298 |
+
if($quickcost_val === false) {
|
299 |
+
$fees = $this->getRowProperty($row, 'fees');
|
300 |
+
if (isset($fees)) {
|
301 |
+
$result = $this->_processFormula($process, $row, 'fees', $fees, $is_checking);
|
302 |
+
if (!$result->success) {
|
303 |
+
return $result;
|
304 |
+
}
|
305 |
+
self::debug(' => <span class="osh-info">result = <span class="osh-formula">' . $this->_toString($result->result) . '</span>', 1);
|
306 |
+
$quickcost_val = (float) $result->result;
|
307 |
+
return new OCS_Result(true, (float) $quickcost_val);
|
308 |
+
}
|
309 |
+
}
|
310 |
+
|
311 |
+
|
312 |
+
|
313 |
+
return new OCS_Result(false);
|
314 |
+
}
|
315 |
+
|
316 |
+
public function getQuickCostValue($processData) {
|
317 |
+
$quickCost = array();
|
318 |
+
$_helper = Mage::helper('chronorelais');
|
319 |
+
$account_number = $_helper->getConfigurationAccountNumber();
|
320 |
+
$password = $_helper->getConfigurationAccountPass();
|
321 |
+
$productCode = $_helper->getChronoProductCode($processData['destination.country.code'], $processData['carrier.code']);
|
322 |
+
$origin_postcode = $_helper->getConfigurationShipperInfo('zipcode');
|
323 |
+
|
324 |
+
//to get arrival code
|
325 |
+
$arrCode = $processData['destination.postcode'];
|
326 |
+
if ($processData['carrier.code'] == 'chronoexpress' || $processData['carrier.code'] == 'chronopostcclassic') {
|
327 |
+
$arrCode = $processData['destination.country.code'];
|
328 |
+
}
|
329 |
+
|
330 |
+
$cartWeight = $processData['cart.weight'];
|
331 |
+
if ($_helper->getConfigWeightUnit() == 'g') {
|
332 |
+
$cartWeight = $cartWeight / 1000; /* conversion g => kg */
|
333 |
+
}
|
334 |
+
$quickCost = array(
|
335 |
+
'accountNumber' => $account_number,
|
336 |
+
'password' => $password,
|
337 |
+
'depCode' => $origin_postcode,
|
338 |
+
'arrCode' => $arrCode,
|
339 |
+
'weight' => $cartWeight,
|
340 |
+
'productCode' => $productCode,
|
341 |
+
'type' => 'M'
|
342 |
+
);
|
343 |
+
|
344 |
+
$quickcost_url = Mage::helper('chronorelais')->getConfigData('carriers/' . $processData['carrier.code'] . '/quickcost_url');
|
345 |
+
|
346 |
+
$helperWS = Mage::helper('chronorelais/webservice');
|
347 |
+
return $helperWS->getQuickcost($quickCost,$quickcost_url);
|
348 |
+
}
|
349 |
+
|
350 |
+
public function getRowProperty(&$row, $key, $original_row = null, $original_key = null) {
|
351 |
+
$property = null;
|
352 |
+
$output = null;
|
353 |
+
if (isset($original_row) && isset($original_key) && $original_row['*code'] == $row['*code'] && $original_key == $key) {
|
354 |
+
$this->addMessage('error', $row, $key, 'Infinite loop %s', "<span class=\"code\">{" . $row['*code'] . '.' . $key . "}</span>");
|
355 |
+
return array('error' => 'Infinite loop');
|
356 |
+
}
|
357 |
+
if (isset($row[$key]['value'])) {
|
358 |
+
$property = $row[$key]['value'];
|
359 |
+
$output = $property;
|
360 |
+
self::debug(' get <span class="osh-key">' . $row['*code'] . '</span>.<span class="osh-key">' . $key . '</span> = <span class="osh-formula">' . $this->_toString($property) . '</span>', 5);
|
361 |
+
preg_match_all('/{([a-z0-9_]+)\.([a-z0-9_]+)}/i', $output, $result_set, PREG_SET_ORDER);
|
362 |
+
foreach ($result_set as $result) {
|
363 |
+
list($original, $ref_code, $ref_key) = $result;
|
364 |
+
if (!in_array($ref_code, array('module', 'date', 'store', 'cart', 'product', 'selection', 'customvar'))) {
|
365 |
+
if ($ref_code == $row['code']['value'] && $ref_key == $key) {
|
366 |
+
$this->addMessage('error', $row, $key, 'Infinite loop %s', "<span class=\"code\">" . $original . "</span>");
|
367 |
+
return null;
|
368 |
+
}
|
369 |
+
if (isset($this->_config[$ref_code][$ref_key]['value'])) {
|
370 |
+
$replacement = $this->getRowProperty($this->_config[$ref_code], $ref_key, isset($original_row) ? $original_row : $row, isset($original_key) ? $original_key : $key);
|
371 |
+
if (is_array($replacement) && isset($replacement['error'])) {
|
372 |
+
return isset($original_row) ? $replacement : 'false';
|
373 |
+
}
|
374 |
+
} else {
|
375 |
+
$this->addMessage('error', $row, $key, 'Non-existent property %s', "<span class=\"code\">" . $original . "</span>");
|
376 |
+
$replacement = 'null';
|
377 |
+
}
|
378 |
+
$output = $this->replace($original, $replacement, $output);
|
379 |
+
}
|
380 |
+
}
|
381 |
+
} else {
|
382 |
+
self::debug(' get <span class="osh-key">' . $row['*code'] . '</span>.<span class="osh-key">' . $key . '</span> = <span class="osh-formula">null</span>', 5);
|
383 |
+
}
|
384 |
+
return $output;
|
385 |
+
}
|
386 |
+
|
387 |
+
protected function _toString($value) {
|
388 |
+
if (!isset($value)) {
|
389 |
+
return 'null';
|
390 |
+
} else if (is_bool($value)) {
|
391 |
+
return $value ? 'true' : 'false';
|
392 |
+
}
|
393 |
+
return $value;
|
394 |
+
}
|
395 |
+
|
396 |
+
protected function replace($from, $to, $input) {
|
397 |
+
if ($from === $to) {
|
398 |
+
return $input;
|
399 |
+
}
|
400 |
+
if (strpos($input, $from) === false) {
|
401 |
+
return $input;
|
402 |
+
}
|
403 |
+
$to = $this->_toString($to);
|
404 |
+
self::debug(' replace <span class="osh-replacement">' . $this->_toString($from) . '</span> by <span class="osh-replacement">' . $to . '</span> => <span class="osh-formula">' . str_replace($from, '<span class="osh-replacement">' . $to . '</span>', $input) . '</span>', 5);
|
405 |
+
return str_replace($from, $to, $input);
|
406 |
+
}
|
407 |
+
|
408 |
+
protected function _min() {
|
409 |
+
$args = func_get_args();
|
410 |
+
$min = null;
|
411 |
+
foreach ($args as $arg) {
|
412 |
+
if (isset($arg) && (!isset($min) || $min > $arg)) {
|
413 |
+
$min = $arg;
|
414 |
+
}
|
415 |
+
}
|
416 |
+
return $min;
|
417 |
+
}
|
418 |
+
|
419 |
+
protected function _max() {
|
420 |
+
$args = func_get_args();
|
421 |
+
$max = null;
|
422 |
+
foreach ($args as $arg) {
|
423 |
+
if (isset($arg) && (!isset($max) || $max < $arg)) {
|
424 |
+
$max = $arg;
|
425 |
+
}
|
426 |
+
}
|
427 |
+
return $max;
|
428 |
+
}
|
429 |
+
|
430 |
+
protected function _processFormula($process, &$row, $property_key, $formula_string, $is_checking, $use_cache = true) {
|
431 |
+
$result = $this->_prepareFormula($process, $row, $property_key, $formula_string, $is_checking, $use_cache);
|
432 |
+
if (!$result->success) {
|
433 |
+
return $result;
|
434 |
+
}
|
435 |
+
|
436 |
+
$eval_result = $this->_evalFormula($result->result);
|
437 |
+
if (!isset($eval_result)) {
|
438 |
+
$this->addMessage('error', $row, $property_key, 'Invalid formula');
|
439 |
+
$result = new OCS_Result(false);
|
440 |
+
if ($use_cache) {
|
441 |
+
$this->setCache($formula_string, $result);
|
442 |
+
}
|
443 |
+
return $result;
|
444 |
+
}
|
445 |
+
self::debug(' formula evaluation = <span class="osh-formula">' . $this->_toString($eval_result) . '</span>', 10);
|
446 |
+
$result = new OCS_Result(true, $eval_result);
|
447 |
+
if ($use_cache) {
|
448 |
+
$this->setCache($formula_string, $result);
|
449 |
+
}
|
450 |
+
return $result;
|
451 |
+
}
|
452 |
+
|
453 |
+
public function evalInput($process, $row, $property_key, $input) {
|
454 |
+
$result = $this->_prepareFormula($process, $row, $property_key, $input, $is_checking = false, $use_cache = true);
|
455 |
+
return $result->success ? $result->result : $input;
|
456 |
+
}
|
457 |
+
|
458 |
+
protected function setCache($expression, $value) {
|
459 |
+
if ($value instanceof OCS_Result) {
|
460 |
+
$this->_formula_cache[$expression] = $value;
|
461 |
+
self::debug(' cache <span class="osh-replacement">' . $expression . '</span> = <span class="osh-formula">' . $this->_toString($this->_formula_cache[$expression]) . '</span>', 10);
|
462 |
+
} else {
|
463 |
+
$value = $this->_toString($value);
|
464 |
+
$this->_expression_cache[$expression] = $value;
|
465 |
+
self::debug(' cache <span class="osh-replacement">' . $expression . '</span> = <span class="osh-formula">' . $value . '</span>', 10);
|
466 |
+
}
|
467 |
+
}
|
468 |
+
|
469 |
+
protected function _prepareFormula($process, $row, $property_key, $formula_string, $is_checking, $use_cache = true) {
|
470 |
+
if ($use_cache && isset($this->_formula_cache[$formula_string])) {
|
471 |
+
$result = $this->_formula_cache[$formula_string];
|
472 |
+
self::debug(' get cached formula <span class="osh-replacement">' . $formula_string . '</span> = <span class="osh-formula">' . $this->_toString($result->result) . '</span>', 10);
|
473 |
+
return $result;
|
474 |
+
}
|
475 |
+
|
476 |
+
$formula = $formula_string;
|
477 |
+
|
478 |
+
while (preg_match("#{foreach product\.((?:attribute|option)\.(?:[a-z0-9_]+))}(.*){/foreach}#i", $formula, $result)) {
|
479 |
+
$original = $result[0];
|
480 |
+
if ($use_cache && isset($this->_expression_cache[$original])) {
|
481 |
+
$replacement = $this->_expression_cache[$original];
|
482 |
+
self::debug(' get cached expression <span class="osh-replacement">' . $original . '</span> = <span class="osh-formula">' . $replacement . '</span>', 10);
|
483 |
+
} else {
|
484 |
+
$replacement = 0;
|
485 |
+
list($filter_property_type, $filter_property_name) = explode('.', $result[1]);
|
486 |
+
$selections = array();
|
487 |
+
self::debug(' :: foreach <span class="osh-key">' . $filter_property_type . '</span>.<span class="osh-key">' . $filter_property_name . '</span>', 10);
|
488 |
+
foreach ($process['products'] as $product) {
|
489 |
+
$tmp_value = $this->_getProductProperty($product, $filter_property_type, $filter_property_name, $get_by_id = false);
|
490 |
+
self::debug(' products[<span class="osh-formula">' . $product->getName() . '</span>].<span class="osh-key">' . $filter_property_type . '</span>.<span class="osh-key">' . $filter_property_name . '</span> = <span class="osh-formula">' . $this->_toString($tmp_value) . '</span>', 10);
|
491 |
+
$key = 'val_' . $tmp_value;
|
492 |
+
$sel = isset($selections[$key]) ? $selections[$key] : null;
|
493 |
+
$selections[$key]['products'][] = $product;
|
494 |
+
$selections[$key]['weight'] = (isset($sel['weight']) ? $sel['weight'] : 0) + $product->getAttribute('weight') * $product->getQuantity();
|
495 |
+
$selections[$key]['quantity'] = (isset($sel['quantity']) ? $sel['quantity'] : 0) + $product->getQuantity();
|
496 |
+
}
|
497 |
+
self::debug(' :: start foreach', 10);
|
498 |
+
foreach ($selections as $selection) {
|
499 |
+
$process2 = $process;
|
500 |
+
$process2['products'] = $selection['products'];
|
501 |
+
$process2['data']['selection.quantity'] = $selection['quantity'];
|
502 |
+
$process2['data']['selection.weight'] = $selection['weight'];
|
503 |
+
$process_result = $this->_processFormula($process2, $row, $property_key, $result[2], $is_checking, $tmp_use_cache = false);
|
504 |
+
$replacement += $process_result->result;
|
505 |
+
}
|
506 |
+
self::debug(' :: end foreach <span class="osh-key">' . $filter_property_type . '</span>.<span class="osh-key">' . $filter_property_name . '</span>', 10);
|
507 |
+
if ($use_cache) {
|
508 |
+
$this->setCache($original, $replacement);
|
509 |
+
}
|
510 |
+
}
|
511 |
+
$formula = $this->replace($original, $replacement, $formula);
|
512 |
+
}
|
513 |
+
|
514 |
+
$formula = str_replace(array("\n", "\t"), array('', ''), $formula);
|
515 |
+
|
516 |
+
while (preg_match("#{customvar\.([a-z0-9_]+)}#i", $formula, $result)) {
|
517 |
+
$original = $result[0];
|
518 |
+
$replacement = Mage::getModel('core/variable')->loadByCode($result[1])->getValue('plain');
|
519 |
+
$formula = $this->replace($original, $replacement, $formula);
|
520 |
+
}
|
521 |
+
|
522 |
+
$first_product = isset($process['products'][0]) ? $process['products'][0] : null;
|
523 |
+
if (!isset($process['data']['selection.weight'])) {
|
524 |
+
$process['data']['selection.weight'] = $process['data']['cart.weight'];
|
525 |
+
}
|
526 |
+
if (!isset($process['data']['selection.quantity'])) {
|
527 |
+
$process['data']['selection.quantity'] = $process['data']['cart.quantity'];
|
528 |
+
}
|
529 |
+
$process['data']['product.weight'] = isset($first_product) ? $first_product->getAttribute('weight') : 0;
|
530 |
+
$process['data']['product.quantity'] = isset($first_product) ? $first_product->getQuantity() : 0;
|
531 |
+
|
532 |
+
foreach ($process['data'] as $original => $replacement) {
|
533 |
+
$formula = $this->replace('{' . $original . '}', $replacement, $formula);
|
534 |
+
}
|
535 |
+
|
536 |
+
if (isset($first_product)) {
|
537 |
+
while (preg_match("#{product\.(attribute|option|stock)\.([a-z0-9_]+)}#i", $formula, $result)) {
|
538 |
+
$original = $result[0];
|
539 |
+
switch ($result[1]) {
|
540 |
+
case 'attribute': $replacement = $first_product->getAttribute($result[2]);
|
541 |
+
break;
|
542 |
+
case 'option': $replacement = $first_product->getOption($result[2]);
|
543 |
+
break;
|
544 |
+
case 'stock': $replacement = $first_product->getStockData($result[2]);
|
545 |
+
break;
|
546 |
+
}
|
547 |
+
$formula = $this->replace($original, $replacement, $formula);
|
548 |
+
}
|
549 |
+
}
|
550 |
+
|
551 |
+
while (preg_match("/{(count) products(?: where ([^}]+))?}/i", $formula, $result) || preg_match("/{(sum|count distinct) product\.(attribute|option)\.([a-z0-9_]+)(?: where ([^}]+))?}/i", $formula, $result)) {
|
552 |
+
$original = $result[0];
|
553 |
+
if ($use_cache && isset($this->_expression_cache[$original])) {
|
554 |
+
$replacement = $this->_expression_cache[$original];
|
555 |
+
self::debug(' get cached expression <span class="osh-replacement">' . $original . '</span> = <span class="osh-formula">' . $replacement . '</span>', 10);
|
556 |
+
} else {
|
557 |
+
$replacement = $this->_processProductProperty($process['products'], $result);
|
558 |
+
if ($use_cache) {
|
559 |
+
$this->setCache($result[0], $replacement);
|
560 |
+
}
|
561 |
+
}
|
562 |
+
$formula = $this->replace($original, $replacement, $formula);
|
563 |
+
}
|
564 |
+
|
565 |
+
while (preg_match("/{table ([^}]+) in ([0-9\.:,\*\[\] ]+)}/i", $formula, $result)) {
|
566 |
+
$original = $result[0];
|
567 |
+
if ($use_cache && isset($this->_expression_cache[$original])) {
|
568 |
+
$replacement = $this->_expression_cache[$original];
|
569 |
+
self::debug(' get cached expression <span class="osh-replacement">' . $original . '</span> = <span class="osh-formula">' . $replacement . '</span>', 10);
|
570 |
+
} else {
|
571 |
+
$reference_value = $this->_evalFormula($result[1]);
|
572 |
+
if (isset($reference_value)) {
|
573 |
+
$fees_table_string = $result[2];
|
574 |
+
|
575 |
+
if (!preg_match('#^' . self::$COUPLE_REGEX . '(?:, *' . self::$COUPLE_REGEX . ')*$#', $fees_table_string)) {
|
576 |
+
$this->addMessage('error', $row, $property_key, 'Error in table %s', '<span class="osh-formula">' . htmlentities($result[0]) . '</span>');
|
577 |
+
$result = new OCS_Result(false);
|
578 |
+
if ($use_cache) {
|
579 |
+
$this->setCache($formula_string, $result);
|
580 |
+
}
|
581 |
+
return $result;
|
582 |
+
}
|
583 |
+
$fees_table = explode(',', $fees_table_string);
|
584 |
+
|
585 |
+
$replacement = null;
|
586 |
+
foreach ($fees_table as $item) {
|
587 |
+
$fee_data = explode(':', $item);
|
588 |
+
|
589 |
+
$fee = trim($fee_data[1]);
|
590 |
+
$max_value = trim($fee_data[0]);
|
591 |
+
|
592 |
+
$last_char = $max_value{strlen($max_value) - 1};
|
593 |
+
if ($last_char == '[') {
|
594 |
+
$including_max_value = false;
|
595 |
+
} else if ($last_char == ']') {
|
596 |
+
$including_max_value = true;
|
597 |
+
} else {
|
598 |
+
$including_max_value = true;
|
599 |
+
}
|
600 |
+
|
601 |
+
$max_value = str_replace(array('[', ']'), '', $max_value);
|
602 |
+
|
603 |
+
if ($max_value == '*' || $including_max_value && $reference_value <= $max_value || !$including_max_value && $reference_value < $max_value) {
|
604 |
+
$replacement = $fee;
|
605 |
+
break;
|
606 |
+
}
|
607 |
+
}
|
608 |
+
}
|
609 |
+
$replacement = $this->_toString($replacement);
|
610 |
+
if ($use_cache) {
|
611 |
+
$this->setCache($original, $replacement);
|
612 |
+
}
|
613 |
+
}
|
614 |
+
$formula = $this->replace($original, $replacement, $formula);
|
615 |
+
}
|
616 |
+
$result = new OCS_Result(true, $formula);
|
617 |
+
return $result;
|
618 |
+
}
|
619 |
+
|
620 |
+
protected function _evalFormula($formula) {
|
621 |
+
if (is_bool($formula)) {
|
622 |
+
return $formula;
|
623 |
+
}
|
624 |
+
if (!preg_match('/^(?:floor|ceil|round|max|min|rand|pow|pi|sqrt|log|exp|abs|int|float|true|false|null|and|or|in|substr|strtolower'
|
625 |
+
. '|in_array\(\'(?:[^\']*)\', *array\( *(?:\'(?:[^\']+)\') *(?: *, *\'(?:[^\']+)\')* *\) *\)'
|
626 |
+
. '|\'[^\']*\'|[0-9,\'\.\-\(\)\*\/\?\:\+\<\>\=\&\|%! ])*$/', $formula)) {
|
627 |
+
$errors = array(
|
628 |
+
PREG_NO_ERROR => 'PREG_NO_ERROR',
|
629 |
+
PREG_INTERNAL_ERROR => 'PREG_INTERNAL_ERROR',
|
630 |
+
PREG_BACKTRACK_LIMIT_ERROR => 'PREG_BACKTRACK_LIMIT_ERROR',
|
631 |
+
PREG_RECURSION_LIMIT_ERROR => 'PREG_RECURSION_LIMIT_ERROR',
|
632 |
+
PREG_BAD_UTF8_ERROR => 'PREG_BAD_UTF8_ERROR',
|
633 |
+
PREG_BAD_UTF8_OFFSET_ERROR => 'PREG_BAD_UTF8_OFFSET_ERROR',
|
634 |
+
);
|
635 |
+
$error = preg_last_error();
|
636 |
+
if (isset($errors[$error])) {
|
637 |
+
$error = $errors[$error];
|
638 |
+
}
|
639 |
+
self::debug(' doesn\'t match (' . $error . ')', 10);
|
640 |
+
return null;
|
641 |
+
}
|
642 |
+
$formula = str_replace(
|
643 |
+
array('min', 'max'), array('$this->_min', '$this->_max'), $formula
|
644 |
+
);
|
645 |
+
$eval_result = null;
|
646 |
+
@eval('$eval_result = (' . $formula . ');');
|
647 |
+
return $eval_result;
|
648 |
+
}
|
649 |
+
|
650 |
+
protected function _getOptionsAndData($string) {
|
651 |
+
if (preg_match('/^(\\s*\(\\s*([^\] ]*)\\s*\)\\s*)/', $string, $result)) {
|
652 |
+
$options = $result[2];
|
653 |
+
$data = str_replace($result[1], '', $string);
|
654 |
+
} else {
|
655 |
+
$options = '';
|
656 |
+
$data = $string;
|
657 |
+
}
|
658 |
+
return array(
|
659 |
+
'options' => $options,
|
660 |
+
'data' => $data,
|
661 |
+
);
|
662 |
+
}
|
663 |
+
|
664 |
+
public function compress($input) {
|
665 |
+
if (preg_match_all("/{table (.*) in (" . self::$COUPLE_REGEX . "(?:, *" . self::$COUPLE_REGEX . ")*)}/imsU", $input, $result, PREG_SET_ORDER)) {
|
666 |
+
foreach ($result as $result_i) {
|
667 |
+
$fees_table = explode(',', $result_i[2]);
|
668 |
+
foreach ($fees_table as $index => $item) {
|
669 |
+
list($max_value, $fee) = explode(':', $item);
|
670 |
+
$last_char = $max_value{strlen($max_value) - 1};
|
671 |
+
if (in_array($last_char, array('[', ']'))) {
|
672 |
+
$including_char = $last_char;
|
673 |
+
$max_value = str_replace(array('[', ']'), '', $max_value);
|
674 |
+
}
|
675 |
+
else {
|
676 |
+
$including_char = '';
|
677 |
+
}
|
678 |
+
$fees_table[$index] = ((float) $max_value) . $including_char . ':' . ((float) $fee);
|
679 |
+
}
|
680 |
+
$input = str_replace($result_i[2], implode(',', $fees_table), $input);
|
681 |
+
$input = str_replace($result_i[1], trim($result_i[1]), $input);
|
682 |
+
}
|
683 |
+
}
|
684 |
+
if (preg_match_all("#{foreach ([^}]*)}(.*){/foreach}#imsU", $input, $result, PREG_SET_ORDER)) {
|
685 |
+
foreach ($result as $result_i) {
|
686 |
+
$input = str_replace($result_i[1], trim($result_i[1]), $input);
|
687 |
+
$input = str_replace($result_i[2], trim($result_i[2]), $input);
|
688 |
+
}
|
689 |
+
}
|
690 |
+
return '$$' . str_replace(
|
691 |
+
self::$UNCOMPRESSED_STRINGS, self::$COMPRESSED_STRINGS, $input
|
692 |
+
);
|
693 |
+
}
|
694 |
+
|
695 |
+
public function uncompress($input) {
|
696 |
+
if (preg_match_all("/{table (.*) in (" . self::$COUPLE_REGEX . "(?:, *" . self::$COUPLE_REGEX . ")*)}/iU", $input, $result, PREG_SET_ORDER)) {
|
697 |
+
foreach ($result as $result_i) {
|
698 |
+
$fees_table = explode(',', $result_i[2]);
|
699 |
+
foreach ($fees_table as $index => $item) {
|
700 |
+
list($max_value, $fee) = explode(':', $item);
|
701 |
+
$last_char = $max_value{strlen($max_value) - 1};
|
702 |
+
if (in_array($last_char, array('[', ']'))) {
|
703 |
+
$including_char = $last_char;
|
704 |
+
$max_value = str_replace(array('[', ']'), '', $max_value);
|
705 |
+
}
|
706 |
+
else {
|
707 |
+
$including_char = '';
|
708 |
+
}
|
709 |
+
$max_value = (float) $max_value;
|
710 |
+
$fee = (float) $fee;
|
711 |
+
$new_max_value = number_format($max_value, 2, '.', '');
|
712 |
+
$new_fee = number_format($fee, 2, '.', '');
|
713 |
+
$fees_table[$index] = (((float) $new_max_value) == $max_value ? $new_max_value : $max_value) . $including_char . ':'
|
714 |
+
. (((float) $new_fee) == $fee ? $new_fee : $fee);
|
715 |
+
}
|
716 |
+
$input = str_replace($result_i[2], implode(', ', $fees_table), $input);
|
717 |
+
$input = str_replace($result_i[1], trim($result_i[1]), $input);
|
718 |
+
}
|
719 |
+
}
|
720 |
+
if (preg_match_all("#{foreach ([^}]*)}(.*){/foreach}#iU", $input, $result, PREG_SET_ORDER)) {
|
721 |
+
foreach ($result as $result_i) {
|
722 |
+
$input = str_replace($result_i[1], trim($result_i[1]), $input);
|
723 |
+
$input = str_replace($result_i[2], trim($result_i[2]), $input);
|
724 |
+
}
|
725 |
+
}
|
726 |
+
return str_replace(
|
727 |
+
self::$COMPRESSED_STRINGS, self::$UNCOMPRESSED_STRINGS, $input
|
728 |
+
);
|
729 |
+
}
|
730 |
+
|
731 |
+
public function parseProperty($input) {
|
732 |
+
$value = $input === 'false' || $input === 'true' ? $input == 'true' : str_replace('\"', '"', preg_replace('/^(?:"|\')(.*)(?:"|\')$/s', '$1', $input));
|
733 |
+
return $value === '' ? null : $value;
|
734 |
+
}
|
735 |
+
|
736 |
+
public function cleanProperty(&$row, $key) {
|
737 |
+
$input = $row[$key]['value'];
|
738 |
+
if (is_string($input)) {
|
739 |
+
$input = str_replace(array("\n"), array(''), $input);
|
740 |
+
while (preg_match('/({TABLE |{SUM |{COUNT | DISTINCT | IN )/', $input, $resi)) {
|
741 |
+
$input = str_replace($resi[0], strtolower($resi[0]), $input);
|
742 |
+
}
|
743 |
+
|
744 |
+
while (preg_match('/{{customVar code=([a-zA-Z0-9_-]+)}}/', $input, $resi)) {
|
745 |
+
$input = str_replace($resi[0], '{customvar.' . $resi[1] . '}', $input);
|
746 |
+
}
|
747 |
+
|
748 |
+
$regex = "{(weight|products_quantity|price_including_tax|price_excluding_tax|country)}";
|
749 |
+
if (preg_match('/' . $regex . '/', $input, $resi)) {
|
750 |
+
$this->addMessage('warning', $row, $key, 'Usage of deprecated syntax %s', '<span class="osh-formula">' . $resi[0] . '</span>');
|
751 |
+
while (preg_match('/' . $regex . '/', $input, $resi)) {
|
752 |
+
switch ($resi[1]) {
|
753 |
+
case 'price_including_tax':
|
754 |
+
case 'price_excluding_tax':
|
755 |
+
case 'weight':
|
756 |
+
$input = str_replace($resi[0], "{cart." . $resi[1] . "}", $input);
|
757 |
+
break;
|
758 |
+
case 'products_quantity': $input = str_replace($resi[0], "{cart.quantity}", $input);
|
759 |
+
break;
|
760 |
+
case 'country': $input = str_replace($resi[0], "{destination.country.name}", $input);
|
761 |
+
break;
|
762 |
+
default:
|
763 |
+
break;
|
764 |
+
}
|
765 |
+
}
|
766 |
+
}
|
767 |
+
|
768 |
+
$regex1 = "{copy '([a-zA-Z0-9_]+)'\.'([a-zA-Z0-9_]+)'}";
|
769 |
+
if (preg_match('/' . $regex1 . '/', $input, $resi)) {
|
770 |
+
$this->addMessage('warning', $row, $key, 'Usage of deprecated syntax %s', '<span class="osh-formula">' . $resi[0] . '</span>');
|
771 |
+
while (preg_match('/' . $regex1 . '/', $input, $resi)) {
|
772 |
+
$input = str_replace($resi[0], '{' . $resi[1] . '.' . $resi[2] . '}', $input);
|
773 |
+
}
|
774 |
+
}
|
775 |
+
|
776 |
+
$regex1 = "{(count|all|any) (attribute|option) '([^'\)]+)' ?((?:==|<=|>=|<|>|!=) ?(?:" . self::$FLOAT_REGEX . "|true|false|'[^'\)]*'))}";
|
777 |
+
$regex2 = "{(sum) (attribute|option) '([^'\)]+)'}";
|
778 |
+
if (preg_match('/' . $regex1 . '/', $input, $resi) || preg_match('/' . $regex2 . '/', $input, $resi)) {
|
779 |
+
$this->addMessage('warning', $row, $key, 'Usage of deprecated syntax %s', '<span class="osh-formula">' . $resi[0] . '</span>');
|
780 |
+
while (preg_match('/' . $regex1 . '/', $input, $resi) || preg_match('/' . $regex2 . '/', $input, $resi)) {
|
781 |
+
switch ($resi[1]) {
|
782 |
+
case 'count': $input = str_replace($resi[0], "{count products where product." . $resi[2] . "s." . $resi[3] . $resi[4] . "}", $input);
|
783 |
+
break;
|
784 |
+
case 'all': $input = str_replace($resi[0], "{count products where product." . $resi[2] . "s." . $resi[3] . $resi[4] . "}=={products_quantity}", $input);
|
785 |
+
break;
|
786 |
+
case 'any': $input = str_replace($resi[0], "{count products where product." . $resi[2] . "s." . $resi[3] . $resi[4] . "}>0", $input);
|
787 |
+
break;
|
788 |
+
case 'sum': $input = str_replace($resi[0], "{sum product." . $resi[2] . "." . $resi[3] . "}", $input);
|
789 |
+
break;
|
790 |
+
default :
|
791 |
+
break;
|
792 |
+
}
|
793 |
+
}
|
794 |
+
}
|
795 |
+
|
796 |
+
$regex = "((?:{| )product.(?:attribute|option))s.";
|
797 |
+
if (preg_match('/' . $regex . '/', $input, $resi)) {
|
798 |
+
$this->addMessage('warning', $row, $key, 'Usage of deprecated syntax %s', '<span class="osh-formula">' . $resi[0] . '</span>');
|
799 |
+
while (preg_match('/' . $regex . '/', $input, $resi)) {
|
800 |
+
$input = str_replace($resi[0], $resi[1] . '.', $input);
|
801 |
+
}
|
802 |
+
}
|
803 |
+
|
804 |
+
$regex = "{table '([^']+)' (" . self::$COUPLE_REGEX . "(?:, *" . self::$COUPLE_REGEX . ")*)}";
|
805 |
+
if (preg_match('/' . $regex . '/', $input, $resi)) {
|
806 |
+
$this->addMessage('warning', $row, $key, 'Usage of deprecated syntax %s', '<span class="osh-formula">' . $resi[0] . '</span>');
|
807 |
+
while (preg_match('/' . $regex . '/', $input, $resi)) {
|
808 |
+
switch ($resi[1]) {
|
809 |
+
case 'products_quantity':
|
810 |
+
$input = str_replace($resi[0], "{table {cart.weight} in " . $resi[2] . "}*{cart.quantity}", $input);
|
811 |
+
break;
|
812 |
+
default:
|
813 |
+
$input = str_replace($resi[0], "{table {cart." . $resi[1] . "} in " . $resi[2] . "}", $input);
|
814 |
+
break;
|
815 |
+
}
|
816 |
+
}
|
817 |
+
}
|
818 |
+
}
|
819 |
+
$row[$key]['value'] = $input;
|
820 |
+
}
|
821 |
+
|
822 |
+
protected function _parseInput() {
|
823 |
+
$config_string = str_replace(
|
824 |
+
array('>', '<', '“', '”', utf8_encode(chr(147)), utf8_encode(chr(148)), '«', '»', "\r\n", "\t"), array('>', '<', '"', '"', '"', '"', '"', '"', "\n", ' '), $this->_input
|
825 |
+
);
|
826 |
+
|
827 |
+
if (substr($config_string, 0, 2) == '$$') {
|
828 |
+
$config_string = $this->uncompress(substr($config_string, 2, strlen($config_string)));
|
829 |
+
}
|
830 |
+
|
831 |
+
$row_regex = ' *([a-z0-9_]+)\\s*:\\s*("(?:(?:[^"]|\\\\")*[^\\\\])?"|' . self::$FLOAT_REGEX . '|false|true)\\s*(,)? *(?:\\n)?';
|
832 |
+
if (!preg_match_all('/((?:#+[^{\\n]*\\s+)*)\\s*(#)?{\\s*(' . $row_regex . ')+\\s*}/i', $config_string, $result, PREG_SET_ORDER)) {
|
833 |
+
$errors = array(
|
834 |
+
PREG_NO_ERROR => 'PREG_NO_ERROR',
|
835 |
+
PREG_INTERNAL_ERROR => 'PREG_INTERNAL_ERROR',
|
836 |
+
PREG_BACKTRACK_LIMIT_ERROR => 'PREG_BACKTRACK_LIMIT_ERROR',
|
837 |
+
PREG_RECURSION_LIMIT_ERROR => 'PREG_RECURSION_LIMIT_ERROR',
|
838 |
+
PREG_BAD_UTF8_ERROR => 'PREG_BAD_UTF8_ERROR',
|
839 |
+
PREG_BAD_UTF8_OFFSET_ERROR => 'PREG_BAD_UTF8_OFFSET_ERROR',
|
840 |
+
);
|
841 |
+
$error = preg_last_error();
|
842 |
+
if (isset($errors[$error])) {
|
843 |
+
$error = $errors[$error];
|
844 |
+
}
|
845 |
+
self::debug(' preg_match_all error (' . $error . ')', 10);
|
846 |
+
}
|
847 |
+
|
848 |
+
$this->_config = array();
|
849 |
+
$available_keys = array(
|
850 |
+
'code', 'label', 'enabled', 'description', 'fees', 'conditions', 'destination', 'origin', 'customer_groups', 'tracking_url',
|
851 |
+
'fees_table', 'fees_formula', 'fixed_fees', 'reference_value',
|
852 |
+
'prices_range', 'weights_range', 'product_properties',
|
853 |
+
'free_shipping__fees_table', 'free_shipping__fees_formula', 'free_shipping__fixed_fees', 'free_shipping__label',
|
854 |
+
);
|
855 |
+
|
856 |
+
foreach ($result as $block) {
|
857 |
+
$deprecated_properties = array();
|
858 |
+
$unknown_properties = array();
|
859 |
+
$missing_semicolon = array();
|
860 |
+
$obsolete_disabling_method = array();
|
861 |
+
|
862 |
+
//$before = strstr($config_string,$block[0],true); // Seulement compatible avec PHP 5.3.0
|
863 |
+
list($before) = explode($block[0], $config_string, 2);
|
864 |
+
if ($before !== false && trim($before) != '') {
|
865 |
+
$config_string = substr($config_string, strlen($before));
|
866 |
+
$this->_addIgnoredLines(trim($before));
|
867 |
+
$this->addMessage('info', $row = null, null, 'Ignored lines %s', '<div class="code">' . trim($before) . '</div>');
|
868 |
+
}
|
869 |
+
|
870 |
+
$config_string = str_replace($block[0], '', $config_string);
|
871 |
+
preg_match_all('/' . $row_regex . '/i', $block[0], $result2, PREG_SET_ORDER);
|
872 |
+
$block_string = $block[0];
|
873 |
+
|
874 |
+
$row = array();
|
875 |
+
$i = 1;
|
876 |
+
foreach ($result2 as $data) {
|
877 |
+
$key = $data[1];
|
878 |
+
if (in_array($key, $available_keys) || substr($key, 0, 1) == '_') {
|
879 |
+
$property = $this->parseProperty($data[2]);
|
880 |
+
if (isset($property)) {
|
881 |
+
$row[$key] = array('value' => $property, 'original_value' => $property);
|
882 |
+
$this->cleanProperty($row, $key);
|
883 |
+
}
|
884 |
+
if ($i > 2) {
|
885 |
+
$block_string = str_replace($data[0], $i == 3 ? "...\n" : '', $block_string);
|
886 |
+
}
|
887 |
+
if ($i != count($result2) && !isset($data[3]) || isset($data[3]) && $data[3] != ',') {
|
888 |
+
if (preg_match('/^("|\')(.{40})(.*)("|\')$/s', $data[2], $resultx)) {
|
889 |
+
$missing_semicolon[] = trim(str_replace($data[2], $resultx[1] . $resultx[2] . ' ...' . $resultx[4], $data[0]));
|
890 |
+
} else {
|
891 |
+
$missing_semicolon[] = trim($data[0]);
|
892 |
+
}
|
893 |
+
}
|
894 |
+
} else {
|
895 |
+
if (!in_array($key, $unknown_properties)) {
|
896 |
+
$unknown_properties[] = $key;
|
897 |
+
}
|
898 |
+
}
|
899 |
+
$i++;
|
900 |
+
}
|
901 |
+
if ($block[1] != '') {
|
902 |
+
$row['*comment']['value'] = $block[1];
|
903 |
+
}
|
904 |
+
if ($block[2] == '#' && !isset($row['enabled'])) {
|
905 |
+
$row['enabled'] = array('value' => false);
|
906 |
+
$obsolete_disabling_method[] = $block_string;
|
907 |
+
}
|
908 |
+
|
909 |
+
$formula_fields_to_check = array();
|
910 |
+
if (isset($row['conditions'])) {
|
911 |
+
$formula_fields_to_check[] = 'conditions';
|
912 |
+
}
|
913 |
+
if (isset($row['fees'])) {
|
914 |
+
$formula_fields_to_check[] = 'fees';
|
915 |
+
}
|
916 |
+
|
917 |
+
if (count($formula_fields_to_check) > 0) {
|
918 |
+
foreach ($formula_fields_to_check as $property) {
|
919 |
+
$property_value = $row[$property]['value'];
|
920 |
+
if (preg_match('/{ +/', $property_value)) {
|
921 |
+
$this->addMessage('warning', $row, $property, 'There are unwanted spaces after char `%s`', '{');
|
922 |
+
$property_value = preg_replace('/{ +/', '{', $property_value);
|
923 |
+
}
|
924 |
+
if (preg_match('/ +}/', $property_value)) {
|
925 |
+
$this->addMessage('warning', $row, $property, 'There are unwanted spaces before char `%s`', '}');
|
926 |
+
$property_value = preg_replace('/ +}/', '}', $property_value);
|
927 |
+
}
|
928 |
+
if (preg_match('/ +/', $property_value)) {
|
929 |
+
$this->addMessage('warning', $row, $property, 'There are unwanted multiples spaces `%s`', preg_replace('/( +)/', '<span class="osh-formula">*$1*</span>', $property_value));
|
930 |
+
$property_value = preg_replace('/ +/', ' ', $property_value);
|
931 |
+
}
|
932 |
+
$row[$property]['value'] = trim($property_value);
|
933 |
+
}
|
934 |
+
}
|
935 |
+
|
936 |
+
$float_value_regex = '\\s*(' . self::$POSITIVE_FLOAT_REGEX . '|\*)\\s*';
|
937 |
+
$conditions = array();
|
938 |
+
if (isset($row['prices_range'])) {
|
939 |
+
if (!in_array('prices_range', $deprecated_properties)) {
|
940 |
+
$deprecated_properties[] = 'prices_range';
|
941 |
+
}
|
942 |
+
|
943 |
+
$result = $this->_getOptionsAndData($row['prices_range']['value']);
|
944 |
+
$options = $result['options'];
|
945 |
+
$prices_range = $result['data'];
|
946 |
+
|
947 |
+
if (($options == '' || in_array($options, array('incl.tax', 'ttc'))) && preg_match('/^\\s*(\[|\])?' . $float_value_regex . '=>' . $float_value_regex . '(\[|\])?\\s*$/', $prices_range, $result)) {
|
948 |
+
$min_price_included = $result[1] == '[';
|
949 |
+
$min_price = $result[2] == '*' ? -1 : (float) $result[2];
|
950 |
+
$max_price = $result[3] == '*' ? -1 : (float) $result[3];
|
951 |
+
$max_price_included = !isset($result[4]) || $result[4] == ']' || $result[4] == '';
|
952 |
+
|
953 |
+
$tax_included = $options != '' && in_array($options, array('incl.tax', 'ttc')) || isset($row['reference_value']) && $row['reference_value']['value'] == 'price_including_tax';
|
954 |
+
$price = $tax_included ? '{cart.price_including_tax}' : '{cart.price_excluding_tax}';
|
955 |
+
|
956 |
+
if ($min_price != -1) {
|
957 |
+
$conditions[] = $price . '>' . ($min_price_included ? '=' : '') . $min_price;
|
958 |
+
}
|
959 |
+
if ($max_price != -1) {
|
960 |
+
$conditions[] = $price . '<' . ($max_price_included ? '=' : '') . $max_price;
|
961 |
+
}
|
962 |
+
}
|
963 |
+
else {
|
964 |
+
$this->addMessage('error', $row, null, 'Unrecognized value of deprecated property %s %s', '<span class="osh-key">prices_range</span>', '<span class="osh-formula">' . $row['prices_range']['value'] . '</span>');
|
965 |
+
}
|
966 |
+
unset($row['prices_range']);
|
967 |
+
}
|
968 |
+
if (isset($row['weights_range'])) {
|
969 |
+
if (!in_array('weights_range', $deprecated_properties)) {
|
970 |
+
$deprecated_properties[] = 'weights_range';
|
971 |
+
}
|
972 |
+
if (preg_match('/^\\s*(\[|\])?' . $float_value_regex . '=>' . $float_value_regex . '(\[|\])?\\s*$/', $row['weights_range']['value'], $result)) {
|
973 |
+
$min_weight_included = $result[1] == '[';
|
974 |
+
$min_weight = $result[2] == '*' ? -1 : (float) $result[2];
|
975 |
+
$max_weight = $result[3] == '*' ? -1 : (float) $result[3];
|
976 |
+
$max_weight_included = !isset($result[4]) || $result[4] == ']' || $result[4] == '';
|
977 |
+
|
978 |
+
if ($min_weight != -1) {
|
979 |
+
$conditions[] = '{cart.weight}>' . ($min_weight_included ? '=' : '') . $min_weight;
|
980 |
+
}
|
981 |
+
if ($max_weight != -1) {
|
982 |
+
$conditions[] = '{cart.weight}<' . ($max_weight_included ? '=' : '') . $max_weight;
|
983 |
+
}
|
984 |
+
}
|
985 |
+
else {
|
986 |
+
$this->addMessage('error', $row, null, 'Unrecognized value of deprecated property %s %s', '<span class="osh-key">weights_range</span>', '<span class="osh-formula">' . $row['weights_range']['value'] . '</span>');
|
987 |
+
}
|
988 |
+
unset($row['weights_range']);
|
989 |
+
}
|
990 |
+
if (isset($row['product_properties'])) {
|
991 |
+
if (!in_array('product_properties', $deprecated_properties)) {
|
992 |
+
$deprecated_properties[] = 'product_properties';
|
993 |
+
}
|
994 |
+
$product_property_regex = "\\s*(and|or)? *\((?:(all|any|sum) )?(attribute|option) '([^'\)]+)' ?(==|=|<=|>=|<|>|!=) ?(" . self::$FLOAT_REGEX . "|true|false|'[^'\)]*')\)\\s*";
|
995 |
+
if (preg_match('/^(' . $product_property_regex . ')+$/', $row['product_properties']['value'], $result)) {
|
996 |
+
preg_match_all('/' . $product_property_regex . '/', $row['product_properties']['value'], $results, PREG_SET_ORDER);
|
997 |
+
$product_properties_condition = '';
|
998 |
+
foreach ($results as $result) {
|
999 |
+
$and_or = $result[1];
|
1000 |
+
if ($and_or == '') {
|
1001 |
+
$and_or = 'and';
|
1002 |
+
}
|
1003 |
+
$any_all_sum = $result[2];
|
1004 |
+
if ($any_all_sum == '') {
|
1005 |
+
$any_all_sum = 'any';
|
1006 |
+
}
|
1007 |
+
$property_type = $result[3];
|
1008 |
+
$property_name = $result[4];
|
1009 |
+
$cmp_symbol = $result[5];
|
1010 |
+
if ($cmp_symbol == '=') {
|
1011 |
+
$cmp_symbol = '==';
|
1012 |
+
}
|
1013 |
+
$cmp_value = $result[6];
|
1014 |
+
|
1015 |
+
$product_properties_condition .= $product_properties_condition == '' ? '' : ' ' . $and_or . ' ';
|
1016 |
+
switch ($any_all_sum) {
|
1017 |
+
case 'sum':
|
1018 |
+
$product_properties_condition .= "{sum product." . $property_type . "." . $property_name . "}" . $cmp_symbol . $cmp_value;
|
1019 |
+
break;
|
1020 |
+
case 'all':
|
1021 |
+
$product_properties_condition .= "{count products where product." . $property_type . "." . $property_name . $cmp_symbol . $cmp_value . "}=={products_quantity}";
|
1022 |
+
break;
|
1023 |
+
case 'any':
|
1024 |
+
$product_properties_condition .= "{count products where product." . $property_type . "." . $property_name . $cmp_symbol . $cmp_value . "}>0";
|
1025 |
+
break;
|
1026 |
+
default :
|
1027 |
+
break;
|
1028 |
+
}
|
1029 |
+
}
|
1030 |
+
if ($product_properties_condition != '') {
|
1031 |
+
$conditions[] = $product_properties_condition;
|
1032 |
+
}
|
1033 |
+
}
|
1034 |
+
else {
|
1035 |
+
$this->addMessage('error', $row, null, 'Unrecognized value of deprecated property %s %s', '<span class="osh-key">product_properties</span>', '<span class="osh-formula">' . $row['product_properties']['value'] . '</span>');
|
1036 |
+
}
|
1037 |
+
unset($row['product_properties']);
|
1038 |
+
}
|
1039 |
+
if (count($conditions) > 0) {
|
1040 |
+
$row['conditions'] = array('value' => count($conditions) == 1 ? $conditions[0] : '(' . implode(') && (', $conditions) . ')');
|
1041 |
+
}
|
1042 |
+
|
1043 |
+
$fees = array();
|
1044 |
+
if (isset($row['fees_table'])) {
|
1045 |
+
if (!in_array('fees_table', $deprecated_properties)) {
|
1046 |
+
$deprecated_properties[] = 'fees_table';
|
1047 |
+
}
|
1048 |
+
$options_and_data = $this->_getOptionsAndData($row['fees_table']['value']);
|
1049 |
+
$options = $options_and_data['options'];
|
1050 |
+
$fees_table_string = $options_and_data['data'];
|
1051 |
+
|
1052 |
+
$var = null;
|
1053 |
+
if ($options == '') {
|
1054 |
+
$var = (isset($row['reference_value']) ? $row['reference_value']['value'] : 'weight');
|
1055 |
+
} else if (in_array($options, array('incl.tax', 'ttc'))) {
|
1056 |
+
$var = 'price_including_tax';
|
1057 |
+
} else if (in_array($options, array('excl.tax', 'ht'))) {
|
1058 |
+
$var = 'price_excluding_tax';
|
1059 |
+
}
|
1060 |
+
|
1061 |
+
if (isset($var)) {
|
1062 |
+
if ($var == 'price') {
|
1063 |
+
$var = 'price_excluding_tax';
|
1064 |
+
}
|
1065 |
+
if ($var == 'products_quantity') {
|
1066 |
+
$var = 'quantity';
|
1067 |
+
}
|
1068 |
+
if (preg_match('/^[[:space:]]*\*[[:space:]]*:[[:space:]]*(' . $float_value_regex . ')[[:space:]]*$/s', $fees_table_string, $result)) {
|
1069 |
+
$fees[] = $result[1];
|
1070 |
+
}
|
1071 |
+
else {
|
1072 |
+
$fees[] = "{table {cart." . $var . "} in " . str_replace(' ', '', $fees_table_string) . "}" . ($var == 'quantity' ? '*{cart.quantity}' : '');
|
1073 |
+
}
|
1074 |
+
}
|
1075 |
+
else {
|
1076 |
+
$this->addMessage('error', $row, null, 'Unrecognized value of deprecated property %s %s', '<span class="osh-key">fees_table</span>', '<span class="osh-formula">' . $row['fees_table']['value'] . '</span>');
|
1077 |
+
}
|
1078 |
+
unset($row['fees_table']);
|
1079 |
+
}
|
1080 |
+
if (isset($row['fees_formula'])) {
|
1081 |
+
if (!in_array('fees_formula', $deprecated_properties)) {
|
1082 |
+
$deprecated_properties[] = 'fees_formula';
|
1083 |
+
}
|
1084 |
+
$fees[] = str_replace(' ', '', $row['fees_formula']['value']);
|
1085 |
+
unset($row['fees_formula']);
|
1086 |
+
}
|
1087 |
+
if (isset($row['fixed_fees'])) {
|
1088 |
+
if (!in_array('fixed_fees', $deprecated_properties)) {
|
1089 |
+
$deprecated_properties[] = 'fixed_fees';
|
1090 |
+
}
|
1091 |
+
if ($row['fixed_fees']['value'] != 0 || count($fees) == 0) {
|
1092 |
+
$fees[] = str_replace(' ', '', $row['fixed_fees']['value']);
|
1093 |
+
}
|
1094 |
+
unset($row['fixed_fees']);
|
1095 |
+
}
|
1096 |
+
if (!isset($row['fees']) && count($fees) > 0) {
|
1097 |
+
$row['fees'] = array('value' => implode('+', $fees));
|
1098 |
+
}
|
1099 |
+
|
1100 |
+
$fs_fees = array();
|
1101 |
+
if (isset($row['free_shipping__fees_table'])) {
|
1102 |
+
if (!in_array('free_shipping__fees_table', $deprecated_properties)) {
|
1103 |
+
$deprecated_properties[] = 'free_shipping__fees_table';
|
1104 |
+
}
|
1105 |
+
$options_and_data = $this->_getOptionsAndData($row['free_shipping__fees_table']['value']);
|
1106 |
+
$options = $options_and_data['options'];
|
1107 |
+
$fees_table_string = $options_and_data['data'];
|
1108 |
+
|
1109 |
+
$var = null;
|
1110 |
+
if ($options == '') {
|
1111 |
+
$var = isset($row['reference_value']) ? $row['reference_value']['value'] : 'weight';
|
1112 |
+
} else if (in_array($options, array('incl.tax', 'ttc'))) {
|
1113 |
+
$var = 'price_including_tax';
|
1114 |
+
} else if (in_array($options, array('excl.tax', 'ht'))) {
|
1115 |
+
$var = 'price_excluding_tax';
|
1116 |
+
}
|
1117 |
+
if ($var == 'price') {
|
1118 |
+
$var = 'price_excluding_tax';
|
1119 |
+
}
|
1120 |
+
|
1121 |
+
if (isset($var)) {
|
1122 |
+
if ($var == 'price') {
|
1123 |
+
$var = 'price_excluding_tax';
|
1124 |
+
}
|
1125 |
+
if ($var == 'products_quantity') {
|
1126 |
+
$var = 'quantity';
|
1127 |
+
}
|
1128 |
+
if (preg_match('/^[[:space:]]*\*[[:space:]]*:[[:space:]]*(' . $float_value_regex . ')[[:space:]]*$/s', $fees_table_string, $result)) {
|
1129 |
+
$fs_fees[] = $result[1];
|
1130 |
+
}
|
1131 |
+
else {
|
1132 |
+
$fs_fees[] = "{table {cart." . $var . "} in " . str_replace(' ', '', $fees_table_string) . "}" . ($var == 'quantity' ? '*{cart.quantity}' : '');
|
1133 |
+
}
|
1134 |
+
}
|
1135 |
+
else {
|
1136 |
+
$this->addMessage('error', $row, null, 'Unrecognized value of deprecated property %s %s', '<span class="osh-key">free_shipping__fees_table</span>', '<span class="osh-formula">' . $row['free_shipping__fees_table']['value'] . '</span>');
|
1137 |
+
}
|
1138 |
+
unset($row['free_shipping__fees_table']);
|
1139 |
+
}
|
1140 |
+
if (isset($row['free_shipping__fees_formula'])) {
|
1141 |
+
if (!in_array('free_shipping__fees_formula', $deprecated_properties)) {
|
1142 |
+
$deprecated_properties[] = 'free_shipping__fees_formula';
|
1143 |
+
}
|
1144 |
+
$fs_fees[] = str_replace(' ', '', $row['free_shipping__fees_formula']['value']);
|
1145 |
+
unset($row['free_shipping__fees_formula']);
|
1146 |
+
}
|
1147 |
+
if (isset($row['free_shipping__fixed_fees'])) {
|
1148 |
+
if (!in_array('free_shipping__fixed_fees', $deprecated_properties)) {
|
1149 |
+
$deprecated_properties[] = 'free_shipping__fixed_fees';
|
1150 |
+
}
|
1151 |
+
if ($row['free_shipping__fixed_fees']['value'] != 0 || count($fees) == 0) {
|
1152 |
+
$fs_fees[] = str_replace(' ', '', $row['free_shipping__fixed_fees']['value']);
|
1153 |
+
}
|
1154 |
+
unset($row['free_shipping__fixed_fees']);
|
1155 |
+
}
|
1156 |
+
|
1157 |
+
if (isset($row['reference_value'])) {
|
1158 |
+
if (!in_array('reference_value', $deprecated_properties)) {
|
1159 |
+
$deprecated_properties[] = 'reference_value';
|
1160 |
+
}
|
1161 |
+
unset($row['reference_value']);
|
1162 |
+
}
|
1163 |
+
|
1164 |
+
if (count($fs_fees) > 0) {
|
1165 |
+
$row2 = $row;
|
1166 |
+
if (isset($row['code'])) {
|
1167 |
+
$row2['code']['value'] = $row['code']['value'] . '__free_shipping';
|
1168 |
+
}
|
1169 |
+
$row2['fees']['value'] = implode('+', $fs_fees);
|
1170 |
+
$row2['conditions']['value'] = isset($row2['conditions']) ? '(' . $row2['conditions'] + ') and {free_shipping}' : '{free_shipping}';
|
1171 |
+
$row['conditions']['value'] = isset($row['conditions']) ? '(' . $row['conditions'] + ') and !{free_shipping}' : '!{free_shipping}';
|
1172 |
+
if (isset($row['free_shipping__label'])) {
|
1173 |
+
if (!in_array('free_shipping__label', $deprecated_properties)) {
|
1174 |
+
$deprecated_properties[] = 'free_shipping__label';
|
1175 |
+
}
|
1176 |
+
$row2['label']['value'] = $row['free_shipping__label']['value'];
|
1177 |
+
unset($row['free_shipping__label']);
|
1178 |
+
unset($row2['free_shipping__label']);
|
1179 |
+
}
|
1180 |
+
$this->_addRow($row2);
|
1181 |
+
}
|
1182 |
+
if (count($unknown_properties) > 0) {
|
1183 |
+
$this->addMessage('error', $row, null, 'Usage of unknown properties %s', ': <span class="osh-key">' . implode('</span>, <span class="osh-key">', $unknown_properties) . '</span>');
|
1184 |
+
}
|
1185 |
+
if (count($deprecated_properties) > 0) {
|
1186 |
+
$this->addMessage('warning', $row, null, 'Usage of deprecated properties %s', ': <span class="osh-key">' . implode('</span>, <span class="osh-key">', $deprecated_properties) . '</span>');
|
1187 |
+
}
|
1188 |
+
if (count($obsolete_disabling_method) > 0) {
|
1189 |
+
$this->addMessage('warning', $row, null, 'Usage of obsolete method to disabling a shipping method (`#` before `{`)%s', '<div class="code">' . implode('<br />', $obsolete_disabling_method) . '</div>');
|
1190 |
+
}
|
1191 |
+
if (count($missing_semicolon) > 0) {
|
1192 |
+
$this->addMessage('warning', $row, null, 'A semicolon is missing at the end of following lines %s', '<div class="code">' . implode('<br />', $missing_semicolon) . '</div>');
|
1193 |
+
}
|
1194 |
+
$this->_addRow($row);
|
1195 |
+
}
|
1196 |
+
if (trim($config_string) != '') {
|
1197 |
+
$this->_addIgnoredLines(trim($config_string));
|
1198 |
+
$row = null;
|
1199 |
+
$this->addMessage('info', $row, null, 'Ignored lines %s', '<div class="code">' . trim($config_string) . '</div>');
|
1200 |
+
}
|
1201 |
+
}
|
1202 |
+
|
1203 |
+
public function addMessage($type, &$row, $property) {
|
1204 |
+
$args = func_get_args();
|
1205 |
+
array_shift($args);
|
1206 |
+
array_shift($args);
|
1207 |
+
array_shift($args);
|
1208 |
+
$message = new OCS_Message($type, $args);
|
1209 |
+
if (isset($row)) {
|
1210 |
+
if (isset($property)) {
|
1211 |
+
$row[$property]['messages'][] = $message;
|
1212 |
+
} else {
|
1213 |
+
$row['*messages'][] = $message;
|
1214 |
+
}
|
1215 |
+
}
|
1216 |
+
$this->_messages[] = $message;
|
1217 |
+
self::debug(' => <span class="osh-' . $message->type . '">' . $message->toString() . '</span>', 1);
|
1218 |
+
}
|
1219 |
+
|
1220 |
+
protected function _addRow(&$row) {
|
1221 |
+
if (isset($row['code'])) {
|
1222 |
+
$key = $row['code']['value'];
|
1223 |
+
if (isset($this->_config[$key])) {
|
1224 |
+
$this->addMessage('error', $row, 'code', 'The property `code` must be unique, `%s` has been found twice', $key);
|
1225 |
+
}
|
1226 |
+
while (isset($this->_config[$key])) {
|
1227 |
+
$key .= rand(0, 9);
|
1228 |
+
}
|
1229 |
+
} else {
|
1230 |
+
$i = 1;
|
1231 |
+
do {
|
1232 |
+
$key = 'code_auto' . sprintf('%03d', $i);
|
1233 |
+
$i++;
|
1234 |
+
} while (isset($this->_config[$key]));
|
1235 |
+
}
|
1236 |
+
$row['*code'] = $key;
|
1237 |
+
$this->_config[$key] = $row;
|
1238 |
+
}
|
1239 |
+
|
1240 |
+
protected function _addIgnoredLines($lines) {
|
1241 |
+
$this->_config[] = array('lines' => $lines);
|
1242 |
+
}
|
1243 |
+
|
1244 |
+
protected function _addressMatch($address_filter, $address) {
|
1245 |
+
$excluding = false;
|
1246 |
+
if (preg_match('# *\* *- *\((.*)\) *#s', $address_filter, $result)) {
|
1247 |
+
$address_filter = $result[1];
|
1248 |
+
$excluding = true;
|
1249 |
+
}
|
1250 |
+
|
1251 |
+
$tmp_address_filter_array = explode(',', trim($address_filter));
|
1252 |
+
|
1253 |
+
$concat = false;
|
1254 |
+
$concatened = '';
|
1255 |
+
$address_filter_array = array();
|
1256 |
+
$i = 0;
|
1257 |
+
|
1258 |
+
foreach ($tmp_address_filter_array as $address_filter) {
|
1259 |
+
if ($concat) {
|
1260 |
+
$concatened .= ',' . $address_filter;
|
1261 |
+
} else {
|
1262 |
+
if ($i < count($tmp_address_filter_array) - 1 && preg_match('#\(#', $address_filter)) {
|
1263 |
+
$concat = true;
|
1264 |
+
$concatened .= $address_filter;
|
1265 |
+
}
|
1266 |
+
else {
|
1267 |
+
$address_filter_array[] = $address_filter;
|
1268 |
+
}
|
1269 |
+
}
|
1270 |
+
if (preg_match('#\)#', $address_filter)) {
|
1271 |
+
$address_filter_array[] = $concatened;
|
1272 |
+
$concatened = '';
|
1273 |
+
$concat = false;
|
1274 |
+
}
|
1275 |
+
$i++;
|
1276 |
+
}
|
1277 |
+
|
1278 |
+
foreach ($address_filter_array as $address_filter) {
|
1279 |
+
if (preg_match('# *([A-Z]{2}) *(-)? *(?:\( *(-)? *(.*)\))? *#s', $address_filter, $result)) {
|
1280 |
+
$country_code = $result[1];
|
1281 |
+
if ($address['country_code'] == $country_code) {
|
1282 |
+
self::debug(' country code <span class="osh-replacement">' . $address['country_code'] . '</span> matches', 5);
|
1283 |
+
if (!isset($result[4]) || $result[4] == '') {
|
1284 |
+
return !$excluding;
|
1285 |
+
}
|
1286 |
+
else {
|
1287 |
+
$region_codes = explode(',', $result[4]);
|
1288 |
+
$in_array = false;
|
1289 |
+
for ($i = count($region_codes); --$i >= 0;) {
|
1290 |
+
$code = trim($region_codes[$i]);
|
1291 |
+
$region_codes[$i] = $code;
|
1292 |
+
if ($address['region_code'] === $code) {
|
1293 |
+
self::debug(' region code <span class="osh-replacement">' . $address['region_code'] . '</span> matches', 5);
|
1294 |
+
$in_array = true;
|
1295 |
+
} else if ($address['postcode'] === $code) {
|
1296 |
+
self::debug(' postcode <span class="osh-replacement">' . $address['postcode'] . '</span> matches', 5);
|
1297 |
+
$in_array = true;
|
1298 |
+
} else if (strpos($code, '*') !== false && preg_match('/^' . str_replace('*', '(?:.*)', $code) . '$/', $address['postcode'])) {
|
1299 |
+
self::debug(' postcode <span class="osh-replacement">' . $address['postcode'] . '</span> matches <span class="osh-formula">' . $code . '</span>', 5);
|
1300 |
+
$in_array = true;
|
1301 |
+
}
|
1302 |
+
if ($in_array) {
|
1303 |
+
break;
|
1304 |
+
}
|
1305 |
+
}
|
1306 |
+
if (!$in_array) {
|
1307 |
+
self::debug(' region code <span class="osh-replacement">' . $address['region_code'] . '</span> and postcode <span class="osh-replacement">' . $address['postcode'] . '</span> don\'t match', 5);
|
1308 |
+
}
|
1309 |
+
// Vérification stricte
|
1310 |
+
$excluding_region = $result[2] == '-' || $result[3] == '-';
|
1311 |
+
if ($excluding_region && !$in_array || !$excluding_region && $in_array) {
|
1312 |
+
return !$excluding;
|
1313 |
+
}
|
1314 |
+
}
|
1315 |
+
}
|
1316 |
+
}
|
1317 |
+
}
|
1318 |
+
return $excluding;
|
1319 |
+
}
|
1320 |
+
|
1321 |
+
protected function _getProductProperty($product, $property_type, $property_name, $get_by_id = false) {
|
1322 |
+
switch ($property_type) {
|
1323 |
+
case 'attribute':
|
1324 |
+
case 'attributes': return $product->getAttribute($property_name, $get_by_id);
|
1325 |
+
case 'option':
|
1326 |
+
case 'options': return $product->getOption($property_name, $get_by_id);
|
1327 |
+
case 'stock': return $product->getStockData($property_name);
|
1328 |
+
default: return null;
|
1329 |
+
}
|
1330 |
+
return null;
|
1331 |
+
}
|
1332 |
+
|
1333 |
+
protected function _processProductProperty($products, $regex_result) {
|
1334 |
+
// COUNT, SUM or COUNT DISTINCT
|
1335 |
+
$operation = strtolower($regex_result[1]);
|
1336 |
+
switch ($operation) {
|
1337 |
+
case 'sum':
|
1338 |
+
case 'count distinct':
|
1339 |
+
$property_type = $regex_result[2];
|
1340 |
+
$property_name = $regex_result[3];
|
1341 |
+
$conditions = isset($regex_result[4]) ? $regex_result[4] : null;
|
1342 |
+
break;
|
1343 |
+
case 'count':
|
1344 |
+
$conditions = isset($regex_result[2]) ? $regex_result[2] : null;
|
1345 |
+
break;
|
1346 |
+
default:
|
1347 |
+
$conditions = null;
|
1348 |
+
break;
|
1349 |
+
}
|
1350 |
+
|
1351 |
+
self::debug(' :: start <span class="osh-replacement">' . $regex_result[0] . '</span>', 10);
|
1352 |
+
|
1353 |
+
$return_value = 0;
|
1354 |
+
|
1355 |
+
preg_match_all('/product\.(attribute(?:s)?|option(?:s)?|stock)\.([a-z0-9_]+)(?:\.(id))?/i', $conditions, $properties_regex_result, PREG_SET_ORDER);
|
1356 |
+
$properties = array();
|
1357 |
+
foreach ($properties_regex_result as $property_regex_result) {
|
1358 |
+
$key = $property_regex_result[0];
|
1359 |
+
if (!isset($properties[$key])) {
|
1360 |
+
$properties[$key] = $property_regex_result;
|
1361 |
+
}
|
1362 |
+
}
|
1363 |
+
|
1364 |
+
foreach ($products as $product) {
|
1365 |
+
if (isset($conditions) && $conditions != '') {
|
1366 |
+
$formula = $conditions;
|
1367 |
+
foreach ($properties as $property) {
|
1368 |
+
$value = $this->_getProductProperty(
|
1369 |
+
$product, $tmp_property_type = $property[1], $tmp_property_name = $property[2], $get_by_id = isset($property[3]) && $property[3] == 'id'
|
1370 |
+
);
|
1371 |
+
$from = $property[0];
|
1372 |
+
$to = is_string($value) || empty($value) ? "'" . $value . "'" : $value;
|
1373 |
+
$formula = str_replace($from, $to, $formula);
|
1374 |
+
self::debug(' replace <span class="osh-replacement">' . $from . '</span> by <span class="osh-replacement">' . $to . '</span> => <span class="osh-formula">' . str_replace($from, '<span class="osh-replacement">' . $to . '</span>', $formula) . '</span>', 5);
|
1375 |
+
}
|
1376 |
+
$eval_result = $this->_evalFormula($formula);
|
1377 |
+
if (!isset($eval_result)) {
|
1378 |
+
return 'null';
|
1379 |
+
}
|
1380 |
+
} else {
|
1381 |
+
$eval_result = true;
|
1382 |
+
}
|
1383 |
+
|
1384 |
+
if ($eval_result == true) {
|
1385 |
+
switch ($operation) {
|
1386 |
+
case 'sum':
|
1387 |
+
$value = $this->_getProductProperty($product, $property_type, $property_name);
|
1388 |
+
$return_value += $value * $product->getQuantity();
|
1389 |
+
break;
|
1390 |
+
case 'count distinct':
|
1391 |
+
if (!isset($distinct_values)) {
|
1392 |
+
$distinct_values = array();
|
1393 |
+
}
|
1394 |
+
$value = $this->_getProductProperty($product, $property_type, $property_name);
|
1395 |
+
if (!in_array($value, $distinct_values)) {
|
1396 |
+
$distinct_values[] = $value;
|
1397 |
+
$return_value++;
|
1398 |
+
}
|
1399 |
+
break;
|
1400 |
+
case 'count':
|
1401 |
+
$return_value += $product->getQuantity();
|
1402 |
+
break;
|
1403 |
+
default:
|
1404 |
+
break;
|
1405 |
+
}
|
1406 |
+
}
|
1407 |
+
}
|
1408 |
+
|
1409 |
+
self::debug(' :: end <span class="osh-replacement">' . $regex_result[0] . '</span>', 10);
|
1410 |
+
|
1411 |
+
return $return_value;
|
1412 |
+
}
|
1413 |
+
|
1414 |
+
}
|
1415 |
+
|
1416 |
+
interface OCS_Product {
|
1417 |
+
|
1418 |
+
public function getOption($option);
|
1419 |
+
|
1420 |
+
public function getAttribute($attribute);
|
1421 |
+
|
1422 |
+
public function getName();
|
1423 |
+
|
1424 |
+
public function getSku();
|
1425 |
+
|
1426 |
+
public function getQuantity();
|
1427 |
+
|
1428 |
+
public function getStockData($key);
|
1429 |
+
}
|
1430 |
+
|
1431 |
+
class OCS_Message {
|
1432 |
+
|
1433 |
+
public $type;
|
1434 |
+
public $message;
|
1435 |
+
public $args;
|
1436 |
+
|
1437 |
+
public function OCS_Message($type, $args) {
|
1438 |
+
$this->type = $type;
|
1439 |
+
$this->message = array_shift($args);
|
1440 |
+
$this->args = $args;
|
1441 |
+
}
|
1442 |
+
|
1443 |
+
public function toString() {
|
1444 |
+
return vsprintf($this->message, $this->args);
|
1445 |
+
}
|
1446 |
+
|
1447 |
+
}
|
1448 |
+
|
1449 |
+
class OCS_Result {
|
1450 |
+
|
1451 |
+
public $success;
|
1452 |
+
public $result;
|
1453 |
+
|
1454 |
+
public function OCS_Result($success, $result = null) {
|
1455 |
+
$this->success = $success;
|
1456 |
+
$this->result = $result;
|
1457 |
+
}
|
1458 |
+
|
1459 |
+
public function __toString() {
|
1460 |
+
return is_bool($this->result) ? ($this->result ? 'true' : 'false') : (string) $this->result;
|
1461 |
+
}
|
1462 |
+
|
1463 |
+
}
|
1464 |
+
|
1465 |
+
?>
|
app/code/community/Chronopost/Chronorelais/includes/countries.inc.php
CHANGED
@@ -1,525 +1,529 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
class Country
|
5 |
-
{
|
6 |
-
private static $LOADED = false;
|
7 |
-
private static $COUNTRIES = array(
|
8 |
-
'code2name' => array(
|
9 |
-
'AF' => 'Afghanistan',
|
10 |
-
'ZA' => 'Afrique du Sud',
|
11 |
-
'AX' => 'Åland',
|
12 |
-
'AL' => 'Albanie',
|
13 |
-
'DZ' => 'Algérie',
|
14 |
-
'DE' => 'Allemagne',
|
15 |
-
'AD' => 'Andorre',
|
16 |
-
'AO' => 'Angola',
|
17 |
-
'AI' => 'Anguilla',
|
18 |
-
'AQ' => 'Antarctique',
|
19 |
-
'AG' => 'Antigua-et-Barbuda',
|
20 |
-
'AN' => 'Antilles néerlandaises',
|
21 |
-
'SA' => 'Arabie saoudite',
|
22 |
-
'AR' => 'Argentine',
|
23 |
-
'AM' => 'Arménie',
|
24 |
-
'AW' => 'Aruba',
|
25 |
-
'AU' => 'Australie',
|
26 |
-
'AT' => 'Autriche',
|
27 |
-
'AZ' => 'Azerbaïdjan',
|
28 |
-
'BS' => 'Bahamas',
|
29 |
-
'BH' => 'Bahreïn',
|
30 |
-
'BD' => 'Bangladesh',
|
31 |
-
'BB' => 'Barbade',
|
32 |
-
'BY' => 'Biélorussie',
|
33 |
-
'BE' => 'Belgique',
|
34 |
-
'BZ' => 'Belize',
|
35 |
-
'BJ' => 'Bénin',
|
36 |
-
'BM' => 'Bermudes',
|
37 |
-
'BT' => 'Bhoutan',
|
38 |
-
'BO' => 'Bolivie',
|
39 |
-
'BA' => 'Bosnie-Herzégovine',
|
40 |
-
'BW' => 'Botswana',
|
41 |
-
'BV' => 'Île Bouvet',
|
42 |
-
'BR' => 'Brésil',
|
43 |
-
'BN' => 'Brunei',
|
44 |
-
'BG' => 'Bulgarie',
|
45 |
-
'BF' => 'Burkina Faso',
|
46 |
-
'BI' => 'Burundi',
|
47 |
-
'KY' => 'Îles Caïmans',
|
48 |
-
'KH' => 'Cambodge',
|
49 |
-
'CM' => 'Cameroun',
|
50 |
-
'CA' => 'Canada',
|
51 |
-
'CV' => 'Cap-Vert',
|
52 |
-
'CF' => 'République centrafricaine',
|
53 |
-
'CL' => 'Chili',
|
54 |
-
'CN' => 'Chine',
|
55 |
-
'CX' => 'Île Christmas',
|
56 |
-
'CY' => 'Chypre',
|
57 |
-
'CC' => 'Îles Cocos',
|
58 |
-
'CO' => 'Colombie',
|
59 |
-
'KM' => 'Comores',
|
60 |
-
'CG' => 'Congo',
|
61 |
-
'CD' => 'République démocratique du Congo',
|
62 |
-
'CK' => 'Îles Cook',
|
63 |
-
'KR' => 'Corée du Sud',
|
64 |
-
'KP' => 'Corée du Nord',
|
65 |
-
'CR' => 'Costa Rica',
|
66 |
-
'CI' => "Côte d'Ivoire",
|
67 |
-
'HR' => 'Croatie',
|
68 |
-
'CU' => 'Cuba',
|
69 |
-
'DK' => 'Danemark',
|
70 |
-
'DJ' => 'Djibouti',
|
71 |
-
'DO' => 'République dominicaine',
|
72 |
-
'DM' => 'Dominique',
|
73 |
-
'EG' => 'Égypte',
|
74 |
-
'SV' => 'Salvador',
|
75 |
-
'AE' => 'Émirats arabes unis',
|
76 |
-
'EC' => 'Équateur',
|
77 |
-
'ER' => 'Érythrée',
|
78 |
-
'ES' => 'Espagne',
|
79 |
-
'EE' => 'Estonie',
|
80 |
-
'US' => 'États-Unis',
|
81 |
-
'ET' => 'Éthiopie',
|
82 |
-
'FK' => 'Îles Malouines',
|
83 |
-
'FO' => 'Îles Féroé',
|
84 |
-
'FJ' => 'Fidji',
|
85 |
-
'FI' => 'Finlande',
|
86 |
-
'FR' => 'France',
|
87 |
-
'GA' => 'Gabon',
|
88 |
-
'GM' => 'Gambie',
|
89 |
-
'GE' => 'Géorgie',
|
90 |
-
'GS' => 'Géorgie du Sud-et-les Îles Sandwich du Sud',
|
91 |
-
'GH' => 'Ghana',
|
92 |
-
'GI' => 'Gibraltar',
|
93 |
-
'GR' => 'Grèce',
|
94 |
-
'GD' => 'Grenade',
|
95 |
-
'GL' => 'Groenland',
|
96 |
-
'GP' => 'Guadeloupe',
|
97 |
-
'GU' => 'Guam',
|
98 |
-
'GT' => 'Guatemala',
|
99 |
-
'GG' => 'Guernesey',
|
100 |
-
'GN' => 'Guinée',
|
101 |
-
'GW' => 'Guinée-Bissau',
|
102 |
-
'GQ' => 'Guinée équatoriale',
|
103 |
-
'GY' => 'Guyana',
|
104 |
-
'GF' => 'Guyane Française',
|
105 |
-
'HT' => 'Haïti',
|
106 |
-
'HM' => 'Îles Heard-et-MacDonald',
|
107 |
-
'HN' => 'Honduras',
|
108 |
-
'HK' => 'Hong Kong',
|
109 |
-
'HU' => 'Hongrie',
|
110 |
-
'IM' => 'Île de Man',
|
111 |
-
'UM' => 'Îles mineures éloignées des États-Unis',
|
112 |
-
'VG' => 'Îles Vierges britanniques',
|
113 |
-
'VI' => 'Îles Vierges américaines',
|
114 |
-
'IN' => 'Inde',
|
115 |
-
'ID' => 'Indonésie',
|
116 |
-
'IR' => 'Iran',
|
117 |
-
'IQ' => 'Irak',
|
118 |
-
'IE' => 'Irlande',
|
119 |
-
'IS' => 'Islande',
|
120 |
-
'IL' => 'Israël',
|
121 |
-
'IT' => 'Italie',
|
122 |
-
'JM' => 'Jamaïque',
|
123 |
-
'JP' => 'Japon',
|
124 |
-
'JE' => 'Jersey',
|
125 |
-
'JO' => 'Jordanie',
|
126 |
-
'KZ' => 'Kazakhstan',
|
127 |
-
'KE' => 'Kenya',
|
128 |
-
'KG' => 'Kirghizistan',
|
129 |
-
'KI' => 'Kiribati',
|
130 |
-
'KW' => 'Koweït',
|
131 |
-
'LA' => 'Laos',
|
132 |
-
'LS' => 'Lesotho',
|
133 |
-
'LV' => 'Lettonie',
|
134 |
-
'LB' => 'Liban',
|
135 |
-
'LR' => 'Libéria',
|
136 |
-
'LY' => 'Libye',
|
137 |
-
'LI' => 'Liechtenstein',
|
138 |
-
'LT' => 'Lituanie',
|
139 |
-
'LU' => 'Luxembourg',
|
140 |
-
'MO' => 'Macao',
|
141 |
-
|
142 |
-
'MG' => 'Madagascar',
|
143 |
-
'MY' => 'Malaisie',
|
144 |
-
'MW' => 'Malawi',
|
145 |
-
'MV' => 'Maldives',
|
146 |
-
'ML' => 'Mali',
|
147 |
-
'MT' => 'Malte',
|
148 |
-
'MP' => 'Îles Mariannes du Nord',
|
149 |
-
'MA' => 'Maroc',
|
150 |
-
'MH' => 'Îles Marshall',
|
151 |
-
'MQ' => 'Martinique',
|
152 |
-
'MU' => 'Île Maurice',
|
153 |
-
'MR' => 'Mauritanie',
|
154 |
-
'YT' => 'Mayotte',
|
155 |
-
'MX' => 'Mexique',
|
156 |
-
'FM' => 'Micronésie',
|
157 |
-
'MD' => 'Moldavie',
|
158 |
-
'MC' => 'Monaco',
|
159 |
-
'MN' => 'Mongolie',
|
160 |
-
'ME' => 'Monténégro',
|
161 |
-
'MS' => 'Montserrat',
|
162 |
-
'MZ' => 'Mozambique',
|
163 |
-
'MM' => 'Birmanie',
|
164 |
-
'NA' => 'Namibie',
|
165 |
-
'NR' => 'Nauru',
|
166 |
-
'NP' => 'Népal',
|
167 |
-
'NI' => 'Nicaragua',
|
168 |
-
'NE' => 'Niger',
|
169 |
-
'NG' => 'Nigéria',
|
170 |
-
'NU' => 'Niué',
|
171 |
-
'NF' => 'Île Norfolk',
|
172 |
-
'NO' => 'Norvège',
|
173 |
-
'NC' => 'Nouvelle-Calédonie',
|
174 |
-
'NZ' => 'Nouvelle-Zélande',
|
175 |
-
'IO' => "Territoire britannique de l'océan Indien",
|
176 |
-
'OM' => 'Oman',
|
177 |
-
'UG' => 'Ouganda',
|
178 |
-
'UZ' => 'Ouzbékistan',
|
179 |
-
'PK' => 'Pakistan',
|
180 |
-
'PW' => 'Palaos',
|
181 |
-
'PS' => 'Palestine',
|
182 |
-
'PA' => 'Panamá',
|
183 |
-
'PG' => 'Papouasie-Nouvelle-Guinée',
|
184 |
-
'PY' => 'Paraguay',
|
185 |
-
'NL' => 'Pays-Bas',
|
186 |
-
'PE' => 'Pérou',
|
187 |
-
'PH' => 'Philippines',
|
188 |
-
'PN' => 'Îles Pitcairn',
|
189 |
-
'PL' => 'Pologne',
|
190 |
-
'PF' => 'Polynésie Française',
|
191 |
-
'PR' => 'Porto Rico',
|
192 |
-
'PT' => 'Portugal',
|
193 |
-
'QA' => 'Qatar',
|
194 |
-
'RE' => 'La Réunion',
|
195 |
-
'RO' => 'Roumanie',
|
196 |
-
'GB' => 'Royaume-Uni',
|
197 |
-
'RU' => 'Russie',
|
198 |
-
'RW' => 'Rwanda',
|
199 |
-
'EH' => 'Sahara occidental',
|
200 |
-
'BL' => 'Saint-Barthélemy',
|
201 |
-
'KN' => 'Saint-Christophe-et-Niévès',
|
202 |
-
'SM' => 'Saint-Marin',
|
203 |
-
'MF' => 'Saint-Martin',
|
204 |
-
'PM' => 'Saint-Pierre-et-Miquelon',
|
205 |
-
'VA' => 'Vatican',
|
206 |
-
'VC' => 'Saint-Vincent-et-les Grenadines',
|
207 |
-
'SH' => 'Sainte-Hélène',
|
208 |
-
'LC' => 'Sainte-Lucie',
|
209 |
-
'SB' => 'Îles Salomon',
|
210 |
-
'WS' => 'Samoa',
|
211 |
-
'AS' => 'Samoa américaines',
|
212 |
-
'ST' => 'São Tomé-et-Principe',
|
213 |
-
'SN' => 'Sénégal',
|
214 |
-
'RS' => 'Serbie',
|
215 |
-
'SC' => 'Seychelles',
|
216 |
-
'SL' => 'Sierra Leone',
|
217 |
-
'SG' => 'Singapour',
|
218 |
-
'SK' => 'Slovaquie',
|
219 |
-
'SI' => 'Slovénie',
|
220 |
-
'SO' => 'Somalie',
|
221 |
-
'SD' => 'Soudan',
|
222 |
-
'LK' => 'Sri Lanka',
|
223 |
-
'SE' => 'Suède',
|
224 |
-
'CH' => 'Suisse',
|
225 |
-
'SR' => 'Suriname',
|
226 |
-
'SJ' => 'Svalbard et île Jan Mayen',
|
227 |
-
'SZ' => 'Swaziland',
|
228 |
-
'SY' => 'Syrie',
|
229 |
-
'TJ' => 'Tadjikistan',
|
230 |
-
'TW' => 'Taïwan',
|
231 |
-
'TZ' => 'Tanzanie',
|
232 |
-
'TD' => 'Tchad',
|
233 |
-
'CZ' => 'République tchèque',
|
234 |
-
'TF' => 'Terres Australes et Antarctiques Françaises',
|
235 |
-
'TH' => 'Thaïlande',
|
236 |
-
'TL' => 'Timor oriental',
|
237 |
-
'TG' => 'Togo',
|
238 |
-
'TK' => 'Tokelau',
|
239 |
-
'TO' => 'Tonga',
|
240 |
-
'TT' => 'Trinité-et-Tobago',
|
241 |
-
'TN' => 'Tunisie',
|
242 |
-
'TM' => 'Turkménistan',
|
243 |
-
'TC' => 'Îles Turques-et-Caïques',
|
244 |
-
'TR' => 'Turquie',
|
245 |
-
'TV' => 'Tuvalu',
|
246 |
-
'UA' => 'Ukraine',
|
247 |
-
'UY' => 'Uruguay',
|
248 |
-
'VU' => 'Vanuatu',
|
249 |
-
'VE' => 'Venezuela',
|
250 |
-
'VN' => 'Viêt Nam',
|
251 |
-
'WF' => 'Wallis-et-Futuna',
|
252 |
-
'YE' => 'Yémen',
|
253 |
-
'ZM' => 'Zambie',
|
254 |
-
'ZW' => 'Zimbabwe',
|
255 |
-
),
|
256 |
-
'code2soft-cleaned-name' => null,
|
257 |
-
'code2hard-cleaned-name' => null,
|
258 |
-
'replacement' => array(
|
259 |
-
'reunion' => 'RE',
|
260 |
-
'france-metropolitaine' => 'FR',
|
261 |
-
'guyane' => 'GF',
|
262 |
-
'taaf' => 'TF',
|
263 |
-
'terres-australes-francaises' => 'TF',
|
264 |
-
'usa' => 'US',
|
265 |
-
'hollande' => 'NL',
|
266 |
-
'grande-bretagne' => 'GB',
|
267 |
-
'vietnam' => 'VN',
|
268 |
-
'belarus' => 'BY',
|
269 |
-
'brunei-darussalam' => 'BN',
|
270 |
-
'cayman' => 'KY',
|
271 |
-
'caiman' => 'KY',
|
272 |
-
'caimanes' => 'KY',
|
273 |
-
'cocos-keeling' => 'CC',
|
274 |
-
'keeling' => 'CC',
|
275 |
-
'centrafrique' => 'CF',
|
276 |
-
'congo-brazzaville' => 'CG',
|
277 |
-
'congo-kinshasa' => 'CD',
|
278 |
-
'zaire' => 'CD',
|
279 |
-
'san-marin' => 'SM',
|
280 |
-
'surinam' => 'SR',
|
281 |
-
'myanmar' => 'MM',
|
282 |
-
'saint-christophe-nevis' => 'KN',
|
283 |
-
'saint-kitts-nevis' => 'KN',
|
284 |
-
'falkland' => 'FK',
|
285 |
-
'el-salvador' => 'SV',
|
286 |
-
'lithuanie' => 'LT',
|
287 |
-
'turks-caiques' => 'TC',
|
288 |
-
'vierges-des-etats-unis' => 'VI',
|
289 |
-
'etat-de-la-cite-du-vatican' => 'VA',
|
290 |
-
'etats-federes-de-micronesie' => 'FM',
|
291 |
-
'r-a-s-chinoise-de-hong-kong' => 'HK',
|
292 |
-
'r-a-s-chinoise-de-macao' => 'MO',
|
293 |
-
),
|
294 |
-
);
|
295 |
-
|
296 |
-
public static function loadCache() {
|
297 |
-
$filename = 'var/cache/countries.txt';
|
298 |
-
if (!file_exists($filename)) {
|
299 |
-
self::$COUNTRIES['code2soft-cleaned-name'] = array();
|
300 |
-
self::$COUNTRIES['code2hard-cleaned-name'] = array();
|
301 |
-
foreach (self::$COUNTRIES['code2name'] as $_code => $_name) {
|
302 |
-
$soft_cleaned = self::softClean($_name);
|
303 |
-
self::$COUNTRIES['code2soft-cleaned-name'][$_code] = $soft_cleaned;
|
304 |
-
self::$COUNTRIES['code2hard-cleaned-name'][$_code] = self::hardClean($soft_cleaned);
|
305 |
-
}
|
306 |
-
$fp = fopen($filename,'w');
|
307 |
-
fwrite($fp, serialize(self::$COUNTRIES));
|
308 |
-
//file_put_contents('var/cache/countries.txt',serialize(self::$COUNTRIES));
|
309 |
-
} else {
|
310 |
-
self::$COUNTRIES = unserialize(file_get_contents($filename));
|
311 |
-
}
|
312 |
-
}
|
313 |
-
|
314 |
-
public static function getCountryNameByCode($code) {
|
315 |
-
return isset(self::$COUNTRIES['code2name'][$code]) ? self::$COUNTRIES['code2name'][$code] : null;
|
316 |
-
}
|
317 |
-
|
318 |
-
public static function getCountryCodeByName($name, $name_type=null) {
|
319 |
-
$suffix = isset($name_type) ? $name_type.'-' : '';
|
320 |
-
if (!self::$LOADED) self::loadCache();
|
321 |
-
$code = array_search($name, self::$COUNTRIES['code2'.$suffix.'name']);
|
322 |
-
return $code!==false ? $code : null;
|
323 |
-
}
|
324 |
-
|
325 |
-
public static function getCountryCodeByReplacedName($cleaned_name) {
|
326 |
-
if (isset(self::$COUNTRIES['replacement'][$cleaned_name])) return self::$COUNTRIES['replacement'][$cleaned_name];
|
327 |
-
return null;
|
328 |
-
}
|
329 |
-
|
330 |
-
public static function softClean($input) {
|
331 |
-
$input = mb_strtolower($input,'UTF-8');
|
332 |
-
$input = preg_replace('/[ -\.]+/','-',trim($input));
|
333 |
-
//echo '"'.$input.'" => ';
|
334 |
-
$input = str_replace(
|
335 |
-
array(' ','ç','é','è','ê','ë','à','á','â','ä','ã','å','ô','ö','ù','û','ü','î','ï','ÿ'),
|
336 |
-
array('-','c','e','e','e','e','a','a','a','a','a','a','o','o','u','u','u','i','i','y'),
|
337 |
-
$input
|
338 |
-
);
|
339 |
-
//echo '"'.$input.'", ';
|
340 |
-
$input = preg_replace("/^st-/",'saint-',$input);
|
341 |
-
$input = preg_replace("/^ste-/",'sainte-',$input);
|
342 |
-
$input = preg_replace("/-&-/",'-et-',$input);
|
343 |
-
return $input;
|
344 |
-
}
|
345 |
-
|
346 |
-
public static function hardClean($input) {
|
347 |
-
//$output = preg_match('/ivoire/',$input);
|
348 |
-
//if ($output) echo '"'.$input.'" => ';
|
349 |
-
$input = preg_replace("/^(?:les|le|la|l'|ile|iles)-/",'',$input);
|
350 |
-
$input = preg_replace("/-(?:ile|iles)$/",'',$input);
|
351 |
-
$input = preg_replace("/-(?:(?:et|les)-)+/",'-',$input);
|
352 |
-
$input = preg_replace("/(?:[^a-z0-9]+)/",'-',$input);
|
353 |
-
//if ($output) echo '"'.$input.'",<br/>';
|
354 |
-
return $input;
|
355 |
-
}
|
356 |
-
|
357 |
-
}
|
358 |
-
|
359 |
-
class AddressFilter extends Country
|
360 |
-
{
|
361 |
-
private $data;
|
362 |
-
private $code;
|
363 |
-
private $name;
|
364 |
-
private $classes;
|
365 |
-
private $label;
|
366 |
-
private $arranged;
|
367 |
-
private $address_filters_list;
|
368 |
-
|
369 |
-
public function AddressFilter($data) {
|
370 |
-
//$input = trim($input);
|
371 |
-
$this->data = $data;
|
372 |
-
$this->classes = array();
|
373 |
-
$this->address_filters_list = null;
|
374 |
-
$this->parse();
|
375 |
-
}
|
376 |
-
|
377 |
-
public function parse($recursive=true) {
|
378 |
-
if (strlen($this->data['country_code'])==2) {
|
379 |
-
$code = strtoupper($this->data['country_code']);
|
380 |
-
$name = Country::getCountryNameByCode($code);
|
381 |
-
|
382 |
-
if (isset($name)) {
|
383 |
-
$this->code = $code;
|
384 |
-
$this->name = $name;
|
385 |
-
$this->classes[] = 'known';
|
386 |
-
}
|
387 |
-
}
|
388 |
-
if (!isset($this->name)) {
|
389 |
-
$code = Country::getCountryCodeByName($this->data['country_code']);
|
390 |
-
if (!isset($code)) {
|
391 |
-
$this->classes[] = 'soft-cleaned';
|
392 |
-
$cleaned_name = Country::softClean($this->data['country_code']);
|
393 |
-
$code = Country::getCountryCodeByName($cleaned_name,'soft-cleaned');
|
394 |
-
}
|
395 |
-
if (!isset($code)) {
|
396 |
-
$this->classes[] = 'replaced';
|
397 |
-
$code = Country::getCountryCodeByReplacedName($cleaned_name);
|
398 |
-
}
|
399 |
-
if (!isset($code)) {
|
400 |
-
$this->classes[] = 'hard-cleaned';
|
401 |
-
$cleaned_name = Country::hardClean($cleaned_name);
|
402 |
-
$code = Country::getCountryCodeByName($cleaned_name,'hard-cleaned');
|
403 |
-
}
|
404 |
-
if (!isset($code)) {
|
405 |
-
$this->classes[] = 'replaced';
|
406 |
-
$code = Country::getCountryCodeByReplacedName($cleaned_name);
|
407 |
-
}
|
408 |
-
if (isset($code)) {
|
409 |
-
$this->code = $code;
|
410 |
-
$this->name = Country::getCountryNameByCode($code);
|
411 |
-
$this->classes[] = 'known';
|
412 |
-
} else {
|
413 |
-
$this->classes[] = 'unknown';
|
414 |
-
}
|
415 |
-
}
|
416 |
-
|
417 |
-
if ($recursive && $this->hasClass('unknown')) {
|
418 |
-
if (!isset($cleaned_name)) $cleaned_name = Country::hardClean(Country::softClean($this->data['original']));
|
419 |
-
switch ($cleaned_name) {
|
420 |
-
case 'corse':
|
421 |
-
$this->data = array(
|
422 |
-
'exclusion' => false,
|
423 |
-
'country_code' => 'FR',
|
424 |
-
'region_codes' => '2A,2B',
|
425 |
-
'original' => $this->data['original'],
|
426 |
-
);
|
427 |
-
$this->classes = array('replaced');
|
428 |
-
$this->parse(false);
|
429 |
-
break;
|
430 |
-
case 'uk':
|
431 |
-
$this->data = array(
|
432 |
-
'exclusion' => false,
|
433 |
-
'country_code' => 'GB',
|
434 |
-
'region_codes' => '',
|
435 |
-
'original' => $this->data['original'],
|
436 |
-
);
|
437 |
-
$this->classes = array('replaced');
|
438 |
-
$this->parse(false);
|
439 |
-
break;
|
440 |
-
case 'union-europeenne':
|
441 |
-
case 'ue':
|
442 |
-
$this->createAddressFilterGroup(
|
443 |
-
array('DE','AT','BE','BG','CY','DK','ES','EE','FI','FR','GR','HU','IE','IT','LV','LT','LU','MT','NL','PL','PT','CZ','RO','GB','SK','SI','SE'),
|
444 |
-
$code = 'UE',
|
445 |
-
$name = 'Union européenne'
|
446 |
-
);
|
447 |
-
break;
|
448 |
-
case 'dom':
|
449 |
-
$this->createAddressFilterGroup(
|
450 |
-
array('GP','MQ','GF','RE'),
|
451 |
-
$code = 'DOM',
|
452 |
-
$name = "Département d'Outre-Mer"
|
453 |
-
);
|
454 |
-
break;
|
455 |
-
case 'com':
|
456 |
-
$this->createAddressFilterGroup(
|
457 |
-
array('PF','PM','WF','YT','MF','BL'),
|
458 |
-
$code = 'COM',
|
459 |
-
$name = "Collectivités d'Outre-Mer"
|
460 |
-
);
|
461 |
-
break;
|
462 |
-
case 'outre-mer':
|
463 |
-
$this->createAddressFilterGroup(
|
464 |
-
array('DOM','COM','NC','TF'),
|
465 |
-
$code = "Outre-Mer",
|
466 |
-
$name = "Outre-Mer"
|
467 |
-
);
|
468 |
-
break;
|
469 |
-
}
|
470 |
-
}
|
471 |
-
|
472 |
-
if ($this->hasClass('known')) {
|
473 |
-
if ($this->hasClass('replaced') || $this->hasClass('hard-cleaned')) $this->label = '<span class="bad">'.$this->data['original'].'</span> '.$this->name;
|
474 |
-
else $this->label = $this->name;
|
475 |
-
if (isset($this->data['region_codes']) && $this->data['region_codes']!='') {
|
476 |
-
$this->label .= ' ('.$this->data['region_codes'].')';
|
477 |
-
}
|
478 |
-
} else {
|
479 |
-
$this->label = $this->data['original'];
|
480 |
-
}
|
481 |
-
}
|
482 |
-
|
483 |
-
public function createAddressFilterGroup($countries, $code, $name) {
|
484 |
-
$this->address_filters_list = array();
|
485 |
-
foreach ($countries as $country_code) {
|
486 |
-
$this->address_filters_list[] = new AddressFilter(array('country_code' => $country_code, 'original' => $country_code));
|
487 |
-
}
|
488 |
-
$this->classes = array('known');
|
489 |
-
$this->code = $code;
|
490 |
-
$this->name = $name;
|
491 |
-
}
|
492 |
-
|
493 |
-
public function hasClass($class) {
|
494 |
-
return in_array($class,$this->classes);
|
495 |
-
}
|
496 |
-
|
497 |
-
public function __toString() {
|
498 |
-
$output = '';
|
499 |
-
if (isset($this->address_filters_list)) {
|
500 |
-
$compact_value = $this->code;
|
501 |
-
$full_value = $this->name;
|
502 |
-
$output .= '<span class="address-filter address-filter-group"'
|
503 |
-
.' full-value="'.$full_value.'" compact-value="'.$compact_value.'" original-value="'.$this->data['original'].'"><span class="address-filter-group-label">'.$this->label.'</span>';
|
504 |
-
foreach ($this->address_filters_list as $address_filter) {
|
505 |
-
$output .= $address_filter;
|
506 |
-
}
|
507 |
-
$output .= '</span>';
|
508 |
-
} else {
|
509 |
-
if (isset($this->code)) {
|
510 |
-
$compact_value = $this->code.(isset($this->data['region_codes']) && $this->data['region_codes']!='' ? '('.$this->data['region_codes'].')' : '');
|
511 |
-
$full_value = $this->name.(isset($this->data['region_codes']) && $this->data['region_codes']!='' ? ' ('.$this->data['region_codes'].')' : '');
|
512 |
-
} else {
|
513 |
-
$compact_value = $this->data['original'];
|
514 |
-
$full_value = $this->data['original'];
|
515 |
-
}
|
516 |
-
$output .= '<span class="address-filter country-'.$this->code.' '.implode(' ',$this->classes)
|
517 |
-
.'" country-code="'.$this->code.'" full-value="'.$full_value.'" compact-value="'.$compact_value.'" original-value="'.$this->data['original'].'">'
|
518 |
-
.$this->label.'</span>';
|
519 |
-
}
|
520 |
-
return $output;
|
521 |
-
}
|
522 |
-
}
|
523 |
-
|
524 |
-
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Country
|
5 |
+
{
|
6 |
+
private static $LOADED = false;
|
7 |
+
private static $COUNTRIES = array(
|
8 |
+
'code2name' => array(
|
9 |
+
'AF' => 'Afghanistan',
|
10 |
+
'ZA' => 'Afrique du Sud',
|
11 |
+
'AX' => 'Åland',
|
12 |
+
'AL' => 'Albanie',
|
13 |
+
'DZ' => 'Algérie',
|
14 |
+
'DE' => 'Allemagne',
|
15 |
+
'AD' => 'Andorre',
|
16 |
+
'AO' => 'Angola',
|
17 |
+
'AI' => 'Anguilla',
|
18 |
+
'AQ' => 'Antarctique',
|
19 |
+
'AG' => 'Antigua-et-Barbuda',
|
20 |
+
'AN' => 'Antilles néerlandaises',
|
21 |
+
'SA' => 'Arabie saoudite',
|
22 |
+
'AR' => 'Argentine',
|
23 |
+
'AM' => 'Arménie',
|
24 |
+
'AW' => 'Aruba',
|
25 |
+
'AU' => 'Australie',
|
26 |
+
'AT' => 'Autriche',
|
27 |
+
'AZ' => 'Azerbaïdjan',
|
28 |
+
'BS' => 'Bahamas',
|
29 |
+
'BH' => 'Bahreïn',
|
30 |
+
'BD' => 'Bangladesh',
|
31 |
+
'BB' => 'Barbade',
|
32 |
+
'BY' => 'Biélorussie',
|
33 |
+
'BE' => 'Belgique',
|
34 |
+
'BZ' => 'Belize',
|
35 |
+
'BJ' => 'Bénin',
|
36 |
+
'BM' => 'Bermudes',
|
37 |
+
'BT' => 'Bhoutan',
|
38 |
+
'BO' => 'Bolivie',
|
39 |
+
'BA' => 'Bosnie-Herzégovine',
|
40 |
+
'BW' => 'Botswana',
|
41 |
+
'BV' => 'Île Bouvet',
|
42 |
+
'BR' => 'Brésil',
|
43 |
+
'BN' => 'Brunei',
|
44 |
+
'BG' => 'Bulgarie',
|
45 |
+
'BF' => 'Burkina Faso',
|
46 |
+
'BI' => 'Burundi',
|
47 |
+
'KY' => 'Îles Caïmans',
|
48 |
+
'KH' => 'Cambodge',
|
49 |
+
'CM' => 'Cameroun',
|
50 |
+
'CA' => 'Canada',
|
51 |
+
'CV' => 'Cap-Vert',
|
52 |
+
'CF' => 'République centrafricaine',
|
53 |
+
'CL' => 'Chili',
|
54 |
+
'CN' => 'Chine',
|
55 |
+
'CX' => 'Île Christmas',
|
56 |
+
'CY' => 'Chypre',
|
57 |
+
'CC' => 'Îles Cocos',
|
58 |
+
'CO' => 'Colombie',
|
59 |
+
'KM' => 'Comores',
|
60 |
+
'CG' => 'Congo',
|
61 |
+
'CD' => 'République démocratique du Congo',
|
62 |
+
'CK' => 'Îles Cook',
|
63 |
+
'KR' => 'Corée du Sud',
|
64 |
+
'KP' => 'Corée du Nord',
|
65 |
+
'CR' => 'Costa Rica',
|
66 |
+
'CI' => "Côte d'Ivoire",
|
67 |
+
'HR' => 'Croatie',
|
68 |
+
'CU' => 'Cuba',
|
69 |
+
'DK' => 'Danemark',
|
70 |
+
'DJ' => 'Djibouti',
|
71 |
+
'DO' => 'République dominicaine',
|
72 |
+
'DM' => 'Dominique',
|
73 |
+
'EG' => 'Égypte',
|
74 |
+
'SV' => 'Salvador',
|
75 |
+
'AE' => 'Émirats arabes unis',
|
76 |
+
'EC' => 'Équateur',
|
77 |
+
'ER' => 'Érythrée',
|
78 |
+
'ES' => 'Espagne',
|
79 |
+
'EE' => 'Estonie',
|
80 |
+
'US' => 'États-Unis',
|
81 |
+
'ET' => 'Éthiopie',
|
82 |
+
'FK' => 'Îles Malouines',
|
83 |
+
'FO' => 'Îles Féroé',
|
84 |
+
'FJ' => 'Fidji',
|
85 |
+
'FI' => 'Finlande',
|
86 |
+
'FR' => 'France',
|
87 |
+
'GA' => 'Gabon',
|
88 |
+
'GM' => 'Gambie',
|
89 |
+
'GE' => 'Géorgie',
|
90 |
+
'GS' => 'Géorgie du Sud-et-les Îles Sandwich du Sud',
|
91 |
+
'GH' => 'Ghana',
|
92 |
+
'GI' => 'Gibraltar',
|
93 |
+
'GR' => 'Grèce',
|
94 |
+
'GD' => 'Grenade',
|
95 |
+
'GL' => 'Groenland',
|
96 |
+
'GP' => 'Guadeloupe',
|
97 |
+
'GU' => 'Guam',
|
98 |
+
'GT' => 'Guatemala',
|
99 |
+
'GG' => 'Guernesey',
|
100 |
+
'GN' => 'Guinée',
|
101 |
+
'GW' => 'Guinée-Bissau',
|
102 |
+
'GQ' => 'Guinée équatoriale',
|
103 |
+
'GY' => 'Guyana',
|
104 |
+
'GF' => 'Guyane Française',
|
105 |
+
'HT' => 'Haïti',
|
106 |
+
'HM' => 'Îles Heard-et-MacDonald',
|
107 |
+
'HN' => 'Honduras',
|
108 |
+
'HK' => 'Hong Kong',
|
109 |
+
'HU' => 'Hongrie',
|
110 |
+
'IM' => 'Île de Man',
|
111 |
+
'UM' => 'Îles mineures éloignées des États-Unis',
|
112 |
+
'VG' => 'Îles Vierges britanniques',
|
113 |
+
'VI' => 'Îles Vierges américaines',
|
114 |
+
'IN' => 'Inde',
|
115 |
+
'ID' => 'Indonésie',
|
116 |
+
'IR' => 'Iran',
|
117 |
+
'IQ' => 'Irak',
|
118 |
+
'IE' => 'Irlande',
|
119 |
+
'IS' => 'Islande',
|
120 |
+
'IL' => 'Israël',
|
121 |
+
'IT' => 'Italie',
|
122 |
+
'JM' => 'Jamaïque',
|
123 |
+
'JP' => 'Japon',
|
124 |
+
'JE' => 'Jersey',
|
125 |
+
'JO' => 'Jordanie',
|
126 |
+
'KZ' => 'Kazakhstan',
|
127 |
+
'KE' => 'Kenya',
|
128 |
+
'KG' => 'Kirghizistan',
|
129 |
+
'KI' => 'Kiribati',
|
130 |
+
'KW' => 'Koweït',
|
131 |
+
'LA' => 'Laos',
|
132 |
+
'LS' => 'Lesotho',
|
133 |
+
'LV' => 'Lettonie',
|
134 |
+
'LB' => 'Liban',
|
135 |
+
'LR' => 'Libéria',
|
136 |
+
'LY' => 'Libye',
|
137 |
+
'LI' => 'Liechtenstein',
|
138 |
+
'LT' => 'Lituanie',
|
139 |
+
'LU' => 'Luxembourg',
|
140 |
+
'MO' => 'Macao',
|
141 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|