bpost - Version 1.0.5

Version Notes

Translations and Bugfixing

Download this release

Release Info

Developer PHPro
Extension bpost
Version 1.0.5
Comparing to
See all releases


Code changes from version 1.0.3 to 1.0.5

Files changed (29) hide show
  1. app/code/community/Bpost/ShM/Block/Adminhtml/Sales/Grid.php +3 -15
  2. app/code/community/Bpost/ShM/Block/Carrier/Bpost.php +1 -1
  3. app/code/community/Bpost/ShM/Controller/ShM/Order.php +5 -5
  4. app/code/community/Bpost/ShM/Helper/Data.php +19 -36
  5. app/code/community/Bpost/ShM/Helper/Returnlabel.php +2 -2
  6. app/code/community/Bpost/ShM/Model/Adminhtml/Bpostgrid.php +33 -26
  7. app/code/community/Bpost/ShM/Model/Adminhtml/Observer.php +8 -29
  8. app/code/community/Bpost/ShM/Model/Adminhtml/System/Config/Source/Datecomment.php +1 -1
  9. app/code/community/Bpost/ShM/Model/Api.php +7 -7
  10. app/code/community/Bpost/ShM/Model/Api/Abstract.php +10 -4
  11. app/code/community/Bpost/ShM/Model/Api/Domcreator.php +52 -51
  12. app/code/community/Bpost/ShM/Model/Observer.php +35 -46
  13. app/code/community/Bpost/ShM/Model/Returnlabel.php +7 -7
  14. app/code/community/Bpost/ShM/Model/Shipping/Carrier/BpostShM.php +28 -31
  15. app/code/community/Bpost/ShM/Model/Shipping/Geocode.php +15 -15
  16. app/code/community/Bpost/ShM/controllers/Adminhtml/Bpost/ShM/AllOrdersController.php +2 -2
  17. app/code/community/Bpost/ShM/controllers/Adminhtml/Bpost/ShM/ConfigController.php +13 -6
  18. app/code/community/Bpost/ShM/controllers/Adminhtml/Bpost/ShM/DownloadController.php +12 -19
  19. app/code/community/Bpost/ShM/controllers/Adminhtml/Bpost/ShM/PendingOrdersController.php +2 -2
  20. app/code/community/Bpost/ShM/controllers/AjaxController.php +26 -28
  21. app/code/community/Bpost/ShM/etc/config.xml +1 -1
  22. app/code/community/Bpost/ShM/etc/system.xml +1 -1
  23. app/code/community/Bpost/ShM/sql/bpost_shm_setup/upgrade-0.0.7-0.0.8.php +2 -2
  24. app/code/community/Bpost/ShM/sql/bpost_shm_setup/upgrade-0.0.9-0.0.10.php +2 -2
  25. app/code/community/Bpost/ShM/sql/bpost_shm_setup/upgrade-0.1.3-0.1.4.php +2 -2
  26. app/design/frontend/base/default/template/bpost/shm/append_bpost_shippingmethod.phtml +2 -2
  27. app/locale/en_US/template/email/bpost/returnlabel.html +1 -1
  28. package.xml +4 -4
  29. skin/frontend/base/default/js/bpost/onestepcheckout.js +6 -5
app/code/community/Bpost/ShM/Block/Adminhtml/Sales/Grid.php CHANGED
@@ -38,7 +38,6 @@ class Bpost_ShM_Block_Adminhtml_Sales_Grid extends Mage_Adminhtml_Block_Widget_G
38
  protected function _prepareColumns()
39
  {
40
  $helper = Mage::helper('bpost_shm');
41
-
42
  $this->addColumn('real_order_id', array(
43
  'header' => $helper->__('Order #'),
44
  'width' => '80px',
@@ -46,7 +45,6 @@ class Bpost_ShM_Block_Adminhtml_Sales_Grid extends Mage_Adminhtml_Block_Widget_G
46
  'index' => 'increment_id',
47
  'filter_index' => 'main_table.increment_id'
48
  ));
49
-
50
  if (!Mage::app()->isSingleStoreMode()) {
51
  $this->addColumn('store_id', array(
52
  'header' => $helper->__('Purchased From (Store)'),
@@ -64,19 +62,16 @@ class Bpost_ShM_Block_Adminhtml_Sales_Grid extends Mage_Adminhtml_Block_Widget_G
64
  'width' => '100px',
65
  'filter_index' => 'main_table.created_at'
66
  ));
67
-
68
  $this->addColumn('billing_name', array(
69
  'header' => $helper->__('Bill to Name'),
70
  'index' => 'billing_name',
71
  'filter_index' => 'main_table.billing_name'
72
  ));
73
-
74
  $this->addColumn('shipping_name', array(
75
  'header' => $helper->__('Ship to Name'),
76
  'index' => 'shipping_customer_name',
77
  'filter_condition_callback' => array($this, '_shippingNameFilter'),
78
  ));
79
-
80
  $this->addColumn('grand_total', array(
81
  'header' => $helper->__('G.T. (Purchased)'),
82
  'index' => 'grand_total',
@@ -84,14 +79,12 @@ class Bpost_ShM_Block_Adminhtml_Sales_Grid extends Mage_Adminhtml_Block_Widget_G
84
  'currency' => 'order_currency_code',
85
  'filter_index' => 'main_table.grand_total'
86
  ));
87
-
88
  $this->addColumn('total_qty_ordered', array(
89
  'header' => $helper->__('# of Items'),
90
  'type' => 'int',
91
  'index' => 'total_qty_ordered',
92
  'width' => '100px',
93
  ));
94
-
95
  $this->addColumn('status', array(
96
  'header' => $helper->__('Status'),
97
  'index' => 'status',
@@ -100,14 +93,12 @@ class Bpost_ShM_Block_Adminhtml_Sales_Grid extends Mage_Adminhtml_Block_Widget_G
100
  'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
101
  'filter_index' => 'main_table.status'
102
  ));
103
-
104
  $this->addColumn('bpost_status', array(
105
  'header' => $helper->__('bpost status'),
106
  'index' => 'bpost_status',
107
  'type' => 'text',
108
  'width' => '100px'
109
  ));
110
-
111
  $this->addColumn('bpost_label_exists', array(
112
  'header' => $helper->__('Label download'),
113
  'index' => 'bpost_label_exists',
@@ -117,7 +108,6 @@ class Bpost_ShM_Block_Adminhtml_Sales_Grid extends Mage_Adminhtml_Block_Widget_G
117
  'options' => array('1' => 'Yes', '0' => 'No'),
118
  'filter_index' => 'sfo.bpost_label_exists'
119
  ));
120
-
121
  if (Mage::getStoreConfig('shipping/bpost_shm/display_delivery_date')) {
122
  $this->addColumn('bpost_drop_date', array(
123
  'header' => $helper->__('Drop date'),
@@ -127,7 +117,6 @@ class Bpost_ShM_Block_Adminhtml_Sales_Grid extends Mage_Adminhtml_Block_Widget_G
127
  'renderer' => 'bpost_shm/adminhtml_sales_grid_renderer_dropdate_dateformat'
128
  ));
129
  }
130
-
131
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
132
  $this->addColumn('action',
133
  array(
@@ -148,7 +137,6 @@ class Bpost_ShM_Block_Adminhtml_Sales_Grid extends Mage_Adminhtml_Block_Widget_G
148
  'is_system' => true,
149
  ));
150
  }
151
-
152
  return parent::_prepareColumns();
153
  }
154
 
@@ -192,7 +180,7 @@ class Bpost_ShM_Block_Adminhtml_Sales_Grid extends Mage_Adminhtml_Block_Widget_G
192
  */
193
  protected function _prepareMassactionBlock()
194
  {
195
- $massActionJsObjectName = $this->getHtmlId()."_massactionJsObject";
196
  $gridJsObjectName = $this->getHtmlId()."JsObject";
197
  $massActionBlock = $this->getLayout()->createBlock($this->getMassactionBlockName());
198
 
@@ -200,7 +188,7 @@ class Bpost_ShM_Block_Adminhtml_Sales_Grid extends Mage_Adminhtml_Block_Widget_G
200
  ->createBlock('adminhtml/widget_button')
201
  ->setData(array(
202
  'label' => Mage::helper('bpost_shm')->__('Submit'),
203
- 'onclick' => "generateAndComplete('".$massActionJsObjectName."','".$gridJsObjectName."')",
204
  ))->toHtml();
205
 
206
  $this->setChild('massaction', $massActionBlock
@@ -230,7 +218,7 @@ class Bpost_ShM_Block_Adminhtml_Sales_Grid extends Mage_Adminhtml_Block_Widget_G
230
  return $this;
231
  }
232
 
233
- $this->getCollection()->getSelect()->where(
234
  "IF(shipping_method='bpostshm_bpost_international', CONCAT('International: ', shipping_name), shipping_name) like ?"
235
  , "%$value%"
236
  );
38
  protected function _prepareColumns()
39
  {
40
  $helper = Mage::helper('bpost_shm');
 
41
  $this->addColumn('real_order_id', array(
42
  'header' => $helper->__('Order #'),
43
  'width' => '80px',
45
  'index' => 'increment_id',
46
  'filter_index' => 'main_table.increment_id'
47
  ));
 
48
  if (!Mage::app()->isSingleStoreMode()) {
49
  $this->addColumn('store_id', array(
50
  'header' => $helper->__('Purchased From (Store)'),
62
  'width' => '100px',
63
  'filter_index' => 'main_table.created_at'
64
  ));
 
65
  $this->addColumn('billing_name', array(
66
  'header' => $helper->__('Bill to Name'),
67
  'index' => 'billing_name',
68
  'filter_index' => 'main_table.billing_name'
69
  ));
 
70
  $this->addColumn('shipping_name', array(
71
  'header' => $helper->__('Ship to Name'),
72
  'index' => 'shipping_customer_name',
73
  'filter_condition_callback' => array($this, '_shippingNameFilter'),
74
  ));
 
75
  $this->addColumn('grand_total', array(
76
  'header' => $helper->__('G.T. (Purchased)'),
77
  'index' => 'grand_total',
79
  'currency' => 'order_currency_code',
80
  'filter_index' => 'main_table.grand_total'
81
  ));
 
82
  $this->addColumn('total_qty_ordered', array(
83
  'header' => $helper->__('# of Items'),
84
  'type' => 'int',
85
  'index' => 'total_qty_ordered',
86
  'width' => '100px',
87
  ));
 
88
  $this->addColumn('status', array(
89
  'header' => $helper->__('Status'),
90
  'index' => 'status',
93
  'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
94
  'filter_index' => 'main_table.status'
95
  ));
 
96
  $this->addColumn('bpost_status', array(
97
  'header' => $helper->__('bpost status'),
98
  'index' => 'bpost_status',
99
  'type' => 'text',
100
  'width' => '100px'
101
  ));
 
102
  $this->addColumn('bpost_label_exists', array(
103
  'header' => $helper->__('Label download'),
104
  'index' => 'bpost_label_exists',
108
  'options' => array('1' => 'Yes', '0' => 'No'),
109
  'filter_index' => 'sfo.bpost_label_exists'
110
  ));
 
111
  if (Mage::getStoreConfig('shipping/bpost_shm/display_delivery_date')) {
112
  $this->addColumn('bpost_drop_date', array(
113
  'header' => $helper->__('Drop date'),
117
  'renderer' => 'bpost_shm/adminhtml_sales_grid_renderer_dropdate_dateformat'
118
  ));
119
  }
 
120
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
121
  $this->addColumn('action',
122
  array(
137
  'is_system' => true,
138
  ));
139
  }
 
140
  return parent::_prepareColumns();
141
  }
142
 
180
  */
181
  protected function _prepareMassactionBlock()
182
  {
183
+ $massActionJsName = $this->getHtmlId()."_massactionJsObject";
184
  $gridJsObjectName = $this->getHtmlId()."JsObject";
185
  $massActionBlock = $this->getLayout()->createBlock($this->getMassactionBlockName());
186
 
188
  ->createBlock('adminhtml/widget_button')
189
  ->setData(array(
190
  'label' => Mage::helper('bpost_shm')->__('Submit'),
191
+ 'onclick' => "generateAndComplete('".$massActionJsName."','".$gridJsObjectName."')",
192
  ))->toHtml();
193
 
194
  $this->setChild('massaction', $massActionBlock
218
  return $this;
219
  }
220
 
221
+ $collection->getSelect()->where(
222
  "IF(shipping_method='bpostshm_bpost_international', CONCAT('International: ', shipping_name), shipping_name) like ?"
223
  , "%$value%"
224
  );
app/code/community/Bpost/ShM/Block/Carrier/Bpost.php CHANGED
@@ -59,7 +59,7 @@ class Bpost_ShM_Block_Carrier_Bpost extends Mage_Core_Block_Template
59
  "datepicker_saturday_pickuppoint" => (bool)$configHelper->getBpostCarriersConfig("saturday_delivery", "bpost_pickuppoint", Mage::app()->getStore()->getId()),
60
  "datepicker_saturday_parcellocker" => (bool)$configHelper->getBpostCarriersConfig("saturday_delivery", "bpost_parcellocker", Mage::app()->getStore()->getId()),
61
  "datepicker_days" => $this->getShippingDates(),
62
- "onestepcheckout_active" => $bpostHelper->getIsOnestepCheckout(),
63
  "onestepcheckout_shipping_address_error" => $bpostHelper->__("Please select a postcode or city first.")
64
  );
65
 
59
  "datepicker_saturday_pickuppoint" => (bool)$configHelper->getBpostCarriersConfig("saturday_delivery", "bpost_pickuppoint", Mage::app()->getStore()->getId()),
60
  "datepicker_saturday_parcellocker" => (bool)$configHelper->getBpostCarriersConfig("saturday_delivery", "bpost_parcellocker", Mage::app()->getStore()->getId()),
61
  "datepicker_days" => $this->getShippingDates(),
62
+ "onestepcheckout_active" => $bpostHelper->isOnestepCheckout(),
63
  "onestepcheckout_shipping_address_error" => $bpostHelper->__("Please select a postcode or city first.")
64
  );
65
 
app/code/community/Bpost/ShM/Controller/ShM/Order.php CHANGED
@@ -79,18 +79,18 @@ class Bpost_ShM_Controller_ShM_Order extends Mage_Adminhtml_Controller_Action
79
 
80
  //first check if we have already messages in this request
81
  //if so, add these to the messages array
82
- foreach(Mage::getSingleton('core/session')->getMessages()->getItems() as $currentSessionMessage){
83
- switch($currentSessionMessage->getType()){
84
  case "notice":
85
- $messages["notice"][] = $currentSessionMessage->getCode();
86
  break;
87
 
88
  case "error":
89
- $messages["error"][] = $currentSessionMessage->getCode();
90
  break;
91
 
92
  case "success":
93
- $messages["success"][] = $currentSessionMessage->getCode();
94
  break;
95
  }
96
  }
79
 
80
  //first check if we have already messages in this request
81
  //if so, add these to the messages array
82
+ foreach(Mage::getSingleton('core/session')->getMessages()->getItems() as $sessionMessage){
83
+ switch($sessionMessage->getType()){
84
  case "notice":
85
+ $messages["notice"][] = $sessionMessage->getCode();
86
  break;
87
 
88
  case "error":
89
+ $messages["error"][] = $sessionMessage->getCode();
90
  break;
91
 
92
  case "success":
93
+ $messages["success"][] = $sessionMessage->getCode();
94
  break;
95
  }
96
  }
app/code/community/Bpost/ShM/Helper/Data.php CHANGED
@@ -153,14 +153,14 @@ class Bpost_ShM_Helper_Data extends Mage_Core_Helper_Abstract
153
  $hash = bin2hex(mcrypt_create_iv(5, MCRYPT_DEV_URANDOM));
154
  $name = $name . "-" . $hash;
155
 
156
- $io = new Varien_Io_File();
157
- $io->setAllowCreateFolders(true);
158
- $io->open(array('path' => Mage::getBaseDir('media') . "/bpost/" . $folder));
159
- $io->streamOpen($name . '.pdf', 'w+');
160
- $io->streamLock(true);
161
- $io->streamWrite($pdfString);
162
- $io->streamUnlock();
163
- $io->streamClose();
164
  return $name;
165
  }
166
 
@@ -168,10 +168,10 @@ class Bpost_ShM_Helper_Data extends Mage_Core_Helper_Abstract
168
  * Function returns the locale code by order
169
  *
170
  * @param $order
171
- * @param $useExceptionLanguages
172
  * @return string
173
  */
174
- public function getLocaleByOrder($order, $useExceptionLanguages = false)
175
  {
176
  $exceptionLanguages = array("DE");
177
 
@@ -187,7 +187,7 @@ class Bpost_ShM_Helper_Data extends Mage_Core_Helper_Abstract
187
  break;
188
 
189
  default:
190
- if ($useExceptionLanguages && in_array($locale, $exceptionLanguages)) {
191
  return $locale;
192
  }
193
 
@@ -348,7 +348,7 @@ class Bpost_ShM_Helper_Data extends Mage_Core_Helper_Abstract
348
  }
