notime_same_day_delivery - Version 1.2.3

Version Notes

Resolved problems with calculation taxable shipping price.

Download this release

Release Info

Developer notime
Extension notime_same_day_delivery
Version 1.2.3
Comparing to
See all releases


Code changes from version 1.2.0 to 1.2.3

app/code/local/Notime/Shipping/Block/Checkout/Onepage/Shipping/Notime.php CHANGED
@@ -1,84 +1,130 @@
1
- <?php
2
-
3
- /**
4
- * One page checkout status
5
- *
6
- * @category Mage
7
- * @category Mage
8
- * @package Mage_Checkout
9
- * @author Magento Core Team <core@magentocommerce.com>
10
- */
11
- class Notime_Shipping_Block_Checkout_Onepage_Shipping_Notime extends Mage_Checkout_Block_Onepage_Abstract
12
- {
13
- protected function _construct()
14
- {
15
- $this->setTemplate('notime/checkout/onepage/shipping_method/notime.phtml');
16
-
17
- /*
18
- $this->getCheckout()->setStepData('shipping_method', array(
19
- 'label' => Mage::helper('checkout')->__('Shipping Method'),
20
- 'is_show' => $this->isShow()
21
- ));
22
- parent::_construct();
23
- */
24
- }
25
-
26
- public function getFormCode(){
27
- return 'notime_additional_block';
28
- }
29
-
30
- /**
31
- * Retrieve is allow and show block
32
- *
33
- * @return bool
34
- */
35
- public function isShow()
36
- {
37
- return !$this->getQuote()->isVirtual();
38
- }
39
-
40
- /**
41
- * Return shipping widget code
42
- * @return mixed|string
43
- */
44
- public function getWidgetButton() {
45
- if(Mage::getStoreConfig('carriers/notime/active', Mage::app()->getStore()->getId())) {
46
- return Mage::getStoreConfig('carriers/notime/widget_editmode_button', Mage::app()->getStore()->getId());
47
- }
48
- return '';
49
- }
50
-
51
- /**
52
- * @return string
53
- */
54
- public function getWidgetCodeSrc() {
55
- if(Mage::getStoreConfig('carriers/notime/active', Mage::app()->getStore()->getId())) {
56
- $matches = array();
57
- preg_match('/src=[\"\']([^"]*)[\"\']/i', Mage::getStoreConfig('carriers/notime/widget_editmode_code', Mage::app()->getStore()->getId()), $matches) ;
58
- if(isset($matches[1])) {
59
- return trim($matches[1]);
60
- }
61
- }
62
- return '';
63
- }
64
-
65
- /**
66
- * @return string
67
- */
68
- public function getWidgetZipCode() {
69
- if(Mage::getStoreConfig('carriers/notime/active', Mage::app()->getStore()->getId())) {
70
- $matches = array();
71
- preg_match('/ecommerceZipCodeId=(.*?)[\&\'\"]/', Mage::getStoreConfig('carriers/notime/widget_editmode_code', Mage::app()->getStore()->getId()), $matches) ;
72
- if(isset($matches[1])) {
73
- return trim($matches[1]);
74
- }
75
- }
76
- return '';
77
- }
78
-
79
- public function getAdditionalText(){
80
- return Mage::getStoreConfig('carriers/notime/additional_info', Mage::app()->getStore()->getId());
81
- }
82
-
83
-
84
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * One page checkout status
5
+ *
6
+ * @category Mage
7
+ * @category Mage
8
+ * @package Mage_Checkout
9
+ * @author Magento Core Team <core@magentocommerce.com>
10
+ */
11
+ class Notime_Shipping_Block_Checkout_Onepage_Shipping_Notime extends Mage_Checkout_Block_Onepage_Abstract
12
+ {
13
+ protected function _construct() {
14
+ $this->setTemplate('notime/checkout/onepage/shipping_method/notime.phtml');
15
+
16
+ }
17
+
18
+ public function getFormCode(){
19
+ return 'notime_additional_block';
20
+ }
21
+
22
+ /**
23
+ * Retrieve is allow and show block
24
+ *
25
+ * @return bool
26
+ */
27
+ public function isShow()
28
+ {
29
+ return !$this->getQuote()->isVirtual();
30
+ }
31
+
32
+ /**
33
+ * Return shipping widget code
34
+ * @return mixed|string
35
+ */
36
+ public function getWidgetButton() {
37
+ if(Mage::getStoreConfig('carriers/notime/active', Mage::app()->getStore()->getId())) {
38
+ return Mage::getStoreConfig('carriers/notime/widget_editmode_button', Mage::app()->getStore()->getId());
39
+ }
40
+ return '';
41
+ }
42
+
43
+ /**
44
+ * @return string
45
+ */
46
+ public function getWidgetCodeSrc() {
47
+ if(Mage::getStoreConfig('carriers/notime/active', Mage::app()->getStore()->getId())) {
48
+ $matches = array();
49
+ preg_match('/src=[\"\']([^"]*)[\"\']/i', Mage::getStoreConfig('carriers/notime/widget_editmode_code', Mage::app()->getStore()->getId()), $matches) ;
50
+ if(isset($matches[1])) {
51
+ return trim($matches[1]);
52
+ }
53
+ }
54
+ return '';
55
+ }
56
+
57
+ /**
58
+ * @return string
59
+ */
60
+ public function getWidgetZipCode() {
61
+ if(Mage::getStoreConfig('carriers/notime/active', Mage::app()->getStore()->getId())) {
62
+ $matches = array();
63
+ preg_match('/ecommerceZipCodeId=(.*?)[\&\'\"]/', Mage::getStoreConfig('carriers/notime/widget_editmode_code', Mage::app()->getStore()->getId()), $matches) ;
64
+ if(isset($matches[1])) {
65
+ return trim($matches[1]);
66
+ }
67
+ }
68
+ return '';
69
+ }
70
+
71
+ public function getAdditionalText(){
72
+ return Mage::getStoreConfig('carriers/notime/additional_info', Mage::app()->getStore()->getId());
73
+ }
74
+
75
+ public function getShipmentId() {
76
+
77
+ $this->checkShipmentZipcode();
78
+
79
+ $shipmentId = Mage::getSingleton('core/session')->getNotimeShipmentId();
80
+ return ($shipmentId && $shipmentId != '-') ? $shipmentId : '-';
81
+ }
82
+
83
+ public function getShipmentFee() {
84
+
85
+ $shipmentFee = Mage::getSingleton('core/session')->getNotimeShipmentFee();
86
+ return $shipmentFee ? $shipmentFee : 0;
87
+ }
88
+
89
+ public function getShipmentInfo() {
90
+
91
+ $shipmentInfo = Mage::getSingleton('core/session')->getNotimeShippingInfo();
92
+ return $shipmentInfo ? $shipmentInfo : '';
93
+ }
94
+
95
+ public function getShipmentTimewindowdate() {
96
+
97
+ $shipmentTimewindowdate = Mage::getSingleton('core/session')->getNotimeSelectedTimewindowdate();
98
+ return $shipmentTimewindowdate ? '\''.$shipmentTimewindowdate.'\'' : 'null';
99
+ }
100
+
101
+ public function getShipmentServiceguid() {
102
+
103
+ $shipmentServiceguid = Mage::getSingleton('core/session')->getNotimeSelectedServiceguid();
104
+ return $shipmentServiceguid ? '\''.$shipmentServiceguid.'\'' : 'null';
105
+ }
106
+
107
+ /*
108
+ * get shipment zipcode
109
+ */
110
+ public function checkShipmentZipcode() {
111
+
112
+ $shippingAddress = $this->getQuote()->getShippingAddress();
113
+
114
+ $zip = $shippingAddress->getPostcode();
115
+ $zipNotime = Mage::getSingleton('core/session')->getNotimeShipmentPostcode();
116
+
117
+ if($zip != $zipNotime) {
118
+
119
+ Mage::getSingleton('core/session')->setNotimeShipmentFee(0);
120
+ Mage::getSingleton('core/session')->setNotimeShipmentId('-');
121
+ Mage::getSingleton('core/session')->setNotimeShipmentPostcode('');
122
+ Mage::getSingleton('core/session')->setNotimeShippingInfo('');
123
+ Mage::getSingleton('core/session')->setNotimeSelectedTimewindowdate('');
124
+ Mage::getSingleton('core/session')->setNotimeSelectedServiceguid('');
125
+
126
+ $shippingAddress->setCollectShippingRates(true)->save();
127
+
128
+ }
129
+ }
130
+ }
app/code/local/Notime/Shipping/Model/Observer.php CHANGED
@@ -29,7 +29,6 @@ class Notime_Shipping_Model_Observer
29
  $shipment_id = $shipment_id;
30
  if($shipment_id) {
31
 
32
- // SEND POST REQUEST
33
  // get customer shipping address
34
  $_shippingAddress = $_order->getShippingAddress();
35
  if($_shippingAddress->getId()) {
@@ -51,32 +50,31 @@ class Notime_Shipping_Model_Observer
51
  )
52
  );
53
 
54
- $client = new Varien_Http_Client();
55
-
56
- $client->setUri('https://v1.notimeapi.com/api/shipment/approve')
57
- ->setConfig(array('timeout' => 30, 'keepalive' => 1))
58
- ->setHeaders(array(
59
- 'Ocp-Apim-Subscription-Key' => '493dc25bf9674ccb9c5920a035c1f777',
60
- ))
61
- ->setRawData(json_encode($params), 'application/json')
62
- ->setMethod(Zend_Http_Client::POST);
63
-
64
- $client->setHeaders(array('Content-Type: application/json'));
65
-
66
- $response = $client->request();
67
-
68
- if($response->isSuccessful()){
69
- // update status
70
- $writeConnection->update(
71
- 'notime_shipping',
72
- array('status' => 1),
73
- 'quote_id='.$_order->getQuoteId()
74
- );
75
- $_order->addStatusHistoryComment('Notime->Success: Shipment was approved successfully!')->save();
76
- } else {
77
- Mage::log('ERROR:'.$response->getMessage(),false,'notime-shipping.log');
78
- //$_order->addStatusHistoryComment('Notime->Error: '.$response->getMessage());
79
- }
80
  }
