tig_myparcel - Version 1.3.0

Version Notes

==== 1.3.0 ====
==== New features ====
- Shipping methods connected to MyParcel
- Minimal order price PakjeGemak
- Labels printing via shipping overview

==== Bug fixes ====
- Various bugs fixed

== v1.1.4 ==

- Pakjegemak extra address-validation on order detail page

known bugs:
None. Please contact us if you find a bug.

== v1.1.3 ==

- Print-position overlay optimised
- New translations
- Extended logging functionality

Download this release

Release Info

Developer TIG
Extension tig_myparcel
Version 1.3.0
Comparing to
See all releases


Code changes from version 1.1.4 to 1.3.0

Files changed (64) hide show
  1. app/code/community/TIG/MyParcel2014/Block/Adminhtml/Sales/Order/Shipment/Create/ConsignmentOptions.php +100 -18
  2. app/code/community/TIG/MyParcel2014/Block/Adminhtml/Sales/Order/Shipment/ShippingInfo.php +265 -14
  3. app/code/community/TIG/MyParcel2014/Block/Adminhtml/Sales/Order/View/ShippingInfo.php +16 -0
  4. app/code/community/TIG/MyParcel2014/{controllers/IndexController.php → Block/Adminhtml/System/Config/AdminSecure.php} +11 -6
  5. app/code/community/TIG/MyParcel2014/Block/Adminhtml/System/Config/Hidden.php +183 -0
  6. app/code/community/TIG/MyParcel2014/Block/Adminhtml/Widget/Grid/Column/Renderer/Shipment/ShippingStatus.php +98 -0
  7. app/code/community/TIG/MyParcel2014/Block/Adminhtml/Widget/Grid/Column/Renderer/ShippingStatus.php +0 -2
  8. app/code/community/TIG/MyParcel2014/Block/Checkout/Js.php +64 -0
  9. app/code/community/TIG/MyParcel2014/Block/Checkout/Progress.php +63 -0
  10. app/code/community/TIG/MyParcel2014/Block/Pakjegemak.php +0 -5
  11. app/code/community/TIG/MyParcel2014/Helper/Data.php +51 -85
  12. app/code/community/TIG/MyParcel2014/Model/Adminhtml/Observer/OrderGrid.php +28 -11
  13. app/code/community/TIG/MyParcel2014/Model/Adminhtml/Observer/ShipmentGrid.php +441 -0
  14. app/code/community/TIG/MyParcel2014/Model/Adminhtml/Observer/ViewShipment.php +111 -0
  15. app/code/community/TIG/MyParcel2014/Model/Adminhtml/Support/Logs.php +0 -2
  16. app/code/community/TIG/MyParcel2014/Model/Api/Curl.php +318 -0
  17. app/code/community/TIG/MyParcel2014/Model/Api/MyParcel.php +153 -69
  18. app/code/community/TIG/MyParcel2014/Model/Carrier/MyParcel.php +148 -18
  19. app/code/community/TIG/MyParcel2014/Model/Checkout/Service.php +156 -0
  20. app/code/community/TIG/MyParcel2014/Model/Checkout/Validate.php +176 -0
  21. app/code/community/TIG/MyParcel2014/Model/Observer/SaveConfig.php +2 -2
  22. app/code/community/TIG/MyParcel2014/Model/Observer/SavePgAddress.php +9 -328
  23. app/code/community/TIG/MyParcel2014/Model/Observer/SaveShipment.php +111 -2
  24. app/code/community/TIG/MyParcel2014/Model/Resource/Setup.php +46 -0
  25. app/code/community/TIG/MyParcel2014/Model/Resource/Shipment/Grid/Collection.php +97 -0
  26. app/code/community/TIG/MyParcel2014/Model/Shipment.php +118 -27
  27. app/code/community/TIG/MyParcel2014/Model/System/Config/Source/ShippingMethods.php +122 -0
  28. app/code/community/TIG/MyParcel2014/controllers/Adminhtml/ConfigController.php +13 -2
  29. app/code/community/TIG/MyParcel2014/controllers/Adminhtml/ShipmentController.php +370 -122
  30. app/code/community/TIG/MyParcel2014/controllers/CheckoutController.php +164 -0
  31. app/code/community/TIG/MyParcel2014/etc/config.xml +45 -35
  32. app/code/community/TIG/MyParcel2014/etc/system.xml +72 -8
  33. app/code/community/TIG/MyParcel2014/sql/tig_myparcel_setup/upgrade-1.1.4-1.2.0.php +83 -0
  34. app/design/adminhtml/default/default/layout/TIG/tig_myparcel.xml +32 -1
  35. app/design/adminhtml/default/default/template/TIG/MyParcel2014/sales/order/mass_actions.phtml +102 -48
  36. app/design/adminhtml/default/default/template/TIG/MyParcel2014/sales/order/shipment/create/consignment_options.phtml +88 -53
  37. app/design/adminhtml/default/default/template/TIG/MyParcel2014/sales/order/shipment/mass_actions.phtml +182 -0
  38. app/design/adminhtml/default/default/template/TIG/MyParcel2014/sales/order/shipment/shipping_info.phtml +152 -26
  39. app/design/adminhtml/default/default/template/TIG/MyParcel2014/system/config/supportTab.phtml +20 -17
  40. app/design/frontend/base/default/layout/TIG/tig_myparcel.xml +36 -19
  41. app/design/frontend/base/default/template/TIG/MyParcel2014/checkout/idev_onestepcheckout/js.phtml +185 -0
  42. app/design/frontend/base/default/template/TIG/MyParcel2014/checkout/onepage/js.phtml +228 -0
  43. app/design/frontend/base/default/template/TIG/MyParcel2014/checkout/onepage/progress.phtml +57 -0
  44. app/design/frontend/base/default/template/TIG/MyParcel2014/checkout/onepage/progress/pakje_gemak.phtml +48 -0
  45. app/design/frontend/base/default/template/TIG/MyParcel2014/onestepcheckout/shipping_method.phtml +0 -86
  46. app/design/frontend/base/default/template/TIG/MyParcel2014/pakjegemak.phtml +0 -88
  47. app/locale/en_US/TIG_MyParcel2014.csv +200 -149
  48. app/locale/nl_NL/TIG_MyParcel2014.csv +200 -149
  49. package.xml +20 -13
  50. skin/adminhtml/default/default/css/TIG/MyParcel2014/prototype_windows_themes_magento.css +63 -0
  51. skin/adminhtml/default/default/css/TIG/MyParcel2014/styles.css +1 -0
  52. skin/adminhtml/default/default/css/TIG/MyParcel2014/system_config_edit_myparcel.css +4 -2
  53. skin/adminhtml/default/default/images/TIG/MyParcel2014/magento/btn_bg.gif +0 -0
  54. skin/adminhtml/default/default/images/TIG/MyParcel2014/magento/content_bg.gif +0 -0
  55. skin/adminhtml/default/default/images/TIG/MyParcel2014/magento/top_bg.gif +0 -0
  56. skin/adminhtml/default/default/images/TIG/MyParcel2014/magento/window_close.png +0 -0
  57. skin/adminhtml/default/default/images/TIG/MyParcel2014/tig_logo_medium.png +0 -0
  58. skin/frontend/base/default/css/TIG/MyParcel2014/checkout.css +159 -0
  59. skin/frontend/base/default/images/TIG/MyParcel/checkout/loader_mini.gif +0 -0
  60. skin/frontend/base/default/images/TIG/MyParcel/checkout/logo_myparcel.png +0 -0
  61. skin/frontend/base/default/images/TIG/MyParcel/checkout/logo_postnl.png +0 -0
  62. skin/frontend/base/default/js/TIG/MyParcel2014/MutationObserver.js +568 -0
  63. skin/frontend/base/default/js/TIG/MyParcel2014/checkout.js +864 -0
  64. skin/frontend/base/default/js/TIG/MyParcel2014/pg_address.js +0 -157
app/code/community/TIG/MyParcel2014/Block/Adminhtml/Sales/Order/Shipment/Create/ConsignmentOptions.php CHANGED
@@ -38,9 +38,11 @@
38
  *
39
  * @method boolean hasShipment()
40
  * @method boolean hasShipmentBaseGrandTotal()
 
41
  *
42
  * @method TIG_MyParcel2014_Block_Adminhtml_Sales_Order_Shipment_Create_ConsignmentOptions setShipment(Mage_Sales_Model_Order_Shipment $value)
43
  * @method TIG_MyParcel2014_Block_Adminhtml_Sales_Order_Shipment_Create_ConsignmentOptions setShipmentBaseGrandTotal(float $value)
 
44
  *
45
  */
46
  class TIG_MyParcel2014_Block_Adminhtml_Sales_Order_Shipment_Create_ConsignmentOptions extends Mage_Adminhtml_Block_Abstract
@@ -132,19 +134,38 @@ class TIG_MyParcel2014_Block_Adminhtml_Sales_Order_Shipment_Create_ConsignmentOp
132
  }
133
 
134
  /**
135
- * Check if shipment country needs customs
136
  *
137
- * @return bool
138
  */
139
- public function countryNeedsCustoms()
140
  {
 
 
 
 
 
141
  $shipment = $this->getShipment();
142
- $helper = Mage::helper('tig_myparcel');
143
 
144
  $shippingAddress = $shipment->getShippingAddress();
145
 
146
  $countryCode = $shippingAddress->getCountry();
147
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  return $helper->countryNeedsCustoms($countryCode);
149
 
150
  }
@@ -171,6 +192,11 @@ class TIG_MyParcel2014_Block_Adminhtml_Sales_Order_Shipment_Create_ConsignmentOp
171
  return Mage::getModel('tig_myparcel/system_config_source_customs')->toOptionArray();
172
  }
173
 
 
 
 
 
 
174
  public function getIsSelected($shipmentOption)
175
  {
176
  $helper = Mage::helper('tig_myparcel');
@@ -216,26 +242,82 @@ class TIG_MyParcel2014_Block_Adminhtml_Sales_Order_Shipment_Create_ConsignmentOp
216
  */
217
  public function getIsInsured()
218
  {
 
 
219
  $helper = Mage::helper('tig_myparcel');
220
  $storeId = $this->getOrderStoreId();
221
  $orderTotalShipped = $this->getOrderTotal();
222
- $insuredType = 'insured_50';
223
- if($orderTotalShipped > 50 && $orderTotalShipped < 250){
224
- $insuredType = 'insured_250';
225
- }elseif($orderTotalShipped > 250){
226
- $insuredType = 'insured_500';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
  }
228
 
229
- $configValue = $helper->getConfig($insuredType,'shipment',$storeId);
230
- if(!empty($configValue) && $configValue > 0){
231
- if($orderTotalShipped < $configValue){
232
- return array(
233
- 'selected' => 'checked="checked"',
234
- 'insuredAmount' => $configValue,
235
- );
236
- }
 
 
 
 
 
237
  }
238
 
239
- return '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
240
  }
241
  }
38
  *
39
  * @method boolean hasShipment()
40
  * @method boolean hasShipmentBaseGrandTotal()
41
+ * @method string hasDestinationCountry()
42
  *
43
  * @method TIG_MyParcel2014_Block_Adminhtml_Sales_Order_Shipment_Create_ConsignmentOptions setShipment(Mage_Sales_Model_Order_Shipment $value)
44
  * @method TIG_MyParcel2014_Block_Adminhtml_Sales_Order_Shipment_Create_ConsignmentOptions setShipmentBaseGrandTotal(float $value)
45
+ * @method TIG_MyParcel2014_Block_Adminhtml_Sales_Order_Shipment_Create_ConsignmentOptions setDestinationCountry(string $value)
46
  *
47
  */
48
  class TIG_MyParcel2014_Block_Adminhtml_Sales_Order_Shipment_Create_ConsignmentOptions extends Mage_Adminhtml_Block_Abstract
134
  }
135
 
136
  /**
137
+ * Get this shipment's country of destination;
138
  *
139
+ * @return mixed
140
  */
141
+ public function getDestinationCountry()
142
  {
143
+ if ($this->hasDestinationCountry()) {
144
+ $countryCode = $this->_getData('destination_country');
145
+ return $countryCode;
146
+ }
147
+
148
  $shipment = $this->getShipment();
 
149
 
150
  $shippingAddress = $shipment->getShippingAddress();
151
 
152
  $countryCode = $shippingAddress->getCountry();
153
 
154
+ $this->setDestinationCountry($countryCode);
155
+ return $countryCode;
156
+ }
157
+
158
+ /**
159
+ * Check if shipment country needs customs
160
+ *
161
+ * @return bool
162
+ */
163
+ public function countryNeedsCustoms()
164
+ {
165
+ $helper = Mage::helper('tig_myparcel');
166
+
167
+ $countryCode = $this->getDestinationCountry();
168
+
169
  return $helper->countryNeedsCustoms($countryCode);
170
 
171
  }
192
  return Mage::getModel('tig_myparcel/system_config_source_customs')->toOptionArray();
193
  }
194
 
195
+ /**
196
+ * @param $shipmentOption
197
+ *
198
+ * @return string
199
+ */
200
  public function getIsSelected($shipmentOption)
201
  {
202
  $helper = Mage::helper('tig_myparcel');
242
  */
243
  public function getIsInsured()
244
  {
245
+
246
+ //load helper, store id and orderTotal
247
  $helper = Mage::helper('tig_myparcel');
248
  $storeId = $this->getOrderStoreId();
249
  $orderTotalShipped = $this->getOrderTotal();
250
+
251
+ //get the insured values
252
+ $insuredType50 = $helper->getConfig('insured_50', 'shipment', $storeId);
253
+ $insuredType250 = $helper->getConfig('insured_250', 'shipment', $storeId);
254
+ $insuredType500 = $helper->getConfig('insured_500', 'shipment', $storeId);
255
+
256
+ //check if the values are not empty/zero
257
+ $insuredType50 = (!empty($insuredType50) && $insuredType50 > 0)? $insuredType50 : false;
258
+ $insuredType250 = (!empty($insuredType250) && $insuredType250 > 0)? $insuredType250 : false;
259
+ $insuredType500 = (!empty($insuredType500) && $insuredType500 > 0)? $insuredType500 : false;
260
+
261
+ //if nothing is filled in, then set the default values, but do not pre-select
262
+ $selected = 'checked="checked"';
263
+ if(
264
+ false === $insuredType50 &&
265
+ false === $insuredType250 &&
266
+ false === $insuredType500
267
+ ){
268
+ $insuredType50 = 50;
269
+ $insuredType250 = 250;
270
+ $insuredType500 = 500;
271
+ $selected = 0;
272
  }
273
 
274
+ if(false !== $insuredType500 && $orderTotalShipped > $insuredType500){
275
+ $insuredValue = $insuredType500;
276
+ $insuredUpTo = 500;
277
+ }elseif(false !== $insuredType250 && $orderTotalShipped > $insuredType250){
278
+ $insuredValue = $insuredType250;
279
+ $insuredUpTo = 250;
280
+ }elseif(false !== $insuredType50 && $orderTotalShipped > $insuredType50){
281
+ $insuredValue = $insuredType50;
282
+ $insuredUpTo = 50;
283
+ }else{
284
+ $insuredValue = 0;
285
+ $insuredUpTo = 0;
286
+ $selected = 0;
287
  }
288
 
289
+ $returnArray = array(
290
+ 'option' => 'insured',
291
+ 'selected' => $selected,
292
+ 'insuredAmount' => 0,
293
+ 'insuredUpTo' => 0,
294
+ );
295
+
296
+ if($insuredValue > 0){
297
+ $returnArray = array(
298
+ 'option' => 'insured',
299
+ 'selected' => $selected,
300
+ 'insuredAmount' => $insuredValue,
301
+ 'insuredUpTo' => $insuredUpTo,
302
+ );
303
+ }
304
+
305
+ return $returnArray;
306
+ }
307
+
308
+ /**
309
+ * Check if the shipment is placed using Pakjegemak
310
+ *
311
+ * @return bool
312
+ */
313
+ public function getIsPakjeGemak()
314
+ {
315
+ $helper = Mage::helper('tig_myparcel');
316
+ $shipment = Mage::registry('current_shipment');
317
+
318
+ if($helper->getPgAddress($shipment->getOrder())){
319
+ return true;
320
+ }
321
+ return false;
322
  }
323
  }
app/code/community/TIG/MyParcel2014/Block/Adminhtml/Sales/Order/Shipment/ShippingInfo.php CHANGED
@@ -36,7 +36,7 @@
36
  * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
- class TIG_MyParcel2014_Block_Adminhtml_Sales_Order_Shipment_ShippingInfo extends Mage_Adminhtml_Block_Abstract
40
  {
41
  protected $_shipment;
42
 
@@ -46,9 +46,33 @@ class TIG_MyParcel2014_Block_Adminhtml_Sales_Order_Shipment_ShippingInfo extends
46
  $this->_shipment = Mage::getModel('sales/order_shipment')->load($shipmentId);
47
 
48
  $myParcelShipment = Mage::getModel('tig_myparcel/shipment')->load($shipmentId, 'shipment_id');
49
- Mage::log($myParcelShipment);
50
  }
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  public function getPgAddressHtml()
53
  {
54
  $res = array();
@@ -69,10 +93,8 @@ class TIG_MyParcel2014_Block_Adminhtml_Sales_Order_Shipment_ShippingInfo extends
69
  public function isCredited()
70
  {
71
  return false;
72
- //return $sdjdsajk->asdasdsad == 1;
73
  }
74
 
75
-
76
  public function getCreditText()
77
  {
78
  $helper = Mage::helper('tig_myparcel');
@@ -98,22 +120,251 @@ class TIG_MyParcel2014_Block_Adminhtml_Sales_Order_Shipment_ShippingInfo extends
98
  }
99
 
100
  /**
101
- * Do a few checks to see if the template should be rendered before actually rendering it.
102
  *
103
- * @return string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  *
105
- * @see Mage_Adminhtml_Block_Abstract::_toHtml()
106
  */
107
- protected function _toHtml()
108
  {
 
109
  $helper = Mage::helper('tig_myparcel');
110
 
111
- if (!$helper->isEnabled()
112
- || !$this->_shipment
113
- || !$helper->shippingMethodIsMyParcel($this->_shipment->getOrder()->getShippingMethod())
114
- ) {
115
- return '';
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  }
117
- return parent::_toHtml();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  }
119
  }
36
  * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
+ class TIG_MyParcel2014_Block_Adminhtml_Sales_Order_Shipment_ShippingInfo extends Mage_Adminhtml_Block_Template
40
  {
41
  protected $_shipment;
42
 
46
  $this->_shipment = Mage::getModel('sales/order_shipment')->load($shipmentId);
47
 
48
  $myParcelShipment = Mage::getModel('tig_myparcel/shipment')->load($shipmentId, 'shipment_id');
 
49
  }
50
 
51
+ /**
52
+ * Do a few checks to see if the template should be rendered before actually rendering it.
53
+ *
54
+ * @return string
55
+ *
56
+ * @see Mage_Adminhtml_Block_Abstract::_toHtml()
57
+ */
58
+ protected function _toHtml()
59
+ {
60
+ $helper = Mage::helper('tig_myparcel');
61
+
62
+ if (!$helper->isEnabled()
63
+ || !$this->_shipment
64
+ || !$helper->shippingMethodIsMyParcel($this->_shipment->getOrder()->getShippingMethod())
65
+ ) {
66
+ return '';
67
+ }
68
+ return parent::_toHtml();
69
+ }
70
+
71
+ /**
72
+ * Get html for the PGaddress
73
+ *
74
+ * @return string
75
+ */
76
  public function getPgAddressHtml()
77
  {
78
  $res = array();
93
  public function isCredited()
94
  {
95
  return false;
 
96
  }
97
 
 
98
  public function getCreditText()
99
  {
100
  $helper = Mage::helper('tig_myparcel');
120
  }
121
 
122
  /**
123
+ * Calculates a shipment's base grand total based on it's shipment items
124
  *
125
+ * @return float|null
126
+ */
127
+ public function getOrderTotal()
128
+ {
129
+ if ($this->hasShipmentBaseGrandTotal()) {
130
+ return $this->_getData('shipment_base_grand_total');
131
+ }
132
+
133
+ /**
134
+ * Check if this Myparcel shipment has a linked Mage_Sales_Model_Order_Shipment object
135
+ */
136
+ $shipment = $this->getShipment();
137
+ if (!$shipment) {
138
+ return null;
139
+ }
140
+
141
+ /**
142
+ * Loop through all associated shipment items and add each item's row total to the shipment's total
143
+ */
144
+ $baseGrandTotal = 0;
145
+ $shipmentItems = $shipment->getAllItems();
146
+
147
+ /**
148
+ * @var Mage_Sales_Model_Order_Shipment_Item $shipmentItem
149
+ */
150
+ foreach ($shipmentItems as $shipmentItem) {
151
+ $qty = $shipmentItem->getQty();
152
+
153
+ /**
154
+ * The base price of a shipment item is only available through it's associated order item
155
+ */
156
+ $basePrice = $shipmentItem->getOrderItem()->getBasePrice();
157
+
158
+ /**
159
+ * Calculate and add the shipment item's row total
160
+ */
161
+ $totalBasePrice = $basePrice * $qty;
162
+ $baseGrandTotal += $totalBasePrice;
163
+ }
164
+
165
+ $this->setShipmentBaseGrandTotal($baseGrandTotal);
166
+ return $baseGrandTotal;
167
+ }
168
+
169
+ /**
170
+ * Check if shipment country needs customs
171
  *
172
+ * @return bool
173
  */
174
+ public function countryNeedsCustoms()
175
  {
176
+ $shipment = $this->getShipment();
177
  $helper = Mage::helper('tig_myparcel');
178
 
179
+ $shippingAddress = $shipment->getShippingAddress();
180
+
181
+ $countryCode = $shippingAddress->getCountry();
182
+
183
+ return $helper->countryNeedsCustoms($countryCode);
184
+
185
+ }
186
+
187
+ /**
188
+ * Get this shipment's country of destination;
189
+ *
190
+ * @return mixed
191
+ */
192
+ public function getDestinationCountry()
193
+ {
194
+ if ($this->hasDestinationCountry()) {
195
+ $countryCode = $this->_getData('destination_country');
196
+ return $countryCode;
197
  }
198
+
199
+ $shipment = $this->getShipment();
200
+
201
+ $shippingAddress = $shipment->getShippingAddress();
202
+
203
+ $countryCode = $shippingAddress->getCountry();
204
+
205
+ $this->setDestinationCountry($countryCode);
206
+ return $countryCode;
207
+ }
208
+
209
+ /**
210
+ * get storeid from where the order was placed
211
+ *
212
+ * @return int
213
+ */
214
+ public function getOrderStoreId()
215
+ {
216
+ $shipment = $this->getShipment();
217
+
218
+ return $shipment->getOrder()->getStoreId();
219
+ }
220
+
221
+ /**
222
+ * get the customs type array
223
+ *
224
+ * @return array
225
+ */
226
+ public function getCustomsTypeOptions()
227
+ {
228
+ return Mage::getModel('tig_myparcel/system_config_source_customs')->toOptionArray();
229
+ }
230
+
231
+ public function getIsSelected($shipmentOption)
232
+ {
233
+ $helper = Mage::helper('tig_myparcel');
234
+ $storeId = $this->getOrderStoreId();
235
+ $orderTotalShipped = $this->getOrderTotal();
236
+
237
+ $configValue = $helper->getConfig($shipmentOption,'shipment',$storeId);
238
+ if(!empty($configValue) && $configValue > 0){
239
+ if($orderTotalShipped >= $configValue){
240
+ return 'checked="checked"';
241
+ }
242
+ }
243
+ return '';
244
+ }
245
+
246
+ /**
247
+ * @return string
248
+ */
249
+ public function getIsHomeSelected()
250
+ {
251
+ return $this->getIsSelected('home_address_only');
252
+
253
+ }
254
+
255
+ /**
256
+ * @return string
257
+ */
258
+ public function getIsSignatureOnReceipt()
259
+ {
260
+ return $this->getIsSelected('signature_on_receipt');
261
+ }
262
+
263
+ /**
264
+ * @return string
265
+ */
266
+ public function getIsReturnOnNoAnswer()
267
+ {
268
+ return $this->getIsSelected('return_if_no_answer');
269
+ }
270
+
271
+ /**
272
+ * @return string
273
+ */
274
+ public function getIsInsured()
275
+ {
276
+ //load helper, store id and orderTotal
277
+ $helper = Mage::helper('tig_myparcel');
278
+ $storeId = $this->getOrderStoreId();
279
+ $orderTotalShipped = $this->getOrderTotal();
280
+
281
+ //get the insured values
282
+ $insuredType50 = $helper->getConfig('insured_50', 'shipment', $storeId);
283
+ $insuredType250 = $helper->getConfig('insured_250', 'shipment', $storeId);
284
+ $insuredType500 = $helper->getConfig('insured_500', 'shipment', $storeId);
285
+
286
+ //check if the values are not empty/zero
287
+ $insuredType50 = (!empty($insuredType50) && $insuredType50 > 0)? $insuredType50 : false;
288
+ $insuredType250 = (!empty($insuredType250) && $insuredType250 > 0)? $insuredType250 : false;
289
+ $insuredType500 = (!empty($insuredType500) && $insuredType500 > 0)? $insuredType500 : false;
290
+
291
+ //if nothing is filled in, then set the default values, but do not pre-select
292
+ $selected = 'checked="checked"';
293
+ if(
294
+ false === $insuredType50 &&
295
+ false === $insuredType250 &&
296
+ false === $insuredType500
297
+ ){
298
+ $insuredType50 = 50;
299
+ $insuredType250 = 250;
300
+ $insuredType500 = 500;
301
+ $selected = 0;
302
+ }
303
+
304
+ if(false !== $insuredType500 && $orderTotalShipped > $insuredType500){
305
+ $insuredValue = $insuredType500;
306
+ $insuredUpTo = 500;
307
+ }elseif(false !== $insuredType250 && $orderTotalShipped > $insuredType250){
308
+ $insuredValue = $insuredType250;
309
+ $insuredUpTo = 250;
310
+ }elseif(false !== $insuredType50 && $orderTotalShipped > $insuredType50){
311
+ $insuredValue = $insuredType50;
312
+ $insuredUpTo = 50;
313
+ }else{
314
+ $insuredValue = 0;
315
+ $insuredUpTo = 0;
316
+ $selected = 0;
317
+ }
318
+
319
+ $returnArray = array(
320
+ 'option' => 'insured',
321
+ 'selected' => $selected,
322
+ 'insuredAmount' => 0,
323
+ 'insuredUpTo' => 0,
324
+ );
325
+
326
+ if($insuredValue > 0){
327
+ $returnArray = array(
328
+ 'option' => 'insured',
329
+ 'selected' => $selected,
330
+ 'insuredAmount' => $insuredValue,
331
+ 'insuredUpTo' => $insuredUpTo,
332
+ );
333
+ }
334
+
335
+ return $returnArray;
336
+ }
337
+
338
+ /**
339
+ * Get current shipment
340
+ *
341
+ * @return Mage_Sales_Model_Order_Shipment.
342
+ */
343
+ public function getShipment()
344
+ {
345
+ if ($this->hasShipment()) {
346
+ return $this->_getData('shipment');
347
+ }
348
+
349
+ $shipment = Mage::registry('current_shipment');
350
+
351
+ $this->setShipment($shipment);
352
+ return $shipment;
353
+ }
354
+
355
+ /**
356
+ * Check if the shipment is placed using Pakjegemak
357
+ *
358
+ * @return bool
359
+ */
360
+ public function getIsPakjeGemak()
361
+ {
362
+ $helper = Mage::helper('tig_myparcel');
363
+ $shipment = Mage::registry('current_shipment');
364
+
365
+ if($helper->getPgAddress($shipment->getOrder())){
366
+ return true;
367
+ }
368
+ return false;
369
  }
370
  }
app/code/community/TIG/MyParcel2014/Block/Adminhtml/Sales/Order/View/ShippingInfo.php CHANGED
@@ -85,4 +85,20 @@ class TIG_MyParcel2014_Block_Adminhtml_Sales_Order_View_ShippingInfo extends Mag
85
 
86
  return parent::_toHtml();
87
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  }
85
 
86
  return parent::_toHtml();
87
  }
88
+
89
+ /**
90
+ * Check if the shipment is placed using Pakjegemak
91
+ *
92
+ * @return bool
93
+ */
94
+ public function getIsPakjeGemak()
95
+ {
96
+ $helper = Mage::helper('tig_myparcel');
97
+ $shipment = Mage::registry('current_shipment');
98
+
99
+ if($helper->getPgAddress($shipment->getOrder())){
100
+ return true;
101
+ }
102
+ return false;
103
+ }
104
  }
app/code/community/TIG/MyParcel2014/{controllers/IndexController.php → Block/Adminhtml/System/Config/AdminSecure.php} RENAMED
@@ -33,14 +33,19 @@
33
  * versions in the future. If you wish to customize this module for your
34
  * needs please contact servicedesk@tig.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
- class TIG_MyParcel2014_IndexController extends Mage_Core_Controller_Front_Action
 
 
40
  {
41
- public function pakjegemakAction()
 
42
  {
43
- echo $this->getLayout()->createBlock('tig_myparcel/pakjegemak')->toHTML();
44
- exit;
 
45
  }
46
- }
 
33
  * versions in the future. If you wish to customize this module for your
34
  * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
+
40
+ class TIG_MyParcel2014_Block_Adminhtml_System_Config_AdminSecure
41
+ extends TIG_MyParcel2014_Block_Adminhtml_System_Config_Hidden
42
  {
43
+
44
+ protected function _getValue()
45
  {
46
+ $isSecure = Mage::getStoreConfigFlag('web/secure/use_in_adminhtml');
47
+ Mage::log($isSecure, null, 'test.log', true);
48
+ return $isSecure;
49
  }
50
+
51
+ }
app/code/community/TIG/MyParcel2014/Block/Adminhtml/System/Config/Hidden.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2015 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_MyParcel2014_Block_Adminhtml_System_Config_Hidden
40
+ extends Mage_Adminhtml_Block_System_Config_Form_Field
41
+ {
42
+ /**
43
+ * Decorate field row html
44
+ *
45
+ * @param Varien_Data_Form_Element_Abstract $element
46
+ * @param string $html
47
+ * @return string
48
+ */
49
+ protected function _decorateRowHtml($element, $html)
50
+ {
51
+ return '<tr id="row_' . $element->getHtmlId() . '" style="display:none;">' . $html . '</tr>';
52
+ }
53
+
54
+ /**
55
+ * Overloaded for forwards compatibility for Magento 1.6.
56
+ *
57
+ * @param Varien_Data_Form_Element_Abstract $element
58
+ * @return string
59
+ */
60
+ public function render(Varien_Data_Form_Element_Abstract $element)
61
+ {
62
+ $id = $element->getHtmlId();
63
+
64
+ $html = '<td class="label"><label for="'.$id.'">'.$element->getLabel().'</label></td>';
65
+
66
+ //$isDefault = !$this->getRequest()->getParam('website') && !$this->getRequest()->getParam('store');
67
+ $isMultiple = $element->getExtType()==='multiple';
68
+
69
+ // replace [value] with [inherit]
70
+ $namePrefix = preg_replace('#\[value\](\[\])?$#', '', $element->getName());
71
+
72
+ $options = $element->getValues();
73
+
74
+ $addInheritCheckbox = false;
75
+ if ($element->getCanUseWebsiteValue()) {
76
+ $addInheritCheckbox = true;
77
+ $checkboxLabel = $this->__('Use Website');
78
+ }
79
+ elseif ($element->getCanUseDefaultValue()) {
80
+ $addInheritCheckbox = true;
81
+ $checkboxLabel = $this->__('Use Default');
82
+ }
83
+
84
+ if ($addInheritCheckbox) {
85
+ $inherit = $element->getInherit()==1 ? 'checked="checked"' : '';
86
+ if ($inherit) {
87
+ $element->setDisabled(true);
88
+ }
89
+ }
90
+
91
+ if ($element->getTooltip()) {
92
+ $html .= '<td class="value with-tooltip">';
93
+ $html .= $this->_getElementHtml($element);
94
+ $html .= '<div class="field-tooltip"><div>' . $element->getTooltip() . '</div></div>';
95
+ } else {
96
+ $html .= '<td class="value">';
97
+ $html .= $this->_getElementHtml($element);
98
+ };
99
+ if ($element->getComment()) {
100
+ $html.= '<p class="note"><span>'.$element->getComment().'</span></p>';
101
+ }
102
+ $html.= '</td>';
103
+
104
+ if ($addInheritCheckbox) {
105
+
106
+ $defText = $element->getDefaultValue();
107
+ if ($options) {
108
+ $defTextArr = array();
109
+ foreach ($options as $k=>$v) {
110
+ if ($isMultiple) {
111
+ if (is_array($v['value']) && in_array($k, $v['value'])) {
112
+ $defTextArr[] = $v['label'];
113
+ }
114
+ } elseif (isset($v['value'])) {
115
+ if ($v['value'] == $defText) {
116
+ $defTextArr[] = $v['label'];
117
+ break;
118
+ }
119
+ } elseif (!is_array($v)) {
120
+ if ($k == $defText) {
121
+ $defTextArr[] = $v;
122
+ break;
123
+ }
124
+ }
125
+ }
126
+ $defText = join(', ', $defTextArr);
127
+ }
128
+
129
+ // default value
130
+ $html.= '<td class="use-default">';
131
+ $html.= '<input id="' . $id . '_inherit" name="'
132
+ . $namePrefix . '[inherit]" type="checkbox" value="1" class="checkbox config-inherit" '
133
+ . $inherit . ' onclick="toggleValueElements(this, Element.previous(this.parentNode))" /> ';
134
+ $html.= '<label for="' . $id . '_inherit" class="inherit" title="'
135
+ . htmlspecialchars($defText) . '">' . $checkboxLabel . '</label>';
136
+ $html.= '</td>';
137
+ }
138
+
139
+ $html.= '<td class="scope-label">';
140
+ if ($element->getScope()) {
141
+ $html .= $element->getScopeLabel();
142
+ }
143
+ $html.= '</td>';
144
+
145
+ $html.= '<td class="">';
146
+ if ($element->getHint()) {
147
+ $html.= '<div class="hint" >';
148
+ $html.= '<div style="display: none;">' . $element->getHint() . '</div>';
149
+ $html.= '</div>';
150
+ }
151
+ $html.= '</td>';
152
+
153
+ return $this->_decorateRowHtml($element, $html);
154
+ }
155
+
156
+ /**
157
+ * Get the element's HTML.
158
+ *
159
+ * @param Varien_Data_Form_Element_Abstract $element
160
+ * @return string
161
+ */
162
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
163
+ {
164
+ $value = $this->_getValue();
165
+
166
+ $html = '<input id="'.$element->getHtmlId().'" name="'.$element->getName()
167
+ .'" value="' . $value . '" '.$this->serialize($element->getHtmlAttributes()).'/>'."\n";
168
+ $html.= $element->getAfterElementHtml();
169
+ return $html;
170
+ }
171
+
172
+ /**
173
+ * Value getter.
174
+ *
175
+ * This method should be overloaded in child methods.
176
+ *
177
+ * @return string
178
+ */
179
+ protected function _getValue()
180
+ {
181
+ return '';
182
+ }
183
+ }
app/code/community/TIG/MyParcel2014/Block/Adminhtml/Widget/Grid/Column/Renderer/Shipment/ShippingStatus.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_MyParcel2014_Block_Adminhtml_Widget_Grid_Column_Renderer_Shipment_ShippingStatus
40
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Text
41
+ {
42
+ /**
43
+ * Additional column names used
44
+ */
45
+ const SHIPPING_METHOD_COLUMN = 'shipping_method';
46
+ const POSTCODE_COLUMN = 'postcode';
47
+ const COUNTRY_ID_COLUMN = 'country_id';
48
+ const BARCODE_COLUMN = 'barcode';
49
+
50
+ /**
51
+ * Renders the barcode column. This column will be empty for non-MyParcel shipments.
52
+ * If the shipment has been confirmed, it will be displayed as a track& trace URL.
53
+ * Otherwise the bare code will be displayed.
54
+ *
55
+ * @param Varien_Object $row
56
+ *
57
+ * @return string
58
+ */
59
+ public function render(Varien_Object $row)
60
+ {
61
+ /**
62
+ * The shipment was not shipped using MyParcel
63
+ */
64
+ $shippingMethod = $row->getData(self::SHIPPING_METHOD_COLUMN);
65
+ if (!Mage::helper('tig_myparcel')->shippingMethodIsMyParcel($shippingMethod)) {
66
+ return '';
67
+ }
68
+
69
+ /**
70
+ * Check if any data is available.
71
+ */
72
+ $value = $row->getData($this->getColumn()->getIndex());
73
+ if (!$value) {
74
+ return '';
75
+ }
76
+
77
+ /**
78
+ * Create a track & trace URL based on shipping destination
79
+ */
80
+ $countryCode = $row->getData(self::COUNTRY_ID_COLUMN);
81
+ $postcode = $row->getData(self::POSTCODE_COLUMN);
82
+ $destinationData = array(
83
+ 'countryCode' => $countryCode,
84
+ 'postcode' => $postcode,
85
+ );
86
+
87
+ $barcode = $row->getData(self::BARCODE_COLUMN);
88
+ if (!empty($barcode)) {
89
+ $barcodeUrl = Mage::helper('tig_myparcel')->getBarcodeUrl($barcode, $destinationData, false, true);
90
+
91
+ $barcodeHtml = "<small>{$value}</small> - <a href='{$barcodeUrl}' target='_blank'>{$barcode}</a>";
92
+ } else {
93
+ $barcodeHtml = $value;
94
+ }
95
+
96
+ return $barcodeHtml;
97
+ }
98
+ }
app/code/community/TIG/MyParcel2014/Block/Adminhtml/Widget/Grid/Column/Renderer/ShippingStatus.php CHANGED
@@ -92,8 +92,6 @@ class TIG_MyParcel2014_Block_Adminhtml_Widget_Grid_Column_Renderer_ShippingStatu
92
  $barcodeUrl = Mage::helper('tig_myparcel')->getBarcodeUrl($barcodes[$key], $destinationData, false, true);
93
 
94
  $barcodeData[] = "<small>{$status}</small> - <a href='{$barcodeUrl}' target='_blank'>{$barcodes[$key]}</a>";
95
- } else {
96
- $barcodeData[] = $status;
97
  }
98
  }
99
 
92
  $barcodeUrl = Mage::helper('tig_myparcel')->getBarcodeUrl($barcodes[$key], $destinationData, false, true);
93
 
94
  $barcodeData[] = "<small>{$status}</small> - <a href='{$barcodeUrl}' target='_blank'>{$barcodes[$key]}</a>";
 
 
95
  }
96
  }
97
 
app/code/community/TIG/MyParcel2014/Block/Checkout/Js.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2015 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_MyParcel2014_Block_Checkout_Js extends Mage_Core_Block_Template
40
+ {
41
+ /**
42
+ * Xpath to the 'pakjegemak_active' setting.
43
+ */
44
+ const XPATH_PAKJEGEMAK_ACTIVE = 'carriers/myparcel/pakjegemak_active';
45
+
46
+ /**
47
+ * Check if PakjeGemak is active before rendering the template.
48
+ *
49
+ * @return string
50
+ */
51
+ protected function _toHtml()
52
+ {
53
+ if (!Mage::helper('tig_myparcel')->isEnabled()) {
54
+ return '';
55
+ }
56
+
57
+ $pakjeGemakActive = Mage::getStoreConfigFlag(self::XPATH_PAKJEGEMAK_ACTIVE, Mage::app()->getStore()->getId());
58
+ if (!$pakjeGemakActive) {
59
+ return '';
60
+ }
61
+
62
+ return parent::_toHtml();
63
+ }
64
+ }
app/code/community/TIG/MyParcel2014/Block/Checkout/Progress.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2015 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_MyParcel2014_Block_Checkout_Progress extends Mage_Checkout_Block_Onepage_Progress
40
+ {
41
+ /**
42
+ * @return string|false
43
+ */
44
+ public function getPakjeGemakAddress()
45
+ {
46
+ $quote =$this->getCheckout()->getQuote();
47
+
48
+ $pakjeGemakAddress = false;
49
+ /** @var Mage_Sales_Model_Quote_Address $address */
50
+ foreach ($quote->getAllAddresses() as $address) {
51
+ if ($address->getAddressType() == 'pakje_gemak') {
52
+ $pakjeGemakAddress = $address;
53
+ break;
54
+ }
55
+ }
56
+
57
+ if (!$pakjeGemakAddress) {
58
+ return false;
59
+ }
60
+
61
+ return $pakjeGemakAddress->format('html');
62
+ }
63
+ }
app/code/community/TIG/MyParcel2014/Block/Pakjegemak.php DELETED
@@ -1,5 +0,0 @@
1
- <?php
2
- class TIG_MyParcel2014_Block_Pakjegemak extends Mage_Core_Block_Template
3
- {
4
- protected $_template = 'TIG/MyParcel2014/pakjegemak.phtml';
5
- }
 
 
 
 
 
app/code/community/TIG/MyParcel2014/Helper/Data.php CHANGED
@@ -50,7 +50,7 @@ class TIG_MyParcel2014_Helper_Data extends Mage_Core_Helper_Abstract {
50
  * Regular expression used to split street name from house number. This regex works well for dutch addresses, but
51
  * may fail for international addresses. We strongly recommend using split address lines instead.
52
  */
53
- const SPLIT_STREET_REGEX = '#\A(.*?)\s+(\d+[a-zA-Z]{0,1}\s{0,1}[-]{1}\s{0,1}\d*[a-zA-Z]{0,1}|\d+[a-zA-Z-]{0,1}\d*[a-zA-Z]{0,1})#';
54
 
55
  /**
56
  * Regular expression used to split house number and house number extension
@@ -75,10 +75,7 @@ class TIG_MyParcel2014_Helper_Data extends Mage_Core_Helper_Abstract {
75
  * Localised track and trace base URL's
76
  */
77
  const POSTNL_TRACK_AND_TRACE_NL_BASE_URL = 'https://mijnpakket.postnl.nl/Inbox/Search?';
78
- const POSTNL_TRACK_AND_TRACE_GB_BASE_URL = 'http://parcels-uk.tntpost.com/mytrackandtrace/trackandtrace.aspx?';
79
- const POSTNL_TRACK_AND_TRACE_DE_BASE_URL = 'http://parcels-de.tntpost.com/de/mytrackandtrace/TrackAndTrace.aspx?';
80
- const POSTNL_TRACK_AND_TRACE_FR_BASE_URL = 'http://parcels-fr.tntpost.com/fr/mytrackandtrace/TrackAndTrace.aspx?';
81
- const POSTNL_TRACK_AND_TRACE_INT_BASE_URL = 'http://www.postnlpakketten.nl/klantenservice/tracktrace/basicsearch.aspx?';
82
 
83
  /**
84
  * List of MyParcel shipping methods.
@@ -99,22 +96,15 @@ class TIG_MyParcel2014_Helper_Data extends Mage_Core_Helper_Abstract {
99
  */
100
  public function getConfig($value, $group = 'general', $storeId = null, $decrypt = false)
101
  {
102
- if(empty($storeId)) // in case of frontend calls
103
- {
104
  $storeId = Mage::app()->getStore()->getId();
105
  }
106
  $config = Mage::getStoreConfig('tig_myparcel/' . $group . '/' . $value, $storeId);
107
 
108
- if($decrypt)
109
- {
110
  $config = Mage::helper('core')->decrypt($config);
111
  }
112
 
113
- if(Mage::app()->getStore()->isCurrentlySecure())
114
- {
115
- $config = str_replace('http://', 'https://', $config);
116
- }
117
-
118
  return trim($config);
119
  }
120
 
@@ -173,27 +163,14 @@ class TIG_MyParcel2014_Helper_Data extends Mage_Core_Helper_Abstract {
173
  */
174
  public function getMyParcelShippingMethods()
175
  {
176
- if ($this->_myParcelShippingMethods != null) {
177
- return $this->_myParcelShippingMethods;
178
- }
179
-
180
- /**
181
- * Get the MyParcel carrier code and all it's methods.
182
- */
183
- $myParcelCarrier = Mage::getModel('tig_myparcel/carrier_myParcel');
184
- $myParcelCode = $myParcelCarrier->getCarrierCode();
185
- $myParcelMethods = $myParcelCarrier->getAllowedMethods();
186
 
187
- /**
188
- * Form an array of shipping methods.
189
- */
190
- $methods = array();
191
- foreach (array_keys($myParcelMethods) as $method) {
192
- $methods[] = $myParcelCode . '_' . $method;
193
  }
194
 
195
- $this->_myParcelShippingMethods = $methods;
196
- return $methods;
197
  }
198
 
199
  /**
@@ -246,8 +223,11 @@ class TIG_MyParcel2014_Helper_Data extends Mage_Core_Helper_Abstract {
246
  'SK','ES','CZ','GB','SE',
247
  );
248
  $whitelisted = in_array($countryCode, $whitelist);
 
 
 
249
 
250
- return (!$whitelisted);
251
  }
252
 
253
  /**
@@ -265,17 +245,25 @@ class TIG_MyParcel2014_Helper_Data extends Mage_Core_Helper_Abstract {
265
  $countryCode = null;
266
  $postcode = null;
267
  if (is_array($destination)) {
 
 
 
 
268
  $countryCode = $destination['countryCode'];
269
  $postcode = $destination['postcode'];
270
- }
 
 
 
271
 
272
- if (is_object($destination) && $destination instanceof Varien_Object) {
273
  $countryCode = $destination->getCountry();
274
  $postcode = str_replace(' ', '', $destination->getPostcode());
 
 
275
  }
276
 
277
  /**
278
- * Get the dutch track & trace URL for dutch shipments or for the admin
279
  */
280
  if ($forceNl
281
  || (!empty($countryCode)
@@ -285,7 +273,7 @@ class TIG_MyParcel2014_Helper_Data extends Mage_Core_Helper_Abstract {
285
  $barcodeUrl = self::POSTNL_TRACK_AND_TRACE_NL_BASE_URL
286
  . '&b=' . $barcode;
287
  /**
288
- * For dutch shipments add the postcode. For international shipments add an 'international' flag
289
  */
290
  if (!empty($postcode)
291
  && !empty($countryCode)
@@ -300,52 +288,14 @@ class TIG_MyParcel2014_Helper_Data extends Mage_Core_Helper_Abstract {
300
  }
301
 
302
  /**
303
- * Get localized track & trace URLs for UK, DE and FR shipments
304
- */
305
- if (isset($countryCode)
306
- && ($countryCode == 'UK'
307
- || $countryCode == 'GB'
308
- )
309
- ) {
310
- $barcodeUrl = self::POSTNL_TRACK_AND_TRACE_GB_BASE_URL
311
- . '&B=' . $barcode
312
- . '&D=GB'
313
- . '&lang=en';
314
-
315
- return $barcodeUrl;
316
- }
317
-
318
- if (isset($countryCode) && $countryCode == 'DE') {
319
- $barcodeUrl = self::POSTNL_TRACK_AND_TRACE_DE_BASE_URL
320
- . '&B=' . $barcode
321
- . '&D=DE'
322
- . '&lang=de';
323
-
324
- return $barcodeUrl;
325
- }
326
-
327
- if (isset($countryCode) && $countryCode == 'FR') {
328
- $barcodeUrl = self::POSTNL_TRACK_AND_TRACE_FR_BASE_URL
329
- . '&B=' . $barcode
330
- . '&D=FR'
331
- . '&lang=fr';
332
-
333
- return $barcodeUrl;
334
- }
335
-
336
- /**
337
- * Get a general track & trace URL for all other destinations
338
  */
339
  $barcodeUrl = self::POSTNL_TRACK_AND_TRACE_INT_BASE_URL
340
- . '&B=' . $barcode
341
- . '&I=true';
342
-
343
- if ($lang) {
344
- $barcodeUrl .= '&lang=' . strtolower($lang);
345
- }
346
 
347
- if ($countryCode) {
348
- $barcodeUrl .= '&D=' . $countryCode;
349
  }
350
 
351
  return $barcodeUrl;
@@ -939,32 +889,48 @@ class TIG_MyParcel2014_Helper_Data extends Mage_Core_Helper_Abstract {
939
  return false;
940
  }
941
 
942
- $store = $myParcelShipment->getOrder()->getStoreId();
943
- $templateId = $this->getConfig('tracktrace_template','general',$store);
 
944
 
945
  //if no template is set, return false: tracktrace should be send by MyParcel
946
  if($templateId === null || $templateId == 'tig_myparcel_general_tracktrace_template'){
947
  return false;
948
  }
949
 
 
 
 
 
 
 
 
 
 
 
950
  $shippingAddress = $myParcelShipment->getShippingAddress();
951
  $barcodeUrl = $this->getBarcodeUrl($barcode,$shippingAddress);
952
  $templateVariables = array(
953
  'tracktrace_url' => $barcodeUrl,
 
 
 
 
954
  );
955
 
956
  try {
957
  $mailer = Mage::getModel('core/email_template_mailer');
958
  $emailInfo = Mage::getModel('core/email_info');
959
- $emailInfo->addTo($myParcelShipment->getOrder()->getCustomerEmail(), $shippingAddress->getName());
960
 
961
  $mailer->addEmailInfo($emailInfo);
962
 
963
  // Set all required params and send emails.
964
- $mailer->setSender(Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $store));
965
- $mailer->setStoreId($store);
966
  $mailer->setTemplateId($templateId);
967
  $mailer->setTemplateParams($templateVariables);
 
968
  $mailer->send();
969
  }catch(Exception $e) {
970
  $this->logException($e);
50
  * Regular expression used to split street name from house number. This regex works well for dutch addresses, but
51
  * may fail for international addresses. We strongly recommend using split address lines instead.
52
  */
53
+ const SPLIT_STREET_REGEX = '#\A(.*?)\s+(\d+\s[a-zA-Z]?|\d+[a-zA-Z]{0,1}\s{0,1}[-]{1}\s{0,1}\d*[a-zA-Z]{0,1}|\d+[a-zA-Z-]{0,1}\d*[a-zA-Z]{0,1})#';
54
 
55
  /**
56
  * Regular expression used to split house number and house number extension
75
  * Localised track and trace base URL's
76
  */
77
  const POSTNL_TRACK_AND_TRACE_NL_BASE_URL = 'https://mijnpakket.postnl.nl/Inbox/Search?';
78
+ const POSTNL_TRACK_AND_TRACE_INT_BASE_URL = 'https://www.internationalparceltracking.com/Main.aspx#/track';
 
 
 
79
 
80
  /**
81
  * List of MyParcel shipping methods.
96
  */
97
  public function getConfig($value, $group = 'general', $storeId = null, $decrypt = false)
98
  {
99
+ if (empty($storeId)) { // in case of frontend calls
 
100
  $storeId = Mage::app()->getStore()->getId();
101
  }
102
  $config = Mage::getStoreConfig('tig_myparcel/' . $group . '/' . $value, $storeId);
103
 
104
+ if ($decrypt) {
 
105
  $config = Mage::helper('core')->decrypt($config);
106
  }
107
 
 
 
 
 
 
108
  return trim($config);
109
  }
110
 
163
  */
164
  public function getMyParcelShippingMethods()
165
  {
166
+ if ($this->_myParcelShippingMethods == null) {
167
+ $shippingMethods = $this->getConfig('myparcel_shipping_methods');
168
+ $shippingMethods = explode(',', $shippingMethods);
 
 
 
 
 
 
 
169
 
170
+ $this->_myParcelShippingMethods = $shippingMethods;
 
 
 
 
 
171
  }
172
 
173
+ return $this->_myParcelShippingMethods;
 
174
  }
175
 
176
  /**
223
  'SK','ES','CZ','GB','SE',
224
  );
225
  $whitelisted = in_array($countryCode, $whitelist);
226
+ if (!$whitelisted) {
227
+ return true;
228
+ }
229
 
230
+ return false;
231
  }
232
 
233
  /**
245
  $countryCode = null;
246
  $postcode = null;
247
  if (is_array($destination)) {
248
+ if (!isset($destination['countryCode'])) {
249
+ throw new InvalidArgumentException("Destination must contain a country code.");
250
+ }
251
+
252
  $countryCode = $destination['countryCode'];
253
  $postcode = $destination['postcode'];
254
+ } elseif (is_object($destination) && $destination instanceof Varien_Object) {
255
+ if (!$destination->getCountry()) {
256
+ throw new InvalidArgumentException('Destination must contain a country code.');
257
+ }
258
 
 
259
  $countryCode = $destination->getCountry();
260
  $postcode = str_replace(' ', '', $destination->getPostcode());
261
+ } else {
262
+ throw new InvalidArgumentException('Destination must be an array or an instance of Varien_Object.');
263
  }
264
 
265
  /**
266
+ * Get the dutch track & trace URL for dutch shipments or for the admin.
267
  */
268
  if ($forceNl
269
  || (!empty($countryCode)
273
  $barcodeUrl = self::POSTNL_TRACK_AND_TRACE_NL_BASE_URL
274
  . '&b=' . $barcode;
275
  /**
276
+ * For dutch shipments add the postcode. For international shipments add an 'international' flag.
277
  */
278
  if (!empty($postcode)
279
  && !empty($countryCode)
288
  }
289
 
290
  /**
291
+ * Get a general track & trace URL for all other destinations.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  */
293
  $barcodeUrl = self::POSTNL_TRACK_AND_TRACE_INT_BASE_URL
294
+ . '/' . $barcode
295
+ . '/' . $countryCode;
 
 
 
 
296
 
297
+ if (!empty($postcode)) {
298
+ $barcodeUrl .= '/' . $postcode;
299
  }
300
 
301
  return $barcodeUrl;
889
  return false;
890
  }
891
 
892
+ $order = $myParcelShipment->getOrder();
893
+ $storeId = $order->getStoreId();
894
+ $templateId = $this->getConfig('tracktrace_template','general',$storeId);
895
 
896
  //if no template is set, return false: tracktrace should be send by MyParcel
897
  if($templateId === null || $templateId == 'tig_myparcel_general_tracktrace_template'){
898
  return false;
899
  }
900
 
901
+ try {
902
+ // Retrieve specified view block from appropriate design package (depends on emulated store)
903
+ $paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment())
904
+ ->setIsSecureMode(true);
905
+ $paymentBlock->getMethod()->setStore($storeId);
906
+ $paymentBlockHtml = $paymentBlock->toHtml();
907
+ } catch (Exception $exception) {
908
+ $paymentBlockHtml = '';
909
+ }
910
+
911
  $shippingAddress = $myParcelShipment->getShippingAddress();
912
  $barcodeUrl = $this->getBarcodeUrl($barcode,$shippingAddress);
913
  $templateVariables = array(
914
  'tracktrace_url' => $barcodeUrl,
915
+ 'order' => $order,
916
+ 'shipment' => $myParcelShipment->getShipment(),
917
+ 'billing' => $order->getBillingAddress(),
918
+ 'payment_html' => $paymentBlockHtml,
919
  );
920
 
921
  try {
922
  $mailer = Mage::getModel('core/email_template_mailer');
923
  $emailInfo = Mage::getModel('core/email_info');
924
+ $emailInfo->addTo($order->getCustomerEmail(), $shippingAddress->getName());
925
 
926
  $mailer->addEmailInfo($emailInfo);
927
 
928
  // Set all required params and send emails.
929
+ $mailer->setSender(Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId));
930
+ $mailer->setStoreId($storeId);
931
  $mailer->setTemplateId($templateId);
932
  $mailer->setTemplateParams($templateVariables);
933
+
934
  $mailer->send();
935
  }catch(Exception $e) {
936
  $this->logException($e);
app/code/community/TIG/MyParcel2014/Model/Adminhtml/Observer/OrderGrid.php CHANGED
@@ -39,7 +39,7 @@
39
  * @method TIG_MyParcel2014_Model_Adminhtml_Observer_OrderGrid setCollection(TIG_MyParcel2014_Model_Resource_Order_Grid_Collection $value)
40
  * @method TIG_MyParcel2014_Model_Resource_Order_Grid_Collection getCollection()
41
  * @method TIG_MyParcel2014_Model_Adminhtml_Observer_OrderGrid setBlock(Mage_Adminhtml_Block_Sales_Order_Grid $value)
42
- * @method Mage_Adminhtml_Block_Sales_Order_Grid getBlock()
43
  */
44
  class TIG_MyParcel2014_Model_Adminhtml_Observer_OrderGrid extends Varien_Object
45
  {
@@ -321,26 +321,43 @@ class TIG_MyParcel2014_Model_Adminhtml_Observer_OrderGrid extends Varien_Object
321
  $adminhtmlHelper = Mage::helper('adminhtml');
322
 
323
  /**
324
- * Add the create shipments mass action
325
  */
326
- /*$block->getMassactionBlock()
327
  ->addItem(
328
- 'myparcel_create_shipments',
329
  array(
330
- 'label'=> $helper->__('MyParcel - Create Shipments'),
331
- 'url' => $adminhtmlHelper->getUrl('myparcel_admin/adminhtml_shipment/massCreateShipments'),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
332
  )
333
- );*/
334
 
335
  /**
336
- * Add the print labels mass action.
337
  */
338
  $block->getMassactionBlock()
339
  ->addItem(
340
- 'myparcel_print_labels',
341
  array(
342
- 'label' => $helper->__('MyParcel - Create &amp; Print shipping labels'),
343
- 'url' => $adminhtmlHelper->getUrl('myparcel_admin/adminhtml_shipment/massPrintLabels'),
344
  )
345
  );
346
 
39
  * @method TIG_MyParcel2014_Model_Adminhtml_Observer_OrderGrid setCollection(TIG_MyParcel2014_Model_Resource_Order_Grid_Collection $value)
40
  * @method TIG_MyParcel2014_Model_Resource_Order_Grid_Collection getCollection()
41
  * @method TIG_MyParcel2014_Model_Adminhtml_Observer_OrderGrid setBlock(Mage_Adminhtml_Block_Sales_Order_Grid $value)
42
+ * @method Mage_Adminhtml_Block_Sales_Order_Grid getBlock()
43
  */
44
  class TIG_MyParcel2014_Model_Adminhtml_Observer_OrderGrid extends Varien_Object
45
  {
321
  $adminhtmlHelper = Mage::helper('adminhtml');
322
 
323
  /**
324
+ * Add the print labels mass action.
325
  */
326
+ $block->getMassactionBlock()
327
  ->addItem(
328
+ 'myparcel_print_labels',
329
  array(
330
+ 'label' => $helper->__('MyParcel - Create &amp; Print shipping labels'),
331
+ 'url' => $adminhtmlHelper->getUrl('myparcel_admin/adminhtml_shipment/massPrintLabels'),
332
+ 'additional' => array(
333
+ 'type_consignment' => array(
334
+ 'name' => 'type_consignment',
335
+ 'type' => 'select',
336
+ 'label' => $helper->__('Type Consignment'),
337
+ 'options' => array(
338
+ TIG_MyParcel2014_Model_Shipment::TYPE_NORMAL => $helper->__('Normal'),
339
+ TIG_MyParcel2014_Model_Shipment::TYPE_LETTER_BOX => $helper->__('Letterbox'),
340
+ TIG_MyParcel2014_Model_Shipment::TYPE_UNPAID => $helper->__('Unpaid'),
341
+ ),
342
+ ),
343
+ 'create_consignment' => array(
344
+ 'name' => 'create_consignment',
345
+ 'type' => 'hidden',
346
+ 'value' => 1,
347
+ ),
348
+ )
349
  )
350
+ );
351
 
352
  /**
353
+ * Add the create shipments mass action.
354
  */
355
  $block->getMassactionBlock()
356
  ->addItem(
357
+ 'myparcel_create_shipments',
358
  array(
359
+ 'label' => $helper->__('MyParcel - Create Magento shipments (no labels)'),
360
+ 'url' => $adminhtmlHelper->getUrl('myparcel_admin/adminhtml_shipment/massCreateShipments'),
361
  )
362
  );
363
 
app/code/community/TIG/MyParcel2014/Model/Adminhtml/Observer/ShipmentGrid.php ADDED
@@ -0,0 +1,441 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ *
39
+ * @method TIG_MyParcel2014_Model_Adminhtml_Observer_ShipmentGrid setCollection(TIG_MyParcel2014_Model_Resource_Shipment_Grid_Collection $value)
40
+ * @method TIG_MyParcel2014_Model_Resource_Shipment_Grid_Collection getCollection()
41
+ * @method TIG_MyParcel2014_Model_Adminhtml_Observer_ShipmentGrid setBlock(Mage_Adminhtml_Block_Sales_Shipment_Grid $block)
42
+ * @method Mage_Adminhtml_Block_Sales_Shipment_Grid getBlock()
43
+ */
44
+ class TIG_MyParcel2014_Model_Adminhtml_Observer_ShipmentGrid extends Varien_Object
45
+ {
46
+ /**
47
+ * The block we want to edit.
48
+ */
49
+ const SHIPMENT_GRID_BLOCK_NAME = 'adminhtml/sales_shipment_grid';
50
+
51
+ /**
52
+ * variable name for shipment grid filter.
53
+ */
54
+ const SHIPMENT_GRID_FILTER_VAR_NAME = 'sales_shipment_gridfilter';
55
+
56
+ /**
57
+ * variable name for shipment grid sorting.
58
+ */
59
+ const SHIPMENT_GRID_SORT_VAR_NAME = 'sales_shipment_gridsort';
60
+
61
+ /**
62
+ * variable name for shipment grid sorting direction.
63
+ */
64
+ const SHIPMENT_GRID_DIR_VAR_NAME = 'sales_shipment_griddir';
65
+
66
+ /**
67
+ * Edits the sales shipment grid by adding a column for the shipment status.
68
+ *
69
+ * @param Varien_Event_Observer $observer
70
+ *
71
+ * @return $this
72
+ *
73
+ * @event adminhtml_block_html_before
74
+ *
75
+ * @observer tig_myparcel_adminhtml_shipmentgrid
76
+ */
77
+ public function modifyGrid(Varien_Event_Observer $observer)
78
+ {
79
+ /**
80
+ * Checks if the current block is the one we want to edit.
81
+ *
82
+ * Unfortunately there is no unique event for this block.
83
+ */
84
+ $block = $observer->getBlock();
85
+ $shipmentGridClass = Mage::getConfig()->getBlockClassName(self::SHIPMENT_GRID_BLOCK_NAME);
86
+
87
+ if (!($block instanceof $shipmentGridClass)) {
88
+ return $this;
89
+ }
90
+
91
+ /**
92
+ * check if the extension is active
93
+ */
94
+ if (!Mage::helper('tig_myparcel')->isEnabled()) {
95
+ return $this;
96
+ }
97
+
98
+ /**
99
+ * @var Mage_Adminhtml_Block_Sales_Shipment_Grid $block
100
+ * @var Mage_Sales_Model_Resource_Shipment_Collection $currentCollection
101
+ */
102
+ $currentCollection = $block->getCollection();
103
+ $select = $currentCollection->getSelect()->reset(Zend_Db_Select::WHERE);
104
+
105
+ /**
106
+ * replace the collection, as the default collection has a bug preventing it from being reset.
107
+ * Without being able to reset it, we can't edit it. Therefore we are forced to replace it altogether.
108
+ */
109
+ $collection = Mage::getResourceModel('tig_myparcel/shipment_grid_collection');
110
+ $collection->setSelect($select)
111
+ ->setPageSize($currentCollection->getPageSize())
112
+ ->setCurPage($currentCollection->getCurPage());
113
+
114
+ $this->setCollection($collection);
115
+ $this->setBlock($block);
116
+
117
+ $this->_joinCollection($collection);
118
+ $this->_modifyColumns($block);
119
+ $this->_addColumns($block);
120
+ $this->_applySortAndFilter();
121
+
122
+ $this->_addMassaction($block);
123
+
124
+ $block->setCollection($collection);
125
+ return $this;
126
+ }
127
+
128
+ /**
129
+ * Adds additional joins to the collection that will be used by newly added columns.
130
+ *
131
+ * @param TIG_MyParcel2014_Model_Resource_Shipment_Grid_Collection $collection
132
+ *
133
+ * @return $this
134
+ */
135
+ protected function _joinCollection($collection)
136
+ {
137
+ $resource = Mage::getSingleton('core/resource');
138
+
139
+ $collection->addExpressionFieldToSelect(
140
+ 'country_id',
141
+ 'IF({{pakjegemak_parent_id}}, {{pakjegemak_country_id}}, {{shipping_country_id}})',
142
+ array(
143
+ 'pakjegemak_parent_id' => '`pakjegemak_address`.`parent_id`',
144
+ 'pakjegemak_country_id' => '`pakjegemak_address`.`country_id`',
145
+ 'shipping_country_id' => '`shipping_address`.`country_id`',
146
+ )
147
+ );
148
+ $collection->addExpressionFieldToSelect(
149
+ 'postcode',
150
+ 'IF({{pakjegemak_parent_id}}, {{pakjegemak_postcode}}, {{shipping_postcode}})',
151
+ array(
152
+ 'pakjegemak_parent_id' => '`pakjegemak_address`.`parent_id`',
153
+ 'pakjegemak_postcode' => '`pakjegemak_address`.`postcode`',
154
+ 'shipping_postcode' => '`shipping_address`.`postcode`',
155
+ )
156
+ );
157
+
158
+ $select = $collection->getSelect();
159
+
160
+ /**
161
+ * Join sales_flat_order table.
162
+ */
163
+ $select->joinInner(
164
+ array('order' => $resource->getTableName('sales/order')),
165
+ '`main_table`.`order_id`=`order`.`entity_id`',
166
+ array(
167
+ 'shipping_method' => 'order.shipping_method',
168
+ )
169
+ );
170
+
171
+ /**
172
+ * Join sales_flat_order_address table.
173
+ */
174
+ $select->joinLeft(
175
+ array('shipping_address' => $resource->getTableName('sales/order_address')),
176
+ "`main_table`.`order_id`=`shipping_address`.`parent_id` AND `shipping_address`.`address_type`='shipping'",
177
+ array()
178
+ );
179
+ $select->joinLeft(
180
+ array('pakjegemak_address' => $resource->getTableName('sales/order_address')),
181
+ "`main_table`.`order_id`=`pakjegemak_address`.`parent_id` " .
182
+ "AND `pakjegemak_address`.`address_type`='pakje_gemak'",
183
+ array()
184
+ );
185
+
186
+ /**
187
+ * Join tig_myparcel_shipment table.
188
+ */
189
+ $select->joinLeft(
190
+ array('tig_myparcel_shipment' => $resource->getTableName('tig_myparcel/shipment')),
191
+ '`main_table`.`entity_id`=`tig_myparcel_shipment`.`shipment_id`',
192
+ array('status' => 'tig_myparcel_shipment.status', 'barcode' => 'tig_myparcel_shipment.barcode')
193
+ );
194
+
195
+ return $this;
196
+ }
197
+
198
+ /**
199
+ * Modifies existing columns to prevent issues with the new collections.
200
+ *
201
+ * @param Mage_Adminhtml_Block_Sales_Shipment_Grid $block
202
+ *
203
+ * @return $this
204
+ */
205
+ protected function _modifyColumns($block)
206
+ {
207
+ /**
208
+ * @var Mage_Adminhtml_Block_Widget_Grid_Column $incrementIdColumn
209
+ */
210
+ $incrementIdColumn = $block->getColumn('order_increment_id');
211
+ if ($incrementIdColumn) {
212
+ $incrementIdColumn->setFilterIndex('main_table.order_increment_id');
213
+ }
214
+
215
+ /**
216
+ * @var Mage_Adminhtml_Block_Widget_Grid_Column $massactionColumn
217
+ */
218
+ $massactionColumn = $block->getColumn('massaction');
219
+ if ($massactionColumn) {
220
+ $massactionColumn->setFilterIndex('main_table.entity_id');
221
+ }
222
+
223
+ /**
224
+ * @var Mage_Adminhtml_Block_Widget_Grid_Column $createdAtColumn
225
+ */
226
+ $createdAtColumn = $block->getColumn('created_at');
227
+ if ($createdAtColumn) {
228
+ $createdAtColumn->setFilterIndex('main_table.created_at');
229
+ }
230
+
231
+ /**
232
+ * @var Mage_Adminhtml_Block_Widget_Grid_Column $storeIdColumn
233
+ */
234
+ $storeIdColumn = $block->getColumn('store_id');
235
+ if ($storeIdColumn) {
236
+ $storeIdColumn->setFilterIndex('main_table.store_id');
237
+ }
238
+
239
+ return $this;
240
+ }
241
+
242
+ /**
243
+ * Adds additional columns to the grid
244
+ *
245
+ * @param Mage_Adminhtml_Block_Sales_Shipment_Grid $block
246
+ *
247
+ * @return $this
248
+ */
249
+ protected function _addColumns($block)
250
+ {
251
+ $helper = Mage::helper('tig_myparcel');
252
+
253
+ $block->addColumnAfter(
254
+ 'shipping_status',
255
+ array(
256
+ 'header' => $helper->__('Shipping status'),
257
+ 'type' => 'text',
258
+ 'index' => 'status',
259
+ 'sortable' => false,
260
+ 'filter' => false,
261
+ 'renderer' => 'tig_myparcel/adminhtml_widget_grid_column_renderer_shipment_shippingStatus',
262
+ ),
263
+ 'shipping_name'
264
+ );
265
+
266
+ $block->sortColumnsByOrder();
267
+
268
+ return $this;
269
+ }
270
+
271
+ /**
272
+ * Applies sorting and filtering to the collection
273
+ *
274
+ * @return $this
275
+ */
276
+ protected function _applySortAndFilter()
277
+ {
278
+ $session = Mage::getSingleton('adminhtml/session');
279
+
280
+ $filter = $session->getData(self::SHIPMENT_GRID_FILTER_VAR_NAME);
281
+ $filter = Mage::helper('adminhtml')->prepareFilterString($filter);
282
+
283
+ if ($filter) {
284
+ $this->_filterCollection($filter);
285
+ }
286
+
287
+ $sort = $session->getData(self::SHIPMENT_GRID_SORT_VAR_NAME);
288
+
289
+ if ($sort) {
290
+ $dir = $session->getData(self::SHIPMENT_GRID_DIR_VAR_NAME);
291
+
292
+ $this->_sortCollection($sort, $dir);
293
+ }
294
+
295
+ return $this;
296
+ }
297
+
298
+ /**
299
+ * Adds new filters to the collection if these filters are based on columns added by this observer
300
+ *
301
+ * @param array $filter Array of filters to be added
302
+ *
303
+ * @return $this
304
+ */
305
+ protected function _filterCollection($filter)
306
+ {
307
+ $block = $this->getBlock();
308
+
309
+ foreach ($filter as $columnName => $value) {
310
+ $column = $block->getColumn($columnName);
311
+
312
+ if (!$column) {
313
+ continue;
314
+ }
315
+
316
+ $column->getFilter()->setValue($value);
317
+ $this->_addColumnFilterToCollection($column);
318
+ }
319
+
320
+ return $this;
321
+ }
322
+
323
+ /**
324
+ * Based on Mage_Adminhtml_Block_Widget_Grid::_addColumnFilterToCollection()
325
+ *
326
+ * Adds a filter condition to the collection for a specified column
327
+ *
328
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
329
+ *
330
+ * @return $this
331
+ */
332
+ protected function _addColumnFilterToCollection($column)
333
+ {
334
+ if (!$this->getCollection()) {
335
+ return $this;
336
+ }
337
+
338
+ $field = ($column->getFilterIndex()) ? $column->getFilterIndex() : $column->getIndex();
339
+ if ($column->getFilterConditionCallback()) {
340
+ call_user_func($column->getFilterConditionCallback(), $this->getCollection(), $column);
341
+
342
+ return $this;
343
+ }
344
+
345
+ $cond = $column->getFilter()->getCondition();
346
+ if ($field && isset($cond)) {
347
+ /**
348
+ * @var TIG_MyParcel2014_Model_Resource_Shipment_Grid_Collection $collection
349
+ */
350
+ $collection = $this->getCollection();
351
+ $collection->addFieldToFilter($field , $cond);
352
+ }
353
+
354
+ return $this;
355
+ }
356
+
357
+ /**
358
+ * Sorts the collection by a specified column in a specified direction
359
+ *
360
+ * @param string $sort The column that the collection is sorted by
361
+ * @param string $dir The direction that is used to sort the collection
362
+ *
363
+ * @return $this
364
+ */
365
+ protected function _sortCollection($sort, $dir)
366
+ {
367
+ $block = $this->getBlock();
368
+ $column = $block->getColumn($sort);
369
+ if (!$column) {
370
+ return $this;
371
+ }
372
+
373
+ $column->setDir($dir);
374
+ $this->_setCollectionOrder($column);
375
+
376
+ return $this;
377
+ }
378
+
379
+ /**
380
+ * Sets sorting order by some column
381
+ *
382
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
383
+ *
384
+ * @return $this
385
+ */
386
+ protected function _setCollectionOrder($column)
387
+ {
388
+ $collection = $this->getCollection();
389
+ if (!$collection) {
390
+ return $this;
391
+ }
392
+
393
+ $columnIndex = $column->getFilterIndex() ? $column->getFilterIndex() : $column->getIndex();
394
+ $collection->setOrder($columnIndex, strtoupper($column->getDir()));
395
+ return $this;
396
+ }
397
+
398
+ /**
399
+ * Adds a massaction print the shipping labels
400
+ *
401
+ * @param Mage_Adminhtml_Block_Sales_Order_Grid $block
402
+ *
403
+ * @return $this
404
+ */
405
+ protected function _addMassaction($block)
406
+ {
407
+ $helper = Mage::helper('tig_myparcel');
408
+ $adminhtmlHelper = Mage::helper('adminhtml');
409
+
410
+ /**
411
+ * Add the print labels mass action.
412
+ */
413
+ $block->getMassactionBlock()
414
+ ->addItem(
415
+ 'myparcel_print_labels',
416
+ array(
417
+ 'label' => $helper->__('MyParcel - Print shipping labels'),
418
+ 'url' => $adminhtmlHelper->getUrl('myparcel_admin/adminhtml_shipment/massPrintShipmentLabels'),
419
+ 'additional' => array(
420
+ 'type_consignment' => array(
421
+ 'name' => 'type_consignment',
422
+ 'type' => 'select',
423
+ 'label' => $helper->__('Type Consignment'),
424
+ 'options' => array(
425
+ TIG_MyParcel2014_Model_Shipment::TYPE_NORMAL => $helper->__('Normal'),
426
+ TIG_MyParcel2014_Model_Shipment::TYPE_LETTER_BOX => $helper->__('Letterbox'),
427
+ TIG_MyParcel2014_Model_Shipment::TYPE_UNPAID => $helper->__('Unpaid'),
428
+ ),
429
+ ),
430
+ 'create_consignment' => array(
431
+ 'name' => 'create_consignment',
432
+ 'type' => 'hidden',
433
+ 'value' => 1,
434
+ ),
435
+ )
436
+ )
437
+ );
438
+
439
+ return $this;
440
+ }
441
+ }
app/code/community/TIG/MyParcel2014/Model/Adminhtml/Observer/ViewShipment.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2015 TIG (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+
40
+ class TIG_MyParcel2014_Model_Adminhtml_Observer_ViewShipment extends Varien_Object
41
+ {
42
+ const RETOURLINK_ROUTE = 'myparcel_admin/adminhtml_config/generateRetourlink';
43
+ const CREDIT_CONSIGNMENT_ROUTE = 'myparcel_admin/adminhtml_config/creditConsignment';
44
+
45
+ /**
46
+ * Adds a button to the view-shipment page, allowing the merchant to create a MyParcel-consignment.
47
+ * The button is not showed when a consignment is already present.
48
+ *
49
+ * @param Varien_Event_Observer $observer
50
+ *
51
+ * @return $this
52
+ *
53
+ * @event adminhtml_widget_container_html_before
54
+ *
55
+ * @observer tig_myparcel_adminhtml_view_shipment
56
+ */
57
+ public function adminhtmlWidgetContainerHtmlBefore(Varien_Event_Observer $observer)
58
+ {
59
+ /** @var Mage_Adminhtml_Block_Widget_Container $block; */
60
+ $block = $observer->getBlock();
61
+
62
+ /** @var TIG_MyParcel2014_Helper_Data $helper */
63
+ $helper = Mage::helper('tig_myparcel');
64
+
65
+
66
+ if ($block instanceof Mage_Adminhtml_Block_Sales_Order_Shipment_View) {
67
+
68
+ $shipmentId = $block->getRequest()->getParam('shipment_id');
69
+
70
+ $shippingMethod = Mage::getModel('sales/order_shipment')
71
+ ->load($shipmentId)
72
+ ->getOrder()
73
+ ->getShippingMethod();
74
+
75
+ if(!$helper->shippingMethodIsMyParcel($shippingMethod)){
76
+ return;
77
+ }
78
+
79
+ $myParcelShipment = Mage::getModel('tig_myparcel/shipment')->load($shipmentId, 'shipment_id');
80
+
81
+ if (!$myParcelShipment->hasConsignmentId()) {
82
+ $block->addButton('myparcel_create_consignment', array(
83
+ 'label' => $helper->__('Create MyParcel Consignment'),
84
+ 'id' => 'createMyParcelConsignment',
85
+ 'class' => 'go',
86
+ ));
87
+ // remove Send Tracking Information button
88
+ $block->removeButton('save');
89
+ } else {
90
+ $retourUrl = $block->getUrl(self::RETOURLINK_ROUTE, array('shipment_id' => $shipmentId,));
91
+ $creditUrl = $block->getUrl(self::CREDIT_CONSIGNMENT_ROUTE, array('shipment_id' => $shipmentId,));
92
+
93
+ $block->addButton('myparcel_create_return_url', array(
94
+ 'label' => $helper->__('Generate Retourlink'),
95
+ 'class' => 'go',
96
+ 'onclick' => "setLocation('".$retourUrl."')",
97
+ ));
98
+ if (0 == $myParcelShipment->getIsCredit()) {
99
+ $block->addButton('myparcel_create_credit_url', array(
100
+ 'label' => $helper->__('Credit Consignment'),
101
+ 'class' => 'go',
102
+ 'onclick' => "setLocation('".$creditUrl."')",
103
+ ));
104
+ } else {
105
+ // remove Send Tracking Information button
106
+ $block->removeButton('save');
107
+ }
108
+ }
109
+ }
110
+ }
111
+ }
app/code/community/TIG/MyParcel2014/Model/Adminhtml/Support/Logs.php CHANGED
@@ -60,8 +60,6 @@ class TIG_MyParcel2014_Model_Adminhtml_Support_Logs
60
  */
61
  public function downloadLogs()
62
  {
63
- $helper = Mage::helper('tig_myparcel');
64
-
65
  /**
66
  * Get the log folder and check if there are log files in it.
67
  */
60
  */
61
  public function downloadLogs()
62
  {
 
 
63
  /**
64
  * Get the log folder and check if there are log files in it.
65
  */
app/code/community/TIG/MyParcel2014/Model/Api/Curl.php ADDED
@@ -0,0 +1,318 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Varien
22
+ * @package Varien_Http
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * HTTP CURL Adapter
29
+ *
30
+ * @category Varien
31
+ * @package Varien_Http
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class TIG_MyParcel2014_Model_Api_Curl implements Zend_Http_Client_Adapter_Interface
35
+ {
36
+ /**
37
+ * Parameters array
38
+ *
39
+ * @var array
40
+ */
41
+ protected $_config = array();
42
+
43
+ /**
44
+ * Curl handle
45
+ *
46
+ * @var resource
47
+ */
48
+ protected $_resource;
49
+
50
+ /**
51
+ * Allow parameters
52
+ *
53
+ * @var array
54
+ */
55
+ protected $_allowedParams = array(
56
+ 'timeout' => CURLOPT_TIMEOUT,
57
+ 'maxredirects' => CURLOPT_MAXREDIRS,
58
+ 'proxy' => CURLOPT_PROXY,
59
+ 'ssl_cert' => CURLOPT_SSLCERT,
60
+ 'userpwd' => CURLOPT_USERPWD
61
+ );
62
+
63
+ /**
64
+ * Array of CURL options
65
+ *
66
+ * @var array
67
+ */
68
+ protected $_options = array();
69
+
70
+ /**
71
+ * Apply current configuration array to transport resource
72
+ *
73
+ * @return Varien_Http_Adapter_Curl
74
+ */
75
+ protected function _applyConfig()
76
+ {
77
+ curl_setopt_array($this->_getResource(), $this->_options);
78
+
79
+ if (empty($this->_config)) {
80
+ return $this;
81
+ }
82
+
83
+ $verifyPeer = isset($this->_config['verifypeer']) ? $this->_config['verifypeer'] : 0;
84
+ curl_setopt($this->_getResource(), CURLOPT_SSL_VERIFYPEER, $verifyPeer);
85
+
86
+ $verifyHost = isset($this->_config['verifyhost']) ? $this->_config['verifyhost'] : 0;
87
+ curl_setopt($this->_getResource(), CURLOPT_SSL_VERIFYHOST, $verifyHost);
88
+
89
+ foreach ($this->_config as $param => $curlOption) {
90
+ if (array_key_exists($param, $this->_allowedParams)) {
91
+ curl_setopt($this->_getResource(), $this->_allowedParams[$param], $this->_config[$param]);
92
+ }
93
+ }
94
+ return $this;
95
+ }
96
+
97
+ /**
98
+ * Set array of additional cURL options
99
+ *
100
+ * @param array $options
101
+ * @return Varien_Http_Adapter_Curl
102
+ */
103
+ public function setOptions(array $options = array())
104
+ {
105
+ $this->_options = $options;
106
+ return $this;
107
+ }
108
+
109
+ /**
110
+ * Add additional option to cURL
111
+ *
112
+ * @param int $option the CURLOPT_* constants
113
+ * @param mixed $value
114
+ * @return Varien_Http_Adapter_Curl
115
+ */
116
+ public function addOption($option, $value)
117
+ {
118
+ $this->_options[$option] = $value;
119
+ return $this;
120
+ }
121
+
122
+ /**
123
+ * Add additional options list to curl
124
+ *
125
+ * @param array $options
126
+ *
127
+ * @return Varien_Http_Adapter_Curl
128
+ */
129
+ public function addOptions(array $options)
130
+ {
131
+ $this->_options = $options + $this->_options;
132
+ return $this;
133
+ }
134
+
135
+ /**
136
+ * Set the configuration array for the adapter
137
+ *
138
+ * @param array $config
139
+ * @return Varien_Http_Adapter_Curl
140
+ */
141
+ public function setConfig($config = array())
142
+ {
143
+ $this->_config = $config;
144
+ return $this;
145
+ }
146
+
147
+ /**
148
+ * Connect to the remote server
149
+ *
150
+ * @deprecated since 1.4.0.0-rc1
151
+ * @param string $host
152
+ * @param int $port
153
+ * @param boolean $secure
154
+ * @return Varien_Http_Adapter_Curl
155
+ */
156
+ public function connect($host, $port = 80, $secure = false)
157
+ {
158
+ return $this->_applyConfig();
159
+ }
160
+
161
+ /**
162
+ * Send request to the remote server
163
+ *
164
+ * @param string $method
165
+ * @param string|Zend_Uri_Http $url
166
+ * @param string $http_ver
167
+ * @param array $headers
168
+ * @param string $body
169
+ * @return string Request as text
170
+ */
171
+ public function write($method, $url, $http_ver = '1.1', $headers = array(), $body = '')
172
+ {
173
+ if ($url instanceof Zend_Uri_Http) {
174
+ $url = $url->getUri();
175
+ }
176
+ $this->_applyConfig();
177
+
178
+ $header = isset($this->_config['header']) ? $this->_config['header'] : true;
179
+ $options = array(
180
+ CURLOPT_URL => $url,
181
+ CURLOPT_RETURNTRANSFER => true,
182
+ CURLOPT_HEADER => $header
183
+ );
184
+ if ($method == Zend_Http_Client::POST) {
185
+ $options[CURLOPT_POST] = true;
186
+ $options[CURLOPT_POSTFIELDS] = $body;
187
+ } elseif ($method == Zend_Http_Client::GET) {
188
+ $options[CURLOPT_HTTPGET] = true;
189
+ }
190
+ if (is_array($headers)) {
191
+ $options[CURLOPT_HTTPHEADER] = $headers;
192
+ }
193
+
194
+ curl_setopt_array($this->_getResource(), $options);
195
+
196
+ return $body;
197
+ }
198
+
199
+ /**
200
+ * Read response from server
201
+ *
202
+ * @return string
203
+ */
204
+ public function read()
205
+ {
206
+ $response = curl_exec($this->_getResource());
207
+
208
+ // Remove 100 and 101 responses headers
209
+ while (Zend_Http_Response::extractCode($response) == 100 || Zend_Http_Response::extractCode($response) == 101) {
210
+ $response = preg_split('/^\r?$/m', $response, 2);
211
+ $response = trim($response[1]);
212
+ }
213
+
214
+ if (stripos($response, "Transfer-Encoding: chunked\r\n")) {
215
+ $response = str_ireplace("Transfer-Encoding: chunked\r\n", '', $response);
216
+ }
217
+
218
+ return $response;
219
+ }
220
+
221
+ /**
222
+ * Close the connection to the server
223
+ *
224
+ * @return Varien_Http_Adapter_Curl
225
+ */
226
+ public function close()
227
+ {
228
+ curl_close($this->_getResource());
229
+ $this->_resource = null;
230
+ return $this;
231
+ }
232
+
233
+ /**
234
+ * Returns a cURL handle on success
235
+ *
236
+ * @return resource
237
+ */
238
+ protected function _getResource()
239
+ {
240
+ if (is_null($this->_resource)) {
241
+ $this->_resource = curl_init();
242
+ }
243
+ return $this->_resource;
244
+ }
245
+
246
+ /**
247
+ * Get last error number
248
+ *
249
+ * @return int
250
+ */
251
+ public function getErrno()
252
+ {
253
+ return curl_errno($this->_getResource());
254
+ }
255
+
256
+ /**
257
+ * Get string with last error for the current session
258
+ *
259
+ * @return string
260
+ */
261
+ public function getError()
262
+ {
263
+ return curl_error($this->_getResource());
264
+ }
265
+
266
+ /**
267
+ * Get information regarding a specific transfer
268
+ *
269
+ * @param int $opt CURLINFO option
270
+ * @return mixed
271
+ */
272
+ public function getInfo($opt = 0)
273
+ {
274
+ if (!$opt) {
275
+ return curl_getinfo($this->_getResource());
276
+ }
277
+
278
+ return curl_getinfo($this->_getResource(), $opt);
279
+ }
280
+
281
+ /**
282
+ * curl_multi_* requests support
283
+ *
284
+ * @param array $urls
285
+ * @param array $options
286
+ * @return array
287
+ */
288
+ public function multiRequest($urls, $options = array())
289
+ {
290
+ $handles = array();
291
+ $result = array();
292
+
293
+ $multihandle = curl_multi_init();
294
+
295
+ foreach ($urls as $key => $url) {
296
+ $handles[$key] = curl_init();
297
+ curl_setopt($handles[$key], CURLOPT_URL, $url);
298
+ curl_setopt($handles[$key], CURLOPT_HEADER, 0);
299
+ curl_setopt($handles[$key], CURLOPT_RETURNTRANSFER, 1);
300
+ if (!empty($options)) {
301
+ curl_setopt_array($handles[$key], $options);
302
+ }
303
+ curl_multi_add_handle($multihandle, $handles[$key]);
304
+ }
305
+ $process = null;
306
+ do {
307
+ curl_multi_exec($multihandle, $process);
308
+ usleep(100);
309
+ } while ($process>0);
310
+
311
+ foreach ($handles as $key => $handle) {
312
+ $result[$key] = curl_multi_getcontent($handle);
313
+ curl_multi_remove_handle($multihandle, $handle);
314
+ }
315
+ curl_multi_close($multihandle);
316
+ return $result;
317
+ }
318
+ }
app/code/community/TIG/MyParcel2014/Model/Api/MyParcel.php CHANGED
@@ -39,7 +39,6 @@
39
  *
40
  * Myparcel API class. Contains all the functionality to connect to Myparcel and get information or create consignments
41
  *
42
- * @method TIG_MyParcel2014_Model_Api_MyParcel setStoreId(int $value)
43
  * @method bool hasStoreId()
44
  */
45
  class TIG_MyParcel2014_Model_Api_MyParcel extends Varien_Object
@@ -55,6 +54,7 @@ class TIG_MyParcel2014_Model_Api_MyParcel extends Varien_Object
55
  const REQUEST_TYPE_RETRIEVE_STATUS = 'retrieve-status';
56
  const REQUEST_TYPE_CONSIGNMENT_CREDIT = 'consignment-credit';
57
  const REQUEST_TYPE_CREATE_RETOURLINK = 'create-retourlink';
 
58
 
59
  /**
60
  * @var string
@@ -112,12 +112,19 @@ class TIG_MyParcel2014_Model_Api_MyParcel extends Varien_Object
112
  $helper = Mage::helper('tig_myparcel');
113
  $username = $helper->getConfig('username', 'api', $storeId);
114
  $key = $helper->getConfig('key', 'api', $storeId, true);
 
 
 
 
 
 
 
115
 
116
  if (empty($username) && empty($key)) {
117
  return;
118
  }
119
 
120
- $this->apiUrl = $helper->getConfig('url') . '/api/';
121
  $this->apiUsername = $username;
122
  $this->apiKey = $key;
123
  }
@@ -137,6 +144,17 @@ class TIG_MyParcel2014_Model_Api_MyParcel extends Varien_Object
137
  return $storeId;
138
  }
139
 
 
 
 
 
 
 
 
 
 
 
 
140
  /**
141
  * returns the response as an array, when an error occurs it will return the error message as a string
142
  * @return array
@@ -155,6 +173,11 @@ class TIG_MyParcel2014_Model_Api_MyParcel extends Varien_Object
155
  $errorDetail = $this->requestErrorDetail;
156
 
157
  if(!$errorDetail){
 
 
 
 
 
158
  return false;
159
  }
160
 
@@ -177,9 +200,9 @@ class TIG_MyParcel2014_Model_Api_MyParcel extends Varien_Object
177
  if(is_array($errorMessage) && !empty($errorMessage))
178
  {
179
  $return .= ':<br/>'."\n";
180
- foreach($errorMessage as $key => $value)
181
  {
182
- $return .= $key .' - '.$value[0];
183
  }
184
  }
185
  }
@@ -194,6 +217,25 @@ class TIG_MyParcel2014_Model_Api_MyParcel extends Varien_Object
194
  return false;
195
  }
196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  /**
198
  * send the created request to MyParcel
199
  *
@@ -205,8 +247,13 @@ class TIG_MyParcel2014_Model_Api_MyParcel extends Varien_Object
205
  return false;
206
  }
207
 
 
 
 
 
208
  $body = $this->requestString . '&signature=' . $this->requestHash;
209
 
 
210
  $options = array(
211
  CURLOPT_POST => true,
212
  CURLOPT_FOLLOWLOCATION => true,
@@ -218,37 +265,45 @@ class TIG_MyParcel2014_Model_Api_MyParcel extends Varien_Object
218
  'timeout' => 60,
219
  );
220
 
 
221
  $url = $this->apiUrl . $this->requestType;
222
-
223
- $helper = Mage::helper('tig_myparcel');
224
-
225
  $helper->log($url);
226
 
 
227
  parse_str(urldecode($body), $bodyArray);
228
  $bodyArray['json'] = json_decode($bodyArray['json']);
229
-
230
  $helper->log($bodyArray['json']);
231
 
232
- $request = new Varien_Http_Adapter_Curl();
 
 
233
  foreach($options as $option => $value)
234
  {
235
  $request->addOption($option, $value);
236
  }
 
 
237
  $request->setConfig($config)
238
  ->write(Zend_Http_Client::POST, $url, '1.1', array(), $body);
239
 
 
240
  $response = $request->read();
 
241
  $helper->log(json_decode($response, true));
242
 
 
243
  if ($response === false) {
244
  $error = $request->getError();
245
  $this->requestError = $error;
246
-
247
  return $this;
248
  }
249
 
 
250
  $result = json_decode($response, true);
251
 
 
252
  if(isset($result['error'])){
253
  $this->requestError = $result['error'];
254
  unset($result['error']);
@@ -260,36 +315,12 @@ class TIG_MyParcel2014_Model_Api_MyParcel extends Varien_Object
260
 
261
  $this->requestResult = $result;
262
 
 
263
  $request->close();
264
 
265
  return $this;
266
  }
267
 
268
- /**
269
- * Checks if all the requirements are set to send a request to MyParcel
270
- * @return bool
271
- */
272
- protected function _checkConfigForRequest()
273
- {
274
- if(empty($this->apiUsername) || empty($this->apiKey)){
275
- return false;
276
- }
277
-
278
- if(empty($this->requestType)){
279
- return false;
280
- }
281
-
282
- if(empty($this->requestString)){
283
- return false;
284
- }
285
-
286
- if(empty($this->requestHash)){
287
- return false;
288
- }
289
-
290
- return true;
291
- }
292
-
293
  /**
294
  * Prepares the API for processing a create consignment request.
295
  *
@@ -384,6 +415,8 @@ class TIG_MyParcel2014_Model_Api_MyParcel extends Varien_Object
384
  }
385
 
386
  /**
 
 
387
  * @param $consignmentId
388
  * @return $this
389
  */
@@ -401,6 +434,8 @@ class TIG_MyParcel2014_Model_Api_MyParcel extends Varien_Object
401
  }
402
 
403
  /**
 
 
404
  * @param $consignmentId
405
  * @return $this
406
  */
@@ -418,6 +453,8 @@ class TIG_MyParcel2014_Model_Api_MyParcel extends Varien_Object
418
  }
419
 
420
  /**
 
 
421
  * @param $consignmentId
422
  * @return $this
423
  */
@@ -434,6 +471,55 @@ class TIG_MyParcel2014_Model_Api_MyParcel extends Varien_Object
434
  return $this;
435
  }
436
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
437
  /**
438
  * Gets the shipping address and product code data for this shipment.
439
  *
@@ -447,6 +533,11 @@ class TIG_MyParcel2014_Model_Api_MyParcel extends Varien_Object
447
  $order = $myParcelShipment->getOrder();
448
  $storeId = $order->getStore()->getId();
449
 
 
 
 
 
 
450
  $shippingAddress = $myParcelShipment->getShippingAddress();
451
  $streetData = $helper->getStreetData($shippingAddress,$storeId);
452
  $email = $myParcelShipment->getOrder()->getCustomerEmail();
@@ -454,11 +545,11 @@ class TIG_MyParcel2014_Model_Api_MyParcel extends Varien_Object
454
  $data = array(
455
  'ToAddress' => array(
456
  'country_code' => $shippingAddress->getCountry(),
457
- 'name' => $shippingAddress->getName(),
458
  'business' => $shippingAddress->getCompany(),
459
- 'postcode' => $shippingAddress->getPostcode(),
460
- 'street' => $streetData['streetname'],
461
- 'house_number' => $streetData['housenumber'],
462
  'number_addition' => $streetData['housenumberExtension'],
463
  'town' => $shippingAddress->getCity(),
464
  'email' => $email,
@@ -493,26 +584,22 @@ class TIG_MyParcel2014_Model_Api_MyParcel extends Varien_Object
493
  $totalWeight = 0;
494
  $items = $myParcelShipment->getOrder()->getAllItems();
495
  $i = 0;
496
- foreach($items as $item)
497
- {
498
- if($item->getProductType() == 'simple')
499
- {
500
  $parentId = $item->getParentItemId();
501
  $weight = floatval($item->getWeight());
502
  $price = floatval($item->getPrice());
503
  $qty = intval($item->getQtyOrdered());
504
 
505
- if(!empty($parentId))
506
- {
507
  $parent = Mage::getModel('sales/order_item')->load($parentId);
508
 
509
  // TODO: check for multiple test cases with configurable and bundled products
510
- if(empty($weight))
511
- {
512
  $weight = $parent->getWeight();
513
  }
514
- if(empty($price))
515
- {
516
  $price = $parent->getPrice();
517
  }
518
  }
@@ -552,7 +639,7 @@ class TIG_MyParcel2014_Model_Api_MyParcel extends Varien_Object
552
  'country_code' => $pgAddress->getCountry(),
553
  'name' => $pgAddress->getName(),
554
  'business' => $pgAddress->getCompany(),
555
- 'postcode' => $pgAddress->getPostcode(),
556
  'street' => $pgStreetData['streetname'],
557
  'house_number' => $pgStreetData['housenumber'],
558
  'number_addition' => $pgStreetData['housenumberExtension'],
@@ -561,6 +648,22 @@ class TIG_MyParcel2014_Model_Api_MyParcel extends Varien_Object
561
  );
562
  }
563
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
564
  return $data;
565
  }
566
 
@@ -632,25 +735,6 @@ class TIG_MyParcel2014_Model_Api_MyParcel extends Varien_Object
632
  return $string;
633
  }
634
 
635
- /**
636
- * Sets the parameters for an API call based on a string with all required request parameters and the requested API
637
- * method.
638
- *
639
- * @param string $requestString
640
- * @param string $requestType
641
- *
642
- * @return $this
643
- */
644
- protected function _setRequestParameters($requestString, $requestType)
645
- {
646
- $this->requestString = $requestString;
647
- $this->requestType = $requestType;
648
-
649
- $this->_hashRequest();
650
-
651
- return $this;
652
- }
653
-
654
  /**
655
  * Creates a hash to ensure security, sets the $requestHash class-variable
656
  *
39
  *
40
  * Myparcel API class. Contains all the functionality to connect to Myparcel and get information or create consignments
41
  *
 
42
  * @method bool hasStoreId()
43
  */
44
  class TIG_MyParcel2014_Model_Api_MyParcel extends Varien_Object
54
  const REQUEST_TYPE_RETRIEVE_STATUS = 'retrieve-status';
55
  const REQUEST_TYPE_CONSIGNMENT_CREDIT = 'consignment-credit';
56
  const REQUEST_TYPE_CREATE_RETOURLINK = 'create-retourlink';
57
+ const REQUEST_TYPE_GET_LOCATIONS = 'pickup';
58
 
59
  /**
60
  * @var string
112
  $helper = Mage::helper('tig_myparcel');
113
  $username = $helper->getConfig('username', 'api', $storeId);
114
  $key = $helper->getConfig('key', 'api', $storeId, true);
115
+ $url = $helper->getConfig('url');
116
+
117
+ if (Mage::app()->getStore()->isCurrentlySecure()) {
118
+ if(!Mage::getStoreConfig('tig_myparcel/general/ssl_handshake')){
119
+ $url = str_replace('http://', 'https://', $url);
120
+ }
121
+ }
122
 
123
  if (empty($username) && empty($key)) {
124
  return;
125
  }
126
 
127
+ $this->apiUrl = $url . '/api/';
128
  $this->apiUsername = $username;
129
  $this->apiKey = $key;
130
  }
144
  return $storeId;
145
  }
146
 
147
+ public function setStoreId($storeId)
148
+ {
149
+ $helper = Mage::helper('tig_myparcel');
150
+
151
+ $this->storeId = $storeId;
152
+ $this->apiUsername = $helper->getConfig('username', 'api', $storeId);
153
+ $this->apiKey = $helper->getConfig('key', 'api', $storeId, true);
154
+
155
+ return $this;
156
+ }
157
+
158
  /**
159
  * returns the response as an array, when an error occurs it will return the error message as a string
160
  * @return array
173
  $errorDetail = $this->requestErrorDetail;
174
 
175
  if(!$errorDetail){
176
+
177
+ if(!empty($this->requestError)){
178
+ return $this->requestError;
179
+ }
180
+
181
  return false;
182
  }
183
 
200
  if(is_array($errorMessage) && !empty($errorMessage))
201
  {
202
  $return .= ':<br/>'."\n";
203
+ foreach($errorMessage as $messageKey => $value)
204
  {
205
+ $return .= $messageKey .' - '.$value[0];
206
  }
207
  }
208
  }
217
  return false;
218
  }
219
 
220
+ /**
221
+ * Sets the parameters for an API call based on a string with all required request parameters and the requested API
222
+ * method.
223
+ *
224
+ * @param string $requestString
225
+ * @param string $requestType
226
+ *
227
+ * @return $this
228
+ */
229
+ protected function _setRequestParameters($requestString, $requestType)
230
+ {
231
+ $this->requestString = $requestString;
232
+ $this->requestType = $requestType;
233
+
234
+ $this->_hashRequest();
235
+
236
+ return $this;
237
+ }
238
+
239
  /**
240
  * send the created request to MyParcel
241
  *
247
  return false;
248
  }
249
 
250
+ //instantiate the helper
251
+ $helper = Mage::helper('tig_myparcel');
252
+
253
+ //curl request string
254
  $body = $this->requestString . '&signature=' . $this->requestHash;
255
 
256
+ //curl options
257
  $options = array(
258
  CURLOPT_POST => true,
259
  CURLOPT_FOLLOWLOCATION => true,
265
  'timeout' => 60,
266
  );
267
 
268
+ //complete request url
269
  $url = $this->apiUrl . $this->requestType;
270
+ // log the request url
 
 
271
  $helper->log($url);
272
 
273
+ //for logging
274
  parse_str(urldecode($body), $bodyArray);
275
  $bodyArray['json'] = json_decode($bodyArray['json']);
 
276
  $helper->log($bodyArray['json']);
277
 
278
+ //instantiate the curl adapter
279
+ $request = new TIG_MyParcel2014_Model_Api_Curl();
280
+ //add the options
281
  foreach($options as $option => $value)
282
  {
283
  $request->addOption($option, $value);
284
  }
285
+
286
+ //do the curl request
287
  $request->setConfig($config)
288
  ->write(Zend_Http_Client::POST, $url, '1.1', array(), $body);
289
 
290
+ //read the response
291
  $response = $request->read();
292
+ //log the response
293
  $helper->log(json_decode($response, true));
294
 
295
+ //check if there are curl-errors
296
  if ($response === false) {
297
  $error = $request->getError();
298
  $this->requestError = $error;
299
+ //$this->requestErrorDetail = $error;
300
  return $this;
301
  }
302
 
303
+ //decode the json response
304
  $result = json_decode($response, true);
305
 
306
+ //check if the response has errors codes
307
  if(isset($result['error'])){
308
  $this->requestError = $result['error'];
309
  unset($result['error']);
315
 
316
  $this->requestResult = $result;
317
 
318
+ //close the server connection with MyParcel
319
  $request->close();
320
 
321
  return $this;
322
  }
323
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
  /**
325
  * Prepares the API for processing a create consignment request.
326
  *
415
  }
416
 
417
  /**
418
+ * create a request string for checking the status of a consignment
419
+ *
420
  * @param $consignmentId
421
  * @return $this
422
  */
434
  }
435
 
436
  /**
437
+ * create a request string for crediting a consignment
438
+ *
439
  * @param $consignmentId
440
  * @return $this
441
  */
453
  }
454
 
455
  /**
456
+ * create a request string for generating a retour-url
457
+ *
458
  * @param $consignmentId
459
  * @return $this
460
  */
471
  return $this;
472
  }
473
 
474
+ /**
475
+ * create a request string for getting the locations
476
+ *
477
+ * @param array $data
478
+ *
479
+ * @return $this
480
+ */
481
+ public function createGetLocationsRequest($data)
482
+ {
483
+ if (empty($data['courier'])) {
484
+ $data['courier'] = 'postnl';
485
+ }
486
+ if (empty($data['courier'])) {
487
+ $data['country'] = 'nl';
488
+ }
489
+
490
+ $requestString = $this->_createRequestString($data);
491
+
492
+ $this->_setRequestParameters($requestString, self::REQUEST_TYPE_GET_LOCATIONS);
493
+
494
+ return $this;
495
+ }
496
+
497
+ /**
498
+ * Checks if all the requirements are set to send a request to MyParcel
499
+ *
500
+ * @return bool
501
+ */
502
+ protected function _checkConfigForRequest()
503
+ {
504
+ if(empty($this->apiUsername) || empty($this->apiKey)){
505
+ return false;
506
+ }
507
+
508
+ if(empty($this->requestType)){
509
+ return false;
510
+ }
511
+
512
+ if(empty($this->requestString)){
513
+ return false;
514
+ }
515
+
516
+ if(empty($this->requestHash)){
517
+ return false;
518
+ }
519
+
520
+ return true;
521
+ }
522
+
523
  /**
524
  * Gets the shipping address and product code data for this shipment.
525
  *
533
  $order = $myParcelShipment->getOrder();
534
  $storeId = $order->getStore()->getId();
535
 
536
+ if($storeId != $this->getStoreId()){
537
+ $this->apiUsername = $helper->getConfig('username', 'api', $storeId);
538
+ $this->apiKey = $helper->getConfig('key', 'api', $storeId, true);
539
+ }
540
+
541
  $shippingAddress = $myParcelShipment->getShippingAddress();
542
  $streetData = $helper->getStreetData($shippingAddress,$storeId);
543
  $email = $myParcelShipment->getOrder()->getCustomerEmail();
545
  $data = array(
546
  'ToAddress' => array(
547
  'country_code' => $shippingAddress->getCountry(),
548
+ 'name' => trim($shippingAddress->getName()),
549
  'business' => $shippingAddress->getCompany(),
550
+ 'postcode' => trim($shippingAddress->getPostcode()),
551
+ 'street' => trim($streetData['streetname']),
552
+ 'house_number' => trim($streetData['housenumber']),
553
  'number_addition' => $streetData['housenumberExtension'],
554
  'town' => $shippingAddress->getCity(),
555
  'email' => $email,
584
  $totalWeight = 0;
585
  $items = $myParcelShipment->getOrder()->getAllItems();
586
  $i = 0;
587
+ foreach($items as $item) {
588
+ if($item->getProductType() == 'simple') {
 
 
589
  $parentId = $item->getParentItemId();
590
  $weight = floatval($item->getWeight());
591
  $price = floatval($item->getPrice());
592
  $qty = intval($item->getQtyOrdered());
593
 
594
+ if(!empty($parentId)) {
 
595
  $parent = Mage::getModel('sales/order_item')->load($parentId);
596
 
597
  // TODO: check for multiple test cases with configurable and bundled products
598
+ if (empty($weight)) {
 
599
  $weight = $parent->getWeight();
600
  }
601
+
602
+ if (empty($price)) {
603
  $price = $parent->getPrice();
604
  }
605
  }
639
  'country_code' => $pgAddress->getCountry(),
640
  'name' => $pgAddress->getName(),
641
  'business' => $pgAddress->getCompany(),
642
+ 'postcode' => trim($pgAddress->getPostcode()),
643
  'street' => $pgStreetData['streetname'],
644
  'house_number' => $pgStreetData['housenumber'],
645
  'number_addition' => $pgStreetData['housenumberExtension'],
648
  );
649
  }
650
 
651
+ /**
652
+ * Add the shipment type parameter.
653
+ */
654
+
655
+ switch ($myParcelShipment->getShipmentType()) {
656
+ case $myParcelShipment::TYPE_LETTER_BOX:
657
+ $data['shipment_type'] = 'letterbox';
658
+ break;
659
+ case $myParcelShipment::TYPE_UNPAID:
660
+ $data['shipment_type'] = 'unpaid_letter';
661
+ break;
662
+ case $myParcelShipment::TYPE_NORMAL:
663
+ default:
664
+ $data['shipment_type'] = 'standard';
665
+ }
666
+
667
  return $data;
668
  }
669
 
735
  return $string;
736
  }
737
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
738
  /**
739
  * Creates a hash to ensure security, sets the $requestHash class-variable
740
  *
app/code/community/TIG/MyParcel2014/Model/Carrier/MyParcel.php CHANGED
@@ -1,4 +1,43 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  class TIG_MyParcel2014_Model_Carrier_MyParcel extends Mage_Shipping_Model_Carrier_Abstract
4
  implements Mage_Shipping_Model_Carrier_Interface
@@ -6,14 +45,14 @@ class TIG_MyParcel2014_Model_Carrier_MyParcel extends Mage_Shipping_Model_Carrie
6
  /**
7
  * Rate type (tablerate or flatrate).
8
  */
9
- const XML_PATH_RATE_TYPE = 'carriers/tig_myparcel/rate_type';
10
 
11
  /**
12
  * MyParcel Carrier code
13
  *
14
  * @var string
15
  */
16
- protected $_code = 'tig_myparcel';
17
 
18
  /**
19
  * Fixed price flag
@@ -35,6 +74,67 @@ class TIG_MyParcel2014_Model_Carrier_MyParcel extends Mage_Shipping_Model_Carrie
35
  parent::__construct();
36
  }
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  /**
39
  * Collect and get rates
40
  *
@@ -73,32 +173,62 @@ class TIG_MyParcel2014_Model_Carrier_MyParcel extends Mage_Shipping_Model_Carrie
73
  }
74
 
75
  // add PakjeGemak if country is NL and not in admin
76
- if(!$helper->isAdmin()){
77
- if($request->getDestCountryId() == 'NL' && $this->getConfigData('pakjegemak_active') == 1)
78
- {
79
- $currentRate = current($result->getRatesByCarrier($this->_code));
 
 
80
 
81
- if($currentRate)
82
- {
83
- $currentPrice = $currentRate->getPrice();
84
- $pakjegemakPrice = floatval($this->getConfigData('pakjegemak_fee'));
85
 
86
- // use a modified clone of the configured shipping rate
87
- $pakjegemakRate = clone $currentRate;
88
 
89
- $pakjegemakRate->setMethod('pakjegemak');
90
- $pakjegemakRate->setMethodTitle('Pakjegemak');
91
- $pakjegemakRate->setPrice($currentPrice + $pakjegemakPrice);
92
 
93
- $result->append($pakjegemakRate);
94
- }
95
  }
96
  }
97
 
98
-
99
  return $result;
100
  }
101
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  /**
103
  * Get allowed shipping methods
104
  *
1
  <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ *
39
+ *
40
+ */
41
 
42
  class TIG_MyParcel2014_Model_Carrier_MyParcel extends Mage_Shipping_Model_Carrier_Abstract
43
  implements Mage_Shipping_Model_Carrier_Interface
45
  /**
46
  * Rate type (tablerate or flatrate).
47
  */
48
+ const XML_PATH_RATE_TYPE = 'carriers/myparcel/rate_type';
49
 
50
  /**
51
  * MyParcel Carrier code
52
  *
53
  * @var string
54
  */
55
+ protected $_code = TIG_MyParcel2014_Model_Shipment::MYPARCEL_CARRIER_CODE;
56
 
57
  /**
58
  * Fixed price flag
74
  parent::__construct();
75
  }
76
 
77
+ /**
78
+ * Check if carrier has shipping tracking option available
79
+ *
80
+ * @return boolean
81
+ */
82
+ public function isTrackingAvailable()
83
+ {
84
+ return true;
85
+ }
86
+
87
+ /**
88
+ * Get tracking information.
89
+ *
90
+ * @param string $tracking
91
+ *
92
+ * @return Mage_Shipping_Model_Tracking_Result_Status
93
+ */
94
+ public function getTrackingInfo($tracking)
95
+ {
96
+ $statusModel = Mage::getModel('shipping/tracking_result_status');
97
+ $track = $this->_getTrackByNumber($tracking);
98
+ $shipment = $track->getShipment();
99
+
100
+ $shippingAddress = $shipment->getShippingAddress();
101
+ $barcodeUrl = Mage::helper('tig_myparcel')->getBarcodeUrl(
102
+ $track->getTrackNumber(),
103
+ $shippingAddress
104
+ );
105
+
106
+ $statusModel->setCarrier($track->getCarrierCode())
107
+ ->setCarrierTitle($this->getConfigData('name'))
108
+ ->setTracking($track->getTrackNumber())
109
+ ->setPopup(1)
110
+ ->setUrl($barcodeUrl);
111
+
112
+ return $statusModel;
113
+ }
114
+
115
+ /**
116
+ * Load track object by tracking number
117
+ *
118
+ * @param string $number
119
+ *
120
+ * @return Mage_Sales_Model_Order_Shipment_Track
121
+ */
122
+ protected function _getTrackByNumber($number)
123
+ {
124
+ $coreResource = Mage::getSingleton('core/resource');
125
+ $readConn = $coreResource->getConnection('core_read');
126
+
127
+ $trackSelect = $readConn->select();
128
+ $trackSelect->from($coreResource->getTableName('sales/shipment_track'), array('entity_id'));
129
+ $trackSelect->where('track_number = ?', $number);
130
+
131
+ $trackId = $readConn->fetchOne($trackSelect);
132
+
133
+ $track = Mage::getModel('sales/order_shipment_track')->load($trackId);
134
+
135
+ return $track;
136
+ }
137
+
138
  /**
139
  * Collect and get rates
140
  *
173
  }
174
 
175
  // add PakjeGemak if country is NL and not in admin
176
+ if (!$helper->isAdmin()
177
+ && 'NL' === $request->getDestCountryId()
178
+ && $this->getConfigFlag('pakjegemak_active')
179
+ && $this->_pakjeGemakValidOrderAmount()
180
+ ) {
181
+ $currentRate = current($result->getRatesByCarrier($this->_code));
182
 
183
+ if ($currentRate) {
184
+ $currentPrice = $currentRate->getPrice();
185
+ $pakjegemakPrice = floatval($this->getConfigData('pakjegemak_fee'));
 
186
 
187
+ // use a modified clone of the configured shipping rate
188
+ $pakjegemakRate = clone $currentRate;
189
 
190
+ $pakjegemakRate->setMethod('pakjegemak');
191
+ $pakjegemakRate->setMethodTitle($this->getConfigData('pakjegemak_title'));
192
+ $pakjegemakRate->setPrice($currentPrice + $pakjegemakPrice);
193
 
194
+ $result->append($pakjegemakRate);
 
195
  }
196
  }
197
 
 
198
  return $result;
199
  }
200
 
201
+ /**
202
+ * Checks config values and quote to see if the total order value is valid for PakjeGemak
203
+ *
204
+ * @return bool
205
+ */
206
+ protected function _pakjeGemakValidOrderAmount()
207
+ {
208
+ if (!$this->getConfigFlag('pakjegemak_min_order_enabled')) {
209
+ return true;
210
+ }
211
+
212
+ $minOrderTotal = $this->getConfigData('pakjegemak_min_order_total');
213
+
214
+ if (!$minOrderTotal) {
215
+ return true;
216
+ }
217
+
218
+ /**
219
+ * We have to collect the totals because they have not always been loaded at this point
220
+ * @var Mage_Sales_Model_Quote $quote
221
+ */
222
+ $quote = Mage::getSingleton('checkout/session')->getQuote()->collectTotals();
223
+ $baseOrderTotal = $quote->getBaseSubtotalWithDiscount();
224
+
225
+ if ($baseOrderTotal < $minOrderTotal) {
226
+ return false;
227
+ }
228
+
229
+ return true;
230
+ }
231
+
232
  /**
233
  * Get allowed shipping methods
234
  *
app/code/community/TIG/MyParcel2014/Model/Checkout/Service.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2015 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_MyParcel2014_Model_Checkout_Service
40
+ {
41
+ /**
42
+ * @param array $addressData
43
+ * @param Mage_Sales_Model_Quote $quote
44
+ *
45
+ * @return $this
46
+ */
47
+ public function savePgAddress(array $addressData, Mage_Sales_Model_Quote $quote)
48
+ {
49
+ $helper = Mage::helper('tig_myparcel');
50
+
51
+ /**
52
+ * Create a new address and add the address data.
53
+ */
54
+ $pgAddress = Mage::getModel('sales/quote_address');
55
+ $pgAddress->setAddressType($helper::PG_ADDRESS_TYPE)
56
+ ->setCity($addressData['city'])
57
+ ->setCountryId('NL')
58
+ ->setPostcode($addressData['postcode'])
59
+ ->setCompany($addressData['name'])
60
+ ->setFirstname('-')
61
+ ->setLastname('-')
62
+ ->setTelephone($addressData['telephone'])
63
+ ->setStreet($addressData['street'] . "\n" . $addressData['housenr']);
64
+
65
+ /**
66
+ * Add the address to the quote and save the quote.
67
+ */
68
+ $quote->addAddress($pgAddress)
69
+ ->save();
70
+
71
+ /**
72
+ * Save the address.
73
+ * This should not be required, but we've encountered a few cases where this was not done automatically by
74
+ * saving the quote.
75
+ */
76
+ $pgAddress->save();
77
+
78
+ /**
79
+ * If this quote has been deactivated, check if it has an order.
80
+ *
81
+ * This is required for OneStepCheckout.
82
+ */
83
+ if (!$quote->getIsActive()) {
84
+ /**
85
+ * @var Mage_Sales_Model_Order $order
86
+ */
87
+ $order = Mage::getModel('sales/order')->load($quote->getId(), 'quote_id');
88
+ if ($order && $order->getId()) {
89
+ /**
90
+ * Save the PakjeGemak address to the order.
91
+ */
92
+ $this->copyAddressToOrder($order, $pgAddress);
93
+ }
94
+ }
95
+
96
+ return $this;
97
+ }
98
+
99
+ /**
100
+ * Copies a given address to the order.
101
+ *
102
+ * @param Mage_Sales_Model_Order $order
103
+ * @param Mage_Sales_Model_Quote_Address $address
104
+ *
105
+ * @return $this
106
+ *
107
+ * @throws Exception
108
+ */
109
+ public function copyAddressToOrder(Mage_Sales_Model_Order $order, Mage_Sales_Model_Quote_Address $address)
110
+ {
111
+ /**
112
+ * Convert the quote address to an order address and add it to the order.
113
+ */
114
+ $address->load($address->getId());
115
+ $orderAddress = Mage::getModel('sales/convert_quote')->addressToOrderAddress($address);
116
+
117
+ $order->addAddress($orderAddress)
118
+ ->save();
119
+
120
+ /**
121
+ * This is a fix for the order address missing a parent ID.
122
+ */
123
+ if (!$orderAddress->getParentId()) {
124
+ $orderAddress->setParentId($order->getId());
125
+ }
126
+
127
+ /**
128
+ * This is required for some PSP extensions which will not save the PakjeGemak address otherwise.
129
+ */
130
+ $orderAddress->save();
131
+
132
+ return $this;
133
+ }
134
+
135
+ /**
136
+ * Removes a saved PakjeGemak address from the quote.
137
+ *
138
+ * @param Mage_Sales_Model_Quote $quote
139
+ *
140
+ * @return $this
141
+ * @throws Exception
142
+ */
143
+ public function removePgAddress(Mage_Sales_Model_Quote $quote)
144
+ {
145
+ $addresses = $quote->getAllAddresses();
146
+
147
+ /** @var Mage_Sales_Model_Quote_Address $address */
148
+ foreach ($addresses as $address) {
149
+ if ($address->getAddressType() == TIG_MyParcel2014_Helper_Data::PG_ADDRESS_TYPE) {
150
+ $address->delete();
151
+ }
152
+ }
153
+
154
+ return $this;
155
+ }
156
+ }
app/code/community/TIG/MyParcel2014/Model/Checkout/Validate.php ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2015 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_MyParcel2014_Model_Checkout_Validate
40
+ {
41
+ /**
42
+ * Validation regular expressions.
43
+ */
44
+ const HOUSENR_REGEX = "#^[0-9]*$#";
45
+ const POSTCODE_REGEX = "#^[1-9][0-9]{3}[\s]*[a-zA-Z]{2}$#";
46
+ const CITY_NAME_REGEX = '#^[a-zA-Z]+(?:(?:\\s+|-)[a-zA-Z]+)*$#';
47
+ const STREET_NAME_REGEX = "#^[a-zA-Z0-9\s,'-]*$#";
48
+ const PHONE_NUMBER_REGEX = '#^(((\+31|0|0031)){1}[1-9]{1}[0-9]{8})$#i';
49
+
50
+ /**
51
+ * Validate getLocations post data and return the validated data as an array.
52
+ *
53
+ * @param array $data
54
+ *
55
+ * @return string[]|false
56
+ */
57
+ public function validateGetLocationsData(array $data)
58
+ {
59
+ /**
60
+ * The housenr and postcode fields are required.
61
+ */
62
+ if (empty($data['housenr']) || empty($data['postcode'])) {
63
+ return false;
64
+ }
65
+
66
+ /**
67
+ * Trim the housenr and postcode values.
68
+ */
69
+ $houseNr = trim($data['housenr']);
70
+ $postcode = trim($data['postcode']);
71
+
72
+ /**
73
+ * Validate that the housenr and postcode are valid values.
74
+ */
75
+ $houseNrValidator = new Zend_Validate_Regex(array('pattern' => self::HOUSENR_REGEX));
76
+ $postcodeValidator = new Zend_Validate_Regex(array('pattern' => self::POSTCODE_REGEX));
77
+
78
+ if (!$houseNrValidator->isValid($houseNr) || !$postcodeValidator->isValid($postcode)) {
79
+ return false;
80
+ }
81
+
82
+ /**
83
+ * Return the validated data.
84
+ */
85
+ $validData = array(
86
+ 'housenr' => $houseNr,
87
+ 'postcode' => $postcode,
88
+ );
89
+
90
+ return $validData;
91
+ }
92
+
93
+ /**
94
+ * Validate saveLocation post data and return the validated data as an array.
95
+ *
96
+ * @param array $data
97
+ *
98
+ * @return string[]|false
99
+ */
100
+ public function validateSaveLocationData(array $data)
101
+ {
102
+ if (empty($data['address'])) {
103
+ return false;
104
+ }
105
+
106
+ $address = Mage::helper('core')->jsonDecode($data['address']);
107
+
108
+ /**
109
+ * These fields are required.
110
+ */
111
+ if (empty($address['city'])
112
+ || empty($address['name'])
113
+ || empty($address['postcode'])
114
+ || empty($address['street'])
115
+ || empty($address['housenr'])
116
+ ) {
117
+ return false;
118
+ }
119
+
120
+ $city = $address['city'];
121
+ $name = $address['name'];
122
+ $postcode = $address['postcode'];
123
+ $street = $address['street'];
124
+ $houseNr = $address['housenr'];
125
+
126
+ /**
127
+ * Validate the required fields.
128
+ */
129
+ $cityValidator = new Zend_Validate_Regex(array('pattern' => self::CITY_NAME_REGEX));
130
+ $postcodeValidator = new Zend_Validate_Regex(array('pattern' => self::POSTCODE_REGEX));
131
+ $streetValidator = new Zend_Validate_Regex(array('pattern' => self::STREET_NAME_REGEX));
132
+ $houseNrValidator = new Zend_Validate_Regex(array('pattern' => self::HOUSENR_REGEX));
133
+
134
+ if (!$cityValidator->isValid($city)
135
+ || !$postcodeValidator->isValid($postcode)
136
+ || !$streetValidator->isValid($street)
137
+ || !$houseNrValidator->isValid($houseNr)
138
+ ) {
139
+ return false;
140
+ }
141
+
142
+ /**
143
+ * Names are essentially impossible to build a regex for. Eventually you will run into a name that the regex
144
+ * thinks is 'wrong' and you will have offended someone. Better to just strip any tags to prevent XSS attacks.
145
+ */
146
+ $name = Mage::helper('core')->stripTags($name);
147
+
148
+ /**
149
+ * Add the validated fields to an array of valid data.
150
+ */
151
+ $validData = array(
152
+ 'city' => $city,
153
+ 'postcode' => $postcode,
154
+ 'street' => $street,
155
+ 'housenr' => $houseNr,
156
+ 'name' => $name,
157
+ );
158
+
159
+ /**
160
+ * If a phone number was also supplied, validate it and add it to the valid data array.
161
+ *
162
+ * Since this is an optional field, if it is not valid it will simply be ignored.
163
+ */
164
+ if (!empty($address['telephone'])) {
165
+ $phoneNumber = $address['telephone'];
166
+ $phoneNumber = str_replace(array('-', ' '), '', $phoneNumber);
167
+ $phoneNumberValidator = new Zend_Validate_Regex(array('pattern' => self::PHONE_NUMBER_REGEX));
168
+
169
+ if ($phoneNumberValidator->isValid($phoneNumber)) {
170
+ $validData['telephone'] = $phoneNumber;
171
+ }
172
+ }
173
+
174
+ return $validData;
175
+ }
176
+ }
app/code/community/TIG/MyParcel2014/Model/Observer/SaveConfig.php CHANGED
@@ -67,11 +67,11 @@ class TIG_MyParcel2014_Model_Observer_SaveConfig extends Varien_Object
67
  $controller = $observer->getControllerAction();
68
  $section = $controller->getRequest()->getParam('section');
69
 
70
- if($section == 'tig_myparcel')
71
  {
72
  $api = Mage::getModel('tig_myparcel/api_myParcel');
73
 
74
- $response = $api->createRegisterConfigRequest()->sendRequest(); // no getRequestResponse()
75
  }
76
 
77
  return $this;
67
  $controller = $observer->getControllerAction();
68
  $section = $controller->getRequest()->getParam('section');
69
 
70
+ if($section == 'myparcel')
71
  {
72
  $api = Mage::getModel('tig_myparcel/api_myParcel');
73
 
74
+ $api->createRegisterConfigRequest()->sendRequest(); // no getRequestResponse()
75
  }
76
 
77
  return $this;
app/code/community/TIG/MyParcel2014/Model/Observer/SavePgAddress.php CHANGED
@@ -41,19 +41,6 @@
41
  */
42
  class TIG_MyParcel2014_Model_Observer_SavePgAddress extends Varien_Object
43
  {
44
- /**
45
- * Regular expressions to validate various address fields.
46
- */
47
- const CITY_NAME_REGEX = '#^[a-zA-Z]+(?:(?:\\s+|-)[a-zA-Z]+)*$#';
48
- const STREET_NAME_REGEX = "#^[a-zA-Z0-9\s,'-]*$#";
49
- const HOUSENR_EXT_REGEX = "#^[a-zA-Z0-9\s,'-]*$#";
50
- const NAME_REGEX = "#^[a-zA-Z0-9\s,'-]*$#";
51
-
52
- /**
53
- * Regular expression to validate dutch phone number.
54
- */
55
- const PHONE_NUMBER_REGEX = '#^(((\+31|0|0031)){1}[1-9]{1}[0-9]{8})$#i';
56
-
57
  /**
58
  * Get the current quote.
59
  *
@@ -71,49 +58,6 @@ class TIG_MyParcel2014_Model_Observer_SavePgAddress extends Varien_Object
71
  return $quote;
72
  }
73
 
74
- /**
75
- * Saves a selected MyParcel address.
76
- *
77
- * @param Varien_Event_Observer $observer
78
- *
79
- * @return $this
80
- *
81
- * @event controller_action_postdispatch_checkout_onepage_saveShippingMethod
82
- * |controller_action_postdispatch_onestepcheckout_index_index
83
- *
84
- * @observer tig_myparcel_save_pg_address
85
- */
86
- public function savePgAddress(Varien_Event_Observer $observer)
87
- {
88
- /**
89
- * Check if the MyParcel extension is enabled.
90
- */
91
- if (!Mage::helper('tig_myparcel')->isEnabled()) {
92
- return $this;
93
- }
94
-
95
- /**
96
- * @var Mage_Core_Controller_Varien_Front $controller
97
- *
98
- * Get the selected PG address from the controller if available.
99
- */
100
- $controller = $observer->getControllerAction();
101
- $pgAddressData = $controller->getRequest()->getParam('tig_myparcel_pg_address', array());
102
-
103
- /**
104
- * Delete any existing pakjeGemak addresses.
105
- */
106
- $this->_removePgAddress();
107
- if (!$this->_isAddressEmpty($pgAddressData)) {
108
- /**
109
- * Save the selected address.
110
- */
111
- $this->_savePgAddress($pgAddressData);
112
- }
113
-
114
- return $this;
115
- }
116
-
117
  /**
118
  * Copies a PakjeGemak address from the quote to the newly placed order.
119
  *
@@ -122,13 +66,17 @@ class TIG_MyParcel2014_Model_Observer_SavePgAddress extends Varien_Object
122
  * @return $this
123
  *
124
  * @throws Exception
 
 
 
 
125
  */
126
  public function copyAddressToOrder(Varien_Event_Observer $observer)
127
  {
128
  /**
129
  * @var Mage_Sales_Model_Order $order
130
  */
131
- $order = $observer->getOrder();
132
  $helper = Mage::helper('tig_myparcel');
133
 
134
  /**
@@ -149,8 +97,8 @@ class TIG_MyParcel2014_Model_Observer_SavePgAddress extends Varien_Object
149
  * Check if the order is shipped using MyParcel.
150
  */
151
  $shippingMethod = $order->getShippingMethod();
152
- if (!$helper->shippingMethodIsMyParcel($shippingMethod)) {
153
- $this->_removePgAddress();
154
  return $this;
155
  }
156
 
@@ -166,275 +114,8 @@ class TIG_MyParcel2014_Model_Observer_SavePgAddress extends Varien_Object
166
  return $this;
167
  }
168
 
169
- $this->_copyAddressToOrder($order, $pakjeGemakAddress);
170
- return $this;
171
- }
172
-
173
- /**
174
- * Check if an array is considered empty.
175
- *
176
- * @param array $pgAddressData
177
- *
178
- * @return bool
179
- */
180
- protected function _isAddressEmpty($pgAddressData)
181
- {
182
- foreach ($pgAddressData as $key => $value) {
183
- /**
184
- * If the value is an array, check recursively if the value is empty and continue with the next item.
185
- */
186
- if (is_array($value)) {
187
- $isEmpty = $this->_isAddressEmpty($value);
188
- if (!$isEmpty) {
189
- return false;
190
- }
191
-
192
- continue;
193
- }
194
-
195
- /**
196
- * Check if the value is empty or contains a single dash.
197
- */
198
- if (!empty($value) && $value !== '-') {
199
- return false;
200
- }
201
- }
202
-
203
- return true;
204
- }
205
-
206
- /**
207
- * Removes a PakjeGemak address from the quote.
208
- *
209
- * @return $this
210
- *
211
- * @throws Exception
212
- */
213
- protected function _removePgAddress()
214
- {
215
- $quote = $this->getQuote();
216
-
217
- /**
218
- * Get the PakjeGemak address if it exists.
219
- */
220
- $pgAddress = Mage::helper('tig_myparcel')->getPgAddress($quote);
221
- if (!$pgAddress) {
222
- return $this;
223
- }
224
-
225
- /**
226
- * Delete the address.
227
- */
228
- $pgAddress->delete();
229
- return $this;
230
- }
231
-
232
- /**
233
- * Saves or updates a PakjeGemak address for the quote.
234
- *
235
- * @param array $pgAddressData
236
- *
237
- * @return $this
238
- *
239
- * @throws Exception
240
- */
241
- protected function _savePgAddress($pgAddressData)
242
- {
243
- $helper = Mage::helper('tig_myparcel');
244
- $quote = $this->getQuote();
245
-
246
- /**
247
- * Check if the quote's shipping method is MyParcel.
248
- */
249
- $shippingMethod = $quote->getShippingAddress()->getShippingMethod();
250
- if (!$helper->shippingMethodIsMyParcel($shippingMethod)) {
251
- return $this;
252
- }
253
-
254
- /**
255
- * Create a new address and add the address data.
256
- */
257
- $pgAddress = Mage::getModel('sales/quote_address');
258
- $pgAddress->setAddressType($helper::PG_ADDRESS_TYPE)
259
- ->setCity($pgAddressData['city'])
260
- ->setCountryId($pgAddressData['country_id'])
261
- ->setPostcode($pgAddressData['postcode'])
262
- ->setCompany($pgAddressData['company'])
263
- ->setFirstname('-')
264
- ->setLastname('-')
265
- ->setTelephone($pgAddressData['telephone'])
266
- ->setStreet($pgAddressData['street']);
267
-
268
- /**
269
- * Add the address to the quote and save the quote.
270
- */
271
- $quote->addAddress($pgAddress)
272
- ->save();
273
-
274
- /**
275
- * Save the address.
276
- * This should not be required, but we've encountered a few cases where this was not done automatically by
277
- * saving the quote.
278
- */
279
- $pgAddress->save();
280
-
281
- /**
282
- * If this quote has been deactivated, check if it has an order.
283
- *
284
- * This is required for OneStepCheckout.
285
- */
286
- if (!$quote->getIsActive()) {
287
- /**
288
- * @var Mage_Sales_Model_Order $order
289
- */
290
- $order = Mage::getModel('sales/order')->load($quote->getId(), 'quote_id');
291
- if ($order && $order->getId()) {
292
- /**
293
- * Save the PakjeGemak address to the order.
294
- */
295
- $this->_copyAddressToOrder($order, $pgAddress);
296
- }
297
- }
298
-
299
  return $this;
300
  }
301
-
302
- /**
303
- * Copies a given address to the order.
304
- *
305
- * @param Mage_Sales_Model_Order $order
306
- * @param Mage_Sales_Model_Quote_Address $address
307
- *
308
- * @return $this
309
- *
310
- * @throws Exception
311
- */
312
- protected function _copyAddressToOrder(Mage_Sales_Model_Order $order, Mage_Sales_Model_Quote_Address $address)
313
- {
314
- /**
315
- * Convert the quote address to an order address and add it to the order.
316
- */
317
- $orderAddress = Mage::getModel('sales/convert_quote')->addressToOrderAddress($address);
318
-
319
- $order->addAddress($orderAddress)
320
- ->save();
321
-
322
- /**
323
- * This is a fix for the order address missing a parent ID.
324
- */
325
- if (!$orderAddress->getParentId()) {
326
- $orderAddress->setParentId($order->getId());
327
- }
328
-
329
- /**
330
- * This is required for some PSP extensions which will not save the PakjeGemak address otherwise.
331
- */
332
- $orderAddress->save();
333
-
334
- return $this;
335
- }
336
-
337
- /**
338
- * Validates an address and returns the validated data.
339
- *
340
- * @param array $address
341
- *
342
- * @return array
343
- *
344
- * @throws TIG_MyParcel2014_Exception
345
- */
346
- protected function _validateAddress($address)
347
- {
348
- if (!isset($address['city'])
349
- || !isset($address['country_id'])
350
- || !isset($address['street'])
351
- || !is_array($address['street'])
352
- || !isset($address['postcode'])
353
- || !isset($address['company'])
354
- ) {
355
- throw new TIG_MyParcel2014_Exception(
356
- Mage::helper('tig_myparcel')->__(
357
- 'Invalid argument supplied. A valid PakjeGemak address must contain at least a company name, city, '
358
- . 'country code, street and zipcode.'
359
- ),
360
- 'MYPA-0015'
361
- );
362
- }
363
-
364
- $city = $address['city'];
365
- $countryCode = $address['country_id'];
366
- $street = $address['street'][1];
367
- $houseNumber = $address['street'][2];
368
- $postcode = str_replace(' ', '', $address['postcode']);
369
- $name = $address['company'];
370
-
371
- $countryCodes = Mage::getResourceModel('directory/country_collection')->getColumnValues('iso2_code');
372
-
373
- $cityValidator = new Zend_Validate_Regex(array('pattern' => self::CITY_NAME_REGEX));
374
- $countryCodeValidator = new Zend_Validate_InArray(array('haystack' => $countryCodes));
375
- $streetValidator = new Zend_Validate_Regex(array('pattern' => self::STREET_NAME_REGEX));
376
- $housenumberValidator = new Zend_Validate_Digits();
377
- $postcodeValidator = new Zend_Validate_PostCode('nl_NL');
378
- $nameValidator = new Zend_Validate_Regex(array('pattern' => self::NAME_REGEX));
379
-
380
- if (!$cityValidator->isValid($city)
381
- || !$countryCodeValidator->isValid($countryCode)
382
- || !$streetValidator->isValid($street)
383
- || !$housenumberValidator->isValid($houseNumber)
384
- || !$postcodeValidator->isValid($postcode)
385
- || !$nameValidator->isValid($name)
386
- ) {
387
- throw new TIG_MyParcel2014_Exception(
388
- Mage::helper('tig_myparcel')->__('Invalid PakjeGemak address.'),
389
- 'MYPA-0016'
390
- );
391
- }
392
-
393
- $data = array(
394
- 'city' => $city,
395
- 'countryCode' => $countryCode,
396
- 'street' => array(
397
- 1 => $street,
398
- 2 => $houseNumber,
399
- 3 => '',
400
- ),
401
- 'postcode' => $postcode,
402
- 'name' => $name,
403
- 'telephone' => '-'
404
- );
405
-
406
- if (isset($address['telephone']) && !empty($address['telephone'])) {
407
- $phoneNumber = $address['telephone'];
408
- $phoneNumber = str_replace(array('-', ' '), '', $phoneNumber);
409
- $phoneNumberValidator = new Zend_Validate_Regex(array('pattern' => self::PHONE_NUMBER_REGEX));
410
-
411
- if (!$phoneNumberValidator->isValid($phoneNumber)) {
412
- throw new TIG_MyParcel2014_Exception(
413
- Mage::helper('tig_myparcel')->__('Invalid phone number.'),
414
- 'MYPA-0017'
415
- );
416
- }
417
-
418
- $data['telephone'] = $phoneNumber;
419
- }
420
-
421
- if (!isset($address['street'][3])) {
422
- return $data;
423
- }
424
-
425
- $houseNumberExtension = $address['street'][3];
426
-
427
- $houseNumberExtensionValidator = new Zend_Validate_Regex(array('pattern' => self::HOUSENR_EXT_REGEX));
428
-
429
- if (!$houseNumberExtensionValidator->isValid($houseNumberExtension)) {
430
- throw new TIG_MyParcel2014_Exception(
431
- Mage::helper('tig_myparcel')->__('Invalid housenumber extension.'),
432
- 'MYPA-0018'
433
- );
434
- }
435
-
436
- $data['street'][3] = $houseNumberExtension;
437
-
438
- return $data;
439
- }
440
  }
 
41
  */
42
  class TIG_MyParcel2014_Model_Observer_SavePgAddress extends Varien_Object
43
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  /**
45
  * Get the current quote.
46
  *
58
  return $quote;
59
  }
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  /**
62
  * Copies a PakjeGemak address from the quote to the newly placed order.
63
  *
66
  * @return $this
67
  *
68
  * @throws Exception
69
+ *
70
+ * @event sales_order_place_after
71
+ *
72
+ * @observer tig_myparcel_copy_pg_address
73
  */
74
  public function copyAddressToOrder(Varien_Event_Observer $observer)
75
  {
76
  /**
77
  * @var Mage_Sales_Model_Order $order
78
  */
79
+ $order = $observer->getEvent()->getOrder();
80
  $helper = Mage::helper('tig_myparcel');
81
 
82
  /**
97
  * Check if the order is shipped using MyParcel.
98
  */
99
  $shippingMethod = $order->getShippingMethod();
100
+ if (!$helper->shippingMethodIsPakjegemak($shippingMethod)) {
101
+ Mage::getModel('tig_myparcel/checkout_service')->removePgAddress($quote);
102
  return $this;
103
  }
104
 
114
  return $this;
115
  }
116
 
117
+ Mage::getModel('tig_myparcel/checkout_service')->copyAddressToOrder($order, $pakjeGemakAddress);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  return $this;
119
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  }
121
+
app/code/community/TIG/MyParcel2014/Model/Observer/SaveShipment.php CHANGED
@@ -1,5 +1,41 @@
1
  <?php
2
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  class TIG_MyParcel2014_Model_Observer_SaveShipment
4
  {
5
  /**
@@ -20,7 +56,19 @@ class TIG_MyParcel2014_Model_Observer_SaveShipment
20
  * @var Mage_Core_Controller_Varien_Front $controller
21
  */
22
  $controller = $observer->getControllerAction();
23
- $selectedConsignmentOptions = $controller->getRequest()->getParam('tig_myparcel');
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  /**
26
  * Add the selected options to the registry.
@@ -28,6 +76,9 @@ class TIG_MyParcel2014_Model_Observer_SaveShipment
28
  * This registry value will be checked when the MyParcel shipment entity is saved.
29
  */
30
  if (!empty($selectedConsignmentOptions)) {
 
 
 
31
  Mage::register('tig_myparcel_consignment_options', $selectedConsignmentOptions);
32
  }
33
 
@@ -75,15 +126,73 @@ class TIG_MyParcel2014_Model_Observer_SaveShipment
75
  return $this;
76
  }
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  /**
79
  * @var TIG_MyParcel2014_Model_Shipment $myParcelShipment
80
  */
81
  $myParcelShipment = Mage::getModel('tig_myparcel/shipment')->load($shipment->getId());
 
 
 
 
 
 
 
 
82
  $myParcelShipment->setShipmentId($shipment->getId())
83
  ->setConsignmentOptions()
84
  ->createConsignment()
85
  ->save();
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  return $this;
88
  }
89
 
1
  <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2015 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
  class TIG_MyParcel2014_Model_Observer_SaveShipment
40
  {
41
  /**
56
  * @var Mage_Core_Controller_Varien_Front $controller
57
  */
58
  $controller = $observer->getControllerAction();
59
+ $selectedConsignmentOptions = $controller->getRequest()->getParam('tig_myparcel', array());
60
+
61
+ if (!empty($selectedConsignmentOptions['shipment_type'])) {
62
+ $shipmentType = $selectedConsignmentOptions['shipment_type'];
63
+ if ($shipmentType != TIG_MyParcel2014_Model_Shipment::TYPE_NORMAL) {
64
+ if(isset($selectedConsignmentOptions['create_consignment'])){
65
+ $selectedConsignmentOptions = array(
66
+ 'shipment_type' => $shipmentType,
67
+ 'create_consignment' => '1',
68
+ );
69
+ }
70
+ }
71
+ }
72
 
73
  /**
74
  * Add the selected options to the registry.
76
  * This registry value will be checked when the MyParcel shipment entity is saved.
77
  */
78
  if (!empty($selectedConsignmentOptions)) {
79
+ if(!isset($selectedConsignmentOptions['create_consignment'])){
80
+ return $this;
81
+ }
82
  Mage::register('tig_myparcel_consignment_options', $selectedConsignmentOptions);
83
  }
84
 
126
  return $this;
127
  }
128
 
129
+ /**
130
+ * check if a new consignment must me made
131
+ */
132
+ $registryOptions = Mage::registry('tig_myparcel_consignment_options');
133
+ if(empty($registryOptions) || !isset($registryOptions['create_consignment'])){
134
+ return $this;
135
+ }
136
+
137
+ /**
138
+ * check if consignment option matches the Magento shipment
139
+ */
140
+ if (false !== $helper->getPgAddress($shipment->getOrder())
141
+ && (!isset($registryOptions['shipment_type']) ||
142
+ $registryOptions['shipment_type'] != TIG_MyParcel2014_Model_Shipment::TYPE_NORMAL
143
+ )
144
+ )
145
+ {
146
+ return $this;
147
+ }
148
+
149
  /**
150
  * @var TIG_MyParcel2014_Model_Shipment $myParcelShipment
151
  */
152
  $myParcelShipment = Mage::getModel('tig_myparcel/shipment')->load($shipment->getId());
153
+
154
+ $consignmentOptions = $registryOptions;
155
+ if (Mage::registry('tig_myparcel_consignment_options')) {
156
+ $consignmentOptions = array_merge($consignmentOptions, Mage::registry('tig_myparcel_consignment_options'));
157
+ Mage::unregister('tig_myparcel_consignment_options');
158
+ }
159
+ Mage::register('tig_myparcel_consignment_options', $consignmentOptions);
160
+
161
  $myParcelShipment->setShipmentId($shipment->getId())
162
  ->setConsignmentOptions()
163
  ->createConsignment()
164
  ->save();
165
 
166
+ $barcode = $myParcelShipment->getBarcode();
167
+ if ($barcode) {
168
+ $carrierCode = TIG_MyParcel2014_Model_Shipment::MYPARCEL_CARRIER_CODE;
169
+
170
+ $carrierTitle = Mage::getStoreConfig('carriers/' . $carrierCode . '/name', $shipment->getStoreId());
171
+ //if the other carrier-method is used, get the title
172
+ if($helper->getPgAddress($myParcelShipment)){
173
+ $carrierTitle = Mage::getStoreConfig('carriers/' . $carrierCode . '/pakjegemak_title', $shipment->getStoreId());
174
+ }
175
+
176
+
177
+
178
+ $data = array(
179
+ 'carrier_code' => $carrierCode,
180
+ 'title' => $carrierTitle,
181
+ 'number' => $barcode,
182
+ );
183
+
184
+ /**
185
+ * @var Mage_Sales_Model_Order_Shipment_Track $track
186
+ */
187
+ $track = Mage::getModel('sales/order_shipment_track')->addData($data);
188
+ $shipment->addTrack($track);
189
+ $trackCollection = $shipment->getTracksCollection();
190
+
191
+ foreach($trackCollection as $track) {
192
+ $track->save();
193
+ }
194
+ }
195
+
196
  return $this;
197
  }
198
 
app/code/community/TIG/MyParcel2014/Model/Resource/Setup.php CHANGED
@@ -88,4 +88,50 @@ class TIG_MyParcel2014_Model_Resource_Setup extends Mage_Catalog_Model_Resource_
88
 
89
  return $this;
90
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  }
88
 
89
  return $this;
90
  }
91
+
92
+ /**
93
+ * Copy a config setting from an old xpath to a new xpath directly in the database, rather than using Magento config
94
+ * entities.
95
+ *
96
+ * @param string $fromXpath
97
+ * @param string $toXpath
98
+ *
99
+ * @return $this
100
+ */
101
+ public function moveConfigSettingInDb($fromXpath, $toXpath)
102
+ {
103
+ $conn = $this->getConnection();
104
+
105
+ try {
106
+ $select = $conn->select()
107
+ ->from($this->getTable('core/config_data'))
108
+ ->where('path = ?', $fromXpath);
109
+
110
+ $result = $conn->fetchAll($select);
111
+ foreach ($result as $row) {
112
+ try {
113
+ /**
114
+ * Copy the old setting to the new setting.
115
+ *
116
+ * @todo Check if the row already exists.
117
+ */
118
+ $conn->insert(
119
+ $this->getTable('core/config_data'),
120
+ array(
121
+ 'scope' => $row['scope'],
122
+ 'scope_id' => $row['scope_id'],
123
+ 'value' => $row['value'],
124
+ 'path' => $toXpath
125
+ )
126
+ );
127
+ } catch (Exception $e) {
128
+ Mage::helper('tig_myparcel')->logException($e);
129
+ }
130
+ }
131
+ } catch (Exception $e) {
132
+ Mage::helper('tig_myparcel')->logException($e);
133
+ }
134
+
135
+ return $this;
136
+ }
137
  }
app/code/community/TIG/MyParcel2014/Model/Resource/Shipment/Grid/Collection.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_MyParcel2014_Model_Resource_Shipment_Grid_Collection extends Mage_Sales_Model_Resource_Order_Shipment_Grid_Collection
40
+ {
41
+ /**
42
+ * Fix for grid pager count believing there is only 1 item when $collection->getSelect()->groupBy() has been used
43
+ *
44
+ * @see Mage_Core_Model_Resource_Db_Collection_Abstract::getSelectCountSql()
45
+ *
46
+ * @return Zend_Db_Select
47
+ */
48
+ public function getSelectCountSql()
49
+ {
50
+ $this->_renderFilters();
51
+
52
+ $countSelect = clone $this->getSelect();
53
+ $countSelect->reset(Zend_Db_Select::ORDER);
54
+ $countSelect->reset(Zend_Db_Select::LIMIT_COUNT);
55
+ $countSelect->reset(Zend_Db_Select::LIMIT_OFFSET);
56
+ $countSelect->reset(Zend_Db_Select::COLUMNS);
57
+
58
+ if(count($this->getSelect()->getPart(Zend_Db_Select::GROUP)) > 0) {
59
+ $countSelect->reset(Zend_Db_Select::GROUP);
60
+ $countSelect->distinct(true);
61
+ $group = $this->getSelect()->getPart(Zend_Db_Select::GROUP);
62
+ $countSelect->columns("COUNT(DISTINCT ".implode(", ", $group).")");
63
+ } else {
64
+ $countSelect->columns('COUNT(*)');
65
+ }
66
+ return $countSelect;
67
+ }
68
+
69
+ /**
70
+ * Fix for getSize not re-counting the number of records in a collection after clear() had been called
71
+ *
72
+ * @return $this
73
+ */
74
+ public function clear()
75
+ {
76
+ $this->_setIsLoaded(false);
77
+ $this->_totalRecords = null;
78
+
79
+ $this->_items = array();
80
+ return $this;
81
+ }
82
+
83
+ /**
84
+ * Replace the select by a given select object.
85
+ * This effectively copies another collection (not entirely, but close enough for our purposes).
86
+ *
87
+ * @param Varien_db_Select $select
88
+ *
89
+ * @return $this
90
+ */
91
+ public function setSelect($select)
92
+ {
93
+ $this->_select = $select;
94
+
95
+ return $this;
96
+ }
97
+ }
app/code/community/TIG/MyParcel2014/Model/Shipment.php CHANGED
@@ -50,6 +50,7 @@
50
  * @method boolean hasApi()
51
  * @method boolean hasShipmentIncrementId()
52
  * @method boolean hasBarcodeSend()
 
53
  *
54
  * @method string getShipmentId()
55
  * @method string getConsignmentId()
@@ -65,6 +66,7 @@
65
  * @method int getInsuredAmount()
66
  * @method int getBarcodeSend()
67
  * @method int getCustomsContentType()
 
68
  *
69
  * @method TIG_MyParcel2014_Model_Shipment setShipmentId(int $value)
70
  * @method TIG_MyParcel2014_Model_Shipment setOrderId(int $value)
@@ -83,6 +85,7 @@
83
  * @method TIG_MyParcel2014_Model_Shipment setRetourlink(string $value)
84
  * @method TIG_MyParcel2014_Model_Shipment setIsCredit(int $value)
85
  * @method TIG_MyParcel2014_Model_Shipment setCustomsContentType(int $value)
 
86
  *
87
  */
88
  class TIG_MyParcel2014_Model_Shipment extends Mage_Core_Model_Abstract
@@ -98,6 +101,13 @@ class TIG_MyParcel2014_Model_Shipment extends Mage_Core_Model_Abstract
98
  const STATUS_NEW = 'new';
99
  const STATUS_CONFIRMED = 'Aangemeld';
100
 
 
 
 
 
 
 
 
101
  /**
102
  * Initialize the shipment
103
  */
@@ -344,36 +354,53 @@ class TIG_MyParcel2014_Model_Shipment extends Mage_Core_Model_Abstract
344
  }
345
 
346
  /**
 
 
347
  * @return array
348
  */
349
  public function getInsuredOption()
350
  {
 
351
  $helper = Mage::helper('tig_myparcel');
352
  $storeId = $this->getOrderStoreId();
353
  $orderTotalShipped = $this->getOrderTotal();
354
- $insuredType = 'insured_50';
355
- if($orderTotalShipped > 50 && $orderTotalShipped < 250){
356
- $insuredType = 'insured_250';
357
- }elseif($orderTotalShipped > 250){
358
- $insuredType = 'insured_500';
359
- }
360
 
361
- $configValue = $helper->getConfig($insuredType,'shipment',$storeId);
362
- if(!empty($configValue) && $configValue > 0){
363
- if($orderTotalShipped < $configValue){
364
- return array(
365
- 'option' => 'insured',
366
- 'selected' => 1,
367
- 'insured_amount' => $configValue,
368
- );
369
- }
 
 
 
 
 
 
 
 
 
 
370
  }
371
 
372
- return array(
373
  'option' => 'insured',
374
  'selected' => 0,
375
  'insured_amount' => 0,
376
  );
 
 
 
 
 
 
 
 
 
 
377
  }
378
 
379
  /**
@@ -408,19 +435,27 @@ class TIG_MyParcel2014_Model_Shipment extends Mage_Core_Model_Abstract
408
  * If any consignment options were set in the registry, those will be added as well.
409
  */
410
  $registryOptions = Mage::registry('tig_myparcel_consignment_options');
411
- if (!empty($registryOptions) && is_array($registryOptions)) {
 
 
 
 
 
 
 
412
  $consignmentOptions = array_merge($consignmentOptions, $registryOptions);
413
  }
414
 
415
  /**
416
- * is only empty and null when the myparcel shipment is created in a mass-action
417
  */
418
- if(empty($consignmentOptions) && is_null($registryOptions)){
 
419
  $this->calculateConsignmentOptions();
 
420
  return $this;
421
  }
422
 
423
-
424
  /**
425
  * Add the options.
426
  */
@@ -436,6 +471,12 @@ class TIG_MyParcel2014_Model_Shipment extends Mage_Core_Model_Abstract
436
  continue;
437
  }
438
 
 
 
 
 
 
 
439
  $this->setDataUsingMethod($option, $value);
440
  }
441
 
@@ -484,6 +525,7 @@ class TIG_MyParcel2014_Model_Shipment extends Mage_Core_Model_Abstract
484
  */
485
  $api = $this->getApi();
486
  $response = $api->createConsignmentRequest($this)
 
487
  ->sendRequest()
488
  ->getRequestResponse();
489
 
@@ -511,18 +553,24 @@ class TIG_MyParcel2014_Model_Shipment extends Mage_Core_Model_Abstract
511
  $isSend = $helper->sendBarcodeEmail($barcode,$shipment);
512
  $this->setBarcode($barcode);
513
  $status = self::STATUS_CONFIRMED;
 
 
 
 
514
  if($isSend){
515
  //add comment to order-comment history
516
- $comment = $helper->__('Track&amp;Trace e-mail is send: %s',$helper->getBarcodeUrl($barcode));
517
- $helper->log($comment);
518
- $order = $shipment->getOrder();
519
- $order->addStatusHistoryComment($comment);
520
- $order->setEmailSent(true);
521
- $order->save();
522
 
523
  //flag the myparcel shipment that barcode
524
  $this->setBarcodeSend(true);
 
 
525
  }
 
 
 
 
 
526
  }
527
 
528
  /**
@@ -563,7 +611,7 @@ class TIG_MyParcel2014_Model_Shipment extends Mage_Core_Model_Abstract
563
  }
564
 
565
  $carrierCode = self::MYPARCEL_CARRIER_CODE;
566
- $carrierTitle = Mage::getStoreConfig('carriers/tig_myparcel/name', $shipment->getStoreId());
567
 
568
  $data = array(
569
  'carrier_code' => $carrierCode,
@@ -589,6 +637,49 @@ class TIG_MyParcel2014_Model_Shipment extends Mage_Core_Model_Abstract
589
  return $this;
590
  }
591
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
592
  /**
593
  * @return $this
594
  */
50
  * @method boolean hasApi()
51
  * @method boolean hasShipmentIncrementId()
52
  * @method boolean hasBarcodeSend()
53
+ * @method boolean hasShipmentType()
54
  *
55
  * @method string getShipmentId()
56
  * @method string getConsignmentId()
66
  * @method int getInsuredAmount()
67
  * @method int getBarcodeSend()
68
  * @method int getCustomsContentType()
69
+ * @method string getShipmentType()
70
  *
71
  * @method TIG_MyParcel2014_Model_Shipment setShipmentId(int $value)
72
  * @method TIG_MyParcel2014_Model_Shipment setOrderId(int $value)
85
  * @method TIG_MyParcel2014_Model_Shipment setRetourlink(string $value)
86
  * @method TIG_MyParcel2014_Model_Shipment setIsCredit(int $value)
87
  * @method TIG_MyParcel2014_Model_Shipment setCustomsContentType(int $value)
88
+ * @method TIG_MyParcel2014_Model_Shipment setShipmentType(string $value)
89
  *
90
  */
91
  class TIG_MyParcel2014_Model_Shipment extends Mage_Core_Model_Abstract
101
  const STATUS_NEW = 'new';
102
  const STATUS_CONFIRMED = 'Aangemeld';
103
 
104
+ /**
105
+ * Supported shipment types.
106
+ */
107
+ const TYPE_LETTER_BOX = 'letter_box';
108
+ const TYPE_NORMAL = 'normal';
109
+ const TYPE_UNPAID = 'unstamped';
110
+
111
  /**
112
  * Initialize the shipment
113
  */
354
  }
355
 
356
  /**
357
+ * get the insured amount
358
+ *
359
  * @return array
360
  */
361
  public function getInsuredOption()
362
  {
363
+ //load helper, store id and orderTotal
364
  $helper = Mage::helper('tig_myparcel');
365
  $storeId = $this->getOrderStoreId();
366
  $orderTotalShipped = $this->getOrderTotal();
 
 
 
 
 
 
367
 
368
+ //get the insured values
369
+ $insuredType50 = $helper->getConfig('insured_50','shipment',$storeId);
370
+ $insuredType250 = $helper->getConfig('insured_250','shipment',$storeId);
371
+ $insuredType500 = $helper->getConfig('insured_500','shipment',$storeId);
372
+
373
+ //check if the values are not empty/zero.
374
+ $insuredType50 = (!empty($insuredType50) && $insuredType50 > 0)? $insuredType50 : false;
375
+ $insuredType250 = (!empty($insuredType250) && $insuredType250 > 0)? $insuredType250 : false;
376
+ $insuredType500 = (!empty($insuredType500) && $insuredType500 > 0)? $insuredType500 : false;
377
+
378
+
379
+ if(false !== $insuredType500 && $orderTotalShipped > $insuredType500){
380
+ $insuredValue = 500;
381
+ }elseif(false !== $insuredType250 && $orderTotalShipped > $insuredType250){
382
+ $insuredValue = 250;
383
+ }elseif(false !== $insuredType50 && $orderTotalShipped > $insuredType50){
384
+ $insuredValue = 50;
385
+ }else{
386
+ $insuredValue = 0;
387
  }
388
 
389
+ $returnArray = array(
390
  'option' => 'insured',
391
  'selected' => 0,
392
  'insured_amount' => 0,
393
  );
394
+
395
+ if($insuredValue > 0){
396
+ $returnArray = array(
397
+ 'option' => 'insured',
398
+ 'selected' => 1,
399
+ 'insured_amount' => $insuredValue,
400
+ );
401
+ }
402
+
403
+ return $returnArray;
404
  }
405
 
406
  /**
435
  * If any consignment options were set in the registry, those will be added as well.
436
  */
437
  $registryOptions = Mage::registry('tig_myparcel_consignment_options');
438
+
439
+ $filteredOptions = $registryOptions;
440
+ unset($filteredOptions['create_consignment']);
441
+ unset($filteredOptions['type_consignment']);
442
+
443
+
444
+
445
+ if (!empty($filteredOptions) && is_array($filteredOptions)) {
446
  $consignmentOptions = array_merge($consignmentOptions, $registryOptions);
447
  }
448
 
449
  /**
450
+ * is only empty when the myparcel shipment is created in a mass-action
451
  */
452
+
453
+ if(empty($consignmentOptions) && empty($filteredOptions)){
454
  $this->calculateConsignmentOptions();
455
+ $this->setDataUsingMethod('shipment_type', $registryOptions['type_consignment']);
456
  return $this;
457
  }
458
 
 
459
  /**
460
  * Add the options.
461
  */
471
  continue;
472
  }
473
 
474
+ if ($option == 'shipment_type') {
475
+ if (!$this->_isValidType($value)) {
476
+ $value = self::TYPE_NORMAL;
477
+ }
478
+ }
479
+
480
  $this->setDataUsingMethod($option, $value);
481
  }
482
 
525
  */
526
  $api = $this->getApi();
527
  $response = $api->createConsignmentRequest($this)
528
+ ->setStoreId($this->getOrder()->getStoreId())
529
  ->sendRequest()
530
  ->getRequestResponse();
531
 
553
  $isSend = $helper->sendBarcodeEmail($barcode,$shipment);
554
  $this->setBarcode($barcode);
555
  $status = self::STATUS_CONFIRMED;
556
+
557
+ //add comment to order-comment history
558
+ $shippingAddress = $this->getShippingAddress();
559
+ $barcodeUrl = $helper->getBarcodeUrl($barcode, $shippingAddress);
560
  if($isSend){
561
  //add comment to order-comment history
562
+ $comment = $helper->__('Track&amp;Trace e-mail is send: %s', $barcodeUrl);
 
 
 
 
 
563
 
564
  //flag the myparcel shipment that barcode
565
  $this->setBarcodeSend(true);
566
+ } else {
567
+ $comment = $helper->__('Track&amp;Trace link: %s', $barcodeUrl);
568
  }
569
+ $helper->log($comment);
570
+ $order = $shipment->getOrder();
571
+ $order->addStatusHistoryComment($comment);
572
+ $order->setEmailSent(false);
573
+ $order->save();
574
  }
575
 
576
  /**
611
  }
612
 
613
  $carrierCode = self::MYPARCEL_CARRIER_CODE;
614
+ $carrierTitle = Mage::getStoreConfig('carriers/' . $carrierCode . '/name', $shipment->getStoreId());
615
 
616
  $data = array(
617
  'carrier_code' => $carrierCode,
637
  return $this;
638
  }
639
 
640
+ /**
641
+ * Checks if the given shipment type is supported by this extension.
642
+ *
643
+ * @param $type
644
+ *
645
+ * @return bool
646
+ */
647
+ protected function _isValidType($type)
648
+ {
649
+ $isValid = false;
650
+ switch ($type) {
651
+ case self::TYPE_NORMAL:
652
+ $isValid = true;
653
+ break;
654
+ case self::TYPE_LETTER_BOX: //no break
655
+ case self::TYPE_UNPAID:
656
+ if ($this->isDutchShipment()) {
657
+ $isValid = true;
658
+ }
659
+ break;
660
+ //no default
661
+ }
662
+
663
+ return $isValid;
664
+ }
665
+
666
+ /**
667
+ * Check if this shipment's destination is the Netherlands.
668
+ *
669
+ * @return bool
670
+ */
671
+ public function isDutchShipment()
672
+ {
673
+ $shippingAddress = $this->getShippingAddress();
674
+ $country = $shippingAddress->getCountryId();
675
+
676
+ if ($country == 'NL') {
677
+ return true;
678
+ }
679
+
680
+ return false;
681
+ }
682
+
683
  /**
684
  * @return $this
685
  */
app/code/community/TIG/MyParcel2014/Model/System/Config/Source/ShippingMethods.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2015 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_MyParcel2014_Model_System_Config_Source_ShippingMethods
40
+ {
41
+ /**
42
+ * Return an option array of carriers and shipping methods. If $isActiveOnlyFlag is set to true, only active
43
+ * carriers and their methods will be returned. {@inheritdoc}
44
+ *
45
+ * @param boolean $isMultiSelect
46
+ * @param boolean $isActiveOnlyFlag
47
+ *
48
+ * @return array
49
+ */
50
+ public function toOptionArray($isMultiSelect = false, $isActiveOnlyFlag = false)
51
+ {
52
+ $methods = array();
53
+
54
+ /**
55
+ * @var Mage_Shipping_Model_Carrier_Abstract $carrierModel
56
+ */
57
+ $carriers = Mage::getSingleton('shipping/config')->getAllCarriers();
58
+ foreach ($carriers as $carrierCode => $carrierModel) {
59
+ if ($isActiveOnlyFlag && !$carrierModel->isActive()) {
60
+ continue;
61
+ }
62
+
63
+ try {
64
+ $carrierMethods = $carrierModel->getAllowedMethods();
65
+ if (!$carrierMethods) {
66
+ continue;
67
+ }
68
+ } catch (Exception $e) {
69
+ Mage::helper('tig_myparcel')->logException($e);
70
+ continue;
71
+ }
72
+
73
+ $carrierTitle = Mage::getStoreConfig('carriers/'.$carrierCode.'/title');
74
+ $methods[$carrierCode] = array(
75
+ 'label' => $carrierTitle,
76
+ 'value' => array(),
77
+ );
78
+
79
+ foreach ($carrierMethods as $methodCode => $methodTitle) {
80
+ $methods[$carrierCode]['value'][] = array(
81
+ 'value' => $carrierCode . '_' . $methodCode,
82
+ 'label' => '[' . $carrierCode . '] ' . $methodTitle,
83
+ );
84
+ }
85
+ }
86
+
87
+ return $methods;
88
+ }
89
+
90
+ /**
91
+ * Get all options as a flat array.
92
+ *
93
+ * @param bool $isActiveOnlyFlag
94
+ *
95
+ * @return array
96
+ */
97
+ public function toArray($isActiveOnlyFlag = false)
98
+ {
99
+ $methods = array();
100
+
101
+ /**
102
+ * @var Mage_Shipping_Model_Carrier_Abstract $carrierModel
103
+ */
104
+ $carriers = Mage::getSingleton('shipping/config')->getAllCarriers();
105
+ foreach ($carriers as $carrierCode => $carrierModel) {
106
+ if ($isActiveOnlyFlag && !$carrierModel->isActive()) {
107
+ continue;
108
+ }
109
+
110
+ $carrierMethods = $carrierModel->getAllowedMethods();
111
+ if (!$carrierMethods) {
112
+ continue;
113
+ }
114
+
115
+ foreach ($carrierMethods as $methodCode => $methodTitle) {
116
+ $methods[] = $carrierCode . '_' . $methodCode;
117
+ }
118
+ }
119
+
120
+ return $methods;
121
+ }
122
+ }
app/code/community/TIG/MyParcel2014/controllers/Adminhtml/ConfigController.php CHANGED
@@ -72,6 +72,7 @@ class TIG_MyParcel2014_Adminhtml_ConfigController extends Mage_Adminhtml_Control
72
  */
73
  $api = $myparcelShipment->getApi();
74
  $response = $api->createRetourlinkRequest($consignmentId)
 
75
  ->sendRequest()
76
  ->getRequestResponse();
77
 
@@ -89,10 +90,14 @@ class TIG_MyParcel2014_Adminhtml_ConfigController extends Mage_Adminhtml_Control
89
  $myparcelShipment->save();
90
 
91
  //set shipment comment
92
- $comment = $helper->__('Retourlink generated: %s',$response['retourlink']);
 
93
  $shipment->addComment($comment,0,1);
94
  $shipment->save();
95
 
 
 
 
96
  //redirect to previous screen
97
  $this->_redirectReferer();
98
  }
@@ -118,6 +123,7 @@ class TIG_MyParcel2014_Adminhtml_ConfigController extends Mage_Adminhtml_Control
118
  */
119
  $api = $myparcelShipment->getApi();
120
  $response = $api->createConsignmentCreditRequest($consignmentId)
 
121
  ->sendRequest()
122
  ->getRequestResponse();
123
 
@@ -126,7 +132,12 @@ class TIG_MyParcel2014_Adminhtml_ConfigController extends Mage_Adminhtml_Control
126
  */
127
  if(!is_array($response) || $response['success'] == false){
128
 
129
- $message = $helper->__('Credit has not been created, check MyParcel backend for details');
 
 
 
 
 
130
  $helper->addSessionMessage('adminhtml/session','MYPA-0021', 'warning');
131
  $helper->logException($message);
132
  }
72
  */
73
  $api = $myparcelShipment->getApi();
74
  $response = $api->createRetourlinkRequest($consignmentId)
75
+ ->setStoreId($shipment->getOrder()->getStoreId())
76
  ->sendRequest()
77
  ->getRequestResponse();
78
 
90
  $myparcelShipment->save();
91
 
92
  //set shipment comment
93
+ $aLink = '<a target="_blank" href="'.$response['retourlink'].'">'.$response['retourlink'].'</a>';
94
+ $comment = $helper->__('Retourlink generated: %s',$aLink);
95
  $shipment->addComment($comment,0,1);
96
  $shipment->save();
97
 
98
+ //add success message
99
+ $helper->addSessionMessage('adminhtml/session', null , 'success', $comment);
100
+
101
  //redirect to previous screen
102
  $this->_redirectReferer();
103
  }
123
  */
124
  $api = $myparcelShipment->getApi();
125
  $response = $api->createConsignmentCreditRequest($consignmentId)
126
+ ->setStoreId($shipment->getOrder()->getStoreId())
127
  ->sendRequest()
128
  ->getRequestResponse();
129
 
132
  */
133
  if(!is_array($response) || $response['success'] == false){
134
 
135
+ if($response['success'] == false){
136
+ $message = $helper->__('The consignment is already credited.');
137
+ }else{
138
+ $message = $helper->__('Credit has not been created, check MyParcel backend for details');
139
+ }
140
+
141
  $helper->addSessionMessage('adminhtml/session','MYPA-0021', 'warning');
142
  $helper->logException($message);
143
  }
app/code/community/TIG/MyParcel2014/controllers/Adminhtml/ShipmentController.php CHANGED
@@ -90,6 +90,54 @@ class TIG_MyParcel2014_Adminhtml_ShipmentController extends Mage_Adminhtml_Contr
90
  return $this;
91
  }
92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  /**
94
  * Creates shipments for a supplied array of orders. This action is triggered by a massaction in the sales > order
95
  * grid.
@@ -178,6 +226,119 @@ class TIG_MyParcel2014_Adminhtml_ShipmentController extends Mage_Adminhtml_Contr
178
  return $this;
179
  }
180
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  /**
182
  * Print shipping labels for all selected orders.
183
  *
@@ -194,16 +355,22 @@ class TIG_MyParcel2014_Adminhtml_ShipmentController extends Mage_Adminhtml_Contr
194
  ->addFieldToSelect(array('entity_id','order_id'))
195
  ->addFieldToFilter('order_id', array('in', $orderIds));
196
 
197
- $shipmentIds = $shipmentCollection->getColumnValues('entity_id');
198
- $orderIds2 = $shipmentCollection->getColumnValues('order_id');
 
 
 
 
 
199
 
200
  /**
201
  * create new shipments if not yet created
202
  */
203
- $hasNoShipments = array_diff($orderIds, $orderIds2);
204
  $newShipments = array();
 
 
205
  if(!empty($hasNoShipments)){
206
- $errors = 0;
207
  foreach($hasNoShipments as $orderId)
208
  {
209
  /**
@@ -213,34 +380,31 @@ class TIG_MyParcel2014_Adminhtml_ShipmentController extends Mage_Adminhtml_Contr
213
  $newShipments[] = $this->_createShipment($orderId, true);
214
  } catch (TIG_MyParcel2014_Exception $e) {
215
  $helper->logException($e);
216
- $this->addWarning(
217
- array(
218
- 'entity_id' => Mage::getResourceModel('sales/order')->getIncrementId($orderId),
219
- 'code' => $e->getCode(),
220
- 'description' => $e->getMessage(),
221
- )
222
  );
 
223
  $errors++;
224
  } catch (Exception $e) {
225
  $helper->logException($e);
226
- $this->addWarning(
227
- array(
228
- 'entity_id' => Mage::getResourceModel('sales/order')->getIncrementId($orderId),
229
- 'code' => null,
230
- 'description' => $e->getMessage(),
231
- )
232
  );
 
233
  $errors++;
234
  }
235
  }
236
  }
237
 
238
  if($errors > 0){
239
- $helper->addSessionMessage(
240
- 'adminhtml/session', null, 'error',
241
- $this->__('Some of the shipments could not be created or could not be created at MyParcel from the selected orders. See below for detailed information.')
242
- );
243
-
244
  $this->_redirect('adminhtml/sales_order/index');
245
  }
246
 
@@ -269,37 +433,52 @@ class TIG_MyParcel2014_Adminhtml_ShipmentController extends Mage_Adminhtml_Contr
269
  foreach ($shipments as $shipment) {
270
  try {
271
  if (!$shipment->hasConsignmentId()) {
272
- $shipment->createConsignment();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
  }
274
 
275
  $consignmentIds[] = $shipment->getConsignmentId();
276
  } catch (Exception $e) {
277
  $helper->logException($e);
278
- $this->addWarning(
279
- array(
280
- 'entity_id' => $shipment->getShipmentIncrementId(),
281
- 'code' => null,
282
- 'description' => $e->getMessage(),
283
- )
284
  );
285
  }
286
  }
287
 
288
  if (!$consignmentIds) {
289
- $helper->addSessionMessage(
290
- 'adminhtml/session',
291
- null,
292
- 'error',
293
- $this->__(
294
- 'Unfortunately no shipments could be processed. Please check the error messages for more details.'
295
- )
296
- );
297
-
298
  $this->_redirect('adminhtml/sales_order/index');
299
  return $this;
300
  }
301
 
 
302
  $api = Mage::getModel('tig_myparcel/api_myParcel');
 
303
  $start = $this->getRequest()->getParam('myparcel_print_labels_start', 1);
304
  $perpage = $helper->getConfig('print_orientation');
305
  $pdfData = $api->createRetrievePdfsRequest($consignmentIds, $start, $perpage)
@@ -321,51 +500,108 @@ class TIG_MyParcel2014_Adminhtml_ShipmentController extends Mage_Adminhtml_Contr
321
  }
322
 
323
  /**
324
- * Get shipment Ids from the request.
325
  *
326
- * @return array
327
  *
328
  * @throws TIG_MyParcel2014_Exception
329
  */
330
- protected function _getShipmentIds()
331
  {
332
- $shipmentIds = $this->getRequest()->getParam('shipment_ids', array());
 
 
 
 
 
 
 
 
 
 
 
 
 
333
 
334
  /**
335
- * Check if a shipment was selected.
 
336
  */
337
- if (!is_array($shipmentIds) || empty($shipmentIds)) {
338
- throw new TIG_MyParcel2014_Exception(
339
- $this->__('Please select one or more shipments.'),
340
- 'MYPA-0001'
341
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
342
  }
343
 
344
- return $shipmentIds;
345
- }
 
 
346
 
347
- /**
348
- * Get order Ids from the request.
349
- *
350
- * @return array
351
- *
352
- * @throws TIG_MyParcel2014_Exception
353
- */
354
- protected function _getOrderIds()
355
- {
356
- $orderIds = $this->getRequest()->getParam('order_ids', array());
 
 
 
 
357
 
358
  /**
359
- * Check if an order was selected.
360
  */
361
- if (!is_array($orderIds) || empty($orderIds)) {
362
- throw new TIG_MyParcel2014_Exception(
363
- $this->__('Please select one or more orders.'),
364
- 'MYPA-0002'
365
- );
366
- }
367
 
368
- return $orderIds;
369
  }
370
 
371
  /**
@@ -450,7 +686,7 @@ class TIG_MyParcel2014_Adminhtml_ShipmentController extends Mage_Adminhtml_Contr
450
  */
451
  $shipment = $this->_getMyParcelShipment($shipmentId);
452
  if (!$shipment || !$shipment->getId()) {
453
- return false;
454
  }
455
 
456
  $shippingMethod = $shipment->getShipment()->getOrder()->getShippingMethod();
@@ -480,6 +716,69 @@ class TIG_MyParcel2014_Adminhtml_ShipmentController extends Mage_Adminhtml_Contr
480
  return $myParcelShipment;
481
  }
482
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
483
  /**
484
  * Checks if any warnings were received while processing the shipments and/or orders. If any warnings are found they
485
  * are added to the adminhtml session as a notice.
@@ -604,44 +903,6 @@ class TIG_MyParcel2014_Adminhtml_ShipmentController extends Mage_Adminhtml_Contr
604
  return $this;
605
  }
606
 
607
- /**
608
- * Creates a shipment of an order containing all available items
609
- *
610
- * @param int $orderId
611
- * @param boolean $returnShipment
612
- *
613
- * @return int|TIG_MyParcel2014_Exception
614
- *
615
- *
616
- * @throws TIG_MyParcel2014_Exception
617
- */
618
- protected function _createShipment($orderId, $returnShipment = false)
619
- {
620
- /**
621
- * @var Mage_Sales_Model_Order $order
622
- */
623
- $order = Mage::getModel('sales/order')->load($orderId);
624
-
625
- if (!$order->canShip()) {
626
- throw new TIG_MyParcel2014_Exception(
627
- $this->__('Order #%s cannot be shipped at this time.', $order->getIncrementId()),
628
- 'MYPA-0004'
629
- );
630
- }
631
-
632
- $shipment = Mage::getModel('sales/service_order', $order)
633
- ->prepareShipment($this->_getItemQtys($order));
634
-
635
- $shipment->register();
636
- $this->_saveShipment($shipment);
637
-
638
- if($returnShipment){
639
- return $shipment;
640
- }
641
-
642
- return $shipment->getId();
643
- }
644
-
645
  /**
646
  * Initialize shipment items QTY
647
  *
@@ -669,21 +930,8 @@ class TIG_MyParcel2014_Adminhtml_ShipmentController extends Mage_Adminhtml_Contr
669
  return $itemQtys;
670
  }
671
 
672
- /**
673
- * Save shipment and order in one transaction
674
- *
675
- * @param Mage_Sales_Model_Order_Shipment $shipment
676
- *
677
- * @return $this
678
- */
679
- protected function _saveShipment($shipment)
680
  {
681
- $shipment->getOrder()->setIsInProcess(true);
682
- Mage::getModel('core/resource_transaction')
683
- ->addObject($shipment)
684
- ->addObject($shipment->getOrder())
685
- ->save();
686
-
687
- return $this;
688
  }
689
- }
90
  return $this;
91
  }
92
 
93
+ /**
94
+ * Get shipment Ids from the request.
95
+ *
96
+ * @return array
97
+ *
98
+ * @throws TIG_MyParcel2014_Exception
99
+ */
100
+ protected function _getShipmentIds()
101
+ {
102
+ $shipmentIds = $this->getRequest()->getParam('shipment_ids', array());
103
+
104
+ /**
105
+ * Check if a shipment was selected.
106
+ */
107
+ if (!is_array($shipmentIds) || empty($shipmentIds)) {
108
+ throw new TIG_MyParcel2014_Exception(
109
+ $this->__('Please select one or more shipments.'),
110
+ 'MYPA-0001'
111
+ );
112
+ }
113
+
114
+ return $shipmentIds;
115
+ }
116
+
117
+ /**
118
+ * Get order Ids from the request.
119
+ *
120
+ * @return array
121
+ *
122
+ * @throws TIG_MyParcel2014_Exception
123
+ */
124
+ protected function _getOrderIds()
125
+ {
126
+ $orderIds = $this->getRequest()->getParam('order_ids', array());
127
+
128
+ /**
129
+ * Check if an order was selected.
130
+ */
131
+ if (!is_array($orderIds) || empty($orderIds)) {
132
+ throw new TIG_MyParcel2014_Exception(
133
+ $this->__('Please select one or more orders.'),
134
+ 'MYPA-0002'
135
+ );
136
+ }
137
+
138
+ return $orderIds;
139
+ }
140
+
141
  /**
142
  * Creates shipments for a supplied array of orders. This action is triggered by a massaction in the sales > order
143
  * grid.
226
  return $this;
227
  }
228
 
229
+ /**
230
+ * Creates a single consignment, for an already existing Magento Shipping.
231
+ * This action is triggered in shipment-view page
232
+ *
233
+ * @return $this
234
+ */
235
+ public function createConsignmentAction()
236
+ {
237
+ $helper = Mage::helper('tig_myparcel');
238
+
239
+ //get post variables
240
+ $selectedConsignmentOptions = $this->getRequest()->getPost('tig_myparcel');
241
+ $shipmentId = $this->getRequest()->getPost('shipment_id');
242
+
243
+ $error = false;
244
+ $myParcelShipment = false;
245
+
246
+ //check if shipment id is present and set the shipmentId to the MyParcel Shipment model
247
+ try{
248
+
249
+ if(!empty($shipmentId)){
250
+ /** @var TIG_MyParcel2014_Model_Shipment $myParcelShipment */
251
+ $myParcelShipment = Mage::getModel('tig_myparcel/shipment')->setShipmentId($shipmentId);
252
+
253
+ }else{
254
+ throw new TIG_MyParcel2014_Exception(
255
+ $helper->__('Please select one or more shipments.'),
256
+ 'MYPA-0001'
257
+ );
258
+ }
259
+ }catch (TIG_MyParcel2014_Exception $e) {
260
+ $error = true;
261
+ $helper->logException($e);
262
+ $helper->addExceptionSessionMessage('adminhtml/session', $e);
263
+
264
+ $this->_redirect('adminhtml/sales_shipment/view', array('shipment_id' => $shipmentId));
265
+ return $this;
266
+
267
+ }
268
+
269
+ //check if consigment options are selected and matches with the type of consignment and Magento shipment
270
+ if (!empty($selectedConsignmentOptions['shipment_type'])) {
271
+ $shipmentType = $selectedConsignmentOptions['shipment_type'];
272
+
273
+ /**
274
+ * check if it is an pakjegemak-shipment && the shipment type is not equal to normal
275
+ * pakjegemak shipments can only be created with the normal shipment type
276
+ */
277
+ try {
278
+ /** @var Mage_Sales_Model_Order_Shipment $shipment */
279
+ $shipment = $myParcelShipment->getShipment();
280
+ if($helper->getPgAddress($shipment->getOrder()) && $shipmentType != TIG_MyParcel2014_Model_Shipment::TYPE_NORMAL){
281
+ $shipment_url = Mage::helper('adminhtml')->getUrl('adminhtml/sales_order_shipment/view',array('shipment_id' => $shipment->getShipment()->getId()));
282
+ throw new TIG_MyParcel2014_Exception(
283
+ $helper->__('The selected shipment type cannot be used. Pakjegemak shipments can only be created with the normal shipment type.<br/> The Magento shipment has been created without a MyParcel shipment, select a different shipment type or go to the shipment page to create a single MyParcel shipment. <a target="_blank" href="%s">View shipment</a>',$shipment_url),
284
+ 'MYPA-0023'
285
+ );
286
+ }
287
+ } catch(TIG_MyParcel2014_Exception $e) {
288
+ $error = true;
289
+ $helper->logException($e);
290
+ $helper->addExceptionSessionMessage('adminhtml/session', $e);
291
+
292
+ $this->_redirect('adminhtml/sales_shipment/view', array('shipment_id' => $shipmentId));
293
+ return $this;
294
+ }
295
+
296
+ //if not the normal shipment-type, no extra options are needed, so reset the consignment options
297
+ if ($shipmentType != TIG_MyParcel2014_Model_Shipment::TYPE_NORMAL) {
298
+ $selectedConsignmentOptions = array(
299
+ 'shipment_type' => $shipmentType
300
+ );
301
+ }
302
+
303
+ //register the consignment options
304
+ Mage::register('tig_myparcel_consignment_options', $selectedConsignmentOptions);
305
+
306
+ /**
307
+ * consignment options are set, try if we can create a myparcel consignment
308
+ */
309
+ try{
310
+ $myParcelShipment->setConsignmentOptions()->createConsignment()->save();
311
+ $barcode = $myParcelShipment->getBarcode();
312
+ if ($barcode) {
313
+ $myParcelShipment->addTrackingCodeToShipment($barcode);
314
+ }
315
+ }catch (TIG_MyParcel2014_Exception $e) {
316
+ $error = true;
317
+ $helper->logException($e);
318
+ $helper->addExceptionSessionMessage('adminhtml/session', $e);
319
+ } catch (Exception $e) {
320
+ $error = true;
321
+ $helper->logException($e);
322
+ $helper->addSessionMessage(
323
+ 'adminhtml/session',
324
+ null,
325
+ 'error',
326
+ $this->__('An error occurred while processing this action.')
327
+ );
328
+ }
329
+ }
330
+
331
+ if(true !== $error){
332
+ $helper->addSessionMessage(
333
+ 'adminhtml/session', null, 'success',
334
+ $this->__('The MyParcel consignment is successfully created.')
335
+ );
336
+ }
337
+
338
+ $this->_redirect('adminhtml/sales_shipment/view', array('shipment_id' => $shipmentId));
339
+ return $this;
340
+ }
341
+
342
  /**
343
  * Print shipping labels for all selected orders.
344
  *
355
  ->addFieldToSelect(array('entity_id','order_id'))
356
  ->addFieldToFilter('order_id', array('in', $orderIds));
357
 
358
+ $shipmentIds = $shipmentCollection->getColumnValues('entity_id');
359
+ $shipmentOrderIds = $shipmentCollection->getColumnValues('order_id');
360
+
361
+ Mage::register('tig_myparcel_consignment_options', array(
362
+ 'create_consignment' => '1',
363
+ 'type_consignment' => $this->getRequest()->getParam('type_consignment'),
364
+ ));
365
 
366
  /**
367
  * create new shipments if not yet created
368
  */
369
+ $hasNoShipments = array_diff($orderIds, $shipmentOrderIds);
370
  $newShipments = array();
371
+
372
+ $errors = 0;
373
  if(!empty($hasNoShipments)){
 
374
  foreach($hasNoShipments as $orderId)
375
  {
376
  /**
380
  $newShipments[] = $this->_createShipment($orderId, true);
381
  } catch (TIG_MyParcel2014_Exception $e) {
382
  $helper->logException($e);
383
+
384
+ $helper->addSessionMessage(
385
+ 'adminhtml/session',
386
+ null,
387
+ 'error',
388
+ 'Order: '.Mage::getResourceModel('sales/order')->getIncrementId($orderId). ' - ' .$e->getMessage()
389
  );
390
+
391
  $errors++;
392
  } catch (Exception $e) {
393
  $helper->logException($e);
394
+
395
+ $helper->addSessionMessage(
396
+ 'adminhtml/session',
397
+ null,
398
+ 'error',
399
+ 'Order: '.Mage::getResourceModel('sales/order')->getIncrementId($orderId). ' - ' .$e->getMessage()
400
  );
401
+
402
  $errors++;
403
  }
404
  }
405
  }
406
 
407
  if($errors > 0){
 
 
 
 
 
408
  $this->_redirect('adminhtml/sales_order/index');
409
  }
410
 
433
  foreach ($shipments as $shipment) {
434
  try {
435
  if (!$shipment->hasConsignmentId()) {
436
+ $type = $this->getRequest()->getParam('type_consignment');
437
+
438
+ if($helper->getPgAddress($shipment->getOrder()) && $type != TIG_MyParcel2014_Model_Shipment::TYPE_NORMAL){
439
+ $shipment_url = Mage::helper('adminhtml')->getUrl('adminhtml/sales_order_shipment/view',array('shipment_id' => $shipment->getShipment()->getId()));
440
+ throw new TIG_MyParcel2014_Exception(
441
+ $helper->__('The selected shipment type cannot be used. Pakjegemak shipments can only be created with the normal shipment type.<br/> The Magento shipment has been created without a MyParcel shipment, select a different shipment type or go to the shipment page to create a single MyParcel shipment. <a target="_blank" href="%s">View shipment</a>',$shipment_url),
442
+ 'MYPA-0023'
443
+ );
444
+ }
445
+
446
+ $consignmentOptions = array('shipment_type' => $type);
447
+ if (Mage::registry('tig_myparcel_consignment_options')) {
448
+ $consignmentOptions = array_merge(
449
+ $consignmentOptions,
450
+ Mage::registry('tig_myparcel_consignment_options')
451
+ );
452
+ Mage::unregister('tig_myparcel_consignment_options');
453
+ }
454
+ Mage::register('tig_myparcel_consignment_options', $consignmentOptions);
455
+ $shipment->setShipmentId($shipment->getShipment()->getId())
456
+ ->setConsignmentOptions($consignmentOptions)
457
+ ->createConsignment()
458
+ ->save();
459
  }
460
 
461
  $consignmentIds[] = $shipment->getConsignmentId();
462
  } catch (Exception $e) {
463
  $helper->logException($e);
464
+
465
+ $helper->addSessionMessage(
466
+ 'adminhtml/session',
467
+ null,
468
+ 'error',
469
+ 'Order: '.$shipment->getOrder()->getIncrementId(). ' - ' .$e->getMessage()
470
  );
471
  }
472
  }
473
 
474
  if (!$consignmentIds) {
 
 
 
 
 
 
 
 
 
475
  $this->_redirect('adminhtml/sales_order/index');
476
  return $this;
477
  }
478
 
479
+ $storeId = $shipment->getOrder()->getStoreId();
480
  $api = Mage::getModel('tig_myparcel/api_myParcel');
481
+ $api->setStoreId($storeId);
482
  $start = $this->getRequest()->getParam('myparcel_print_labels_start', 1);
483
  $perpage = $helper->getConfig('print_orientation');
484
  $pdfData = $api->createRetrievePdfsRequest($consignmentIds, $start, $perpage)
500
  }
501
 
502
  /**
503
+ * Print shipping labels for all selected shipments.
504
  *
505
+ * @return $this
506
  *
507
  * @throws TIG_MyParcel2014_Exception
508
  */
509
+ public function massPrintShipmentLabelsAction()
510
  {
511
+ $helper = Mage::helper('tig_myparcel');
512
+ $shipmentIds = $this->_getShipmentIds();
513
+
514
+ $shipmentCollection = Mage::getResourceModel('sales/order_shipment_collection')
515
+ ->addFieldToSelect(array('entity_id','order_id'))
516
+ ->addFieldToFilter('entity_id', array('in', $shipmentIds));
517
+
518
+ $shipmentIds = $shipmentCollection->getColumnValues('entity_id');
519
+ $shipmentOrderIds = $shipmentCollection->getColumnValues('order_id');
520
+
521
+ Mage::register('tig_myparcel_consignment_options', array(
522
+ 'create_consignment' => '1',
523
+ 'type_consignment' => $this->getRequest()->getParam('type_consignment'),
524
+ ));
525
 
526
  /**
527
+ * Load the shipments and check if they are valid.
528
+ * returns an array with shipment objects
529
  */
530
+ $shipments = $this->_loadAndCheckShipments($shipmentIds, true, false);
531
+
532
+ /**
533
+ * Get the labels from CIF.
534
+ *
535
+ * @var TIG_MyParcel2014_Model_Shipment $shipment
536
+ */
537
+ $consignmentIds = array();
538
+ foreach ($shipments as $shipment) {
539
+ try {
540
+ if (!$shipment->hasConsignmentId()) {
541
+ $type = $this->getRequest()->getParam('type_consignment');
542
+
543
+ if($helper->getPgAddress($shipment->getOrder()) && $type != TIG_MyParcel2014_Model_Shipment::TYPE_NORMAL){
544
+ $shipment_url = Mage::helper('adminhtml')->getUrl('adminhtml/sales_order_shipment/view',array('shipment_id' => $shipment->getShipment()->getId()));
545
+ throw new TIG_MyParcel2014_Exception(
546
+ $helper->__('The selected shipment type cannot be used. Pakjegemak shipments can only be created with the normal shipment type.<br/> The Magento shipment has been created without a MyParcel shipment, select a different shipment type or go to the shipment page to create a single MyParcel shipment. <a target="_blank" href="%s">View shipment</a>',$shipment_url),
547
+ 'MYPA-0023'
548
+ );
549
+ }
550
+
551
+ $consignmentOptions = array('shipment_type' => $type);
552
+ if (Mage::registry('tig_myparcel_consignment_options')) {
553
+ $consignmentOptions = array_merge(
554
+ $consignmentOptions,
555
+ Mage::registry('tig_myparcel_consignment_options')
556
+ );
557
+ Mage::unregister('tig_myparcel_consignment_options');
558
+ }
559
+ Mage::register('tig_myparcel_consignment_options', $consignmentOptions);
560
+ $shipment->setShipmentId($shipment->getShipment()->getId())
561
+ ->setConsignmentOptions($consignmentOptions)
562
+ ->createConsignment()
563
+ ->save();
564
+ }
565
+
566
+ $consignmentIds[] = $shipment->getConsignmentId();
567
+ } catch (Exception $e) {
568
+ $helper->logException($e);
569
+
570
+ $helper->addSessionMessage(
571
+ 'adminhtml/session',
572
+ null,
573
+ 'error',
574
+ 'Order: '.$shipment->getOrder()->getIncrementId(). ' - ' .$e->getMessage()
575
+ );
576
+ }
577
  }
578
 
579
+ if (!$consignmentIds) {
580
+ $this->_redirect('adminhtml/sales_shipment/index');
581
+ return $this;
582
+ }
583
 
584
+ $storeId = $shipment->getOrder()->getStoreId();
585
+ $api = Mage::getModel('tig_myparcel/api_myParcel');
586
+ $api->setStoreId($storeId);
587
+ $start = $this->getRequest()->getParam('myparcel_print_labels_start', 1);
588
+ $perpage = $helper->getConfig('print_orientation');
589
+ $pdfData = $api->createRetrievePdfsRequest($consignmentIds, $start, $perpage)
590
+ ->sendRequest()
591
+ ->getRequestResponse();
592
+
593
+ $fileName = 'MyParcel Shipping Labels '
594
+ . date('Ymd-His', Mage::getSingleton('core/date')->timestamp())
595
+ . '.pdf';
596
+
597
+ $this->_preparePdfResponse($fileName, urldecode($pdfData['pdf']));
598
 
599
  /**
600
+ * We need to check for warnings before the label download response.
601
  */
602
+ $this->_checkForWarnings();
 
 
 
 
 
603
 
604
+ return $this;
605
  }
606
 
607
  /**
686
  */
687
  $shipment = $this->_getMyParcelShipment($shipmentId);
688
  if (!$shipment || !$shipment->getId()) {
689
+ $shipment->setShipmentId($shipmentId);
690
  }
691
 
692
  $shippingMethod = $shipment->getShipment()->getOrder()->getShippingMethod();
716
  return $myParcelShipment;
717
  }
718
 
719
+ /**
720
+ * Creates a shipment of an order containing all available items
721
+ *
722
+ * @param int $orderId
723
+ * @param boolean $returnShipment
724
+ *
725
+ * @return int|TIG_MyParcel2014_Exception
726
+ *
727
+ *
728
+ * @throws TIG_MyParcel2014_Exception
729
+ */
730
+ protected function _createShipment($orderId, $returnShipment = false)
731
+ {
732
+ /**
733
+ * @var Mage_Sales_Model_Order $order
734
+ */
735
+ $order = Mage::getModel('sales/order')->load($orderId);
736
+
737
+ if($order->isCanceled()){
738
+ throw new TIG_MyParcel2014_Exception(
739
+ $this->__('Order %s cannot be shipped, because it is cancelled.', $order->getIncrementId()),
740
+ 'MYPA-0004'
741
+ );
742
+ }
743
+
744
+ if (!$order->canShip()) {
745
+ throw new TIG_MyParcel2014_Exception(
746
+ $this->__('Order #%s cannot be shipped at this time.', $order->getIncrementId()),
747
+ 'MYPA-0004'
748
+ );
749
+ }
750
+
751
+ $shipment = Mage::getModel('sales/service_order', $order)
752
+ ->prepareShipment($this->_getItemQtys($order));
753
+
754
+ $shipment->register();
755
+ $this->_saveShipment($shipment);
756
+
757
+ if($returnShipment){
758
+ return $shipment;
759
+ }
760
+
761
+ return $shipment->getId();
762
+ }
763
+
764
+ /**
765
+ * Save shipment and order in one transaction
766
+ *
767
+ * @param Mage_Sales_Model_Order_Shipment $shipment
768
+ *
769
+ * @return $this
770
+ */
771
+ protected function _saveShipment($shipment)
772
+ {
773
+ $shipment->getOrder()->setIsInProcess(true);
774
+ Mage::getModel('core/resource_transaction')
775
+ ->addObject($shipment)
776
+ ->addObject($shipment->getOrder())
777
+ ->save();
778
+
779
+ return $this;
780
+ }
781
+
782
  /**
783
  * Checks if any warnings were received while processing the shipments and/or orders. If any warnings are found they
784
  * are added to the adminhtml session as a notice.
903
  return $this;
904
  }
905
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
906
  /**
907
  * Initialize shipment items QTY
908
  *
930
  return $itemQtys;
931
  }
932
 
933
+ protected function _isAllowed()
 
 
 
 
 
 
 
934
  {
935
+ return true;
 
 
 
 
 
 
936
  }
937
+ }
app/code/community/TIG/MyParcel2014/controllers/CheckoutController.php ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_MyParcel2014_CheckoutController extends Mage_Core_Controller_Front_Action
40
+ {
41
+ /**
42
+ * Get available locations for the supplied postcode and housenr from MyParcel.
43
+ *
44
+ * @return $this
45
+ */
46
+ public function getLocationsAction()
47
+ {
48
+ /**
49
+ * This action may only be called using AJAX requests
50
+ */
51
+ if (!$this->getRequest()->isAjax()) {
52
+ $this->getResponse()
53
+ ->setBody('not_allowed');
54
+
55
+ return $this;
56
+ }
57
+
58
+ /**
59
+ * Get the submitted post data and validate it.
60
+ */
61
+ $postData = $this->getRequest()->getPost();
62
+ $validData = Mage::getSingleton('tig_myparcel/checkout_validate')->validateGetLocationsData($postData);
63
+
64
+ /**
65
+ * Check if the data is valid.
66
+ */
67
+ if (!$validData) {
68
+ $this->getResponse()
69
+ ->setBody('invalid_data');
70
+
71
+ return $this;
72
+ }
73
+
74
+ /**
75
+ * Form the data array required for the MyParcel API.
76
+ */
77
+ $requestData = array(
78
+ 'country' => 'NL',
79
+ 'postalcode' => $validData['postcode'],
80
+ 'streetnumber' => $validData['housenr'],
81
+ 'courier' => 'postnl',
82
+ );
83
+
84
+ /**
85
+ * Request all available locations from the MYParcel API.
86
+ */
87
+ $api = Mage::getModel('tig_myparcel/api_myParcel');
88
+ $api->createGetLocationsRequest($requestData)->sendRequest();
89
+
90
+ /**
91
+ * Get the result and make sure it's valid.
92
+ */
93
+ $result = $api->getRequestResponse();
94
+ if (!isset($result['data'])) {
95
+ $this->getResponse()
96
+ ->setBody('invalid_response');
97
+
98
+ return $this;
99
+ }
100
+
101
+ /**
102
+ * Print the response in JSON format.
103
+ */
104
+ $json = Mage::helper('core')->jsonEncode($result);
105
+ $this->getResponse()
106
+ ->setBody($json);
107
+
108
+ return $this;
109
+ }
110
+
111
+ /**
112
+ * Save the selected PakjeGemak location.
113
+ *
114
+ * @return $this
115
+ */
116
+ public function saveLocationAction()
117
+ {
118
+ /**
119
+ * This action may only be called using AJAX requests
120
+ */
121
+ if (!$this->getRequest()->isAjax()) {
122
+ $this->getResponse()
123
+ ->setBody('not_allowed');
124
+
125
+ return $this;
126
+ }
127
+
128
+ /**
129
+ * Get the submitted post data and validate it.
130
+ */
131
+ $postData = $this->getRequest()->getPost();
132
+ $validData = Mage::getSingleton('tig_myparcel/checkout_validate')->validateSaveLocationData($postData);
133
+
134
+ /**
135
+ * Check if the data is valid.
136
+ */
137
+ if (!$validData) {
138
+ $this->getResponse()
139
+ ->setBody('invalid_data');
140
+
141
+ return $this;
142
+ }
143
+
144
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
145
+ try {
146
+ /**
147
+ * Save the address of the selected PakjeGemak location in the quote.
148
+ */
149
+ Mage::getModel('tig_myparcel/checkout_service')->savePgAddress($validData, $quote);
150
+ } catch (Exception $e) {
151
+ Mage::helper('tig_myparcel')->logException($e);
152
+
153
+ $this->getResponse()
154
+ ->setBody('error');
155
+
156
+ return $this;
157
+ }
158
+
159
+ $this->getResponse()
160
+ ->setBody('ok');
161
+
162
+ return $this;
163
+ }
164
+ }
app/code/community/TIG/MyParcel2014/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <TIG_MyParcel2014>
5
- <version>1.1.4</version>
6
  </TIG_MyParcel2014>
7
  </modules>
8
  <global>
@@ -118,19 +118,38 @@
118
  </tig_myparcel_shipment_save>
119
  </observers>
120
  </controller_action_predispatch_adminhtml_sales_order_shipment_save>
121
- <adminhtml_block_html_before>
122
- <observers>
123
- <!-- Adds a massaction the grid that allows merchants to print shipping labels for selected orders-->
124
  <tig_myparcel_adminhtml_ordergrid>
125
- <type>singleton</type>
126
- <class>tig_myparcel/adminhtml_observer_orderGrid</class>
127
- <method>modifyGrid</method>
128
- </tig_myparcel_adminhtml_ordergrid>
129
- </observers>
130
- </adminhtml_block_html_before>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  </events>
132
  </adminhtml>
 
133
  <frontend>
 
 
 
134
  <routers>
135
  <tig_myparcel>
136
  <use>standard</use>
@@ -156,28 +175,6 @@
156
  </TIG_MyParcel2014>
157
  </modules>
158
  </translate>
159
- <events>
160
- <controller_action_postdispatch_checkout_onepage_saveShippingMethod>
161
- <observers>
162
- <!-- Saves a selected PG address for Onepage checkout. -->
163
- <tig_myparcel_save_pg_address>
164
- <type>singleton</type>
165
- <class>tig_myparcel/observer_savePgAddress</class>
166
- <method>savePgAddress</method>
167
- </tig_myparcel_save_pg_address>
168
- </observers>
169
- </controller_action_postdispatch_checkout_onepage_saveShippingMethod>
170
- <controller_action_postdispatch_onestepcheckout_index_index>
171
- <observers>
172
- <!-- Saves a selected PG address for OneStepCheckout. -->
173
- <tig_myparcel_save_pg_address>
174
- <type>singleton</type>
175
- <class>tig_myparcel/observer_savePgAddress</class>
176
- <method>savePgAddress</method>
177
- </tig_myparcel_save_pg_address>
178
- </observers>
179
- </controller_action_postdispatch_onestepcheckout_index_index>
180
- </events>
181
  </frontend>
182
 
183
  <crontab>
@@ -194,16 +191,19 @@
194
 
195
  <default>
196
  <carriers>
197
- <tig_myparcel>
198
  <active>0</active>
199
  <model>tig_myparcel/carrier_myParcel</model>
200
  <title>MyParcel Shipping</title>
 
201
  <rate_type>flat</rate_type>
202
  <pakjegemak_active>0</pakjegemak_active>
 
203
  <pakjegemak_fee>0</pakjegemak_fee>
 
204
  <sort_order>10</sort_order>
205
  <sallowspecific>0</sallowspecific>
206
- </tig_myparcel>
207
  </carriers>
208
  <tig_myparcel>
209
  <api>
@@ -215,6 +215,8 @@
215
  <active>0</active>
216
  <test>0</test>
217
  <print_orientation>A4</print_orientation>
 
 
218
  </general>
219
  <shipment>
220
  <home_address_only>0</home_address_only>
@@ -246,7 +248,7 @@
246
 
247
  <!-- Stability of this release -->
248
  <stability>
249
- <tig_myparcel>stable</tig_myparcel>
250
  </stability>
251
 
252
  <!-- A list of possible error codes recognized by this extension. Each error has a default message, a link to
@@ -362,6 +364,14 @@
362
  <url/>
363
  <type>error</type>
364
  </MYPA-0022>
 
 
 
 
 
 
 
 
365
  </errors>
366
  </tig>
367
  </config>
2
  <config>
3
  <modules>
4
  <TIG_MyParcel2014>
5
+ <version>1.3.0</version>
6
  </TIG_MyParcel2014>
7
  </modules>
8
  <global>
118
  </tig_myparcel_shipment_save>
119
  </observers>
120
  </controller_action_predispatch_adminhtml_sales_order_shipment_save>
121
+ <adminhtml_block_html_before>
122
+ <observers>
123
+ <!-- Adds a massaction the grid that allows merchants to print shipping labels for selected orders-->
124
  <tig_myparcel_adminhtml_ordergrid>
125
+ <type>singleton</type>
126
+ <class>tig_myparcel/adminhtml_observer_orderGrid</class>
127
+ <method>modifyGrid</method>
128
+ </tig_myparcel_adminhtml_ordergrid>
129
+ <!-- Adds a column with shipping status to the shipment grid -->
130
+ <tig_myparcel_adminhtml_shipmentgrid>
131
+ <type>singleton</type>
132
+ <class>tig_myparcel/adminhtml_observer_shipmentGrid</class>
133
+ <method>modifyGrid</method>
134
+ </tig_myparcel_adminhtml_shipmentgrid>
135
+ </observers>
136
+ </adminhtml_block_html_before>
137
+ <adminhtml_widget_container_html_before>
138
+ <observers>
139
+ <tig_myparcel_adminhtml_view_shipment>
140
+ <class>tig_myparcel/adminhtml_observer_viewShipment</class>
141
+ <type>singleton</type>
142
+ <method>adminhtmlWidgetContainerHtmlBefore</method>
143
+ </tig_myparcel_adminhtml_view_shipment>
144
+ </observers>
145
+ </adminhtml_widget_container_html_before>
146
  </events>
147
  </adminhtml>
148
+
149
  <frontend>
150
+ <secure_url>
151
+ <myparcel_checkout>/myparcel2014/checkout</myparcel_checkout>
152
+ </secure_url>
153
  <routers>
154
  <tig_myparcel>
155
  <use>standard</use>
175
  </TIG_MyParcel2014>
176
  </modules>
177
  </translate>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  </frontend>
179
 
180
  <crontab>
191
 
192
  <default>
193
  <carriers>
194
+ <myparcel>
195
  <active>0</active>
196
  <model>tig_myparcel/carrier_myParcel</model>
197
  <title>MyParcel Shipping</title>
198
+ <name>MyParcel</name>
199
  <rate_type>flat</rate_type>
200
  <pakjegemak_active>0</pakjegemak_active>
201
+ <pakjegemak_title>Pakjegemak</pakjegemak_title>
202
  <pakjegemak_fee>0</pakjegemak_fee>
203
+ <pakjegemak_min_order_enabled>0</pakjegemak_min_order_enabled>
204
  <sort_order>10</sort_order>
205
  <sallowspecific>0</sallowspecific>
206
+ </myparcel>
207
  </carriers>
208
  <tig_myparcel>
209
  <api>
215
  <active>0</active>
216
  <test>0</test>
217
  <print_orientation>A4</print_orientation>
218
+ <myparcel_shipping_methods>tig_myparcel_flatrate,myparcel_flatrate,tig_myparcel_tablerate,myparcel_tablerate,tig_myparcel_pakjegemak,myparcel_pakjegemak</myparcel_shipping_methods>
219
+ <ssl_handshake>0</ssl_handshake>
220
  </general>
221
  <shipment>
222
  <home_address_only>0</home_address_only>
248
 
249
  <!-- Stability of this release -->
250
  <stability>
251
+ <tig_myparcel>develop</tig_myparcel>
252
  </stability>
253
 
254
  <!-- A list of possible error codes recognized by this extension. Each error has a default message, a link to
364
  <url/>
365
  <type>error</type>
366
  </MYPA-0022>
367
+ <MYPA-0023>
368
+ <message>The selected shipment-type cannot be used, Pakjegemak-shipments can only be created with the normal shipment type.</message>
369
+ <url/>
370
+ <type>error</type>
371
+ </MYPA-0023>
372
+ <MYPA-0024>
373
+ <message>Order %s cannot be shipped, because it is cancelled.</message>
374
+ </MYPA-0024>
375
  </errors>
376
  </tig>
377
  </config>
app/code/community/TIG/MyParcel2014/etc/system.xml CHANGED
@@ -4,7 +4,7 @@
4
  <!-- add MyParcel shipping method to the shipping-methods list -->
5
  <carriers translate="label" module="shipping">
6
  <groups>
7
- <tig_myparcel translate="label">
8
  <label>MyParcel</label>
9
  <frontend_type>text</frontend_type>
10
  <sort_order>0</sort_order>
@@ -113,7 +113,18 @@
113
  <show_in_website>1</show_in_website>
114
  <show_in_store>0</show_in_store>
115
  </pakjegemak_active>
116
- <pakjegemak_fee translate="label" module="tig_myparcel">
 
 
 
 
 
 
 
 
 
 
 
117
  <label>Pakjegemak fee</label>
118
  <comment>This will be added to the regular shipping price</comment>
119
  <frontend_type>text</frontend_type>
@@ -126,11 +137,37 @@
126
  <pakjegemak_active>1</pakjegemak_active>
127
  </depends>
128
  </pakjegemak_fee>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  <!-- allow specific countries -->
130
  <sallowspecific translate="label" module="tig_myparcel">
131
  <label>Ship to Applicable Countries</label>
132
  <frontend_type>select</frontend_type>
133
- <sort_order>120</sort_order>
134
  <frontend_class>shipping-applicable-country</frontend_class>
135
  <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
136
  <show_in_default>1</show_in_default>
@@ -140,7 +177,7 @@
140
  <specificcountry translate="label" module="tig_myparcel">
141
  <label>Ship to Specific Countries</label>
142
  <frontend_type>multiselect</frontend_type>
143
- <sort_order>130</sort_order>
144
  <source_model>adminhtml/system_config_source_country</source_model>
145
  <show_in_default>1</show_in_default>
146
  <show_in_website>1</show_in_website>
@@ -150,13 +187,13 @@
150
  <sort_order translate="label" module="tig_myparcel">
151
  <label>Sort Order</label>
152
  <frontend_type>text</frontend_type>
153
- <sort_order>140</sort_order>
154
  <show_in_default>1</show_in_default>
155
  <show_in_website>1</show_in_website>
156
  <show_in_store>0</show_in_store>
157
  </sort_order>
158
  </fields>
159
- </tig_myparcel>
160
  </groups>
161
  </carriers>
162
  <!-- add the configuration page as seperate page to the backend -->
@@ -264,6 +301,33 @@
264
  <show_in_website>1</show_in_website>
265
  <show_in_store>1</show_in_store>
266
  </tracktrace_template>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  </fields>
268
  </general>
269
  <shipment translate="label comment" module="tig_myparcel">
@@ -305,7 +369,7 @@
305
  </return_if_no_answer>
306
  <insured_50 translate="label comment">
307
  <label><![CDATA[Insured up to &euro; 50]]></label>
308
- <comment>For NL shipping only</comment>
309
  <frontend_type>text</frontend_type>
310
  <validate>validate-number validate-zero-or-greater</validate>
311
  <sort_order>40</sort_order>
@@ -313,7 +377,7 @@
313
  <show_in_website>1</show_in_website>
314
  <show_in_store>1</show_in_store>
315
  </insured_50>
316
- <insured_250 translate="label comment">
317
  <label><![CDATA[Insured up to &euro; 250]]></label>
318
  <comment><![CDATA[For NL shipping only, shipments outside the EU insured default is &euro; 200]]></comment>
319
  <frontend_type>text</frontend_type>
4
  <!-- add MyParcel shipping method to the shipping-methods list -->
5
  <carriers translate="label" module="shipping">
6
  <groups>
7
+ <myparcel translate="label">
8
  <label>MyParcel</label>
9
  <frontend_type>text</frontend_type>
10
  <sort_order>0</sort_order>
113
  <show_in_website>1</show_in_website>
114
  <show_in_store>0</show_in_store>
115
  </pakjegemak_active>
116
+ <pakjegemak_title translate="label" module="tig_myparcel">
117
+ <label>Pakjegemak Method Name</label>
118
+ <frontend_type>text</frontend_type>
119
+ <sort_order>105</sort_order>
120
+ <show_in_default>1</show_in_default>
121
+ <show_in_website>1</show_in_website>
122
+ <show_in_store>1</show_in_store>
123
+ <depends>
124
+ <pakjegemak_active>1</pakjegemak_active>
125
+ </depends>
126
+ </pakjegemak_title>
127
+ <pakjegemak_fee translate="label,comment" module="tig_myparcel">
128
  <label>Pakjegemak fee</label>
129
  <comment>This will be added to the regular shipping price</comment>
130
  <frontend_type>text</frontend_type>
137
  <pakjegemak_active>1</pakjegemak_active>
138
  </depends>
139
  </pakjegemak_fee>
140
+ <pakjegemak_min_order_enabled translate="label,comment" module="tig_myparcel">
141
+ <label>Pakjegemak minimum order total enabled</label>
142
+ <frontend_type>select</frontend_type>
143
+ <source_model>tig_myparcel/system_config_source_yesno</source_model>
144
+ <sort_order>120</sort_order>
145
+ <show_in_default>1</show_in_default>
146
+ <show_in_website>1</show_in_website>
147
+ <show_in_store>0</show_in_store>
148
+ <depends>
149
+ <pakjegemak_active>1</pakjegemak_active>
150
+ </depends>
151
+ </pakjegemak_min_order_enabled>
152
+ <pakjegemak_min_order_total translate="label,comment" module="tig_myparcel">
153
+ <label>Pakjegemak minimum order total, incl. BTW</label>
154
+ <comment>Pakjegemak will not be visible if the subtotal of an order is below this value</comment>
155
+ <frontend_type>text</frontend_type>
156
+ <validate>validate-number validate-zero-or-greater</validate>
157
+ <sort_order>130</sort_order>
158
+ <show_in_default>1</show_in_default>
159
+ <show_in_website>1</show_in_website>
160
+ <show_in_store>0</show_in_store>
161
+ <depends>
162
+ <pakjegemak_active>1</pakjegemak_active>
163
+ <pakjegemak_min_order_enabled>1</pakjegemak_min_order_enabled>
164
+ </depends>
165
+ </pakjegemak_min_order_total>
166
  <!-- allow specific countries -->
167
  <sallowspecific translate="label" module="tig_myparcel">
168
  <label>Ship to Applicable Countries</label>
169
  <frontend_type>select</frontend_type>
170
+ <sort_order>140</sort_order>
171
  <frontend_class>shipping-applicable-country</frontend_class>
172
  <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
173
  <show_in_default>1</show_in_default>
177
  <specificcountry translate="label" module="tig_myparcel">
178
  <label>Ship to Specific Countries</label>
179
  <frontend_type>multiselect</frontend_type>
180
+ <sort_order>150</sort_order>
181
  <source_model>adminhtml/system_config_source_country</source_model>
182
  <show_in_default>1</show_in_default>
183
  <show_in_website>1</show_in_website>
187
  <sort_order translate="label" module="tig_myparcel">
188
  <label>Sort Order</label>
189
  <frontend_type>text</frontend_type>
190
+ <sort_order>160</sort_order>
191
  <show_in_default>1</show_in_default>
192
  <show_in_website>1</show_in_website>
193
  <show_in_store>0</show_in_store>
194
  </sort_order>
195
  </fields>
196
+ </myparcel>
197
  </groups>
198
  </carriers>
199
  <!-- add the configuration page as seperate page to the backend -->
301
  <show_in_website>1</show_in_website>
302
  <show_in_store>1</show_in_store>
303
  </tracktrace_template>
304
+ <myparcel_shipping_methods translate="label tooltip" module="tig_myparcel">
305
+ <label>MyParcel shipping methods</label>
306
+ <tooltip>Please select the shipping methods that will be considered to be 'MyParcel' by this extension. Orders placed using one of these shipping methods may be processed using the MyParcel extension.</tooltip>
307
+ <frontend_type>multiselect</frontend_type>
308
+ <can_be_empty>0</can_be_empty>
309
+ <source_model>tig_myparcel/system_config_source_shippingMethods</source_model>
310
+ <sort_order>60</sort_order>
311
+ <show_in_default>1</show_in_default>
312
+ <show_in_website>0</show_in_website>
313
+ <show_in_store>0</show_in_store>
314
+ </myparcel_shipping_methods>
315
+ <ssl_handshake translate="label comment tooltip">
316
+ <label>Force unencrypted MyParcel connection</label>
317
+ <comment>By enabling this, you will force connection to the MyParcel platform over unsecured http, rather than https</comment>
318
+ <tooltip>In some cases the SSL certification can't be validated, which can lead to problems connection to the MyParcel platform. Only use this if you are aware that all communication to MyParcel will be sent over the unsecure https protocol.</tooltip>
319
+ <frontend_type>select</frontend_type>
320
+ <source_model>tig_myparcel/system_config_source_yesno</source_model>
321
+ <sort_order>60</sort_order>
322
+ <show_in_default>1</show_in_default>
323
+ <depends><use_in_adminhtml>1</use_in_adminhtml></depends>
324
+ </ssl_handshake>
325
+ <use_in_adminhtml>
326
+ <frontend_type>hidden</frontend_type>
327
+ <frontend_model>tig_myparcel/adminhtml_system_config_adminSecure</frontend_model>
328
+ <sort_order>70</sort_order>
329
+ <show_in_default>1</show_in_default>
330
+ </use_in_adminhtml>
331
  </fields>
332
  </general>
333
  <shipment translate="label comment" module="tig_myparcel">
369
  </return_if_no_answer>
370
  <insured_50 translate="label comment">
371
  <label><![CDATA[Insured up to &euro; 50]]></label>
372
+ <comment>Only for dutch shipments</comment>
373
  <frontend_type>text</frontend_type>
374
  <validate>validate-number validate-zero-or-greater</validate>
375
  <sort_order>40</sort_order>
377
  <show_in_website>1</show_in_website>
378
  <show_in_store>1</show_in_store>
379
  </insured_50>
380
+ <insured_250 translate="label">
381
  <label><![CDATA[Insured up to &euro; 250]]></label>
382
  <comment><![CDATA[For NL shipping only, shipments outside the EU insured default is &euro; 200]]></comment>
383
  <frontend_type>text</frontend_type>
app/code/community/TIG/MyParcel2014/sql/tig_myparcel_setup/upgrade-1.1.4-1.2.0.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2013 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+
40
+ /* @var $installer TIG_MyParcel2014_Model_Resource_Setup */
41
+ $installer = $this;
42
+
43
+ $installer->startSetup();
44
+
45
+ $tableName = $installer->getTable('tig_myparcel/shipment');
46
+
47
+ if (!$conn->tableColumnExists($tableName, 'shipment_type')) {
48
+ $conn->addColumn(
49
+ $tableName,
50
+ 'shipment_type',
51
+ array(
52
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
53
+ 'length' => '16',
54
+ 'nullable' => false,
55
+ 'default' => TIG_MyParcel2014_Model_Shipment::TYPE_NORMAL,
56
+ 'comment' => 'Shipment Type',
57
+ 'after' => 'updated_at',
58
+ )
59
+ );
60
+ }
61
+
62
+ $settingsToMove = array(
63
+ 'carriers/tig_myparcel/active' => 'carriers/myparcel/active',
64
+ 'carriers/tig_myparcel/title' => 'carriers/myparcel/title',
65
+ 'carriers/tig_myparcel/name' => 'carriers/myparcel/name',
66
+ 'carriers/tig_myparcel/rate_type' => 'carriers/myparcel/rate_type',
67
+ 'carriers/tig_myparcel/type' => 'carriers/myparcel/type',
68
+ 'carriers/tig_myparcel/price' => 'carriers/myparcel/price',
69
+ 'carriers/tig_myparcel/condition_name' => 'carriers/myparcel/condition_name',
70
+ 'carriers/tig_myparcel/handling_type' => 'carriers/myparcel/handling_type',
71
+ 'carriers/tig_myparcel/handling_fee' => 'carriers/myparcel/handling_fee',
72
+ 'carriers/tig_myparcel/pakjegemak_active' => 'carriers/myparcel/pakjegemak_active',
73
+ 'carriers/tig_myparcel/pakjegemak_fee' => 'carriers/myparcel/pakjegemak_fee',
74
+ 'carriers/tig_myparcel/sallowspecific' => 'carriers/myparcel/sallowspecific',
75
+ 'carriers/tig_myparcel/specificcountry' => 'carriers/myparcel/specificcountry',
76
+ 'carriers/tig_myparcel/sort_order' => 'carriers/myparcel/sort_order',
77
+ );
78
+
79
+ foreach ($settingsToMove as $from => $to) {
80
+ $installer->moveConfigSettingInDb($from, $to);
81
+ }
82
+
83
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/TIG/tig_myparcel.xml CHANGED
@@ -63,7 +63,7 @@
63
  <name>prototype/windows/themes/default.css</name>
64
  </action>
65
  <action method="addCss">
66
- <name>lib/prototype/windows/themes/magento.css</name>
67
  </action>
68
  </reference>
69
  <reference name="before_body_end">
@@ -81,7 +81,29 @@
81
  </reference>
82
  </adminhtml_sales_order_view>
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  <adminhtml_sales_order_shipment_new>
 
 
 
 
 
85
  <reference name="before_body_end">
86
  <block type="tig_myparcel/adminhtml_sales_order_shipment_create_consignmentOptions"
87
  name="tig_myparcel_shipment_create_consignment_options"
@@ -90,6 +112,15 @@
90
  </adminhtml_sales_order_shipment_new>
91
 
92
  <adminhtml_sales_order_shipment_view>
 
 
 
 
 
 
 
 
 
93
  <reference name="before_body_end">
94
  <block type="tig_myparcel/adminhtml_sales_order_shipment_shippingInfo"
95
  name="tig_myparcel_order_shipment_shipping_info"
63
  <name>prototype/windows/themes/default.css</name>
64
  </action>
65
  <action method="addCss">
66
+ <name>css/TIG/MyParcel2014/prototype_windows_themes_magento.css</name>
67
  </action>
68
  </reference>
69
  <reference name="before_body_end">
81
  </reference>
82
  </adminhtml_sales_order_view>
83
 
84
+ <adminhtml_sales_shipment_index>
85
+ <reference name="head">
86
+ <action method="addItem">
87
+ <type>js_css</type>
88
+ <name>prototype/windows/themes/default.css</name>
89
+ </action>
90
+ <action method="addCss">
91
+ <name>css/TIG/MyParcel2014/prototype_windows_themes_magento.css</name>
92
+ </action>
93
+ </reference>
94
+ <reference name="before_body_end">
95
+ <block type="core/template"
96
+ name="tig_myparcel_order_index"
97
+ template="TIG/MyParcel2014/sales/order/shipment/mass_actions.phtml"/>
98
+ </reference>
99
+ </adminhtml_sales_shipment_index>
100
+
101
  <adminhtml_sales_order_shipment_new>
102
+ <reference name="head">
103
+ <action method="addCss">
104
+ <name>css/TIG/MyParcel2014/styles.css</name>
105
+ </action>
106
+ </reference>
107
  <reference name="before_body_end">
108
  <block type="tig_myparcel/adminhtml_sales_order_shipment_create_consignmentOptions"
109
  name="tig_myparcel_shipment_create_consignment_options"
112
  </adminhtml_sales_order_shipment_new>
113
 
114
  <adminhtml_sales_order_shipment_view>
115
+ <reference name="head">
116
+ <action method="addItem">
117
+ <type>js_css</type>
118
+ <name>prototype/windows/themes/default.css</name>
119
+ </action>
120
+ <action method="addCss">
121
+ <name>css/TIG/MyParcel2014/prototype_windows_themes_magento.css</name>
122
+ </action>
123
+ </reference>
124
  <reference name="before_body_end">
125
  <block type="tig_myparcel/adminhtml_sales_order_shipment_shippingInfo"
126
  name="tig_myparcel_order_shipment_shipping_info"
app/design/adminhtml/default/default/template/TIG/MyParcel2014/sales/order/mass_actions.phtml CHANGED
@@ -53,7 +53,7 @@
53
  #myparcel_popup_window .magento_e { width:0; }
54
  #myparcel_popup_window .magento_content { background-image:none; }
55
  #print_pages { width:200px; height:280px; float:left; }
56
- #print_pages .print_page { width:90px; height:130px; background:#dfdfdf; margin:10px 0 0 10px; float:left; cursor:pointer; text-indent:-1337px; overflow:hidden; }
57
  #print_pages .print_page:hover { background:#eb5e00; }
58
  </style>
59
  <script type="text/javascript">
@@ -65,60 +65,114 @@
65
  inputstart.type = 'hidden';
66
  inputstart.name = 'myparcel_print_labels_start';
67
  inputstart.value = 1;
68
- document.getElementById('sales_order_grid_massaction-form').appendChild(inputstart);
69
 
70
- // monitor the print option and show A4 positions
71
- $('sales_order_grid_massaction-select').observe('change', function(e, el){
72
- if($(this).value == 'myparcel_print_labels')
73
- {
74
- Dialog.info(null, {
75
- closable:true,
76
- resizable:false,
77
- draggable:true,
78
- className:'magento',
79
- windowClassName:'myparcel-popup-window',
80
- title:'<?php echo $this->__('Select A4 print start position'); ?>',
81
- top:100,
82
- width:200,
83
- height:290,
84
- zIndex:1337,
85
- recenterAuto:true,
86
- hideEffect:Element.hide,
87
- showEffect:Element.show,
88
- id:'myparcel_popup_window'
89
- });
90
- Dialog.setInfoMessage($('print_container').innerHTML);
91
 
92
- $('print_pages').show();
 
 
 
93
 
94
- var printChildren = $('print_pages').childElements();
95
- for(var i = 0, j = printChildren.length; i < j; i++)
96
- {
97
- printChildren[i].observe('mouseover', function(){
98
- $(this).toggleClassName('hover');
99
- });
100
- printChildren[i].observe('mouseout', function(){
101
- $(this).toggleClassName('hover');
102
- });
103
- printChildren[i].observe('click', function(){
104
- $('myparcel_print_labels_start').value = $(this).innerHTML;
105
- Windows.close('myparcel_popup_window');
106
- $$('#sales_order_grid_massaction-form button')[0].click();
107
- $('sales_order_grid_massaction-select').value = '';
108
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  }
110
 
111
- $('myparcel_popup_window_close').observe('click', function(){
112
- $('sales_order_grid_massaction-select')[0].selected = true;
113
- });
 
 
 
 
 
 
 
 
 
 
114
 
115
- // close popup when clicked outside
116
- setTimeout(function(){
117
- $('overlay_modal').observe('click', function(){
118
- $('myparcel_popup_window_close').click();
119
- $('sales_order_grid_massaction-select')[0].selected = true;
120
  });
121
- }, 337);
 
 
 
122
  }
123
  });
124
  })();
53
  #myparcel_popup_window .magento_e { width:0; }
54
  #myparcel_popup_window .magento_content { background-image:none; }
55
  #print_pages { width:200px; height:280px; float:left; }
56
+ #print_pages .print_page { width:90px; height:130px; background:#dfdfdf; margin:10px 0 0 10px; float:left; cursor:pointer; text-indent:-5000px; overflow:hidden; }
57
  #print_pages .print_page:hover { background:#eb5e00; }
58
  </style>
59
  <script type="text/javascript">
65
  inputstart.type = 'hidden';
66
  inputstart.name = 'myparcel_print_labels_start';
67
  inputstart.value = 1;
68
+ $('sales_order_grid_massaction-form').appendChild(inputstart);
69
 
70
+ Object.extend(sales_order_grid_massactionJsObject, {
71
+ apply : function (skipMyParcelCheck) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
 
73
+ if (varienStringArray.count(this.checkedString) == 0) {
74
+ alert(this.errorText);
75
+ return;
76
+ }
77
 
78
+ /**
79
+ * Additional MyParcel functionality
80
+ */
81
+ if (!skipMyParcelCheck) {
82
+ massActionSelect = $('sales_order_grid_massaction-select');
83
+ selectedMassAction = massActionSelect[massActionSelect.selectedIndex];
84
+ if (selectedMassAction.value == 'myparcel_print_labels') {
85
+ Dialog.info(null, {
86
+ closable:true,
87
+ resizable:false,
88
+ draggable:true,
89
+ className:'magento',
90
+ windowClassName:'myparcel-popup-window',
91
+ title:'<?php echo $this->__('Select A4 print start position'); ?>',
92
+ top:100,
93
+ width:200,
94
+ height:290,
95
+ zIndex:5000,
96
+ recenterAuto:true,
97
+ hideEffect:Element.hide,
98
+ showEffect:Element.show,
99
+ id:'myparcel_popup_window'
100
+ });
101
+ Dialog.setInfoMessage($('print_container').innerHTML);
102
+
103
+ var printPages = $('print_pages');
104
+ printPages.show();
105
+
106
+ var printChildren = printPages.childElements();
107
+ for(var i = 0, j = printChildren.length; i < j; i++)
108
+ {
109
+ printChildren[i].observe('mouseover', function(){
110
+ $(this).toggleClassName('hover');
111
+ });
112
+ printChildren[i].observe('mouseout', function(){
113
+ $(this).toggleClassName('hover');
114
+ });
115
+ printChildren[i].observe('click', function(event){
116
+ $('myparcel_print_labels_start').value = Event.element(event).innerHTML;
117
+ Windows.close('myparcel_popup_window');
118
+ this.apply(true);
119
+ }.bindAsEventListener(this));
120
+ }
121
+
122
+ $('myparcel_popup_window_close').observe('click', function(){
123
+ Windows.close('myparcel_popup_window');
124
+ });
125
+
126
+ // close popup when clicked outside
127
+ setTimeout(function(){
128
+ $('overlay_modal').observe('click', function(){
129
+ $('myparcel_popup_window_close').click();
130
+ });
131
+ }, 300);
132
+
133
+ return;
134
+ }
135
+ }
136
+
137
+ /**
138
+ * original apply method
139
+ */
140
+ var item = this.getSelectedItem();
141
+ if (!item) {
142
+ this.validator.validate();
143
+ return;
144
+ }
145
+ this.currentItem = item;
146
+ var fieldName = (item.field ? item.field : this.formFieldName);
147
+
148
+ if (this.currentItem.confirm && !window.confirm(this.currentItem.confirm)) {
149
+ return;
150
  }
151
 
152
+ this.formHiddens.update('');
153
+ new Insertion.Bottom(this.formHiddens, this.fieldTemplate.evaluate({
154
+ name : fieldName,
155
+ value : this.checkedString
156
+ }));
157
+ new Insertion.Bottom(this.formHiddens, this.fieldTemplate.evaluate({
158
+ name : 'massaction_prepare_key',
159
+ value : fieldName
160
+ }));
161
+
162
+ if (!this.validator.validate()) {
163
+ return;
164
+ }
165
 
166
+ if (this.useAjax && item.url) {
167
+ new Ajax.Request(item.url, {
168
+ 'method' : 'post',
169
+ 'parameters' : this.form.serialize(true),
170
+ 'onComplete' : this.onMassactionComplete.bind(this)
171
  });
172
+ } else if (item.url) {
173
+ this.form.action = item.url;
174
+ this.form.submit();
175
+ }
176
  }
177
  });
178
  })();
app/design/adminhtml/default/default/template/TIG/MyParcel2014/sales/order/shipment/create/consignment_options.phtml CHANGED
@@ -49,61 +49,82 @@ $_homeSelected = $this->getIsHomeSelected();
49
  $_signatureSelected = $this->getIsSignatureOnReceipt();
50
  $_returnNoAnswerSelected = $this->getIsReturnOnNoAnswer();
51
  $_insured = $this->getIsInsured();
 
52
  $_insuredSelected = '';
 
53
  $_insuredAmount = 0;
54
  if(is_array($_insured)){
55
- $_insuredAmount = $_insured['insuredAmount'];
56
  $_insuredSelected = $_insured['selected'];
 
 
 
 
 
 
57
  }
58
 
59
  ?>
60
  <div id="tig_myparcel_consignment_options">
61
- <p class="normal"><strong><?php echo $this->__('Myparcel Consignment Options');?></strong></p>
 
 
 
62
  <div id="tig_myparcel_form_container">
63
- <?php if(!$_countryNeedsCustoms):?>
64
- <p>
65
- <label for="tig_myparcel_home_address_only" class="normal"><?php echo $this->__('Home address only');?></label>
66
- <input id="tig_myparcel_home_address_only" type="checkbox" value="1" name="tig_myparcel[home_address_only]" <?php echo $_homeSelected;?> />
67
- </p>
68
- <p>
69
- <label for="tig_myparcel_signature_on_receipt" class="normal"><?php echo $this->__('Signature on receipt');?></label>
70
- <input id="tig_myparcel_signature_on_receipt" type="checkbox" value="1" name="tig_myparcel[signature_on_receipt]" <?php echo $_signatureSelected;?> />
71
- </p>
72
- <p>
73
- <label for="tig_myparcel_return_if_no_answer" class="normal"><?php echo $this->__('Return if no answer');?></label>
74
- <input id="tig_myparcel_return_if_no_answer" type="checkbox" value="1" name="tig_myparcel[return_if_no_answer]" <?php echo $_returnNoAnswerSelected;?> />
75
- </p>
76
- <p>
77
- <label for="tig_myparcel_insured" class="normal"><?php echo $this->__('Insured');?></label>
78
- <input id="tig_myparcel_insured" type="checkbox" value="1" name="tig_myparcel[insured]" <?php echo $_insuredSelected;?> />
79
- </p>
80
- <p style="display:none;">
81
- <label for="tig_myparcel_insured_amount" class="normal"><?php echo $this->__('Insured amount');?></label>
82
- <input id="tig_myparcel_insured_amount" class="validate-digits validate-digits-range digits-range-0-5000" type="text" value="<?php echo $_insuredAmount;?>" name="tig_myparcel[insured_amount]" />
83
- </p>
84
- <?php endif;?>
85
- <?php if($_countryNeedsCustoms):?>
86
- <p>
87
- <label for="tig_myparcel_customs_type" class="normal"><?php echo $this->__('Customs Shipment Type');?></label>
88
- <select id="tig_myparcel_customs_type" class="select required-entry" name="tig_myparcel[customs_type]">
89
- <?php foreach($_customsTypeOptions as $_option):?>
90
- <?php $_selected = ''; ?>
91
- <?php if ($_option['value'] == $_defaultCustomsCode): ?>
92
- <?php $_selected = 'selected="selected"'; ?>
93
- <?php endif; ?>
 
 
 
 
 
 
 
94
 
95
- <option value="<?php echo $_option['value']; ?>" <?php echo $_selected ?>>
96
- <?php echo $this->__($_option['label']); ?>
97
- </option>
98
- <?php endforeach;?>
99
- </select>
100
- </p>
101
- <p>
102
- <label for="tig_myparcel_customs_content_code" class="normal"><?php echo $this->__('Customs Content HS Code');?></label>
103
- <input id="tig_myparcel_customs_content_code" type="text" value="<?php echo $_defaultCustomsContentCode;?>" name="tig_myparcel[customs_content_type]" />
104
- </p>
105
- <p><small><?php echo $this->__('Select content type for Cross Domestic products, see <a href="http://gebruikstarief.douane.nl" target="_blank">http://gebruikstarief.douane.nl</a>');?></small></p>
106
- <?php endif;?>
 
 
 
107
  </div>
108
  </div>
109
  <script type ="text/javascript">
@@ -113,19 +134,33 @@ if(is_array($_insured)){
113
  before: $('tig_myparcel_consignment_options')
114
  });
115
 
116
- var insuredCheckbox = $('tig_myparcel_insured');
117
- var insuredAmountField = $('tig_myparcel_insured_amount').up();
118
- if (insuredCheckbox.checked) {
119
- insuredAmountField.show();
 
120
  }
121
 
122
- insuredCheckbox.observe('click', function() {
123
- if (insuredCheckbox.checked) {
124
- insuredAmountField.show();
125
  } else {
126
- insuredAmountField.hide();
127
  }
128
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  });
130
  //]]>
131
  </script>
49
  $_signatureSelected = $this->getIsSignatureOnReceipt();
50
  $_returnNoAnswerSelected = $this->getIsReturnOnNoAnswer();
51
  $_insured = $this->getIsInsured();
52
+ $_isPakjegemak = $this->getIsPakjeGemak();
53
  $_insuredSelected = '';
54
+ $_insuredUpTo = '';
55
  $_insuredAmount = 0;
56
  if(is_array($_insured)){
57
+ $_insuredAmount = $_insured['insuredAmount'];
58
  $_insuredSelected = $_insured['selected'];
59
+ $_insuredUpTo = $_insured['insuredUpTo'];
60
+ }
61
+
62
+ $_disabled = '';
63
+ if(true == $_isPakjegemak){
64
+ $_disabled= 'disabled';
65
  }
66
 
67
  ?>
68
  <div id="tig_myparcel_consignment_options">
69
+ <p>
70
+ <label for="tig_myparcel_create_consignment" class="normal"><strong>Maak MyParcel zending aan</strong></label>
71
+ <input id="tig_myparcel_create_consignment" type="checkbox" value="1" name="tig_myparcel[create_consignment]" checked="true" />
72
+ </p>
73
  <div id="tig_myparcel_form_container">
74
+ <?php if ($this->getDestinationCountry() == 'NL'): ?>
75
+ <p>
76
+ <label for="tig_myparcel_shipment_type" class="normal"><?php echo $this->__('Shipment type');?></label>
77
+ <select id="tig_myparcel_shipment_type" name="tig_myparcel[shipment_type]">
78
+ <option value="normal" selected="selected"><?php echo $this->__('Normal'); ?></option>
79
+ <option value="letter_box" <?php echo $_disabled;?> ><?php echo $this->__('Letter box'); ?></option>
80
+ <option value="unstamped" <?php echo $_disabled;?> ><?php echo $this->__('Unpaid'); ?></option>
81
+ </select>
82
+ </p>
83
+ <?php endif; ?>
84
+ <div id="myparcel_consignment_options">
85
+ <?php if(!$_countryNeedsCustoms):?>
86
+ <p>
87
+ <label for="tig_myparcel_home_address_only" class="normal"><?php echo $this->__('Home address only');?></label>
88
+ <input id="tig_myparcel_home_address_only" type="checkbox" value="1" name="tig_myparcel[home_address_only]" <?php echo $_homeSelected;?> />
89
+ </p>
90
+ <p>
91
+ <label for="tig_myparcel_signature_on_receipt" class="normal"><?php echo $this->__('Signature on receipt');?></label>
92
+ <input id="tig_myparcel_signature_on_receipt" type="checkbox" value="1" name="tig_myparcel[signature_on_receipt]" <?php echo $_signatureSelected;?> />
93
+ </p>
94
+ <p>
95
+ <label for="tig_myparcel_return_if_no_answer" class="normal"><?php echo $this->__('Return if no answer');?></label>
96
+ <input id="tig_myparcel_return_if_no_answer" type="checkbox" value="1" name="tig_myparcel[return_if_no_answer]" <?php echo $_returnNoAnswerSelected;?> />
97
+ </p>
98
+ <p>
99
+ <label for="tig_myparcel_insured" class="normal"><?php echo $this->__('Insured up to: &euro; %s',$_insured['insuredUpTo']);?></label>
100
+ <input id="tig_myparcel_insured" type="checkbox" value="1" name="tig_myparcel[insured]" <?php echo $_insuredSelected;?> />
101
+ <input id="tig_myparcel_insured_amount" type="hidden" value="<?php echo $_insuredAmount;?>" name="tig_myparcel[insured_amount]" class="validate-digits validate-digits-range digits-range-0-5000" />
102
+ </p>
103
+ <?php else: ?>
104
+ <p>
105
+ <label for="tig_myparcel_customs_type" class="normal"><?php echo $this->__('Customs Shipment Type');?></label>
106
+ <select id="tig_myparcel_customs_type" class="select required-entry" name="tig_myparcel[customs_type]">
107
+ <?php foreach($_customsTypeOptions as $_option):?>
108
+ <?php $_selected = ''; ?>
109
+ <?php if ($_option['value'] == $_defaultCustomsCode): ?>
110
+ <?php $_selected = 'selected="selected"'; ?>
111
+ <?php endif; ?>
112
 
113
+ <option value="<?php echo $_option['value']; ?>" <?php echo $_selected ?>>
114
+ <?php echo $this->__($_option['label']); ?>
115
+ </option>
116
+ <?php endforeach;?>
117
+ </select>
118
+ </p>
119
+ <p>
120
+ <label for="tig_myparcel_customs_content_code" class="normal"><?php echo $this->__('Customs Content HS Code');?></label>
121
+ <input id="tig_myparcel_customs_content_code" type="text" value="<?php echo $_defaultCustomsContentCode;?>" name="tig_myparcel[customs_content_type]" />
122
+ </p>
123
+ <p>
124
+ <small><?php echo $this->__('Select content type for Cross Domestic products, see <a href="http://gebruikstarief.douane.nl" target="_blank">http://gebruikstarief.douane.nl</a>');?></small>
125
+ </p>
126
+ <?php endif;?>
127
+ </div>
128
  </div>
129
  </div>
130
  <script type ="text/javascript">
134
  before: $('tig_myparcel_consignment_options')
135
  });
136
 
137
+ var createConsignmentCheckbox = $('tig_myparcel_create_consignment');
138
+ var consignmentOptionsForm = $('tig_myparcel_form_container');
139
+
140
+ if(createConsignmentCheckbox.checked){
141
+ consignmentOptionsForm.show();
142
  }
143
 
144
+ createConsignmentCheckbox.observe('click', function() {
145
+ if (createConsignmentCheckbox.checked) {
146
+ consignmentOptionsForm.show();
147
  } else {
148
+ consignmentOptionsForm.hide();
149
  }
150
  });
151
+
152
+ var shipmentTypeSelect = $('tig_myparcel_shipment_type');
153
+ if (shipmentTypeSelect) {
154
+ shipmentTypeSelect.observe('change', function() {
155
+ var value = this.getValue();
156
+ var consignmentOptionFields = $('myparcel_consignment_options');
157
+ if (value == 'normal') {
158
+ consignmentOptionFields.show();
159
+ } else {
160
+ consignmentOptionFields.hide();
161
+ }
162
+ })
163
+ }
164
  });
165
  //]]>
166
  </script>
app/design/adminhtml/default/default/template/TIG/MyParcel2014/sales/order/shipment/mass_actions.phtml ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ *
39
+ * @var TIG_MyParcel2014_Block_Adminhtml_Sales_Order_Shipment_ShippingInfo $this
40
+ */
41
+ ?>
42
+ <?php if(Mage::helper('tig_myparcel')->getConfig('print_orientation') == 'A4'): ?>
43
+ <div id="print_container" style="display:none;">
44
+ <div id="print_pages">
45
+ <div class="print_page">1</div>
46
+ <div class="print_page">2</div>
47
+ <div class="print_page">3</div>
48
+ <div class="print_page">4</div>
49
+ </div>
50
+ </div>
51
+ <style type="text/css">
52
+ #myparcel_popup_window .magento_w,
53
+ #myparcel_popup_window .magento_e { width:0; }
54
+ #myparcel_popup_window .magento_content { background-image:none; }
55
+ #print_pages { width:200px; height:280px; float:left; }
56
+ #print_pages .print_page { width:90px; height:130px; background:#dfdfdf; margin:10px 0 0 10px; float:left; cursor:pointer; text-indent:-5000px; overflow:hidden; }
57
+ #print_pages .print_page:hover { background:#eb5e00; }
58
+ </style>
59
+ <script type="text/javascript">
60
+ //<![CDATA[
61
+ (function(){
62
+ // create hidden input to store the chosen option
63
+ var inputstart = document.createElement('input');
64
+ inputstart.id = 'myparcel_print_labels_start';
65
+ inputstart.type = 'hidden';
66
+ inputstart.name = 'myparcel_print_labels_start';
67
+ inputstart.value = 1;
68
+ $('sales_shipment_grid_massaction-form').appendChild(inputstart);
69
+
70
+ Object.extend(sales_shipment_grid_massactionJsObject, {
71
+ apply : function (skipMyParcelCheck) {
72
+
73
+ if (varienStringArray.count(this.checkedString) == 0) {
74
+ alert(this.errorText);
75
+ return;
76
+ }
77
+
78
+ /**
79
+ * Additional MyParcel functionality
80
+ */
81
+ if (!skipMyParcelCheck) {
82
+ massActionSelect = $('sales_shipment_grid_massaction-select');
83
+ selectedMassAction = massActionSelect[massActionSelect.selectedIndex];
84
+ console.log(selectedMassAction);
85
+ if (selectedMassAction.value == 'myparcel_print_labels') {
86
+ Dialog.info(null, {
87
+ closable:true,
88
+ resizable:false,
89
+ draggable:true,
90
+ className:'magento',
91
+ windowClassName:'myparcel-popup-window',
92
+ title:'<?php echo $this->__('Select A4 print start position'); ?>',
93
+ top:100,
94
+ width:200,
95
+ height:290,
96
+ zIndex:5000,
97
+ recenterAuto:true,
98
+ hideEffect:Element.hide,
99
+ showEffect:Element.show,
100
+ id:'myparcel_popup_window'
101
+ });
102
+ Dialog.setInfoMessage($('print_container').innerHTML);
103
+
104
+ var printPages = $('print_pages');
105
+ printPages.show();
106
+
107
+ var printChildren = printPages.childElements();
108
+ for(var i = 0, j = printChildren.length; i < j; i++)
109
+ {
110
+ printChildren[i].observe('mouseover', function(){
111
+ $(this).toggleClassName('hover');
112
+ });
113
+ printChildren[i].observe('mouseout', function(){
114
+ $(this).toggleClassName('hover');
115
+ });
116
+ printChildren[i].observe('click', function(event){
117
+ $('myparcel_print_labels_start').value = Event.element(event).innerHTML;
118
+ Windows.close('myparcel_popup_window');
119
+ this.apply(true);
120
+ }.bindAsEventListener(this));
121
+ }
122
+
123
+ $('myparcel_popup_window_close').observe('click', function(){
124
+ Windows.close('myparcel_popup_window');
125
+ });
126
+
127
+ // close popup when clicked outside
128
+ setTimeout(function(){
129
+ $('overlay_modal').observe('click', function(){
130
+ $('myparcel_popup_window_close').click();
131
+ });
132
+ }, 300);
133
+
134
+ return;
135
+ }
136
+ }
137
+
138
+ /**
139
+ * original apply method
140
+ */
141
+ var item = this.getSelectedItem();
142
+ if (!item) {
143
+ this.validator.validate();
144
+ return;
145
+ }
146
+ this.currentItem = item;
147
+ var fieldName = (item.field ? item.field : this.formFieldName);
148
+
149
+ if (this.currentItem.confirm && !window.confirm(this.currentItem.confirm)) {
150
+ return;
151
+ }
152
+
153
+ this.formHiddens.update('');
154
+ new Insertion.Bottom(this.formHiddens, this.fieldTemplate.evaluate({
155
+ name : fieldName,
156
+ value : this.checkedString
157
+ }));
158
+ new Insertion.Bottom(this.formHiddens, this.fieldTemplate.evaluate({
159
+ name : 'massaction_prepare_key',
160
+ value : fieldName
161
+ }));
162
+
163
+ if (!this.validator.validate()) {
164
+ return;
165
+ }
166
+
167
+ if (this.useAjax && item.url) {
168
+ new Ajax.Request(item.url, {
169
+ 'method' : 'post',
170
+ 'parameters' : this.form.serialize(true),
171
+ 'onComplete' : this.onMassactionComplete.bind(this)
172
+ });
173
+ } else if (item.url) {
174
+ this.form.action = item.url;
175
+ this.form.submit();
176
+ }
177
+ }
178
+ });
179
+ })();
180
+ //]]>
181
+ </script>
182
+ <?php endif; ?>
app/design/adminhtml/default/default/template/TIG/MyParcel2014/sales/order/shipment/shipping_info.phtml CHANGED
@@ -38,7 +38,117 @@
38
  *
39
  * @var TIG_MyParcel2014_Block_Adminhtml_Sales_Order_Shipment_ShippingInfo $this
40
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  <script type ="text/javascript">
43
  //<![CDATA[
44
  document.observe('dom:loaded', function(){
@@ -48,39 +158,55 @@
48
  var target = document.getElementById('shipment_tracking_info').parentNode;
49
  target.parentNode.insertBefore(pgaddress, target);
50
 
51
- //retourlink button
52
- var retourText = '<?php echo $this->getRetourlinkText();?>';
53
- var retourUrl = '<?php echo $this->getRetourlinkUrl();?>';
54
- retourUrl = 'setLocation(\''+retourUrl+'\')';
55
-
56
- var retourlinkButton = document.createElement('button');
57
- retourlinkButton.setAttribute('onclick',retourUrl);
58
- retourlinkButton.setAttribute('class','scalable save');
59
- retourlinkButton.setAttribute('type','button');
60
- retourlinkButton.setAttribute('title',retourText);
61
- retourlinkButton.setAttribute('id','');
62
- retourlinkButton.innerHTML = '<span><span><span>'+retourText+'</span></span></span>';
63
 
 
 
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
- //credit button
67
- var creditText = '<?php echo $this->getCreditText();?>';
68
- var creditUrl = '<?php echo $this->getCreditUrl();?>';
69
- creditUrl = 'setLocation(\''+creditUrl+'\')';
70
 
71
- var creditButton = document.createElement('button');
72
- creditButton.setAttribute('onclick',creditUrl);
73
- creditButton.setAttribute('class','scalable save');
74
- creditButton.setAttribute('type','button');
75
- creditButton.setAttribute('title',creditText);
76
- creditButton.setAttribute('id','');
77
- creditButton.innerHTML = '<span><span><span>'+creditText+'</span></span></span>';
78
 
79
 
80
- var shippingButtons = $$('h3.head-sales-order-shipment')[0].next();
81
- shippingButtons.appendChild(retourlinkButton);
82
- shippingButtons.appendChild(creditButton);
 
 
 
 
 
 
 
 
 
83
 
 
 
 
84
  });
85
  //]]>
86
  </script>
38
  *
39
  * @var TIG_MyParcel2014_Block_Adminhtml_Sales_Order_Shipment_ShippingInfo $this
40
  */
41
+
42
+
43
+ $_countryNeedsCustoms = $this->countryNeedsCustoms();
44
+ $_storeId = $this->getOrderStoreId();
45
+ $_helper = Mage::helper('tig_myparcel');
46
+ $_shipment = $this->getShipment();
47
+ $_customsTypeOptions = $this->getCustomsTypeOptions();
48
+ $_defaultCustomsCode = $_helper->getConfig('customs_type', 'shipment', $_storeId);
49
+ $_defaultCustomsContentCode = $_helper->getConfig('customs_hstariffnr', 'shipment', $_storeId);
50
+ $_homeSelected = $this->getIsHomeSelected();
51
+ $_signatureSelected = $this->getIsSignatureOnReceipt();
52
+ $_returnNoAnswerSelected = $this->getIsReturnOnNoAnswer();
53
+ $_insured = $this->getIsInsured();
54
+ $_isPakjegemak = $this->getIsPakjeGemak();
55
+ $_insuredSelected = '';
56
+ $_insuredUpTo = '';
57
+ $_insuredAmount = 0;
58
+ if(is_array($_insured)){
59
+ $_insuredAmount = $_insured['insuredAmount'];
60
+ $_insuredSelected = $_insured['selected'];
61
+ $_insuredUpTo = $_insured['insuredUpTo'];
62
+ }
63
+
64
+ $_disabled = '';
65
+ if(true == $_isPakjegemak){
66
+ $_disabled= 'disabled';
67
+ }
68
+
69
  ?>
70
+
71
+ <div id="print_container" style="display:none;">
72
+ <div id="deliveryOptions">
73
+ <form id="myparcel_create_consignment_form" method="post" action="<?php echo $this->getUrl('myparcel_admin/adminhtml_shipment/createConsignment');?>">
74
+ <input type="hidden" name="shipment_id" value="<?php echo $_shipment->getId();?>" />
75
+ <input type="hidden" name="form_key" value="<?php echo $this->getFormKey(); ?>" />
76
+ <div id="tig_myparcel_consignment_options">
77
+ <div id="tig_myparcel_form_container">
78
+ <?php if(!$_countryNeedsCustoms):?>
79
+ <?php if ($this->getDestinationCountry() == 'NL'): ?>
80
+ <p>
81
+ <label for="tig_myparcel_shipment_type" class="normal"><?php echo $this->__('Shipment type');?></label>
82
+ <select id="tig_myparcel_shipment_type" name="tig_myparcel[shipment_type]">
83
+ <option value="normal" selected="selected"><?php echo $this->__('Normal'); ?></option>
84
+ <option value="letter_box" <?php echo $_disabled;?> ><?php echo $this->__('Letter box'); ?></option>
85
+ <option value="unstamped" <?php echo $_disabled;?> ><?php echo $this->__('Unpaid'); ?></option>
86
+ </select>
87
+ </p>
88
+ <?php endif; ?>
89
+ <div id="myparcel_consignment_options">
90
+ <p>
91
+ <label for="tig_myparcel_home_address_only" class="normal"><?php echo $this->__('Home address only');?></label>
92
+ <input id="tig_myparcel_home_address_only" type="checkbox" value="1" name="tig_myparcel[home_address_only]" <?php echo $_homeSelected;?> />
93
+ </p>
94
+ <p>
95
+ <label for="tig_myparcel_signature_on_receipt" class="normal"><?php echo $this->__('Signature on receipt');?></label>
96
+ <input id="tig_myparcel_signature_on_receipt" type="checkbox" value="1" name="tig_myparcel[signature_on_receipt]" <?php echo $_signatureSelected;?> />
97
+ </p>
98
+ <p>
99
+ <label for="tig_myparcel_return_if_no_answer" class="normal"><?php echo $this->__('Return if no answer');?></label>
100
+ <input id="tig_myparcel_return_if_no_answer" type="checkbox" value="1" name="tig_myparcel[return_if_no_answer]" <?php echo $_returnNoAnswerSelected;?> />
101
+ </p>
102
+ <p>
103
+ <label for="tig_myparcel_insured" class="normal"><?php echo $this->__('Insured up to: &euro; %s',$_insured['insuredUpTo']);?></label>
104
+ <input id="tig_myparcel_insured" type="checkbox" value="1" name="tig_myparcel[insured]" <?php echo $_insuredSelected;?> />
105
+ <input id="tig_myparcel_insured_amount" type="hidden" value="<?php echo $_insuredAmount;?>" name="tig_myparcel[insured_amount]" class="validate-digits validate-digits-range digits-range-0-5000" />
106
+ </p>
107
+ </div>
108
+ <?php endif;?>
109
+ <?php if($_countryNeedsCustoms):?>
110
+ <p>
111
+ <label for="tig_myparcel_customs_type" class="normal"><?php echo $this->__('Customs Shipment Type');?></label>
112
+ <select id="tig_myparcel_customs_type" class="select required-entry" name="tig_myparcel[customs_type]">
113
+ <?php foreach($_customsTypeOptions as $_option):?>
114
+ <?php $_selected = ''; ?>
115
+ <?php if ($_option['value'] == $_defaultCustomsCode): ?>
116
+ <?php $_selected = 'selected="selected"'; ?>
117
+ <?php endif; ?>
118
+
119
+ <option value="<?php echo $_option['value']; ?>" <?php echo $_selected ?>>
120
+ <?php echo $this->__($_option['label']); ?>
121
+ </option>
122
+ <?php endforeach;?>
123
+ </select>
124
+ </p>
125
+ <p>
126
+ <label for="tig_myparcel_customs_content_code" class="normal"><?php echo $this->__('Customs Content HS Code');?></label>
127
+ <input id="tig_myparcel_customs_content_code" type="text" value="<?php echo $_defaultCustomsContentCode;?>" name="tig_myparcel[customs_content_type]" />
128
+ </p>
129
+ <p><small><?php echo $this->__('Select content type for Cross Domestic products, see <a href="http://gebruikstarief.douane.nl" target="_blank">http://gebruikstarief.douane.nl</a>');?></small></p>
130
+ <?php endif;?>
131
+ </div>
132
+ </div>
133
+ <button class="scalable save" type="submit" title="Verwerken Opmerking" id="submit_comment_button">
134
+ <span><span><span>Create MyParcel Consignment</span></span></span>
135
+ </button>
136
+ </form>
137
+ </div>
138
+ </div>
139
+ <style type="text/css">
140
+ #myparcel_popup_window .magento_w,
141
+ #myparcel_popup_window .magento_e { width:0; }
142
+ #myparcel_popup_window .magento_content { background-image:none; }
143
+ #print_pages { width:200px; height:280px; float:left; }
144
+ #print_pages .print_page { width:90px; height:130px; background:#dfdfdf; margin:10px 0 0 10px; float:left; cursor:pointer; text-indent:-5000px; overflow:hidden; }
145
+ #print_pages .print_page:hover { background:#eb5e00; }
146
+
147
+ #deliveryOptions {margin: 15px;}
148
+ #deliveryOptions p {clear:both;}
149
+ #deliveryOptions p label.normal {display:block;width:170px;float:left;}
150
+ </style>
151
+
152
  <script type ="text/javascript">
153
  //<![CDATA[
154
  document.observe('dom:loaded', function(){
158
  var target = document.getElementById('shipment_tracking_info').parentNode;
159
  target.parentNode.insertBefore(pgaddress, target);
160
 
161
+ //create consignment button
162
+ var buttonId = 'createMyParcelConsignment';
 
 
 
 
 
 
 
 
 
 
163
 
164
+ if ($(buttonId) != undefined){
165
+ $(buttonId).observe('click', function(e, el){
166
 
167
+ Dialog.info(null, {
168
+ closable:true,
169
+ resizable:false,
170
+ draggable:true,
171
+ className:'magento',
172
+ windowClassName:'myparcel-popup-window',
173
+ title:'<?php echo $this->__('Select MyParcel shipping options'); ?>',
174
+ top:100,
175
+ width:400,
176
+ height:200,
177
+ zIndex:5000,
178
+ recenterAuto:true,
179
+ hideEffect:Element.hide,
180
+ showEffect:Element.show,
181
+ id:'myparcel_popup_window'
182
+ });
183
+ Dialog.setInfoMessage($('print_container').innerHTML);
184
 
185
+ $('deliveryOptions').show();
 
 
 
186
 
187
+ // when modal loaded, add event listeners
188
+ setTimeout(function(){
189
+ $('overlay_modal').observe('click', function(){
190
+ $('myparcel_popup_window_close').click();
191
+ });
 
 
192
 
193
 
194
+ var shipmentTypeSelect = $('tig_myparcel_shipment_type');
195
+ if (shipmentTypeSelect) {
196
+ shipmentTypeSelect.observe('change', function() {
197
+ var value = this.getValue();
198
+ var consignmentOptionFields = $('myparcel_consignment_options');
199
+ if (value == 'normal') {
200
+ consignmentOptionFields.show();
201
+ } else {
202
+ consignmentOptionFields.hide();
203
+ }
204
+ })
205
+ }
206
 
207
+ }, 300);
208
+ });
209
+ }
210
  });
211
  //]]>
212
  </script>
app/design/adminhtml/default/default/template/TIG/MyParcel2014/system/config/supportTab.phtml CHANGED
@@ -33,8 +33,8 @@
33
  * versions in the future. If you wish to customize this module for your
34
  * needs please contact servicedesk@tig.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
- * @lictig.nlivecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  ?>
40
  <?php $_helper = Mage::helper('tig_myparcel'); ?>
@@ -46,7 +46,7 @@
46
  <tr>
47
  <td colspan="3">
48
  <div class="text-box">
49
- <?php $url = 'http://kb.totalinternetgroup.nl/topic/99829566';?>
50
  <h4><?php echo $_helper->__('To download the instructions for the MyParcel Magento extension, click <a target="_blank" href="%s">here</a>.',$url); ?></h4>
51
  </div>
52
  </td>
@@ -86,13 +86,17 @@
86
  <h3><?php echo $_helper->__('Support');?></h3>
87
  <h4><?php echo $_helper->__('Questions and information about your MyParcel account');?></h4>
88
  <p><?php echo $_helper->__('For questions related to your MyParcel account,please contact MyParcel.');?></p>
89
- <p><a href="http://www.myparcel.nl" target="_blank"><img src="<?php echo $this->getSkinUrl('images/TIG/MyParcel2014/logo_myparcel.png'); ?>" alt="" /></a></p>
90
- <table class="contact">
91
  <tr>
92
  <td class="first"><?php echo $_helper->__('MyParcel');?>:</td>
93
  <td class="last">
94
  <a target="_blank" href="http://www.myparcel.nl">www.myparcel.nl</a>
95
  </td>
 
 
 
 
 
96
  </tr>
97
  <tr>
98
  <td class="first"><?php echo $_helper->__('Phone');?>:</td>
@@ -107,17 +111,16 @@
107
  </tr>
108
  </table>
109
  <h4><?php echo $_helper->__('Extension support and configuration questions');?></h4>
110
- <p><?php echo $_helper->__('For configuration problems, extension conflicts or bugs, please contact Total Internet Group.');?></p>
111
- <p>
112
- <a href="http://www.totalinternetgroup.nl" target="_blank">
113
- <img src="<?php echo $this->getSkinUrl('images/TIG/MyParcel2014/tig_logo_medium.gif'); ?>" alt="" />
114
- </a>
115
- </p>
116
- <table class="contact">
117
  <tr>
118
  <td class="first"><?php echo $_helper->__('Phone');?>:</td>
119
  <td class="last">020 - 2181 001</td>
120
-
 
 
 
 
121
  </tr>
122
  <tr>
123
  <td><?php echo $_helper->__('Email');?>:</td>
@@ -127,22 +130,22 @@
127
  <h3><?php echo $_helper->__('Documents');?></h3>
128
  <ul>
129
  <li>
130
- <a class="link" target="_blank" href="http://kb.totalinternetgroup.nl/topic/99829566" title="<?php echo $_helper->__('Installation and configuration instructions');?>">
131
  <?php echo $_helper->__('Installation and configuration instructions');?>
132
  </a>
133
  </li>
134
  <li>
135
- <a class="link" target="_blank" href="http://kb.totalinternetgroup.nl/topic/99831236" title="<?php echo $_helper->__('Full changelog');?>">
136
  <?php echo $_helper->__('Full changelog');?>
137
  </a>
138
  </li>
139
  <li>
140
- <a class="link" target="_blank" href="http://kb.totalinternetgroup.nl/forum/23053573" title="<?php echo $_helper->__('Overview articles in knowledge base');?>">
141
  <?php echo $_helper->__('Overview articles in knowledge base');?>
142
  </a>
143
  </li>
144
  </ul>
145
- <p><?php echo $_helper->__('This extension has been developed by Total Internet Group.');?></p>
146
  </div>
147
  </td>
148
  </tr>
33
  * versions in the future. If you wish to customize this module for your
34
  * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2015 TIG (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  ?>
40
  <?php $_helper = Mage::helper('tig_myparcel'); ?>
46
  <tr>
47
  <td colspan="3">
48
  <div class="text-box">
49
+ <?php $url = 'http://kb.tig.nl/topic/99829566';?>
50
  <h4><?php echo $_helper->__('To download the instructions for the MyParcel Magento extension, click <a target="_blank" href="%s">here</a>.',$url); ?></h4>
51
  </div>
52
  </td>
86
  <h3><?php echo $_helper->__('Support');?></h3>
87
  <h4><?php echo $_helper->__('Questions and information about your MyParcel account');?></h4>
88
  <p><?php echo $_helper->__('For questions related to your MyParcel account,please contact MyParcel.');?></p>
89
+ <table class="contact tig">
 
90
  <tr>
91
  <td class="first"><?php echo $_helper->__('MyParcel');?>:</td>
92
  <td class="last">
93
  <a target="_blank" href="http://www.myparcel.nl">www.myparcel.nl</a>
94
  </td>
95
+ <td rowspan="3">
96
+ <a class="logo_image" href="http://www.myparcel.nl" target="_blank">
97
+ <img src="<?php echo $this->getSkinUrl('images/TIG/MyParcel2014/logo_myparcel.png'); ?>" alt="" />
98
+ </a>
99
+ </td>
100
  </tr>
101
  <tr>
102
  <td class="first"><?php echo $_helper->__('Phone');?>:</td>
111
  </tr>
112
  </table>
113
  <h4><?php echo $_helper->__('Extension support and configuration questions');?></h4>
114
+ <p><?php echo $_helper->__('For configuration problems, extension conflicts or bugs, please contact TIG.');?></p>
115
+ <table class="contact tig">
 
 
 
 
 
116
  <tr>
117
  <td class="first"><?php echo $_helper->__('Phone');?>:</td>
118
  <td class="last">020 - 2181 001</td>
119
+ <td rowspan="2">
120
+ <a class="logo_image" href="http://www.tig.nl" target="_blank">
121
+ <img src="<?php echo $this->getSkinUrl('images/TIG/MyParcel2014/tig_logo_medium.png'); ?>" alt="" />
122
+ </a>
123
+ </td>
124
  </tr>
125
  <tr>
126
  <td><?php echo $_helper->__('Email');?>:</td>
130
  <h3><?php echo $_helper->__('Documents');?></h3>
131
  <ul>
132
  <li>
133
+ <a class="link" target="_blank" href="http://kb.tig.nl/topic/99829566" title="<?php echo $_helper->__('Installation and configuration instructions');?>">
134
  <?php echo $_helper->__('Installation and configuration instructions');?>
135
  </a>
136
  </li>
137
  <li>
138
+ <a class="link" target="_blank" href="http://kb.tig.nl/topic/99831236" title="<?php echo $_helper->__('Full changelog');?>">
139
  <?php echo $_helper->__('Full changelog');?>
140
  </a>
141
  </li>
142
  <li>
143
+ <a class="link" target="_blank" href="http://kb.tig.nl/forum/23053573" title="<?php echo $_helper->__('Overview articles in knowledge base');?>">
144
  <?php echo $_helper->__('Overview articles in knowledge base');?>
145
  </a>
146
  </li>
147
  </ul>
148
+ <p><?php echo $_helper->__('This extension has been developed by TIG.');?></p>
149
  </div>
150
  </td>
151
  </tr>
app/design/frontend/base/default/layout/TIG/tig_myparcel.xml CHANGED
@@ -43,38 +43,55 @@
43
  <reference name="head">
44
  <action method="addItem">
45
  <type>skin_js</type>
46
- <file>js/TIG/MyParcel2014/pg_address.js</file>
 
 
 
 
 
 
 
 
47
  </action>
48
  </reference>
 
 
 
 
 
 
49
  </checkout_onepage_index>
50
 
51
- <checkout_onepage_shippingmethod>
52
  <reference name="root">
53
- <block type="tig_myparcel/checkout_pgAddress" name="myparcel.pg_address" template="TIG/MyParcel2014/checkout/pg_address.phtml" output="toHtml"/>
54
  </reference>
55
- </checkout_onepage_shippingmethod>
 
 
 
 
 
 
 
56
 
57
  <onestepcheckout_index_index>
58
  <reference name="head">
59
  <action method="addItem">
60
  <type>skin_js</type>
61
- <file>js/TIG/MyParcel2014/pg_address.js</file>
62
  </action>
63
- </reference>
64
- <reference name="choose-shipping-method">
65
- <action method="setTemplate">
66
- <template>TIG/MyParcel2014/onestepcheckout/shipping_method.phtml</template>
67
  </action>
68
- <block type="tig_myparcel/checkout_pgAddress" name="myparcel.pg_address" template="TIG/MyParcel2014/checkout/pg_address.phtml"/>
69
- </reference>
70
- </onestepcheckout_index_index>
71
-
72
- <onestepcheckout_ajax_save_billing>
73
- <reference name="choose-shipping-method">
74
- <action method="setTemplate">
75
- <template>TIG/MyParcel2014/onestepcheckout/shipping_method.phtml</template>
76
  </action>
77
- <block type="tig_myparcel/checkout_pgAddress" name="myparcel.pg_address" template="TIG/MyParcel2014/checkout/pg_address.phtml"/>
78
  </reference>
79
- </onestepcheckout_ajax_save_billing>
 
 
 
80
  </layout>
43
  <reference name="head">
44
  <action method="addItem">
45
  <type>skin_js</type>
46
+ <file>js/TIG/MyParcel2014/MutationObserver.js</file>
47
+ </action>
48
+ <action method="addItem">
49
+ <type>skin_js</type>
50
+ <file>js/TIG/MyParcel2014/checkout.js</file>
51
+ </action>
52
+ <action method="addItem">
53
+ <type>skin_css</type>
54
+ <file>css/TIG/MyParcel2014/checkout.css</file>
55
  </action>
56
  </reference>
57
+ <reference name="right">
58
+ <block type="checkout/onepage_progress" name="myparcel_checkout.progress" template="TIG/MyParcel2014/checkout/onepage/progress.phtml"/>
59
+ </reference>
60
+ <reference name="before_body_end">
61
+ <block type="tig_myparcel/checkout_js" name="myparcel_checkout_js" template="TIG/MyParcel2014/checkout/onepage/js.phtml"/>
62
+ </reference>
63
  </checkout_onepage_index>
64
 
65
+ <checkout_onepage_progress>
66
  <reference name="root">
67
+ <block type="checkout/onepage_progress" name="myparcel.progress" template="TIG/MyParcel2014/checkout/onepage/progress.phtml"/>
68
  </reference>
69
+ </checkout_onepage_progress>
70
+
71
+ <checkout_onepage_progress_myparcel_checkout>
72
+ <remove name="right"/>
73
+ <remove name="left"/>
74
+
75
+ <block type="tig_myparcel/checkout_progress" name="root" template="TIG/MyParcel2014/checkout/onepage/progress/pakje_gemak.phtml" output="toHtml"/>
76
+ </checkout_onepage_progress_myparcel_checkout>
77
 
78
  <onestepcheckout_index_index>
79
  <reference name="head">
80
  <action method="addItem">
81
  <type>skin_js</type>
82
+ <file>js/TIG/MyParcel2014/MutationObserver.js</file>
83
  </action>
84
+ <action method="addItem">
85
+ <type>skin_js</type>
86
+ <file>js/TIG/MyParcel2014/checkout.js</file>
 
87
  </action>
88
+ <action method="addItem">
89
+ <type>skin_css</type>
90
+ <file>css/TIG/MyParcel2014/checkout.css</file>
 
 
 
 
 
91
  </action>
 
92
  </reference>
93
+ <reference name="before_body_end">
94
+ <block type="tig_myparcel/checkout_js" name="myparcel_checkout_js" template="TIG/MyParcel2014/checkout/idev_onestepcheckout/js.phtml"/>
95
+ </reference>
96
+ </onestepcheckout_index_index>
97
  </layout>
app/design/frontend/base/default/template/TIG/MyParcel2014/checkout/idev_onestepcheckout/js.phtml ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2015 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ ?>
40
+ <?php $_helper = Mage::helper('tig_myparcel'); ?>
41
+ <div id="myparcel_checkout_overlay_container" style="display:none;"></div>
42
+ <div id="myparcel_checkout_container" style="display:none;">
43
+ <div id="#{overlay_id}" class="responsive-add-location">
44
+ <div class="overlay close"></div>
45
+ <div id="#{overlay_window_id}">
46
+ <div class="logo">
47
+ <img src="<?php echo $this->getSkinUrl('images/TIG/MyParcel/checkout/logo_postnl.png');?>" alt="" />
48
+ <p class="powered-by"><?php echo $_helper->__('Powered by MyParcel'); ?></p>
49
+ </div>
50
+ <span class="close"><?php echo $_helper->__('Close'); ?></span>
51
+ <h3><?php echo $_helper->__('Choose a PostNL pickup location'); ?></h3>
52
+ <div class="responsive-location-search">
53
+ <div class="search-form">
54
+ <label for="#{postcode_field_id}"><?php echo $_helper->__('Search by zipcode and housenumber'); ?>:</label>
55
+ <input type="text" class="myparcel-input" name="" id="#{postcode_field_id}" value="" placeholder="<?php echo $_helper->__('Zipcode'); ?>" />
56
+ <label for="#{housenr_field_id}"><?php echo $_helper->__('Housenumber'); ?>:</label>
57
+ <input type="text" class="myparcel-input" name="" id="#{housenr_field_id}" value="" placeholder="<?php echo $_helper->__('Housenumber'); ?>" />
58
+ </div>
59
+ <div class="actions">
60
+ <div id="#{location_loader_id}" class="myparcel-loader" style="display:none;"></div>
61
+ <button class="myparcel-button" id="#{search_button_id}"><?php echo $_helper->__('Search'); ?></button>
62
+ </div>
63
+ </div>
64
+
65
+ <div class="responsive-location-results">
66
+ <div class="heading">
67
+ <h3><?php echo $_helper->__('Nearest myparcel pickup points'); ?></h3>
68
+ </div>
69
+
70
+ <ul class="list" id="#{location_list_id}">
71
+ </ul>
72
+ </div>
73
+ </div>
74
+ </div>
75
+ </div>
76
+ <div id="myparcel_checkout_location_template" style="display:none;">
77
+ <li class="location-details #{location_class}" id="#{location_id}" data-location_code="#{location_code}">
78
+ <div class="content">
79
+ <div class="location-info">
80
+ <span class="radio selected"></span><span class="address"><strong>#{location}</strong><br>#{street} #{street_number}<br>#{postcode} #{city}</span><span class="distance"><strong>#{distance} m</strong></span>
81
+ </div>
82
+ <a style="display:none;" href="#" class="info-link">More info</a>
83
+ <button class="myparcel-button" onclick="#{select_location_onclick}"><?php echo $_helper->__('Select'); ?></button>
84
+ </div>
85
+ <div class="more-info" id="#{location_info_id}" style="display:none;">
86
+ <table class="business-hours">
87
+ <thead>
88
+ <tr>
89
+ <th colspan="2"><?php echo $this->__('Business hours') ?></th>
90
+ </tr>
91
+ </thead>
92
+ <tbody>
93
+ <tr>
94
+ <th><?php echo $this->__('Mo') ?></th>
95
+ <td>#{opening_hours_monday}</td>
96
+ </tr>
97
+ <tr>
98
+ <th><?php echo $this->__('Tu') ?></th>
99
+ <td>#{opening_hours_tuesday}</td>
100
+ </tr>
101
+ <tr>
102
+ <th><?php echo $this->__('We') ?></th>
103
+ <td>#{opening_hours_wednesday}</td>
104
+ </tr>
105
+ <tr>
106
+ <th><?php echo $this->__('Th') ?></th>
107
+ <td>#{opening_hours_thursday}</td>
108
+ </tr>
109
+ <tr>
110
+ <th><?php echo $this->__('Fr') ?></th>
111
+ <td>#{opening_hours_friday}</td>
112
+ </tr>
113
+ <tr>
114
+ <th><?php echo $this->__('Sa') ?></th>
115
+ <td>#{opening_hours_saturday}</td>
116
+ </tr>
117
+ <tr>
118
+ <th><?php echo $this->__('Su') ?></th>
119
+ <td>#{opening_hours_sunday}</td>
120
+ </tr>
121
+ </tbody>
122
+ </table>
123
+ </div>
124
+ </li>
125
+ </div>
126
+ <div id="myparcel_checkout_location_error_template" style="display:none;">
127
+ <li id="no_locations_error" class="location-error-msg">
128
+ <?php echo $_helper->__('Unfortunately no locations could be found. Please check your postcode and house number combination.'); ?>
129
+ </li>
130
+ </div>
131
+ <div id="myparcel_checkout_selected_location_template" style="display:none;">
132
+ <div id="#{selected_location_id}" class="complete">
133
+ <label><?php echo $this->__('Selected post office location:') ?></label>
134
+ <address>
135
+ #{location}<br />
136
+ #{street} #{street_number}<br />
137
+ #{city}, #{postcode}<br />
138
+ Nederland<br />
139
+ T: #{phone_number}
140
+ <a href="#" onclick="myParcelCheckout.openOverlay();return false;" class="myparcel_checkout_edit_link"><?php echo $this->__('Edit'); ?></a>
141
+ </address>
142
+ </div>
143
+ </div>
144
+ <script type="text/javascript">
145
+ //<![CDATA[
146
+ var myParcelCheckout;
147
+ document.observe('dom:loaded', function() {
148
+ var checkoutContainer = $('myparcel_checkout_container');
149
+ var locationContainer = $('myparcel_checkout_location_template');
150
+ var locationErrorContainer = $('myparcel_checkout_location_error_template');
151
+ var selectedLocationContainer = $('myparcel_checkout_selected_location_template');
152
+ var templates = {
153
+ overlay : new Template(checkoutContainer.innerHTML),
154
+ location : new Template(locationContainer.innerHTML),
155
+ location_error : new Template(locationErrorContainer.innerHTML),
156
+ selected_location : new Template(selectedLocationContainer.innerHTML)
157
+ };
158
+
159
+ checkoutContainer.remove();
160
+ locationContainer.remove();
161
+ locationErrorContainer.remove();
162
+ selectedLocationContainer.remove();
163
+
164
+ var config = {
165
+ get_locations_url : '<?php echo $this->getUrl('myparcel2014/checkout/getLocations', array('_secure' => true)); ?>',
166
+ save_location_url : '<?php echo $this->getUrl('myparcel2014/checkout/saveLocation', array('_secure' => true)); ?>',
167
+ use_shipping_or_billing_checkbox : true,
168
+ save_location_on_select : true
169
+ };
170
+
171
+ var selectors = {
172
+ shipping_methods_container : '.onestepcheckout-shipping-method-block',
173
+ shipping_method : '#s_method_myparcel_pakjegemak',
174
+ billing_or_shipping_field : '#billing\\:use_for_shipping_yes'
175
+ };
176
+
177
+ myParcelCheckout = new MyParcelCheckout(config, selectors, templates, {});
178
+
179
+ var shippingMethod =$('s_method_myparcel_pakjegemak');
180
+ if (shippingMethod.checked) {
181
+ shippingMethod.checked = false;
182
+ }
183
+ });
184
+ //]]>
185
+ </script>
app/design/frontend/base/default/template/TIG/MyParcel2014/checkout/onepage/js.phtml ADDED
@@ -0,0 +1,228 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2015 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ ?>
40
+ <?php
41
+ $_helper = Mage::helper('tig_myparcel');
42
+ $version = Mage::getVersionInfo();
43
+ $_selector = '';
44
+ if((int) $version['major'] === 1 && (int)$version['minor'] < 8){
45
+ $_selector = 'style_16';
46
+ }
47
+ ?>
48
+ <div id="myparcel_checkout_overlay_container" style="display:none;"></div>
49
+ <div id="myparcel_checkout_container" style="display:none;">
50
+ <div id="#{overlay_id}" class="responsive-add-location <?php echo $_selector;?>">
51
+ <div class="overlay close"></div>
52
+ <div id="#{overlay_window_id}">
53
+ <div class="logo">
54
+ <img src="<?php echo $this->getSkinUrl('images/TIG/MyParcel/checkout/logo_postnl.png');?>" alt="" />
55
+ <p class="powered-by"><?php echo $_helper->__('Powered by MyParcel'); ?></p>
56
+ </div>
57
+ <span class="close"><?php echo $_helper->__('Close'); ?></span>
58
+ <h3><?php echo $_helper->__('Choose a PostNL pickup location'); ?></h3>
59
+ <div class="responsive-location-search">
60
+ <div class="search-form">
61
+ <label for="#{postcode_field_id}"><?php echo $_helper->__('Search by zipcode and housenumber'); ?>:</label>
62
+ <input type="text" class="myparcel-input" name="" id="#{postcode_field_id}" value="" placeholder="<?php echo $_helper->__('Zipcode'); ?>" />
63
+ <label for="#{housenr_field_id}"><?php echo $_helper->__('Housenumber'); ?>:</label>
64
+ <input type="text" class="myparcel-input" name="" id="#{housenr_field_id}" value="" placeholder="<?php echo $_helper->__('Housenumber'); ?>" />
65
+ </div>
66
+ <div class="actions">
67
+ <div id="#{location_loader_id}" class="myparcel-loader" style="display:none;"></div>
68
+ <button class="myparcel-button" id="#{search_button_id}"><?php echo $_helper->__('Search'); ?></button>
69
+ </div>
70
+ </div>
71
+
72
+ <div class="responsive-location-results">
73
+ <div class="heading">
74
+ <h3><?php echo $_helper->__('Nearest myparcel pickup points'); ?></h3>
75
+ </div>
76
+
77
+ <ul class="list" id="#{location_list_id}">
78
+ </ul>
79
+ </div>
80
+ </div>
81
+ </div>
82
+ </div>
83
+ <div id="myparcel_checkout_location_template" style="display:none;">
84
+ <li class="location-details #{location_class}" id="#{location_id}" data-location_code="#{location_code}">
85
+ <div class="content">
86
+ <div class="location-info">
87
+ <span class="radio selected"></span>
88
+ <span class="address"><strong>#{location}</strong><br>#{street} #{street_number}<br>#{postcode} #{city}</span>
89
+ </div>
90
+ <span class="distance"><strong>#{distance} m</strong></span>
91
+ <a style="display:none;" href="#" class="info-link">More info</a>
92
+ <button class="myparcel-button" onclick="#{select_location_onclick}"><?php echo $_helper->__('Select'); ?></button>
93
+ </div>
94
+ <div class="more-info" id="#{location_info_id}" style="display:none;">
95
+ <table class="business-hours">
96
+ <thead>
97
+ <tr>
98
+ <th colspan="2"><?php echo $this->__('Business hours') ?></th>
99
+ </tr>
100
+ </thead>
101
+ <tbody>
102
+ <tr>
103
+ <th><?php echo $this->__('Mo') ?></th>
104
+ <td>#{opening_hours_monday}</td>
105
+ </tr>
106
+ <tr>
107
+ <th><?php echo $this->__('Tu') ?></th>
108
+ <td>#{opening_hours_tuesday}</td>
109
+ </tr>
110
+ <tr>
111
+ <th><?php echo $this->__('We') ?></th>
112
+ <td>#{opening_hours_wednesday}</td>
113
+ </tr>
114
+ <tr>
115
+ <th><?php echo $this->__('Th') ?></th>
116
+ <td>#{opening_hours_thursday}</td>
117
+ </tr>
118
+ <tr>
119
+ <th><?php echo $this->__('Fr') ?></th>
120
+ <td>#{opening_hours_friday}</td>
121
+ </tr>
122
+ <tr>
123
+ <th><?php echo $this->__('Sa') ?></th>
124
+ <td>#{opening_hours_saturday}</td>
125
+ </tr>
126
+ <tr>
127
+ <th><?php echo $this->__('Su') ?></th>
128
+ <td>#{opening_hours_sunday}</td>
129
+ </tr>
130
+ </tbody>
131
+ </table>
132
+ </div>
133
+ </li>
134
+ </div>
135
+ <div id="myparcel_checkout_location_error_template" style="display:none;">
136
+ <li id="no_locations_error" class="location-error-msg">
137
+ <?php echo $_helper->__('Unfortunately no locations could be found. Please check your postcode and house number combination.'); ?>
138
+ </li>
139
+ </div>
140
+ <div id="myparcel_checkout_selected_location_template" style="display:none;">
141
+ <div id="#{selected_location_id}" class="complete">
142
+ <label class="head"><?php echo $this->__('Selected post office location:') ?></label>
143
+ <address>
144
+ #{location}<br />
145
+ #{street} #{street_number}<br />
146
+ #{city}, #{postcode}<br />
147
+ Nederland<br />
148
+ T: #{phone_number}
149
+ <a href="#" onclick="myParcelCheckout.openOverlay();return false;" class="myparcel_checkout_edit_link"><?php echo $this->__('Edit'); ?></a>
150
+ </address>
151
+ </div>
152
+ </div>
153
+ <script type="text/javascript">
154
+ //<![CDATA[
155
+ var myParcelCheckout;
156
+ document.observe('dom:loaded', function() {
157
+ var checkoutContainer = $('myparcel_checkout_container');
158
+ var locationContainer = $('myparcel_checkout_location_template');
159
+ var locationErrorContainer = $('myparcel_checkout_location_error_template');
160
+ var selectedLocationContainer = $('myparcel_checkout_selected_location_template');
161
+ var templates = {
162
+ overlay : new Template(checkoutContainer.innerHTML),
163
+ location : new Template(locationContainer.innerHTML),
164
+ location_error : new Template(locationErrorContainer.innerHTML),
165
+ selected_location : new Template(selectedLocationContainer.innerHTML)
166
+ };
167
+
168
+ var shippingMethodsLoadCallback = function() {
169
+ if(null != $('shipping-progress-opcheckout')){
170
+ $('shipping-progress-opcheckout').show();
171
+ }
172
+ };
173
+
174
+ var saveLocationSuccessCallback = function() {
175
+ checkout.reloadProgressBlock('myparcel_checkout');
176
+ $('shipping-progress-opcheckout').hide();
177
+ };
178
+
179
+ var config = {
180
+ get_locations_url : '<?php echo $this->getUrl('myparcel2014/checkout/getLocations', array('_secure' => true)); ?>',
181
+ save_location_url : '<?php echo $this->getUrl('myparcel2014/checkout/saveLocation', array('_secure' => true)); ?>',
182
+ shipping_methods_load_callback : shippingMethodsLoadCallback,
183
+ save_location_success_callback : saveLocationSuccessCallback
184
+ };
185
+
186
+ var selectors = {
187
+ shipping_method : '#s_method_myparcel_pakjegemak'
188
+ };
189
+
190
+ checkoutContainer.remove();
191
+ locationContainer.remove();
192
+ locationErrorContainer.remove();
193
+ selectedLocationContainer.remove();
194
+ myParcelCheckout = new MyParcelCheckout(config, selectors, templates, {});
195
+
196
+ if (typeof myParcelCheckout != 'undefined') {
197
+ Object.extend(shippingMethod, {
198
+ save : function () {
199
+ if (checkout.loadWaiting != false) return;
200
+ if (this.validate()) {
201
+ var selectedShippingMethod = $$('#co-shipping-method-form input:checked[name="shipping_method"]')[0];
202
+ if (selectedShippingMethod.id == 's_method_myparcel_pakjegemak') {
203
+ myParcelCheckout.saveSelectedLocation();
204
+ } else {
205
+ if(null != $('shipping-progress-opcheckout')){
206
+ $('shipping-progress-opcheckout').show();
207
+ }
208
+ $('myparcel_checkout-progress-opcheckout').hide();
209
+ }
210
+
211
+ checkout.setLoadWaiting('shipping-method');
212
+ new Ajax.Request(
213
+ this.saveUrl,
214
+ {
215
+ method : 'post',
216
+ onComplete : this.onComplete,
217
+ onSuccess : this.onSave,
218
+ onFailure : checkout.ajaxFailure.bind(checkout),
219
+ parameters : Form.serialize(this.form)
220
+ }
221
+ );
222
+ }
223
+ }
224
+ });
225
+ }
226
+ });
227
+ //]]>
228
+ </script>
app/design/frontend/base/default/template/TIG/MyParcel2014/checkout/onepage/progress.phtml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2015 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ *
39
+ * @var TIG_MyParcel2014_Block_Checkout_Progress $this
40
+ */
41
+ ?>
42
+ <div id="myparcel_checkout-progress-opcheckout">
43
+ </div>
44
+ <script type="text/javascript">
45
+ //<![CDATA[
46
+ var shippingAddressProgress = $('shipping-progress-opcheckout');
47
+ if (shippingAddressProgress) {
48
+ shippingAddressProgress.insert({
49
+ after : $('myparcel_checkout-progress-opcheckout')
50
+ });
51
+ }
52
+
53
+ if (checkout) {
54
+ checkout.steps = ['login', 'billing', 'shipping', 'shipping_method', 'myparcel_checkout', 'payment', 'review'];
55
+ }
56
+ //]]>
57
+ </script>
app/design/frontend/base/default/template/TIG/MyParcel2014/checkout/onepage/progress/pakje_gemak.phtml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2015 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ *
39
+ * @var TIG_MyParcel2014_Block_Checkout_Progress $this
40
+ */
41
+ ?>
42
+ <?php if ($this->getCheckout()->getStepData('shipping_method', 'complete')): ?>
43
+ <?php $_pakjeGemakAddress = $this->getPakjeGemakAddress(); ?>
44
+ <?php if($_pakjeGemakAddress): ?>
45
+ <dt class="complete"><?php echo $this->__('Post Office Address') ?> <span class="changelink"><span class="separator">|</span> <a href="#shipping_method" onclick="checkout.changeSection('opc-shipping_method'); return false;"><?php echo $this->__('Change') ?></a></span></dt>
46
+ <dd class="complete"><?php echo $_pakjeGemakAddress; ?></dd>
47
+ <?php endif; ?>
48
+ <?php endif; ?>
app/design/frontend/base/default/template/TIG/MyParcel2014/onestepcheckout/shipping_method.phtml DELETED
@@ -1,86 +0,0 @@
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_default
22
- * @package Mage
23
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
- */
26
- ?>
27
- <?php if (!($_shippingRateGroups = $this->getShippingRates())): ?>
28
- <strong><?php echo $this->__('Sorry, no quotes are available for this order at this time.') ?></strong>
29
- <?php else: ?>
30
- <?php if (count($_shippingRateGroups)=='1' && Mage::getStoreConfig('onestepcheckout/general/hide_shipping_method')):?>
31
- <dl class="shipment-methods" style="display: none">
32
- <?php foreach ($_shippingRateGroups as $code => $_rates): ?>
33
- <dd><?php echo $this->getCarrierName($code) ?></dd>
34
- <?php foreach ($_rates as $_rate): ?>
35
- <dt style="margin-bottom: 5px;">
36
- <?php if ($_rate->getErrorMessage()): ?>
37
- <ul class="messages"><li class="error-msg"><ul><li><?php echo $_rate->getErrorMessage() ?></li></ul></li></ul>
38
- <?php else: ?>
39
- <input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>" checked="checked" />
40
- <label for="s_method_<?php echo $_rate->getCode() ?>"><!--<b><?php echo $this->getCarrierName($code) ?>:</b>--> <?php echo $_rate->getMethodTitle() ?>
41
- <strong>
42
- <?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
43
- <?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
44
- <?php echo $_excl; ?>
45
- <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
46
- (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
47
- <?php endif; ?>
48
- </strong>
49
- </label>
50
- <?php endif ?>
51
- </dt>
52
- <?php endforeach; ?>
53
- <?php endforeach; ?>
54
- </dl>
55
- <?php else: ?>
56
- <dl class="shipment-methods">
57
- <?php foreach ($_shippingRateGroups as $code => $_rates): ?>
58
- <dd><?php echo $this->getCarrierName($code) ?></dd>
59
- <?php foreach ($_rates as $_rate): ?>
60
- <dt style="margin-bottom: 5px;">
61
-
62
- <?php if ($_rate->getErrorMessage()): ?>
63
- <ul class="messages"><li class="error-msg"><ul><li><?php echo $_rate->getErrorMessage() ?></li></ul></li></ul>
64
- <?php else: ?>
65
- <input name="shipping_method" type="radio" class="validate-one-required-by-name" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> />
66
- <label for="s_method_<?php echo $_rate->getCode() ?>"><!--<b><?php echo $this->getCarrierName($code) ?>:</b>--> <?php echo $_rate->getMethodTitle() ?>
67
- <strong>
68
- <?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
69
- <?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
70
-
71
- <?php echo $_excl; ?>
72
- <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
73
- (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
74
- <?php endif; ?>
75
- </strong>
76
- </label>
77
- <?php endif ?>
78
- </dt>
79
- <?php endforeach; ?>
80
- <?php endforeach; ?>
81
- </dl>
82
- <?php endif; ?>
83
- <?php endif; ?>
84
- <?php if ($this->getChild('myparcel.pg_address')): ?>
85
- <?php echo $this->getChildHtml('myparcel.pg_address'); ?>
86
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/TIG/MyParcel2014/pakjegemak.phtml DELETED
@@ -1,88 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml" >
3
- <head>
4
- <title>MyParcel - Magento - Passdata from PostNL through MyParcel</title>
5
- </head>
6
- <body>
7
- <script type="text/javascript">
8
- /* Querystring.js ******************************************************************************/
9
- function Querystring(qs) { // optionally pass a querystring to parse
10
- this.params = new Object()
11
- this.get=Querystring_get
12
-
13
- if (qs == null)
14
- qs=location.search.substring(1,location.search.length)
15
-
16
- if (qs.length == 0) return
17
-
18
- qs = qs.replace(/\+/g, ' ')
19
- var args = qs.split('&') // parse out name/value pairs separated via &
20
-
21
-
22
- for (var i=0;i<args.length;i++) {
23
- var value;
24
- var pair = args[i].split('=')
25
- var name = unescape(pair[0])
26
-
27
- if (pair.length == 2)
28
- value = unescape(pair[1])
29
- else
30
- value = name
31
-
32
- this.params[name] = value
33
- }
34
- }
35
-
36
- function Querystring_get(key, default_) {
37
- // This silly looking line changes UNDEFINED to NULL
38
- if (default_ == null) default_ = null;
39
-
40
- var value=this.params[key]
41
- if (value==null) value=default_;
42
-
43
- return value
44
- }
45
-
46
- window.onload = passData;
47
- function passData()
48
- {
49
- var name;
50
- var street;
51
- var houseNr;
52
- var houseNrAdd;
53
- var postalCodeNum;
54
- var postalCodeAlpha;
55
- var city;
56
-
57
- var qs = new Querystring();
58
- if (qs.get("action") == "confirm")
59
- {
60
- name = qs.get('name');
61
- street = qs.get('street');
62
- houseNr = qs.get('housenumber');
63
- houseNrAdd = qs.get('housenumberadd');
64
- postalCodeNum = qs.get('postalcodenum');
65
- postalCodeAlpha = qs.get('postalcodealpha');
66
- city = qs.get('city');
67
-
68
- if(parent.parent.window.opener)
69
- {
70
- var shopname = name.split('&nbsp;&nbsp;');
71
- if(shopname.length == 2) shopname = shopname[1];
72
-
73
- parent.parent.window.opener.myParcelPgAddress.setAddress({
74
- name : shopname,
75
- street : street,
76
- housenumber : houseNr,
77
- housenumberadd : houseNrAdd,
78
- postalcode : postalCodeNum + postalCodeAlpha,
79
- city : city,
80
- country : 'NL',
81
- }).updateFieldset();
82
- }
83
- }
84
- parent.parent.window.close();
85
- }
86
- </script>
87
- </body>
88
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/locale/en_US/TIG_MyParcel2014.csv CHANGED
@@ -1,149 +1,200 @@
1
- TIG_MyParcel2014::Enabled,Enabled
2
- TIG_MyParcel2014::Title,Title
3
- TIG_MyParcel2014::Method Name,Method Name
4
- TIG_MyParcel2014::Rate Type,Rate Type
5
- TIG_MyParcel2014::Type,Type
6
- TIG_MyParcel2014::Price,Price
7
- TIG_MyParcel2014::Pakjegemak active,Pakjegemak active
8
- TIG_MyParcel2014::Pakjegemak fee,Pakjegemak fee
9
- TIG_MyParcel2014::Condition,Condition
10
- TIG_MyParcel2014::Calculate Handling Fee,Calculate Handling Fee
11
- TIG_MyParcel2014::Handling Fee,Handling Fee
12
- TIG_MyParcel2014::Ship to Applicable Countries,Ship to Applicable Countries
13
- TIG_MyParcel2014::Ship to Specific Countries,Ship to Specific Countries
14
- TIG_MyParcel2014::Sort Order,Sort Order
15
- TIG_MyParcel2014::Default Shipment Settings,Default Shipment Settings
16
- TIG_MyParcel2014::Home address only,Home address only
17
- TIG_MyParcel2014::Signature on receipt,Signature on receipt
18
- TIG_MyParcel2014::Return if no answer,Return if no answer
19
- TIG_MyParcel2014::Insured up to &euro; 50,Insured up to &euro; 50
20
- TIG_MyParcel2014::For NL shipping only,For NL shipping only
21
- TIG_MyParcel2014::Insured up to &euro; 250,Insured up to &euro; 250
22
- "TIG_MyParcel2014::For NL shipping only, shipments outside the EU insured default is &euro; 200","For NL shipping only, shipments outside the EU insured default is &euro; 200"
23
- TIG_MyParcel2014::Insured up to &euro; 500,Insured up to &euro; 500
24
- "TIG_MyParcel2014::For NL shipping only, shipments inside the EU insured default is &euro; 500","For NL shipping only, shipments inside the EU insured default is &euro; 500"
25
- TIG_MyParcel2014::Customs Shipment Type,Customs Shipment Type
26
- TIG_MyParcel2014::Customs Content HS Code,Customs Content HS Code
27
- "TIG_MyParcel2014::Default content type for Cross Domestic products, see <a href=""http://gebruikstarief.douane.nl"" target=""_blank"">http://gebruikstarief.douane.nl</a>","Default content type for Cross Domestic products, see <a href=""http://gebruikstarief.douane.nl"" target=""_blank"">http://gebruikstarief.douane.nl</a>"
28
- "TIG_MyParcel2014::Fill in your preferences for a shipment. These settings will only apply for the mass actions in the order grid. When creating a single shipment, these settings can be changed manually.<br/>These settings will activate based on the order total amount. When shipping outside of the EU you can set default values for customs type and customs goods HS code.","Fill in your preferences for a shipment. These settings will only apply for the mass actions in the order grid. When creating a single shipment, these settings can be changed manually.<br/>These settings will activate based on the order total amount. When shipping outside of the EU you can set default values for customs type and customs goods HS code."
29
- TIG_MyParcel2014::Retourlink e-mail Template,Retourlink e-mail Template
30
- TIG_MyParcel2014::PLACEHOLDER,PLACEHOLDER
31
- TIG_MyParcel2014::Track&amp;Trace email template,Track&amp;Trace email template
32
- "TIG_MyParcel2014::You can create a new transactional e-mail where the variables {{var tracktrace_url}} and {{var retourlabel_url}} are available. TIP: You can base them on the Order Update template, because {{var order}} is also available.","You can create a new transactional e-mail where the variables {{var tracktrace_url}} and {{var retourlabel_url}} are available. TIP: You can base them on the Order Update template, because {{var order}} is also available."
33
- TIG_MyParcel2014::Print Orientation,Print Orientation
34
- TIG_MyParcel2014::Select a standard orientation for printing labels.,Select a standard orientation for printing labels.
35
- TIG_MyParcel2014::Enable test modus,Enable test modus
36
- TIG_MyParcel2014::Enable to test the extension,Enable to test the extension
37
- TIG_MyParcel2014::Enable Myparcel Extension,Enable Myparcel Extension
38
- TIG_MyParcel2014::Enable or disable the MyParcel module.,Enable or disable the MyParcel module.
39
- TIG_MyParcel2014::Selecting 'No' will overrule all individual settings.,Selecting 'No' will overrule all individual settings.
40
- TIG_MyParcel2014::General Settings,General Settings
41
- TIG_MyParcel2014::API Key,API Key
42
- TIG_MyParcel2014::The API Key given by MyParcel.,The API Key given by MyParcel.
43
- TIG_MyParcel2014::API Username,API Username
44
- TIG_MyParcel2014::Your MyParcel username.,Your MyParcel username.
45
- TIG_MyParcel2014::To get your personal API credentials you should contact MyParcel.,To get your personal API credentials you should contact MyParcel.
46
- TIG_MyParcel2014::API settings,API settings
47
- TIG_MyParcel2014::Version &amp; Support,Version &amp; Support
48
- TIG_MyParcel2014::The log files cannot be downloaded.,The log files cannot be downloaded.
49
- TIG_MyParcel2014::An error occurred while processing this action.,An error occurred while processing this action.
50
- TIG_MyParcel2014::The shipments were successfully created.,The shipments were successfully created.
51
- TIG_MyParcel2014::None of the shipments could be created. Please check the error messages for more details.,None of the shipments could be created. Please check the error messages for more details.
52
- TIG_MyParcel2014::Please select one or more shipments.,Please select one or more shipments.
53
- TIG_MyParcel2014::Please select one or more orders.,Please select one or more orders.
54
- TIG_MyParcel2014::MyParcel replied with the following warnings:,MyParcel replied with the following warnings:
55
- TIG_MyParcel2014::The following shipments or orders could not be processed:,The following shipments or orders could not be processed:
56
- TIG_MyParcel2014::Order #%s cannot be shipped at this time.,Order #%s cannot be shipped at this time.
57
- TIG_MyParcel2014::Invalid full street supplied: %s.,Invalid full street supplied: %s.
58
- TIG_MyParcel2014::Invalid housnumber supplied: %s.,Invalid housnumber supplied: %s.
59
- TIG_MyParcel2014::Invalid session requested.,Invalid session requested.
60
- TIG_MyParcel2014::Invalid message type requested: %s.,Invalid message type requested: %s.
61
- TIG_MyParcel2014::No message supplied.,No message supplied.
62
- TIG_MyParcel2014::No message type supplied.,No message type supplied.
63
- TIG_MyParcel2014::Click here for more information from the TiG knowledgebase.,Click here for more information from the TiG knowledgebase.
64
- TIG_MyParcel2014::An error occurred while processing your request: ,An error occurred while processing your request:
65
- TIG_MyParcel2014::The createConsignment action is currently unavailable.,The createConsignment action is currently unavailable.
66
- TIG_MyParcel2014::Invalid createConsignment response.,Invalid createConsignment response.
67
- TIG_MyParcel2014::Shipping status,Shipping status
68
- TIG_MyParcel2014::MyParcel - Create Shipments,MyParcel - Create Shipments
69
- TIG_MyParcel2014::MyParcel - Print shipping labels,MyParcel - Print shipping labels
70
- TIG_MyParcel2014::Download log files,Download log files
71
- TIG_MyParcel2014::Unknown rate type specified: %s.,Unknown rate type specified: %s.
72
- TIG_MyParcel2014::Flat,Flat
73
- TIG_MyParcel2014::Table,Table
74
- TIG_MyParcel2014::Invalid PakjeGemak address.,Invalid PakjeGemak address.
75
- TIG_MyParcel2014::Invalid phone number.,Invalid phone number.
76
- TIG_MyParcel2014::Invalid housenumber extension.,Invalid housenumber extension.
77
- TIG_MyParcel2014::A4,A4
78
- TIG_MyParcel2014::A6,A6
79
- TIG_MyParcel2014::Commercial Goods,Commercial Goods
80
- TIG_MyParcel2014::Commercial Sample,Commercial Sample
81
- TIG_MyParcel2014::Documents,Documents
82
- TIG_MyParcel2014::Gift,Gift
83
- TIG_MyParcel2014::Returned Goods,Returned Goods
84
- TIG_MyParcel2014::Yes,Yes
85
- TIG_MyParcel2014::No,No
86
- TIG_MyParcel2014::Myparcel Consignment Options,Myparcel Consignment Options
87
- TIG_MyParcel2014::Insured amount,Insured amount
88
- TIG_MyParcel2014::Insured,Insured
89
- TIG_MyParcel2014::MyParcel version %s,MyParcel version %s
90
- TIG_MyParcel2014::Magento &amp; 3rd party version compatibility,Magento &amp; 3rd party version compatibility
91
- TIG_MyParcel2014::Magento Community Edition version,Magento Community Edition version
92
- TIG_MyParcel2014::Magento Enterprise Edition version,Magento Enterprise Edition version
93
- TIG_MyParcel2014::Idev's OneStepCheckout version,Idev's OneStepCheckout version
94
- "TIG_MyParcel2014::If you wish to use this extension on an unsupported Magento version or edition, or in combination with an unsupported 3rd party extension, we cannot guarantee the MyParcel extension will function as expected. For questions please contact the Total Internet Group servicedesk.","If you wish to use this extension on an unsupported Magento version or edition, or in combination with an unsupported 3rd party extension, we cannot guarantee the MyParcel extension will function as expected. For questions please contact the Total Internet Group servicedesk."
95
- TIG_MyParcel2014::Support,Support
96
- TIG_MyParcel2014::The extension is developed by Total Internet Group.,The extension is developed by Total Internet Group.
97
- TIG_MyParcel2014::MyParcel account questions and information,MyParcel account questions and information
98
- "TIG_MyParcel2014::For questions related to your MyParcel account,please contact MyParcel.","For questions related to your MyParcel account,please contact MyParcel."
99
- TIG_MyParcel2014::Phone,Phone
100
- TIG_MyParcel2014::Extension support and configuration questions,Extension support and configuration questions
101
- "TIG_MyParcel2014::For configuration problems, extension conflicts and bugs contact Total Internet Group.","For configuration problems, extension conflicts and bugs contact Total Internet Group."
102
- TIG_MyParcel2014::Online knowledgebase,Online knowledgebase
103
- TIG_MyParcel2014::Request help directly,Request help directly
104
- TIG_MyParcel2014::Email,Email
105
- TIG_MyParcel2014::Documentation,Documentation
106
- TIG_MyParcel2014::A list of documents regarding the extension.,A list of documents regarding the extension.
107
- TIG_MyParcel2014::View the installation and configuration manual.,View the installation and configuration manual.
108
- TIG_MyParcel2014::Installation and configuration manual,Installation and configuration manual
109
- TIG_MyParcel2014::View the user manual.,View the user manual.
110
- TIG_MyParcel2014::User manual,User manual
111
- TIG_MyParcel2014::View the complete changelog of the extension.,View the complete changelog of the extension.
112
- TIG_MyParcel2014::Full changelog,Full changelog
113
- TIG_MyParcel2014::MyParcel PgAddress class missing.,MyParcel PgAddress class missing.
114
- TIG_MyParcel2014::Select a transactional e-mail template to send the retourlink,Select a transactional e-mail template to send the retourlink
115
- TIG_MyParcel2014::Select a transactional e-mail template to send the barcode,Select a transactional e-mail template to send the barcode
116
- TIG_MyParcel2014::You can create a new transactional e-mail where the variables {{var retourlink}} is available.,You can create a new transactional e-mail where the variables {{var retourlink}} is available.
117
- TIG_MyParcel2014::Unable to send track and trace email for shipment #,Unable to send track and trace email for shipment #
118
- TIG_MyParcel2014::Track&amp;Trace e-mail is send: %s,Track&amp;Trace e-mail is send: %s
119
- TIG_MyParcel2014::Credit Consignment,Credit Consignment
120
- TIG_MyParcel2014::Generate Retourlink,Generate Retourlink
121
- TIG_MyParcel2014::Retourlink generated: %s,Retourlink generated: %s
122
- "TIG_MyParcel2014::Credit has not been created, check MyParcel backend for details","Credit has not been created, check MyParcel backend for details"
123
- TIG_MyParcel2014::Consignment %s is credited at MyParcel,Consignment %s is credited at MyParcel
124
- "TIG_MyParcel2014::If you do not use split street lines and you wish to ship to outside the EU, there is a strong possibility that MyParcel will be unable to properly parse the address. This may result in the shipment being refused or it may even lead to the shipment being delivered at the wrong address!","If you do not use split street lines and you wish to ship to outside the EU, there is a strong possibility that MyParcel will be unable to properly parse the address. This may result in the shipment being refused or it may even lead to the shipment being delivered at the wrong address!"
125
- TIG_MyParcel2014::Split street parts,Split street parts
126
- TIG_MyParcel2014::Streetname field,Streetname field
127
- TIG_MyParcel2014::Housenr. field,Housenr. field
128
- TIG_MyParcel2014::Split house number parts,Split house number parts
129
- TIG_MyParcel2014::Housenr. extension field,Housenr. extension field
130
- TIG_MyParcel2014::Street line #%s,Street line #%s
131
- TIG_MyParcel2014::This will be added to the regular shipping price,This will be added to the regular shipping price
132
- TIG_MyParcel2014::Default shipment type for Cross Domestic shipments,Default shipment type for Cross Domestic shipments
133
- "TIG_MyParcel2014::When changing the address, you need to cancel the current MyParcel shipment(s) linked to this order and create new MyParcel shipments.","When changing the address, you need to cancel the current MyParcel shipment(s) linked to this order and create new MyParcel shipments."
134
- "TIG_MyParcel2014::To download the instructions for the MyParcel Magento extension, click <a target=""_blank"" href=""%s"">here</a>.","To download the instructions for the MyParcel Magento extension, click <a target=""_blank"" href=""%s"">here</a>."
135
- TIG_MyParcel2014::When using the extension please note:,When using the extension please note:
136
- TIG_MyParcel2014::To be able to configure the extension you need to possess and use an active MyParcel account.,To be able to configure the extension you need to possess and use an active MyParcel account.
137
- "TIG_MyParcel2014::During the transition phase the old Magento MyParcel extension can remain active. However, you do need to turn off PakjeGemak in the old MyParcel extension.","During the transition phase the old Magento MyParcel extension can remain active. However, you do need to turn off PakjeGemak in the old MyParcel extension."
138
- TIG_MyParcel2014::We cannot guarantee perfect functionality of the MyParcel extension when you intend to use the extension on a version of Magento that is not supported or when you intend to use the extension together with a 3rd part extension that is not supported. If you have any questions please contact MyParcel.,We cannot guarantee perfect functionality of the MyParcel extension when you intend to use the extension on a version of Magento that is not supported or when you intend to use the extension together with a 3rd part extension that is not supported. If you have any questions please contact MyParcel.
139
- TIG_MyParcel2014::Installation and configuration instructions,Installation and configuration instructions
140
- TIG_MyParcel2014::Overview articles in knowledge base,View all articles in the knowledgebase
141
- TIG_MyParcel2014::This extension has been developed by Total Internet Group.,This extension has been developed by Total Internet Group.
142
- TIG_MyParcel2014::Questions and information about your MyParcel account,Questions and information about your MyParcel account
143
- "TIG_MyParcel2014::For configuration problems, extension conflicts or bugs, please contact Total Internet Group.","For configuration problems, extension conflicts or bugs, please contact Total Internet Group."
144
- "TIG_MyParcel2014::Shipments will not be delivered at the neighbours, only on house address.","Shipments will not be delivered at the neighbours, only on house address."
145
- TIG_MyParcel2014::Shipments will not go the a pickup point but will be returned directly after multiple delivery attempts.,Shipments will not go the a pickup point but will be returned directly after multiple delivery attempts.
146
- TIG_MyParcel2014::Unable to save check_status cron expression: %s,Unable to save check_status cron expression: %s
147
- TIG_MyParcel2014::Some of the shipments could not be created or could not be created at MyParcel from the selected orders. See below for detailed information.,Some of the shipments could not be created or could not be created at MyParcel from the selected orders. See below for detailed information.
148
- TIG_MyParcel2014::Select A4 print start position,Select A4 print start position
149
- "TIG_MyParcel2014::Select content type for Cross Domestic products, see <a href=""http://gebruikstarief.douane.nl"" target=""_blank"">http://gebruikstarief.douane.nl</a>","Select content type for Cross Domestic products, see <a href=""http://gebruikstarief.douane.nl"" target=""_blank"">http://gebruikstarief.douane.nl</a>"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ TIG_MyParcel2014::Enabled,Enabled
2
+ TIG_MyParcel2014::Title,Title
3
+ TIG_MyParcel2014::Method Name,Method Name
4
+ TIG_MyParcel2014::Rate Type,Rate Type
5
+ TIG_MyParcel2014::Type,Type
6
+ TIG_MyParcel2014::Price,Price
7
+ TIG_MyParcel2014::Pakjegemak active,Pakjegemak active
8
+ TIG_MyParcel2014::Pakjegemak fee,Pakjegemak fee
9
+ TIG_MyParcel2014::Condition,Condition
10
+ TIG_MyParcel2014::Calculate Handling Fee,Calculate Handling Fee
11
+ TIG_MyParcel2014::Handling Fee,Handling Fee
12
+ TIG_MyParcel2014::Ship to Applicable Countries,Ship to Applicable Countries
13
+ TIG_MyParcel2014::Ship to Specific Countries,Ship to Specific Countries
14
+ TIG_MyParcel2014::Sort Order,Sort Order
15
+ TIG_MyParcel2014::Default Shipment Settings,Default Shipment Settings
16
+ TIG_MyParcel2014::Home address only,Home address only
17
+ TIG_MyParcel2014::Signature on receipt,Signature on receipt
18
+ TIG_MyParcel2014::Return if no answer,Return if no answer
19
+ TIG_MyParcel2014::Insured up to &euro; 50,Insured up to &euro; 50
20
+ TIG_MyParcel2014::For NL shipping only,For NL shipping only
21
+ TIG_MyParcel2014::Insured up to &euro; 250,Insured up to &euro; 250
22
+ "TIG_MyParcel2014::For NL shipping only, shipments outside the EU insured default is &euro; 200","For NL shipping only, shipments outside the EU insured default is &euro; 200"
23
+ TIG_MyParcel2014::Insured up to &euro; 500,Insured up to &euro; 500
24
+ "TIG_MyParcel2014::For NL shipping only, shipments inside the EU insured default is &euro; 500","For NL shipping only, shipments inside the EU insured default is &euro; 500"
25
+ TIG_MyParcel2014::Customs Shipment Type,Customs Shipment Type
26
+ TIG_MyParcel2014::Customs Content HS Code,Customs Content HS Code
27
+ "TIG_MyParcel2014::Default content type for Cross Domestic products, see <a href=""http://gebruikstarief.douane.nl"" target=""_blank"">http://gebruikstarief.douane.nl</a>","Default content type for Cross Domestic products, see <a href=""http://gebruikstarief.douane.nl"" target=""_blank"">http://gebruikstarief.douane.nl</a>"
28
+ "TIG_MyParcel2014::Fill in your preferences for a shipment. These settings will only apply for the mass actions in the order grid. When creating a single shipment, these settings can be changed manually.<br/>These settings will activate based on the order total amount. When shipping outside of the EU you can set default values for customs type and customs goods HS code.","Fill in your preferences for a shipment. These settings will only apply for the mass actions in the order grid. When creating a single shipment, these settings can be changed manually.<br/>These settings will activate based on the order total amount. When shipping outside of the EU you can set default values for customs type and customs goods HS code."
29
+ TIG_MyParcel2014::Retourlink e-mail Template,Retourlink e-mail Template
30
+ TIG_MyParcel2014::PLACEHOLDER,PLACEHOLDER
31
+ TIG_MyParcel2014::Track&Trace email template,Track&Trace email template
32
+ "TIG_MyParcel2014::You can create a new transactional e-mail where the variables {{var tracktrace_url}} and {{var retourlabel_url}} are available. TIP: You can base them on the Order Update template, because {{var order}} is also available.","You can create a new transactional e-mail where the variables {{var tracktrace_url}} and {{var retourlabel_url}} are available. TIP: You can base them on the Order Update template, because {{var order}} is also available."
33
+ TIG_MyParcel2014::Print Orientation,Print Orientation
34
+ TIG_MyParcel2014::Select a standard orientation for printing labels.,Select a standard orientation for printing labels.
35
+ TIG_MyParcel2014::Enable test modus,Enable test modus
36
+ TIG_MyParcel2014::Enable to test the extension,Enable to test the extension
37
+ TIG_MyParcel2014::Enable Myparcel Extension,Enable Myparcel Extension
38
+ TIG_MyParcel2014::Enable or disable the MyParcel module.,Enable or disable the MyParcel module.
39
+ TIG_MyParcel2014::Selecting 'No' will overrule all individual settings.,Selecting 'No' will overrule all individual settings.
40
+ TIG_MyParcel2014::General Settings,General Settings
41
+ TIG_MyParcel2014::API Key,API Key
42
+ TIG_MyParcel2014::The API Key given by MyParcel.,The API Key given by MyParcel.
43
+ TIG_MyParcel2014::API Username,API Username
44
+ TIG_MyParcel2014::Your MyParcel username.,Your MyParcel username.
45
+ TIG_MyParcel2014::To get your personal API credentials you should contact MyParcel.,To get your personal API credentials you should contact MyParcel.
46
+ TIG_MyParcel2014::API settings,API settings
47
+ TIG_MyParcel2014::Version &amp; Support,Version &amp; Support
48
+ TIG_MyParcel2014::The log files cannot be downloaded.,The log files cannot be downloaded.
49
+ TIG_MyParcel2014::An error occurred while processing this action.,An error occurred while processing this action.
50
+ TIG_MyParcel2014::The shipments were successfully created.,The shipments were successfully created.
51
+ TIG_MyParcel2014::None of the shipments could be created. Please check the error messages for more details.,None of the shipments could be created. Please check the error messages for more details.
52
+ TIG_MyParcel2014::Please select one or more shipments.,Please select one or more shipments.
53
+ TIG_MyParcel2014::Please select one or more orders.,Please select one or more orders.
54
+ TIG_MyParcel2014::MyParcel replied with the following warnings:,MyParcel replied with the following warnings:
55
+ TIG_MyParcel2014::The following shipments or orders could not be processed:,The following shipments or orders could not be processed:
56
+ TIG_MyParcel2014::Order #%s cannot be shipped at this time.,Order #%s cannot be shipped at this time.
57
+ TIG_MyParcel2014::Invalid full street supplied: %s.,Invalid full street supplied: %s.
58
+ TIG_MyParcel2014::Invalid housnumber supplied: %s.,Invalid housnumber supplied: %s.
59
+ TIG_MyParcel2014::Invalid session requested.,Invalid session requested.
60
+ TIG_MyParcel2014::Invalid message type requested: %s.,Invalid message type requested: %s.
61
+ TIG_MyParcel2014::No message supplied.,No message supplied.
62
+ TIG_MyParcel2014::No message type supplied.,No message type supplied.
63
+ TIG_MyParcel2014::Click here for more information from the TiG knowledgebase.,Click here for more information from the TiG knowledgebase.
64
+ TIG_MyParcel2014::An error occurred while processing your request: ,An error occurred while processing your request:
65
+ TIG_MyParcel2014::The createConsignment action is currently unavailable.,The createConsignment action is currently unavailable.
66
+ TIG_MyParcel2014::Invalid createConsignment response.,Invalid createConsignment response.
67
+ TIG_MyParcel2014::Shipping status,Shipping status
68
+ TIG_MyParcel2014::MyParcel - Create Shipments,MyParcel - Create Shipments
69
+ TIG_MyParcel2014::MyParcel - Print shipping labels,MyParcel - Print shipping labels
70
+ TIG_MyParcel2014::Download log files,Download log files
71
+ TIG_MyParcel2014::Unknown rate type specified: %s.,Unknown rate type specified: %s.
72
+ TIG_MyParcel2014::Flat,Flat
73
+ TIG_MyParcel2014::Table,Table
74
+ TIG_MyParcel2014::Invalid PakjeGemak address.,Invalid PakjeGemak address.
75
+ TIG_MyParcel2014::Invalid phone number.,Invalid phone number.
76
+ TIG_MyParcel2014::Invalid housenumber extension.,Invalid housenumber extension.
77
+ TIG_MyParcel2014::A4,A4
78
+ TIG_MyParcel2014::A6,A6
79
+ TIG_MyParcel2014::Commercial Goods,Commercial Goods
80
+ TIG_MyParcel2014::Commercial Sample,Commercial Sample
81
+ TIG_MyParcel2014::Documents,Documents
82
+ TIG_MyParcel2014::Gift,Gift
83
+ TIG_MyParcel2014::Returned Goods,Returned Goods
84
+ TIG_MyParcel2014::Yes,Yes
85
+ TIG_MyParcel2014::No,No
86
+ TIG_MyParcel2014::Myparcel Consignment Options,Myparcel Consignment Options
87
+ TIG_MyParcel2014::Insured amount,Insured amount
88
+ TIG_MyParcel2014::Insured,Insured
89
+ TIG_MyParcel2014::MyParcel version %s,MyParcel version %s
90
+ TIG_MyParcel2014::Magento &amp; 3rd party version compatibility,Magento &amp; 3rd party version compatibility
91
+ TIG_MyParcel2014::Magento Community Edition version,Magento Community Edition version
92
+ TIG_MyParcel2014::Magento Enterprise Edition version,Magento Enterprise Edition version
93
+ TIG_MyParcel2014::Idev's OneStepCheckout version,Idev's OneStepCheckout version
94
+ "TIG_MyParcel2014::If you wish to use this extension on an unsupported Magento version or edition, or in combination with an unsupported 3rd party extension, we cannot guarantee the MyParcel extension will function as expected. For questions please contact the Total Internet Group servicedesk.","If you wish to use this extension on an unsupported Magento version or edition, or in combination with an unsupported 3rd party extension, we cannot guarantee the MyParcel extension will function as expected. For questions please contact the Total Internet Group servicedesk."
95
+ TIG_MyParcel2014::Support,Support
96
+ TIG_MyParcel2014::The extension is developed by Total Internet Group.,The extension is developed by Total Internet Group.
97
+ TIG_MyParcel2014::MyParcel account questions and information,MyParcel account questions and information
98
+ "TIG_MyParcel2014::For questions related to your MyParcel account,please contact MyParcel.","For questions related to your MyParcel account,please contact MyParcel."
99
+ TIG_MyParcel2014::Phone,Phone
100
+ TIG_MyParcel2014::Extension support and configuration questions,Extension support and configuration questions
101
+ "TIG_MyParcel2014::For configuration problems, extension conflicts and bugs contact Total Internet Group.","For configuration problems, extension conflicts and bugs contact Total Internet Group."
102
+ TIG_MyParcel2014::Online knowledgebase,Online knowledgebase
103
+ TIG_MyParcel2014::Request help directly,Request help directly
104
+ TIG_MyParcel2014::Email,Email
105
+ TIG_MyParcel2014::Documentation,Documentation
106
+ TIG_MyParcel2014::A list of documents regarding the extension.,A list of documents regarding the extension.
107
+ TIG_MyParcel2014::View the installation and configuration manual.,View the installation and configuration manual.
108
+ TIG_MyParcel2014::Installation and configuration manual,Installation and configuration manual
109
+ TIG_MyParcel2014::View the user manual.,View the user manual.
110
+ TIG_MyParcel2014::User manual,User manual
111
+ TIG_MyParcel2014::View the complete changelog of the extension.,View the complete changelog of the extension.
112
+ TIG_MyParcel2014::Full changelog,Full changelog
113
+ TIG_MyParcel2014::MyParcel PgAddress class missing.,MyParcel PgAddress class missing.
114
+ TIG_MyParcel2014::Select a transactional e-mail template to send the retourlink,Select a transactional e-mail template to send the retourlink
115
+ TIG_MyParcel2014::Select a transactional e-mail template to send the barcode,Select a transactional e-mail template to send the barcode
116
+ TIG_MyParcel2014::You can create a new transactional e-mail where the variables {{var retourlink}} is available.,You can create a new transactional e-mail where the variables {{var retourlink}} is available.
117
+ TIG_MyParcel2014::Unable to send track and trace email for shipment #,Unable to send track and trace email for shipment #
118
+ TIG_MyParcel2014::Track&amp;Trace e-mail is send: %s,Track&amp;Trace e-mail is send: %s
119
+ TIG_MyParcel2014::Credit Consignment,Credit Consignment
120
+ TIG_MyParcel2014::Generate Retourlink,Generate Retourlink
121
+ TIG_MyParcel2014::Retourlink generated: %s,Retourlink generated: %s
122
+ "TIG_MyParcel2014::Credit has not been created, check MyParcel backend for details","Credit has not been created, check MyParcel backend for details"
123
+ TIG_MyParcel2014::Consignment %s is credited at MyParcel,Consignment %s is credited at MyParcel
124
+ "TIG_MyParcel2014::If you do not use split street lines and you wish to ship to outside the EU, there is a strong possibility that MyParcel will be unable to properly parse the address. This may result in the shipment being refused or it may even lead to the shipment being delivered at the wrong address!","If you do not use split street lines and you wish to ship to outside the EU, there is a strong possibility that MyParcel will be unable to properly parse the address. This may result in the shipment being refused or it may even lead to the shipment being delivered at the wrong address!"
125
+ TIG_MyParcel2014::Split street parts,Split street parts
126
+ TIG_MyParcel2014::Streetname field,Streetname field
127
+ TIG_MyParcel2014::Housenr. field,Housenr. field
128
+ TIG_MyParcel2014::Split house number parts,Split house number parts
129
+ TIG_MyParcel2014::Housenr. extension field,Housenr. extension field
130
+ TIG_MyParcel2014::Street line #%s,Street line #%s
131
+ TIG_MyParcel2014::This will be added to the regular shipping price,This will be added to the regular shipping price
132
+ TIG_MyParcel2014::Default shipment type for Cross Domestic shipments,Default shipment type for Cross Domestic shipments
133
+ "TIG_MyParcel2014::When changing the address, you need to cancel the current MyParcel shipment(s) linked to this order and create new MyParcel shipments.","When changing the address, you need to cancel the current MyParcel shipment(s) linked to this order and create new MyParcel shipments."
134
+ "TIG_MyParcel2014::To download the instructions for the MyParcel Magento extension, click <a target=""_blank"" href=""%s"">here</a>.","To download the instructions for the MyParcel Magento extension, click <a target=""_blank"" href=""%s"">here</a>."
135
+ TIG_MyParcel2014::When using the extension please note:,When using the extension please note:
136
+ TIG_MyParcel2014::To be able to configure the extension you need to possess and use an active MyParcel account.,To be able to configure the extension you need to possess and use an active MyParcel account.
137
+ "TIG_MyParcel2014::During the transition phase the old Magento MyParcel extension can remain active. However, you do need to turn off PakjeGemak in the old MyParcel extension.","During the transition phase the old Magento MyParcel extension can remain active. However, you do need to turn off PakjeGemak in the old MyParcel extension."
138
+ TIG_MyParcel2014::We cannot guarantee perfect functionality of the MyParcel extension when you intend to use the extension on a version of Magento that is not supported or when you intend to use the extension together with a 3rd part extension that is not supported. If you have any questions please contact MyParcel.,We cannot guarantee perfect functionality of the MyParcel extension when you intend to use the extension on a version of Magento that is not supported or when you intend to use the extension together with a 3rd part extension that is not supported. If you have any questions please contact MyParcel.
139
+ TIG_MyParcel2014::Installation and configuration instructions,Installation and configuration instructions
140
+ TIG_MyParcel2014::Overview articles in knowledge base,View all articles in the knowledgebase
141
+ TIG_MyParcel2014::This extension has been developed by TIG.,This extension has been developed by TIG.
142
+ TIG_MyParcel2014::Questions and information about your MyParcel account,Questions and information about your MyParcel account
143
+ "TIG_MyParcel2014::For configuration problems, extension conflicts or bugs, please contact TIG.","For configuration problems, extension conflicts or bugs, please contact TIG."
144
+ "TIG_MyParcel2014::Shipments will not be delivered at the neighbours, only on house address.","Shipments will not be delivered at the neighbours, only on house address."
145
+ TIG_MyParcel2014::Shipments will not go the a pickup point but will be returned directly after multiple delivery attempts.,Shipments will not go the a pickup point but will be returned directly after multiple delivery attempts.
146
+ TIG_MyParcel2014::Unable to save check_status cron expression: %s,Unable to save check_status cron expression: %s
147
+ TIG_MyParcel2014::Some of the shipments could not be created or could not be created at MyParcel from the selected orders. See below for detailed information.,Some of the shipments could not be created or could not be created at MyParcel from the selected orders. See below for detailed information.
148
+ TIG_MyParcel2014::Select A4 print start position,Select A4 print start position
149
+ "TIG_MyParcel2014::Select content type for Cross Domestic products, see <a href=""http://gebruikstarief.douane.nl"" target=""_blank"">http://gebruikstarief.douane.nl</a>","Select content type for Cross Domestic products, see <a href=""http://gebruikstarief.douane.nl"" target=""_blank"">http://gebruikstarief.douane.nl</a>"
150
+ TIG_MyParcel2014::Create MyParcel Consignment,Create MyParcel Consignment
151
+ TIG_MyParcel2014::Track&amp;Trace link: %s,Track&amp;Trace link: %s
152
+ TIG_MyParcel2014::Is letter box parcel,Is letter box parcel
153
+ TIG_MyParcel2014::Shipment type,Shipment type
154
+ TIG_MyParcel2014::Normal,Normal
155
+ TIG_MyParcel2014::Letter box,Letter box
156
+ TIG_MyParcel2014::Unstamped,Unstamped
157
+ TIG_MyParcel2014::The MyParcel consignment is successfully created.,The MyParcel consignment is successfully created.
158
+ TIG_MyParcel2014::Choose a pickup location,Choose a pickup location
159
+ TIG_MyParcel2014::Zipcode,Zipcode
160
+ "TIG_MyParcel2014::Search by zipcode, address or city","Search by zipcode, address or city"
161
+ TIG_MyParcel2014::Housenumber,Housenumber
162
+ TIG_MyParcel2014::Search,Search
163
+ TIG_MyParcel2014::Nearest myparcel pickup points,Nearest myparcel pickup points
164
+ TIG_MyParcel2014::Pakjegemak Method Name,Pakjegemak Method Name
165
+ TIG_MyParcel2014::Unpaid,Unpaid
166
+ TIG_MyParcel2014::The consignment is already credited.,The consignment is already credited.
167
+ TIG_MyParcel2014::MyParcel - Create &amp; Print shipping labels,MyParcel - Create &amp; Print shipping labels
168
+ TIG_MyParcel2014::Letterbox,Letterbox
169
+ TIG_MyParcel2014::Select,Select
170
+ TIG_MyParcel2014::Insured Up To %s,Insured Up To %s
171
+ TIG_MyParcel2014::Close,Close
172
+ TIG_MyParcel2014::Choose a PostNL pickup location,Choose a PostNL pickup location
173
+ "TIG_MyParcel2014::The selected shipment-type cannot be used, Pakjegemak-shipments can only be created with the normal shipment type.","The selected shipment-type cannot be used, Pakjegemak-shipments can only be created with the normal shipment type."
174
+ TIG_MyParcel2014::MyParcel - Create Magento shipments (no labels),MyParcel - Create Magento shipments (no labels)
175
+ TIG_MyParcel2014::Insured up to: &euro; %s,Insured up to: &euro; %s
176
+ TIG_MyParcel2014::Post Office Address,Post Office Address
177
+ "TIG_MyParcel2014::The selected shipment type cannot be used. Pakjegemak shipments can only be created with the normal shipment type.<br/> The Magento shipment has been created without a MyParcel shipment, select a different shipment type or go to the shipment page to create a single MyParcel shipment. <a target=""_blank"" href=""%s"">View shipment</a>","The selected shipment type cannot be used. Pakjegemak shipments can only be created with the normal shipment type.<br/> The Magento shipment has been created without a MyParcel shipment, select a different shipment type or go to the shipment page to create a single MyParcel shipment. <a target=""_blank"" href=""%s"">View shipment</a>"
178
+ TIG_MyParcel2014::Only for dutch shipments,Only for dutch shipments
179
+ "TIG_MyParcel2014::Only for dutch shipments, shipments to outside of the EU are standard ensured up to &euro 200","Only for dutch shipments, shipments to outside of the EU are standard ensured up to &euro 200"
180
+ TIG_MyParcel2014::Force unencrypted MyParcel connection,Force unencrypted MyParcel connection
181
+ "TIG_MyParcel2014::By enabling this, you will force connection to the MyParcel platform over unsecured http, rather than https.","By enabling this, you will force connection to the MyParcel platform over unsecured http, rather than https."
182
+ "TIG_MyParcel2014::In some cases the SSL certification can't be validated, which can lead to problems connection to the MyParcel platform. Only use this if you are aware that ALL communication to MyParcel will be sent over the unsecure https protocol.","In some cases the SSL certification can't be validated, which can lead to problems connection to the MyParcel platform. Only use this if you are aware that ALL communication to MyParcel will be sent over the unsecure https protocol."
183
+ TIG_MyParcel2014::Unfortunately no locations could be found. Please check your postcode and house number combination.,Unfortunately no locations could be found. Please check your postcode and house number combination.
184
+ TIG_MyParcel2014::Search by zipcode and housenumber,Search by zipcode and housenumber
185
+ "TIG_MyParcel2014::Pakjegemak minimum order total, incl. BTW","Pakjegemak minimum order total, incl. BTW"
186
+ TIG_MyParcel2014::Pakjegemak minimum order total enabled,Pakjegemak minimum order total enabled
187
+ TIG_MyParcel2014::MyParcel shipping methods,MyParcel shipping methods
188
+ TIG_MyParcel2014::MyParcel Shipping,MyParcel Shipping
189
+ TIG_MyParcel2014::Selected post office location,Selected post office location
190
+ TIG_MyParcel2014::Powerd by MyParcel,Powerd by MyParcel
191
+ TIG_MyParcel2014::Business hours,Business hours
192
+ TIG_MyParcel2014::Mo,Mo
193
+ TIG_MyParcel2014::Tu,Tu
194
+ TIG_MyParcel2014::We,We
195
+ TIG_MyParcel2014::Th,Th
196
+ TIG_MyParcel2014::Fr,Fr
197
+ TIG_MyParcel2014::Sa,Sa
198
+ TIG_MyParcel2014::Su,Su
199
+ TIG_MyParcel2014::Edit,Edit
200
+ TIG_MyParcel2014::Type Consignment,Type Consignment
app/locale/nl_NL/TIG_MyParcel2014.csv CHANGED
@@ -1,149 +1,200 @@
1
- TIG_MyParcel2014::Enabled,Geactiveerd
2
- TIG_MyParcel2014::Title,Titel
3
- TIG_MyParcel2014::Method Name,Methode naam
4
- TIG_MyParcel2014::Rate Type,Tarief type
5
- TIG_MyParcel2014::Type,Type
6
- TIG_MyParcel2014::Price,Prijs
7
- TIG_MyParcel2014::Pakjegemak active,Pakjegemak actief
8
- TIG_MyParcel2014::Pakjegemak fee,Pakjegemak afhandelingskosten
9
- TIG_MyParcel2014::Condition,Voorwaarde
10
- TIG_MyParcel2014::Calculate Handling Fee,Verzendkosten berekeningswijze
11
- TIG_MyParcel2014::Handling Fee,Afhandelingskosten
12
- TIG_MyParcel2014::Ship to Applicable Countries,Verzend naar beschikbare landen
13
- TIG_MyParcel2014::Ship to Specific Countries,Verzend naar specifieke landen
14
- TIG_MyParcel2014::Sort Order,Sorteer bestelling
15
- TIG_MyParcel2014::Default Shipment Settings,Standaard verzend instellingen
16
- TIG_MyParcel2014::Home address only,Alleen huisadres
17
- TIG_MyParcel2014::Signature on receipt,Handtekening bij ontvangst
18
- TIG_MyParcel2014::Return if no answer,Retour bij niet aanwezig
19
- TIG_MyParcel2014::Insured up to &euro; 50,Verzekerd tot &euro; 50
20
- TIG_MyParcel2014::For NL shipping only,Alleen voor Nederlandse verzendingen
21
- TIG_MyParcel2014::Insured up to &euro; 250,Verzekerd tot &euro; 250
22
- "TIG_MyParcel2014::For NL shipping only, shipments outside the EU insured default is &euro; 200","Alleen voor Nederlandse verzendingen, zendingen naar landen buiten de EU zijn standaard verzekerd tot &euro; 200"
23
- TIG_MyParcel2014::Insured up to &euro; 500,Verzekerd tot &euro; 500
24
- "TIG_MyParcel2014::For NL shipping only, shipments inside the EU insured default is &euro; 500","Alleen voor Nederlandse verzendingen, zendingen naar landen binnen de EU zijn standaard verzekerd tot &euro; 500"
25
- TIG_MyParcel2014::Customs Shipment Type,Douane verzend type
26
- TIG_MyParcel2014::Customs Content HS Code,Douane goederen HS code
27
- "TIG_MyParcel2014::Default content type for Cross Domestic products, see <a href=""http://gebruikstarief.douane.nl"" target=""_blank"">http://gebruikstarief.douane.nl</a>","Standaard goederen type voor Cross Domestic producten, zie <a href=""http://gebruikstarief.douane.nl"" target=""_blank"">http://gebruikstarief.douane.nl</a>"
28
- "TIG_MyParcel2014::Fill in your preferences for a shipment. These settings will only apply for the mass actions in the order grid. When creating a single shipment, these settings can be changed manually.<br/>These settings will activate based on the order total amount. When shipping outside of the EU you can set default values for customs type and customs goods HS code.","Vul hier uw voorkeuren in voor een verzending. Dit is later per zending uiteraard nog per zending aan te passen. De verzekeringsopties worden actief op basis van het order totaal bedrag. <br/> Indien u zendingen naar landen buiten de EU verstuurt, kunt u optioneel voor deze zendingen een standaard waarde invullen bij het Douane verzendtype en de Douane goederen HS code."
29
- TIG_MyParcel2014::Retourlink e-mail Template,Retourlink e-mail Template
30
- TIG_MyParcel2014::PLACEHOLDER,PLACEHOLDER
31
- TIG_MyParcel2014::Track&amp;Trace email template,Track&amp;Trace e-mail Template
32
- "TIG_MyParcel2014::You can create a new transactional e-mail where the variables {{var tracktrace_url}} and {{var retourlabel_url}} are available. TIP: You can base them on the Order Update template, because {{var order}} is also available.","U kunt een nieuwe transactionele email aanmaken en daarin {{var tracktrace_url}} en {{var retourlabel_url}} gebruiken. Zie voor details de <a target=""_blank"" href=""http://kb.totalinternetgroup.nl/topic/98526863"">KB</a>"
33
- TIG_MyParcel2014::Print Orientation,Print ori&euml;ntatie
34
- TIG_MyParcel2014::Select a standard orientation for printing labels.,Selecteer een standaard print ori&euml;ntatie voor het printen van labels.
35
- TIG_MyParcel2014::Enable test modus,Activeer test modus
36
- TIG_MyParcel2014::Enable to test the extension,Activeer om test verzendingen te kunnen maken
37
- TIG_MyParcel2014::Enable Myparcel Extension,Activeer MyParcel extensie
38
- TIG_MyParcel2014::Enable or disable the MyParcel module.,Activeer of deactiveer de MyParcel extensie
39
- TIG_MyParcel2014::Selecting 'No' will overrule all individual settings.,"Wanneer ""nee"" is geselecteerd worden alle individuele instellingen overruled."
40
- TIG_MyParcel2014::General Settings,Algemene instellingen
41
- TIG_MyParcel2014::API Key,API Key
42
- TIG_MyParcel2014::The API Key given by MyParcel.,Stel hier de API key in die is ontvangen vanuit MyParcel
43
- TIG_MyParcel2014::API Username,API Gebruikersnaam
44
- TIG_MyParcel2014::Your MyParcel username.,Vul hier de gebruikersnaam in voor het MyParcel platform
45
- TIG_MyParcel2014::To get your personal API credentials you should contact MyParcel.,Neem contact op met MyParcel om de API gegevens te ontvangen.
46
- TIG_MyParcel2014::API settings,API Instellingen
47
- TIG_MyParcel2014::Version &amp; Support,Versie &amp; Support
48
- TIG_MyParcel2014::The log files cannot be downloaded.,De logbestanden kunnen niet gedownload worden.
49
- TIG_MyParcel2014::An error occurred while processing this action.,Er is een fout opgetreden tijdens het verwerken van deze actie.
50
- TIG_MyParcel2014::The shipments were successfully created.,De verzendingen zijn succesvol aangemaakt
51
- TIG_MyParcel2014::None of the shipments could be created. Please check the error messages for more details.,Geen van de verzendingen konden aangemaakt worden. Controleer de foutmeldingen in de logbestanden voor details.
52
- TIG_MyParcel2014::Please select one or more shipments.,Selecteer &eacute;&eacute;n of meerdere verzendingen.
53
- TIG_MyParcel2014::Please select one or more orders.,Selecteer &eacute;&eacute;n of meerdere orders.
54
- TIG_MyParcel2014::MyParcel replied with the following warnings:,MyParcel heeft geantwoord met de volgende waarschuwingen:
55
- TIG_MyParcel2014::The following shipments or orders could not be processed:,De volgende verzendingen konden niet verwerkt worden:
56
- TIG_MyParcel2014::Order #%s cannot be shipped at this time.,Order #%s kan niet verzonden worden op dit moment
57
- TIG_MyParcel2014::Invalid full street supplied: %s.,Invalide volledige straatnaam opgegeven: %s
58
- TIG_MyParcel2014::Invalid housnumber supplied: %s.,Invalide huisnummer opgegeven: %s
59
- TIG_MyParcel2014::Invalid session requested.,Invalide sessie opgevraagd
60
- TIG_MyParcel2014::Invalid message type requested: %s.,Invalide bericht-type opgevraagd: %s
61
- TIG_MyParcel2014::No message supplied.,Geen bericht meegegeven
62
- TIG_MyParcel2014::No message type supplied.,Geen bericht-type meegegeven
63
- TIG_MyParcel2014::Click here for more information from the TiG knowledgebase.,Klik hier voor meer informatie van de TIG kennisbank.
64
- TIG_MyParcel2014::An error occurred while processing your request: ,Er is een fout opgetreden tijdens het verwerken van dit verzoek:
65
- TIG_MyParcel2014::The createConsignment action is currently unavailable.,De createConsigment actie is tijdelijk niet beschikbaar
66
- TIG_MyParcel2014::Invalid createConsignment response.,Invalide createConsignment antwoord
67
- TIG_MyParcel2014::Shipping status,Verzend status
68
- TIG_MyParcel2014::MyParcel - Create Shipments,MyParcel - Cre&euml;er verzendingen
69
- TIG_MyParcel2014::MyParcel - Print shipping labels,MyParcel - Print verzend labels
70
- TIG_MyParcel2014::Download log files,Download log bestanden
71
- TIG_MyParcel2014::Unknown rate type specified: %s.,Onbekend tarief type opgegeven: %s.
72
- TIG_MyParcel2014::Flat,Plat
73
- TIG_MyParcel2014::Table,Tabel
74
- TIG_MyParcel2014::Invalid PakjeGemak address.,Invalide PakjeGemak adres.
75
- TIG_MyParcel2014::Invalid phone number.,Invalide telefoonnummer.
76
- TIG_MyParcel2014::Invalid housenumber extension.,Invalide huisnummer extensie.
77
- TIG_MyParcel2014::A4,A4
78
- TIG_MyParcel2014::A6,A6
79
- TIG_MyParcel2014::Commercial Goods,Commerciele goederen
80
- TIG_MyParcel2014::Commercial Sample,Commercieel Proef
81
- TIG_MyParcel2014::Documents,Documenten
82
- TIG_MyParcel2014::Gift,Gift
83
- TIG_MyParcel2014::Returned Goods,Retour goederen
84
- TIG_MyParcel2014::Yes,Ja
85
- TIG_MyParcel2014::No,Nee
86
- TIG_MyParcel2014::Myparcel Consignment Options,MyParcel Verzend Opties
87
- TIG_MyParcel2014::Insured amount,Verzekerd bedrag
88
- TIG_MyParcel2014::Insured,Verzekerd
89
- TIG_MyParcel2014::MyParcel version %s,MyParcel versie %s
90
- TIG_MyParcel2014::Magento &amp; 3rd party version compatibility,Magento &amp; derde partijen ondersteuning
91
- TIG_MyParcel2014::Magento Community Edition version,Magento Community Edition versie
92
- TIG_MyParcel2014::Magento Enterprise Edition version,Magento Enterprise Edition versie
93
- TIG_MyParcel2014::Idev's OneStepCheckout version,Idev's OneStepCheckout versie
94
- "TIG_MyParcel2014::If you wish to use this extension on an unsupported Magento version or edition, or in combination with an unsupported 3rd party extension, we cannot guarantee the MyParcel extension will function as expected. For questions please contact the Total Internet Group servicedesk.","Indien u de extensie wilt gebruiken op een niet-ondersteunde versie of editie van Magento, of als u de extensie wilt gebruiken samen met een 3rd party extensie die niet ondersteund wordt, kunnen wij niet garanderen dat de MyParcel extensie feilloos zal functioneren. Voor vragen kunt u contact opnemen met MyParcel."
95
- TIG_MyParcel2014::Support,Ondersteuning
96
- TIG_MyParcel2014::The extension is developed by Total Internet Group.,Deze extensie is ontwikkeld door Total Internet Group.
97
- TIG_MyParcel2014::MyParcel account questions and information,MyParcel account vragen en informatie
98
- "TIG_MyParcel2014::For questions related to your MyParcel account,please contact MyParcel.","Voor vragen gerelateerd aan uw MyParcel account, neemt u contact op met MyParcel."
99
- TIG_MyParcel2014::Phone,Telefoon
100
- TIG_MyParcel2014::Extension support and configuration questions,Extensie ondersteuning en configuratie vragen
101
- "TIG_MyParcel2014::For configuration problems, extension conflicts and bugs contact Total Internet Group.","Voor configuratie problemen, extensie conflicten en bugs, neem contact op met Total Internet Group."
102
- TIG_MyParcel2014::Online knowledgebase,Online kennisbank
103
- TIG_MyParcel2014::Request help directly,Vraag direct hulp
104
- TIG_MyParcel2014::Email,E-mail
105
- TIG_MyParcel2014::Documentation,Documentatie
106
- TIG_MyParcel2014::A list of documents regarding the extension.,Een lijst met document aangaande de extensie.
107
- TIG_MyParcel2014::View the installation and configuration manual.,Bekijk de installatie en configuratie handleiding.
108
- TIG_MyParcel2014::Installation and configuration manual,Installatie en configuratie handleiding
109
- TIG_MyParcel2014::View the user manual.,Bekijk de gebruikers handleiding
110
- TIG_MyParcel2014::User manual,Gebruikers handleiding
111
- TIG_MyParcel2014::View the complete changelog of the extension.,Bekijk de volledige release notes van de extensie
112
- TIG_MyParcel2014::Full changelog,Volledige release notes
113
- TIG_MyParcel2014::MyParcel PgAddress class missing.,MyParcel PgAddress class mist
114
- TIG_MyParcel2014::Select a transactional e-mail template to send the retourlink,Selecteer een transactionele e-mail template om de retourlink te verzenden.
115
- TIG_MyParcel2014::Select a transactional e-mail template to send the barcode,Selecteer een transactionele e-mail template om de Track&amp;Trace code te versturen
116
- TIG_MyParcel2014::You can create a new transactional e-mail where the variables {{var retourlink}} is available.,"Maak een transactionele e-mail aan, daarin zal de variabele {{var retourlink}} beschikbaar zijn om te retourlink te verzenden."
117
- TIG_MyParcel2014::Unable to send track and trace email for shipment #,Versturen van track & trace e-mail mislukt voor zending #
118
- TIG_MyParcel2014::Track&amp;Trace e-mail is send: %s,Track & Trace e-mail is verzonden: %s
119
- TIG_MyParcel2014::Credit Consignment,Crediteer zending
120
- TIG_MyParcel2014::Generate Retourlink,Genereer Retourlabel
121
- TIG_MyParcel2014::Retourlink generated: %s,Retourlink aangemaakt: %s
122
- "TIG_MyParcel2014::Credit has not been created, check MyParcel backend for details","Credit is niet aangemaakt, zie MyParcel backend voor meer informatie."
123
- TIG_MyParcel2014::Consignment %s is credited at MyParcel,Zending %s is gecrediteerd bij MyParcel.
124
- "TIG_MyParcel2014::If you do not use split street lines and you wish to ship to outside the EU, there is a strong possibility that MyParcel will be unable to properly parse the address. This may result in the shipment being refused or it may even lead to the shipment being delivered at the wrong address!","Als je adresgegevens niet opsplitst en je stuurt zendingen naar buiten de EU, dan is er een mogelijkheid dat MyParcel het adres niet kan omzetten. Dit kan leiden tot zendingen die geweigerd worden of zelfs niet afgeleverd kunnen worden."
125
- TIG_MyParcel2014::Split street parts,Deel straatnaam velden op
126
- TIG_MyParcel2014::Streetname field,Straatnaam veld
127
- TIG_MyParcel2014::Housenr. field,Huisnummer veld
128
- TIG_MyParcel2014::Split house number parts,Deel huisnummervelden op
129
- TIG_MyParcel2014::Housenr. extension field,Huisnr. extensie veld
130
- TIG_MyParcel2014::Street line #%s,Adresregel #%s
131
- TIG_MyParcel2014::This will be added to the regular shipping price,Dit zal bij de normale verzendkosten worden opgeteld
132
- TIG_MyParcel2014::Default shipment type for Cross Domestic shipments,Standaard verzend inhoud voor Cross Domestic verzendingen
133
- "TIG_MyParcel2014::When changing the address, you need to cancel the current MyParcel shipment(s) linked to this order and create new MyParcel shipments.","Wanneer het adres gewijzigd wordt, bent u genoodzaakt om de gekoppelde MyParcel verzendingen te crediteren en nieuwe MyParcel verzendingen aan te maken."
134
- "TIG_MyParcel2014::To download the instructions for the MyParcel Magento extension, click <a target=""_blank"" href=""%s"">here</a>.","Klik <a target=""_blank"" href=""%s"">hier</a> om de handleiding van de MyParcel Magento extensie te downloaden."
135
- TIG_MyParcel2014::When using the extension please note:,Aandachtspunten bij het gebruik van deze extensie:
136
- TIG_MyParcel2014::To be able to configure the extension you need to possess and use an active MyParcel account.,U dient een actief MyParcel account te hebben om de extensie te kunnen configureren.
137
- "TIG_MyParcel2014::During the transition phase the old Magento MyParcel extension can remain active. However, you do need to turn off PakjeGemak in the old MyParcel extension.",Indien u de oude MyParcel extensie gebruikt kan deze actief blijven in de overgangsfase. Wel dient u PakjeGemak in de oude MyParcel extensie uit te schakelen.
138
- TIG_MyParcel2014::We cannot guarantee perfect functionality of the MyParcel extension when you intend to use the extension on a version of Magento that is not supported or when you intend to use the extension together with a 3rd part extension that is not supported. If you have any questions please contact MyParcel.,"Indien u de extensie wilt gebruiken op een niet-ondersteunde versie of editie van Magento, of als u de extensie wilt gebruiken samen met een 3rd party extensie die niet ondersteund wordt, kunnen wij niet garanderen dat de MyParcel extensie feilloos zal functioneren. Voor vragen kunt u contact opnemen met MyParcel."
139
- TIG_MyParcel2014::Installation and configuration instructions,Installatie en configuratie handleiding
140
- TIG_MyParcel2014::Overview articles in knowledge base,Bekijk alle kennisbank artikelen
141
- TIG_MyParcel2014::This extension has been developed by Total Internet Group.,Deze extensie is ontwikkeld door Total Internet Group.
142
- TIG_MyParcel2014::Questions and information about your MyParcel account,MyParcel account vragen en informatie
143
- "TIG_MyParcel2014::For configuration problems, extension conflicts or bugs, please contact Total Internet Group.","Voor configuratie problemen, extensie conflicten en bugs, neem contact op met Total Internet Group."
144
- "TIG_MyParcel2014::Shipments will not be delivered at the neighbours, only on house address.","Zendingen worden niet bij de buren aangeboden, alleen op huisadres."
145
- TIG_MyParcel2014::Shipments will not go the a pickup point but will be returned directly after multiple delivery attempts.,Zendingen gaan niet naar een afhaallocatie en komen direct retour na bezorgpogingen.
146
- TIG_MyParcel2014::Unable to save check_status cron expression: %s,Het is niet gelukt om de check_status cron expressie op te slaan: %s
147
- TIG_MyParcel2014::Some of the shipments could not be created or could not be created at MyParcel from the selected orders. See below for detailed information.,Een aantal van de geselecteerde orders is een foutmelding opgetreden tijdens het aanmaken van de verzending. Zie hieronder voor gedetailleerde informatie.
148
- TIG_MyParcel2014::Select A4 print start position,Selecteer de A4 print start positie
149
- "TIG_MyParcel2014::Select content type for Cross Domestic products, see <a href=""http://gebruikstarief.douane.nl"" target=""_blank"">http://gebruikstarief.douane.nl</a>","Vul de goederen code voor zendingen buiten de EU in, zie <a href=""http://gebruikstarief.douane.nl"" target=""_blank"">http://gebruikstarief.douane.nl</a> voor de bestaande codes."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ TIG_MyParcel2014::Enabled,Geactiveerd
2
+ TIG_MyParcel2014::Title,Titel
3
+ TIG_MyParcel2014::Method Name,Methode naam
4
+ TIG_MyParcel2014::Rate Type,Tarief type
5
+ TIG_MyParcel2014::Type,Type
6
+ TIG_MyParcel2014::Price,Prijs
7
+ TIG_MyParcel2014::Pakjegemak active,Pakjegemak actief
8
+ TIG_MyParcel2014::Pakjegemak fee,Pakjegemak afhandelingskosten
9
+ TIG_MyParcel2014::Condition,Voorwaarde
10
+ TIG_MyParcel2014::Calculate Handling Fee,Verzendkosten berekeningswijze
11
+ TIG_MyParcel2014::Handling Fee,Afhandelingskosten
12
+ TIG_MyParcel2014::Ship to Applicable Countries,Verzend naar beschikbare landen
13
+ TIG_MyParcel2014::Ship to Specific Countries,Verzend naar specifieke landen
14
+ TIG_MyParcel2014::Sort Order,Sorteer bestelling
15
+ TIG_MyParcel2014::Default Shipment Settings,Standaard verzend instellingen
16
+ TIG_MyParcel2014::Home address only,Alleen huisadres
17
+ TIG_MyParcel2014::Signature on receipt,Handtekening bij ontvangst
18
+ TIG_MyParcel2014::Return if no answer,Retour bij niet aanwezig
19
+ TIG_MyParcel2014::Insured up to &euro; 50,Verzekerd tot &euro; 50
20
+ TIG_MyParcel2014::For NL shipping only,Alleen voor Nederlandse verzendingen
21
+ TIG_MyParcel2014::Insured up to &euro; 250,Verzekerd tot &euro; 250
22
+ "TIG_MyParcel2014::For NL shipping only, shipments outside the EU insured default is &euro; 200","Alleen voor Nederlandse verzendingen, zendingen naar landen buiten de EU zijn standaard verzekerd tot &euro; 200"
23
+ TIG_MyParcel2014::Insured up to &euro; 500,Verzekerd tot &euro; 500
24
+ "TIG_MyParcel2014::For NL shipping only, shipments inside the EU insured default is &euro; 500","Alleen voor Nederlandse verzendingen, zendingen naar landen binnen de EU zijn standaard verzekerd tot &euro; 500"
25
+ TIG_MyParcel2014::Customs Shipment Type,Douane verzend type
26
+ TIG_MyParcel2014::Customs Content HS Code,Douane goederen HS code
27
+ "TIG_MyParcel2014::Default content type for Cross Domestic products, see <a href=""http://gebruikstarief.douane.nl"" target=""_blank"">http://gebruikstarief.douane.nl</a>","Standaard goederen type voor Cross Domestic producten, zie <a href=""http://gebruikstarief.douane.nl"" target=""_blank"">http://gebruikstarief.douane.nl</a> voor de juiste HS code"
28
+ "TIG_MyParcel2014::Fill in your preferences for a shipment. These settings will only apply for the mass actions in the order grid. When creating a single shipment, these settings can be changed manually.<br/>These settings will activate based on the order total amount. When shipping outside of the EU you can set default values for customs type and customs goods HS code.","Vul hier uw standaard voorkeuren in voor uw verzendopties. Deze instellingen worden als default op al uw zendingen toegepast, indien van toepassing. Deze opties zijn later, per zending, uiteraard nog wel aan te passen tijdens het verwerken. <br/><br/>De opties ""Alleen huisadres"", ""Handtekening bij ontvangst"", ""Retour bij niet aanwezig"" en de verschillende verzekeringen worden actief op basis van het totale order bedrag. Bijvoorbeeld, als u bij ""Alleen huisadres"" 50 invult, dan wordt voor alle zendingen voor orders vanaf &euro;50 standaard de instelling ""Alleen huisadres"" aangevinkt. Of als u bij ""Verzekerd tot &euro; 250,-"" het getal 150 invult, dan worden alle orders vanaf &euro; 150 standaard verzekerd voor &euro; 250,- inkoopwaarde.<br/><br/>Indien u zendingen naar landen buiten de EU verstuurt, kunt u optioneel voor deze zendingen een standaard waarde invullen bij het ""Douane verzend type"" en de ""Douane goederen HS code"". Deze waardes kunt u nog aanpassen wanneer u uw zending verwerkt."
29
+ TIG_MyParcel2014::Retourlink e-mail Template,Retourlink e-mail Template
30
+ TIG_MyParcel2014::PLACEHOLDER,PLACEHOLDER
31
+ TIG_MyParcel2014::Track&Trace email template,Track&amp;Trace e-mail Template
32
+ "TIG_MyParcel2014::You can create a new transactional e-mail where the variables {{var tracktrace_url}} and {{var retourlabel_url}} are available. TIP: You can base them on the Order Update template, because {{var order}} is also available.","U kunt een nieuwe transactionele email aanmaken en daarin {{var tracktrace_url}} en {{var retourlabel_url}} gebruiken. Zie voor details de <a target=""_blank"" href=""http://kb.totalinternetgroup.nl/topic/98526863"">KB</a>"
33
+ TIG_MyParcel2014::Print Orientation,Print ori&euml;ntatie
34
+ TIG_MyParcel2014::Select a standard orientation for printing labels.,Selecteer een standaard print ori&euml;ntatie voor het printen van labels.
35
+ TIG_MyParcel2014::Enable test modus,Activeer test modus
36
+ TIG_MyParcel2014::Enable to test the extension,Activeer om test verzendingen te kunnen maken
37
+ TIG_MyParcel2014::Enable Myparcel Extension,Activeer MyParcel extensie
38
+ TIG_MyParcel2014::Enable or disable the MyParcel module.,Activeer of deactiveer de MyParcel extensie
39
+ TIG_MyParcel2014::Selecting 'No' will overrule all individual settings.,"Wanneer ""nee"" is geselecteerd worden alle individuele instellingen overruled."
40
+ TIG_MyParcel2014::General Settings,Algemene instellingen
41
+ TIG_MyParcel2014::API Key,API Key
42
+ TIG_MyParcel2014::The API Key given by MyParcel.,Stel hier de API key in die is ontvangen vanuit MyParcel
43
+ TIG_MyParcel2014::API Username,API Gebruikersnaam
44
+ TIG_MyParcel2014::Your MyParcel username.,Vul hier de gebruikersnaam in voor het MyParcel platform
45
+ TIG_MyParcel2014::To get your personal API credentials you should contact MyParcel.,Neem contact op met MyParcel om de API gegevens te ontvangen.
46
+ TIG_MyParcel2014::API settings,API Instellingen
47
+ TIG_MyParcel2014::Version &amp; Support,Versie &amp; Support
48
+ TIG_MyParcel2014::The log files cannot be downloaded.,De logbestanden kunnen niet gedownload worden.
49
+ TIG_MyParcel2014::An error occurred while processing this action.,Er is een fout opgetreden tijdens het verwerken van deze actie.
50
+ TIG_MyParcel2014::The shipments were successfully created.,De verzendingen zijn succesvol aangemaakt
51
+ TIG_MyParcel2014::None of the shipments could be created. Please check the error messages for more details.,Geen van de verzendingen konden aangemaakt worden. Controleer de foutmeldingen in de logbestanden voor details.
52
+ TIG_MyParcel2014::Please select one or more shipments.,Selecteer &eacute;&eacute;n of meerdere verzendingen.
53
+ TIG_MyParcel2014::Please select one or more orders.,Selecteer &eacute;&eacute;n of meerdere orders.
54
+ TIG_MyParcel2014::MyParcel replied with the following warnings:,MyParcel heeft geantwoord met de volgende waarschuwingen:
55
+ TIG_MyParcel2014::The following shipments or orders could not be processed:,De volgende verzendingen konden niet verwerkt worden:
56
+ TIG_MyParcel2014::Order #%s cannot be shipped at this time.,Order #%s kan niet verzonden worden op dit moment
57
+ TIG_MyParcel2014::Invalid full street supplied: %s.,Invalide volledige straatnaam opgegeven: %s
58
+ TIG_MyParcel2014::Invalid housnumber supplied: %s.,Invalide huisnummer opgegeven: %s
59
+ TIG_MyParcel2014::Invalid session requested.,Invalide sessie opgevraagd
60
+ TIG_MyParcel2014::Invalid message type requested: %s.,Invalide bericht-type opgevraagd: %s
61
+ TIG_MyParcel2014::No message supplied.,Geen bericht meegegeven
62
+ TIG_MyParcel2014::No message type supplied.,Geen bericht-type meegegeven
63
+ TIG_MyParcel2014::Click here for more information from the TiG knowledgebase.,Klik hier voor meer informatie van de TIG kennisbank.
64
+ TIG_MyParcel2014::An error occurred while processing your request: ,Er is een fout opgetreden tijdens het verwerken van dit verzoek:
65
+ TIG_MyParcel2014::The createConsignment action is currently unavailable.,De createConsigment actie is tijdelijk niet beschikbaar
66
+ TIG_MyParcel2014::Invalid createConsignment response.,Invalide createConsignment antwoord
67
+ TIG_MyParcel2014::Shipping status,Verzend status
68
+ TIG_MyParcel2014::MyParcel - Create Shipments,MyParcel - Cre&euml;er verzendingen
69
+ TIG_MyParcel2014::MyParcel - Print shipping labels,MyParcel - Print verzend labels
70
+ TIG_MyParcel2014::Download log files,Download log bestanden
71
+ TIG_MyParcel2014::Unknown rate type specified: %s.,Onbekend tarief type opgegeven: %s.
72
+ TIG_MyParcel2014::Flat,Plat
73
+ TIG_MyParcel2014::Table,Tabel
74
+ TIG_MyParcel2014::Invalid PakjeGemak address.,Invalide PakjeGemak adres.
75
+ TIG_MyParcel2014::Invalid phone number.,Invalide telefoonnummer.
76
+ TIG_MyParcel2014::Invalid housenumber extension.,Invalide huisnummer extensie.
77
+ TIG_MyParcel2014::A4,A4
78
+ TIG_MyParcel2014::A6,A6
79
+ TIG_MyParcel2014::Commercial Goods,Commerciele goederen
80
+ TIG_MyParcel2014::Commercial Sample,Commercieel Proef
81
+ TIG_MyParcel2014::Documents,Documenten
82
+ TIG_MyParcel2014::Gift,Gift
83
+ TIG_MyParcel2014::Returned Goods,Retour goederen
84
+ TIG_MyParcel2014::Yes,Ja
85
+ TIG_MyParcel2014::No,Nee
86
+ TIG_MyParcel2014::Myparcel Consignment Options,MyParcel Verzend Opties
87
+ TIG_MyParcel2014::Insured amount,Verzekerd bedrag
88
+ TIG_MyParcel2014::Insured,Verzekerd
89
+ TIG_MyParcel2014::MyParcel version %s,MyParcel versie %s
90
+ TIG_MyParcel2014::Magento &amp; 3rd party version compatibility,Magento &amp; derde partijen ondersteuning
91
+ TIG_MyParcel2014::Magento Community Edition version,Magento Community Edition versie
92
+ TIG_MyParcel2014::Magento Enterprise Edition version,Magento Enterprise Edition versie
93
+ TIG_MyParcel2014::Idev's OneStepCheckout version,Idev's OneStepCheckout versie
94
+ "TIG_MyParcel2014::If you wish to use this extension on an unsupported Magento version or edition, or in combination with an unsupported 3rd party extension, we cannot guarantee the MyParcel extension will function as expected. For questions please contact the Total Internet Group servicedesk.","Indien u de extensie wilt gebruiken op een niet-ondersteunde versie of editie van Magento, of als u de extensie wilt gebruiken samen met een 3rd party extensie die niet ondersteund wordt, kunnen wij niet garanderen dat de MyParcel extensie feilloos zal functioneren. Voor vragen kunt u contact opnemen met MyParcel."
95
+ TIG_MyParcel2014::Support,Ondersteuning
96
+ TIG_MyParcel2014::The extension is developed by Total Internet Group.,Deze extensie is ontwikkeld door Total Internet Group.
97
+ TIG_MyParcel2014::MyParcel account questions and information,MyParcel account vragen en informatie
98
+ "TIG_MyParcel2014::For questions related to your MyParcel account,please contact MyParcel.","Voor vragen gerelateerd aan uw MyParcel account, neemt u contact op met MyParcel."
99
+ TIG_MyParcel2014::Phone,Telefoon
100
+ TIG_MyParcel2014::Extension support and configuration questions,Extensie ondersteuning en configuratie vragen
101
+ "TIG_MyParcel2014::For configuration problems, extension conflicts and bugs contact Total Internet Group.","Voor configuratie problemen, extensie conflicten en bugs, neem contact op met Total Internet Group."
102
+ TIG_MyParcel2014::Online knowledgebase,Online kennisbank
103
+ TIG_MyParcel2014::Request help directly,Vraag direct hulp
104
+ TIG_MyParcel2014::Email,E-mail
105
+ TIG_MyParcel2014::Documentation,Documentatie
106
+ TIG_MyParcel2014::A list of documents regarding the extension.,Een lijst met document aangaande de extensie.
107
+ TIG_MyParcel2014::View the installation and configuration manual.,Bekijk de installatie en configuratie handleiding.
108
+ TIG_MyParcel2014::Installation and configuration manual,Installatie en configuratie handleiding
109
+ TIG_MyParcel2014::View the user manual.,Bekijk de gebruikers handleiding
110
+ TIG_MyParcel2014::User manual,Gebruikers handleiding
111
+ TIG_MyParcel2014::View the complete changelog of the extension.,Bekijk de volledige release notes van de extensie
112
+ TIG_MyParcel2014::Full changelog,Volledige release notes
113
+ TIG_MyParcel2014::MyParcel PgAddress class missing.,MyParcel PgAddress class mist
114
+ TIG_MyParcel2014::Select a transactional e-mail template to send the retourlink,Selecteer een transactionele e-mail template om de retourlink te verzenden.
115
+ TIG_MyParcel2014::Select a transactional e-mail template to send the barcode,Selecteer een transactionele e-mail template om de Track&amp;Trace code te versturen
116
+ TIG_MyParcel2014::You can create a new transactional e-mail where the variables {{var retourlink}} is available.,"Maak een transactionele e-mail aan, daarin zal de variabele {{var retourlink}} beschikbaar zijn om te retourlink te verzenden."
117
+ TIG_MyParcel2014::Unable to send track and trace email for shipment #,Versturen van track & trace e-mail mislukt voor zending #
118
+ TIG_MyParcel2014::Track&amp;Trace e-mail is send: %s,Track & Trace e-mail is verzonden: %s
119
+ TIG_MyParcel2014::Credit Consignment,Crediteer zending
120
+ TIG_MyParcel2014::Generate Retourlink,Genereer Retourlabel
121
+ TIG_MyParcel2014::Retourlink generated: %s,Retourlink aangemaakt en gemaild naar de klant. %s
122
+ "TIG_MyParcel2014::Credit has not been created, check MyParcel backend for details","Credit is niet aangemaakt, zie MyParcel backend voor meer informatie."
123
+ TIG_MyParcel2014::Consignment %s is credited at MyParcel,Zending %s is gecrediteerd bij MyParcel.
124
+ "TIG_MyParcel2014::If you do not use split street lines and you wish to ship to outside the EU, there is a strong possibility that MyParcel will be unable to properly parse the address. This may result in the shipment being refused or it may even lead to the shipment being delivered at the wrong address!","Als je adresgegevens niet opsplitst en je stuurt zendingen naar buiten de EU, dan is er een mogelijkheid dat MyParcel het adres niet kan omzetten. Dit kan leiden tot zendingen die geweigerd worden of zelfs niet afgeleverd kunnen worden."
125
+ TIG_MyParcel2014::Split street parts,Deel straatnaam velden op
126
+ TIG_MyParcel2014::Streetname field,Straatnaam veld
127
+ TIG_MyParcel2014::Housenr. field,Huisnummer veld
128
+ TIG_MyParcel2014::Split house number parts,Deel huisnummervelden op
129
+ TIG_MyParcel2014::Housenr. extension field,Huisnr. extensie veld
130
+ TIG_MyParcel2014::Street line #%s,Adresregel #%s
131
+ TIG_MyParcel2014::This will be added to the regular shipping price,Dit zal bij de normale verzendkosten worden opgeteld
132
+ TIG_MyParcel2014::Default shipment type for Cross Domestic shipments,Standaard verzend inhoud voor Cross Domestic verzendingen
133
+ "TIG_MyParcel2014::When changing the address, you need to cancel the current MyParcel shipment(s) linked to this order and create new MyParcel shipments.","Wanneer het adres gewijzigd wordt, bent u genoodzaakt om de gekoppelde MyParcel verzendingen te crediteren en nieuwe MyParcel verzendingen aan te maken."
134
+ "TIG_MyParcel2014::To download the instructions for the MyParcel Magento extension, click <a target=""_blank"" href=""%s"">here</a>.","Klik <a target=""_blank"" href=""%s"">hier</a> om de handleiding van de MyParcel Magento extensie te downloaden."
135
+ TIG_MyParcel2014::When using the extension please note:,Aandachtspunten bij het gebruik van deze extensie:
136
+ TIG_MyParcel2014::To be able to configure the extension you need to possess and use an active MyParcel account.,U dient een actief MyParcel account te hebben om de extensie te kunnen configureren.
137
+ "TIG_MyParcel2014::During the transition phase the old Magento MyParcel extension can remain active. However, you do need to turn off PakjeGemak in the old MyParcel extension.",Indien u de oude MyParcel extensie gebruikt kan deze actief blijven in de overgangsfase. Wel dient u PakjeGemak in de oude MyParcel extensie uit te schakelen.
138
+ TIG_MyParcel2014::We cannot guarantee perfect functionality of the MyParcel extension when you intend to use the extension on a version of Magento that is not supported or when you intend to use the extension together with a 3rd part extension that is not supported. If you have any questions please contact MyParcel.,"Indien u de extensie wilt gebruiken op een niet-ondersteunde versie of editie van Magento, of als u de extensie wilt gebruiken samen met een 3rd party extensie die niet ondersteund wordt, kunnen wij niet garanderen dat de MyParcel extensie feilloos zal functioneren. Voor vragen kunt u contact opnemen met MyParcel."
139
+ TIG_MyParcel2014::Installation and configuration instructions,Installatie en configuratie handleiding
140
+ TIG_MyParcel2014::Overview articles in knowledge base,Bekijk alle kennisbank artikelen
141
+ TIG_MyParcel2014::This extension has been developed by TIG.,Deze extensie is ontwikkeld door TIG.
142
+ TIG_MyParcel2014::Questions and information about your MyParcel account,MyParcel account vragen en informatie
143
+ "TIG_MyParcel2014::For configuration problems, extension conflicts or bugs, please contact TIG.","Voor configuratie problemen, extensie conflicten en bugs, neem contact op met TIG."
144
+ "TIG_MyParcel2014::Shipments will not be delivered at the neighbours, only on house address.","Zendingen worden niet bij de buren aangeboden, alleen op huisadres."
145
+ TIG_MyParcel2014::Shipments will not go the a pickup point but will be returned directly after multiple delivery attempts.,Zendingen gaan niet naar een afhaallocatie en komen direct retour na bezorgpogingen.
146
+ TIG_MyParcel2014::Unable to save check_status cron expression: %s,Het is niet gelukt om de check_status cron expressie op te slaan: %s
147
+ TIG_MyParcel2014::Some of the shipments could not be created or could not be created at MyParcel from the selected orders. See below for detailed information.,Een aantal van de geselecteerde orders is een foutmelding opgetreden tijdens het aanmaken van de verzending. Zie hieronder voor gedetailleerde informatie.
148
+ TIG_MyParcel2014::Select A4 print start position,Selecteer de A4 print start positie
149
+ "TIG_MyParcel2014::Select content type for Cross Domestic products, see <a href=""http://gebruikstarief.douane.nl"" target=""_blank"">http://gebruikstarief.douane.nl</a>","Vul de goederen code voor zendingen buiten de EU in, zie <a href=""http://gebruikstarief.douane.nl"" target=""_blank"">http://gebruikstarief.douane.nl</a> voor de bestaande codes."
150
+ TIG_MyParcel2014::Create MyParcel Consignment,Cre&euml;er MyParcel verzending
151
+ TIG_MyParcel2014::Track&amp;Trace link: %s,Track&amp;Trace link: %s
152
+ TIG_MyParcel2014::Is letter box parcel,Is brievenbuspakje
153
+ TIG_MyParcel2014::Shipment type,Zendingtype
154
+ TIG_MyParcel2014::Normal,Normaal
155
+ TIG_MyParcel2014::Letter box,Brievenbuspakje
156
+ TIG_MyParcel2014::Unstamped,Ongefrankeerd
157
+ TIG_MyParcel2014::The MyParcel consignment is successfully created.,De MyParcel zending is succesvol aangemaakt.
158
+ TIG_MyParcel2014::Choose a pickup location,Selecteer MyParcel Verzendopties
159
+ TIG_MyParcel2014::Zipcode,Postcode
160
+ "TIG_MyParcel2014::Search by zipcode, address or city","Zoek op postcode, adres of plaats"
161
+ TIG_MyParcel2014::Housenumber,Huisnummer
162
+ TIG_MyParcel2014::Search,Zoeken
163
+ TIG_MyParcel2014::Nearest myparcel pickup points,Dichtstbijzijnde afhaal locaties
164
+ TIG_MyParcel2014::Pakjegemak Method Name,Pakjegemak methode naam
165
+ TIG_MyParcel2014::Unpaid,Ongefrankeerd
166
+ TIG_MyParcel2014::The consignment is already credited.,Deze zending is al gecrediteerd.
167
+ TIG_MyParcel2014::MyParcel - Create &amp; Print shipping labels,MyParcel - Cre&euml;er &amp; Print verzend labels
168
+ TIG_MyParcel2014::Letterbox,Brievenbuspakje
169
+ TIG_MyParcel2014::Select,Selecteer
170
+ TIG_MyParcel2014::Insured Up To %s,Verzekerd tot: &euro;
171
+ TIG_MyParcel2014::Close,Sluiten
172
+ TIG_MyParcel2014::Choose a PostNL pickup location,Kies PostNL afhaallocatie
173
+ "TIG_MyParcel2014::The selected shipment-type cannot be used, Pakjegemak-shipments can only be created with the normal shipment type.","Het geselecteerde zending-type kan niet gebruikt worden, Pakjegemak zendingen kunnen enkel aangemaakt worden met het normale verzend-type."
174
+ TIG_MyParcel2014::MyParcel - Create Magento shipments (no labels),MyParcel - Cre&euml;er Magento verzendingen (geen labels)
175
+ TIG_MyParcel2014::Insured up to: &euro; %s,Verzekerd tot : &euro; %s
176
+ TIG_MyParcel2014::Post Office Address,Gekozen afhaallocatie
177
+ "TIG_MyParcel2014::The selected shipment type cannot be used. Pakjegemak shipments can only be created with the normal shipment type.<br/> The Magento shipment has been created without a MyParcel shipment, select a different shipment type or go to the shipment page to create a single MyParcel shipment. <a target=""_blank"" href=""%s"">View shipment</a>","Het geselecteerde zending type kan niet gebruikt worden. Pakjegemak zendingen kunnen enkel aangemaakt worden middels de normale verzendtype. <br/>De Magento zending is aangemaakt zonder een MyParcel zending, selecteer een ander verzend type of ga naar de Magento zending pagina en maak daar een MyParcel zending aan. <a target=""_blank"" href=""%s"">Bekijk zending</a>"
178
+ TIG_MyParcel2014::Only for dutch shipments,Alleen voor Nederlandse verzendingen
179
+ "TIG_MyParcel2014::Only for dutch shipments, shipments to outside of the EU are standard ensured up to &euro 200","Alleen voor Nederlandse verzendingen, zendingen naar landen buiten de EU zijn standaard verzekerd tot &euro; 200"
180
+ TIG_MyParcel2014::Force unencrypted MyParcel connection,Forceer unencrypted verbinding met MyParcel
181
+ "TIG_MyParcel2014::By enabling this, you will force connection to the MyParcel platform over unsecured http, rather than https.","Door dit te activeren, wordt verbinding met MyParcel geforceerd over unencrypted http verstuurd, in plaats van https."
182
+ "TIG_MyParcel2014::In some cases the SSL certification can't be validated, which can lead to problems connection to the MyParcel platform. Only use this if you are aware that ALL communication to MyParcel will be sent over the unsecure https protocol.","In sommige gevallen kan het voorkomen dat het SSL certificaat niet gevalideerd kan worden, wat kan leiden tot problemen met verbinden met het MyParcel platform. Gebruik dit enkel als ALLE communicatie met het MyParcel platform over het unencrypted http protocol moet verlopen."
183
+ TIG_MyParcel2014::Unfortunately no locations could be found. Please check your postcode and house number combination.,Helaas konden er geen locaties worden gevonden. Controleer alstublieft uw huisnummer en postcode combinatie.
184
+ TIG_MyParcel2014::Search by zipcode and housenumber,Zoek op postcode en huisnummer
185
+ "TIG_MyParcel2014::Pakjegemak minimum order total, incl. BTW","Pakjegemak minimaal order totaal, incl. BTW"
186
+ TIG_MyParcel2014::Pakjegemak minimum order total enabled,Pakjegemak minimaal order totaal geactiveerd
187
+ TIG_MyParcel2014::MyParcel shipping methods,MyParcel verzend methodes
188
+ TIG_MyParcel2014::MyParcel Shipping,MyParcel verzending
189
+ TIG_MyParcel2014::Selected post office location,Selecteer afhaallocatie
190
+ TIG_MyParcel2014::Powerd by MyParcel,Gesponsord door MyParcel
191
+ TIG_MyParcel2014::Business hours,Kantoor uren
192
+ TIG_MyParcel2014::Mo,Ma
193
+ TIG_MyParcel2014::Tu,Di
194
+ TIG_MyParcel2014::We,Wo
195
+ TIG_MyParcel2014::Th,Do
196
+ TIG_MyParcel2014::Fr,Vr
197
+ TIG_MyParcel2014::Sa,Za
198
+ TIG_MyParcel2014::Su,Zo
199
+ TIG_MyParcel2014::Edit,Wijzig
200
+ TIG_MyParcel2014::Type Consignment,Zendingtype
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>tig_myparcel</name>
4
- <version>1.1.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US">Creative Commons License</license>
7
  <channel>community</channel>
@@ -11,32 +11,39 @@
11
  &#xD;
12
  The official MyParcel extension for Magento.&#xD;
13
  &#xD;
14
- This extension allows you to ship your MyParcel shipments right from Magento. &#xD;
15
  With this extension you can:&#xD;
16
- - ship&#xD;
17
- MyParcel shippingmethod (flat rate and table rate)&#xD;
18
  - create shipments from the order-grid and directly print the shipping-lables &#xD;
19
  - create shipments with specific MyParcel options&#xD;
20
  - Generate return-links for a shipment&#xD;
21
  - Ship world-wide with MyParcel&#xD;
22
  - Send Track&amp;Trace information</description>
23
- <notes>== v1.1.4 ==&#xD;
 
 
 
 
 
 
 
 
 
24
  &#xD;
25
  - Pakjegemak extra address-validation on order detail page&#xD;
26
  &#xD;
27
  known bugs:&#xD;
28
- None. Please contact us if you find a bug. &#xD;
29
  &#xD;
30
  == v1.1.3 ==&#xD;
31
  &#xD;
32
- - Print-position overlay optimised &#xD;
33
  - New translations&#xD;
34
- - Extended logging functionality&#xD;
35
- </notes>
36
  <authors><author><name>TIG</name><user>supporttotal</user><email>servicedesk@totalinternetgroup.nl</email></author></authors>
37
- <date>2014-11-14</date>
38
- <time>11:11:14</time>
39
- <contents><target name="magecommunity"><dir name="TIG"><dir name="MyParcel2014"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="Shipment"><dir name="Create"><file name="ConsignmentOptions.php" hash="5bfc4f8b4167f0ecf8c892734b2eda4f"/></dir><file name="ShippingInfo.php" hash="7accd0b9bc08db64370f3ecee51f9ceb"/></dir><dir name="View"><file name="ShippingInfo.php" hash="2419c6171fa1a79d941dc70cb1d5a6aa"/></dir></dir></dir><dir name="System"><dir name="Config"><file name="SupportTab.php" hash="3ed95adf1523bd5a21c1fe19d61813dc"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="ShippingStatus.php" hash="cbc45c122811852bd84534d79eb2aafb"/></dir></dir></dir></dir></dir><dir name="Checkout"><file name="PgAddress.php" hash="b1a9ac7d2219b3b4f85cab5996f8c531"/></dir><file name="Pakjegemak.php" hash="9383ed277b713c5cb17c3b0ce8f343d0"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ConfigController.php" hash="999f4c9d5ee7189858836c80a754ee8e"/><file name="ShipmentController.php" hash="7fdbe522ebe44fdabe89c168539f2f8c"/></dir><file name="IndexController.php" hash="080a26652af41c2c58c42c586ad63aa5"/></dir><dir name="data"><dir name="tig_myparcel_setup"><file name="data-upgrade-0.1.0-1.1.1.php" hash="04cd4a74b8e7a2374586f2352c6716c4"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="48f98ab56dba89e6b2479b9a4cebb628"/><file name="config.xml" hash="fe75d6b65cdff273abb4d8d61cb0385f"/><file name="system.xml" hash="11af62b575e8b99fb218782bec2aa3a4"/></dir><dir name="Helper"><file name="AddressValidation.php" hash="a85c4dda15b569c42f5ba51e74fa5726"/><file name="Data.php" hash="f36a078844a4d2660392ff3e1ac300ae"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="Observer"><file name="OrderGrid.php" hash="d507f9afa01ba674c7b2a78d7dfd619a"/><file name="SystemConfig.php" hash="71e86b1d78a3a9f7667fa3370735b0e3"/></dir><dir name="Support"><file name="Logs.php" hash="aa893e95915c5366661ce456ca32c0a3"/></dir></dir><dir name="Api"><file name="MyParcel.php" hash="cca5627cfb099eb5e9e3b89762d88a41"/></dir><dir name="Carrier"><file name="MyParcel.php" hash="e45050890417ce8c3e1ca761a1157b29"/><dir name="System"><dir name="Config"><dir name="Source"><file name="RateType.php" hash="d0e2b78dc1040b1265e35d60ae2de76b"/></dir></dir></dir></dir><dir name="Observer"><file name="Cron.php" hash="ea790b89e5bd5379b0711415623b3e1d"/><file name="SaveConfig.php" hash="fe0d9d218f656b25008ae1964460528e"/><file name="SavePgAddress.php" hash="de0c427e8c3fc0dc59d028085d8b9674"/><file name="SaveShipment.php" hash="8e26215a9c690385263b0a8d704502e3"/></dir><dir name="Resource"><dir name="Order"><dir name="Grid"><file name="Collection.php" hash="48fc092078dcdbcca40788c486ca0987"/></dir></dir><file name="Setup.php" hash="300815f89f12c143a5fa2cb1f3c2b765"/><dir name="Shipment"><file name="Collection.php" hash="6af521845d88a214d283cfd3fecfbd2d"/></dir><file name="Shipment.php" hash="7c7bb4b4349da9504015a279b9ff8a4f"/></dir><file name="Shipment.php" hash="d5580552df3d49c8924238acb3536ac2"/><dir name="System"><dir name="Config"><dir name="Source"><file name="A4a6.php" hash="9233248742c79824ea8408577a9b4f2e"/><file name="Customs.php" hash="9b5c4fd3a866fdabf44a7b532b9c3501"/><file name="StreetField.php" hash="f171261f2d8785ebf41f19d2bfeb7d58"/><file name="Yesno.php" hash="0c49e0c17e933924d25ffe823e2dab16"/></dir></dir></dir></dir><dir name="sql"><dir name="tig_myparcel_setup"><file name="install-0.1.0.php" hash="6f0adc84b58a049b000997cec80946a3"/></dir></dir><file name="Exception.php" hash="17fbabfc37a1872da197dda8ae31eaad"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="TIG"><file name="tig_myparcel.xml" hash="8a2005f2eee524a02af7bc523b868965"/></dir></dir><dir name="template"><dir name="TIG"><dir name="MyParcel2014"><dir name="sales"><dir name="order"><dir name="address"><file name="warning.phtml" hash="fd5bf39bc5bf1ff6e79c41cad00de14b"/></dir><file name="mass_actions.phtml" hash="59eaa0ffec5b3eaf528a6101d1b4f6f1"/><dir name="shipment"><dir name="create"><file name="consignment_options.phtml" hash="88fcdcea5734d77ec6318b2d77fe74a1"/></dir><file name="shipping_info.phtml" hash="f34cbcc5f5ff2b65de6cc8f1473df530"/></dir><dir name="view"><file name="shipping_info.phtml" hash="e6e8ca0fa33e940b00c5c4c138c55bac"/></dir></dir></dir><dir name="system"><dir name="config"><file name="edit.phtml" hash="3b3728e61a547322258ee4fd0026b271"/><file name="supportTab.phtml" hash="24145a6786819ec62e52df469bfb5fc6"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="TIG"><file name="tig_myparcel.xml" hash="a42a9dc6a24fe8572c8e1038cea3c630"/></dir></dir><dir name="template"><dir name="TIG"><dir name="MyParcel2014"><dir name="checkout"><file name="pg_address.phtml" hash="91808db0c3bdd7c1c3ce5c04c04dd04c"/></dir><dir name="onestepcheckout"><file name="shipping_method.phtml" hash="ec8cf315f3ca86dd4d97750fd04af42a"/></dir><file name="pakjegemak.phtml" hash="2bf073793e34ec86a6ab523ef1a5507b"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="TIG_MyParcel2014.xml" hash="ea5b922031b3e792a2b381903077e66f"/></dir></target><target name="magelocale"><dir name="en_US"><file name="TIG_MyParcel2014.csv" hash="fa60245119132612d19229349ab10e1c"/></dir><dir name="nl_NL"><file name="TIG_MyParcel2014.csv" hash="c7519311efa10f64d6437801c4ff4050"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="TIG"><dir name="MyParcel2014"><file name="styles.css" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="system_config_edit.css" hash="429c1a64ac62e62ab80915236e6400cf"/><file name="system_config_edit_myparcel.css" hash="8845190193d237aaacfdf8963a4e572b"/><file name="system_config_edit_myparcel_magento16.css" hash="f9a8479639e2fe8d0da9cf602b1607c3"/></dir></dir></dir><dir name="images"><dir name="TIG"><dir name="MyParcel2014"><file name="bkg_tooltip.png" hash="56cfed3ed8a65b19f8de88946d1a0a01"/><file name="btn_download_icon.png" hash="142d5ebbe43ad09dde97cd32e1ef4303"/><file name="glyph_error.gif" hash="a138b803d772f552aa2e49e1c506edbd"/><file name="glyph_info.gif" hash="40f72d28be63ecf2b6ef44c7ea730104"/><file name="glyph_manual.png" hash="771db63b6ffc9de1c06da564796adc6e"/><file name="glyph_pdf.png" hash="a5ea929f4014a88d7320d0293913ace3"/><file name="glyph_success.gif" hash="465a056a3ba3d94367f51c3c0b751391"/><file name="glyph_warning.gif" hash="fa817cb6d49efb9855942ef2b739fc6c"/><file name="icon-tooltip.png" hash="5767601cd66b23d0b6fe8defc10dd48d"/><file name="legend.gif" hash="d8fb0642901868d489d31b426f3e3406"/><file name="logo_myparcel.png" hash="73b50ec4d9d63d1b4ee4822b8b5f4964"/><file name="logo_myparcel_19.png" hash="8b7463a2911050419d97b24890732472"/><file name="logo_myparcel_38.png" hash="20e50f897cd8a4133e15629a10a1fea2"/><file name="tig_logo_medium.gif" hash="3e1071908cfdb7b472438482c3331ac7"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="js"><dir name="TIG"><dir name="MyParcel2014"><file name="pg_address.js" hash="0d1120a7b62b2456f67a4b6ebb0254ba"/></dir></dir></dir></dir></dir></dir></target></contents>
40
  <compatible/>
41
- <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
42
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>tig_myparcel</name>
4
+ <version>1.3.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US">Creative Commons License</license>
7
  <channel>community</channel>
11
  &#xD;
12
  The official MyParcel extension for Magento.&#xD;
13
  &#xD;
14
+ This extension allows you to ship your MyParcel shipments right from Magento.&#xD;
15
  With this extension you can:&#xD;
16
+ - ship MyParcel shippingmethod (flat rate and table rate)&#xD;
 
17
  - create shipments from the order-grid and directly print the shipping-lables &#xD;
18
  - create shipments with specific MyParcel options&#xD;
19
  - Generate return-links for a shipment&#xD;
20
  - Ship world-wide with MyParcel&#xD;
21
  - Send Track&amp;Trace information</description>
22
+ <notes>==== 1.3.0 ====&#xD;
23
+ ==== New features ====&#xD;
24
+ - Shipping methods connected to MyParcel&#xD;
25
+ - Minimal order price PakjeGemak&#xD;
26
+ - Labels printing via shipping overview&#xD;
27
+ &#xD;
28
+ ==== Bug fixes ====&#xD;
29
+ - Various bugs fixed&#xD;
30
+ &#xD;
31
+ == v1.1.4 ==&#xD;
32
  &#xD;
33
  - Pakjegemak extra address-validation on order detail page&#xD;
34
  &#xD;
35
  known bugs:&#xD;
36
+ None. Please contact us if you find a bug.&#xD;
37
  &#xD;
38
  == v1.1.3 ==&#xD;
39
  &#xD;
40
+ - Print-position overlay optimised&#xD;
41
  - New translations&#xD;
42
+ - Extended logging functionality</notes>
 
43
  <authors><author><name>TIG</name><user>supporttotal</user><email>servicedesk@totalinternetgroup.nl</email></author></authors>
44
+ <date>2015-09-09</date>
45
+ <time>13:38:02</time>
46
+ <contents><target name="magecommunity"><dir name="TIG"><dir name="MyParcel2014"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="Shipment"><dir name="Create"><file name="ConsignmentOptions.php" hash="fdf0ec9cf1e5ada2c89638392d5a4106"/></dir><file name="ShippingInfo.php" hash="a95276d5b85a3cc2ec515fa944a34337"/></dir><dir name="View"><file name="ShippingInfo.php" hash="7e0ffdedc1cab6870991cbb7e7f752fc"/></dir></dir></dir><dir name="System"><dir name="Config"><file name="AdminSecure.php" hash="b223e97b8822fb4a1242157378661689"/><file name="Hidden.php" hash="98e74d07fb637d7cbac3eed14a55b378"/><file name="SupportTab.php" hash="3ed95adf1523bd5a21c1fe19d61813dc"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><dir name="Shipment"><file name="ShippingStatus.php" hash="6250677ea5d6e6b36be23cdc6d21c151"/></dir><file name="ShippingStatus.php" hash="6a9bfdfcac2b362f6797186f94467115"/></dir></dir></dir></dir></dir><dir name="Checkout"><file name="Js.php" hash="2fcda151238c8bf53d8c0bcd25b2859a"/><file name="PgAddress.php" hash="b1a9ac7d2219b3b4f85cab5996f8c531"/><file name="Progress.php" hash="ff8ec8b6512b5785dd621366a06856de"/></dir></dir><file name="Exception.php" hash="17fbabfc37a1872da197dda8ae31eaad"/><dir name="Helper"><file name="AddressValidation.php" hash="a85c4dda15b569c42f5ba51e74fa5726"/><file name="Data.php" hash="8e8524b060c84e5a2514f212be6d329b"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="Observer"><file name="OrderGrid.php" hash="1dc3c89a1e99cf3b15600b5d2b9383cd"/><file name="ShipmentGrid.php" hash="a68ea668bf9298fb1121c4bffe45d919"/><file name="SystemConfig.php" hash="71e86b1d78a3a9f7667fa3370735b0e3"/><file name="ViewShipment.php" hash="7074926de0d2273fc1ca8024c6737baa"/></dir><dir name="Support"><file name="Logs.php" hash="8678ec28f8a98cf2bd6b5625dc55ac15"/></dir></dir><dir name="Api"><file name="Curl.php" hash="f006338a00df9cef0485a647bfefaca6"/><file name="MyParcel.php" hash="32b8c1b8442926751ca9b8acfa9359c1"/></dir><dir name="Carrier"><file name="MyParcel.php" hash="56d1cce86bbd2193e9122cd17b724681"/><dir name="System"><dir name="Config"><dir name="Source"><file name="RateType.php" hash="d0e2b78dc1040b1265e35d60ae2de76b"/></dir></dir></dir></dir><dir name="Checkout"><file name="Service.php" hash="73e0c2c9ff1512a1c927093e200cfed2"/><file name="Validate.php" hash="f411737f90a793ba75c18092cb2f1248"/></dir><dir name="Observer"><file name="Cron.php" hash="ea790b89e5bd5379b0711415623b3e1d"/><file name="SaveConfig.php" hash="3804317337df37ce33615280f6c3677b"/><file name="SavePgAddress.php" hash="b07e42bda2318a7272a48a52480dccc0"/><file name="SaveShipment.php" hash="a70cef74590a4952af19944a1e7bf502"/></dir><dir name="Resource"><dir name="Order"><dir name="Grid"><file name="Collection.php" hash="48fc092078dcdbcca40788c486ca0987"/></dir></dir><file name="Setup.php" hash="b16d3f9146b6544c1f90ff8e218b52bb"/><dir name="Shipment"><file name="Collection.php" hash="6af521845d88a214d283cfd3fecfbd2d"/><dir name="Grid"><file name="Collection.php" hash="52886710560d83ced9224c93c0e6489c"/></dir></dir><file name="Shipment.php" hash="7c7bb4b4349da9504015a279b9ff8a4f"/></dir><file name="Shipment.php" hash="fd15fb02034a52915d674e059d0d2056"/><dir name="System"><dir name="Config"><dir name="Source"><file name="A4a6.php" hash="9233248742c79824ea8408577a9b4f2e"/><file name="Customs.php" hash="9b5c4fd3a866fdabf44a7b532b9c3501"/><file name="ShippingMethods.php" hash="ee471d016cf4df58467e21620bbd680c"/><file name="StreetField.php" hash="f171261f2d8785ebf41f19d2bfeb7d58"/><file name="Yesno.php" hash="0c49e0c17e933924d25ffe823e2dab16"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ConfigController.php" hash="9ceac2b4384a27d9d12c934b30d6a1cc"/><file name="ShipmentController.php" hash="0b25ca4791e181e3fc50c0bf143ef4f1"/></dir><file name="CheckoutController.php" hash="b62b65440631e6bc5d80d59b84c3f4df"/></dir><dir name="data"><dir name="tig_myparcel_setup"><file name="data-upgrade-0.1.0-1.1.1.php" hash="04cd4a74b8e7a2374586f2352c6716c4"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="48f98ab56dba89e6b2479b9a4cebb628"/><file name="config.xml" hash="40561b0cb1b716876949a40f89b101bd"/><file name="system.xml" hash="9cc7401f0addb375843efeacb5ed232d"/></dir><dir name="sql"><dir name="tig_myparcel_setup"><file name="install-0.1.0.php" hash="6f0adc84b58a049b000997cec80946a3"/><file name="upgrade-1.1.4-1.2.0.php" hash="03f749e474005d691c8ecafa07f91deb"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="TIG_MyParcel2014.xml" hash="ea5b922031b3e792a2b381903077e66f"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="TIG"><file name="tig_myparcel.xml" hash="a944d8cfb23ade9b64dd6299a9f91cf5"/></dir></dir><dir name="template"><dir name="TIG"><dir name="MyParcel2014"><dir name="sales"><dir name="order"><dir name="address"><file name="warning.phtml" hash="fd5bf39bc5bf1ff6e79c41cad00de14b"/></dir><file name="mass_actions.phtml" hash="6a24b4431dac3412a9240bd8b68539b3"/><dir name="shipment"><dir name="create"><file name="consignment_options.phtml" hash="b32b4f46b7985c5285c71c9a7c028baf"/></dir><file name="mass_actions.phtml" hash="db772f2c96dc31f41649762e7663d5d6"/><file name="shipping_info.phtml" hash="3ff875c048e2288a687362973832baaf"/></dir><dir name="view"><file name="shipping_info.phtml" hash="e6e8ca0fa33e940b00c5c4c138c55bac"/></dir></dir></dir><dir name="system"><dir name="config"><file name="edit.phtml" hash="3b3728e61a547322258ee4fd0026b271"/><file name="supportTab.phtml" hash="bd4e2c8d1496236c240e3356f3a2205e"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="TIG"><file name="tig_myparcel.xml" hash="8022c6c45dbb88195a951120dfd347c0"/></dir></dir><dir name="template"><dir name="TIG"><dir name="MyParcel2014"><dir name="checkout"><dir name="idev_onestepcheckout"><file name="js.phtml" hash="87965f66a877a3ed093642e2e94c54ea"/></dir><dir name="onepage"><file name="js.phtml" hash="b3861e23ba7a743d414e6e645dd6ea36"/><dir name="progress"><file name="pakje_gemak.phtml" hash="f08a5b6e16bc52bf6c605cb5189d9bf2"/></dir><file name="progress.phtml" hash="536f7f1d1d8bbdae7baac74267201f73"/></dir><file name="pg_address.phtml" hash="91808db0c3bdd7c1c3ce5c04c04dd04c"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="TIG"><dir name="MyParcel2014"><file name="prototype_windows_themes_magento.css" hash="c1cfaf8dca98f8e18e2b83dc8e9f216d"/><file name="styles.css" hash="7c8cc3f0ea1f8b9bbaeb9ebaf7f91f9c"/><file name="system_config_edit.css" hash="429c1a64ac62e62ab80915236e6400cf"/><file name="system_config_edit_myparcel.css" hash="4ca2ff19c68359ebaf3750239da2bcc7"/><file name="system_config_edit_myparcel_magento16.css" hash="f9a8479639e2fe8d0da9cf602b1607c3"/></dir></dir></dir><dir name="images"><dir name="TIG"><dir name="MyParcel2014"><file name="bkg_tooltip.png" hash="56cfed3ed8a65b19f8de88946d1a0a01"/><file name="btn_download_icon.png" hash="142d5ebbe43ad09dde97cd32e1ef4303"/><file name="glyph_error.gif" hash="a138b803d772f552aa2e49e1c506edbd"/><file name="glyph_info.gif" hash="40f72d28be63ecf2b6ef44c7ea730104"/><file name="glyph_manual.png" hash="771db63b6ffc9de1c06da564796adc6e"/><file name="glyph_pdf.png" hash="a5ea929f4014a88d7320d0293913ace3"/><file name="glyph_success.gif" hash="465a056a3ba3d94367f51c3c0b751391"/><file name="glyph_warning.gif" hash="fa817cb6d49efb9855942ef2b739fc6c"/><file name="icon-tooltip.png" hash="5767601cd66b23d0b6fe8defc10dd48d"/><file name="legend.gif" hash="d8fb0642901868d489d31b426f3e3406"/><file name="logo_myparcel.png" hash="73b50ec4d9d63d1b4ee4822b8b5f4964"/><file name="logo_myparcel_19.png" hash="8b7463a2911050419d97b24890732472"/><file name="logo_myparcel_38.png" hash="20e50f897cd8a4133e15629a10a1fea2"/><dir name="magento"><file name="btn_bg.gif" hash="37c51a4d48a92da9648dcd3ca011039f"/><file name="content_bg.gif" hash="21278ea0da2d4256f4ced96b6080ba2e"/><file name="top_bg.gif" hash="26f28090de87d64f9b01bf624f89bfe2"/><file name="window_close.png" hash="3af14f053f360bf31f8ba2df73ec7f1e"/></dir><file name="tig_logo_medium.gif" hash="3e1071908cfdb7b472438482c3331ac7"/><file name="tig_logo_medium.png" hash="ae24176891a64b6dcf1fa4b34326757a"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="TIG"><dir name="MyParcel2014"><file name="checkout.css" hash="621cd2a44f1b3d7a4946e834ed589ffe"/></dir></dir></dir><dir name="images"><dir name="TIG"><dir name="MyParcel"><dir name="checkout"><file name="loader_mini.gif" hash="f244ab6581d4329e3dbb7e289d47dfb2"/><file name="logo_myparcel.png" hash="73b50ec4d9d63d1b4ee4822b8b5f4964"/><file name="logo_postnl.png" hash="6fa95b3a5e83b6887848b5feb7369bf1"/></dir></dir></dir></dir><dir name="js"><dir name="TIG"><dir name="MyParcel2014"><file name="MutationObserver.js" hash="0ce653eab6a6aa85e827da86ddb71c2c"/><file name="checkout.js" hash="db71dd5e28bdb04a67c6a5828ca3911c"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="nl_NL"><file name="TIG_MyParcel2014.csv" hash="7fb3f019d5dc718ceff86a8f37e3a36c"/></dir><dir name="en_US"><file name="TIG_MyParcel2014.csv" hash="e4a40f0acab2a1952cf3727ce395f6ac"/></dir></target></contents>
47
  <compatible/>
48
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
49
  </package>
skin/adminhtml/default/default/css/TIG/MyParcel2014/prototype_windows_themes_magento.css ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento Enterprise Edition
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Magento Enterprise Edition End User License Agreement
7
+ * that is bundled with this package in the file LICENSE_EE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://www.magento.com/license/enterprise-edition
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to license@magento.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future. If you wish to customize Magento for your
18
+ * needs please refer to http://www.magento.com for more information.
19
+ *
20
+ * @category design
21
+ * @package default_default
22
+ * @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
23
+ * @license http://www.magento.com/license/enterprise-edition
24
+ */
25
+ .dialog { border:1px solid #555; }
26
+ .dialog .bot { display:none !important; }
27
+ .overlay_magento { background-color:#000; filter:alpha(opacity=60); -moz-opacity:.6; opacity:.6; -webkit-opacity:.6; }
28
+ .top.table_window { border-bottom:1px solid #e6e6e6; background:#6a838b url(../../../images/TIG/MyParcel2014/magento/top_bg.gif) 0 100% repeat-x; }
29
+
30
+ .magento_nw { width:6px; height:28px; }
31
+ .magento_n { height:28px; }
32
+ .magento_ne { width:6px; height:28px; }
33
+
34
+ .magento_w { width:6px; }
35
+ .magento_e { width:6px; }
36
+ .magento_w,
37
+ .magento_e,
38
+ .magento_content { background: #fafafa url(../../../images/TIG/MyParcel2014/magento/content_bg.gif) 0 0 repeat-x; }
39
+
40
+ .magento_sw { background:#deebf0; width:5px; height:3px; }
41
+ .magento_s { background:#deebf0; height:3px; }
42
+ .magento_se,
43
+
44
+ .magento_sizer { background:#deebf0; width:5px; height:3px; }
45
+ .magento_sizer { cursor:se-resize; }
46
+
47
+ .magento_close { width:16px; height:16px; background:url(../../../images/TIG/MyParcel2014/magento/window_close.png) no-repeat 0 0; position:absolute; top:5px; right:7px; cursor:pointer; z-index:1000; }
48
+ .magento_minimize { width:16px; height:16px; position:absolute; top:5px; right:28px; cursor:pointer; z-index:1000; }
49
+ .magento_maximize { width:16px; height:16px; position:absolute; top:5px; right:49px; cursor:pointer; z-index:1000; }
50
+
51
+ .magento_title { float:left; width:100%; font:bold 12px/28px Arial, Helvetica, sans-serif; color:#fff; text-align:left; }
52
+
53
+ .magento_content { overflow:auto; font-size:12px; }
54
+ .magento_content,
55
+ .magento_content label { color:#333; font-family:Arial, sans-serif; }
56
+
57
+ .magento_buttons { padding:10px; text-align:right; }
58
+ .magento_buttons input.button { border-width:1px; border-style:solid; border-color:#ed6502 #a04300 #a04300 #ed6502; background:#ffac47 url(../../../images/TIG/MyParcel2014/magento/btn_bg.gif) 0 100% repeat-x; padding:0 7px 1px 7px; font:bold 12px/18px Arial, Helvetica, sans-serif; color:#fff; cursor:pointer; text-align:center; white-space:nowrap; }
59
+
60
+ /* FOR IE */
61
+ * html .magento_close { background-image:none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../../../images/TIG/MyParcel2014/magento/window_maximize.png", sizingMethod="crop"); }
62
+ * html .magento_minimize { background-image:none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../../../images/TIG/MyParcel2014/magento/window_close.png", sizingMethod="crop");}
63
+ * html .magento_maximize { background-image:none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../../../images/TIG/MyParcel2014/magento/window_minimize.png", sizingMethod="crop"); }
skin/adminhtml/default/default/css/TIG/MyParcel2014/styles.css CHANGED
@@ -0,0 +1 @@
 
1
+ #tig_myparcel_consignment_options {margin:20px 0;}
skin/adminhtml/default/default/css/TIG/MyParcel2014/system_config_edit_myparcel.css CHANGED
@@ -13,8 +13,10 @@
13
  #tig_myparcel_myparcel_support a.link { display: inline-block; height: 16px; line-height: 16px; padding: 0 0 0 21px; background:url(../../../images/btn_go.gif) no-repeat 0 40%; }
14
  #tig_myparcel_myparcel_support .text-box { background:#fff; padding:9px 16px; margin:6px 0 10px; border:1px solid #ccc; }
15
  #tig_myparcel_myparcel_support table.contact { margin:0 0 25px -1px; }
16
- #tig_myparcel_myparcel_support table.contact td { padding:0; }
17
- #tig_myparcel_myparcel_support table.contact td.first { width:150px; padding-right:5px; }
 
 
18
 
19
  /* Legend */
20
  #tig_myparcel_myparcel_support #legend li { background:url(../../../images/TIG/MyParcel2014/legend.gif) 0 0 no-repeat; padding-left:14px; }
13
  #tig_myparcel_myparcel_support a.link { display: inline-block; height: 16px; line-height: 16px; padding: 0 0 0 21px; background:url(../../../images/btn_go.gif) no-repeat 0 40%; }
14
  #tig_myparcel_myparcel_support .text-box { background:#fff; padding:9px 16px; margin:6px 0 10px; border:1px solid #ccc; }
15
  #tig_myparcel_myparcel_support table.contact { margin:0 0 25px -1px; }
16
+ #tig_myparcel_myparcel_support table.contact td { padding:0; width:110px; }
17
+ #tig_myparcel_myparcel_support table.contact td.first { padding-right:5px; }
18
+ #tig_myparcel_myparcel_support table.tig td a.logo_image { margin-left:10px; }
19
+ #tig_myparcel_myparcel_support table.tig td a.logo_image img {width:45px;}
20
 
21
  /* Legend */
22
  #tig_myparcel_myparcel_support #legend li { background:url(../../../images/TIG/MyParcel2014/legend.gif) 0 0 no-repeat; padding-left:14px; }
skin/adminhtml/default/default/images/TIG/MyParcel2014/magento/btn_bg.gif ADDED
Binary file
skin/adminhtml/default/default/images/TIG/MyParcel2014/magento/content_bg.gif ADDED
Binary file
skin/adminhtml/default/default/images/TIG/MyParcel2014/magento/top_bg.gif ADDED
Binary file
skin/adminhtml/default/default/images/TIG/MyParcel2014/magento/window_close.png ADDED
Binary file
skin/adminhtml/default/default/images/TIG/MyParcel2014/tig_logo_medium.png ADDED
Binary file
skin/frontend/base/default/css/TIG/MyParcel2014/checkout.css ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * ___________ __ __
3
+ * \__ ___/____ _/ |_ _____ | |
4
+ * | | / _ \\ __\\__ \ | |
5
+ * | | | |_| || | / __ \_| |__
6
+ * |____| \____/ |__| (____ /|____/
7
+ * \/
8
+ * ___ __ __
9
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
10
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
11
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
12
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
13
+ * \/ \/
14
+ * ________
15
+ * / _____/_______ ____ __ __ ______
16
+ * / \ ___\_ __ \ / _ \ | | \\____ \
17
+ * \ \_\ \| | \/| |_| || | /| |_| |
18
+ * \______ /|__| \____/ |____/ | __/
19
+ * \/ |__|
20
+ *
21
+ * NOTICE OF LICENSE
22
+ *
23
+ * This source file is subject to the Creative Commons License.
24
+ * It is available through the world-wide-web at this URL:
25
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
26
+ * If you are unable to obtain it through the world-wide-web, please send an email
27
+ * to servicedesk@tig.nl so we can send you a copy immediately.
28
+ *
29
+ * DISCLAIMER
30
+ *
31
+ * Do not edit or add to this file if you wish to upgrade this module to newer
32
+ * versions in the future. If you wish to customize this module for your
33
+ * needs please contact servicedesk@tig.nl for more information.
34
+ *
35
+ * @copyright Copyright (c) 2015 Total Internet Group B.V. (http://www.tig.nl)
36
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
37
+ */
38
+
39
+ /** Onepage checkout location-address */
40
+ .checkout-onepage-index #myparcel_checkout_selected_location.complete label.head { font-weight: lighter; }
41
+ .checkout-onepage-index #myparcel_checkout_selected_location.complete address {
42
+ background: none repeat scroll 0 0 #f4f4f4;
43
+ display: block;
44
+ padding-bottom: 15px;
45
+ padding-left: 40px;
46
+ width: 250px;
47
+ font-size: 0.85em;
48
+ }
49
+
50
+ /** Onestepcheckout location-address*/
51
+ .onestepcheckout-index-index #myparcel_checkout_selected_location.complete label.head { margin-left: 17px; }
52
+ .onestepcheckout-index-index #myparcel_checkout_selected_location.complete address {
53
+ font-size: 0.8em;
54
+ font-weight: normal;
55
+ margin-left: 15px;
56
+ margin-top: 5px;
57
+ }
58
+
59
+ .myparcel_checkout_edit_link { float:right; margin-right:15px; }
60
+ .location-error-msg { color:#f00; }
61
+
62
+ /** TIG MyParcel Basic overlay CSS */
63
+
64
+ #myparcel_checkout_overlay .overlay { position: fixed; top: 0; width: 100%; height: 100%; background-color: #000; opacity: 0.4; z-index: 4000; }
65
+ #myparcel_checkout_overlay #overlay_window .powered-by { font-size:.75em; }
66
+ #myparcel_checkout_overlay #overlay_window .myparcel-loader { display:inline-block; width:14px; height:16px; text-indent:-999em; background:url(../../../images/TIG/MyParcel/checkout/loader_mini.gif) 0 2px no-repeat; margin-left:4px; }
67
+ #myparcel_checkout_overlay #overlay_window { background-color: #fff; border: 1px solid #01bbc5; overflow: auto; z-index: 5000; padding: 5px; border-radius: 4px; }
68
+ #myparcel_checkout_overlay #overlay_window .close {
69
+ display:inline-block;
70
+ position:absolute;
71
+ top: 1%;
72
+ right: 1%;
73
+ line-height:1.7em;
74
+ background:#01bbc5;
75
+ padding: 0 1em;
76
+ color: #fff;
77
+ cursor:pointer;
78
+ border-radius: 4px;
79
+ font-size:1em;
80
+ margin: 1%;
81
+ }
82
+ #myparcel_checkout_overlay #overlay_window h3 { background: none repeat scroll 0 0 #01bbc5;
83
+ border-radius: 3px;
84
+ color: white;
85
+ float: left;
86
+ font-size: 1em;
87
+ line-height: 2em;
88
+ margin: 1% 0;
89
+ text-align: center;
90
+ text-transform: none;
91
+ width: 100%;
92
+ }
93
+ #myparcel_checkout_overlay #overlay_window .logo { width: 100%; text-align:center; max-width:none;}
94
+ #myparcel_checkout_overlay #overlay_window .logo img { width:45px; display:inline-table; }
95
+ #myparcel_checkout_overlay #overlay_window .responsive-location-search { float:left; width: 100%; }
96
+ #myparcel_checkout_overlay #overlay_window .responsive-location-search .search-form { width: 85%; margin: 0 auto; }
97
+ #myparcel_checkout_overlay #overlay_window .responsive-location-search .search-form label {font-size:0.8em;}
98
+ #myparcel_checkout_overlay #overlay_window .responsive-location-search .search-form input { margin: 1% 0; border-radius: 4px; border: 1px solid #58585a; }
99
+ #myparcel_checkout_overlay #overlay_window .responsive-location-search .actions { text-align:center;}
100
+ #myparcel_checkout_overlay #overlay_window .responsive-location-search .actions .myparcel-button { background: none repeat scroll 0 0 #01bbc5; border: medium none; border-radius: 4px; color: #fff; line-height: 32px; margin: 4% 0; padding: 0 15px; }
101
+ #myparcel_checkout_overlay #overlay_window .responsive-location-results { float: left; width: 100%; }
102
+ #myparcel_checkout_overlay #overlay_window .responsive-location-results .list { float: left; width: 100%; }
103
+ #myparcel_checkout_overlay #overlay_window .responsive-location-results .list li.location {float:left; width:100%;}
104
+ #myparcel_checkout_overlay #overlay_window .responsive-location-results .list li.location .content {margin:1%; float:left; width:99%; background:#e9e9e9; padding:1%; border-radius: 3px; }
105
+ #myparcel_checkout_overlay #overlay_window .responsive-location-results .list li.location .location-info,
106
+ #myparcel_checkout_overlay #overlay_window .responsive-location-results .list li.location .address { font-size: 0.9em; float:left; }
107
+ #myparcel_checkout_overlay #overlay_window .responsive-location-results .list li.location .location-info { width: 65%; }
108
+ #myparcel_checkout_overlay #overlay_window .responsive-location-results .list li.location .distance,
109
+ #myparcel_checkout_overlay #overlay_window .responsive-location-results .list li.location .myparcel-button,
110
+ #myparcel_checkout_overlay #overlay_window .responsive-location-results .list li.location .info-link { float:right; text-align:right; font-style: italic; font-size:0.8em; width:20%; }
111
+
112
+ #myparcel_checkout_overlay #overlay_window .responsive-location-results .list li.location .myparcel-button {
113
+ width: auto;
114
+ display:inline-block;
115
+ line-height:1.7em;
116
+ background:#01bbc5;
117
+ padding: 0 1em;
118
+ color: #fff;
119
+ cursor:pointer;
120
+ border-radius: 4px;
121
+ font-size:1em;
122
+ margin: 1%;
123
+ border: none;
124
+ font-style:normal;
125
+ }
126
+
127
+ #myparcel_checkout_overlay #overlay_window .close:hover,
128
+ #myparcel_checkout_overlay #overlay_window .responsive-location-results .list li.location .myparcel-button:hover,
129
+ #myparcel_checkout_overlay #overlay_window .responsive-location-search .actions .myparcel-button:hover { background: #58585a; }
130
+
131
+
132
+
133
+ /**
134
+ * Magento 1.6 styles
135
+ */
136
+ #myparcel_checkout_overlay.style_16 #overlay_window .responsive-location-search .search-form label {font-size: 1em; display:inline-block;width:100%;text-align:left;}
137
+ #myparcel_checkout_overlay.style_16 #overlay_window .responsive-location-search .search-form input {width:365px; max-width:100%;height:25px;max-height:100%;}
138
+ #myparcel_checkout_overlay.style_16 #overlay_window .responsive-location-results .list li.location .content {width:96%; }
139
+ #myparcel_checkout_overlay.style_16 #overlay_window .responsive-location-results .list li.location .location-info,
140
+ #myparcel_checkout_overlay.style_16 #overlay_window .responsive-location-results .list li.location .address { text-align:left; }
141
+ /**
142
+ Media queries for responsive theme's
143
+ */
144
+
145
+ @media only screen and (min-width: 0px) and (max-width: 679px) {
146
+ #myparcel_checkout_overlay #overlay_window { height: 80%; left: 10%; position: fixed; top: 10%; width: 80%; }
147
+ }
148
+
149
+ @media only screen and (min-width: 680px) and (max-width: 1024px){
150
+ #myparcel_checkout_overlay #overlay_window { height: 80%; left: 50%; position: fixed; top: 10%; width: 500px; margin-left:-250px; }
151
+ }
152
+
153
+ @media only screen and (min-width : 1024px) {
154
+ #myparcel_checkout_overlay #overlay_window { height: 80%; left: 50%; position: fixed; top: 10%; width: 500px; margin-left:-250px; }
155
+ }
156
+
157
+ body.overlay_open{
158
+ overflow:hidden;
159
+ }
skin/frontend/base/default/images/TIG/MyParcel/checkout/loader_mini.gif ADDED
Binary file
skin/frontend/base/default/images/TIG/MyParcel/checkout/logo_myparcel.png ADDED
Binary file
skin/frontend/base/default/images/TIG/MyParcel/checkout/logo_postnl.png ADDED
Binary file
skin/frontend/base/default/js/TIG/MyParcel2014/MutationObserver.js ADDED
@@ -0,0 +1,568 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
4
+ * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5
+ * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6
+ * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7
+ * Code distributed by Google as part of the polymer project is also
8
+ * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9
+ */
10
+
11
+ (function(global) {
12
+
13
+ var registrationsTable = new WeakMap();
14
+
15
+ var setImmediate;
16
+
17
+ // As much as we would like to use the native implementation, IE
18
+ // (all versions) suffers a rather annoying bug where it will drop or defer
19
+ // callbacks when heavy DOM operations are being performed concurrently.
20
+ //
21
+ // For a thorough discussion on this, see:
22
+ // http://codeforhire.com/2013/09/21/setimmediate-and-messagechannel-broken-on-internet-explorer-10/
23
+ if (/Trident|Edge/.test(navigator.userAgent)) {
24
+ // Sadly, this bug also affects postMessage and MessageQueues.
25
+ //
26
+ // We would like to use the onreadystatechange hack for IE <= 10, but it is
27
+ // dangerous in the polyfilled environment due to requiring that the
28
+ // observed script element be in the document.
29
+ setImmediate = setTimeout;
30
+
31
+ // If some other browser ever implements it, let's prefer their native
32
+ // implementation:
33
+ } else if (window.setImmediate) {
34
+ setImmediate = window.setImmediate;
35
+
36
+ // Otherwise, we fall back to postMessage as a means of emulating the next
37
+ // task semantics of setImmediate.
38
+ } else {
39
+ var setImmediateQueue = [];
40
+ var sentinel = String(Math.random());
41
+ window.addEventListener('message', function(e) {
42
+ if (e.data === sentinel) {
43
+ var queue = setImmediateQueue;
44
+ setImmediateQueue = [];
45
+ queue.forEach(function(func) {
46
+ func();
47
+ });
48
+ }
49
+ });
50
+ setImmediate = function(func) {
51
+ setImmediateQueue.push(func);
52
+ window.postMessage(sentinel, '*');
53
+ };
54
+ }
55
+
56
+ // This is used to ensure that we never schedule 2 callas to setImmediate
57
+ var isScheduled = false;
58
+
59
+ // Keep track of observers that needs to be notified next time.
60
+ var scheduledObservers = [];
61
+
62
+ /**
63
+ * Schedules |dispatchCallback| to be called in the future.
64
+ * @param {MutationObserver} observer
65
+ */
66
+ function scheduleCallback(observer) {
67
+ scheduledObservers.push(observer);
68
+ if (!isScheduled) {
69
+ isScheduled = true;
70
+ setImmediate(dispatchCallbacks);
71
+ }
72
+ }
73
+
74
+ function wrapIfNeeded(node) {
75
+ return window.ShadowDOMPolyfill &&
76
+ window.ShadowDOMPolyfill.wrapIfNeeded(node) ||
77
+ node;
78
+ }
79
+
80
+ function dispatchCallbacks() {
81
+ // http://dom.spec.whatwg.org/#mutation-observers
82
+
83
+ isScheduled = false; // Used to allow a new setImmediate call above.
84
+
85
+ var observers = scheduledObservers;
86
+ scheduledObservers = [];
87
+ // Sort observers based on their creation UID (incremental).
88
+ observers.sort(function(o1, o2) {
89
+ return o1.uid_ - o2.uid_;
90
+ });
91
+
92
+ var anyNonEmpty = false;
93
+ observers.forEach(function(observer) {
94
+
95
+ // 2.1, 2.2
96
+ var queue = observer.takeRecords();
97
+ // 2.3. Remove all transient registered observers whose observer is mo.
98
+ removeTransientObserversFor(observer);
99
+
100
+ // 2.4
101
+ if (queue.length) {
102
+ observer.callback_(queue, observer);
103
+ anyNonEmpty = true;
104
+ }
105
+ });
106
+
107
+ // 3.
108
+ if (anyNonEmpty)
109
+ dispatchCallbacks();
110
+ }
111
+
112
+ function removeTransientObserversFor(observer) {
113
+ observer.nodes_.forEach(function(node) {
114
+ var registrations = registrationsTable.get(node);
115
+ if (!registrations)
116
+ return;
117
+ registrations.forEach(function(registration) {
118
+ if (registration.observer === observer)
119
+ registration.removeTransientObservers();
120
+ });
121
+ });
122
+ }
123
+
124
+ /**
125
+ * This function is used for the "For each registered observer observer (with
126
+ * observer's options as options) in target's list of registered observers,
127
+ * run these substeps:" and the "For each ancestor ancestor of target, and for
128
+ * each registered observer observer (with options options) in ancestor's list
129
+ * of registered observers, run these substeps:" part of the algorithms. The
130
+ * |options.subtree| is checked to ensure that the callback is called
131
+ * correctly.
132
+ *
133
+ * @param {Node} target
134
+ * @param {function(MutationObserverInit):MutationRecord} callback
135
+ */
136
+ function forEachAncestorAndObserverEnqueueRecord(target, callback) {
137
+ for (var node = target; node; node = node.parentNode) {
138
+ var registrations = registrationsTable.get(node);
139
+
140
+ if (registrations) {
141
+ for (var j = 0; j < registrations.length; j++) {
142
+ var registration = registrations[j];
143
+ var options = registration.options;
144
+
145
+ // Only target ignores subtree.
146
+ if (node !== target && !options.subtree)
147
+ continue;
148
+
149
+ var record = callback(options);
150
+ if (record)
151
+ registration.enqueue(record);
152
+ }
153
+ }
154
+ }
155
+ }
156
+
157
+ var uidCounter = 0;
158
+
159
+ /**
160
+ * The class that maps to the DOM MutationObserver interface.
161
+ * @param {Function} callback.
162
+ * @constructor
163
+ */
164
+ function JsMutationObserver(callback) {
165
+ this.callback_ = callback;
166
+ this.nodes_ = [];
167
+ this.records_ = [];
168
+ this.uid_ = ++uidCounter;
169
+ }
170
+
171
+ JsMutationObserver.prototype = {
172
+ observe: function(target, options) {
173
+ target = wrapIfNeeded(target);
174
+
175
+ // 1.1
176
+ if (!options.childList && !options.attributes && !options.characterData ||
177
+
178
+ // 1.2
179
+ options.attributeOldValue && !options.attributes ||
180
+
181
+ // 1.3
182
+ options.attributeFilter && options.attributeFilter.length &&
183
+ !options.attributes ||
184
+
185
+ // 1.4
186
+ options.characterDataOldValue && !options.characterData) {
187
+
188
+ throw new SyntaxError();
189
+ }
190
+
191
+ var registrations = registrationsTable.get(target);
192
+ if (!registrations)
193
+ registrationsTable.set(target, registrations = []);
194
+
195
+ // 2
196
+ // If target's list of registered observers already includes a registered
197
+ // observer associated with the context object, replace that registered
198
+ // observer's options with options.
199
+ var registration;
200
+ for (var i = 0; i < registrations.length; i++) {
201
+ if (registrations[i].observer === this) {
202
+ registration = registrations[i];
203
+ registration.removeListeners();
204
+ registration.options = options;
205
+ break;
206
+ }
207
+ }
208
+
209
+ // 3.
210
+ // Otherwise, add a new registered observer to target's list of registered
211
+ // observers with the context object as the observer and options as the
212
+ // options, and add target to context object's list of nodes on which it
213
+ // is registered.
214
+ if (!registration) {
215
+ registration = new Registration(this, target, options);
216
+ registrations.push(registration);
217
+ this.nodes_.push(target);
218
+ }
219
+
220
+ registration.addListeners();
221
+ },
222
+
223
+ disconnect: function() {
224
+ this.nodes_.forEach(function(node) {
225
+ var registrations = registrationsTable.get(node);
226
+ for (var i = 0; i < registrations.length; i++) {
227
+ var registration = registrations[i];
228
+ if (registration.observer === this) {
229
+ registration.removeListeners();
230
+ registrations.splice(i, 1);
231
+ // Each node can only have one registered observer associated with
232
+ // this observer.
233
+ break;
234
+ }
235
+ }
236
+ }, this);
237
+ this.records_ = [];
238
+ },
239
+
240
+ takeRecords: function() {
241
+ var copyOfRecords = this.records_;
242
+ this.records_ = [];
243
+ return copyOfRecords;
244
+ }
245
+ };
246
+
247
+ /**
248
+ * @param {string} type
249
+ * @param {Node} target
250
+ * @constructor
251
+ */
252
+ function MutationRecord(type, target) {
253
+ this.type = type;
254
+ this.target = target;
255
+ this.addedNodes = [];
256
+ this.removedNodes = [];
257
+ this.previousSibling = null;
258
+ this.nextSibling = null;
259
+ this.attributeName = null;
260
+ this.attributeNamespace = null;
261
+ this.oldValue = null;
262
+ }
263
+
264
+ function copyMutationRecord(original) {
265
+ var record = new MutationRecord(original.type, original.target);
266
+ record.addedNodes = original.addedNodes.slice();
267
+ record.removedNodes = original.removedNodes.slice();
268
+ record.previousSibling = original.previousSibling;
269
+ record.nextSibling = original.nextSibling;
270
+ record.attributeName = original.attributeName;
271
+ record.attributeNamespace = original.attributeNamespace;
272
+ record.oldValue = original.oldValue;
273
+ return record;
274
+ };
275
+
276
+ // We keep track of the two (possibly one) records used in a single mutation.
277
+ var currentRecord, recordWithOldValue;
278
+
279
+ /**
280
+ * Creates a record without |oldValue| and caches it as |currentRecord| for
281
+ * later use.
282
+ * @param {string} oldValue
283
+ * @return {MutationRecord}
284
+ */
285
+ function getRecord(type, target) {
286
+ return currentRecord = new MutationRecord(type, target);
287
+ }
288
+
289
+ /**
290
+ * Gets or creates a record with |oldValue| based in the |currentRecord|
291
+ * @param {string} oldValue
292
+ * @return {MutationRecord}
293
+ */
294
+ function getRecordWithOldValue(oldValue) {
295
+ if (recordWithOldValue)
296
+ return recordWithOldValue;
297
+ recordWithOldValue = copyMutationRecord(currentRecord);
298
+ recordWithOldValue.oldValue = oldValue;
299
+ return recordWithOldValue;
300
+ }
301
+
302
+ function clearRecords() {
303
+ currentRecord = recordWithOldValue = undefined;
304
+ }
305
+
306
+ /**
307
+ * @param {MutationRecord} record
308
+ * @return {boolean} Whether the record represents a record from the current
309
+ * mutation event.
310
+ */
311
+ function recordRepresentsCurrentMutation(record) {
312
+ return record === recordWithOldValue || record === currentRecord;
313
+ }
314
+
315
+ /**
316
+ * Selects which record, if any, to replace the last record in the queue.
317
+ * This returns |null| if no record should be replaced.
318
+ *
319
+ * @param {MutationRecord} lastRecord
320
+ * @param {MutationRecord} newRecord
321
+ * @param {MutationRecord}
322
+ */
323
+ function selectRecord(lastRecord, newRecord) {
324
+ if (lastRecord === newRecord)
325
+ return lastRecord;
326
+
327
+ // Check if the the record we are adding represents the same record. If
328
+ // so, we keep the one with the oldValue in it.
329
+ if (recordWithOldValue && recordRepresentsCurrentMutation(lastRecord))
330
+ return recordWithOldValue;
331
+
332
+ return null;
333
+ }
334
+
335
+ /**
336
+ * Class used to represent a registered observer.
337
+ * @param {MutationObserver} observer
338
+ * @param {Node} target
339
+ * @param {MutationObserverInit} options
340
+ * @constructor
341
+ */
342
+ function Registration(observer, target, options) {
343
+ this.observer = observer;
344
+ this.target = target;
345
+ this.options = options;
346
+ this.transientObservedNodes = [];
347
+ }
348
+
349
+ Registration.prototype = {
350
+ enqueue: function(record) {
351
+ var records = this.observer.records_;
352
+ var length = records.length;
353
+
354
+ // There are cases where we replace the last record with the new record.
355
+ // For example if the record represents the same mutation we need to use
356
+ // the one with the oldValue. If we get same record (this can happen as we
357
+ // walk up the tree) we ignore the new record.
358
+ if (records.length > 0) {
359
+ var lastRecord = records[length - 1];
360
+ var recordToReplaceLast = selectRecord(lastRecord, record);
361
+ if (recordToReplaceLast) {
362
+ records[length - 1] = recordToReplaceLast;
363
+ return;
364
+ }
365
+ } else {
366
+ scheduleCallback(this.observer);
367
+ }
368
+
369
+ records[length] = record;
370
+ },
371
+
372
+ addListeners: function() {
373
+ this.addListeners_(this.target);
374
+ },
375
+
376
+ addListeners_: function(node) {
377
+ var options = this.options;
378
+ if (options.attributes)
379
+ node.addEventListener('DOMAttrModified', this, true);
380
+
381
+ if (options.characterData)
382
+ node.addEventListener('DOMCharacterDataModified', this, true);
383
+
384
+ if (options.childList)
385
+ node.addEventListener('DOMNodeInserted', this, true);
386
+
387
+ if (options.childList || options.subtree)
388
+ node.addEventListener('DOMNodeRemoved', this, true);
389
+ },
390
+
391
+ removeListeners: function() {
392
+ this.removeListeners_(this.target);
393
+ },
394
+
395
+ removeListeners_: function(node) {
396
+ var options = this.options;
397
+ if (options.attributes)
398
+ node.removeEventListener('DOMAttrModified', this, true);
399
+
400
+ if (options.characterData)
401
+ node.removeEventListener('DOMCharacterDataModified', this, true);
402
+
403
+ if (options.childList)
404
+ node.removeEventListener('DOMNodeInserted', this, true);
405
+
406
+ if (options.childList || options.subtree)
407
+ node.removeEventListener('DOMNodeRemoved', this, true);
408
+ },
409
+
410
+ /**
411
+ * Adds a transient observer on node. The transient observer gets removed
412
+ * next time we deliver the change records.
413
+ * @param {Node} node
414
+ */
415
+ addTransientObserver: function(node) {
416
+ // Don't add transient observers on the target itself. We already have all
417
+ // the required listeners set up on the target.
418
+ if (node === this.target)
419
+ return;
420
+
421
+ this.addListeners_(node);
422
+ this.transientObservedNodes.push(node);
423
+ var registrations = registrationsTable.get(node);
424
+ if (!registrations)
425
+ registrationsTable.set(node, registrations = []);
426
+
427
+ // We know that registrations does not contain this because we already
428
+ // checked if node === this.target.
429
+ registrations.push(this);
430
+ },
431
+
432
+ removeTransientObservers: function() {
433
+ var transientObservedNodes = this.transientObservedNodes;
434
+ this.transientObservedNodes = [];
435
+
436
+ transientObservedNodes.forEach(function(node) {
437
+ // Transient observers are never added to the target.
438
+ this.removeListeners_(node);
439
+
440
+ var registrations = registrationsTable.get(node);
441
+ for (var i = 0; i < registrations.length; i++) {
442
+ if (registrations[i] === this) {
443
+ registrations.splice(i, 1);
444
+ // Each node can only have one registered observer associated with
445
+ // this observer.
446
+ break;
447
+ }
448
+ }
449
+ }, this);
450
+ },
451
+
452
+ handleEvent: function(e) {
453
+ // Stop propagation since we are managing the propagation manually.
454
+ // This means that other mutation events on the page will not work
455
+ // correctly but that is by design.
456
+ e.stopImmediatePropagation();
457
+
458
+ switch (e.type) {
459
+ case 'DOMAttrModified':
460
+ // http://dom.spec.whatwg.org/#concept-mo-queue-attributes
461
+
462
+ var name = e.attrName;
463
+ var namespace = e.relatedNode.namespaceURI;
464
+ var target = e.target;
465
+
466
+ // 1.
467
+ var record = new getRecord('attributes', target);
468
+ record.attributeName = name;
469
+ record.attributeNamespace = namespace;
470
+
471
+ // 2.
472
+ var oldValue =
473
+ e.attrChange === MutationEvent.ADDITION ? null : e.prevValue;
474
+
475
+ forEachAncestorAndObserverEnqueueRecord(target, function(options) {
476
+ // 3.1, 4.2
477
+ if (!options.attributes)
478
+ return;
479
+
480
+ // 3.2, 4.3
481
+ if (options.attributeFilter && options.attributeFilter.length &&
482
+ options.attributeFilter.indexOf(name) === -1 &&
483
+ options.attributeFilter.indexOf(namespace) === -1) {
484
+ return;
485
+ }
486
+ // 3.3, 4.4
487
+ if (options.attributeOldValue)
488
+ return getRecordWithOldValue(oldValue);
489
+
490
+ // 3.4, 4.5
491
+ return record;
492
+ });
493
+
494
+ break;
495
+
496
+ case 'DOMCharacterDataModified':
497
+ // http://dom.spec.whatwg.org/#concept-mo-queue-characterdata
498
+ var target = e.target;
499
+
500
+ // 1.
501
+ var record = getRecord('characterData', target);
502
+
503
+ // 2.
504
+ var oldValue = e.prevValue;
505
+
506
+
507
+ forEachAncestorAndObserverEnqueueRecord(target, function(options) {
508
+ // 3.1, 4.2
509
+ if (!options.characterData)
510
+ return;
511
+
512
+ // 3.2, 4.3
513
+ if (options.characterDataOldValue)
514
+ return getRecordWithOldValue(oldValue);
515
+
516
+ // 3.3, 4.4
517
+ return record;
518
+ });
519
+
520
+ break;
521
+
522
+ case 'DOMNodeRemoved':
523
+ this.addTransientObserver(e.target);
524
+ // Fall through.
525
+ case 'DOMNodeInserted':
526
+ // http://dom.spec.whatwg.org/#concept-mo-queue-childlist
527
+ var changedNode = e.target;
528
+ var addedNodes, removedNodes;
529
+ if (e.type === 'DOMNodeInserted') {
530
+ addedNodes = [changedNode];
531
+ removedNodes = [];
532
+ } else {
533
+
534
+ addedNodes = [];
535
+ removedNodes = [changedNode];
536
+ }
537
+ var previousSibling = changedNode.previousSibling;
538
+ var nextSibling = changedNode.nextSibling;
539
+
540
+ // 1.
541
+ var record = getRecord('childList', e.target.parentNode);
542
+ record.addedNodes = addedNodes;
543
+ record.removedNodes = removedNodes;
544
+ record.previousSibling = previousSibling;
545
+ record.nextSibling = nextSibling;
546
+
547
+ forEachAncestorAndObserverEnqueueRecord(e.relatedNode, function(options) {
548
+ // 2.1, 3.2
549
+ if (!options.childList)
550
+ return;
551
+
552
+ // 2.2, 3.3
553
+ return record;
554
+ });
555
+
556
+ }
557
+
558
+ clearRecords();
559
+ }
560
+ };
561
+
562
+ global.JsMutationObserver = JsMutationObserver;
563
+
564
+ if (!global.MutationObserver)
565
+ global.MutationObserver = JsMutationObserver;
566
+
567
+
568
+ })(this);
skin/frontend/base/default/js/TIG/MyParcel2014/checkout.js ADDED
@@ -0,0 +1,864 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * ___________ __ __
3
+ * \__ ___/____ _/ |_ _____ | |
4
+ * | | / _ \\ __\\__ \ | |
5
+ * | | | |_| || | / __ \_| |__
6
+ * |____| \____/ |__| (____ /|____/
7
+ * \/
8
+ * ___ __ __
9
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
10
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
11
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
12
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
13
+ * \/ \/
14
+ * ________
15
+ * / _____/_______ ____ __ __ ______
16
+ * / \ ___\_ __ \ / _ \ | | \\____ \
17
+ * \ \_\ \| | \/| |_| || | /| |_| |
18
+ * \______ /|__| \____/ |____/ | __/
19
+ * \/ |__|
20
+ *
21
+ * NOTICE OF LICENSE
22
+ *
23
+ * This source file is subject to the Creative Commons License.
24
+ * It is available through the world-wide-web at this URL:
25
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
26
+ * If you are unable to obtain it through the world-wide-web, please send an email
27
+ * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
28
+ *
29
+ * DISCLAIMER
30
+ *
31
+ * Do not edit or add to this file if you wish to upgrade this module to newer
32
+ * versions in the future. If you wish to customize this module for your
33
+ * needs please contact servicedesk@totalinternetgroup.nl for more information.
34
+ *
35
+ * @copyright Copyright (c) 2015 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
36
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
37
+ */
38
+ if (typeof isEmptyObj == 'undefined') {
39
+ function isEmptyObj(obj) {
40
+ var keys = Object.keys(obj).length;
41
+
42
+ return keys === 0;
43
+ }
44
+ }
45
+
46
+ var MyParcelCheckout = Class.create();
47
+ MyParcelCheckout.prototype = {
48
+ /**
49
+ * Core config options.
50
+ */
51
+ _config : {
52
+ get_locations_url : '',
53
+ save_location_url : '',
54
+ use_shipping_or_billing_checkbox : false,
55
+ save_location_on_select : false,
56
+ shipping_methods_load_callback : function() {},
57
+ select_location_callback : function() {},
58
+ save_location_success_callback : function() {},
59
+ save_location_error_callback : function() {}
60
+ },
61
+
62
+ /**
63
+ * Selectors for elements used by MyParcel checkout.
64
+ * Modifying these should allow compatibility with other checkout extensions or themes.
65
+ */
66
+ _selectors : {
67
+ overlay_container : '#myparcel_checkout_overlay_container',
68
+ shipping_methods_container : '#checkout-shipping-method-load',
69
+ shipping_method : '#s_method_tig_myparcel_pakjegemak',
70
+ shipping_street_field : '#shipping\\:street1',
71
+ shipping_housenr_field : '#shipping\\:street2',
72
+ shipping_postcode_field : '#shipping\\:postcode',
73
+ billing_street_field : '#billing\\:street1',
74
+ billing_housenr_field : '#billing\\:street2',
75
+ billing_postcode_field : '#billing\\:postcode',
76
+ billing_or_shipping_field : ''
77
+ },
78
+
79
+ /**
80
+ * Templates. Should be an object containing Prototype Template objects.
81
+ */
82
+ _templates : {},
83
+
84
+ /**
85
+ * Parameters to be used with the templates. These will be supplemented dynamically.
86
+ */
87
+ _templateParams : {
88
+ overlay : {
89
+ overlay_id : 'myparcel_checkout_overlay',
90
+ postcode_field_id : 'myparcel_postcode_field',
91
+ housenr_field_id : 'myparcel_housenr_field',
92
+ search_button_id : 'myparcel_search_button',
93
+ overlay_window_id : 'overlay_window',
94
+ location_loader_id : 'locations_loader',
95
+ location_list_id : 'location_list'
96
+ },
97
+ location : {
98
+ location_class : 'location',
99
+ location_id_prefix : 'location_',
100
+ location_info_id_prefix : 'location_info_',
101
+ select_location_onclick_class : 'myParcelCheckout'
102
+ },
103
+ selected_location : {
104
+ selected_location_id : 'myparcel_checkout_selected_location'
105
+ }
106
+ },
107
+
108
+ /**
109
+ * Locations retrieved through the MyParcel API.
110
+ */
111
+ _locations : {},
112
+
113
+ /**
114
+ * Selected location.
115
+ */
116
+ _selectedLocation : false,
117
+
118
+ /**
119
+ * Registered observers.
120
+ */
121
+ _observers : {},
122
+
123
+ /**
124
+ * The overlay window.
125
+ */
126
+ _overlay : false,
127
+
128
+ /**
129
+ * Constructor method.
130
+ *
131
+ * @param config
132
+ * @param selectors
133
+ * @param templates
134
+ * @param templateParams
135
+ */
136
+ initialize : function(config, selectors, templates, templateParams) {
137
+ /**
138
+ * Set configuration options.
139
+ */
140
+ this._config = Object.extend(this._config, config || {});
141
+ this._selectors = Object.extend(this._selectors, selectors || {});
142
+ this._templates = Object.extend(this._templates, templates || {});
143
+ this._templateParams = Object.extend(this._templateParams, templateParams || {});
144
+
145
+ /**
146
+ * Verify that all required templates are present.
147
+ */
148
+ this._verifyTemplates();
149
+
150
+ /**
151
+ * Register and start the core observers.
152
+ */
153
+ this._registerObservers();
154
+ this._initObservers(this._selectors);
155
+ },
156
+
157
+ /**
158
+ * Verifies that all required templates are defined.
159
+ *
160
+ * @returns {MyParcelCheckout}
161
+ * @private
162
+ */
163
+ _verifyTemplates : function() {
164
+ var templates = this._templates;
165
+ if (!templates.overlay || !templates.location || !templates.location_error || !templates.selected_location) {
166
+ throw 'Error: missing templates.';
167
+ }
168
+
169
+ return this;
170
+ },
171
+
172
+ /**
173
+ * Registers observers for the core MyParcel checkout functionality.
174
+ *
175
+ * @private
176
+ */
177
+ _registerObservers : function() {
178
+ this._observers['shipping_methods_load'] = this.shippingMethodsLoad.bindAsEventListener(this);
179
+ this._observers['shipping_method'] = this.shippingMethodOnClick.bindAsEventListener(this);
180
+ this._observers['search_field'] = this.searchFieldOnClick.bindAsEventListener(this);
181
+ this._observers['overlay_hide'] = this.overlayOnClick.bindAsEventListener(this);
182
+ this._observers['housenr_keypress'] = this.searchFieldOnKeypress.bindAsEventListener(this);
183
+ },
184
+
185
+ /**
186
+ * Initialize the core observers.
187
+ *
188
+ * @param selectors
189
+ * @returns {MyParcelCheckout}
190
+ * @private
191
+ */
192
+ _initObservers : function(selectors) {
193
+ /**
194
+ * This observer observes changes to the dom structure of the shipping methods container.
195
+ */
196
+ var shippingMethodContainer = $$(selectors.shipping_methods_container)[0];
197
+ var observer = new MutationObserver(this._observers.shipping_methods_load);
198
+ var config = {
199
+ attributes : true,
200
+ childList : true,
201
+ characterData : true,
202
+ subTree : false,
203
+ attributeOldValue : false,
204
+ characterDataOldValue : false,
205
+ attributeFilter : []
206
+ };
207
+
208
+ observer.observe(shippingMethodContainer, config);
209
+
210
+ /**
211
+ * Observe the shipping method.
212
+ */
213
+ var shippingMethod = $$(selectors.shipping_method);
214
+ shippingMethod.invoke('observe', 'click', this._observers.shipping_method);
215
+
216
+ return this;
217
+ },
218
+
219
+ /**
220
+ * Initialize observers for the overlay window.
221
+ *
222
+ * @returns {MyParcelCheckout}
223
+ * @private
224
+ */
225
+ _initOverlayObservers : function() {
226
+ var overlay = this._overlay;
227
+ var templateParams = this._templateParams.overlay;
228
+
229
+ var searchButton = overlay.select('#' + templateParams.search_button_id)[0];
230
+ searchButton.stopObserving('click', this._observers.search_field);
231
+ searchButton.observe('click', this._observers.search_field);
232
+
233
+ var housenrField = overlay.select('#' + templateParams.housenr_field_id)[0];
234
+ housenrField.stopObserving('keypress', this._observers.housenr_keypress);
235
+ housenrField.observe('keypress', this._observers.housenr_keypress);
236
+
237
+ overlay.select('.close').invoke('stopObserving', 'click', this._observers.overlay_hide);
238
+ overlay.select('.close').invoke('observe', 'click', this._observers.overlay_hide);
239
+
240
+ return this;
241
+ },
242
+
243
+ /**
244
+ * Get the postcode and house number values as entered in the previous steps.
245
+ *
246
+ * @returns {{postcode: null, housenr: null}}
247
+ * @private
248
+ */
249
+ _getSearchFieldValues : function() {
250
+ var postcodeField;
251
+ var houseNrField;
252
+ var houseNrValue;
253
+ var regex = /(.*?)\s+(\d+\s[a-zA-Z]?|\d+[a-zA-Z]{0,1}\s{0,1}[-]{1}\s{0,1}\d*[a-zA-Z]{0,1}|\d+[a-zA-Z-]{0,1}\d*[a-zA-Z]{0,1})/;
254
+ var houseNrFieldUsed = false;
255
+ var streetAndHouseNrField;
256
+
257
+ /**
258
+ * By default no postcode and house number are entered.
259
+ *
260
+ * @type {{postcode: null, housenr: null}}
261
+ */
262
+ var values = {
263
+ postcode : null,
264
+ housenr : null
265
+ };
266
+
267
+
268
+ /**
269
+ * This checks if the house number field is used.
270
+ * If this is not the case, the house number needs to be extracted from the street address line later on.
271
+ */
272
+ houseNrField = $$(this._selectors.billing_housenr_field)[0];
273
+ if(houseNrField){
274
+ if(houseNrField.getValue()) {
275
+ houseNrFieldUsed = true;
276
+ }
277
+ }
278
+
279
+
280
+ /**
281
+ * If the current checkout page uses a checkbox to switch between billing and shipping addresses, this option
282
+ * will allow that.
283
+ */
284
+ if (this._config.use_shipping_or_billing_checkbox) {
285
+ var useBilling = $$(this._selectors.billing_or_shipping_field)[0].getValue();
286
+ if (useBilling) {
287
+ postcodeField = $$(this._selectors.billing_postcode_field)[0];
288
+ if (houseNrFieldUsed) {
289
+ houseNrField = $$(this._selectors.billing_housenr_field)[0];
290
+ } else {
291
+ streetAndHouseNrField = $$(this._selectors.billing_street_field)[0]
292
+ }
293
+ } else {
294
+ postcodeField = $$(this._selectors.shipping_postcode_field)[0];
295
+ if (houseNrFieldUsed) {
296
+ houseNrField = $$(this._selectors.shipping_housenr_field)[0];
297
+ } else {
298
+ streetAndHouseNrField = $$(this._selectors.shipping_street_field)[0]
299
+ }
300
+ }
301
+ } else {
302
+ postcodeField = $$(this._selectors.shipping_postcode_field)[0];
303
+ if (houseNrFieldUsed) {
304
+ houseNrField = $$(this._selectors.shipping_housenr_field)[0];
305
+ } else {
306
+ streetAndHouseNrField = $$(this._selectors.shipping_street_field)[0]
307
+ }
308
+ }
309
+
310
+ if (houseNrFieldUsed) {
311
+ houseNrValue = houseNrField.getValue();
312
+ } else {
313
+ var streetAndHouseNrFieldValue = streetAndHouseNrField.getValue();
314
+ var splitAddress = regex.exec(streetAndHouseNrFieldValue);
315
+ if(splitAddress) {
316
+ houseNrValue = splitAddress[2];
317
+ }
318
+ }
319
+
320
+
321
+ /**
322
+ * If the fields were found, get their values.
323
+ */
324
+ if (postcodeField) {
325
+ values['postcode'] = postcodeField.getValue();
326
+ }
327
+
328
+ values['housenr'] = houseNrValue;
329
+
330
+ return values;
331
+ },
332
+
333
+ /**
334
+ * Set the postcode and house number values for the search fields in the overlay.
335
+ *
336
+ * @returns {MyParcelCheckout}
337
+ * @private
338
+ */
339
+ _setSearchFieldValues : function() {
340
+ var values = this._getSearchFieldValues();
341
+
342
+ var postcodeField = this._overlay.select('#' + this._templateParams.overlay.postcode_field_id)[0];
343
+ postcodeField.setValue(values['postcode']);
344
+
345
+ var houseNrField = this._overlay.select('#' + this._templateParams.overlay.housenr_field_id)[0];
346
+ houseNrField.setValue(values['housenr']);
347
+
348
+ return this;
349
+ },
350
+
351
+ /**
352
+ * Request available locations from the MyParcel API for the entered postcode and house number values.
353
+ *
354
+ * @returns {*}
355
+ * @private
356
+ */
357
+ _searchForLocations : function() {
358
+ /**
359
+ * Show the loader spinner and remove any available locations found previously.
360
+ */
361
+ this.showLocationLoader();
362
+ this.removeLocations();
363
+
364
+ /**
365
+ * Reset the currently selected location.
366
+ *
367
+ * @type {boolean}
368
+ * @private
369
+ */
370
+ this._selectedLocation = false;
371
+ if ($(this._templateParams.selected_location.selected_location_id)) {
372
+ $(this._templateParams.selected_location.selected_location_id).remove();
373
+ }
374
+
375
+ /**
376
+ * Get the entered postcode and house number values.
377
+ */
378
+ var postcodeField = this._overlay.select('#' + this._templateParams.overlay.postcode_field_id)[0];
379
+ var postcodeValue = postcodeField.getValue();
380
+
381
+ var houseNrField = this._overlay.select('#' + this._templateParams.overlay.housenr_field_id)[0];
382
+ var houseNrValue = houseNrField.getValue();
383
+
384
+ if (!houseNrValue || !postcodeValue) {
385
+ this.showLocationsError();
386
+ this.hideLocationLoader();
387
+ return false;
388
+ }
389
+
390
+ /**
391
+ * Send an AJAX request to the MyParcel API.
392
+ */
393
+ new Ajax.Request(this._config.get_locations_url, {
394
+ method : 'post',
395
+ parameters : {
396
+ postcode : postcodeValue,
397
+ housenr : houseNrValue,
398
+ isAjax : true
399
+ },
400
+ onSuccess : this.renderLocations.bind(this),
401
+ onFailure : this.showLocationsError.bind(this)
402
+ });
403
+
404
+ return this;
405
+ },
406
+
407
+ /**
408
+ * This method is triggered every time the DOm structure of the shipping methods container is updated.
409
+ *
410
+ * @returns {MyParcelCheckout}
411
+ */
412
+ shippingMethodsLoad : function() {
413
+ var shippingMethod = $$(this._selectors.shipping_method);
414
+
415
+ /**
416
+ * Observe the shipping method causing the observer from the _observers object. First stop observing it to
417
+ * prevent double observers.
418
+ */
419
+ shippingMethod.invoke('stopObserving', 'click', this._observers.shipping_method);
420
+ shippingMethod.invoke('observe', 'click', this._observers.shipping_method);
421
+
422
+ /**
423
+ * Hide the overlay window if it was somehow still open.
424
+ */
425
+ if (this._overlay) {
426
+ this._overlay.up().hide();
427
+ }
428
+
429
+ /**
430
+ * Remove any previously found locations.
431
+ *
432
+ * @type {{}}
433
+ * @private
434
+ */
435
+ this._locations = {};
436
+
437
+ /**
438
+ * If the PakjeGemak shipping method was selected, deselect it. The shipping method may only be selected when a
439
+ * location has been chosen.
440
+ */
441
+ if ($$(this._selectors.shipping_method)[0] && $$(this._selectors.shipping_method)[0].checked) {
442
+ $$(this._selectors.shipping_method)[0].checked = false;
443
+ }
444
+
445
+ this._config.shipping_methods_load_callback();
446
+ return this;
447
+ },
448
+
449
+ /**
450
+ * Open the overlay window.
451
+ *
452
+ * @returns {MyParcelCheckout}
453
+ */
454
+ shippingMethodOnClick : function() {
455
+ this.openOverlay();
456
+
457
+ return this;
458
+ },
459
+
460
+ /**
461
+ * Search for locations based on the entered postcode and house number.
462
+ *
463
+ * @todo trigger form validation for the postcode and house number fields.
464
+ *
465
+ * @param event
466
+ * @returns {MyParcelCheckout}
467
+ */
468
+ searchFieldOnClick : function(event) {
469
+ event.stop();
470
+
471
+ this._searchForLocations();
472
+
473
+ return this;
474
+ },
475
+
476
+ /**
477
+ * Search for locations based on the entered postcode and house number.
478
+ *
479
+ * @todo trigger form validation for the postcode and house number fields.
480
+ *
481
+ * @param event
482
+ * @returns {MyParcelCheckout}
483
+ */
484
+ searchFieldOnKeypress : function(event) {
485
+ if(event.keyCode == Event.KEY_RETURN || event.which == Event.KEY_RETURN)
486
+ {
487
+ event.stop();
488
+ this._searchForLocations();
489
+ }
490
+ return this;
491
+ },
492
+
493
+ /**
494
+ * Close the overlay window when clicked outside the main window.
495
+ *
496
+ * @returns {MyParcelCheckout}
497
+ */
498
+ overlayOnClick : function() {
499
+ this.closeOverlay();
500
+
501
+ return this;
502
+ },
503
+
504
+ /**
505
+ * Open the overlay window.
506
+ *
507
+ * @returns {MyParcelCheckout}
508
+ */
509
+ openOverlay : function() {
510
+ /**
511
+ * Get the stored overlay element.
512
+ *
513
+ * @type {boolean|HTMLElement}
514
+ */
515
+ var overlay = this._overlay;
516
+ /**
517
+ * If no overlay was stored, create the overlay window.
518
+ */
519
+ if (!overlay) {
520
+ /**
521
+ * Create the overlay by evaluating it's template.
522
+ *
523
+ * @type {string}
524
+ */
525
+ overlay = this._templates.overlay.evaluate(this._templateParams.overlay);
526
+
527
+ /**
528
+ * Add the overlay to the overlay container.
529
+ */
530
+ $$(this._selectors.overlay_container)[0].insert(overlay);
531
+
532
+ /**
533
+ * Get the overlay as an Element, rather than pure HTML.
534
+ *
535
+ * @type {HTMLElement}
536
+ */
537
+ overlay = $(this._templateParams.overlay.overlay_id);
538
+
539
+ /**
540
+ * Store the overlay.
541
+ *
542
+ * @type {HTMLElement}
543
+ * @private
544
+ */
545
+ this._overlay = overlay;
546
+
547
+ /**
548
+ * Initialize the overlay observers.
549
+ */
550
+ this._initOverlayObservers();
551
+ }
552
+
553
+ /**
554
+ * Set the default values for the postcode and house number fields.
555
+ */
556
+ this._setSearchFieldValues();
557
+
558
+ /**
559
+ * Do an immediate search for locations if no locations are stored.
560
+ */
561
+ if (isEmptyObj(this._locations)) {
562
+ this._searchForLocations();
563
+ }
564
+
565
+ /**
566
+ * Show the overlay window.
567
+ */
568
+ $$('body')[0].addClassName('overlay_open');
569
+ overlay.up().show();
570
+
571
+ return this;
572
+ },
573
+
574
+ /**
575
+ * Close the overlay window.
576
+ *
577
+ * @returns {MyParcelCheckout}
578
+ */
579
+ closeOverlay : function() {
580
+ $$('body')[0].removeClassName('overlay_open');
581
+ this._overlay.up().hide();
582
+
583
+ /**
584
+ * If no location was selected, deselect the shipping method.
585
+ */
586
+ if (!this._selectedLocation) {
587
+ $$(this._selectors.shipping_method)[0].checked = false;
588
+ }
589
+
590
+ return this;
591
+ },
592
+
593
+ /**
594
+ * Show the locations loader spinner.
595
+ *
596
+ * @returns {MyParcelCheckout}
597
+ */
598
+ showLocationLoader : function() {
599
+ $(this._templateParams.overlay.location_loader_id).show();
600
+
601
+ return this;
602
+ },
603
+
604
+ /**
605
+ * Hide the locations loader spinner.
606
+ *
607
+ * @returns {MyParcelCheckout}
608
+ */
609
+ hideLocationLoader : function() {
610
+ $(this._templateParams.overlay.location_loader_id).hide();
611
+
612
+ return this;
613
+ },
614
+
615
+ /**
616
+ * Render the found locations based on the location template.
617
+ *
618
+ * @param response
619
+ * @returns {MyParcelCheckout}
620
+ */
621
+ renderLocations : function(response) {
622
+ /**
623
+ * Get the found locations from the AJAX response and validate that it's valid JSON.
624
+ * @type {string}
625
+ */
626
+ var json = response.responseText;
627
+ try {
628
+ var result = json.evalJSON(true);
629
+ if (!result.data) {
630
+ this.showLocationsError();
631
+ this.hideLocationLoader();
632
+
633
+ return this;
634
+ }
635
+ } catch (e) {
636
+ /**
637
+ * If the result was not valid, show the 'no locations found'-error.
638
+ */
639
+ this.showLocationsError();
640
+ this.hideLocationLoader();
641
+
642
+ return this;
643
+ }
644
+
645
+ var locationContainer = $(this._templateParams.overlay.location_list_id);
646
+ var newLocationsHtml = '';
647
+ var newLocations = {};
648
+
649
+ /**
650
+ * Build the HTML structure for each location found.
651
+ */
652
+ result.data.each(function(location) {
653
+ /**
654
+ * Get the location data and opening hours.
655
+ */
656
+ var locationData = location;
657
+ var openingHours = locationData.opening_hours;
658
+
659
+ /**
660
+ * Restructure the opening hours so the template can parse it.
661
+ * @type {string}
662
+ */
663
+ locationData.opening_hours_monday = openingHours.monday.join(', ');
664
+ locationData.opening_hours_tuesday = openingHours.tuesday.join(', ');
665
+ locationData.opening_hours_wednesday = openingHours.wednesday.join(', ');
666
+ locationData.opening_hours_thursday = openingHours.thursday.join(', ');
667
+ locationData.opening_hours_friday = openingHours.friday.join(', ');
668
+ locationData.opening_hours_saturday = openingHours.saturday.join(', ');
669
+ locationData.opening_hours_sunday = openingHours.sunday.join(', ');
670
+
671
+ /**
672
+ * Add some additional data to the template parameters.
673
+ */
674
+ var locationTemplateParams = this._templateParams.location;
675
+ locationTemplateParams.location_id = this._templateParams.location.location_id_prefix
676
+ + location.location_code;
677
+ locationTemplateParams.location_info_id = this._templateParams.location.location_info_id_prefix
678
+ + location.location_code;
679
+ locationTemplateParams.select_location_onclick = this._templateParams.location.select_location_onclick_class
680
+ + '.selectLocation(this);';
681
+
682
+ /**
683
+ * Merge the template parameters with the location data.
684
+ */
685
+ locationData = Object.extend(locationData, locationTemplateParams);
686
+
687
+ /**
688
+ * Add the location to the stored locations object and render it's HTML.
689
+ */
690
+ newLocations[location.location_code] = location;
691
+ newLocationsHtml += this._templates.location.evaluate(locationData);
692
+ }.bind(this));
693
+
694
+ /**
695
+ * Add the HTML of all found locations to the locations container element.
696
+ */
697
+ locationContainer.update(newLocationsHtml);
698
+
699
+ /**
700
+ * Store the found locations.
701
+ * @type {{}}
702
+ * @private
703
+ */
704
+ this._locations = newLocations;
705
+
706
+ /**
707
+ * Hide the locations loader spinner.
708
+ */
709
+ this.hideLocationLoader();
710
+
711
+ return this;
712
+ },
713
+
714
+ /**
715
+ * Remove all previously found locations.
716
+ *
717
+ * @returns {MyParcelCheckout}
718
+ */
719
+ removeLocations : function() {
720
+ $(this._templateParams.overlay.location_list_id).update('');
721
+
722
+ return this;
723
+ },
724
+
725
+ /**
726
+ * Show the locations error message.
727
+ *
728
+ * @returns {MyParcelCheckout}
729
+ */
730
+ showLocationsError : function() {
731
+ var locationContainer = $(this._templateParams.overlay.location_list_id);
732
+
733
+ locationContainer.update(this._templates.location_error.evaluate({}));
734
+
735
+ return this;
736
+ },
737
+
738
+ /**
739
+ * Select a location.
740
+ *
741
+ * @param {HTMLElement} element
742
+ * @returns {MyParcelCheckout}
743
+ */
744
+ selectLocation : function(element) {
745
+ /**
746
+ * Get the selected location code.
747
+ */
748
+ var locationContainer = element.up('.' + this._templateParams.location.location_class);
749
+ var locationCode = locationContainer.getAttribute('data-location_code');
750
+
751
+ /**
752
+ * Get the location object.
753
+ */
754
+ this._selectedLocation = this._locations[locationCode];
755
+
756
+ /**
757
+ * Render the selected location for future reference for the user.
758
+ */
759
+ this.renderSelectedLocation();
760
+
761
+ /**
762
+ * Close the overlay window.
763
+ */
764
+ this.closeOverlay();
765
+
766
+ this._config.select_location_callback();
767
+
768
+ if (this._config.save_location_on_select) {
769
+ this.saveSelectedLocation();
770
+ }
771
+
772
+ return this;
773
+ },
774
+
775
+ /**
776
+ * Render the selected location based on it's template.
777
+ *
778
+ * @returns {*}
779
+ */
780
+ renderSelectedLocation : function() {
781
+ /**
782
+ * Get the selected location.
783
+ * @type {boolean|{}}
784
+ */
785
+ var selectedLocation = this._selectedLocation;
786
+ if (!selectedLocation) {
787
+ return false;
788
+ }
789
+
790
+ /**
791
+ * Remove the previously selected location.
792
+ */
793
+ if ($(this._templateParams.selected_location.selected_location_id)) {
794
+ $(this._templateParams.selected_location.selected_location_id).remove();
795
+ }
796
+
797
+ /**
798
+ * Parse the selected location template.
799
+ */
800
+ var selectedLocationTemplate = this._templates.selected_location;
801
+ var selectedLocationContainer = $$(this._selectors.shipping_method)[0].up();
802
+ var templateParams = Object.extend(
803
+ selectedLocation,
804
+ this._templateParams.selected_location
805
+ );
806
+
807
+ /**
808
+ * Add the selected location at the bottom of the shipping method's parent container.
809
+ */
810
+ selectedLocationContainer.insert({
811
+ bottom : selectedLocationTemplate.evaluate(templateParams)
812
+ });
813
+
814
+ return this;
815
+ },
816
+
817
+ /**
818
+ * Save the selected location.
819
+ *
820
+ * @returns {boolean}
821
+ */
822
+ saveSelectedLocation : function() {
823
+ /**
824
+ * Get the selected location.
825
+ * @type {boolean|{}}
826
+ */
827
+ var selectedLocation = this._selectedLocation;
828
+ if (!selectedLocation) {
829
+ return true;
830
+ }
831
+
832
+ /**
833
+ * Form an object containing the location's address.
834
+ * @type {{city: *, name: *, telephone: *, postcode: *, street: *, housenr: *}}
835
+ */
836
+ var address = {
837
+ city : selectedLocation.city,
838
+ name : selectedLocation.location,
839
+ telephone : selectedLocation.phone_number,
840
+ postcode : selectedLocation.postcode,
841
+ street : selectedLocation.street,
842
+ housenr : selectedLocation.street_number
843
+ };
844
+ /**
845
+ * JSON-encode the address for AJAX.
846
+ */
847
+ address = Object.toJSON(address);
848
+
849
+ /**
850
+ * Send an AJAX request to save the address.
851
+ */
852
+ new Ajax.Request(this._config.save_location_url, {
853
+ method : 'post',
854
+ parameters : {
855
+ address : address,
856
+ isAjax : true
857
+ },
858
+ onSuccess : this._config.save_location_success_callback,
859
+ onFailure : this._config.save_location_error_callback
860
+ });
861
+
862
+ return true;
863
+ }
864
+ };
skin/frontend/base/default/js/TIG/MyParcel2014/pg_address.js DELETED
@@ -1,157 +0,0 @@
1
- /**
2
- * ___________ __ __
3
- * \__ ___/____ _/ |_ _____ | |
4
- * | | / _ \\ __\\__ \ | |
5
- * | | | |_| || | / __ \_| |__
6
- * |____| \____/ |__| (____ /|____/
7
- * \/
8
- * ___ __ __
9
- * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
10
- * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
11
- * | || | \| | \ ___/ | | \/| | \\ ___/ | |
12
- * |___||___| /|__| \_____>|__| |___| / \_____>|__|
13
- * \/ \/
14
- * ________
15
- * / _____/_______ ____ __ __ ______
16
- * / \ ___\_ __ \ / _ \ | | \\____ \
17
- * \ \_\ \| | \/| |_| || | /| |_| |
18
- * \______ /|__| \____/ |____/ | __/
19
- * \/ |__|
20
- *
21
- * NOTICE OF LICENSE
22
- *
23
- * This source file is subject to the Creative Commons License.
24
- * It is available through the world-wide-web at this URL:
25
- * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
26
- * If you are unable to obtain it through the world-wide-web, please send an email
27
- * to servicedesk@tig.nl so we can send you a copy immediately.
28
- *
29
- * DISCLAIMER
30
- *
31
- * Do not edit or add to this file if you wish to upgrade this module to newer
32
- * versions in the future. If you wish to customize this module for your
33
- * needs please contact servicedesk@tig.nl for more information.
34
- *
35
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
36
- * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
37
- */
38
-
39
- var MyParcelPgAddress = new Class.create();
40
- MyParcelPgAddress.prototype = {
41
- options : null,
42
- fieldset : null,
43
- address : false,
44
- _isDebug : null,
45
-
46
- /**
47
- * @constructor
48
- */
49
- initialize : function (fieldset, options) {
50
- options = Object.extend({
51
- debug : false
52
- }, options || {});
53
-
54
- this.setOptions(options);
55
- this.setFieldset(fieldset);
56
- },
57
-
58
- setOptions : function(options) {
59
- this.options = options;
60
-
61
- return this;
62
- },
63
-
64
- getOptions : function() {
65
- return this.options;
66
- },
67
-
68
- setFieldset : function(fieldset) {
69
- this.fieldset = fieldset;
70
-
71
- return this;
72
- },
73
-
74
- getFieldset : function() {
75
- return this.fieldset;
76
- },
77
-
78
- setAddress : function(address) {
79
- address = Object.extend({
80
- firstname : '-',
81
- lastname : '-',
82
- name : '-',
83
- street : '-',
84
- housenumber : '-',
85
- housenumberadd : '-',
86
- postalcode : '-',
87
- city : '-',
88
- country : '-',
89
- phone : '-'
90
- }, address || {});
91
-
92
- if (address['postalcodenum'] && address['postalcodealpha']) {
93
- address.postalcode = address['postalcodenum'] + address['postalcodealpha'];
94
- }
95
-
96
- this.address = address;
97
-
98
- return this;
99
- },
100
-
101
- getAddress : function() {
102
- return this.address;
103
- },
104
-
105
- isDebug : function() {
106
- if (this._isDebug !== null) {
107
- return this._isDebug;
108
- }
109
-
110
- var options = this.getOptions();
111
- if (options.debug == true) {
112
- this._isDebug = true;
113
- return true;
114
- }
115
-
116
- this._isDebug = false;
117
- return false;
118
- },
119
-
120
- updateFieldset : function() {
121
- var address = this.getAddress();
122
- if (!address) {
123
- if (this.isDebug()) {
124
- console.error('Missing address data');
125
- }
126
- return this;
127
- }
128
-
129
- var fieldset = this.getFieldset();
130
- var addressValue;
131
- fieldset.select('input').each(function(element) {
132
- var addressKey = element.readAttribute('data-tig-myparcel-address-key');
133
- if (!addressKey) {
134
- return;
135
- }
136
-
137
- addressValue = address[addressKey];
138
- if (!addressValue) {
139
- if (this.isDebug()) {
140
- console.error('No data for field ' + addressKey);
141
- }
142
- addressValue = '-';
143
- }
144
- element.setValue(addressValue)
145
- }.bind(this));
146
-
147
- // populate info div placeholder
148
- var pginfo = $('pginfodiv');
149
- if(pginfo) {
150
- var pgstreet1 = address['street'] + ' ' + address['housenumber'] + address['housenumberadd'];
151
- var pgstreet2 = address['postalcode'] + ' ' + address['city'] + ' (' + address['country'] + ')';
152
- pginfo.innerHTML = '<p>' + address['name'] + '<br/>' + pgstreet1 + '<br/>' + pgstreet2 + '</p>';
153
- }
154
-
155
- return this;
156
- }
157
- };