349
  } else {
350
 
351
- if($bpostHelper->getIsOnestepCheckout()){
352
  if(isset($params["address_id"]) && $params["address_id"] != null){
353
  //load customer address and use
354
  $shippingAddress = Mage::getModel("customer/address")->load($params["address_id"]);
@@ -512,38 +512,30 @@ class Bpost_ShM_Helper_Data extends Mage_Core_Helper_Abstract
512
  $shippingCost = $quote->getShippingAddress()->getData('shipping_incl_tax');
513
  //bpost helper
514
  $helper = Mage::helper('bpost_shm');
515
-
516
  //get config values
517
  $configHelper = Mage::helper("bpost_shm/system_config");
518
  $displayDeliveryDate = (bool)$configHelper->getBpostShippingConfig("display_delivery_date", Mage::app()->getStore()->getId());
519
  $chooseDeliveryDate = (bool)$configHelper->getBpostShippingConfig("choose_delivery_date", Mage::app()->getStore()->getId());
520
- $daysBetweenOrderAndShipment = $configHelper->getBpostShippingConfig("days_between_order_and_shipment", Mage::app()->getStore()->getId());
521
- $nrOfDeliveryDaysShown = $configHelper->getBpostShippingConfig("nr_of_delivery_days_shown", Mage::app()->getStore()->getId());
522
- $nextDayDeliveryAllowedTill = $configHelper->getBpostShippingConfig("next_day_delivery_allowed_till", Mage::app()->getStore()->getId());
523
-
524
  //get the Magento date model
525
  $dateModel = Mage::getSingleton('core/date');
526
-
527
  //days to add counter, will always be 1 since delivery is never on the same day
528
  $daysToStart = 1;
529
-
530
  //add a day if the current time surpasses the time treshold
531
  $time = $dateModel->date('H,i');
532
-
533
- if($nextDayDeliveryAllowedTill <= $time && substr($nextDayDeliveryAllowedTill, 0, 5) != '00,00') {
534
  $daysToStart = 2;
535
  }
536
-
537
  //get the current date
538
  $currentDate = $dateModel->date();
539
-
540
  //define all bpost shipping methods
541
  $shippingMethods = array(
542
  'bpost_homedelivery' => false,
543
  'bpost_pickuppoint' => false,
544
  'bpost_parcellocker' => false
545
  );
546
-
547
  foreach ($shippingMethods as $method => $value) {
548
  //get saturday delivery flags
549
  $saturdayDelivery = (bool)$configHelper->getBpostCarriersConfig("saturday_delivery", $method, Mage::app()->getStore()->getId());
@@ -552,11 +544,9 @@ class Bpost_ShM_Helper_Data extends Mage_Core_Helper_Abstract
552
  if(($grandTotal - $shippingCost) < $saturdayDeliveryFrom) {
553
  $saturdayDelivery = false;
554
  }
555
-
556
  $extraDays = $daysToStart;
557
  //add total days between order and shipment
558
- $totalDays = $extraDays + $daysBetweenOrderAndShipment;
559
-
560
  //loop over days checking for the first valid day
561
  for($i = 1; $i <= $totalDays; $i++) {
562
  $nextDate = $this->_formatDeliveryDate($currentDate.' +'.$i.' days');
@@ -565,9 +555,7 @@ class Bpost_ShM_Helper_Data extends Mage_Core_Helper_Abstract
565
  $totalDays++;
566
  }
567
  }
568
-
569
  $startDate = $this->_formatDeliveryDate($currentDate.' +'.$totalDays.' days');
570
-
571
  //customer gets a date from the system
572
  if($displayDeliveryDate && !$chooseDeliveryDate) {
573
  $shippingMethods[$method] = array(
@@ -581,8 +569,7 @@ class Bpost_ShM_Helper_Data extends Mage_Core_Helper_Abstract
581
  } else if($displayDeliveryDate && $chooseDeliveryDate) {
582
  $days = array();
583
  $addedDays = 0;
584
-
585
- for($i = 0; $i < $nrOfDeliveryDaysShown; $i++) {
586
  //add starting date to array
587
  if($i == 0) {
588
  $days[$i] = array(
@@ -593,7 +580,6 @@ class Bpost_ShM_Helper_Data extends Mage_Core_Helper_Abstract
593
  } else {
594
  $addedDays++;
595
  $nextDate = $this->_formatDeliveryDate($startDate.' +'.$addedDays.' days');
596
-
597
  $validDate = false;
598
  while($validDate == false) {
599
  if($this->_isValidDeliveryDate($nextDate, $saturdayDelivery, $method, $closedOn)) {
@@ -603,18 +589,15 @@ class Bpost_ShM_Helper_Data extends Mage_Core_Helper_Abstract
603
  $nextDate = $this->_formatDeliveryDate($startDate.' +'.$addedDays.' days');
604
  }
605
  }
606
-
607
  $days[$i] = array(
608
  'date' => $nextDate,
609
  'date_format' => $helper->__($this->_formatDeliveryDate($nextDate, 'l')).'<span>'.$this->_formatDeliveryDate($nextDate, 'j')." ".strtolower($helper->__($this->_formatDeliveryDate($nextDate, 'F'))).'</span>'
610
  );
611
  }
612
  }
613
-
614
  $shippingMethods[$method] = $days;
615
  }
616
  }
617
-
618
  return $shippingMethods;
619
  }
620
 
@@ -772,7 +755,7 @@ class Bpost_ShM_Helper_Data extends Mage_Core_Helper_Abstract
772
  *
773
  * @return bool
774
  */
775
- public function getIsOnestepCheckout()
776
  {
777
  if (strpos(Mage::helper("core/url")->getCurrentUrl(), 'onestepcheckout') !== false || strpos(Mage::app()->getRequest()->getHeader('referer'), 'onestepcheckout') !== false) {
778
  return true;
153
  $hash = bin2hex(mcrypt_create_iv(5, MCRYPT_DEV_URANDOM));
154
  $name = $name . "-" . $hash;
155
 
156
+ $varienFile = new Varien_Io_File();
157
+ $varienFile->setAllowCreateFolders(true);
158
+ $varienFile->open(array('path' => Mage::getBaseDir('media') . "/bpost/" . $folder));
159
+ $varienFile->streamOpen($name . '.pdf', 'w+');
160
+ $varienFile->streamLock(true);
161
+ $varienFile->streamWrite($pdfString);
162
+ $varienFile->streamUnlock();
163
+ $varienFile->streamClose();
164
  return $name;
165
  }
166
 
168
  * Function returns the locale code by order
169
  *
170
  * @param $order
171
+ * @param $useExceptionLanguage
172
  * @return string
173
  */
174
+ public function getLocaleByOrder($order, $useExceptionLanguage = false)
175
  {
176
  $exceptionLanguages = array("DE");
177
 
187
  break;
188
 
189
  default:
190
+ if ($useExceptionLanguage && in_array($locale, $exceptionLanguages)) {
191
  return $locale;
192
  }
193
 
348
  }
349
  } else {
350
 
351
+ if($bpostHelper->isOnestepCheckout()){
352
  if(isset($params["address_id"]) && $params["address_id"] != null){
353
  //load customer address and use
354
  $shippingAddress = Mage::getModel("customer/address")->load($params["address_id"]);
512
  $shippingCost = $quote->getShippingAddress()->getData('shipping_incl_tax');
513
  //bpost helper
514
  $helper = Mage::helper('bpost_shm');
 
515
  //get config values
516
  $configHelper = Mage::helper("bpost_shm/system_config");
517
  $displayDeliveryDate = (bool)$configHelper->getBpostShippingConfig("display_delivery_date", Mage::app()->getStore()->getId());
518
  $chooseDeliveryDate = (bool)$configHelper->getBpostShippingConfig("choose_delivery_date", Mage::app()->getStore()->getId());
519
+ $daysBetweenShipment = $configHelper->getBpostShippingConfig("days_between_order_and_shipment", Mage::app()->getStore()->getId());
520
+ $nrOfDaysShown = $configHelper->getBpostShippingConfig("nr_of_delivery_days_shown", Mage::app()->getStore()->getId());
521
+ $cutoffTime = $configHelper->getBpostShippingConfig("next_day_delivery_allowed_till", Mage::app()->getStore()->getId());
 
522
  //get the Magento date model
523
  $dateModel = Mage::getSingleton('core/date');
 
524
  //days to add counter, will always be 1 since delivery is never on the same day
525
  $daysToStart = 1;
 
526
  //add a day if the current time surpasses the time treshold
527
  $time = $dateModel->date('H,i');
528
+ if($cutoffTime <= $time && substr($cutoffTime, 0, 5) != '00,00') {
 
529
  $daysToStart = 2;
530
  }
 
531
  //get the current date
532
  $currentDate = $dateModel->date();
 
533
  //define all bpost shipping methods
534
  $shippingMethods = array(
535
  'bpost_homedelivery' => false,
536
  'bpost_pickuppoint' => false,
537
  'bpost_parcellocker' => false
538
  );
 
539
  foreach ($shippingMethods as $method => $value) {
540
  //get saturday delivery flags
541
  $saturdayDelivery = (bool)$configHelper->getBpostCarriersConfig("saturday_delivery", $method, Mage::app()->getStore()->getId());
544
  if(($grandTotal - $shippingCost) < $saturdayDeliveryFrom) {
545
  $saturdayDelivery = false;
546
  }
 
547
  $extraDays = $daysToStart;
548
  //add total days between order and shipment
549
+ $totalDays = $extraDays + $daysBetweenShipment;
 
550
  //loop over days checking for the first valid day
551
  for($i = 1; $i <= $totalDays; $i++) {
552
  $nextDate = $this->_formatDeliveryDate($currentDate.' +'.$i.' days');
555
  $totalDays++;
556
  }
557
  }
 
558
  $startDate = $this->_formatDeliveryDate($currentDate.' +'.$totalDays.' days');
 
559
  //customer gets a date from the system
560
  if($displayDeliveryDate && !$chooseDeliveryDate) {
561
  $shippingMethods[$method] = array(
569
  } else if($displayDeliveryDate && $chooseDeliveryDate) {
570
  $days = array();
571
  $addedDays = 0;
572
+ for($i = 0; $i < $nrOfDaysShown; $i++) {
 
573
  //add starting date to array
574
  if($i == 0) {
575
  $days[$i] = array(
580
  } else {
581
  $addedDays++;
582
  $nextDate = $this->_formatDeliveryDate($startDate.' +'.$addedDays.' days');
 
583
  $validDate = false;
584
  while($validDate == false) {
585
  if($this->_isValidDeliveryDate($nextDate, $saturdayDelivery, $method, $closedOn)) {
589
  $nextDate = $this->_formatDeliveryDate($startDate.' +'.$addedDays.' days');
590
  }
591
  }
 
592
  $days[$i] = array(
593
  'date' => $nextDate,
594
  'date_format' => $helper->__($this->_formatDeliveryDate($nextDate, 'l')).'<span>'.$this->_formatDeliveryDate($nextDate, 'j')." ".strtolower($helper->__($this->_formatDeliveryDate($nextDate, 'F'))).'</span>'
595
  );
596
  }
597
  }
 
598
  $shippingMethods[$method] = $days;
599
  }
600
  }
 
601
  return $shippingMethods;
602
  }
603
 
755
  *
756
  * @return bool
757
  */
758
+ public function isOnestepCheckout()
759
  {
760
  if (strpos(Mage::helper("core/url")->getCurrentUrl(), 'onestepcheckout') !== false || strpos(Mage::app()->getRequest()->getHeader('referer'), 'onestepcheckout') !== false) {
761
  return true;
app/code/community/Bpost/ShM/Helper/Returnlabel.php CHANGED
@@ -19,8 +19,8 @@ class Bpost_ShM_Helper_Returnlabel extends Mage_Core_Helper_Abstract
19
  * unfortunately, we must do this with collection count
20
  */
21
  public function getOrderReturnlabelsCount($orderId){
22
- $returnLabelCollection = Mage::getModel("bpost_shm/returnlabel");
23
- $collection = $returnLabelCollection->getCollection()->addFieldToFilter("order_id", $orderId);
24
 
25
  return $collection->count();
26
  }
19
  * unfortunately, we must do this with collection count
20
  */
21
  public function getOrderReturnlabelsCount($orderId){
22
+ $labelCollection = Mage::getModel("bpost_shm/returnlabel");
23
+ $collection = $labelCollection->getCollection()->addFieldToFilter("order_id", $orderId);
24
 
25
  return $collection->count();
26
  }
app/code/community/Bpost/ShM/Model/Adminhtml/Bpostgrid.php CHANGED
@@ -28,17 +28,17 @@ class Bpost_ShM_Model_Adminhtml_Bpostgrid extends Varien_Event_Observer
28
  $collectionCount = $shipmentCollection->count();
29
  $shipment = false;
30
 
31
- $retryAutomatedShipment = false;
32
  if ($collectionCount == 1 && $shipmentCollection->getFirstItem()->getBpostShipmentAutomated() == 1) {
33
- $retryAutomatedShipment = true;
34
  }
35
 
36
- if ($collectionCount > 0 && !$order->getBpostLabelExists() && !$retryAutomatedShipment) {
37
  return $this->_processAvailableShipments($order);
38
 
39
  } elseif (!$order->getBpostLabelExists()) {
40
 
41
- if ($retryAutomatedShipment) {
42
  $shipment = $shipmentCollection->getFirstItem();
43
  }
44
  return $this->_createBpostShipment($order, $shipment);
@@ -269,10 +269,10 @@ class Bpost_ShM_Model_Adminhtml_Bpostgrid extends Varien_Event_Observer
269
  $pdfName = null;
270
 
271
  $webserviceModel = Mage::getModel("bpost_shm/api", true);
272
- $responseLabelWebserviceCallback = $webserviceModel->createLabelByOrder($order, $this->_addReturnLabels);
273
 
274
- if ($responseLabelWebserviceCallback) {
275
- $parsedResponse = $bpostHelper->parseLabelApiResponse($responseLabelWebserviceCallback, $order);
276
 
277
  if (empty($parsedResponse) || !isset($parsedResponse["pdfString"])) {
278
  $message = $bpostHelper->__("No label response received for Magento order #%s.", $order->getIncrementId());
@@ -348,7 +348,10 @@ class Bpost_ShM_Model_Adminhtml_Bpostgrid extends Varien_Event_Observer
348
  $labelPdfArray = array();
349
  $i = 0;
350
 
351
- $orderCollection = Mage::getModel("sales/order")->getCollection()->addFieldToFilter("entity_id", array("in" => $orderIds));
 
 
 
352
 
353
  foreach ($orderCollection as $order) {
354
  $exported = false;
@@ -373,18 +376,22 @@ class Bpost_ShM_Model_Adminhtml_Bpostgrid extends Varien_Event_Observer
373
  }
374
 
375
  if ($exported) {
376
- $shippingCollection->setDataToAll("bpost_label_exported", true);
377
  $order->setBpostLabelExported(true);
378
  }
379
-
380
- $shippingCollection->save();
381
- $order->save();
382
  }
383
  } else {
384
  $i++;
385
  }
386
  }
387
 
 
 
 
 
 
 
 
388
  if (!count($labelPdfArray)) {
389
  return false;
390
  }
@@ -393,12 +400,12 @@ class Bpost_ShM_Model_Adminhtml_Bpostgrid extends Varien_Event_Observer
393
  Mage::getSingleton('core/session')->addNotice($message);
394
  }
395
 
396
- $generated_name = date("Y_m_d_H_i_s") . "_undownloaded.zip";
397
 
398
  $file = new Varien_Io_File();
399
  $file->checkAndCreateFolder(Mage::getBaseDir('media') . self::MEDIA_LABEL_PATH . "zips/");
400
 
401
- return $this->_zipLabelPdfArray($labelPdfArray, $generated_name, true, true);
402
  }
403
 
404
 
@@ -406,13 +413,13 @@ class Bpost_ShM_Model_Adminhtml_Bpostgrid extends Varien_Event_Observer
406
  * Zips the labels.
407
  *
408
  * @param array $files
409
- * @param string $generated_name
410
  * @param bool $overwrite
411
  * @return bool|string
412
  */
413
- protected function _zipLabelPdfArray($files = array(), $generated_name = '', $overwrite = false, $mergePdfFiles = false)
414
  {
415
- $destination = Mage::getBaseDir('media') . self::MEDIA_LABEL_PATH . "zips/" . $generated_name;
416
  $varienFile = new Varien_Io_File();
417
  $bpostHelper = Mage::helper("bpost_shm");
418
 
@@ -421,13 +428,13 @@ class Bpost_ShM_Model_Adminhtml_Bpostgrid extends Varien_Event_Observer
421
  return false;
422
  }
423
 
424
- $valid_files = array();
425
  $pdfMerged = new Zend_Pdf();
426
 
427
  if (is_array($files)) {
428
  foreach ($files as $file) {
429
  if ($varienFile->fileExists($file)) {
430
- $valid_files[] = $file;
431
 
432
  if ($mergePdfFiles) {
433
  $tmpPdf = Zend_Pdf::load($file);
@@ -445,11 +452,11 @@ class Bpost_ShM_Model_Adminhtml_Bpostgrid extends Varien_Event_Observer
445
  $mergedPdfName = $mergedPdfName . ".pdf";
446
 
447
  if ($mergedPdfName) {
448
- $valid_files = array($mergedPdfName);
449
  }
450
  }
451
 
452
- $validFilesCount = count($valid_files);
453
  if ($validFilesCount && $validFilesCount > 1) {
454
  $zip = new ZipArchive();
455
 
@@ -457,20 +464,20 @@ class Bpost_ShM_Model_Adminhtml_Bpostgrid extends Varien_Event_Observer
457
  return false;
458
  }
459
 
460
- foreach ($valid_files as $file) {
461
  $fileName = $bpostHelper->getFileNameByPath($file);
462
  $zip->addFile($file, $fileName);
463
  }
464
 
465
  $zip->close();
466
- return $generated_name;
467
  } elseif ($validFilesCount) {
468
  //we return the pdf path instead of creating a zip file
469
- $pdfName = $valid_files[0];
470
  return $pdfName;
471
  }
472
-
473
- return false;
474
  }
 
 
475
  }
476
  }
28
  $collectionCount = $shipmentCollection->count();
29
  $shipment = false;
30
 
31
+ $retryAutoShipment = false;
32
  if ($collectionCount == 1 && $shipmentCollection->getFirstItem()->getBpostShipmentAutomated() == 1) {
33
+ $retryAutoShipment = true;
34
  }
35
 
36
+ if ($collectionCount > 0 && !$order->getBpostLabelExists() && !$retryAutoShipment) {
37
  return $this->_processAvailableShipments($order);
38
 
39
  } elseif (!$order->getBpostLabelExists()) {
40
 
41
+ if ($retryAutoShipment) {
42
  $shipment = $shipmentCollection->getFirstItem();
43
  }
44
  return $this->_createBpostShipment($order, $shipment);
269
  $pdfName = null;
270
 
271
  $webserviceModel = Mage::getModel("bpost_shm/api", true);
272
+ $response = $webserviceModel->createLabelByOrder($order, $this->_addReturnLabels);
273
 
274
+ if ($response) {
275
+ $parsedResponse = $bpostHelper->parseLabelApiResponse($response, $order);
276
 
277
  if (empty($parsedResponse) || !isset($parsedResponse["pdfString"])) {
278
  $message = $bpostHelper->__("No label response received for Magento order #%s.", $order->getIncrementId());
348
  $labelPdfArray = array();
349
  $i = 0;
350
 
351
+ $orderCollection = Mage::getModel("sales/order")->getCollection()
352
+ ->addFieldToFilter("entity_id", array("in" => $orderIds));
353
+
354
+ $exportedOrderIds = array();
355
 
356
  foreach ($orderCollection as $order) {
357
  $exported = false;
376
  }
377
 
378
  if ($exported) {
379
+ $exportedOrderIds[] = $order->getId();
380
  $order->setBpostLabelExported(true);
381
  }
 
 
 
382
  }
383
  } else {
384
  $i++;
385
  }
386
  }
387
 
388
+ $orderCollection->save();
389
+
390
+ //we save data to all shipments, performance change
391
+ $shippingCollection = Mage::getModel('sales/order_shipment')->getCollection();
392
+ $shippingCollection->addFieldToFilter("order_id", array("in" => $exportedOrderIds));
393
+ $shippingCollection->setDataToAll("bpost_label_exported", true)->save();
394
+
395
  if (!count($labelPdfArray)) {
396
  return false;
397
  }
400
  Mage::getSingleton('core/session')->addNotice($message);
401
  }
402
 
403
+ $generatedName = date("Y_m_d_H_i_s") . "_undownloaded.zip";
404
 
405
  $file = new Varien_Io_File();
406
  $file->checkAndCreateFolder(Mage::getBaseDir('media') . self::MEDIA_LABEL_PATH . "zips/");
407
 
408
+ return $this->_zipLabelPdfArray($labelPdfArray, $generatedName, true, true);
409
  }
410
 
411
 
413
  * Zips the labels.
414
  *
415
  * @param array $files
416
+ * @param string $generatedName
417
  * @param bool $overwrite
418
  * @return bool|string
419
  */
420
+ protected function _zipLabelPdfArray($files = array(), $generatedName = '', $overwrite = false, $mergePdfFiles = false)
421
  {
422
+ $destination = Mage::getBaseDir('media') . self::MEDIA_LABEL_PATH . "zips/" . $generatedName;
423
  $varienFile = new Varien_Io_File();
424
  $bpostHelper = Mage::helper("bpost_shm");
425
 
428
  return false;
429
  }
430
 
431
+ $validFiles = array();
432
  $pdfMerged = new Zend_Pdf();
433
 
434
  if (is_array($files)) {
435
  foreach ($files as $file) {
436
  if ($varienFile->fileExists($file)) {
437
+ $validFiles[] = $file;
438
 
439
  if ($mergePdfFiles) {
440
  $tmpPdf = Zend_Pdf::load($file);
452
  $mergedPdfName = $mergedPdfName . ".pdf";
453
 
454
  if ($mergedPdfName) {
455
+ $validFiles = array($mergedPdfName);
456
  }
457
  }
458
 
459
+ $validFilesCount = count($validFiles);
460
  if ($validFilesCount && $validFilesCount > 1) {
461
  $zip = new ZipArchive();
462
 
464
  return false;
465
  }
466
 
467
+ foreach ($validFiles as $file) {
468
  $fileName = $bpostHelper->getFileNameByPath($file);
469
  $zip->addFile($file, $fileName);
470
  }
471
 
472
  $zip->close();
473
+ return $generatedName;
474
  } elseif ($validFilesCount) {
475
  //we return the pdf path instead of creating a zip file
476
+ $pdfName = $validFiles[0];
477
  return $pdfName;
478
  }
 
 
479
  }
480
+
481
+ return false;
482
  }
483
  }
app/code/community/Bpost/ShM/Model/Adminhtml/Observer.php CHANGED
@@ -47,26 +47,6 @@ class Bpost_ShM_Model_Adminhtml_Observer extends Varien_Event_Observer
47
  }
48
  }