81
  }
82
  } catch (Exception $e) {
@@ -84,7 +82,6 @@ class Notime_Shipping_Model_Observer
84
  }
85
  }
86
  }
87
-
88
  }
89
  }
90
 
@@ -93,19 +90,19 @@ class Notime_Shipping_Model_Observer
93
  *
94
  */
95
  public function notime_shipping_save_shipment_id($event) {
 
96
  if(!Mage::getStoreConfig('carriers/notime/active', Mage::app()->getStore()->getId())) return;
 
97
  $_quote = $event->getQuote();
98
 
99
  $request = Mage::app()->getRequest();
100
  $shipmentId = trim($request->getPost('notime_shipment_id'));
101
- $confirmedTimeWindowDescription = trim($request->getPost('notime_confirmed_time_window_description'));
102
-
103
  if($shipmentId == '') { exit; }
104
 
105
  try {
106
 
107
  $resource = Mage::getSingleton('core/resource');
108
- $readConnection = $resource->getConnection('core_read');
109
  $writeConnection = $resource->getConnection('core_write');
110
 
111
  $writeConnection->delete(
@@ -116,12 +113,15 @@ class Notime_Shipping_Model_Observer
116
  "notime_shipping",
117
  array("quote_id" => $_quote->getId(),"shipment_id" => $shipmentId, "status" => 0)
118
  );
119
- $_quote->setExtShippingInfo($confirmedTimeWindowDescription);
120
  } catch (Exception $e) {
121
  mage::log('Error when processing shipping method:'.$e->getMessage(), false, 'notime_shipping.log');
122
  }
123
  }
124
 
 
 
 
125
  public function notime_shipping_core_block_html_after($observer)
126
  {
127
  if(!Mage::getStoreConfig('carriers/notime/active', Mage::app()->getStore()->getId())) return;
@@ -143,13 +143,6 @@ class Notime_Shipping_Model_Observer
143
  $carrier = Mage::getModel('shipping/config')->getCarrierInstance($code);
144
  $injectBlock = $block->getLayout()->createBlock($carrier->getFormBlock());
145
 
146
- //Store adress id so we can use it in the ajax call done in the block
147
- //$injectBlock->setAddressId($block->getAddress()->getId());
148
- //$injectBlock->setCountryCode($block->getAddress()->getCountryId());
149
- //$injectBlock->setMethodCode($code);
150
- //$injectBlock->setRate($_rate);
151
- //$injectBlock->setMethodInstance($carrier);
152
-
153
  $htmlBefore = substr($html,0,$pos2+strlen($endingToken));
154
  $htmlAfter = substr($html,$pos2);
155
  $observer->getTransport()->setHtml($htmlBefore.$injectBlock->toHtml().$htmlAfter);
@@ -159,44 +152,60 @@ class Notime_Shipping_Model_Observer
159
  }
160
  }
161
  }
162
-
163
- //$this->AddSalesRuleJavascript($observer);
164
  }
