Version Notes
+ Update to API 1.1
+ Add guest functionality
Download this release
Release Info
Developer | Fermo!Point |
Extension | fermopoint |
Version | 1.1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1.0 to 1.1.2
- app/code/community/FermoPoint/StorePickup/Block/Map.php +5 -0
- app/code/community/FermoPoint/StorePickup/Helper/Config.php +24 -1
- app/code/community/FermoPoint/StorePickup/Helper/Data.php +43 -0
- app/code/community/FermoPoint/StorePickup/Model/Api.php +19 -2
- app/code/community/FermoPoint/StorePickup/Model/Api/OrderCollection.php +6 -4
- app/code/community/FermoPoint/StorePickup/Model/Observer.php +64 -7
- app/code/community/FermoPoint/StorePickup/controllers/ValidateController.php +32 -0
- app/code/community/FermoPoint/StorePickup/etc/config.xml +12 -1
- app/code/community/FermoPoint/StorePickup/etc/jstranslator.xml +6 -0
- app/code/community/FermoPoint/StorePickup/etc/system.xml +31 -0
- app/code/community/FermoPoint/StorePickup/sql/fpstorepickup_setup/mysql4-upgrade-1.1.1-1.1.2.php +13 -0
- app/design/frontend/base/default/layout/fpstorepickup.xml +4 -0
- app/design/frontend/base/default/template/fpstorepickup/map.phtml +63 -19
- app/locale/it_IT/FermoPoint_StorePickup.csv +3 -1
- js/fermopoint/storepickup.js +95 -0
- package.xml +6 -5
- skin/frontend/base/default/fermopoint/css/storepickup.css +8 -1
app/code/community/FermoPoint/StorePickup/Block/Map.php
CHANGED
@@ -51,5 +51,10 @@ class FermoPoint_StorePickup_Block_Map extends Mage_Core_Block_Template
|
|
51 |
{
|
52 |
return Mage::getSingleton('checkout/session')->getQuote()->getCustomerEmail();
|
53 |
}
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
}
|
51 |
{
|
52 |
return Mage::getSingleton('checkout/session')->getQuote()->getCustomerEmail();
|
53 |
}
|
54 |
+
|
55 |
+
public function getUserDob()
|
56 |
+
{
|
57 |
+
return '';
|
58 |
+
}
|
59 |
|
60 |
}
|
app/code/community/FermoPoint/StorePickup/Helper/Config.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
class FermoPoint_StorePickup_Helper_Config extends Mage_Core_Helper_Abstract
|
4 |
{
|
5 |
|
6 |
-
const API_VERSION = '
|
7 |
|
8 |
const ENDPOINT_PRODUCTION = 'http://api.fermopoint.it/api/v:api_version/:api_method';
|
9 |
const ENDPOINT_SANDBOX = 'http://sandbox.fermopoint.it/api/v:api_version/:api_method';
|
@@ -19,12 +19,25 @@ class FermoPoint_StorePickup_Helper_Config extends Mage_Core_Helper_Abstract
|
|
19 |
const XML_PATH_ALLOWSPECIFIC = 'carriers/fpstorepickup/allowspecific_payment';
|
20 |
const XML_PATH_SPECIFICPAYMENTS = 'carriers/fpstorepickup/specificpayment';
|
21 |
const XML_PATH_AUTOSHIP = 'carriers/fpstorepickup/auto_ship';
|
|
|
|
|
|
|
22 |
|
23 |
public function getAutoShip()
|
24 |
{
|
25 |
return Mage::getStoreConfigFlag(self::XML_PATH_AUTOSHIP);
|
26 |
}
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
public function getTosAccepted()
|
29 |
{
|
30 |
return Mage::getStoreConfigFlag(self::XML_PATH_ACCEPT);
|
@@ -35,6 +48,16 @@ class FermoPoint_StorePickup_Helper_Config extends Mage_Core_Helper_Abstract
|
|
35 |
return (string) Mage::getStoreConfig(self::XML_PATH_CLIENTID);
|
36 |
}
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
public function getAllowSpecificPayments()
|
39 |
{
|
40 |
return Mage::getStoreConfig(self::XML_PATH_ALLOWSPECIFIC);
|
3 |
class FermoPoint_StorePickup_Helper_Config extends Mage_Core_Helper_Abstract
|
4 |
{
|
5 |
|
6 |
+
const API_VERSION = '1.1';
|
7 |
|
8 |
const ENDPOINT_PRODUCTION = 'http://api.fermopoint.it/api/v:api_version/:api_method';
|
9 |
const ENDPOINT_SANDBOX = 'http://sandbox.fermopoint.it/api/v:api_version/:api_method';
|
19 |
const XML_PATH_ALLOWSPECIFIC = 'carriers/fpstorepickup/allowspecific_payment';
|
20 |
const XML_PATH_SPECIFICPAYMENTS = 'carriers/fpstorepickup/specificpayment';
|
21 |
const XML_PATH_AUTOSHIP = 'carriers/fpstorepickup/auto_ship';
|
22 |
+
const XML_PATH_GUEST = 'carriers/fpstorepickup/guest';
|
23 |
+
const XML_PATH_GUEST_NICKNAME = 'carriers/fpstorepickup/guest_nickname';
|
24 |
+
const XML_PATH_GUEST_DOB = 'carriers/fpstorepickup/guest_dob';
|
25 |
|
26 |
public function getAutoShip()
|
27 |
{
|
28 |
return Mage::getStoreConfigFlag(self::XML_PATH_AUTOSHIP);
|
29 |
}
|
30 |
|
31 |
+
public function getGuestEnabled()
|
32 |
+
{
|
33 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_GUEST);
|
34 |
+
}
|
35 |
+
|
36 |
+
public function resetGuestEnabled()
|
37 |
+
{
|
38 |
+
Mage::getModel('core/config')->saveConfig(self::XML_PATH_GUEST, 0);
|
39 |
+
}
|
40 |
+
|
41 |
public function getTosAccepted()
|
42 |
{
|
43 |
return Mage::getStoreConfigFlag(self::XML_PATH_ACCEPT);
|
48 |
return (string) Mage::getStoreConfig(self::XML_PATH_CLIENTID);
|
49 |
}
|
50 |
|
51 |
+
public function getGuestNickname()
|
52 |
+
{
|
53 |
+
return (string) Mage::getStoreConfig(self::XML_PATH_GUEST_NICKNAME);
|
54 |
+
}
|
55 |
+
|
56 |
+
public function getGuestDob()
|
57 |
+
{
|
58 |
+
return (string) Mage::getStoreConfig(self::XML_PATH_GUEST_DOB);
|
59 |
+
}
|
60 |
+
|
61 |
public function getAllowSpecificPayments()
|
62 |
{
|
63 |
return Mage::getStoreConfig(self::XML_PATH_ALLOWSPECIFIC);
|
app/code/community/FermoPoint/StorePickup/Helper/Data.php
CHANGED
@@ -77,6 +77,16 @@ class FermoPoint_StorePickup_Helper_Data extends Mage_Core_Helper_Abstract
|
|
77 |
return $this->_getSessionData('phone_number', '');
|
78 |
}
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
public function getChangeMethodUrl()
|
81 |
{
|
82 |
return $this->_getUrl('fpstorepickup/index/changemethod', array('_secure' => true));
|
@@ -87,6 +97,16 @@ class FermoPoint_StorePickup_Helper_Data extends Mage_Core_Helper_Abstract
|
|
87 |
return $this->_getUrl('fpstorepickup/index/search', array('_secure' => true));
|
88 |
}
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
public function getLocationUrl()
|
91 |
{
|
92 |
return $this->_getUrl('fpstorepickup/index/location', array('_secure' => true));
|
@@ -114,4 +134,27 @@ class FermoPoint_StorePickup_Helper_Data extends Mage_Core_Helper_Abstract
|
|
114 |
$cart = Mage::getSingleton('checkout/cart');
|
115 |
return $cart->getQuote()->getShippingAddress();
|
116 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
}
|
77 |
return $this->_getSessionData('phone_number', '');
|
78 |
}
|
79 |
|
80 |
+
public function setDob($dob)
|
81 |
+
{
|
82 |
+
$this->_setSessionData('dob', $dob);
|
83 |
+
}
|
84 |
+
|
85 |
+
public function getDob()
|
86 |
+
{
|
87 |
+
return $this->_getSessionData('dob', '');
|
88 |
+
}
|
89 |
+
|
90 |
public function getChangeMethodUrl()
|
91 |
{
|
92 |
return $this->_getUrl('fpstorepickup/index/changemethod', array('_secure' => true));
|
97 |
return $this->_getUrl('fpstorepickup/index/search', array('_secure' => true));
|
98 |
}
|
99 |
|
100 |
+
public function getValidateNicknameUrl()
|
101 |
+
{
|
102 |
+
return $this->_getUrl('fpstorepickup/validate/nickname', array('_secure' => true));
|
103 |
+
}
|
104 |
+
|
105 |
+
public function getValidateDobUrl()
|
106 |
+
{
|
107 |
+
return $this->_getUrl('fpstorepickup/validate/dob', array('_secure' => true));
|
108 |
+
}
|
109 |
+
|
110 |
public function getLocationUrl()
|
111 |
{
|
112 |
return $this->_getUrl('fpstorepickup/index/location', array('_secure' => true));
|
134 |
$cart = Mage::getSingleton('checkout/cart');
|
135 |
return $cart->getQuote()->getShippingAddress();
|
136 |
}
|
137 |
+
|
138 |
+
public function convertDate($date)
|
139 |
+
{
|
140 |
+
$locale = Mage::app()->getLocale();
|
141 |
+
$dateObj = $locale->date(null, null, $locale->getLocaleCode(), false);
|
142 |
+
|
143 |
+
$dateObj->setTimezone(
|
144 |
+
Mage::app()->getStore()->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE)
|
145 |
+
);
|
146 |
+
|
147 |
+
//set begining of day
|
148 |
+
$dateObj->setHour(00);
|
149 |
+
$dateObj->setMinute(00);
|
150 |
+
$dateObj->setSecond(00);
|
151 |
+
|
152 |
+
//set date with applying timezone of store
|
153 |
+
$dateObj->set($date, Zend_Date::DATE_SHORT, $locale->getLocaleCode());
|
154 |
+
|
155 |
+
//convert store date to default date in UTC timezone without DST
|
156 |
+
//$dateObj->setTimezone(Mage_Core_Model_Locale::DEFAULT_TIMEZONE);
|
157 |
+
|
158 |
+
return $dateObj->toString('yyyy-MM-dd');
|
159 |
+
}
|
160 |
}
|
app/code/community/FermoPoint/StorePickup/Model/Api.php
CHANGED
@@ -117,6 +117,22 @@ class FermoPoint_StorePickup_Model_Api {
|
|
117 |
));
|
118 |
}
|
119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
public function isEmailAvailable($email)
|
121 |
{
|
122 |
return $this->call('users/email', array(
|
@@ -143,6 +159,7 @@ class FermoPoint_StorePickup_Model_Api {
|
|
143 |
'nickname' => $orderPoint->getNickname(),
|
144 |
'email' => $orderPoint->getEmail(),
|
145 |
'phone_number' => $orderPoint->getPhoneNumber(),
|
|
|
146 |
);
|
147 |
if ( ! $data['existing_user'])
|
148 |
{
|
@@ -162,6 +179,7 @@ class FermoPoint_StorePickup_Model_Api {
|
|
162 |
'email' => $orderPoint->getEmail(),
|
163 |
'phone_number' => $orderPoint->getPhoneNumber(),
|
164 |
'full_name' => $order->getCustomerName(),
|
|
|
165 |
'address' => array(
|
166 |
's' => $billingAddress->getStreetFull(),
|
167 |
'e' => null,
|
@@ -170,7 +188,6 @@ class FermoPoint_StorePickup_Model_Api {
|
|
170 |
'p' => $billingAddress->getPostcode(),
|
171 |
'd' => $regionCode,
|
172 |
),
|
173 |
-
//'born_date' => '1988-01-01',
|
174 |
//'tax_code' => 'AAAAAA11A11A111A',
|
175 |
'newsletter' => true,
|
176 |
);
|
@@ -220,7 +237,7 @@ class FermoPoint_StorePickup_Model_Api {
|
|
220 |
|
221 |
public function getOrders($limit = 20, $offset = 0)
|
222 |
{
|
223 |
-
return $this->call('orders', array(
|
224 |
}
|
225 |
|
226 |
}
|
117 |
));
|
118 |
}
|
119 |
|
120 |
+
public function isNicknameAndDobMatch($nickname, $dob)
|
121 |
+
{
|
122 |
+
return $this->call('users/check', array(
|
123 |
+
'nickname' => $nickname,
|
124 |
+
'born_date' => $dob,
|
125 |
+
));
|
126 |
+
}
|
127 |
+
|
128 |
+
public function isGuestNicknameAndDobMatch($nickname, $dob)
|
129 |
+
{
|
130 |
+
return $this->call('users/guest-check', array(
|
131 |
+
'nickname' => $nickname,
|
132 |
+
'born_date' => $dob,
|
133 |
+
));
|
134 |
+
}
|
135 |
+
|
136 |
public function isEmailAvailable($email)
|
137 |
{
|
138 |
return $this->call('users/email', array(
|
159 |
'nickname' => $orderPoint->getNickname(),
|
160 |
'email' => $orderPoint->getEmail(),
|
161 |
'phone_number' => $orderPoint->getPhoneNumber(),
|
162 |
+
'born_date' => $orderPoint->getDob(),
|
163 |
);
|
164 |
if ( ! $data['existing_user'])
|
165 |
{
|
179 |
'email' => $orderPoint->getEmail(),
|
180 |
'phone_number' => $orderPoint->getPhoneNumber(),
|
181 |
'full_name' => $order->getCustomerName(),
|
182 |
+
'born_date' => $orderPoint->getDob(),
|
183 |
'address' => array(
|
184 |
's' => $billingAddress->getStreetFull(),
|
185 |
'e' => null,
|
188 |
'p' => $billingAddress->getPostcode(),
|
189 |
'd' => $regionCode,
|
190 |
),
|
|
|
191 |
//'tax_code' => 'AAAAAA11A11A111A',
|
192 |
'newsletter' => true,
|
193 |
);
|
237 |
|
238 |
public function getOrders($limit = 20, $offset = 0)
|
239 |
{
|
240 |
+
return $this->call('orders', array('take' => $limit, 'skip' => $offset, 'orderby' => 'date'), array());
|
241 |
}
|
242 |
|
243 |
}
|
app/code/community/FermoPoint/StorePickup/Model/Api/OrderCollection.php
CHANGED
@@ -28,12 +28,14 @@ class FermoPoint_StorePickup_Model_Api_OrderCollection extends Varien_Data_Colle
|
|
28 |
$raw = Mage::getSingleton('fpstorepickup/api')->getOrders($limit, ($offset - 1) * $limit);
|
29 |
} catch (FermoPoint_StorePickup_Exception $e) {
|
30 |
$raw = array(
|
31 |
-
array(
|
32 |
-
|
33 |
-
|
|
|
|
|
34 |
);
|
35 |
}
|
36 |
-
foreach ($raw as $row)
|
37 |
{
|
38 |
$obj = new Varien_Object();
|
39 |
$obj->setData($row);
|
28 |
$raw = Mage::getSingleton('fpstorepickup/api')->getOrders($limit, ($offset - 1) * $limit);
|
29 |
} catch (FermoPoint_StorePickup_Exception $e) {
|
30 |
$raw = array(
|
31 |
+
'orders' => array(
|
32 |
+
array(
|
33 |
+
'email' => Mage::helper('fpstorepickup')->__('Service is not available at the moment, please try again later'),
|
34 |
+
),
|
35 |
+
),
|
36 |
);
|
37 |
}
|
38 |
+
foreach ($raw['orders'] as $row)
|
39 |
{
|
40 |
$obj = new Varien_Object();
|
41 |
$obj->setData($row);
|
app/code/community/FermoPoint/StorePickup/Model/Observer.php
CHANGED
@@ -19,6 +19,8 @@ class FermoPoint_StorePickup_Model_Observer
|
|
19 |
$controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
|
20 |
}
|
21 |
|
|
|
|
|
22 |
public function onSaveShippingMethodBefore($observer)
|
23 |
{
|
24 |
$controller = $observer->getEvent()->getControllerAction();
|
@@ -34,16 +36,50 @@ class FermoPoint_StorePickup_Model_Observer
|
|
34 |
if ( ! $point->getId())
|
35 |
return $this->_returnError($controller, Mage::helper('fpstorepickup')->__('Unknown Fermo!Point ID'));
|
36 |
|
37 |
-
$
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
-
$api = Mage::
|
42 |
-
switch ($accountType
|
43 |
{
|
44 |
case 'existing':
|
45 |
-
if ($
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
break;
|
48 |
|
49 |
case 'new':
|
@@ -76,6 +112,7 @@ class FermoPoint_StorePickup_Model_Observer
|
|
76 |
Mage::helper('fpstorepickup')->setNickname(trim($request->getPost('fermopoint_nickname')));
|
77 |
Mage::helper('fpstorepickup')->setAccountType(trim($request->getPost('fermopoint_account')));
|
78 |
Mage::helper('fpstorepickup')->setPhoneNumber(trim($request->getPost('fermopoint_phone')));
|
|
|
79 |
|
80 |
$point = Mage::getSingleton('fpstorepickup/points')->getPoint($pointId);
|
81 |
if ($point->getId())
|
@@ -113,6 +150,7 @@ class FermoPoint_StorePickup_Model_Observer
|
|
113 |
'account_type' => Mage::helper('fpstorepickup')->getAccountType(),
|
114 |
'nickname' => Mage::helper('fpstorepickup')->getNickname(),
|
115 |
'phone_number' => Mage::helper('fpstorepickup')->getPhoneNumber(),
|
|
|
116 |
'email' => $order->getCustomerEmail(),
|
117 |
);
|
118 |
$point = Mage::getSingleton('fpstorepickup/points')->getPoint($pointId);
|
@@ -291,5 +329,24 @@ class FermoPoint_StorePickup_Model_Observer
|
|
291 |
->save()
|
292 |
;
|
293 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
|
295 |
}
|
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();
|
36 |
if ( ! $point->getId())
|
37 |
return $this->_returnError($controller, Mage::helper('fpstorepickup')->__('Unknown Fermo!Point ID'));
|
38 |
|
39 |
+
$accountType = $request->getPost('fermopoint_account', 'new');
|
40 |
+
$config = Mage::helper('fpstorepickup/config');
|
41 |
+
if ($accountType == 'guest' && $config->getGuestEnabled())
|
42 |
+
{
|
43 |
+
$isGuest = true;
|
44 |
+
$accountType = 'existing';
|
45 |
+
$request->setPost('fermopoint_account', $accountType);
|
46 |
+
$nickname = $config->getGuestNickname();
|
47 |
+
$request->setPost('fermopoint_nickname', $nickname);
|
48 |
+
$dob = $config->getGuestDob();
|
49 |
+
$request->setPost('fermopoint_dob', $dob);
|
50 |
+
}
|
51 |
+
else
|
52 |
+
{
|
53 |
+
$isGuest = false;
|
54 |
+
$nickname = trim($request->getPost('fermopoint_nickname', ''));
|
55 |
+
if (empty($nickname))
|
56 |
+
return $this->_returnError($controller, Mage::helper('fpstorepickup')->__('Invalid Nickname'));
|
57 |
+
|
58 |
+
$dob = trim($request->getPost('fermopoint_dob', ''));
|
59 |
+
if (empty($dob))
|
60 |
+
return $this->_returnError($controller, Mage::helper('fpstorepickup')->__('Invalid Date of Birth'));
|
61 |
+
|
62 |
+
$dob = Mage::helper('fpstorepickup')->convertDate($dob);
|
63 |
+
if (empty($dob))
|
64 |
+
return $this->_returnError($controller, Mage::helper('fpstorepickup')->__('Invalid Date of Birth'));
|
65 |
+
|
66 |
+
$request->setPost('fermopoint_dob', $dob);
|
67 |
+
}
|
68 |
|
69 |
+
$api = Mage::getSingleton('fpstorepickup/api');
|
70 |
+
switch ($accountType)
|
71 |
{
|
72 |
case 'existing':
|
73 |
+
if ($isGuest)
|
74 |
+
{
|
75 |
+
if ( ! $api->isGuestNicknameAndDobMatch($nickname, $dob))
|
76 |
+
return $this->_returnError($controller, Mage::helper('fpstorepickup')->__('There is no user with given nickname and date of birth'));
|
77 |
+
}
|
78 |
+
else
|
79 |
+
{
|
80 |
+
if ( ! $api->isNicknameAndDobMatch($nickname, $dob))
|
81 |
+
return $this->_returnError($controller, Mage::helper('fpstorepickup')->__('There is no user with given nickname and date of birth'));
|
82 |
+
}
|
83 |
break;
|
84 |
|
85 |
case 'new':
|
112 |
Mage::helper('fpstorepickup')->setNickname(trim($request->getPost('fermopoint_nickname')));
|
113 |
Mage::helper('fpstorepickup')->setAccountType(trim($request->getPost('fermopoint_account')));
|
114 |
Mage::helper('fpstorepickup')->setPhoneNumber(trim($request->getPost('fermopoint_phone')));
|
115 |
+
Mage::helper('fpstorepickup')->setDob(trim($request->getPost('fermopoint_dob')));
|
116 |
|
117 |
$point = Mage::getSingleton('fpstorepickup/points')->getPoint($pointId);
|
118 |
if ($point->getId())
|
150 |
'account_type' => Mage::helper('fpstorepickup')->getAccountType(),
|
151 |
'nickname' => Mage::helper('fpstorepickup')->getNickname(),
|
152 |
'phone_number' => Mage::helper('fpstorepickup')->getPhoneNumber(),
|
153 |
+
'dob' => Mage::helper('fpstorepickup')->getDob(),
|
154 |
'email' => $order->getCustomerEmail(),
|
155 |
);
|
156 |
$point = Mage::getSingleton('fpstorepickup/points')->getPoint($pointId);
|
329 |
->save()
|
330 |
;
|
331 |
}
|
332 |
+
|
333 |
+
public function onSystemConfigSaveAfter($observer)
|
334 |
+
{
|
335 |
+
$section = $observer->getEvent()->getSection();
|
336 |
+
if ($section != 'carriers')
|
337 |
+
return;
|
338 |
+
|
339 |
+
$config = Mage::helper('fpstorepickup/config');
|
340 |
+
if ( ! $config->getGuestEnabled())
|
341 |
+
return;
|
342 |
+
|
343 |
+
$api = Mage::getSingleton('fpstorepickup/api');
|
344 |
+
if ($api->isGuestNicknameAndDobMatch($config->getGuestNickname(), $config->getGuestDob()))
|
345 |
+
return;
|
346 |
+
|
347 |
+
$session = Mage::getSingleton('adminhtml/session');
|
348 |
+
$session->addError(Mage::helper('fpstorepickup')->__('Nickname and date of birth do not match!'));
|
349 |
+
$config->resetGuestEnabled();
|
350 |
+
}
|
351 |
|
352 |
}
|
app/code/community/FermoPoint/StorePickup/controllers/ValidateController.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class FermoPoint_StorePickup_ValidateController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
public function nicknameAction()
|
7 |
+
{
|
8 |
+
$nickname = $this->getRequest()->getPost('nickname', '');
|
9 |
+
$api = Mage::getSingleton('fpstorepickup/api');
|
10 |
+
if ( ! empty($nickname))
|
11 |
+
$result = $api->isNicknameAvailable($nickname) ? 'ok' : 'error';
|
12 |
+
else
|
13 |
+
$result = 'ok';
|
14 |
+
|
15 |
+
$this->getResponse()->setBody($result);
|
16 |
+
}
|
17 |
+
|
18 |
+
public function dobAction()
|
19 |
+
{
|
20 |
+
$nickname = $this->getRequest()->getPost('nickname', '');
|
21 |
+
$dob = $this->getRequest()->getPost('dob', '');
|
22 |
+
$dob = Mage::helper('fpstorepickup')->convertDate($dob);
|
23 |
+
$api = Mage::getSingleton('fpstorepickup/api');
|
24 |
+
if ( ! empty($nickname) && ! empty($dob))
|
25 |
+
$result = $api->isNicknameAndDobMatch($nickname, $dob) ? 'ok' : 'error';
|
26 |
+
else
|
27 |
+
$result = 'ok';
|
28 |
+
|
29 |
+
$this->getResponse()->setBody($result);
|
30 |
+
}
|
31 |
+
|
32 |
+
}
|
app/code/community/FermoPoint/StorePickup/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<FermoPoint_StorePickup>
|
5 |
-
<version>1.1.
|
6 |
</FermoPoint_StorePickup>
|
7 |
</modules>
|
8 |
<global>
|
@@ -197,6 +197,16 @@
|
|
197 |
</fpstorepickup>
|
198 |
</updates>
|
199 |
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
</adminhtml>
|
201 |
<default>
|
202 |
<carriers>
|
@@ -208,6 +218,7 @@
|
|
208 |
<auto_ship>1</auto_ship>
|
209 |
<sandbox>1</sandbox>
|
210 |
<debug>1</debug>
|
|
|
211 |
<cost>0</cost>
|
212 |
<maximum_subtotal>500</maximum_subtotal>
|
213 |
<maximum_weight>15</maximum_weight>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<FermoPoint_StorePickup>
|
5 |
+
<version>1.1.2</version>
|
6 |
</FermoPoint_StorePickup>
|
7 |
</modules>
|
8 |
<global>
|
197 |
</fpstorepickup>
|
198 |
</updates>
|
199 |
</layout>
|
200 |
+
<events>
|
201 |
+
<admin_system_config_section_save_after>
|
202 |
+
<observers>
|
203 |
+
<fermopoint_storepickup_observer>
|
204 |
+
<class>fpstorepickup/observer</class>
|
205 |
+
<method>onSystemConfigSaveAfter</method>
|
206 |
+
</fermopoint_storepickup_observer>
|
207 |
+
</observers>
|
208 |
+
</admin_system_config_section_save_after>
|
209 |
+
</events>
|
210 |
</adminhtml>
|
211 |
<default>
|
212 |
<carriers>
|
218 |
<auto_ship>1</auto_ship>
|
219 |
<sandbox>1</sandbox>
|
220 |
<debug>1</debug>
|
221 |
+
<guest>0</guest>
|
222 |
<cost>0</cost>
|
223 |
<maximum_subtotal>500</maximum_subtotal>
|
224 |
<maximum_weight>15</maximum_weight>
|
app/code/community/FermoPoint/StorePickup/etc/jstranslator.xml
CHANGED
@@ -24,4 +24,10 @@
|
|
24 |
<fermopoint-hours translate="message" module="fpstorepickup">
|
25 |
<message>Hours</message>
|
26 |
</fermopoint-hours>
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
</jstranslator>
|
24 |
<fermopoint-hours translate="message" module="fpstorepickup">
|
25 |
<message>Hours</message>
|
26 |
</fermopoint-hours>
|
27 |
+
<fermopoint-nickname-exists translate="message" module="fpstorepickup">
|
28 |
+
<message>User with this nickname already exists</message>
|
29 |
+
</fermopoint-nickname-exists>
|
30 |
+
<fermopoint-combo-mismatch translate="message" module="fpstorepickup">
|
31 |
+
<message>There is no user with given nickname and date of birth</message>
|
32 |
+
</fermopoint-combo-mismatch>
|
33 |
</jstranslator>
|
app/code/community/FermoPoint/StorePickup/etc/system.xml
CHANGED
@@ -101,6 +101,37 @@
|
|
101 |
<comment>Create shipments automatically after invoicing</comment>
|
102 |
</auto_ship>
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
<cost translate="label">
|
105 |
<label>Cost</label>
|
106 |
<frontend_type>text</frontend_type>
|
101 |
<comment>Create shipments automatically after invoicing</comment>
|
102 |
</auto_ship>
|
103 |
|
104 |
+
<guest translate="label">
|
105 |
+
<label>Enable Guest</label>
|
106 |
+
<frontend_type>select</frontend_type>
|
107 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
108 |
+
<sort_order>25</sort_order>
|
109 |
+
<show_in_default>1</show_in_default>
|
110 |
+
<show_in_website>1</show_in_website>
|
111 |
+
<show_in_store>0</show_in_store>
|
112 |
+
<depends><accept>1</accept></depends>
|
113 |
+
</guest>
|
114 |
+
|
115 |
+
<guest_nickname translate="label">
|
116 |
+
<label>Guest Nickname</label>
|
117 |
+
<frontend_type>text</frontend_type>
|
118 |
+
<sort_order>26</sort_order>
|
119 |
+
<show_in_default>1</show_in_default>
|
120 |
+
<show_in_website>1</show_in_website>
|
121 |
+
<show_in_store>0</show_in_store>
|
122 |
+
<depends><accept>1</accept></depends>
|
123 |
+
</guest_nickname>
|
124 |
+
<guest_dob translate="label comment">
|
125 |
+
<label>Guest Date of Birth</label>
|
126 |
+
<comment>YYYY-MM-DD</comment>
|
127 |
+
<frontend_type>text</frontend_type>
|
128 |
+
<sort_order>27</sort_order>
|
129 |
+
<show_in_default>1</show_in_default>
|
130 |
+
<show_in_website>1</show_in_website>
|
131 |
+
<show_in_store>0</show_in_store>
|
132 |
+
<depends><accept>1</accept></depends>
|
133 |
+
</guest_dob>
|
134 |
+
|
135 |
<cost translate="label">
|
136 |
<label>Cost</label>
|
137 |
<frontend_type>text</frontend_type>
|
app/code/community/FermoPoint/StorePickup/sql/fpstorepickup_setup/mysql4-upgrade-1.1.1-1.1.2.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
ALTER TABLE `{$installer->getTable('fpstorepickup/order_point')}`
|
9 |
+
ADD COLUMN `dob` DATE NULL DEFAULT NULL AFTER nickname
|
10 |
+
;
|
11 |
+
");
|
12 |
+
|
13 |
+
$installer->endSetup();
|
app/design/frontend/base/default/layout/fpstorepickup.xml
CHANGED
@@ -6,6 +6,10 @@
|
|
6 |
<action method="addJs"><script>fermopoint/markerclusterer.js</script></action>
|
7 |
<action method="addJs"><script>fermopoint/storepickup.js</script></action>
|
8 |
<action method="addItem"><type>skin_css</type><name>fermopoint/css/storepickup.css</name></action>
|
|
|
|
|
|
|
|
|
9 |
</reference>
|
10 |
<!--reference name="checkout.onepage.billing">
|
11 |
<action method="setTemplate"><template>fpstorepickup/checkout/onepage/billing.phtml</template></action>
|
6 |
<action method="addJs"><script>fermopoint/markerclusterer.js</script></action>
|
7 |
<action method="addJs"><script>fermopoint/storepickup.js</script></action>
|
8 |
<action method="addItem"><type>skin_css</type><name>fermopoint/css/storepickup.css</name></action>
|
9 |
+
<action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/><!--<if/><condition>can_load_calendar_js</condition>--></action>
|
10 |
+
<action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></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 |
<!--reference name="checkout.onepage.billing">
|
15 |
<action method="setTemplate"><template>fpstorepickup/checkout/onepage/billing.phtml</template></action>
|
app/design/frontend/base/default/template/fpstorepickup/map.phtml
CHANGED
@@ -32,20 +32,37 @@
|
|
32 |
<p id="fermopoint_point_address"></p>
|
33 |
<ul class="form-list">
|
34 |
<li class="control">
|
35 |
-
<input type="radio" name="fermopoint_account" id="fermopoint_account:new" value="new" title="<?php echo $this->__('I did not use Fermo!Point before') ?>" onclick="$$('.fermopoint-new-account').each(function (el) {el.show()});$$('.fermopoint-existing-account').each(function (el) {el.hide()});" checked="checked" class="radio" /><label for="fermopoint_account:new"><?php echo $this->__('I did not use Fermo!Point before') ?></label></li>
|
36 |
</li>
|
37 |
<li class="control">
|
38 |
-
<input type="radio" name="fermopoint_account" id="fermopoint_account:existing" value="existing" title="<?php echo $this->__('I have used Fermo!Point in the past') ?>" onclick="$$('.fermopoint-new-account').each(function (el) {el.hide()});$$('.fermopoint-existing-account').each(function (el) {el.show()});" class="radio" /><label for="fermopoint_account:existing"><?php echo $this->__('I have used Fermo!Point in the past') ?></label></li>
|
39 |
</li>
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
41 |
<div class="field">
|
42 |
<label for="fermopoint_nickname" class="required"><em>*</em><?php echo $this->__('Nickname') ?></label>
|
43 |
<label for="fermopoint_nickname" class="nick info fermopoint-existing-account" style="display:none;">(<?php echo $this->__('Please enter your Nickname. The nickname will be required at the time of withdrawal of the package') ?>)</label>
|
44 |
<label for="fermopoint_nickname" class="nick info fermopoint-new-account">(<?php echo $this->__('Choose and enter your nickname. The nickname will be required at the time of withdrawal of the package') ?>)</label>
|
45 |
<div class="input-box">
|
46 |
<input type="text" name="fermopoint_nickname" id="fermopoint_nickname" title="<?php echo $this->__('Nickname') ?>" class="input-text required-entry" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
</div>
|
48 |
</div>
|
|
|
|
|
49 |
<div class="field">
|
50 |
<label for="fermopoint_phone"><?php echo $this->__('Mobile phone') ?></label>
|
51 |
<label for="fermopoint_phone" class="phone info">(<?php echo $this->__('Enter your cell phone number for delivery') ?>)</label>
|
@@ -55,24 +72,33 @@
|
|
55 |
</div>
|
56 |
</li>
|
57 |
</ul>
|
58 |
-
<
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
</p>
|
74 |
</div>
|
75 |
-
<?php endif ?>
|
76 |
</div>
|
77 |
</div>
|
78 |
<script type="text/javascript">
|
@@ -104,6 +130,15 @@
|
|
104 |
//+ ' ' + point.country_id
|
105 |
;
|
106 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
|
108 |
Event.observe('fermopoint_search', 'click', function (event) {
|
109 |
event.preventDefault();
|
@@ -114,5 +149,14 @@
|
|
114 |
|
115 |
fpStorePickup.search($('fermopoint_search_address').value, $('fermopoint_search_radius').value);
|
116 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
//]]>
|
118 |
</script>
|
32 |
<p id="fermopoint_point_address"></p>
|
33 |
<ul class="form-list">
|
34 |
<li class="control">
|
35 |
+
<input type="radio" name="fermopoint_account" id="fermopoint_account:new" value="new" title="<?php echo $this->__('I did not use Fermo!Point before') ?>" onclick="$$('.fermopoint-new-account, .fermopoint-account').each(function (el) {el.show()});$$('.fermopoint-existing-account,.fermopoint-guest').each(function (el) {el.hide()});" checked="checked" class="radio" /><label for="fermopoint_account:new"><?php echo $this->__('I did not use Fermo!Point before') ?></label></li>
|
36 |
</li>
|
37 |
<li class="control">
|
38 |
+
<input type="radio" name="fermopoint_account" id="fermopoint_account:existing" value="existing" title="<?php echo $this->__('I have used Fermo!Point in the past') ?>" onclick="$$('.fermopoint-new-account,.fermopoint-guest').each(function (el) {el.hide()});$$('.fermopoint-existing-account,.fermopoint-account').each(function (el) {el.show()});" class="radio" /><label for="fermopoint_account:existing"><?php echo $this->__('I have used Fermo!Point in the past') ?></label></li>
|
39 |
</li>
|
40 |
+
<?php if (Mage::helper('fpstorepickup/config')->getGuestEnabled()) : ?>
|
41 |
+
<li class="control">
|
42 |
+
<input type="radio" name="fermopoint_account" id="fermopoint_account:guest" value="guest" title="<?php echo $this->__('Check out as guest') ?>" onclick="$$('.fermopoint-new-account,.fermopoint-account').each(function (el) {el.hide()});$$('.fermopoint-existing-account,.fermopoint-guest').each(function (el) {el.show()});" class="radio" /><label for="fermopoint_account:guest"><?php echo $this->__('Delivery as HOST of %s. You will use the service without any registration.', Mage::app()->getStore()->getFrontendName()) ?></label></li>
|
43 |
+
</li>
|
44 |
+
<?php endif ?>
|
45 |
+
<li class="fields fermopoint-account">
|
46 |
<div class="field">
|
47 |
<label for="fermopoint_nickname" class="required"><em>*</em><?php echo $this->__('Nickname') ?></label>
|
48 |
<label for="fermopoint_nickname" class="nick info fermopoint-existing-account" style="display:none;">(<?php echo $this->__('Please enter your Nickname. The nickname will be required at the time of withdrawal of the package') ?>)</label>
|
49 |
<label for="fermopoint_nickname" class="nick info fermopoint-new-account">(<?php echo $this->__('Choose and enter your nickname. The nickname will be required at the time of withdrawal of the package') ?>)</label>
|
50 |
<div class="input-box">
|
51 |
<input type="text" name="fermopoint_nickname" id="fermopoint_nickname" title="<?php echo $this->__('Nickname') ?>" class="input-text required-entry" />
|
52 |
+
<img class="ajax-validate" src="<?php echo $this->getSkinUrl('fermopoint/images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading') ?>" />
|
53 |
+
</div>
|
54 |
+
</div>
|
55 |
+
<div class="field">
|
56 |
+
<label for="fermopoint_dob" class="required"><em>*</em><?php echo $this->__('Date of Birth') ?></label>
|
57 |
+
<label for="fermopoint_dob" class="dob info">(<?php echo $this->__('Enter your birth date') ?>)</label>
|
58 |
+
<div class="input-box">
|
59 |
+
<input type="text" name="fermopoint_dob" id="fermopoint_dob" title="<?php echo $this->__('Date of Birth') ?>" value="<?php echo $this->escapeHtml($this->getUserDob()) ?>" class="input-text required-entry" />
|
60 |
+
<img class="ajax-validate" src="<?php echo $this->getSkinUrl('fermopoint/images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading') ?>" />
|
61 |
+
<img style="" title="Select Date" id="fermopoint_dob_trig" class="v-middle" alt="" src="<?php echo $this->getSkinUrl("images/calendar.gif");?> "/>
|
62 |
</div>
|
63 |
</div>
|
64 |
+
</li>
|
65 |
+
<li class="fields">
|
66 |
<div class="field">
|
67 |
<label for="fermopoint_phone"><?php echo $this->__('Mobile phone') ?></label>
|
68 |
<label for="fermopoint_phone" class="phone info">(<?php echo $this->__('Enter your cell phone number for delivery') ?>)</label>
|
72 |
</div>
|
73 |
</li>
|
74 |
</ul>
|
75 |
+
<div class="fermopoint-account">
|
76 |
+
<p class="fermopoint-new-account">
|
77 |
+
<?php echo $this->__('The billing information will be disclosed to Fermo!Point to register the new account and the user will be used in the future on any other site that integrates eCommerce service Fermo!Point') ?>
|
78 |
+
</p>
|
79 |
+
<p class="fermopoint-new-account">
|
80 |
+
<?php echo $this->__('To the email address specified in the billing information <b>%s</ b> will receive an email with your login credentials to the portal Fermo!Point', $this->htmlEscape($this->getUserEmail())) ?>
|
81 |
+
</p>
|
82 |
+
|
83 |
+
|
84 |
+
<?php if ( ! empty($tosUrl)) : ?>
|
85 |
+
<div id="fermopoint_conditions" class="fermopoint-new-account">
|
86 |
+
<iframe src="<?php echo $tosUrl ?>">
|
87 |
+
<p><?php echo $this->__('Your browser does not support iframes.') ?></p>
|
88 |
+
</iframe>
|
89 |
+
<div style="clear: both"></div>
|
90 |
+
<p class="checkbox">
|
91 |
+
<input type="checkbox" name="fermopoint_accept_terms" id="fermopoint_accept_terms" value="1" autocomplete="off" class="required-entry" />
|
92 |
+
<label for="fermopoint_accept_terms"><?php echo $this->__('I accept Fermo!Point terms and conditions') ?></label>
|
93 |
+
</p>
|
94 |
+
</div>
|
95 |
+
<?php endif ?>
|
96 |
+
</div>
|
97 |
+
<div class="fermopoint-guest" style="display: none;">
|
98 |
+
<p class="guest-account" style="display: none;">
|
99 |
+
<?php echo $this->__('You will check out as guest.') ?>
|
100 |
</p>
|
101 |
</div>
|
|
|
102 |
</div>
|
103 |
</div>
|
104 |
<script type="text/javascript">
|
130 |
//+ ' ' + point.country_id
|
131 |
;
|
132 |
};
|
133 |
+
fpStorePickup.bindValidations(
|
134 |
+
$('fermopoint_account:new'),
|
135 |
+
$('fermopoint_account:existing'),
|
136 |
+
$('fermopoint_account:guest'),
|
137 |
+
$('fermopoint_nickname'),
|
138 |
+
$('fermopoint_dob'),
|
139 |
+
'<?php echo Mage::helper('fpstorepickup')->getValidateNicknameUrl() ?>',
|
140 |
+
'<?php echo Mage::helper('fpstorepickup')->getValidateDobUrl() ?>'
|
141 |
+
);
|
142 |
|
143 |
Event.observe('fermopoint_search', 'click', function (event) {
|
144 |
event.preventDefault();
|
149 |
|
150 |
fpStorePickup.search($('fermopoint_search_address').value, $('fermopoint_search_radius').value);
|
151 |
});
|
152 |
+
|
153 |
+
Calendar.setup({
|
154 |
+
inputField: "fermopoint_dob",
|
155 |
+
ifFormat: "<?php echo Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT) ?>",
|
156 |
+
showsTime: false,
|
157 |
+
button: "fermopoint_dob_trig",
|
158 |
+
align: "Bl",
|
159 |
+
singleClick : true
|
160 |
+
});
|
161 |
//]]>
|
162 |
</script>
|
app/locale/it_IT/FermoPoint_StorePickup.csv
CHANGED
@@ -52,4 +52,6 @@ All Orders,Tutte le Transazioni
|
|
52 |
"The billing information will be disclosed to Fermo!Point to register the new account and the user will be used in the future on any other site that integrates eCommerce service Fermo!Point","I dati di fatturazione saranno comunicati a Fermo!Point per la registrazione del nuovo account e l'utenza potrà essere utilizzata in futuro su qualsiasi altro sito eCommerce che integra il servizio Fermo!Point"
|
53 |
"To the email address specified in the billing information <b>%s</ b> will receive an email with your login credentials to the portal Fermo!Point","All’indirizzo email specificato nei dati di fatturazione <b>%s</b> riceverete un’email con le credenziali di accesso al portale Fermo!Point"
|
54 |
"Auto Ship","Spedizione automatica"
|
55 |
-
"Create shipments automatically after invoicing","Crea automaticamente la spedizione a seguito della fatturazione"
|
|
|
|
52 |
"The billing information will be disclosed to Fermo!Point to register the new account and the user will be used in the future on any other site that integrates eCommerce service Fermo!Point","I dati di fatturazione saranno comunicati a Fermo!Point per la registrazione del nuovo account e l'utenza potrà essere utilizzata in futuro su qualsiasi altro sito eCommerce che integra il servizio Fermo!Point"
|
53 |
"To the email address specified in the billing information <b>%s</ b> will receive an email with your login credentials to the portal Fermo!Point","All’indirizzo email specificato nei dati di fatturazione <b>%s</b> riceverete un’email con le credenziali di accesso al portale Fermo!Point"
|
54 |
"Auto Ship","Spedizione automatica"
|
55 |
+
"Create shipments automatically after invoicing","Crea automaticamente la spedizione a seguito della fatturazione"
|
56 |
+
"Delivery as HOST of %s. You will use the service without any registration.","Prenota la consegna come ospite di %s. Utilizzerai il servizio senza doverti registrare."
|
57 |
+
"There is no user with given nickname and date of birth","La coppia nickname / data di nascita non sembra essere corretta"
|
js/fermopoint/storepickup.js
CHANGED
@@ -22,6 +22,101 @@ FermopointStorePickup.prototype = {
|
|
22 |
this.setUpHook();
|
23 |
},
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
setUpHook: function () {
|
26 |
var fallbackValidate = ShippingMethod.prototype.validate,
|
27 |
fallbackNextStep = ShippingMethod.prototype.nextStep;
|
22 |
this.setUpHook();
|
23 |
},
|
24 |
|
25 |
+
clearValidations: function (input) {
|
26 |
+
},
|
27 |
+
|
28 |
+
onAccountTypeChange: function (event, target) {
|
29 |
+
if (this.nickname.value.length)
|
30 |
+
Validation.validate(this.nickname);
|
31 |
+
if (this.dob.value.length)
|
32 |
+
Validation.validate(this.dob);
|
33 |
+
},
|
34 |
+
|
35 |
+
onNicknameChange: function (event, target) {
|
36 |
+
Validation.validate(this.nickname);
|
37 |
+
if (this.dob.value.length)
|
38 |
+
Validation.validate(this.dob);
|
39 |
+
},
|
40 |
+
|
41 |
+
onDobChange: function (event, target) {
|
42 |
+
Validation.validate(this.dob);
|
43 |
+
},
|
44 |
+
|
45 |
+
validateNickname: function (v) {
|
46 |
+
var result,
|
47 |
+
self = this;
|
48 |
+
if ( ! v.length || ! this.newAccount.checked)
|
49 |
+
return true;
|
50 |
+
|
51 |
+
result = true;
|
52 |
+
this.nickname.up('.input-box').addClassName('loading');
|
53 |
+
new Ajax.Request(this.nicknameUrl, {
|
54 |
+
method: 'post',
|
55 |
+
parameters: {
|
56 |
+
nickname: v
|
57 |
+
},
|
58 |
+
asynchronous: false,
|
59 |
+
onSuccess: function (transport) {
|
60 |
+
var response = transport.responseText;
|
61 |
+
|
62 |
+
result = response === 'ok';
|
63 |
+
},
|
64 |
+
onComplete: function() {
|
65 |
+
self.nickname.up('.input-box').removeClassName('loading');
|
66 |
+
}
|
67 |
+
});
|
68 |
+
|
69 |
+
return result;
|
70 |
+
},
|
71 |
+
|
72 |
+
validateDob: function (v) {
|
73 |
+
var result,
|
74 |
+
self = this;
|
75 |
+
if ( ! v.length || ! this.existingAccount.checked || ! this.nickname.value.length)
|
76 |
+
return true;
|
77 |
+
|
78 |
+
result = true;
|
79 |
+
this.dob.up('.input-box').addClassName('loading');
|
80 |
+
new Ajax.Request(this.dobUrl, {
|
81 |
+
method: 'post',
|
82 |
+
parameters: {
|
83 |
+
nickname: this.nickname.value,
|
84 |
+
dob: v
|
85 |
+
},
|
86 |
+
asynchronous: false,
|
87 |
+
onSuccess: function (transport) {
|
88 |
+
var response = transport.responseText;
|
89 |
+
|
90 |
+
result = response === 'ok';
|
91 |
+
},
|
92 |
+
onComplete: function() {
|
93 |
+
self.dob.up('.input-box').removeClassName('loading');
|
94 |
+
}
|
95 |
+
});
|
96 |
+
|
97 |
+
return result;
|
98 |
+
},
|
99 |
+
|
100 |
+
bindValidations: function (newAccount, existingAccount, guestAccount, nickname, dob, nicknameUrl, dobUrl) {
|
101 |
+
this.newAccount = newAccount;
|
102 |
+
this.existingAccount = existingAccount;
|
103 |
+
this.guestAccount = guestAccount;
|
104 |
+
this.nickname = nickname;
|
105 |
+
this.dob = dob;
|
106 |
+
this.nicknameUrl = nicknameUrl;
|
107 |
+
this.dobUrl = dobUrl;
|
108 |
+
|
109 |
+
newAccount.on('change', this.onAccountTypeChange.bind(this));
|
110 |
+
existingAccount.on('change', this.onAccountTypeChange.bind(this));
|
111 |
+
guestAccount.on('change', this.onAccountTypeChange.bind(this));
|
112 |
+
|
113 |
+
Validation.add('validate-fp-nickname', 'User with this nickname already exists', this.validateNickname.bind(this));
|
114 |
+
Validation.add('validate-fp-dob', 'There is no user with given nickname and date of birth', this.validateDob.bind(this));
|
115 |
+
|
116 |
+
nickname.addClassName('validate-fp-nickname').on('change', this.onNicknameChange.bind(this));
|
117 |
+
dob.addClassName('validate-fp-dob').on('change', this.onDobChange.bind(this));
|
118 |
+
},
|
119 |
+
|
120 |
setUpHook: function () {
|
121 |
var fallbackValidate = ShippingMethod.prototype.validate,
|
122 |
fallbackNextStep = ShippingMethod.prototype.nextStep;
|
package.xml
CHANGED
@@ -1,18 +1,19 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>fermopoint</name>
|
4 |
-
<version>1.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-07-
|
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="dc6592a6ed82b51a6eb8e44272a6248d"/></dir></dir></dir></dir><file name="Map.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.1.2</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>+ Update to API 1.1
|
12 |
+
+ Add guest functionality</notes>
|
13 |
<authors><author><name>Fermo!Point</name><user>fermopoint</user><email>support@fermopoint.it</email></author></authors>
|
14 |
+
<date>2015-07-30</date>
|
15 |
+
<time>07:49:36</time>
|
16 |
+
<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="dc6592a6ed82b51a6eb8e44272a6248d"/></dir></dir></dir></dir><file name="Map.php" hash="c0b53051dea83ee529486d44122e4256"/></dir><dir name="Helper"><file name="Config.php" hash="976bccea81cde416e6c7ccdecbc174ee"/><file name="Data.php" hash="465427bda9f839f28a86e79218d2e3ee"/></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="9074db5a092606cacc204c189b974233"/><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="1f6fc498579162f1b7d1ff8126b6602d"/><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="ae0c1a887620172c4ada8b63c4989d26"/></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="81b42a465c90ad88a6a68042d74de09a"/></dir></dir></dir></dir><file name="map.phtml" hash="17ca1b83deda0163483674a63ed34987"/></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="markerclusterer.js" hash="b623ac6d39ea8ed99d179db49b7b0bab"/><file name="storepickup.js" hash="1afe5a0a6f425962227f53a1c5969815"/></dir></dir></target><target name="magelocale"><dir name="it_IT"><file name="FermoPoint_StorePickup.csv" hash="3fe8490d1a1f5a7d3a7ed81a5f9cfc42"/></dir></target><target name="magemedia"><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></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="fermopoint"><dir name="css"><file name="storepickup.css" hash="399a835ac06524de3a6817c7ba77dd0d"/></dir><dir name="images"><file name="opc-ajax-loader.gif" hash="e805ea7eca1f34c75ba0f93780d32d38"/></dir></dir></dir></dir></dir></target></contents>
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
19 |
</package>
|
skin/frontend/base/default/fermopoint/css/storepickup.css
CHANGED
@@ -81,5 +81,12 @@
|
|
81 |
width: 40px;
|
82 |
}
|
83 |
|
84 |
-
#fermopoint_point .nick.info,
|
|
|
|
|
85 |
|
|
|
|
|
|
|
|
|
|
81 |
width: 40px;
|
82 |
}
|
83 |
|
84 |
+
#fermopoint_point .nick.info,
|
85 |
+
#fermopoint_point .dob.info,
|
86 |
+
#fermopoint_point .phone.info { display: block; font-size: 12px; color: #6B749A; }
|
87 |
|
88 |
+
#fermopoint_dob_trig {display: inline-block; }
|
89 |
+
|
90 |
+
|
91 |
+
.input-box .ajax-validate {display: none;}
|
92 |
+
.input-box.loading .ajax-validate {display: inline; position: relative; left: -25px;}
|