49
 
50
- //add extra tab return barcodes on order view page
51
- //removed on bpost's request
52
-
53
- /*
54
- if($block instanceof Mage_Adminhtml_Block_Sales_Order_View_Tabs){
55
- $order = $block->getOrder();
56
-
57
- if(strpos($order->getShippingMethod(), 'bpost') !== false){
58
- $block->addTab('order_view_tab_bpostreturnbarcodetab', array(
59
- 'label' => Mage::helper('bpost_shm')->__('bpost Return Barcodes'),
60
- 'title' => Mage::helper('bpost_shm')->__('bpost Return Barcodes'),
61
- 'after' => "order_view_tab_bpostreturnlabeltab",
62
- 'content' => $block->getLayout()->createBlock('bpost_shm/adminhtml_sales_order_view_tab_returnbarcode', 'bpost_returnbarcode_grid')->toHtml()
63
- ));
64
-
65
- $block->setActiveTab("order_info");
66
- }
67
- }
68
- */
69
-
70
  return false;
71
  }
72
 
@@ -102,9 +82,9 @@ class Bpost_ShM_Model_Adminhtml_Observer extends Varien_Event_Observer
102
 
103
  if($order->getBpostReference()){
104
  try{
105
- $bpostShipmentStatuses = $bpostHelper->getBpostStatus($order);
106
 
107
- if(!$bpostShipmentStatuses){
108
  continue;
109
  }
110
 
@@ -122,8 +102,8 @@ class Bpost_ShM_Model_Adminhtml_Observer extends Varien_Event_Observer
122
  foreach($trackCollection as $track){
123
  $trackNumber = $track->getTrackNumber();
124
 
125
- if($trackNumber && isset($bpostShipmentStatuses[$trackNumber])){
126
- $status = $bpostShipmentStatuses[$trackNumber];
127
  $shipment = $track->getShipment();
128
  $shipment->setBpostStatus($status);
129
  $transaction->addObject($shipment);
@@ -144,15 +124,15 @@ class Bpost_ShM_Model_Adminhtml_Observer extends Varien_Event_Observer
144
  //need to save shipment and order
145
  if($dataChanged){
146
  $transaction->addObject($order);
147
-
148
- //save transaction
149
- $transaction->save();
150
  }
151
  }catch(Exception $e){
152
  Mage::helper("bpost_shm")->ApiLog($e->getMessage(), Zend_Log::ERR);
153
  }
154
  }
155
  }
 
 
 
156
  }
157
 
158
 
@@ -167,12 +147,11 @@ class Bpost_ShM_Model_Adminhtml_Observer extends Varien_Event_Observer
167
 
168
 
169
  /**
170
- * @param $observer
171
  * @return $this
172
  * function triggered when saving shipping settings bpost module
173
  * checks if authentication is valid
174
  */
175
- public function admin_system_config_changed_section_shipping($observer)
176
  {
177
  /** @var Bpost_ShM_Model_Api $api */
178
  $session = Mage::getSingleton("adminhtml/session");
47
  }
48
  }
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  return false;
51
  }
52
 
82
 
83
  if($order->getBpostReference()){
84
  try{
85
+ $shipmentStatuses = $bpostHelper->getBpostStatus($order);
86
 
87
+ if(!$shipmentStatuses){
88
  continue;
89
  }
90
 
102
  foreach($trackCollection as $track){
103
  $trackNumber = $track->getTrackNumber();
104
 
105
+ if($trackNumber && isset($shipmentStatuses[$trackNumber])){
106
+ $status = $shipmentStatuses[$trackNumber];
107
  $shipment = $track->getShipment();
108
  $shipment->setBpostStatus($status);
109
  $transaction->addObject($shipment);
124
  //need to save shipment and order
125
  if($dataChanged){
126
  $transaction->addObject($order);
 
 
 
127
  }
128
  }catch(Exception $e){
129
  Mage::helper("bpost_shm")->ApiLog($e->getMessage(), Zend_Log::ERR);
130
  }
131
  }
132
  }
133
+
134
+ //save transaction
135
+ $transaction->save();
136
  }
137
 
138
 
147
 
148
 
149
  /**
 
150
  * @return $this
151
  * function triggered when saving shipping settings bpost module
152
  * checks if authentication is valid
153
  */
154
+ public function admin_system_config_changed_section_shipping()
155
  {
156
  /** @var Bpost_ShM_Model_Api $api */
157
  $session = Mage::getSingleton("adminhtml/session");
app/code/community/Bpost/ShM/Model/Adminhtml/System/Config/Source/Datecomment.php CHANGED
@@ -13,7 +13,7 @@
13
  class Bpost_ShM_Model_Adminhtml_System_Config_Source_Datecomment extends Mage_Core_Model_Config_Data
14
  {
15
 
16
- public function getCommentText(Mage_Core_Model_Config_Element $element, $currentValue)
17
  {
18
  $bpostHelper = Mage::helper("bpost_shm");
19
  $popupUrl = "'" . Mage::helper("adminhtml")->getUrl('adminhtml/bpost_shM_config/screenshotpopup') . "'";
13
  class Bpost_ShM_Model_Adminhtml_System_Config_Source_Datecomment extends Mage_Core_Model_Config_Data
14
  {
15
 
16
+ public function getCommentText()
17
  {
18
  $bpostHelper = Mage::helper("bpost_shm");
19
  $popupUrl = "'" . Mage::helper("adminhtml")->getUrl('adminhtml/bpost_shM_config/screenshotpopup') . "'";
app/code/community/Bpost/ShM/Model/Api.php CHANGED
@@ -90,7 +90,7 @@ class Bpost_ShM_Model_Api extends Bpost_ShM_Model_Api_Abstract
90
 
91
 
92
  /**
93
- * @param $shipmentOrOrderObject
94
  * @param bool $withReturnLabels
95
  * @param string $format
96
  * @return bool|Zend_Http_Response
@@ -100,7 +100,7 @@ class Bpost_ShM_Model_Api extends Bpost_ShM_Model_Api_Abstract
100
 
101
  * if no shipment is given, we will download in bulk
102
  */
103
- public function createLabelByShipmentOrInBulk($shipmentOrOrderObject = false, $withReturnLabels = false, $format = "pdf", $referencePrefix = "S"){
104
  if($format === "pdf"){
105
  $headers = array("Content-Type:application/vnd.bpost.shm-labelRequest-v3+XML","Accept:application/vnd.bpost.shm-label-pdf-v3+XML");
106
  }else{
@@ -109,12 +109,12 @@ class Bpost_ShM_Model_Api extends Bpost_ShM_Model_Api_Abstract
109
 
110
  $configHelper = Mage::helper("bpost_shm/system_config");
111
 
112
- if($shipmentOrOrderObject){
113
- $storeId = $shipmentOrOrderObject->getStoreId();
114
- $referenceId = $referencePrefix.$shipmentOrOrderObject->getIncrementId();
115
 
116
- if($shipmentOrOrderObject->getNewReference()){
117
- $referenceId = $shipmentOrOrderObject->getNewReference();
118
  }
119
 
120
  $labelFormat = strtoupper($configHelper->getBpostShippingConfig("label_format", $storeId));
90
 
91
 
92
  /**
93
+ * @param $orderObject
94
  * @param bool $withReturnLabels
95
  * @param string $format
96
  * @return bool|Zend_Http_Response
100
 
101
  * if no shipment is given, we will download in bulk
102
  */
103
+ public function createLabelByShipmentOrInBulk($orderObject = false, $withReturnLabels = false, $format = "pdf", $referencePrefix = "S"){
104
  if($format === "pdf"){
105
  $headers = array("Content-Type:application/vnd.bpost.shm-labelRequest-v3+XML","Accept:application/vnd.bpost.shm-label-pdf-v3+XML");
106
  }else{
109
 
110
  $configHelper = Mage::helper("bpost_shm/system_config");
111
 
112
+ if($orderObject){
113
+ $storeId = $orderObject->getStoreId();
114
+ $referenceId = $referencePrefix.$orderObject->getIncrementId();
115
 
116
+ if($orderObject->getNewReference()){
117
+ $referenceId = $orderObject->getNewReference();
118
  }
119
 
120
  $labelFormat = strtoupper($configHelper->getBpostShippingConfig("label_format", $storeId));
app/code/community/Bpost/ShM/Model/Api/Abstract.php CHANGED
@@ -67,7 +67,7 @@ class Bpost_ShM_Model_Api_Abstract extends Mage_Core_Model_Abstract
67
  * @return bool
68
  * function checks if the current object is initialized or not
69
  */
70
- public function getIsInitialized(){
71
  if($this->_initialized){
72
  return true;
73
  }
@@ -84,7 +84,7 @@ class Bpost_ShM_Model_Api_Abstract extends Mage_Core_Model_Abstract
84
  protected function _getRestClient($headers = null){
85
  try{
86
  //first make sure the current model is initialized
87
- if(!$this->getIsInitialized()){
88
  Mage::throwException('Please initialize your API model first by calling the initialize() function.');
89
  }
90
 
@@ -101,6 +101,8 @@ class Bpost_ShM_Model_Api_Abstract extends Mage_Core_Model_Abstract
101
  }catch(Exception $e){
102
  Mage::helper("bpost_shm")->ApiLog($e->getMessage(), Zend_Log::ERR);
103
  }
 
 
104
  }
105
 
106
 
@@ -124,6 +126,8 @@ class Bpost_ShM_Model_Api_Abstract extends Mage_Core_Model_Abstract
124
  }catch(Exception $e){
125
  Mage::helper("bpost_shm")->ApiLog($e->getMessage(), Zend_Log::ERR);
126
  }
 
 
127
  }
128
 
129
 
@@ -177,6 +181,8 @@ class Bpost_ShM_Model_Api_Abstract extends Mage_Core_Model_Abstract
177
  return false;
178
  }
179
  }
 
 
180
  }
181
 
182
 
@@ -216,9 +222,9 @@ class Bpost_ShM_Model_Api_Abstract extends Mage_Core_Model_Abstract
216
  switch($errorHandlingData["request_name"]){
217
  case "createOrder":
218
  //only send error email if 'use Magento to manage labels' is false
219
- $manageLabelsWithMagento = $configHelper->getBpostShippingConfig("manage_labels_with_magento");
220
 
221
- if(!$manageLabelsWithMagento){
222
  //require email template, add error message, and send it to the shopmanager
223
  $receiver = Mage::getStoreConfig('trans_email/ident_general/email');
224
  $receiverName = Mage::getStoreConfig('trans_email/ident_general/name');
67
  * @return bool
68
  * function checks if the current object is initialized or not
69
  */
70
+ public function isInitialized(){
71
  if($this->_initialized){
72
  return true;
73
  }
84
  protected function _getRestClient($headers = null){
85
  try{
86
  //first make sure the current model is initialized
87
+ if(!$this->isInitialized()){
88
  Mage::throwException('Please initialize your API model first by calling the initialize() function.');
89
  }
90
 
101
  }catch(Exception $e){
102
  Mage::helper("bpost_shm")->ApiLog($e->getMessage(), Zend_Log::ERR);
103
  }
104
+
105
+ return false;
106
  }
107
 
108
 
126
  }catch(Exception $e){
127
  Mage::helper("bpost_shm")->ApiLog($e->getMessage(), Zend_Log::ERR);
128
  }
129
+
130
+ return false;
131
  }
132
 
133
 
181
  return false;
182
  }
183
  }
184
+
185
+ return false;
186
  }
187
 
188
 
222
  switch($errorHandlingData["request_name"]){
223
  case "createOrder":
224
  //only send error email if 'use Magento to manage labels' is false
225
+ $manageLabels = $configHelper->getBpostShippingConfig("manage_labels_with_magento");
226
 
227
+ if(!$manageLabels){
228
  //require email template, add error message, and send it to the shopmanager
229
  $receiver = Mage::getStoreConfig('trans_email/ident_general/email');
230
  $receiverName = Mage::getStoreConfig('trans_email/ident_general/name');
app/code/community/Bpost/ShM/Model/Api/Domcreator.php CHANGED
@@ -5,9 +5,9 @@ class Bpost_ShM_Model_Api_Domcreator extends Bpost_ShM_Model_Api_Abstract
5
  protected $_xmlnsValue = "http://schema.post.be/shm/deepintegration/v3/national";
6
  protected $_xmlnsCommonValue = "http://schema.post.be/shm/deepintegration/v3/common";
7
  protected $_xmlnsTnsValue = "http://schema.post.be/shm/deepintegration/v3/";
8
- protected $_xmlnsInternationalValue = "http://schema.post.be/shm/deepintegration/v3/international";
9
  protected $_xmlnsXsiValue = "http://www.w3.org/2001/XMLSchema-instance";
10
- protected $_xsiSchemaLocationValue = "http://schema.post.be/shm/deepintegration/v3/";
11
 
12
  protected $_shippingAddress;
13
  protected $_billingAddress;
@@ -71,21 +71,21 @@ class Bpost_ShM_Model_Api_Domcreator extends Bpost_ShM_Model_Api_Abstract
71
  $xmlnsTnsAttribute = $document->createAttribute("xmlns:tns");
72
  $xmlnsTnsAttribute->value = $this->_xmlnsTnsValue;
73
 
74
- $xmlnsInternationalAttribute = $document->createAttribute("xmlns:international");
75
- $xmlnsInternationalAttribute->value = $this->_xmlnsInternationalValue;
76
 
77
  $xmlnsXsiAttribute = $document->createAttribute("xmlns:xsi");
78
  $xmlnsXsiAttribute->value = $this->_xmlnsXsiValue;
79
 
80
- $xsiSchemaLocationValue = $document->createAttribute("xsi:schemaLocation");
81
- $xsiSchemaLocationValue->value = $this->_xsiSchemaLocationValue;
82
 
83
  $orderElement->appendChild($xmlnsAttribute);
84
  $orderElement->appendChild($xmlnsCommonAttribute);
85
  $orderElement->appendChild($xmlnsTnsAttribute);
86
- $orderElement->appendChild($xmlnsInternationalAttribute);
87
  $orderElement->appendChild($xmlnsXsiAttribute);
88
- $orderElement->appendChild($xsiSchemaLocationValue);
89
  //end adding order attributes
90
 
91
  $document->appendChild($orderElement);
@@ -200,16 +200,16 @@ class Bpost_ShM_Model_Api_Domcreator extends Bpost_ShM_Model_Api_Abstract
200
  $nationalBoxElements = $this->_getNationalBoxElements($document, $order, $returnOrder, $weightInGrams, $shippingMethod);
201
  $box->appendChild($nationalBoxElements);
202
  }else{
203
- $internationalBoxElements = $this->_getInternationalBoxElements($document, $order, $returnOrder, $weightInGrams);
204
- $box->appendChild($internationalBoxElements);
205
  }
206
 
207
- //we do the same for additionalCustomerReference
208
  //Free text. If not submitted, it will indicate the channel used for creating this order. Best used by integrators to indicate the origin of the order.
209
 
210
- $additionalCustomerReference = $document->createElement('tns:additionalCustomerReference');
211
- $additionalCustomerReference->appendChild($document->createTextNode("Magento_".Mage::getVersion()));
212
- $box->appendChild($additionalCustomerReference);
213
 
214
  //finally we add the box element to the order element
215
  $orderElement->appendChild($box);
@@ -223,14 +223,15 @@ class Bpost_ShM_Model_Api_Domcreator extends Bpost_ShM_Model_Api_Abstract
223
  $bpostHelper = Mage::helper("bpost_shm");
224
  $configHelper = Mage::helper("bpost_shm/system_config");
225
  $nationalBox = $document->createElement('tns:nationalBox');
226
- $manageLabelsWithMagento = $configHelper->getBpostShippingConfig("manage_labels_with_magento");
227
 
228
- $requestedDeliveryDate = false;
229
  $dropDate = new DateTime($order->getBpostDeliveryDate());
230
  $currentDate = new DateTime();
231
- if($dropDate && $dropDate > $currentDate) {
232
- $requestedDeliveryDate = $document->createElement('requestedDeliveryDate');
233
- $requestedDeliveryDate->appendChild($document->createTextNode($order->getBpostDeliveryDate()));
 
234
  }
235
 
236
  //add product
@@ -328,8 +329,8 @@ class Bpost_ShM_Model_Api_Domcreator extends Bpost_ShM_Model_Api_Abstract
328
  $atHome->appendChild($weight);
329
  $atHome->appendChild($receiver);
330
 
331
- if($requestedDeliveryDate){
332
- $atHome->appendChild($requestedDeliveryDate);
333
  }
334
 
335
  $nationalBox->appendChild($atHome);
@@ -338,7 +339,7 @@ class Bpost_ShM_Model_Api_Domcreator extends Bpost_ShM_Model_Api_Abstract
338
  case "bpostshm_bpost_pickuppoint":
339
  if(!$order->getBpostPickuplocationId()){
340
  //only throw error in backend
341
- if($manageLabelsWithMagento){
342
  Mage::throwException("No pickup location order data found.");
343
  }
344
  }
@@ -359,7 +360,7 @@ class Bpost_ShM_Model_Api_Domcreator extends Bpost_ShM_Model_Api_Abstract
359
  $options = $this->_checkIfOptionIsValid($document, $options, $order, "bpost_pickuppoint", "insurance", "insured");
360
  $options = $this->_checkIfOptionIsValid($document, $options, $order, "bpost_pickuppoint", "saturday_delivery", "saturdayDelivery");
361
 
362
- $formattedShippingAddress = $bpostHelper->formatShippingAddress($this->_shippingAddress);
363
 
364
  $pugoId = $document->createElement('pugoId');
365
  $pugoId->appendChild($document->createTextNode($order->getBpostPickuplocationId()));
@@ -368,11 +369,11 @@ class Bpost_ShM_Model_Api_Domcreator extends Bpost_ShM_Model_Api_Abstract
368
  $pugoName->appendChild($document->createTextNode($this->_shippingAddress->getLastname()));
369
 
370
  //Address tags
371
- $streetName->appendChild($document->createTextNode($formattedShippingAddress["street"]));
372
- $streetNumber->appendChild($document->createTextNode($formattedShippingAddress["number"]));
373
 
374
- $streetPostalCode->appendChild($document->createTextNode($formattedShippingAddress["postcode"]));
375
- $locality->appendChild($document->createTextNode($formattedShippingAddress["city"]));
376
  $countryCode->appendChild($document->createTextNode($this->_shippingAddress->getCountryId()));
377
 
378
  $pugoAddress = $document->createElement('pugoAddress');
@@ -397,8 +398,8 @@ class Bpost_ShM_Model_Api_Domcreator extends Bpost_ShM_Model_Api_Abstract
397
  $atBpost->appendChild($receiverName);
398
  $atBpost->appendChild($receiverCompany);
399
 
400
- if($requestedDeliveryDate) {
401
- $atBpost->appendChild($requestedDeliveryDate);
402
  }
403
 
404
  $nationalBox->appendChild($atBpost);
@@ -407,7 +408,7 @@ class Bpost_ShM_Model_Api_Domcreator extends Bpost_ShM_Model_Api_Abstract
407
 
408
  case "bpostshm_bpost_parcellocker":
409
 
410
- if(!$order->getBpostPickuplocationId() && $manageLabelsWithMagento){
411
  Mage::throwException("No parcel locker data found.");
412
  }
413
 
@@ -417,7 +418,7 @@ class Bpost_ShM_Model_Api_Domcreator extends Bpost_ShM_Model_Api_Abstract
417
  $options = $this->_checkIfOptionIsValid($document, $options, $order, "bpost_parcellocker", "insurance", "insured");
418
  $options = $this->_checkIfOptionIsValid($document, $options, $order, "bpost_parcellocker", "saturday_delivery", "saturdayDelivery");
419
 
420
- $formattedShippingAddress = $bpostHelper->formatShippingAddress($this->_shippingAddress);
421
 
422
  $parcelsDepotId = $document->createElement('parcelsDepotId');
423
  $parcelsDepotId->appendChild($document->createTextNode($order->getBpostPickuplocationId()));
@@ -426,11 +427,11 @@ class Bpost_ShM_Model_Api_Domcreator extends Bpost_ShM_Model_Api_Abstract
426
  $parcelsDepotName->appendChild($document->createTextNode($this->_shippingAddress->getLastname()));
427
 
428
  //Address tags
429
- $streetName->appendChild($document->createTextNode($formattedShippingAddress["street"]));
430
- $streetNumber->appendChild($document->createTextNode($formattedShippingAddress["number"]));
431
 
432
- $streetPostalCode->appendChild($document->createTextNode($formattedShippingAddress["postcode"]));
433
- $locality->appendChild($document->createTextNode($formattedShippingAddress["city"]));
434
  $countryCode->appendChild($document->createTextNode($this->_shippingAddress->getCountryId()));
435
 
436
  $parcelsDepotAddress = $document->createElement('parcelsDepotAddress');
@@ -471,29 +472,29 @@ class Bpost_ShM_Model_Api_Domcreator extends Bpost_ShM_Model_Api_Abstract
471
  }
472
  //end unregistered element
473
 
474
- $at247 = $document->createElement('at24-7');
475
- $at247->appendChild($product);
476
 
477
  if($options->hasChildNodes()){
478
- $at247->appendChild($options);
479
  }
480
 
481
 
482
- $at247->appendChild($weight);
483
- $at247->appendChild($parcelsDepotId);
484
- $at247->appendChild($parcelsDepotName);
485
- $at247->appendChild($parcelsDepotAddress);
486
 
487
  //add unregistered element
488
- $at247->appendChild($unregistered);
489
- $at247->appendChild($receiverName);
490
- $at247->appendChild($receiverCompany);
491
 
492
- if($requestedDeliveryDate) {
493
- $at247->appendChild($requestedDeliveryDate);
494
  }
495
 
496
- $nationalBox->appendChild($at247);
497
  break;
498
  }
499
  return $nationalBox;
@@ -600,8 +601,8 @@ class Bpost_ShM_Model_Api_Domcreator extends Bpost_ShM_Model_Api_Abstract
600
  $shipmentType = $document->createElement('international:shipmentType');
601
  $shipmentType->appendChild($document->createTextNode("OTHER"));
602
 
603
- $parcelReturnInstructions = $document->createElement('international:parcelReturnInstructions');
604
- $parcelReturnInstructions->appendChild($document->createTextNode("RTS"));
605
 
606
  $privateAddress = $document->createElement('international:privateAddress');
607
  $privateAddress->appendChild($document->createTextNode("false"));
@@ -609,7 +610,7 @@ class Bpost_ShM_Model_Api_Domcreator extends Bpost_ShM_Model_Api_Abstract
609
  $customsInfo->appendChild($parcelValue);
610
  $customsInfo->appendChild($contentDescription);
611
  $customsInfo->appendChild($shipmentType);
612
- $customsInfo->appendChild($parcelReturnInstructions);
613
  $customsInfo->appendChild($privateAddress);
614
  //end customsInfo element
615
 
5
  protected $_xmlnsValue = "http://schema.post.be/shm/deepintegration/v3/national";
6
  protected $_xmlnsCommonValue = "http://schema.post.be/shm/deepintegration/v3/common";
7
  protected $_xmlnsTnsValue = "http://schema.post.be/shm/deepintegration/v3/";
8
+ protected $_xmlnsInternational = "http://schema.post.be/shm/deepintegration/v3/international";
9
  protected $_xmlnsXsiValue = "http://www.w3.org/2001/XMLSchema-instance";
10
+ protected $_xsiSchemaLocation = "http://schema.post.be/shm/deepintegration/v3/";
11
 
12
  protected $_shippingAddress;
13
  protected $_billingAddress;
71
  $xmlnsTnsAttribute = $document->createAttribute("xmlns:tns");
72
  $xmlnsTnsAttribute->value = $this->_xmlnsTnsValue;
73
 
74
+ $xmlnsIAttribute = $document->createAttribute("xmlns:international");
75
+ $xmlnsIAttribute->value = $this->_xmlnsInternational;
76
 
77
  $xmlnsXsiAttribute = $document->createAttribute("xmlns:xsi");
78
  $xmlnsXsiAttribute->value = $this->_xmlnsXsiValue;
79
 
80
+ $xsiSchemaLocation = $document->createAttribute("xsi:schemaLocation");
81
+ $xsiSchemaLocation->value = $this->_xsiSchemaLocation;
82
 
83
  $orderElement->appendChild($xmlnsAttribute);
84
  $orderElement->appendChild($xmlnsCommonAttribute);
85
  $orderElement->appendChild($xmlnsTnsAttribute);
86
+ $orderElement->appendChild($xmlnsIAttribute);
87
  $orderElement->appendChild($xmlnsXsiAttribute);
88
+ $orderElement->appendChild($xsiSchemaLocation);
89
  //end adding order attributes
90
 
91
  $document->appendChild($orderElement);
200
  $nationalBoxElements = $this->_getNationalBoxElements($document, $order, $returnOrder, $weightInGrams, $shippingMethod);
201
  $box->appendChild($nationalBoxElements);
202
  }else{
203
+ $internationalElements = $this->_getInternationalBoxElements($document, $order, $returnOrder, $weightInGrams);
204
+ $box->appendChild($internationalElements);
205
  }
206
 
207
+ //we do the same for additionalCustomerRef
208
  //Free text. If not submitted, it will indicate the channel used for creating this order. Best used by integrators to indicate the origin of the order.
209
 
210
+ $additionalCustomerRef = $document->createElement('tns:additionalCustomerReference');
211
+ $additionalCustomerRef->appendChild($document->createTextNode("Magento_".Mage::getVersion()));
212
+ $box->appendChild($additionalCustomerRef);
213
 
214
  //finally we add the box element to the order element
215
  $orderElement->appendChild($box);
223
  $bpostHelper = Mage::helper("bpost_shm");
224
  $configHelper = Mage::helper("bpost_shm/system_config");
225
  $nationalBox = $document->createElement('tns:nationalBox');
226
+ $manageLabels = $configHelper->getBpostShippingConfig("manage_labels_with_magento");
227
 
228
+ $reqDeliveryDate = false;
229
  $dropDate = new DateTime($order->getBpostDeliveryDate());
230
  $currentDate = new DateTime();
231
+
232
+ if($dropDate && $dropDate > $currentDate && !$returnOrder) {
233
+ $reqDeliveryDate = $document->createElement('requestedDeliveryDate');
234
+ $reqDeliveryDate->appendChild($document->createTextNode($order->getBpostDeliveryDate()));
235
  }
236
 
237
  //add product
329
  $atHome->appendChild($weight);
330
  $atHome->appendChild($receiver);
331
 
332
+ if($reqDeliveryDate){
333
+ $atHome->appendChild($reqDeliveryDate);
334
  }
335
 
336
  $nationalBox->appendChild($atHome);
339
  case "bpostshm_bpost_pickuppoint":
340
  if(!$order->getBpostPickuplocationId()){
341
  //only throw error in backend
342
+ if($manageLabels){
343
  Mage::throwException("No pickup location order data found.");
344
  }
345
  }
360
  $options = $this->_checkIfOptionIsValid($document, $options, $order, "bpost_pickuppoint", "insurance", "insured");
361
  $options = $this->_checkIfOptionIsValid($document, $options, $order, "bpost_pickuppoint", "saturday_delivery", "saturdayDelivery");
362
 
363
+ $formattedAddress = $bpostHelper->formatShippingAddress($this->_shippingAddress);
364
 
365
  $pugoId = $document->createElement('pugoId');
366
  $pugoId->appendChild($document->createTextNode($order->getBpostPickuplocationId()));
369
  $pugoName->appendChild($document->createTextNode($this->_shippingAddress->getLastname()));
370
 
371
  //Address tags
372
+ $streetName->appendChild($document->createTextNode($formattedAddress["street"]));
373
+ $streetNumber->appendChild($document->createTextNode($formattedAddress["number"]));
374
 
375
+ $streetPostalCode->appendChild($document->createTextNode($formattedAddress["postcode"]));
376
+ $locality->appendChild($document->createTextNode($formattedAddress["city"]));
377
  $countryCode->appendChild($document->createTextNode($this->_shippingAddress->getCountryId()));
378
 
379
  $pugoAddress = $document->createElement('pugoAddress');
398
  $atBpost->appendChild($receiverName);
399
  $atBpost->appendChild($receiverCompany);
400
 
401
+ if($reqDeliveryDate) {
402
+ $atBpost->appendChild($reqDeliveryDate);
403
  }
404
 
405
  $nationalBox->appendChild($atBpost);
408
 
409
  case "bpostshm_bpost_parcellocker":
410
 
411
+ if(!$order->getBpostPickuplocationId() && $manageLabels){
412
  Mage::throwException("No parcel locker data found.");
413
  }
414
 
418
  $options = $this->_checkIfOptionIsValid($document, $options, $order, "bpost_parcellocker", "insurance", "insured");
419
  $options = $this->_checkIfOptionIsValid($document, $options, $order, "bpost_parcellocker", "saturday_delivery", "saturdayDelivery");
420
 
421
+ $formattedAddress = $bpostHelper->formatShippingAddress($this->_shippingAddress);
422
 
423
  $parcelsDepotId = $document->createElement('parcelsDepotId');
424
  $parcelsDepotId->appendChild($document->createTextNode($order->getBpostPickuplocationId()));
427
  $parcelsDepotName->appendChild($document->createTextNode($this->_shippingAddress->getLastname()));
428
 
429
  //Address tags
430
+ $streetName->appendChild($document->createTextNode($formattedAddress["street"]));
431
+ $streetNumber->appendChild($document->createTextNode($formattedAddress["number"]));
432
 
433
+ $streetPostalCode->appendChild($document->createTextNode($formattedAddress["postcode"]));
434
+ $locality->appendChild($document->createTextNode($formattedAddress["city"]));
435
  $countryCode->appendChild($document->createTextNode($this->_shippingAddress->getCountryId()));
436
 
437
  $parcelsDepotAddress = $document->createElement('parcelsDepotAddress');
472
  }
473
  //end unregistered element
474
 
475
+ $atTwentyFourSeven = $document->createElement('at24-7');
476
+ $atTwentyFourSeven->appendChild($product);
477
 
478
  if($options->hasChildNodes()){
479
+ $atTwentyFourSeven->appendChild($options);
480
  }
481
 
482
 
483
+ $atTwentyFourSeven->appendChild($weight);
484
+ $atTwentyFourSeven->appendChild($parcelsDepotId);
485
+ $atTwentyFourSeven->appendChild($parcelsDepotName);
486
+ $atTwentyFourSeven->appendChild($parcelsDepotAddress);
487
 
488
  //add unregistered element
489
+ $atTwentyFourSeven->appendChild($unregistered);
490
+ $atTwentyFourSeven->appendChild($receiverName);
491
+ $atTwentyFourSeven->appendChild($receiverCompany);
492
 
493
+ if($reqDeliveryDate) {
494
+ $atTwentyFourSeven->appendChild($reqDeliveryDate);
495
  }
496
 
497
+ $nationalBox->appendChild($atTwentyFourSeven);
498
  break;
499
  }
500
  return $nationalBox;
601
  $shipmentType = $document->createElement('international:shipmentType');
602
  $shipmentType->appendChild($document->createTextNode("OTHER"));
603
 
604
+ $returnInstructions = $document->createElement('international:parcelReturnInstructions');
605
+ $returnInstructions->appendChild($document->createTextNode("RTS"));
606
 
607
  $privateAddress = $document->createElement('international:privateAddress');
608
  $privateAddress->appendChild($document->createTextNode("false"));
610
  $customsInfo->appendChild($parcelValue);
611
  $customsInfo->appendChild($contentDescription);
612
  $customsInfo->appendChild($shipmentType);
613
+ $customsInfo->appendChild($returnInstructions);
614
  $customsInfo->appendChild($privateAddress);
615
  //end customsInfo element
616
 
app/code/community/Bpost/ShM/Model/Observer.php CHANGED
@@ -69,14 +69,14 @@ class Bpost_ShM_Model_Observer extends Varien_Event_Observer
69
  $observer->getEvent()->getName() == "controller_action_postdispatch_checkout_onepage_saveBilling") ||