165
-
166
- public function notime_shipping_salesQuoteCollectTotalsAfter(Varien_Event_Observer $observer){
167
- $shipmentFee = Mage::app()->getRequest()->getPost('notime_shipment_fee', -1);
 
 
 
 
 
 
168
  if($shipmentFee == -1) {
169
  return $this;
170
  }
171
 
172
- $quoteAddress = $observer->getQuoteAddress();
173
- $quote = $observer->getQuoteAddress()->getQuote();
174
 
175
- $store = Mage::app()->getStore($quote->getStoreId());
 
176
 
177
- $carriers = Mage::getStoreConfig('carriers', $store);
178
- foreach ($carriers as $carrierCode => $carrierConfig) {
179
- if($carrierCode == 'notime') {
180
 
181
- Mage::getSingleton('core/session')->setNotimeShipmentFee($shipmentFee);
182
-
183
- $quoteAddress->setShippingAmount($shipmentFee)
184
- ->setBaseShippingAmount($shipmentFee)->save();
 
 
185
  }
186
  }
187
 
188
  return $this;
189
- }
190
-
191
- public function notime_shipping_salesOrderPlaceAfter(Varien_Event_Observer $observer) {
192
-
193
- Mage::getSingleton('core/session')->unsNotimeShipmentFee();
 
194
 
195
  $_order = $observer->getOrder();
196
- $_quote = Mage::getModel('sales/quote')->load($_order->getQuoteId());
197
- if($_quote->getId()) {
198
- $_order->setShippingDescription($_order->getShippingDescription().' ('.$_quote->getExtShippingInfo().')')->save();
 
 
 
199
  }
200
- }
201
 
 
 
 
 
 
 
 
 
202
  }
29
  $shipment_id = $shipment_id;
30
  if($shipment_id) {
31
 
 
32
  // get customer shipping address
33
  $_shippingAddress = $_order->getShippingAddress();
34
  if($_shippingAddress->getId()) {
50
  )
51
  );
52
 
53
+ $client = new Varien_Http_Client();
54
+
55
+ $client->setUri('https://v1.notimeapi.com/api/shipment/approve')
56
+ ->setConfig(array('timeout' => 30, 'keepalive' => 1))
57
+ ->setHeaders(array(
58
+ 'Ocp-Apim-Subscription-Key' => '493dc25bf9674ccb9c5920a035c1f777',
59
+ ))
60
+ ->setRawData(json_encode($params), 'application/json')
61
+ ->setMethod(Zend_Http_Client::POST);
62
+
63
+ $client->setHeaders(array('Content-Type: application/json'));
64
+
65
+ $response = $client->request();
66
+
67
+ if($response->isSuccessful()){
68
+ // update status
69
+ $writeConnection->update(
70
+ 'notime_shipping',
71
+ array('status' => 1),
72
+ 'quote_id='.$_order->getQuoteId()
73
+ );
74
+ $_order->addStatusHistoryComment('Notime->Success: Shipment was approved successfully!')->save();
75
+ } else {
76
+ Mage::log('ERROR:'.$response->getMessage(),false,'notime-shipping.log');
77
+ }
 
78
  }
79
  }
80
  } catch (Exception $e) {
82
  }
83
  }
84
  }
 
85
  }
86
  }
87
 
90
  *
91
  */
92
  public function notime_shipping_save_shipment_id($event) {
93
+
94
  if(!Mage::getStoreConfig('carriers/notime/active', Mage::app()->getStore()->getId())) return;
95
+
96
  $_quote = $event->getQuote();
97
 
98
  $request = Mage::app()->getRequest();
99
  $shipmentId = trim($request->getPost('notime_shipment_id'));
100
+
 
101
  if($shipmentId == '') { exit; }
102
 
103
  try {
104
 
105
  $resource = Mage::getSingleton('core/resource');
 
106
  $writeConnection = $resource->getConnection('core_write');
107
 
108
  $writeConnection->delete(
113
  "notime_shipping",
114
  array("quote_id" => $_quote->getId(),"shipment_id" => $shipmentId, "status" => 0)
115
  );
116
+
117
  } catch (Exception $e) {
118
  mage::log('Error when processing shipping method:'.$e->getMessage(), false, 'notime_shipping.log');
119
  }
120
  }
121
 
122
+ /**
123
+ * @param $observer
124
+ */
125
  public function notime_shipping_core_block_html_after($observer)
126
  {
127
  if(!Mage::getStoreConfig('carriers/notime/active', Mage::app()->getStore()->getId())) return;
143
  $carrier = Mage::getModel('shipping/config')->getCarrierInstance($code);
144
  $injectBlock = $block->getLayout()->createBlock($carrier->getFormBlock());
145
 
 
 
 
 
 
 
 
146
  $htmlBefore = substr($html,0,$pos2+strlen($endingToken));
147
  $htmlAfter = substr($html,$pos2);
148
  $observer->getTransport()->setHtml($htmlBefore.$injectBlock->toHtml().$htmlAfter);
152
  }
153
  }
154
  }
 
 
155
  }
156
+
157
+ /**
158
+ * Apply Notime shipping fee
159
+ * @param Varien_Event_Observer $observer
160
+ * @return Notime_Shipping_Model_Observer
161
+ */
162
+ public function notime_shipping_salesQuoteCollectTotalsBefore(Varien_Event_Observer $observer){
163
+
164
+ $shipmentFee = Mage::getSingleton('core/session')->getNotimeShipmentFee();
165
  if($shipmentFee == -1) {
166
  return $this;
167
  }
168
 
169
+ $quote = $observer->getQuote();
170
+ $address = $quote->getShippingAddress();
171
 
172
+ if('shipping' == $address->getAddressType()) {
173
+ if('notime_notime' == $address->getShippingMethod()) {
174
 
175
+ $store = Mage::app()->getStore($quote->getStoreId());
 
 
176
 
177
+ $carriers = Mage::getStoreConfig('carriers', $store);
178
+ foreach ($carriers as $carrierCode => $carrierConfig) {
179
+ if($carrierCode == 'notime') {
180
+ $store->setConfig("carriers/notime/price", $shipmentFee);
181
+ }
182
+ }
183
  }
184
  }
185
 
186
  return $this;
187
+ }
188
+
189
+ /**
190
+ * @param Varien_Event_Observer $observer
191
+ */
192
+ public function notime_shipping_salesOrderPlaceAfter(Varien_Event_Observer $observer) {
193
 
194
  $_order = $observer->getOrder();
195
+
196
+ if('notime_notime' == $_order->getShippingMethod()) {
197
+ $_order
198
+ ->setShippingDescription($_order->getShippingDescription().' ('.Mage::getSingleton('core/session')->getNotimeShippingInfo().')')
199
+ ->addStatusHistoryComment('Notime->ShipmentId: '.Mage::getSingleton('core/session')->getNotimeShipmentId())
200
+ ->save();
201
  }
 
202
 
203
+ Mage::getSingleton('core/session')->unsNotimeShipmentFee();
204
+ Mage::getSingleton('core/session')->unsNotimeShippingInfo();
205
+ Mage::getSingleton('core/session')->unsNotimeShipmentId();
206
+ Mage::getSingleton('core/session')->unsNotimeShipmentPostcode();
207
+ Mage::getSingleton('core/session')->unsNotimeSelectedTimewindowdate();
208
+ Mage::getSingleton('core/session')->unsNotimeSelectedServiceguid();
209
+
210
+ }
211
  }
