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 +130 -84
- app/code/local/Notime/Shipping/Model/Observer.php +72 -63
- app/code/local/Notime/Shipping/controllers/IndexController.php +32 -26
- app/code/local/Notime/Shipping/etc/config.xml +10 -10
- app/design/frontend/base/default/template/notime/checkout/onepage/shipping_method/notime.phtml +163 -106
- app/locale/de_DE/Notime_Shipping.csv +3 -2
- app/locale/en_US/Notime_Shipping.csv +9 -8
- app/locale/fr_FR/Notime_Shipping.csv +9 -8
- package.xml +5 -5
- skin/frontend/base/default/js/notime.js +69 -56
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 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
*
|
34 |
-
|
35 |
-
|
36 |
-
{
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
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 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
}
|
80 |
}
|
81 |
}
|
82 |
} 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 |
-
|
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 |
-
|
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 |
-
|
167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
if($shipmentFee == -1) {
|
169 |
return $this;
|
170 |
}
|
171 |
|
172 |
-
$
|
173 |
-
$
|
174 |
|
175 |
-
|
|
|
176 |
|
177 |
-
|
178 |
-
foreach ($carriers as $carrierCode => $carrierConfig) {
|
179 |
-
if($carrierCode == 'notime') {
|
180 |
|
181 |
-
Mage::
|
182 |
-
|
183 |
-
|
184 |
-
|
|
|
|
|
185 |
}
|
186 |
}
|
187 |
|
188 |
return $this;
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
|
|
194 |
|
195 |
$_order = $observer->getOrder();
|
196 |
-
|
197 |
-
if($
|
198 |
-
$_order
|
|
|
|
|
|
|
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 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
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 |
-
<
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
</
|
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>
|
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 |
-
$
|
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" value="
|
18 |
-
<input type="hidden" id="notime_shipment_fee" name="notime_shipment_fee" class="input-text" value="">
|
19 |
-
|
20 |
-
|
21 |
-
<
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
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
|
|
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.
|
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ürich Switzerla
|
|
12 |
With this new shipping method customers can view and pick from the available delivery time-slots. 
|
13 |
The popup can be placed either in the preview section, next to the product, and/or in the checkout page.
|
14 |
The merchant can configure this shipping method in the "Shipping methods" area and "Product Information" area.</description>
|
15 |
-
<notes>
|
16 |
<authors><author><name>notime</name><user>notime</user><email>dmitry.zhersh@notime.eu</email></author></authors>
|
17 |
-
<date>2017-
|
18 |
-
<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="
|
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. 
|
13 |
The popup can be placed either in the preview section, next to the product, and/or in the checkout page.
|
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 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
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 |
};
|