70
  $observer->getEvent()->getName() == "controller_action_postdispatch_checkout_onepage_saveShipping") {
71
 
72
- $bpostOriginalShippingAddress = new Varien_Object();
73
  $street = $shippingAddress->getStreet(1);
74
 
75
  if($shippingAddress->getStreet(2) && $shippingAddress->getStreet(2) != ""){
76
  $street .= "\n" . $shippingAddress->getStreet(2);
77
  }
78
 
79
- $bpostOriginalShippingAddress
80
  ->setFirstname($shippingAddress->getFirstname())
81
  ->setLastname($shippingAddress->getLastname())
82
  ->setCompany($shippingAddress->getCompany())
@@ -89,10 +89,10 @@ class Bpost_ShM_Model_Observer extends Varien_Event_Observer
89
  ->setFax($shippingAddress->getFax());
90
 
91
  if($shippingAddress->getAddressId() != "" && $shippingAddress->hasAddressId()){
92
- $bpostOriginalShippingAddress->setAddressId($shippingAddress->getAddressId());
93
  }
94
 
95
- $checkoutSession->setBpostOriginalShippingAddress($bpostOriginalShippingAddress);
96
  }
97
  return $this;
98
  }
@@ -100,10 +100,9 @@ class Bpost_ShM_Model_Observer extends Varien_Event_Observer
100
  /**
101
  * Reset saturday delivery option so rate calculation doesn't show saturday incl. shipping rates
102
  *
103
- * @param $observer
104
  * @return $this
105
  */