app/code/local/Notime/Shipping/controllers/IndexController.php CHANGED
@@ -1,26 +1,32 @@
1
- <?php
2
-
3
- class Notime_Shipping_IndexController extends Mage_Core_Controller_Front_Action
4
- {
5
- public function indexAction() {
6
- if ($this->getRequest()->isPost()) {
7
- $shipmentFee = $this->getRequest()->getPost('shipping_fee', '');
8
- if($shipmentFee) {
9
-
10
- Mage::getSingleton('core/session')->setNotimeShipmentFee($shipmentFee);
11
-
12
- $_quote = Mage::getModel('checkout/cart')->getQuote();
13
- $address = $_quote->getShippingAddress();
14
-
15
- $address->setShippingAmount($shipmentFee);
16
- $address->setBaseShippingAmount($shipmentFee);
17
-
18
- $address->setCollectShippingRates(true)->save();
19
-
20
- $_quote->collectTotals()->save();
21
- }
22
-
23
- return true;
24
- }
25
- }
26
- }
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Notime_Shipping_IndexController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function indexAction() {
6
+
7
+ if ($this->getRequest()->isPost()) {
8
+
9
+ $shipmentFee = $this->getRequest()->getPost('shipping_fee', 0);
10
+ $shipmentId = $this->getRequest()->getPost('shipping_id', '-');
11
+ $shipmentPostcode = $this->getRequest()->getPost('shipping_postcode', '');
12
+ $shipmentInfo = $this->getRequest()->getPost('shipping_info', '');
13
+
14
+ // widget -> selected window data
15
+ $shipmentTimewindowdate = $this->getRequest()->getPost('shipping_timewindowdate', '');
16
+ $shipmentServiceguid = $this->getRequest()->getPost('shipping_serviceguid', '');
17
+
18
+ Mage::getSingleton('core/session')->setNotimeShipmentFee($shipmentFee);
19
+ Mage::getSingleton('core/session')->setNotimeShipmentId($shipmentId);
20
+ Mage::getSingleton('core/session')->setNotimeShipmentPostcode($shipmentPostcode);
21
+ Mage::getSingleton('core/session')->setNotimeShippingInfo($shipmentInfo);
22
+
23
+ Mage::getSingleton('core/session')->setNotimeSelectedTimewindowdate($shipmentTimewindowdate);
24
+ Mage::getSingleton('core/session')->setNotimeSelectedServiceguid($shipmentServiceguid);
25
+
26
+ $address = Mage::getModel('checkout/cart')->getQuote()->getShippingAddress();
27
+ $address->setCollectShippingRates(true)->save();
28
+
29
+ return true;
30
+ }
31
+ }
32
+ }
app/code/local/Notime/Shipping/etc/config.xml CHANGED
@@ -98,15 +98,15 @@
98
  </notime_core_block_html_before>
99
  </observers>
100
  </core_block_abstract_to_html_after>
101
- <sales_quote_address_collect_totals_after>
102
- <observers>
103
- <notime_order_change_price>
104
- <type>singleton</type>
105
- <class>Notime_Shipping_Model_Observer</class>
106
- <method>notime_shipping_salesQuoteCollectTotalsAfter</method>
107
- </notime_order_change_price>
108
- </observers>
109
- </sales_quote_address_collect_totals_after>
110
  <sales_order_place_after>
111
  <observers>
112
  <notime_order_place_after>
@@ -135,7 +135,7 @@
135
  <active>0</active>
136
  <model>notimeshipping/carrier_notime</model>
137
  <name>Same-day (by notime)</name>
138
- <price>4.90</price>
139
  <title>Same-day (by notime)</title>
140
  <type>O</type>
141
  <shipping_widget></shipping_widget>
98
  </notime_core_block_html_before>
99
  </observers>
100
  </core_block_abstract_to_html_after>
101
+ <sales_quote_collect_totals_before>
102
+ <observers>
103
+ <notime_quote_totals_before>
104
+ <type>singleton</type>
105
+ <class>Notime_Shipping_Model_Observer</class>
106
+ <method>notime_shipping_salesQuoteCollectTotalsBefore</method>
107
+ </notime_quote_totals_before>
108
+ </observers>
109
+ </sales_quote_collect_totals_before>
110
  <sales_order_place_after>
111
  <observers>
112
  <notime_order_place_after>
135
  <active>0</active>
136
  <model>notimeshipping/carrier_notime</model>
137
  <name>Same-day (by notime)</name>
138
+ <price>0.00</price>
139
  <title>Same-day (by notime)</title>
140
  <type>O</type>
141
  <shipping_widget></shipping_widget>
