Chronopost - Version 0.2.0

Version Notes

Version destinée à Magento 1.6.X et supérieures
------------
Support du multi-shipping.
Correction sur le filtrage des commandes pour l'export.
Correction du nom de point relais manquant dans les exports.
Modification de libellé en admin pour explication du Quickcost.

Download this release

Release Info

Developer Benjamin GOSSELET
Extension Chronopost
Version 0.2.0
Comparing to
See all releases


Code changes from version 0.1.7.1 to 0.2.0

Files changed (23) hide show
  1. app/code/community/Chronopost/Chronorelais/Block/Checkout/Multishipping/Shipping/Method/Chronorelais.php +52 -0
  2. app/code/community/Chronopost/Chronorelais/Block/Export/Orders/Grid.php +254 -236
  3. app/code/community/Chronopost/Chronorelais/Block/Sales/Shipment/Copy of Grid.php +0 -139
  4. app/code/community/Chronopost/Chronorelais/Block/Sales/Shipment/Grid-bkp-03-02-11.php +0 -143
  5. app/code/community/Chronopost/Chronorelais/Block/Sales/Shipment/Grid.php +203 -185
  6. app/code/community/Chronopost/Chronorelais/controllers/Checkout/MultishippingController.php +114 -0
  7. app/code/community/Chronopost/Chronorelais/controllers/Checkout/OnepageController.php +284 -656
  8. app/code/community/Chronopost/Chronorelais/controllers/ExportController.php +444 -445
  9. app/code/community/Chronopost/Chronorelais/controllers/ImportController.php +248 -248
  10. app/code/community/Chronopost/Chronorelais/controllers/Sales/ImpressionController.php +566 -555
  11. app/code/community/Chronopost/Chronorelais/controllers/Sales/Order/ShipmentController.php +274 -268
  12. app/code/community/Chronopost/Chronorelais/etc/config.xml +344 -339
  13. app/code/community/Chronopost/Chronorelais/etc/system.xml +964 -964
  14. app/design/frontend/default/default/layout/chronorelais.xml +59 -43
  15. app/design/frontend/default/default/template/chronorelais/checkout/multishipping/shipping.phtml +152 -0
  16. app/design/frontend/default/default/template/chronorelais/checkout/multishipping/shipping_method/chronorelais.phtml +30 -0
  17. app/design/frontend/default/default/template/chronorelais/checkout/onepage/shipping_method/chronorelais.phtml +29 -28
  18. app/locale/en_US/Chronopost_Chronorelais.csv +1 -0
  19. app/locale/fr_FR/Chronopost_Chronorelais.csv +1 -0
  20. package.xml +32 -26
  21. skin/frontend/default/default/chronorelais/chronorelais.css +46 -46
  22. skin/frontend/default/default/chronorelais/chronorelais.png +0 -0
  23. skin/frontend/default/default/chronorelais/chronorelaismap.js +569 -463
app/code/community/Chronopost/Chronorelais/Block/Checkout/Multishipping/Shipping/Method/Chronorelais.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Checkout
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
+ * One page checkout status
29
+ *
30
+ * @category Mage
31
+ * @category Mage
32
+ * @package Mage_Checkout
33
+ * @author Magento Core Team <core@magentocommerce.com>
34
+ */
35
+ class Chronopost_Chronorelais_Block_Checkout_Multishipping_Shipping_Method_Chronorelais extends Mage_Checkout_Block_Onepage_Abstract
36
+ {
37
+ protected $_chronorelais;
38
+
39
+ public function getChronorelais()
40
+ {
41
+ if (empty($this->_chronorelais)) {
42
+ $postcode = Mage::getSingleton('core/session')->getMultiPostcode();
43
+
44
+ $client = new SoapClient("http://wsshipping.chronopost.fr/soap.point.relais/services/ServiceRechercheBt?wsdl",array('trace'=> 0,'connection_timeout'=>10));
45
+ $webservbt = $client->__call("rechercheBtParCodeproduitEtCodepostalEtDate",array(0,$postcode,0));
46
+ $this->_chronorelais = $webservbt;
47
+ }
48
+
49
+ return $this->_chronorelais;
50
+ }
51
+
52
+ }
app/code/community/Chronopost/Chronorelais/Block/Export/Orders/Grid.php CHANGED
@@ -1,236 +1,254 @@
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->setDefaultSort('created_at');
10
- $this->setDefaultDir('DESC');
11
- $this->setSaveParametersInSession(true);
12
- }
13
-
14
- /**
15
- * Retrieve collection class
16
- *
17
- * @return string
18
- */
19
- protected function _getCollectionClass()
20
- {
21
- return 'sales/order_grid_collection';
22
- }
23
-
24
- protected function _prepareCollection()
25
- {
26
- $_chronopost_deliver_saturday = Mage::helper('chronorelais')->getConfigData('carriers/chronopost/deliver_on_saturday');
27
- $_chronorelais_deliver_saturday = Mage::helper('chronorelais')->getConfigData('carriers/chronorelais/deliver_on_saturday');
28
- if($_chronopost_deliver_saturday==1) { $_chronopost_deliver_saturday = 'Yes'; } else { $_chronopost_deliver_saturday = 'No';}
29
- if($_chronorelais_deliver_saturday==1) { $_chronorelais_deliver_saturday = 'Yes'; } else { $_chronorelais_deliver_saturday = 'No'; }
30
-
31
- $collection = Mage::getResourceModel($this->_getCollectionClass());
32
- $collection->join('order', 'main_table.entity_id = order.entity_id', 'shipping_description');
33
- $collection->join('order_payment', 'main_table.entity_id = order_payment.parent_id', 'method');
34
- $collection->getSelect()->joinLeft(array('oes' => Mage::getSingleton('core/resource')->getTableName('sales_chronopost_order_export_status')), 'main_table.entity_id = oes.order_id', array("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"));
35
- $collection->getSelect()->where('order.shipping_method LIKE "chronorelais%" OR order.shipping_method LIKE "chronopost%" OR order.shipping_method LIKE "chronoexpress%"');
36
-
37
- $this->setCollection($collection);
38
- return parent::_prepareCollection();
39
- }
40
-
41
- protected function _prepareColumns()
42
- {
43
-
44
- $this->addColumn('real_order_id', array(
45
- 'header'=> Mage::helper('sales')->__('Order #'),
46
- 'width' => '80px',
47
- 'type' => 'text',
48
- 'index' => 'increment_id',
49
- 'filter' => false,
50
- ));
51
-
52
- if (!Mage::app()->isSingleStoreMode()) {
53
- $this->addColumn('store_id', array(
54
- 'header' => Mage::helper('sales')->__('Purchased From (Store)'),
55
- 'index' => 'store_id',
56
- 'type' => 'store',
57
- 'store_view'=> true,
58
- 'display_deleted' => true,
59
- 'filter' => false,
60
- ));
61
- }
62
-
63
- $this->addColumn('created_at', array(
64
- 'header' => Mage::helper('sales')->__('Purchased On'),
65
- 'index' => 'created_at',
66
- 'type' => 'datetime',
67
- 'width' => '100px',
68
- 'filter' => false,
69
- ));
70
-
71
- $this->addColumn('billing_name', array(
72
- 'header' => Mage::helper('sales')->__('Bill to Name'),
73
- 'index' => 'billing_name',
74
- 'filter' => false,
75
- ));
76
-
77
- $this->addColumn('shipping_name', array(
78
- 'header' => Mage::helper('sales')->__('Ship to Name'),
79
- 'index' => 'shipping_name',
80
- 'filter' => false,
81
- ));
82
-
83
- $this->addColumn('base_grand_total', array(
84
- 'header' => Mage::helper('sales')->__('G.T. (Base)'),
85
- 'index' => 'base_grand_total',
86
- 'type' => 'currency',
87
- 'currency' => 'base_currency_code',
88
- 'filter' => false,
89
- ));
90
-
91
- $this->addColumn('grand_total', array(
92
- 'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
93
- 'index' => 'grand_total',
94
- 'type' => 'currency',
95
- 'currency' => 'order_currency_code',
96
- 'filter' => false,
97
- ));
98
-
99
- $this->addColumn('shipping_description', array(
100
- 'header'=> Mage::helper('sales')->__('Shipping Method'),
101
- 'width' => '80px',
102
- 'type' => 'text',
103
- 'index' => 'shipping_description',
104
- 'filter' => false,
105
- 'truncate' => 30,
106
- 'escape' => true,
107
- ));
108
-
109
- $this->addColumn('payment', array(
110
- 'header' => Mage::helper('sales')->__('Mode de Paiement'),
111
- 'index' => 'method',
112
- 'width' => '100px',
113
- 'type' => 'text',
114
- 'filter' => false,
115
- ));
116
-
117
- if($is_sending_day = Mage::helper('chronorelais')->isSendingDay()) {
118
- $this->addColumn('livraison_le_samedi', array(
119
- 'header' => Mage::helper('sales')->__('Livraison le Samedi'),
120
- 'index' => 'livraison_le_samedi',
121
- 'width' => '100px',
122
- 'class' => 'a-center',
123
- 'filter' => false,
124
- ));
125
- }
126
-
127
- $this->addColumn('main_table.status', array(
128
- 'header' => Mage::helper('sales')->__('Status'),
129
- 'index' => 'status',
130
- 'type' => 'options',
131
- 'width' => '70px',
132
- 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
133
- ));
134
-
135
- if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
136
- $this->addColumn('action',
137
- array(
138
- 'header' => Mage::helper('sales')->__('Action'),
139
- 'width' => '50px',
140
- 'type' => 'action',
141
- 'getter' => 'getId',
142
- 'actions' => array(
143
- array(
144
- 'caption' => Mage::helper('sales')->__('View'),
145
- 'url' => array('base'=>'adminhtml/sales_order/view'),
146
- 'field' => 'order_id'
147
- )
148
- ),
149
- 'filter' => false,
150
- 'sortable' => false,
151
- 'index' => 'stores',
152
- 'is_system' => true,
153
- ));
154
- }
155
-
156
- return parent::_prepareColumns();
157
- }
158
-
159
- protected function _prepareMassaction111()
160
- {
161
- $this->setMassactionIdField('entity_id');
162
- $this->getMassactionBlock()->setFormFieldName('order_ids');
163
- $this->getMassactionBlock()->setUseSelectAll(false);
164
-
165
- $this->getMassactionBlock()->addItem('export_css', array(
166
- 'label'=> Mage::helper('chronorelais')->__('Export CSS'),
167
- 'url' => $this->getUrl('*/*/exportcss'),
168
- ));
169
- $this->getMassactionBlock()->addItem('export_cso', array(
170
- 'label'=> Mage::helper('chronorelais')->__('Export CSO'),
171
- 'url' => $this->getUrl('*/*/exportcso'),
172
- ));
173
-
174
- return $this;
175
- }
176
-
177
- protected function _prepareMassaction()
178
- {
179
- $this->setMassactionIdField('entity_id');
180
- $this->getMassactionBlock()->setFormFieldName('order_ids');
181
- $this->getMassactionBlock()->setUseSelectAll(false);
182
-
183
- if($is_sending_day = Mage::helper('chronorelais')->isSendingDay()) {
184
- $shipping = array(
185
- 'Yes' => Mage::helper('chronorelais')->__('Yes'),
186
- 'No' => Mage::helper('chronorelais')->__('No'));
187
- $this->getMassactionBlock()->addItem('shipping', array(
188
- 'label' => Mage::helper('chronorelais')->__('Livraison le Samedi'),
189
- 'url' => $this->getUrl('*/*/massLivraisonSamediStatus', array('_current'=>true)),
190
- 'additional' => array(
191
- 'visibility' => array(
192
- 'name' => 'status',
193
- 'type' => 'select',
194
- 'class' => 'required-entry',
195
- 'style' => 'width:80px',
196
- 'label' => Mage::helper('chronorelais')->__('Status'),
197
- 'values' => $shipping
198
- )
199
- )
200
- ));
201
- }
202
-
203
- $export = array(
204
- 'css' => Mage::helper('chronorelais')->__('CSS Format'),
205
- 'cso' => Mage::helper('chronorelais')->__('CSO Format'));
206
- array_unshift($statuses, array('label'=>'', 'value'=>''));
207
- $this->getMassactionBlock()->addItem('export', array(
208
- 'label'=> Mage::helper('chronorelais')->__('Export'),
209
- 'url' => $this->getUrl('*/*/massExport', array('_current'=>true)),
210
- 'additional' => array(
211
- 'visibility' => array(
212
- 'name' => 'format',
213
- 'type' => 'select',
214
- 'class' => 'required-entry',
215
- 'label' => Mage::helper('chronorelais')->__('Format'),
216
- 'values' => $export
217
- )
218
- )
219
- ));
220
- return $this;
221
- }
222
-
223
- public function getRowUrl($row)
224
- {
225
- if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
226
- return $this->getUrl('adminhtml/sales_order/view', array('order_id' => $row->getId()));
227
- }
228
- return false;
229
- }
230
-
231
- public function getGridUrl()
232
- {
233
- return $this->getUrl('*/*/*', array('_current'=>true));
234
- }
235
-
236
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) { $_chronopost_deliver_saturday = 'Yes'; } else { $_chronopost_deliver_saturday = 'No';}
30
+ if($_chronorelais_deliver_saturday==1) { $_chronorelais_deliver_saturday = 'Yes'; } else { $_chronorelais_deliver_saturday = 'No'; }
31
+
32
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
33
+ $collection->join('order', 'main_table.entity_id = order.entity_id', 'shipping_description');
34
+ $collection->join('order_payment', 'main_table.entity_id = order_payment.parent_id', 'method');
35
+ $collection->getSelect()->joinLeft(array('oes' => Mage::getSingleton('core/resource')->getTableName('sales_chronopost_order_export_status')), 'main_table.entity_id = oes.order_id', array("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"));
36
+ $collection->getSelect()->where('order.shipping_method LIKE "chronorelais%" OR order.shipping_method LIKE "chronopost%" OR order.shipping_method LIKE "chronoexpress%"');
37
+
38
+ $this->setCollection($collection);
39
+ return parent::_prepareCollection();
40
+ }
41
+
42
+ protected function _addColumnFilterToCollection($column)
43
+ {
44
+ if ($this->getCollection()) {
45
+ $field = ( $column->getFilterIndex() ) ? $column->getFilterIndex() : $column->getIndex();
46
+ if ($column->getFilterConditionCallback()) {
47
+ call_user_func($column->getFilterConditionCallback(), $this->getCollection(), $column);
48
+ } else {
49
+ $cond = $column->getFilter()->getCondition();
50
+ if ($field && isset($cond)) {
51
+ // Le champ status est ambigu, il faut donc sp�cifier sa table lors de l'ajout pour filtrage
52
+ $this->getCollection()->addFieldToFilter($field == "status" ? "main_table.status" : $field, $cond);
53
+ }
54
+ }
55
+ }
56
+ return $this;
57
+ }
58
+
59
+ protected function _prepareColumns()
60
+ {
61
+
62
+ $this->addColumn('real_order_id', array(
63
+ 'header'=> Mage::helper('sales')->__('Order #'),
64
+ 'width' => '80px',
65
+ 'type' => 'text',
66
+ 'index' => 'increment_id',
67
+ 'filter' => false,
68
+ ));
69
+
70
+ if (!Mage::app()->isSingleStoreMode()) {
71
+ $this->addColumn('store_id', array(
72
+ 'header' => Mage::helper('sales')->__('Purchased From (Store)'),
73
+ 'index' => 'store_id',
74
+ 'type' => 'store',
75
+ 'store_view'=> true,
76
+ 'display_deleted' => true,
77
+ 'filter' => false,
78
+ ));
79
+ }
80
+
81
+ $this->addColumn('created_at', array(
82
+ 'header' => Mage::helper('sales')->__('Purchased On'),
83
+ 'index' => 'created_at',
84
+ 'type' => 'datetime',
85
+ 'width' => '100px',
86
+ 'filter' => false,
87
+ ));
88
+
89
+ $this->addColumn('billing_name', array(
90
+ 'header' => Mage::helper('sales')->__('Bill to Name'),
91
+ 'index' => 'billing_name',
92
+ 'filter' => false,
93
+ ));
94
+
95
+ $this->addColumn('shipping_name', array(
96
+ 'header' => Mage::helper('sales')->__('Ship to Name'),
97
+ 'index' => 'shipping_name',
98
+ 'filter' => false,
99
+ ));
100
+
101
+ $this->addColumn('base_grand_total', array(
102
+ 'header' => Mage::helper('sales')->__('G.T. (Base)'),
103
+ 'index' => 'base_grand_total',
104
+ 'type' => 'currency',
105
+ 'currency' => 'base_currency_code',
106
+ 'filter' => false,
107
+ ));
108
+
109
+ $this->addColumn('grand_total', array(
110
+ 'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
111
+ 'index' => 'grand_total',
112
+ 'type' => 'currency',
113
+ 'currency' => 'order_currency_code',
114
+ 'filter' => false,
115
+ ));
116
+
117
+ $this->addColumn('shipping_description', array(
118
+ 'header'=> Mage::helper('sales')->__('Shipping Method'),
119
+ 'width' => '80px',
120
+ 'type' => 'text',
121
+ 'index' => 'shipping_description',
122
+ 'filter' => false,
123
+ 'truncate' => 30,
124
+ 'escape' => true,
125
+ ));
126
+
127
+ $this->addColumn('payment', array(
128
+ 'header' => Mage::helper('sales')->__('Mode de Paiement'),
129
+ 'index' => 'method',
130
+ 'width' => '100px',
131
+ 'type' => 'text',
132
+ 'filter' => false,
133
+ ));
134
+
135
+ if($is_sending_day = Mage::helper('chronorelais')->isSendingDay()) {
136
+ $this->addColumn('livraison_le_samedi', array(
137
+ 'header' => Mage::helper('sales')->__('Livraison le Samedi'),
138
+ 'index' => 'livraison_le_samedi',
139
+ 'width' => '100px',
140
+ 'class' => 'a-center',
141
+ 'filter' => false,
142
+ ));
143
+ }
144
+
145
+ $this->addColumn('status', array(
146
+ 'header' => Mage::helper('sales')->__('Status'),
147
+ 'index' => 'status',
148
+ 'type' => 'options',
149
+ 'width' => '70px',
150
+ 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
151
+ ));
152
+
153
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
154
+ $this->addColumn('action',
155
+ array(
156
+ 'header' => Mage::helper('sales')->__('Action'),
157
+ 'width' => '50px',
158
+ 'type' => 'action',
159
+ 'getter' => 'getId',
160
+ 'actions' => array(
161
+ array(
162
+ 'caption' => Mage::helper('sales')->__('View'),
163
+ 'url' => array('base'=>'adminhtml/sales_order/view'),
164
+ 'field' => 'order_id'
165
+ )
166
+ ),
167
+ 'filter' => false,
168
+ 'sortable' => false,
169
+ 'index' => 'stores',
170
+ 'is_system' => true,
171
+ ));
172
+ }
173
+
174
+ return parent::_prepareColumns();
175
+ }
176
+
177
+ protected function _prepareMassaction111()
178
+ {
179
+ $this->setMassactionIdField('entity_id');
180
+ $this->getMassactionBlock()->setFormFieldName('order_ids');
181
+ $this->getMassactionBlock()->setUseSelectAll(false);
182
+
183
+ $this->getMassactionBlock()->addItem('export_css', array(
184
+ 'label'=> Mage::helper('chronorelais')->__('Export CSS'),
185
+ 'url' => $this->getUrl('*/*/exportcss'),
186
+ ));
187
+ $this->getMassactionBlock()->addItem('export_cso', array(
188
+ 'label'=> Mage::helper('chronorelais')->__('Export CSO'),
189
+ 'url' => $this->getUrl('*/*/exportcso'),
190
+ ));
191
+
192
+ return $this;
193
+ }
194
+
195
+ protected function _prepareMassaction()
196
+ {
197
+ $this->setMassactionIdField('entity_id');
198
+ $this->getMassactionBlock()->setFormFieldName('order_ids');
199
+ $this->getMassactionBlock()->setUseSelectAll(false);
200
+
201
+ if($is_sending_day = Mage::helper('chronorelais')->isSendingDay()) {
202
+ $shipping = array(
203
+ 'Yes' => Mage::helper('chronorelais')->__('Yes'),
204
+ 'No' => Mage::helper('chronorelais')->__('No'));
205
+ $this->getMassactionBlock()->addItem('shipping', array(
206
+ 'label' => Mage::helper('chronorelais')->__('Livraison le Samedi'),
207
+ 'url' => $this->getUrl('*/*/massLivraisonSamediStatus', array('_current'=>true)),
208
+ 'additional' => array(
209
+ 'visibility' => array(
210
+ 'name' => 'status',
211
+ 'type' => 'select',
212
+ 'class' => 'required-entry',
213
+ 'style' => 'width:80px',
214
+ 'label' => Mage::helper('chronorelais')->__('Status'),
215
+ 'values' => $shipping
216
+ )
217
+ )
218
+ ));
219
+ }
220
+
221
+ $export = array(
222
+ 'css' => Mage::helper('chronorelais')->__('CSS Format'),
223
+ 'cso' => Mage::helper('chronorelais')->__('CSO Format'));
224
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
225
+ $this->getMassactionBlock()->addItem('export', array(
226
+ 'label'=> Mage::helper('chronorelais')->__('Export'),
227
+ 'url' => $this->getUrl('*/*/massExport', array('_current'=>true)),
228
+ 'additional' => array(
229
+ 'visibility' => array(
230
+ 'name' => 'format',
231
+ 'type' => 'select',
232
+ 'class' => 'required-entry',
233
+ 'label' => Mage::helper('chronorelais')->__('Format'),
234
+ 'values' => $export
235
+ )
236
+ )
237
+ ));
238
+ return $this;
239
+ }
240
+
241
+ public function getRowUrl($row)
242
+ {
243
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
244
+ return $this->getUrl('adminhtml/sales_order/view', array('order_id' => $row->getId()));
245
+ }
246
+ return false;
247
+ }
248
+
249
+ public function getGridUrl()
250
+ {
251
+ return $this->getUrl('*/*/*', array('_current'=>true));
252
+ }
253
+
254
+ }
app/code/community/Chronopost/Chronorelais/Block/Sales/Shipment/Copy of Grid.php DELETED
@@ -1,139 +0,0 @@
1
- <?php
2
- class Chronopost_Chronorelais_Block_Sales_Shipment_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
- {
4
-
5
- public function __construct()
6
- {
7
- parent::__construct();
8
- $this->setId('sales_shipment_grid');
9
- $this->setDefaultSort('order_created_at');
10
- $this->setDefaultDir('DESC');
11
- }
12
-
13
- /**
14
- * Retrieve collection class
15
- *
16
- * @return string
17
- */
18
- protected function _getCollectionClass()
19
- {
20
- return 'sales/order_shipment_grid_collection';
21
- }
22
-
23
- protected function _prepareCollection()
24
- {
25
- $collection = Mage::getResourceModel($this->_getCollectionClass());
26
- $collection->getSelect()->columns(array('shipment_created_at' => 'main_table.created_at'));
27
- $collection->getSelect()->columns(array('shipment_increment_id' => 'main_table.increment_id'));
28
-
29
- $collection->getSelect()->joinLeft(array('ot' => $collection->getTable('sales/order')), 'main_table.order_id = ot.entity_id');
30
- $collection->getSelect()->joinLeft(array('ost' => $collection->getTable('sales/shipment_track')), 'ot.entity_id = ost.order_id');
31
-
32
- $collection->getSelect()->where('ot.shipping_method LIKE "chronorelais%" OR ot.shipping_method LIKE "chronopost%"');
33
- $this->setCollection($collection);
34
- return parent::_prepareCollection();
35
- }
36
-
37
- protected function _prepareColumns()
38
- {
39
- $this->addColumn('increment_id', array(
40
- 'header' => Mage::helper('sales')->__('Shipment #'),
41
- 'index' => 'shipment_increment_id',
42
- 'type' => 'text',
43
- ));
44
-
45
- $this->addColumn('shipment_created_at', array(
46
- 'header' => Mage::helper('sales')->__('Date Shipped'),
47
- 'index' => 'shipment_created_at',
48
- 'type' => 'datetime',
49
- ));
50
-
51
- $this->addColumn('order_increment_id', array(
52
- 'header' => Mage::helper('sales')->__('Order #'),
53
- 'index' => 'order_increment_id',
54
- 'type' => 'number',
55
- ));
56
-
57
- $this->addColumn('order_created_at', array(
58
- 'header' => Mage::helper('sales')->__('Order Date'),
59
- 'index' => 'order_created_at',
60
- 'type' => 'datetime',
61
- ));
62
-
63
- $this->addColumn('shipping_name', array(
64
- 'header' => Mage::helper('sales')->__('Ship to Name'),
65
- 'index' => 'shipping_name',
66
- ));
67
-
68
- $this->addColumn('total_qty', array(
69
- 'header' => Mage::helper('sales')->__('Total Qty'),
70
- 'index' => 'total_qty',
71
- 'type' => 'number',
72
- ));
73
-
74
- $this->addColumn('number', array(
75
- 'header' => Mage::helper('sales')->__('Tracking'),
76
- 'index' => 'number',
77
- ));
78
-
79
- $this->addColumn('title', array(
80
- 'header' => Mage::helper('sales')->__('Mode de transport'),
81
- 'index' => 'title',
82
- 'type' => 'text',
83
- ));
84
-
85
- $this->addColumn('download', array(
86
- 'header' => Mage::helper('chronorelais')->__('Etiquettes'),
87
- 'type' => 'action',
88
- 'getter' => 'getParentId',
89
- 'actions' => array(
90
- array(
91
- 'caption' => Mage::helper('chronorelais')->__('Imprimer'),
92
- 'url' => array(
93
- 'base'=>'chronorelais/sales_impression/print'
94
- ),
95
- 'field' => 'shipment_id'
96
- )
97
- ),
98
- 'filter' => false,
99
- 'sortable' => false,
100
- 'index' => 'stores'
101
- ));
102
-
103
- return parent::_prepareColumns();
104
- }
105
-
106
- public function getRowUrl($row)
107
- {
108
- if (!Mage::getSingleton('admin/session')->isAllowed('sales/order/shipment')) {
109
- return false;
110
- }
111
-
112
- return $this->getUrl('adminhtml/sales_shipment/view',
113
- array(
114
- 'shipment_id'=> $row->getParentId(),
115
- )
116
- );
117
- }
118
-
119
- protected function _prepareMassaction()
120
- {
121
- $this->setMassactionIdField('entity_id');
122
- $this->getMassactionBlock()->setFormFieldName('shipment_ids');
123
- $this->getMassactionBlock()->setUseSelectAll(false);
124
-
125
- // Impression des étiquettes
126
- /*$this->getMassactionBlock()->addItem('pdfshipments_order', array(
127
- 'label'=> Mage::helper('sales')->__('Imprimer les étiquettes'),
128
- 'url' => $this->getUrl('chronorelais/sales_impression/printMass'),
129
- ));*/
130
-
131
- return $this;
132
- }
133
-
134
- public function getGridUrl()
135
- {
136
- return $this->getUrl('*/*/*', array('_current' => true));
137
- }
138
-
139
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Chronopost/Chronorelais/Block/Sales/Shipment/Grid-bkp-03-02-11.php DELETED
@@ -1,143 +0,0 @@
1
- <?php
2
- class Chronopost_Chronorelais_Block_Sales_Shipment_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
- {
4
-
5
- public function __construct()
6
- {
7
- parent::__construct();
8
- $this->setId('sales_shipment_grid');
9
- $this->setDefaultSort('shipment_created_at');
10
- $this->setDefaultDir('DESC');
11
- }
12
-
13
- /**
14
- * Retrieve collection class
15
- *
16
- * @return string
17
- */
18
- protected function _getCollectionClass()
19
- {
20
- return 'sales/order_collection';
21
- }
22
-
23
- protected function _prepareCollection()
24
- {
25
- $collection = Mage::getResourceModel($this->_getCollectionClass());
26
- $collection->getSelect()->columns(array('shipment_created_at' => 'osg.created_at'));
27
- $collection->getSelect()->columns(array('shipment_increment_id' => 'osg.increment_id'));
28
- $collection->getSelect()->columns(array('shipping_method' => 'main_table.shipping_method'));
29
-
30
- $collection->getSelect()->joinLeft(array('ost' => $collection->getTable('sales/shipment_track')), 'main_table.entity_id = ost.order_id', array('if(isNull(ost.number) , "--" , ost.number) as number', 'if(isNull(ost.title) , "--" , ost.title) as title'));
31
- $collection->getSelect()->joinRight(array('osg' => $collection->getTable('sales/shipment_grid')), 'osg.order_id = main_table.entity_id');
32
- $collection->getSelect()->where('shipping_method LIKE "chronorelais%" OR shipping_method LIKE "chronopost%"');
33
- $collection->getSelect()->group('osg.entity_id');
34
-
35
-
36
- $this->setCollection($collection);
37
-
38
- return parent::_prepareCollection();
39
- }
40
-
41
- protected function _prepareColumns()
42
- {
43
- $this->addColumn('increment_id', array(
44
- 'header' => Mage::helper('sales')->__('Shipment #'),
45
- 'index' => 'shipment_increment_id',
46
- 'type' => 'text',
47
- ));
48
-
49
- $this->addColumn('shipment_created_at', array(
50
- 'header' => Mage::helper('sales')->__('Date Shipped'),
51
- 'index' => 'shipment_created_at',
52
- 'type' => 'datetime',
53
- ));
54
-
55
- $this->addColumn('order_increment_id', array(
56
- 'header' => Mage::helper('sales')->__('Order #'),
57
- 'index' => 'order_increment_id',
58
- 'type' => 'number',
59
- ));
60
-
61
- $this->addColumn('order_created_at', array(
62
- 'header' => Mage::helper('sales')->__('Order Date'),
63
- 'index' => 'order_created_at',
64
- 'type' => 'datetime',
65
- ));
66
-
67
- $this->addColumn('shipping_name', array(
68
- 'header' => Mage::helper('sales')->__('Ship to Name'),
69
- 'index' => 'shipping_name',
70
- ));
71
-
72
- $this->addColumn('total_qty', array(
73
- 'header' => Mage::helper('sales')->__('Total Qty'),
74
- 'index' => 'total_qty',
75
- 'type' => 'number',
76
- ));
77
-
78
- $this->addColumn('number', array(
79
- 'header' => Mage::helper('sales')->__('Tracking'),
80
- 'index' => 'number',
81
- ));
82
-
83
- $this->addColumn('title', array(
84
- 'header' => Mage::helper('sales')->__('Mode de transport'),
85
- 'index' => 'title',
86
- 'type' => 'text',
87
- ));
88
-
89
- $this->addColumn('download', array(
90
- 'header' => Mage::helper('chronorelais')->__('Etiquettes'),
91
- 'type' => 'action',
92
- 'getter' => 'getId',
93
- 'actions' => array(
94
- array(
95
- 'caption' => Mage::helper('chronorelais')->__('Imprimer'),
96
- 'url' => array(
97
- 'base'=>'chronorelais/sales_impression/print'
98
- ),
99
- 'field' => 'shipment_id'
100
- )
101
- ),
102
- 'filter' => false,
103
- 'sortable' => false,
104
- 'index' => 'stores'
105
- ));
106
-
107
- return parent::_prepareColumns();
108
- }
109
-
110
- public function getRowUrl($row)
111
- {
112
- if (!Mage::getSingleton('admin/session')->isAllowed('sales/order/shipment')) {
113
- return false;
114
- }
115
-
116
- return $this->getUrl('adminhtml/sales_shipment/view',
117
- array(
118
- 'shipment_id'=> $row->getId(),
119
- )
120
- );
121
- }
122
-
123
- protected function _prepareMassaction()
124
- {
125
- $this->setMassactionIdField('entity_id');
126
- $this->getMassactionBlock()->setFormFieldName('shipment_ids');
127
- $this->getMassactionBlock()->setUseSelectAll(false);
128
-
129
- // Impression des étiquettes
130
- /*$this->getMassactionBlock()->addItem('pdfshipments_order', array(
131
- 'label'=> Mage::helper('sales')->__('Imprimer les étiquettes'),
132
- 'url' => $this->getUrl('chronorelais/sales_impression/printMass'),
133
- ));*/
134
-
135
- return $this;
136
- }
137
-
138
- public function getGridUrl()
139
- {
140
- return $this->getUrl('*/*/*', array('_current' => true));
141
- }
142
-
143
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Chronopost/Chronorelais/Block/Sales/Shipment/Grid.php CHANGED
@@ -1,185 +1,203 @@
1
- <?php
2
- class Chronopost_Chronorelais_Block_Sales_Shipment_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
- {
4
-
5
- public function __construct()
6
- {
7
- parent::__construct();
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
- {
20
- return 'sales/order_grid_collection';
21
- }
22
-
23
- protected function _prepareCollection()
24
- {
25
- $_chronopost_deliver_saturday = Mage::helper('chronorelais')->getConfigData('carriers/chronopost/deliver_on_saturday');
26
- $_chronorelais_deliver_saturday = Mage::helper('chronorelais')->getConfigData('carriers/chronorelais/deliver_on_saturday');
27
- if($_chronopost_deliver_saturday==1) { $_chronopost_deliver_saturday = 'Yes'; } else { $_chronopost_deliver_saturday = 'No';}
28
- if($_chronorelais_deliver_saturday==1) { $_chronorelais_deliver_saturday = 'Yes'; } else { $_chronorelais_deliver_saturday = 'No'; }
29
-
30
- $collection = Mage::getResourceModel($this->_getCollectionClass());
31
- $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 shipping_method', 'og.total_qty_ordered'));
32
- $collection->getSelect()->joinLeft(array('osg' => $collection->getTable('sales/shipment_grid')), 'main_table.entity_id = osg.order_id', array('if(isNull(osg.increment_id) , "--" , osg.increment_id) as shipment_increment_id', 'osg.created_at as shipment_created_at'));
33
- $collection->getSelect()->joinLeft(array('ost' => $collection->getTable('sales/shipment_track')), 'main_table.entity_id = ost.order_id', array('if(isNull(ost.number) , "--" , ost.number) as number', 'if(isNull(ost.title) , "--" , ost.title) as title'));
34
- $collection->getSelect()->joinLeft(array('oes' => Mage::getSingleton('core/resource')->getTableName('sales_chronopost_order_export_status')), 'main_table.entity_id = oes.order_id', array("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"));
35
- $collection->getSelect()->where('og.shipping_method LIKE "chronorelais%" OR og.shipping_method LIKE "chronopost%" OR og.shipping_method LIKE "chronoexpress%"');
36
- $collection->getSelect()->group('main_table.entity_id');
37
- $sql = $collection->getSelectSql(true);
38
- $collection->getSelect()->reset()->from(
39
- array('e' =>new Zend_Db_Expr("({$sql})")),
40
- array('e' => "*")
41
- );
42
-
43
- $this->setCollection($collection);
44
- return parent::_prepareCollection();
45
- }
46
-
47
- protected function _prepareColumns()
48
- {
49
-
50
- $this->addColumn('real_order_id', array(
51
- 'header'=> Mage::helper('sales')->__('Order #'),
52
- 'width' => '100px',
53
- 'type' => 'text',
54
- 'index' => 'increment_id',
55
- 'filter' => false,
56
- ));
57
-
58
- $this->addColumn('created_at', array(
59
- 'header' => Mage::helper('sales')->__('Order Date'),
60
- 'index' => 'created_at',
61
- 'type' => 'datetime',
62
- 'filter' => false,
63
- ));
64
-
65
- $this->addColumn('shipment_increment_id', array(
66
- 'header' => Mage::helper('sales')->__('Shipment #'),
67
- 'index' => 'shipment_increment_id',
68
- 'type' => 'text',
69
- 'width' => '100px',
70
- 'filter' => false,
71
- ));
72
-
73
- $this->addColumn('shipment_created_at', array(
74
- 'header' => Mage::helper('sales')->__('Date Shipped'),
75
- 'index' => 'shipment_created_at',
76
- 'type' => 'datetime',
77
- 'filter' => false,
78
- ));
79
-
80
- $this->addColumn('shipping_name', array(
81
- 'header' => Mage::helper('sales')->__('Ship to Name'),
82
- 'index' => 'shipping_name',
83
- 'filter' => false,
84
- ));
85
-
86
- $this->addColumn('total_qty_ordered', array(
87
- 'header' => Mage::helper('sales')->__('Total Qty'),
88
- 'index' => 'total_qty_ordered',
89
- 'type' => 'number',
90
- 'filter' => false,
91
- ));
92
-
93
- $this->addColumn('number', array(
94
- 'header' => Mage::helper('sales')->__('Tracking'),
95
- 'index' => 'number',
96
- 'filter' => false,
97
- ));
98
-
99
- $this->addColumn('shipping_method', array(
100
- 'header' => Mage::helper('sales')->__('Mode de transport'),
101
- 'index' => 'shipping_method',
102
- 'type' => 'text',
103
- 'filter' => false,
104
- ));
105
-
106
- if($is_sending_day = Mage::helper('chronorelais')->isSendingDay()) {
107
- $this->addColumn('livraison_le_samedi', array(
108
- 'header' => Mage::helper('sales')->__('Livraison le Samedi'),
109
- 'index' => 'livraison_le_samedi',
110
- 'width' => '100px',
111
- 'class' => 'a-center',
112
- 'filter' => false,
113
- ));
114
- }
115
-
116
- $this->addColumn('download', array(
117
- 'header' => Mage::helper('chronorelais')->__('Etiquettes'),
118
- 'type' => 'action',
119
- 'getter' => 'getId',
120
- 'actions' => array(
121
- array(
122
- 'caption' => Mage::helper('chronorelais')->__('Imprimer'),
123
- 'url' => array(
124
- 'base'=>'chronorelais/sales_impression/print'
125
- ),
126
- 'target' => '_blank',
127
- 'field' => 'order_id'
128
- )
129
- ),
130
- 'filter' => false,
131
- 'sortable' => false,
132
- 'index' => 'stores'
133
- ));
134
-
135
- return parent::_prepareColumns();
136
- }
137
-
138
- public function getRowUrl($row)
139
- {
140
- if (!Mage::getSingleton('admin/session')->isAllowed('sales/order/shipment')) {
141
- return false;
142
- }
143
-
144
- return $this->getUrl('adminhtml/sales_order/view',
145
- array(
146
- 'order_id'=> $row->getId(),
147
- )
148
- );
149
- }
150
-
151
- protected function _prepareMassaction()
152
- {
153
- if($is_sending_day = Mage::helper('chronorelais')->isSendingDay()) {
154
- $this->setMassactionIdField('entity_id');
155
- $this->getMassactionBlock()->setFormFieldName('order_ids');
156
- $this->getMassactionBlock()->setUseSelectAll(false);
157
-
158
- $shipping = array(
159
- 'Yes' => Mage::helper('chronorelais')->__('Yes'),
160
- 'No' => Mage::helper('chronorelais')->__('No'));
161
- $this->getMassactionBlock()->addItem('shipping', array(
162
- 'label' => Mage::helper('chronorelais')->__('Livraison le Samedi'),
163
- 'url' => $this->getUrl('*/*/massLivraisonSamediStatus', array('_current'=>true)),
164
- 'additional' => array(
165
- 'visibility' => array(
166
- 'name' => 'status',
167
- 'type' => 'select',
168
- 'class' => 'required-entry',
169
- 'style' => 'width:80px',
170
- 'label' => Mage::helper('chronorelais')->__('Status'),
171
- 'values' => $shipping
172
- )
173
- )
174
- ));
175
-
176
- return $this;
177
- }
178
- }
179
-
180
- public function getGridUrl()
181
- {
182
- return $this->getUrl('*/*/*', array('_current' => true));
183
- }
184
-
185
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Chronopost_Chronorelais_Block_Sales_Shipment_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
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
+ {
20
+ return 'sales/order_grid_collection';
21
+ }
22
+
23
+ protected function _prepareCollection()
24
+ {
25
+ $_chronopost_deliver_saturday = Mage::helper('chronorelais')->getConfigData('carriers/chronopost/deliver_on_saturday');
26
+ $_chronorelais_deliver_saturday = Mage::helper('chronorelais')->getConfigData('carriers/chronorelais/deliver_on_saturday');
27
+ if($_chronopost_deliver_saturday==1) { $_chronopost_deliver_saturday = 'Yes'; } else { $_chronopost_deliver_saturday = 'No';}
28
+ if($_chronorelais_deliver_saturday==1) { $_chronorelais_deliver_saturday = 'Yes'; } else { $_chronorelais_deliver_saturday = 'No'; }
29
+
30
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
31
+ $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 shipping_method', 'og.total_qty_ordered'));
32
+ $collection->getSelect()->joinLeft(array('osg' => $collection->getTable('sales/shipment_grid')), 'main_table.entity_id = osg.order_id', array('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'));
33
+ $collection->getSelect()->joinLeft(array('ost' => $collection->getTable('sales/shipment_track')), 'main_table.entity_id = ost.order_id', array('if(isNull(ost.track_number) , "--" , GROUP_CONCAT(DISTINCT ost.track_number SEPARATOR \', \')) as track_number', 'if(isNull(ost.title) , "--" , GROUP_CONCAT(DISTINCT ost.title SEPARATOR \', \')) as title'));
34
+ $collection->getSelect()->joinLeft(array('oes' => Mage::getSingleton('core/resource')->getTableName('sales_chronopost_order_export_status')), 'main_table.entity_id = oes.order_id', array("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"));
35
+ $collection->getSelect()->where('og.shipping_method LIKE "chronorelais%" OR og.shipping_method LIKE "chronopost%" OR og.shipping_method LIKE "chronoexpress%"');
36
+ $collection->getSelect()->group('main_table.entity_id');
37
+ $sql = $collection->getSelectSql(true);
38
+ $collection->getSelect()->reset()->from(
39
+ array('e' =>new Zend_Db_Expr("({$sql})")),
40
+ array('e' => "*")
41
+ );
42
+
43
+ $this->setCollection($collection);
44
+ return parent::_prepareCollection();
45
+ }
46
+
47
+ protected function _prepareColumns()
48
+ {
49
+
50
+ $this->addColumn('real_order_id', array(
51
+ 'header'=> Mage::helper('sales')->__('Order #'),
52
+ 'width' => '100px',
53
+ 'type' => 'text',
54
+ 'index' => 'increment_id',
55
+ 'filter' => false,
56
+ ));
57
+
58
+ $this->addColumn('created_at', array(
59
+ 'header' => Mage::helper('sales')->__('Order Date'),
60
+ 'index' => 'created_at',
61
+ 'type' => 'datetime',
62
+ 'filter' => false,
63
+ ));
64
+
65
+ $this->addColumn('shipment_increment_id', array(
66
+ 'header' => Mage::helper('sales')->__('Shipment #'),
67
+ 'index' => 'shipment_increment_id',
68
+ 'type' => 'text',
69
+ 'width' => '100px',
70
+ 'filter' => false,
71
+ ));
72
+
73
+ $this->addColumn('shipment_created_at', array(
74
+ 'header' => Mage::helper('sales')->__('Date Shipped'),
75
+ 'index' => 'shipment_created_at',
76
+ 'type' => 'datetime',
77
+ 'filter' => false,
78
+ ));
79
+
80
+ $this->addColumn('shipping_name', array(
81
+ 'header' => Mage::helper('sales')->__('Ship to Name'),
82
+ 'index' => 'shipping_name',
83
+ 'filter' => false,
84
+ ));
85
+
86
+ $this->addColumn('total_qty_ordered', array(
87
+ 'header' => Mage::helper('sales')->__('Total Qty'),
88
+ 'index' => 'total_qty_ordered',
89
+ 'type' => 'number',
90
+ 'filter' => false,
91
+ ));
92
+
93
+ $this->addColumn('track_number', array(
94
+ 'header' => Mage::helper('sales')->__('Tracking'),
95
+ 'index' => 'track_number',
96
+ 'filter' => false,
97
+ ));
98
+
99
+ $this->addColumn('shipping_method', array(
100
+ 'header' => Mage::helper('sales')->__('Mode de transport'),
101
+ 'index' => 'shipping_method',
102
+ 'type' => 'text',
103
+ 'filter' => false,
104
+ ));
105
+
106
+ if($is_sending_day = Mage::helper('chronorelais')->isSendingDay()) {
107
+ $this->addColumn('livraison_le_samedi', array(
108
+ 'header' => Mage::helper('sales')->__('Livraison le Samedi'),
109
+ 'index' => 'livraison_le_samedi',
110
+ 'width' => '100px',
111
+ 'class' => 'a-center',
112
+ 'filter' => false,
113
+ ));
114
+ }
115
+
116
+ $this->addColumn('download', array(
117
+ 'header' => Mage::helper('chronorelais')->__('Etiquettes'),
118
+ 'type' => 'action',
119
+ 'getter' => 'getId',
120
+ 'actions' => array(
121
+ array(
122
+ 'caption' => Mage::helper('chronorelais')->__('Imprimer'),
123
+ 'url' => array(
124
+ 'base'=>'chronorelais/sales_impression/print'
125
+ ),
126
+ 'target' => '_blank',
127
+ 'field' => 'order_id'
128
+ )
129
+ ),
130
+ 'filter' => false,
131
+ 'sortable' => false,
132
+ 'index' => 'stores'
133
+ ));
134
+
135
+ return parent::_prepareColumns();
136
+ }
137
+
138
+ public function getRowUrl($row)
139
+ {
140
+ if (!Mage::getSingleton('admin/session')->isAllowed('sales/order/shipment')) {
141
+ return false;
142
+ }
143
+
144
+ return $this->getUrl('adminhtml/sales_order/view',
145
+ array(
146
+ 'order_id'=> $row->getId(),
147
+ )
148
+ );
149
+ }
150
+
151
+ protected function _prepareMassaction()
152
+ {
153
+ if($is_sending_day = Mage::helper('chronorelais')->isSendingDay()) {
154
+ $this->setMassactionIdField('entity_id');
155
+ $this->getMassactionBlock()->setFormFieldName('order_ids');
156
+ $this->getMassactionBlock()->setUseSelectAll(false);
157
+
158
+ $shipping = array(
159
+ 'Yes' => Mage::helper('chronorelais')->__('Yes'),
160
+ 'No' => Mage::helper('chronorelais')->__('No'));
161
+ $this->getMassactionBlock()->addItem('shipping', array(
162
+ 'label' => Mage::helper('chronorelais')->__('Livraison le Samedi'),
163
+ 'url' => $this->getUrl('*/*/massLivraisonSamediStatus', array('_current'=>true)),
164
+ 'additional' => array(
165
+ 'visibility' => array(
166
+ 'name' => 'status',
167
+ 'type' => 'select',
168
+ 'class' => 'required-entry',
169
+ 'style' => 'width:80px',
170
+ 'label' => Mage::helper('chronorelais')->__('Status'),
171
+ 'values' => $shipping
172
+ )
173
+ )
174
+ ));
175
+
176
+ return $this;
177
+ }
178
+ }
179
+
180
+ public function getGridUrl()
181
+ {
182
+ return $this->getUrl('*/*/*', array('_current' => true));
183
+ }
184
+
185
+ public function getAdditionalJavaScript()
186
+ {
187
+ echo "$$('#sales_order_grid_table tr td:nth-child(3)').each(function(item) {
188
+ var chaine = item.innerHTML.replace(/^\s+/g,'').replace(/\s+$/g,'');
189
+ if (chaine.split(', ').length > 1) {
190
+ var content = '';
191
+ var numbers = chaine.split(', ');
192
+ var lien = $(item).next('.last').down('a');
193
+ for (var i=0; i<numbers.length; i++) {
194
+ content += '<a href=\"' + lien.href.replace(/\/order_id\/\d+\//, '/shipment_increment_id/' + numbers[i] + '/') + '\" target=\"_blank\">Exp&eacute;dition ' + numbers[i] + '</a><br />';
195
+ }
196
+ content += '';
197
+ lien.up().innerHTML = content;
198
+ //lien.writeAttribute('onclick', \"$(this).up().down('div').show(); return false;\");
199
+ }
200
+ });";
201
+ }
202
+
203
+ }
app/code/community/Chronopost/Chronorelais/controllers/Checkout/MultishippingController.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once 'Mage/Checkout/controllers/MultishippingController.php';
4
+ class Chronopost_Chronorelais_Checkout_MultishippingController extends Mage_Checkout_MultishippingController
5
+ {
6
+ /**
7
+ * Get payment method step html
8
+ *
9
+ * @return string
10
+ */
11
+ protected function _getChronoRelaisHtml()
12
+ {
13
+ return $this->getLayout()->getBlock('root')->toHtml();
14
+ }
15
+
16
+ public function shippingPostAction()
17
+ {
18
+ $shippingMethods = $this->getRequest()->getPost('shipping_method');
19
+ try {
20
+ Mage::dispatchEvent(
21
+ 'checkout_controller_multishipping_shipping_post',
22
+ array('request'=>$this->getRequest(), 'quote'=>$this->_getCheckout()->getQuote())
23
+ );
24
+ $this->_getCheckout()->setShippingMethods($shippingMethods);
25
+
26
+ //WEC chronorelais
27
+ $addresses = $this->_getCheckout()->getQuote()->getAllShippingAddresses();
28
+ $relays = $this->getRequest()->getParam('shipping_method_chronorelais');
29
+ foreach ($addresses as $address) {
30
+ if (isset($shippingMethods[$address->getId()])) {
31
+ if( substr($shippingMethods[$address->getId()],0,12) == "chronorelais" ){
32
+
33
+ $relaisId = $relays[$address->getId()];
34
+ if($relaisId!=""){
35
+
36
+ $client = new SoapClient("http://wsshipping.chronopost.fr/soap.point.relais/services/ServiceRechercheBt?wsdl");
37
+ $webservbt = $client->__call("rechercheBtParIdChronopostA2Pas",array($relaisId));
38
+ $relais = $webservbt[0] ;
39
+
40
+ if($relais) {
41
+ $address->setCity($relais->localite)
42
+ ->setPostcode($relais->codePostal)
43
+ ->setStreet ( trim( $relais->adresse1." ".$relais->adresse2." ".$relais->adresse3 ) )
44
+ ->setCompany ( $relais->nomEnseigne )
45
+ ->setWRelayPointCode( $relais->identifiantChronopostPointA2PAS )
46
+ ->save()
47
+ ->setCollectShippingRates(true);
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
53
+ //ENDWEC chronorelais
54
+
55
+ $this->_getState()->setActiveStep(
56
+ Mage_Checkout_Model_Type_Multishipping_State::STEP_BILLING
57
+ );
58
+ $this->_getState()->setCompleteStep(
59
+ Mage_Checkout_Model_Type_Multishipping_State::STEP_SHIPPING
60
+ );
61
+ $this->_redirect('*/*/billing');
62
+ }
63
+ catch (Exception $e){
64
+ $this->_getCheckoutSession()->addError($e->getMessage());
65
+ $this->_redirect('*/*/shipping');
66
+ }
67
+ }
68
+
69
+ /**
70
+ * Get relais
71
+ */
72
+ public function getMultiRelaisAction()
73
+ {
74
+ $result = array();
75
+ $postcode = $this->getRequest()->get('zip', '');
76
+
77
+ if (extension_loaded('soap')) {
78
+ $addresses = $this->_getCheckout()->getQuote()->getAllShippingAddresses();
79
+ foreach ($addresses as $address) {
80
+ if ($address->getId() == $this->getRequest()->get('index')) {
81
+ /*$address->setPostcode($postcode)
82
+ ->save()
83
+ ->setCollectShippingRates(true);*/
84
+
85
+ $client = new SoapClient("http://wsshipping.chronopost.fr/soap.point.relais/services/ServiceRechercheBt?wsdl",array('trace'=> 0,'connection_timeout'=>10));
86
+ $webservbt = $client->__call("rechercheBtParCodeproduitEtCodepostalEtDate",array(0,$postcode,0));
87
+
88
+ if ($webservbt) {
89
+ Mage::getSingleton('core/session')->setMultiPostcode($postcode);
90
+ $this->loadLayout('checkout_multishipping_shippingchronorelais');
91
+ $result['update_section'] = array(
92
+ 'name' => 'checkout-shipping-method-chronorelais-load_'.$this->getRequest()->get('index'),
93
+ 'html' => str_replace("%%id%%", $this->getRequest()->get('index'), $this->_getChronoRelaisHtml())
94
+ );
95
+ $result['relaypoints'] = $webservbt;
96
+ } else {
97
+ $result['error'] = true;
98
+ $result['message'] = $this->__('No point relay is associated with this postcode');
99
+ }
100
+
101
+ break;
102
+ }
103
+ }
104
+ if (count($result) == 0) {
105
+ $result['error'] = true;
106
+ $result['message'] = $this->__('Issue with addresses');
107
+ }
108
+ } else {
109
+ $result['error'] = true;
110
+ $result['message'] = $this->__('Sorry for inconvenience, The SOAP extension is not installed in the server. Please contact the site administrator.');
111
+ }
112
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
113
+ }
114
+ }
app/code/community/Chronopost/Chronorelais/controllers/Checkout/OnepageController.php CHANGED
@@ -1,657 +1,285 @@
1
- <?php
2
-
3
- require_once 'Mage/Checkout/controllers/OnepageController.php';
4
- class Chronopost_Chronorelais_Checkout_OnepageController extends Mage_Checkout_OnepageController
5
- {
6
- protected $_sectionUpdateFunctions = array(
7
- 'payment-method' => '_getPaymentMethodsHtml',
8
- 'shipping-method' => '_getShippingMethodsHtml',
9
- 'review' => '_getReviewHtml',
10
- 'shipping-method-chronorelais' => '_getReviewHtml',
11
- );
12
-
13
- /**
14
- * @return Mage_Checkout_OnepageController
15
- */
16
- public function preDispatch()
17
- {
18
- parent::preDispatch();
19
- $this->_preDispatchValidateCustomer();
20
- return $this;
21
- }
22
-
23
- protected function _ajaxRedirectResponse()
24
- {
25
- $this->getResponse()
26
- ->setHeader('HTTP/1.1', '403 Session Expired')
27
- ->setHeader('Login-Required', 'true')
28
- ->sendResponse();
29
- return $this;
30
- }
31
-
32
- /**
33
- * Validate ajax request and redirect on failure
34
- *
35
- * @return bool
36
- */
37
- protected function _expireAjax()
38
- {
39
- if (!$this->getOnepage()->getQuote()->hasItems()
40
- || $this->getOnepage()->getQuote()->getHasError()
41
- || $this->getOnepage()->getQuote()->getIsMultiShipping()) {
42
- $this->_ajaxRedirectResponse();
43
- return true;
44
- }
45
- $action = $this->getRequest()->getActionName();
46
- if (Mage::getSingleton('checkout/session')->getCartWasUpdated(true)
47
- && !in_array($action, array('index', 'progress'))) {
48
- $this->_ajaxRedirectResponse();
49
- return true;
50
- }
51
-
52
- return false;
53
- }
54
-
55
- /**
56
- * Get shipping method step html
57
- *
58
- * @return string
59
- */
60
- protected function _getShippingMethodsHtml()
61
- {
62
- $layout = $this->getLayout();
63
- $update = $layout->getUpdate();
64
- $update->load('checkout_onepage_shippingmethod');
65
- $layout->generateXml();
66
- $layout->generateBlocks();
67
- $output = $layout->getOutput();
68
- return $output;
69
- }
70
-
71
- /**
72
- * Get payment method step html
73
- *
74
- * @return string
75
- */
76
- protected function _getPaymentMethodsHtml()
77
- {
78
- $layout = $this->getLayout();
79
- $update = $layout->getUpdate();
80
- $update->load('checkout_onepage_paymentmethod');
81
- $layout->generateXml();
82
- $layout->generateBlocks();
83
- $output = $layout->getOutput();
84
- return $output;
85
- }
86
-
87
- protected function _getAdditionalHtml()
88
- {
89
- $layout = $this->getLayout();
90
- $update = $layout->getUpdate();
91
- $update->load('checkout_onepage_additional');
92
- $layout->generateXml();
93
- $layout->generateBlocks();
94
- $output = $layout->getOutput();
95
- return $output;
96
- }
97
-
98
- /**
99
- * Get order review step html
100
- *
101
- * @return string
102
- */
103
- protected function _getReviewHtml()
104
- {
105
- return $this->getLayout()->getBlock('root')->toHtml();
106
- }
107
-
108
- /**
109
- * Get payment method step html
110
- *
111
- * @return string
112
- */
113
- protected function _getChronoRelaisHtml()
114
- {
115
- return $this->getLayout()->getBlock('root')->toHtml();
116
- }
117
-
118
- /**
119
- * Get one page checkout model
120
- *
121
- * @return Mage_Checkout_Model_Type_Onepage
122
- */
123
- public function getOnepage()
124
- {
125
- return Mage::getSingleton('checkout/type_onepage');
126
- }
127
-
128
- /**
129
- * Checkout page
130
- */
131
- public function indexAction()
132
- {
133
- if (!extension_loaded('soap')) {
134
- if(Mage::helper('chronorelais')->getConfigData('carriers/chronopost/active') || Mage::helper('chronorelais')->getConfigData('carriers/chronorelais/active') || Mage::helper('chronorelais')->getConfigData('carriers/chronoexpress/active')) {
135
- Mage::getSingleton('checkout/session')->addError($this->__('The SOAP extension is not installed in the server. Please contact the site administrator. Sorry for inconvenience.'));
136
- $this->_redirect('checkout/cart');
137
- return;
138
- }
139
- }
140
- if (!Mage::helper('checkout')->canOnepageCheckout()) {
141
- Mage::getSingleton('checkout/session')->addError($this->__('The onepage checkout is disabled.'));
142
- $this->_redirect('checkout/cart');
143
- return;
144
- }
145
- $quote = $this->getOnepage()->getQuote();
146
- if (!$quote->hasItems() || $quote->getHasError()) {
147
- $this->_redirect('checkout/cart');
148
- return;
149
- }
150
- if (!$quote->validateMinimumAmount()) {
151
- $error = Mage::getStoreConfig('sales/minimum_order/error_message');
152
- Mage::getSingleton('checkout/session')->addError($error);
153
- $this->_redirect('checkout/cart');
154
- return;
155
- }
156
- Mage::getSingleton('checkout/session')->setCartWasUpdated(false);
157
- Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::getUrl('*/*/*', array('_secure'=>true)));
158
- $this->getOnepage()->initCheckout();
159
- $this->loadLayout();
160
- $this->_initLayoutMessages('customer/session');
161
- $this->getLayout()->getBlock('head')->setTitle($this->__('Checkout'));
162
- $this->renderLayout();
163
- }
164
-
165
- /**
166
- * Checkout status block
167
- */
168
- public function progressAction()
169
- {
170
- if ($this->_expireAjax()) {
171
- return;
172
- }
173
- $this->loadLayout(false);
174
- $this->renderLayout();
175
- }
176
-
177
- public function shippingMethodAction()
178
- {
179
- if ($this->_expireAjax()) {
180
- return;
181
- }
182
- $this->loadLayout(false);
183
- $this->renderLayout();
184
- }
185
-
186
- public function reviewAction()
187
- {
188
- if ($this->_expireAjax()) {
189
- return;
190
- }
191
- $this->loadLayout(false);
192
- $this->renderLayout();
193
- }
194
-
195
- /**
196
- * Order success action
197
- */
198
- public function successAction()
199
- {
200
- $session = $this->getOnepage()->getCheckout();
201
- if (!$session->getLastSuccessQuoteId()) {
202
- $this->_redirect('checkout/cart');
203
- return;
204
- }
205
-
206
- $lastQuoteId = $session->getLastQuoteId();
207
- $lastOrderId = $session->getLastOrderId();
208
- $lastRecurringProfiles = $session->getLastRecurringProfileIds();
209
- if (!$lastQuoteId || (!$lastOrderId && empty($lastRecurringProfiles))) {
210
- $this->_redirect('checkout/cart');
211
- return;
212
- }
213
-
214
- $session->clear();
215
- $this->loadLayout();
216
- $this->_initLayoutMessages('checkout/session');
217
- Mage::dispatchEvent('checkout_onepage_controller_success_action');
218
- $this->renderLayout();
219
- }
220
-
221
- public function failureAction()
222
- {
223
- $lastQuoteId = $this->getOnepage()->getCheckout()->getLastQuoteId();
224
- $lastOrderId = $this->getOnepage()->getCheckout()->getLastOrderId();
225
-
226
- if (!$lastQuoteId || !$lastOrderId) {
227
- $this->_redirect('checkout/cart');
228
- return;
229
- }
230
-
231
- $this->loadLayout();
232
- $this->renderLayout();
233
- }
234
-
235
-
236
- public function getAdditionalAction()
237
- {
238
- $this->getResponse()->setBody($this->_getAdditionalHtml());
239
- }
240
-
241
- /**
242
- * Address JSON
243
- */
244
- public function getAddressAction()
245
- {
246
- if ($this->_expireAjax()) {
247
- return;
248
- }
249
- $addressId = $this->getRequest()->getParam('address', false);
250
- if ($addressId) {
251
- $address = $this->getOnepage()->getAddress($addressId);
252
-
253
- if (Mage::getSingleton('customer/session')->getCustomer()->getId() == $address->getCustomerId()) {
254
- $this->getResponse()->setHeader('Content-type', 'application/x-json');
255
- $this->getResponse()->setBody($address->toJson());
256
- } else {
257
- $this->getResponse()->setHeader('HTTP/1.1','403 Forbidden');
258
- }
259
- }
260
- }
261
-
262
- /**
263
- * Save checkout method
264
- */
265
- public function saveMethodAction()
266
- {
267
- if ($this->_expireAjax()) {
268
- return;
269
- }
270
- if ($this->getRequest()->isPost()) {
271
- $method = $this->getRequest()->getPost('method');
272
- $result = $this->getOnepage()->saveCheckoutMethod($method);
273
- $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
274
- }
275
- }
276
-
277
- /**
278
- * save checkout billing address
279
- */
280
- public function saveBillingAction()
281
- {
282
- if ($this->_expireAjax()) {
283
- return;
284
- }
285
- if ($this->getRequest()->isPost()) {
286
- $postData = $this->getRequest()->getPost('billing', array());
287
- $data = $this->_filterPostData($postData);
288
- $customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
289
-
290
- if (isset($data['email'])) {
291
- $data['email'] = trim($data['email']);
292
- }
293
- $result = $this->getOnepage()->saveBilling($data, $customerAddressId);
294
-
295
- if (!isset($result['error'])) {
296
- /* check quote for virtual */
297
- if ($this->getOnepage()->getQuote()->isVirtual()) {
298
- $result['goto_section'] = 'payment';
299
- $result['update_section'] = array(
300
- 'name' => 'payment-method',
301
- 'html' => $this->_getPaymentMethodsHtml()
302
- );
303
- } elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
304
- $result['goto_section'] = 'shipping_method';
305
- $result['update_section'] = array(
306
- 'name' => 'shipping-method',
307
- 'html' => $this->_getShippingMethodsHtml()
308
- );
309
-
310
- $result['allow_sections'] = array('shipping');
311
- $result['duplicateBillingInfo'] = 'true';
312
-
313
- //WEC chronorelais
314
- if( isset( $_SESSION["customer_shipping_address_reference"] ) ){
315
- unset( $_SESSION["customer_shipping_address_reference"] );
316
- }
317
-
318
- if(!array_key_exists("compagny",$data)){ $data["compagny"]=""; }
319
-
320
- $_SESSION["customer_shipping_address_reference"]["data"] = $data;
321
- $_SESSION["customer_shipping_address_reference"]["customerAddressId"] = $customerAddressId;
322
- $_SESSION["customer_shipping_address_reference"]["available"] = false;
323
- //ENDWEC
324
-
325
- } else {
326
- $result['goto_section'] = 'shipping';
327
- }
328
- }
329
- $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
330
- }
331
- }
332
-
333
- /**
334
- * Shipping address save action
335
- */
336
- public function saveShippingAction()
337
- {
338
- if ($this->_expireAjax()) {
339
- return;
340
- }
341
- if ($this->getRequest()->isPost()) {
342
- $data = $this->getRequest()->getPost('shipping', array());
343
- $customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
344
-
345
-
346
-
347
- $result = $this->getOnepage()->saveShipping($data, $customerAddressId);
348
-
349
- if (!isset($result['error'])) {
350
- $result['goto_section'] = 'shipping_method';
351
- $result['update_section'] = array(
352
- 'name' => 'shipping-method',
353
- 'html' => $this->_getShippingMethodsHtml()
354
- );
355
- }
356
- $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
357
- }
358
-
359
- //WEC chronorelais
360
- if( isset( $_SESSION["customer_shipping_address_reference"] ) ){
361
- unset( $_SESSION["customer_shipping_address_reference"] );
362
- }
363
- if(!array_key_exists("compagny",$data)){ $data["compagny"]=""; }
364
- $_SESSION["customer_shipping_address_reference"]["data"] = $data;
365
- $_SESSION["customer_shipping_address_reference"]["customerAddressId"] = $customerAddressId;
366
- $_SESSION["customer_shipping_address_reference"]["available"] = false;
367
-
368
- //ENDWEC
369
- }
370
-
371
- /**
372
- * Shipping method save action
373
- */
374
- public function saveShippingMethodAction()
375
- {
376
- if ($this->_expireAjax()) {
377
- return;
378
- }
379
-
380
- if ($this->getRequest()->isPost()) {
381
-
382
- //WEC chronorelais
383
- if( $_SESSION["customer_shipping_address_reference"]["available"] ){
384
- $data = $_SESSION["customer_shipping_address_reference"]["data"];
385
- $customerAddressId = $_SESSION["customer_shipping_address_reference"]["customerAddressId"];
386
- $_SESSION["customer_shipping_address_reference"]["available"] = false;
387
-
388
- $result = $this->getOnepage()->saveShipping($data, $customerAddressId);
389
- $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
390
- }
391
-
392
- $method = $this->getRequest()->getParam('shipping_method');
393
- $quote = Mage::getSingleton('checkout/cart')->init()->getQuote();
394
- $address = $quote->getShippingAddress();
395
-
396
- //if( substr($this->getRequest()->getParam('shipping_method'),0,25) == "chronorelais_chronorelais" ){
397
- if( substr($this->getRequest()->getParam('shipping_method'),0,12) == "chronorelais" ){
398
-
399
- $relaisId = $this->getRequest()->getParam('shipping_method_chronorelais');
400
- if($relaisId!=""){
401
-
402
- $client = new SoapClient("http://wsshipping.chronopost.fr/soap.point.relais/services/ServiceRechercheBt?wsdl");
403
- $webservbt = $client->__call("rechercheBtParIdChronopostA2Pas",array($relaisId));
404
- $relais = $webservbt[0] ;
405
-
406
- if($relais) {
407
- $address->setCity($relais->localite)
408
- ->setPostcode($relais->codePostal)
409
- ->setStreet ( trim( $relais->adresse1." ".$relais->adresse2." ".$relais->adresse3 ) )
410
- ->setCompany ( $relais->nomEnseigne )
411
- ->setWRelayPointCode( $relais->identifiantChronopostPointA2PAS )
412
- ->save()
413
- ->setCollectShippingRates(true);
414
-
415
- $_SESSION["customer_shipping_address_reference"]["available"] = true;
416
- }
417
- }
418
- }
419
-
420
- $methodTitle = "";
421
- if(isset($relais->localite)) {
422
- $methodTitle = ' - '.$relais->nomEnseigne.' - '.trim( $relais->adresse1." ".$relais->adresse2." ".$relais->adresse3 ).' - '.$relais->codePostal.' - '.$relais->localite;
423
- }
424
- if ($method) {
425
- foreach ($address->getAllShippingRates() as $rate) {
426
- if ($rate->getCode()==$method) {
427
- $address->setShippingDescription($rate->getCarrierTitle().' - '.$rate->getMethodTitle().$methodTitle);
428
- break;
429
- }
430
- }
431
- }
432
-
433
- //ENDWEC chronorelais
434
-
435
- $data = $this->getRequest()->getPost('shipping_method', '');
436
-
437
- $result = $this->getOnepage()->saveShippingMethod($data);
438
-
439
- /*
440
- $result will have erro data if shipping method is empty
441
- */
442
- if(!$result) {
443
- Mage::dispatchEvent('checkout_controller_onepage_save_shipping_method', array('request'=>$this->getRequest(), 'quote'=>$this->getOnepage()->getQuote()));
444
- // $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
445
-
446
- $result['goto_section'] = 'payment';
447
- $result['update_section'] = array(
448
- 'name' => 'payment-method',
449
- 'html' => $this->_getPaymentMethodsHtml()
450
- );
451
- }
452
- $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
453
- }
454
- }
455
-
456
- /**
457
- * Save payment ajax action
458
- *
459
- * Sets either redirect or a JSON response
460
- */
461
- public function savePaymentAction()
462
- {
463
- if ($this->_expireAjax()) {
464
- return;
465
- }
466
- try {
467
- if (!$this->getRequest()->isPost()) {
468
- $this->_ajaxRedirectResponse();
469
- return;
470
- }
471
-
472
- // set payment to quote
473
- $result = array();
474
- $data = $this->getRequest()->getPost('payment', array());
475
- $result = $this->getOnepage()->savePayment($data);
476
-
477
- // get section and redirect data
478
- $redirectUrl = $this->getOnepage()->getQuote()->getPayment()->getCheckoutRedirectUrl();
479
- if (empty($result['error']) && !$redirectUrl) {
480
- $this->loadLayout('checkout_onepage_review');
481
- $result['goto_section'] = 'review';
482
- $result['update_section'] = array(
483
- 'name' => 'review',
484
- 'html' => $this->_getReviewHtml()
485
- );
486
- }
487
- if ($redirectUrl) {
488
- $result['redirect'] = $redirectUrl;
489
- }
490
- } catch (Mage_Payment_Exception $e) {
491
- if ($e->getFields()) {
492
- $result['fields'] = $e->getFields();
493
- }
494
- $result['error'] = $e->getMessage();
495
- } catch (Mage_Core_Exception $e) {
496
- $result['error'] = $e->getMessage();
497
- } catch (Exception $e) {
498
- Mage::logException($e);
499
- $result['error'] = $this->__('Unable to set Payment Method.');
500
- }
501
- $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
502
- }
503
-
504
- /**
505
- * Create order action
506
- */
507
- public function saveOrderAction()
508
- {
509
- if ($this->_expireAjax()) {
510
- return;
511
- }
512
-
513
- $result = array();
514
- try {
515
- if ($requiredAgreements = Mage::helper('checkout')->getRequiredAgreementIds()) {
516
- $postedAgreements = array_keys($this->getRequest()->getPost('agreement', array()));
517
- if ($diff = array_diff($requiredAgreements, $postedAgreements)) {
518
- $result['success'] = false;
519
- $result['error'] = true;
520
- $result['error_messages'] = $this->__('Please agree to all the terms and conditions before placing the order.');
521
- $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
522
- return;
523
- }
524
- }
525
- if ($data = $this->getRequest()->getPost('payment', false)) {
526
- $this->getOnepage()->getQuote()->getPayment()->importData($data);
527
- }
528
- $this->getOnepage()->saveOrder();
529
- $redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl();
530
- $result['success'] = true;
531
- $result['error'] = false;
532
- } catch (Mage_Core_Exception $e) {
533
- Mage::logException($e);
534
- Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
535
- $result['success'] = false;
536
- $result['error'] = true;
537
- $result['error_messages'] = $e->getMessage();
538
-
539
- if ($gotoSection = $this->getOnepage()->getCheckout()->getGotoSection()) {
540
- $result['goto_section'] = $gotoSection;
541
- $this->getOnepage()->getCheckout()->setGotoSection(null);
542
- }
543
-
544
- if ($updateSection = $this->getOnepage()->getCheckout()->getUpdateSection()) {
545
- if (isset($this->_sectionUpdateFunctions[$updateSection])) {
546
- $updateSectionFunction = $this->_sectionUpdateFunctions[$updateSection];
547
- $result['update_section'] = array(
548
- 'name' => $updateSection,
549
- 'html' => $this->$updateSectionFunction()
550
- );
551
- }
552
- $this->getOnepage()->getCheckout()->setUpdateSection(null);
553
- }
554
- } catch (Exception $e) {
555
- Mage::logException($e);
556
- Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
557
- $result['success'] = false;
558
- $result['error'] = true;
559
- $result['error_messages'] = $this->__('There was an error processing your order. Please contact us or try again later.');
560
- }
561
- $this->getOnepage()->getQuote()->save();
562
- /**
563
- * when there is redirect to third party, we don't want to save order yet.
564
- * we will save the order in return action.
565
- */
566
- if (isset($redirectUrl)) {
567
- $result['redirect'] = $redirectUrl;
568
- }
569
-
570
- $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
571
- }
572
-
573
- /**
574
- * Filtering posted data. Converting localized data if needed
575
- *
576
- * @param array
577
- * @return array
578
- */
579
- protected function _filterPostData($data)
580
- {
581
- $data = $this->_filterDates($data, array('dob'));
582
- return $data;
583
- }
584
-
585
- /**
586
- * Get relais
587
- */
588
- public function getRelaisAction()
589
- {
590
- if ($this->_expireAjax()) {
591
- return;
592
- }
593
- $result = array();
594
- $quote = Mage::getSingleton('checkout/cart')->init()->getQuote();
595
- $address = $quote->getShippingAddress();
596
- $postcode = $address->getPostcode();
597
-
598
- if (extension_loaded('soap')) {
599
- $client = new SoapClient("http://wsshipping.chronopost.fr/soap.point.relais/services/ServiceRechercheBt?wsdl",array('trace'=> 0,'connection_timeout'=>10));
600
- $webservbt = $client->__call("rechercheBtParCodeproduitEtCodepostalEtDate",array(0,$postcode,0));
601
-
602
- if ($webservbt) {
603
- $this->loadLayout('checkout_onepage_shippingchronorelais');
604
- $result['goto_section'] = 'shipping-method';
605
- $result['update_section'] = array(
606
- 'name' => 'shipping-method-chronorelais',
607
- 'html' => $this->_getChronoRelaisHtml()
608
- );
609
- $result['relaypoints'] = $webservbt;
610
- } else {
611
- $result['error'] = true;
612
- $result['message'] = $this->__('No point relay is associated with this postcode');
613
- }
614
- } else {
615
- $result['error'] = true;
616
- $result['message'] = $this->__('Sorry for inconvenience, The SOAP extension is not installed in the server. Please contact the site administrator.');
617
- }
618
- $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
619
- }
620
-
621
- /**
622
- * Change shipping postal code
623
- */
624
- public function changePostalCodeAction()
625
- {
626
- if ($this->_expireAjax()) {
627
- return;
628
- }
629
- $result = array();
630
- $webservbt = array();
631
- $postcode = $this->getRequest()->getPost('mappostalcode');
632
- if($postcode) {
633
- $quote = Mage::getSingleton('checkout/cart')->init()->getQuote();
634
- $address = $quote->getShippingAddress();
635
- $address->setPostcode($postcode)
636
- ->save()
637
- ->setCollectShippingRates(true);
638
-
639
- $client = new SoapClient("http://wsshipping.chronopost.fr/soap.point.relais/services/ServiceRechercheBt?wsdl",array('trace'=> 0,'connection_timeout'=>10));
640
- $webservbt = $client->__call("rechercheBtParCodeproduitEtCodepostalEtDate",array(0,$postcode,0));
641
- }
642
- if ($webservbt) {
643
- $this->loadLayout('checkout_onepage_shippingchronorelais');
644
- $result['goto_section'] = 'shipping-method';
645
- $result['update_section'] = array(
646
- 'name' => 'shipping-method-chronorelais',
647
- 'html' => $this->_getChronoRelaisHtml()
648
- );
649
- $result['relaypoints'] = $webservbt;
650
- } else {
651
- $result['error'] = true;
652
- $result['message'] = $this->__('No point relay is associated with this postcode');
653
- }
654
- $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
655
- }
656
-
657
  }
1
+ <?php
2
+
3
+ require_once 'Mage/Checkout/controllers/OnepageController.php';
4
+ class Chronopost_Chronorelais_Checkout_OnepageController extends Mage_Checkout_OnepageController
5
+ {
6
+ protected $_sectionUpdateFunctions = array(
7
+ 'payment-method' => '_getPaymentMethodsHtml',
8
+ 'shipping-method' => '_getShippingMethodsHtml',
9
+ 'review' => '_getReviewHtml',
10
+ 'shipping-method-chronorelais' => '_getReviewHtml',
11
+ );
12
+
13
+ /**
14
+ * Get payment method step html
15
+ *
16
+ * @return string
17
+ */
18
+ protected function _getChronoRelaisHtml()
19
+ {
20
+ return $this->getLayout()->getBlock('root')->toHtml();
21
+ }
22
+
23
+ /**
24
+ * Checkout page
25
+ */
26
+ public function indexAction()
27
+ {
28
+ if (!extension_loaded('soap')) {
29
+ if(Mage::helper('chronorelais')->getConfigData('carriers/chronopost/active') || Mage::helper('chronorelais')->getConfigData('carriers/chronorelais/active') || Mage::helper('chronorelais')->getConfigData('carriers/chronoexpress/active')) {
30
+ Mage::getSingleton('checkout/session')->addError($this->__('The SOAP extension is not installed in the server. Please contact the site administrator. Sorry for inconvenience.'));
31
+ $this->_redirect('checkout/cart');
32
+ return;
33
+ }
34
+ }
35
+ parent::indexAction();
36
+ }
37
+
38
+ /**
39
+ * save checkout billing address
40
+ */
41
+ public function saveBillingAction()
42
+ {
43
+ if ($this->_expireAjax()) {
44
+ return;
45
+ }
46
+ if ($this->getRequest()->isPost()) {
47
+ // $postData = $this->getRequest()->getPost('billing', array());
48
+ // $data = $this->_filterPostData($postData);
49
+ $data = $this->getRequest()->getPost('billing', array());
50
+ $customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
51
+
52
+ if (isset($data['email'])) {
53
+ $data['email'] = trim($data['email']);
54
+ }
55
+ $result = $this->getOnepage()->saveBilling($data, $customerAddressId);
56
+
57
+ if (!isset($result['error'])) {
58
+ /* check quote for virtual */
59
+ if ($this->getOnepage()->getQuote()->isVirtual()) {
60
+ $result['goto_section'] = 'payment';
61
+ $result['update_section'] = array(
62
+ 'name' => 'payment-method',
63
+ 'html' => $this->_getPaymentMethodsHtml()
64
+ );
65
+ } elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
66
+ $result['goto_section'] = 'shipping_method';
67
+ $result['update_section'] = array(
68
+ 'name' => 'shipping-method',
69
+ 'html' => $this->_getShippingMethodsHtml()
70
+ );
71
+
72
+ $result['allow_sections'] = array('shipping');
73
+ $result['duplicateBillingInfo'] = 'true';
74
+
75
+ //WEC chronorelais
76
+ if( isset( $_SESSION["customer_shipping_address_reference"] ) ){
77
+ unset( $_SESSION["customer_shipping_address_reference"] );
78
+ }
79
+
80
+ if(!array_key_exists("company",$data)){ $data["company"]=""; }
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
+
87
+ } else {
88
+ $result['goto_section'] = 'shipping';
89
+ }
90
+ }
91
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Shipping address save action
97
+ */
98
+ public function saveShippingAction()
99
+ {
100
+ if ($this->_expireAjax()) {
101
+ return;
102
+ }
103
+ if ($this->getRequest()->isPost()) {
104
+ $data = $this->getRequest()->getPost('shipping', array());
105
+ $customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
106
+ $result = $this->getOnepage()->saveShipping($data, $customerAddressId);
107
+
108
+ if (!isset($result['error'])) {
109
+ $result['goto_section'] = 'shipping_method';
110
+ $result['update_section'] = array(
111
+ 'name' => 'shipping-method',
112
+ 'html' => $this->_getShippingMethodsHtml()
113
+ );
114
+ }
115
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
116
+ }
117
+
118
+ //WEC chronorelais
119
+ if( isset( $_SESSION["customer_shipping_address_reference"] ) ){
120
+ unset( $_SESSION["customer_shipping_address_reference"] );
121
+ }
122
+ if(!array_key_exists("company",$data)){ $data["company"]=""; }
123
+ $_SESSION["customer_shipping_address_reference"]["data"] = $data;
124
+ $_SESSION["customer_shipping_address_reference"]["customerAddressId"] = $customerAddressId;
125
+ $_SESSION["customer_shipping_address_reference"]["available"] = false;
126
+
127
+ //ENDWEC
128
+ }
129
+
130
+ /**
131
+ * Shipping method save action
132
+ */
133
+ public function saveShippingMethodAction()
134
+ {
135
+ if ($this->_expireAjax()) {
136
+ return;
137
+ }
138
+ if ($this->getRequest()->isPost()) {
139
+
140
+ //WEC chronorelais
141
+ if( $_SESSION["customer_shipping_address_reference"]["available"] ){
142
+ $data = $_SESSION["customer_shipping_address_reference"]["data"];
143
+ $customerAddressId = $_SESSION["customer_shipping_address_reference"]["customerAddressId"];
144
+ $_SESSION["customer_shipping_address_reference"]["available"] = false;
145
+
146
+ $result = $this->getOnepage()->saveShipping($data, $customerAddressId);
147
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
148
+ }
149
+
150
+ $method = $this->getRequest()->getParam('shipping_method');
151
+ $quote = Mage::getSingleton('checkout/cart')->init()->getQuote();
152
+ $address = $quote->getShippingAddress();
153
+
154
+ if( substr($this->getRequest()->getParam('shipping_method'),0,12) == "chronorelais" ){
155
+ $relaisId = $this->getRequest()->getParam('shipping_method_chronorelais');
156
+ if($relaisId!=""){
157
+
158
+ $client = new SoapClient("http://wsshipping.chronopost.fr/soap.point.relais/services/ServiceRechercheBt?wsdl");
159
+ $webservbt = $client->__call("rechercheBtParIdChronopostA2Pas",array($relaisId));
160
+ $relais = $webservbt[0] ;
161
+
162
+ if($relais) {
163
+ $address->setCity($relais->localite)
164
+ ->setPostcode($relais->codePostal)
165
+ ->setStreet ( trim( $relais->adresse1." ".$relais->adresse2." ".$relais->adresse3 ) )
166
+ ->setCompany ( $relais->nomEnseigne )
167
+ ->setWRelayPointCode( $relais->identifiantChronopostPointA2PAS )
168
+ ->save()
169
+ ->setCollectShippingRates(true);
170
+
171
+ $_SESSION["customer_shipping_address_reference"]["available"] = true;
172
+ }
173
+ }
174
+ }
175
+
176
+ $methodTitle = "";
177
+ if(isset($relais->localite)) {
178
+ $methodTitle = ' - '.$relais->nomEnseigne.' - '.trim( $relais->adresse1." ".$relais->adresse2." ".$relais->adresse3 ).' - '.$relais->codePostal.' - '.$relais->localite;
179
+ }
180
+ if ($method) {
181
+ foreach ($address->getAllShippingRates() as $rate) {
182
+ if ($rate->getCode()==$method) {
183
+ $address->setShippingDescription($rate->getCarrierTitle().' - '.$rate->getMethodTitle().$methodTitle);
184
+ break;
185
+ }
186
+ }
187
+ }
188
+ //ENDWEC chronorelais
189
+
190
+ $data = $this->getRequest()->getPost('shipping_method', '');
191
+ $result = $this->getOnepage()->saveShippingMethod($data);
192
+ /*
193
+ $result will have erro data if shipping method is empty
194
+ */
195
+ if(!$result) {
196
+ Mage::dispatchEvent('checkout_controller_onepage_save_shipping_method',
197
+ array('request'=>$this->getRequest(),
198
+ 'quote'=>$this->getOnepage()->getQuote()));
199
+ $this->getOnepage()->getQuote()->collectTotals();
200
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
201
+
202
+ $result['goto_section'] = 'payment';
203
+ $result['update_section'] = array(
204
+ 'name' => 'payment-method',
205
+ 'html' => $this->_getPaymentMethodsHtml()
206
+ );
207
+ }
208
+ $this->getOnepage()->getQuote()->collectTotals()->save();
209
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
210
+ }
211
+ }
212
+
213
+ /**
214
+ * Get relais
215
+ */
216
+ public function getRelaisAction()
217
+ {
218
+ if ($this->_expireAjax()) {
219
+ return;
220
+ }
221
+ $result = array();
222
+ $quote = Mage::getSingleton('checkout/cart')->init()->getQuote();
223
+ $address = $quote->getShippingAddress();
224
+ $postcode = $address->getPostcode();
225
+
226
+ if (extension_loaded('soap')) {
227
+ $client = new SoapClient("http://wsshipping.chronopost.fr/soap.point.relais/services/ServiceRechercheBt?wsdl",array('trace'=> 0,'connection_timeout'=>10));
228
+ $webservbt = $client->__call("rechercheBtParCodeproduitEtCodepostalEtDate",array(0,$postcode,0));
229
+
230
+ if ($webservbt) {
231
+ $this->loadLayout('checkout_onepage_shippingchronorelais');
232
+ $result['goto_section'] = 'shipping-method';
233
+ $result['update_section'] = array(
234
+ 'name' => 'shipping-method-chronorelais',
235
+ 'html' => $this->_getChronoRelaisHtml()
236
+ );
237
+ $result['relaypoints'] = $webservbt;
238
+ } else {
239
+ $result['error'] = true;
240
+ $result['message'] = $this->__('No point relay is associated with this postcode');
241
+ }
242
+ } else {
243
+ $result['error'] = true;
244
+ $result['message'] = $this->__('Sorry for inconvenience, The SOAP extension is not installed in the server. Please contact the site administrator.');
245
+ }
246
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
247
+ }
248
+
249
+ /**
250
+ * Change shipping postal code
251
+ */
252
+ public function changePostalCodeAction()
253
+ {
254
+ if ($this->_expireAjax()) {
255
+ return;
256
+ }
257
+ $result = array();
258
+ $webservbt = array();
259
+ $postcode = $this->getRequest()->getPost('mappostalcode');
260
+ if($postcode) {
261
+ $quote = Mage::getSingleton('checkout/cart')->init()->getQuote();
262
+ $address = $quote->getShippingAddress();
263
+ $address->setPostcode($postcode)
264
+ ->save()
265
+ ->setCollectShippingRates(true);
266
+
267
+ $client = new SoapClient("http://wsshipping.chronopost.fr/soap.point.relais/services/ServiceRechercheBt?wsdl",array('trace'=> 0,'connection_timeout'=>10));
268
+ $webservbt = $client->__call("rechercheBtParCodeproduitEtCodepostalEtDate",array(0,$postcode,0));
269
+ }
270
+ if ($webservbt) {
271
+ $this->loadLayout('checkout_onepage_shippingchronorelais');
272
+ $result['goto_section'] = 'shipping-method';
273
+ $result['update_section'] = array(
274
+ 'name' => 'shipping-method-chronorelais',
275
+ 'html' => $this->_getChronoRelaisHtml()
276
+ );
277
+ $result['relaypoints'] = $webservbt;
278
+ } else {
279
+ $result['error'] = true;
280
+ $result['message'] = $this->__('No point relay is associated with this postcode');
281
+ }
282
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
283
+ }
284
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  }
app/code/community/Chronopost/Chronorelais/controllers/ExportController.php CHANGED
@@ -1,446 +1,445 @@
1
- <?php
2
- class Chronopost_Chronorelais_ExportController extends Mage_Adminhtml_Controller_Action
3
- {
4
-
5
- /**
6
- * Constructor
7
- */
8
- protected function _construct()
9
- {
10
- $this->setUsedModuleName('Chronopost_Chronorelais');
11
- }
12
-
13
- /**
14
- * Main action : show orders list
15
- */
16
- public function indexAction()
17
- {
18
- $this->loadLayout()
19
- ->_setActiveMenu('sales/chronorelais/export')
20
- ->_addContent($this->getLayout()->createBlock('chronorelais/export_orders'))
21
- ->renderLayout();
22
- }
23
-
24
- public function getValue($value)
25
- {
26
- return ($value!='' ? $value : '');
27
- }
28
-
29
- public function removeSpclChars($text)
30
- {
31
- return ereg_replace("[^0-9a-zA-Z]", "", $text);
32
- }
33
-
34
- public function massLivraisonSamediStatusAction()
35
- {
36
- if($this->getRequest()->getPost('status')) {
37
- $this->saveLivraisonSamediStatusAction();
38
- }
39
- }
40
-
41
- public function massExportAction()
42
- {
43
- if($this->getRequest()->getPost('format')=='css') {
44
- $this->exportcssAction();
45
- } elseif($this->getRequest()->getPost('format')=='cso') {
46
- $this->exportcsoAction();
47
- }
48
- }
49
-
50
- /**
51
- * Export CSS Action
52
- * Generates a CSV file to download (CSS format)
53
- */
54
- public function exportcssAction()
55
- {
56
- /* get the orders */
57
- $orderIds = $this->getRequest()->getPost('order_ids');
58
-
59
- /**
60
- * Get configuration
61
- */
62
- $separator = Mage::helper('chronorelais')->getConfigurationFieldSeparator('css');
63
- $delimiter = Mage::helper('chronorelais')->getConfigurationFieldDelimiter('css');
64
-
65
- if ($delimiter == 'simple_quote') {
66
- $delimiter = "'";
67
- } else if ($delimiter == 'double_quotes') {
68
- $delimiter = '"';
69
- } else {
70
- $delimiter = '';
71
- }
72
- $lineBreak = Mage::helper('chronorelais')->getConfigurationEndOfLineCharacter('css');
73
- if ($lineBreak == 'lf') {
74
- $lineBreak = "\n";
75
- } else if ($lineBreak == 'cr') {
76
- $lineBreak = "\r";
77
- } else if ($lineBreak == 'crlf') {
78
- $lineBreak = "\r\n";
79
- }
80
- $fileExtension = Mage::helper('chronorelais')->getConfigurationFileExtension('css');
81
- $fileCharset = Mage::helper('chronorelais')->getConfigurationFileCharset('css');
82
-
83
- /* set the filename */
84
- $filename = 'orders_exportcss_'.Mage::getSingleton('core/date')->date('Ymd_His').$fileExtension;
85
-
86
- /* initialize the content variable */
87
- $content = '';
88
-
89
- if (!empty($orderIds)) {
90
- foreach ($orderIds as $orderId) {
91
-
92
- /* get the order */
93
- $order = Mage::getModel('sales/order')->load($orderId);
94
- $address = $order->getShippingAddress();
95
- $billingAddress = $order->getBillingAddress();
96
-
97
- $_shippingMethod = explode('_',$order->getShippingMethod());
98
-
99
- /* customer id */
100
- $content = $this->_addFieldToCsv($content, $delimiter, ($order->getCustomerId() ? $order->getCustomerId() : $address->getLastname()));
101
- $content .= $separator;
102
- /* customer company */
103
- //$content = $this->_addFieldToCsv($content, $delimiter, $address->getCompany() ? $address->getCompany() : ($address->getName() ? $address->getName() : $billingAddress->getName()));
104
- $content = $this->_addFieldToCsv($content, $delimiter, ($address->getName() ? $address->getName() : $billingAddress->getName()));
105
- $content .= $separator;
106
- /* customer name */
107
- $cust_name = ($_shippingMethod[0] == "chronorelais" ? $this->getValue($address->getName()) : '');
108
- $content = $this->_addFieldToCsv($content, $delimiter, $cust_name);
109
- $content .= $separator;
110
- /* street address */
111
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getStreet(1)));
112
- $content .= $separator;
113
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getStreet(2)));
114
- $content .= $separator;
115
- /* postal code */
116
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getPostcode()));
117
- $content .= $separator;
118
- /* city */
119
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getCity()));
120
- $content .= $separator;
121
- /* country code */
122
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getCountry()));
123
- $content .= $separator;
124
- /* telephone */
125
- $telephone = trim(ereg_replace("[^0-9.-]", " ", $address->getTelephone()));
126
- $telephone = (strlen($telephone)>=10 ? $telephone : '');
127
- $content = $this->_addFieldToCsv($content, $delimiter, $telephone);
128
- $content .= $separator;
129
- /* email */
130
- $customer_email = ($address->getEmail()) ? $address->getEmail() : ($billingAddress->getEmail() ? $billingAddress->getEmail() : $order->getCustomerEmail());
131
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($customer_email));
132
- $content .= $separator;
133
- /* chronorelay point */
134
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getWRelayPointCode()));
135
- $content .= $separator;
136
- /* real order id */
137
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($order->getRealOrderId()));
138
- $content .= $separator;
139
- /* total weight */
140
- $order_weight = number_format($order->getWeight(), 2 , '.' , '');
141
- //$order_weight = $order_weight * 1000;
142
- $content = $this->_addFieldToCsv($content, $delimiter, $order_weight);
143
- $content .= $separator;
144
-
145
- /* productCode*/
146
- $productCode = ''; //Default code for chronorelais
147
- $productCode = Mage::helper('chronorelais')->getChronoProductCodeString($_shippingMethod[0]);
148
- $content = $this->_addFieldToCsv($content, $delimiter, $productCode);
149
- $content .= $separator;
150
-
151
- /* Livraison Samedi*/
152
- $SaturdayShipping = 'L'; //default value for the saturday shipping
153
- $send_day = strtolower(date('l'));
154
- if($_shippingMethod[0] == "chronopost" || $_shippingMethod[0] == "chronorelais") {
155
- if(!$_deliver_on_saturday = Mage::helper('chronorelais')->getLivraisonSamediStatus($orderId)) {
156
- $_deliver_on_saturday = Mage::helper('chronorelais')->getConfigData('carriers/'.$_shippingMethod[0].'/deliver_on_saturday');
157
- } else {
158
- if($_deliver_on_saturday=='Yes') {
159
- $_deliver_on_saturday = 1;
160
- } else {
161
- $_deliver_on_saturday = 0;
162
- }
163
- }
164
- $is_sending_day = Mage::helper('chronorelais')->isSendingDay();
165
- if($_deliver_on_saturday && $is_sending_day==true) {
166
- $SaturdayShipping = 'S';
167
- } elseif(!$_deliver_on_saturday && $is_sending_day==true) {
168
- $SaturdayShipping = 'L';
169
- }
170
- }
171
- $content = $this->_addFieldToCsv($content, $delimiter, $SaturdayShipping);
172
- $content .= $separator;
173
-
174
- /* empty fields */
175
- $content = $this->_addFieldToCsv($content, $delimiter, 0);
176
- $content .= $separator;
177
- $content = $this->_addFieldToCsv($content, $delimiter, 0);
178
- $content .= $lineBreak;
179
- }
180
-
181
- /* decode the content, depending on the charset */
182
- if ($fileCharset == 'ISO-8859-1') {
183
- $content = utf8_decode($content);
184
- }
185
-
186
- /* pick file mime type, depending on the extension */
187
- if ($fileExtension == '.txt') {
188
- $fileMimeType = 'text/plain';
189
- } else if ($fileExtension == '.csv') {
190
- $fileMimeType = 'application/csv';
191
- } else if ($fileExtension == '.chr') {
192
- $fileMimeType = 'application/chr';
193
- } else {
194
- // default
195
- $fileMimeType = 'text/plain';
196
- }
197
-
198
- /* download the file */
199
- return $this->_prepareDownloadResponse($filename, $content, $fileMimeType .'; charset="'. $fileCharset .'"');
200
- }
201
- else {
202
- $this->_getSession()->addError($this->__('No Order has been selected'));
203
- }
204
- }
205
-
206
- /**
207
- * Export CSO Action
208
- * Generates a CSV file to download (CSO format)
209
- */
210
- public function exportcsoAction()
211
- {
212
- /* get the orders */
213
- $orderIds = $this->getRequest()->getPost('order_ids');
214
-
215
- /**
216
- * Get configuration
217
- */
218
- $separator = Mage::helper('chronorelais')->getConfigurationFieldSeparator('cso');
219
- $delimiter = Mage::helper('chronorelais')->getConfigurationFieldDelimiter('cso');
220
- if ($delimiter == 'simple_quote') {
221
- $delimiter = "'";
222
- } else if ($delimiter == 'double_quotes') {
223
- $delimiter = '"';
224
- } else {
225
- $delimiter = '';
226
- }
227
- $lineBreak = Mage::helper('chronorelais')->getConfigurationEndOfLineCharacter('cso');
228
- if ($lineBreak == 'lf') {
229
- $lineBreak = "\n";
230
- } else if ($lineBreak == 'cr') {
231
- $lineBreak = "\r";
232
- } else if ($lineBreak == 'crlf') {
233
- $lineBreak = "\r\n";
234
- }
235
- $fileExtension = Mage::helper('chronorelais')->getConfigurationFileExtension('cso');
236
- $fileCharset = Mage::helper('chronorelais')->getConfigurationFileCharset('cso');
237
-
238
- /* set the filename */
239
- $filename = 'orders_exportcso_'.Mage::getSingleton('core/date')->date('Ymd_His').$fileExtension;
240
-
241
- /* initialize the content variable */
242
- $content = '';
243
-
244
- if (!empty($orderIds)) {
245
- foreach ($orderIds as $orderId) {
246
-
247
- /* get the order */
248
- $order = Mage::getModel('sales/order')->load($orderId);
249
- $address = $order->getShippingAddress();
250
- $billingAddress = $order->getBillingAddress();
251
-
252
- /* customer id */
253
- $content = $this->_addFieldToCsv($content, $delimiter, ($order->getCustomerId() ? $order->getCustomerId() : $address->getLastname()));
254
- $content .= $separator;
255
- /* customer company or name*/
256
- //$content = $this->_addFieldToCsv($content, $delimiter, $address->getCompany() ? $address->getCompany() : ($address->getName() ? $address->getName() : $billingAddress->getName()));
257
- $content = $this->_addFieldToCsv($content, $delimiter, $address->getCompany());
258
- $content .= $separator;
259
- /* empty */
260
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue(""));
261
- $content .= $separator;
262
- /* street address */
263
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getStreet(1)));
264
- $content .= $separator;
265
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getStreet(2)));
266
- $content .= $separator;
267
- /* Code Porte */
268
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue(""));
269
- $content .= $separator;
270
- /* country code */
271
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getCountry()));
272
- $content .= $separator;
273
- /* postal code */
274
- $content = $this->_addFieldToCsv($content, $delimiter, $this->removeSpclChars($this->getValue($address->getPostcode())));
275
- $content .= $separator;
276
- /* city */
277
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue(strtoupper($address->getCity())));
278
- $content .= $separator;
279
- /* lastname */
280
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getLastname()));
281
- $content .= $separator;
282
- /* firstname */
283
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getFirstname()));
284
- $content .= $separator;
285
- /* telephone */
286
- $telephone = trim(ereg_replace("[^0-9.-]", " ", $address->getTelephone()));
287
- $telephone = (strlen($telephone)>=10 ? $telephone : '');
288
- $content = $this->_addFieldToCsv($content, $delimiter, $telephone);
289
- $content .= $separator;
290
- /* email */
291
- $customer_email = ($address->getEmail()) ? $address->getEmail() : ($billingAddress->getEmail() ? $billingAddress->getEmail() : $order->getCustomerEmail());
292
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($customer_email));
293
- $content .= $separator;
294
- /* VAT number*/
295
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue(""));
296
- $content .= $separator;
297
- /* productCode*/
298
- $productCode = ''; //Default code for chronorelais
299
- $_shippingMethod = explode('_',$order->getShippingMethod());
300
- if($_shippingMethod[0] == "chronopost") { // Conditions for chronorelais code
301
- $productCode = 1;
302
- } elseif($_shippingMethod[0] == "chronorelais") {
303
- //$productCode = 6; //for chronorelais
304
- } else {
305
- $productCode = 4; //for chronoexpress
306
- }
307
- $content = $this->_addFieldToCsv($content, $delimiter, $productCode);
308
- $content .= $separator;
309
- /* real order id */
310
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($order->getRealOrderId()));
311
- $content .= $separator;
312
- /* total weight */
313
- $order_weight = number_format($order->getWeight(), 2 , '.' , '');
314
- $order_weight = $order_weight * 1000;
315
- $content = $this->_addFieldToCsv($content, $delimiter, $order_weight);
316
- $content .= $separator;
317
- /* Valeur Assur�e field*/
318
- $content = $this->_addFieldToCsv($content, $delimiter, 0);
319
- $content .= $separator;
320
- /* Inform the recipient by e-mail field*/
321
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue("N"));
322
- $content .= $separator;
323
- /* Print Waybill field*/
324
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue("O"));
325
- $content .= $separator;
326
- /* sub-account field*/
327
- $sub_account = Mage::helper('chronorelais')->getConfigurationSubAccountNumber();
328
- $content = $this->_addFieldToCsv($content, $delimiter, (strlen($sub_account)==3 ? $sub_account : ""));
329
- $content .= $separator;
330
- /* Nature of item field*/
331
- $content = $this->_addFieldToCsv($content, $delimiter, 2);
332
- $content .= $separator;
333
- /* Description of Consignment field*/
334
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue(""));
335
- $content .= $separator;
336
- /* Print pro-forma (customs) field*/
337
- $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue("N"));
338
- $content .= $separator;
339
- /* Declared value (customs) field*/
340
- $content = $this->_addFieldToCsv($content, $delimiter, 0);
341
- $content .= $separator;
342
- /* Livraison Samedi (Delivery Saturday) field*/
343
- $SaturdayShipping = 0; //default value for the saturday shipping
344
- $send_day = strtolower(date('l'));
345
- if($_shippingMethod[0] == "chronopost" || $_shippingMethod[0] == "chronorelais") {
346
- if(!$_deliver_on_saturday = Mage::helper('chronorelais')->getLivraisonSamediStatus($orderId)) {
347
- $_deliver_on_saturday = Mage::helper('chronorelais')->getConfigData('carriers/'.$_shippingMethod[0].'/deliver_on_saturday');
348
- } else {
349
- if($_deliver_on_saturday=='Yes') {
350
- $_deliver_on_saturday = 1;
351
- } else {
352
- $_deliver_on_saturday = 0;
353
- }
354
- }
355
- $is_sending_day = Mage::helper('chronorelais')->isSendingDay();
356
- if($_deliver_on_saturday && $is_sending_day) {
357
- $SaturdayShipping = 1;
358
- } elseif(!$_deliver_on_saturday && $is_sending_day) {
359
- $SaturdayShipping = 2;
360
- }
361
- }
362
- $content = $this->_addFieldToCsv($content, $delimiter, $SaturdayShipping);
363
- $content .= $lineBreak;
364
- }
365
-
366
- /* decode the content, depending on the charset */
367
- if ($fileCharset == 'ISO-8859-1') {
368
- $content = utf8_decode($content);
369
- }
370
-
371
- /* pick file mime type, depending on the extension */
372
- if ($fileExtension == '.txt') {
373
- $fileMimeType = 'text/plain';
374
- } else if ($fileExtension == '.csv') {
375
- $fileMimeType = 'application/csv';
376
- } else if ($fileExtension == '.chr') {
377
- $fileMimeType = 'application/chr';
378
- } else {
379
- // default
380
- $fileMimeType = 'text/plain';
381
- }
382
-
383
- /* download the file */
384
- return $this->_prepareDownloadResponse($filename, $content, $fileMimeType .'; charset="'. $fileCharset .'"');
385
- }
386
- else {
387
- $this->_getSession()->addError($this->__('No Order has been selected'));
388
- }
389
- }
390
-
391
- /* Save the Livraison le Samedi status to orders */
392
- public function saveLivraisonSamediStatusAction()
393
- {
394
- /* get the orders */
395
- $orderIds = $this->getRequest()->getPost('order_ids');
396
- $status = $this->getRequest()->getPost('status');
397
- $_connection = Mage::getSingleton('core/resource')->getConnection('core_write');
398
- $_table = Mage::getSingleton('core/resource')->getTableName('sales_chronopost_order_export_status');
399
- $exceptions = array();
400
-
401
- foreach($orderIds as $orderId) {
402
- $order_details = Mage::getModel('sales/order')->load($orderId);
403
- $shipping_method = '';
404
- $livraison_le_samedi = $status;
405
- if($shipping_method = $order_details->getShippingMethod()) {
406
- $shipping_method = explode('_',$shipping_method);
407
- if($shipping_method[0]=='chronoexpress') {
408
- $livraison_le_samedi = '--';
409
- }
410
- }
411
- $condition = array(
412
- $_connection->quoteInto('order_id = ?', $orderId),
413
- );
414
- $_connection->delete($_table, $condition);
415
-
416
- $dataLine = array(
417
- 'order_id' => $orderId,
418
- 'livraison_le_samedi' => $livraison_le_samedi
419
- );
420
- try {
421
- $_connection->insert($_table, $dataLine);
422
- }
423
- catch (Exception $e) {
424
- $exceptions[] = Mage::helper('chronorelais')->__('Order assigning error: ' . $e->getMessage());
425
- }
426
- }
427
- if($exceptions) {
428
- $this->_getSession()->addError($exceptions);
429
- } else {
430
- $this->_getSession()->addSuccess($this->__('Livraison le Samedi statut a &eacute;t&eacute; ajout&eacute;'));
431
- }
432
- $this->_redirect('*/*/index');
433
- }
434
-
435
- /**
436
- * Add a new field to the csv file
437
- * @param csvContent : the current csv content
438
- * @param fieldDelimiter : the delimiter character
439
- * @param fieldContent : the content to add
440
- * @return : the concatenation of current content and content to add
441
- */
442
- private function _addFieldToCsv($csvContent, $fieldDelimiter, $fieldContent) {
443
- return $csvContent . $fieldDelimiter . $fieldContent . $fieldDelimiter;
444
- }
445
-
446
  }
1
+ <?php
2
+ class Chronopost_Chronorelais_ExportController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+
5
+ /**
6
+ * Constructor
7
+ */
8
+ protected function _construct()
9
+ {
10
+ $this->setUsedModuleName('Chronopost_Chronorelais');
11
+ }
12
+
13
+ /**
14
+ * Main action : show orders list
15
+ */
16
+ public function indexAction()
17
+ {
18
+ $this->loadLayout()
19
+ ->_setActiveMenu('sales/chronorelais/export')
20
+ ->_addContent($this->getLayout()->createBlock('chronorelais/export_orders'))
21
+ ->renderLayout();
22
+ }
23
+
24
+ public function getValue($value)
25
+ {
26
+ return ($value!='' ? $value : '');
27
+ }
28
+
29
+ public function removeSpclChars($text)
30
+ {
31
+ return ereg_replace("[^0-9a-zA-Z]", "", $text);
32
+ }
33
+
34
+ public function massLivraisonSamediStatusAction()
35
+ {
36
+ if($this->getRequest()->getPost('status')) {
37
+ $this->saveLivraisonSamediStatusAction();
38
+ }
39
+ }
40
+
41
+ public function massExportAction()
42
+ {
43
+ if($this->getRequest()->getPost('format')=='css') {
44
+ $this->exportcssAction();
45
+ } elseif($this->getRequest()->getPost('format')=='cso') {
46
+ $this->exportcsoAction();
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Export CSS Action
52
+ * Generates a CSV file to download (CSS format)
53
+ */
54
+ public function exportcssAction()
55
+ {
56
+ /* get the orders */
57
+ $orderIds = $this->getRequest()->getPost('order_ids');
58
+
59
+ /**
60
+ * Get configuration
61
+ */
62
+ $separator = Mage::helper('chronorelais')->getConfigurationFieldSeparator('css');
63
+ $delimiter = Mage::helper('chronorelais')->getConfigurationFieldDelimiter('css');
64
+
65
+ if ($delimiter == 'simple_quote') {
66
+ $delimiter = "'";
67
+ } else if ($delimiter == 'double_quotes') {
68
+ $delimiter = '"';
69
+ } else {
70
+ $delimiter = '';
71
+ }
72
+ $lineBreak = Mage::helper('chronorelais')->getConfigurationEndOfLineCharacter('css');
73
+ if ($lineBreak == 'lf') {
74
+ $lineBreak = "\n";
75
+ } else if ($lineBreak == 'cr') {
76
+ $lineBreak = "\r";
77
+ } else if ($lineBreak == 'crlf') {
78
+ $lineBreak = "\r\n";
79
+ }
80
+ $fileExtension = Mage::helper('chronorelais')->getConfigurationFileExtension('css');
81
+ $fileCharset = Mage::helper('chronorelais')->getConfigurationFileCharset('css');
82
+
83
+ /* set the filename */
84
+ $filename = 'orders_exportcss_'.Mage::getSingleton('core/date')->date('Ymd_His').$fileExtension;
85
+
86
+ /* initialize the content variable */
87
+ $content = '';
88
+
89
+ if (!empty($orderIds)) {
90
+ foreach ($orderIds as $orderId) {
91
+
92
+ /* get the order */
93
+ $order = Mage::getModel('sales/order')->load($orderId);
94
+ $address = $order->getShippingAddress();
95
+ $billingAddress = $order->getBillingAddress();
96
+
97
+ $_shippingMethod = explode('_',$order->getShippingMethod());
98
+
99
+ /* customer id */
100
+ $content = $this->_addFieldToCsv($content, $delimiter, ($order->getCustomerId() ? $order->getCustomerId() : $address->getLastname()));
101
+ $content .= $separator;
102
+ /* Nom du point relais OU soci�t� si livraison � domicile */
103
+ //$content = $this->_addFieldToCsv($content, $delimiter, $_shippingMethod[0] == "chronorelais" ? $address->getCompany() : "");
104
+ $content = $this->_addFieldToCsv($content, $delimiter, $address->getCompany());
105
+ $content .= $separator;
106
+ /* customer name */
107
+ $content = $this->_addFieldToCsv($content, $delimiter, ($address->getName() ? $address->getName() : $billingAddress->getName()));
108
+ $content .= $separator;
109
+ /* street address */
110
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getStreet(1)));
111
+ $content .= $separator;
112
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getStreet(2)));
113
+ $content .= $separator;
114
+ /* postal code */
115
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getPostcode()));
116
+ $content .= $separator;
117
+ /* city */
118
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getCity()));
119
+ $content .= $separator;
120
+ /* country code */
121
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getCountry()));
122
+ $content .= $separator;
123
+ /* telephone */
124
+ $telephone = trim(ereg_replace("[^0-9.-]", " ", $address->getTelephone()));
125
+ $telephone = (strlen($telephone)>=10 ? $telephone : '');
126
+ $content = $this->_addFieldToCsv($content, $delimiter, $telephone);
127
+ $content .= $separator;
128
+ /* email */
129
+ $customer_email = ($address->getEmail()) ? $address->getEmail() : ($billingAddress->getEmail() ? $billingAddress->getEmail() : $order->getCustomerEmail());
130
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($customer_email));
131
+ $content .= $separator;
132
+ /* chronorelay point */
133
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getWRelayPointCode()));
134
+ $content .= $separator;
135
+ /* real order id */
136
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($order->getRealOrderId()));
137
+ $content .= $separator;
138
+ /* total weight */
139
+ $order_weight = number_format($order->getWeight(), 2 , '.' , '');
140
+ //$order_weight = $order_weight * 1000;
141
+ $content = $this->_addFieldToCsv($content, $delimiter, $order_weight);
142
+ $content .= $separator;
143
+
144
+ /* productCode*/
145
+ $productCode = ''; //Default code for chronorelais
146
+ $productCode = Mage::helper('chronorelais')->getChronoProductCodeString($_shippingMethod[0]);
147
+ $content = $this->_addFieldToCsv($content, $delimiter, $productCode);
148
+ $content .= $separator;
149
+
150
+ /* Livraison Samedi*/
151
+ $SaturdayShipping = 'L'; //default value for the saturday shipping
152
+ $send_day = strtolower(date('l'));
153
+ if($_shippingMethod[0] == "chronopost" || $_shippingMethod[0] == "chronorelais") {
154
+ if(!$_deliver_on_saturday = Mage::helper('chronorelais')->getLivraisonSamediStatus($orderId)) {
155
+ $_deliver_on_saturday = Mage::helper('chronorelais')->getConfigData('carriers/'.$_shippingMethod[0].'/deliver_on_saturday');
156
+ } else {
157
+ if($_deliver_on_saturday=='Yes') {
158
+ $_deliver_on_saturday = 1;
159
+ } else {
160
+ $_deliver_on_saturday = 0;
161
+ }
162
+ }
163
+ $is_sending_day = Mage::helper('chronorelais')->isSendingDay();
164
+ if($_deliver_on_saturday && $is_sending_day==true) {
165
+ $SaturdayShipping = 'S';
166
+ } elseif(!$_deliver_on_saturday && $is_sending_day==true) {
167
+ $SaturdayShipping = 'L';
168
+ }
169
+ }
170
+ $content = $this->_addFieldToCsv($content, $delimiter, $SaturdayShipping);
171
+ $content .= $separator;
172
+
173
+ /* empty fields */
174
+ $content = $this->_addFieldToCsv($content, $delimiter, 0);
175
+ $content .= $separator;
176
+ $content = $this->_addFieldToCsv($content, $delimiter, 0);
177
+ $content .= $lineBreak;
178
+ }
179
+
180
+ /* decode the content, depending on the charset */
181
+ if ($fileCharset == 'ISO-8859-1') {
182
+ $content = utf8_decode($content);
183
+ }
184
+
185
+ /* pick file mime type, depending on the extension */
186
+ if ($fileExtension == '.txt') {
187
+ $fileMimeType = 'text/plain';
188
+ } else if ($fileExtension == '.csv') {
189
+ $fileMimeType = 'application/csv';
190
+ } else if ($fileExtension == '.chr') {
191
+ $fileMimeType = 'application/chr';
192
+ } else {
193
+ // default
194
+ $fileMimeType = 'text/plain';
195
+ }
196
+
197
+ /* download the file */
198
+ return $this->_prepareDownloadResponse($filename, $content, $fileMimeType .'; charset="'. $fileCharset .'"');
199
+ }
200
+ else {
201
+ $this->_getSession()->addError($this->__('No Order has been selected'));
202
+ }
203
+ }
204
+
205
+ /**
206
+ * Export CSO Action
207
+ * Generates a CSV file to download (CSO format)
208
+ */
209
+ public function exportcsoAction()
210
+ {
211
+ /* get the orders */
212
+ $orderIds = $this->getRequest()->getPost('order_ids');
213
+
214
+ /**
215
+ * Get configuration
216
+ */
217
+ $separator = Mage::helper('chronorelais')->getConfigurationFieldSeparator('cso');
218
+ $delimiter = Mage::helper('chronorelais')->getConfigurationFieldDelimiter('cso');
219
+ if ($delimiter == 'simple_quote') {
220
+ $delimiter = "'";
221
+ } else if ($delimiter == 'double_quotes') {
222
+ $delimiter = '"';
223
+ } else {
224
+ $delimiter = '';
225
+ }
226
+ $lineBreak = Mage::helper('chronorelais')->getConfigurationEndOfLineCharacter('cso');
227
+ if ($lineBreak == 'lf') {
228
+ $lineBreak = "\n";
229
+ } else if ($lineBreak == 'cr') {
230
+ $lineBreak = "\r";
231
+ } else if ($lineBreak == 'crlf') {
232
+ $lineBreak = "\r\n";
233
+ }
234
+ $fileExtension = Mage::helper('chronorelais')->getConfigurationFileExtension('cso');
235
+ $fileCharset = Mage::helper('chronorelais')->getConfigurationFileCharset('cso');
236
+
237
+ /* set the filename */
238
+ $filename = 'orders_exportcso_'.Mage::getSingleton('core/date')->date('Ymd_His').$fileExtension;
239
+
240
+ /* initialize the content variable */
241
+ $content = '';
242
+
243
+ if (!empty($orderIds)) {
244
+ foreach ($orderIds as $orderId) {
245
+
246
+ /* get the order */
247
+ $order = Mage::getModel('sales/order')->load($orderId);
248
+ $address = $order->getShippingAddress();
249
+ $billingAddress = $order->getBillingAddress();
250
+
251
+ /* customer id */
252
+ $content = $this->_addFieldToCsv($content, $delimiter, ($order->getCustomerId() ? $order->getCustomerId() : $address->getLastname()));
253
+ $content .= $separator;
254
+ /* Nom du point relais OU soci�t� si livraison � domicile */
255
+ //$content = $this->_addFieldToCsv($content, $delimiter, $_shippingMethod[0] == "chronorelais" ? $address->getCompany() : "");
256
+ $content = $this->_addFieldToCsv($content, $delimiter, $address->getCompany());
257
+ $content .= $separator;
258
+ /* empty */
259
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue(""));
260
+ $content .= $separator;
261
+ /* street address */
262
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getStreet(1)));
263
+ $content .= $separator;
264
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getStreet(2)));
265
+ $content .= $separator;
266
+ /* Code Porte */
267
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue(""));
268
+ $content .= $separator;
269
+ /* country code */
270
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getCountry()));
271
+ $content .= $separator;
272
+ /* postal code */
273
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->removeSpclChars($this->getValue($address->getPostcode())));
274
+ $content .= $separator;
275
+ /* city */
276
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue(strtoupper($address->getCity())));
277
+ $content .= $separator;
278
+ /* lastname */
279
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getLastname()));
280
+ $content .= $separator;
281
+ /* firstname */
282
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($address->getFirstname()));
283
+ $content .= $separator;
284
+ /* telephone */
285
+ $telephone = trim(ereg_replace("[^0-9.-]", " ", $address->getTelephone()));
286
+ $telephone = (strlen($telephone)>=10 ? $telephone : '');
287
+ $content = $this->_addFieldToCsv($content, $delimiter, $telephone);
288
+ $content .= $separator;
289
+ /* email */
290
+ $customer_email = ($address->getEmail()) ? $address->getEmail() : ($billingAddress->getEmail() ? $billingAddress->getEmail() : $order->getCustomerEmail());
291
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($customer_email));
292
+ $content .= $separator;
293
+ /* VAT number*/
294
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue(""));
295
+ $content .= $separator;
296
+ /* productCode*/
297
+ $productCode = ''; //Default code for chronorelais
298
+ $_shippingMethod = explode('_',$order->getShippingMethod());
299
+ if($_shippingMethod[0] == "chronopost") { // Conditions for chronorelais code
300
+ $productCode = 1;
301
+ } elseif($_shippingMethod[0] == "chronorelais") {
302
+ //$productCode = 6; //for chronorelais
303
+ } else {
304
+ $productCode = 4; //for chronoexpress
305
+ }
306
+ $content = $this->_addFieldToCsv($content, $delimiter, $productCode);
307
+ $content .= $separator;
308
+ /* real order id */
309
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue($order->getRealOrderId()));
310
+ $content .= $separator;
311
+ /* total weight */
312
+ $order_weight = number_format($order->getWeight(), 2 , '.' , '');
313
+ $order_weight = $order_weight * 1000;
314
+ $content = $this->_addFieldToCsv($content, $delimiter, $order_weight);
315
+ $content .= $separator;
316
+ /* Valeur Assur�e field*/
317
+ $content = $this->_addFieldToCsv($content, $delimiter, 0);
318
+ $content .= $separator;
319
+ /* Inform the recipient by e-mail field*/
320
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue("N"));
321
+ $content .= $separator;
322
+ /* Print Waybill field*/
323
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue("O"));
324
+ $content .= $separator;
325
+ /* sub-account field*/
326
+ $sub_account = Mage::helper('chronorelais')->getConfigurationSubAccountNumber();
327
+ $content = $this->_addFieldToCsv($content, $delimiter, (strlen($sub_account)==3 ? $sub_account : ""));
328
+ $content .= $separator;
329
+ /* Nature of item field*/
330
+ $content = $this->_addFieldToCsv($content, $delimiter, 2);
331
+ $content .= $separator;
332
+ /* Description of Consignment field*/
333
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue(""));
334
+ $content .= $separator;
335
+ /* Print pro-forma (customs) field*/
336
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getValue("N"));
337
+ $content .= $separator;
338
+ /* Declared value (customs) field*/
339
+ $content = $this->_addFieldToCsv($content, $delimiter, 0);
340
+ $content .= $separator;
341
+ /* Livraison Samedi (Delivery Saturday) field*/
342
+ $SaturdayShipping = 0; //default value for the saturday shipping
343
+ $send_day = strtolower(date('l'));
344
+ if($_shippingMethod[0] == "chronopost" || $_shippingMethod[0] == "chronorelais") {
345
+ if(!$_deliver_on_saturday = Mage::helper('chronorelais')->getLivraisonSamediStatus($orderId)) {
346
+ $_deliver_on_saturday = Mage::helper('chronorelais')->getConfigData('carriers/'.$_shippingMethod[0].'/deliver_on_saturday');
347
+ } else {
348
+ if($_deliver_on_saturday=='Yes') {
349
+ $_deliver_on_saturday = 1;
350
+ } else {
351
+ $_deliver_on_saturday = 0;
352
+ }
353
+ }
354
+ $is_sending_day = Mage::helper('chronorelais')->isSendingDay();
355
+ if($_deliver_on_saturday && $is_sending_day) {
356
+ $SaturdayShipping = 1;
357
+ } elseif(!$_deliver_on_saturday && $is_sending_day) {
358
+ $SaturdayShipping = 2;
359
+ }
360
+ }
361
+ $content = $this->_addFieldToCsv($content, $delimiter, $SaturdayShipping);
362
+ $content .= $lineBreak;
363
+ }
364
+
365
+ /* decode the content, depending on the charset */
366
+ if ($fileCharset == 'ISO-8859-1') {
367
+ $content = utf8_decode($content);
368
+ }
369
+
370
+ /* pick file mime type, depending on the extension */
371
+ if ($fileExtension == '.txt') {
372
+ $fileMimeType = 'text/plain';
373
+ } else if ($fileExtension == '.csv') {
374
+ $fileMimeType = 'application/csv';
375
+ } else if ($fileExtension == '.chr') {
376
+ $fileMimeType = 'application/chr';
377
+ } else {
378
+ // default
379
+ $fileMimeType = 'text/plain';
380
+ }
381
+
382
+ /* download the file */
383
+ return $this->_prepareDownloadResponse($filename, $content, $fileMimeType .'; charset="'. $fileCharset .'"');
384
+ }
385
+ else {
386
+ $this->_getSession()->addError($this->__('No Order has been selected'));
387
+ }
388
+ }
389
+
390
+ /* Save the Livraison le Samedi status to orders */
391
+ public function saveLivraisonSamediStatusAction()
392
+ {
393
+ /* get the orders */
394
+ $orderIds = $this->getRequest()->getPost('order_ids');
395
+ $status = $this->getRequest()->getPost('status');
396
+ $_connection = Mage::getSingleton('core/resource')->getConnection('core_write');
397
+ $_table = Mage::getSingleton('core/resource')->getTableName('sales_chronopost_order_export_status');
398
+ $exceptions = array();
399
+
400
+ foreach($orderIds as $orderId) {
401
+ $order_details = Mage::getModel('sales/order')->load($orderId);
402
+ $shipping_method = '';
403
+ $livraison_le_samedi = $status;
404
+ if($shipping_method = $order_details->getShippingMethod()) {
405
+ $shipping_method = explode('_',$shipping_method);
406
+ if($shipping_method[0]=='chronoexpress') {
407
+ $livraison_le_samedi = '--';
408
+ }
409
+ }
410
+ $condition = array(
411
+ $_connection->quoteInto('order_id = ?', $orderId),
412
+ );
413
+ $_connection->delete($_table, $condition);
414
+
415
+ $dataLine = array(
416
+ 'order_id' => $orderId,
417
+ 'livraison_le_samedi' => $livraison_le_samedi
418
+ );
419
+ try {
420
+ $_connection->insert($_table, $dataLine);
421
+ }
422
+ catch (Exception $e) {
423
+ $exceptions[] = Mage::helper('chronorelais')->__('Order assigning error: ' . $e->getMessage());
424
+ }
425
+ }
426
+ if($exceptions) {
427
+ $this->_getSession()->addError($exceptions);
428
+ } else {
429
+ $this->_getSession()->addSuccess($this->__('Livraison le Samedi statut a &eacute;t&eacute; ajout&eacute;'));
430
+ }
431
+ $this->_redirect('*/*/index');
432
+ }
433
+
434
+ /**
435
+ * Add a new field to the csv file
436
+ * @param csvContent : the current csv content
437
+ * @param fieldDelimiter : the delimiter character
438
+ * @param fieldContent : the content to add
439
+ * @return : the concatenation of current content and content to add
440
+ */
441
+ private function _addFieldToCsv($csvContent, $fieldDelimiter, $fieldContent) {
442
+ return $csvContent . $fieldDelimiter . $fieldContent . $fieldDelimiter;
443
+ }
444
+
 
445
  }
app/code/community/Chronopost/Chronorelais/controllers/ImportController.php CHANGED
@@ -1,249 +1,249 @@
1
- <?php
2
- class Chronopost_Chronorelais_ImportController extends Mage_Adminhtml_Controller_Action
3
- {
4
-
5
- /**
6
- * Constructor
7
- */
8
- protected function _construct()
9
- {
10
- $this->setUsedModuleName('Chronopost_Chronorelais');
11
- }
12
-
13
- /**
14
- * Main action : show import form
15
- */
16
- public function indexAction()
17
- {
18
- $this->loadLayout()
19
- ->_setActiveMenu('sales/chronorelais/import')
20
- ->_addContent($this->getLayout()->createBlock('chronorelais/import_form'))
21
- ->renderLayout();
22
- }
23
-
24
- /**
25
- * Import Action
26
- */
27
- public function importAction()
28
- {
29
- if ($this->getRequest()->isPost() && !empty($_FILES['import_chronorelais_file']['tmp_name'])) {
30
- try {
31
- $trackingTitle = $_POST['import_chronorelais_tracking_title'];
32
- $this->_importChronorelaisFile($_FILES['import_chronorelais_file']['tmp_name'], $trackingTitle);
33
- }
34
- catch (Mage_Core_Exception $e) {
35
- $this->_getSession()->addError($e->getMessage());
36
- }
37
- catch (Exception $e) {
38
- $this->_getSession()->addError($e->getMessage());
39
- $this->_getSession()->addError($this->__('Invalid file upload attempt'));
40
- }
41
- }
42
- else {
43
- $this->_getSession()->addError($this->__('Invalid file upload attempt'));
44
- }
45
- $this->_redirect('*/*/index');
46
- }
47
-
48
- /**
49
- * Importation logic
50
- * @param string $fileName
51
- * @param string $trackingTitle
52
- */
53
- protected function _importChronorelaisFile($fileName, $trackingTitle)
54
- {
55
- /**
56
- * File handling
57
- **/
58
- ini_set('auto_detect_line_endings', true);
59
- $csvObject = new Varien_File_Csv();
60
- $csvData = $csvObject->getData($fileName);
61
-
62
- /**
63
- * File expected fields
64
- */
65
- $expectedCsvFields = array(
66
- 0 => $this->__('Order Id'),
67
- 1 => $this->__('Tracking Number')
68
- );
69
-
70
- /**
71
- * Get configuration
72
- */
73
- $sendEmail = Mage::helper('chronorelais')->getConfigurationSendEmail();
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
83
- */
84
- foreach ($csvData as $k => $v) {
85
-
86
- /**
87
- * End of file has more than one empty lines
88
- */
89
- if (count($v) <= 1 && !strlen($v[0])) {
90
- continue;
91
- }
92
-
93
- /**
94
- * Check that the number of fields is not lower than expected
95
- */
96
- if (count($v) < count($expectedCsvFields)) {
97
- $this->_getSession()->addError($this->__('Line %s format is invalid and has been ignored', $k));
98
- continue;
99
- }
100
-
101
- /**
102
- * Get fields content
103
- */
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
- */
113
- $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
114
- if (!$order->getId()) {
115
- $this->_getSession()->addError($this->__('Order %s does not exist', $orderId));
116
- continue;
117
- }
118
-
119
- /**
120
- * Try to create a shipment
121
- */
122
- $shipmentId = $this->_createShipment($order, $trackingNumber, $trackingTitle, $sendEmail, $comment, $includeComment);
123
-
124
- if ($shipmentId != 0) {
125
- $this->_getSession()->addSuccess($this->__('Shipment %s created for order %s, with tracking number %s', $shipmentId, $orderId, $trackingNumber));
126
- }
127
-
128
- }//foreach
129
-
130
- }
131
-
132
- /**
133
- * Create new shipment for order
134
- * Inspired by Mage_Sales_Model_Order_Shipment_Api methods
135
- *
136
- * @param Mage_Sales_Model_Order $order (it should exist, no control is done into the method)
137
- * @param string $trackingNumber
138
- * @param string $trackingTitle
139
- * @param booleam $email
140
- * @param string $comment
141
- * @param boolean $includeComment
142
- * @return int : shipment real id if creation was ok, else 0
143
- */
144
- public function _createShipment($order, $trackingNumber, $trackingTitle, $email, $comment, $includeComment)
145
- {
146
- /**
147
- * Check shipment creation availability
148
- */
149
- if (!$order->canShip()) {
150
- $this->_getSession()->addError($this->__('Order %s can not be shipped or has already been shipped', $order->getRealOrderId()));
151
- return 0;
152
- }
153
-
154
- /**
155
- * Initialize the Mage_Sales_Model_Order_Shipment object
156
- */
157
- $convertor = Mage::getModel('sales/convert_order');
158
- $shipment = $convertor->toShipment($order);
159
-
160
- /**
161
- * Add the items to send
162
- */
163
- foreach ($order->getAllItems() as $orderItem) {
164
- if (!$orderItem->getQtyToShip()) {
165
- continue;
166
- }
167
- if ($orderItem->getIsVirtual()) {
168
- continue;
169
- }
170
-
171
- $item = $convertor->itemToShipmentItem($orderItem);
172
- $qty = $orderItem->getQtyToShip();
173
- $item->setQty($qty);
174
-
175
- $shipment->addItem($item);
176
- }//foreach
177
-
178
- $shipment->register();
179
-
180
- /**
181
- * Tracking number instanciation
182
- */
183
-
184
- $_shippingMethod = explode("_",$order->getShippingMethod());
185
- switch($_shippingMethod[0]) {
186
- case "chronopost":
187
- case "chronorelais":
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>';
196
- break;
197
- default:
198
- $carrier_code = 'custom';
199
- $popup = 0;
200
- $tracking_order = '';
201
- break;
202
- }
203
-
204
- $track = Mage::getModel('sales/order_shipment_track')
205
- ->setNumber($trackingNumber)
206
- ->setCarrierCode($carrier_code)
207
- ->setTitle($trackingTitle)
208
- ->setPopup($popup);
209
- $shipment->addTrack($track);
210
-
211
- /**
212
- * Comment handling
213
- */
214
- $shipment->addComment($comment, $email && $includeComment);
215
-
216
- /**
217
- * Change order status to Processing
218
- */
219
- $shipment->getOrder()->setIsInProcess(true);
220
-
221
- /**
222
- * If e-mail, set as sent (must be done before shipment object saving)
223
- */
224
- if ($email) {
225
- $shipment->setEmailSent(true);
226
- }
227
-
228
- try {
229
- /**
230
- * Save the created shipment and the updated order
231
- */
232
- $shipment->save();
233
- $shipment->getOrder()->save();
234
-
235
- /**
236
- * Email sending
237
- */
238
- $shipment->sendEmail($email, ($includeComment ? $tracking_order.$comment : $tracking_order));
239
- } catch (Mage_Core_Exception $e) {
240
- $this->_getSession()->addError($this->__('Shipment creation error for Order %s : %s', $orderId, $e->getMessage()));
241
- return 0;
242
- }
243
-
244
- /**
245
- * Everything was ok : return Shipment real id
246
- */
247
- return $shipment->getIncrementId();
248
- }
249
  }
1
+ <?php
2
+ class Chronopost_Chronorelais_ImportController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+
5
+ /**
6
+ * Constructor
7
+ */
8
+ protected function _construct()
9
+ {
10
+ $this->setUsedModuleName('Chronopost_Chronorelais');
11
+ }
12
+
13
+ /**
14
+ * Main action : show import form
15
+ */
16
+ public function indexAction()
17
+ {
18
+ $this->loadLayout()
19
+ ->_setActiveMenu('sales/chronorelais/import')
20
+ ->_addContent($this->getLayout()->createBlock('chronorelais/import_form'))
21
+ ->renderLayout();
22
+ }
23
+
24
+ /**
25
+ * Import Action
26
+ */
27
+ public function importAction()
28
+ {
29
+ if ($this->getRequest()->isPost() && !empty($_FILES['import_chronorelais_file']['tmp_name'])) {
30
+ try {
31
+ $trackingTitle = $_POST['import_chronorelais_tracking_title'];
32
+ $this->_importChronorelaisFile($_FILES['import_chronorelais_file']['tmp_name'], $trackingTitle);
33
+ }
34
+ catch (Mage_Core_Exception $e) {
35
+ $this->_getSession()->addError($e->getMessage());
36
+ }
37
+ catch (Exception $e) {
38
+ $this->_getSession()->addError($e->getMessage());
39
+ $this->_getSession()->addError($this->__('Invalid file upload attempt'));
40
+ }
41
+ }
42
+ else {
43
+ $this->_getSession()->addError($this->__('Invalid file upload attempt'));
44
+ }
45
+ $this->_redirect('*/*/index');
46
+ }
47
+
48
+ /**
49
+ * Importation logic
50
+ * @param string $fileName
51
+ * @param string $trackingTitle
52
+ */
53
+ protected function _importChronorelaisFile($fileName, $trackingTitle)
54
+ {
55
+ /**
56
+ * File handling
57
+ **/
58
+ ini_set('auto_detect_line_endings', true);
59
+ $csvObject = new Varien_File_Csv();
60
+ $csvData = $csvObject->getData($fileName);
61
+
62
+ /**
63
+ * File expected fields
64
+ */
65
+ $expectedCsvFields = array(
66
+ 0 => $this->__('Order Id'),
67
+ 1 => $this->__('Tracking Number')
68
+ );
69
+
70
+ /**
71
+ * Get configuration
72
+ */
73
+ $sendEmail = Mage::helper('chronorelais')->getConfigurationSendEmail();
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
83
+ */
84
+ foreach ($csvData as $k => $v) {
85
+
86
+ /**
87
+ * End of file has more than one empty lines
88
+ */
89
+ if (count($v) <= 1 && !strlen($v[0])) {
90
+ continue;
91
+ }
92
+
93
+ /**
94
+ * Check that the number of fields is not lower than expected
95
+ */
96
+ if (count($v) < count($expectedCsvFields)) {
97
+ $this->_getSession()->addError($this->__('Line %s format is invalid and has been ignored', $k));
98
+ continue;
99
+ }
100
+
101
+ /**
102
+ * Get fields content
103
+ */
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
+ */
113
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
114
+ if (!$order->getId()) {
115
+ $this->_getSession()->addError($this->__('Order %s does not exist', $orderId));
116
+ continue;
117
+ }
118
+
119
+ /**
120
+ * Try to create a shipment
121
+ */
122
+ $shipmentId = $this->_createShipment($order, $trackingNumber, $trackingTitle, $sendEmail, $comment, $includeComment);
123
+
124
+ if ($shipmentId != 0) {
125
+ $this->_getSession()->addSuccess($this->__('Shipment %s created for order %s, with tracking number %s', $shipmentId, $orderId, $trackingNumber));
126
+ }
127
+
128
+ }//foreach
129
+
130
+ }
131
+
132
+ /**
133
+ * Create new shipment for order
134
+ * Inspired by Mage_Sales_Model_Order_Shipment_Api methods
135
+ *
136
+ * @param Mage_Sales_Model_Order $order (it should exist, no control is done into the method)
137
+ * @param string $trackingNumber
138
+ * @param string $trackingTitle
139
+ * @param booleam $email
140
+ * @param string $comment
141
+ * @param boolean $includeComment
142
+ * @return int : shipment real id if creation was ok, else 0
143
+ */
144
+ public function _createShipment($order, $trackingNumber, $trackingTitle, $email, $comment, $includeComment)
145
+ {
146
+ /**
147
+ * Check shipment creation availability
148
+ */
149
+ if (!$order->canShip()) {
150
+ $this->_getSession()->addError($this->__('Order %s can not be shipped or has already been shipped', $order->getRealOrderId()));
151
+ return 0;
152
+ }
153
+
154
+ /**
155
+ * Initialize the Mage_Sales_Model_Order_Shipment object
156
+ */
157
+ $convertor = Mage::getModel('sales/convert_order');
158
+ $shipment = $convertor->toShipment($order);
159
+
160
+ /**
161
+ * Add the items to send
162
+ */
163
+ foreach ($order->getAllItems() as $orderItem) {
164
+ if (!$orderItem->getQtyToShip()) {
165
+ continue;
166
+ }
167
+ if ($orderItem->getIsVirtual()) {
168
+ continue;
169
+ }
170
+
171
+ $item = $convertor->itemToShipmentItem($orderItem);
172
+ $qty = $orderItem->getQtyToShip();
173
+ $item->setQty($qty);
174
+
175
+ $shipment->addItem($item);
176
+ }//foreach
177
+
178
+ $shipment->register();
179
+
180
+ /**
181
+ * Tracking number instanciation
182
+ */
183
+
184
+ $_shippingMethod = explode("_",$order->getShippingMethod());
185
+ switch($_shippingMethod[0]) {
186
+ case "chronopost":
187
+ case "chronorelais":
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>';
196
+ break;
197
+ default:
198
+ $carrier_code = 'custom';
199
+ $popup = 0;
200
+ $tracking_order = '';
201
+ break;
202
+ }
203
+
204
+ $track = Mage::getModel('sales/order_shipment_track')
205
+ ->setNumber($trackingNumber) //setTrackingNumber ?
206
+ ->setCarrierCode($carrier_code)
207
+ ->setTitle($trackingTitle)
208
+ ->setPopup($popup);
209
+ $shipment->addTrack($track);
210
+
211
+ /**
212
+ * Comment handling
213
+ */
214
+ $shipment->addComment($comment, $email && $includeComment);
215
+
216
+ /**
217
+ * Change order status to Processing
218
+ */
219
+ $shipment->getOrder()->setIsInProcess(true);
220
+
221
+ /**
222
+ * If e-mail, set as sent (must be done before shipment object saving)
223
+ */
224
+ if ($email) {
225
+ $shipment->setEmailSent(true);
226
+ }
227
+
228
+ try {
229
+ /**
230
+ * Save the created shipment and the updated order
231
+ */
232
+ $shipment->save();
233
+ $shipment->getOrder()->save();
234
+
235
+ /**
236
+ * Email sending
237
+ */
238
+ $shipment->sendEmail($email, ($includeComment ? $tracking_order.$comment : $tracking_order));
239
+ } catch (Mage_Core_Exception $e) {
240
+ $this->_getSession()->addError($this->__('Shipment creation error for Order %s : %s', $orderId, $e->getMessage()));
241
+ return 0;
242
+ }
243
+
244
+ /**
245
+ * Everything was ok : return Shipment real id
246
+ */
247
+ return $shipment->getIncrementId();
248
+ }
249
  }
app/code/community/Chronopost/Chronorelais/controllers/Sales/ImpressionController.php CHANGED
@@ -1,556 +1,567 @@
1
- <?php
2
- require_once 'Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php';
3
- class Chronopost_Chronorelais_Sales_ImpressionController extends Mage_Adminhtml_Sales_Order_ShipmentController
4
- {
5
- protected $_trackingNumbers = '';
6
-
7
- /**
8
- * Additional initialization
9
- *
10
- */
11
- protected function _construct()
12
- {
13
- $this->setUsedModuleName('Chronopost_Chronorelais');
14
- }
15
-
16
- /**
17
- * Shipping grid
18
- */
19
- public function indexAction()
20
- {
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
- $this->loadLayout()
26
- ->_setActiveMenu('sales/chronorelais')
27
- ->_addContent($this->getLayout()->createBlock('chronorelais/sales_impression'))
28
- ->renderLayout();
29
- }
30
-
31
- /**
32
- * Save shipment and order in one transaction
33
- * @param Mage_Sales_Model_Order_Shipment $shipment
34
- */
35
- protected function _saveShipment($shipment)
36
- {
37
- $shipment->getOrder()->setIsInProcess(true);
38
- $transactionSave = Mage::getModel('core/resource_transaction')
39
- ->addObject($shipment)
40
- ->addObject($shipment->getOrder())
41
- ->save();
42
-
43
- return $this;
44
- }
45
-
46
- protected function _processDownload($resource, $resourceType)
47
- {
48
- $helper = Mage::helper('downloadable/download');
49
- /* @var $helper Mage_Downloadable_Helper_Download */
50
-
51
- $helper->setResource($resource, $resourceType);
52
-
53
- $fileName = $helper->getFilename();
54
- $contentType = $helper->getContentType();
55
-
56
- $this->getResponse()
57
- ->setHttpResponseCode(200)
58
- ->setHeader('Pragma', 'public', true)
59
- ->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)
60
- ->setHeader('Content-type', $contentType, true);
61
-
62
- if ($fileSize = $helper->getFilesize()) {
63
- $this->getResponse()
64
- ->setHeader('Content-Length', $fileSize);
65
- }
66
-
67
- if ($contentDisposition = $helper->getContentDisposition()) {
68
- $this->getResponse()
69
- ->setHeader('Content-Disposition', $contentDisposition . '; filename='.$fileName);
70
- }
71
-
72
- $this->getResponse()
73
- ->clearBody();
74
- $this->getResponse()
75
- ->sendHeaders();
76
-
77
- $helper->output();
78
- }
79
-
80
- protected function getTrackingNumber($shipmentId)
81
- {
82
- $shipment = Mage::getModel('sales/order_shipment')->load($shipmentId);
83
-
84
- //On récupère le numéro de tracking
85
- $tracks = $shipment->getTracksCollection();
86
- foreach ($tracks as $track) {
87
- if ( $track->getParentId() == $shipmentId)
88
- {
89
- $this->_trackingNumbers .= $track->getnumber();
90
- }
91
- }
92
-
93
- return $this->_trackingNumbers;
94
- }
95
-
96
- protected function getFilledValue($value)
97
- {
98
- if($value) {
99
- return $this->removeaccents(trim($value));
100
- } else {
101
- return '';
102
- }
103
- }
104
-
105
- protected function checkMobileNumber($value)
106
- {
107
- if($reqvalue = trim($value)) {
108
- $_number = substr($reqvalue, 0, 2);
109
- $fixed_array = array('01','02','03','04','05','06','06');
110
- if(in_array($_number, $fixed_array)) {
111
- return $reqvalue;
112
- } else {
113
- return '';
114
- }
115
- }
116
- }
117
-
118
- protected function getExpeditionParams($_order, $_shippingMethod)
119
- {
120
- $_shippingAddress = $_order->getShippingAddress();
121
- $_billingAddress = $_order->getBillingAddress();
122
- $_helper = Mage::helper('chronorelais');
123
-
124
- if ($_shippingMethod[0] == 'chronorelais' || $_shippingMethod[0] == 'chronopost' || $_shippingMethod[0] == 'chronoexpress') {
125
- $esdParams = $header = $shipper = $customer = $recipient = $ref = $skybill = $skybillParams = $password = array();
126
-
127
- //esdParams parameters
128
- $esdParams = array(
129
- 'height' => '',
130
- 'width' => '',
131
- 'length' => ''
132
- );
133
-
134
- //header parameters
135
- $header = array(
136
- 'idEmit' => 'CHRFR',
137
- 'accountNumber' => $_helper->getConfigurationAccountNumber(),
138
- 'subAccount' => $_helper->getConfigurationSubAccountNumber()
139
- );
140
-
141
- //shipper parameters
142
- $shipperMobilePhone = $this->checkMobileNumber($_helper->getConfigurationShipperInfo('mobilephone'));
143
- $shipper = array(
144
- 'shipperAdress1' => $_helper->getConfigurationShipperInfo('address1'),
145
- 'shipperAdress2' => $_helper->getConfigurationShipperInfo('address2'),
146
- 'shipperCity' => $_helper->getConfigurationShipperInfo('city'),
147
- 'shipperCivility' => $_helper->getConfigurationShipperInfo('civility'),
148
- 'shipperContactName'=> $_helper->getConfigurationShipperInfo('contactname'),
149
- 'shipperCountry' => $_helper->getConfigurationShipperInfo('country'),
150
- 'shipperEmail' => $_helper->getConfigurationShipperInfo('email'),
151
- 'shipperMobilePhone'=> $shipperMobilePhone,
152
- 'shipperName' => $_helper->getConfigurationShipperInfo('name'),
153
- 'shipperName2' => $_helper->getConfigurationShipperInfo('name2'),
154
- 'shipperPhone' => $_helper->getConfigurationShipperInfo('phone'),
155
- 'shipperPreAlert' => '',
156
- 'shipperZipCode' => $_helper->getConfigurationShipperInfo('zipcode')
157
- );
158
-
159
- //customer parameters
160
- $customerMobilePhone = $this->checkMobileNumber($_helper->getConfigurationCustomerInfo('mobilephone'));
161
- $customer = array(
162
- 'customerAdress1' => $_helper->getConfigurationCustomerInfo('address1'),
163
- 'customerAdress2' => $_helper->getConfigurationCustomerInfo('address2'),
164
- 'customerCity' => $_helper->getConfigurationCustomerInfo('city'),
165
- 'customerCivility' => $_helper->getConfigurationCustomerInfo('civility'),
166
- 'customerContactName'=> $_helper->getConfigurationCustomerInfo('contactname'),
167
- 'customerCountry' => $_helper->getConfigurationCustomerInfo('country'),
168
- 'customerEmail' => $_helper->getConfigurationCustomerInfo('email'),
169
- 'customerMobilePhone'=> $customerMobilePhone,
170
- 'customerName' => $_helper->getConfigurationCustomerInfo('name'),
171
- 'customerName2' => $_helper->getConfigurationCustomerInfo('name2'),
172
- 'customerPhone' => $_helper->getConfigurationCustomerInfo('phone'),
173
- 'customerPreAlert' => '',
174
- 'customerZipCode' => $_helper->getConfigurationCustomerInfo('zipcode')
175
- );
176
-
177
- //recipient parameters
178
- $recipient_address = $_shippingAddress->getStreet();
179
- if (!isset($recipient_address[1])) {
180
- $recipient_address[1] = '';
181
- }
182
- $customer_email = ($_shippingAddress->getEmail()) ? $_shippingAddress->getEmail() : ($_billingAddress->getEmail() ? $_billingAddress->getEmail() : $_order->getCustomerEmail());
183
- $recipientMobilePhone = $this->checkMobileNumber($_shippingAddress->getTelephone());
184
- $recipientName = $this->getFilledValue($_shippingAddress->getCompany()); //RelayPoint Name if chronorelais or Companyname if chronopost and
185
- $recipientName2 = $this->getFilledValue($_shippingAddress->getFirstname() . ' ' . $_shippingAddress->getLastname());
186
- //remove any alphabets in phone number
187
- $recipientPhone = trim(ereg_replace("[^0-9.-]", " ", $_shippingAddress->getTelephone()));
188
-
189
- $recipient = array(
190
- 'recipientAdress1' => $this->getFilledValue($recipient_address[0]),
191
- 'recipientAdress2' => $this->getFilledValue($recipient_address[1]),
192
- 'recipientCity' => $this->getFilledValue($_shippingAddress->getCity()),
193
- 'recipientContactName' => $recipientName2,
194
- 'recipientCountry' => $this->getFilledValue($_shippingAddress->getCountryId()),
195
- 'recipientEmail' => $customer_email,
196
- 'recipientMobilePhone' => $recipientMobilePhone,
197
- 'recipientName' => $recipientName,
198
- 'recipientName2' => $recipientName2,
199
- 'recipientPhone' => $recipientPhone,
200
- 'recipientPreAlert' => '',
201
- 'recipientZipCode' => $this->getFilledValue($_shippingAddress->getPostcode()),
202
- );
203
-
204
- //ref parameters
205
- $recipientRef = $this->getFilledValue($_shippingAddress->getWRelayPointCode());
206
- if(!$recipientRef) {
207
- $recipientRef = $_order->getCustomerId();
208
- }
209
- $shipperRef = $_order->getRealOrderId();
210
-
211
- $ref = array(
212
- 'recipientRef' => $recipientRef,
213
- 'shipperRef' => $shipperRef
214
- );
215
-
216
- //skybill parameters
217
- /* Livraison Samedi (Delivery Saturday) field*/
218
- $SaturdayShipping = 0; //default value for the saturday shipping
219
- $send_day = strtolower(date('l'));
220
- if($_shippingMethod[0] == "chronopost" || $_shippingMethod[0] == "chronorelais") {
221
- if(!$_deliver_on_saturday = Mage::helper('chronorelais')->getLivraisonSamediStatus($_order->getEntityId())) {
222
- $_deliver_on_saturday = Mage::helper('chronorelais')->getConfigData('carriers/'.$_shippingMethod[0].'/deliver_on_saturday');
223
- } else {
224
- if($_deliver_on_saturday=='Yes') {
225
- $_deliver_on_saturday = 1;
226
- } else {
227
- $_deliver_on_saturday = 0;
228
- }
229
- }
230
- $is_sending_day = Mage::helper('chronorelais')->isSendingDay();
231
- if($_deliver_on_saturday && $is_sending_day) {
232
- $SaturdayShipping = 6;
233
- } elseif(!$_deliver_on_saturday && $is_sending_day) {
234
- $SaturdayShipping = 1;
235
- }
236
- }
237
-
238
- $skybill = array(
239
- 'codCurrency' => 'EUR',
240
- 'codValue' => '',
241
- 'content1' => '',
242
- 'content2' => '',
243
- 'content3' => '',
244
- 'content4' => '',
245
- 'content5' => '',
246
- 'customsCurrency' => 'EUR',
247
- 'customsValue' => '',
248
- 'evtCode' => 'DC',
249
- 'insuredCurrency' => 'EUR',
250
- 'insuredValue' => '',
251
- 'objectType' => 'MAR',
252
- 'productCode' => $_helper->getChronoProductCode($_shippingAddress->getCountryId(),$_shippingMethod[0]),
253
- 'service' => $SaturdayShipping,
254
- 'shipDate' => date('c'),
255
- 'shipHour' => date('H'),
256
- 'weight' => $_order->getWeight(),
257
- 'weightUnit' => 'KGM'
258
- );
259
-
260
- $skybillParams = array(
261
- 'mode' => $_helper->getConfigurationSkybillParam()
262
- );
263
-
264
- $expeditionArray = array(
265
- 'esdParams' => $esdParams,
266
- 'header' => $header,
267
- 'shipper' => $shipper,
268
- 'customer' => $customer,
269
- 'recipient' => $recipient,
270
- 'ref' => $ref,
271
- 'skybill' => $skybill,
272
- 'skybillParams' => $skybillParams,
273
- 'password' => $_helper->getConfigurationAccountPass(),
274
- 'option' => '0'
275
- );
276
- //printArray($expeditionArray); exit;
277
- return $expeditionArray;
278
- }
279
- }
280
-
281
- protected function getEtiquetteUrl($shipmentId)
282
- {
283
- //On récupère les infos d'expédition
284
- $reservationNumber = '';
285
- $_helper = Mage::helper('chronorelais');
286
-
287
- $shipment = Mage::getModel('sales/order_shipment')->load($shipmentId);
288
- if($_shipTracks = $shipment->getAllTracks()) {
289
- foreach($_shipTracks as $_shipTrack) {
290
- if($_shipTrack->getNumber() && $_shipTrack->getChronoReservationNumber()) {
291
- $reservationNumber = $_shipTrack->getChronoReservationNumber();
292
- break;
293
- }
294
- }
295
- if($reservationNumber) {
296
- return $reservationNumber;
297
- }
298
- }
299
-
300
- $_order = $shipment->getOrder();
301
- $_shippingMethod = explode("_",$_order->getShippingMethod());
302
-
303
- $expeditionArray = $this->getExpeditionParams($_order, $_shippingMethod);
304
- $tracking_number = '';
305
- if($expeditionArray) {
306
- $client = new SoapClient("http://wsshipping.chronopost.fr/shipping/services/services/ServiceEProcurement?wsdl", array('trace' => true));
307
- try
308
- {
309
- $webservbt = $client->__call("reservationExpeditionV2",$expeditionArray);
310
- if(!$webservbt->errorCode && $webservbt->reservationNumber) {
311
- $tracking_number = $webservbt->skybillNumber;
312
- // Add tracking number for the shipment if not already exists.
313
- if(!$this->_trackingNumbers && $webservbt->skybillNumber) {
314
- $track = Mage::getModel('sales/order_shipment_track')
315
- ->setNumber($webservbt->skybillNumber)
316
- ->setCarrier(ucwords($_shippingMethod[0]))
317
- ->setCarrierCode($_shippingMethod[0])
318
- ->setTitle(ucwords($_shippingMethod[0]))
319
- ->setChronoReservationNumber($webservbt->reservationNumber)
320
- ->setPopup(1);
321
- $shipment->addTrack($track);
322
-
323
- $tracking_url = str_replace('{tracking_number}', $tracking_number, Mage::helper('chronorelais')->getConfigurationTrackingViewUrl());
324
- $tracking_title = $this->__('Track Your Order');
325
- $tracking_order = '<p><a title="'.$tracking_title.'" href="'.$tracking_url.'"><b>'.$tracking_title.'</b></a></p>';
326
-
327
- //$shipment->register();
328
- $comment = '';
329
- $shipment->setEmailSent(true);
330
- $this->_saveShipment($shipment);
331
- $shipment->sendEmail(1, $tracking_order.$comment);
332
- }
333
- return $webservbt->reservationNumber;
334
- } else {
335
- $this->_getSession()->addError($_helper->__($webservbt->errorMessage));
336
- }
337
- }
338
- catch(SoapFault $fault)
339
- {
340
- $this->_getSession()->addError($_helper->__($fault->faultstring));
341
- }
342
- }
343
- }
344
-
345
- public function getShipmentByOrderId($orderId) {
346
- $_shipment = Mage::getResourceModel('sales/order_shipment_grid_collection')
347
- ->addAttributeToFilter('order_id', $orderId)
348
- ->getAllIds();
349
- return $_shipment;
350
- }
351
-
352
- public function initShipment($orderId)
353
- {
354
- $order = Mage::getModel('sales/order')->load($orderId);
355
-
356
- /**
357
- * Check order existing
358
- */
359
- if (!$order->getId()) {
360
- $this->_getSession()->addError($this->__('The order no longer exists.'));
361
- return false;
362
- }
363
- /**
364
- * Check shipment is available to create separate from invoice
365
- */
366
-
367
- if ($order->getForcedDoShipmentWithInvoice()) {
368
- $this->_getSession()->addError($this->__('Cannot do shipment for the order separately from invoice.'));
369
- return false;
370
- }
371
- /**
372
- * Check shipment create availability
373
- */
374
- /*if (!$order->canShip()) {
375
- $this->_getSession()->addError($this->__('Cannot do shipment for the order.'));
376
- return false;
377
- }*/
378
- $savedQtys = $this->_getItemQtys();
379
- $shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($savedQtys);
380
-
381
- Mage::register('current_shipment', $shipment);
382
- return $shipment;
383
- }
384
-
385
- public function createNewShipment($orderId) {
386
- $_helper = Mage::helper('chronorelais');
387
- $reservationNumber = '';
388
- try {
389
- if ($shipment = $this->initShipment($orderId)) {
390
- $shipment->register();
391
-
392
- $_order = $shipment->getOrder();
393
- $_shippingMethod = explode("_",$_order->getShippingMethod());
394
-
395
- $expeditionArray = $this->getExpeditionParams($_order, $_shippingMethod);
396
- $tracking_number = '';
397
- if($expeditionArray) {
398
-
399
- $client = new SoapClient("http://wsshipping.chronopost.fr/shipping/services/services/ServiceEProcurement?wsdl", array('trace' => true));
400
- try
401
- {
402
- $expedition = $client->__call("reservationExpeditionV2",$expeditionArray);
403
- if(!$expedition->errorCode && $expedition->skybillNumber) {
404
- $tracking_number = $expedition->skybillNumber;
405
- $track = Mage::getModel('sales/order_shipment_track')
406
- ->setNumber($expedition->skybillNumber)
407
- ->setCarrier(ucwords($_shippingMethod[0]))
408
- ->setCarrierCode($_shippingMethod[0])
409
- ->setTitle(ucwords($_shippingMethod[0]))
410
- ->setChronoReservationNumber($expedition->reservationNumber)
411
- ->setPopup(1);
412
- $shipment->addTrack($track);
413
- $reservationNumber = $expedition->reservationNumber;
414
- } else {
415
- $this->_getSession()->addError($_helper->__($expedition->errorMessage));
416
- return;
417
- }
418
- }
419
- catch(SoapFault $fault)
420
- {
421
- $this->_getSession()->addError($_helper->__($fault->faultstring));
422
- return;
423
- }
424
- }
425
-
426
- $tracking_url = str_replace('{tracking_number}', $tracking_number, Mage::helper('chronorelais')->getConfigurationTrackingViewUrl());
427
- $tracking_title = $this->__('Track Your Order');
428
- $tracking_order = '<p><a title="'.$tracking_title.'" href="'.$tracking_url.'"><b>'.$tracking_title.'</b></a></p>';
429
-
430
- $comment = '';
431
- $shipment->setEmailSent(true);
432
- $this->_saveShipment($shipment);
433
- $shipment->sendEmail(1, $tracking_order.$comment);
434
- $this->_getSession()->addSuccess($this->__('Shipment was successfully created.'));
435
- return $reservationNumber;
436
-
437
- }else {
438
- $this->_forward('noRoute');
439
- return;
440
- }
441
- }
442
- catch (Mage_Core_Exception $e) {
443
- $this->_getSession()->addError($e->getMessage());
444
- return;
445
- }
446
- catch (Exception $e) {
447
- $this->_getSession()->addError($this->__('Can not save shipment: '.$e->getMessage()));
448
- return;
449
- }
450
- }
451
-
452
- public function printMassAction()
453
- {
454
- $shipmentsIds = $this->getRequest()->getPost('shipment_ids');
455
- try {
456
- $trackingNumber = $this->getEtiquetteUrl($shipmentsIds);
457
- if($trackingNumber) {
458
- $tracking_url = str_replace('{trackingNumber}', $trackingNumber, Mage::helper('chronorelais')->getConfigurationTrackingUrl());
459
- $this->_processDownload($tracking_url, 'url');
460
- exit(0);
461
- }
462
- } catch (Mage_Core_Exception $e) {
463
- $this->_getSession()->addError(Mage::helper('chronorelais')->__('Désolé, une erreure est survenu lors de la récupération de l\'étiquetes. Merci de contacter Chronopost ou de réessayer plus tard'));
464
- }
465
- return $this->_redirectReferer();
466
-
467
- }
468
-
469
- public function printAction()
470
- {
471
- $orderId = $this->getRequest()->getParam('order_id');
472
-
473
- if($_shipments = $this->getShipmentByOrderId($orderId)) {
474
- $shipmentId = $_shipments[0];
475
- $trackingNumber = $this->getEtiquetteUrl($shipmentId);
476
- } else {
477
- $trackingNumber = $this->createNewShipment($orderId);
478
- }
479
-
480
- if($trackingNumber) {
481
- try {
482
- $tracking_url = str_replace('{trackingNumber}', $trackingNumber, Mage::helper('chronorelais')->getConfigurationTrackingUrl());
483
- $this->_processDownload($tracking_url, 'url');
484
- exit(0);
485
- } catch (Mage_Core_Exception $e) {
486
- $this->_getSession()->addError(Mage::helper('chronorelais')->__('Désolé, une erreure est survenu lors de la récupération de l\'étiquetes. Merci de contacter Chronopost ou de réessayer plus tard'));
487
- }
488
- }
489
- return $this->_redirectReferer();
490
- }
491
-
492
- public function massLivraisonSamediStatusAction()
493
- {
494
- if($this->getRequest()->getPost('status')) {
495
- $this->saveLivraisonSamediStatusAction();
496
- }
497
- }
498
-
499
- /* Save the Livraison le Samedi status to orders */
500
- public function saveLivraisonSamediStatusAction()
501
- {
502
- /* get the orders */
503
- $orderIds = $this->getRequest()->getPost('order_ids');
504
- $status = $this->getRequest()->getPost('status');
505
- $_connection = Mage::getSingleton('core/resource')->getConnection('core_write');
506
- $_table = Mage::getSingleton('core/resource')->getTableName('sales_chronopost_order_export_status');
507
- $exceptions = array();
508
-
509
- foreach($orderIds as $orderId) {
510
- $order_details = Mage::getModel('sales/order')->load($orderId);
511
- $shipping_method = '';
512
- $livraison_le_samedi = $status;
513
- if($shipping_method = $order_details->getShippingMethod()) {
514
- $shipping_method = explode('_',$shipping_method);
515
- if($shipping_method[0]=='chronoexpress') {
516
- $livraison_le_samedi = '--';
517
- }
518
- }
519
- $condition = array(
520
- $_connection->quoteInto('order_id = ?', $orderId),
521
- );
522
- $_connection->delete($_table, $condition);
523
-
524
- $dataLine = array(
525
- 'order_id' => $orderId,
526
- 'livraison_le_samedi' => $livraison_le_samedi
527
- );
528
- try {
529
- $_connection->insert($_table, $dataLine);
530
- }
531
- catch (Exception $e) {
532
- $exceptions[] = Mage::helper('chronorelais')->__('Order assigning error: ' . $e->getMessage());
533
- }
534
- }
535
- if($exceptions) {
536
- $this->_getSession()->addError($exceptions);
537
- } else {
538
- $this->_getSession()->addSuccess($this->__('Livraison le Samedi statut a &eacute;t&eacute; ajout&eacute;'));
539
- }
540
- $this->_redirect('*/*/index');
541
- }
542
-
543
- /* Remove accents characters */
544
- public function removeaccents($string){
545
- $stringToReturn = str_replace(
546
- array('à','á','â','ã','ä', 'ç', 'è','é','ê','ë', 'ì','í','î','ï', 'ñ', 'ò','ó','ô','õ','ö', 'ù','ú','û','ü', 'ý','ÿ', 'À','Á','Â','Ã','Ä', 'Ç', 'È','É','Ê','Ë', 'Ì','Í','Î','Ï', 'Ñ', 'Ò','Ó','Ô','Õ','Ö', 'Ù','Ú','Û','Ü', 'Ý','/','\xa8'),
547
- 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);
548
- // Remove all remaining other unknown characters
549
- $stringToReturn = preg_replace('/[^a-zA-Z0-9\-]/', ' ', $stringToReturn);
550
- $stringToReturn = preg_replace('/^[\-]+/', '', $stringToReturn);
551
- $stringToReturn = preg_replace('/[\-]+$/', '', $stringToReturn);
552
- $stringToReturn = preg_replace('/[\-]{2,}/', ' ', $stringToReturn);
553
- return $stringToReturn;
554
- }
555
-
 
 
 
 
 
 
 
 
 
 
 
556
  }
1
+ <?php
2
+
3
+ require_once 'Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php';
4
+
5
+ class Chronopost_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
+ $this->loadLayout()
26
+ ->_setActiveMenu('sales/chronorelais')
27
+ ->_addContent($this->getLayout()->createBlock('chronorelais/sales_impression'))
28
+ ->renderLayout();
29
+ }
30
+
31
+ /**
32
+ * Save shipment and order in one transaction
33
+ * @param Mage_Sales_Model_Order_Shipment $shipment
34
+ */
35
+ protected function _saveShipment($shipment) {
36
+ $shipment->getOrder()->setIsInProcess(true);
37
+ $transactionSave = Mage::getModel('core/resource_transaction')
38
+ ->addObject($shipment)
39
+ ->addObject($shipment->getOrder())
40
+ ->save();
41
+
42
+ return $this;
43
+ }
44
+
45
+ protected function _processDownload($resource, $resourceType) {
46
+ $helper = Mage::helper('downloadable/download');
47
+ /* @var $helper Mage_Downloadable_Helper_Download */
48
+
49
+ $helper->setResource($resource, $resourceType);
50
+
51
+ $fileName = $helper->getFilename();
52
+ $contentType = $helper->getContentType();
53
+
54
+ $this->getResponse()
55
+ ->setHttpResponseCode(200)
56
+ ->setHeader('Pragma', 'public', true)
57
+ ->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)
58
+ ->setHeader('Content-type', $contentType, true);
59
+
60
+ if ($fileSize = $helper->getFilesize()) {
61
+ $this->getResponse()
62
+ ->setHeader('Content-Length', $fileSize);
63
+ }
64
+
65
+ if ($contentDisposition = $helper->getContentDisposition()) {
66
+ $this->getResponse()
67
+ ->setHeader('Content-Disposition', $contentDisposition . '; filename=' . $fileName);
68
+ }
69
+
70
+ $this->getResponse()
71
+ ->clearBody();
72
+ $this->getResponse()
73
+ ->sendHeaders();
74
+
75
+ $helper->output();
76
+ }
77
+
78
+ protected function getTrackingNumber($shipmentId) {
79
+ $shipment = Mage::getModel('sales/order_shipment')->load($shipmentId);
80
+
81
+ //On récupère le numéro de tracking
82
+ $tracks = $shipment->getTracksCollection();
83
+ foreach ($tracks as $track) {
84
+ if ($track->getParentId() == $shipmentId) {
85
+ $this->_trackingNumbers .= $track->getnumber();
86
+ }
87
+ }
88
+
89
+ return $this->_trackingNumbers;
90
+ }
91
+
92
+ protected function getFilledValue($value) {
93
+ if ($value) {
94
+ return $this->removeaccents(trim($value));
95
+ } else {
96
+ return '';
97
+ }
98
+ }
99
+
100
+ protected function checkMobileNumber($value) {
101
+ if ($reqvalue = trim($value)) {
102
+ $_number = substr($reqvalue, 0, 2);
103
+ $fixed_array = array('01', '02', '03', '04', '05', '06', '06');
104
+ if (in_array($_number, $fixed_array)) {
105
+ return $reqvalue;
106
+ } else {
107
+ return '';
108
+ }
109
+ }
110
+ }
111
+
112
+ protected function getExpeditionParams($shipment, $_shippingMethod) {
113
+ $_order = $shipment->getOrder();
114
+ $_shippingAddress = $shipment->getShippingAddress();
115
+ $_billingAddress = $shipment->getBillingAddress();
116
+ $_helper = Mage::helper('chronorelais');
117
+
118
+ if ($_shippingMethod[0] == 'chronorelais' || $_shippingMethod[0] == 'chronopost' || $_shippingMethod[0] == 'chronoexpress') {
119
+ $esdParams = $header = $shipper = $customer = $recipient = $ref = $skybill = $skybillParams = $password = array();
120
+
121
+ //esdParams parameters
122
+ $esdParams = array(
123
+ 'height' => '',
124
+ 'width' => '',
125
+ 'length' => ''
126
+ );
127
+
128
+ //header parameters
129
+ $header = array(
130
+ 'idEmit' => 'CHRFR',
131
+ 'accountNumber' => $_helper->getConfigurationAccountNumber(),
132
+ 'subAccount' => $_helper->getConfigurationSubAccountNumber()
133
+ );
134
+
135
+ //shipper parameters
136
+ $shipperMobilePhone = $this->checkMobileNumber($_helper->getConfigurationShipperInfo('mobilephone'));
137
+ $shipper = array(
138
+ 'shipperAdress1' => $_helper->getConfigurationShipperInfo('address1'),
139
+ 'shipperAdress2' => $_helper->getConfigurationShipperInfo('address2'),
140
+ 'shipperCity' => $_helper->getConfigurationShipperInfo('city'),
141
+ 'shipperCivility' => $_helper->getConfigurationShipperInfo('civility'),
142
+ 'shipperContactName' => $_helper->getConfigurationShipperInfo('contactname'),
143
+ 'shipperCountry' => $_helper->getConfigurationShipperInfo('country'),
144
+ 'shipperEmail' => $_helper->getConfigurationShipperInfo('email'),
145
+ 'shipperMobilePhone' => $shipperMobilePhone,
146
+ 'shipperName' => $_helper->getConfigurationShipperInfo('name'),
147
+ 'shipperName2' => $_helper->getConfigurationShipperInfo('name2'),
148
+ 'shipperPhone' => $_helper->getConfigurationShipperInfo('phone'),
149
+ 'shipperPreAlert' => '',
150
+ 'shipperZipCode' => $_helper->getConfigurationShipperInfo('zipcode')
151
+ );
152
+
153
+ //customer parameters
154
+ $customerMobilePhone = $this->checkMobileNumber($_helper->getConfigurationCustomerInfo('mobilephone'));
155
+ $customer = array(
156
+ 'customerAdress1' => $_helper->getConfigurationCustomerInfo('address1'),
157
+ 'customerAdress2' => $_helper->getConfigurationCustomerInfo('address2'),
158
+ 'customerCity' => $_helper->getConfigurationCustomerInfo('city'),
159
+ 'customerCivility' => $_helper->getConfigurationCustomerInfo('civility'),
160
+ 'customerContactName' => $_helper->getConfigurationCustomerInfo('contactname'),
161
+ 'customerCountry' => $_helper->getConfigurationCustomerInfo('country'),
162
+ 'customerEmail' => $_helper->getConfigurationCustomerInfo('email'),
163
+ 'customerMobilePhone' => $customerMobilePhone,
164
+ 'customerName' => $_helper->getConfigurationCustomerInfo('name'),
165
+ 'customerName2' => $_helper->getConfigurationCustomerInfo('name2'),
166
+ 'customerPhone' => $_helper->getConfigurationCustomerInfo('phone'),
167
+ 'customerPreAlert' => '',
168
+ 'customerZipCode' => $_helper->getConfigurationCustomerInfo('zipcode')
169
+ );
170
+
171
+ //recipient parameters
172
+ $recipient_address = $_shippingAddress->getStreet();
173
+ if (!isset($recipient_address[1])) {
174
+ $recipient_address[1] = '';
175
+ }
176
+ $customer_email = ($_shippingAddress->getEmail()) ? $_shippingAddress->getEmail() : ($_billingAddress->getEmail() ? $_billingAddress->getEmail() : $_order->getCustomerEmail());
177
+ $recipientMobilePhone = $this->checkMobileNumber($_shippingAddress->getTelephone());
178
+ $recipientName = $this->getFilledValue($_shippingAddress->getCompany()); //RelayPoint Name if chronorelais or Companyname if chronopost and
179
+ $recipientName2 = $this->getFilledValue($_shippingAddress->getFirstname() . ' ' . $_shippingAddress->getLastname());
180
+ //remove any alphabets in phone number
181
+ $recipientPhone = trim(ereg_replace("[^0-9.-]", " ", $_shippingAddress->getTelephone()));
182
+
183
+ $recipient = array(
184
+ 'recipientAdress1' => substr($this->getFilledValue($recipient_address[0]), 0, 38),
185
+ 'recipientAdress2' => substr($this->getFilledValue($recipient_address[1]), 0, 38),
186
+ 'recipientCity' => $this->getFilledValue($_shippingAddress->getCity()),
187
+ 'recipientContactName' => $recipientName2,
188
+ 'recipientCountry' => $this->getFilledValue($_shippingAddress->getCountryId()),
189
+ 'recipientEmail' => $customer_email,
190
+ 'recipientMobilePhone' => $recipientMobilePhone,
191
+ 'recipientName' => $recipientName,
192
+ 'recipientName2' => $recipientName2,
193
+ 'recipientPhone' => $recipientPhone,
194
+ 'recipientPreAlert' => '',
195
+ 'recipientZipCode' => $this->getFilledValue($_shippingAddress->getPostcode()),
196
+ );
197
+
198
+ //ref parameters
199
+ $recipientRef = $this->getFilledValue($_shippingAddress->getWRelayPointCode());
200
+ if (!$recipientRef) {
201
+ $recipientRef = $_order->getCustomerId();
202
+ }
203
+ $shipperRef = $_order->getRealOrderId();
204
+
205
+ $ref = array(
206
+ 'recipientRef' => $recipientRef,
207
+ 'shipperRef' => $shipperRef
208
+ );
209
+
210
+ //skybill parameters
211
+ /* Livraison Samedi (Delivery Saturday) field */
212
+ $SaturdayShipping = 0; //default value for the saturday shipping
213
+ $send_day = strtolower(date('l'));
214
+ if ($_shippingMethod[0] == "chronopost" || $_shippingMethod[0] == "chronorelais") {
215
+ if (!$_deliver_on_saturday = Mage::helper('chronorelais')->getLivraisonSamediStatus($_order->getEntityId())) {
216
+ $_deliver_on_saturday = Mage::helper('chronorelais')->getConfigData('carriers/' . $_shippingMethod[0] . '/deliver_on_saturday');
217
+ } else {
218
+ if ($_deliver_on_saturday == 'Yes') {
219
+ $_deliver_on_saturday = 1;
220
+ } else {
221
+ $_deliver_on_saturday = 0;
222
+ }
223
+ }
224
+ $is_sending_day = Mage::helper('chronorelais')->isSendingDay();
225
+ if ($_deliver_on_saturday && $is_sending_day) {
226
+ $SaturdayShipping = 6;
227
+ } elseif (!$_deliver_on_saturday && $is_sending_day) {
228
+ $SaturdayShipping = 1;
229
+ }
230
+ }
231
+
232
+ $weight = 0;
233
+ foreach ($shipment->getItemsCollection() as $item) {
234
+ $weight += $item->weight * $item->qty;
235
+ }
236
+
237
+ $skybill = array(
238
+ 'codCurrency' => 'EUR',
239
+ 'codValue' => '',
240
+ 'content1' => '',
241
+ 'content2' => '',
242
+ 'content3' => '',
243
+ 'content4' => '',
244
+ 'content5' => '',
245
+ 'customsCurrency' => 'EUR',
246
+ 'customsValue' => '',
247
+ 'evtCode' => 'DC',
248
+ 'insuredCurrency' => 'EUR',
249
+ 'insuredValue' => '',
250
+ 'objectType' => 'MAR',
251
+ 'productCode' => $_helper->getChronoProductCode($_shippingAddress->getCountryId(), $_shippingMethod[0]),
252
+ 'service' => $SaturdayShipping,
253
+ 'shipDate' => date('c'),
254
+ 'shipHour' => date('H'),
255
+ 'weight' => $weight,
256
+ 'weightUnit' => 'KGM'
257
+ );
258
+
259
+ $skybillParams = array(
260
+ 'mode' => $_helper->getConfigurationSkybillParam()
261
+ );
262
+
263
+ $expeditionArray = array(
264
+ 'esdParams' => $esdParams,
265
+ 'header' => $header,
266
+ 'shipper' => $shipper,
267
+ 'customer' => $customer,
268
+ 'recipient' => $recipient,
269
+ 'ref' => $ref,
270
+ 'skybill' => $skybill,
271
+ 'skybillParams' => $skybillParams,
272
+ 'password' => $_helper->getConfigurationAccountPass(),
273
+ 'option' => '0'
274
+ );
275
+ //printArray($expeditionArray); exit;
276
+ return $expeditionArray;
277
+ }
278
+ }
279
+
280
+ protected function getEtiquetteUrl($shipmentId) {
281
+ //On récupère les infos d'expédition
282
+ $reservationNumber = '';
283
+ $_helper = Mage::helper('chronorelais');
284
+
285
+ $shipment = Mage::getModel('sales/order_shipment')->load($shipmentId);
286
+ if ($_shipTracks = $shipment->getAllTracks()) {
287
+ foreach ($_shipTracks as $_shipTrack) {
288
+ if ($_shipTrack->getNumber() && $_shipTrack->getChronoReservationNumber()) {
289
+ $reservationNumber = $_shipTrack->getChronoReservationNumber();
290
+ break;
291
+ }
292
+ }
293
+ if ($reservationNumber) {
294
+ return $reservationNumber;
295
+ }
296
+ }
297
+
298
+ $_order = $shipment->getOrder();
299
+ $_shippingMethod = explode("_", $_order->getShippingMethod());
300
+
301
+ $expeditionArray = $this->getExpeditionParams($shipment, $_shippingMethod);
302
+ $tracking_number = '';
303
+ if ($expeditionArray) {
304
+ $client = new SoapClient("http://wsshipping.chronopost.fr/shipping/services/services/ServiceEProcurement?wsdl", array('trace' => true));
305
+ try {
306
+ $webservbt = $client->__call("reservationExpeditionV2", $expeditionArray);
307
+ if (!$webservbt->errorCode && $webservbt->reservationNumber) {
308
+ $tracking_number = $webservbt->skybillNumber;
309
+ // Add tracking number for the shipment if not already exists.
310
+ if (!$this->_trackingNumbers && $webservbt->skybillNumber) {
311
+ $track = Mage::getModel('sales/order_shipment_track')
312
+ ->setNumber($webservbt->skybillNumber)
313
+ ->setCarrier(ucwords($_shippingMethod[0]))
314
+ ->setCarrierCode($_shippingMethod[0])
315
+ ->setTitle(ucwords($_shippingMethod[0]))
316
+ ->setChronoReservationNumber($webservbt->reservationNumber)
317
+ ->setPopup(1);
318
+ $shipment->addTrack($track);
319
+
320
+ $tracking_url = str_replace('{tracking_number}', $tracking_number, Mage::helper('chronorelais')->getConfigurationTrackingViewUrl());
321
+ $tracking_title = $this->__('Track Your Order');
322
+ $tracking_order = '<p><a title="' . $tracking_title . '" href="' . $tracking_url . '"><b>' . $tracking_title . '</b></a></p>';
323
+
324
+ //$shipment->register();
325
+ $comment = '';
326
+ $shipment->setEmailSent(true);
327
+ $this->_saveShipment($shipment);
328
+ $shipment->sendEmail(1, $tracking_order . $comment);
329
+ }
330
+ return $webservbt->reservationNumber;
331
+ } else {
332
+ $this->_getSession()->addError($_helper->__($webservbt->errorMessage));
333
+ }
334
+ } catch (SoapFault $fault) {
335
+ $this->_getSession()->addError($_helper->__($fault->faultstring));
336
+ }
337
+ }
338
+ }
339
+
340
+ public function getShipmentByOrderId($orderId) {
341
+ $_shipment = Mage::getResourceModel('sales/order_shipment_grid_collection')
342
+ ->addAttributeToFilter('order_id', $orderId)
343
+ ->getAllIds();
344
+ return $_shipment;
345
+ }
346
+
347
+ public function getShipmentByIncrementId($incrementId) {
348
+ $_shipment = Mage::getResourceModel('sales/order_shipment_grid_collection')
349
+ ->addAttributeToFilter('increment_id', $incrementId)
350
+ ->getAllIds();
351
+ return $_shipment;
352
+ }
353
+
354
+ public function initShipment($orderId) {
355
+ $order = Mage::getModel('sales/order')->load($orderId);
356
+
357
+ /**
358
+ * Check order existing
359
+ */
360
+ if (!$order->getId()) {
361
+ $this->_getSession()->addError($this->__('The order no longer exists.'));
362
+ return false;
363
+ }
364
+ /**
365
+ * Check shipment is available to create separate from invoice
366
+ */
367
+ if ($order->getForcedDoShipmentWithInvoice()) {
368
+ $this->_getSession()->addError($this->__('Cannot do shipment for the order separately from invoice.'));
369
+ return false;
370
+ }
371
+ /**
372
+ * Check shipment create availability
373
+ */
374
+ /* if (!$order->canShip()) {
375
+ $this->_getSession()->addError($this->__('Cannot do shipment for the order.'));
376
+ return false;
377
+ } */
378
+ $savedQtys = $this->_getItemQtys();
379
+ $shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($savedQtys);
380
+
381
+ Mage::register('current_shipment', $shipment);
382
+ return $shipment;
383
+ }
384
+
385
+ public function createNewShipment($orderId) {
386
+ $_helper = Mage::helper('chronorelais');
387
+ $reservationNumber = '';
388
+ try {
389
+ if ($shipment = $this->initShipment($orderId)) {
390
+ $shipment->register();
391
+
392
+ $_order = $shipment->getOrder();
393
+ $_shippingMethod = explode("_", $_order->getShippingMethod());
394
+
395
+ $expeditionArray = $this->getExpeditionParams($shipment, $_shippingMethod);
396
+ $tracking_number = '';
397
+ if ($expeditionArray) {
398
+
399
+ $client = new SoapClient("http://wsshipping.chronopost.fr/shipping/services/services/ServiceEProcurement?wsdl", array('trace' => true));
400
+ try {
401
+ $expedition = $client->__call("reservationExpeditionV2", $expeditionArray);
402
+ if (!$expedition->errorCode && $expedition->skybillNumber) {
403
+ $tracking_number = $expedition->skybillNumber;
404
+ $track = Mage::getModel('sales/order_shipment_track')
405
+ ->setNumber($expedition->skybillNumber)
406
+ ->setCarrier(ucwords($_shippingMethod[0]))
407
+ ->setCarrierCode($_shippingMethod[0])
408
+ ->setTitle(ucwords($_shippingMethod[0]))
409
+ ->setChronoReservationNumber($expedition->reservationNumber)
410
+ ->setPopup(1);
411
+ $shipment->addTrack($track);
412
+ $reservationNumber = $expedition->reservationNumber;
413
+ } else {
414
+ $this->_getSession()->addError($_helper->__($expedition->errorMessage));
415
+ return;
416
+ }
417
+ } catch (SoapFault $fault) {
418
+ $this->_getSession()->addError($_helper->__($fault->faultstring));
419
+ return;
420
+ }
421
+ }
422
+
423
+ $tracking_url = str_replace('{tracking_number}', $tracking_number, Mage::helper('chronorelais')->getConfigurationTrackingViewUrl());
424
+ $tracking_title = $this->__('Track Your Order');
425
+ $tracking_order = '<p><a title="' . $tracking_title . '" href="' . $tracking_url . '"><b>' . $tracking_title . '</b></a></p>';
426
+
427
+ $comment = '';
428
+ $shipment->setEmailSent(true);
429
+ $this->_saveShipment($shipment);
430
+ $shipment->sendEmail(1, $tracking_order . $comment);
431
+ $this->_getSession()->addSuccess($this->__('Shipment was successfully created.'));
432
+ return $reservationNumber;
433
+ } else {
434
+ $this->_forward('noRoute');
435
+ return;
436
+ }
437
+ } catch (Mage_Core_Exception $e) {
438
+ $this->_getSession()->addError($e->getMessage());
439
+ return;
440
+ } catch (Exception $e) {
441
+ $this->_getSession()->addError($this->__('Can not save shipment: ' . $e->getMessage()));
442
+ return;
443
+ }
444
+ }
445
+
446
+ public function printMassAction() {
447
+ $shipmentsIds = $this->getRequest()->getPost('shipment_ids');
448
+ try {
449
+ $trackingNumber = $this->getEtiquetteUrl($shipmentsIds);
450
+ if ($trackingNumber) {
451
+ $tracking_url = str_replace('{trackingNumber}', $trackingNumber, Mage::helper('chronorelais')->getConfigurationTrackingUrl());
452
+ $this->_processDownload($tracking_url, 'url');
453
+ exit(0);
454
+ }
455
+ } catch (Mage_Core_Exception $e) {
456
+ $this->_getSession()->addError(Mage::helper('chronorelais')->__('Désolé, une erreure est survenu lors de la récupération de l\'étiquetes. Merci de contacter Chronopost ou de réessayer plus tard'));
457
+ }
458
+ return $this->_redirectReferer();
459
+ }
460
+
461
+ public function printAction() {
462
+ // Appel via order_id
463
+ $orderId = $this->getRequest()->getParam('order_id');
464
+ if ($orderId) {
465
+ if ($_shipments = $this->getShipmentByOrderId($orderId)) {
466
+ if (count($_shipments) == 1) {
467
+ $shipmentId = $_shipments[0];
468
+ $trackingNumber = $this->getEtiquetteUrl($shipmentId);
469
+ } else {
470
+ $track = "Cette commande contient plusieurs expéditions, cliquez sur chaque lien pour obtenir les étiquettes :<br>";
471
+ foreach ($_shipments as $_shipment) {
472
+ $url = str_replace('{trackingNumber}', $this->getEtiquetteUrl($_shipment), Mage::helper('chronorelais')->getConfigurationTrackingUrl());
473
+ $track .= '<a target="_blank" href="'.$url.'">'.$url.'</a><br />';
474
+ }
475
+ echo $track;
476
+ return;
477
+ }
478
+ } else {
479
+ $trackingNumber = $this->createNewShipment($orderId);
480
+ }
481
+ } else {
482
+ $shipmentId = $this->getRequest()->getParam('shipment_id');
483
+ if ($shipmentId) {
484
+ $trackingNumber = $this->getEtiquetteUrl($shipmentId);
485
+ } else {
486
+ $shipmentIncrementId = $this->getRequest()->getParam('shipment_increment_id');
487
+ $shipmentId = $this->getShipmentByIncrementId($shipmentIncrementId);
488
+ $trackingNumber = $this->getEtiquetteUrl($shipmentId[0]);
489
+ }
490
+ }
491
+
492
+
493
+ if ($trackingNumber) {
494
+ try {
495
+ $tracking_url = str_replace('{trackingNumber}', $trackingNumber, Mage::helper('chronorelais')->getConfigurationTrackingUrl());
496
+ $this->_processDownload($tracking_url, 'url');
497
+ exit(0);
498
+ } catch (Mage_Core_Exception $e) {
499
+ $this->_getSession()->addError(Mage::helper('chronorelais')->__('Désolé, une erreure est survenu lors de la récupération de l\'étiquetes. Merci de contacter Chronopost ou de réessayer plus tard'));
500
+ }
501
+ }
502
+ return $this->_redirectReferer();
503
+ }
504
+
505
+ public function massLivraisonSamediStatusAction() {
506
+ if ($this->getRequest()->getPost('status')) {
507
+ $this->saveLivraisonSamediStatusAction();
508
+ }
509
+ }
510
+
511
+ /* Save the Livraison le Samedi status to orders */
512
+
513
+ public function saveLivraisonSamediStatusAction() {
514
+ /* get the orders */
515
+ $orderIds = $this->getRequest()->getPost('order_ids');
516
+ $status = $this->getRequest()->getPost('status');
517
+ $_connection = Mage::getSingleton('core/resource')->getConnection('core_write');
518
+ $_table = Mage::getSingleton('core/resource')->getTableName('sales_chronopost_order_export_status');
519
+ $exceptions = array();
520
+
521
+ foreach ($orderIds as $orderId) {
522
+ $order_details = Mage::getModel('sales/order')->load($orderId);
523
+ $shipping_method = '';
524
+ $livraison_le_samedi = $status;
525
+ if ($shipping_method = $order_details->getShippingMethod()) {
526
+ $shipping_method = explode('_', $shipping_method);
527
+ if ($shipping_method[0] == 'chronoexpress') {
528
+ $livraison_le_samedi = '--';
529
+ }
530
+ }
531
+ $condition = array(
532
+ $_connection->quoteInto('order_id = ?', $orderId),
533
+ );
534
+ $_connection->delete($_table, $condition);
535
+
536
+ $dataLine = array(
537
+ 'order_id' => $orderId,
538
+ 'livraison_le_samedi' => $livraison_le_samedi
539
+ );
540
+ try {
541
+ $_connection->insert($_table, $dataLine);
542
+ } catch (Exception $e) {
543
+ $exceptions[] = Mage::helper('chronorelais')->__('Order assigning error: ' . $e->getMessage());
544
+ }
545
+ }
546
+ if ($exceptions) {
547
+ $this->_getSession()->addError($exceptions);
548
+ } else {
549
+ $this->_getSession()->addSuccess($this->__('Livraison le Samedi statut a &eacute;t&eacute; ajout&eacute;'));
550
+ }
551
+ $this->_redirect('*/*/index');
552
+ }
553
+
554
+ /* Remove accents characters */
555
+
556
+ public function removeaccents($string) {
557
+ $stringToReturn = str_replace(
558
+ 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);
559
+ // Remove all remaining other unknown characters
560
+ $stringToReturn = preg_replace('/[^a-zA-Z0-9\-]/', ' ', $stringToReturn);
561
+ $stringToReturn = preg_replace('/^[\-]+/', '', $stringToReturn);
562
+ $stringToReturn = preg_replace('/[\-]+$/', '', $stringToReturn);
563
+ $stringToReturn = preg_replace('/[\-]{2,}/', ' ', $stringToReturn);
564
+ return $stringToReturn;
565
+ }
566
+
567
  }
app/code/community/Chronopost/Chronorelais/controllers/Sales/Order/ShipmentController.php CHANGED
@@ -1,268 +1,274 @@
1
- <?php
2
- require_once 'Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php';
3
- class Chronopost_Chronorelais_Sales_Order_ShipmentController extends Mage_Adminhtml_Sales_Order_ShipmentController
4
- {
5
-
6
- /**
7
- * Save shipment
8
- * We can save only new shipment. Existing shipments are not editable
9
- */
10
-
11
- public function getFilledValue($value)
12
- {
13
- if($value) {
14
- return $this->removeaccents(trim($value));
15
- } else {
16
- return '';
17
- }
18
- }
19
-
20
- public function checkMobileNumber($value)
21
- {
22
- if($reqvalue = trim($value)) {
23
- $_number = substr($reqvalue, 0, 2);
24
- $fixed_array = array('01','02','03','04','05','06','06');
25
- if(in_array($_number, $fixed_array)) {
26
- return $reqvalue;
27
- } else {
28
- return '';
29
- }
30
- }
31
- }
32
-
33
- public function saveAction()
34
- {
35
- $data = $this->getRequest()->getPost('shipment');
36
-
37
- try {
38
- if ($shipment = $this->_initShipment()) {
39
- $shipment->register();
40
-
41
- //Si l'expedition est réalisé par Mondial Relay, on créé le tracking automatiquement.
42
-
43
- $_order = $shipment->getOrder();
44
- $_shippingMethod = explode("_",$_order->getShippingMethod());
45
-
46
- $_shippingAddress = $_order->getShippingAddress();
47
- $_billingAddress = $_order->getBillingAddress();
48
- $_helper = Mage::helper('chronorelais');
49
-
50
- if ($_shippingMethod[0] == 'chronorelais' || $_shippingMethod[0] == 'chronopost' || $_shippingMethod[0] == 'chronoexpress') {
51
-
52
- $esdParams = $header = $shipper = $customer = $recipient = $ref = $skybill = $skybillParams = $password = array();
53
-
54
- //esdParams parameters
55
- $esdParams = array(
56
- 'height' => '',
57
- 'width' => '',
58
- 'length' => ''
59
- );
60
-
61
- //header parameters
62
- $header = array(
63
- 'idEmit' => 'CHRFR',
64
- 'accountNumber' => $_helper->getConfigurationAccountNumber(),
65
- 'subAccount' => $_helper->getConfigurationSubAccountNumber()
66
- );
67
-
68
- //shipper parameters
69
- $shipperMobilePhone = $this->checkMobileNumber($_helper->getConfigurationShipperInfo('mobilephone'));
70
- $shipper = array(
71
- 'shipperAdress1' => $_helper->getConfigurationShipperInfo('address1'),
72
- 'shipperAdress2' => $_helper->getConfigurationShipperInfo('address2'),
73
- 'shipperCity' => $_helper->getConfigurationShipperInfo('city'),
74
- 'shipperCivility' => $_helper->getConfigurationShipperInfo('civility'),
75
- 'shipperContactName'=> $_helper->getConfigurationShipperInfo('contactname'),
76
- 'shipperCountry' => $_helper->getConfigurationShipperInfo('country'),
77
- 'shipperEmail' => $_helper->getConfigurationShipperInfo('email'),
78
- 'shipperMobilePhone'=> $shipperMobilePhone,
79
- 'shipperName' => $_helper->getConfigurationShipperInfo('name'),
80
- 'shipperName2' => $_helper->getConfigurationShipperInfo('name2'),
81
- 'shipperPhone' => $_helper->getConfigurationShipperInfo('phone'),
82
- 'shipperPreAlert' => '',
83
- 'shipperZipCode' => $_helper->getConfigurationShipperInfo('zipcode')
84
- );
85
-
86
- //customer parameters
87
- $customerMobilePhone = $this->checkMobileNumber($_helper->getConfigurationCustomerInfo('mobilephone'));
88
- $customer = array(
89
- 'customerAdress1' => $_helper->getConfigurationCustomerInfo('address1'),
90
- 'customerAdress2' => $_helper->getConfigurationCustomerInfo('address2'),
91
- 'customerCity' => $_helper->getConfigurationCustomerInfo('city'),
92
- 'customerCivility' => $_helper->getConfigurationCustomerInfo('civility'),
93
- 'customerContactName'=> $_helper->getConfigurationCustomerInfo('contactname'),
94
- 'customerCountry' => $_helper->getConfigurationCustomerInfo('country'),
95
- 'customerEmail' => $_helper->getConfigurationCustomerInfo('email'),
96
- 'customerMobilePhone'=> $customerMobilePhone,
97
- 'customerName' => $_helper->getConfigurationCustomerInfo('name'),
98
- 'customerName2' => $_helper->getConfigurationCustomerInfo('name2'),
99
- 'customerPhone' => $_helper->getConfigurationCustomerInfo('phone'),
100
- 'customerPreAlert' => '',
101
- 'customerZipCode' => $_helper->getConfigurationCustomerInfo('zipcode')
102
- );
103
-
104
- //recipient parameters
105
- $recipient_address = $_shippingAddress->getStreet();
106
- if (!isset($recipient_address[1])) {
107
- $recipient_address[1] = '';
108
- }
109
- $customer_email = ($_shippingAddress->getEmail()) ? $_shippingAddress->getEmail() : ($_billingAddress->getEmail() ? $_billingAddress->getEmail() : $_order->getCustomerEmail());
110
- $recipientMobilePhone = $this->checkMobileNumber($_shippingAddress->getTelephone());
111
- $recipientName = $this->getFilledValue($_shippingAddress->getCompany()); //RelayPoint Name if chronorelais or Companyname if chronopost and
112
- $recipientName2 = $this->getFilledValue($_shippingAddress->getFirstname() . ' ' . $_shippingAddress->getLastname());
113
- //remove any alphabets in phone number
114
- $recipientPhone = trim(ereg_replace("[^0-9.-]", " ", $_shippingAddress->getTelephone()));
115
-
116
- $recipient = array(
117
- 'recipientAdress1' => $this->getFilledValue($recipient_address[0]),
118
- 'recipientAdress2' => $this->getFilledValue($recipient_address[1]),
119
- 'recipientCity' => $this->getFilledValue($_shippingAddress->getCity()),
120
- 'recipientContactName' => $recipientName2,
121
- 'recipientCountry' => $this->getFilledValue($_shippingAddress->getCountryId()),
122
- 'recipientEmail' => $customer_email,
123
- 'recipientMobilePhone' => $recipientMobilePhone,
124
- 'recipientName' => $recipientName,
125
- 'recipientName2' => $recipientName2,
126
- 'recipientPhone' => $recipientPhone,
127
- 'recipientPreAlert' => '',
128
- 'recipientZipCode' => $this->getFilledValue($_shippingAddress->getPostcode()),
129
- );
130
-
131
- //ref parameters
132
- $recipientRef = $this->getFilledValue($_shippingAddress->getWRelayPointCode());
133
- if(!$recipientRef) {
134
- $recipientRef = $_order->getCustomerId();
135
- }
136
- $shipperRef = $_order->getRealOrderId();
137
-
138
- $ref = array(
139
- 'recipientRef' => $recipientRef,
140
- 'shipperRef' => $shipperRef
141
- );
142
-
143
- //skybill parameters
144
- /* Livraison Samedi (Delivery Saturday) field*/
145
- $SaturdayShipping = 0; //default value for the saturday shipping
146
- $send_day = strtolower(date('l'));
147
- if($_shippingMethod[0] == "chronopost" || $_shippingMethod[0] == "chronorelais") {
148
- if(!$_deliver_on_saturday = Mage::helper('chronorelais')->getLivraisonSamediStatus($_order->getEntityId())) {
149
- $_deliver_on_saturday = Mage::helper('chronorelais')->getConfigData('carriers/'.$_shippingMethod[0].'/deliver_on_saturday');
150
- } else {
151
- if($_deliver_on_saturday=='Yes') {
152
- $_deliver_on_saturday = 1;
153
- } else {
154
- $_deliver_on_saturday = 0;
155
- }
156
- }
157
- $is_sending_day = Mage::helper('chronorelais')->isSendingDay();
158
- if($_deliver_on_saturday && $is_sending_day) {
159
- $SaturdayShipping = 1;
160
- } elseif(!$_deliver_on_saturday && $is_sending_day) {
161
- $SaturdayShipping = 6;
162
- }
163
- }
164
- $skybill = array(
165
- 'codCurrency' => 'EUR',
166
- 'codValue' => '',
167
- 'content1' => '',
168
- 'content2' => '',
169
- 'content3' => '',
170
- 'content4' => '',
171
- 'content5' => '',
172
- 'customsCurrency' => 'EUR',
173
- 'customsValue' => '',
174
- 'evtCode' => 'DC',
175
- 'insuredCurrency' => 'EUR',
176
- 'insuredValue' => '',
177
- 'objectType' => 'MAR',
178
- 'productCode' => $_helper->getChronoProductCode($_shippingAddress->getCountryId(),$_shippingMethod[0]),
179
- 'service' => $SaturdayShipping,
180
- 'shipDate' => date('c'),
181
- 'shipHour' => date('H'),
182
- 'weight' => $_order->getWeight(),
183
- 'weightUnit' => 'KGM'
184
- );
185
-
186
- $expeditionArray = array(
187
- 'esdParams' => $esdParams,
188
- 'header' => $header,
189
- 'shipper' => $shipper,
190
- 'customer' => $customer,
191
- 'recipient' => $recipient,
192
- 'ref' => $ref,
193
- 'skybill' => $skybill,
194
- 'skybillParams' => $_helper->getConfigurationSkybillParam(),
195
- 'password' => $_helper->getConfigurationAccountPass(),
196
- 'option' => '0'
197
- );
198
-
199
- $client = new SoapClient("http://wsshipping.chronopost.fr/shipping/services/services/ServiceEProcurement?wsdl", array('trace' => true));
200
- try
201
- {
202
- $expedition = $client->__call("reservationExpeditionV2",$expeditionArray);
203
- if(!$expedition->errorCode && $expedition->skybillNumber) {
204
- $track = Mage::getModel('sales/order_shipment_track')
205
- ->setNumber($expedition->skybillNumber)
206
- ->setCarrier(ucwords($_shippingMethod[0]))
207
- ->setCarrierCode($_shippingMethod[0])
208
- ->setTitle(ucwords($_shippingMethod[0]))
209
- ->setChronoReservationNumber($expedition->reservationNumber)
210
- ->setPopup(1);
211
- $shipment->addTrack($track);
212
- } else {
213
- $this->_getSession()->addError($_helper->__($expedition->errorMessage));
214
- $this->_redirect('*/*/new', array('order_id' => $this->getRequest()->getParam('order_id')));
215
- return;
216
- }
217
- }
218
- catch(SoapFault $fault)
219
- {
220
- $this->_getSession()->addError($_helper->__($fault->faultstring));
221
- $this->_redirect('*/*/new', array('order_id' => $this->getRequest()->getParam('order_id')));
222
- return;
223
- }
224
- }
225
-
226
- $comment = '';
227
- if (!empty($data['comment_text'])) {
228
- $shipment->addComment($data['comment_text'], isset($data['comment_customer_notify']));
229
- $comment = $data['comment_text'];
230
- }
231
-
232
- if (!empty($data['send_email'])) {
233
- $shipment->setEmailSent(true);
234
- }
235
-
236
- $this->_saveShipment($shipment);
237
- $shipment->sendEmail(!empty($data['send_email']), $comment);
238
- $this->_getSession()->addSuccess($this->__('Shipment was successfully created.'));
239
- $this->_redirect('adminhtml/sales_order/view', array('order_id' => $shipment->getOrderId()));
240
- return;
241
-
242
- }else {
243
- $this->_forward('noRoute');
244
- return;
245
- }
246
- }
247
- catch (Mage_Core_Exception $e) {
248
- $this->_getSession()->addError($e->getMessage());
249
- }
250
- catch (Exception $e) {
251
- $this->_getSession()->addError($this->__('Can not save shipment: '.$e->getMessage()));
252
- }
253
- $this->_redirect('*/*/new', array('order_id' => $this->getRequest()->getParam('order_id')));
254
- }
255
-
256
- public function removeaccents($string){
257
- $stringToReturn = str_replace(
258
- array('�','�','�','�','�', '�', '�','�','�','�', '�','�','�','�', '�', '�','�','�','�','�', '�','�','�','�', '�','�', '�','�','�','�','�', '�', '�','�','�','�', '�','�','�','�', '�', '�','�','�','�','�', '�','�','�','�', '�','/','\xa8'),
259
- 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);
260
- // Remove all remaining other unknown characters
261
- $stringToReturn = preg_replace('/[^a-zA-Z0-9\-]/', ' ', $stringToReturn);
262
- $stringToReturn = preg_replace('/^[\-]+/', '', $stringToReturn);
263
- $stringToReturn = preg_replace('/[\-]+$/', '', $stringToReturn);
264
- $stringToReturn = preg_replace('/[\-]{2,}/', ' ', $stringToReturn);
265
- return $stringToReturn;
266
- }
267
-
268
- }
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php';
3
+ class Chronopost_Chronorelais_Sales_Order_ShipmentController extends Mage_Adminhtml_Sales_Order_ShipmentController
4
+ {
5
+
6
+ /**
7
+ * Save shipment
8
+ * We can save only new shipment. Existing shipments are not editable
9
+ */
10
+
11
+ public function getFilledValue($value)
12
+ {
13
+ if($value) {
14
+ return $this->removeaccents(trim($value));
15
+ } else {
16
+ return '';
17
+ }
18
+ }
19
+
20
+ public function checkMobileNumber($value)
21
+ {
22
+ if($reqvalue = trim($value)) {
23
+ $_number = substr($reqvalue, 0, 2);
24
+ $fixed_array = array('01','02','03','04','05','06','06');
25
+ if(in_array($_number, $fixed_array)) {
26
+ return $reqvalue;
27
+ } else {
28
+ return '';
29
+ }
30
+ }
31
+ }
32
+
33
+ public function saveAction()
34
+ {
35
+ $data = $this->getRequest()->getPost('shipment');
36
+
37
+ try {
38
+ if ($shipment = $this->_initShipment()) {
39
+ $shipment->register();
40
+
41
+ //Si l'expedition est réalisé par Mondial Relay, on créé le tracking automatiquement.
42
+
43
+ $_order = $shipment->getOrder();
44
+ $_shippingMethod = explode("_",$_order->getShippingMethod());
45
+
46
+ $_shippingAddress = $shipment->getShippingAddress();
47
+ $_billingAddress = $shipment->getBillingAddress();
48
+ $_helper = Mage::helper('chronorelais');
49
+
50
+ if ($_shippingMethod[0] == 'chronorelais' || $_shippingMethod[0] == 'chronopost' || $_shippingMethod[0] == 'chronoexpress') {
51
+
52
+ $esdParams = $header = $shipper = $customer = $recipient = $ref = $skybill = $skybillParams = $password = array();
53
+
54
+ //esdParams parameters
55
+ $esdParams = array(
56
+ 'height' => '',
57
+ 'width' => '',
58
+ 'length' => ''
59
+ );
60
+
61
+ //header parameters
62
+ $header = array(
63
+ 'idEmit' => 'CHRFR',
64
+ 'accountNumber' => $_helper->getConfigurationAccountNumber(),
65
+ 'subAccount' => $_helper->getConfigurationSubAccountNumber()
66
+ );
67
+
68
+ //shipper parameters
69
+ $shipperMobilePhone = $this->checkMobileNumber($_helper->getConfigurationShipperInfo('mobilephone'));
70
+ $shipper = array(
71
+ 'shipperAdress1' => $_helper->getConfigurationShipperInfo('address1'),
72
+ 'shipperAdress2' => $_helper->getConfigurationShipperInfo('address2'),
73
+ 'shipperCity' => $_helper->getConfigurationShipperInfo('city'),
74
+ 'shipperCivility' => $_helper->getConfigurationShipperInfo('civility'),
75
+ 'shipperContactName'=> $_helper->getConfigurationShipperInfo('contactname'),
76
+ 'shipperCountry' => $_helper->getConfigurationShipperInfo('country'),
77
+ 'shipperEmail' => $_helper->getConfigurationShipperInfo('email'),
78
+ 'shipperMobilePhone'=> $shipperMobilePhone,
79
+ 'shipperName' => $_helper->getConfigurationShipperInfo('name'),
80
+ 'shipperName2' => $_helper->getConfigurationShipperInfo('name2'),
81
+ 'shipperPhone' => $_helper->getConfigurationShipperInfo('phone'),
82
+ 'shipperPreAlert' => '',
83
+ 'shipperZipCode' => $_helper->getConfigurationShipperInfo('zipcode')
84
+ );
85
+
86
+ //customer parameters
87
+ $customerMobilePhone = $this->checkMobileNumber($_helper->getConfigurationCustomerInfo('mobilephone'));
88
+ $customer = array(
89
+ 'customerAdress1' => $_helper->getConfigurationCustomerInfo('address1'),
90
+ 'customerAdress2' => $_helper->getConfigurationCustomerInfo('address2'),
91
+ 'customerCity' => $_helper->getConfigurationCustomerInfo('city'),
92
+ 'customerCivility' => $_helper->getConfigurationCustomerInfo('civility'),
93
+ 'customerContactName'=> $_helper->getConfigurationCustomerInfo('contactname'),
94
+ 'customerCountry' => $_helper->getConfigurationCustomerInfo('country'),
95
+ 'customerEmail' => $_helper->getConfigurationCustomerInfo('email'),
96
+ 'customerMobilePhone'=> $customerMobilePhone,
97
+ 'customerName' => $_helper->getConfigurationCustomerInfo('name'),
98
+ 'customerName2' => $_helper->getConfigurationCustomerInfo('name2'),
99
+ 'customerPhone' => $_helper->getConfigurationCustomerInfo('phone'),
100
+ 'customerPreAlert' => '',
101
+ 'customerZipCode' => $_helper->getConfigurationCustomerInfo('zipcode')
102
+ );
103
+
104
+ //recipient parameters
105
+ $recipient_address = $_shippingAddress->getStreet();
106
+ if (!isset($recipient_address[1])) {
107
+ $recipient_address[1] = '';
108
+ }
109
+ $customer_email = ($_shippingAddress->getEmail()) ? $_shippingAddress->getEmail() : ($_billingAddress->getEmail() ? $_billingAddress->getEmail() : $_order->getCustomerEmail());
110
+ $recipientMobilePhone = $this->checkMobileNumber($_shippingAddress->getTelephone());
111
+ $recipientName = $this->getFilledValue($_shippingAddress->getCompany()); //RelayPoint Name if chronorelais or Companyname if chronopost and
112
+ $recipientName2 = $this->getFilledValue($_shippingAddress->getFirstname() . ' ' . $_shippingAddress->getLastname());
113
+ //remove any alphabets in phone number
114
+ $recipientPhone = trim(ereg_replace("[^0-9.-]", " ", $_shippingAddress->getTelephone()));
115
+
116
+ $recipient = array(
117
+ 'recipientAdress1' => $this->getFilledValue($recipient_address[0]),
118
+ 'recipientAdress2' => $this->getFilledValue($recipient_address[1]),
119
+ 'recipientCity' => $this->getFilledValue($_shippingAddress->getCity()),
120
+ 'recipientContactName' => $recipientName2,
121
+ 'recipientCountry' => $this->getFilledValue($_shippingAddress->getCountryId()),
122
+ 'recipientEmail' => $customer_email,
123
+ 'recipientMobilePhone' => $recipientMobilePhone,
124
+ 'recipientName' => $recipientName,
125
+ 'recipientName2' => $recipientName2,
126
+ 'recipientPhone' => $recipientPhone,
127
+ 'recipientPreAlert' => '',
128
+ 'recipientZipCode' => $this->getFilledValue($_shippingAddress->getPostcode()),
129
+ );
130
+
131
+ //ref parameters
132
+ $recipientRef = $this->getFilledValue($_shippingAddress->getWRelayPointCode());
133
+ if(!$recipientRef) {
134
+ $recipientRef = $_order->getCustomerId();
135
+ }
136
+ $shipperRef = $_order->getRealOrderId();
137
+
138
+ $ref = array(
139
+ 'recipientRef' => $recipientRef,
140
+ 'shipperRef' => $shipperRef
141
+ );
142
+
143
+ //skybill parameters
144
+ /* Livraison Samedi (Delivery Saturday) field*/
145
+ $SaturdayShipping = 0; //default value for the saturday shipping
146
+ $send_day = strtolower(date('l'));
147
+ if($_shippingMethod[0] == "chronopost" || $_shippingMethod[0] == "chronorelais") {
148
+ if(!$_deliver_on_saturday = Mage::helper('chronorelais')->getLivraisonSamediStatus($_order->getEntityId())) {
149
+ $_deliver_on_saturday = Mage::helper('chronorelais')->getConfigData('carriers/'.$_shippingMethod[0].'/deliver_on_saturday');
150
+ } else {
151
+ if($_deliver_on_saturday=='Yes') {
152
+ $_deliver_on_saturday = 1;
153
+ } else {
154
+ $_deliver_on_saturday = 0;
155
+ }
156
+ }
157
+ $is_sending_day = Mage::helper('chronorelais')->isSendingDay();
158
+ if($_deliver_on_saturday && $is_sending_day) {
159
+ $SaturdayShipping = 1;
160
+ } elseif(!$_deliver_on_saturday && $is_sending_day) {
161
+ $SaturdayShipping = 6;
162
+ }
163
+ }
164
+
165
+ $weight = 0;
166
+ foreach ($shipment->getItemsCollection() as $item) {
167
+ $weight += $item->weight * $item->qty;
168
+ }
169
+
170
+ $skybill = array(
171
+ 'codCurrency' => 'EUR',
172
+ 'codValue' => '',
173
+ 'content1' => '',
174
+ 'content2' => '',
175
+ 'content3' => '',
176
+ 'content4' => '',
177
+ 'content5' => '',
178
+ 'customsCurrency' => 'EUR',
179
+ 'customsValue' => '',
180
+ 'evtCode' => 'DC',
181
+ 'insuredCurrency' => 'EUR',
182
+ 'insuredValue' => '',
183
+ 'objectType' => 'MAR',
184
+ 'productCode' => $_helper->getChronoProductCode($_shippingAddress->getCountryId(),$_shippingMethod[0]),
185
+ 'service' => $SaturdayShipping,
186
+ 'shipDate' => date('c'),
187
+ 'shipHour' => date('H'),
188
+ 'weight' => $weight,
189
+ 'weightUnit' => 'KGM'
190
+ );
191
+
192
+ $expeditionArray = array(
193
+ 'esdParams' => $esdParams,
194
+ 'header' => $header,
195
+ 'shipper' => $shipper,
196
+ 'customer' => $customer,
197
+ 'recipient' => $recipient,
198
+ 'ref' => $ref,
199
+ 'skybill' => $skybill,
200
+ 'skybillParams' => $_helper->getConfigurationSkybillParam(),
201
+ 'password' => $_helper->getConfigurationAccountPass(),
202
+ 'option' => '0'
203
+ );
204
+
205
+ $client = new SoapClient("http://wsshipping.chronopost.fr/shipping/services/services/ServiceEProcurement?wsdl", array('trace' => true));
206
+ try
207
+ {
208
+ $expedition = $client->__call("reservationExpeditionV2",$expeditionArray);
209
+ if(!$expedition->errorCode && $expedition->skybillNumber) {
210
+ $track = Mage::getModel('sales/order_shipment_track')
211
+ ->setNumber($expedition->skybillNumber)
212
+ ->setCarrier(ucwords($_shippingMethod[0]))
213
+ ->setCarrierCode($_shippingMethod[0])
214
+ ->setTitle(ucwords($_shippingMethod[0]))
215
+ ->setChronoReservationNumber($expedition->reservationNumber)
216
+ ->setPopup(1);
217
+ $shipment->addTrack($track);
218
+ } else {
219
+ $this->_getSession()->addError($_helper->__($expedition->errorMessage));
220
+ $this->_redirect('*/*/new', array('order_id' => $this->getRequest()->getParam('order_id')));
221
+ return;
222
+ }
223
+ }
224
+ catch(SoapFault $fault)
225
+ {
226
+ $this->_getSession()->addError($_helper->__($fault->faultstring));
227
+ $this->_redirect('*/*/new', array('order_id' => $this->getRequest()->getParam('order_id')));
228
+ return;
229
+ }
230
+ }
231
+
232
+ $comment = '';
233
+ if (!empty($data['comment_text'])) {
234
+ $shipment->addComment($data['comment_text'], isset($data['comment_customer_notify']));
235
+ $comment = $data['comment_text'];
236
+ }
237
+
238
+ if (!empty($data['send_email'])) {
239
+ $shipment->setEmailSent(true);
240
+ }
241
+
242
+ $this->_saveShipment($shipment);
243
+ $shipment->sendEmail(!empty($data['send_email']), $comment);
244
+ $this->_getSession()->addSuccess($this->__('Shipment was successfully created.'));
245
+ $this->_redirect('adminhtml/sales_order/view', array('order_id' => $shipment->getOrderId()));
246
+ return;
247
+
248
+ }else {
249
+ $this->_forward('noRoute');
250
+ return;
251
+ }
252
+ }
253
+ catch (Mage_Core_Exception $e) {
254
+ $this->_getSession()->addError($e->getMessage());
255
+ }
256
+ catch (Exception $e) {
257
+ $this->_getSession()->addError($this->__('Can not save shipment: '.$e->getMessage()));
258
+ }
259
+ $this->_redirect('*/*/new', array('order_id' => $this->getRequest()->getParam('order_id')));
260
+ }
261
+
262
+ public function removeaccents($string){
263
+ $stringToReturn = str_replace(
264
+ array('�','�','�','�','�', '�', '�','�','�','�', '�','�','�','�', '�', '�','�','�','�','�', '�','�','�','�', '�','�', '�','�','�','�','�', '�', '�','�','�','�', '�','�','�','�', '�', '�','�','�','�','�', '�','�','�','�', '�','/','\xa8'),
265
+ 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);
266
+ // Remove all remaining other unknown characters
267
+ $stringToReturn = preg_replace('/[^a-zA-Z0-9\-]/', ' ', $stringToReturn);
268
+ $stringToReturn = preg_replace('/^[\-]+/', '', $stringToReturn);
269
+ $stringToReturn = preg_replace('/[\-]+$/', '', $stringToReturn);
270
+ $stringToReturn = preg_replace('/[\-]{2,}/', ' ', $stringToReturn);
271
+ return $stringToReturn;
272
+ }
273
+
274
+ }
app/code/community/Chronopost/Chronorelais/etc/config.xml CHANGED
@@ -1,340 +1,345 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Chronopost_Chronorelais>
5
- <version>0.1.7.1</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
- <sales>
20
- <rewrite>
21
- <quote_address_total_shipping>Chronopost_Chronorelais_Model_Sales_Quote_Address_Total_Shipping</quote_address_total_shipping>
22
- </rewrite>
23
- </sales>
24
- </models>
25
- <blocks>
26
- <chronorelais>
27
- <class>Chronopost_Chronorelais_Block</class>
28
- </chronorelais>
29
- <adminhtml>
30
- <rewrite>
31
- <sales_order_shipment_view>Chronopost_Chronorelais_Block_Sales_Order_Shipment_View</sales_order_shipment_view>
32
- </rewrite>
33
- </adminhtml>
34
- </blocks>
35
- <helpers>
36
- <chronorelais>
37
- <class>Chronopost_Chronorelais_Helper</class>
38
- </chronorelais>
39
- </helpers>
40
-
41
- <resources>
42
- <sales>
43
- <shipping>
44
- <carriers>
45
- <chronorelais>
46
- <class>Chronopost_Chronorelais_Model_Carrier_Chronorelais</class>
47
- </chronorelais>
48
- <chronopost>
49
- <class>Chronopost_Chronorelais_Model_Carrier_Chronopost</class>
50
- </chronopost>
51
- <chronoexpress>
52
- <class>Chronopost_Chronorelais_Model_Carrier_Chronoexpress</class>
53
- </chronoexpress>
54
- </carriers>
55
- </shipping>
56
- </sales>
57
- <chronorelais_setup>
58
- <setup>
59
- <module>Chronopost_Chronorelais</module>
60
- <class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
61
- </setup>
62
- <connection>
63
- <use>core_setup</use>
64
- </connection>
65
- </chronorelais_setup>
66
- <chronorelais_write>
67
- <connection>
68
- <use>core_write</use>
69
- </connection>
70
- </chronorelais_write>
71
-
72
- <chronorelais_read>
73
- <connection>
74
- <use>core_read</use>
75
- </connection>
76
- </chronorelais_read>
77
- </resources>
78
-
79
- <rewrite>
80
- <chronopost_chronorelais_checkout_onepage>
81
- <from><![CDATA[#^/checkout/onepage/#]]></from>
82
- <to>/chronorelais/checkout_onepage/</to>
83
- </chronopost_chronorelais_checkout_onepage>
84
- <chronopost_chronorelais_sales_order_shipment>
85
- <from><![CDATA[#^/.*sales_order_shipment/save/#]]></from>
86
- <to>/chronorelais/sales_order_shipment/save/</to>
87
- </chronopost_chronorelais_sales_order_shipment>
88
- </rewrite>
89
-
90
- <fieldsets>
91
- <sales_copy_order_billing_address>
92
- <w_relay_point_code><to_order>*</to_order></w_relay_point_code>
93
- </sales_copy_order_billing_address>
94
- <sales_copy_order_shipping_address>
95
- <w_relay_point_code><to_order>*</to_order></w_relay_point_code>
96
- </sales_copy_order_shipping_address>
97
- <sales_convert_quote_address>
98
- <w_relay_point_code><to_order_address>*</to_order_address><to_customer_address>*</to_customer_address></w_relay_point_code>
99
- </sales_convert_quote_address>
100
- <sales_convert_order_address>
101
- <w_relay_point_code><to_quote_address>*</to_quote_address></w_relay_point_code>
102
- </sales_convert_order_address>
103
- <customer_address>
104
- <w_relay_point_code><to_quote_address>*</to_quote_address></w_relay_point_code>
105
- </customer_address>
106
- </fieldsets>
107
-
108
- </global>
109
-
110
- <frontend>
111
- <routers>
112
- <chronorelais>
113
- <use>standard</use>
114
- <args>
115
- <module>Chronopost_Chronorelais</module>
116
- <frontName>chronorelais</frontName>
117
- </args>
118
- </chronorelais>
119
- </routers>
120
-
121
- <layout>
122
- <updates>
123
- <chronorelais>
124
- <file>chronorelais.xml</file>
125
- </chronorelais>
126
- </updates>
127
- </layout>
128
- <translate>
129
- <modules>
130
- <Chronopost_Chronorelais>
131
- <files>
132
- <default>Chronopost_Chronorelais.csv</default>
133
- </files>
134
- </Chronopost_Chronorelais>
135
- </modules>
136
- </translate>
137
- </frontend>
138
-
139
- <admin>
140
- <routers>
141
- <chronorelais>
142
- <use>admin</use>
143
- <args>
144
- <module>Chronopost_Chronorelais</module>
145
- <frontName>chronorelais</frontName>
146
- </args>
147
- </chronorelais>
148
- </routers>
149
- </admin>
150
-
151
- <adminhtml>
152
- <menu>
153
- <sales>
154
- <children>
155
- <chronorelais translate="title"> <!-- TODO faire marcher : module="chronorelais" (aussi dans les children) -->
156
- <title>Chronopost</title>
157
- <sort_order>15</sort_order>
158
- <children>
159
- <export translate="title">
160
- <title>Export</title>
161
- <action>chronorelais/export</action>
162
- <sort_order>10</sort_order>
163
- </export>
164
- <import translate="title">
165
- <title>Import</title>
166
- <action>chronorelais/import</action>
167
- <sort_order>20</sort_order>
168
- </import>
169
- <impression translate="title" module="sales">
170
- <title>Impression des étiquettes</title>
171
- <action>chronorelais/sales_impression</action>
172
- <sort_order>30</sort_order>
173
- </impression>
174
- </children>
175
- </chronorelais>
176
- </children>
177
- </sales>
178
- </menu>
179
- <acl>
180
- <resources>
181
- <admin>
182
- <children>
183
- <sales>
184
- <children>
185
- <chronorelais translate="title">
186
- <title>Chronopost</title>
187
- <sort_order>15</sort_order>
188
- <children>
189
- <export translate="title">
190
- <title>Export</title>
191
- <sort_order>10</sort_order>
192
- </export>
193
- <import translate="title">
194
- <title>Import</title>
195
- <sort_order>20</sort_order>
196
- </import>
197
- <impression translate="title" module="sales">
198
- <title>Impression des étiquettes</title>
199
- <sort_order>30</sort_order>
200
- </impression>
201
- </children>
202
- </chronorelais>
203
- </children>
204
- </sales>
205
- <system>
206
- <children>
207
- <config>
208
- <children>
209
- <chronorelais translate="title" module="chronorelais">
210
- <title>Chronopost</title>
211
- <sort_order>100</sort_order>
212
- </chronorelais>
213
- </children>
214
- </config>
215
- </children>
216
- </system>
217
- </children>
218
- </admin>
219
- </resources>
220
- </acl>
221
-
222
- <translate>
223
- <modules>
224
- <Chronopost_Chronorelais>
225
- <files>
226
- <default>Chronopost_Chronorelais.csv</default>
227
- </files>
228
- </Chronopost_Chronorelais>
229
- </modules>
230
- </translate>
231
- </adminhtml>
232
-
233
- <default>
234
- <chronorelais>
235
- <shipping>
236
- <google_map_api>ABQIAAAAZvdukOwsytNocL5anZKqZxS51Nc8ngbKeRYi0kVLSLeRaqOKHRSLs6O150txpwWCDcct2mH4X-G6OA</google_map_api>
237
- <tracking_view_url><![CDATA[http://suivi.chronopost.fr/servletSuivi?langue=fr_FR&noLTList={tracking_number}]]></tracking_view_url>
238
- </shipping>
239
- <export_css>
240
- <file_extension>.chr</file_extension>
241
- <file_charset>ASCII-7</file_charset>
242
- <endofline_character>crlf</endofline_character>
243
- <field_delimiter>none</field_delimiter>
244
- <field_separator>;</field_separator>
245
- </export_css>
246
- <export_cso>
247
- <file_extension>.txt</file_extension>
248
- <file_charset>ISO-8859-1</file_charset>
249
- <endofline_character>crlf</endofline_character>
250
- <field_delimiter>none</field_delimiter>
251
- <field_separator>;</field_separator>
252
- </export_cso>
253
- <import>
254
- <default_tracking_title>Chronopost - Chronopost livraison express à domicile</default_tracking_title>
255
- <send_email>1</send_email>
256
- <shipping_comment></shipping_comment>
257
- <include_comment>0</include_comment>
258
- </import>
259
- </chronorelais>
260
- <carriers>
261
- <chronopost>
262
- <active>0</active>
263
- <title>Chronopost</title>
264
- <model>Chronopost_Chronorelais_Model_Carrier_Chronopost</model>
265
- <tracking_view_url></tracking_view_url>
266
- <config>
267
- # Chronopost
268
- {
269
- label: "Chronopost livraison express à domicile",
270
- code: "chronopost",
271
- description: "Colis livré le lendemain avant 13h, à l’adresse de votre choix.
272
- Délai à compter de la prise en charge du colis par Chronopost, pour une livraison en France métropolitaine.
273
- En cas d’absence, le colis est mis en instance dans le bureau de Poste le plus proche.",
274
- tracking_url: "http://www.fr.chronopost.com/fr/tracking/result?listeNumeros={tracking_number}",
275
- destination: "FR,MC",
276
- 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}",
277
- }
278
- </config>
279
- <weight_limit>30</weight_limit>
280
- <quickcost_url>http://wsshipping.chronopost.fr/wsQuickcost/services/ServiceQuickCost?wsdl</quickcost_url>
281
- <logo_url>chronopost.png</logo_url>
282
- <debug>0</debug>
283
- <stop_to_first_match>0</stop_to_first_match>
284
- <!--<specificerrmsg>This shipping method is currently unavailable.</specificerrmsg>-->
285
- <sort_order>1</sort_order>
286
- </chronopost>
287
- <chronoexpress>
288
- <active>0</active>
289
- <title>Chronopost</title>
290
- <model>Chronopost_Chronorelais_Model_Carrier_Chronoexpress</model>
291
- <tracking_view_url></tracking_view_url>
292
- <config>
293
- # Chronoexpress
294
- {
295
- label: "Chronopost livraison express partout dans le monde",
296
- code: "chronoexpress",
297
- description: "L'Europe livrée en 1 à 3 jours et le reste du monde en 2 à 5 jours.
298
- Délai à compter de la prise en charge du colis par Chronopost.",
299
- tracking_url: "http://www.fr.chronopost.com/fr/tracking/result?listeNumeros={tracking_number}",
300
- 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",
301
- 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}",
302
- }
303
- </config>
304
- <weight_limit>30</weight_limit>
305
- <quickcost_url>http://wsshipping.chronopost.fr/wsQuickcost/services/ServiceQuickCost?wsdl</quickcost_url>
306
- <logo_url>chronopost.png</logo_url>
307
- <debug>0</debug>
308
- <stop_to_first_match>0</stop_to_first_match>
309
- <!--<specificerrmsg>This shipping method is currently unavailable.</specificerrmsg>-->
310
- <sort_order>1</sort_order>
311
- </chronoexpress>
312
- <chronorelais>
313
- <active>0</active>
314
- <title>Chrono Relais</title>
315
- <model>Chronopost_Chronorelais_Model_Carrier_Chronorelais</model>
316
- <tracking_view_url></tracking_view_url>
317
- <config>
318
- # Chronorelais
319
- {
320
- label: "Chronopost : livraison express en point Chrono Relais",
321
- code: "chronorelais",
322
- description: "Colis disponible le lendemain à partir de 13h dans le point Chrono Relais de votre choix.
323
- Délai à compter de la prise en charge du colis par Chronopost.",
324
- tracking_url: "http://www.fr.chronopost.com/fr/tracking/result?listeNumeros={tracking_number}",
325
- destination: "FR",
326
- 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}",
327
- }
328
- </config>
329
- <weight_limit>20</weight_limit>
330
- <quickcost_url>http://wsshipping.chronopost.fr/wsQuickcost/services/ServiceQuickCost?wsdl</quickcost_url>
331
- <logo_url>chronorelais.png</logo_url>
332
- <debug>0</debug>
333
- <stop_to_first_match>0</stop_to_first_match>
334
- <!--<specificerrmsg>This shipping method is currently unavailable.</specificerrmsg>-->
335
- <sort_order>2</sort_order>
336
- </chronorelais>
337
- </carriers>
338
- </default>
339
-
 
 
 
 
 
340
  </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Chronopost_Chronorelais>
5
+ <version>0.1.7.1</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
+ <sales>
20
+ <rewrite>
21
+ <quote_address_total_shipping>Chronopost_Chronorelais_Model_Sales_Quote_Address_Total_Shipping</quote_address_total_shipping>
22
+ </rewrite>
23
+ </sales>
24
+ </models>
25
+ <blocks>
26
+ <chronorelais>
27
+ <class>Chronopost_Chronorelais_Block</class>
28
+ </chronorelais>
29
+ <adminhtml>
30
+ <rewrite>
31
+ <sales_order_shipment_view>Chronopost_Chronorelais_Block_Sales_Order_Shipment_View</sales_order_shipment_view>
32
+ </rewrite>
33
+ </adminhtml>
34
+ </blocks>
35
+ <helpers>
36
+ <chronorelais>
37
+ <class>Chronopost_Chronorelais_Helper</class>
38
+ </chronorelais>
39
+ </helpers>
40
+
41
+ <resources>
42
+ <sales>
43
+ <shipping>
44
+ <carriers>
45
+ <chronorelais>
46
+ <class>Chronopost_Chronorelais_Model_Carrier_Chronorelais</class>
47
+ </chronorelais>
48
+ <chronopost>
49
+ <class>Chronopost_Chronorelais_Model_Carrier_Chronopost</class>
50
+ </chronopost>
51
+ <chronoexpress>
52
+ <class>Chronopost_Chronorelais_Model_Carrier_Chronoexpress</class>
53
+ </chronoexpress>
54
+ </carriers>
55
+ </shipping>
56
+ </sales>
57
+ <chronorelais_setup>
58
+ <setup>
59
+ <module>Chronopost_Chronorelais</module>
60
+ <class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
61
+ </setup>
62
+ <connection>
63
+ <use>core_setup</use>
64
+ </connection>
65
+ </chronorelais_setup>
66
+ <chronorelais_write>
67
+ <connection>
68
+ <use>core_write</use>
69
+ </connection>
70
+ </chronorelais_write>
71
+
72
+ <chronorelais_read>
73
+ <connection>
74
+ <use>core_read</use>
75
+ </connection>
76
+ </chronorelais_read>
77
+ </resources>
78
+
79
+ <rewrite>
80
+ <chronopost_chronorelais_checkout_onepage>
81
+ <from><![CDATA[#^/checkout/onepage/#]]></from>
82
+ <to>/chronorelais/checkout_onepage/</to>
83
+ </chronopost_chronorelais_checkout_onepage>
84
+ <chronopost_chronorelais_checkout_multishipping>
85
+ <from><![CDATA[#^/checkout/multishipping/#]]></from>
86
+ <to>/chronorelais/checkout_multishipping/</to>
87
+ </chronopost_chronorelais_checkout_multishipping>
88
+ <chronopost_chronorelais_sales_order_shipment>
89
+ <from><![CDATA[#^/.*sales_order_shipment/save/#]]></from>
90
+ <to>/chronorelais/sales_order_shipment/save/</to>
91
+ </chronopost_chronorelais_sales_order_shipment>
92
+ </rewrite>
93
+
94
+ <fieldsets>
95
+ <sales_copy_order_billing_address>
96
+ <w_relay_point_code><to_order>*</to_order></w_relay_point_code>
97
+ </sales_copy_order_billing_address>
98
+ <sales_copy_order_shipping_address>
99
+ <w_relay_point_code><to_order>*</to_order></w_relay_point_code>
100
+ </sales_copy_order_shipping_address>
101
+ <sales_convert_quote_address>
102
+ <w_relay_point_code><to_order_address>*</to_order_address><to_customer_address>*</to_customer_address></w_relay_point_code>
103
+ </sales_convert_quote_address>
104
+ <sales_convert_order_address>
105
+ <w_relay_point_code><to_quote_address>*</to_quote_address></w_relay_point_code>
106
+ </sales_convert_order_address>
107
+ <customer_address>
108
+ <w_relay_point_code><to_quote_address>*</to_quote_address></w_relay_point_code>
109
+ </customer_address>
110
+ </fieldsets>
111
+
112
+ </global>
113
+
114
+ <frontend>
115
+ <routers>
116
+ <chronorelais>
117
+ <use>standard</use>
118
+ <args>
119
+ <module>Chronopost_Chronorelais</module>
120
+ <frontName>chronorelais</frontName>
121
+ </args>
122
+ </chronorelais>
123
+ </routers>
124
+
125
+ <layout>
126
+ <updates>
127
+ <chronorelais>
128
+ <file>chronorelais.xml</file>
129
+ </chronorelais>
130
+ </updates>
131
+ </layout>
132
+ <translate>
133
+ <modules>
134
+ <Chronopost_Chronorelais>
135
+ <files>
136
+ <default>Chronopost_Chronorelais.csv</default>
137
+ </files>
138
+ </Chronopost_Chronorelais>
139
+ </modules>
140
+ </translate>
141
+ </frontend>
142
+
143
+ <admin>
144
+ <routers>
145
+ <chronorelais>
146
+ <use>admin</use>
147
+ <args>
148
+ <module>Chronopost_Chronorelais</module>
149
+ <frontName>chronorelais</frontName>
150
+ </args>
151
+ </chronorelais>
152
+ </routers>
153
+ </admin>
154
+
155
+ <adminhtml>
156
+ <menu>
157
+ <sales>
158
+ <children>
159
+ <chronorelais translate="title"> <!-- TODO faire marcher : module="chronorelais" (aussi dans les children) -->
160
+ <title>Chronopost</title>
161
+ <sort_order>15</sort_order>
162
+ <children>
163
+ <export translate="title">
164
+ <title>Export</title>
165
+ <action>chronorelais/export</action>
166
+ <sort_order>10</sort_order>
167
+ </export>
168
+ <import translate="title">
169
+ <title>Import</title>
170
+ <action>chronorelais/import</action>
171
+ <sort_order>20</sort_order>
172
+ </import>
173
+ <impression translate="title" module="sales">
174
+ <title>Impression des étiquettes</title>
175
+ <action>chronorelais/sales_impression</action>
176
+ <sort_order>30</sort_order>
177
+ </impression>
178
+ </children>
179
+ </chronorelais>
180
+ </children>
181
+ </sales>
182
+ </menu>
183
+ <acl>
184
+ <resources>
185
+ <admin>
186
+ <children>
187
+ <sales>
188
+ <children>
189
+ <chronorelais translate="title">
190
+ <title>Chronopost</title>
191
+ <sort_order>15</sort_order>
192
+ <children>
193
+ <export translate="title">
194
+ <title>Export</title>
195
+ <sort_order>10</sort_order>
196
+ </export>
197
+ <import translate="title">
198
+ <title>Import</title>
199
+ <sort_order>20</sort_order>
200
+ </import>
201
+ <impression translate="title" module="sales">
202
+ <title>Impression des étiquettes</title>
203
+ <sort_order>30</sort_order>
204
+ </impression>
205
+ </children>
206
+ </chronorelais>
207
+ </children>
208
+ </sales>
209
+ <system>
210
+ <children>
211
+ <config>
212
+ <children>
213
+ <chronorelais translate="title" module="chronorelais">
214
+ <title>Chronopost</title>
215
+ <sort_order>100</sort_order>
216
+ </chronorelais>
217
+ </children>
218
+ </config>
219
+ </children>
220
+ </system>
221
+ </children>
222
+ </admin>
223
+ </resources>
224
+ </acl>
225
+
226
+ <translate>
227
+ <modules>
228
+ <Chronopost_Chronorelais>
229
+ <files>
230
+ <default>Chronopost_Chronorelais.csv</default>
231
+ </files>
232
+ </Chronopost_Chronorelais>
233
+ </modules>
234
+ </translate>
235
+ </adminhtml>
236
+
237
+ <default>
238
+ <chronorelais>
239
+ <shipping>
240
+ <google_map_api>ABQIAAAAZvdukOwsytNocL5anZKqZxS51Nc8ngbKeRYi0kVLSLeRaqOKHRSLs6O150txpwWCDcct2mH4X-G6OA</google_map_api>
241
+ <tracking_view_url><![CDATA[http://suivi.chronopost.fr/servletSuivi?langue=fr_FR&noLTList={tracking_number}]]></tracking_view_url>
242
+ </shipping>
243
+ <export_css>
244
+ <file_extension>.chr</file_extension>
245
+ <file_charset>ASCII-7</file_charset>
246
+ <endofline_character>crlf</endofline_character>
247
+ <field_delimiter>none</field_delimiter>
248
+ <field_separator>;</field_separator>
249
+ </export_css>
250
+ <export_cso>
251
+ <file_extension>.txt</file_extension>
252
+ <file_charset>ISO-8859-1</file_charset>
253
+ <endofline_character>crlf</endofline_character>
254
+ <field_delimiter>none</field_delimiter>
255
+ <field_separator>;</field_separator>
256
+ </export_cso>
257
+ <import>
258
+ <default_tracking_title>Chronopost - Chronopost livraison express à domicile</default_tracking_title>
259
+ <send_email>1</send_email>
260
+ <shipping_comment></shipping_comment>
261
+ <include_comment>0</include_comment>
262
+ </import>
263
+ </chronorelais>
264
+ <carriers>
265
+ <chronopost>
266
+ <active>0</active>
267
+ <title>Chronopost</title>
268
+ <model>Chronopost_Chronorelais_Model_Carrier_Chronopost</model>
269
+ <tracking_view_url></tracking_view_url>
270
+ <config>
271
+ # Chronopost
272
+ {
273
+ label: "Chronopost livraison express à domicile",
274
+ code: "chronopost",
275
+ description: "Colis livré le lendemain avant 13h, à l’adresse de votre choix.
276
+ Délai à compter de la prise en charge du colis par Chronopost, pour une livraison en France métropolitaine.
277
+ En cas d’absence, le colis est mis en instance dans le bureau de Poste le plus proche.",
278
+ tracking_url: "http://www.fr.chronopost.com/fr/tracking/result?listeNumeros={tracking_number}",
279
+ destination: "FR,MC",
280
+ 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}",
281
+ }
282
+ </config>
283
+ <weight_limit>30</weight_limit>
284
+ <quickcost_url>http://wsshipping.chronopost.fr/wsQuickcost/services/ServiceQuickCost?wsdl</quickcost_url>
285
+ <logo_url>chronopost.png</logo_url>
286
+ <debug>0</debug>
287
+ <stop_to_first_match>0</stop_to_first_match>
288
+ <!--<specificerrmsg>This shipping method is currently unavailable.</specificerrmsg>-->
289
+ <sort_order>1</sort_order>
290
+ </chronopost>
291
+ <chronoexpress>
292
+ <active>0</active>
293
+ <title>Chronopost</title>
294
+ <model>Chronopost_Chronorelais_Model_Carrier_Chronoexpress</model>
295
+ <tracking_view_url></tracking_view_url>
296
+ <config>
297
+ # Chronoexpress
298
+ {
299
+ label: "Chronopost livraison express partout dans le monde",
300
+ code: "chronoexpress",
301
+ description: "L'Europe livrée en 1 à 3 jours et le reste du monde en 2 à 5 jours.
302
+ Délai à compter de la prise en charge du colis par Chronopost.",
303
+ tracking_url: "http://www.fr.chronopost.com/fr/tracking/result?listeNumeros={tracking_number}",
304
+ 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",
305
+ 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}",
306
+ }
307
+ </config>
308
+ <weight_limit>30</weight_limit>
309
+ <quickcost_url>http://wsshipping.chronopost.fr/wsQuickcost/services/ServiceQuickCost?wsdl</quickcost_url>
310
+ <logo_url>chronopost.png</logo_url>
311
+ <debug>0</debug>
312
+ <stop_to_first_match>0</stop_to_first_match>
313
+ <!--<specificerrmsg>This shipping method is currently unavailable.</specificerrmsg>-->
314
+ <sort_order>1</sort_order>
315
+ </chronoexpress>
316
+ <chronorelais>
317
+ <active>0</active>
318
+ <title>Chrono Relais</title>
319
+ <model>Chronopost_Chronorelais_Model_Carrier_Chronorelais</model>
320
+ <tracking_view_url></tracking_view_url>
321
+ <config>
322
+ # Chronorelais
323
+ {
324
+ label: "Chrono Relais : livraison express en relais Pickup",
325
+ code: "chronorelais",
326
+ description: "Colis livré en Chronopost le lendemain avant 13 h dans le relais Pickup de votre choix.
327
+ Vous êtes averti par email ou SMS de l’arrivée du colis dans le point.
328
+ Délai à compter de la prise en charge du colis par Chronopost.",
329
+ tracking_url: "http://www.fr.chronopost.com/fr/tracking/result?listeNumeros={tracking_number}",
330
+ destination: "FR",
331
+ 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}",
332
+ }
333
+ </config>
334
+ <weight_limit>20</weight_limit>
335
+ <quickcost_url>http://wsshipping.chronopost.fr/wsQuickcost/services/ServiceQuickCost?wsdl</quickcost_url>
336
+ <logo_url>chronorelais.png</logo_url>
337
+ <debug>0</debug>
338
+ <stop_to_first_match>0</stop_to_first_match>
339
+ <!--<specificerrmsg>This shipping method is currently unavailable.</specificerrmsg>-->
340
+ <sort_order>2</sort_order>
341
+ </chronorelais>
342
+ </carriers>
343
+ </default>
344
+
345
  </config>
app/code/community/Chronopost/Chronorelais/etc/system.xml CHANGED
@@ -1,965 +1,965 @@
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
- <source_model>adminhtml/system_config_source_yesno</source_model>
24
- <sort_order>1</sort_order>
25
- <show_in_default>1</show_in_default>
26
- <show_in_website>1</show_in_website>
27
- <show_in_store>1</show_in_store>
28
- </active>
29
- <title translate="label">
30
- <label>Title</label>
31
- <frontend_type>text</frontend_type>
32
- <sort_order>2</sort_order>
33
- <show_in_default>1</show_in_default>
34
- <show_in_website>1</show_in_website>
35
- <show_in_store>1</show_in_store>
36
- </title>
37
- <config translate="label">
38
- <label>Configuration</label>
39
- <frontend_model>chronorelais/adminhtml_system_config_form_field_config</frontend_model>
40
- <comment>{configuration_syntax_help}</comment>
41
- <frontend_type>textarea</frontend_type>
42
- <sort_order>3</sort_order>
43
- <show_in_default>1</show_in_default>
44
- <show_in_website>1</show_in_website>
45
- <show_in_store>1</show_in_store>
46
- </config>
47
- <weight_limit translate="label">
48
- <label>Weight Limit</label>
49
- <frontend_type>text</frontend_type>
50
- <comment>in Kg</comment>
51
- <sort_order>7</sort_order>
52
- <show_in_default>1</show_in_default>
53
- <show_in_website>1</show_in_website>
54
- <show_in_store>1</show_in_store>
55
- </weight_limit>
56
- <quickcost translate="label">
57
- <label>Quickcost</label>
58
- <frontend_type>select</frontend_type>
59
- <comment>To obtain the price from your rate grid</comment>
60
- <source_model>adminhtml/system_config_source_yesno</source_model>
61
- <sort_order>10</sort_order>
62
- <show_in_default>1</show_in_default>
63
- <show_in_website>1</show_in_website>
64
- <show_in_store>0</show_in_store>
65
- </quickcost>
66
- <quickcost_url>
67
- <label>Quickcost Url</label>
68
- <frontend_type>text</frontend_type>
69
- <sort_order>11</sort_order>
70
- <show_in_default>1</show_in_default>
71
- <show_in_website>1</show_in_website>
72
- <show_in_store>0</show_in_store>
73
- </quickcost_url>
74
- <free_shipping_enable translate="label">
75
- <label>Free Shipping on the Amount</label>
76
- <frontend_type>select</frontend_type>
77
- <source_model>adminhtml/system_config_source_enabledisable</source_model>
78
- <sort_order>12</sort_order>
79
- <show_in_default>1</show_in_default>
80
- <show_in_website>1</show_in_website>
81
- <show_in_store>1</show_in_store>
82
- </free_shipping_enable>
83
- <free_shipping_subtotal translate="label">
84
- <label>Minimum Amount for Free Shipping</label>
85
- <frontend_type>text</frontend_type>
86
- <sort_order>13</sort_order>
87
- <show_in_default>1</show_in_default>
88
- <show_in_website>1</show_in_website>
89
- <show_in_store>0</show_in_store>
90
- </free_shipping_subtotal>
91
- <application_fee translate="label">
92
- <label>Application Fee</label>
93
- <frontend_type>text</frontend_type>
94
- <sort_order>14</sort_order>
95
- <show_in_default>1</show_in_default>
96
- <show_in_website>1</show_in_website>
97
- <show_in_store>1</show_in_store>
98
- </application_fee>
99
- <handling_fee translate="label">
100
- <label>Handling Fee</label>
101
- <frontend_type>text</frontend_type>
102
- <sort_order>15</sort_order>
103
- <show_in_default>1</show_in_default>
104
- <show_in_website>1</show_in_website>
105
- <show_in_store>1</show_in_store>
106
- </handling_fee>
107
- <logo_url>
108
- <label>Logo Url</label>
109
- <frontend_type>text</frontend_type>
110
- <comment>{logo_ulr_help}</comment>
111
- <sort_order>18</sort_order>
112
- <show_in_default>1</show_in_default>
113
- <show_in_website>1</show_in_website>
114
- <show_in_store>1</show_in_store>
115
- </logo_url>
116
- <debug>
117
- <label>Debug</label>
118
- <comment>{debug_help}</comment>
119
- <frontend_type>text</frontend_type>
120
- <sort_order>20</sort_order>
121
- <show_in_default>1</show_in_default>
122
- <show_in_website>1</show_in_website>
123
- <show_in_store>1</show_in_store>
124
- </debug>
125
- <!--<stop_to_first_match translate="label">
126
- <label>Stop to first match</label>
127
- <frontend_type>select</frontend_type>
128
- <source_model>adminhtml/system_config_source_yesno</source_model>
129
- <sort_order>22</sort_order>
130
- <show_in_default>1</show_in_default>
131
- <show_in_website>1</show_in_website>
132
- <show_in_store>1</show_in_store>
133
- </stop_to_first_match>-->
134
- <deliver_on_saturday translate="label comment">
135
- <label>Livraison le Samedi</label>
136
- <comment>If yes has been selected, the option will be available every Thursdays from 6pm to Fridays at 3pm.</comment>
137
- <frontend_type>select</frontend_type>
138
- <source_model>adminhtml/system_config_source_yesno</source_model>
139
- <sort_order>23</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
- </deliver_on_saturday>
144
- <!--<showmethod translate="label">
145
- <label>Show Method if Not Applicable</label>
146
- <frontend_type>select</frontend_type>
147
- <sort_order>30</sort_order>
148
- <frontend_class>shipping-skip-hide</frontend_class>
149
- <source_model>adminhtml/system_config_source_yesno</source_model>
150
- <show_in_default>1</show_in_default>
151
- <show_in_website>1</show_in_website>
152
- <show_in_store>0</show_in_store>
153
- </showmethod>
154
- <specificerrmsg translate="label">
155
- <label>Displayed Error Message</label>
156
- <frontend_type>textarea</frontend_type>
157
- <sort_order>31</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
- </specificerrmsg>-->
162
- <sort_order translate="label">
163
- <label>Sort order</label>
164
- <frontend_type>text</frontend_type>
165
- <sort_order>100</sort_order>
166
- <show_in_default>1</show_in_default>
167
- <show_in_website>1</show_in_website>
168
- <show_in_store>1</show_in_store>
169
- </sort_order>
170
- </fields>
171
- </chronopost>
172
-
173
- <chronoexpress translate="label">
174
- <label>Chrono Express</label>
175
- <frontend_type>text</frontend_type>
176
- <sort_order>21</sort_order>
177
- <show_in_default>1</show_in_default>
178
- <show_in_website>1</show_in_website>
179
- <show_in_store>1</show_in_store>
180
- <fields>
181
- <active translate="label">
182
- <label>Enabled</label>
183
- <frontend_type>select</frontend_type>
184
- <source_model>adminhtml/system_config_source_yesno</source_model>
185
- <sort_order>1</sort_order>
186
- <show_in_default>1</show_in_default>
187
- <show_in_website>1</show_in_website>
188
- <show_in_store>1</show_in_store>
189
- </active>
190
- <title translate="label">
191
- <label>Title</label>
192
- <frontend_type>text</frontend_type>
193
- <sort_order>2</sort_order>
194
- <show_in_default>1</show_in_default>
195
- <show_in_website>1</show_in_website>
196
- <show_in_store>1</show_in_store>
197
- </title>
198
- <config translate="label">
199
- <label>Configuration</label>
200
- <frontend_model>chronorelais/adminhtml_system_config_form_field_config</frontend_model>
201
- <comment>{configuration_syntax_help}</comment>
202
- <frontend_type>textarea</frontend_type>
203
- <sort_order>3</sort_order>
204
- <show_in_default>1</show_in_default>
205
- <show_in_website>1</show_in_website>
206
- <show_in_store>1</show_in_store>
207
- </config>
208
- <weight_limit translate="label">
209
- <label>Weight Limit</label>
210
- <frontend_type>text</frontend_type>
211
- <comment>in Kg</comment>
212
- <sort_order>7</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
- </weight_limit>
217
- <quickcost translate="label">
218
- <label>Quickcost</label>
219
- <frontend_type>select</frontend_type>
220
- <comment>To obtain the price from your rate grid</comment>
221
- <source_model>adminhtml/system_config_source_yesno</source_model>
222
- <sort_order>10</sort_order>
223
- <show_in_default>1</show_in_default>
224
- <show_in_website>1</show_in_website>
225
- <show_in_store>0</show_in_store>
226
- </quickcost>
227
- <quickcost_url>
228
- <label>Quickcost Url</label>
229
- <frontend_type>text</frontend_type>
230
- <sort_order>11</sort_order>
231
- <show_in_default>1</show_in_default>
232
- <show_in_website>1</show_in_website>
233
- <show_in_store>0</show_in_store>
234
- </quickcost_url>
235
- <free_shipping_enable translate="label">
236
- <label>Free Shipping on the Amount</label>
237
- <frontend_type>select</frontend_type>
238
- <source_model>adminhtml/system_config_source_enabledisable</source_model>
239
- <sort_order>12</sort_order>
240
- <show_in_default>1</show_in_default>
241
- <show_in_website>1</show_in_website>
242
- <show_in_store>1</show_in_store>
243
- </free_shipping_enable>
244
- <free_shipping_subtotal translate="label">
245
- <label>Minimum Amount for Free Shipping</label>
246
- <frontend_type>text</frontend_type>
247
- <sort_order>13</sort_order>
248
- <show_in_default>1</show_in_default>
249
- <show_in_website>1</show_in_website>
250
- <show_in_store>0</show_in_store>
251
- </free_shipping_subtotal>
252
- <application_fee translate="label">
253
- <label>Application Fee</label>
254
- <frontend_type>text</frontend_type>
255
- <sort_order>14</sort_order>
256
- <show_in_default>1</show_in_default>
257
- <show_in_website>1</show_in_website>
258
- <show_in_store>1</show_in_store>
259
- </application_fee>
260
- <handling_fee translate="label">
261
- <label>Handling Fee</label>
262
- <frontend_type>text</frontend_type>
263
- <sort_order>15</sort_order>
264
- <show_in_default>1</show_in_default>
265
- <show_in_website>1</show_in_website>
266
- <show_in_store>1</show_in_store>
267
- </handling_fee>
268
- <logo_url>
269
- <label>Logo Url</label>
270
- <frontend_type>text</frontend_type>
271
- <comment>{logo_ulr_help}</comment>
272
- <sort_order>18</sort_order>
273
- <show_in_default>1</show_in_default>
274
- <show_in_website>1</show_in_website>
275
- <show_in_store>1</show_in_store>
276
- </logo_url>
277
- <debug>
278
- <label>Debug</label>
279
- <comment>{debug_help}</comment>
280
- <frontend_type>text</frontend_type>
281
- <sort_order>20</sort_order>
282
- <show_in_default>1</show_in_default>
283
- <show_in_website>1</show_in_website>
284
- <show_in_store>1</show_in_store>
285
- </debug>
286
- <!--<stop_to_first_match translate="label">
287
- <label>Stop to first match</label>
288
- <frontend_type>select</frontend_type>
289
- <source_model>adminhtml/system_config_source_yesno</source_model>
290
- <sort_order>22</sort_order>
291
- <show_in_default>1</show_in_default>
292
- <show_in_website>1</show_in_website>
293
- <show_in_store>1</show_in_store>
294
- </stop_to_first_match>-->
295
- <!-- deliver_on_saturday not included in chronoexpress only -->
296
- <!--<showmethod translate="label">
297
- <label>Show Method if Not Applicable</label>
298
- <frontend_type>select</frontend_type>
299
- <sort_order>30</sort_order>
300
- <frontend_class>shipping-skip-hide</frontend_class>
301
- <source_model>adminhtml/system_config_source_yesno</source_model>
302
- <show_in_default>1</show_in_default>
303
- <show_in_website>1</show_in_website>
304
- <show_in_store>0</show_in_store>
305
- </showmethod>
306
- <specificerrmsg translate="label">
307
- <label>Displayed Error Message</label>
308
- <frontend_type>textarea</frontend_type>
309
- <sort_order>31</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
- </specificerrmsg>-->
314
- <sort_order translate="label">
315
- <label>Sort order</label>
316
- <frontend_type>text</frontend_type>
317
- <sort_order>100</sort_order>
318
- <show_in_default>1</show_in_default>
319
- <show_in_website>1</show_in_website>
320
- <show_in_store>1</show_in_store>
321
- </sort_order>
322
- </fields>
323
- </chronoexpress>
324
-
325
- <chronorelais translate="label">
326
- <label>Chrono Relais</label>
327
- <frontend_type>text</frontend_type>
328
- <sort_order>22</sort_order>
329
- <show_in_default>1</show_in_default>
330
- <show_in_website>1</show_in_website>
331
- <show_in_store>1</show_in_store>
332
- <fields>
333
- <active translate="label">
334
- <label>Enabled</label>
335
- <frontend_type>select</frontend_type>
336
- <source_model>adminhtml/system_config_source_yesno</source_model>
337
- <sort_order>1</sort_order>
338
- <show_in_default>1</show_in_default>
339
- <show_in_website>1</show_in_website>
340
- <show_in_store>1</show_in_store>
341
- </active>
342
- <title translate="label">
343
- <label>Title</label>
344
- <frontend_type>text</frontend_type>
345
- <sort_order>2</sort_order>
346
- <show_in_default>1</show_in_default>
347
- <show_in_website>1</show_in_website>
348
- <show_in_store>1</show_in_store>
349
- </title>
350
- <config translate="label">
351
- <label>Configuration</label>
352
- <frontend_model>chronorelais/adminhtml_system_config_form_field_config</frontend_model>
353
- <comment>{configuration_syntax_help}</comment>
354
- <frontend_type>textarea</frontend_type>
355
- <sort_order>3</sort_order>
356
- <show_in_default>1</show_in_default>
357
- <show_in_website>1</show_in_website>
358
- <show_in_store>1</show_in_store>
359
- </config>
360
- <weight_limit translate="label">
361
- <label>Weight Limit</label>
362
- <frontend_type>text</frontend_type>
363
- <comment>in Kg</comment>
364
- <sort_order>7</sort_order>
365
- <show_in_default>1</show_in_default>
366
- <show_in_website>1</show_in_website>
367
- <show_in_store>1</show_in_store>
368
- </weight_limit>
369
- <quickcost translate="label">
370
- <label>Quickcost</label>
371
- <frontend_type>select</frontend_type>
372
- <comment>To obtain the price from your rate grid</comment>
373
- <source_model>adminhtml/system_config_source_yesno</source_model>
374
- <sort_order>10</sort_order>
375
- <show_in_default>1</show_in_default>
376
- <show_in_website>1</show_in_website>
377
- <show_in_store>0</show_in_store>
378
- </quickcost>
379
- <quickcost_url>
380
- <label>Quickcost Url</label>
381
- <frontend_type>text</frontend_type>
382
- <sort_order>11</sort_order>
383
- <show_in_default>1</show_in_default>
384
- <show_in_website>1</show_in_website>
385
- <show_in_store>0</show_in_store>
386
- </quickcost_url>
387
- <free_shipping_enable translate="label">
388
- <label>Free Shipping with Minimum Order Amount</label>
389
- <frontend_type>select</frontend_type>
390
- <source_model>adminhtml/system_config_source_enabledisable</source_model>
391
- <sort_order>12</sort_order>
392
- <show_in_default>1</show_in_default>
393
- <show_in_website>1</show_in_website>
394
- <show_in_store>1</show_in_store>
395
- </free_shipping_enable>
396
- <free_shipping_subtotal translate="label">
397
- <label>Minimum Order Amount for Free Shipping</label>
398
- <frontend_type>text</frontend_type>
399
- <sort_order>13</sort_order>
400
- <show_in_default>1</show_in_default>
401
- <show_in_website>1</show_in_website>
402
- <show_in_store>1</show_in_store>
403
- </free_shipping_subtotal>
404
- <application_fee translate="label">
405
- <label>Application Fee</label>
406
- <frontend_type>text</frontend_type>
407
- <sort_order>14</sort_order>
408
- <show_in_default>1</show_in_default>
409
- <show_in_website>1</show_in_website>
410
- <show_in_store>1</show_in_store>
411
- </application_fee>
412
- <handling_fee translate="label">
413
- <label>Handling Fee</label>
414
- <frontend_type>text</frontend_type>
415
- <sort_order>15</sort_order>
416
- <show_in_default>1</show_in_default>
417
- <show_in_website>1</show_in_website>
418
- <show_in_store>1</show_in_store>
419
- </handling_fee>
420
- <logo_url>
421
- <label>Logo Url</label>
422
- <frontend_type>text</frontend_type>
423
- <comment>{logo_ulr_help}</comment>
424
- <sort_order>18</sort_order>
425
- <show_in_default>1</show_in_default>
426
- <show_in_website>1</show_in_website>
427
- <show_in_store>1</show_in_store>
428
- </logo_url>
429
- <debug>
430
- <label>Debug</label>
431
- <comment>{debug_help}</comment>
432
- <frontend_type>text</frontend_type>
433
- <sort_order>20</sort_order>
434
- <show_in_default>1</show_in_default>
435
- <show_in_website>1</show_in_website>
436
- <show_in_store>1</show_in_store>
437
- </debug>
438
- <!--<stop_to_first_match translate="label">
439
- <label>Stop to first match</label>
440
- <frontend_type>select</frontend_type>
441
- <source_model>adminhtml/system_config_source_yesno</source_model>
442
- <sort_order>22</sort_order>
443
- <show_in_default>1</show_in_default>
444
- <show_in_website>1</show_in_website>
445
- <show_in_store>1</show_in_store>
446
- </stop_to_first_match>-->
447
- <deliver_on_saturday translate="label comment">
448
- <label>Livraison le Samedi</label>
449
- <comment>If yes has been selected, the option will be available every Thursdays from 6pm to Fridays at 3pm.</comment>
450
- <frontend_type>select</frontend_type>
451
- <source_model>adminhtml/system_config_source_yesno</source_model>
452
- <sort_order>23</sort_order>
453
- <show_in_default>1</show_in_default>
454
- <show_in_website>1</show_in_website>
455
- <show_in_store>1</show_in_store>
456
- </deliver_on_saturday>
457
- <!--<showmethod translate="label">
458
- <label>Show Method if Not Applicable</label>
459
- <frontend_type>select</frontend_type>
460
- <sort_order>30</sort_order>
461
- <frontend_class>shipping-skip-hide</frontend_class>
462
- <source_model>adminhtml/system_config_source_yesno</source_model>
463
- <show_in_default>1</show_in_default>
464
- <show_in_website>1</show_in_website>
465
- <show_in_store>0</show_in_store>
466
- </showmethod>
467
- <specificerrmsg translate="label">
468
- <label>Displayed Error Message</label>
469
- <frontend_type>textarea</frontend_type>
470
- <sort_order>31</sort_order>
471
- <show_in_default>1</show_in_default>
472
- <show_in_website>1</show_in_website>
473
- <show_in_store>1</show_in_store>
474
- </specificerrmsg>-->
475
- <sort_order translate="label">
476
- <label>Sort order</label>
477
- <frontend_type>text</frontend_type>
478
- <sort_order>100</sort_order>
479
- <show_in_default>1</show_in_default>
480
- <show_in_website>1</show_in_website>
481
- <show_in_store>1</show_in_store>
482
- </sort_order>
483
- </fields>
484
- </chronorelais>
485
- </groups>
486
- </carriers>
487
- </sections>
488
-
489
- <sections>
490
- <chronorelais>
491
- <label>Chronopost Settings</label>
492
- <tab>chronopost</tab>
493
- <frontend_type>text</frontend_type>
494
- <sort_order>2000</sort_order>
495
- <show_in_default>1</show_in_default>
496
- <show_in_website>1</show_in_website>
497
- <show_in_store>1</show_in_store>
498
- <groups>
499
- <shipping translate="label">
500
- <label>General</label>
501
- <frontend_type>text</frontend_type>
502
- <sort_order>10</sort_order>
503
- <show_in_default>1</show_in_default>
504
- <show_in_website>1</show_in_website>
505
- <show_in_store>1</show_in_store>
506
- <fields>
507
- <account_number translate="label">
508
- <label>N° de compte Chronopost</label>
509
- <frontend_type>text</frontend_type>
510
- <sort_order>7</sort_order>
511
- <show_in_default>1</show_in_default>
512
- <show_in_website>1</show_in_website>
513
- <show_in_store>1</show_in_store>
514
- </account_number>
515
- <sub_account_number translate="label">
516
- <label>Sous-compte</label>
517
- <comment>must be 3 digits or empty</comment>
518
- <frontend_type>text</frontend_type>
519
- <sort_order>8</sort_order>
520
- <show_in_default>1</show_in_default>
521
- <show_in_website>1</show_in_website>
522
- <show_in_store>1</show_in_store>
523
- </sub_account_number>
524
- <account_pass translate="label">
525
- <label>Mot de passe Chronopost</label>
526
- <frontend_type>text</frontend_type>
527
- <sort_order>9</sort_order>
528
- <show_in_default>1</show_in_default>
529
- <show_in_website>1</show_in_website>
530
- <show_in_store>1</show_in_store>
531
- </account_pass>
532
- <google_map_api translate="label">
533
- <label>Google Map API Key</label>
534
- <frontend_type>text</frontend_type>
535
- <sort_order>10</sort_order>
536
- <show_in_default>1</show_in_default>
537
- <show_in_website>1</show_in_website>
538
- <show_in_store>1</show_in_store>
539
- </google_map_api>
540
- <tracking_view_url translate="label">
541
- <label>Tracking URL</label>
542
- <comment>For English language, replace fr_FR with en_GB in the above url</comment>
543
- <frontend_type>text</frontend_type>
544
- <sort_order>20</sort_order>
545
- <show_in_default>1</show_in_default>
546
- <show_in_website>1</show_in_website>
547
- <show_in_store>1</show_in_store>
548
- </tracking_view_url>
549
-
550
- </fields>
551
- </shipping>
552
- <export_css translate="label">
553
- <label>Export Configuration CSS</label>
554
- <frontend_type>text</frontend_type>
555
- <sort_order>20</sort_order>
556
- <show_in_default>1</show_in_default>
557
- <show_in_website>1</show_in_website>
558
- <show_in_store>1</show_in_store>
559
- <fields>
560
- <file_extension translate="label">
561
- <label>File Extension</label>
562
- <frontend_type>select</frontend_type>
563
- <source_model>chronorelais/config_source_fileExtension</source_model>
564
- <sort_order>10</sort_order>
565
- <show_in_default>1</show_in_default>
566
- <show_in_website>1</show_in_website>
567
- <show_in_store>1</show_in_store>
568
- </file_extension>
569
- <file_charset translate="label">
570
- <label>File Charset</label>
571
- <frontend_type>select</frontend_type>
572
- <source_model>chronorelais/config_source_fileCharset</source_model>
573
- <sort_order>20</sort_order>
574
- <show_in_default>1</show_in_default>
575
- <show_in_website>1</show_in_website>
576
- <show_in_store>1</show_in_store>
577
- </file_charset>
578
- <endofline_character translate="label">
579
- <label>End Of Line Character</label>
580
- <frontend_type>select</frontend_type>
581
- <source_model>chronorelais/config_source_endOfLineCharacter</source_model>
582
- <sort_order>30</sort_order>
583
- <show_in_default>1</show_in_default>
584
- <show_in_website>1</show_in_website>
585
- <show_in_store>1</show_in_store>
586
- </endofline_character>
587
- <field_delimiter translate="label">
588
- <label>Field Delimiter</label>
589
- <frontend_type>select</frontend_type>
590
- <source_model>chronorelais/config_source_fieldDelimiter</source_model>
591
- <sort_order>40</sort_order>
592
- <show_in_default>1</show_in_default>
593
- <show_in_website>1</show_in_website>
594
- <show_in_store>1</show_in_store>
595
- </field_delimiter>
596
- <field_separator translate="label">
597
- <label>Field Separator</label>
598
- <frontend_type>select</frontend_type>
599
- <source_model>chronorelais/config_source_fieldSeparator</source_model>
600
- <sort_order>50</sort_order>
601
- <show_in_default>1</show_in_default>
602
- <show_in_website>1</show_in_website>
603
- <show_in_store>1</show_in_store>
604
- </field_separator>
605
- </fields>
606
- </export_css>
607
- <export_cso translate="label">
608
- <label>Export Configuration CSO</label>
609
- <frontend_type>text</frontend_type>
610
- <sort_order>21</sort_order>
611
- <show_in_default>1</show_in_default>
612
- <show_in_website>1</show_in_website>
613
- <show_in_store>1</show_in_store>
614
- <fields>
615
- <file_extension translate="label">
616
- <label>File Extension</label>
617
- <frontend_type>select</frontend_type>
618
- <source_model>chronorelais/config_source_fileExtension</source_model>
619
- <sort_order>10</sort_order>
620
- <show_in_default>1</show_in_default>
621
- <show_in_website>1</show_in_website>
622
- <show_in_store>1</show_in_store>
623
- </file_extension>
624
- <file_charset translate="label">
625
- <label>File Charset</label>
626
- <frontend_type>select</frontend_type>
627
- <source_model>chronorelais/config_source_fileCharset</source_model>
628
- <sort_order>20</sort_order>
629
- <show_in_default>1</show_in_default>
630
- <show_in_website>1</show_in_website>
631
- <show_in_store>1</show_in_store>
632
- </file_charset>
633
- <endofline_character translate="label">
634
- <label>End Of Line Character</label>
635
- <frontend_type>select</frontend_type>
636
- <source_model>chronorelais/config_source_endOfLineCharacter</source_model>
637
- <sort_order>30</sort_order>
638
- <show_in_default>1</show_in_default>
639
- <show_in_website>1</show_in_website>
640
- <show_in_store>1</show_in_store>
641
- </endofline_character>
642
- <field_delimiter translate="label">
643
- <label>Field Delimiter</label>
644
- <frontend_type>select</frontend_type>
645
- <source_model>chronorelais/config_source_fieldDelimiter</source_model>
646
- <sort_order>40</sort_order>
647
- <show_in_default>1</show_in_default>
648
- <show_in_website>1</show_in_website>
649
- <show_in_store>1</show_in_store>
650
- </field_delimiter>
651
- <field_separator translate="label">
652
- <label>Field Separator</label>
653
- <frontend_type>select</frontend_type>
654
- <source_model>chronorelais/config_source_fieldSeparator</source_model>
655
- <sort_order>50</sort_order>
656
- <show_in_default>1</show_in_default>
657
- <show_in_website>1</show_in_website>
658
- <show_in_store>1</show_in_store>
659
- </field_separator>
660
- </fields>
661
- </export_cso>
662
- <import translate="label">
663
- <label>Import Configuration</label>
664
- <frontend_type>text</frontend_type>
665
- <sort_order>30</sort_order>
666
- <show_in_default>1</show_in_default>
667
- <show_in_website>1</show_in_website>
668
- <show_in_store>1</show_in_store>
669
- <fields>
670
- <default_tracking_title translate="label comment">
671
- <label>Default Tracking Title</label>
672
- <frontend_type>text</frontend_type>
673
- <sort_order>10</sort_order>
674
- <show_in_default>1</show_in_default>
675
- <show_in_website>1</show_in_website>
676
- <show_in_store>1</show_in_store>
677
- <comment>This value can be changed in the import form</comment>
678
- </default_tracking_title>
679
- <send_email translate="label comment">
680
- <label>Send an e-mail</label>
681
- <frontend_type>select</frontend_type>
682
- <source_model>adminhtml/system_config_source_yesno</source_model>
683
- <sort_order>20</sort_order>
684
- <show_in_default>1</show_in_default>
685
- <show_in_website>1</show_in_website>
686
- <show_in_store>1</show_in_store>
687
- <comment>Send shipping confirmation to the customer</comment>
688
- </send_email>
689
- <shipping_comment translate="label comment">
690
- <label>Shipping Comment</label>
691
- <frontend_type>text</frontend_type>
692
- <sort_order>30</sort_order>
693
- <show_in_default>1</show_in_default>
694
- <show_in_website>1</show_in_website>
695
- <show_in_store>1</show_in_store>
696
- <comment>Internal comment, can be left empty</comment>
697
- </shipping_comment>
698
- <include_comment translate="label comment">
699
- <label>Include comment into e-mail</label>
700
- <frontend_type>select</frontend_type>
701
- <source_model>adminhtml/system_config_source_yesno</source_model>
702
- <sort_order>40</sort_order>
703
- <show_in_default>1</show_in_default>
704
- <show_in_website>1</show_in_website>
705
- <show_in_store>1</show_in_store>
706
- <comment>Only applies if the shipping comment is set</comment>
707
- </include_comment>
708
- </fields>
709
- </import>
710
-
711
- <shipperinformation translate="label">
712
- <label>Shipper Information for Labels printing</label>
713
- <frontend_type>text</frontend_type>
714
- <sort_order>40</sort_order>
715
- <show_in_default>1</show_in_default>
716
- <show_in_website>1</show_in_website>
717
- <show_in_store>1</show_in_store>
718
- <fields>
719
- <civility translate="label">
720
- <label>Shipper Civility</label>
721
- <frontend_type>select</frontend_type>
722
- <source_model>chronorelais/config_source_civility</source_model>
723
- <sort_order>10</sort_order>
724
- <show_in_default>1</show_in_default>
725
- <show_in_website>1</show_in_website>
726
- <show_in_store>1</show_in_store>
727
- </civility>
728
- <name translate="label comment">
729
- <label>Shipper Name</label>
730
- <frontend_type>text</frontend_type>
731
- <sort_order>20</sort_order>
732
- <show_in_default>1</show_in_default>
733
- <show_in_website>1</show_in_website>
734
- <show_in_store>1</show_in_store>
735
- <comment>Company name</comment>
736
- </name>
737
- <name2 translate="label comment">
738
- <label>Shipper Name2</label>
739
- <frontend_type>text</frontend_type>
740
- <sort_order>30</sort_order>
741
- <show_in_default>1</show_in_default>
742
- <show_in_website>1</show_in_website>
743
- <show_in_store>1</show_in_store>
744
- <comment>[Optional]</comment>
745
- </name2>
746
- <address1 translate="label">
747
- <label>Shipper Address1</label>
748
- <frontend_type>text</frontend_type>
749
- <sort_order>40</sort_order>
750
- <show_in_default>1</show_in_default>
751
- <show_in_website>1</show_in_website>
752
- <show_in_store>1</show_in_store>
753
- </address1>
754
- <address2 translate="label comment">
755
- <label>Shipper Address2</label>
756
- <frontend_type>text</frontend_type>
757
- <sort_order>50</sort_order>
758
- <show_in_default>1</show_in_default>
759
- <show_in_website>1</show_in_website>
760
- <show_in_store>1</show_in_store>
761
- <comment>[Optional]</comment>
762
- </address2>
763
- <zipcode translate="label">
764
- <label>Shipper Zipcode</label>
765
- <frontend_type>text</frontend_type>
766
- <sort_order>60</sort_order>
767
- <show_in_default>1</show_in_default>
768
- <show_in_website>1</show_in_website>
769
- <show_in_store>1</show_in_store>
770
- </zipcode>
771
- <city translate="label">
772
- <label>Shipper City</label>
773
- <frontend_type>text</frontend_type>
774
- <sort_order>70</sort_order>
775
- <show_in_default>1</show_in_default>
776
- <show_in_website>1</show_in_website>
777
- <show_in_store>1</show_in_store>
778
- </city>
779
- <country translate="label">
780
- <label>Shipper Country</label>
781
- <frontend_type>select</frontend_type>
782
- <sort_order>80</sort_order>
783
- <source_model>adminhtml/system_config_source_country</source_model>
784
- <show_in_default>1</show_in_default>
785
- <show_in_website>1</show_in_website>
786
- <show_in_store>1</show_in_store>
787
- </country>
788
- <contactname translate="label">
789
- <label>Shipper Contact Name</label>
790
- <frontend_type>text</frontend_type>
791
- <sort_order>90</sort_order>
792
- <show_in_default>1</show_in_default>
793
- <show_in_website>1</show_in_website>
794
- <show_in_store>1</show_in_store>
795
- </contactname>
796
- <email translate="label">
797
- <label>Shipper Email</label>
798
- <frontend_type>text</frontend_type>
799
- <sort_order>100</sort_order>
800
- <show_in_default>1</show_in_default>
801
- <show_in_website>1</show_in_website>
802
- <show_in_store>1</show_in_store>
803
- <comment>[Optional]</comment>
804
- </email>
805
- <phone translate="label comment">
806
- <label>Shipper Telephone</label>
807
- <frontend_type>text</frontend_type>
808
- <sort_order>110</sort_order>
809
- <show_in_default>1</show_in_default>
810
- <show_in_website>1</show_in_website>
811
- <show_in_store>1</show_in_store>
812
- <comment>[Optional]</comment>
813
- </phone>
814
- <mobilephone translate="label comment">
815
- <label>Shipper Mobile</label>
816
- <frontend_type>text</frontend_type>
817
- <sort_order>120</sort_order>
818
- <show_in_default>1</show_in_default>
819
- <show_in_website>1</show_in_website>
820
- <show_in_store>1</show_in_store>
821
- <comment>[Optional]</comment>
822
- </mobilephone>
823
- </fields>
824
- </shipperinformation>
825
-
826
- <customerinformation translate="label">
827
- <label>Chronopost Customer Account Information for Labels printing</label>
828
- <frontend_type>text</frontend_type>
829
- <sort_order>50</sort_order>
830
- <show_in_default>1</show_in_default>
831
- <show_in_website>1</show_in_website>
832
- <show_in_store>1</show_in_store>
833
- <fields>
834
- <civility translate="label">
835
- <label>Customer Civility</label>
836
- <frontend_type>select</frontend_type>
837
- <source_model>chronorelais/config_source_civility</source_model>
838
- <sort_order>10</sort_order>
839
- <show_in_default>1</show_in_default>
840
- <show_in_website>1</show_in_website>
841
- <show_in_store>1</show_in_store>
842
- </civility>
843
- <name translate="label comment">
844
- <label>Customer Name </label>
845
- <frontend_type>text</frontend_type>
846
- <sort_order>20</sort_order>
847
- <show_in_default>1</show_in_default>
848
- <show_in_website>1</show_in_website>
849
- <show_in_store>1</show_in_store>
850
- <comment>Company name</comment>
851
- </name>
852
- <name2 translate="label comment">
853
- <label>Customer Name2</label>
854
- <frontend_type>text</frontend_type>
855
- <sort_order>30</sort_order>
856
- <show_in_default>1</show_in_default>
857
- <show_in_website>1</show_in_website>
858
- <show_in_store>1</show_in_store>
859
- <comment>[Optional]</comment>
860
- </name2>
861
- <address1 translate="label">
862
- <label>Customer Address1</label>
863
- <frontend_type>text</frontend_type>
864
- <sort_order>40</sort_order>
865
- <show_in_default>1</show_in_default>
866
- <show_in_website>1</show_in_website>
867
- <show_in_store>1</show_in_store>
868
- </address1>
869
- <address2 translate="label comment">
870
- <label>Customer Address2</label>
871
- <frontend_type>text</frontend_type>
872
- <sort_order>50</sort_order>
873
- <show_in_default>1</show_in_default>
874
- <show_in_website>1</show_in_website>
875
- <show_in_store>1</show_in_store>
876
- <comment>[Optional]</comment>
877
- </address2>
878
- <zipcode translate="label">
879
- <label>Customer Zipcode</label>
880
- <frontend_type>text</frontend_type>
881
- <sort_order>60</sort_order>
882
- <show_in_default>1</show_in_default>
883
- <show_in_website>1</show_in_website>
884
- <show_in_store>1</show_in_store>
885
- </zipcode>
886
- <city translate="label">
887
- <label>Customer City</label>
888
- <frontend_type>text</frontend_type>
889
- <sort_order>70</sort_order>
890
- <show_in_default>1</show_in_default>
891
- <show_in_website>1</show_in_website>
892
- <show_in_store>1</show_in_store>
893
- </city>
894
- <country translate="label">
895
- <label>Customer Country</label>
896
- <frontend_type>select</frontend_type>
897
- <sort_order>80</sort_order>
898
- <source_model>adminhtml/system_config_source_country</source_model>
899
- <show_in_default>1</show_in_default>
900
- <show_in_website>1</show_in_website>
901
- <show_in_store>1</show_in_store>
902
- </country>
903
- <contactname translate="label">
904
- <label>Customer Contact Name</label>
905
- <frontend_type>text</frontend_type>
906
- <sort_order>90</sort_order>
907
- <show_in_default>1</show_in_default>
908
- <show_in_website>1</show_in_website>
909
- <show_in_store>1</show_in_store>
910
- </contactname>
911
- <email translate="label">
912
- <label>Customer Email</label>
913
- <frontend_type>text</frontend_type>
914
- <sort_order>100</sort_order>
915
- <show_in_default>1</show_in_default>
916
- <show_in_website>1</show_in_website>
917
- <show_in_store>1</show_in_store>
918
- <comment>[Optional]</comment>
919
- </email>
920
- <phone translate="label comment">
921
- <label>Customer Telephone</label>
922
- <frontend_type>text</frontend_type>
923
- <sort_order>110</sort_order>
924
- <show_in_default>1</show_in_default>
925
- <show_in_website>1</show_in_website>
926
- <show_in_store>1</show_in_store>
927
- <comment>[Optional]</comment>
928
- </phone>
929
- <mobilephone translate="label comment">
930
- <label>Customer Mobile</label>
931
- <frontend_type>text</frontend_type>
932
- <sort_order>120</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
- <comment>[Optional]</comment>
937
- </mobilephone>
938
- </fields>
939
- </customerinformation>
940
-
941
- <skybillparam translate="label">
942
- <label>Skybill Parameters for Labels printing</label>
943
- <frontend_type>text</frontend_type>
944
- <sort_order>60</sort_order>
945
- <show_in_default>1</show_in_default>
946
- <show_in_website>1</show_in_website>
947
- <show_in_store>1</show_in_store>
948
- <fields>
949
- <mode translate="label">
950
- <label>Print Mode</label>
951
- <frontend_type>select</frontend_type>
952
- <source_model>chronorelais/config_source_printMode</source_model>
953
- <sort_order>10</sort_order>
954
- <show_in_default>1</show_in_default>
955
- <show_in_website>1</show_in_website>
956
- <show_in_store>1</show_in_store>
957
- <required>1</required>
958
- </mode>
959
- </fields>
960
- </skybillparam>
961
- </groups>
962
- </chronorelais>
963
- </sections>
964
-
965
  </config>
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
+ <source_model>adminhtml/system_config_source_yesno</source_model>
24
+ <sort_order>1</sort_order>
25
+ <show_in_default>1</show_in_default>
26
+ <show_in_website>1</show_in_website>
27
+ <show_in_store>1</show_in_store>
28
+ </active>
29
+ <title translate="label">
30
+ <label>Title</label>
31
+ <frontend_type>text</frontend_type>
32
+ <sort_order>2</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ </title>
37
+ <config translate="label">
38
+ <label>Configuration</label>
39
+ <frontend_model>chronorelais/adminhtml_system_config_form_field_config</frontend_model>
40
+ <comment>{configuration_syntax_help}</comment>
41
+ <frontend_type>textarea</frontend_type>
42
+ <sort_order>3</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ </config>
47
+ <weight_limit translate="label">
48
+ <label>Weight Limit</label>
49
+ <frontend_type>text</frontend_type>
50
+ <comment>in Kg</comment>
51
+ <sort_order>7</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ </weight_limit>
56
+ <quickcost translate="label">
57
+ <label>Quickcost</label>
58
+ <frontend_type>select</frontend_type>
59
+ <comment>No : cost is obtained from your rate grid ; Yes : cost is fetched from URL below</comment>
60
+ <source_model>adminhtml/system_config_source_yesno</source_model>
61
+ <sort_order>10</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>0</show_in_store>
65
+ </quickcost>
66
+ <quickcost_url>
67
+ <label>Quickcost Url</label>
68
+ <frontend_type>text</frontend_type>
69
+ <sort_order>11</sort_order>
70
+ <show_in_default>1</show_in_default>
71
+ <show_in_website>1</show_in_website>
72
+ <show_in_store>0</show_in_store>
73
+ </quickcost_url>
74
+ <free_shipping_enable translate="label">
75
+ <label>Free Shipping on the Amount</label>
76
+ <frontend_type>select</frontend_type>
77
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
78
+ <sort_order>12</sort_order>
79
+ <show_in_default>1</show_in_default>
80
+ <show_in_website>1</show_in_website>
81
+ <show_in_store>1</show_in_store>
82
+ </free_shipping_enable>
83
+ <free_shipping_subtotal translate="label">
84
+ <label>Minimum Amount for Free Shipping</label>
85
+ <frontend_type>text</frontend_type>
86
+ <sort_order>13</sort_order>
87
+ <show_in_default>1</show_in_default>
88
+ <show_in_website>1</show_in_website>
89
+ <show_in_store>0</show_in_store>
90
+ </free_shipping_subtotal>
91
+ <application_fee translate="label">
92
+ <label>Application Fee</label>
93
+ <frontend_type>text</frontend_type>
94
+ <sort_order>14</sort_order>
95
+ <show_in_default>1</show_in_default>
96
+ <show_in_website>1</show_in_website>
97
+ <show_in_store>1</show_in_store>
98
+ </application_fee>
99
+ <handling_fee translate="label">
100
+ <label>Handling Fee</label>
101
+ <frontend_type>text</frontend_type>
102
+ <sort_order>15</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>1</show_in_website>
105
+ <show_in_store>1</show_in_store>
106
+ </handling_fee>
107
+ <logo_url>
108
+ <label>Logo Url</label>
109
+ <frontend_type>text</frontend_type>
110
+ <comment>{logo_ulr_help}</comment>
111
+ <sort_order>18</sort_order>
112
+ <show_in_default>1</show_in_default>
113
+ <show_in_website>1</show_in_website>
114
+ <show_in_store>1</show_in_store>
115
+ </logo_url>
116
+ <debug>
117
+ <label>Debug</label>
118
+ <comment>{debug_help}</comment>
119
+ <frontend_type>text</frontend_type>
120
+ <sort_order>20</sort_order>
121
+ <show_in_default>1</show_in_default>
122
+ <show_in_website>1</show_in_website>
123
+ <show_in_store>1</show_in_store>
124
+ </debug>
125
+ <!--<stop_to_first_match translate="label">
126
+ <label>Stop to first match</label>
127
+ <frontend_type>select</frontend_type>
128
+ <source_model>adminhtml/system_config_source_yesno</source_model>
129
+ <sort_order>22</sort_order>
130
+ <show_in_default>1</show_in_default>
131
+ <show_in_website>1</show_in_website>
132
+ <show_in_store>1</show_in_store>
133
+ </stop_to_first_match>-->
134
+ <deliver_on_saturday translate="label comment">
135
+ <label>Livraison le Samedi</label>
136
+ <comment>If yes has been selected, the option will be available every Thursdays from 6pm to Fridays at 3pm.</comment>
137
+ <frontend_type>select</frontend_type>
138
+ <source_model>adminhtml/system_config_source_yesno</source_model>
139
+ <sort_order>23</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
+ </deliver_on_saturday>
144
+ <!--<showmethod translate="label">
145
+ <label>Show Method if Not Applicable</label>
146
+ <frontend_type>select</frontend_type>
147
+ <sort_order>30</sort_order>
148
+ <frontend_class>shipping-skip-hide</frontend_class>
149
+ <source_model>adminhtml/system_config_source_yesno</source_model>
150
+ <show_in_default>1</show_in_default>
151
+ <show_in_website>1</show_in_website>
152
+ <show_in_store>0</show_in_store>
153
+ </showmethod>
154
+ <specificerrmsg translate="label">
155
+ <label>Displayed Error Message</label>
156
+ <frontend_type>textarea</frontend_type>
157
+ <sort_order>31</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
+ </specificerrmsg>-->
162
+ <sort_order translate="label">
163
+ <label>Sort order</label>
164
+ <frontend_type>text</frontend_type>
165
+ <sort_order>100</sort_order>
166
+ <show_in_default>1</show_in_default>
167
+ <show_in_website>1</show_in_website>
168
+ <show_in_store>1</show_in_store>
169
+ </sort_order>
170
+ </fields>
171
+ </chronopost>
172
+
173
+ <chronoexpress translate="label">
174
+ <label>Chrono Express</label>
175
+ <frontend_type>text</frontend_type>
176
+ <sort_order>21</sort_order>
177
+ <show_in_default>1</show_in_default>
178
+ <show_in_website>1</show_in_website>
179
+ <show_in_store>1</show_in_store>
180
+ <fields>
181
+ <active translate="label">
182
+ <label>Enabled</label>
183
+ <frontend_type>select</frontend_type>
184
+ <source_model>adminhtml/system_config_source_yesno</source_model>
185
+ <sort_order>1</sort_order>
186
+ <show_in_default>1</show_in_default>
187
+ <show_in_website>1</show_in_website>
188
+ <show_in_store>1</show_in_store>
189
+ </active>
190
+ <title translate="label">
191
+ <label>Title</label>
192
+ <frontend_type>text</frontend_type>
193
+ <sort_order>2</sort_order>
194
+ <show_in_default>1</show_in_default>
195
+ <show_in_website>1</show_in_website>
196
+ <show_in_store>1</show_in_store>
197
+ </title>
198
+ <config translate="label">
199
+ <label>Configuration</label>
200
+ <frontend_model>chronorelais/adminhtml_system_config_form_field_config</frontend_model>
201
+ <comment>{configuration_syntax_help}</comment>
202
+ <frontend_type>textarea</frontend_type>
203
+ <sort_order>3</sort_order>
204
+ <show_in_default>1</show_in_default>
205
+ <show_in_website>1</show_in_website>
206
+ <show_in_store>1</show_in_store>
207
+ </config>
208
+ <weight_limit translate="label">
209
+ <label>Weight Limit</label>
210
+ <frontend_type>text</frontend_type>
211
+ <comment>in Kg</comment>
212
+ <sort_order>7</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
+ </weight_limit>
217
+ <quickcost translate="label">
218
+ <label>Quickcost</label>
219
+ <frontend_type>select</frontend_type>
220
+ <comment>No : cost is obtained from your rate grid ; Yes : cost is fetched from URL below</comment>
221
+ <source_model>adminhtml/system_config_source_yesno</source_model>
222
+ <sort_order>10</sort_order>
223
+ <show_in_default>1</show_in_default>
224
+ <show_in_website>1</show_in_website>
225
+ <show_in_store>0</show_in_store>
226
+ </quickcost>
227
+ <quickcost_url>
228
+ <label>Quickcost Url</label>
229
+ <frontend_type>text</frontend_type>
230
+ <sort_order>11</sort_order>
231
+ <show_in_default>1</show_in_default>
232
+ <show_in_website>1</show_in_website>
233
+ <show_in_store>0</show_in_store>
234
+ </quickcost_url>
235
+ <free_shipping_enable translate="label">
236
+ <label>Free Shipping on the Amount</label>
237
+ <frontend_type>select</frontend_type>
238
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
239
+ <sort_order>12</sort_order>
240
+ <show_in_default>1</show_in_default>
241
+ <show_in_website>1</show_in_website>
242
+ <show_in_store>1</show_in_store>
243
+ </free_shipping_enable>
244
+ <free_shipping_subtotal translate="label">
245
+ <label>Minimum Amount for Free Shipping</label>
246
+ <frontend_type>text</frontend_type>
247
+ <sort_order>13</sort_order>
248
+ <show_in_default>1</show_in_default>
249
+ <show_in_website>1</show_in_website>
250
+ <show_in_store>0</show_in_store>
251
+ </free_shipping_subtotal>
252
+ <application_fee translate="label">
253
+ <label>Application Fee</label>
254
+ <frontend_type>text</frontend_type>
255
+ <sort_order>14</sort_order>
256
+ <show_in_default>1</show_in_default>
257
+ <show_in_website>1</show_in_website>
258
+ <show_in_store>1</show_in_store>
259
+ </application_fee>
260
+ <handling_fee translate="label">
261
+ <label>Handling Fee</label>
262
+ <frontend_type>text</frontend_type>
263
+ <sort_order>15</sort_order>
264
+ <show_in_default>1</show_in_default>
265
+ <show_in_website>1</show_in_website>
266
+ <show_in_store>1</show_in_store>
267
+ </handling_fee>
268
+ <logo_url>
269
+ <label>Logo Url</label>
270
+ <frontend_type>text</frontend_type>
271
+ <comment>{logo_ulr_help}</comment>
272
+ <sort_order>18</sort_order>
273
+ <show_in_default>1</show_in_default>
274
+ <show_in_website>1</show_in_website>
275
+ <show_in_store>1</show_in_store>
276
+ </logo_url>
277
+ <debug>
278
+ <label>Debug</label>
279
+ <comment>{debug_help}</comment>
280
+ <frontend_type>text</frontend_type>
281
+ <sort_order>20</sort_order>
282
+ <show_in_default>1</show_in_default>
283
+ <show_in_website>1</show_in_website>
284
+ <show_in_store>1</show_in_store>
285
+ </debug>
286
+ <!--<stop_to_first_match translate="label">
287
+ <label>Stop to first match</label>
288
+ <frontend_type>select</frontend_type>
289
+ <source_model>adminhtml/system_config_source_yesno</source_model>
290
+ <sort_order>22</sort_order>
291
+ <show_in_default>1</show_in_default>
292
+ <show_in_website>1</show_in_website>
293
+ <show_in_store>1</show_in_store>
294
+ </stop_to_first_match>-->
295
+ <!-- deliver_on_saturday not included in chronoexpress only -->
296
+ <!--<showmethod translate="label">
297
+ <label>Show Method if Not Applicable</label>
298
+ <frontend_type>select</frontend_type>
299
+ <sort_order>30</sort_order>
300
+ <frontend_class>shipping-skip-hide</frontend_class>
301
+ <source_model>adminhtml/system_config_source_yesno</source_model>
302
+ <show_in_default>1</show_in_default>
303
+ <show_in_website>1</show_in_website>
304
+ <show_in_store>0</show_in_store>
305
+ </showmethod>
306
+ <specificerrmsg translate="label">
307
+ <label>Displayed Error Message</label>
308
+ <frontend_type>textarea</frontend_type>
309
+ <sort_order>31</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
+ </specificerrmsg>-->
314
+ <sort_order translate="label">
315
+ <label>Sort order</label>
316
+ <frontend_type>text</frontend_type>
317
+ <sort_order>100</sort_order>
318
+ <show_in_default>1</show_in_default>
319
+ <show_in_website>1</show_in_website>
320
+ <show_in_store>1</show_in_store>
321
+ </sort_order>
322
+ </fields>
323
+ </chronoexpress>
324
+
325
+ <chronorelais translate="label">
326
+ <label>Chrono Relais</label>
327
+ <frontend_type>text</frontend_type>
328
+ <sort_order>22</sort_order>
329
+ <show_in_default>1</show_in_default>
330
+ <show_in_website>1</show_in_website>
331
+ <show_in_store>1</show_in_store>
332
+ <fields>
333
+ <active translate="label">
334
+ <label>Enabled</label>
335
+ <frontend_type>select</frontend_type>
336
+ <source_model>adminhtml/system_config_source_yesno</source_model>
337
+ <sort_order>1</sort_order>
338
+ <show_in_default>1</show_in_default>
339
+ <show_in_website>1</show_in_website>
340
+ <show_in_store>1</show_in_store>
341
+ </active>
342
+ <title translate="label">
343
+ <label>Title</label>
344
+ <frontend_type>text</frontend_type>
345
+ <sort_order>2</sort_order>
346
+ <show_in_default>1</show_in_default>
347
+ <show_in_website>1</show_in_website>
348
+ <show_in_store>1</show_in_store>
349
+ </title>
350
+ <config translate="label">
351
+ <label>Configuration</label>
352
+ <frontend_model>chronorelais/adminhtml_system_config_form_field_config</frontend_model>
353
+ <comment>{configuration_syntax_help}</comment>
354
+ <frontend_type>textarea</frontend_type>
355
+ <sort_order>3</sort_order>
356
+ <show_in_default>1</show_in_default>
357
+ <show_in_website>1</show_in_website>
358
+ <show_in_store>1</show_in_store>
359
+ </config>
360
+ <weight_limit translate="label">
361
+ <label>Weight Limit</label>
362
+ <frontend_type>text</frontend_type>
363
+ <comment>in Kg</comment>
364
+ <sort_order>7</sort_order>
365
+ <show_in_default>1</show_in_default>
366
+ <show_in_website>1</show_in_website>
367
+ <show_in_store>1</show_in_store>
368
+ </weight_limit>
369
+ <quickcost translate="label">
370
+ <label>Quickcost</label>
371
+ <frontend_type>select</frontend_type>
372
+ <comment>No : cost is obtained from your rate grid ; Yes : cost is fetched from URL below</comment>
373
+ <source_model>adminhtml/system_config_source_yesno</source_model>
374
+ <sort_order>10</sort_order>
375
+ <show_in_default>1</show_in_default>
376
+ <show_in_website>1</show_in_website>
377
+ <show_in_store>0</show_in_store>
378
+ </quickcost>
379
+ <quickcost_url>
380
+ <label>Quickcost Url</label>
381
+ <frontend_type>text</frontend_type>
382
+ <sort_order>11</sort_order>
383
+ <show_in_default>1</show_in_default>
384
+ <show_in_website>1</show_in_website>
385
+ <show_in_store>0</show_in_store>
386
+ </quickcost_url>
387
+ <free_shipping_enable translate="label">
388
+ <label>Free Shipping with Minimum Order Amount</label>
389
+ <frontend_type>select</frontend_type>
390
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
391
+ <sort_order>12</sort_order>
392
+ <show_in_default>1</show_in_default>
393
+ <show_in_website>1</show_in_website>
394
+ <show_in_store>1</show_in_store>
395
+ </free_shipping_enable>
396
+ <free_shipping_subtotal translate="label">
397
+ <label>Minimum Order Amount for Free Shipping</label>
398
+ <frontend_type>text</frontend_type>
399
+ <sort_order>13</sort_order>
400
+ <show_in_default>1</show_in_default>
401
+ <show_in_website>1</show_in_website>
402
+ <show_in_store>1</show_in_store>
403
+ </free_shipping_subtotal>
404
+ <application_fee translate="label">
405
+ <label>Application Fee</label>
406
+ <frontend_type>text</frontend_type>
407
+ <sort_order>14</sort_order>
408
+ <show_in_default>1</show_in_default>
409
+ <show_in_website>1</show_in_website>
410
+ <show_in_store>1</show_in_store>
411
+ </application_fee>
412
+ <handling_fee translate="label">
413
+ <label>Handling Fee</label>
414
+ <frontend_type>text</frontend_type>
415
+ <sort_order>15</sort_order>
416
+ <show_in_default>1</show_in_default>
417
+ <show_in_website>1</show_in_website>
418
+ <show_in_store>1</show_in_store>
419
+ </handling_fee>
420
+ <logo_url>
421
+ <label>Logo Url</label>
422
+ <frontend_type>text</frontend_type>
423
+ <comment>{logo_ulr_help}</comment>
424
+ <sort_order>18</sort_order>
425
+ <show_in_default>1</show_in_default>
426
+ <show_in_website>1</show_in_website>
427
+ <show_in_store>1</show_in_store>
428
+ </logo_url>
429
+ <debug>
430
+ <label>Debug</label>
431
+ <comment>{debug_help}</comment>
432
+ <frontend_type>text</frontend_type>
433
+ <sort_order>20</sort_order>
434
+ <show_in_default>1</show_in_default>
435
+ <show_in_website>1</show_in_website>
436
+ <show_in_store>1</show_in_store>
437
+ </debug>
438
+ <!--<stop_to_first_match translate="label">
439
+ <label>Stop to first match</label>
440
+ <frontend_type>select</frontend_type>
441
+ <source_model>adminhtml/system_config_source_yesno</source_model>
442
+ <sort_order>22</sort_order>
443
+ <show_in_default>1</show_in_default>
444
+ <show_in_website>1</show_in_website>
445
+ <show_in_store>1</show_in_store>
446
+ </stop_to_first_match>-->
447
+ <deliver_on_saturday translate="label comment">
448
+ <label>Livraison le Samedi</label>
449
+ <comment>If yes has been selected, the option will be available every Thursdays from 6pm to Fridays at 3pm.</comment>
450
+ <frontend_type>select</frontend_type>
451
+ <source_model>adminhtml/system_config_source_yesno</source_model>
452
+ <sort_order>23</sort_order>
453
+ <show_in_default>1</show_in_default>
454
+ <show_in_website>1</show_in_website>
455
+ <show_in_store>1</show_in_store>
456
+ </deliver_on_saturday>
457
+ <!--<showmethod translate="label">
458
+ <label>Show Method if Not Applicable</label>
459
+ <frontend_type>select</frontend_type>
460
+ <sort_order>30</sort_order>
461
+ <frontend_class>shipping-skip-hide</frontend_class>
462
+ <source_model>adminhtml/system_config_source_yesno</source_model>
463
+ <show_in_default>1</show_in_default>
464
+ <show_in_website>1</show_in_website>
465
+ <show_in_store>0</show_in_store>
466
+ </showmethod>
467
+ <specificerrmsg translate="label">
468
+ <label>Displayed Error Message</label>
469
+ <frontend_type>textarea</frontend_type>
470
+ <sort_order>31</sort_order>
471
+ <show_in_default>1</show_in_default>
472
+ <show_in_website>1</show_in_website>
473
+ <show_in_store>1</show_in_store>
474
+ </specificerrmsg>-->
475
+ <sort_order translate="label">
476
+ <label>Sort order</label>
477
+ <frontend_type>text</frontend_type>
478
+ <sort_order>100</sort_order>
479
+ <show_in_default>1</show_in_default>
480
+ <show_in_website>1</show_in_website>
481
+ <show_in_store>1</show_in_store>
482
+ </sort_order>
483
+ </fields>
484
+ </chronorelais>
485
+ </groups>
486
+ </carriers>
487
+ </sections>
488
+
489
+ <sections>
490
+ <chronorelais>
491
+ <label>Chronopost Settings</label>
492
+ <tab>chronopost</tab>
493
+ <frontend_type>text</frontend_type>
494
+ <sort_order>2000</sort_order>
495
+ <show_in_default>1</show_in_default>
496
+ <show_in_website>1</show_in_website>
497
+ <show_in_store>1</show_in_store>
498
+ <groups>
499
+ <shipping translate="label">
500
+ <label>General</label>
501
+ <frontend_type>text</frontend_type>
502
+ <sort_order>10</sort_order>
503
+ <show_in_default>1</show_in_default>
504
+ <show_in_website>1</show_in_website>
505
+ <show_in_store>1</show_in_store>
506
+ <fields>
507
+ <account_number translate="label">
508
+ <label>N° de compte Chronopost</label>
509
+ <frontend_type>text</frontend_type>
510
+ <sort_order>7</sort_order>
511
+ <show_in_default>1</show_in_default>
512
+ <show_in_website>1</show_in_website>
513
+ <show_in_store>1</show_in_store>
514
+ </account_number>
515
+ <sub_account_number translate="label">
516
+ <label>Sous-compte</label>
517
+ <comment>must be 3 digits or empty</comment>
518
+ <frontend_type>text</frontend_type>
519
+ <sort_order>8</sort_order>
520
+ <show_in_default>1</show_in_default>
521
+ <show_in_website>1</show_in_website>
522
+ <show_in_store>1</show_in_store>
523
+ </sub_account_number>
524
+ <account_pass translate="label">
525
+ <label>Mot de passe Chronopost</label>
526
+ <frontend_type>text</frontend_type>
527
+ <sort_order>9</sort_order>
528
+ <show_in_default>1</show_in_default>
529
+ <show_in_website>1</show_in_website>
530
+ <show_in_store>1</show_in_store>
531
+ </account_pass>
532
+ <google_map_api translate="label">
533
+ <label>Google Map API Key</label>
534
+ <frontend_type>text</frontend_type>
535
+ <sort_order>10</sort_order>
536
+ <show_in_default>1</show_in_default>
537
+ <show_in_website>1</show_in_website>
538
+ <show_in_store>1</show_in_store>
539
+ </google_map_api>
540
+ <tracking_view_url translate="label">
541
+ <label>Tracking URL</label>
542
+ <comment>For English language, replace fr_FR with en_GB in the above url</comment>
543
+ <frontend_type>text</frontend_type>
544
+ <sort_order>20</sort_order>
545
+ <show_in_default>1</show_in_default>
546
+ <show_in_website>1</show_in_website>
547
+ <show_in_store>1</show_in_store>
548
+ </tracking_view_url>
549
+
550
+ </fields>
551
+ </shipping>
552
+ <export_css translate="label">
553
+ <label>Export Configuration CSS</label>
554
+ <frontend_type>text</frontend_type>
555
+ <sort_order>20</sort_order>
556
+ <show_in_default>1</show_in_default>
557
+ <show_in_website>1</show_in_website>
558
+ <show_in_store>1</show_in_store>
559
+ <fields>
560
+ <file_extension translate="label">
561
+ <label>File Extension</label>
562
+ <frontend_type>select</frontend_type>
563
+ <source_model>chronorelais/config_source_fileExtension</source_model>
564
+ <sort_order>10</sort_order>
565
+ <show_in_default>1</show_in_default>
566
+ <show_in_website>1</show_in_website>
567
+ <show_in_store>1</show_in_store>
568
+ </file_extension>
569
+ <file_charset translate="label">
570
+ <label>File Charset</label>
571
+ <frontend_type>select</frontend_type>
572
+ <source_model>chronorelais/config_source_fileCharset</source_model>
573
+ <sort_order>20</sort_order>
574
+ <show_in_default>1</show_in_default>
575
+ <show_in_website>1</show_in_website>
576
+ <show_in_store>1</show_in_store>
577
+ </file_charset>
578
+ <endofline_character translate="label">
579
+ <label>End Of Line Character</label>
580
+ <frontend_type>select</frontend_type>
581
+ <source_model>chronorelais/config_source_endOfLineCharacter</source_model>
582
+ <sort_order>30</sort_order>
583
+ <show_in_default>1</show_in_default>
584
+ <show_in_website>1</show_in_website>
585
+ <show_in_store>1</show_in_store>
586
+ </endofline_character>
587
+ <field_delimiter translate="label">
588
+ <label>Field Delimiter</label>
589
+ <frontend_type>select</frontend_type>
590
+ <source_model>chronorelais/config_source_fieldDelimiter</source_model>
591
+ <sort_order>40</sort_order>
592
+ <show_in_default>1</show_in_default>
593
+ <show_in_website>1</show_in_website>
594
+ <show_in_store>1</show_in_store>
595
+ </field_delimiter>
596
+ <field_separator translate="label">
597
+ <label>Field Separator</label>
598
+ <frontend_type>select</frontend_type>
599
+ <source_model>chronorelais/config_source_fieldSeparator</source_model>
600
+ <sort_order>50</sort_order>
601
+ <show_in_default>1</show_in_default>
602
+ <show_in_website>1</show_in_website>
603
+ <show_in_store>1</show_in_store>
604
+ </field_separator>
605
+ </fields>
606
+ </export_css>
607
+ <export_cso translate="label">
608
+ <label>Export Configuration CSO</label>
609
+ <frontend_type>text</frontend_type>
610
+ <sort_order>21</sort_order>
611
+ <show_in_default>1</show_in_default>
612
+ <show_in_website>1</show_in_website>
613
+ <show_in_store>1</show_in_store>
614
+ <fields>
615
+ <file_extension translate="label">
616
+ <label>File Extension</label>
617
+ <frontend_type>select</frontend_type>
618
+ <source_model>chronorelais/config_source_fileExtension</source_model>
619
+ <sort_order>10</sort_order>
620
+ <show_in_default>1</show_in_default>
621
+ <show_in_website>1</show_in_website>
622
+ <show_in_store>1</show_in_store>
623
+ </file_extension>
624
+ <file_charset translate="label">
625
+ <label>File Charset</label>
626
+ <frontend_type>select</frontend_type>
627
+ <source_model>chronorelais/config_source_fileCharset</source_model>
628
+ <sort_order>20</sort_order>
629
+ <show_in_default>1</show_in_default>
630
+ <show_in_website>1</show_in_website>
631
+ <show_in_store>1</show_in_store>
632
+ </file_charset>
633
+ <endofline_character translate="label">
634
+ <label>End Of Line Character</label>
635
+ <frontend_type>select</frontend_type>
636
+ <source_model>chronorelais/config_source_endOfLineCharacter</source_model>
637
+ <sort_order>30</sort_order>
638
+ <show_in_default>1</show_in_default>
639
+ <show_in_website>1</show_in_website>
640
+ <show_in_store>1</show_in_store>
641
+ </endofline_character>
642
+ <field_delimiter translate="label">
643
+ <label>Field Delimiter</label>
644
+ <frontend_type>select</frontend_type>
645
+ <source_model>chronorelais/config_source_fieldDelimiter</source_model>
646
+ <sort_order>40</sort_order>
647
+ <show_in_default>1</show_in_default>
648
+ <show_in_website>1</show_in_website>
649
+ <show_in_store>1</show_in_store>
650
+ </field_delimiter>
651
+ <field_separator translate="label">
652
+ <label>Field Separator</label>
653
+ <frontend_type>select</frontend_type>
654
+ <source_model>chronorelais/config_source_fieldSeparator</source_model>
655
+ <sort_order>50</sort_order>
656
+ <show_in_default>1</show_in_default>
657
+ <show_in_website>1</show_in_website>
658
+ <show_in_store>1</show_in_store>
659
+ </field_separator>
660
+ </fields>
661
+ </export_cso>
662
+ <import translate="label">
663
+ <label>Import Configuration</label>
664
+ <frontend_type>text</frontend_type>
665
+ <sort_order>30</sort_order>
666
+ <show_in_default>1</show_in_default>
667
+ <show_in_website>1</show_in_website>
668
+ <show_in_store>1</show_in_store>
669
+ <fields>
670
+ <default_tracking_title translate="label comment">
671
+ <label>Default Tracking Title</label>
672
+ <frontend_type>text</frontend_type>
673
+ <sort_order>10</sort_order>
674
+ <show_in_default>1</show_in_default>
675
+ <show_in_website>1</show_in_website>
676
+ <show_in_store>1</show_in_store>
677
+ <comment>This value can be changed in the import form</comment>
678
+ </default_tracking_title>
679
+ <send_email translate="label comment">
680
+ <label>Send an e-mail</label>
681
+ <frontend_type>select</frontend_type>
682
+ <source_model>adminhtml/system_config_source_yesno</source_model>
683
+ <sort_order>20</sort_order>
684
+ <show_in_default>1</show_in_default>
685
+ <show_in_website>1</show_in_website>
686
+ <show_in_store>1</show_in_store>
687
+ <comment>Send shipping confirmation to the customer</comment>
688
+ </send_email>
689
+ <shipping_comment translate="label comment">
690
+ <label>Shipping Comment</label>
691
+ <frontend_type>text</frontend_type>
692
+ <sort_order>30</sort_order>
693
+ <show_in_default>1</show_in_default>
694
+ <show_in_website>1</show_in_website>
695
+ <show_in_store>1</show_in_store>
696
+ <comment>Internal comment, can be left empty</comment>
697
+ </shipping_comment>
698
+ <include_comment translate="label comment">
699
+ <label>Include comment into e-mail</label>
700
+ <frontend_type>select</frontend_type>
701
+ <source_model>adminhtml/system_config_source_yesno</source_model>
702
+ <sort_order>40</sort_order>
703
+ <show_in_default>1</show_in_default>
704
+ <show_in_website>1</show_in_website>
705
+ <show_in_store>1</show_in_store>
706
+ <comment>Only applies if the shipping comment is set</comment>
707
+ </include_comment>
708
+ </fields>
709
+ </import>
710
+
711
+ <shipperinformation translate="label">
712
+ <label>Shipper Information for Labels printing</label>
713
+ <frontend_type>text</frontend_type>
714
+ <sort_order>40</sort_order>
715
+ <show_in_default>1</show_in_default>
716
+ <show_in_website>1</show_in_website>
717
+ <show_in_store>1</show_in_store>
718
+ <fields>
719
+ <civility translate="label">
720
+ <label>Shipper Civility</label>
721
+ <frontend_type>select</frontend_type>
722
+ <source_model>chronorelais/config_source_civility</source_model>
723
+ <sort_order>10</sort_order>
724
+ <show_in_default>1</show_in_default>
725
+ <show_in_website>1</show_in_website>
726
+ <show_in_store>1</show_in_store>
727
+ </civility>
728
+ <name translate="label comment">
729
+ <label>Shipper Name</label>
730
+ <frontend_type>text</frontend_type>
731
+ <sort_order>20</sort_order>
732
+ <show_in_default>1</show_in_default>
733
+ <show_in_website>1</show_in_website>
734
+ <show_in_store>1</show_in_store>
735
+ <comment>Company name</comment>
736
+ </name>
737
+ <name2 translate="label comment">
738
+ <label>Shipper Name2</label>
739
+ <frontend_type>text</frontend_type>
740
+ <sort_order>30</sort_order>
741
+ <show_in_default>1</show_in_default>
742
+ <show_in_website>1</show_in_website>
743
+ <show_in_store>1</show_in_store>
744
+ <comment>[Optional]</comment>
745
+ </name2>
746
+ <address1 translate="label">
747
+ <label>Shipper Address1</label>
748
+ <frontend_type>text</frontend_type>
749
+ <sort_order>40</sort_order>
750
+ <show_in_default>1</show_in_default>
751
+ <show_in_website>1</show_in_website>
752
+ <show_in_store>1</show_in_store>
753
+ </address1>
754
+ <address2 translate="label comment">
755
+ <label>Shipper Address2</label>
756
+ <frontend_type>text</frontend_type>
757
+ <sort_order>50</sort_order>
758
+ <show_in_default>1</show_in_default>
759
+ <show_in_website>1</show_in_website>
760
+ <show_in_store>1</show_in_store>
761
+ <comment>[Optional]</comment>
762
+ </address2>
763
+ <zipcode translate="label">
764
+ <label>Shipper Zipcode</label>
765
+ <frontend_type>text</frontend_type>
766
+ <sort_order>60</sort_order>
767
+ <show_in_default>1</show_in_default>
768
+ <show_in_website>1</show_in_website>
769
+ <show_in_store>1</show_in_store>
770
+ </zipcode>
771
+ <city translate="label">
772
+ <label>Shipper City</label>
773
+ <frontend_type>text</frontend_type>
774
+ <sort_order>70</sort_order>
775
+ <show_in_default>1</show_in_default>
776
+ <show_in_website>1</show_in_website>
777
+ <show_in_store>1</show_in_store>
778
+ </city>
779
+ <country translate="label">
780
+ <label>Shipper Country</label>
781
+ <frontend_type>select</frontend_type>
782
+ <sort_order>80</sort_order>
783
+ <source_model>adminhtml/system_config_source_country</source_model>
784
+ <show_in_default>1</show_in_default>
785
+ <show_in_website>1</show_in_website>
786
+ <show_in_store>1</show_in_store>
787
+ </country>
788
+ <contactname translate="label">
789
+ <label>Shipper Contact Name</label>
790
+ <frontend_type>text</frontend_type>
791
+ <sort_order>90</sort_order>
792
+ <show_in_default>1</show_in_default>
793
+ <show_in_website>1</show_in_website>
794
+ <show_in_store>1</show_in_store>
795
+ </contactname>
796
+ <email translate="label">
797
+ <label>Shipper Email</label>
798
+ <frontend_type>text</frontend_type>
799
+ <sort_order>100</sort_order>
800
+ <show_in_default>1</show_in_default>
801
+ <show_in_website>1</show_in_website>
802
+ <show_in_store>1</show_in_store>
803
+ <comment>[Optional]</comment>
804
+ </email>
805
+ <phone translate="label comment">
806
+ <label>Shipper Telephone</label>
807
+ <frontend_type>text</frontend_type>
808
+ <sort_order>110</sort_order>
809
+ <show_in_default>1</show_in_default>
810
+ <show_in_website>1</show_in_website>
811
+ <show_in_store>1</show_in_store>
812
+ <comment>[Optional]</comment>
813
+ </phone>
814
+ <mobilephone translate="label comment">
815
+ <label>Shipper Mobile</label>
816
+ <frontend_type>text</frontend_type>
817
+ <sort_order>120</sort_order>
818
+ <show_in_default>1</show_in_default>
819
+ <show_in_website>1</show_in_website>
820
+ <show_in_store>1</show_in_store>
821
+ <comment>[Optional]</comment>
822
+ </mobilephone>
823
+ </fields>
824
+ </shipperinformation>
825
+
826
+ <customerinformation translate="label">
827
+ <label>Chronopost Customer Account Information for Labels printing</label>
828
+ <frontend_type>text</frontend_type>
829
+ <sort_order>50</sort_order>
830
+ <show_in_default>1</show_in_default>
831
+ <show_in_website>1</show_in_website>
832
+ <show_in_store>1</show_in_store>
833
+ <fields>
834
+ <civility translate="label">
835
+ <label>Customer Civility</label>
836
+ <frontend_type>select</frontend_type>
837
+ <source_model>chronorelais/config_source_civility</source_model>
838
+ <sort_order>10</sort_order>
839
+ <show_in_default>1</show_in_default>
840
+ <show_in_website>1</show_in_website>
841
+ <show_in_store>1</show_in_store>
842
+ </civility>
843
+ <name translate="label comment">
844
+ <label>Customer Name </label>
845
+ <frontend_type>text</frontend_type>
846
+ <sort_order>20</sort_order>
847
+ <show_in_default>1</show_in_default>
848
+ <show_in_website>1</show_in_website>
849
+ <show_in_store>1</show_in_store>
850
+ <comment>Company name</comment>
851
+ </name>
852
+ <name2 translate="label comment">
853
+ <label>Customer Name2</label>
854
+ <frontend_type>text</frontend_type>
855
+ <sort_order>30</sort_order>
856
+ <show_in_default>1</show_in_default>
857
+ <show_in_website>1</show_in_website>
858
+ <show_in_store>1</show_in_store>
859
+ <comment>[Optional]</comment>
860
+ </name2>
861
+ <address1 translate="label">
862
+ <label>Customer Address1</label>
863
+ <frontend_type>text</frontend_type>
864
+ <sort_order>40</sort_order>
865
+ <show_in_default>1</show_in_default>
866
+ <show_in_website>1</show_in_website>
867
+ <show_in_store>1</show_in_store>
868
+ </address1>
869
+ <address2 translate="label comment">
870
+ <label>Customer Address2</label>
871
+ <frontend_type>text</frontend_type>
872
+ <sort_order>50</sort_order>
873
+ <show_in_default>1</show_in_default>
874
+ <show_in_website>1</show_in_website>
875
+ <show_in_store>1</show_in_store>
876
+ <comment>[Optional]</comment>
877
+ </address2>
878
+ <zipcode translate="label">
879
+ <label>Customer Zipcode</label>
880
+ <frontend_type>text</frontend_type>
881
+ <sort_order>60</sort_order>
882
+ <show_in_default>1</show_in_default>
883
+ <show_in_website>1</show_in_website>
884
+ <show_in_store>1</show_in_store>
885
+ </zipcode>
886
+ <city translate="label">
887
+ <label>Customer City</label>
888
+ <frontend_type>text</frontend_type>
889
+ <sort_order>70</sort_order>
890
+ <show_in_default>1</show_in_default>
891
+ <show_in_website>1</show_in_website>
892
+ <show_in_store>1</show_in_store>
893
+ </city>
894
+ <country translate="label">
895
+ <label>Customer Country</label>
896
+ <frontend_type>select</frontend_type>
897
+ <sort_order>80</sort_order>
898
+ <source_model>adminhtml/system_config_source_country</source_model>
899
+ <show_in_default>1</show_in_default>
900
+ <show_in_website>1</show_in_website>
901
+ <show_in_store>1</show_in_store>
902
+ </country>
903
+ <contactname translate="label">
904
+ <label>Customer Contact Name</label>
905
+ <frontend_type>text</frontend_type>
906
+ <sort_order>90</sort_order>
907
+ <show_in_default>1</show_in_default>
908
+ <show_in_website>1</show_in_website>
909
+ <show_in_store>1</show_in_store>
910
+ </contactname>
911
+ <email translate="label">
912
+ <label>Customer Email</label>
913
+ <frontend_type>text</frontend_type>
914
+ <sort_order>100</sort_order>
915
+ <show_in_default>1</show_in_default>
916
+ <show_in_website>1</show_in_website>
917
+ <show_in_store>1</show_in_store>
918
+ <comment>[Optional]</comment>
919
+ </email>
920
+ <phone translate="label comment">
921
+ <label>Customer Telephone</label>
922
+ <frontend_type>text</frontend_type>
923
+ <sort_order>110</sort_order>
924
+ <show_in_default>1</show_in_default>
925
+ <show_in_website>1</show_in_website>
926
+ <show_in_store>1</show_in_store>
927
+ <comment>[Optional]</comment>
928
+ </phone>
929
+ <mobilephone translate="label comment">
930
+ <label>Customer Mobile</label>
931
+ <frontend_type>text</frontend_type>
932
+ <sort_order>120</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
+ <comment>[Optional]</comment>
937
+ </mobilephone>
938
+ </fields>
939
+ </customerinformation>
940
+
941
+ <skybillparam translate="label">
942
+ <label>Skybill Parameters for Labels printing</label>
943
+ <frontend_type>text</frontend_type>
944
+ <sort_order>60</sort_order>
945
+ <show_in_default>1</show_in_default>
946
+ <show_in_website>1</show_in_website>
947
+ <show_in_store>1</show_in_store>
948
+ <fields>
949
+ <mode translate="label">
950
+ <label>Print Mode</label>
951
+ <frontend_type>select</frontend_type>
952
+ <source_model>chronorelais/config_source_printMode</source_model>
953
+ <sort_order>10</sort_order>
954
+ <show_in_default>1</show_in_default>
955
+ <show_in_website>1</show_in_website>
956
+ <show_in_store>1</show_in_store>
957
+ <required>1</required>
958
+ </mode>
959
+ </fields>
960
+ </skybillparam>
961
+ </groups>
962
+ </chronorelais>
963
+ </sections>
964
+
965
  </config>
app/design/frontend/default/default/layout/chronorelais.xml CHANGED
@@ -1,44 +1,60 @@
1
- <?xml version="1.0"?>
2
- <layout version="0.1.0">
3
- <default>
4
- <reference name="head">
5
- <action method="addItem"><type>skin_css</type><name>chronorelais/chronorelais.css</name></action>
6
- </reference>
7
- </default>
8
-
9
- <checkout_onepage_index>
10
- <reference name="checkout.onepage.shipping_method">
11
- <action method="setTemplate"><template>chronorelais/checkout/onepage/shipping_method.phtml</template></action>
12
- <block type="checkout/onepage_shipping_method_available" name="checkout.onepage.shipping_method.available" as="available" template="chronorelais/checkout/onepage/shipping_method/available.phtml">
13
- <block type="chronorelais/checkout_onepage_shipping_method_chronorelais" name="checkout.onepage.shipping_method.chronorelais" as="relaislist" template="chronorelais/checkout/onepage/shipping_method/chronorelais.phtml"/>
14
- </block>
15
- </reference>
16
- </checkout_onepage_index>
17
-
18
- <checkout_onepage_shippingmethod>
19
- <remove name="right"/>
20
- <remove name="left"/>
21
- <block type="checkout/onepage_shipping_method_available" name="root" output="toHtml" template="chronorelais/checkout/onepage/shipping_method/available.phtml">
22
- <!--<block type="checkout/onepage_shipping_method_chronorelais" name="checkout.onepage.shipping_method.chronorelais" as="relaislist" template="chronorelais/checkout/onepage/shipping_method/chronorelais.phtml"/>-->
23
- </block>
24
- </checkout_onepage_shippingmethod>
25
-
26
- <checkout_onepage_shippingchronorelais>
27
- <remove name="right"/>
28
- <remove name="left"/>
29
- <block type="chronorelais/checkout_onepage_shipping_method_chronorelais" name="root" output="toHtml" template="chronorelais/checkout/onepage/shipping_method/chronorelais.phtml"/>
30
- </checkout_onepage_shippingchronorelais>
31
-
32
- <customer_account_index>
33
- <reference name="customer_account_dashboard">
34
- <block type="sales/order_recent" name="customer_account_dashboard_top" as="top" template="chronorelais/sales/order/recent.phtml"/>
35
- </reference>
36
- </customer_account_index>
37
-
38
- <sales_order_history>
39
- <reference name="sales.order.history">
40
- <action method="setTemplate"><template>chronorelais/sales/order/history.phtml</template></action>
41
- </reference>
42
- </sales_order_history>
43
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  </layout>
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addItem"><type>skin_css</type><name>chronorelais/chronorelais.css</name></action>
6
+ </reference>
7
+ </default>
8
+
9
+ <checkout_onepage_index>
10
+ <reference name="checkout.onepage.shipping_method">
11
+ <action method="setTemplate"><template>chronorelais/checkout/onepage/shipping_method.phtml</template></action>
12
+ <block type="checkout/onepage_shipping_method_available" name="checkout.onepage.shipping_method.available" as="available" template="chronorelais/checkout/onepage/shipping_method/available.phtml">
13
+ <block type="chronorelais/checkout_onepage_shipping_method_chronorelais" name="checkout.onepage.shipping_method.chronorelais" as="relaislist" template="chronorelais/checkout/onepage/shipping_method/chronorelais.phtml"/>
14
+ </block>
15
+ </reference>
16
+ </checkout_onepage_index>
17
+
18
+ <!-- -->
19
+ <checkout_multishipping_shipping>
20
+ <update handle="checkout_multishipping"/>
21
+ <reference name="checkout_shipping">
22
+ <action method="setTemplate"><template>chronorelais/checkout/multishipping/shipping.phtml</template></action>
23
+ <block type="chronorelais/checkout_multishipping_shipping_method_chronorelais" name="checkout.multishipping.shipping_method.chronorelais" as="relaislist" template="chronorelais/checkout/multishipping/shipping_method/chronorelais.phtml"/>
24
+ </reference>
25
+ </checkout_multishipping_shipping>
26
+ <!-- -->
27
+
28
+ <checkout_onepage_shippingmethod>
29
+ <remove name="right"/>
30
+ <remove name="left"/>
31
+ <block type="checkout/onepage_shipping_method_available" name="root" output="toHtml" template="chronorelais/checkout/onepage/shipping_method/available.phtml">
32
+ <!--<block type="checkout/onepage_shipping_method_chronorelais" name="checkout.onepage.shipping_method.chronorelais" as="relaislist" template="chronorelais/checkout/onepage/shipping_method/chronorelais.phtml"/>-->
33
+ </block>
34
+ </checkout_onepage_shippingmethod>
35
+
36
+ <checkout_onepage_shippingchronorelais>
37
+ <remove name="right"/>
38
+ <remove name="left"/>
39
+ <block type="chronorelais/checkout_onepage_shipping_method_chronorelais" name="root" output="toHtml" template="chronorelais/checkout/onepage/shipping_method/chronorelais.phtml"/>
40
+ </checkout_onepage_shippingchronorelais>
41
+
42
+ <checkout_multishipping_shippingchronorelais>
43
+ <remove name="right"/>
44
+ <remove name="left"/>
45
+ <block type="chronorelais/checkout_multishipping_shipping_method_chronorelais" name="root" output="toHtml" template="chronorelais/checkout/multishipping/shipping_method/chronorelais.phtml"/>
46
+ </checkout_multishipping_shippingchronorelais>
47
+
48
+ <customer_account_index>
49
+ <reference name="customer_account_dashboard">
50
+ <block type="sales/order_recent" name="customer_account_dashboard_top" as="top" template="chronorelais/sales/order/recent.phtml"/>
51
+ </reference>
52
+ </customer_account_index>
53
+
54
+ <sales_order_history>
55
+ <reference name="sales.order.history">
56
+ <action method="setTemplate"><template>chronorelais/sales/order/history.phtml</template></action>
57
+ </reference>
58
+ </sales_order_history>
59
+
60
  </layout>
app/design/frontend/default/default/template/chronorelais/checkout/multishipping/shipping.phtml ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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 design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Multishipping checkout shipping template
30
+ *
31
+ * @see Mage_Checkout_Block_Multishipping_Shipping
32
+ */
33
+ ?>
34
+ <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=<?php echo Mage::helper('chronorelais')->getConfigurationGoogleMapAPIKey()?>" type="text/javascript"></script>
35
+ <script type="text/javascript" src="<?php echo $this->getSkinUrl('chronorelais/chronorelaismap.js') ?>"></script>
36
+ <script type="text/javascript">
37
+ //<![CDATA[
38
+ var Picto_Chrono_Relais = '<?php echo $this->getSkinUrl('chronorelais/Picto_Chrono_Relais.png')?>';
39
+ var Home_Chrono_Icon = '<?php echo $this->getSkinUrl('chronorelais/home.png')?>';
40
+ //]]>
41
+ </script>
42
+
43
+ <div class="multiple-checkout">
44
+ <div class="page-title">
45
+ <h1><?php echo $this->__('Select Shipping Method') ?></h1>
46
+ </div>
47
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
48
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="shipping_method_form">
49
+ <?php foreach ($this->getAddresses() as $_index => $_address): ?>
50
+ <div class="col2-set">
51
+ <h2 class="legend"><?php echo $this->__('Address %s of %s', ($_index+1), $this->getAddressCount()) ?></h2>
52
+ <div class="col-1 col-narrow">
53
+ <div class="box">
54
+ <div class="box-title">
55
+ <h3><?php echo $this->__('Shipping To') ?> <span class="separator">|</span> <a href="<?php echo $this->getAddressEditUrl($_address) ?>"><?php echo $this->__('Change') ?></a></h3>
56
+ </div>
57
+ <div class="box-content">
58
+ <address><?php echo $_address->format('html') ?></address>
59
+ </div>
60
+ </div>
61
+ <div class="box box-sp-methods">
62
+ <div class="pointer"></div>
63
+ <div class="box-title">
64
+ <h3><?php echo $this->__('Shipping Method') ?></h3>
65
+ </div>
66
+ <div class="box-content">
67
+ <?php if (!($_shippingRateGroups = $this->getShippingRates($_address))): ?>
68
+ <p><?php echo $this->__('Sorry, no quotes are available for this order at this time.') ?></p>
69
+ <?php else: ?>
70
+ <dl class="sp-methods">
71
+ <?php $_sole = count($_shippingRateGroups) == 1; foreach ($_shippingRateGroups as $code => $_rates): ?>
72
+ <dt><?php echo $this->getCarrierName($code) ?></dt>
73
+ <dd>
74
+ <ul>
75
+ <?php $_sole = $_sole && count($_rates) == 1; foreach ($_rates as $_rate): ?>
76
+ <li<?php if ($_rate->getErrorMessage()) echo ' class="error-msg"' ?>>
77
+ <?php if ($_rate->getErrorMessage()): ?>
78
+ <?php echo $_rate->getCarrierTitle() ?>: <?php echo $_rate->getErrorMessage() ?>
79
+ <?php else: ?>
80
+ <?php /*if ($_sole) : ?>
81
+ <span class="no-display"><input type="radio" name="shipping_method[<?php echo $_address->getId() ?>]" value="<?php echo $this->htmlEscape($_rate->getCode()) ?>" id="s_method_<?php echo $_address->getId() ?>_<?php echo $_rate->getCode() ?>" checked="checked"/></span>
82
+ <?php else:*/ ?>
83
+ <input type="radio" name="shipping_method[<?php echo $_address->getId() ?>]" value="<?php echo $this->htmlEscape($_rate->getCode()) ?>" id="s_method_<?php echo $_address->getId() ?>_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod($_address)) echo ' checked="checked"' ?> class="radio" onclick="<?php if($code=="chronorelais"): ?>shippingMethod.getrelais('<?php echo $this->getUrl('checkout/multishipping/getMultiRelais')?>?zip=<?php echo $_address->getPostcode() ?>&index=<?php echo $_address->getId() ?>', <?php echo $_address->getId() ?>, '<?php echo $_address->getPostcode() ?> <?php echo $_address->getCity() ?>')<?php else: ?>shippingMethod.hiderelais(<?php echo $_address->getId() ?>)<?php endif; ?>" />
84
+ <?php //endif; ?>
85
+ <label for="s_method_<?php echo $_address->getId() ?>_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodTitle() ?>
86
+ <?php $_excl = $this->getShippingPrice($_address, $_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
87
+ <?php $_incl = $this->getShippingPrice($_address, $_rate->getPrice(), true); ?>
88
+ <?php echo $_excl; ?>
89
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
90
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
91
+ <?php endif; ?>
92
+ </label>
93
+ <?php endif ?>
94
+ </li>
95
+ <?php endforeach; ?>
96
+ </ul>
97
+ </dd>
98
+ <?php endforeach; ?>
99
+ </dl>
100
+ <?php endif; ?>
101
+ </div>
102
+ </div>
103
+ </div>
104
+ <div class="col-2 col-wide">
105
+ <?php echo $this->helper('giftmessage/message')->getInline('multishipping_adress_checkbox', $_address); ?>
106
+ <h3><?php echo $this->__('Items') ?> <span class="separator">|</span> <a href="<?php echo $this->getItemsEditUrl($_address) ?>"><?php echo $this->__('Edit Items') ?></a></h3>
107
+ <table class="data-table" id="shipping-table-<?php echo $_address->getId() ?>">
108
+ <col />
109
+ <col width="1" />
110
+ <thead>
111
+ <tr>
112
+ <th><?php echo $this->__('Product Name') ?></th>
113
+ <th class="a-center"><?php echo $this->__('Qty') ?></th>
114
+ </tr>
115
+ </thead>
116
+ <tbody>
117
+ <?php foreach ($this->getAddressItems($_address) as $_item): ?>
118
+ <tr>
119
+ <td>
120
+ <?php echo $this->getItemHtml($_item->getQuoteItem()) ?>
121
+ </td>
122
+ <td class="a-center"><?php echo $_item->getQty() ?></td>
123
+ </tr>
124
+ <?php endforeach; ?>
125
+ </tbody>
126
+ </table>
127
+ <script type="text/javascript">decorateTable('shipping-table-<?php echo $_address->getId() ?>')</script>
128
+ <?php echo $this->helper('giftmessage/message')->getInline('multishipping_adress', $_address); ?>
129
+ </div>
130
+
131
+ <span style="display: none;" class="please-wait" id="loading-process"><img class="v-middle" title="<?php echo $this->__('Loading...')?>" alt="<?php echo $this->__('Loading...')?>" src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif')?>"> <?php echo $this->__('Loading...')?></span>
132
+ <div id="checkout-shipping-method-chronorelais-load_<?php echo $_address->getId() ?>" class="chronorelais-list" style="clear: both;">
133
+ <?php if($this->getAddressShippingMethod($_address)=="chronorelais_chronorelais"): ?>
134
+ <?php Mage::getSingleton('core/session')->setMultiPostcode($_address->getPostcode()); ?>
135
+ <?php echo $this->getChildHtml('relaislist') ?>
136
+ <?php endif; ?>
137
+ </div>
138
+ </div>
139
+ <?php endforeach; ?>
140
+ <?php echo $this->getChildHtml('checkout_billing_items') ?>
141
+ <div class="buttons-set">
142
+ <p class="back-link"><a href="<?php echo $this->getBackUrl() ?>"><small>&laquo; </small><?php echo $this->__('Back to Select Addresses') ?></a></p>
143
+ <button type="submit" title="<?php echo $this->__('Continue to Billing Information') ?>" class="button"><span><span><?php echo $this->__('Continue to Billing Information') ?></span></span></button>
144
+ </div>
145
+ </form>
146
+
147
+ <script type="text/javascript">
148
+ //<![CDATA[
149
+ var shippingMethod = new MultiShippingMethod();
150
+ //]]>
151
+ </script>
152
+ </div>
app/design/frontend/default/default/template/chronorelais/checkout/multishipping/shipping_method/chronorelais.phtml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if(count($this->getChronorelais())>0): ?>
2
+ <?php
3
+ $postcode = Mage::getSingleton('core/session')->getMultiPostcode();
4
+ ?>
5
+ <div class="chronorelaismap">
6
+ <div class="mappostalcode">
7
+ <form id="mappostalcodeform_%%id%%" onsubmit="return false;" action="#">
8
+ <input type="text" name="mappostalcode[%%id%%]" id="mappostalcode_%%id%%" value="<?php echo $postcode ?>" class="input-text" onkeyup="if (event.keyCode == 13) shippingMethod.changePostalCode('<?php echo $this->getUrl('checkout/multishipping/getMultiRelais')?>?index=%%id%%', %%id%%)" />
9
+ <button onclick="shippingMethod.changePostalCode('<?php echo $this->getUrl('checkout/multishipping/getMultiRelais')?>?index=%%id%%', %%id%%);" id="mappostalcodebtn_%%id%%" class="button" type="button"><span><span><?php echo $this->__('Changer mon code postal')?></span></span></button>
10
+ <span style="display: none;" class="please-wait" id="postalcode-please-wait_%%id%%"><img class="v-middle" title="<?php echo $this->__('Loading map...')?>" alt="<?php echo $this->__('Loading map...')?>" src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif')?>"> <?php echo $this->__('Loading map...')?></span>
11
+ </form>
12
+ </div>
13
+ <div id="chronomap_%%id%%" class="chronomap"></div>
14
+ </div>
15
+ <p style="margin: 0;"><?php echo $this->__('Veuillez choisir parmi les 5 relais Pickup affich&eacute;s ci-dessous celui qui servira d\'adresse de livraison.')?></p>
16
+ <dl class="sp-methods-chronorelais">
17
+ <dt><?php echo $this->__('Chronorelay points')?></dt>
18
+ <dd>
19
+ <ul>
20
+ <?php foreach($this->getChronorelais() as $key=>$chronorelais): ?>
21
+ <li>
22
+ <input name="shipping_method_chronorelais[%%id%%]" type="radio" value="<?php echo $chronorelais->identifiantChronopostPointA2PAS;?>" id="s_method_chronorelais_%%id%%_<?php echo $chronorelais->identifiantChronopostPointA2PAS;?>" class="radio" onclick="loadMyPoint('<?php echo $chronorelais->identifiantChronopostPointA2PAS;//$key?>')" />
23
+ <label for="s_method_chronorelais_%%id%%_<?php echo $chronorelais->identifiantChronopostPointA2PAS;?>"><?php echo $chronorelais->nomEnseigne.' - '.$chronorelais->adresse1.' - '.$chronorelais->codePostal.' - '.$chronorelais->localite;?></label>
24
+ </li>
25
+ <?php endforeach; ?>
26
+ </ul>
27
+ </dd>
28
+ </dl>
29
+
30
+ <?php endif; ?>
app/design/frontend/default/default/template/chronorelais/checkout/onepage/shipping_method/chronorelais.phtml CHANGED
@@ -1,29 +1,30 @@
1
- <?php if(count($this->getChronorelais())>0): ?>
2
- <?php
3
- $quote = Mage::getSingleton('checkout/cart')->init()->getQuote();
4
- $address = $quote->getShippingAddress();
5
- $postcode = $address->getPostcode();
6
- ?>
7
- <div class="chronorelaismap">
8
- <div class="mappostalcode">
9
- <input type="text" name="mappostalcode" id="mappostalcode" value="<?php echo $postcode ?>" class="input-text" onkeydown="if (event.keyCode == 13) shippingMethod.changePostalCode('<?php echo $this->getUrl('checkout/onepage/changePostalCode')?>')" />
10
- <button onclick="shippingMethod.changePostalCode('<?php echo $this->getUrl('checkout/onepage/changePostalCode')?>');" id="mappostalcodebtn" class="button" type="button"><span><span><?php echo $this->__('Changer mon code postal')?></span></span></button>
11
- <span style="display: none;" class="please-wait" id="postalcode-please-wait"><img class="v-middle" title="<?php echo $this->__('Loading map...')?>" alt="<?php echo $this->__('Loading map...')?>" src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif')?>"> <?php echo $this->__('Loading map...')?></span>
12
- </div>
13
- <div id="chronomap"></div>
14
- </div>
15
- <dl class="sp-methods-chronorelais">
16
- <dt><?php echo $this->__('Chronorelay points')?></dt>
17
- <dd>
18
- <ul>
19
- <?php foreach($this->getChronorelais() as $key=>$chronorelais): ?>
20
- <li>
21
- <input name="shipping_method_chronorelais" type="radio" value="<?php echo $chronorelais->identifiantChronopostPointA2PAS;?>" id="s_method_chronorelais_<?php echo $chronorelais->identifiantChronopostPointA2PAS;?>" class="radio" onclick="loadMyPoint('<?php echo $chronorelais->identifiantChronopostPointA2PAS;//$key?>')" />
22
- <label for="s_method_chronorelais_<?php echo $chronorelais->identifiantChronopostPointA2PAS;?>"><?php echo $chronorelais->nomEnseigne.' - '.$chronorelais->adresse1.' - '.$chronorelais->codePostal.' - '.$chronorelais->localite;?></label>
23
- </li>
24
- <?php endforeach; ?>
25
- </ul>
26
- </dd>
27
- </dl>
28
-
 
29
  <?php endif; ?>
1
+ <?php if(count($this->getChronorelais())>0): ?>
2
+ <?php
3
+ $quote = Mage::getSingleton('checkout/cart')->init()->getQuote();
4
+ $address = $quote->getShippingAddress();
5
+ $postcode = $address->getPostcode();
6
+ ?>
7
+ <div class="chronorelaismap">
8
+ <div class="mappostalcode">
9
+ <input type="text" name="mappostalcode" id="mappostalcode" value="<?php echo $postcode ?>" class="input-text" onkeydown="if (event.keyCode == 13) shippingMethod.changePostalCode('<?php echo $this->getUrl('checkout/onepage/changePostalCode')?>')" />
10
+ <button onclick="shippingMethod.changePostalCode('<?php echo $this->getUrl('checkout/onepage/changePostalCode')?>');" id="mappostalcodebtn" class="button" type="button"><span><span><?php echo $this->__('Changer mon code postal')?></span></span></button>
11
+ <span style="display: none;" class="please-wait" id="postalcode-please-wait"><img class="v-middle" title="<?php echo $this->__('Loading map...')?>" alt="<?php echo $this->__('Loading map...')?>" src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif')?>"> <?php echo $this->__('Loading map...')?></span>
12
+ </div>
13
+ <div id="chronomap" class="chronomap"></div>
14
+ </div>
15
+ <p style="margin: 0;"><?php echo $this->__('Veuillez choisir parmi les 5 relais Pickup affich&eacute;s ci-dessous celui qui servira d\'adresse de livraison.')?></p>
16
+ <dl class="sp-methods-chronorelais">
17
+ <dt><?php echo $this->__('Chronorelay points')?></dt>
18
+ <dd>
19
+ <ul>
20
+ <?php foreach($this->getChronorelais() as $key=>$chronorelais): ?>
21
+ <li>
22
+ <input name="shipping_method_chronorelais" type="radio" value="<?php echo $chronorelais->identifiantChronopostPointA2PAS;?>" id="s_method_chronorelais_<?php echo $chronorelais->identifiantChronopostPointA2PAS;?>" class="radio" onclick="loadMyPoint('<?php echo $chronorelais->identifiantChronopostPointA2PAS;//$key?>')" />
23
+ <label for="s_method_chronorelais_<?php echo $chronorelais->identifiantChronopostPointA2PAS;?>"><?php echo $chronorelais->nomEnseigne.' - '.$chronorelais->adresse1.' - '.$chronorelais->codePostal.' - '.$chronorelais->localite;?></label>
24
+ </li>
25
+ <?php endforeach; ?>
26
+ </ul>
27
+ </dd>
28
+ </dl>
29
+
30
  <?php endif; ?>
app/locale/en_US/Chronopost_Chronorelais.csv CHANGED
@@ -36,6 +36,7 @@
36
  "{configuration_syntax_help}","<a href='http://www.magentocommerce.com/boards/viewthread/37860/' target='_blank'>Help</a>"
37
  "{debug_help}","0 = none, 1 = minimum, 10 = full"
38
  "{logo_ulr_help}","Upload the logo image to the given skin folder. skin/frontend/[your package name]/[your skin name]/chronorelais/"
 
39
 
40
  "Tracking URL","Tracking URL"
41
  "Debug","Debug"
36
  "{configuration_syntax_help}","<a href='http://www.magentocommerce.com/boards/viewthread/37860/' target='_blank'>Help</a>"
37
  "{debug_help}","0 = none, 1 = minimum, 10 = full"
38
  "{logo_ulr_help}","Upload the logo image to the given skin folder. skin/frontend/[your package name]/[your skin name]/chronorelais/"
39
+ "No : cost is obtained from your rate grid ; Yes : cost is fetched from URL below";"No : cost is obtained from your rate grid ; Yes : cost is fetched from URL below"
40
 
41
  "Tracking URL","Tracking URL"
42
  "Debug","Debug"
app/locale/fr_FR/Chronopost_Chronorelais.csv CHANGED
@@ -36,6 +36,7 @@
36
  "{configuration_syntax_help}","<a href='http://www.magentocommerce.com/boards/viewthread/37860/' target='_blank'>Aide</a>"
37
  "{debug_help}","0 = aucun, 1 = minimum, 10 = complet"
38
  "{logo_ulr_help}","Upload the logo image to the given skin folder. skin/frontend/[your package name]/[your skin name]/chronorelais/"
 
39
 
40
  "Tracking URL","URL de suivi"
41
  "Debug","Debug"
36
  "{configuration_syntax_help}","<a href='http://www.magentocommerce.com/boards/viewthread/37860/' target='_blank'>Aide</a>"
37
  "{debug_help}","0 = aucun, 1 = minimum, 10 = complet"
38
  "{logo_ulr_help}","Upload the logo image to the given skin folder. skin/frontend/[your package name]/[your skin name]/chronorelais/"
39
+ "No : cost is obtained from your rate grid ; Yes : cost is fetched from URL below";"Non : le prix est calculé grâce à votre grille tarifaire ; Oui : le prix est calculé via le webservice ci-dessous"
40
 
41
  "Tracking URL","URL de suivi"
42
  "Debug","Debug"
package.xml CHANGED
@@ -1,37 +1,43 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Chronopost</name>
4
- <version>0.1.7.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Cette extension officielle permet de proposer &#xE0; vos clients le mode de livraison Chronopost</summary>
10
- <description>Chronopost offre le choix parmi 2 solutions de livraison en France et 1 &#xE0; l&#x2019;international pour toutes vos commandes en ligne :
11
-
12
- Chronopost livraison Express &#xE0; domicile. Colis livr&#xE9; le lendemain avant 13h &#xE0; l&#x2019;adresse de votre choix
13
- Chrono Relais, colis disponible le lendemain &#xE0; partir de 13h dans l&#x2019;un de 3500 points Chrono Relais de votre choix
14
- Chrono Express : livraison express partout dans le monde. L&#x2019;Europe livr&#xE9;e en 1 &#xE0; 3 jours et le reste du monde en 3 &#xE0; 5 jours.
15
-
16
- Afin de vous accompagner dans le d&#xE9;veloppement des sites e-marchands sur la plateforme Magento, vous trouverez dans le module Chronopost un package de solutions :
17
-
18
- La g&#xE9;olocalisation des points Chrono Relais
19
- Le calcul du co&#xFB;t du transport (via logiciel QuickCost)
20
- Le suivi int&#xE9;gr&#xE9;&#x2013; Le choix entre 3 solutions possibles d&#x2019;&#xE9;tiquetage des envois selon les besoins de l&#x2019;e-commer&#xE7;ant
21
- Test&#xE9; et valid&#xE9; sur Magento 1.4 et.1.5
22
-
23
- --&gt; Un manuel d'installation est &#xE0; votre disposition dans la partie 'Docs' afin de vous guider dans l'installation du module. (A lire imp&#xE9;rativement)
24
-
25
- ATTENTION : Pour toute mise en production du module Chronopost, un contrat avec Chronopost est n&#xE9;cessaire. Si vous n&#x2019;avez pas de contrat merci de prendre contact &#xE0; l&#x2019;adresse suivante : mychrono@chronopost.fr
26
-
27
- R&#xE9;alisation Adexos
28
-
 
29
  Ce module est d&#xE9;vellop&#xE9; &#xE0; partir de l'extension Owebia Shipping 2</description>
30
- <notes>New shipping module</notes>
31
- <authors><author><name>Benjamin GOSSELET</name><user>auto-converted</user><email>chronopost@adexos.fr</email></author></authors>
32
- <date>2011-09-27</date>
33
- <time>17:58:22</time>
34
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="chronorelais"><dir name="import"><file name="form.phtml" hash="356aadf2bb0182b23f7af38888a0cd38"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="chronorelais.xml" hash="054fa1c126747c9c24c9c87057fa2c35"/></dir><dir name="template"><dir name="chronorelais"><dir name="checkout"><dir name="onepage"><dir name="shipping_method"><file name="available.phtml" hash="7377a159a92db28c30f86ad52921a5b0"/><file name="chronorelais.phtml" hash="066b7b46e68ab109c497ac167d8cd333"/></dir><file name="shipping_method.phtml" hash="4f084424b6dcdb187753f09357f46898"/></dir></dir><dir name="sales"><dir name="order"><file name="history.phtml" hash="f95a1860a4cf463f6fca48273cc45eaf"/><file name="recent.phtml" hash="8045fbbe75510efc55da31455d2cc47a"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Chronopost"><dir name="Chronorelais"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Config.php" hash="b38741ddd97fcae5dd276239fb3c6b70"/></dir></dir></dir></dir></dir><dir name="Checkout"><dir name="Onepage"><dir name="Shipping"><dir name="Method"><file name="Chronorelais.php" hash="c4d908310310e4cd90833378df260599"/></dir></dir></dir></dir><dir name="Export"><dir name="Orders"><file name="Grid.php" hash="d79a797a01c1e7405d78fa08a1cd8805"/></dir><file name="Orders.php" hash="9ada10bd85cb58122e722b3e82c71e37"/></dir><dir name="Import"><file name="Form.php" hash="56c6e3787c05e58d57b48ec4b1421468"/></dir><dir name="Sales"><dir name="Order"><dir name="Shipment"><file name="View.php" hash="f5407d7d14aa59acb844479da5046900"/></dir></dir><dir name="Shipment"><file name="Copy of Grid.php" hash="f72d35dcf2b3be9d8d5f24342c0633f4"/><file name="Grid-bkp-03-02-11.php" hash="e3b798fa5259cca5e9d3a08a75fb3f76"/><file name="Grid.php" hash="ffdfa3caf30f292211f4a7c65b54a866"/></dir><file name="Impression.php" hash="619599b136b9cc49f01dba5b08ee8428"/></dir><file name="Detail.php" hash="005fa3b6e5918c6c9779402fab5713f2"/><file name="Filter.php" hash="28f80e3ab34f6ff03b61f070ccbac697"/></dir><dir name="Controller"><file name="Abstract.php" hash="94680cd88c6af59764dedb613b08d5f6"/></dir><dir name="controllers"><dir name="Checkout"><file name="OnepageController.php" hash="180def68d8f23900be5bb3f5f2214fc3"/></dir><dir name="Sales"><dir name="Order"><file name="ShipmentController.php" hash="748e773c4558f24f1cf54e462fa24a88"/></dir><file name="ImpressionController.php" hash="a5692a173c2c941f2ab8c8bef02a6ddd"/></dir><file name="AjaxController.php" hash="1905b32a1366d3c27277836364737e98"/><file name="ExportController.php" hash="8fbffc0b31a55ac422a52e5972c05b01"/><file name="ImportController.php" hash="f2a840c80d8a2c267a20950b7d11e42f"/><file name="RelaisController.php" hash="5d48155ddb7cc2d4effbbfdeb4f3946d"/></dir><dir name="etc"><file name="config.xml" hash="ea6e1349c876e0dfc5e2ff955f30e775"/><file name="system.xml" hash="024697b3c6f3808ef1f89d44bd422a72"/></dir><dir name="Helper"><file name="Data.php" hash="70531f8f903a63986c063f65553d643d"/></dir><dir name="includes"><file name="ChronorelaisShippingHelper.php" hash="9a3aa6bb5b3846102d78450d76c93fdf"/><file name="countries.inc.php" hash="d21cd393c7c0ebc83beccc99950d6ab1"/></dir><dir name="Model"><dir name="Carrier"><file name="AbstractChronorelais.php" hash="f4957f6d660c4adb0328f9f2d73da1e2"/><file name="AbstractChronorelaisShipping.php" hash="1adab13f3659559803b338ad86205d43"/><file name="Chronoexpress.php" hash="bc867a6b98966ada549a0b81ec334b64"/><file name="Chronopost.php" hash="c4d4525447d2801d28d921eaedc35a9a"/><file name="Chronorelais.php" hash="5cfcb83c23d05585fdc50f8b2747fc40"/></dir><dir name="Config"><dir name="Source"><file name="Civility.php" hash="fe6ec6eebe6faffdd0bb65479d91cd5d"/><file name="EndOfLineCharacter.php" hash="3fe6b6069a9efdc29ad0d3f7d1cf4794"/><file name="FieldDelimiter.php" hash="3e023d40aeca50932e62ff97eed6317e"/><file name="FieldSeparator.php" hash="ce30c5974a893bd5467334d574dd578a"/><file name="FileCharset.php" hash="6cc4ebab95735bd121af16e0eedd90d6"/><file name="FileExtension.php" hash="597c3e78e7584bf7c4b7b2ebad6d2a65"/><file name="PrintMode.php" hash="67e8a6e98e12c7e72624ba5322076c00"/></dir></dir><dir name="Sales"><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Shipping.php" hash="2e69db363011f84ef2cdb5d0e9d4c4df"/></dir></dir></dir></dir></dir><dir name="sql"><dir name="chronorelais_setup"><file name="mysql4-install-0.1.0.php" hash="c307802a7bd10c1ecce06799b04569c2"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="ea3358055a851a96b673c721202045be"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="961f41dc1012d0917504f9bb5f5d106c"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="b85470889421f652c3d01b96072f579c"/><file name="mysql4-upgrade-0.1.3-0.1.4.php" hash="def69d0ae26b0d130d2ce6e0838e5d7f"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Chronopost_Chronorelais.csv" hash="351140a6ab727666e06cc7fe5d28c1b0"/></dir><dir name="fr_FR"><file name="Chronopost_Chronorelais.csv" hash="723a027f77a05e598cefe3c522bd5c0c"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="chronorelais"><file name="ac.png" hash="0c04f70da35d43a2636cfbd6ad2b10d5"/><file name="chronopost.png" hash="93e5b22e2f280923df8d503f5c8e5b92"/><file name="chronorelais.css" hash="990db2d6f277650fb487161bcf4b0eb5"/><file name="chronorelais.png" hash="0383895b061b4a1210f9435fcf3a726a"/><file name="chronorelaismap.js" hash="41d3d363b046ed8ad5ff6a799341a507"/><file name="home.png" hash="7904b495e94047eb3406e260bc660cce"/><file name="ico_ac_shaded.gif" hash="e55d9b2071fb976cf5331b6273a40731"/><file name="Picto_Chrono_Relais.png" hash="1ea0f0c410d237adf23d5905cd8431f5"/><file name="Thumbs.db" hash="2e16ed23c37d1aa29a6caf73f513a648"/></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="chronopost"><dir name="chronorelais"><file name="ocseditor.css" hash="1bfc847153768d6729cdad7cb1abe443"/><file name="ocseditor.js" hash="8b7f29ddf7faff2fd3a63af18ba666aa"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="WSChronopost_Chronorelais.xml" hash="e614759d6b46c0c25f6c26d6e9dff45a"/></dir></target></contents>
 
 
 
 
 
35
  <compatible/>
36
- <dependencies/>
37
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Chronopost</name>
4
+ <version>0.2.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Cette extension officielle permet de proposer &#xE0; vos clients le mode de livraison Chronopost</summary>
10
+ <description>Chronopost offre le choix parmi 2 solutions de livraison en France et 1 &#xE0; l'international pour toutes vos commandes en ligne :&#xD;
11
+ &#xD;
12
+ Chronopost livraison Express &#xE0; domicile. Colis livr&#xE9; le lendemain avant 13h &#xE0; l'adresse de votre choix&#xD;
13
+ Chrono Relais, colis disponible le lendemain &#xE0; partir de 13h dans l'un de 3500 points Chrono Relais de votre choix&#xD;
14
+ Chrono Express : livraison express partout dans le monde. L'Europe livr&#xE9;e en 1 &#xE0; 3 jours et le reste du monde en 3 &#xE0; 5 jours.&#xD;
15
+ &#xD;
16
+ Afin de vous accompagner dans le d&#xE9;veloppement des sites e-marchands sur la plateforme Magento, vous trouverez dans le module Chronopost un package de solutions :&#xD;
17
+ &#xD;
18
+ La g&#xE9;olocalisation des points Chrono Relais&#xD;
19
+ Le calcul du co&#xFB;t du transport (via logiciel QuickCost)&#xD;
20
+ Le suivi int&#xE9;gr&#xE9;&#xD;
21
+ Le choix entre 3 solutions possibles d'&#xE9;tiquetage des envois selon les besoins de l'e-commer&#xE7;ant&#xD;
22
+ Test&#xE9; et valid&#xE9; sur Magento 1.6.2&#xD;
23
+ &#xD;
24
+ --&gt; Un manuel d'installation est &#xE0; votre disposition dans la partie 'Docs' afin de vous guider dans l'installation du module. (A lire imp&#xE9;rativement)&#xD;
25
+ &#xD;
26
+ ATTENTION : Pour toute mise en production du module Chronopost, un contrat avec Chronopost est n&#xE9;cessaire. Si vous n'avez pas de contrat merci de prendre contact &#xE0; l'adresse suivante : mychrono@chronopost.fr&#xD;
27
+ &#xD;
28
+ R&#xE9;alisation Adexos&#xD;
29
+ &#xD;
30
  Ce module est d&#xE9;vellop&#xE9; &#xE0; partir de l'extension Owebia Shipping 2</description>
31
+ <notes>Version destin&#xE9;e &#xE0; Magento 1.6.X et sup&#xE9;rieures&#xD;
32
+ ------------&#xD;
33
+ Support du multi-shipping.&#xD;
34
+ Correction sur le filtrage des commandes pour l'export.&#xD;
35
+ Correction du nom de point relais manquant dans les exports.&#xD;
36
+ Modification de libell&#xE9; en admin pour explication du Quickcost.</notes>
37
+ <authors><author><name>Benjamin GOSSELET</name><user>Chronopost</user><email>bgosselet@adexos.fr</email></author></authors>
38
+ <date>2012-05-11</date>
39
+ <time>14:22:43</time>
40
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="chronorelais"><dir name="import"><file name="form.phtml" hash="356aadf2bb0182b23f7af38888a0cd38"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="chronorelais.xml" hash="a298640a9d7a9d5c9ad90b81801d0584"/></dir><dir name="template"><dir name="chronorelais"><dir name="checkout"><dir name="multishipping"><file name="shipping.phtml" hash="89ac65c42722975ec8b872a1e69b5ae9"/><dir name="shipping_method"><file name="chronorelais.phtml" hash="f184ce28e619c185434810545bc82d9f"/></dir></dir><dir name="onepage"><dir name="shipping_method"><file name="available.phtml" hash="7377a159a92db28c30f86ad52921a5b0"/><file name="chronorelais.phtml" hash="4d9d318e0add0ff4a70155541180654a"/></dir><file name="shipping_method.phtml" hash="4f084424b6dcdb187753f09357f46898"/></dir></dir><dir name="sales"><dir name="order"><file name="history.phtml" hash="f95a1860a4cf463f6fca48273cc45eaf"/><file name="recent.phtml" hash="8045fbbe75510efc55da31455d2cc47a"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Chronopost"><dir name="Chronorelais"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Config.php" hash="b38741ddd97fcae5dd276239fb3c6b70"/></dir></dir></dir></dir></dir><dir name="Checkout"><dir name="Multishipping"><dir name="Shipping"><dir name="Method"><file name="Chronorelais.php" hash="a095d54809c9ad04453758635879127e"/></dir></dir></dir><dir name="Onepage"><dir name="Shipping"><dir name="Method"><file name="Chronorelais.php" hash="c4d908310310e4cd90833378df260599"/></dir></dir></dir></dir><file name="Detail.php" hash="005fa3b6e5918c6c9779402fab5713f2"/><dir name="Export"><dir name="Orders"><file name="Grid.php" hash="bec368bcf626b7c7665a3f042be17905"/></dir><file name="Orders.php" hash="9ada10bd85cb58122e722b3e82c71e37"/></dir><file name="Filter.php" hash="28f80e3ab34f6ff03b61f070ccbac697"/><dir name="Import"><file name="Form.php" hash="56c6e3787c05e58d57b48ec4b1421468"/></dir><dir name="Sales"><file name="Impression.php" hash="619599b136b9cc49f01dba5b08ee8428"/><dir name="Order"><dir name="Shipment"><file name="View.php" hash="f5407d7d14aa59acb844479da5046900"/></dir></dir><dir name="Shipment"><file name="Grid.php" hash="06928b811ee8d71e5e1fdcc0814ff9e0"/></dir></dir></dir><dir name="Controller"><file name="Abstract.php" hash="94680cd88c6af59764dedb613b08d5f6"/></dir><dir name="Helper"><file name="Data.php" hash="70531f8f903a63986c063f65553d643d"/></dir><dir name="Model"><dir name="Carrier"><file name="AbstractChronorelais.php" hash="f4957f6d660c4adb0328f9f2d73da1e2"/><file name="AbstractChronorelaisShipping.php" hash="1adab13f3659559803b338ad86205d43"/><file name="Chronoexpress.php" hash="bc867a6b98966ada549a0b81ec334b64"/><file name="Chronopost.php" hash="c4d4525447d2801d28d921eaedc35a9a"/><file name="Chronorelais.php" hash="5cfcb83c23d05585fdc50f8b2747fc40"/></dir><dir name="Config"><dir name="Source"><file name="Civility.php" hash="fe6ec6eebe6faffdd0bb65479d91cd5d"/><file name="EndOfLineCharacter.php" hash="3fe6b6069a9efdc29ad0d3f7d1cf4794"/><file name="FieldDelimiter.php" hash="3e023d40aeca50932e62ff97eed6317e"/><file name="FieldSeparator.php" hash="ce30c5974a893bd5467334d574dd578a"/><file name="FileCharset.php" hash="6cc4ebab95735bd121af16e0eedd90d6"/><file name="FileExtension.php" hash="597c3e78e7584bf7c4b7b2ebad6d2a65"/><file name="PrintMode.php" hash="67e8a6e98e12c7e72624ba5322076c00"/></dir></dir><dir name="Sales"><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Shipping.php" hash="2e69db363011f84ef2cdb5d0e9d4c4df"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="AjaxController.php" hash="1905b32a1366d3c27277836364737e98"/><dir name="Checkout"><file name="MultishippingController.php" hash="c44aa875ba9683e1d6311390c4e77080"/><file name="OnepageController.php" hash="6986dd92fff2085260d011234fc298f6"/></dir><file name="ExportController.php" hash="9a24df876d6d7c48df53d99ff5498d6b"/><file name="ImportController.php" hash="7cce42f41a838e1cb3e220742020eeff"/><file name="RelaisController.php" hash="5d48155ddb7cc2d4effbbfdeb4f3946d"/><dir name="Sales"><file name="ImpressionController.php" hash="7b040384c03fec329f66ec0afb2d4d44"/><dir name="Order"><file name="ShipmentController.php" hash="992c53ee433323ef9fb1c0f101c54ea3"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="8a9bc798220b1a454bef20bddcee2dd2"/><file name="system.xml" hash="1eb275cce36bcc0c8322f3f95fd5deb1"/></dir><dir name="includes"><file name="ChronorelaisShippingHelper.php" hash="9a3aa6bb5b3846102d78450d76c93fdf"/><file name="countries.inc.php" hash="d21cd393c7c0ebc83beccc99950d6ab1"/></dir><dir name="sql"><dir name="chronorelais_setup"><file name="mysql4-install-0.1.0.php" hash="c307802a7bd10c1ecce06799b04569c2"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="ea3358055a851a96b673c721202045be"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="961f41dc1012d0917504f9bb5f5d106c"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="b85470889421f652c3d01b96072f579c"/><file name="mysql4-upgrade-0.1.3-0.1.4.php" hash="def69d0ae26b0d130d2ce6e0838e5d7f"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Chronopost_Chronorelais.csv" hash="76475aa4fa500c135a666e47bab62ddf"/></dir><dir name="fr_FR"><file name="Chronopost_Chronorelais.csv" hash="ebcbda74580c951df42e932aa434a33a"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="chronorelais"><file name="Picto_Chrono_Relais.png" hash="1ea0f0c410d237adf23d5905cd8431f5"/><file name="Thumbs.db" hash="2e16ed23c37d1aa29a6caf73f513a648"/><file name="ac.png" hash="0c04f70da35d43a2636cfbd6ad2b10d5"/><file name="chronopost.png" hash="93e5b22e2f280923df8d503f5c8e5b92"/><file name="chronorelais.css" hash="a1fef1934a1114be6c8f4eebde2b5263"/><file name="chronorelais.png" hash="87c42de75ddafe495dfc0248c2a688b4"/><file name="chronorelaismap.js" hash="60db33945bcaeeaf58e1a57cb3a3f23d"/><file name="home.png" hash="7904b495e94047eb3406e260bc660cce"/><file name="ico_ac_shaded.gif" hash="e55d9b2071fb976cf5331b6273a40731"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="WSChronopost_Chronorelais.xml" hash="e614759d6b46c0c25f6c26d6e9dff45a"/></dir></target><target name="mage"><dir name="js"><dir name="chronopost"><dir name="chronorelais"><file name="ocseditor.css" hash="1bfc847153768d6729cdad7cb1abe443"/><file name="ocseditor.js" hash="8b7f29ddf7faff2fd3a63af18ba666aa"/></dir></dir></dir></target></contents>
41
  <compatible/>
42
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
43
  </package>
skin/frontend/default/default/chronorelais/chronorelais.css CHANGED
@@ -1,46 +1,46 @@
1
- /* styles for chrono relais */
2
-
3
- .chronorelais-list { }
4
- .sp-methods-chronorelais { padding:5px 20px;}
5
- sp-methods-chronorelais dd li { clear:both;}
6
- .chronorelaismap { margin:20px 0px 10px 0px; }
7
- .chronorelaismap .mappostalcode { margin-bottom:10px; text-align:right;}
8
- .sp-methods .method-description { clear:both; }
9
- .sp-methods .method-radio, .sp-methods .method-image, .sp-methods .method-contents { }
10
- .sp-methods .method-image { padding:0 10px;}
11
-
12
- /*****************************
13
- sw-Gmap
14
- *******************************/
15
- #chronomap { height:450px; width:100%; overflow:hidden!mportant; font:82.5%/1.3 Arial,Helvetica,sans-serif; background-color: #E5E3DF; border: 1px solid #aaa;}
16
- #chronomap *{float:none;overflow:visible;font-family: Arial,sans-serif;}
17
- #chronomap a {color:#0000cc;outline:none;}
18
- #chronomap h4{font-size:14px;margin-bottom:6px;border-bottom:1px solid #ccc;}
19
- #chronomap h2{font-size:16px;margin:2px 10px 6px 0; font-weight:bold;}
20
-
21
- /*****************************
22
- Infowindow
23
- *******************************/
24
- #chronomap .sw-infowindow a{cursor:pointer;}
25
- #sw-infowindow-info{max-height:400px}
26
- #sw-infowindow-hor{height:150px}
27
- .sw-map-adresse-wrp{min-height:90px}
28
- .sw-map-adresse{font-size:1.2em;margin:5px 0 8px 0;line-height:1.45em;}
29
- .sw-map-tools a{font-size:12px;}
30
- #chronomap .sw-desc{display:block;font-weight:bold;line-height:16px;float:none!important;width:auto;}
31
- #chronomap .sw-help{display:block;float:none!important;width:auto;clear:both;}
32
- .sw-map-itin-tools{font-size:11px;padding:8px 0;display:block;}
33
- .sw-back-link{font-size:11px;display:block;text-align:right;margin:0px ;}
34
- #sw-sendbymail-wrap{height:220px;overflow:hidden;}
35
- #chronomap .sw-textarea{height:30px;}
36
- .sw-tool-itineraire{height:220px;}
37
- /*****************************
38
- Tables
39
- *******************************/
40
- .sw-table {border-collapse:collapse; width:100%;}
41
- .sw-table td {font-size:1.2em;border-bottom:1px solid #ccc; padding:1px 0px;}
42
- .sw-table th{background:#eee;font-size:1.3em;border-top:1px solid #555}
43
- #sw-table-horaire-client td ,#sw-table-horaire-depot td{width:50%;}
44
- #sw-table-horaire-client{}
45
- #sw-table-horaire-depot{margin-top:8px;}
46
- /*****************************
1
+ /* styles for chrono relais */
2
+
3
+ .chronorelais-list { }
4
+ .sp-methods-chronorelais { padding:5px 20px;}
5
+ sp-methods-chronorelais dd li { clear:both;}
6
+ .chronorelaismap { margin:20px 0px 10px 0px; }
7
+ .chronorelaismap .mappostalcode { margin-bottom:10px; text-align:right;}
8
+ .sp-methods .method-description { clear:both; }
9
+ .sp-methods .method-radio, .sp-methods .method-image, .sp-methods .method-contents { }
10
+ .sp-methods .method-image { padding:0 10px;}
11
+
12
+ /*****************************
13
+ sw-Gmap
14
+ *******************************/
15
+ .chronomap { height:450px; width:100%; overflow:hidden!mportant; font:82.5%/1.3 Arial,Helvetica,sans-serif; background-color: #E5E3DF; border: 1px solid #aaa;}
16
+ .chronomap *{float:none;overflow:visible;font-family: Arial,sans-serif;}
17
+ .chronomap a {color:#0000cc;outline:none;}
18
+ .chronomap h4{font-size:14px;margin-bottom:6px;border-bottom:1px solid #ccc;}
19
+ .chronomap h2{font-size:16px;margin:2px 10px 6px 0; font-weight:bold;}
20
+
21
+ /*****************************
22
+ Infowindow
23
+ *******************************/
24
+ .chronomap .sw-infowindow a{cursor:pointer;}
25
+ #sw-infowindow-info{max-height:400px}
26
+ #sw-infowindow-hor{height:150px}
27
+ .sw-map-adresse-wrp{min-height:90px}
28
+ .sw-map-adresse{font-size:1.2em;margin:5px 0 8px 0;line-height:1.45em;}
29
+ .sw-map-tools a{font-size:12px;}
30
+ .chronomap .sw-desc{display:block;font-weight:bold;line-height:16px;float:none!important;width:auto;}
31
+ .chronomap .sw-help{display:block;float:none!important;width:auto;clear:both;}
32
+ .sw-map-itin-tools{font-size:11px;padding:8px 0;display:block;}
33
+ .sw-back-link{font-size:11px;display:block;text-align:right;margin:0px ;}
34
+ #sw-sendbymail-wrap{height:220px;overflow:hidden;}
35
+ .chronomap .sw-textarea{height:30px;}
36
+ .sw-tool-itineraire{height:220px;}
37
+ /*****************************
38
+ Tables
39
+ *******************************/
40
+ .sw-table {border-collapse:collapse; width:100%;}
41
+ .sw-table td {font-size:1.2em;border-bottom:1px solid #ccc; padding:1px 0px;}
42
+ .sw-table th{background:#eee;font-size:1.3em;border-top:1px solid #555}
43
+ #sw-table-horaire-client td ,#sw-table-horaire-depot td{width:50%;}
44
+ #sw-table-horaire-client{}
45
+ #sw-table-horaire-depot{margin-top:8px;}
46
+ /*****************************
skin/frontend/default/default/chronorelais/chronorelais.png CHANGED
Binary file
skin/frontend/default/default/chronorelais/chronorelaismap.js CHANGED
@@ -1,463 +1,569 @@
1
- var gmarkers = [];
2
- var map;
3
- var homeaddress = "";
4
- var addressrelais = [];
5
- var relaylatan = [];
6
- var next_pt = 0;
7
- var hidehomeicon = false;
8
-
9
- function loadMyPoint(i) {
10
- GEvent.trigger(gmarkers[i], "click");
11
- }
12
-
13
- var bounds = new GLatLngBounds();
14
- function loadRelayMap(address, relaisArray, nextpt) {
15
- if (GBrowserIsCompatible()) {
16
- var geo = new GClientGeocoder();
17
- var reasons=[];
18
- reasons[G_GEO_SUCCESS] = "Success";
19
- reasons[G_GEO_MISSING_ADDRESS] = "Missing Address: The address was either missing or had no value.";
20
- reasons[G_GEO_UNKNOWN_ADDRESS] = "Unknown Address: No corresponding geographic location could be found for the specified address.";
21
- reasons[G_GEO_UNAVAILABLE_ADDRESS]= "Unavailable Address: The geocode for the given address cannot be returned due to legal or contractual reasons.";
22
- reasons[G_GEO_BAD_KEY] = "Bad Key: The API key is either invalid or does not match the domain for which it was given";
23
- reasons[G_GEO_TOO_MANY_QUERIES] = "Too Many Queries: The daily geocoding quota for this site has been exceeded.";
24
- reasons[G_GEO_SERVER_ERROR] = "Server error: The geocoding request could not be successfully processed.";
25
-
26
- map = new GMap2(document.getElementById("chronomap"));
27
- //map.addControl(new GLargeMapControl());
28
- map.setUIToDefault();
29
-
30
- var blueIcon = new GIcon();
31
- blueIcon.iconSize = new GSize(45, 30);
32
- blueIcon.iconAnchor = new GPoint(9, 34);
33
- blueIcon.infoWindowAnchor = new GPoint(9, 2);
34
- blueIcon.transparent = Picto_Chrono_Relais;
35
- var homeicon = new GIcon();
36
- homeicon.iconSize = new GSize(32, 37);
37
- homeicon.iconAnchor = new GPoint(9, 34);
38
- homeicon.infoWindowAnchor = new GPoint(9, 2);
39
- homeicon.transparent = Home_Chrono_Icon;
40
-
41
- if(!homeaddress && !hidehomeicon) {
42
- var ship_address = getShipAddress(); //get shipping address to set home address
43
- homeaddress = relaisArray.codePostal + " " + relaisArray.localite;
44
- if(ship_address) { homeaddress = ship_address+" "+homeaddress; }
45
-
46
- geo.getLocations(homeaddress , function(result) {
47
- if (result.Status.code == G_GEO_SUCCESS) {
48
- var p = result.Placemark[0].Point.coordinates;
49
- var point = new GLatLng(p[1],p[0]);
50
- var marker = new GMarker(point,{title:'home',icon:homeicon});
51
- map.addOverlay(marker);
52
- map.setCenter(point, 17-5);
53
- }
54
- });
55
- }
56
-
57
- function createTabbedMarker(point, relaisArray) {
58
- //alert(point);
59
- addressrelais.push(relaisArray);
60
- var label = nextpt;
61
- var relaypoint_id = relaisArray.identifiantChronopostPointA2PAS;
62
- var marker = new GMarker(point,{title:relaisArray.nomEnseigne,icon:blueIcon});
63
- var tab = new GInfoWindowTab ("Infos", '<div id="sw-infowindow-info" class="sw-infowindow">'+getMarkerInfoContent(relaisArray) + getActionsForm(label)+'</div>');
64
- var tab2 = new GInfoWindowTab ("Horaires", '<div id="sw-infowindow-hor" class="sw-infowindow">'+"<h2>Horaires</h2>"+getHorairesTab(relaisArray, true)+'</div>') ;
65
-
66
- GEvent.addListener(marker, "click", function() {
67
- if(document.getElementById('s_method_chronorelais_'+relaisArray.identifiantChronopostPointA2PAS))
68
- document.getElementById('s_method_chronorelais_'+relaisArray.identifiantChronopostPointA2PAS).checked = true;
69
- marker.openInfoWindowTabsHtml([tab, tab2]);
70
- });
71
- //gmarkers.push(marker);
72
- gmarkers[relaypoint_id] = marker;
73
- return marker;
74
- }
75
-
76
- function showAddress(address, relaisArray) {
77
- var search = address;
78
- // ====== Perform the Geocoding ======
79
- geo.getLocations(search, function (result)
80
- {
81
- // If that was successful
82
- if (result.Status.code == G_GEO_SUCCESS) {
83
- // Loop through the results, placing markers
84
- //for (var i=0; i<result.Placemark.length; i++) {
85
- for (var i=0; i<1; i++) {
86
- var p = result.Placemark[i].Point.coordinates;
87
- relaylatan.push(p);
88
- var point = new GLatLng(p[1],p[0]);
89
- var marker = createTabbedMarker(point, relaisArray);
90
- map.addOverlay(marker);
91
- // ==== Each time a point is found, extent the bounds ato include it =====
92
- bounds.extend(point);
93
- }
94
- // centre the map on the first result
95
- //!homeaddress && hidehomeicon &&
96
- if(nextpt==5) {
97
- var p = result.Placemark[0].Point.coordinates;
98
- map.setCenter(new GLatLng(p[1],p[0]),17-5);
99
- // ===== determine the zoom level from the bounds =====
100
- map.setZoom(map.getBoundsZoomLevel(bounds));
101
- // ===== determine the centre from the bounds ======
102
- map.setCenter(bounds.getCenter());
103
- }
104
- }
105
- // ====== Decode the error status ======
106
- else {
107
- var reason="Code "+result.Status.code;
108
- if (reasons[result.Status.code]) {
109
- reason = reasons[result.Status.code]
110
- }
111
- alert('Could not find "'+search+ '" ' + reason);
112
- }
113
- }
114
- );
115
- }
116
- showAddress(address, relaisArray);
117
-
118
- } else {
119
- alert("Sorry, the Google Maps API is not compatible with this browser");
120
- }
121
- } // end of loadRelayMap function
122
-
123
- function addEvent( obj, type, fn ) {
124
- if ( obj.attachEvent ) {
125
- obj["e"+type+fn] = fn;
126
- obj[type+fn] = function() { obj["e"+type+fn]( window.event ) };
127
- obj.attachEvent( "on"+type, obj[type+fn] );
128
- }
129
- else{
130
- obj.addEventListener( type, fn, false );
131
- }
132
- }
133
-
134
- function getMarkerInfoContent(relaisArray){
135
- var icoPath = Picto_Chrono_Relais;
136
- var content="<div class=\"sw-map-adresse-wrp\" style=\"background-image: url("+ icoPath +"); background-repeat: no-repeat;padding-left:50px;\">"
137
- + "<h2>"+relaisArray.nomEnseigne+"</h2>"
138
- + "<div class=\"sw-map-adresse\">"
139
- + parseAdresse(relaisArray)
140
- + relaisArray.codePostal + " " + relaisArray.localite
141
- + "</div></div>";
142
- return content;
143
- }
144
- function getActionsForm(label)
145
- {
146
- var html = '<div class="sw-map-tools"><a href="javascript:printPage('+label+')">Imprimer</a>'
147
- + '</div>';
148
- return html;
149
- }
150
-
151
- function getHorairesTab(anArray, highlight)
152
- {
153
- var userAgent = navigator.userAgent.toLowerCase();
154
- var msie = /msie/.test( userAgent ) && !/opera/.test( userAgent );
155
-
156
- var rs = "" ;
157
- rs = "<table id=\"sw-table-horaire\" class=\"sw-table\"";
158
- if(msie) {
159
- rs += " style=\"width:auto;\"";
160
- }
161
- rs += ">"
162
- + "<tr><td>Lun:</td>"+ parseHorairesOuverture(anArray.horairesOuvertureLundi, 1, highlight) +"</tr>"
163
- + "<tr><td>Mar:</td>"+ parseHorairesOuverture(anArray.horairesOuvertureMardi, 2, highlight) +"</tr>"
164
- + "<tr><td>Mer:</td>"+ parseHorairesOuverture(anArray.horairesOuvertureMercredi, 3, highlight) +"</tr>"
165
- + "<tr><td>Jeu:</td>"+ parseHorairesOuverture(anArray.horairesOuvertureJeudi, 4, highlight) +"</tr>"
166
- + "<tr><td>Ven:</td>"+ parseHorairesOuverture(anArray.horairesOuvertureVendredi, 5, highlight) +"</tr>"
167
- + "<tr><td>Sam:</td>"+ parseHorairesOuverture(anArray.horairesOuvertureSamedi, 6, highlight) +"</tr>"
168
- + "<tr><td>Dim:</td>"+ parseHorairesOuverture(anArray.horairesOuvertureDimanche, 0, highlight) +"</tr>"
169
- + "</table>" ;
170
- return rs ;
171
- }
172
-
173
- function parseAdresse(anArray)
174
- {
175
- var address = anArray.adresse1 + "<br />" ;
176
- if (anArray.adresse2)
177
- address += anArray.adresse2 + "<br />" ;
178
- if (anArray.adresse3)
179
- address += anArray.adresse3 + "<br />" ;
180
- return address ;
181
- }
182
-
183
- function parseHorairesOuverture(value , day, highlight)
184
- {
185
- var rs = "" ;
186
-
187
- var now = new Date() ;
188
- var today = now.getDay() ; // number of day
189
- var attributedCell = "" ;
190
- var reg = new RegExp(" ", "g");
191
-
192
- var horaires = value.split(reg) ;
193
-
194
- for (var i=0; i < horaires.length; i++)
195
- {
196
- // first define the attributes for the current cell
197
- if ( highlight == true && day == today)
198
- {
199
- attributedCell = "style=\"color:red;\"" ;
200
- }
201
- else
202
- {
203
- attributedCell = "" ;
204
- }
205
-
206
- // so, re-format time
207
- if (horaires[i] == "00:00-00:00")
208
- {
209
- horaires[i] = "<td "+attributedCell+">Ferm&eacute;</td>" ;
210
- }
211
- else
212
- {
213
- horaires[i] = "<td "+attributedCell+">"+horaires[i]+"</td>" ;
214
- }
215
-
216
- // yeah, concatenates result to the returned value
217
- rs += horaires[i] ;
218
- }
219
-
220
- return rs ;
221
- }
222
-
223
- function printPage(i)
224
- {
225
- var fen=open("","Impression");
226
- fen.focus();
227
- var baseURL = "http://www.chronopost.fr/transport-express/webdav/site/chronov4/groups/administrators/public/Chronomaps/" ;
228
- var latlngpoint = relaylatan[i-1];
229
- if(latlngpoint) {
230
- fen.location.href = baseURL
231
- + "print-result.html?request=print&"
232
- + btQueryString(addressrelais[i-1], true)
233
- + "&rtype=chronorelais"
234
- + "&icnname=ac"
235
- + "&lat=" + latlngpoint[1]
236
- + "&lng=" + latlngpoint[0]
237
- + "&sw-form-type-point=opt_chrlas"
238
- + "&is_print_direction=" + false
239
- + "&from_addr="
240
- + "&to_addr=";
241
- }
242
- }
243
-
244
- function btQueryString(anArray, needEscape)
245
- {
246
- var rs = "" ;
247
- for (key in anArray)
248
- {
249
- if (needEscape == true)
250
- {
251
- if(anArray[key]) {
252
- if (rs != "")
253
- rs += "&"
254
- rs += key +"=" + escape(anArray[key]) ;
255
- }
256
- }
257
- else
258
- {
259
- if(anArray[key]) {
260
- if (rs != "")
261
- rs += "_-_"
262
- rs += key +"=" + anArray[key] ;
263
- }
264
- }
265
- }
266
- return rs ;
267
- }
268
-
269
- function getShipAddress() {
270
- var ship_address = '';
271
- if($('shipping:same_as_billing').checked) {
272
- if ($('billing-address-select') && $('billing-address-select').value) {
273
- var e = $('billing-address-select');
274
- var address_value = e.options[e.selectedIndex].text;
275
- var shipping_address = address_value.split(',');
276
- if(shipping_address[1]) {
277
- ship_address = shipping_address[1];
278
- }
279
- } else {
280
- if($('billing:street1')) { ship_address = $('billing:street1').value; }
281
- if($('billing:street2')) { ship_address = ship_address+" "+$('billing:street2').value; }
282
- if($('billing:street3')) { ship_address = ship_address+" "+$('billing:street3').value; }
283
- }
284
- } else {
285
- if ($('shipping-address-select') && $('shipping-address-select').value) {
286
- var e = $('shipping-address-select');
287
- var address_value = e.options[e.selectedIndex].text;
288
- var shipping_address = address_value.split(',');
289
- if(shipping_address[1]) {
290
- ship_address = shipping_address[1];
291
- }
292
- } else {
293
- if($('shipping:street1')) { ship_address = $('shipping:street1').value; }
294
- if($('shipping:street2')) { ship_address = ship_address+" "+$('shipping:street2').value; }
295
- if($('shipping:street3')) { ship_address = ship_address+" "+$('shipping:street3').value; }
296
- }
297
- }
298
- return ship_address;
299
- }
300
-
301
- /** Map content end **/
302
-
303
-
304
- // shipping method
305
- var ShippingMethod = Class.create();
306
- ShippingMethod.prototype = {
307
- initialize: function(form, saveUrl){
308
- this.form = form;
309
- if ($(this.form)) {
310
- $(this.form).observe('submit', function(event){this.save();Event.stop(event);}.bind(this));
311
- }
312
- this.saveUrl = saveUrl;
313
- this.validator = new Validation(this.form);
314
- this.onSave = this.nextStep.bindAsEventListener(this);
315
- this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
316
- },
317
-
318
- validate: function() {
319
- var methods = document.getElementsByName('shipping_method');
320
- if (methods.length==0) {
321
- alert(Translator.translate('Your order cannot be completed at this time as there is no shipping methods available for it. Please make neccessary changes in your shipping address.'));
322
- return false;
323
- }
324
-
325
- if(!this.validator.validate()) {
326
- return false;
327
- }
328
-
329
- for (var i=0; i<methods.length; i++) {
330
- if (methods[i].checked) {
331
- return true;
332
- }
333
- }
334
- alert(Translator.translate('Please specify shipping method.'));
335
- return false;
336
- },
337
-
338
- getrelais: function(url){
339
- if (checkout.loadWaiting!=false) return;
340
- if (this.validate()) {
341
- checkout.setLoadWaiting('shipping-method');
342
- hidehomeicon = false;
343
- var request = new Ajax.Request(
344
- url,
345
- {
346
- method:'post',
347
- onComplete: this.onComplete,
348
- onSuccess: this.onSave,
349
- onFailure: checkout.ajaxFailure.bind(checkout),
350
- parameters: Form.serialize(this.form)
351
- }
352
- );
353
- }
354
- },
355
-
356
- changePostalCode: function(url){
357
- if (checkout.loadWaiting!=false) return;
358
- if (this.validate()) {
359
- if(!$('mappostalcode').value) { return false; }
360
- checkout.setLoadWaiting('shipping-method');
361
- $('mappostalcodebtn').hide();
362
- $('postalcode-please-wait').show();
363
- $('postalcode-please-wait').style.opacity = '0.5';
364
- hidehomeicon = true;
365
- var request = new Ajax.Request(
366
- url,
367
- {
368
- method:'post',
369
- onComplete: this.onComplete,
370
- onSuccess: this.onSave,
371
- onFailure: checkout.ajaxFailure.bind(checkout),
372
- parameters: Form.serialize(this.form)
373
- }
374
- );
375
- }
376
- },
377
-
378
- hiderelais: function(url){
379
- if($('checkout-shipping-method-chronorelais-load')) {
380
- $('checkout-shipping-method-chronorelais-load').innerHTML = "";
381
- }
382
- },
383
-
384
- save: function(){
385
-
386
- if (checkout.loadWaiting!=false) return;
387
- if (this.validate()) {
388
- checkout.setLoadWaiting('shipping-method');
389
- var request = new Ajax.Request(
390
- this.saveUrl,
391
- {
392
- method:'post',
393
- onComplete: this.onComplete,
394
- onSuccess: this.onSave,
395
- onFailure: checkout.ajaxFailure.bind(checkout),
396
- parameters: Form.serialize(this.form)
397
- }
398
- );
399
- }
400
- },
401
-
402
- resetLoadWaiting: function(transport){
403
- checkout.setLoadWaiting(false);
404
- },
405
-
406
- nextStep: function(transport){
407
- if (transport && transport.responseText){
408
- try{
409
- response = eval('(' + transport.responseText + ')');
410
- }
411
- catch (e) {
412
- response = {};
413
- }
414
- }
415
-
416
- if (response.error) {
417
- alert(response.message);
418
- if($('mappostalcodebtn')) { $('mappostalcodebtn').show(); }
419
- if($('postalcode-please-wait')) { $('postalcode-please-wait').hide(); }
420
- return false;
421
- }
422
-
423
- if (response.update_section) {
424
- $('checkout-'+response.update_section.name+'-load').update(response.update_section.html);
425
- response.update_section.html.evalScripts();
426
-
427
- if(response.relaypoints) {
428
- if(response.relaypoints.length>0) {
429
- var relayaddress = "";
430
- gmarkers = [];
431
- addressrelais = [];
432
- relaylatan = [];
433
- homeaddress = "";
434
- next_pt = 0;
435
- bounds = new GLatLngBounds();
436
- for(var s=0; s<response.relaypoints.length; s++) {
437
- next_pt = s+1;
438
- relayaddress = response.relaypoints[s].adresse1;
439
- if(response.relaypoints[s].codePostal)
440
- relayaddress += " "+response.relaypoints[s].codePostal;
441
- if(response.relaypoints[s].localite)
442
- relayaddress += " "+response.relaypoints[s].localite;
443
- loadRelayMap(relayaddress, response.relaypoints[s], next_pt);
444
- }
445
- }
446
- }
447
- }
448
-
449
- payment.initWhatIsCvvListeners();
450
-
451
- if (response.goto_section) {
452
- checkout.gotoSection(response.goto_section);
453
- checkout.reloadProgressBlock();
454
- return;
455
- }
456
-
457
- if (response.payment_methods_html) {
458
- $('checkout-payment-method-load').update(response.payment_methods_html);
459
- }
460
-
461
- checkout.setShippingMethod();
462
- }
463
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var gmarkers = [];
2
+ var map;
3
+ var homeaddress = "";
4
+ var addressrelais = [];
5
+ var relaylatan = [];
6
+ var next_pt = 0;
7
+ var hidehomeicon = false;
8
+
9
+ function loadMyPoint(i) {
10
+ GEvent.trigger(gmarkers[i], "click");
11
+ }
12
+
13
+ var bounds = new GLatLngBounds();
14
+ function loadRelayMap(address, relaisArray, nextpt, mapid) {
15
+ if (GBrowserIsCompatible()) {
16
+ var geo = new GClientGeocoder();
17
+ var reasons=[];
18
+ reasons[G_GEO_SUCCESS] = "Success";
19
+ reasons[G_GEO_MISSING_ADDRESS] = "Missing Address: The address was either missing or had no value.";
20
+ reasons[G_GEO_UNKNOWN_ADDRESS] = "Unknown Address: No corresponding geographic location could be found for the specified address.";
21
+ reasons[G_GEO_UNAVAILABLE_ADDRESS]= "Unavailable Address: The geocode for the given address cannot be returned due to legal or contractual reasons.";
22
+ reasons[G_GEO_BAD_KEY] = "Bad Key: The API key is either invalid or does not match the domain for which it was given";
23
+ reasons[G_GEO_TOO_MANY_QUERIES] = "Too Many Queries: The daily geocoding quota for this site has been exceeded.";
24
+ reasons[G_GEO_SERVER_ERROR] = "Server error: The geocoding request could not be successfully processed.";
25
+
26
+ map = new GMap2(document.getElementById(mapid));
27
+ //map.addControl(new GLargeMapControl());
28
+ map.setUIToDefault();
29
+
30
+ var blueIcon = new GIcon();
31
+ blueIcon.iconSize = new GSize(45, 30);
32
+ blueIcon.iconAnchor = new GPoint(9, 34);
33
+ blueIcon.infoWindowAnchor = new GPoint(9, 2);
34
+ blueIcon.transparent = Picto_Chrono_Relais;
35
+ var homeicon = new GIcon();
36
+ homeicon.iconSize = new GSize(32, 37);
37
+ homeicon.iconAnchor = new GPoint(9, 34);
38
+ homeicon.infoWindowAnchor = new GPoint(9, 2);
39
+ homeicon.transparent = Home_Chrono_Icon;
40
+
41
+ if(!homeaddress && !hidehomeicon) {
42
+ var ship_address = getShipAddress(); //get shipping address to set home address
43
+ homeaddress = relaisArray.codePostal + " " + relaisArray.localite;
44
+ if(ship_address) { homeaddress = ship_address+" "+homeaddress; }
45
+
46
+ geo.getLocations(homeaddress , function(result) {
47
+ if (result.Status.code == G_GEO_SUCCESS) {
48
+ var p = result.Placemark[0].Point.coordinates;
49
+ var point = new GLatLng(p[1],p[0]);
50
+ var marker = new GMarker(point,{title:'home',icon:homeicon});
51
+ map.addOverlay(marker);
52
+ map.setCenter(point, 17-5);
53
+ }
54
+ });
55
+ }
56
+
57
+ function createTabbedMarker(point, relaisArray) {
58
+ //alert(point);
59
+ addressrelais.push(relaisArray);
60
+ var label = nextpt;
61
+ var relaypoint_id = relaisArray.identifiantChronopostPointA2PAS;
62
+ var marker = new GMarker(point,{title:relaisArray.nomEnseigne,icon:blueIcon});
63
+ var tab = new GInfoWindowTab ("Infos", '<div id="sw-infowindow-info" class="sw-infowindow">'+getMarkerInfoContent(relaisArray) + getActionsForm(label)+'</div>');
64
+ var tab2 = new GInfoWindowTab ("Horaires", '<div id="sw-infowindow-hor" class="sw-infowindow">'+"<h2>Horaires</h2>"+getHorairesTab(relaisArray, true)+'</div>') ;
65
+
66
+ GEvent.addListener(marker, "click", function() {
67
+ if(document.getElementById('s_method_chronorelais_'+relaisArray.identifiantChronopostPointA2PAS))
68
+ document.getElementById('s_method_chronorelais_'+relaisArray.identifiantChronopostPointA2PAS).checked = true;
69
+ marker.openInfoWindowTabsHtml([tab, tab2]);
70
+ });
71
+ //gmarkers.push(marker);
72
+ gmarkers[relaypoint_id] = marker;
73
+ return marker;
74
+ }
75
+
76
+ function showAddress(address, relaisArray) {
77
+ var search = address;
78
+ // ====== Perform the Geocoding ======
79
+ geo.getLocations(search, function (result)
80
+ {
81
+ // If that was successful
82
+ if (result.Status.code == G_GEO_SUCCESS) {
83
+ // Loop through the results, placing markers
84
+ //for (var i=0; i<result.Placemark.length; i++) {
85
+ for (var i=0; i<1; i++) {
86
+ var p = result.Placemark[i].Point.coordinates;
87
+ relaylatan.push(p);
88
+ var point = new GLatLng(p[1],p[0]);
89
+ var marker = createTabbedMarker(point, relaisArray);
90
+ map.addOverlay(marker);
91
+ // ==== Each time a point is found, extent the bounds ato include it =====
92
+ bounds.extend(point);
93
+ }
94
+ // centre the map on the first result
95
+ //!homeaddress && hidehomeicon &&
96
+ if(nextpt==5) {
97
+ var p = result.Placemark[0].Point.coordinates;
98
+ map.setCenter(new GLatLng(p[1],p[0]),17-5);
99
+ // ===== determine the zoom level from the bounds =====
100
+ map.setZoom(map.getBoundsZoomLevel(bounds));
101
+ // ===== determine the centre from the bounds ======
102
+ map.setCenter(bounds.getCenter());
103
+ }
104
+ }
105
+ // ====== Decode the error status ======
106
+ else {
107
+ var reason="Code "+result.Status.code;
108
+ if (reasons[result.Status.code]) {
109
+ reason = reasons[result.Status.code]
110
+ }
111
+ alert('Could not find "'+search+ '" ' + reason);
112
+ }
113
+ }
114
+ );
115
+ }
116
+ showAddress(address, relaisArray);
117
+
118
+ } else {
119
+ alert("Sorry, the Google Maps API is not compatible with this browser");
120
+ }
121
+ } // end of loadRelayMap function
122
+
123
+ function addEvent( obj, type, fn ) {
124
+ if ( obj.attachEvent ) {
125
+ obj["e"+type+fn] = fn;
126
+ obj[type+fn] = function() { obj["e"+type+fn]( window.event ) };
127
+ obj.attachEvent( "on"+type, obj[type+fn] );
128
+ }
129
+ else{
130
+ obj.addEventListener( type, fn, false );
131
+ }
132
+ }
133
+
134
+ function getMarkerInfoContent(relaisArray){
135
+ var icoPath = Picto_Chrono_Relais;
136
+ var content="<div class=\"sw-map-adresse-wrp\" style=\"background-image: url("+ icoPath +"); background-repeat: no-repeat;padding-left:50px;\">"
137
+ + "<h2>"+relaisArray.nomEnseigne+"</h2>"
138
+ + "<div class=\"sw-map-adresse\">"
139
+ + parseAdresse(relaisArray)
140
+ + relaisArray.codePostal + " " + relaisArray.localite
141
+ + "</div></div>";
142
+ return content;
143
+ }
144
+ function getActionsForm(label)
145
+ {
146
+ var html = '<div class="sw-map-tools"><a href="javascript:printPage('+label+')">Imprimer</a>'
147
+ + '</div>';
148
+ return html;
149
+ }
150
+
151
+ function getHorairesTab(anArray, highlight)
152
+ {
153
+ var userAgent = navigator.userAgent.toLowerCase();
154
+ var msie = /msie/.test( userAgent ) && !/opera/.test( userAgent );
155
+
156
+ var rs = "" ;
157
+ rs = "<table id=\"sw-table-horaire\" class=\"sw-table\"";
158
+ if(msie) {
159
+ rs += " style=\"width:auto;\"";
160
+ }
161
+ rs += ">"
162
+ + "<tr><td>Lun:</td>"+ parseHorairesOuverture(anArray.horairesOuvertureLundi, 1, highlight) +"</tr>"
163
+ + "<tr><td>Mar:</td>"+ parseHorairesOuverture(anArray.horairesOuvertureMardi, 2, highlight) +"</tr>"
164
+ + "<tr><td>Mer:</td>"+ parseHorairesOuverture(anArray.horairesOuvertureMercredi, 3, highlight) +"</tr>"
165
+ + "<tr><td>Jeu:</td>"+ parseHorairesOuverture(anArray.horairesOuvertureJeudi, 4, highlight) +"</tr>"
166
+ + "<tr><td>Ven:</td>"+ parseHorairesOuverture(anArray.horairesOuvertureVendredi, 5, highlight) +"</tr>"
167
+ + "<tr><td>Sam:</td>"+ parseHorairesOuverture(anArray.horairesOuvertureSamedi, 6, highlight) +"</tr>"
168
+ + "<tr><td>Dim:</td>"+ parseHorairesOuverture(anArray.horairesOuvertureDimanche, 0, highlight) +"</tr>"
169
+ + "</table>" ;
170
+ return rs ;
171
+ }
172
+
173
+ function parseAdresse(anArray)
174
+ {
175
+ var address = anArray.adresse1 + "<br />" ;
176
+ if (anArray.adresse2)
177
+ address += anArray.adresse2 + "<br />" ;
178
+ if (anArray.adresse3)
179
+ address += anArray.adresse3 + "<br />" ;
180
+ return address ;
181
+ }
182
+
183
+ function parseHorairesOuverture(value , day, highlight)
184
+ {
185
+ var rs = "" ;
186
+
187
+ var now = new Date() ;
188
+ var today = now.getDay() ; // number of day
189
+ var attributedCell = "" ;
190
+ var reg = new RegExp(" ", "g");
191
+
192
+ var horaires = value.split(reg) ;
193
+
194
+ for (var i=0; i < horaires.length; i++)
195
+ {
196
+ // first define the attributes for the current cell
197
+ /* Aucun jour n'est mis en exergue car on ne sait pas quel sera le jour de livraison
198
+ if ( highlight == true && day == today)
199
+ {
200
+ attributedCell = "style=\"color:red;\"" ;
201
+ }
202
+ else
203
+ {
204
+ */
205
+ attributedCell = "" ;
206
+ /*
207
+ }
208
+ */
209
+
210
+ // so, re-format time
211
+ if (horaires[i] == "00:00-00:00")
212
+ {
213
+ horaires[i] = "<td "+attributedCell+">Ferm&eacute;</td>" ;
214
+ }
215
+ else
216
+ {
217
+ horaires[i] = "<td "+attributedCell+">"+horaires[i]+"</td>" ;
218
+ }
219
+
220
+ // yeah, concatenates result to the returned value
221
+ rs += horaires[i] ;
222
+ }
223
+
224
+ return rs ;
225
+ }
226
+
227
+ function printPage(i)
228
+ {
229
+ var fen=open("","Impression");
230
+ fen.focus();
231
+ var baseURL = "http://www.chronopost.fr/transport-express/webdav/site/chronov4/groups/administrators/public/Chronomaps/" ;
232
+ var latlngpoint = relaylatan[i-1];
233
+ if(latlngpoint) {
234
+ fen.location.href = baseURL
235
+ + "print-result.html?request=print&"
236
+ + btQueryString(addressrelais[i-1], true)
237
+ + "&rtype=chronorelais"
238
+ + "&icnname=ac"
239
+ + "&lat=" + latlngpoint[1]
240
+ + "&lng=" + latlngpoint[0]
241
+ + "&sw-form-type-point=opt_chrlas"
242
+ + "&is_print_direction=" + false
243
+ + "&from_addr="
244
+ + "&to_addr=";
245
+ }
246
+ }
247
+
248
+ function btQueryString(anArray, needEscape)
249
+ {
250
+ var rs = "" ;
251
+ for (key in anArray)
252
+ {
253
+ if (needEscape == true)
254
+ {
255
+ if(anArray[key]) {
256
+ if (rs != "")
257
+ rs += "&"
258
+ rs += key +"=" + escape(anArray[key]) ;
259
+ }
260
+ }
261
+ else
262
+ {
263
+ if(anArray[key]) {
264
+ if (rs != "")
265
+ rs += "_-_"
266
+ rs += key +"=" + anArray[key] ;
267
+ }
268
+ }
269
+ }
270
+ return rs ;
271
+ }
272
+
273
+ function getShipAddress() {
274
+ var ship_address = '';
275
+ if($('shipping:same_as_billing').checked) {
276
+ if ($('billing-address-select') && $('billing-address-select').value) {
277
+ var e = $('billing-address-select');
278
+ var address_value = e.options[e.selectedIndex].text;
279
+ var shipping_address = address_value.split(',');
280
+ if(shipping_address[1]) {
281
+ ship_address = shipping_address[1];
282
+ }
283
+ } else {
284
+ if($('billing:street1')) { ship_address = $('billing:street1').value; }
285
+ if($('billing:street2')) { ship_address = ship_address+" "+$('billing:street2').value; }
286
+ if($('billing:street3')) { ship_address = ship_address+" "+$('billing:street3').value; }
287
+ }
288
+ } else {
289
+ if ($('shipping-address-select') && $('shipping-address-select').value) {
290
+ var e = $('shipping-address-select');
291
+ var address_value = e.options[e.selectedIndex].text;
292
+ var shipping_address = address_value.split(',');
293
+ if(shipping_address[1]) {
294
+ ship_address = shipping_address[1];
295
+ }
296
+ } else {
297
+ if($('shipping:street1')) { ship_address = $('shipping:street1').value; }
298
+ if($('shipping:street2')) { ship_address = ship_address+" "+$('shipping:street2').value; }
299
+ if($('shipping:street3')) { ship_address = ship_address+" "+$('shipping:street3').value; }
300
+ }
301
+ }
302
+ return ship_address;
303
+ }
304
+
305
+ /** Map content end **/
306
+
307
+
308
+ // shipping method
309
+ var ShippingMethod = Class.create();
310
+ ShippingMethod.prototype = {
311
+ initialize: function(form, saveUrl){
312
+ this.form = form;
313
+ if ($(this.form)) {
314
+ $(this.form).observe('submit', function(event){this.save();Event.stop(event);}.bind(this));
315
+ }
316
+ this.saveUrl = saveUrl;
317
+ this.validator = new Validation(this.form);
318
+ this.onSave = this.nextStep.bindAsEventListener(this);
319
+ this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
320
+ },
321
+
322
+ validate: function() {
323
+ var methods = document.getElementsByName('shipping_method');
324
+ if (methods.length==0) {
325
+ alert(Translator.translate('Your order cannot be completed at this time as there is no shipping methods available for it. Please make neccessary changes in your shipping address.'));
326
+ return false;
327
+ }
328
+
329
+ if(!this.validator.validate()) {
330
+ return false;
331
+ }
332
+
333
+ for (var i=0; i<methods.length; i++) {
334
+ if (methods[i].checked) {
335
+ return true;
336
+ }
337
+ }
338
+ alert(Translator.translate('Please specify shipping method.'));
339
+ return false;
340
+ },
341
+
342
+ getrelais: function(url){
343
+ if (checkout.loadWaiting!=false) return;
344
+ if (this.validate()) {
345
+ checkout.setLoadWaiting('shipping-method');
346
+ hidehomeicon = false;
347
+ var request = new Ajax.Request(
348
+ url,
349
+ {
350
+ method:'post',
351
+ onComplete: this.onComplete,
352
+ onSuccess: this.onSave,
353
+ onFailure: checkout.ajaxFailure.bind(checkout),
354
+ parameters: Form.serialize(this.form)
355
+ }
356
+ );
357
+ }
358
+ },
359
+
360
+ changePostalCode: function(url){
361
+ if (checkout.loadWaiting!=false) return;
362
+ if (this.validate()) {
363
+ if(!$('mappostalcode').value) { return false; }
364
+ checkout.setLoadWaiting('shipping-method');
365
+ $('mappostalcodebtn').hide();
366
+ $('postalcode-please-wait').show();
367
+ $('postalcode-please-wait').style.opacity = '0.5';
368
+ hidehomeicon = true;
369
+ var request = new Ajax.Request(
370
+ url,
371
+ {
372
+ method:'post',
373
+ onComplete: this.onComplete,
374
+ onSuccess: this.onSave,
375
+ onFailure: checkout.ajaxFailure.bind(checkout),
376
+ parameters: Form.serialize(this.form)
377
+ }
378
+ );
379
+ }
380
+ },
381
+
382
+ hiderelais: function(url){
383
+ if($('checkout-shipping-method-chronorelais-load')) {
384
+ $('checkout-shipping-method-chronorelais-load').innerHTML = "";
385
+ }
386
+ },
387
+
388
+ save: function(){
389
+
390
+ if (checkout.loadWaiting!=false) return;
391
+ if (this.validate()) {
392
+ checkout.setLoadWaiting('shipping-method');
393
+ var request = new Ajax.Request(
394
+ this.saveUrl,
395
+ {
396
+ method:'post',
397
+ onComplete: this.onComplete,
398
+ onSuccess: this.onSave,
399
+ onFailure: checkout.ajaxFailure.bind(checkout),
400
+ parameters: Form.serialize(this.form)
401
+ }
402
+ );
403
+ }
404
+ },
405
+
406
+ resetLoadWaiting: function(transport){
407
+ checkout.setLoadWaiting(false);
408
+ },
409
+
410
+ nextStep: function(transport){
411
+ if (transport && transport.responseText){
412
+ try{
413
+ response = eval('(' + transport.responseText + ')');
414
+ }
415
+ catch (e) {
416
+ response = {};
417
+ }
418
+ }
419
+
420
+ if (response.error) {
421
+ alert(response.message);
422
+ if($('mappostalcodebtn')) { $('mappostalcodebtn').show(); }
423
+ if($('postalcode-please-wait')) { $('postalcode-please-wait').hide(); }
424
+ return false;
425
+ }
426
+
427
+ if (response.update_section) {
428
+ $('checkout-'+response.update_section.name+'-load').update(response.update_section.html);
429
+ response.update_section.html.evalScripts();
430
+
431
+ if(response.relaypoints) {
432
+ if(response.relaypoints.length>0) {
433
+ var relayaddress = "";
434
+ gmarkers = [];
435
+ addressrelais = [];
436
+ relaylatan = [];
437
+ homeaddress = "";
438
+ next_pt = 0;
439
+ bounds = new GLatLngBounds();
440
+ for(var s=0; s<response.relaypoints.length; s++) {
441
+ next_pt = s+1;
442
+ relayaddress = response.relaypoints[s].adresse1;
443
+ if(response.relaypoints[s].codePostal)
444
+ relayaddress += " "+response.relaypoints[s].codePostal;
445
+ if(response.relaypoints[s].localite)
446
+ relayaddress += " "+response.relaypoints[s].localite;
447
+ loadRelayMap(relayaddress, response.relaypoints[s], next_pt, "chronomap");
448
+ }
449
+ }
450
+ }
451
+ }
452
+
453
+ payment.initWhatIsCvvListeners();
454
+
455
+ if (response.goto_section) {
456
+ checkout.gotoSection(response.goto_section);
457
+ checkout.reloadProgressBlock();
458
+ return;
459
+ }
460
+
461
+ if (response.payment_methods_html) {
462
+ $('checkout-payment-method-load').update(response.payment_methods_html);
463
+ }
464
+
465
+ checkout.setShippingMethod();
466
+ }
467
+ }
468
+
469
+ // shipping method
470
+ var multiindex = "";
471
+ var MultiShippingMethod = Class.create();
472
+ MultiShippingMethod.prototype = {
473
+ initialize: function(){
474
+ this.loadWaiting = false;
475
+ this.onComplete = this.complete.bindAsEventListener(this);
476
+ },
477
+
478
+ getrelais: function(url, index, home){
479
+ if (this.loadWaiting!=false) return;
480
+ this.loadWaiting = true;
481
+ homeaddress = home;
482
+ hidehomeicon = false;
483
+ multiindex = "_" + index;
484
+ var request = new Ajax.Request(
485
+ url,
486
+ {
487
+ method:'post',
488
+ onComplete: this.onComplete
489
+ //onSuccess: this.onSave,
490
+ //onFailure: checkout.ajaxFailure.bind(checkout),
491
+ //parameters: Form.serialize(this.form)
492
+ }
493
+ );
494
+
495
+ },
496
+
497
+ changePostalCode: function(url, index){
498
+ if (this.loadWaiting!=false) return;
499
+ this.loadWaiting = true;
500
+ multiindex = "_" + index;
501
+ if(!$('mappostalcode' + multiindex).value) { return false; }
502
+ homeaddress = $('mappostalcode' + multiindex).value;
503
+ $('mappostalcodebtn' + multiindex).hide();
504
+ $('postalcode-please-wait' + multiindex).show();
505
+ $('postalcode-please-wait' + multiindex).style.opacity = '0.5';
506
+ hidehomeicon = true;
507
+ var request = new Ajax.Request(
508
+ url + '&zip=' + $('mappostalcode' + multiindex).value,
509
+ {
510
+ method:'post',
511
+ onComplete: this.onComplete
512
+ //onSuccess: this.onSave,
513
+ //onFailure: checkout.ajaxFailure.bind(checkout),
514
+ //parameters: Form.serialize('mappostalcodeform' + multiindex)
515
+ }
516
+ );
517
+ },
518
+
519
+ hiderelais: function(url, index){
520
+ if($('checkout-shipping-method-chronorelais-load_' + index)) {
521
+ $('checkout-shipping-method-chronorelais-load_' + index).innerHTML = "";
522
+ }
523
+ },
524
+
525
+ complete: function(transport){
526
+ this.loadWaiting = false;
527
+
528
+ if (transport && transport.responseText){
529
+ try{
530
+ response = eval('(' + transport.responseText + ')');
531
+ }
532
+ catch (e) {
533
+ response = {};
534
+ }
535
+ }
536
+
537
+ if (response.error) {
538
+ alert(response.message);
539
+ if($('mappostalcodebtn' + multiindex)) { $('mappostalcodebtn' + multiindex).show(); }
540
+ if($('postalcode-please-wait' + multiindex)) { $('postalcode-please-wait' + multiindex).hide(); }
541
+ return false;
542
+ }
543
+
544
+ if (response.update_section) {
545
+ $(response.update_section.name).update(response.update_section.html);
546
+ response.update_section.html.evalScripts();
547
+
548
+ if(response.relaypoints) {
549
+ if(response.relaypoints.length>0) {
550
+ var relayaddress = "";
551
+ gmarkers = [];
552
+ addressrelais = [];
553
+ relaylatan = [];
554
+ next_pt = 0;
555
+ bounds = new GLatLngBounds();
556
+ for(var s=0; s<response.relaypoints.length; s++) {
557
+ next_pt = s+1;
558
+ relayaddress = response.relaypoints[s].adresse1;
559
+ if(response.relaypoints[s].codePostal)
560
+ relayaddress += " "+response.relaypoints[s].codePostal;
561
+ if(response.relaypoints[s].localite)
562
+ relayaddress += " "+response.relaypoints[s].localite;
563
+ loadRelayMap(relayaddress, response.relaypoints[s], next_pt, 'chronomap' + multiindex);
564
+ }
565
+ }
566
+ }
567
+ }
568
+ }
569
+ }