106
- public function controller_action_predispatch_checkout_onepage_saveAddress($observer)
107
  {
108
  $checkoutSession = Mage::getSingleton('checkout/session');
109
  //always reset the saturday delivery option so we don't see multiplied rates
@@ -115,10 +114,9 @@ class Bpost_ShM_Model_Observer extends Varien_Event_Observer
115
  /**
116
  * Change shipping address if needed, save previous shipping method, add progress bar reload flag.
117
  *
118
- * @param $observer
119
  * @return $this
120
  */
121
- public function checkout_controller_onepage_save_shipping_method($observer)
122
  {
123
  //init all necessary data
124
  $checkoutSession = Mage::getSingleton('checkout/session');
@@ -258,9 +256,9 @@ class Bpost_ShM_Model_Observer extends Varien_Event_Observer
258
 
259
  //function checks if manage labels with Magento is disabled
260
  //if so, we need to call the create order api function
261
- $manageLabelsWithMagento = $configHelper->getBpostShippingConfig("manage_labels_with_magento");
262
 
263
- if(!$manageLabelsWithMagento){
264
  $apiModel = Mage::getModel("bpost_shm/api", true);
265
  $apiModel->createOrder($order);
266
  $order->setBpostReference($order->getIncrementId())->save();
@@ -274,7 +272,7 @@ class Bpost_ShM_Model_Observer extends Varien_Event_Observer
274
  * function sets default data on our quote
275
  * we need to do this for the onestepcheckout
276
  */
277
- public function sales_quote_collect_totals_before($observer){
278
  $checkoutSession = Mage::getSingleton('checkout/session');
279
  $quote = $checkoutSession->getQuote();
280
  $params = Mage::app()->getRequest()->getParams();
@@ -283,36 +281,29 @@ class Bpost_ShM_Model_Observer extends Varien_Event_Observer
283
  if(isset($params["shipping_method"]) && $originalRatePrices){
284
  $bpostConfigHelper = Mage::helper("bpost_shm/system_config");
285
  $bpostHelper = Mage::helper("bpost_shm");
286
- $shippingMethodForConfig = str_replace('bpostshm_', '', $params["shipping_method"]);
287
- $groups = $quote->getShippingAddress()->getGroupedAllShippingRates();
288
- foreach ($groups as $code => $_rates){
289
- foreach ($_rates as $_rate){
290
-
291
- if($_rate->getCode() == $params["shipping_method"] && isset($originalRatePrices[$params["shipping_method"]])){
292
- $saturdayDeliveryCost = $bpostHelper->formatSaturdayDeliveryCost($bpostConfigHelper->getBpostShippingConfig("saturday_delivery_cost", Mage::app()->getStore()->getId()));
293
-
294
- if(isset($params["disable_saturday_delivery"]) && $params["disable_saturday_delivery"] == 1 && Mage::helper("bpost_shm/system_config")->getBpostShippingConfig("display_delivery_date")){
295
- //check if the option saturday delivery is active for the current shipping method
296
- if($bpostConfigHelper->getBpostCarriersConfig("saturday_delivery", $shippingMethodForConfig, Mage::app()->getStore()->getId())){
297
- //remove extra cost
298
- $_rate->setPrice($originalRatePrices[$params["shipping_method"]]);
299
- $_rate->setSaturdayDelivery(0);
300
- $quote->setBpostDisableSaturdayDelivery(true);
301
- $quote->setBpostSaturdayCostApplied(false);
302
- }
303
-
304
- }elseif(isset($params["disable_saturday_delivery"]) && $params["disable_saturday_delivery"] == 0 && Mage::helper("bpost_shm/system_config")->getBpostShippingConfig("display_delivery_date")){
305
- //add extra cost
306
- if($bpostConfigHelper->getBpostCarriersConfig("saturday_delivery", $shippingMethodForConfig, Mage::app()->getStore()->getId())){
307
- $_rate->setPrice($originalRatePrices[$params["shipping_method"]]+$saturdayDeliveryCost);
308
- $_rate->setSaturdayDelivery(1);
309
- //make sure the original prices are applied
310
- $quote->setBpostDisableSaturdayDelivery(false);
311
- $quote->setBpostSaturdayCostApplied(true);
312
- }
313
  }
314
 
315
- $_rate->save();
 
 
 
 
 
 
 
316
  }
317
  }
318
  }
@@ -331,9 +322,9 @@ class Bpost_ShM_Model_Observer extends Varien_Event_Observer
331
  }
332
 
333
  if(!$quote->getBpostNotificationSms()){
334
- $currentPrimaryShipping = $customer->getPrimaryShippingAddress();
335
- if(is_object($currentPrimaryShipping)){
336
- $telephone = $currentPrimaryShipping->getTelephone();
337
  $quote->getShippingAddress()->setTelephone($telephone);
338
  }
339
  }
@@ -343,10 +334,8 @@ class Bpost_ShM_Model_Observer extends Varien_Event_Observer
343
  return $this;
344
  }
345
 
346
- /**
347
- * @param $observer
348
- */
349
- public function controller_action_predispatch_onestepcheckout_index_index($observer){
350
  $checkoutSession = Mage::getSingleton('checkout/session');
351
  $quote = $checkoutSession->getQuote();
352
  $shippingMethod = str_replace("bpostshm_", "",$quote->getShippingAddress()->getShippingMethod());
69
  $observer->getEvent()->getName() == "controller_action_postdispatch_checkout_onepage_saveBilling") ||
70
  $observer->getEvent()->getName() == "controller_action_postdispatch_checkout_onepage_saveShipping") {
71
 
72
+ $originalAddress = new Varien_Object();
73
  $street = $shippingAddress->getStreet(1);
74
 
75
  if($shippingAddress->getStreet(2) && $shippingAddress->getStreet(2) != ""){
76
  $street .= "\n" . $shippingAddress->getStreet(2);
77
  }
78
 
79
+ $originalAddress
80
  ->setFirstname($shippingAddress->getFirstname())
81
  ->setLastname($shippingAddress->getLastname())
82
  ->setCompany($shippingAddress->getCompany())
89
  ->setFax($shippingAddress->getFax());
90
 
91
  if($shippingAddress->getAddressId() != "" && $shippingAddress->hasAddressId()){
92
+ $originalAddress->setAddressId($shippingAddress->getAddressId());
93
  }
94
 
95
+ $checkoutSession->setBpostOriginalShippingAddress($originalAddress);
96
  }
97
  return $this;
98
  }
100
  /**
101
  * Reset saturday delivery option so rate calculation doesn't show saturday incl. shipping rates
102
  *
 
103
  * @return $this
104
  */
105
+ public function controller_action_predispatch_checkout_onepage_saveAddress()
106
  {
107
  $checkoutSession = Mage::getSingleton('checkout/session');
108
  //always reset the saturday delivery option so we don't see multiplied rates
114
  /**
115
  * Change shipping address if needed, save previous shipping method, add progress bar reload flag.
116
  *
 
117
  * @return $this
118
  */
119
+ public function checkout_controller_onepage_save_shipping_method()
120
  {
121
  //init all necessary data
122
  $checkoutSession = Mage::getSingleton('checkout/session');
256
 
257
  //function checks if manage labels with Magento is disabled
258
  //if so, we need to call the create order api function
259
+ $manageLabels = $configHelper->getBpostShippingConfig("manage_labels_with_magento");
260
 
261
+ if(!$manageLabels){
262
  $apiModel = Mage::getModel("bpost_shm/api", true);
263
  $apiModel->createOrder($order);
264
  $order->setBpostReference($order->getIncrementId())->save();
272
  * function sets default data on our quote
273
  * we need to do this for the onestepcheckout
274
  */
275
+ public function sales_quote_collect_totals_before(){
276
  $checkoutSession = Mage::getSingleton('checkout/session');
277
  $quote = $checkoutSession->getQuote();
278
  $params = Mage::app()->getRequest()->getParams();
281
  if(isset($params["shipping_method"]) && $originalRatePrices){
282
  $bpostConfigHelper = Mage::helper("bpost_shm/system_config");
283
  $bpostHelper = Mage::helper("bpost_shm");
284
+ $shippingMethod = str_replace('bpostshm_', '', $params["shipping_method"]);
285
+
286
+ foreach($quote->getShippingAddress()->getShippingRatesCollection() as $_rate){
287
+ if($_rate->getCode() == $params["shipping_method"] && isset($originalRatePrices[$params["shipping_method"]])){
288
+ $saturdayDeliveryCost = $bpostHelper->formatSaturdayDeliveryCost($bpostConfigHelper->getBpostShippingConfig("saturday_delivery_cost", Mage::app()->getStore()->getId()));
289
+
290
+ if(isset($params["disable_saturday_delivery"]) && $params["disable_saturday_delivery"] == 1 && Mage::helper("bpost_shm/system_config")->getBpostShippingConfig("display_delivery_date")){
291
+ //check if the option saturday delivery is active for the current shipping method
292
+ if($bpostConfigHelper->getBpostCarriersConfig("saturday_delivery", $shippingMethod, Mage::app()->getStore()->getId())){
293
+ //remove extra cost
294
+ $_rate->setPrice($originalRatePrices[$params["shipping_method"]]);
295
+ $_rate->setSaturdayDelivery(0);
296
+ $quote->setBpostDisableSaturdayDelivery(true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
297
  }
298
 
299
+ }elseif(isset($params["disable_saturday_delivery"]) && $params["disable_saturday_delivery"] == 0 && Mage::helper("bpost_shm/system_config")->getBpostShippingConfig("display_delivery_date")){
300
+ //add extra cost
301
+ if($bpostConfigHelper->getBpostCarriersConfig("saturday_delivery", $shippingMethod, Mage::app()->getStore()->getId())){
302
+ $_rate->setPrice($originalRatePrices[$params["shipping_method"]]+$saturdayDeliveryCost);
303
+ $_rate->setSaturdayDelivery(1);
304
+ //make sure the original prices are applied
305
+ $quote->setBpostDisableSaturdayDelivery(false);
306
+ }
307
  }
308
  }
309
  }
322
  }
323
 
324
  if(!$quote->getBpostNotificationSms()){
325
+ $primaryShipping = $customer->getPrimaryShippingAddress();
326
+ if(is_object($primaryShipping)){
327
+ $telephone = $primaryShipping->getTelephone();
328
  $quote->getShippingAddress()->setTelephone($telephone);
329
  }
330
  }
334
  return $this;
335
  }
336
 
337
+
338
+ public function controller_action_predispatch_onestepcheckout_index_index(){
 
 
339
  $checkoutSession = Mage::getSingleton('checkout/session');
340
  $quote = $checkoutSession->getQuote();
341
  $shippingMethod = str_replace("bpostshm_", "",$quote->getShippingAddress()->getShippingMethod());
app/code/community/Bpost/ShM/Model/Returnlabel.php CHANGED
@@ -34,7 +34,7 @@ class Bpost_ShM_Model_Returnlabel extends Mage_Core_Model_Abstract
34
  {
35
  $order = Mage::getModel('sales/order')->load($orderId);
36
  $bpostHelper = Mage::helper("bpost_shm");
37
- $bpostReturnLabelHelper = Mage::helper("bpost_shm/returnlabel");
38
 
39
  //check for return order
40
  $returnlabelResponse = Mage::getModel('bpost_shm/api', true)->createReturnLabel($order);
@@ -47,7 +47,7 @@ class Bpost_ShM_Model_Returnlabel extends Mage_Core_Model_Abstract
47
 
48
  //make sure we save with an unique name
49
  //if no barcode is returned (probably never)
50
- $barcode = $bpostReturnLabelHelper->getBarcodeByLabelResponse($order, $parsedLabelResponse);
51
 
52
  foreach($parsedLabelResponse["pdfString"] as $pdfString){
53
  //convertstring to pdf and save
@@ -65,7 +65,7 @@ class Bpost_ShM_Model_Returnlabel extends Mage_Core_Model_Abstract
65
 
66
  //we start a transaction
67
  //we save multiple objects
68
- $transactionSave = Mage::getModel('core/resource_transaction')
69
  ->addObject($returnLabelObject)
70
  ->addObject($order)
71
  ->save();
@@ -89,16 +89,16 @@ class Bpost_ShM_Model_Returnlabel extends Mage_Core_Model_Abstract
89
  $returnLabel = Mage::getModel('bpost_shm/returnlabel')->load($returnId);
90
  $order = Mage::getModel('sales/order')->load($returnLabel->getOrderId());
91
  $billingAddress = $order->getBillingAddress();
92
- $pdf_attachment = $returnLabel->getLabelPdfPath();
93
 
94
  $templateVars = array('returnlabel' => $returnLabel, 'order' => $order, 'store' => Mage::app()->getStore($order->getStoreId()));
95
  $transactionalEmail = Mage::getModel('core/email_template')->setDesignConfig(array('area' => 'frontend', 'store' => $order->getStoreId()));
96
 
97
- $filePath = Mage::getBaseDir('media') . self::MEDIA_RETURNLABEL_PATH . $pdf_attachment;
98
  $pdfFileParser = Zend_Pdf::load($filePath);
99
 
100
- if (!empty($pdf_attachment) && $file->fileExists($filePath)) {
101
- $fileName = $bpostHelper->getFileNameByPath($pdf_attachment);
102
  $transactionalEmail->getMail()
103
  ->createAttachment(
104
  $pdfFileParser->render(),
34
  {
35
  $order = Mage::getModel('sales/order')->load($orderId);
36
  $bpostHelper = Mage::helper("bpost_shm");
37
+ $returnLabelHelper = Mage::helper("bpost_shm/returnlabel");
38
 
39
  //check for return order
40
  $returnlabelResponse = Mage::getModel('bpost_shm/api', true)->createReturnLabel($order);
47
 
48
  //make sure we save with an unique name
49
  //if no barcode is returned (probably never)
50
+ $barcode = $returnLabelHelper->getBarcodeByLabelResponse($order, $parsedLabelResponse);
51
 
52
  foreach($parsedLabelResponse["pdfString"] as $pdfString){
53
  //convertstring to pdf and save
65
 
66
  //we start a transaction
67
  //we save multiple objects
68
+ Mage::getModel('core/resource_transaction')
69
  ->addObject($returnLabelObject)
70
  ->addObject($order)
71
  ->save();
89
  $returnLabel = Mage::getModel('bpost_shm/returnlabel')->load($returnId);
90
  $order = Mage::getModel('sales/order')->load($returnLabel->getOrderId());
91
  $billingAddress = $order->getBillingAddress();
92
+ $pdfAttachment = $returnLabel->getLabelPdfPath();
93
 
94
  $templateVars = array('returnlabel' => $returnLabel, 'order' => $order, 'store' => Mage::app()->getStore($order->getStoreId()));
95
  $transactionalEmail = Mage::getModel('core/email_template')->setDesignConfig(array('area' => 'frontend', 'store' => $order->getStoreId()));
96
 
97
+ $filePath = Mage::getBaseDir('media') . self::MEDIA_RETURNLABEL_PATH . $pdfAttachment;
98
  $pdfFileParser = Zend_Pdf::load($filePath);
99
 
100
+ if (!empty($pdfAttachment) && $file->fileExists($filePath)) {
101
+ $fileName = $bpostHelper->getFileNameByPath($pdfAttachment);
102
  $transactionalEmail->getMail()
103
  ->createAttachment(
104
  $pdfFileParser->render(),
app/code/community/Bpost/ShM/Model/Shipping/Carrier/BpostShM.php CHANGED
@@ -27,19 +27,18 @@ class Bpost_ShM_Model_Shipping_Carrier_BpostShM extends Mage_Shipping_Model_Carr
27
  */
28
  public function collectRates(Mage_Shipping_Model_Rate_Request $request)
29
  {
30
- $numberOfDisabledShippingMethods = 0;
31
  $result = Mage::getModel('bpost_shm/shipping_rate_result');
32
 
33
  $helper = Mage::helper("bpost_shm");
34
  $configHelper = Mage::helper("bpost_shm/system_config");
35
  $checkoutSession = Mage::getSingleton('checkout/session');
36
 
37
- $quote = $checkoutSession->getQuote();
38
  $ratePriceByMethod = array();
39
 
40
  foreach ($this->getAllowedMethods() as $shippingMethodCode => $shippingMethodName) {
41
  if (!$this->getBpostConfigData('active', $shippingMethodCode) || !$this->checkAvailableBpostShipCountries($request, $shippingMethodCode)) {
42
- $numberOfDisabledShippingMethods++;
43
  continue;
44
  }
45
 
@@ -120,28 +119,27 @@ class Bpost_ShM_Model_Shipping_Carrier_BpostShM extends Mage_Shipping_Model_Carr
120
  }
121
  }
122
 
123
- $postCodeValidationResult = Mage::helper('bpost_shm')->validatePostcode($request->getDestCountryId(), $request->getDestPostcode());
124
- if (($shippingMethodCode == 'bpost_homedelivery' || $shippingMethodCode == 'bpost_international') && $postCodeValidationResult != 'passed') {
125
  $error = Mage::getModel('shipping/rate_result_error');
126
  $error->setCarrier($this->_code);
127
  $error->setCarrierTitle('Bpost ShippingManager');
128
- $error->setData('error_message', Mage::helper('bpost_shm')->__('The Bpost shipping method "%s" is not available because your postal code is not correct. For your country the format should be like "%s". Please correct the postal code in your shipping address.', $shippingMethodName, $postCodeValidationResult));
129
  $result->append($error);
130
  continue;
131
  }
132
 
133
  $saturdayDeliveryCost = $helper->formatSaturdayDeliveryCost($configHelper->getBpostShippingConfig("saturday_delivery_cost", Mage::app()->getStore()->getId()));
134
- $saturdayDeliveryActiveByCarrier = $configHelper->getBpostCarriersConfig("saturday_delivery", $shippingMethodCode, Mage::app()->getStore()->getId());
135
  $ratePriceByMethod[$this->_code . "_" . $shippingMethodCode] = $price;
136
- if ((bool)$saturdayDeliveryActiveByCarrier &&
 
137
  (bool)Mage::helper("bpost_shm/system_config")->getBpostShippingConfig("display_delivery_date") &&
138
  !(bool)$checkoutSession->getQuote()->getData("bpost_disable_saturday_delivery")
139
  ) {
140
  $price = $price + $saturdayDeliveryCost;
141
- $quote->setBpostSaturdayCostApplied(true)->save();
142
- } else {
143
- $quote->setBpostSaturdayCostApplied(false)->save();
144
  }
 
145
  $method->setCarrier($this->_code);
146
  $method->setMethod($shippingMethodCode);
147
  $method->setMethodTitle($helper->__($this->getBpostConfigData('name', $shippingMethodCode)));
@@ -151,7 +149,7 @@ class Bpost_ShM_Model_Shipping_Carrier_BpostShM extends Mage_Shipping_Model_Carr
151
  $result->append($method);
152
  }
153
 
154
- if ($numberOfDisabledShippingMethods == 4) {
155
  return false;
156
  }
157
 
@@ -217,15 +215,15 @@ class Bpost_ShM_Model_Shipping_Carrier_BpostShM extends Mage_Shipping_Model_Carr
217
  /**
218
  * Get tracking result object.
219
  *
220
- * @param string $tracking_number
221
- * @return Mage_Shipping_Model_Tracking_Result $tracking_result
222
  */
223
- public function getTrackingInfo($tracking_number)
224
  {
225
- $tracking_result = $this->getTracking($tracking_number);
226
 
227
- if ($tracking_result instanceof Mage_Shipping_Model_Tracking_Result) {
228
- $trackings = $tracking_result->getAllTrackings();
229
  if (is_array($trackings) && count($trackings) > 0) {
230
  return $trackings[0];
231
  }
@@ -236,33 +234,32 @@ class Bpost_ShM_Model_Shipping_Carrier_BpostShM extends Mage_Shipping_Model_Carr
236
  /**
237
  * Get tracking Url
238
  *
239
- * @param string $tracking_number
240
  * @return Mage_Shipping_Model_Tracking_Result
241
  */
242
- public function getTracking($tracking_number)
243
  {
244
  $collection = Mage::getResourceModel('sales/order_shipment_track_collection')
245
- ->addFieldToFilter('track_number', $tracking_number)
246
  ->addAttributeToSelect("order_id")
247
  ->join('sales/order', 'order_id=`sales/order`.entity_id', array('increment_id' => 'increment_id', 'shipping_description' => 'shipping_description'), null, 'left');
248
- $orderId = $collection->getFirstItem()->getIncrementId();
249
  $carrierTitle = $collection->getFirstItem()->getShippingDescription();
250
- $tracking_result = Mage::getModel('shipping/tracking_result');
251
- $tracking_status = Mage::getModel('shipping/tracking_result_status');
252
  $localeExploded = explode('_', Mage::app()->getLocale()->getLocaleCode());
253
- $tracking_status->setCarrier($this->_code);
254
- $tracking_status->setCarrierTitle($carrierTitle);
255
- $tracking_status->setTracking($tracking_number);
256
 
257
  $trackDomainUrl = self::SHIPMENT_TRACK_DOMAIN;
258
- $tracking_status->addData(
259
  array(
260
- 'status' => '<a target="_blank" href="' . $trackDomainUrl . 'etr/light/performSearch.do?searchByItemCode=true&oss_language=' . $localeExploded[0] . '&itemCodes=' . $tracking_number . '"><img src="' . Mage::getDesign()->getSkinUrl('images/bpost/bpost_logo_RGB72_M.png') . '" /> <br />' . Mage::helper('bpost_shm')->__('Click here to track your bpost shipments.') . '</a>'
261
  )
262
  );
263
- $tracking_result->append($tracking_status);
264
 
265
- return $tracking_result;
266
  }
267
 
268
  /**
27
  */
28
  public function collectRates(Mage_Shipping_Model_Rate_Request $request)
29
  {
30
+ $disabledShippingMethods = 0;
31
  $result = Mage::getModel('bpost_shm/shipping_rate_result');
32
 
33
  $helper = Mage::helper("bpost_shm");
34
  $configHelper = Mage::helper("bpost_shm/system_config");
35
  $checkoutSession = Mage::getSingleton('checkout/session');
36
 
 
37
  $ratePriceByMethod = array();
38
 
39
  foreach ($this->getAllowedMethods() as $shippingMethodCode => $shippingMethodName) {
40
  if (!$this->getBpostConfigData('active', $shippingMethodCode) || !$this->checkAvailableBpostShipCountries($request, $shippingMethodCode)) {
41
+ $disabledShippingMethods++;
42
  continue;
43
  }
44
 
119
  }
120
  }
121
 
122
+ $pcValidationResult = Mage::helper('bpost_shm')->validatePostcode($request->getDestCountryId(), $request->getDestPostcode());
123
+ if (($shippingMethodCode == 'bpost_homedelivery' || $shippingMethodCode == 'bpost_international') && $pcValidationResult != 'passed') {
124
  $error = Mage::getModel('shipping/rate_result_error');
125
  $error->setCarrier($this->_code);
126
  $error->setCarrierTitle('Bpost ShippingManager');
127
+ $error->setData('error_message', Mage::helper('bpost_shm')->__('The Bpost shipping method "%s" is not available because your postal code is not correct. For your country the format should be like "%s". Please correct the postal code in your shipping address.', $shippingMethodName, $pcValidationResult));
128
  $result->append($error);
129
  continue;
130
  }
131
 
132
  $saturdayDeliveryCost = $helper->formatSaturdayDeliveryCost($configHelper->getBpostShippingConfig("saturday_delivery_cost", Mage::app()->getStore()->getId()));
133
+ $saturdayDelivery = $configHelper->getBpostCarriersConfig("saturday_delivery", $shippingMethodCode, Mage::app()->getStore()->getId());
134
  $ratePriceByMethod[$this->_code . "_" . $shippingMethodCode] = $price;
135
+
136
+ if ((bool)$saturdayDelivery &&
137
  (bool)Mage::helper("bpost_shm/system_config")->getBpostShippingConfig("display_delivery_date") &&
138
  !(bool)$checkoutSession->getQuote()->getData("bpost_disable_saturday_delivery")
139
  ) {
140
  $price = $price + $saturdayDeliveryCost;
 
 
 
141
  }
142
+
143
  $method->setCarrier($this->_code);
144
  $method->setMethod($shippingMethodCode);
145
  $method->setMethodTitle($helper->__($this->getBpostConfigData('name', $shippingMethodCode)));
149
  $result->append($method);
150
  }
151
 
152
+ if ($disabledShippingMethods == 4) {
153
  return false;
154
  }
155
 
215
  /**
216
  * Get tracking result object.
217
  *
218
+ * @param string $trackingNumber
219
+ * @return Mage_Shipping_Model_Tracking_Result $trackingResult
220
  */
221
+ public function getTrackingInfo($trackingNumber)
222
  {
223
+ $trackingResult = $this->getTracking($trackingNumber);
224
 
225
+ if ($trackingResult instanceof $trackingResult) {
226
+ $trackings = $trackingResult->getAllTrackings();
227
  if (is_array($trackings) && count($trackings) > 0) {
228
  return $trackings[0];
229
  }
234
  /**
235
  * Get tracking Url
236
  *
237
+ * @param string $trackingNumber
238
  * @return Mage_Shipping_Model_Tracking_Result
239
  */
240
+ public function getTracking($trackingNumber)
241
  {
242
  $collection = Mage::getResourceModel('sales/order_shipment_track_collection')
243
+ ->addFieldToFilter('track_number', $trackingNumber)
244
  ->addAttributeToSelect("order_id")
245
  ->join('sales/order', 'order_id=`sales/order`.entity_id', array('increment_id' => 'increment_id', 'shipping_description' => 'shipping_description'), null, 'left');
 
246
  $carrierTitle = $collection->getFirstItem()->getShippingDescription();
247
+ $trackingResult = Mage::getModel('shipping/tracking_result');
248
+ $trackingStatus = Mage::getModel('shipping/tracking_result_status');
249
  $localeExploded = explode('_', Mage::app()->getLocale()->getLocaleCode());
250
+ $trackingStatus->setCarrier($this->_code);
251
+ $trackingStatus->setCarrierTitle($carrierTitle);
252
+ $trackingStatus->setTracking($trackingNumber);
253
 
254
  $trackDomainUrl = self::SHIPMENT_TRACK_DOMAIN;
255
+ $trackingStatus->addData(
256
  array(
257
+ 'status' => '<a target="_blank" href="' . $trackDomainUrl . 'etr/light/performSearch.do?searchByItemCode=true&oss_language=' . $localeExploded[0] . '&itemCodes=' . $trackingNumber . '"><img src="' . Mage::getDesign()->getSkinUrl('images/bpost/bpost_logo_RGB72_M.png') . '" /> <br />' . Mage::helper('bpost_shm')->__('Click here to track your bpost shipments.') . '</a>'
258
  )
259
  );
260
+ $trackingResult->append($trackingStatus);
261
 
262
+ return $trackingResult;
263
  }
264
 
265
  /**
app/code/community/Bpost/ShM/Model/Shipping/Geocode.php CHANGED
@@ -13,12 +13,12 @@
13
  */
14
  class Bpost_ShM_Model_Shipping_Geocode
15
  {
16
- protected $address_line;
17
  /**
18
  * @var Bpost_ShM_Helper_Data
19
  */
20
- protected $success = false;
21
- protected $xml;
22
 
23
  /**
24
  * Make the call to google geocode
@@ -33,11 +33,11 @@ class Bpost_ShM_Model_Shipping_Geocode
33
  $key = $configHelper->getBpostShippingConfig("server_api_key");
34
 
35
  if($gMapsAddress) {
36
- $this->address_line = $gMapsAddress;
37
  $url = 'https://maps.googleapis.com/maps/api/geocode/xml?address=' . urlencode($gMapsAddress);
38
  } else {
39
  $coords = $latitude.','.$longitude;
40
- $this->address_line = $coords;
41
  $url = 'https://maps.googleapis.com/maps/api/geocode/xml?latlng=' . urlencode($coords);
42
  }
43
  $url .= '&language=nl';
@@ -48,13 +48,13 @@ class Bpost_ShM_Model_Shipping_Geocode
48
  $xml = simplexml_load_file($url);
49
  switch($xml->status){
50
  case "OK":
51
- $this->success = true;
52
- $this->xml = $xml;
53
- Mage::helper('bpost_shm')->log("Geocode: OK ".$this->address_line." to xml" ,Zend_Log::DEBUG);
54
  return $this;
55
  break;
56
  case "ZERO_RESULTS":
57
- Mage::helper('bpost_shm')->log("Geocode: no results found for ".$this->address_line,Zend_Log::DEBUG);
58
  return false;
59
  break;
60
  case "OVER_QUERY_LIMIT":
@@ -104,9 +104,9 @@ class Bpost_ShM_Model_Shipping_Geocode
104
  */
105
  public function getLatLng()
106
  {
107
- if($this->success){
108
- $lat = (string)$this->xml->result[0]->geometry->location->lat;
109
- $lng = (string)$this->xml->result[0]->geometry->location->lng;
110
 
111
  if(isset($lat) && isset($lng)) {
112
  return array('lat' => $lat, 'lng' => $lng);
@@ -121,9 +121,9 @@ class Bpost_ShM_Model_Shipping_Geocode
121
  */
122
  public function getPostalCode()
123
  {
124
- if($this->success){
125
- $postalCode = $this->_extractFromAdress($this->xml->result[0], 'postal_code');
126
- $locality = $this->_extractFromAdress($this->xml->result[0], 'locality');
127
 
128
  if($postalCode) {
129
  return (string)$postalCode;
13
  */
14
  class Bpost_ShM_Model_Shipping_Geocode
15
  {
16
+ protected $_addressLine;
17
  /**
18
  * @var Bpost_ShM_Helper_Data
19
  */
20
+ protected $_success = false;
21
+ protected $_xml;
22
 
23
  /**
24
  * Make the call to google geocode
33
  $key = $configHelper->getBpostShippingConfig("server_api_key");
34
 
35
  if($gMapsAddress) {
36
+ $this->_addressLine = $gMapsAddress;
37
  $url = 'https://maps.googleapis.com/maps/api/geocode/xml?address=' . urlencode($gMapsAddress);
38
  } else {
39
  $coords = $latitude.','.$longitude;
40
+ $this->_addressLine = $coords;
41
  $url = 'https://maps.googleapis.com/maps/api/geocode/xml?latlng=' . urlencode($coords);
42
  }
43
  $url .= '&language=nl';
48
  $xml = simplexml_load_file($url);
49
  switch($xml->status){
50
  case "OK":
51
+ $this->_success = true;
52
+ $this->_xml = $xml;
53
+ Mage::helper('bpost_shm')->log("Geocode: OK ".$this->_addressLine." to xml" ,Zend_Log::DEBUG);
54
  return $this;
55
  break;
56
  case "ZERO_RESULTS":
57
+ Mage::helper('bpost_shm')->log("Geocode: no results found for ".$this->_addressLine,Zend_Log::DEBUG);
58
  return false;
59
  break;
60
  case "OVER_QUERY_LIMIT":
104
  */
105
  public function getLatLng()
106
  {
107
+ if($this->_success){
108
+ $lat = (string)$this->_xml->result[0]->geometry->location->lat;
109
+ $lng = (string)$this->_xml->result[0]->geometry->location->lng;
110
 
111
  if(isset($lat) && isset($lng)) {
112
  return array('lat' => $lat, 'lng' => $lng);
121
  */
122
  public function getPostalCode()
123
  {
124
+ if($this->_success){
125
+ $postalCode = $this->_extractFromAdress($this->_xml->result[0], 'postal_code');
126
+ $locality = $this->_extractFromAdress($this->_xml->result[0], 'locality');
127
 
128
  if($postalCode) {
129
  return (string)$postalCode;
app/code/community/Bpost/ShM/controllers/Adminhtml/Bpost/ShM/AllOrdersController.php CHANGED
@@ -28,9 +28,9 @@ class Bpost_ShM_Adminhtml_Bpost_ShM_AllOrdersController extends Bpost_ShM_Contro
28
  protected function _isAllowed()
29
  {
30
  $configHelper = Mage::helper("bpost_shm/system_config");
31
- $manageLabelsWithMagento = $configHelper->getBpostShippingConfig("manage_labels_with_magento");
32
 
33
- if(!$manageLabelsWithMagento){
34
  $this->_getSession()->addNotice('Please enable the "Use Magento to manage labels" setting first under "system -> configuration -> shipping settings -> Bpost Shipping Manager" if you want to use this functionality.');
35
  return false;
36
  }
28
  protected function _isAllowed()
29
  {
30
  $configHelper = Mage::helper("bpost_shm/system_config");
31
+ $manageLabels = $configHelper->getBpostShippingConfig("manage_labels_with_magento");
32
 
33
+ if(!$manageLabels){
34
  $this->_getSession()->addNotice('Please enable the "Use Magento to manage labels" setting first under "system -> configuration -> shipping settings -> Bpost Shipping Manager" if you want to use this functionality.');
35
  return false;
36
  }
app/code/community/Bpost/ShM/controllers/Adminhtml/Bpost/ShM/ConfigController.php CHANGED
@@ -96,16 +96,23 @@ class Bpost_ShM_Adminhtml_Bpost_ShM_ConfigController extends Mage_Adminhtml_Cont
96
 
97
  $countryCodes = array();
98
  foreach ($xml->deliveryMethod as $deliveryMethodData) {
99
- if($deliveryMethodData->product["name"] == $product){
100
-
101
- $productData = $deliveryMethodData->product;
102
- foreach($productData->price as $priceData){
103
- $countryCode = (string)$priceData["countryIso2Code"];
104
- $countryCodes[] = $countryCode;
 
 
 
 
 
 
105
  }
106
  }
107
  }
108
 
 
109
  if(!empty($countryCodes)){
110
  $countryModel = Mage::getModel("bpost_shm/country");
111
  $countryResourceModel = Mage::getResourceModel('bpost_shm/country');
96
 
97
  $countryCodes = array();
98
  foreach ($xml->deliveryMethod as $deliveryMethodData) {
99
+ foreach($deliveryMethodData->product as $productData){
100
+ $attributes = $productData->attributes();
101
+ $productName = $attributes["name"];
102
+
103
+ if($productName == $product) {
104
+ $productData = $deliveryMethodData->product;
105
+ foreach ($productData->price as $priceData) {
106
+ $countryCode = (string)$priceData["countryIso2Code"];
107
+ $countryCodes[] = $countryCode;
108
+ }
109
+
110
+ break 2;
111
  }
112
  }
113
  }
114
 
115
+
116
  if(!empty($countryCodes)){
117
  $countryModel = Mage::getModel("bpost_shm/country");
118
  $countryResourceModel = Mage::getResourceModel('bpost_shm/country');
app/code/community/Bpost/ShM/controllers/Adminhtml/Bpost/ShM/DownloadController.php CHANGED
@@ -17,40 +17,33 @@ class Bpost_ShM_Adminhtml_Bpost_ShM_DownloadController extends Mage_Adminhtml_Co
17
  $bpostMediaFilePath = Mage::getBaseDir('media') . Bpost_ShM_Model_Adminhtml_Bpostgrid::MEDIA_LABEL_PATH;
18
  $shipmentCollection = Mage::getResourceModel('sales/order_shipment_collection');
19
 
20
- $order = false;
21
- $pdfDownloadName = "";
22
-
23
  if($orderId){
 
 
 
 
24
  //get shipments by order
25
  $order = Mage::getModel("sales/order")->load($orderId);
26
  $pdfDownloadName = $order->getIncrementId().".pdf";
27
-
28
- $shipmentCollection->addFieldToFilter('order_id', $orderId);
29
- $shipmentCollection->addFieldToFilter('bpost_label_path', array("neq" => ""));
30
  }else{
31
  $shipmentId = $request->getParam('shipment_id');
32
  $shipmentCollection->addFieldToFilter('entity_id', $shipmentId);
33
- }
34
-
35
- $pdfMerged = new Zend_Pdf();
36
- $shipment = $shipmentCollection->getFirstItem();
37
-
38
- $merged = false;
39
- if(!$order){
40
- $order = $shipment->getOrder();
41
- }
42
 
43
- if(!$orderId){
44
- $pdfDownloadName = $shipment->getIncrementId().".pdf";
45
-
46
- if ($shipment->getBpostLabelPath() == "") {
47
  $message = Mage::helper('bpost_shm')->__("No label generated yet - please perform the ‘Generate Label and Complete’ action from the overview.");
48
  Mage::getSingleton('core/session')->addError($message);
49
  $this->_redirect('*/sales_order_shipment/view/' , array('shipment_id' => $shipmentId));
50
  return;
51
  }
 
 
 
52
  }
53
 
 
 
 
54
  if ($shipment->getBpostLabelPath() != "") {
55
  $pdfNames = explode(":", $shipment->getBpostLabelPath());
56
 
17
  $bpostMediaFilePath = Mage::getBaseDir('media') . Bpost_ShM_Model_Adminhtml_Bpostgrid::MEDIA_LABEL_PATH;
18
  $shipmentCollection = Mage::getResourceModel('sales/order_shipment_collection');
19
 
 
 
 
20
  if($orderId){
21
+ $shipmentCollection->addFieldToFilter('order_id', $orderId);
22
+ $shipmentCollection->addFieldToFilter('bpost_label_path', array("neq" => ""));
23
+ $shipment = $shipmentCollection->getFirstItem();
24
+
25
  //get shipments by order
26
  $order = Mage::getModel("sales/order")->load($orderId);
27
  $pdfDownloadName = $order->getIncrementId().".pdf";
 
 
 
28
  }else{
29
  $shipmentId = $request->getParam('shipment_id');
30
  $shipmentCollection->addFieldToFilter('entity_id', $shipmentId);
31
+ $shipment = $shipmentCollection->getFirstItem();
 
 
 
 
 
 
 
 
32
 
33
+ if (!$shipment->hasData() || $shipment->getBpostLabelPath() == "") {
 
 
 
34
  $message = Mage::helper('bpost_shm')->__("No label generated yet - please perform the ‘Generate Label and Complete’ action from the overview.");
35
  Mage::getSingleton('core/session')->addError($message);
36
  $this->_redirect('*/sales_order_shipment/view/' , array('shipment_id' => $shipmentId));
37
  return;
38
  }
39
+
40
+ $order = $shipment->getOrder();
41
+ $pdfDownloadName = $shipment->getIncrementId().".pdf";
42
  }
43
 
44
+ $pdfMerged = new Zend_Pdf();
45
+ $merged = false;
46
+
47
  if ($shipment->getBpostLabelPath() != "") {
48
  $pdfNames = explode(":", $shipment->getBpostLabelPath());
49
 
app/code/community/Bpost/ShM/controllers/Adminhtml/Bpost/ShM/PendingOrdersController.php CHANGED
@@ -28,9 +28,9 @@ class Bpost_ShM_Adminhtml_Bpost_ShM_PendingOrdersController extends Bpost_ShM_Co
28
  protected function _isAllowed()
29
  {
30
  $configHelper = Mage::helper("bpost_shm/system_config");
31
- $manageLabelsWithMagento = $configHelper->getBpostShippingConfig("manage_labels_with_magento");
32
 
33
- if(!$manageLabelsWithMagento){
34
  $this->_getSession()->addNotice('Please enable the "Use Magento to manage labels" setting first under "system -> configuration -> shipping settings -> Bpost Shipping Manager" if you want to use this functionality.');
35
  return false;
36
  }
28
  protected function _isAllowed()
29
  {
30
  $configHelper = Mage::helper("bpost_shm/system_config");
31
+ $manageLabels = $configHelper->getBpostShippingConfig("manage_labels_with_magento");
32
 
33
+ if(!$manageLabels){
34
  $this->_getSession()->addNotice('Please enable the "Use Magento to manage labels" setting first under "system -> configuration -> shipping settings -> Bpost Shipping Manager" if you want to use this functionality.');
35
  return false;
36
  }
app/code/community/Bpost/ShM/controllers/AjaxController.php CHANGED
@@ -104,44 +104,42 @@ class Bpost_ShM_AjaxController extends Mage_Core_Controller_Front_Action {
104
  $request = $this->getRequest();
105
  $isAjax = $request->isAjax();
106
 
107
- if ($isAjax) {
108
- $id = $request->getPost("id");
109
- $type = $request->getPost("type");
110
 
111
- if(($id && $type)) {
112
- $apiCall = Mage::helper('bpost_shm')->getBpostOpeningHours($id, $type);
113
- $error = array();
114
- $weekDays = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday');
115
- $closedOn = array();
116
 
117
- $xml = simplexml_load_string($apiCall);
118
 
119
- try{
120
- $openingHours = $xml->Poi->Record->Hours;
121
 
122
- foreach($weekDays as $weekDay) {
123
- $day = $openingHours->$weekDay;
124
 
125
- if($day) {
126
- if(empty($day->AMOpen[0]) && empty($day->AMClose[0]) && empty($day->PMOpen[0]) && empty($day->PMClose[0])) {
127
- //assume the point is closed for the day
128
- array_push($closedOn, $weekDay);
129
- }
130
  }
131
  }
132
-
133
- $shippingDates = Mage::helper('bpost_shm')->getBpostShippingDates($closedOn);
134
-
135
- }catch (Exception $e){
136
- Mage::helper("bpost_shm")->log("Webservice: not expected result returned:" . $e->getMessage(), Zend_Log::WARN);
137
- $shippingDates = "";
138
- $error[] = Mage::helper('bpost_shm')->__("Sorry, there was a problem contacting bpost, please contact the store owner for support.");
139
  }
140
 
141
- $payloadFull = array("error" => $error, "dates" => $shippingDates);
142
- $this->getResponse()->setHeader('Content-type', 'application/json');
143
- $this->getResponse()->setBody(json_encode($payloadFull));
 
 
 
144
  }
 
 
 
 
145
  }
146
  }
147
  }
104
  $request = $this->getRequest();
105
  $isAjax = $request->isAjax();
106
 
107
+ $id = $request->getPost("id");
108
+ $type = $request->getPost("type");
 
109
 
110
+ if ($isAjax && $id && $type) {
111
+ $apiCall = Mage::helper('bpost_shm')->getBpostOpeningHours($id, $type);
112
+ $error = array();
113
+ $weekDays = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday');
114
+ $closedOn = array();
115
 
116
+ $xml = simplexml_load_string($apiCall);
117
 
118
+ try{
119
+ $openingHours = $xml->Poi->Record->Hours;
120
 
121
+ foreach($weekDays as $weekDay) {
122
+ $day = $openingHours->$weekDay;
123
 
124
+ if($day) {
125
+ if(empty($day->AMOpen[0]) && empty($day->AMClose[0]) && empty($day->PMOpen[0]) && empty($day->PMClose[0])) {
126
+ //assume the point is closed for the day
127
+ array_push($closedOn, $weekDay);
 
128
  }
129
  }
 
 
 
 
 
 
 
130
  }
131
 
132
+ $shippingDates = Mage::helper('bpost_shm')->getBpostShippingDates($closedOn);
133
+
134
+ }catch (Exception $e){
135
+ Mage::helper("bpost_shm")->log("Webservice: not expected result returned:" . $e->getMessage(), Zend_Log::WARN);
136
+ $shippingDates = "";
137
+ $error[] = Mage::helper('bpost_shm')->__("Sorry, there was a problem contacting bpost, please contact the store owner for support.");
138
  }
139
+
140
+ $payloadFull = array("error" => $error, "dates" => $shippingDates);
141
+ $this->getResponse()->setHeader('Content-type', 'application/json');
142
+ $this->getResponse()->setBody(json_encode($payloadFull));
143
  }
144
  }
145
  }
app/code/community/Bpost/ShM/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Bpost_ShM>
5
- <version>1.0.3</version>
6
  </Bpost_ShM>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Bpost_ShM>
5
+ <version>1.0.5</version>
6
  </Bpost_ShM>
7
  </modules>
8
  <global>
app/code/community/Bpost/ShM/etc/system.xml CHANGED
@@ -216,7 +216,7 @@
216
  <depends>
217
  <manage_labels_with_magento>1</manage_labels_with_magento>
218
  </depends>
219
- <comment><![CDATA[If you enable this option, the bpost Track & Trace link will be added in the Magento mail templates. It is always possible to manually send these emails.<br/><a href='http://bpost.freshdesk.com/solution/articles/4000061636' target='_blank'>http://bpost.freshdesk.com/solution/articles/4000061636</a>]]></comment>
220
  </automatic_track_and_trace_information>
221
 
222
  <display_delivery_date translate="label,comment">
216
  <depends>
217
  <manage_labels_with_magento>1</manage_labels_with_magento>
218
  </depends>
219
+ <comment><![CDATA[If you enable this option, the bpost Track & Trace link will be added in the Magento mail templates. It is always possible to manually send these emails.<br/><a href='http://bpost.freshdesk.com/solution/articles/4000062605' target='_blank'>http://bpost.freshdesk.com/solution/articles/4000062605</a>]]></comment>
220
  </automatic_track_and_trace_information>
221
 
222
  <display_delivery_date translate="label,comment">
app/code/community/Bpost/ShM/sql/bpost_shm_setup/upgrade-0.0.7-0.0.8.php CHANGED
@@ -13,7 +13,7 @@ if (!Mage::helper('core')->isModuleEnabled('Bpost_ShippingManager')) {
13
  $installer->startSetup();
14
 
15
  //create the return label table
16
- $table_returnLabel = $installer->getConnection()->newTable($installer->getTable('bpost_shm/returnlabel'))
17
  ->addColumn('label_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
18
  'unsigned' => true,
19
  'nullable' => false,
@@ -32,7 +32,7 @@ if (!Mage::helper('core')->isModuleEnabled('Bpost_ShippingManager')) {
32
  ), "Id of the order")
33
  ->addColumn('date_created', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(), 'Creation Date')
34
  ->setComment('bpost Shipping Return Labels');
35
- $installer->getConnection()->createTable($table_returnLabel);
36
 
37
  $installer->endSetup();
38
 
13
  $installer->startSetup();
14
 
15
  //create the return label table
16
+ $tableReturnLabel = $installer->getConnection()->newTable($installer->getTable('bpost_shm/returnlabel'))
17
  ->addColumn('label_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
18
  'unsigned' => true,
19
  'nullable' => false,
32
  ), "Id of the order")
33
  ->addColumn('date_created', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(), 'Creation Date')
34
  ->setComment('bpost Shipping Return Labels');
35
+ $installer->getConnection()->createTable($tableReturnLabel);
36
 
37
  $installer->endSetup();
38
 
app/code/community/Bpost/ShM/sql/bpost_shm_setup/upgrade-0.0.9-0.0.10.php CHANGED
@@ -13,7 +13,7 @@ if (!Mage::helper('core')->isModuleEnabled('Bpost_ShippingManager')) {
13
  $installer->startSetup();
14
 
15
  //create the return label table
16
- $table_returnLabel = $installer->getConnection()->newTable($installer->getTable('bpost_shm/bpost_country'))
17
  ->addColumn('country_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
18
  'unsigned' => true,
19
  'nullable' => false,
@@ -25,7 +25,7 @@ if (!Mage::helper('core')->isModuleEnabled('Bpost_ShippingManager')) {
25
  'default' => "",
26
  ), "country code")
27
  ->setComment('bpost country code');
28
- $installer->getConnection()->createTable($table_returnLabel);
29
  $installer->endSetup();
30
 
31
  }
13
  $installer->startSetup();
14
 
15
  //create the return label table
16
+ $tableReturnLabel = $installer->getConnection()->newTable($installer->getTable('bpost_shm/bpost_country'))
17
  ->addColumn('country_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
18
  'unsigned' => true,
19
  'nullable' => false,
25
  'default' => "",
26
  ), "country code")
27
  ->setComment('bpost country code');
28
+ $installer->getConnection()->createTable($tableReturnLabel);
29
  $installer->endSetup();
30
 
31
  }
app/code/community/Bpost/ShM/sql/bpost_shm_setup/upgrade-0.1.3-0.1.4.php CHANGED
@@ -13,7 +13,7 @@ if (!Mage::helper('core')->isModuleEnabled('Bpost_ShippingManager')) {
13
  $installer->startSetup();
14
 
15
  //create the return label table
16
- $table_holidays = $installer->getConnection()->newTable($installer->getTable('bpost_shm/bpost_holidays'))
17
  ->addColumn('holiday_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
18
  'unsigned' => true,
19
  'nullable' => false,
@@ -25,7 +25,7 @@ if (!Mage::helper('core')->isModuleEnabled('Bpost_ShippingManager')) {
25
  'default' => null,
26
  ), "date")
27
  ->setComment('bpost holiday list');
28
- $installer->getConnection()->createTable($table_holidays);
29
 
30
  //import 2015 holidays
31
  $installer->run("
13
  $installer->startSetup();
14
 
15
  //create the return label table
16
+ $tableHolidays = $installer->getConnection()->newTable($installer->getTable('bpost_shm/bpost_holidays'))
17
  ->addColumn('holiday_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
18
  'unsigned' => true,
19
  'nullable' => false,
25
  'default' => null,
26
  ), "date")
27
  ->setComment('bpost holiday list');
28
+ $installer->getConnection()->createTable($tableHolidays);
29
 
30
  //import 2015 holidays
31
  $installer->run("
app/design/frontend/base/default/template/bpost/shm/append_bpost_shippingmethod.phtml CHANGED
@@ -2,7 +2,7 @@
2
  <?php $bpostHelper = Mage::helper("bpost_shm");?>
3
 
4
  <div id="bpostShm" class="bpostspotswrapper">
5
- <?php if($bpostHelper->getIsOnestepCheckout()){ ?>
6
  <div id="bpost-info-wrapper">
7
  <div id="bpostinfo"></div>
8
  </div>
@@ -50,7 +50,7 @@
50
  <div class="cf"></div>
51
  <div class="bpost-saturday-delivery">
52
  <label for="bpost-saturday">
53
- <input type="checkbox" <?php if($bpostHelper->getIsOnestepCheckout()){ echo 'onclick="stopObserving(); triggerAjaxCallGetSeparateSaveMethods(\'' . $this->getUrl('onestepcheckout/ajax/set_methods_separate', array('_secure'=>true)) . '\', false);"';}?> name="bpost_saturday_delivery" id="bpost-saturday" value="1" />
54
  <div class="bpost-label-text"><?php echo $settings['datepicker_saturday_delivery_text'] ?><?php if($this->getSaturdayDeliveryCost()) { ?><br /><small><?php echo sprintf($settings['datepicker_saturday_delivery_cost'], $this->getSaturdayDeliveryCost()) ?></small><?php } ?></div>
55
  </label>
56
  </div>
2
  <?php $bpostHelper = Mage::helper("bpost_shm");?>
3
 
4
  <div id="bpostShm" class="bpostspotswrapper">
5
+ <?php if($bpostHelper->isOnestepCheckout()){ ?>
6
  <div id="bpost-info-wrapper">
7
  <div id="bpostinfo"></div>
8
  </div>
50
  <div class="cf"></div>
51
  <div class="bpost-saturday-delivery">
52
  <label for="bpost-saturday">
53
+ <input type="checkbox" <?php if($bpostHelper->isOnestepCheckout()){ echo 'onclick="stopObserving(); triggerAjaxCallGetSeparateSaveMethods(\'' . $this->getUrl('onestepcheckout/ajax/set_methods_separate', array('_secure'=>true)) . '\', false);"';}?> name="bpost_saturday_delivery" id="bpost-saturday" value="1" />
54
  <div class="bpost-label-text"><?php echo $settings['datepicker_saturday_delivery_text'] ?><?php if($this->getSaturdayDeliveryCost()) { ?><br /><small><?php echo sprintf($settings['datepicker_saturday_delivery_cost'], $this->getSaturdayDeliveryCost()) ?></small><?php } ?></div>
55
  </label>
56
  </div>
app/locale/en_US/template/email/bpost/returnlabel.html CHANGED
@@ -32,7 +32,7 @@ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif;
32
  </td>
33
  </tr>
34
  <tr>
35
- <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
36
  </tr>
37
  </table>
38
  </td>
32
  </td>
33
  </tr>
34
  <tr>
35
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></td>
36
  </tr>
37
  </table>
38
  </td>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>bpost</name>
4
- <version>1.0.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>bpost shipping manager By PHPro</description>
11
  <notes>Translations and Bugfixing</notes>
12
  <authors><author><name>PHPro</name><user>heremke</user><email>info@phpro.be</email></author></authors>
13
- <date>2015-09-21</date>
14
- <time>15:58:41</time>
15
- <contents><target name="magecommunity"><dir name="Bpost"><dir name="ShM"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="AllOrders"><file name="Grid.php" hash="042d1860e8cbed473f36344cc9219bf7"/></dir><file name="AllOrders.php" hash="c9bed128109004f6007a2c51c0b13687"/><dir name="Grid"><dir name="Renderer"><dir name="Dropdate"><file name="Dateformat.php" hash="dc59c761bbc587cf9d9c3b46881cd5a2"/></dir><dir name="Label"><file name="Download.php" hash="6848a41d5eb1bad1e9da43937e279468"/></dir></dir></dir><file name="Grid.php" hash="a1fbaee1e57a9a4dba925580658cbaf3"/><dir name="Order"><dir name="View"><dir name="Tab"><file name="Returnbarcode.php" hash="d271b69bca3b77dc0a5a624d56628a1d"/><file name="Returnlabels.php" hash="3a281c4942cf722ab58523e9869113eb"/></dir></dir></dir><dir name="PendingOrders"><file name="Grid.php" hash="bcdc263143e9d4c104b6014da45373f6"/></dir><file name="PendingOrders.php" hash="584198acc69c0fad60ac793238ca6c8f"/></dir><dir name="Shipping"><dir name="Carrier"><dir name="Bpost"><dir name="Tablerate"><dir name="Homedelivery"><file name="Grid.php" hash="edc472d70d53b81685e0f861a50cd4fd"/></dir><dir name="International"><file name="Grid.php" hash="c76e5042c0f6ff9ed96d978f45336c2c"/></dir><dir name="Parcellocker"><file name="Grid.php" hash="f5de661468fc82c0b0a51baad560ebb4"/></dir><dir name="Pickuppoint"><file name="Grid.php" hash="23151dff9b96415cd8648429260481c9"/></dir></dir></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Api"><dir name="Import"><file name="Countries.php" hash="1f2d94c2ffb8f43d81050b7b9da42a42"/></dir></dir><dir name="Field"><file name="Choose.php" hash="ef813927a3ba26302cd8e4c7c5fb62a8"/><file name="Hour.php" hash="763b955bff596cddf2ceabd4ce85816d"/><file name="Info.php" hash="421631d66f10176e4cca80d30df625eb"/><file name="Logo.php" hash="30d8127ce79649b4cbe228a05fa4205f"/><file name="Subheader.php" hash="1af7b5ce235f4f422ab53e281db3cf6f"/></dir><dir name="Tablerates"><dir name="Export"><file name="Homedelivery.php" hash="beb4c5c59ef77d06a425a31d90893255"/><file name="International.php" hash="7806c48c000e996b707e87e58ac1f166"/><file name="Parcellocker.php" hash="e32815fa7846b08318a87c02a7374990"/><file name="Pickuppoint.php" hash="8cb4911d631d257332ce542db49c3672"/></dir></dir></dir></dir></dir><file name=".DS_Store" hash="f9730b3dd315c12716dddf59ea39931a"/></dir><dir name="Carrier"><file name="Bpost.php" hash="6f58e340cfb76e37b7c3eb2155f6c5d7"/></dir><file name=".DS_Store" hash="0047fe0bc161a58c6088a4e959de43a4"/></dir><dir name="Controller"><dir name="ShM"><file name="Order.php" hash="5ed0d85c210e731f7c2baa152281a1c4"/></dir><file name=".DS_Store" hash="3e624abbe850356dc518e8d865bb05a8"/></dir><dir name="Helper"><file name="Data.php" hash="043dff0ea4247b1d6db6b792ad6a4b51"/><file name="Returnlabel.php" hash="8b27e238d29e7b577389231433167141"/><dir name="System"><file name="Config.php" hash="393353ca26ef2b398769ecbb59fdcbf9"/></dir></dir><dir name="Model"><dir name="Adminhtml"><file name="Bpostgrid.php" hash="43d4c6679ef90dea08323cec7980495f"/><file name="Observer.php" hash="e40fbb7a4ad7338f88084eed36f59cc1"/><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Shipping"><dir name="Tablerates"><file name="Homedelivery.php" hash="26758346e7e09d2b3075cb0613a00b79"/><file name="International.php" hash="c6ba9e8b7e42893a7faf31392e0d647f"/><file name="Parcellocker.php" hash="2fa265b0623de5740b15ea27284a3b47"/><file name="Pickuppoint.php" hash="84ccd80c14f33de89b8164e396ef3241"/></dir></dir></dir><dir name="Source"><file name="Datecomment.php" hash="e2f0cd25ed8a1bb1e12171269f1ba6d9"/><file name="Shipping.php" hash="a19f622f5f64ee64c8f8e6667d6d9323"/></dir><file name=".DS_Store" hash="84808502c88185caecc9457a346ab540"/></dir><file name=".DS_Store" hash="60d450ab59b771a3c283579b2d35d28e"/></dir><file name=".DS_Store" hash="f9ea5fe25ab734fc254197fb0d37417f"/></dir><dir name="Api"><file name="Abstract.php" hash="1c174f96ada592113660356946094fa1"/><file name="Domcreator.php" hash="8e49b4e6aedba6c8c5f516d1bdb4c1ef"/></dir><file name="Api.php" hash="604467308efa121de1fbcd0a31894411"/><file name="Country.php" hash="7ca2d7fee06b4672ee8679dcc0d437cf"/><file name="Holidays.php" hash="85d3ad2c06516d3bd42d6cf25b6c1c1b"/><file name="Observer.php" hash="736e03d5cebaef3bc95f16860bdc1111"/><dir name="Resource"><dir name="Country"><file name="Collection.php" hash="173cb7acd05ead3fa4bb29f1a2200188"/></dir><file name="Country.php" hash="3ed62dc4bae568879a781400724e2b31"/><dir name="Holidays"><file name="Collection.php" hash="b39c602b1b6c7802a8e298ccabd3b88d"/></dir><file name="Holidays.php" hash="8410fabf516cce95e6e6a69e52abb6ec"/><dir name="Returnlabel"><file name="Collection.php" hash="d34adb537d24116270238ae1fa377a05"/></dir><file name="Returnlabel.php" hash="419fda598a2630ccc773ce0b0eacbd79"/><dir name="Tablerates"><dir name="Homedelivery"><file name="Collection.php" hash="7a34c249b5015ecda8ad26cbf42c6280"/></dir><file name="Homedelivery.php" hash="a94baf3909962e162813d8003583cc77"/><dir name="International"><file name="Collection.php" hash="6ba99077f1625a8c81990ea3afcb14b8"/></dir><file name="International.php" hash="ca3e45f29f9ef44f00ff41b509e0f0a1"/><dir name="Parcellocker"><file name="Collection.php" hash="9aa78e0bc7d389e93e958472a0fc40b6"/></dir><file name="Parcellocker.php" hash="66bb509267844a48ff5b054c82a47254"/><dir name="Pickuppoint"><file name="Collection.php" hash="1f9db3d5ff7f1a9e9d2eccddf6860513"/></dir><file name="Pickuppoint.php" hash="33e26bc93dcea5aabbee59343043413d"/></dir></dir><file name="Returnlabel.php" hash="72e3631e3106cc8710270092c7f23ed1"/><dir name="Shipping"><dir name="Carrier"><file name="BpostShM.php" hash="e9f253c4821f6f311098298d0b942764"/></dir><file name="Geocode.php" hash="fe2273974154557204395f79c688be52"/><dir name="Rate"><file name="Result.php" hash="77e9fc98f15441edfdc478fd589e41a8"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Country.php" hash="f49cbe30d05cffb6f516a3df6ddc1b7b"/><file name="Product.php" hash="cb74b0fc8d3f661d0be4ac9f9c5b840d"/><file name="Ratetypes.php" hash="42f1f3f8dc000ea5e5336ca1ad7ab85c"/><file name="Weightunit.php" hash="e0c0a9975395245c4d16d975c0334c31"/></dir></dir></dir><dir name="Tablerates"><file name="Homedelivery.php" hash="d60385de528eb957a2874af6306d4aae"/><file name="International.php" hash="d02e02a7cddbda576530d6acbd6d02e8"/><file name="Parcellocker.php" hash="805a9669f9d024a4c018d611e5c71afd"/><file name="Pickuppoint.php" hash="49dff9f40e26163b8d0c6b8be9f6ee51"/></dir><file name=".DS_Store" hash="167df0443a19cb5d776dcdb27f2b1bd5"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Bpost"><dir name="ShM"><file name="AllOrdersController.php" hash="01d0f8d2ec4180d854f18f913c8c164b"/><file name="ConfigController.php" hash="4162396a6ba56e940420fd9fe2c6ec5e"/><file name="DownloadController.php" hash="922f7565761811017a51882fb81d5669"/><file name="PendingOrdersController.php" hash="4589f63b6bf06850fe32c0b2160dab5a"/></dir></dir></dir><file name="AjaxController.php" hash="5319019be27bb45d40d536d086e74dec"/></dir><dir name="etc"><file name="adminhtml.xml" hash="cba525a2c3c394cb15c144f887e081cc"/><file name="config.xml" hash="557c866a126bdad7cb2c2739397a11d0"/><file name="system.xml" hash="e19af914361223c8c62c2b33542d7fb0"/></dir><dir name="sql"><dir name="bpost_shm_setup"><file name="install-0.0.1.php" hash="441ce29ddd9b04c052f03699e8ecc704"/><file name="upgrade-0.0.1-0.0.2.php" hash="7c5bb7a9609d6bec38a927e07eaad066"/><file name="upgrade-0.0.10-0.1.0.php" hash="c1523f2fd829372143c4686376512b37"/><file name="upgrade-0.0.2-0.0.3.php" hash="7e441f96e071efaa42d629815be8379c"/><file name="upgrade-0.0.3-0.0.4.php" hash="e2009ca70b9b268024433be7ac74ba19"/><file name="upgrade-0.0.4-0.0.5.php" hash="a51391f3bf810a5c6ae5c0bdbc5d9603"/><file name="upgrade-0.0.5-0.0.6.php" hash="2d8d624be7f829029b3e9fceb6d6c3b8"/><file name="upgrade-0.0.6-0.0.7.php" hash="82a7a64e3234c8b6e20367fcc80e1049"/><file name="upgrade-0.0.7-0.0.8.php" hash="3366e57552fa19433772709a557d2ed3"/><file name="upgrade-0.0.8-0.0.9.php" hash="20a344294274390515a891a89facfcb3"/><file name="upgrade-0.0.9-0.0.10.php" hash="064df8d78b82bc05d44041af93ca1bff"/><file name="upgrade-0.1.0-0.1.1.php" hash="ed824736e9cd0f8e98a4dc62c41ecf96"/><file name="upgrade-0.1.1-0.1.2.php" hash="bb7cf544bc07ef2209b82753ac2b950d"/><file name="upgrade-0.1.2-0.1.3.php" hash="04f9ab295e48b018e80da482bdf23132"/><file name="upgrade-0.1.3-0.1.4.php" hash="e9f9ecec20e2f5e05e44db2dc153bd56"/><file name="upgrade-0.1.4-0.1.5.php" hash="16333b0f3faa92e98d6bb6f75b4273cd"/><file name="upgrade-0.1.5-0.1.6.php" hash="f2f1f169a5ad2fbd0650ffbef3217b08"/><file name="upgrade-0.1.6-0.1.7.php" hash="95eebc7f870fa36c0a0997a06cb47076"/><file name="upgrade-0.1.7-0.1.8.php" hash="56a4bc5320b56309c943a90df00464e8"/></dir><file name=".DS_Store" hash="247fda627329429624d4c2a70ecd2548"/></dir><file name=".DS_Store" hash="9e95293deb7301dcbe4ff241e10d6486"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="bpost"><file name="shm.xml" hash="8a5ceb93674efcbd6e8063437877d9d5"/></dir></dir><dir name="template"><dir name="bpost"><file name="empty.phtml" hash="45a92398f5adc3dd6dda9527f95ef4d5"/><file name="informationpopup.phtml" hash="42432ed861bb8b5b34a39d879c164979"/><file name="screenshotpopup.phtml" hash="5ad6a05c55ea41e550262ceed28626ae"/><dir name="widget"><dir name="grid"><file name="massaction.phtml" hash="f9b9aa54fe683d66fd535f95afb07dfe"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="bpost"><file name="shm.xml" hash="7950f7c44cc1b2a10846611251a37501"/></dir></dir><dir name="template"><dir name="bpost"><dir name="shm"><file name="append_bpost_shippingmethod.phtml" hash="e55ca434e8fd22bccdf1914f3e5292ee"/><file name="gmapsapi.phtml" hash="8a5119f27b9537f9ede57ead12403a32"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="zBpost_ShM.xml" hash="791aeaa9ddf185a0b053728b20b06ea0"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Bpost_ShM.csv" hash="dc2696cafa7691c1a02c3fb7e6fcfea8"/><dir name="template"><dir name="email"><dir name="bpost"><file name="returnlabel.html" hash="c006eca772b567c6eefddbe04238eef7"/><file name="errorhandling_create_order.html" hash="5458114b6bfee6f66841f4fe19e13675"/></dir></dir></dir></dir><dir name="fr_DR"><file name="Bpost_ShM.csv" hash=""/></dir><dir name="nl_NL"><file name="Bpost_ShM.csv" hash="45850c54dbcc2c621617d93b526003eb"/></dir></target><target name="mageweb"><dir name="js"><dir name="bpost"><dir name="shm"><dir name="adminhtml"><file name="informationpopup.js" hash="dd25216084d43f70b7de4beaf1ef23c5"/></dir><file name="checkout.js" hash="d83462f10d2dbf8451744e53f2f51ae9"/><file name="onestepcheckout_shipping.js" hash="1d6f538fff8b36ba3958584747e835de"/></dir><file name=".DS_Store" hash="9cb5eec7f2c81769f587e6bea95ca5e7"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="bpost"><file name="checkout.css" hash="b085e5c58f8068bbb491eb9b929db40d"/></dir></dir><dir name="images"><dir name="bpost"><file name="ajax-loader-button.gif" hash="cbdad94ec5d22b17d7aae4c6d245069a"/><file name="ajax-loader-wheel.gif" hash="faa74e8c61fc64d5edb11613c7eead2c"/><file name="bpost_logo_RGB72_L.png" hash="ca8a5de3a37cfbbdac7c0fec6e4f9f28"/><file name="bpost_logo_RGB72_M.png" hash="feb4bb3bb7c9c4100612b62cde7037e5"/><file name="bpost_sym_RGB72_S.png" hash="18e774a968be600664d11a9e0691a424"/><file name="btn_close.png" hash="d6ecac0a01a600ef15efc9004ccc9fb7"/><file name="icon-close.png" hash="54d0827f50c1d294c61e88e316e61059"/><file name="icon-info.png" hash="e4de51e3c12327403a9b966aac98a9d6"/><file name="location_parcellocker_default.png" hash="8906b0e09067eab6f31b712d54ecf547"/><file name="location_postoffice_default.png" hash="ea147b38b01449e8a1cff3ebff6b2741"/><file name="location_postpoint_default.png" hash="c53f598daafbec4d042b165d21116719"/></dir></dir><dir name="js"><dir name="bpost"><file name="onestepcheckout.js" hash="b593635d5c0f5964c5bb34e27c66da92"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="bpost"><file name="informationpopup.css" hash="ce01062469cdb18ba03c76c129912c00"/></dir></dir><dir name="images"><dir name="bpost"><file name="ajax-loader-red.gif" hash="7bf0fa0e5a55c6a7cd122a9bb461006d"/><file name="bpost_logo_RGB72_L.png" hash="ca8a5de3a37cfbbdac7c0fec6e4f9f28"/><file name="bpost_logo_RGB72_M.png" hash="feb4bb3bb7c9c4100612b62cde7037e5"/><file name="btn_close.png" hash="d6ecac0a01a600ef15efc9004ccc9fb7"/><file name="ce-screenshot.png" hash="ff6f4a630cd17efc1abbe8eca6e015a5"/><file name="ee-screenshot.png" hash="ff6f4a630cd17efc1abbe8eca6e015a5"/><file name="pdf_icon.png" hash="95b561422892384337eb2eabb968a558"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>bpost</name>
4
+ <version>1.0.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
10
  <description>bpost shipping manager By PHPro</description>
11
  <notes>Translations and Bugfixing</notes>
12
  <authors><author><name>PHPro</name><user>heremke</user><email>info@phpro.be</email></author></authors>
13
+ <date>2015-09-23</date>
14
+ <time>13:13:48</time>
15
+ <contents><target name="magecommunity"><dir name="Bpost"><dir name="ShM"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="AllOrders"><file name="Grid.php" hash="042d1860e8cbed473f36344cc9219bf7"/></dir><file name="AllOrders.php" hash="c9bed128109004f6007a2c51c0b13687"/><dir name="Grid"><dir name="Renderer"><dir name="Dropdate"><file name="Dateformat.php" hash="dc59c761bbc587cf9d9c3b46881cd5a2"/></dir><dir name="Label"><file name="Download.php" hash="6848a41d5eb1bad1e9da43937e279468"/></dir></dir></dir><file name="Grid.php" hash="ae7c83f9baabda1db4627833d1f4f942"/><dir name="Order"><dir name="View"><dir name="Tab"><file name="Returnbarcode.php" hash="d271b69bca3b77dc0a5a624d56628a1d"/><file name="Returnlabels.php" hash="3a281c4942cf722ab58523e9869113eb"/></dir></dir></dir><dir name="PendingOrders"><file name="Grid.php" hash="bcdc263143e9d4c104b6014da45373f6"/></dir><file name="PendingOrders.php" hash="584198acc69c0fad60ac793238ca6c8f"/></dir><dir name="Shipping"><dir name="Carrier"><dir name="Bpost"><dir name="Tablerate"><dir name="Homedelivery"><file name="Grid.php" hash="edc472d70d53b81685e0f861a50cd4fd"/></dir><dir name="International"><file name="Grid.php" hash="c76e5042c0f6ff9ed96d978f45336c2c"/></dir><dir name="Parcellocker"><file name="Grid.php" hash="f5de661468fc82c0b0a51baad560ebb4"/></dir><dir name="Pickuppoint"><file name="Grid.php" hash="23151dff9b96415cd8648429260481c9"/></dir></dir></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Api"><dir name="Import"><file name="Countries.php" hash="1f2d94c2ffb8f43d81050b7b9da42a42"/></dir></dir><dir name="Field"><file name="Choose.php" hash="ef813927a3ba26302cd8e4c7c5fb62a8"/><file name="Hour.php" hash="763b955bff596cddf2ceabd4ce85816d"/><file name="Info.php" hash="421631d66f10176e4cca80d30df625eb"/><file name="Logo.php" hash="30d8127ce79649b4cbe228a05fa4205f"/><file name="Subheader.php" hash="1af7b5ce235f4f422ab53e281db3cf6f"/></dir><dir name="Tablerates"><dir name="Export"><file name="Homedelivery.php" hash="beb4c5c59ef77d06a425a31d90893255"/><file name="International.php" hash="7806c48c000e996b707e87e58ac1f166"/><file name="Parcellocker.php" hash="e32815fa7846b08318a87c02a7374990"/><file name="Pickuppoint.php" hash="8cb4911d631d257332ce542db49c3672"/></dir></dir></dir></dir></dir><file name=".DS_Store" hash="f9730b3dd315c12716dddf59ea39931a"/></dir><dir name="Carrier"><file name="Bpost.php" hash="11e9b51420dbe11656c378f6c6156576"/></dir><file name=".DS_Store" hash="0047fe0bc161a58c6088a4e959de43a4"/></dir><dir name="Controller"><dir name="ShM"><file name="Order.php" hash="7ab38959baaf721d9e7fe16bd34e9dab"/></dir><file name=".DS_Store" hash="3e624abbe850356dc518e8d865bb05a8"/></dir><dir name="Helper"><file name="Data.php" hash="0b7698d1987cca886ba137e8bddd7dfa"/><file name="Returnlabel.php" hash="e3fb05a9f08577dfe90866669d3f7613"/><dir name="System"><file name="Config.php" hash="393353ca26ef2b398769ecbb59fdcbf9"/></dir></dir><dir name="Model"><dir name="Adminhtml"><file name="Bpostgrid.php" hash="a8728ed9efdb88b5e67be037153c9304"/><file name="Observer.php" hash="cbada04572bd9df418bc069c6982a06e"/><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Shipping"><dir name="Tablerates"><file name="Homedelivery.php" hash="26758346e7e09d2b3075cb0613a00b79"/><file name="International.php" hash="c6ba9e8b7e42893a7faf31392e0d647f"/><file name="Parcellocker.php" hash="2fa265b0623de5740b15ea27284a3b47"/><file name="Pickuppoint.php" hash="84ccd80c14f33de89b8164e396ef3241"/></dir></dir></dir><dir name="Source"><file name="Datecomment.php" hash="a67ca74e2f81cbfaec6b7ed0ce8aa9f2"/><file name="Shipping.php" hash="a19f622f5f64ee64c8f8e6667d6d9323"/></dir><file name=".DS_Store" hash="84808502c88185caecc9457a346ab540"/></dir><file name=".DS_Store" hash="60d450ab59b771a3c283579b2d35d28e"/></dir><file name=".DS_Store" hash="f9ea5fe25ab734fc254197fb0d37417f"/></dir><dir name="Api"><file name="Abstract.php" hash="4cfff5b324dca9ebfb317e00e21e370a"/><file name="Domcreator.php" hash="fae02cb56a06504d03cbf712e46e4a2d"/></dir><file name="Api.php" hash="8c6181a0a88f503522d85784233c2380"/><file name="Country.php" hash="7ca2d7fee06b4672ee8679dcc0d437cf"/><file name="Holidays.php" hash="85d3ad2c06516d3bd42d6cf25b6c1c1b"/><file name="Observer.php" hash="1ed3c875be0aef025165934de084aa4a"/><dir name="Resource"><dir name="Country"><file name="Collection.php" hash="173cb7acd05ead3fa4bb29f1a2200188"/></dir><file name="Country.php" hash="3ed62dc4bae568879a781400724e2b31"/><dir name="Holidays"><file name="Collection.php" hash="b39c602b1b6c7802a8e298ccabd3b88d"/></dir><file name="Holidays.php" hash="8410fabf516cce95e6e6a69e52abb6ec"/><dir name="Returnlabel"><file name="Collection.php" hash="d34adb537d24116270238ae1fa377a05"/></dir><file name="Returnlabel.php" hash="419fda598a2630ccc773ce0b0eacbd79"/><dir name="Tablerates"><dir name="Homedelivery"><file name="Collection.php" hash="7a34c249b5015ecda8ad26cbf42c6280"/></dir><file name="Homedelivery.php" hash="a94baf3909962e162813d8003583cc77"/><dir name="International"><file name="Collection.php" hash="6ba99077f1625a8c81990ea3afcb14b8"/></dir><file name="International.php" hash="ca3e45f29f9ef44f00ff41b509e0f0a1"/><dir name="Parcellocker"><file name="Collection.php" hash="9aa78e0bc7d389e93e958472a0fc40b6"/></dir><file name="Parcellocker.php" hash="66bb509267844a48ff5b054c82a47254"/><dir name="Pickuppoint"><file name="Collection.php" hash="1f9db3d5ff7f1a9e9d2eccddf6860513"/></dir><file name="Pickuppoint.php" hash="33e26bc93dcea5aabbee59343043413d"/></dir></dir><file name="Returnlabel.php" hash="169bca5baa7726cd51e2a76e1b9a35a8"/><dir name="Shipping"><dir name="Carrier"><file name="BpostShM.php" hash="55f8f4eb614a8507071d3741e09164d2"/></dir><file name="Geocode.php" hash="83a582852a4170bcca330d0fa618ab08"/><dir name="Rate"><file name="Result.php" hash="77e9fc98f15441edfdc478fd589e41a8"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Country.php" hash="f49cbe30d05cffb6f516a3df6ddc1b7b"/><file name="Product.php" hash="cb74b0fc8d3f661d0be4ac9f9c5b840d"/><file name="Ratetypes.php" hash="42f1f3f8dc000ea5e5336ca1ad7ab85c"/><file name="Weightunit.php" hash="e0c0a9975395245c4d16d975c0334c31"/></dir></dir></dir><dir name="Tablerates"><file name="Homedelivery.php" hash="d60385de528eb957a2874af6306d4aae"/><file name="International.php" hash="d02e02a7cddbda576530d6acbd6d02e8"/><file name="Parcellocker.php" hash="805a9669f9d024a4c018d611e5c71afd"/><file name="Pickuppoint.php" hash="49dff9f40e26163b8d0c6b8be9f6ee51"/></dir><file name=".DS_Store" hash="167df0443a19cb5d776dcdb27f2b1bd5"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Bpost"><dir name="ShM"><file name="AllOrdersController.php" hash="094407f569e3c68b947273d25178b7c3"/><file name="ConfigController.php" hash="48a6c0923f74731a35e945a404c82371"/><file name="DownloadController.php" hash="2ea8c17c69a8611164d954d6f5e8a9a3"/><file name="PendingOrdersController.php" hash="430744f33af2d12a85851e117390748e"/></dir></dir></dir><file name="AjaxController.php" hash="1e7450cbcb9cc91361614473fb2be3e8"/></dir><dir name="etc"><file name="adminhtml.xml" hash="cba525a2c3c394cb15c144f887e081cc"/><file name="config.xml" hash="aea0ca1704d08d3e7788dd7744f5bde6"/><file name="system.xml" hash="9f0c60aa9c43140ca8a413e290d4d734"/></dir><dir name="sql"><dir name="bpost_shm_setup"><file name="install-0.0.1.php" hash="441ce29ddd9b04c052f03699e8ecc704"/><file name="upgrade-0.0.1-0.0.2.php" hash="7c5bb7a9609d6bec38a927e07eaad066"/><file name="upgrade-0.0.10-0.1.0.php" hash="c1523f2fd829372143c4686376512b37"/><file name="upgrade-0.0.2-0.0.3.php" hash="7e441f96e071efaa42d629815be8379c"/><file name="upgrade-0.0.3-0.0.4.php" hash="e2009ca70b9b268024433be7ac74ba19"/><file name="upgrade-0.0.4-0.0.5.php" hash="a51391f3bf810a5c6ae5c0bdbc5d9603"/><file name="upgrade-0.0.5-0.0.6.php" hash="2d8d624be7f829029b3e9fceb6d6c3b8"/><file name="upgrade-0.0.6-0.0.7.php" hash="82a7a64e3234c8b6e20367fcc80e1049"/><file name="upgrade-0.0.7-0.0.8.php" hash="a3b337a855d92202b5d625269edf4cb8"/><file name="upgrade-0.0.8-0.0.9.php" hash="20a344294274390515a891a89facfcb3"/><file name="upgrade-0.0.9-0.0.10.php" hash="74d06a2bbf41c5c8d9cb7870898a3eb3"/><file name="upgrade-0.1.0-0.1.1.php" hash="ed824736e9cd0f8e98a4dc62c41ecf96"/><file name="upgrade-0.1.1-0.1.2.php" hash="bb7cf544bc07ef2209b82753ac2b950d"/><file name="upgrade-0.1.2-0.1.3.php" hash="04f9ab295e48b018e80da482bdf23132"/><file name="upgrade-0.1.3-0.1.4.php" hash="9e8f6f1e2522917b8efeb379d21cd953"/><file name="upgrade-0.1.4-0.1.5.php" hash="16333b0f3faa92e98d6bb6f75b4273cd"/><file name="upgrade-0.1.5-0.1.6.php" hash="f2f1f169a5ad2fbd0650ffbef3217b08"/><file name="upgrade-0.1.6-0.1.7.php" hash="95eebc7f870fa36c0a0997a06cb47076"/><file name="upgrade-0.1.7-0.1.8.php" hash="56a4bc5320b56309c943a90df00464e8"/></dir><file name=".DS_Store" hash="247fda627329429624d4c2a70ecd2548"/></dir><file name=".DS_Store" hash="9e95293deb7301dcbe4ff241e10d6486"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="bpost"><file name="shm.xml" hash="8a5ceb93674efcbd6e8063437877d9d5"/></dir></dir><dir name="template"><dir name="bpost"><file name="empty.phtml" hash="45a92398f5adc3dd6dda9527f95ef4d5"/><file name="informationpopup.phtml" hash="42432ed861bb8b5b34a39d879c164979"/><file name="screenshotpopup.phtml" hash="5ad6a05c55ea41e550262ceed28626ae"/><dir name="widget"><dir name="grid"><file name="massaction.phtml" hash="f9b9aa54fe683d66fd535f95afb07dfe"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="bpost"><file name="shm.xml" hash="7950f7c44cc1b2a10846611251a37501"/></dir></dir><dir name="template"><dir name="bpost"><dir name="shm"><file name="append_bpost_shippingmethod.phtml" hash="f99babefda7237074b8ef430bb622276"/><file name="gmapsapi.phtml" hash="8a5119f27b9537f9ede57ead12403a32"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="zBpost_ShM.xml" hash="791aeaa9ddf185a0b053728b20b06ea0"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Bpost_ShM.csv" hash="dc2696cafa7691c1a02c3fb7e6fcfea8"/><dir name="template"><dir name="email"><dir name="bpost"><file name="returnlabel.html" hash="fa9b1779caf12fe6e8c85e44899e7e66"/><file name="errorhandling_create_order.html" hash="5458114b6bfee6f66841f4fe19e13675"/></dir></dir></dir></dir><dir name="fr_DR"><file name="Bpost_ShM.csv" hash=""/></dir><dir name="nl_NL"><file name="Bpost_ShM.csv" hash="45850c54dbcc2c621617d93b526003eb"/></dir></target><target name="mageweb"><dir name="js"><dir name="bpost"><dir name="shm"><dir name="adminhtml"><file name="informationpopup.js" hash="dd25216084d43f70b7de4beaf1ef23c5"/></dir><file name="checkout.js" hash="d83462f10d2dbf8451744e53f2f51ae9"/><file name="onestepcheckout_shipping.js" hash="1d6f538fff8b36ba3958584747e835de"/></dir><file name=".DS_Store" hash="9cb5eec7f2c81769f587e6bea95ca5e7"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="bpost"><file name="checkout.css" hash="b085e5c58f8068bbb491eb9b929db40d"/></dir></dir><dir name="images"><dir name="bpost"><file name="ajax-loader-button.gif" hash="cbdad94ec5d22b17d7aae4c6d245069a"/><file name="ajax-loader-wheel.gif" hash="faa74e8c61fc64d5edb11613c7eead2c"/><file name="bpost_logo_RGB72_L.png" hash="ca8a5de3a37cfbbdac7c0fec6e4f9f28"/><file name="bpost_logo_RGB72_M.png" hash="feb4bb3bb7c9c4100612b62cde7037e5"/><file name="bpost_sym_RGB72_S.png" hash="18e774a968be600664d11a9e0691a424"/><file name="btn_close.png" hash="d6ecac0a01a600ef15efc9004ccc9fb7"/><file name="icon-close.png" hash="54d0827f50c1d294c61e88e316e61059"/><file name="icon-info.png" hash="e4de51e3c12327403a9b966aac98a9d6"/><file name="location_parcellocker_default.png" hash="8906b0e09067eab6f31b712d54ecf547"/><file name="location_postoffice_default.png" hash="ea147b38b01449e8a1cff3ebff6b2741"/><file name="location_postpoint_default.png" hash="c53f598daafbec4d042b165d21116719"/></dir></dir><dir name="js"><dir name="bpost"><file name="onestepcheckout.js" hash="2308ea9945056e54cf4628603f9b5d5c"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="bpost"><file name="informationpopup.css" hash="ce01062469cdb18ba03c76c129912c00"/></dir></dir><dir name="images"><dir name="bpost"><file name="ajax-loader-red.gif" hash="7bf0fa0e5a55c6a7cd122a9bb461006d"/><file name="bpost_logo_RGB72_L.png" hash="ca8a5de3a37cfbbdac7c0fec6e4f9f28"/><file name="bpost_logo_RGB72_M.png" hash="feb4bb3bb7c9c4100612b62cde7037e5"/><file name="btn_close.png" hash="d6ecac0a01a600ef15efc9004ccc9fb7"/><file name="ce-screenshot.png" hash="ff6f4a630cd17efc1abbe8eca6e015a5"/><file name="ee-screenshot.png" hash="ff6f4a630cd17efc1abbe8eca6e015a5"/><file name="pdf_icon.png" hash="95b561422892384337eb2eabb968a558"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
skin/frontend/base/default/js/bpost/onestepcheckout.js CHANGED
@@ -12,11 +12,12 @@ get_separate_save_methods_function = function get_separate_save_methods_function
12
  triggerAjaxCallGetSeparateSaveMethods = function (url, update_payments){
13
  var form = $('onestepcheckout-form');
14
  var shipping_method = $RF(form, 'shipping_method');
15
- if( window.bpostSettings){
16
- var shippingmethodDate = window.bpostSettings.datepicker_days[shipping_method.replace('bpostshm_', '')]['date'];
17
- var currentDate = new Date(shippingmethodDate);
18
- var currentDay = currentDate.getDay();
19
- var saturdayDelivery = 0;
 
20
  }
21
  else{
22
  currentDay = "";
12
  triggerAjaxCallGetSeparateSaveMethods = function (url, update_payments){
13
  var form = $('onestepcheckout-form');
14
  var shipping_method = $RF(form, 'shipping_method');
15
+
16
+ if( window.bpostSettings && shipping_method){
17
+ var shippingmethodDate = window.bpostSettings.datepicker_days[shipping_method.replace('bpostshm_', '')]['date'];
18
+ var currentDate = new Date(shippingmethodDate);
19
+ var currentDay = currentDate.getDay();
20
+ var saturdayDelivery = 0;
21
  }
22
  else{
23
  currentDay = "";