app/design/frontend/base/default/template/notime/checkout/onepage/shipping_method/notime.phtml CHANGED
@@ -1,106 +1,163 @@
1
- <?php
2
- $carrier = $this->getMethodInstance();
3
- $formCode = $this->getFormCode();
4
- $rate_id = 'notime_notime';
5
- $zipInputId = 'gls_zip_input_'.$formCode;
6
- $priceTemplate = Mage::helper('core')->currency(0, true, false); //template of price with currency
7
- $matches = array();
8
- preg_match('/[\.,\,]/', $priceTemplate, $matches);
9
- $priceSeparator = $matches[0];
10
- ?>
11
-
12
- <ul class="form-list" id="<?php echo $formCode ?>">
13
- <li>
14
- <span id="notime_shipment_additional_text"><?php echo $this->getAdditionalText(); ?></span>
15
- </li>
16
- <input type="hidden" id="<?php echo $this->getWidgetZipCode();?>" name="magento_notime_zip_code" value="<?php echo $this->getQuote()->getShippingAddress()->getPostcode();?>">
17
- <input type="hidden" id="notime_shipment_id" name="notime_shipment_id" class="input-text required-notime-shipment" value="-">
18
- <input type="hidden" id="notime_shipment_fee" name="notime_shipment_fee" class="input-text" value="">
19
- <input type="hidden" id="notime_confirmed_time_window_description" name="notime_confirmed_time_window_description" class="input-text" value="">
20
- <div id='notimeWidgetNotSupportedPostcodeContainer'>
21
- <span><?php echo $this->__('Not Supported Postcode'); ?></span>
22
- </div>
23
- <li>
24
- <?php echo $this->getWidgetButton(); ?>
25
- <span id="notime_shipment_success"></span>
26
- </li>
27
- <script type="text/javascript">
28
- // <![CDATA[
29
- function getShippingPriceLabel(){
30
- return $$("label[for='s_method_notime_notime'] span[class='price']")[0];
31
- }
32
-
33
- function updateShippingPriceLabel(fee){
34
- var priceLabel = getShippingPriceLabel();
35
- if (fee !== ''){
36
- var feeStr = fee.toString().replace(/[\.,\,]/g, '<?php echo $priceSeparator; ?>');
37
- var priceStr = '<?php echo $priceTemplate; ?>'.replace(/\d+([\.,\,]\d{1,2})?/gi, feeStr);
38
- priceLabel.update(priceStr);
39
- }
40
- else{
41
- priceLabel.update("");
42
- }
43
- }
44
-
45
- var shipmentGeneratedHandler = function(event) {
46
- var generatedId = event.detail.generatedShippmentGuid;
47
- var shipmentFee = event.detail.fee;
48
- var confirmedTimeWindowDescription = event.detail.selectedTimeWindowDescription;
49
- if(generatedId) {
50
- $('notime_shipment_id').setValue(generatedId);
51
- $('notime_shipment_fee').setValue(shipmentFee);
52
- $('notime_confirmed_time_window_description').setValue(confirmedTimeWindowDescription);
53
- updateShippingPriceLabel(shipmentFee);
54
- var $validationError = $('advice-required-notime-shipment-notime_shipment_id');
55
- if($validationError){
56
- $validationError.hide();
57
- }
58
- $('notime_shipment_success').update('<?php echo $this->__('You have successfully selected time window'); ?>');
59
-
60
- // update totals
61
- var urlNotime = '<?php echo $this->getUrl('notimeshipping/index/index', array('_secure' => true)); ?>';
62
- var parameters = {'shipping_fee': shipmentFee};
63
- new Ajax.Request(urlNotime, {
64
- method:'post',
65
- parameters:parameters,
66
- onSuccess:function(transport) {
67
- if (transport.status == 200) {
68
- $('<?php echo $this->getWidgetZipCode();?>').click();
69
- }
70
- }
71
- });
72
- }
73
- }
74
-
75
- var timeWindowConfirmedHandler = function(event){
76
- $('notime_shipment_id').setValue('-'); //Default value unless shipmentId have generated yet.
77
- $('notime_shipment_success').update('');
78
- }
79
-
80
- document.body.addEventListener("notime_widget:shipmentGenerated",shipmentGeneratedHandler);
81
- document.body.addEventListener("notime_widget:timeWindowConfirmed",timeWindowConfirmedHandler);
82
-
83
- function load_js() {
84
- var head= document.getElementsByTagName('head')[0];
85
- var script= document.createElement('script');
86
- script.type= 'text/javascript';
87
- script.src= '<?php echo $this->getWidgetCodeSrc(); ?>';
88
- head.appendChild(script);
89
- }
90
- load_js();
91
-
92
- document.observe('dom:loaded', function(){
93
- createNotimeShippingForm<?php echo $formCode ?>();
94
- });
95
-
96
- createNotimeShippingForm<?php echo $formCode ?>();
97
-
98
- function createNotimeShippingForm<?php echo $formCode ?>(){
99
- new NotimeShippingForm('<?php echo $rate_id; ?>','<?php echo $formCode; ?>');
100
- }
101
-
102
- Translator.add('Click here and choose your delivery time-slot','<?php echo Mage::helper('notimeshipping')->__('Click here and choose your delivery time-slot')?>');
103
- updateShippingPriceLabel('');
104
- // ]]>
105
- </script>
106
- </ul>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $carrier = $this->getMethodInstance();
3
+ $formCode = $this->getFormCode();
4
+ $rate_id = 'notime_notime';
5
+ $priceTemplate = Mage::helper('core')->currency(0, true, false); //template of price with currency
6
+
7
+ $matches = array();
8
+ preg_match('/[\.,\,]/', $priceTemplate, $matches);
9
+ $priceSeparator = $matches[0];
10
+ ?>
11
+
12
+ <ul class="form-list" id="<?php echo $formCode ?>">
13
+ <li>
14
+ <span id="notime_shipment_additional_text"><?php echo $this->getAdditionalText(); ?></span>
15
+ </li>
16
+ <input type="hidden" id="<?php echo $this->getWidgetZipCode();?>" name="magento_notime_zip_code" value="<?php echo $this->getQuote()->getShippingAddress()->getPostcode();?>">
17
+ <input type="hidden" id="notime_shipment_id" name="notime_shipment_id" class="input-text required-notime-shipment required-notime-shipment-notsupported" value="<?php echo $this->getShipmentId(); ?>">
18
+ <input type="hidden" id="notime_shipment_fee" name="notime_shipment_fee" class="input-text" value="<?php echo $this->getShipmentFee(); ?>">
19
+ <input type="hidden" id="notime_confirmed_time_window_description" name="notime_confirmed_time_window_description" class="input-text" value="<?php echo $this->getShipmentInfo(); ?>">
20
+
21
+ <div id='notimeWidgetNotSupportedPostcodeContainer'>
22
+ <span><?php echo $this->__('Not Supported Postcode'); ?></span>
23
+ </div>
24
+ <li>
25
+ <?php echo $this->getWidgetButton(); ?>
26
+ <span id="notime_shipment_success"></span>
27
+ </li>
28
+ <script type="text/javascript">
29
+
30
+ // <![CDATA[
31
+ function getShippingPriceLabel(){
32
+ return $$("label[for='s_method_notime_notime'] span[class='price']")[0];
33
+ }
34
+
35
+ function updateShippingPriceLabel(fee){
36
+ var priceLabel = getShippingPriceLabel();
37
+ if (fee !== '' && fee != 0){
38
+ var feeStr = fee.toString().replace(/[\.,\,]/g, '<?php echo $priceSeparator; ?>');
39
+ var priceStr = '<?php echo $priceTemplate; ?>'.replace(/\d+([\.,\,]\d{1,2})?/gi, feeStr);
40
+ priceLabel.update(priceStr);
41
+ }
42
+ else{
43
+ priceLabel.update('');
44
+ }
45
+ }
46
+
47
+ function updateShippingSuccessMessage() {
48
+ var shipmentId = $('notime_shipment_id').getValue();
49
+ var shipmentFee = $('notime_shipment_fee').getValue();
50
+
51
+ updateShippingPriceLabel(shipmentFee);
52
+
53
+ if(shipmentId == '' || shipmentId == '-') {
54
+ $('notime_shipment_success').update('');
55
+ } else {
56
+ $('notime_shipment_success').update('<?php echo $this->__('You have successfully selected time window'); ?>');
57
+ }
58
+ }
59
+
60
+ var shipmentGeneratedHandler = function(event) {
61
+
62
+ var shipmentPostcode = $('<?php echo $this->getWidgetZipCode();?>').getValue();
63
+
64
+ var generatedId = event.detail.generatedShippmentGuid;
65
+ var shipmentFee = event.detail.fee;
66
+ var selectedTimeWindowDate = event.detail.selectedTimeWindowDate;
67
+ var selectedServiceGuid = event.detail.selectedServiceGuid;
68
+
69
+ if(generatedId) {
70
+ $('notime_shipment_id').setValue(generatedId);
71
+ $('notime_shipment_fee').setValue(shipmentFee);
72
+
73
+ var $validationError = $('advice-required-notime-shipment-notime_shipment_id');
74
+ if($validationError){
75
+ $validationError.hide();
76
+ }
77
+
78
+ updateShippingSuccessMessage();
79
+
80
+ // update totals
81
+ var urlNotime = '<?php echo $this->getUrl('notimeshipping/index/index', array('_secure' => true)); ?>';
82
+ var parameters = {
83
+ 'shipping_fee': shipmentFee,
84
+ 'shipping_id': generatedId,
85
+ 'shipping_postcode': shipmentPostcode,
86
+ 'shipping_info': $('notime_confirmed_time_window_description').getValue(),
87
+ 'shipping_timewindowdate': selectedTimeWindowDate,
88
+ 'shipping_serviceguid': selectedServiceGuid
89
+ };
90
+
91
+ new Ajax.Request(urlNotime, {
92
+ method:'post',
93
+ parameters:parameters,
94
+ onSuccess:function(transport) {
95
+ if (transport.status == 200) {
96
+ $('<?php echo $this->getWidgetZipCode();?>').click();
97
+ }
98
+ }
99
+ });
100
+ }
101
+ }
102
+
103
+ var timeWindowConfirmedHandler = function(event){
104
+
105
+ //Default value unless shipmentId have generated yet.
106
+ $('notime_shipment_id').setValue('-');
107
+ $('notime_shipment_fee').setValue(0);
108
+ $('notime_shipment_success').update('');
109
+
110
+ var confirmedTimeWindowDescription = event.detail.selectedTimeWindowDescription;
111
+ $('notime_confirmed_time_window_description').setValue(confirmedTimeWindowDescription);
112
+
113
+ }
114
+
115
+ document.body.addEventListener("notime_widget:shipmentGenerated",shipmentGeneratedHandler);
116
+ document.body.addEventListener("notime_widget:timeWindowConfirmed",timeWindowConfirmedHandler);
117
+
118
+ function setSelectedService() {
119
+ window.Notime.Widget.setSelectedService(<?php echo $this->getShipmentServiceguid();?>, <?php echo $this->getShipmentTimewindowdate();?>);
120
+ }
121
+
122
+ function load_js() {
123
+ var head= document.getElementsByTagName('head')[0];
124
+ var script= document.createElement('script');
125
+ script.type= 'text/javascript';
126
+ script.src= '<?php echo $this->getWidgetCodeSrc(); ?>';
127
+
128
+ if (script.readyState) {
129
+ script.onreadystatechange = function () { // For old versions of IE
130
+ if (this.script === 'complete' || this.script === 'loaded') {
131
+ setSelectedService();
132
+ }
133
+ };
134
+ } else { // Other browsers
135
+ script.onload = setSelectedService;
136
+ }
137
+
138
+ head.appendChild(script);
139
+
140
+ }
141
+ load_js();
142
+
143
+ document.observe('dom:loaded', function(){
144
+
145
+ createNotimeShippingForm<?php echo $formCode ?>();
146
+ });
147
+
148
+ function createNotimeShippingForm<?php echo $formCode ?>(){
149
+ new NotimeShippingForm('<?php echo $rate_id; ?>','<?php echo $formCode; ?>');
150
+ }
151
+
152
+ new NotimeShippingForm('<?php echo $rate_id; ?>','<?php echo $formCode; ?>');
153
+
154
+ updateShippingSuccessMessage();
155
+
156
+ $('<?php echo $this->getWidgetZipCode();?>').click();
157
+
158
+ Translator.add('Click here and choose your delivery time-slot','<?php echo Mage::helper('notimeshipping')->__('Click here and choose your delivery time-slot')?>');
159
+ Translator.add('Please choose another postcode or another delivery method','<?php echo Mage::helper('notimeshipping')->__('Please choose another postcode or another delivery method')?>');
160
+
161
+ // ]]>
162
+ </script>
163
+ </ul>
app/locale/de_DE/Notime_Shipping.csv CHANGED
@@ -1,8 +1,9 @@
1
- "Click here and choose your delivery time-slot","Klicken Sie hier und wahlen Sie Ihr Lieferzeit-Fenster aus"
2
  "You have successfully selected time window","Ihre Auswahl wurde erfoglreich in unser System erfasst"
