Version Notes
+ Compatibility with TM FireCheckout
Download this release
Release Info
Developer | Fermo!Point |
Extension | fermopoint |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.4 to 1.2.0
- app/code/community/FermoPoint/StorePickup/Block/Checkout/Onepage/Shipping/Method/Available.php +20 -1
- app/code/community/FermoPoint/StorePickup/Block/FireCheckout/Billing/Js.php +11 -0
- app/code/community/FermoPoint/StorePickup/Block/FireCheckout/Billing/Radio.php +11 -0
- app/code/community/FermoPoint/StorePickup/Block/Map.php +27 -5
- app/code/community/FermoPoint/StorePickup/Helper/Data.php +19 -0
- app/code/community/FermoPoint/StorePickup/Model/Observer.php +75 -11
- app/code/community/FermoPoint/StorePickup/etc/config.xml +17 -1
- app/design/frontend/base/default/layout/fpstorepickup.xml +12 -4
- app/design/frontend/base/default/template/fpstorepickup/checkout/onepage/billing/radio.phtml +0 -1
- app/design/frontend/base/default/template/fpstorepickup/firecheckout/onepage/billing/js.phtml +30 -0
- app/design/frontend/base/default/template/fpstorepickup/firecheckout/onepage/billing/radio.phtml +4 -0
- app/design/frontend/base/default/template/fpstorepickup/map.phtml +15 -2
- js/fermopoint/firecheckout.js +25 -0
- js/fermopoint/storepickup.js +372 -350
- package.xml +5 -5
- skin/frontend/base/default/fermopoint/css/storepickup.css +7 -1
app/code/community/FermoPoint/StorePickup/Block/Checkout/Onepage/Shipping/Method/Available.php
CHANGED
@@ -36,8 +36,27 @@ class FermoPoint_StorePickup_Block_Checkout_Onepage_Shipping_Method_Available ex
|
|
36 |
|
37 |
protected function _afterToHtml($html)
|
38 |
{
|
39 |
-
if ($this->_storePickupAvailable)
|
40 |
$html .= $this->getLayout()->createBlock('fpstorepickup/map')->toHtml();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
return $html;
|
43 |
}
|
36 |
|
37 |
protected function _afterToHtml($html)
|
38 |
{
|
39 |
+
if ($this->_storePickupAvailable && ! Mage::helper('fpstorepickup')->getIsOneStepCheckout())
|
40 |
$html .= $this->getLayout()->createBlock('fpstorepickup/map')->toHtml();
|
41 |
+
elseif (Mage::helper('fpstorepickup')->getIsOneStepCheckout())
|
42 |
+
{
|
43 |
+
$flag = Mage::helper('core')->jsonEncode($this->_storePickupAvailable);
|
44 |
+
$html .= <<<JS
|
45 |
+
<script type="text/javascript">
|
46 |
+
(function () {
|
47 |
+
var flag = {$flag},
|
48 |
+
container = $('fermopoint_outer');
|
49 |
+
if ( ! container)
|
50 |
+
return;
|
51 |
+
if (flag)
|
52 |
+
container.show();
|
53 |
+
else
|
54 |
+
container.hide();
|
55 |
+
})();
|
56 |
+
</script>
|
57 |
+
JS
|
58 |
+
;
|
59 |
+
}
|
60 |
|
61 |
return $html;
|
62 |
}
|
app/code/community/FermoPoint/StorePickup/Block/FireCheckout/Billing/Js.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class FermoPoint_StorePickup_Block_FireCheckout_Billing_Js extends Mage_Core_Block_Template {
|
4 |
+
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setTemplate('fpstorepickup/firecheckout/onepage/billing/js.phtml');
|
9 |
+
}
|
10 |
+
|
11 |
+
}
|
app/code/community/FermoPoint/StorePickup/Block/FireCheckout/Billing/Radio.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class FermoPoint_StorePickup_Block_FireCheckout_Billing_Radio extends Mage_Core_Block_Template {
|
4 |
+
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setTemplate('fpstorepickup/firecheckout/onepage/billing/radio.phtml');
|
9 |
+
}
|
10 |
+
|
11 |
+
}
|
app/code/community/FermoPoint/StorePickup/Block/Map.php
CHANGED
@@ -2,6 +2,8 @@
|
|
2 |
|
3 |
class FermoPoint_StorePickup_Block_Map extends Mage_Core_Block_Template
|
4 |
{
|
|
|
|
|
5 |
|
6 |
public function __construct()
|
7 |
{
|
@@ -10,6 +12,17 @@ class FermoPoint_StorePickup_Block_Map extends Mage_Core_Block_Template
|
|
10 |
$this->setTemplate('fpstorepickup/map.phtml');
|
11 |
}
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
public function getTosUrl()
|
14 |
{
|
15 |
return Mage::helper('fpstorepickup/config')->getTosUrl();
|
@@ -32,12 +45,21 @@ class FermoPoint_StorePickup_Block_Map extends Mage_Core_Block_Template
|
|
32 |
{
|
33 |
$address = Mage::getSingleton('checkout/session')->getQuote()->getBillingAddress();
|
34 |
$street = $address->getStreet();
|
35 |
-
$
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
return implode(' ', $parts);
|
42 |
}
|
43 |
|
2 |
|
3 |
class FermoPoint_StorePickup_Block_Map extends Mage_Core_Block_Template
|
4 |
{
|
5 |
+
|
6 |
+
protected $_initiallyHidden = false;
|
7 |
|
8 |
public function __construct()
|
9 |
{
|
12 |
$this->setTemplate('fpstorepickup/map.phtml');
|
13 |
}
|
14 |
|
15 |
+
public function getInitiallyHidden()
|
16 |
+
{
|
17 |
+
return $this->_initiallyHidden;
|
18 |
+
}
|
19 |
+
|
20 |
+
public function setInitiallyHidden($flag)
|
21 |
+
{
|
22 |
+
$this->_initiallyHidden = $flag;
|
23 |
+
return $this;
|
24 |
+
}
|
25 |
+
|
26 |
public function getTosUrl()
|
27 |
{
|
28 |
return Mage::helper('fpstorepickup/config')->getTosUrl();
|
45 |
{
|
46 |
$address = Mage::getSingleton('checkout/session')->getQuote()->getBillingAddress();
|
47 |
$street = $address->getStreet();
|
48 |
+
$street = is_array($street) ? implode(', ', $street) : $street;
|
49 |
+
$parts = array();
|
50 |
+
if ( ! empty($street))
|
51 |
+
{
|
52 |
+
$street .= ',';
|
53 |
+
$parts[] = $street;
|
54 |
+
}
|
55 |
|
56 |
+
$postcode = $address->getPostcode();
|
57 |
+
if ( ! empty($postcode))
|
58 |
+
$parts[] = $postcode;
|
59 |
+
|
60 |
+
$city = $address->getCity();
|
61 |
+
if ( ! empty($city))
|
62 |
+
$parts[] = $city;
|
63 |
return implode(' ', $parts);
|
64 |
}
|
65 |
|
app/code/community/FermoPoint/StorePickup/Helper/Data.php
CHANGED
@@ -5,6 +5,25 @@ class FermoPoint_StorePickup_Helper_Data extends Mage_Core_Helper_Abstract
|
|
5 |
|
6 |
const SESSION_KEY = 'fermopoint_storepickup';
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
protected function _getSessionData($key, $default = null)
|
9 |
{
|
10 |
$session = Mage::getSingleton('checkout/session');
|
5 |
|
6 |
const SESSION_KEY = 'fermopoint_storepickup';
|
7 |
|
8 |
+
protected $_isOneStepCheckout;
|
9 |
+
|
10 |
+
public function getIsOneStepCheckout()
|
11 |
+
{
|
12 |
+
if ($this->_isOneStepCheckout === null)
|
13 |
+
{
|
14 |
+
$this->_isOneStepCheckout = false;
|
15 |
+
if ('true' == (string)Mage::getConfig()->getNode('modules/NCR_ProductLists/active'))
|
16 |
+
{
|
17 |
+
$helper = Mage::helper('firecheckout');
|
18 |
+
if ($helper !== false)
|
19 |
+
{
|
20 |
+
$this->_isOneStepCheckout = $helper->canFireCheckout();
|
21 |
+
}
|
22 |
+
}
|
23 |
+
}
|
24 |
+
return $this->_isOneStepCheckout;
|
25 |
+
}
|
26 |
+
|
27 |
protected function _getSessionData($key, $default = null)
|
28 |
{
|
29 |
$session = Mage::getSingleton('checkout/session');
|
app/code/community/FermoPoint/StorePickup/Model/Observer.php
CHANGED
@@ -19,11 +19,41 @@ class FermoPoint_StorePickup_Model_Observer
|
|
19 |
$controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
|
20 |
}
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
|
|
|
|
|
|
|
|
23 |
|
24 |
public function onSaveShippingMethodBefore($observer)
|
25 |
{
|
26 |
$controller = $observer->getEvent()->getControllerAction();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
$request = $controller->getRequest();
|
28 |
if ( ! $request->isPost())
|
29 |
return;
|
@@ -34,7 +64,7 @@ class FermoPoint_StorePickup_Model_Observer
|
|
34 |
$pointId = $request->getPost('fermopoint_point_id', 0);
|
35 |
$point = Mage::getModel('fpstorepickup/point')->load($pointId);
|
36 |
if ( ! $point->getId())
|
37 |
-
return
|
38 |
|
39 |
$accountType = $request->getPost('fermopoint_account', 'new');
|
40 |
$config = Mage::helper('fpstorepickup/config');
|
@@ -53,15 +83,15 @@ class FermoPoint_StorePickup_Model_Observer
|
|
53 |
$isGuest = false;
|
54 |
$nickname = trim($request->getPost('fermopoint_nickname', ''));
|
55 |
if (empty($nickname))
|
56 |
-
return
|
57 |
|
58 |
$dob = trim($request->getPost('fermopoint_dob', ''));
|
59 |
if (empty($dob))
|
60 |
-
return
|
61 |
|
62 |
$dob = Mage::helper('fpstorepickup')->convertDate($dob);
|
63 |
if (empty($dob))
|
64 |
-
return
|
65 |
|
66 |
$request->setPost('fermopoint_dob', $dob);
|
67 |
}
|
@@ -73,12 +103,12 @@ class FermoPoint_StorePickup_Model_Observer
|
|
73 |
if ($isGuest)
|
74 |
{
|
75 |
if ( ! $api->isGuestNicknameAndDobMatch($nickname, $dob))
|
76 |
-
return
|
77 |
}
|
78 |
else
|
79 |
{
|
80 |
if ( ! $api->isNicknameAndDobMatch($nickname, $dob))
|
81 |
-
return
|
82 |
}
|
83 |
break;
|
84 |
|
@@ -86,15 +116,15 @@ class FermoPoint_StorePickup_Model_Observer
|
|
86 |
default:
|
87 |
$email = $this->getQuote()->getCustomerEmail();
|
88 |
if ( ! $api->isEmailAvailable($email))
|
89 |
-
return
|
90 |
|
91 |
if ( ! $api->isNicknameAvailable($nickname))
|
92 |
-
return
|
93 |
}
|
94 |
|
95 |
/*$telephone = trim($request->getPost('fermopoint_phone', ''));
|
96 |
if (empty($telephone))
|
97 |
-
return
|
98 |
*/
|
99 |
}
|
100 |
|
@@ -185,6 +215,30 @@ class FermoPoint_StorePickup_Model_Observer
|
|
185 |
$transport->setHtml($html);
|
186 |
}
|
187 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
public function onBlockToHtmlAfter($event)
|
189 |
{
|
190 |
if ( ! Mage::getStoreConfig('carriers/fpstorepickup/active')
|
@@ -196,8 +250,18 @@ class FermoPoint_StorePickup_Model_Observer
|
|
196 |
if ( ! $block)
|
197 |
return;
|
198 |
|
199 |
-
|
200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
}
|
202 |
|
203 |
public function onOrderInvoicePay($event)
|
19 |
$controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
|
20 |
}
|
21 |
|
22 |
+
protected function _returnFirecheckoutError($controller, $message)
|
23 |
+
{
|
24 |
+
$controller->getResponse()->setBody(Mage::helper('core')->jsonEncode(array(
|
25 |
+
'success' => false,
|
26 |
+
'error' => true,
|
27 |
+
'error_messages' => $message,
|
28 |
+
)));
|
29 |
+
$controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
|
30 |
+
}
|
31 |
|
32 |
+
protected function _muteError($controller, $message)
|
33 |
+
{
|
34 |
+
// do nothing
|
35 |
+
}
|
36 |
|
37 |
public function onSaveShippingMethodBefore($observer)
|
38 |
{
|
39 |
$controller = $observer->getEvent()->getControllerAction();
|
40 |
+
$this->_onSaveShippingMethodBefore($controller, array($this, '_returnError'));
|
41 |
+
}
|
42 |
+
|
43 |
+
public function onFirecheckoutSaveOrderBefore($observer)
|
44 |
+
{
|
45 |
+
$controller = $observer->getEvent()->getControllerAction();
|
46 |
+
$this->_onSaveShippingMethodBefore($controller, array($this, '_returnFirecheckoutError'));
|
47 |
+
}
|
48 |
+
|
49 |
+
public function onFirecheckoutSaveShippingMethodBefore($observer)
|
50 |
+
{
|
51 |
+
$controller = $observer->getEvent()->getControllerAction();
|
52 |
+
$this->_onSaveShippingMethodBefore($controller, array($this, '_muteError'));
|
53 |
+
}
|
54 |
+
|
55 |
+
protected function _onSaveShippingMethodBefore($controller, $callback)
|
56 |
+
{
|
57 |
$request = $controller->getRequest();
|
58 |
if ( ! $request->isPost())
|
59 |
return;
|
64 |
$pointId = $request->getPost('fermopoint_point_id', 0);
|
65 |
$point = Mage::getModel('fpstorepickup/point')->load($pointId);
|
66 |
if ( ! $point->getId())
|
67 |
+
return call_user_func($callback, $controller, Mage::helper('fpstorepickup')->__('Unknown Fermo!Point ID'));
|
68 |
|
69 |
$accountType = $request->getPost('fermopoint_account', 'new');
|
70 |
$config = Mage::helper('fpstorepickup/config');
|
83 |
$isGuest = false;
|
84 |
$nickname = trim($request->getPost('fermopoint_nickname', ''));
|
85 |
if (empty($nickname))
|
86 |
+
return call_user_func($callback, $controller, Mage::helper('fpstorepickup')->__('Invalid Nickname'));
|
87 |
|
88 |
$dob = trim($request->getPost('fermopoint_dob', ''));
|
89 |
if (empty($dob))
|
90 |
+
return call_user_func($callback, $controller, Mage::helper('fpstorepickup')->__('Invalid Date of Birth'));
|
91 |
|
92 |
$dob = Mage::helper('fpstorepickup')->convertDate($dob);
|
93 |
if (empty($dob))
|
94 |
+
return call_user_func($callback, $controller, Mage::helper('fpstorepickup')->__('Invalid Date of Birth'));
|
95 |
|
96 |
$request->setPost('fermopoint_dob', $dob);
|
97 |
}
|
103 |
if ($isGuest)
|
104 |
{
|
105 |
if ( ! $api->isGuestNicknameAndDobMatch($nickname, $dob))
|
106 |
+
return call_user_func($callback, $controller, Mage::helper('fpstorepickup')->__('There is no user with given nickname and date of birth'));
|
107 |
}
|
108 |
else
|
109 |
{
|
110 |
if ( ! $api->isNicknameAndDobMatch($nickname, $dob))
|
111 |
+
return call_user_func($callback, $controller, Mage::helper('fpstorepickup')->__('There is no user with given nickname and date of birth'));
|
112 |
}
|
113 |
break;
|
114 |
|
116 |
default:
|
117 |
$email = $this->getQuote()->getCustomerEmail();
|
118 |
if ( ! $api->isEmailAvailable($email))
|
119 |
+
return call_user_func($callback, $controller, Mage::helper('fpstorepickup')->__('Your email is already registered on Fermo!Point'));
|
120 |
|
121 |
if ( ! $api->isNicknameAvailable($nickname))
|
122 |
+
return call_user_func($callback, $controller, Mage::helper('fpstorepickup')->__('User with this nickname already exists'));
|
123 |
}
|
124 |
|
125 |
/*$telephone = trim($request->getPost('fermopoint_phone', ''));
|
126 |
if (empty($telephone))
|
127 |
+
return call_user_func($callback, $controller, Mage::helper('fpstorepickup')->__('Invalid phone number'));
|
128 |
*/
|
129 |
}
|
130 |
|
215 |
$transport->setHtml($html);
|
216 |
}
|
217 |
|
218 |
+
protected function _insertFirecheckoutRadioJs(Mage_Core_Block_Abstract $block, Varien_Object $transport)
|
219 |
+
{
|
220 |
+
$html = $transport->getHtml();
|
221 |
+
if ( ! preg_match('#(<ul[^>]+>.+?same_as_billing.+?)</ul>#ius', $html, $matches))
|
222 |
+
return;
|
223 |
+
|
224 |
+
$html = str_replace(
|
225 |
+
$matches[1],
|
226 |
+
$matches[1] . $block->getLayout()->createBlock('fpstorepickup/fireCheckout_billing_radio')->toHtml(),
|
227 |
+
$html
|
228 |
+
);
|
229 |
+
$html .= $block->getLayout()->createBlock('fpstorepickup/fireCheckout_billing_js')->toHtml();
|
230 |
+
$transport->setHtml($html);
|
231 |
+
}
|
232 |
+
|
233 |
+
protected function _insertMap(Mage_Core_Block_Abstract $block, Varien_Object $transport)
|
234 |
+
{
|
235 |
+
if ( ! Mage::helper('fpstorepickup')->getIsOneStepCheckout())
|
236 |
+
return;
|
237 |
+
$html = $transport->getHtml();
|
238 |
+
$html .= $block->getLayout()->createBlock('fpstorepickup/map')->setInitiallyHidden(true)->toHtml();
|
239 |
+
$transport->setHtml($html);
|
240 |
+
}
|
241 |
+
|
242 |
public function onBlockToHtmlAfter($event)
|
243 |
{
|
244 |
if ( ! Mage::getStoreConfig('carriers/fpstorepickup/active')
|
250 |
if ( ! $block)
|
251 |
return;
|
252 |
|
253 |
+
switch ($block->getType())
|
254 |
+
{
|
255 |
+
case 'checkout/onepage_billing':
|
256 |
+
$this->_insertRadioJs($block, $event->getTransport());
|
257 |
+
break;
|
258 |
+
case 'firecheckout/checkout_shipping':
|
259 |
+
$this->_insertFirecheckoutRadioJs($block, $event->getTransport());
|
260 |
+
break;
|
261 |
+
case 'checkout/onepage_shipping_method_additional':
|
262 |
+
$this->_insertMap($block, $event->getTransport());
|
263 |
+
break;
|
264 |
+
}
|
265 |
}
|
266 |
|
267 |
public function onOrderInvoicePay($event)
|
app/code/community/FermoPoint/StorePickup/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<FermoPoint_StorePickup>
|
5 |
-
<version>1.
|
6 |
</FermoPoint_StorePickup>
|
7 |
</modules>
|
8 |
<global>
|
@@ -152,6 +152,22 @@
|
|
152 |
</fermopoint_storepickup_observer>
|
153 |
</observers>
|
154 |
</checkout_controller_onepage_save_shipping_method>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
<controller_action_predispatch_checkout_onepage_saveShippingMethod>
|
156 |
<observers>
|
157 |
<fermopoint_storepickup_observer>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<FermoPoint_StorePickup>
|
5 |
+
<version>1.2.0</version>
|
6 |
</FermoPoint_StorePickup>
|
7 |
</modules>
|
8 |
<global>
|
152 |
</fermopoint_storepickup_observer>
|
153 |
</observers>
|
154 |
</checkout_controller_onepage_save_shipping_method>
|
155 |
+
<controller_action_predispatch_firecheckout_index_saveOrder>
|
156 |
+
<observers>
|
157 |
+
<fermopoint_storepickup_observer>
|
158 |
+
<class>fpstorepickup/observer</class>
|
159 |
+
<method>onFirecheckoutSaveOrderBefore</method>
|
160 |
+
</fermopoint_storepickup_observer>
|
161 |
+
</observers>
|
162 |
+
</controller_action_predispatch_firecheckout_index_saveOrder>
|
163 |
+
<controller_action_predispatch_firecheckout_index_saveShippingMethod>
|
164 |
+
<observers>
|
165 |
+
<fermopoint_storepickup_observer>
|
166 |
+
<class>fpstorepickup/observer</class>
|
167 |
+
<method>onFirecheckoutSaveShippingMethodBefore</method>
|
168 |
+
</fermopoint_storepickup_observer>
|
169 |
+
</observers>
|
170 |
+
</controller_action_predispatch_firecheckout_index_saveShippingMethod>
|
171 |
<controller_action_predispatch_checkout_onepage_saveShippingMethod>
|
172 |
<observers>
|
173 |
<fermopoint_storepickup_observer>
|
app/design/frontend/base/default/layout/fpstorepickup.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<layout version="0.1.0">
|
3 |
|
4 |
-
|
5 |
<reference name="head">
|
6 |
<action method="addJs"><script>fermopoint/markerclusterer.js</script></action>
|
7 |
<action method="addJs"><script>fermopoint/storepickup.js</script></action>
|
@@ -11,9 +11,17 @@
|
|
11 |
<action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
|
12 |
<block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
|
13 |
</reference>
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
17 |
</checkout_onepage_index>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
</layout>
|
1 |
<?xml version="1.0"?>
|
2 |
<layout version="0.1.0">
|
3 |
|
4 |
+
<fermopoint_scripts>
|
5 |
<reference name="head">
|
6 |
<action method="addJs"><script>fermopoint/markerclusterer.js</script></action>
|
7 |
<action method="addJs"><script>fermopoint/storepickup.js</script></action>
|
11 |
<action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
|
12 |
<block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
|
13 |
</reference>
|
14 |
+
</fermopoint_scripts>
|
15 |
+
|
16 |
+
<checkout_onepage_index>
|
17 |
+
<update handle="fermopoint_scripts" />
|
18 |
</checkout_onepage_index>
|
19 |
+
|
20 |
+
<firecheckout_index_index>
|
21 |
+
<update handle="fermopoint_scripts" />
|
22 |
+
<reference name="head">
|
23 |
+
<action method="addJs"><script>fermopoint/firecheckout.js</script></action>
|
24 |
+
</reference>
|
25 |
+
</firecheckout_index_index>
|
26 |
|
27 |
</layout>
|
app/design/frontend/base/default/template/fpstorepickup/checkout/onepage/billing/radio.phtml
CHANGED
@@ -2,4 +2,3 @@
|
|
2 |
<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_point" value="1"<?php if (Mage::helper('fpstorepickup')->getUseMethod()) : ?> checked="checked" <?php endif ?> onclick="$('shipping:same_as_billing').checked = true;" class="radio" />
|
3 |
<label for="billing:use_for_shipping_point"><?php echo $this->__('Fermo!Point Store Pickup') ?></label>
|
4 |
</li>
|
5 |
-
|
2 |
<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_point" value="1"<?php if (Mage::helper('fpstorepickup')->getUseMethod()) : ?> checked="checked" <?php endif ?> onclick="$('shipping:same_as_billing').checked = true;" class="radio" />
|
3 |
<label for="billing:use_for_shipping_point"><?php echo $this->__('Fermo!Point Store Pickup') ?></label>
|
4 |
</li>
|
|
app/design/frontend/base/default/template/fpstorepickup/firecheckout/onepage/billing/js.phtml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script type="text/javascript">
|
2 |
+
//<![CDATA[
|
3 |
+
var fpStorePickup = new FermopointStorePickup(
|
4 |
+
'<?php echo Mage::helper('fpstorepickup')->getChangeMethodUrl(); ?>',
|
5 |
+
'<?php echo Mage::helper('fpstorepickup')->getSearchUrl(); ?>',
|
6 |
+
'<?php echo Mage::helper('fpstorepickup')->getMediaUrl(); ?>'
|
7 |
+
);
|
8 |
+
|
9 |
+
Event.observe('shipping:same_as_billing_point', 'click', function(event){
|
10 |
+
fpStorePickup.setUseStorePickup(true);
|
11 |
+
if ($('s_method_fpstorepickup_fpstorepickup'))
|
12 |
+
$('s_method_fpstorepickup_fpstorepickup').checked = true;
|
13 |
+
reviewInfo.update('shipping-address');
|
14 |
+
});
|
15 |
+
|
16 |
+
Event.observe('shipping:same_as_billing', 'click', function(event){
|
17 |
+
fpStorePickup.setUseStorePickup(false);
|
18 |
+
if ($('s_method_fpstorepickup_fpstorepickup'))
|
19 |
+
$('s_method_fpstorepickup_fpstorepickup').checked = false;
|
20 |
+
reviewInfo.update('shipping-address');
|
21 |
+
});
|
22 |
+
|
23 |
+
Event.observe('shipping:same_as_billing_no', 'click', function(event){
|
24 |
+
fpStorePickup.setUseStorePickup(false);
|
25 |
+
if ($('s_method_fpstorepickup_fpstorepickup'))
|
26 |
+
$('s_method_fpstorepickup_fpstorepickup').checked = false;
|
27 |
+
reviewInfo.update('shipping-address');
|
28 |
+
});
|
29 |
+
//]]>
|
30 |
+
</script>
|
app/design/frontend/base/default/template/fpstorepickup/firecheckout/onepage/billing/radio.phtml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<li class="control">
|
2 |
+
<input type="radio" name="shipping[same_as_billing]" onclick="shipping.setSameAsBilling(true)" id="shipping:same_as_billing_point" value="1"<?php if (Mage::helper('fpstorepickup')->getUseMethod()) : ?> checked="checked" <?php endif ?> class="radio" />
|
3 |
+
<label for="shipping:same_as_billing_point"><?php echo $this->__('Fermo!Point Store Pickup') ?></label>
|
4 |
+
</li>
|
app/design/frontend/base/default/template/fpstorepickup/map.phtml
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php $tosUrl = $this->getTosUrl() ?>
|
2 |
<?php $mapId = uniqid() ?>
|
3 |
-
<div class="fermopoint"
|
4 |
<div id="fermopoint_map">
|
5 |
<h3><?php echo $this->__('Search for pick-up points') ?></h3>
|
6 |
<p><?php echo $this->__('You are viewing the collection points closest to the address below. If you want, you can enter a different address.') ?></p>
|
@@ -120,7 +120,10 @@
|
|
120 |
};
|
121 |
fpStorePickup.onSelectPoint = function (point) {
|
122 |
$('fermopoint_point').show();
|
123 |
-
|
|
|
|
|
|
|
124 |
$('fermopoint_point_id').value = point.id;
|
125 |
$('fermopoint_point_name').innerHTML = point.name;
|
126 |
$('fermopoint_point_address').innerHTML = point.street
|
@@ -129,6 +132,16 @@
|
|
129 |
+ ' ' + point.region
|
130 |
//+ ' ' + point.country_id
|
131 |
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
};
|
133 |
fpStorePickup.bindValidations(
|
134 |
$('fermopoint_account:new'),
|
1 |
<?php $tosUrl = $this->getTosUrl() ?>
|
2 |
<?php $mapId = uniqid() ?>
|
3 |
+
<div class="fermopoint" id="fermopoint_outer"<?php if ($this->getInitiallyHidden()) echo ' style="display:none"' ?>>
|
4 |
<div id="fermopoint_map">
|
5 |
<h3><?php echo $this->__('Search for pick-up points') ?></h3>
|
6 |
<p><?php echo $this->__('You are viewing the collection points closest to the address below. If you want, you can enter a different address.') ?></p>
|
120 |
};
|
121 |
fpStorePickup.onSelectPoint = function (point) {
|
122 |
$('fermopoint_point').show();
|
123 |
+
try {
|
124 |
+
Effect.ScrollTo('fermopoint_point');
|
125 |
+
} catch (e) {
|
126 |
+
}
|
127 |
$('fermopoint_point_id').value = point.id;
|
128 |
$('fermopoint_point_name').innerHTML = point.name;
|
129 |
$('fermopoint_point_address').innerHTML = point.street
|
132 |
+ ' ' + point.region
|
133 |
//+ ' ' + point.country_id
|
134 |
;
|
135 |
+
try {
|
136 |
+
var arr = FireCheckout.Ajax.getSectionsToUpdate('shipping-method');
|
137 |
+
arr.push('shipping-address-review');
|
138 |
+
checkout.update(
|
139 |
+
checkout.urls.shipping_method,
|
140 |
+
FireCheckout.Ajax.arrayToJson(arr)
|
141 |
+
);
|
142 |
+
reviewInfo.update('shipping-address');
|
143 |
+
} catch (e) {
|
144 |
+
}
|
145 |
};
|
146 |
fpStorePickup.bindValidations(
|
147 |
$('fermopoint_account:new'),
|
js/fermopoint/firecheckout.js
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
;(function () {
|
2 |
+
document.observe('dom:loaded', function() {
|
3 |
+
var oldHandler = FireCheckout.OrderReview.prototype.update,
|
4 |
+
oldResponseHandler = FireCheckout.prototype.setResponse;
|
5 |
+
FireCheckout.OrderReview.prototype.update = function (from, to) {
|
6 |
+
var target = to || from,
|
7 |
+
review = $(target + '-review'),
|
8 |
+
fpRadio = $('s_method_fpstorepickup_fpstorepickup');
|
9 |
+
|
10 |
+
if (fpRadio && fpRadio.checked && target == 'shipping-address') {
|
11 |
+
review && review.update(this.getTitle(target) + $('fermopoint_point_address').innerHTML);
|
12 |
+
} else
|
13 |
+
return oldHandler.apply(this, arguments);
|
14 |
+
}
|
15 |
+
|
16 |
+
FireCheckout.prototype.setResponse = function (response) {
|
17 |
+
var result = oldResponseHandler.apply(this, arguments);
|
18 |
+
try {
|
19 |
+
fpStorePickup.forceMapUpdate();
|
20 |
+
} catch (e) {
|
21 |
+
}
|
22 |
+
return result;
|
23 |
+
}
|
24 |
+
});
|
25 |
+
})();
|
js/fermopoint/storepickup.js
CHANGED
@@ -1,350 +1,372 @@
|
|
1 |
-
var FermopointStorePickup = Class.create();
|
2 |
-
FermopointStorePickup.prototype = {
|
3 |
-
|
4 |
-
initialize: function(changeMethodUrl, searchUrl, mediaUrl) {
|
5 |
-
this.changeMethodUrl = changeMethodUrl;
|
6 |
-
this.searchUrl = searchUrl;
|
7 |
-
this.mediaUrl = mediaUrl;
|
8 |
-
|
9 |
-
this.error = false;
|
10 |
-
this.points = [];
|
11 |
-
this.markers = [];
|
12 |
-
this.location = null;
|
13 |
-
this.map = null;
|
14 |
-
this.clusterer = null;
|
15 |
-
this.infoWindow = null;
|
16 |
-
|
17 |
-
this.onInit = null;
|
18 |
-
this.onSearchStart = null;
|
19 |
-
this.onSearchEnd = null;
|
20 |
-
this.onSelectPoint = null;
|
21 |
-
|
22 |
-
this.setUpHook();
|
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 |
-
this.
|
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 |
-
this.
|
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 |
-
this.
|
106 |
-
this.
|
107 |
-
this.
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
}
|
143 |
-
|
144 |
-
if (
|
145 |
-
alert(Translator.translate('You should
|
146 |
-
return false;
|
147 |
-
}
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
};
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
if (this.
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
this.
|
183 |
-
|
184 |
-
|
185 |
-
'<
|
186 |
-
|
187 |
-
|
188 |
-
'<div class="fermopoint-info-
|
189 |
-
'<div class="fermopoint-info-row
|
190 |
-
'<div class="fermopoint-info-row
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
google.maps.
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
})
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
if (this.
|
275 |
-
this.
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
this.
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
script
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var FermopointStorePickup = Class.create();
|
2 |
+
FermopointStorePickup.prototype = {
|
3 |
+
|
4 |
+
initialize: function(changeMethodUrl, searchUrl, mediaUrl) {
|
5 |
+
this.changeMethodUrl = changeMethodUrl;
|
6 |
+
this.searchUrl = searchUrl;
|
7 |
+
this.mediaUrl = mediaUrl;
|
8 |
+
|
9 |
+
this.error = false;
|
10 |
+
this.points = [];
|
11 |
+
this.markers = [];
|
12 |
+
this.location = null;
|
13 |
+
this.map = null;
|
14 |
+
this.clusterer = null;
|
15 |
+
this.infoWindow = null;
|
16 |
+
|
17 |
+
this.onInit = null;
|
18 |
+
this.onSearchStart = null;
|
19 |
+
this.onSearchEnd = null;
|
20 |
+
this.onSelectPoint = null;
|
21 |
+
|
22 |
+
this.setUpHook();
|
23 |
+
},
|
24 |
+
|
25 |
+
forceMapUpdate: function () {
|
26 |
+
google.maps.event.trigger(this.map, 'resize');
|
27 |
+
},
|
28 |
+
|
29 |
+
clearValidations: function (input) {
|
30 |
+
},
|
31 |
+
|
32 |
+
onAccountTypeChange: function (event, target) {
|
33 |
+
if (this.nickname.value.length)
|
34 |
+
Validation.validate(this.nickname);
|
35 |
+
if (this.dob.value.length)
|
36 |
+
Validation.validate(this.dob);
|
37 |
+
},
|
38 |
+
|
39 |
+
onNicknameChange: function (event, target) {
|
40 |
+
Validation.validate(this.nickname);
|
41 |
+
if (this.dob.value.length)
|
42 |
+
Validation.validate(this.dob);
|
43 |
+
},
|
44 |
+
|
45 |
+
onDobChange: function (event, target) {
|
46 |
+
Validation.validate(this.dob);
|
47 |
+
},
|
48 |
+
|
49 |
+
validateNickname: function (v) {
|
50 |
+
var result,
|
51 |
+
self = this;
|
52 |
+
if ( ! v.length || ! this.newAccount.checked)
|
53 |
+
return true;
|
54 |
+
|
55 |
+
result = true;
|
56 |
+
this.nickname.up('.input-box').addClassName('loading');
|
57 |
+
new Ajax.Request(this.nicknameUrl, {
|
58 |
+
method: 'post',
|
59 |
+
parameters: {
|
60 |
+
nickname: v
|
61 |
+
},
|
62 |
+
asynchronous: false,
|
63 |
+
onSuccess: function (transport) {
|
64 |
+
var response = transport.responseText;
|
65 |
+
|
66 |
+
result = response === 'ok';
|
67 |
+
},
|
68 |
+
onComplete: function() {
|
69 |
+
self.nickname.up('.input-box').removeClassName('loading');
|
70 |
+
}
|
71 |
+
});
|
72 |
+
|
73 |
+
return result;
|
74 |
+
},
|
75 |
+
|
76 |
+
validateDob: function (v) {
|
77 |
+
var result,
|
78 |
+
self = this;
|
79 |
+
if ( ! v.length || ! this.existingAccount.checked || ! this.nickname.value.length)
|
80 |
+
return true;
|
81 |
+
|
82 |
+
result = true;
|
83 |
+
this.dob.up('.input-box').addClassName('loading');
|
84 |
+
new Ajax.Request(this.dobUrl, {
|
85 |
+
method: 'post',
|
86 |
+
parameters: {
|
87 |
+
nickname: this.nickname.value,
|
88 |
+
dob: v
|
89 |
+
},
|
90 |
+
asynchronous: false,
|
91 |
+
onSuccess: function (transport) {
|
92 |
+
var response = transport.responseText;
|
93 |
+
|
94 |
+
result = response === 'ok';
|
95 |
+
},
|
96 |
+
onComplete: function() {
|
97 |
+
self.dob.up('.input-box').removeClassName('loading');
|
98 |
+
}
|
99 |
+
});
|
100 |
+
|
101 |
+
return result;
|
102 |
+
},
|
103 |
+
|
104 |
+
bindValidations: function (newAccount, existingAccount, guestAccount, nickname, dob, nicknameUrl, dobUrl) {
|
105 |
+
this.newAccount = newAccount;
|
106 |
+
this.existingAccount = existingAccount;
|
107 |
+
this.guestAccount = guestAccount;
|
108 |
+
this.nickname = nickname;
|
109 |
+
this.dob = dob;
|
110 |
+
this.nicknameUrl = nicknameUrl;
|
111 |
+
this.dobUrl = dobUrl;
|
112 |
+
|
113 |
+
newAccount.on('change', this.onAccountTypeChange.bind(this));
|
114 |
+
existingAccount.on('change', this.onAccountTypeChange.bind(this));
|
115 |
+
if (guestAccount)
|
116 |
+
guestAccount.on('change', this.onAccountTypeChange.bind(this));
|
117 |
+
|
118 |
+
Validation.add('validate-fp-nickname', 'User with this nickname already exists', this.validateNickname.bind(this));
|
119 |
+
Validation.add('validate-fp-dob', 'There is no user with given nickname and date of birth', this.validateDob.bind(this));
|
120 |
+
|
121 |
+
nickname.addClassName('validate-fp-nickname').on('change', this.onNicknameChange.bind(this));
|
122 |
+
dob.addClassName('validate-fp-dob').on('change', this.onDobChange.bind(this));
|
123 |
+
},
|
124 |
+
|
125 |
+
setUpHook: function () {
|
126 |
+
var fallbackValidate = ShippingMethod.prototype.validate,
|
127 |
+
fallbackNextStep = ShippingMethod.prototype.nextStep;
|
128 |
+
ShippingMethod.prototype.validate = function () {
|
129 |
+
var result,
|
130 |
+
pointId,
|
131 |
+
methods;
|
132 |
+
|
133 |
+
result = fallbackValidate.call(this);
|
134 |
+
if ( ! result)
|
135 |
+
return false;
|
136 |
+
|
137 |
+
methods = document.getElementsByName('shipping_method');
|
138 |
+
for (var i=0; i<methods.length; i++) {
|
139 |
+
if (methods[i].checked && methods[i].value !== 'fpstorepickup_fpstorepickup') {
|
140 |
+
return true;
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
/*if ($('fermopoint_accept_terms') && $('fermopoint_accept_terms').visible() && ! $('fermopoint_accept_terms').checked) {
|
145 |
+
alert(Translator.translate('You should accept FermoPoint terms and conditions').stripTags());
|
146 |
+
return false;
|
147 |
+
}*/
|
148 |
+
pointId = parseInt($('fermopoint_point_id').value, 10);
|
149 |
+
if (pointId <= 0) {
|
150 |
+
alert(Translator.translate('You should select one of available pick-up points to continue').stripTags());
|
151 |
+
return false;
|
152 |
+
}
|
153 |
+
|
154 |
+
return true;
|
155 |
+
};
|
156 |
+
|
157 |
+
ShippingMethod.prototype.nextStep = function (transport) {
|
158 |
+
fallbackNextStep.call(this, transport);
|
159 |
+
checkout.reloadProgressBlock('shipping');
|
160 |
+
};
|
161 |
+
},
|
162 |
+
|
163 |
+
rebound: function () {
|
164 |
+
var i,
|
165 |
+
bounds;
|
166 |
+
|
167 |
+
if ( ! this.markers.length)
|
168 |
+
return;
|
169 |
+
|
170 |
+
bounds = new google.maps.LatLngBounds();
|
171 |
+
|
172 |
+
if (this.location)
|
173 |
+
bounds.extend(this.location.getPosition());
|
174 |
+
|
175 |
+
for (i = 0; i < this.markers.length; i++)
|
176 |
+
bounds.extend(this.markers[i].getPosition());
|
177 |
+
|
178 |
+
this.map.fitBounds(bounds);
|
179 |
+
},
|
180 |
+
|
181 |
+
showPointInfo: function (marker, idx) {
|
182 |
+
var point = this.points[idx],
|
183 |
+
days = [];
|
184 |
+
for (var i = 0; i < point.hours.length; i++) {
|
185 |
+
days.push('<span class="dow">' + point.hours[i].day + '</span>' + point.hours[i].hours.join(', '));
|
186 |
+
}
|
187 |
+
this.infoWindow.setContent(
|
188 |
+
'<div class="fermopoint-info-window">' +
|
189 |
+
'<div class="fermopoint-info-row title">' + point.name + '</div>' +
|
190 |
+
'<div class="fermopoint-info-row select"><a class="fermopoint-select-me" rel="' + idx + '" href="#">' + Translator.translate('Select this pick-up point') + '</a></div>' +
|
191 |
+
'<div class="fermopoint-info-row"></div>' +
|
192 |
+
'<div class="fermopoint-info-row distance"><strong>' + Translator.translate('Distance') + ': </strong>' + point.distance + ' km </div>' +
|
193 |
+
'<div class="fermopoint-info-row contact"><strong>' + Translator.translate('Contact') + ': </strong>' + point.contact + '</div>'+
|
194 |
+
'<div class="fermopoint-info-row category"><strong>' + Translator.translate('Category') + ': </strong>' + point.category + '</div>'+
|
195 |
+
'<div class="fermopoint-info-row hours"><!--strong>' + Translator.translate('Hours') + ': </strong--><div class="hours-list">' + days.join('<br />') + '</div></div>'
|
196 |
+
|
197 |
+
);
|
198 |
+
this.infoWindow.open(this.map, marker);
|
199 |
+
},
|
200 |
+
|
201 |
+
setPoints: function (points) {
|
202 |
+
var i, marker, point, caller = this;
|
203 |
+
for (i = 0; i < this.markers.length; i++)
|
204 |
+
this.markers[i].setMap(null);
|
205 |
+
|
206 |
+
this.clusterer.clearMarkers();
|
207 |
+
this.markers.length = 0;
|
208 |
+
|
209 |
+
this.points = points;
|
210 |
+
if ( ! this.points.length)
|
211 |
+
return;
|
212 |
+
|
213 |
+
for (i = 0; i < this.points.length; i++) {
|
214 |
+
point = this.points[i];
|
215 |
+
marker = new google.maps.Marker({
|
216 |
+
position: new google.maps.LatLng(point.latitude, point.longitude),
|
217 |
+
map: this.map,
|
218 |
+
icon: this.mediaUrl + 'marker_point.png'
|
219 |
+
});
|
220 |
+
google.maps.event.addListener(marker, 'click', (function(marker, i) {
|
221 |
+
return function () {
|
222 |
+
caller.showPointInfo(marker, i);
|
223 |
+
}
|
224 |
+
})(marker, i));
|
225 |
+
this.markers.push(marker);
|
226 |
+
}
|
227 |
+
|
228 |
+
this.clusterer.addMarkers(this.markers);
|
229 |
+
|
230 |
+
this.rebound();
|
231 |
+
},
|
232 |
+
|
233 |
+
choosePoint: function (idx) {
|
234 |
+
this.infoWindow.close();
|
235 |
+
if (typeof(this.onSelectPoint) === 'function')
|
236 |
+
this.onSelectPoint.call(this, this.points[idx]);
|
237 |
+
},
|
238 |
+
|
239 |
+
initMap: function (container) {
|
240 |
+
var mapOptions = {
|
241 |
+
zoom: 5,
|
242 |
+
center: new google.maps.LatLng(41.9000, 12.4833)
|
243 |
+
},
|
244 |
+
caller = this;
|
245 |
+
|
246 |
+
Event.observe(container, 'click', function (event) {
|
247 |
+
var target = Event.findElement(event);
|
248 |
+
|
249 |
+
if (target.hasClassName('fermopoint-select-me')) {
|
250 |
+
Event.stop(event);
|
251 |
+
caller.choosePoint(parseInt(target.rel), 10);
|
252 |
+
}
|
253 |
+
});
|
254 |
+
|
255 |
+
this.infoWindow = new google.maps.InfoWindow();
|
256 |
+
this.map = new google.maps.Map(document.getElementById(container), mapOptions);
|
257 |
+
this.clusterer = new MarkerClusterer(this.map, this.markers, {
|
258 |
+
gridSize: 45,
|
259 |
+
styles: [{
|
260 |
+
height: 36, width: 36, textColor: "#ffffff", textSize: 11,
|
261 |
+
url: this.mediaUrl + 'cluster1.png'
|
262 |
+
}, {
|
263 |
+
height: 42, width: 42, textColor: "#ffffff", textSize: 11,
|
264 |
+
url: this.mediaUrl + 'cluster2.png'
|
265 |
+
}, {
|
266 |
+
height: 50, width: 50, textColor: "#ffffff", textSize: 11,
|
267 |
+
url: this.mediaUrl + 'cluster3.png'
|
268 |
+
}, {
|
269 |
+
height: 60, width: 60, textColor: "#ffffff", textSize: 11,
|
270 |
+
url: this.mediaUrl + 'cluster4.png'
|
271 |
+
}]
|
272 |
+
});
|
273 |
+
|
274 |
+
if (typeof(this.onInit) === 'function')
|
275 |
+
this.onInit.call(this);
|
276 |
+
},
|
277 |
+
|
278 |
+
setLocation: function (lat, lng) {
|
279 |
+
if (this.location)
|
280 |
+
this.location.setMap(null);
|
281 |
+
this.location = new google.maps.Marker({
|
282 |
+
position: new google.maps.LatLng(lat, lng),
|
283 |
+
map: this.map
|
284 |
+
});
|
285 |
+
|
286 |
+
this.rebound();
|
287 |
+
},
|
288 |
+
|
289 |
+
search: function (address, radius) {
|
290 |
+
var url = this.searchUrl,
|
291 |
+
caller = this;
|
292 |
+
|
293 |
+
if ( ! address.length)
|
294 |
+
return;
|
295 |
+
|
296 |
+
if (typeof(this.onSearchStart) === 'function')
|
297 |
+
this.onSearchStart.call(this);
|
298 |
+
|
299 |
+
new Ajax.Request(url, {
|
300 |
+
parameters: {
|
301 |
+
address: address,
|
302 |
+
radius: radius
|
303 |
+
},
|
304 |
+
onComplete: function () {
|
305 |
+
if (typeof(caller.onSearchEnd) === 'function')
|
306 |
+
caller.onSearchEnd.call(caller, caller.points, caller.error);
|
307 |
+
},
|
308 |
+
onSuccess: function(transport) {
|
309 |
+
var json = transport.responseText.evalJSON();
|
310 |
+
caller.error = json.error;
|
311 |
+
|
312 |
+
if (json.error) {
|
313 |
+
setTimeout(function () {
|
314 |
+
alert(json.message ? json.message : Translator.translate('Error'));
|
315 |
+
}, 1);
|
316 |
+
return;
|
317 |
+
}
|
318 |
+
|
319 |
+
caller.setLocation(json.latitude, json.longitude);
|
320 |
+
caller.setPoints(json.points);
|
321 |
+
}
|
322 |
+
});
|
323 |
+
},
|
324 |
+
|
325 |
+
initGoogleMap: function (scriptUrl, container) {
|
326 |
+
if ( ! window.google || ! google.maps)
|
327 |
+
this.loadGoogleMap(scriptUrl, container);
|
328 |
+
else
|
329 |
+
this.initMap(container);
|
330 |
+
},
|
331 |
+
|
332 |
+
loadGoogleMap: function (scriptUrl, container) {
|
333 |
+
var script = document.createElement('script'),
|
334 |
+
functionName = 'initMap' + Math.floor(Math.random() * 1000001),
|
335 |
+
caller = this;
|
336 |
+
|
337 |
+
window[functionName] = function () {
|
338 |
+
caller.initMap(container);
|
339 |
+
}
|
340 |
+
|
341 |
+
script.type = 'text/javascript';
|
342 |
+
script.src = scriptUrl + '&callback=' + functionName;
|
343 |
+
document.body.appendChild(script);
|
344 |
+
},
|
345 |
+
|
346 |
+
setUseStorePickup: function(flag)
|
347 |
+
{
|
348 |
+
var url = this.changeMethodUrl;
|
349 |
+
|
350 |
+
if (flag)
|
351 |
+
url += 'flag/1';
|
352 |
+
else
|
353 |
+
url += 'flag/0';
|
354 |
+
|
355 |
+
var request = new Ajax.Request(url, {
|
356 |
+
method: 'get',
|
357 |
+
onSuccess: function () {
|
358 |
+
try {
|
359 |
+
var url = flag ? checkout.urls.billing_address : checkout.urls.shipping_address,
|
360 |
+
sections = FireCheckout.Ajax.getSectionsToUpdate('shipping');
|
361 |
+
|
362 |
+
if (sections.length) {
|
363 |
+
checkout.update(url, FireCheckout.Ajax.arrayToJson(sections));
|
364 |
+
}
|
365 |
+
} catch (e) {
|
366 |
+
}
|
367 |
+
},
|
368 |
+
onFailure: ""
|
369 |
+
});
|
370 |
+
}
|
371 |
+
|
372 |
+
}
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>fermopoint</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Fermo!Points</summary>
|
10 |
<description>Module for integrating Fermo!Points collecting points system.</description>
|
11 |
-
<notes
|
12 |
<authors><author><name>Fermo!Point</name><user>fermopoint</user><email>support@fermopoint.it</email></author></authors>
|
13 |
-
<date>2015-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="FermoPoint"><dir name="StorePickup"><dir><dir name="Block"><dir name="Adminhtml"><dir name="Configuration"><file name="Disabled.php" hash="27fc2af187259bddd66552c84231f5f5"/><file name="Manual.php" hash="132e7c4a9f89ad71dccb4ce1b2c4c242"/></dir><dir name="Remote"><dir name="Grid"><dir name="Renderer"><file name="Notes.php" hash="0d3427070e683a438abdabc1926cf316"/></dir></dir><file name="Grid.php" hash="9dcea09a45c0dabe2931380a20a97b9b"/></dir><file name="Remote.php" hash="71367be2fb6723af4ff91b8207209ab0"/><file name="Stats.php" hash="e5f884c631ab63546570ab35e0a8336c"/></dir><dir name="Checkout"><dir name="Billing"><file name="Js.php" hash="6be3156e2bb484852a9d5b0e9aa7eee2"/><file name="Radio.php" hash="6839fed605f95a79537e09467a578e58"/></dir><dir name="Onepage"><dir name="Payment"><file name="Methods.php" hash="aa8e5a31eb2ce85672e0f8aa290b4759"/></dir><dir name="Shipping"><dir name="Method"><file name="Available.php" hash="
|
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>fermopoint</name>
|
4 |
+
<version>1.2.0</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>
|
8 |
<extends/>
|
9 |
<summary>Fermo!Points</summary>
|
10 |
<description>Module for integrating Fermo!Points collecting points system.</description>
|
11 |
+
<notes>+ Compatibility with TM FireCheckout</notes>
|
12 |
<authors><author><name>Fermo!Point</name><user>fermopoint</user><email>support@fermopoint.it</email></author></authors>
|
13 |
+
<date>2015-10-15</date>
|
14 |
+
<time>13:32:37</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="FermoPoint"><dir name="StorePickup"><dir><dir name="Block"><dir name="Adminhtml"><dir name="Configuration"><file name="Disabled.php" hash="27fc2af187259bddd66552c84231f5f5"/><file name="Manual.php" hash="132e7c4a9f89ad71dccb4ce1b2c4c242"/></dir><dir name="Remote"><dir name="Grid"><dir name="Renderer"><file name="Notes.php" hash="0d3427070e683a438abdabc1926cf316"/></dir></dir><file name="Grid.php" hash="9dcea09a45c0dabe2931380a20a97b9b"/></dir><file name="Remote.php" hash="71367be2fb6723af4ff91b8207209ab0"/><file name="Stats.php" hash="e5f884c631ab63546570ab35e0a8336c"/></dir><dir name="Checkout"><dir name="Billing"><file name="Js.php" hash="6be3156e2bb484852a9d5b0e9aa7eee2"/><file name="Radio.php" hash="6839fed605f95a79537e09467a578e58"/></dir><dir name="Onepage"><dir name="Payment"><file name="Methods.php" hash="aa8e5a31eb2ce85672e0f8aa290b4759"/></dir><dir name="Shipping"><dir name="Method"><file name="Available.php" hash="59f7cea723940a81ab4a849b0dccca4f"/></dir></dir></dir></dir><dir name="FireCheckout"><dir name="Billing"><file name="Js.php" hash="dc5d3d07ad298c28a0651d6c090d7ef6"/><file name="Radio.php" hash="d85b3da0d7755b3e272a1102325815bf"/></dir></dir><file name="Map.php" hash="546a20b5c8477952392fdf7d90635e04"/></dir><dir name="Helper"><file name="Config.php" hash="976bccea81cde416e6c7ccdecbc174ee"/><file name="Data.php" hash="2cf93d2c91bdb35f6b69a6850358365c"/></dir><dir name="Model"><dir name="Api"><file name="OrderCollection.php" hash="f43b08d838be60a4e923fd8e3373356f"/><file name="SearchData.php" hash="97543705dfb6ff16c64761d566ff30f7"/></dir><file name="Api.php" hash="f80281ef215ae86396c02bd7e8839a3b"/><dir name="Carrier"><file name="Storepickup.php" hash="fe1eba536223f737c90b6ee1019d89e8"/></dir><file name="GoogleMaps.php" hash="57e207c865f97f5eb7c2832862a052d1"/><file name="Observer.php" hash="c7403a99deffd0cabc38bc64c274e417"/><dir name="Order"><file name="Point.php" hash="e5d033a2ee6add18f52bd0068102b22f"/></dir><file name="Point.php" hash="b5924ba282ad76dffc269b9c13b823f9"/><file name="Points.php" hash="37f236eabd20c5f91dc6958b600d5d21"/><dir name="Resource"><dir name="Order"><dir name="Point"><file name="Collection.php" hash="294427a66e6588ec4a5ef9af18eecd01"/></dir><file name="Point.php" hash="6c02668768be696fa833bab39fe3f9db"/></dir><dir name="Point"><file name="Collection.php" hash="9745e0182402f72ee43ce6cd7834afce"/></dir><file name="Point.php" hash="6b8e4a20dbda96bdf1c71bf56fcf8c31"/></dir><dir name="Source"><file name="Payment.php" hash="2a2213f3b7832f8891d147015c0361cd"/><file name="Selectorpayment.php" hash="8448ba93eb8ebe2c25eeeef100ff47f9"/><file name="State.php" hash="6a3f558509964600aa9491fbc7b5a15d"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="RemoteController.php" hash="1572704560ae35965d184bfa25fef23c"/></dir><file name="IndexController.php" hash="339258a7f63260b5dfa7706058d08c5d"/><file name="ValidateController.php" hash="81869825387f94dfaa8475408edf054f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f790d0329024eba67a9018fd782a763a"/><file name="config.xml" hash="62c255d6e76d223a0c6a34723cecfd17"/><file name="jstranslator.xml" hash="f6340ca99cf070450e94d3f0c8f86da2"/><file name="system.xml" hash="4585c331972160f8c6f9d26f2bb36476"/></dir><dir name="sql"><dir name="fpstorepickup_setup"><file name="mysql4-install-1.0.0.php" hash="c48472469c87f9975c4b203715e0137c"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="4801c11b1c8698ecbf9b4d857b055c33"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="21b100d87f0d3820e6317774c5ed273d"/><file name="mysql4-upgrade-1.1.1-1.1.2.php" hash="a120ae850a03a56010cf9576715beabd"/></dir></dir></dir><file name="Exception.php" hash="5d30b0aa037248c2709775c8485d5fff"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="fpstorepickup.xml" hash="e753271157b0dfbba46396a5046efdee"/></dir><dir name="template"><dir name="fpstorepickup"><file name="stats.phtml" hash="977cf97e8e340abdc86825c4e853195c"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="fpstorepickup.xml" hash="ba7e537b0d17993a5cc7ab95765296ad"/></dir><dir name="template"><dir name="fpstorepickup"><dir><dir name="checkout"><dir name="onepage"><dir name="billing"><file name="js.phtml" hash="0d0d4fa1a2a807ececff43ffad03e322"/><file name="radio.phtml" hash="975e2309308ae63914aa16b9ad81ea47"/></dir></dir></dir><dir name="firecheckout"><dir name="onepage"><dir name="billing"><file name="js.phtml" hash="7b2a9f3f2e75d8fd6ade7c363077b963"/><file name="radio.phtml" hash="a40fd64f5cdd9e35dcd4d8997cf22b13"/></dir></dir></dir></dir><file name="map.phtml" hash="1749388c6101314b73939c7a0c47983c"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="FermoPoint_StorePickup.xml" hash="88569786925f04dade3952d7951f0fca"/></dir></dir></dir><dir name="js"><dir name="fermopoint"><file name="firecheckout.js" hash="41f93eaa23e8ccdcb1e403f396c86da8"/><file name="markerclusterer.js" hash="b623ac6d39ea8ed99d179db49b7b0bab"/><file name="storepickup.js" hash="3f3bc937af937212c7a799d4d59183e0"/></dir></dir><dir name="media"><dir name="fermopoint"><file name="cluster1.png" hash="545e7decba75c26883195707a1caf453"/><file name="cluster2.png" hash="1a2554261502135f8699081f7b7dfc15"/><file name="cluster3.png" hash="381dc5802ac150d868bab1edee7cba6c"/><file name="cluster4.png" hash="5fad1a5d344e178f587c759d9466a937"/><file name="marker_location.png" hash="000a6513abbe2c9683b19f49873710c5"/><file name="marker_point.png" hash="9b4dd5a4dd6ace99004ee529a9097de8"/></dir></dir></target><target name="magelocale"><dir name="it_IT"><file name="FermoPoint_StorePickup.csv" hash="cbaa015c86386833206af782606b37aa"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="fermopoint"><dir name="css"><file name="storepickup.css" hash="c0619cfa9fd6f2edf4c363120c54dbff"/></dir><dir name="images"><file name="opc-ajax-loader.gif" hash="e805ea7eca1f34c75ba0f93780d32d38"/></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/fermopoint/css/storepickup.css
CHANGED
@@ -89,4 +89,10 @@
|
|
89 |
|
90 |
|
91 |
.input-box .ajax-validate {display: none;}
|
92 |
-
.input-box.loading .ajax-validate {display: inline; position: relative; left: -25px;}
|
|
|
|
|
|
|
|
|
|
|
|
89 |
|
90 |
|
91 |
.input-box .ajax-validate {display: none;}
|
92 |
+
.input-box.loading .ajax-validate {display: inline; position: relative; left: -25px;}
|
93 |
+
|
94 |
+
.firecheckout-index-index .col3-set.firecheckout-set .form-list .control label[for="shipping:same_as_billing_point"] { width: 90% !important; }
|
95 |
+
.firecheckout-index-index .fermopoint .form-list .fields .field { width: 100%; }
|
96 |
+
.firecheckout-index-index #shipping:same_as_billing_point { vertical-align: top; }
|
97 |
+
.firecheckout-index-index #fermopoint_search_address { display: block; }
|
98 |
+
.firecheckout-index-index .fermopoint-info-window { min-width: 220px; }
|