3
  "Notime Widget Button (edit mode)","Notime Widget Button (edit mode)"
4
  "Notime Widget Code (edit mode)","Notime Widget Code (edit mode)"
5
  "Notime Widget Button (view mode)","Notime Widget Button (view mode)"
6
  "Notime Widget Code (view mode)","Notime Widget Code (view mode)"
7
  "Notime Widget at a Product Page","Notime Widget at a Product Page"
8
- "Not Supported Postcode","Diese Dienstleistung gibts fur Ihre PLZ noch nicht."
 
1
+ "Click here and choose your delivery time-slot","Klicken Sie hier und wählen Sie Ihr Lieferzeit-Fenster aus"
2
  "You have successfully selected time window","Ihre Auswahl wurde erfoglreich in unser System erfasst"
3
  "Notime Widget Button (edit mode)","Notime Widget Button (edit mode)"
4
  "Notime Widget Code (edit mode)","Notime Widget Code (edit mode)"
5
  "Notime Widget Button (view mode)","Notime Widget Button (view mode)"
6
  "Notime Widget Code (view mode)","Notime Widget Code (view mode)"
7
  "Notime Widget at a Product Page","Notime Widget at a Product Page"
8
+ "Not Supported Postcode","Diese Dienstleistung gibts für Ihre PLZ noch nicht."
9
+ "Please choose another postcode or another delivery method","Bitte wählen Sie eine andere PLZ oder eine andere Versandart aus."
app/locale/en_US/Notime_Shipping.csv CHANGED
@@ -1,8 +1,9 @@
1
- "Click here and choose your delivery time-slot","Click here and choose your delivery time-slot"
2
- "You have successfully selected time window","You have successfully selected a time window for your delivery"
3
- "Notime Widget Button (edit mode)","Notime Widget Button (edit mode)"
4
- "Notime Widget Code (edit mode)","Notime Widget Code (edit mode)"
5
- "Notime Widget Button (view mode)","Notime Widget Button (view mode)"
6
- "Notime Widget Code (view mode)","Notime Widget Code (view mode)"
7
- "Notime Widget at a Product Page","Notime Widget at a Product Page"
8
- "Not Supported Postcode","This service is not yet available for your postcode."
 
1
+ "Click here and choose your delivery time-slot","Click here and choose your delivery time-slot"
2
+ "You have successfully selected time window","You have successfully selected a time window for your delivery"
3
+ "Notime Widget Button (edit mode)","Notime Widget Button (edit mode)"
4
+ "Notime Widget Code (edit mode)","Notime Widget Code (edit mode)"
5
+ "Notime Widget Button (view mode)","Notime Widget Button (view mode)"
6
+ "Notime Widget Code (view mode)","Notime Widget Code (view mode)"
7
+ "Notime Widget at a Product Page","Notime Widget at a Product Page"
8
+ "Not Supported Postcode","This service is not yet available for your postcode."
9
+ "Please choose another postcode or another delivery method","Please choose another postcode or another delivery method."
app/locale/fr_FR/Notime_Shipping.csv CHANGED
@@ -1,8 +1,9 @@
1
- "Click here and choose your delivery time-slot","Click here and choose your delivery time-slot"
2
- "You have successfully selected time window","You have successfully selected a time window for your delivery"
3
- "Notime Widget Button (edit mode)","Notime Widget Button (edit mode)"
4
- "Notime Widget Code (edit mode)","Notime Widget Code (edit mode)"
5
- "Notime Widget Button (view mode)","Notime Widget Button (view mode)"
6
- "Notime Widget Code (view mode)","Notime Widget Code (view mode)"
7
- "Notime Widget at a Product Page","Notime Widget at a Product Page"
8
- "Not Supported Postcode","Ce service est pas encore disponible pour votre code postal."
 
1
+ "Click here and choose your delivery time-slot","Click here and choose your delivery time-slot"
2
+ "You have successfully selected time window","You have successfully selected a time window for your delivery"
3
+ "Notime Widget Button (edit mode)","Notime Widget Button (edit mode)"
4
+ "Notime Widget Code (edit mode)","Notime Widget Code (edit mode)"
5
+ "Notime Widget Button (view mode)","Notime Widget Button (view mode)"
6
+ "Notime Widget Code (view mode)","Notime Widget Code (view mode)"
7
+ "Notime Widget at a Product Page","Notime Widget at a Product Page"
8
+ "Not Supported Postcode","Ce service est pas encore disponible pour votre code postal."
9
+ "Please choose another postcode or another delivery method","Choisissez un autre code postale ou un autre mode d'expedition."
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>notime_same_day_delivery</name>
4
- <version>1.2.0</version>
5
  <stability>stable</stability>
6
  <license uri="https://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -12,11 +12,11 @@ notime same-day shipping is provided by notime AG based in Z&#xFC;rich Switzerla
12
  With this new shipping method customers can view and pick from the available delivery time-slots. &#xD;
13
  The popup can be placed either in the preview section, next to the product, and/or in the checkout page.&#xD;
14
  The merchant can configure this shipping method in the "Shipping methods" area and "Product Information" area.</description>
15
- <notes>Problems with shipping price recalculation in case one step checkout were fixed.</notes>
16
  <authors><author><name>notime</name><user>notime</user><email>dmitry.zhersh@notime.eu</email></author></authors>
17
- <date>2017-03-30</date>
18
- <time>20:49:44</time>
19
- <contents><target name="magelocal"><dir name="Notime"><dir name="Shipping"><dir name="Block"><dir name="Checkout"><dir name="Onepage"><dir name="Shipping"><file name="Notime.php" hash="f16e5aa4ff3a9c8dd2111c445c8e8744"/></dir></dir></dir><dir name="Product"><file name="Widget.php" hash="e72292e3c7e8aed1909f4584fd1ea037"/></dir><file name="ShippingMethod.php" hash="b7cd80898a2a06821e6104a35b90b61e"/></dir><dir name="Helper"><file name="Data.php" hash="42686d5dffb62fdfc799d4a052daa968"/></dir><dir name="Model"><dir name="Carrier"><file name="Notime.php" hash="242500b090ad04d6eba1487ec7dc987b"/></dir><file name="Observer.php" hash="ed1e32767160edff794fe7d57e345e4a"/></dir><dir name="controllers"><file name="IndexController.php" hash="468036e131346e8655d5faa099585631"/></dir><dir name="etc"><file name="config.xml" hash="b91f5abce7a9af96848a5a5824a17504"/><file name="system.xml" hash="f124b1bda52f8da0a305c2a6170bddca"/></dir><dir name="sql"><dir name="notimeshipping_setup"><file name="mysql4-install-1.0.0.php" hash="7647e9d736ac1199cb7732358b539be6"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="e15b6ad29a30175b3afca7280d1162ce"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="notime.xml" hash="3c16298a844be38a8a6d2a7ee615d6b9"/></dir><dir name="template"><dir name="notime"><dir name="checkout"><dir name="onepage"><dir name="shipping_method"><file name="notime.phtml" hash="828b45ed839f03c119d589faea4f3ef8"/></dir></dir></dir><dir name="product"><file name="widget.phtml" hash="23da2d2a03f095b8fe467c9c5c6b3c96"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Notime_Shipping.xml" hash="f5de879b88f342a03e16c4d655867b21"/></dir></target><target name="magelocale"><dir><dir name="de_DE"><file name="Notime_Shipping.csv" hash="2e29f39df813d21c450c30e2a360844b"/></dir><dir name="en_US"><file name="Notime_Shipping.csv" hash="04348e009ae0215e958926b45817257c"/></dir><dir name="fr_FR"><file name="Notime_Shipping.csv" hash="ef3db48b18b2b4fc6159c9c450ff5e57"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="notime.css" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><dir name="js"><file name="notime.js" hash="7678c5eebe3ccd258d1a1fcac13bdaa5"/></dir></dir></dir></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.4.0</min><max>7.0.4</max></php></required></dependencies>
22
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>notime_same_day_delivery</name>
4
+ <version>1.2.3</version>
5
  <stability>stable</stability>
6
  <license uri="https://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
12
  With this new shipping method customers can view and pick from the available delivery time-slots. &#xD;
13
  The popup can be placed either in the preview section, next to the product, and/or in the checkout page.&#xD;
14
  The merchant can configure this shipping method in the "Shipping methods" area and "Product Information" area.</description>
15
+ <notes>Resolved problems with calculation taxable shipping price.</notes>
16
  <authors><author><name>notime</name><user>notime</user><email>dmitry.zhersh@notime.eu</email></author></authors>
17
+ <date>2017-04-13</date>
18
+ <time>13:39:01</time>
19
+ <contents><target name="magelocal"><dir name="Notime"><dir name="Shipping"><dir name="Block"><dir name="Checkout"><dir name="Onepage"><dir name="Shipping"><file name="Notime.php" hash="b3c81ff441682a56e23ba89c856533db"/></dir></dir></dir><dir name="Product"><file name="Widget.php" hash="e72292e3c7e8aed1909f4584fd1ea037"/></dir><file name="ShippingMethod.php" hash="b7cd80898a2a06821e6104a35b90b61e"/></dir><dir name="Helper"><file name="Data.php" hash="42686d5dffb62fdfc799d4a052daa968"/></dir><dir name="Model"><dir name="Carrier"><file name="Notime.php" hash="242500b090ad04d6eba1487ec7dc987b"/></dir><file name="Observer.php" hash="ff90c23dc2ad6d33a8de7ac29cb3e87d"/></dir><dir name="controllers"><file name="IndexController.php" hash="be50975eda060f063cf34307cb958012"/></dir><dir name="etc"><file name="config.xml" hash="a87f8bfc1ac9e811ca8432d14e931964"/><file name="system.xml" hash="f124b1bda52f8da0a305c2a6170bddca"/></dir><dir name="sql"><dir name="notimeshipping_setup"><file name="mysql4-install-1.0.0.php" hash="7647e9d736ac1199cb7732358b539be6"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="e15b6ad29a30175b3afca7280d1162ce"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="notime.xml" hash="3c16298a844be38a8a6d2a7ee615d6b9"/></dir><dir name="template"><dir name="notime"><dir name="checkout"><dir name="onepage"><dir name="shipping_method"><file name="notime.phtml" hash="5bb34677232ce20f542a392ad0a1cc2f"/></dir></dir></dir><dir name="product"><file name="widget.phtml" hash="23da2d2a03f095b8fe467c9c5c6b3c96"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Notime_Shipping.xml" hash="f5de879b88f342a03e16c4d655867b21"/></dir></target><target name="magelocale"><dir><dir name="de_DE"><file name="Notime_Shipping.csv" hash="ff7779a3e027ef6ba1cecf517e3f03a2"/></dir><dir name="en_US"><file name="Notime_Shipping.csv" hash="76ab542daf7efd4973f8707f57ebb1b0"/></dir><dir name="fr_FR"><file name="Notime_Shipping.csv" hash="ab3eff49d5e197b4be6562238534c54e"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="notime.css" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><dir name="js"><file name="notime.js" hash="d9746648a959ae7e37dd66465da75b72"/></dir></dir></dir></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.4.0</min><max>7.0.4</max></php></required></dependencies>
22
  </package>
skin/frontend/base/default/js/notime.js CHANGED
@@ -1,57 +1,70 @@
1
- var NotimeShippingForm = Class.create();
2
- NotimeShippingForm.prototype = {
3
- initialize: function (rate_id,formElementId) {
4
- this.rate_id = rate_id;
5
- this.formElement = $(formElementId);
6
- this._addEventListeners();
7
- this._addValidation();
8
- this._toggleForm();
9
- },
10
- _addEventListeners: function () {
11
- var self = this;
12
- $$('input[name="shipping_method"]').each(
13
- function(sel){
14
-
15
- if (window.addEventListener) {
16
- // Check for addEventListener first, since IE9/10 have both,
17
- // but you should use the standard over the deprecated IE-specific one
18
- sel.addEventListener('click', function() {
19
- self._toggleForm();
20
- });
21
- } else if (window.attachEvent) {
22
- sel.attachEvent('onclick', function() {
23
- self._toggleForm();
24
- });
25
- } else {
26
- Event.observe(sel, 'click', function() {
27
- self._toggleForm();
28
- });
29
- }
30
- }
31
- );
32
- },
33
- _toggleForm: function(){
34
- var selectedShippingMethodCode = $$('input[name="shipping_method"]:checked');
35
-
36
- //alert(selectedShippingMethodCode.pluck('value'));
37
-
38
- if(this.rate_id == selectedShippingMethodCode.pluck('value')){
39
- this.formElement.show();
40
- }else{
41
- this.formElement.hide();
42
- }
43
- },
44
- _addValidation: function(){
45
- var self = this;
46
- Validation.add('required-notime-shipment',Translator.translate('Click here and choose your delivery time-slot'),function(value){
47
- if(value != '' && value != '-')
48
- {
49
- return true;
50
- }
51
- return false;
52
- });
53
- },
54
- _validate: function(){
55
-
56
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  };
1
+ var NotimeShippingForm = Class.create();
2
+ NotimeShippingForm.prototype = {
3
+ initialize: function (rate_id,formElementId) {
4
+ this.rate_id = rate_id;
5
+ this.formElement = $(formElementId);
6
+ this._addEventListeners();
7
+ this._addValidation();
8
+ this._toggleForm();
9
+ },
10
+ _addEventListeners: function () {
11
+ var self = this;
12
+ $$('input[name="shipping_method"]').each(
13
+ function(sel){
14
+
15
+ if (window.addEventListener) {
16
+ // Check for addEventListener first, since IE9/10 have both,
17
+ // but you should use the standard over the deprecated IE-specific one
18
+ sel.addEventListener('click', function() {
19
+ self._toggleForm();
20
+ });
21
+ } else if (window.attachEvent) {
22
+ sel.attachEvent('onclick', function() {
23
+ self._toggleForm();
24
+ });
25
+ } else {
26
+ Event.observe(sel, 'click', function() {
27
+ self._toggleForm();
28
+ });
29
+ }
30
+ }
31
+ );
32
+ },
33
+ _toggleForm: function(){
34
+ var selectedShippingMethodCode = $$('input[name="shipping_method"]:checked');
35
+
36
+ //alert(selectedShippingMethodCode.pluck('value'));
37
+
38
+ if(this.rate_id == selectedShippingMethodCode.pluck('value')){
39
+ this.formElement.show();
40
+ }else{
41
+ this.formElement.hide();
42
+ }
43
+ },
44
+ _addValidation: function(){
45
+ var self = this;
46
+
47
+ Validation.add('required-notime-shipment',Translator.translate('Click here and choose your delivery time-slot'),function(value){
48
+ var $notimeWidgetNotSupportedPostcodeContainer = $('notimeWidgetNotSupportedPostcodeContainer');
49
+ if((value != '' && value != '-') || $notimeWidgetNotSupportedPostcodeContainer.visible())
50
+ {
51
+ return true;
52
+ }
53
+ return false;
54
+ });
55
+
56
+
57
+ Validation.add('required-notime-shipment-notsupported',Translator.translate('Please choose another postcode or another delivery method'),function(value){
58
+ var $notimeWidgetNotSupportedPostcodeContainer = $('notimeWidgetNotSupportedPostcodeContainer');
59
+ if((value == '' || value == '-') && $notimeWidgetNotSupportedPostcodeContainer.visible())
60
+ {
61
+ return false;
62
+ }
63
+ return true;
64
+ });
65
+
66
+ },
67
+ _validate: function(){
68
+
69
+ }
70
  };