Webcreta_UserandMobile - Version 0.1.0

Version Notes

Fixed minor bugs

Download this release

Release Info

Developer WebCreta
Extension Webcreta_UserandMobile
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

Files changed (29) hide show
  1. app/code/community/Webcreta/UserandMobile/Helper/Data.php +7 -0
  2. app/code/community/Webcreta/UserandMobile/Model/Checkout/Type/Onepage.php +941 -0
  3. app/code/community/Webcreta/UserandMobile/controllers/Adminhtml/CustomerController.php +237 -0
  4. app/code/community/Webcreta/UserandMobile/controllers/Checkout/OnepageController.php +660 -0
  5. app/code/community/Webcreta/UserandMobile/controllers/Customer/AccountController.php +265 -0
  6. app/code/community/Webcreta/UserandMobile/etc/adminhtml.xml +23 -0
  7. app/code/community/Webcreta/UserandMobile/etc/config.xml +122 -0
  8. app/code/community/Webcreta/UserandMobile/etc/system.xml +42 -0
  9. app/code/community/Webcreta/UserandMobile/sql/userandmobile_setup/install-1.0.1.php +64 -0
  10. app/design/frontend/base/default/layout/userandmobile.xml +28 -0
  11. app/design/frontend/base/default/template/userandmobile/checkout/onepage/billing.phtml +207 -0
  12. app/design/frontend/base/default/template/userandmobile/checkout/onepage/login.phtml +123 -0
  13. app/design/frontend/base/default/template/userandmobile/edit.phtml +90 -0
  14. app/design/frontend/base/default/template/userandmobile/login.phtml +70 -0
  15. app/design/frontend/base/default/template/userandmobile/register.phtml +161 -0
  16. app/design/frontend/default/default/layout/userandmobile.xml +28 -0
  17. app/design/frontend/default/default/template/userandmobile/checkout/onepage/billing.phtml +207 -0
  18. app/design/frontend/default/default/template/userandmobile/checkout/onepage/login.phtml +123 -0
  19. app/design/frontend/default/default/template/userandmobile/edit.phtml +90 -0
  20. app/design/frontend/default/default/template/userandmobile/login.phtml +70 -0
  21. app/design/frontend/default/default/template/userandmobile/register.phtml +161 -0
  22. app/design/frontend/rwd/default/layout/userandmobile.xml +28 -0
  23. app/design/frontend/rwd/default/template/userandmobile/checkout/onepage/billing.phtml +207 -0
  24. app/design/frontend/rwd/default/template/userandmobile/checkout/onepage/login.phtml +123 -0
  25. app/design/frontend/rwd/default/template/userandmobile/edit.phtml +90 -0
  26. app/design/frontend/rwd/default/template/userandmobile/login.phtml +70 -0
  27. app/design/frontend/rwd/default/template/userandmobile/register.phtml +161 -0
  28. app/etc/modules/Webcreta_UserandMobile.xml +10 -0
  29. package.xml +18 -0
app/code/community/Webcreta/UserandMobile/Helper/Data.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Webcreta_UserandMobile_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
7
+
app/code/community/Webcreta/UserandMobile/Model/Checkout/Type/Onepage.php ADDED
@@ -0,0 +1,941 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Webcreta_UserandMobile_Model_Checkout_Type_Onepage
4
+ {
5
+ /**
6
+ * Checkout types: Checkout as Guest, Register, Logged In Customer
7
+ */
8
+ const METHOD_GUEST = 'guest';
9
+ const METHOD_REGISTER = 'register';
10
+ const METHOD_CUSTOMER = 'customer';
11
+
12
+ /**
13
+ * Error message of "customer already exists"
14
+ *
15
+ * @var string
16
+ */
17
+ private $_customerEmailExistsMessage = '';
18
+
19
+ /**
20
+ * @var Mage_Customer_Model_Session
21
+ */
22
+ protected $_customerSession;
23
+
24
+ /**
25
+ * @var Mage_Checkout_Model_Session
26
+ */
27
+ protected $_checkoutSession;
28
+
29
+ /**
30
+ * @var Mage_Sales_Model_Quote
31
+ */
32
+ protected $_quote = null;
33
+
34
+ /**
35
+ * @var Mage_Checkout_Helper_Data
36
+ */
37
+ protected $_helper;
38
+
39
+ /**
40
+ * Class constructor
41
+ * Set customer already exists message
42
+ */
43
+ public function __construct()
44
+ {
45
+ $this->_helper = Mage::helper('checkout');
46
+ $this->_customerEmailExistsMessage = Mage::helper('checkout')->__('There is already a customer registered using this email address. Please login using this email address or enter a different email address to register your account.');
47
+ $this->_checkoutSession = Mage::getSingleton('checkout/session');
48
+ $this->_customerSession = Mage::getSingleton('customer/session');
49
+ }
50
+
51
+ /**
52
+ * Get frontend checkout session object
53
+ *
54
+ * @return Mage_Checkout_Model_Session
55
+ */
56
+ public function getCheckout()
57
+ {
58
+ return $this->_checkoutSession;
59
+ }
60
+
61
+ /**
62
+ * Quote object getter
63
+ *
64
+ * @return Mage_Sales_Model_Quote
65
+ */
66
+ public function getQuote()
67
+ {
68
+ if ($this->_quote === null) {
69
+ return $this->_checkoutSession->getQuote();
70
+ }
71
+ return $this->_quote;
72
+ }
73
+
74
+ /**
75
+ * Declare checkout quote instance
76
+ *
77
+ * @param Mage_Sales_Model_Quote $quote
78
+ * @return Mage_Checkout_Model_Type_Onepage
79
+ */
80
+ public function setQuote(Mage_Sales_Model_Quote $quote)
81
+ {
82
+ $this->_quote = $quote;
83
+ return $this;
84
+ }
85
+
86
+ /**
87
+ * Get customer session object
88
+ *
89
+ * @return Mage_Customer_Model_Session
90
+ */
91
+ public function getCustomerSession()
92
+ {
93
+ return $this->_customerSession;
94
+ }
95
+
96
+ /**
97
+ * Initialize quote state to be valid for one page checkout
98
+ *
99
+ * @return Mage_Checkout_Model_Type_Onepage
100
+ */
101
+ public function initCheckout()
102
+ {
103
+ $checkout = $this->getCheckout();
104
+ $customerSession = $this->getCustomerSession();
105
+ if (is_array($checkout->getStepData())) {
106
+ foreach ($checkout->getStepData() as $step=>$data) {
107
+ if (!($step==='login' || $customerSession->isLoggedIn() && $step==='billing')) {
108
+ $checkout->setStepData($step, 'allow', false);
109
+ }
110
+ }
111
+ }
112
+
113
+ $quoteSave = false;
114
+ $collectTotals = false;
115
+
116
+ /**
117
+ * Reset multishipping flag before any manipulations with quote address
118
+ * addAddress method for quote object related on this flag
119
+ */
120
+ if ($this->getQuote()->getIsMultiShipping()) {
121
+ $this->getQuote()->setIsMultiShipping(false);
122
+ $quoteSave = true;
123
+ }
124
+
125
+ /**
126
+ * Reset customer balance
127
+ */
128
+ if ($this->getQuote()->getUseCustomerBalance()) {
129
+ $this->getQuote()->setUseCustomerBalance(false);
130
+ $quoteSave = true;
131
+ $collectTotals = true;
132
+ }
133
+ /**
134
+ * Reset reward points
135
+ */
136
+ if ($this->getQuote()->getUseRewardPoints()) {
137
+ $this->getQuote()->setUseRewardPoints(false);
138
+ $quoteSave = true;
139
+ $collectTotals = true;
140
+ }
141
+
142
+ if ($collectTotals) {
143
+ $this->getQuote()->collectTotals();
144
+ }
145
+
146
+ if ($quoteSave) {
147
+ $this->getQuote()->save();
148
+ }
149
+
150
+ /*
151
+ * want to load the correct customer information by assigning to address
152
+ * instead of just loading from sales/quote_address
153
+ */
154
+ $customer = $customerSession->getCustomer();
155
+ if ($customer) {
156
+ $this->getQuote()->assignCustomer($customer);
157
+ }
158
+ return $this;
159
+ }
160
+
161
+ /**
162
+ * Get quote checkout method
163
+ *
164
+ * @return string
165
+ */
166
+ public function getCheckoutMethod()
167
+ {
168
+ if ($this->getCustomerSession()->isLoggedIn()) {
169
+ return self::METHOD_CUSTOMER;
170
+ }
171
+ if (!$this->getQuote()->getCheckoutMethod()) {
172
+ if ($this->_helper->isAllowedGuestCheckout($this->getQuote())) {
173
+ $this->getQuote()->setCheckoutMethod(self::METHOD_GUEST);
174
+ } else {
175
+ $this->getQuote()->setCheckoutMethod(self::METHOD_REGISTER);
176
+ }
177
+ }
178
+ return $this->getQuote()->getCheckoutMethod();
179
+ }
180
+
181
+ /**
182
+ * Get quote checkout method
183
+ *
184
+ * @deprecated since 1.4.0.1
185
+ * @return string
186
+ */
187
+ public function getCheckoutMehod()
188
+ {
189
+ return $this->getCheckoutMethod();
190
+ }
191
+
192
+ /**
193
+ * Specify checkout method
194
+ *
195
+ * @param string $method
196
+ * @return array
197
+ */
198
+ public function saveCheckoutMethod($method)
199
+ {
200
+ if (empty($method)) {
201
+ return array('error' => -1, 'message' => Mage::helper('checkout')->__('Invalid data.'));
202
+ }
203
+
204
+ $this->getQuote()->setCheckoutMethod($method)->save();
205
+ $this->getCheckout()->setStepData('billing', 'allow', true);
206
+ return array();
207
+ }
208
+
209
+ /**
210
+ * Get customer address by identifier
211
+ *
212
+ * @param int $addressId
213
+ * @return Mage_Customer_Model_Address
214
+ */
215
+ public function getAddress($addressId)
216
+ {
217
+ $address = Mage::getModel('customer/address')->load((int)$addressId);
218
+ $address->explodeStreetAddress();
219
+ if ($address->getRegionId()) {
220
+ $address->setRegion($address->getRegionId());
221
+ }
222
+ return $address;
223
+ }
224
+
225
+ /**
226
+ * Save billing address information to quote
227
+ * This method is called by One Page Checkout JS (AJAX) while saving the billing information.
228
+ *
229
+ * @param array $data
230
+ * @param int $customerAddressId
231
+ * @return Mage_Checkout_Model_Type_Onepage
232
+ */
233
+ public function saveBilling($data, $customerAddressId)
234
+ {
235
+ if (empty($data)) {
236
+ return array('error' => -1, 'message' => Mage::helper('checkout')->__('Invalid data.'));
237
+ }
238
+
239
+ $address = $this->getQuote()->getBillingAddress();
240
+ /* @var $addressForm Mage_Customer_Model_Form */
241
+ $addressForm = Mage::getModel('customer/form');
242
+ $addressForm->setFormCode('customer_address_edit')
243
+ ->setEntityType('customer_address')
244
+ ->setIsAjaxRequest(Mage::app()->getRequest()->isAjax());
245
+
246
+ if (!empty($customerAddressId)) {
247
+ $customerAddress = Mage::getModel('customer/address')->load($customerAddressId);
248
+ if ($customerAddress->getId()) {
249
+ if ($customerAddress->getCustomerId() != $this->getQuote()->getCustomerId()) {
250
+ return array('error' => 1,
251
+ 'message' => Mage::helper('checkout')->__('Customer Address is not valid.')
252
+ );
253
+ }
254
+
255
+ $address->importCustomerAddress($customerAddress)->setSaveInAddressBook(0);
256
+ $addressForm->setEntity($address);
257
+ $addressErrors = $addressForm->validateData($address->getData());
258
+ if ($addressErrors !== true) {
259
+ return array('error' => 1, 'message' => $addressErrors);
260
+ }
261
+ }
262
+ } else {
263
+ $addressForm->setEntity($address);
264
+ // emulate request object
265
+ $addressData = $addressForm->extractData($addressForm->prepareRequest($data));
266
+ $addressErrors = $addressForm->validateData($addressData);
267
+ if ($addressErrors !== true) {
268
+ return array('error' => 1, 'message' => array_values($addressErrors));
269
+ }
270
+ $addressForm->compactData($addressData);
271
+ //unset billing address attributes which were not shown in form
272
+ foreach ($addressForm->getAttributes() as $attribute) {
273
+ if (!isset($data[$attribute->getAttributeCode()])) {
274
+ $address->setData($attribute->getAttributeCode(), NULL);
275
+ }
276
+ }
277
+ $address->setCustomerAddressId(null);
278
+ // Additional form data, not fetched by extractData (as it fetches only attributes)
279
+ $address->setSaveInAddressBook(empty($data['save_in_address_book']) ? 0 : 1);
280
+ }
281
+
282
+ // set email for newly created user
283
+ if (!$address->getEmail() && $this->getQuote()->getCustomerEmail()) {
284
+ $address->setEmail($this->getQuote()->getCustomerEmail());
285
+ }
286
+
287
+ // validate billing address
288
+ if (($validateRes = $address->validate()) !== true) {
289
+ return array('error' => 1, 'message' => $validateRes);
290
+ }
291
+
292
+ $address->implodeStreetAddress();
293
+
294
+ if (true !== ($result = $this->_validateCustomerData($data))) {
295
+ return $result;
296
+ }
297
+
298
+ if (!$this->getQuote()->getCustomerId() && self::METHOD_REGISTER == $this->getQuote()->getCheckoutMethod()) {
299
+ if ($this->_customerEmailExists($address->getEmail(), Mage::app()->getWebsite()->getId())) {
300
+ return array('error' => 1, 'message' => $this->_customerEmailExistsMessage);
301
+ }
302
+ }
303
+
304
+ if (!$this->getQuote()->isVirtual()) {
305
+ /**
306
+ * Billing address using otions
307
+ */
308
+ $usingCase = isset($data['use_for_shipping']) ? (int)$data['use_for_shipping'] : 0;
309
+
310
+ switch ($usingCase) {
311
+ case 0:
312
+ $shipping = $this->getQuote()->getShippingAddress();
313
+ $shipping->setSameAsBilling(0);
314
+ break;
315
+ case 1:
316
+ $billing = clone $address;
317
+ $billing->unsAddressId()->unsAddressType();
318
+ $shipping = $this->getQuote()->getShippingAddress();
319
+ $shippingMethod = $shipping->getShippingMethod();
320
+
321
+ // Billing address properties that must be always copied to shipping address
322
+ $requiredBillingAttributes = array('customer_address_id');
323
+
324
+ // don't reset original shipping data, if it was not changed by customer
325
+ foreach ($shipping->getData() as $shippingKey => $shippingValue) {
326
+ if (!is_null($shippingValue) && !is_null($billing->getData($shippingKey))
327
+ && !isset($data[$shippingKey]) && !in_array($shippingKey, $requiredBillingAttributes)
328
+ ) {
329
+ $billing->unsetData($shippingKey);
330
+ }
331
+ }
332
+ $shipping->addData($billing->getData())
333
+ ->setSameAsBilling(1)
334
+ ->setSaveInAddressBook(0)
335
+ ->setShippingMethod($shippingMethod)
336
+ ->setCollectShippingRates(true);
337
+ $this->getCheckout()->setStepData('shipping', 'complete', true);
338
+ $this->_setCartCouponCode();
339
+ break;
340
+ }
341
+ }
342
+
343
+ $this->getQuote()->collectTotals();
344
+ $this->getQuote()->save();
345
+
346
+ if (!$this->getQuote()->isVirtual() && $this->getCheckout()->getStepData('shipping', 'complete') == true) {
347
+ //Recollect Shipping rates for shipping methods
348
+ $this->getQuote()->getShippingAddress()->setCollectShippingRates(true);
349
+ }
350
+
351
+ $this->getCheckout()
352
+ ->setStepData('billing', 'allow', true)
353
+ ->setStepData('billing', 'complete', true)
354
+ ->setStepData('shipping', 'allow', true);
355
+
356
+ return array();
357
+ }
358
+
359
+ /**
360
+ * Validate customer data and set some its data for further usage in quote
361
+ * Will return either true or array with error messages
362
+ *
363
+ * @param array $data
364
+ * @return true|array
365
+ */
366
+ protected function _validateCustomerData(array $data)
367
+ {
368
+ /** @var $customerForm Mage_Customer_Model_Form */
369
+ $customerForm = Mage::getModel('customer/form');
370
+ $customerForm->setFormCode('checkout_register')
371
+ ->setIsAjaxRequest(Mage::app()->getRequest()->isAjax());
372
+
373
+ $quote = $this->getQuote();
374
+ if ($quote->getCustomerId()) {
375
+ $customer = $quote->getCustomer();
376
+ $customerForm->setEntity($customer);
377
+ $customerData = $quote->getCustomer()->getData();
378
+ } else {
379
+ /* @var $customer Mage_Customer_Model_Customer */
380
+ $customer = Mage::getModel('customer/customer');
381
+ $customerForm->setEntity($customer);
382
+ $customerRequest = $customerForm->prepareRequest($data);
383
+ $customerData = $customerForm->extractData($customerRequest);
384
+ }
385
+
386
+ $customerErrors = $customerForm->validateData($customerData);
387
+ if ($customerErrors !== true) {
388
+ return array(
389
+ 'error' => -1,
390
+ 'message' => implode(', ', $customerErrors)
391
+ );
392
+ }
393
+
394
+ if ($quote->getCustomerId()) {
395
+ return true;
396
+ }
397
+
398
+ $customerForm->compactData($customerData);
399
+
400
+ if ($quote->getCheckoutMethod() == self::METHOD_REGISTER) {
401
+ // set customer password
402
+ $customer->setPassword($customerRequest->getParam('customer_password'));
403
+ $customer->setPasswordConfirmation($customerRequest->getParam('confirm_password'));
404
+ } else {
405
+ // spoof customer password for guest
406
+ $password = $customer->generatePassword();
407
+ $customer->setPassword($password);
408
+ $customer->setPasswordConfirmation($password);
409
+ // set NOT LOGGED IN group id explicitly,
410
+ // otherwise copyFieldset('customer_account', 'to_quote') will fill it with default group id value
411
+ $customer->setGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
412
+ }
413
+
414
+ $result = $customer->validate();
415
+ if (true !== $result && is_array($result)) {
416
+ return array(
417
+ 'error' => -1,
418
+ 'message' => implode(', ', $result)
419
+ );
420
+ }
421
+
422
+ if ($quote->getCheckoutMethod() == self::METHOD_REGISTER) {
423
+ // save customer encrypted password in quote
424
+ $quote->setPasswordHash($customer->encryptPassword($customer->getPassword()));
425
+ }
426
+
427
+ // copy customer/guest email to address
428
+ $quote->getBillingAddress()->setEmail($customer->getEmail());
429
+
430
+ // copy customer data to quote
431
+ Mage::helper('core')->copyFieldset('customer_account', 'to_quote', $customer, $quote);
432
+
433
+ return true;
434
+ }
435
+
436
+ /**
437
+ * Validate customer data and set some its data for further usage in quote
438
+ * Will return either true or array with error messages
439
+ *
440
+ * @deprecated since 1.4.0.1
441
+ * @param Mage_Sales_Model_Quote_Address $address
442
+ * @return true|array
443
+ */
444
+ protected function _processValidateCustomer(Mage_Sales_Model_Quote_Address $address)
445
+ {
446
+ // set customer date of birth for further usage
447
+ $dob = '';
448
+ if ($address->getDob()) {
449
+ $dob = Mage::app()->getLocale()->date($address->getDob(), null, null, false)->toString('yyyy-MM-dd');
450
+ $this->getQuote()->setCustomerDob($dob);
451
+ }
452
+
453
+ // set customer tax/vat number for further usage
454
+ if ($address->getTaxvat()) {
455
+ $this->getQuote()->setCustomerTaxvat($address->getTaxvat());
456
+ }
457
+
458
+ // set customer gender for further usage
459
+ if ($address->getGender()) {
460
+ $this->getQuote()->setCustomerGender($address->getGender());
461
+ }
462
+
463
+ // invoke customer model, if it is registering
464
+ if (self::METHOD_REGISTER == $this->getQuote()->getCheckoutMethod()) {
465
+ // set customer password hash for further usage
466
+ $customer = Mage::getModel('customer/customer');
467
+ $this->getQuote()->setPasswordHash($customer->encryptPassword($address->getCustomerPassword()));
468
+
469
+ // validate customer
470
+ foreach (array(
471
+ 'firstname' => 'firstname',
472
+ 'lastname' => 'lastname',
473
+ 'email' => 'email',
474
+ 'password' => 'customer_password',
475
+ 'confirmation' => 'confirm_password',
476
+ 'taxvat' => 'taxvat',
477
+ 'gender' => 'gender',
478
+ ) as $key => $dataKey) {
479
+ $customer->setData($key, $address->getData($dataKey));
480
+ }
481
+ if ($dob) {
482
+ $customer->setDob($dob);
483
+ }
484
+ $validationResult = $customer->validate();
485
+ if (true !== $validationResult && is_array($validationResult)) {
486
+ return array(
487
+ 'error' => -1,
488
+ 'message' => implode(', ', $validationResult)
489
+ );
490
+ }
491
+ } else if (self::METHOD_GUEST == $this->getQuote()->getCheckoutMethod()) {
492
+ $email = $address->getData('email');
493
+ if (!Zend_Validate::is($email, 'EmailAddress')) {
494
+ return array(
495
+ 'error' => -1,
496
+ 'message' => Mage::helper('checkout')->__('Invalid email address "%s"', $email)
497
+ );
498
+ }
499
+ }
500
+
501
+ return true;
502
+ }
503
+
504
+ /**
505
+ * Save checkout shipping address
506
+ *
507
+ * @param array $data
508
+ * @param int $customerAddressId
509
+ * @return Mage_Checkout_Model_Type_Onepage
510
+ */
511
+ public function saveShipping($data, $customerAddressId)
512
+ {
513
+ if (empty($data)) {
514
+ return array('error' => -1, 'message' => Mage::helper('checkout')->__('Invalid data.'));
515
+ }
516
+ $address = $this->getQuote()->getShippingAddress();
517
+
518
+ /* @var $addressForm Mage_Customer_Model_Form */
519
+ $addressForm = Mage::getModel('customer/form');
520
+ $addressForm->setFormCode('customer_address_edit')
521
+ ->setEntityType('customer_address')
522
+ ->setIsAjaxRequest(Mage::app()->getRequest()->isAjax());
523
+
524
+ if (!empty($customerAddressId)) {
525
+ $customerAddress = Mage::getModel('customer/address')->load($customerAddressId);
526
+ if ($customerAddress->getId()) {
527
+ if ($customerAddress->getCustomerId() != $this->getQuote()->getCustomerId()) {
528
+ return array('error' => 1,
529
+ 'message' => Mage::helper('checkout')->__('Customer Address is not valid.')
530
+ );
531
+ }
532
+
533
+ $address->importCustomerAddress($customerAddress)->setSaveInAddressBook(0);
534
+ $addressForm->setEntity($address);
535
+ $addressErrors = $addressForm->validateData($address->getData());
536
+ if ($addressErrors !== true) {
537
+ return array('error' => 1, 'message' => $addressErrors);
538
+ }
539
+ }
540
+ } else {
541
+ $addressForm->setEntity($address);
542
+ // emulate request object
543
+ $addressData = $addressForm->extractData($addressForm->prepareRequest($data));
544
+ $addressErrors = $addressForm->validateData($addressData);
545
+ if ($addressErrors !== true) {
546
+ return array('error' => 1, 'message' => $addressErrors);
547
+ }
548
+ $addressForm->compactData($addressData);
549
+ // unset shipping address attributes which were not shown in form
550
+ foreach ($addressForm->getAttributes() as $attribute) {
551
+ if (!isset($data[$attribute->getAttributeCode()])) {
552
+ $address->setData($attribute->getAttributeCode(), NULL);
553
+ }
554
+ }
555
+
556
+ $address->setCustomerAddressId(null);
557
+ // Additional form data, not fetched by extractData (as it fetches only attributes)
558
+ $address->setSaveInAddressBook(empty($data['save_in_address_book']) ? 0 : 1);
559
+ $address->setSameAsBilling(empty($data['same_as_billing']) ? 0 : 1);
560
+ }
561
+
562
+ $address->implodeStreetAddress();
563
+ $address->setCollectShippingRates(true);
564
+
565
+ if (($validateRes = $address->validate())!==true) {
566
+ return array('error' => 1, 'message' => $validateRes);
567
+ }
568
+
569
+ $this->_setCartCouponCode();
570
+
571
+ $this->getQuote()->collectTotals()->save();
572
+
573
+ $this->getCheckout()
574
+ ->setStepData('shipping', 'complete', true)
575
+ ->setStepData('shipping_method', 'allow', true);
576
+
577
+ return array();
578
+ }
579
+
580
+ /**
581
+ * Specify quote shipping method
582
+ *
583
+ * @param string $shippingMethod
584
+ * @return array
585
+ */
586
+ public function saveShippingMethod($shippingMethod)
587
+ {
588
+ if (empty($shippingMethod)) {
589
+ return array('error' => -1, 'message' => Mage::helper('checkout')->__('Invalid shipping method.'));
590
+ }
591
+ $rate = $this->getQuote()->getShippingAddress()->getShippingRateByCode($shippingMethod);
592
+ if (!$rate) {
593
+ return array('error' => -1, 'message' => Mage::helper('checkout')->__('Invalid shipping method.'));
594
+ }
595
+ $this->getQuote()->getShippingAddress()
596
+ ->setShippingMethod($shippingMethod);
597
+
598
+ $this->getCheckout()
599
+ ->setStepData('shipping_method', 'complete', true)
600
+ ->setStepData('payment', 'allow', true);
601
+
602
+ return array();
603
+ }
604
+
605
+ /**
606
+ * Specify quote payment method
607
+ *
608
+ * @param array $data
609
+ * @return array
610
+ */
611
+ public function savePayment($data)
612
+ {
613
+ if (empty($data)) {
614
+ return array('error' => -1, 'message' => Mage::helper('checkout')->__('Invalid data.'));
615
+ }
616
+ $quote = $this->getQuote();
617
+ if ($quote->isVirtual()) {
618
+ $quote->getBillingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);
619
+ } else {
620
+ $quote->getShippingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);
621
+ }
622
+
623
+ // shipping totals may be affected by payment method
624
+ if (!$quote->isVirtual() && $quote->getShippingAddress()) {
625
+ $quote->getShippingAddress()->setCollectShippingRates(true);
626
+ }
627
+
628
+ $data['checks'] = Mage_Payment_Model_Method_Abstract::CHECK_USE_CHECKOUT
629
+ | Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_COUNTRY
630
+ | Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_CURRENCY
631
+ | Mage_Payment_Model_Method_Abstract::CHECK_ORDER_TOTAL_MIN_MAX
632
+ | Mage_Payment_Model_Method_Abstract::CHECK_ZERO_TOTAL;
633
+
634
+ $payment = $quote->getPayment();
635
+ $payment->importData($data);
636
+
637
+ $quote->save();
638
+
639
+ $this->getCheckout()
640
+ ->setStepData('payment', 'complete', true)
641
+ ->setStepData('review', 'allow', true);
642
+
643
+ return array();
644
+ }
645
+
646
+ /**
647
+ * Validate quote state to be integrated with one page checkout process
648
+ */
649
+ public function validate()
650
+ {
651
+ $quote = $this->getQuote();
652
+ if ($quote->getIsMultiShipping()) {
653
+ Mage::throwException(Mage::helper('checkout')->__('Invalid checkout type.'));
654
+ }
655
+
656
+ if ($quote->getCheckoutMethod() == self::METHOD_GUEST && !$quote->isAllowedGuestCheckout()) {
657
+ Mage::throwException(Mage::helper('checkout')->__('Sorry, guest checkout is not enabled. Please try again or contact store owner.'));
658
+ }
659
+ }
660
+
661
+ /**
662
+ * Prepare quote for guest checkout order submit
663
+ *
664
+ * @return Mage_Checkout_Model_Type_Onepage
665
+ */
666
+ protected function _prepareGuestQuote()
667
+ {
668
+ $quote = $this->getQuote();
669
+ $quote->setCustomerId(null)
670
+ ->setCustomerEmail($quote->getBillingAddress()->getEmail())
671
+ ->setCustomerIsGuest(true)
672
+ ->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
673
+ return $this;
674
+ }
675
+
676
+ /**
677
+ * Prepare quote for customer registration and customer order submit
678
+ *
679
+ * @return Mage_Checkout_Model_Type_Onepage
680
+ */
681
+ protected function _prepareNewCustomerQuote()
682
+ {
683
+ $quote = $this->getQuote();
684
+ $billing = $quote->getBillingAddress();
685
+ $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress();
686
+
687
+ //$customer = Mage::getModel('customer/customer');
688
+ $customer = $quote->getCustomer();
689
+ $mobile = Mage::getSingleton('core/session')->getMobileSession();
690
+ $customer->setMobile($mobile);
691
+ Mage::getSingleton('core/session')->unsMobileSession();
692
+ /* @var $customer Mage_Customer_Model_Customer */
693
+ $customerBilling = $billing->exportCustomerAddress();
694
+ $customer->addAddress($customerBilling);
695
+ $billing->setCustomerAddress($customerBilling);
696
+ $customerBilling->setIsDefaultBilling(true);
697
+ if ($shipping && !$shipping->getSameAsBilling()) {
698
+ $customerShipping = $shipping->exportCustomerAddress();
699
+ $customer->addAddress($customerShipping);
700
+ $shipping->setCustomerAddress($customerShipping);
701
+ $customerShipping->setIsDefaultShipping(true);
702
+ } else {
703
+ $customerBilling->setIsDefaultShipping(true);
704
+ }
705
+
706
+ Mage::helper('core')->copyFieldset('checkout_onepage_quote', 'to_customer', $quote, $customer);
707
+ $customer->setPassword($customer->decryptPassword($quote->getPasswordHash()));
708
+ $quote->setCustomer($customer)
709
+ ->setCustomerId(true);
710
+ }
711
+
712
+ /**
713
+ * Prepare quote for customer order submit
714
+ *
715
+ * @return Mage_Checkout_Model_Type_Onepage
716
+ */
717
+ protected function _prepareCustomerQuote()
718
+ {
719
+ $quote = $this->getQuote();
720
+ $billing = $quote->getBillingAddress();
721
+ $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress();
722
+
723
+ $customer = $this->getCustomerSession()->getCustomer();
724
+ if (!$billing->getCustomerId() || $billing->getSaveInAddressBook()) {
725
+ $customerBilling = $billing->exportCustomerAddress();
726
+ $customer->addAddress($customerBilling);
727
+ $billing->setCustomerAddress($customerBilling);
728
+ }
729
+ if ($shipping && !$shipping->getSameAsBilling() &&
730
+ (!$shipping->getCustomerId() || $shipping->getSaveInAddressBook())) {
731
+ $customerShipping = $shipping->exportCustomerAddress();
732
+ $customer->addAddress($customerShipping);
733
+ $shipping->setCustomerAddress($customerShipping);
734
+ }
735
+
736
+ if (isset($customerBilling) && !$customer->getDefaultBilling()) {
737
+ $customerBilling->setIsDefaultBilling(true);
738
+ }
739
+ if ($shipping && isset($customerShipping) && !$customer->getDefaultShipping()) {
740
+ $customerShipping->setIsDefaultShipping(true);
741
+ } else if (isset($customerBilling) && !$customer->getDefaultShipping()) {
742
+ $customerBilling->setIsDefaultShipping(true);
743
+ }
744
+ $quote->setCustomer($customer);
745
+ }
746
+
747
+ /**
748
+ * Involve new customer to system
749
+ *
750
+ * @return Mage_Checkout_Model_Type_Onepage
751
+ */
752
+ protected function _involveNewCustomer()
753
+ {
754
+ $customer = $this->getQuote()->getCustomer();
755
+ if ($customer->isConfirmationRequired()) {
756
+ $customer->sendNewAccountEmail('confirmation', '', $this->getQuote()->getStoreId());
757
+ $url = Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail());
758
+ $this->getCustomerSession()->addSuccess(
759
+ Mage::helper('customer')->__('Account confirmation is required. Please, check your e-mail for confirmation link. To resend confirmation email please <a href="%s">click here</a>.', $url)
760
+ );
761
+ } else {
762
+ $customer->sendNewAccountEmail('registered', '', $this->getQuote()->getStoreId());
763
+ $this->getCustomerSession()->loginById($customer->getId());
764
+ }
765
+ return $this;
766
+ }
767
+
768
+ /**
769
+ * Create order based on checkout type. Create customer if necessary.
770
+ *
771
+ * @return Mage_Checkout_Model_Type_Onepage
772
+ */
773
+ public function saveOrder()
774
+ {
775
+ $this->validate();
776
+ $isNewCustomer = false;
777
+ switch ($this->getCheckoutMethod()) {
778
+ case self::METHOD_GUEST:
779
+ $this->_prepareGuestQuote();
780
+ break;
781
+ case self::METHOD_REGISTER:
782
+ $this->_prepareNewCustomerQuote();
783
+ $isNewCustomer = true;
784
+ break;
785
+ default:
786
+ $this->_prepareCustomerQuote();
787
+ break;
788
+ }
789
+
790
+ $service = Mage::getModel('sales/service_quote', $this->getQuote());
791
+ $service->submitAll();
792
+
793
+ if ($isNewCustomer) {
794
+ try {
795
+ $this->_involveNewCustomer();
796
+ } catch (Exception $e) {
797
+ Mage::logException($e);
798
+ }
799
+ }
800
+
801
+ $this->_checkoutSession->setLastQuoteId($this->getQuote()->getId())
802
+ ->setLastSuccessQuoteId($this->getQuote()->getId())
803
+ ->clearHelperData();
804
+
805
+ $order = $service->getOrder();
806
+ if ($order) {
807
+ Mage::dispatchEvent('checkout_type_onepage_save_order_after',
808
+ array('order'=>$order, 'quote'=>$this->getQuote()));
809
+
810
+ /**
811
+ * a flag to set that there will be redirect to third party after confirmation
812
+ * eg: paypal standard ipn
813
+ */
814
+ $redirectUrl = $this->getQuote()->getPayment()->getOrderPlaceRedirectUrl();
815
+ /**
816
+ * we only want to send to customer about new order when there is no redirect to third party
817
+ */
818
+ if (!$redirectUrl && $order->getCanSendNewEmailFlag()) {
819
+ try {
820
+ $order->queueNewOrderEmail();
821
+ } catch (Exception $e) {
822
+ Mage::logException($e);
823
+ }
824
+ }
825
+
826
+ // add order information to the session
827
+ $this->_checkoutSession->setLastOrderId($order->getId())
828
+ ->setRedirectUrl($redirectUrl)
829
+ ->setLastRealOrderId($order->getIncrementId());
830
+
831
+ // as well a billing agreement can be created
832
+ $agreement = $order->getPayment()->getBillingAgreement();
833
+ if ($agreement) {
834
+ $this->_checkoutSession->setLastBillingAgreementId($agreement->getId());
835
+ }
836
+ }
837
+
838
+ // add recurring profiles information to the session
839
+ $profiles = $service->getRecurringPaymentProfiles();
840
+ if ($profiles) {
841
+ $ids = array();
842
+ foreach ($profiles as $profile) {
843
+ $ids[] = $profile->getId();
844
+ }
845
+ $this->_checkoutSession->setLastRecurringProfileIds($ids);
846
+ // TODO: send recurring profile emails
847
+ }
848
+
849
+ Mage::dispatchEvent(
850
+ 'checkout_submit_all_after',
851
+ array('order' => $order, 'quote' => $this->getQuote(), 'recurring_profiles' => $profiles)
852
+ );
853
+
854
+ return $this;
855
+ }
856
+
857
+ /**
858
+ * Validate quote state to be able submitted from one page checkout page
859
+ *
860
+ * @deprecated after 1.4 - service model doing quote validation
861
+ * @return Mage_Checkout_Model_Type_Onepage
862
+ */
863
+ protected function validateOrder()
864
+ {
865
+ if ($this->getQuote()->getIsMultiShipping()) {
866
+ Mage::throwException(Mage::helper('checkout')->__('Invalid checkout type.'));
867
+ }
868
+
869
+ if (!$this->getQuote()->isVirtual()) {
870
+ $address = $this->getQuote()->getShippingAddress();
871
+ $addressValidation = $address->validate();
872
+ if ($addressValidation !== true) {
873
+ Mage::throwException(Mage::helper('checkout')->__('Please check shipping address information.'));
874
+ }
875
+ $method= $address->getShippingMethod();
876
+ $rate = $address->getShippingRateByCode($method);
877
+ if (!$this->getQuote()->isVirtual() && (!$method || !$rate)) {
878
+ Mage::throwException(Mage::helper('checkout')->__('Please specify shipping method.'));
879
+ }
880
+ }
881
+
882
+ $addressValidation = $this->getQuote()->getBillingAddress()->validate();
883
+ if ($addressValidation !== true) {
884
+ Mage::throwException(Mage::helper('checkout')->__('Please check billing address information.'));
885
+ }
886
+
887
+ if (!($this->getQuote()->getPayment()->getMethod())) {
888
+ Mage::throwException(Mage::helper('checkout')->__('Please select valid payment method.'));
889
+ }
890
+ }
891
+
892
+ /**
893
+ * Check if customer email exists
894
+ *
895
+ * @param string $email
896
+ * @param int $websiteId
897
+ * @return false|Mage_Customer_Model_Customer
898
+ */
899
+ protected function _customerEmailExists($email, $websiteId = null)
900
+ {
901
+ $customer = Mage::getModel('customer/customer');
902
+ if ($websiteId) {
903
+ $customer->setWebsiteId($websiteId);
904
+ }
905
+ $customer->loadByEmail($email);
906
+ if ($customer->getId()) {
907
+ return $customer;
908
+ }
909
+ return false;
910
+ }
911
+
912
+ /**
913
+ * Get last order increment id by order id
914
+ *
915
+ * @return string
916
+ */
917
+ public function getLastOrderId()
918
+ {
919
+ $lastId = $this->getCheckout()->getLastOrderId();
920
+ $orderId = false;
921
+ if ($lastId) {
922
+ $order = Mage::getModel('sales/order');
923
+ $order->load($lastId);
924
+ $orderId = $order->getIncrementId();
925
+ }
926
+ return $orderId;
927
+ }
928
+
929
+ /**
930
+ * Sets cart coupon code from checkout to quote
931
+ *
932
+ * @return $this
933
+ */
934
+ protected function _setCartCouponCode()
935
+ {
936
+ if ($couponCode = $this->getCheckout()->getCartCouponCode()) {
937
+ $this->getQuote()->setCouponCode($couponCode);
938
+ }
939
+ return $this;
940
+ }
941
+ }
app/code/community/Webcreta/UserandMobile/controllers/Adminhtml/CustomerController.php ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once "Mage/Adminhtml/controllers/CustomerController.php";
4
+ class Webcreta_UserandMobile_Adminhtml_CustomerController extends Mage_Adminhtml_CustomerController
5
+ {
6
+ public function saveAction()
7
+ {
8
+ $data = $this->getRequest()->getPost();
9
+
10
+ if ($data) {
11
+ $redirectBack = $this->getRequest()->getParam('back', false);
12
+ $this->_initCustomer('customer_id');
13
+
14
+ /** @var $customer Mage_Customer_Model_Customer */
15
+ $customer = Mage::registry('current_customer');
16
+
17
+ /** @var $customerForm Mage_Customer_Model_Form */
18
+ $customerForm = Mage::getModel('customer/form');
19
+ $customerForm->setEntity($customer)
20
+ ->setFormCode('adminhtml_customer')
21
+ ->ignoreInvisible(false)
22
+ ;
23
+
24
+ $formData = $customerForm->extractData($this->getRequest(), 'account');
25
+
26
+ // Handle 'disable auto_group_change' attribute
27
+ if (isset($formData['disable_auto_group_change'])) {
28
+ $formData['disable_auto_group_change'] = empty($formData['disable_auto_group_change']) ? '0' : '1';
29
+ }
30
+
31
+ $errors = null;
32
+ if ($customer->getId()&& !empty($data['account']['new_password'])
33
+ && Mage::helper('customer')->getIsRequireAdminUserToChangeUserPassword()
34
+ ) {
35
+ //Validate current admin password
36
+ if (isset($data['account']['current_password'])) {
37
+ $currentPassword = $data['account']['current_password'];
38
+ } else {
39
+ $currentPassword = null;
40
+ }
41
+ unset($data['account']['current_password']);
42
+ $errors = $this->_validateCurrentPassword($currentPassword);
43
+ }
44
+
45
+ if (!is_array($errors)) {
46
+ $errors = $customerForm->validateData($formData);
47
+ }
48
+
49
+ if ($errors !== true) {
50
+ foreach ($errors as $error) {
51
+ $this->_getSession()->addError($error);
52
+ }
53
+ $this->_getSession()->setCustomerData($data);
54
+ $this->getResponse()->setRedirect($this->getUrl('*/customer/edit', array('id' => $customer->getId())));
55
+ return;
56
+ }
57
+
58
+ $customerForm->compactData($formData);
59
+
60
+ // Unset template data
61
+ if (isset($data['address']['_template_'])) {
62
+ unset($data['address']['_template_']);
63
+ }
64
+
65
+ $modifiedAddresses = array();
66
+ if (!empty($data['address'])) {
67
+ /** @var $addressForm Mage_Customer_Model_Form */
68
+ $addressForm = Mage::getModel('customer/form');
69
+ $addressForm->setFormCode('adminhtml_customer_address')->ignoreInvisible(false);
70
+
71
+ foreach (array_keys($data['address']) as $index) {
72
+ $address = $customer->getAddressItemById($index);
73
+ if (!$address) {
74
+ $address = Mage::getModel('customer/address');
75
+ }
76
+
77
+ $requestScope = sprintf('address/%s', $index);
78
+ $formData = $addressForm->setEntity($address)
79
+ ->extractData($this->getRequest(), $requestScope);
80
+
81
+ // Set default billing and shipping flags to address
82
+ $isDefaultBilling = isset($data['account']['default_billing'])
83
+ && $data['account']['default_billing'] == $index;
84
+ $address->setIsDefaultBilling($isDefaultBilling);
85
+ $isDefaultShipping = isset($data['account']['default_shipping'])
86
+ && $data['account']['default_shipping'] == $index;
87
+ $address->setIsDefaultShipping($isDefaultShipping);
88
+
89
+ $errors = $addressForm->validateData($formData);
90
+ if ($errors !== true) {
91
+ foreach ($errors as $error) {
92
+ $this->_getSession()->addError($error);
93
+ }
94
+ $this->_getSession()->setCustomerData($data);
95
+ $this->getResponse()->setRedirect($this->getUrl('*/customer/edit', array(
96
+ 'id' => $customer->getId())
97
+ ));
98
+ return;
99
+ }
100
+
101
+ $addressForm->compactData($formData);
102
+
103
+ // Set post_index for detect default billing and shipping addresses
104
+ $address->setPostIndex($index);
105
+
106
+ if ($address->getId()) {
107
+ $modifiedAddresses[] = $address->getId();
108
+ } else {
109
+ $customer->addAddress($address);
110
+ }
111
+ }
112
+ }
113
+
114
+ // Default billing and shipping
115
+ if (isset($data['account']['default_billing'])) {
116
+ $customer->setData('default_billing', $data['account']['default_billing']);
117
+ }
118
+ if (isset($data['account']['default_shipping'])) {
119
+ $customer->setData('default_shipping', $data['account']['default_shipping']);
120
+ }
121
+ if (isset($data['account']['confirmation'])) {
122
+ $customer->setData('confirmation', $data['account']['confirmation']);
123
+ }
124
+
125
+ // Mark not modified customer addresses for delete
126
+ foreach ($customer->getAddressesCollection() as $customerAddress) {
127
+ if ($customerAddress->getId() && !in_array($customerAddress->getId(), $modifiedAddresses)) {
128
+ $customerAddress->setData('_deleted', true);
129
+ }
130
+ }
131
+
132
+ if (Mage::getSingleton('admin/session')->isAllowed('customer/newsletter')
133
+ && !$customer->getConfirmation()
134
+ ) {
135
+ $customer->setIsSubscribed(isset($data['subscription']));
136
+ }
137
+
138
+ if (isset($data['account']['sendemail_store_id'])) {
139
+ $customer->setSendemailStoreId($data['account']['sendemail_store_id']);
140
+ }
141
+
142
+ $isNewCustomer = $customer->isObjectNew();
143
+ try {
144
+ $sendPassToEmail = false;
145
+ // Force new customer confirmation
146
+ if ($isNewCustomer) {
147
+ $customer->setPassword($data['account']['password']);
148
+ $customer->setForceConfirmed(true);
149
+ if ($customer->getPassword() == 'auto') {
150
+ $sendPassToEmail = true;
151
+ $customer->setPassword($customer->generatePassword());
152
+ }
153
+ }
154
+
155
+ Mage::dispatchEvent('adminhtml_customer_prepare_save', array(
156
+ 'customer' => $customer,
157
+ 'request' => $this->getRequest()
158
+ ));
159
+
160
+ $postMobile = $data['account']['mobile'];
161
+ $currentCustomerId = $this->getRequest()->getParam('id');
162
+ $customerModel = Mage::getModel('customer/customer')->load($currentCustomerId);
163
+ $currentCustomerMobile = $customerModel->getMobile();
164
+ $customerCollection = Mage::getModel('customer/customer')->getCollection();
165
+ $customerCollection->addAttributeToSelect(array('mobile', 'firstname', 'lastname', 'email'));
166
+ $allMobileArr = array();
167
+
168
+ foreach ($customerCollection as $singleCustomer) {
169
+ $allMobileArr[] = $singleCustomer->getMobile();
170
+ }
171
+
172
+ if($currentCustomerMobile == $postMobile){
173
+ $customer->setMobile($currentCustomerMobile);
174
+ }elseif(in_array($postMobile, $allMobileArr)){
175
+ Mage::getSingleton('core/session')->addError('Mobile number is already in use.');
176
+ $this->_redirect('*/*/edit', array(
177
+ 'id' => $customer->getId(),
178
+ '_current' => true
179
+ ));
180
+ return;
181
+ }else{
182
+ $customer->setMobile($postMobile);
183
+ }
184
+
185
+ $customer->save();
186
+
187
+ // Send welcome email
188
+ if ($customer->getWebsiteId() && (isset($data['account']['sendemail']) || $sendPassToEmail)) {
189
+ $storeId = $customer->getSendemailStoreId();
190
+ if ($isNewCustomer) {
191
+ $customer->sendNewAccountEmail('registered', '', $storeId);
192
+ } elseif ((!$customer->getConfirmation())) {
193
+ // Confirm not confirmed customer
194
+ $customer->sendNewAccountEmail('confirmed', '', $storeId);
195
+ }
196
+ }
197
+
198
+ if (!empty($data['account']['new_password'])) {
199
+ $newPassword = $data['account']['new_password'];
200
+ if ($newPassword == 'auto') {
201
+ $newPassword = $customer->generatePassword();
202
+ }
203
+ $customer->changePassword($newPassword);
204
+ $customer->sendPasswordReminderEmail();
205
+ }
206
+
207
+ Mage::getSingleton('adminhtml/session')->addSuccess(
208
+ Mage::helper('adminhtml')->__('The customer has been saved.')
209
+ );
210
+ Mage::dispatchEvent('adminhtml_customer_save_after', array(
211
+ 'customer' => $customer,
212
+ 'request' => $this->getRequest()
213
+ ));
214
+
215
+ if ($redirectBack) {
216
+ $this->_redirect('*/*/edit', array(
217
+ 'id' => $customer->getId(),
218
+ '_current' => true
219
+ ));
220
+ return;
221
+ }
222
+ } catch (Mage_Core_Exception $e) {
223
+ $this->_getSession()->addError($e->getMessage());
224
+ $this->_getSession()->setCustomerData($data);
225
+ $this->getResponse()->setRedirect($this->getUrl('*/customer/edit', array('id' => $customer->getId())));
226
+ return;
227
+ } catch (Exception $e) {
228
+ $this->_getSession()->addException($e,
229
+ Mage::helper('adminhtml')->__('An error occurred while saving the customer.'));
230
+ $this->_getSession()->setCustomerData($data);
231
+ $this->getResponse()->setRedirect($this->getUrl('*/customer/edit', array('id'=>$customer->getId())));
232
+ return;
233
+ }
234
+ }
235
+ $this->getResponse()->setRedirect($this->getUrl('*/customer'));
236
+ }
237
+ }
app/code/community/Webcreta/UserandMobile/controllers/Checkout/OnepageController.php ADDED
@@ -0,0 +1,660 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once "Mage/Checkout/controllers/OnepageController.php";
4
+ class Webcreta_UserandMobile_Checkout_OnepageController extends Mage_Checkout_Controller_Action
5
+ {
6
+ /**
7
+ * List of functions for section update
8
+ *
9
+ * @var array
10
+ */
11
+ protected $_sectionUpdateFunctions = array(
12
+ 'payment-method' => '_getPaymentMethodsHtml',
13
+ 'shipping-method' => '_getShippingMethodsHtml',
14
+ 'review' => '_getReviewHtml',
15
+ );
16
+
17
+ /**
18
+ * @var Mage_Sales_Model_Order
19
+ */
20
+ protected $_order;
21
+
22
+ /**
23
+ * Predispatch: should set layout area
24
+ *
25
+ * @return Mage_Checkout_OnepageController
26
+ */
27
+ public function preDispatch()
28
+ {
29
+ parent::preDispatch();
30
+ $this->_preDispatchValidateCustomer();
31
+
32
+ $checkoutSessionQuote = Mage::getSingleton('checkout/session')->getQuote();
33
+ if ($checkoutSessionQuote->getIsMultiShipping()) {
34
+ $checkoutSessionQuote->setIsMultiShipping(false);
35
+ $checkoutSessionQuote->removeAllAddresses();
36
+ }
37
+
38
+ if (!$this->_canShowForUnregisteredUsers()) {
39
+ $this->norouteAction();
40
+ $this->setFlag('',self::FLAG_NO_DISPATCH,true);
41
+ return;
42
+ }
43
+
44
+ return $this;
45
+ }
46
+
47
+ /**
48
+ * Send Ajax redirect response
49
+ *
50
+ * @return Mage_Checkout_OnepageController
51
+ */
52
+ protected function _ajaxRedirectResponse()
53
+ {
54
+ $this->getResponse()
55
+ ->setHeader('HTTP/1.1', '403 Session Expired')
56
+ ->setHeader('Login-Required', 'true')
57
+ ->sendResponse();
58
+ return $this;
59
+ }
60
+
61
+ /**
62
+ * Validate ajax request and redirect on failure
63
+ *
64
+ * @return bool
65
+ */
66
+ protected function _expireAjax()
67
+ {
68
+ if (!$this->getOnepage()->getQuote()->hasItems()
69
+ || $this->getOnepage()->getQuote()->getHasError()
70
+ || $this->getOnepage()->getQuote()->getIsMultiShipping()
71
+ ) {
72
+ $this->_ajaxRedirectResponse();
73
+ return true;
74
+ }
75
+ $action = strtolower($this->getRequest()->getActionName());
76
+ if (Mage::getSingleton('checkout/session')->getCartWasUpdated(true)
77
+ && !in_array($action, array('index', 'progress'))
78
+ ) {
79
+ $this->_ajaxRedirectResponse();
80
+ return true;
81
+ }
82
+ return false;
83
+ }
84
+
85
+ /**
86
+ * Get shipping method step html
87
+ *
88
+ * @return string
89
+ */
90
+ protected function _getShippingMethodsHtml()
91
+ {
92
+ $layout = $this->getLayout();
93
+ $update = $layout->getUpdate();
94
+ $update->load('checkout_onepage_shippingmethod');
95
+ $layout->generateXml();
96
+ $layout->generateBlocks();
97
+ $output = $layout->getOutput();
98
+ return $output;
99
+ }
100
+
101
+ /**
102
+ * Get payment method step html
103
+ *
104
+ * @return string
105
+ */
106
+ protected function _getPaymentMethodsHtml()
107
+ {
108
+ $layout = $this->getLayout();
109
+ $update = $layout->getUpdate();
110
+ $update->load('checkout_onepage_paymentmethod');
111
+ $layout->generateXml();
112
+ $layout->generateBlocks();
113
+ $output = $layout->getOutput();
114
+ return $output;
115
+ }
116
+
117
+ /**
118
+ * Return block content from the 'checkout_onepage_additional'
119
+ * This is the additional content for shipping method
120
+ *
121
+ * @return string
122
+ */
123
+ protected function _getAdditionalHtml()
124
+ {
125
+ $layout = $this->getLayout();
126
+ $update = $layout->getUpdate();
127
+ $update->load('checkout_onepage_additional');
128
+ $layout->generateXml();
129
+ $layout->generateBlocks();
130
+ $output = $layout->getOutput();
131
+ Mage::getSingleton('core/translate_inline')->processResponseBody($output);
132
+ return $output;
133
+ }
134
+
135
+ /**
136
+ * Get order review step html
137
+ *
138
+ * @return string
139
+ */
140
+ protected function _getReviewHtml()
141
+ {
142
+ return $this->getLayout()->getBlock('root')->toHtml();
143
+ }
144
+
145
+ /**
146
+ * Get one page checkout model
147
+ *
148
+ * @return Mage_Checkout_Model_Type_Onepage
149
+ */
150
+ public function getOnepage()
151
+ {
152
+ return Mage::getSingleton('checkout/type_onepage');
153
+ }
154
+
155
+ /**
156
+ * Checkout page
157
+ */
158
+ public function indexAction()
159
+ {
160
+ if (!Mage::helper('checkout')->canOnepageCheckout()) {
161
+ Mage::getSingleton('checkout/session')->addError($this->__('The onepage checkout is disabled.'));
162
+ $this->_redirect('checkout/cart');
163
+ return;
164
+ }
165
+ $quote = $this->getOnepage()->getQuote();
166
+ if (!$quote->hasItems() || $quote->getHasError()) {
167
+ $this->_redirect('checkout/cart');
168
+ return;
169
+ }
170
+ if (!$quote->validateMinimumAmount()) {
171
+ $error = Mage::getStoreConfig('sales/minimum_order/error_message') ?
172
+ Mage::getStoreConfig('sales/minimum_order/error_message') :
173
+ Mage::helper('checkout')->__('Subtotal must exceed minimum order amount');
174
+
175
+ Mage::getSingleton('checkout/session')->addError($error);
176
+ $this->_redirect('checkout/cart');
177
+ return;
178
+ }
179
+ Mage::getSingleton('checkout/session')->setCartWasUpdated(false);
180
+ Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::getUrl('*/*/*', array('_secure' => true)));
181
+ $this->getOnepage()->initCheckout();
182
+ $this->loadLayout();
183
+ $this->_initLayoutMessages('customer/session');
184
+ $this->getLayout()->getBlock('head')->setTitle($this->__('Checkout'));
185
+ $this->renderLayout();
186
+ }
187
+
188
+ /**
189
+ * Refreshes the previous step
190
+ * Loads the block corresponding to the current step and sets it
191
+ * in to the response body
192
+ *
193
+ * This function is called from the reloadProgessBlock
194
+ * function from the javascript
195
+ *
196
+ * @return string|null
197
+ */
198
+ public function progressAction()
199
+ {
200
+ // previous step should never be null. We always start with billing and go forward
201
+ $prevStep = $this->getRequest()->getParam('prevStep', false);
202
+
203
+ if ($this->_expireAjax() || !$prevStep) {
204
+ return null;
205
+ }
206
+
207
+ $layout = $this->getLayout();
208
+ $update = $layout->getUpdate();
209
+ /* Load the block belonging to the current step*/
210
+ $update->load('checkout_onepage_progress_' . $prevStep);
211
+ $layout->generateXml();
212
+ $layout->generateBlocks();
213
+ $output = $layout->getOutput();
214
+ $this->getResponse()->setBody($output);
215
+ return $output;
216
+ }
217
+
218
+ /**
219
+ * Shipping method action
220
+ */
221
+ public function shippingMethodAction()
222
+ {
223
+ if ($this->_expireAjax()) {
224
+ return;
225
+ }
226
+ $this->loadLayout(false);
227
+ $this->renderLayout();
228
+ }
229
+
230
+ /**
231
+ * Review page action
232
+ */
233
+ public function reviewAction()
234
+ {
235
+ if ($this->_expireAjax()) {
236
+ return;
237
+ }
238
+ $this->loadLayout(false);
239
+ $this->renderLayout();
240
+ }
241
+
242
+ /**
243
+ * Order success action
244
+ */
245
+ public function successAction()
246
+ {
247
+ $session = $this->getOnepage()->getCheckout();
248
+ if (!$session->getLastSuccessQuoteId()) {
249
+ $this->_redirect('checkout/cart');
250
+ return;
251
+ }
252
+
253
+ $lastQuoteId = $session->getLastQuoteId();
254
+ $lastOrderId = $session->getLastOrderId();
255
+ $lastRecurringProfiles = $session->getLastRecurringProfileIds();
256
+ if (!$lastQuoteId || (!$lastOrderId && empty($lastRecurringProfiles))) {
257
+ $this->_redirect('checkout/cart');
258
+ return;
259
+ }
260
+
261
+ $session->clear();
262
+ $this->loadLayout();
263
+ $this->_initLayoutMessages('checkout/session');
264
+ Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($lastOrderId)));
265
+ $this->renderLayout();
266
+ }
267
+
268
+ /**
269
+ * Failure action
270
+ */
271
+ public function failureAction()
272
+ {
273
+ $lastQuoteId = $this->getOnepage()->getCheckout()->getLastQuoteId();
274
+ $lastOrderId = $this->getOnepage()->getCheckout()->getLastOrderId();
275
+
276
+ if (!$lastQuoteId || !$lastOrderId) {
277
+ $this->_redirect('checkout/cart');
278
+ return;
279
+ }
280
+
281
+ $this->loadLayout();
282
+ $this->renderLayout();
283
+ }
284
+
285
+
286
+ /**
287
+ * Get additional info action
288
+ */
289
+ public function getAdditionalAction()
290
+ {
291
+ $this->getResponse()->setBody($this->_getAdditionalHtml());
292
+ }
293
+
294
+ /**
295
+ * Address JSON
296
+ */
297
+ public function getAddressAction()
298
+ {
299
+ if ($this->_expireAjax()) {
300
+ return;
301
+ }
302
+ $addressId = $this->getRequest()->getParam('address', false);
303
+ if ($addressId) {
304
+ $address = $this->getOnepage()->getAddress($addressId);
305
+
306
+ if (Mage::getSingleton('customer/session')->getCustomer()->getId() == $address->getCustomerId()) {
307
+ $this->_prepareDataJSON($address->toArray());
308
+ } else {
309
+ $this->getResponse()->setHeader('HTTP/1.1','403 Forbidden');
310
+ }
311
+ }
312
+ }
313
+
314
+ /**
315
+ * Save checkout method
316
+ */
317
+ public function saveMethodAction()
318
+ {
319
+ if ($this->_expireAjax()) {
320
+ return;
321
+ }
322
+ if ($this->getRequest()->isPost()) {
323
+ $method = $this->getRequest()->getPost('method');
324
+ $result = $this->getOnepage()->saveCheckoutMethod($method);
325
+ $this->_prepareDataJSON($result);
326
+ }
327
+ }
328
+
329
+ /**
330
+ * Save checkout billing address
331
+ */
332
+ public function saveBillingAction()
333
+ {
334
+ if ($this->_expireAjax()) {
335
+ return;
336
+ }
337
+ if ($this->getRequest()->isPost()) {
338
+ $postData = $this->getRequest()->getParams();
339
+ if(!empty($postData['mobile'])){
340
+ $postMobile = $postData['mobile'];
341
+ Mage::getSingleton('core/session')->setMobileSession($postMobile);
342
+ $customerCollection = Mage::getModel('customer/customer')->getCollection();
343
+ $customerCollection->addAttributeToSelect(array('mobile', 'firstname', 'lastname', 'email'));
344
+ $allMobileArr = array();
345
+
346
+ foreach ($customerCollection as $singleCustomer) {
347
+ $allMobileArr[] = $singleCustomer->getMobile();
348
+ }
349
+
350
+ if(in_array($postMobile, $allMobileArr)){
351
+ $result = array('error' => 1, 'message' => "Mobile number is already in use.");
352
+ return $this->_prepareDataJSON($result);
353
+
354
+ }
355
+ }
356
+ $data = $this->getRequest()->getPost('billing', array());
357
+ $customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
358
+
359
+ if (isset($data['email'])) {
360
+ $data['email'] = trim($data['email']);
361
+ }
362
+ $result = $this->getOnepage()->saveBilling($data, $customerAddressId);
363
+
364
+ if (!isset($result['error'])) {
365
+ if ($this->getOnepage()->getQuote()->isVirtual()) {
366
+ $result['goto_section'] = 'payment';
367
+ $result['update_section'] = array(
368
+ 'name' => 'payment-method',
369
+ 'html' => $this->_getPaymentMethodsHtml()
370
+ );
371
+ } elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
372
+ $result['goto_section'] = 'shipping_method';
373
+ $result['update_section'] = array(
374
+ 'name' => 'shipping-method',
375
+ 'html' => $this->_getShippingMethodsHtml()
376
+ );
377
+
378
+ $result['allow_sections'] = array('shipping');
379
+ $result['duplicateBillingInfo'] = 'true';
380
+ } else {
381
+ $result['goto_section'] = 'shipping';
382
+ }
383
+ }
384
+
385
+ $this->_prepareDataJSON($result);
386
+ }
387
+ }
388
+
389
+ /**
390
+ * Shipping address save action
391
+ */
392
+ public function saveShippingAction()
393
+ {
394
+ if ($this->_expireAjax()) {
395
+ return;
396
+ }
397
+ if ($this->getRequest()->isPost()) {
398
+ $data = $this->getRequest()->getPost('shipping', array());
399
+ $customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
400
+ $result = $this->getOnepage()->saveShipping($data, $customerAddressId);
401
+
402
+ if (!isset($result['error'])) {
403
+ $result['goto_section'] = 'shipping_method';
404
+ $result['update_section'] = array(
405
+ 'name' => 'shipping-method',
406
+ 'html' => $this->_getShippingMethodsHtml()
407
+ );
408
+ }
409
+ $this->_prepareDataJSON($result);
410
+ }
411
+ }
412
+
413
+ /**
414
+ * Shipping method save action
415
+ */
416
+ public function saveShippingMethodAction()
417
+ {
418
+ if ($this->_expireAjax()) {
419
+ return;
420
+ }
421
+ if ($this->getRequest()->isPost()) {
422
+ $data = $this->getRequest()->getPost('shipping_method', '');
423
+ $result = $this->getOnepage()->saveShippingMethod($data);
424
+ // $result will contain error data if shipping method is empty
425
+ if (!$result) {
426
+ Mage::dispatchEvent(
427
+ 'checkout_controller_onepage_save_shipping_method',
428
+ array(
429
+ 'request' => $this->getRequest(),
430
+ 'quote' => $this->getOnepage()->getQuote()));
431
+ $this->getOnepage()->getQuote()->collectTotals();
432
+ $this->_prepareDataJSON($result);
433
+
434
+ $result['goto_section'] = 'payment';
435
+ $result['update_section'] = array(
436
+ 'name' => 'payment-method',
437
+ 'html' => $this->_getPaymentMethodsHtml()
438
+ );
439
+ }
440
+ $this->getOnepage()->getQuote()->collectTotals()->save();
441
+ $this->_prepareDataJSON($result);
442
+ }
443
+ }
444
+
445
+ /**
446
+ * Save payment ajax action
447
+ *
448
+ * Sets either redirect or a JSON response
449
+ */
450
+ public function savePaymentAction()
451
+ {
452
+ if ($this->_expireAjax()) {
453
+ return;
454
+ }
455
+ try {
456
+ if (!$this->getRequest()->isPost()) {
457
+ $this->_ajaxRedirectResponse();
458
+ return;
459
+ }
460
+
461
+ $data = $this->getRequest()->getPost('payment', array());
462
+ $result = $this->getOnepage()->savePayment($data);
463
+
464
+ // get section and redirect data
465
+ $redirectUrl = $this->getOnepage()->getQuote()->getPayment()->getCheckoutRedirectUrl();
466
+ if (empty($result['error']) && !$redirectUrl) {
467
+ $this->loadLayout('checkout_onepage_review');
468
+ $result['goto_section'] = 'review';
469
+ $result['update_section'] = array(
470
+ 'name' => 'review',
471
+ 'html' => $this->_getReviewHtml()
472
+ );
473
+ }
474
+ if ($redirectUrl) {
475
+ $result['redirect'] = $redirectUrl;
476
+ }
477
+ } catch (Mage_Payment_Exception $e) {
478
+ if ($e->getFields()) {
479
+ $result['fields'] = $e->getFields();
480
+ }
481
+ $result['error'] = $e->getMessage();
482
+ } catch (Mage_Core_Exception $e) {
483
+ $result['error'] = $e->getMessage();
484
+ } catch (Exception $e) {
485
+ Mage::logException($e);
486
+ $result['error'] = $this->__('Unable to set Payment Method.');
487
+ }
488
+ $this->_prepareDataJSON($result);
489
+ }
490
+
491
+ /**
492
+ * Get Order by quoteId
493
+ *
494
+ * @throws Mage_Payment_Model_Info_Exception
495
+ * @return Mage_Sales_Model_Order
496
+ */
497
+ protected function _getOrder()
498
+ {
499
+ if (is_null($this->_order)) {
500
+ $this->_order = Mage::getModel('sales/order')->load($this->getOnepage()->getQuote()->getId(), 'quote_id');
501
+ if (!$this->_order->getId()) {
502
+ throw new Mage_Payment_Model_Info_Exception(Mage::helper('core')->__("Can not create invoice. Order was not found."));
503
+ }
504
+ }
505
+ return $this->_order;
506
+ }
507
+
508
+ /**
509
+ * Create invoice
510
+ *
511
+ * @return Mage_Sales_Model_Order_Invoice
512
+ */
513
+ protected function _initInvoice()
514
+ {
515
+ $items = array();
516
+ foreach ($this->_getOrder()->getAllItems() as $item) {
517
+ $items[$item->getId()] = $item->getQtyOrdered();
518
+ }
519
+ /* @var $invoice Mage_Sales_Model_Service_Order */
520
+ $invoice = Mage::getModel('sales/service_order', $this->_getOrder())->prepareInvoice($items);
521
+ $invoice->setEmailSent(true)->register();
522
+
523
+ Mage::register('current_invoice', $invoice);
524
+ return $invoice;
525
+ }
526
+
527
+ /**
528
+ * Create order action
529
+ */
530
+ public function saveOrderAction()
531
+ {
532
+ if (!$this->_validateFormKey()) {
533
+ $this->_redirect('*/*');
534
+ return;
535
+ }
536
+
537
+ if ($this->_expireAjax()) {
538
+ return;
539
+ }
540
+
541
+ $result = array();
542
+ try {
543
+ $requiredAgreements = Mage::helper('checkout')->getRequiredAgreementIds();
544
+ if ($requiredAgreements) {
545
+ $postedAgreements = array_keys($this->getRequest()->getPost('agreement', array()));
546
+ $diff = array_diff($requiredAgreements, $postedAgreements);
547
+ if ($diff) {
548
+ $result['success'] = false;
549
+ $result['error'] = true;
550
+ $result['error_messages'] = $this->__('Please agree to all the terms and conditions before placing the order.');
551
+ $this->_prepareDataJSON($result);
552
+ return;
553
+ }
554
+ }
555
+
556
+ $data = $this->getRequest()->getPost('payment', array());
557
+ if ($data) {
558
+ $data['checks'] = Mage_Payment_Model_Method_Abstract::CHECK_USE_CHECKOUT
559
+ | Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_COUNTRY
560
+ | Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_CURRENCY
561
+ | Mage_Payment_Model_Method_Abstract::CHECK_ORDER_TOTAL_MIN_MAX
562
+ | Mage_Payment_Model_Method_Abstract::CHECK_ZERO_TOTAL;
563
+ $this->getOnepage()->getQuote()->getPayment()->importData($data);
564
+ }
565
+
566
+ $this->getOnepage()->saveOrder();
567
+
568
+ $redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl();
569
+ $result['success'] = true;
570
+ $result['error'] = false;
571
+ } catch (Mage_Payment_Model_Info_Exception $e) {
572
+ $message = $e->getMessage();
573
+ if (!empty($message)) {
574
+ $result['error_messages'] = $message;
575
+ }
576
+ $result['goto_section'] = 'payment';
577
+ $result['update_section'] = array(
578
+ 'name' => 'payment-method',
579
+ 'html' => $this->_getPaymentMethodsHtml()
580
+ );
581
+ } catch (Mage_Core_Exception $e) {
582
+ Mage::logException($e);
583
+ Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
584
+ $result['success'] = false;
585
+ $result['error'] = true;
586
+ $result['error_messages'] = $e->getMessage();
587
+
588
+ $gotoSection = $this->getOnepage()->getCheckout()->getGotoSection();
589
+ if ($gotoSection) {
590
+ $result['goto_section'] = $gotoSection;
591
+ $this->getOnepage()->getCheckout()->setGotoSection(null);
592
+ }
593
+ $updateSection = $this->getOnepage()->getCheckout()->getUpdateSection();
594
+ if ($updateSection) {
595
+ if (isset($this->_sectionUpdateFunctions[$updateSection])) {
596
+ $updateSectionFunction = $this->_sectionUpdateFunctions[$updateSection];
597
+ $result['update_section'] = array(
598
+ 'name' => $updateSection,
599
+ 'html' => $this->$updateSectionFunction()
600
+ );
601
+ }
602
+ $this->getOnepage()->getCheckout()->setUpdateSection(null);
603
+ }
604
+ } catch (Exception $e) {
605
+ Mage::logException($e);
606
+ Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
607
+ $result['success'] = false;
608
+ $result['error'] = true;
609
+ $result['error_messages'] = $this->__('There was an error processing your order. Please contact us or try again later.');
610
+ }
611
+ $this->getOnepage()->getQuote()->save();
612
+ /**
613
+ * when there is redirect to third party, we don't want to save order yet.
614
+ * we will save the order in return action.
615
+ */
616
+ if (isset($redirectUrl)) {
617
+ $result['redirect'] = $redirectUrl;
618
+ }
619
+
620
+ $this->_prepareDataJSON($result);
621
+ }
622
+
623
+ /**
624
+ * Filtering posted data. Converting localized data if needed
625
+ *
626
+ * @param array
627
+ * @return array
628
+ */
629
+ protected function _filterPostData($data)
630
+ {
631
+ $data = $this->_filterDates($data, array('dob'));
632
+ return $data;
633
+ }
634
+
635
+ /**
636
+ * Check can page show for unregistered users
637
+ *
638
+ * @return boolean
639
+ */
640
+ protected function _canShowForUnregisteredUsers()
641
+ {
642
+ return Mage::getSingleton('customer/session')->isLoggedIn()
643
+ || $this->getRequest()->getActionName() == 'index'
644
+ || Mage::helper('checkout')->isAllowedGuestCheckout($this->getOnepage()->getQuote())
645
+ || !Mage::helper('checkout')->isCustomerMustBeLogged();
646
+ }
647
+
648
+ /**
649
+ * Prepare JSON formatted data for response to client
650
+ *
651
+ * @param $response
652
+ * @return Zend_Controller_Response_Abstract
653
+ */
654
+ protected function _prepareDataJSON($response)
655
+ {
656
+ $this->getResponse()->setHeader('Content-type', 'application/json', true);
657
+ return $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
658
+ }
659
+
660
+ }
app/code/community/Webcreta/UserandMobile/controllers/Customer/AccountController.php ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once "Mage/Customer/controllers/AccountController.php";
4
+ class Webcreta_UserandMobile_Customer_AccountController extends Mage_Customer_AccountController{
5
+
6
+ public function createPostAction()
7
+ {
8
+ $errUrl = $this->_getUrl('*/*/create', array('_secure' => true));
9
+
10
+ if (!$this->_validateFormKey()) {
11
+ $this->_redirectError($errUrl);
12
+ return;
13
+ }
14
+
15
+ /** @var $session Mage_Customer_Model_Session */
16
+ $session = $this->_getSession();
17
+ if ($session->isLoggedIn()) {
18
+ $this->_redirect('*/*/');
19
+ return;
20
+ }
21
+
22
+ if (!$this->getRequest()->isPost()) {
23
+ $this->_redirectError($errUrl);
24
+ return;
25
+ }
26
+
27
+ $customer = $this->_getCustomer();
28
+
29
+ try {
30
+ $errors = $this->_getCustomerErrors($customer);
31
+
32
+ if (empty($errors)) {
33
+ $customer->cleanPasswordsValidationData();
34
+ $formData = $this->getRequest()->getPost();
35
+ $postMobile = $formData['mobile'];
36
+ if(!empty($postMobile)){
37
+ $customerCollection = Mage::getModel('customer/customer')->getCollection();
38
+ $customerCollection->addAttributeToSelect(array('mobile', 'firstname', 'lastname', 'email'));
39
+ $allMobileArr = array();
40
+
41
+ foreach ($customerCollection as $singleCustomer) {
42
+ $allMobileArr[] = $singleCustomer->getMobile();
43
+ }
44
+
45
+ if(in_array($postMobile, $allMobileArr)){
46
+ Mage::getSingleton('core/session')->addError('Mobile number is already in use.');
47
+ $url = Mage::getUrl('customer/account/create');
48
+ $response = Mage::app()->getFrontController()->getResponse();
49
+ $response->setRedirect($url);
50
+ $response->sendResponse();
51
+ exit;
52
+ }
53
+ }
54
+ $customer->save();
55
+
56
+ $this->_dispatchRegisterSuccess($customer);
57
+ $this->_successProcessRegistration($customer);
58
+ return;
59
+ } else {
60
+ $this->_addSessionError($errors);
61
+ }
62
+ } catch (Mage_Core_Exception $e) {
63
+ $session->setCustomerFormData($this->getRequest()->getPost());
64
+ if ($e->getCode() === Mage_Customer_Model_Customer::EXCEPTION_EMAIL_EXISTS) {
65
+ $url = $this->_getUrl('customer/account/forgotpassword');
66
+ $message = $this->__('There is already an account with this email address. If you are sure that it is your email address, <a href="%s">click here</a> to get your password and access your account.', $url);
67
+ } else {
68
+ $message = $this->_escapeHtml($e->getMessage());
69
+ }
70
+ $session->addError($message);
71
+ } catch (Exception $e) {
72
+ $session->setCustomerFormData($this->getRequest()->getPost());
73
+ $session->addException($e, $this->__('Cannot save the customer.'));
74
+ }
75
+
76
+ $this->_redirectError($errUrl);
77
+ }
78
+ public function loginPostAction()
79
+ {
80
+ $formData = $this->getRequest()->getPost('login');
81
+ $mobile = $formData['username'];
82
+
83
+ $CustomAddress = Mage::getResourceModel('customer/customer_collection')
84
+ ->addAttributeToSelect('*')
85
+ ->addAttributeToFilter('mobile',$mobile);
86
+ foreach($CustomAddress as $singleCustomer){
87
+ $custEmail = $singleCustomer['email'];
88
+ }
89
+
90
+ if (!$this->_validateFormKey()) {
91
+ $this->_redirect('*/*/');
92
+ return;
93
+ }
94
+
95
+ if ($this->_getSession()->isLoggedIn()) {
96
+ $this->_redirect('*/*/');
97
+ return;
98
+ }
99
+ $session = $this->_getSession();
100
+
101
+ if ($this->getRequest()->isPost()) {
102
+ $login = $this->getRequest()->getPost('login');
103
+ if(!empty($CustomAddress->getData())){
104
+ $login['username'] = $custEmail;
105
+ }
106
+
107
+ if (!empty($login['username']) && !empty($login['password'])) {
108
+ try {
109
+ $session->login($login['username'], $login['password']);
110
+ if ($session->getCustomer()->getIsJustConfirmed()) {
111
+ $this->_welcomeCustomer($session->getCustomer(), true);
112
+ }
113
+ } catch (Mage_Core_Exception $e) {
114
+ switch ($e->getCode()) {
115
+ case Mage_Customer_Model_Customer::EXCEPTION_EMAIL_NOT_CONFIRMED:
116
+ $value = $this->_getHelper('customer')->getEmailConfirmationUrl($login['username']);
117
+ $message = $this->_getHelper('customer')->__('This account is not confirmed. <a href="%s">Click here</a> to resend confirmation email.', $value);
118
+ break;
119
+ case Mage_Customer_Model_Customer::EXCEPTION_INVALID_EMAIL_OR_PASSWORD:
120
+ $message = $e->getMessage();
121
+ break;
122
+ default:
123
+ $message = $e->getMessage();
124
+ }
125
+ $session->addError($message);
126
+ $session->setUsername($login['username']);
127
+ } catch (Exception $e) {
128
+ // Mage::logException($e); // PA DSS violation: this exception log can disclose customer password
129
+ }
130
+ } else {
131
+ $session->addError($this->__('Login and password are required.'));
132
+ }
133
+ }
134
+
135
+ $this->_loginPostRedirect();
136
+ }
137
+
138
+ public function editPostAction()
139
+ {
140
+ if (!$this->_validateFormKey()) {
141
+ return $this->_redirect('*/*/edit');
142
+ }
143
+
144
+ if ($this->getRequest()->isPost()) {
145
+ /** @var $customer Mage_Customer_Model_Customer */
146
+ $customer = $this->_getSession()->getCustomer();
147
+ $customer->setOldEmail($customer->getEmail());
148
+ /** @var $customerForm Mage_Customer_Model_Form */
149
+ $customerForm = $this->_getModel('customer/form');
150
+ $customerForm->setFormCode('customer_account_edit')
151
+ ->setEntity($customer);
152
+
153
+ $customerData = $customerForm->extractData($this->getRequest());
154
+
155
+ $errors = array();
156
+ $customerErrors = $customerForm->validateData($customerData);
157
+ if ($customerErrors !== true) {
158
+ $errors = array_merge($customerErrors, $errors);
159
+ } else {
160
+ $customerForm->compactData($customerData);
161
+ $errors = array();
162
+
163
+ if (!$customer->validatePassword($this->getRequest()->getPost('current_password'))) {
164
+ $errors[] = $this->__('Invalid current password');
165
+ }
166
+
167
+ // If email change was requested then set flag
168
+ $isChangeEmail = ($customer->getOldEmail() != $customer->getEmail()) ? true : false;
169
+ $customer->setIsChangeEmail($isChangeEmail);
170
+
171
+ // If password change was requested then add it to common validation scheme
172
+ $customer->setIsChangePassword($this->getRequest()->getParam('change_password'));
173
+
174
+ if ($customer->getIsChangePassword()) {
175
+ $newPass = $this->getRequest()->getPost('password');
176
+ $confPass = $this->getRequest()->getPost('confirmation');
177
+
178
+ if (strlen($newPass)) {
179
+ /**
180
+ * Set entered password and its confirmation - they
181
+ * will be validated later to match each other and be of right length
182
+ */
183
+ $customer->setPassword($newPass);
184
+ $customer->setPasswordConfirmation($confPass);
185
+ } else {
186
+ $errors[] = $this->__('New password field cannot be empty.');
187
+ }
188
+ }
189
+
190
+ // Validate account and compose list of errors if any
191
+ $customerErrors = $customer->validate();
192
+ if (is_array($customerErrors)) {
193
+ $errors = array_merge($errors, $customerErrors);
194
+ }
195
+ }
196
+
197
+ if (!empty($errors)) {
198
+ $this->_getSession()->setCustomerFormData($this->getRequest()->getPost());
199
+ foreach ($errors as $message) {
200
+ $this->_getSession()->addError($message);
201
+ }
202
+ $this->_redirect('*/*/edit');
203
+ return $this;
204
+ }
205
+
206
+ try {
207
+ $customer->cleanPasswordsValidationData();
208
+
209
+ // Reset all password reset tokens if all data was sufficient and correct on email change
210
+ if ($customer->getIsChangeEmail()) {
211
+ $customer->setRpToken(null);
212
+ $customer->setRpTokenCreatedAt(null);
213
+ }
214
+
215
+ $postMobile = $this->getRequest()->getPost('mobile');
216
+ if(!empty($postMobile)){
217
+ $currentCustomerId = Mage::getSingleton('customer/session')->getCustomer()->getId();
218
+ $customerModel = Mage::getModel('customer/customer')->load($currentCustomerId);
219
+ $currentCustomerMobile = $customerModel->getMobile();
220
+ $customerCollection = Mage::getModel('customer/customer')->getCollection();
221
+ $customerCollection->addAttributeToSelect(array('mobile', 'firstname', 'lastname', 'email'));
222
+ $allMobileArr = array();
223
+
224
+
225
+
226
+ foreach ($customerCollection as $singleCustomer) {
227
+ $allMobileArr[] = $singleCustomer->getMobile();
228
+ }
229
+
230
+ if($currentCustomerMobile == $postMobile){
231
+ $customer->setMobile($currentCustomerMobile);
232
+ }elseif(in_array($postMobile, $allMobileArr)){
233
+ Mage::getSingleton('core/session')->addError('Mobile number is already in use.');
234
+ $url = Mage::getUrl('customer/account/edit');
235
+ $response = Mage::app()->getFrontController()->getResponse();
236
+ $response->setRedirect($url);
237
+ $response->sendResponse();
238
+ exit;
239
+ }
240
+ else{
241
+ $customer->setMobile($postMobile);
242
+ }
243
+ }
244
+ $customer->save();
245
+ $this->_getSession()->setCustomer($customer)
246
+ ->addSuccess($this->__('The account information has been saved.'));
247
+
248
+ if ($customer->getIsChangeEmail() || $customer->getIsChangePassword()) {
249
+ $customer->sendChangedPasswordOrEmail();
250
+ }
251
+
252
+ $this->_redirect('customer/account');
253
+ return;
254
+ } catch (Mage_Core_Exception $e) {
255
+ $this->_getSession()->setCustomerFormData($this->getRequest()->getPost())
256
+ ->addError($e->getMessage());
257
+ } catch (Exception $e) {
258
+ $this->_getSession()->setCustomerFormData($this->getRequest()->getPost())
259
+ ->addException($e, $this->__('Cannot save the customer.'));
260
+ }
261
+ }
262
+
263
+ $this->_redirect('*/*/edit');
264
+ }
265
+ }
app/code/community/Webcreta/UserandMobile/etc/adminhtml.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <userandmobile translate="title" module="userandmobile">
12
+ <title>Username and Mobile Section</title>
13
+ <sort_order>0</sort_order>
14
+ </userandmobile>
15
+ </children>
16
+ </config>
17
+ </children>
18
+ </system>
19
+ </children>
20
+ </admin>
21
+ </resources>
22
+ </acl>
23
+ </config>
app/code/community/Webcreta/UserandMobile/etc/config.xml ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Webcreta_UserandMobile>
5
+ <version>1.0.1</version>
6
+ </Webcreta_UserandMobile>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <userandmobile>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Webcreta_UserandMobile</module>
14
+ <frontName>userandmobile</frontName>
15
+ </args>
16
+ </userandmobile>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <userandmobile>
21
+ <file>userandmobile.xml</file>
22
+ </userandmobile>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <global>
27
+ <models>
28
+ <checkout>
29
+ <rewrite>
30
+ <type_onepage>Webcreta_UserandMobile_Model_Checkout_Type_Onepage</type_onepage>
31
+ </rewrite>
32
+ </checkout>
33
+ </models>
34
+ <rewrite>
35
+ <webcreta_userandmobile_customer_accountcontroller>
36
+ <from><![CDATA[#^/customer/account/#]]></from>
37
+ <to>/userandmobile/customer_account/</to>
38
+ </webcreta_userandmobile_customer_accountcontroller>
39
+ <webcreta_userandmobile_customer_onepagecontroller>
40
+ <from><![CDATA[#^/checkout/onepage/#]]></from>
41
+ <to>/userandmobile/checkout_onepage/</to>
42
+ </webcreta_userandmobile_customer_onepagecontroller>
43
+ </rewrite>
44
+ <helpers>
45
+ <userandmobile>
46
+ <class>Webcreta_UserandMobile_Helper</class>
47
+ </userandmobile>
48
+ </helpers>
49
+ <blocks>
50
+ <userandmobile>
51
+ <class>Webcreta_UserandMobile_Block</class>
52
+ </userandmobile>
53
+ </blocks>
54
+ <models>
55
+ <userandmobile>
56
+ <class>Webcreta_UserandMobile_Model</class>
57
+ <resourceModel>userandmobile_mysql4</resourceModel>
58
+ </userandmobile>
59
+ </models>
60
+ <resources>
61
+ <userandmobile_setup>
62
+ <setup>
63
+ <module>Webcreta_UserandMobile</module>
64
+ <class>Mage_Eav_Model_Entity_Setup</class>
65
+ </setup>
66
+ <connection>
67
+ <use>core_setup</use>
68
+ </connection>
69
+ </userandmobile_setup>
70
+ <userandmobile_write>
71
+ <connection>
72
+ <use>core_write</use>
73
+ </connection>
74
+ </userandmobile_write>
75
+ <userandmobile_read>
76
+ <connection>
77
+ <use>core_read</use>
78
+ </connection>
79
+ </userandmobile_read>
80
+ </resources>
81
+ </global>
82
+ <admin>
83
+ <routers>
84
+ <userandmobile>
85
+ <use>admin</use>
86
+ <args>
87
+ <module>Webcreta_UserandMobile</module>
88
+ <frontName>admin_userandmobile</frontName>
89
+ </args>
90
+ </userandmobile>
91
+ <adminhtml>
92
+ <args>
93
+ <modules>
94
+ <Webcreta_UserandMobile before="Mage_Adminhtml">Webcreta_UserandMobile_Adminhtml</Webcreta_UserandMobile>
95
+ </modules>
96
+ </args>
97
+ </adminhtml>
98
+ </routers>
99
+ </admin>
100
+ <adminhtml>
101
+ <acl>
102
+ <resources>
103
+ <all>
104
+ <title>Allow Everything</title>
105
+ </all>
106
+ <admin>
107
+ <children>
108
+ <userandmobile translate="title" module="userandmobile">
109
+ <title>UserandMobile</title>
110
+ <sort_order>1000</sort_order>
111
+ <children>
112
+ <userandmobilebackend translate="title">
113
+ <title>Backend Page Title</title>
114
+ </userandmobilebackend>
115
+ </children>
116
+ </userandmobile>
117
+ </children>
118
+ </admin>
119
+ </resources>
120
+ </acl>
121
+ </adminhtml>
122
+ </config>
app/code/community/Webcreta/UserandMobile/etc/system.xml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <webcreta translate="label" module="userandmobile">
5
+ <label>Webcreta</label>
6
+ <sort_order>0</sort_order>
7
+ </webcreta>
8
+ </tabs>
9
+ <sections>
10
+ <userandmobile translate="label" module="userandmobile">
11
+ <label>Username and Mobile</label>
12
+ <tab>customer</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>0</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <usermobile translate="label">
20
+ <label>Manage Username and Mobile</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>0</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <enable translate="label">
28
+ <label>Enable</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>0</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ <comment>Please enable/disable module</comment>
36
+ </enable>
37
+ </fields>
38
+ </usermobile>
39
+ </groups>
40
+ </userandmobile>
41
+ </sections>
42
+ </config>
app/code/community/Webcreta/UserandMobile/sql/userandmobile_setup/install-1.0.1.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $store = Mage::app()->getStore(Mage_Core_Model_App::ADMIN_STORE_ID);
5
+
6
+ $eavConfig = Mage::getSingleton('eav/config');
7
+ $attribute = array(
8
+ 'label' => 'mobile',
9
+ 'visible' => true,
10
+ 'unique' => true,
11
+ 'required' => false,
12
+ 'type' => 'varchar',
13
+ 'input' => 'text',
14
+ 'sort_order' => 65,
15
+ 'validate_rules' => array(
16
+ 'max_text_length' => 30,
17
+ 'min_text_length' => 1
18
+ ),
19
+ 'used_in_forms' => array('adminhtml_customer','adminhtml_checkout','customer_account_edit', 'customer_account_create', 'checkout_register'),
20
+ );
21
+
22
+ $installer->addAttribute('customer','mobile', $attribute);
23
+
24
+ $attributes = array('mobile' => $attribute);
25
+
26
+ foreach ($attributes as $attributeCode => $data) {
27
+ $attribute = $eavConfig->getAttribute('customer', $attributeCode);
28
+ $attribute->setWebsite( (($store->getWebsite())?$store->getWebsite():0));
29
+ $attribute->addData($data);
30
+ if (false === ($attribute->getIsSystem() == 1 && $attribute->getIsVisible() == 0)) {
31
+ $usedInForms = array(
32
+ 'customer_account_create',
33
+ 'customer_account_edit',
34
+ 'checkout_register',
35
+ );
36
+ if (!empty($data['adminhtml_only'])) {
37
+ $usedInForms = array('adminhtml_customer');
38
+ } else {
39
+ $usedInForms[] = 'adminhtml_customer';
40
+ }
41
+ if (!empty($data['adminhtml_checkout'])) {
42
+ $usedInForms[] = 'adminhtml_checkout';
43
+ }else {
44
+ $usedInForms[] = 'adminhtml_checkout';
45
+ }
46
+
47
+ $attribute->setData('used_in_forms', $usedInForms);
48
+ }
49
+ $attribute->save();
50
+ }
51
+
52
+ $installer->startSetup();
53
+
54
+ $result = $installer->getConnection()->raw_fetchRow("SHOW COLUMNS from {$this->getTable('sales_flat_quote')} like '%customer_mobile%'");
55
+ if(!is_array($result) || !in_array('customer_mobile', $result)){
56
+ $installer->run("
57
+ ALTER TABLE `{$this->getTable('sales_flat_quote')}`
58
+ ADD `customer_mobile` VARCHAR( 255 ) NULL AFTER `customer_taxvat`
59
+ ");
60
+ }
61
+
62
+ $installer->endSetup();
63
+
64
+ ?>
app/design/frontend/base/default/layout/userandmobile.xml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ </default>
5
+ <customer_account_create>
6
+ <reference name="customer_form_register">
7
+ <action method="setTemplate" ifconfig="userandmobile/usermobile/enable"><template>userandmobile/register.phtml</template></action>
8
+ </reference>
9
+ </customer_account_create>
10
+ <customer_account_login>
11
+ <reference name="customer_form_login">
12
+ <action method="setTemplate" ifconfig="userandmobile/usermobile/enable"><template>userandmobile/login.phtml</template></action>
13
+ </reference>
14
+ </customer_account_login>
15
+ <customer_account_edit>
16
+ <reference name="my.account.wrapper" ifconfig="userandmobile/usermobile/enable">
17
+ <block type="customer/form_edit" name="customer_edit" template="userandmobile/edit.phtml"/>
18
+ </reference>
19
+ </customer_account_edit>
20
+ <checkout_onepage_index>
21
+ <reference name="checkout.onepage.login">
22
+ <action method="setTemplate" ifconfig="userandmobile/usermobile/enable"><template>userandmobile/checkout/onepage/login.phtml</template></action>
23
+ </reference>
24
+ <reference name="checkout.onepage.billing">
25
+ <action method="setTemplate" ifconfig="userandmobile/usermobile/enable"><template>userandmobile/checkout/onepage/billing.phtml</template></action>
26
+ </reference>
27
+ </checkout_onepage_index>
28
+ </layout>
app/design/frontend/base/default/template/userandmobile/checkout/onepage/billing.phtml ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <form id="co-billing-form" action="">
2
+ <div class="fieldset">
3
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
4
+ <ul class="form-list">
5
+ <?php if ($this->customerHasAddresses()): ?>
6
+ <li class="wide">
7
+ <label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
8
+ <div class="input-box">
9
+ <?php echo $this->getAddressesHtmlSelect('billing') ?>
10
+ </div>
11
+ </li>
12
+ <?php endif; ?>
13
+ <li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?> class="scaffold-form">
14
+ <div class="fieldset">
15
+ <input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
16
+ <ul>
17
+ <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setForceUseCustomerRequiredAttributes(!$this->isCustomerLoggedIn())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
18
+ <li class="fields">
19
+ <div class="field">
20
+ <label for="billing:company"><?php echo $this->__('Company') ?></label>
21
+ <div class="input-box">
22
+ <input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->quoteEscape($this->__('Company')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
23
+ </div>
24
+ </div>
25
+ <?php if(!$this->isCustomerLoggedIn()): ?>
26
+ <div class="field">
27
+ <label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
28
+ <div class="input-box">
29
+ <input type="email" autocapitalize="off" autocorrect="off" spellcheck="false" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo $this->quoteEscape($this->__('Email Address')) ?>" class="input-text validate-email required-entry" />
30
+ </div>
31
+ </div>
32
+ <div class="field mobile">
33
+ <label for="mobile" class="required"><em>*</em>Mobile</label>
34
+ <div class="input-box">
35
+ <input type="text" id="mobile" name="mobile" value="" title="Mobile Number" class="input-text required-entry validate-length maximum-length-10 minimum-length-10 validate-digits">
36
+ </div>
37
+ </div>
38
+ <?php endif; ?>
39
+ </li>
40
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
41
+ <li class="wide">
42
+ <label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
43
+ <div class="input-box">
44
+ <input type="text" title="<?php echo $this->quoteEscape($this->__('Street Address')) ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
45
+ </div>
46
+ </li>
47
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
48
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
49
+ <li class="wide">
50
+ <label for="billing:street<?php echo $_i ?>"><?php echo $this->__('Street Address %s', $_i) ?></label>
51
+ <div class="input-box">
52
+ <input type="text" title="<?php echo $this->quoteEscape($this->__('Street Address %s', $_i)) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
53
+ </div>
54
+ </li>
55
+ <?php endfor; ?>
56
+ <?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
57
+ <li class="wide">
58
+ <label for="billing:vat_id"><?php echo $this->__('VAT Number') ?></label>
59
+ <div class="input-box">
60
+ <input type="text" id="billing:vat_id" name="billing[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" title="<?php echo $this->quoteEscape($this->__('VAT Number')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
61
+ </div>
62
+ </li>
63
+ <?php endif; ?>
64
+ <li class="fields">
65
+ <div class="field">
66
+ <label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
67
+ <div class="input-box">
68
+ <input type="text" title="<?php echo $this->quoteEscape($this->__('City')) ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="billing:city" />
69
+ </div>
70
+ </div>
71
+ <div class="field">
72
+ <label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
73
+ <div class="input-box">
74
+ <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->quoteEscape($this->__('State/Province')) ?>" class="validate-select" style="display:none;">
75
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
76
+ </select>
77
+ <script type="text/javascript">
78
+ //<![CDATA[
79
+ $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
80
+ //]]>
81
+ </script>
82
+ <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->quoteEscape($this->__('State/Province')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
83
+ </div>
84
+ </div>
85
+ </li>
86
+ <li class="fields">
87
+ <div class="field">
88
+ <label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
89
+ <div class="input-box">
90
+ <input type="text" title="<?php echo $this->quoteEscape($this->__('Zip/Postal Code')) ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
91
+ </div>
92
+ </div>
93
+ <div class="field">
94
+ <label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
95
+ <div class="input-box">
96
+ <?php echo $this->getCountryHtmlSelect('billing') ?>
97
+ </div>
98
+ </div>
99
+ </li>
100
+ <li class="fields">
101
+ <div class="field">
102
+ <label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
103
+ <div class="input-box">
104
+ <input type="tel" name="billing[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->quoteEscape($this->__('Telephone')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="billing:telephone" />
105
+ </div>
106
+ </div>
107
+ <div class="field">
108
+ <label for="billing:fax"><?php echo $this->__('Fax') ?></label>
109
+ <div class="input-box">
110
+ <input type="tel" name="billing[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->quoteEscape($this->__('Fax')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="billing:fax" />
111
+ </div>
112
+ </div>
113
+ </li>
114
+
115
+ <?php if(!$this->isCustomerLoggedIn()): ?>
116
+
117
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
118
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
119
+ <?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
120
+ <li class="fields">
121
+ <?php if ($_dob->isEnabled()): ?>
122
+ <div class="field">
123
+ <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
124
+ </div>
125
+ <?php endif; ?>
126
+ <?php if ($_gender->isEnabled()): ?>
127
+ <div class="field">
128
+ <?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
129
+ </div>
130
+ <?php endif ?>
131
+ </li>
132
+ <?php endif ?>
133
+
134
+ <?php if ($this->isTaxvatEnabled()):?>
135
+ <li><?php echo $this->getTaxvatHtml() ?></li>
136
+ <?php endif; ?>
137
+
138
+ <li class="fields" id="register-customer-password">
139
+ <div class="field">
140
+ <label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
141
+ <div class="input-box">
142
+ <input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->quoteEscape($this->__('Password')) ?>" class="input-text required-entry validate-password" />
143
+ </div>
144
+ </div>
145
+ <div class="field">
146
+ <label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
147
+ <div class="input-box">
148
+ <input type="password" name="billing[confirm_password]" title="<?php echo $this->quoteEscape($this->__('Confirm Password')) ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
149
+ </div>
150
+ </div>
151
+ </li>
152
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
153
+ <?php endif; ?>
154
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
155
+ <li class="control">
156
+ <input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->quoteEscape($this->__('Save in address book')) ?>" id="billing:save_in_address_book" onchange="if(window.shipping) shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
157
+ </li>
158
+ <?php else:?>
159
+ <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
160
+ <?php endif; ?>
161
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
162
+ </ul>
163
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
164
+ </div>
165
+ </li>
166
+ <?php if ($this->canShip()): ?>
167
+ <li class="control">
168
+ <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1"<?php if ($this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->quoteEscape($this->__('Ship to this address')) ?>" onclick="$('shipping:same_as_billing').checked = true;" class="radio" /><label for="billing:use_for_shipping_yes"><?php echo $this->__('Ship to this address') ?></label></li>
169
+ <li class="control">
170
+ <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0"<?php if (!$this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->quoteEscape($this->__('Ship to different address')) ?>" onclick="$('shipping:same_as_billing').checked = false;" class="radio" /><label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
171
+ </li>
172
+ <?php endif; ?>
173
+ </ul>
174
+ <?php if (!$this->canShip()): ?>
175
+ <input type="hidden" name="billing[use_for_shipping]" value="1" />
176
+ <?php endif; ?>
177
+ <div class="buttons-set" id="billing-buttons-container">
178
+ <button type="button" title="<?php echo $this->quoteEscape($this->__('Continue')) ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
179
+ <span class="please-wait" id="billing-please-wait" style="display:none;">
180
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->quoteEscape($this->__('Loading next step...')) ?>" title="<?php echo $this->quoteEscape($this->__('Loading next step...')) ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
181
+ </span>
182
+ </div>
183
+ </div>
184
+ </form>
185
+ <script type="text/javascript">
186
+ //<![CDATA[
187
+ var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
188
+ var billingForm = new VarienForm('co-billing-form');
189
+
190
+ //billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->jsQuoteEscape($this->__('Select State/Province...')) ?>');
191
+ $('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
192
+
193
+ var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'billing:postcode');
194
+ if ($('onepage-guest-register-button')) {
195
+ Event.observe($('onepage-guest-register-button'), 'click', function(event) {
196
+ var billingRememberMe = $('co-billing-form').select('#remember-me-box');
197
+ if (billingRememberMe.length > 0) {
198
+ if ($('login:guest') && $('login:guest').checked) {
199
+ billingRememberMe[0].hide();
200
+ } else if ($('login:register') && ($('login:register').checked || $('login:register').type == 'hidden')) {
201
+ billingRememberMe[0].show();
202
+ }
203
+ }
204
+ });
205
+ }
206
+ //]]>
207
+ </script>
app/design/frontend/base/default/template/userandmobile/checkout/onepage/login.phtml ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php echo $this->getChildHtml('login_before') ?>
2
+ <div class="col2-set<?php if (!$this->helper('customer')->isRegistrationAllowed() && !$this->getQuote()->isAllowedGuestCheckout()) echo ' login-only' ?>">
3
+ <div class="col-1">
4
+ <h3>
5
+ <?php if( $this->getQuote()->isAllowedGuestCheckout() && $this->helper('customer')->isRegistrationAllowed() ): ?>
6
+ <?php echo $this->__('Checkout as a Guest or Register') ?>
7
+ <?php elseif ( $this->getQuote()->isAllowedGuestCheckout() && !$this->helper('customer')->isRegistrationAllowed() ): ?>
8
+ <?php echo $this->__('Checkout as a Guest') ?>
9
+ <?php else: ?>
10
+ <?php echo $this->__('Register to Create an Account') ?>
11
+ <?php endif; ?>
12
+ </h3>
13
+ <?php if( !$this->getQuote()->isAllowedGuestCheckout() && $this->helper('customer')->isRegistrationAllowed() ): ?>
14
+ <p class="description"><?php echo $this->__('Register and save time!') ?></strong><br />
15
+ <?php echo $this->__('Register with us for future convenience:') ?></p>
16
+ <ul>
17
+ <li><?php echo $this->__('Fast and easy check out') ?></li>
18
+ <li><?php echo $this->__('Easy access to your order history and status') ?></li>
19
+ </ul>
20
+ <?php elseif( $this->getQuote()->isAllowedGuestCheckout() && $this->helper('customer')->isRegistrationAllowed() ): ?>
21
+ <p class="description"><?php echo $this->__('Register with us for future convenience:') ?></p>
22
+ <?php endif ?>
23
+ <?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
24
+ <ul class="form-list">
25
+ <?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
26
+ <li class="control">
27
+ <input type="radio" name="checkout_method" id="login:guest" value="guest"<?php if($this->getQuote()->getCheckoutMethod()!=Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER): ?> checked="checked"<?php endif; ?> class="radio" /><label for="login:guest"><?php echo $this->__('Checkout as Guest') ?></label>
28
+ </li>
29
+ <?php endif; ?>
30
+ <?php if( $this->helper('customer')->isRegistrationAllowed() ): ?>
31
+ <li class="control">
32
+ <input type="radio" name="checkout_method" id="login:register" value="register"<?php if($this->getQuote()->getCheckoutMethod()==Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER || !$this->getQuote()->isAllowedGuestCheckout()): ?> checked="checked"<?php endif ?> class="radio" />
33
+ <label for="login:register"><?php echo $this->__('Register and Checkout') ?></label>
34
+ </li>
35
+ <?php endif; ?>
36
+ </ul>
37
+ <?php else: ?>
38
+ <input type="hidden" name="checkout_method" id="login:register" value="register" checked="checked" />
39
+ <?php endif; ?>
40
+ <div class="buttons-set">
41
+ <p class="required">&nbsp;</p>
42
+ <?php if ($this->getQuote()->isAllowedGuestCheckout()): ?>
43
+ <button id="onepage-guest-register-button" type="button" class="button" onclick="checkout.setMethod();"><span><span><?php echo $this->__('Continue') ?></span></span></button>
44
+ <?php elseif ($this->helper('checkout')->isCustomerMustBeLogged()): ?>
45
+ <button id="onepage-guest-register-button" type="button" class="button" onclick="window.location='<?php echo $this->helper('checkout/url')->getRegistrationUrl();?>'"><span><span><?php echo $this->__('Register') ?></span></span></button>
46
+ <?php else: ?>
47
+ <form action="<?php echo $this->getUrl('persistent/index/saveMethod'); ?>">
48
+ <button id="onepage-guest-register-button" type="submit" class="button"><span><span><?php echo $this->__('Register') ?></span></span></button>
49
+ </form>
50
+ <?php endif; ?>
51
+ </div>
52
+ </div>
53
+ <div class="col-2">
54
+ <h3><?php echo $this->__('Returning Customers') ?></h3>
55
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
56
+ <form id="login-form" action="<?php echo $this->getPostAction() ?>" method="post">
57
+ <div class="fieldset">
58
+ <?php echo $this->getBlockHtml('formkey'); ?>
59
+ <p class="description"><?php echo $this->__('Sign in to speed up your checkout process') ?></p>
60
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
61
+ <ul class="form-list">
62
+ <li>
63
+ <label for="mobile" class="required"><em>*</em>Mobile/Email</label>
64
+ <div class="input-box">
65
+ <input type="text" name="login[username]" value="" id="mobile" class="input-text required-entry validate" title="Mobile Number">
66
+ </div>
67
+ </li>
68
+ <li>
69
+ <label for="login-password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
70
+ <div class="input-box">
71
+ <input type="password" class="input-text validate-password required-entry" id="login-password" name="login[password]" />
72
+ </div>
73
+ </li>
74
+ <li>
75
+ <a href="<?php echo $this->getUrl('customer/account/forgotpassword') ?>" class="f-left"><?php echo $this->__('Forgot your password?') ?></a>
76
+ </li>
77
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
78
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
79
+ </ul>
80
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
81
+ <input name="context" type="hidden" value="checkout" />
82
+ </div>
83
+ </form>
84
+ <div class="buttons-set">
85
+ <button type="submit" class="button" onclick="onepageLogin(this)"><span><span><?php echo $this->__('Login') ?></span></span></button>
86
+ </div>
87
+ </div>
88
+ </div>
89
+
90
+ <script type="text/javascript">
91
+ //<![CDATA[
92
+ var loginForm = new VarienForm('login-form', true);
93
+ $('login-email').observe('keypress', bindLoginPost);
94
+ $('login-password').observe('keypress', bindLoginPost);
95
+ function bindLoginPost(evt){
96
+ if (evt.keyCode == Event.KEY_RETURN) {
97
+ loginForm.submit();
98
+ }
99
+ }
100
+ function onepageLogin(button)
101
+ {
102
+ if(loginForm.validator && loginForm.validator.validate()){
103
+ button.disabled = true;
104
+ loginForm.submit();
105
+ }
106
+ }
107
+ //]]>
108
+ </script>
109
+ <?php
110
+ $registerParam = $this->getRequest()->getParam('register');
111
+ if ($registerParam || $registerParam === ''):
112
+ ?>
113
+ <script type="text/javascript">
114
+ //<![CDATA[
115
+ document.observe("dom:loaded", function() {
116
+ if($('login:register')) {
117
+ $('login:register').checked = true;
118
+ checkout.setMethod();
119
+ }
120
+ })
121
+ //]]>
122
+ </script>
123
+ <?php endif; ?>
app/design/frontend/base/default/template/userandmobile/edit.phtml ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="page-title">
2
+ <h1><?php echo $this->__('Edit Account Information') ?></h1>
3
+ </div>
4
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
5
+ <form action="<?php echo $this->getUrl('customer/account/editPost') ?>" method="post" autocomplete="off" id="form-validate" class="scaffold-form" enctype="multipart/form-data">
6
+ <div class="fieldset">
7
+ <?php echo $this->getBlockHtml('formkey')?>
8
+ <h2 class="legend"><?php echo $this->__('Account Information') ?></h2>
9
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
10
+ <ul class="form-list">
11
+ <li class="fields">
12
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getCustomer())->toHtml() ?>
13
+ </li>
14
+ <li>
15
+ <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
16
+ <div class="input-box">
17
+ <input type="email" autocapitalize="off" autocorrect="off" spellcheck="false" name="email" id="email" value="<?php echo $this->escapeHtml($this->getCustomer()->getEmail()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Email Address')) ?>" class="input-text required-entry validate-email" />
18
+ </div>
19
+ </li>
20
+ <?php $checkEnable = Mage::getStoreConfig('userandmobile/usermobile/enable'); ?>
21
+ <?php if($checkEnable == true): ?>
22
+ <li>
23
+ <label for="mobile" class="required"><em>*</em>Mobile</label>
24
+ <div class="input-box">
25
+ <input type="text" id="mobile" name="mobile" value="<?php echo $this->escapeHtml($this->getCustomer()->getMobile()) ?>" title="Mobile Number" maxlength="20" class="input-text required-entry validate-length maximum-length-10 minimum-length-10 validate-digits">
26
+ </div>
27
+ </li>
28
+ <?php endif; ?>
29
+
30
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
31
+ <?php if ($_dob->isEnabled()): ?>
32
+ <li><?php echo $_dob->setDate($this->getCustomer()->getDob())->toHtml() ?></li>
33
+ <?php endif ?>
34
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
35
+ <?php if ($_taxvat->isEnabled()): ?>
36
+ <li><?php echo $_taxvat->setTaxvat($this->getCustomer()->getTaxvat())->toHtml() ?></li>
37
+ <?php endif ?>
38
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
39
+ <?php if ($_gender->isEnabled()): ?>
40
+ <li><?php echo $_gender->setGender($this->getCustomer()->getGender())->toHtml() ?></li>
41
+ <?php endif ?>
42
+ <li>
43
+ <label for="current_password" class="required"><em>*</em><?php echo Mage::helper('core')->quoteEscape($this->__('Current Password')) ?></label>
44
+ <div class="input-box">
45
+ <!-- This is a dummy hidden field to trick firefox from auto filling the password -->
46
+ <input type="text" class="input-text no-display" name="dummy" id="dummy" />
47
+ <input type="password" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Current Password')) ?>" class="input-text required-entry" name="current_password" id="current_password" />
48
+ </div>
49
+ </li>
50
+ <li class="control">
51
+ <input type="checkbox" name="change_password" id="change_password" value="1" onclick="setPasswordForm(this.checked)" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Change Password')) ?>"<?php if($this->getCustomer()->getChangePassword()==1): ?> checked="checked"<?php endif; ?> class="checkbox" /><label for="change_password"><?php echo $this->__('Change Password') ?></label>
52
+ </li>
53
+ </ul>
54
+ </div>
55
+ <div class="fieldset" style="display:none;">
56
+ <h2 class="legend"><?php echo $this->__('Change Password') ?></h2>
57
+ <ul class="form-list">
58
+ <li class="fields">
59
+ <div class="field">
60
+ <label for="password" class="required"><em>*</em><?php echo $this->__('New Password') ?></label>
61
+ <div class="input-box">
62
+ <input type="password" title="<?php echo Mage::helper('core')->quoteEscape($this->__('New Password')) ?>" class="input-text required-entry validate-password" name="password" id="password" />
63
+ </div>
64
+ </div>
65
+ <div class="field">
66
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm New Password') ?></label>
67
+ <div class="input-box">
68
+ <input type="password" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Confirm New Password')) ?>" class="input-text required-entry validate-cpassword" name="confirmation" id="confirmation" />
69
+ </div>
70
+ </div>
71
+ </li>
72
+ </ul>
73
+ </div>
74
+ <div class="buttons-set">
75
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
76
+ <button type="submit" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Save')) ?>" class="button"><span><span><?php echo $this->__('Save') ?></span></span></button>
77
+ </div>
78
+ </form>
79
+ <script type="text/javascript">
80
+ //<![CDATA[
81
+ var dataForm = new VarienForm('form-validate', true);
82
+ function setPasswordForm(arg){
83
+ $('password').up('.fieldset')[arg ? 'show': 'hide']();
84
+ }
85
+
86
+ <?php if($this->getCustomer()->getChangePassword()): ?>
87
+ setPasswordForm(true);
88
+ <?php endif; ?>
89
+ //]]>
90
+ </script>
app/design/frontend/base/default/template/userandmobile/login.phtml ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="account-login<?php if (!$this->helper('customer')->isRegistrationAllowed()) echo ' login-only' ?>">
2
+ <div class="page-title">
3
+ <h1><?php if ($this->helper('customer')->isRegistrationAllowed()): ?>
4
+ <?php echo $this->__('Login or Create an Account') ?>
5
+ <?php else: ?>
6
+ <?php echo $this->__('Login'); ?>
7
+ <?php endif; ?></h1>
8
+ </div>
9
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
10
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form" class="scaffold-form">
11
+ <?php echo $this->getBlockHtml('formkey'); ?>
12
+ <div class="col2-set">
13
+ <?php if ($this->helper('customer')->isRegistrationAllowed()): ?>
14
+ <div class="col-1 new-users">
15
+ <div class="content">
16
+ <h2><?php echo $this->__('New Here?') ?></h2>
17
+ <p class="form-instructions"><?php echo $this->__('Registration is free and easy!') ?></p>
18
+ <ul class="benefits">
19
+ <li><?php echo $this->__('Faster checkout') ?></li>
20
+ <li><?php echo $this->__('Save multiple shipping addresses') ?></li>
21
+ <li><?php echo $this->__('View and track orders and more') ?></li>
22
+ </ul>
23
+ </div>
24
+ <div class="buttons-set">
25
+ <a title="<?php echo $this->quoteEscape($this->__('Create an Account')) ?>" class="button" href="<?php echo Mage::helper('persistent')->getCreateAccountUrl($this->getCreateAccountUrl()) ?>"><span><span><?php echo $this->__('Create an Account') ?></span></span></a>
26
+ </div>
27
+ </div>
28
+ <?php endif; ?>
29
+ <?php // This column should be col-1 if the registration column is not displayed ?>
30
+ <div class="<?php if ($this->helper('customer')->isRegistrationAllowed()): ?>col-2<?php else: ?>col-1<?php endif; ?> registered-users">
31
+ <div class="content fieldset">
32
+ <h2><?php echo $this->__('Already registered?') ?></h2>
33
+ <p class="form-instructions"><?php echo $this->__('If you have an account with us, please log in.') ?></p>
34
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
35
+ <ul class="form-list">
36
+ <li>
37
+ <label for="mobile" class="required"><em>*</em>Mobile/Email</label>
38
+ <div class="input-box">
39
+ <input type="text" name="login[username]" value="" id="mobile" class="input-text required-entry validate" title="Mobile Number">
40
+ </div>
41
+ </li>
42
+ <li>
43
+ <label for="pass" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
44
+ <div class="input-box">
45
+ <input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->quoteEscape($this->__('Password')) ?>" />
46
+ </div>
47
+ </li>
48
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
49
+ <li>
50
+ <a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('Forgot Your Password?') ?></a>
51
+ </li>
52
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
53
+ </ul>
54
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
55
+ </div>
56
+ <div class="buttons-set">
57
+ <button type="submit" class="button" title="<?php echo $this->quoteEscape($this->__('Login')) ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ <?php if (Mage::helper('checkout')->isContextCheckout()): ?>
62
+ <input name="context" type="hidden" value="checkout" />
63
+ <?php endif; ?>
64
+ </form>
65
+ <script type="text/javascript">
66
+ //<![CDATA[
67
+ var dataForm = new VarienForm('login-form', true);
68
+ //]]>
69
+ </script>
70
+ </div>
app/design/frontend/base/default/template/userandmobile/register.phtml ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="account-create">
2
+ <div class="page-title">
3
+ <h1><?php echo $this->__('Create an Account Rewrite') ?></h1>
4
+ </div>
5
+ <?php echo $this->getChildHtml('form_fields_before')?>
6
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
7
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate" class="scaffold-form" enctype="multipart/form-data">
8
+ <div class="fieldset">
9
+ <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
10
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
11
+ <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
12
+ <p class="form-instructions"><?php echo $this->__('Please enter the following information to create your account.') ?></p>
13
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
14
+ <ul class="form-list">
15
+ <li class="fields">
16
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->setForceUseCustomerAttributes(true)->toHtml() ?>
17
+ </li>
18
+ <div class="field mobile">
19
+ <label for="mobile" class="required"><em>*</em>Mobile</label>
20
+ <div class="input-box">
21
+ <input type="text" id="mobile" name="mobile" value="" title="Mobile Number" class="input-text required-entry validate-length maximum-length-10 minimum-length-10 validate-digits">
22
+ </div>
23
+ </div>
24
+ <li>
25
+ <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
26
+ <div class="input-box">
27
+ <input type="email" autocapitalize="off" autocorrect="off" spellcheck="false" name="email" id="email_address" value="<?php echo $this->escapeHtml($this->getFormData()->getEmail()) ?>" title="<?php echo $this->quoteEscape($this->__('Email Address')) ?>" class="input-text validate-email required-entry" />
28
+ </div>
29
+ </li>
30
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
31
+ <?php if ($_dob->isEnabled()): ?>
32
+ <li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
33
+ <?php endif ?>
34
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
35
+ <?php if ($_taxvat->isEnabled()): ?>
36
+ <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
37
+ <?php endif ?>
38
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
39
+ <?php if ($_gender->isEnabled()): ?>
40
+ <li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
41
+ <?php endif ?>
42
+
43
+ <?php if($this->getShowAddressFields()): ?>
44
+ <li class="hidden">
45
+ <input type="hidden" name="create_address" value="1" />
46
+ </li>
47
+ <li class="fields">
48
+ <div class="field">
49
+ <label for="company"><?php echo $this->__('Company') ?></label>
50
+ <div class="input-box">
51
+ <input type="text" name="company" id="company" value="<?php echo $this->escapeHtml($this->getFormData()->getCompany()) ?>" title="<?php echo $this->quoteEscape($this->__('Company')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
52
+ </div>
53
+ </div>
54
+ <div class="field">
55
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
56
+ <div class="input-box">
57
+ <input type="tel" name="telephone" id="telephone" value="<?php echo $this->escapeHtml($this->getFormData()->getTelephone()) ?>" title="<?php echo $this->quoteEscape($this->__('Telephone')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" />
58
+ </div>
59
+ </div>
60
+ </li>
61
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
62
+ <li class="wide">
63
+ <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
64
+ <div class="input-box">
65
+ <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet(0)) ?>" title="<?php echo $this->quoteEscape($this->__('Street Address')) ?>" id="street_1" class="input-text <?php echo $_streetValidationClass ?>" />
66
+ </div>
67
+ </li>
68
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
69
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
70
+ <li class="wide">
71
+ <label for="billing:street<?php echo $_i ?>"><?php echo $this->__('Street Address %s', $_i) ?></label>
72
+ <div class="input-box">
73
+ <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet($_i - 1)) ?>" title="<?php echo $this->quoteEscape($this->__('Street Address %s', $_i)) ?>" id="street_<?php echo $_i ?>" class="input-text <?php echo $_streetValidationClass ?>" />
74
+ </div>
75
+ </li>
76
+ <?php endfor; ?>
77
+ <li class="fields">
78
+ <div class="field">
79
+ <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
80
+ <div class="input-box">
81
+ <input type="text" name="city" value="<?php echo $this->escapeHtml($this->getFormData()->getCity()) ?>" title="<?php echo $this->quoteEscape($this->__('City')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="city" />
82
+ </div>
83
+ </div>
84
+ <div class="field">
85
+ <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
86
+ <div class="input-box">
87
+ <select id="region_id" name="region_id" title="<?php echo $this->quoteEscape($this->__('State/Province')) ?>" class="validate-select" style="display:none;">
88
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
89
+ </select>
90
+ <script type="text/javascript">
91
+ //<![CDATA[
92
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
93
+ //]]>
94
+ </script>
95
+ <input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getRegion()) ?>" title="<?php echo $this->quoteEscape($this->__('State/Province')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
96
+ </div>
97
+ </div>
98
+ </li>
99
+ <li class="fields">
100
+ <div class="field">
101
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
102
+ <div class="input-box">
103
+ <input type="text" name="postcode" value="<?php echo $this->escapeHtml($this->getFormData()->getPostcode()) ?>" title="<?php echo $this->quoteEscape($this->__('Zip/Postal Code')) ?>" id="zip" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
104
+ </div>
105
+ </div>
106
+ <div class="field">
107
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
108
+ <div class="input-box">
109
+ <?php echo $this->getCountryHtmlSelect() ?>
110
+ </div>
111
+ </div>
112
+ </li>
113
+ <li class="hidden">
114
+ <input type="hidden" name="default_billing" value="1" />
115
+ <input type="hidden" name="default_shipping" value="1" />
116
+ </li>
117
+ <?php endif; ?>
118
+ <li class="fields">
119
+ <div class="field">
120
+ <label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
121
+ <div class="input-box">
122
+ <input type="password" name="password" id="password" title="<?php echo $this->quoteEscape($this->__('Password')) ?>" class="input-text required-entry validate-password" />
123
+ </div>
124
+ </div>
125
+ <div class="field">
126
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
127
+ <div class="input-box">
128
+ <input type="password" name="confirmation" title="<?php echo $this->quoteEscape($this->__('Confirm Password')) ?>" id="confirmation" class="input-text required-entry validate-cpassword" />
129
+ </div>
130
+ </div>
131
+ </li>
132
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
133
+ <?php if ($this->isNewsletterEnabled()): ?>
134
+ <li class="control">
135
+ <div class="input-box">
136
+ <input type="checkbox" name="is_subscribed" title="<?php echo $this->quoteEscape($this->__('Sign Up for Newsletter')) ?>" value="1" id="is_subscribed"<?php if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" />
137
+ </div>
138
+ <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
139
+ </li>
140
+ <?php endif ?>
141
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
142
+ </ul>
143
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
144
+ </div>
145
+ <div class="buttons-set">
146
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
147
+ <button type="submit" title="<?php echo $this->quoteEscape($this->__('Register')) ?>" class="button"><span><span><?php echo $this->__('Register') ?></span></span></button>
148
+ </div>
149
+ <?php if (Mage::helper('checkout')->isContextCheckout()): ?>
150
+ <input name="context" type="hidden" value="checkout" />
151
+ <?php endif; ?>
152
+ </form>
153
+ <script type="text/javascript">
154
+ //<![CDATA[
155
+ var dataForm = new VarienForm('form-validate', true);
156
+ <?php if($this->getShowAddressFields()): ?>
157
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
158
+ <?php endif; ?>
159
+ //]]>
160
+ </script>
161
+ </div>
app/design/frontend/default/default/layout/userandmobile.xml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ </default>
5
+ <customer_account_create>
6
+ <reference name="customer_form_register">
7
+ <action method="setTemplate" ifconfig="userandmobile/usermobile/enable"><template>userandmobile/register.phtml</template></action>
8
+ </reference>
9
+ </customer_account_create>
10
+ <customer_account_login>
11
+ <reference name="customer_form_login">
12
+ <action method="setTemplate" ifconfig="userandmobile/usermobile/enable"><template>userandmobile/login.phtml</template></action>
13
+ </reference>
14
+ </customer_account_login>
15
+ <customer_account_edit>
16
+ <reference name="my.account.wrapper" ifconfig="userandmobile/usermobile/enable">
17
+ <block type="customer/form_edit" name="customer_edit" template="userandmobile/edit.phtml"/>
18
+ </reference>
19
+ </customer_account_edit>
20
+ <checkout_onepage_index>
21
+ <reference name="checkout.onepage.login">
22
+ <action method="setTemplate" ifconfig="userandmobile/usermobile/enable"><template>userandmobile/checkout/onepage/login.phtml</template></action>
23
+ </reference>
24
+ <reference name="checkout.onepage.billing">
25
+ <action method="setTemplate" ifconfig="userandmobile/usermobile/enable"><template>userandmobile/checkout/onepage/billing.phtml</template></action>
26
+ </reference>
27
+ </checkout_onepage_index>
28
+ </layout>
app/design/frontend/default/default/template/userandmobile/checkout/onepage/billing.phtml ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <form id="co-billing-form" action="">
2
+ <div class="fieldset">
3
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
4
+ <ul class="form-list">
5
+ <?php if ($this->customerHasAddresses()): ?>
6
+ <li class="wide">
7
+ <label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
8
+ <div class="input-box">
9
+ <?php echo $this->getAddressesHtmlSelect('billing') ?>
10
+ </div>
11
+ </li>
12
+ <?php endif; ?>
13
+ <li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?> class="scaffold-form">
14
+ <div class="fieldset">
15
+ <input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
16
+ <ul>
17
+ <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setForceUseCustomerRequiredAttributes(!$this->isCustomerLoggedIn())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
18
+ <li class="fields">
19
+ <div class="field">
20
+ <label for="billing:company"><?php echo $this->__('Company') ?></label>
21
+ <div class="input-box">
22
+ <input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->quoteEscape($this->__('Company')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
23
+ </div>
24
+ </div>
25
+ <?php if(!$this->isCustomerLoggedIn()): ?>
26
+ <div class="field">
27
+ <label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
28
+ <div class="input-box">
29
+ <input type="email" autocapitalize="off" autocorrect="off" spellcheck="false" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo $this->quoteEscape($this->__('Email Address')) ?>" class="input-text validate-email required-entry" />
30
+ </div>
31
+ </div>
32
+ <div class="field mobile">
33
+ <label for="mobile" class="required"><em>*</em>Mobile</label>
34
+ <div class="input-box">
35
+ <input type="text" id="mobile" name="mobile" value="" title="Mobile Number" class="input-text required-entry validate-length maximum-length-10 minimum-length-10 validate-digits">
36
+ </div>
37
+ </div>
38
+ <?php endif; ?>
39
+ </li>
40
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
41
+ <li class="wide">
42
+ <label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
43
+ <div class="input-box">
44
+ <input type="text" title="<?php echo $this->quoteEscape($this->__('Street Address')) ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
45
+ </div>
46
+ </li>
47
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
48
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
49
+ <li class="wide">
50
+ <label for="billing:street<?php echo $_i ?>"><?php echo $this->__('Street Address %s', $_i) ?></label>
51
+ <div class="input-box">
52
+ <input type="text" title="<?php echo $this->quoteEscape($this->__('Street Address %s', $_i)) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
53
+ </div>
54
+ </li>
55
+ <?php endfor; ?>
56
+ <?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
57
+ <li class="wide">
58
+ <label for="billing:vat_id"><?php echo $this->__('VAT Number') ?></label>
59
+ <div class="input-box">
60
+ <input type="text" id="billing:vat_id" name="billing[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" title="<?php echo $this->quoteEscape($this->__('VAT Number')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
61
+ </div>
62
+ </li>
63
+ <?php endif; ?>
64
+ <li class="fields">
65
+ <div class="field">
66
+ <label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
67
+ <div class="input-box">
68
+ <input type="text" title="<?php echo $this->quoteEscape($this->__('City')) ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="billing:city" />
69
+ </div>
70
+ </div>
71
+ <div class="field">
72
+ <label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
73
+ <div class="input-box">
74
+ <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->quoteEscape($this->__('State/Province')) ?>" class="validate-select" style="display:none;">
75
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
76
+ </select>
77
+ <script type="text/javascript">
78
+ //<![CDATA[
79
+ $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
80
+ //]]>
81
+ </script>
82
+ <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->quoteEscape($this->__('State/Province')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
83
+ </div>
84
+ </div>
85
+ </li>
86
+ <li class="fields">
87
+ <div class="field">
88
+ <label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
89
+ <div class="input-box">
90
+ <input type="text" title="<?php echo $this->quoteEscape($this->__('Zip/Postal Code')) ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
91
+ </div>
92
+ </div>
93
+ <div class="field">
94
+ <label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
95
+ <div class="input-box">
96
+ <?php echo $this->getCountryHtmlSelect('billing') ?>
97
+ </div>
98
+ </div>
99
+ </li>
100
+ <li class="fields">
101
+ <div class="field">
102
+ <label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
103
+ <div class="input-box">
104
+ <input type="tel" name="billing[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->quoteEscape($this->__('Telephone')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="billing:telephone" />
105
+ </div>
106
+ </div>
107
+ <div class="field">
108
+ <label for="billing:fax"><?php echo $this->__('Fax') ?></label>
109
+ <div class="input-box">
110
+ <input type="tel" name="billing[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->quoteEscape($this->__('Fax')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="billing:fax" />
111
+ </div>
112
+ </div>
113
+ </li>
114
+
115
+ <?php if(!$this->isCustomerLoggedIn()): ?>
116
+
117
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
118
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
119
+ <?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
120
+ <li class="fields">
121
+ <?php if ($_dob->isEnabled()): ?>
122
+ <div class="field">
123
+ <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
124
+ </div>
125
+ <?php endif; ?>
126
+ <?php if ($_gender->isEnabled()): ?>
127
+ <div class="field">
128
+ <?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
129
+ </div>
130
+ <?php endif ?>
131
+ </li>
132
+ <?php endif ?>
133
+
134
+ <?php if ($this->isTaxvatEnabled()):?>
135
+ <li><?php echo $this->getTaxvatHtml() ?></li>
136
+ <?php endif; ?>
137
+
138
+ <li class="fields" id="register-customer-password">
139
+ <div class="field">
140
+ <label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
141
+ <div class="input-box">
142
+ <input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->quoteEscape($this->__('Password')) ?>" class="input-text required-entry validate-password" />
143
+ </div>
144
+ </div>
145
+ <div class="field">
146
+ <label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
147
+ <div class="input-box">
148
+ <input type="password" name="billing[confirm_password]" title="<?php echo $this->quoteEscape($this->__('Confirm Password')) ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
149
+ </div>
150
+ </div>
151
+ </li>
152
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
153
+ <?php endif; ?>
154
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
155
+ <li class="control">
156
+ <input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->quoteEscape($this->__('Save in address book')) ?>" id="billing:save_in_address_book" onchange="if(window.shipping) shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
157
+ </li>
158
+ <?php else:?>
159
+ <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
160
+ <?php endif; ?>
161
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
162
+ </ul>
163
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
164
+ </div>
165
+ </li>
166
+ <?php if ($this->canShip()): ?>
167
+ <li class="control">
168
+ <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1"<?php if ($this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->quoteEscape($this->__('Ship to this address')) ?>" onclick="$('shipping:same_as_billing').checked = true;" class="radio" /><label for="billing:use_for_shipping_yes"><?php echo $this->__('Ship to this address') ?></label></li>
169
+ <li class="control">
170
+ <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0"<?php if (!$this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->quoteEscape($this->__('Ship to different address')) ?>" onclick="$('shipping:same_as_billing').checked = false;" class="radio" /><label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
171
+ </li>
172
+ <?php endif; ?>
173
+ </ul>
174
+ <?php if (!$this->canShip()): ?>
175
+ <input type="hidden" name="billing[use_for_shipping]" value="1" />
176
+ <?php endif; ?>
177
+ <div class="buttons-set" id="billing-buttons-container">
178
+ <button type="button" title="<?php echo $this->quoteEscape($this->__('Continue')) ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
179
+ <span class="please-wait" id="billing-please-wait" style="display:none;">
180
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->quoteEscape($this->__('Loading next step...')) ?>" title="<?php echo $this->quoteEscape($this->__('Loading next step...')) ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
181
+ </span>
182
+ </div>
183
+ </div>
184
+ </form>
185
+ <script type="text/javascript">
186
+ //<![CDATA[
187
+ var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
188
+ var billingForm = new VarienForm('co-billing-form');
189
+
190
+ //billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->jsQuoteEscape($this->__('Select State/Province...')) ?>');
191
+ $('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
192
+
193
+ var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'billing:postcode');
194
+ if ($('onepage-guest-register-button')) {
195
+ Event.observe($('onepage-guest-register-button'), 'click', function(event) {
196
+ var billingRememberMe = $('co-billing-form').select('#remember-me-box');
197
+ if (billingRememberMe.length > 0) {
198
+ if ($('login:guest') && $('login:guest').checked) {
199
+ billingRememberMe[0].hide();
200
+ } else if ($('login:register') && ($('login:register').checked || $('login:register').type == 'hidden')) {
201
+ billingRememberMe[0].show();
202
+ }
203
+ }
204
+ });
205
+ }
206
+ //]]>
207
+ </script>
app/design/frontend/default/default/template/userandmobile/checkout/onepage/login.phtml ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php echo $this->getChildHtml('login_before') ?>
2
+ <div class="col2-set<?php if (!$this->helper('customer')->isRegistrationAllowed() && !$this->getQuote()->isAllowedGuestCheckout()) echo ' login-only' ?>">
3
+ <div class="col-1">
4
+ <h3>
5
+ <?php if( $this->getQuote()->isAllowedGuestCheckout() && $this->helper('customer')->isRegistrationAllowed() ): ?>
6
+ <?php echo $this->__('Checkout as a Guest or Register') ?>
7
+ <?php elseif ( $this->getQuote()->isAllowedGuestCheckout() && !$this->helper('customer')->isRegistrationAllowed() ): ?>
8
+ <?php echo $this->__('Checkout as a Guest') ?>
9
+ <?php else: ?>
10
+ <?php echo $this->__('Register to Create an Account') ?>
11
+ <?php endif; ?>
12
+ </h3>
13
+ <?php if( !$this->getQuote()->isAllowedGuestCheckout() && $this->helper('customer')->isRegistrationAllowed() ): ?>
14
+ <p class="description"><?php echo $this->__('Register and save time!') ?></strong><br />
15
+ <?php echo $this->__('Register with us for future convenience:') ?></p>
16
+ <ul>
17
+ <li><?php echo $this->__('Fast and easy check out') ?></li>
18
+ <li><?php echo $this->__('Easy access to your order history and status') ?></li>
19
+ </ul>
20
+ <?php elseif( $this->getQuote()->isAllowedGuestCheckout() && $this->helper('customer')->isRegistrationAllowed() ): ?>
21
+ <p class="description"><?php echo $this->__('Register with us for future convenience:') ?></p>
22
+ <?php endif ?>
23
+ <?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
24
+ <ul class="form-list">
25
+ <?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
26
+ <li class="control">
27
+ <input type="radio" name="checkout_method" id="login:guest" value="guest"<?php if($this->getQuote()->getCheckoutMethod()!=Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER): ?> checked="checked"<?php endif; ?> class="radio" /><label for="login:guest"><?php echo $this->__('Checkout as Guest') ?></label>
28
+ </li>
29
+ <?php endif; ?>
30
+ <?php if( $this->helper('customer')->isRegistrationAllowed() ): ?>
31
+ <li class="control">
32
+ <input type="radio" name="checkout_method" id="login:register" value="register"<?php if($this->getQuote()->getCheckoutMethod()==Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER || !$this->getQuote()->isAllowedGuestCheckout()): ?> checked="checked"<?php endif ?> class="radio" />
33
+ <label for="login:register"><?php echo $this->__('Register and Checkout') ?></label>
34
+ </li>
35
+ <?php endif; ?>
36
+ </ul>
37
+ <?php else: ?>
38
+ <input type="hidden" name="checkout_method" id="login:register" value="register" checked="checked" />
39
+ <?php endif; ?>
40
+ <div class="buttons-set">
41
+ <p class="required">&nbsp;</p>
42
+ <?php if ($this->getQuote()->isAllowedGuestCheckout()): ?>
43
+ <button id="onepage-guest-register-button" type="button" class="button" onclick="checkout.setMethod();"><span><span><?php echo $this->__('Continue') ?></span></span></button>
44
+ <?php elseif ($this->helper('checkout')->isCustomerMustBeLogged()): ?>
45
+ <button id="onepage-guest-register-button" type="button" class="button" onclick="window.location='<?php echo $this->helper('checkout/url')->getRegistrationUrl();?>'"><span><span><?php echo $this->__('Register') ?></span></span></button>
46
+ <?php else: ?>
47
+ <form action="<?php echo $this->getUrl('persistent/index/saveMethod'); ?>">
48
+ <button id="onepage-guest-register-button" type="submit" class="button"><span><span><?php echo $this->__('Register') ?></span></span></button>
49
+ </form>
50
+ <?php endif; ?>
51
+ </div>
52
+ </div>
53
+ <div class="col-2">
54
+ <h3><?php echo $this->__('Returning Customers') ?></h3>
55
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
56
+ <form id="login-form" action="<?php echo $this->getPostAction() ?>" method="post">
57
+ <div class="fieldset">
58
+ <?php echo $this->getBlockHtml('formkey'); ?>
59
+ <p class="description"><?php echo $this->__('Sign in to speed up your checkout process') ?></p>
60
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
61
+ <ul class="form-list">
62
+ <li>
63
+ <label for="mobile" class="required"><em>*</em>Mobile/Email</label>
64
+ <div class="input-box">
65
+ <input type="text" name="login[username]" value="" id="mobile" class="input-text required-entry validate" title="Mobile Number">
66
+ </div>
67
+ </li>
68
+ <li>
69
+ <label for="login-password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
70
+ <div class="input-box">
71
+ <input type="password" class="input-text validate-password required-entry" id="login-password" name="login[password]" />
72
+ </div>
73
+ </li>
74
+ <li>
75
+ <a href="<?php echo $this->getUrl('customer/account/forgotpassword') ?>" class="f-left"><?php echo $this->__('Forgot your password?') ?></a>
76
+ </li>
77
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
78
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
79
+ </ul>
80
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
81
+ <input name="context" type="hidden" value="checkout" />
82
+ </div>
83
+ </form>
84
+ <div class="buttons-set">
85
+ <button type="submit" class="button" onclick="onepageLogin(this)"><span><span><?php echo $this->__('Login') ?></span></span></button>
86
+ </div>
87
+ </div>
88
+ </div>
89
+
90
+ <script type="text/javascript">
91
+ //<![CDATA[
92
+ var loginForm = new VarienForm('login-form', true);
93
+ $('login-email').observe('keypress', bindLoginPost);
94
+ $('login-password').observe('keypress', bindLoginPost);
95
+ function bindLoginPost(evt){
96
+ if (evt.keyCode == Event.KEY_RETURN) {
97
+ loginForm.submit();
98
+ }
99
+ }
100
+ function onepageLogin(button)
101
+ {
102
+ if(loginForm.validator && loginForm.validator.validate()){
103
+ button.disabled = true;
104
+ loginForm.submit();
105
+ }
106
+ }
107
+ //]]>
108
+ </script>
109
+ <?php
110
+ $registerParam = $this->getRequest()->getParam('register');
111
+ if ($registerParam || $registerParam === ''):
112
+ ?>
113
+ <script type="text/javascript">
114
+ //<![CDATA[
115
+ document.observe("dom:loaded", function() {
116
+ if($('login:register')) {
117
+ $('login:register').checked = true;
118
+ checkout.setMethod();
119
+ }
120
+ })
121
+ //]]>
122
+ </script>
123
+ <?php endif; ?>
app/design/frontend/default/default/template/userandmobile/edit.phtml ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="page-title">
2
+ <h1><?php echo $this->__('Edit Account Information') ?></h1>
3
+ </div>
4
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
5
+ <form action="<?php echo $this->getUrl('customer/account/editPost') ?>" method="post" autocomplete="off" id="form-validate" class="scaffold-form" enctype="multipart/form-data">
6
+ <div class="fieldset">
7
+ <?php echo $this->getBlockHtml('formkey')?>
8
+ <h2 class="legend"><?php echo $this->__('Account Information') ?></h2>
9
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
10
+ <ul class="form-list">
11
+ <li class="fields">
12
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getCustomer())->toHtml() ?>
13
+ </li>
14
+ <li>
15
+ <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
16
+ <div class="input-box">
17
+ <input type="email" autocapitalize="off" autocorrect="off" spellcheck="false" name="email" id="email" value="<?php echo $this->escapeHtml($this->getCustomer()->getEmail()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Email Address')) ?>" class="input-text required-entry validate-email" />
18
+ </div>
19
+ </li>
20
+ <?php $checkEnable = Mage::getStoreConfig('userandmobile/usermobile/enable'); ?>
21
+ <?php if($checkEnable == true): ?>
22
+ <li>
23
+ <label for="mobile" class="required"><em>*</em>Mobile</label>
24
+ <div class="input-box">
25
+ <input type="text" id="mobile" name="mobile" value="<?php echo $this->escapeHtml($this->getCustomer()->getMobile()) ?>" title="Mobile Number" maxlength="20" class="input-text required-entry validate-length maximum-length-10 minimum-length-10 validate-digits">
26
+ </div>
27
+ </li>
28
+ <?php endif; ?>
29
+
30
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
31
+ <?php if ($_dob->isEnabled()): ?>
32
+ <li><?php echo $_dob->setDate($this->getCustomer()->getDob())->toHtml() ?></li>
33
+ <?php endif ?>
34
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
35
+ <?php if ($_taxvat->isEnabled()): ?>
36
+ <li><?php echo $_taxvat->setTaxvat($this->getCustomer()->getTaxvat())->toHtml() ?></li>
37
+ <?php endif ?>
38
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
39
+ <?php if ($_gender->isEnabled()): ?>
40
+ <li><?php echo $_gender->setGender($this->getCustomer()->getGender())->toHtml() ?></li>
41
+ <?php endif ?>
42
+ <li>
43
+ <label for="current_password" class="required"><em>*</em><?php echo Mage::helper('core')->quoteEscape($this->__('Current Password')) ?></label>
44
+ <div class="input-box">
45
+ <!-- This is a dummy hidden field to trick firefox from auto filling the password -->
46
+ <input type="text" class="input-text no-display" name="dummy" id="dummy" />
47
+ <input type="password" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Current Password')) ?>" class="input-text required-entry" name="current_password" id="current_password" />
48
+ </div>
49
+ </li>
50
+ <li class="control">
51
+ <input type="checkbox" name="change_password" id="change_password" value="1" onclick="setPasswordForm(this.checked)" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Change Password')) ?>"<?php if($this->getCustomer()->getChangePassword()==1): ?> checked="checked"<?php endif; ?> class="checkbox" /><label for="change_password"><?php echo $this->__('Change Password') ?></label>
52
+ </li>
53
+ </ul>
54
+ </div>
55
+ <div class="fieldset" style="display:none;">
56
+ <h2 class="legend"><?php echo $this->__('Change Password') ?></h2>
57
+ <ul class="form-list">
58
+ <li class="fields">
59
+ <div class="field">
60
+ <label for="password" class="required"><em>*</em><?php echo $this->__('New Password') ?></label>
61
+ <div class="input-box">
62
+ <input type="password" title="<?php echo Mage::helper('core')->quoteEscape($this->__('New Password')) ?>" class="input-text required-entry validate-password" name="password" id="password" />
63
+ </div>
64
+ </div>
65
+ <div class="field">
66
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm New Password') ?></label>
67
+ <div class="input-box">
68
+ <input type="password" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Confirm New Password')) ?>" class="input-text required-entry validate-cpassword" name="confirmation" id="confirmation" />
69
+ </div>
70
+ </div>
71
+ </li>
72
+ </ul>
73
+ </div>
74
+ <div class="buttons-set">
75
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
76
+ <button type="submit" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Save')) ?>" class="button"><span><span><?php echo $this->__('Save') ?></span></span></button>
77
+ </div>
78
+ </form>
79
+ <script type="text/javascript">
80
+ //<![CDATA[
81
+ var dataForm = new VarienForm('form-validate', true);
82
+ function setPasswordForm(arg){
83
+ $('password').up('.fieldset')[arg ? 'show': 'hide']();
84
+ }
85
+
86
+ <?php if($this->getCustomer()->getChangePassword()): ?>
87
+ setPasswordForm(true);
88
+ <?php endif; ?>
89
+ //]]>
90
+ </script>
app/design/frontend/default/default/template/userandmobile/login.phtml ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="account-login<?php if (!$this->helper('customer')->isRegistrationAllowed()) echo ' login-only' ?>">
2
+ <div class="page-title">
3
+ <h1><?php if ($this->helper('customer')->isRegistrationAllowed()): ?>
4
+ <?php echo $this->__('Login or Create an Account') ?>
5
+ <?php else: ?>
6
+ <?php echo $this->__('Login'); ?>
7
+ <?php endif; ?></h1>
8
+ </div>
9
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
10
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form" class="scaffold-form">
11
+ <?php echo $this->getBlockHtml('formkey'); ?>
12
+ <div class="col2-set">
13
+ <?php if ($this->helper('customer')->isRegistrationAllowed()): ?>
14
+ <div class="col-1 new-users">
15
+ <div class="content">
16
+ <h2><?php echo $this->__('New Here?') ?></h2>
17
+ <p class="form-instructions"><?php echo $this->__('Registration is free and easy!') ?></p>
18
+ <ul class="benefits">
19
+ <li><?php echo $this->__('Faster checkout') ?></li>
20
+ <li><?php echo $this->__('Save multiple shipping addresses') ?></li>
21
+ <li><?php echo $this->__('View and track orders and more') ?></li>
22
+ </ul>
23
+ </div>
24
+ <div class="buttons-set">
25
+ <a title="<?php echo $this->quoteEscape($this->__('Create an Account')) ?>" class="button" href="<?php echo Mage::helper('persistent')->getCreateAccountUrl($this->getCreateAccountUrl()) ?>"><span><span><?php echo $this->__('Create an Account') ?></span></span></a>
26
+ </div>
27
+ </div>
28
+ <?php endif; ?>
29
+ <?php // This column should be col-1 if the registration column is not displayed ?>
30
+ <div class="<?php if ($this->helper('customer')->isRegistrationAllowed()): ?>col-2<?php else: ?>col-1<?php endif; ?> registered-users">
31
+ <div class="content fieldset">
32
+ <h2><?php echo $this->__('Already registered?') ?></h2>
33
+ <p class="form-instructions"><?php echo $this->__('If you have an account with us, please log in.') ?></p>
34
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
35
+ <ul class="form-list">
36
+ <li>
37
+ <label for="mobile" class="required"><em>*</em>Mobile/Email</label>
38
+ <div class="input-box">
39
+ <input type="text" name="login[username]" value="" id="mobile" class="input-text required-entry validate" title="Mobile Number">
40
+ </div>
41
+ </li>
42
+ <li>
43
+ <label for="pass" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
44
+ <div class="input-box">
45
+ <input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->quoteEscape($this->__('Password')) ?>" />
46
+ </div>
47
+ </li>
48
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
49
+ <li>
50
+ <a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('Forgot Your Password?') ?></a>
51
+ </li>
52
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
53
+ </ul>
54
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
55
+ </div>
56
+ <div class="buttons-set">
57
+ <button type="submit" class="button" title="<?php echo $this->quoteEscape($this->__('Login')) ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ <?php if (Mage::helper('checkout')->isContextCheckout()): ?>
62
+ <input name="context" type="hidden" value="checkout" />
63
+ <?php endif; ?>
64
+ </form>
65
+ <script type="text/javascript">
66
+ //<![CDATA[
67
+ var dataForm = new VarienForm('login-form', true);
68
+ //]]>
69
+ </script>
70
+ </div>
app/design/frontend/default/default/template/userandmobile/register.phtml ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="account-create">
2
+ <div class="page-title">
3
+ <h1><?php echo $this->__('Create an Account Rewrite') ?></h1>
4
+ </div>
5
+ <?php echo $this->getChildHtml('form_fields_before')?>
6
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
7
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate" class="scaffold-form" enctype="multipart/form-data">
8
+ <div class="fieldset">
9
+ <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
10
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
11
+ <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
12
+ <p class="form-instructions"><?php echo $this->__('Please enter the following information to create your account.') ?></p>
13
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
14
+ <ul class="form-list">
15
+ <li class="fields">
16
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->setForceUseCustomerAttributes(true)->toHtml() ?>
17
+ </li>
18
+ <div class="field mobile">
19
+ <label for="mobile" class="required"><em>*</em>Mobile</label>
20
+ <div class="input-box">
21
+ <input type="text" id="mobile" name="mobile" value="" title="Mobile Number" class="input-text required-entry validate-length maximum-length-10 minimum-length-10 validate-digits">
22
+ </div>
23
+ </div>
24
+ <li>
25
+ <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
26
+ <div class="input-box">
27
+ <input type="email" autocapitalize="off" autocorrect="off" spellcheck="false" name="email" id="email_address" value="<?php echo $this->escapeHtml($this->getFormData()->getEmail()) ?>" title="<?php echo $this->quoteEscape($this->__('Email Address')) ?>" class="input-text validate-email required-entry" />
28
+ </div>
29
+ </li>
30
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
31
+ <?php if ($_dob->isEnabled()): ?>
32
+ <li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
33
+ <?php endif ?>
34
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
35
+ <?php if ($_taxvat->isEnabled()): ?>
36
+ <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
37
+ <?php endif ?>
38
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
39
+ <?php if ($_gender->isEnabled()): ?>
40
+ <li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
41
+ <?php endif ?>
42
+
43
+ <?php if($this->getShowAddressFields()): ?>
44
+ <li class="hidden">
45
+ <input type="hidden" name="create_address" value="1" />
46
+ </li>
47
+ <li class="fields">
48
+ <div class="field">
49
+ <label for="company"><?php echo $this->__('Company') ?></label>
50
+ <div class="input-box">
51
+ <input type="text" name="company" id="company" value="<?php echo $this->escapeHtml($this->getFormData()->getCompany()) ?>" title="<?php echo $this->quoteEscape($this->__('Company')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
52
+ </div>
53
+ </div>
54
+ <div class="field">
55
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
56
+ <div class="input-box">
57
+ <input type="tel" name="telephone" id="telephone" value="<?php echo $this->escapeHtml($this->getFormData()->getTelephone()) ?>" title="<?php echo $this->quoteEscape($this->__('Telephone')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" />
58
+ </div>
59
+ </div>
60
+ </li>
61
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
62
+ <li class="wide">
63
+ <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
64
+ <div class="input-box">
65
+ <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet(0)) ?>" title="<?php echo $this->quoteEscape($this->__('Street Address')) ?>" id="street_1" class="input-text <?php echo $_streetValidationClass ?>" />
66
+ </div>
67
+ </li>
68
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
69
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
70
+ <li class="wide">
71
+ <label for="billing:street<?php echo $_i ?>"><?php echo $this->__('Street Address %s', $_i) ?></label>
72
+ <div class="input-box">
73
+ <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet($_i - 1)) ?>" title="<?php echo $this->quoteEscape($this->__('Street Address %s', $_i)) ?>" id="street_<?php echo $_i ?>" class="input-text <?php echo $_streetValidationClass ?>" />
74
+ </div>
75
+ </li>
76
+ <?php endfor; ?>
77
+ <li class="fields">
78
+ <div class="field">
79
+ <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
80
+ <div class="input-box">
81
+ <input type="text" name="city" value="<?php echo $this->escapeHtml($this->getFormData()->getCity()) ?>" title="<?php echo $this->quoteEscape($this->__('City')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="city" />
82
+ </div>
83
+ </div>
84
+ <div class="field">
85
+ <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
86
+ <div class="input-box">
87
+ <select id="region_id" name="region_id" title="<?php echo $this->quoteEscape($this->__('State/Province')) ?>" class="validate-select" style="display:none;">
88
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
89
+ </select>
90
+ <script type="text/javascript">
91
+ //<![CDATA[
92
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
93
+ //]]>
94
+ </script>
95
+ <input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getRegion()) ?>" title="<?php echo $this->quoteEscape($this->__('State/Province')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
96
+ </div>
97
+ </div>
98
+ </li>
99
+ <li class="fields">
100
+ <div class="field">
101
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
102
+ <div class="input-box">
103
+ <input type="text" name="postcode" value="<?php echo $this->escapeHtml($this->getFormData()->getPostcode()) ?>" title="<?php echo $this->quoteEscape($this->__('Zip/Postal Code')) ?>" id="zip" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
104
+ </div>
105
+ </div>
106
+ <div class="field">
107
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
108
+ <div class="input-box">
109
+ <?php echo $this->getCountryHtmlSelect() ?>
110
+ </div>
111
+ </div>
112
+ </li>
113
+ <li class="hidden">
114
+ <input type="hidden" name="default_billing" value="1" />
115
+ <input type="hidden" name="default_shipping" value="1" />
116
+ </li>
117
+ <?php endif; ?>
118
+ <li class="fields">
119
+ <div class="field">
120
+ <label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
121
+ <div class="input-box">
122
+ <input type="password" name="password" id="password" title="<?php echo $this->quoteEscape($this->__('Password')) ?>" class="input-text required-entry validate-password" />
123
+ </div>
124
+ </div>
125
+ <div class="field">
126
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
127
+ <div class="input-box">
128
+ <input type="password" name="confirmation" title="<?php echo $this->quoteEscape($this->__('Confirm Password')) ?>" id="confirmation" class="input-text required-entry validate-cpassword" />
129
+ </div>
130
+ </div>
131
+ </li>
132
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
133
+ <?php if ($this->isNewsletterEnabled()): ?>
134
+ <li class="control">
135
+ <div class="input-box">
136
+ <input type="checkbox" name="is_subscribed" title="<?php echo $this->quoteEscape($this->__('Sign Up for Newsletter')) ?>" value="1" id="is_subscribed"<?php if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" />
137
+ </div>
138
+ <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
139
+ </li>
140
+ <?php endif ?>
141
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
142
+ </ul>
143
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
144
+ </div>
145
+ <div class="buttons-set">
146
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
147
+ <button type="submit" title="<?php echo $this->quoteEscape($this->__('Register')) ?>" class="button"><span><span><?php echo $this->__('Register') ?></span></span></button>
148
+ </div>
149
+ <?php if (Mage::helper('checkout')->isContextCheckout()): ?>
150
+ <input name="context" type="hidden" value="checkout" />
151
+ <?php endif; ?>
152
+ </form>
153
+ <script type="text/javascript">
154
+ //<![CDATA[
155
+ var dataForm = new VarienForm('form-validate', true);
156
+ <?php if($this->getShowAddressFields()): ?>
157
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
158
+ <?php endif; ?>
159
+ //]]>
160
+ </script>
161
+ </div>
app/design/frontend/rwd/default/layout/userandmobile.xml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ </default>
5
+ <customer_account_create>
6
+ <reference name="customer_form_register">
7
+ <action method="setTemplate" ifconfig="userandmobile/usermobile/enable"><template>userandmobile/register.phtml</template></action>
8
+ </reference>
9
+ </customer_account_create>
10
+ <customer_account_login>
11
+ <reference name="customer_form_login">
12
+ <action method="setTemplate" ifconfig="userandmobile/usermobile/enable"><template>userandmobile/login.phtml</template></action>
13
+ </reference>
14
+ </customer_account_login>
15
+ <customer_account_edit>
16
+ <reference name="my.account.wrapper" ifconfig="userandmobile/usermobile/enable">
17
+ <block type="customer/form_edit" name="customer_edit" template="userandmobile/edit.phtml"/>
18
+ </reference>
19
+ </customer_account_edit>
20
+ <checkout_onepage_index>
21
+ <reference name="checkout.onepage.login">
22
+ <action method="setTemplate" ifconfig="userandmobile/usermobile/enable"><template>userandmobile/checkout/onepage/login.phtml</template></action>
23
+ </reference>
24
+ <reference name="checkout.onepage.billing">
25
+ <action method="setTemplate" ifconfig="userandmobile/usermobile/enable"><template>userandmobile/checkout/onepage/billing.phtml</template></action>
26
+ </reference>
27
+ </checkout_onepage_index>
28
+ </layout>
app/design/frontend/rwd/default/template/userandmobile/checkout/onepage/billing.phtml ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <form id="co-billing-form" action="">
2
+ <div class="fieldset">
3
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
4
+ <ul class="form-list">
5
+ <?php if ($this->customerHasAddresses()): ?>
6
+ <li class="wide">
7
+ <label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
8
+ <div class="input-box">
9
+ <?php echo $this->getAddressesHtmlSelect('billing') ?>
10
+ </div>
11
+ </li>
12
+ <?php endif; ?>
13
+ <li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?> class="scaffold-form">
14
+ <div class="fieldset">
15
+ <input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
16
+ <ul>
17
+ <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setForceUseCustomerRequiredAttributes(!$this->isCustomerLoggedIn())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
18
+ <li class="fields">
19
+ <div class="field">
20
+ <label for="billing:company"><?php echo $this->__('Company') ?></label>
21
+ <div class="input-box">
22
+ <input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->quoteEscape($this->__('Company')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
23
+ </div>
24
+ </div>
25
+ <?php if(!$this->isCustomerLoggedIn()): ?>
26
+ <div class="field">
27
+ <label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
28
+ <div class="input-box">
29
+ <input type="email" autocapitalize="off" autocorrect="off" spellcheck="false" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo $this->quoteEscape($this->__('Email Address')) ?>" class="input-text validate-email required-entry" />
30
+ </div>
31
+ </div>
32
+ <div class="field mobile">
33
+ <label for="mobile" class="required"><em>*</em>Mobile</label>
34
+ <div class="input-box">
35
+ <input type="text" id="mobile" name="mobile" value="" title="Mobile Number" class="input-text required-entry validate-length maximum-length-10 minimum-length-10 validate-digits">
36
+ </div>
37
+ </div>
38
+ <?php endif; ?>
39
+ </li>
40
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
41
+ <li class="wide">
42
+ <label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
43
+ <div class="input-box">
44
+ <input type="text" title="<?php echo $this->quoteEscape($this->__('Street Address')) ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
45
+ </div>
46
+ </li>
47
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
48
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
49
+ <li class="wide">
50
+ <label for="billing:street<?php echo $_i ?>"><?php echo $this->__('Street Address %s', $_i) ?></label>
51
+ <div class="input-box">
52
+ <input type="text" title="<?php echo $this->quoteEscape($this->__('Street Address %s', $_i)) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
53
+ </div>
54
+ </li>
55
+ <?php endfor; ?>
56
+ <?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
57
+ <li class="wide">
58
+ <label for="billing:vat_id"><?php echo $this->__('VAT Number') ?></label>
59
+ <div class="input-box">
60
+ <input type="text" id="billing:vat_id" name="billing[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" title="<?php echo $this->quoteEscape($this->__('VAT Number')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
61
+ </div>
62
+ </li>
63
+ <?php endif; ?>
64
+ <li class="fields">
65
+ <div class="field">
66
+ <label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
67
+ <div class="input-box">
68
+ <input type="text" title="<?php echo $this->quoteEscape($this->__('City')) ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="billing:city" />
69
+ </div>
70
+ </div>
71
+ <div class="field">
72
+ <label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
73
+ <div class="input-box">
74
+ <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->quoteEscape($this->__('State/Province')) ?>" class="validate-select" style="display:none;">
75
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
76
+ </select>
77
+ <script type="text/javascript">
78
+ //<![CDATA[
79
+ $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
80
+ //]]>
81
+ </script>
82
+ <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->quoteEscape($this->__('State/Province')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
83
+ </div>
84
+ </div>
85
+ </li>
86
+ <li class="fields">
87
+ <div class="field">
88
+ <label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
89
+ <div class="input-box">
90
+ <input type="text" title="<?php echo $this->quoteEscape($this->__('Zip/Postal Code')) ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
91
+ </div>
92
+ </div>
93
+ <div class="field">
94
+ <label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
95
+ <div class="input-box">
96
+ <?php echo $this->getCountryHtmlSelect('billing') ?>
97
+ </div>
98
+ </div>
99
+ </li>
100
+ <li class="fields">
101
+ <div class="field">
102
+ <label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
103
+ <div class="input-box">
104
+ <input type="tel" name="billing[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->quoteEscape($this->__('Telephone')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="billing:telephone" />
105
+ </div>
106
+ </div>
107
+ <div class="field">
108
+ <label for="billing:fax"><?php echo $this->__('Fax') ?></label>
109
+ <div class="input-box">
110
+ <input type="tel" name="billing[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->quoteEscape($this->__('Fax')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="billing:fax" />
111
+ </div>
112
+ </div>
113
+ </li>
114
+
115
+ <?php if(!$this->isCustomerLoggedIn()): ?>
116
+
117
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
118
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
119
+ <?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
120
+ <li class="fields">
121
+ <?php if ($_dob->isEnabled()): ?>
122
+ <div class="field">
123
+ <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
124
+ </div>
125
+ <?php endif; ?>
126
+ <?php if ($_gender->isEnabled()): ?>
127
+ <div class="field">
128
+ <?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
129
+ </div>
130
+ <?php endif ?>
131
+ </li>
132
+ <?php endif ?>
133
+
134
+ <?php if ($this->isTaxvatEnabled()):?>
135
+ <li><?php echo $this->getTaxvatHtml() ?></li>
136
+ <?php endif; ?>
137
+
138
+ <li class="fields" id="register-customer-password">
139
+ <div class="field">
140
+ <label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
141
+ <div class="input-box">
142
+ <input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->quoteEscape($this->__('Password')) ?>" class="input-text required-entry validate-password" />
143
+ </div>
144
+ </div>
145
+ <div class="field">
146
+ <label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
147
+ <div class="input-box">
148
+ <input type="password" name="billing[confirm_password]" title="<?php echo $this->quoteEscape($this->__('Confirm Password')) ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
149
+ </div>
150
+ </div>
151
+ </li>
152
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
153
+ <?php endif; ?>
154
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
155
+ <li class="control">
156
+ <input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->quoteEscape($this->__('Save in address book')) ?>" id="billing:save_in_address_book" onchange="if(window.shipping) shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
157
+ </li>
158
+ <?php else:?>
159
+ <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
160
+ <?php endif; ?>
161
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
162
+ </ul>
163
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
164
+ </div>
165
+ </li>
166
+ <?php if ($this->canShip()): ?>
167
+ <li class="control">
168
+ <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1"<?php if ($this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->quoteEscape($this->__('Ship to this address')) ?>" onclick="$('shipping:same_as_billing').checked = true;" class="radio" /><label for="billing:use_for_shipping_yes"><?php echo $this->__('Ship to this address') ?></label></li>
169
+ <li class="control">
170
+ <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0"<?php if (!$this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->quoteEscape($this->__('Ship to different address')) ?>" onclick="$('shipping:same_as_billing').checked = false;" class="radio" /><label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
171
+ </li>
172
+ <?php endif; ?>
173
+ </ul>
174
+ <?php if (!$this->canShip()): ?>
175
+ <input type="hidden" name="billing[use_for_shipping]" value="1" />
176
+ <?php endif; ?>
177
+ <div class="buttons-set" id="billing-buttons-container">
178
+ <button type="button" title="<?php echo $this->quoteEscape($this->__('Continue')) ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
179
+ <span class="please-wait" id="billing-please-wait" style="display:none;">
180
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->quoteEscape($this->__('Loading next step...')) ?>" title="<?php echo $this->quoteEscape($this->__('Loading next step...')) ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
181
+ </span>
182
+ </div>
183
+ </div>
184
+ </form>
185
+ <script type="text/javascript">
186
+ //<![CDATA[
187
+ var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
188
+ var billingForm = new VarienForm('co-billing-form');
189
+
190
+ //billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->jsQuoteEscape($this->__('Select State/Province...')) ?>');
191
+ $('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
192
+
193
+ var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'billing:postcode');
194
+ if ($('onepage-guest-register-button')) {
195
+ Event.observe($('onepage-guest-register-button'), 'click', function(event) {
196
+ var billingRememberMe = $('co-billing-form').select('#remember-me-box');
197
+ if (billingRememberMe.length > 0) {
198
+ if ($('login:guest') && $('login:guest').checked) {
199
+ billingRememberMe[0].hide();
200
+ } else if ($('login:register') && ($('login:register').checked || $('login:register').type == 'hidden')) {
201
+ billingRememberMe[0].show();
202
+ }
203
+ }
204
+ });
205
+ }
206
+ //]]>
207
+ </script>
app/design/frontend/rwd/default/template/userandmobile/checkout/onepage/login.phtml ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php echo $this->getChildHtml('login_before') ?>
2
+ <div class="col2-set<?php if (!$this->helper('customer')->isRegistrationAllowed() && !$this->getQuote()->isAllowedGuestCheckout()) echo ' login-only' ?>">
3
+ <div class="col-1">
4
+ <h3>
5
+ <?php if( $this->getQuote()->isAllowedGuestCheckout() && $this->helper('customer')->isRegistrationAllowed() ): ?>
6
+ <?php echo $this->__('Checkout as a Guest or Register') ?>
7
+ <?php elseif ( $this->getQuote()->isAllowedGuestCheckout() && !$this->helper('customer')->isRegistrationAllowed() ): ?>
8
+ <?php echo $this->__('Checkout as a Guest') ?>
9
+ <?php else: ?>
10
+ <?php echo $this->__('Register to Create an Account') ?>
11
+ <?php endif; ?>
12
+ </h3>
13
+ <?php if( !$this->getQuote()->isAllowedGuestCheckout() && $this->helper('customer')->isRegistrationAllowed() ): ?>
14
+ <p class="description"><?php echo $this->__('Register and save time!') ?></strong><br />
15
+ <?php echo $this->__('Register with us for future convenience:') ?></p>
16
+ <ul>
17
+ <li><?php echo $this->__('Fast and easy check out') ?></li>
18
+ <li><?php echo $this->__('Easy access to your order history and status') ?></li>
19
+ </ul>
20
+ <?php elseif( $this->getQuote()->isAllowedGuestCheckout() && $this->helper('customer')->isRegistrationAllowed() ): ?>
21
+ <p class="description"><?php echo $this->__('Register with us for future convenience:') ?></p>
22
+ <?php endif ?>
23
+ <?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
24
+ <ul class="form-list">
25
+ <?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
26
+ <li class="control">
27
+ <input type="radio" name="checkout_method" id="login:guest" value="guest"<?php if($this->getQuote()->getCheckoutMethod()!=Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER): ?> checked="checked"<?php endif; ?> class="radio" /><label for="login:guest"><?php echo $this->__('Checkout as Guest') ?></label>
28
+ </li>
29
+ <?php endif; ?>
30
+ <?php if( $this->helper('customer')->isRegistrationAllowed() ): ?>
31
+ <li class="control">
32
+ <input type="radio" name="checkout_method" id="login:register" value="register"<?php if($this->getQuote()->getCheckoutMethod()==Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER || !$this->getQuote()->isAllowedGuestCheckout()): ?> checked="checked"<?php endif ?> class="radio" />
33
+ <label for="login:register"><?php echo $this->__('Register and Checkout') ?></label>
34
+ </li>
35
+ <?php endif; ?>
36
+ </ul>
37
+ <?php else: ?>
38
+ <input type="hidden" name="checkout_method" id="login:register" value="register" checked="checked" />
39
+ <?php endif; ?>
40
+ <div class="buttons-set">
41
+ <p class="required">&nbsp;</p>
42
+ <?php if ($this->getQuote()->isAllowedGuestCheckout()): ?>
43
+ <button id="onepage-guest-register-button" type="button" class="button" onclick="checkout.setMethod();"><span><span><?php echo $this->__('Continue') ?></span></span></button>
44
+ <?php elseif ($this->helper('checkout')->isCustomerMustBeLogged()): ?>
45
+ <button id="onepage-guest-register-button" type="button" class="button" onclick="window.location='<?php echo $this->helper('checkout/url')->getRegistrationUrl();?>'"><span><span><?php echo $this->__('Register') ?></span></span></button>
46
+ <?php else: ?>
47
+ <form action="<?php echo $this->getUrl('persistent/index/saveMethod'); ?>">
48
+ <button id="onepage-guest-register-button" type="submit" class="button"><span><span><?php echo $this->__('Register') ?></span></span></button>
49
+ </form>
50
+ <?php endif; ?>
51
+ </div>
52
+ </div>
53
+ <div class="col-2">
54
+ <h3><?php echo $this->__('Returning Customers') ?></h3>
55
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
56
+ <form id="login-form" action="<?php echo $this->getPostAction() ?>" method="post">
57
+ <div class="fieldset">
58
+ <?php echo $this->getBlockHtml('formkey'); ?>
59
+ <p class="description"><?php echo $this->__('Sign in to speed up your checkout process') ?></p>
60
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
61
+ <ul class="form-list">
62
+ <li>
63
+ <label for="mobile" class="required"><em>*</em>Mobile/Email</label>
64
+ <div class="input-box">
65
+ <input type="text" name="login[username]" value="" id="mobile" class="input-text required-entry validate" title="Mobile Number">
66
+ </div>
67
+ </li>
68
+ <li>
69
+ <label for="login-password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
70
+ <div class="input-box">
71
+ <input type="password" class="input-text validate-password required-entry" id="login-password" name="login[password]" />
72
+ </div>
73
+ </li>
74
+ <li>
75
+ <a href="<?php echo $this->getUrl('customer/account/forgotpassword') ?>" class="f-left"><?php echo $this->__('Forgot your password?') ?></a>
76
+ </li>
77
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
78
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
79
+ </ul>
80
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
81
+ <input name="context" type="hidden" value="checkout" />
82
+ </div>
83
+ </form>
84
+ <div class="buttons-set">
85
+ <button type="submit" class="button" onclick="onepageLogin(this)"><span><span><?php echo $this->__('Login') ?></span></span></button>
86
+ </div>
87
+ </div>
88
+ </div>
89
+
90
+ <script type="text/javascript">
91
+ //<![CDATA[
92
+ var loginForm = new VarienForm('login-form', true);
93
+ $('login-email').observe('keypress', bindLoginPost);
94
+ $('login-password').observe('keypress', bindLoginPost);
95
+ function bindLoginPost(evt){
96
+ if (evt.keyCode == Event.KEY_RETURN) {
97
+ loginForm.submit();
98
+ }
99
+ }
100
+ function onepageLogin(button)
101
+ {
102
+ if(loginForm.validator && loginForm.validator.validate()){
103
+ button.disabled = true;
104
+ loginForm.submit();
105
+ }
106
+ }
107
+ //]]>
108
+ </script>
109
+ <?php
110
+ $registerParam = $this->getRequest()->getParam('register');
111
+ if ($registerParam || $registerParam === ''):
112
+ ?>
113
+ <script type="text/javascript">
114
+ //<![CDATA[
115
+ document.observe("dom:loaded", function() {
116
+ if($('login:register')) {
117
+ $('login:register').checked = true;
118
+ checkout.setMethod();
119
+ }
120
+ })
121
+ //]]>
122
+ </script>
123
+ <?php endif; ?>
app/design/frontend/rwd/default/template/userandmobile/edit.phtml ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="page-title">
2
+ <h1><?php echo $this->__('Edit Account Information') ?></h1>
3
+ </div>
4
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
5
+ <form action="<?php echo $this->getUrl('customer/account/editPost') ?>" method="post" autocomplete="off" id="form-validate" class="scaffold-form" enctype="multipart/form-data">
6
+ <div class="fieldset">
7
+ <?php echo $this->getBlockHtml('formkey')?>
8
+ <h2 class="legend"><?php echo $this->__('Account Information') ?></h2>
9
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
10
+ <ul class="form-list">
11
+ <li class="fields">
12
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getCustomer())->toHtml() ?>
13
+ </li>
14
+ <li>
15
+ <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
16
+ <div class="input-box">
17
+ <input type="email" autocapitalize="off" autocorrect="off" spellcheck="false" name="email" id="email" value="<?php echo $this->escapeHtml($this->getCustomer()->getEmail()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Email Address')) ?>" class="input-text required-entry validate-email" />
18
+ </div>
19
+ </li>
20
+ <?php $checkEnable = Mage::getStoreConfig('userandmobile/usermobile/enable'); ?>
21
+ <?php if($checkEnable == true): ?>
22
+ <li>
23
+ <label for="mobile" class="required"><em>*</em>Mobile</label>
24
+ <div class="input-box">
25
+ <input type="text" id="mobile" name="mobile" value="<?php echo $this->escapeHtml($this->getCustomer()->getMobile()) ?>" title="Mobile Number" maxlength="20" class="input-text required-entry validate-length maximum-length-10 minimum-length-10 validate-digits">
26
+ </div>
27
+ </li>
28
+ <?php endif; ?>
29
+
30
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
31
+ <?php if ($_dob->isEnabled()): ?>
32
+ <li><?php echo $_dob->setDate($this->getCustomer()->getDob())->toHtml() ?></li>
33
+ <?php endif ?>
34
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
35
+ <?php if ($_taxvat->isEnabled()): ?>
36
+ <li><?php echo $_taxvat->setTaxvat($this->getCustomer()->getTaxvat())->toHtml() ?></li>
37
+ <?php endif ?>
38
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
39
+ <?php if ($_gender->isEnabled()): ?>
40
+ <li><?php echo $_gender->setGender($this->getCustomer()->getGender())->toHtml() ?></li>
41
+ <?php endif ?>
42
+ <li>
43
+ <label for="current_password" class="required"><em>*</em><?php echo Mage::helper('core')->quoteEscape($this->__('Current Password')) ?></label>
44
+ <div class="input-box">
45
+ <!-- This is a dummy hidden field to trick firefox from auto filling the password -->
46
+ <input type="text" class="input-text no-display" name="dummy" id="dummy" />
47
+ <input type="password" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Current Password')) ?>" class="input-text required-entry" name="current_password" id="current_password" />
48
+ </div>
49
+ </li>
50
+ <li class="control">
51
+ <input type="checkbox" name="change_password" id="change_password" value="1" onclick="setPasswordForm(this.checked)" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Change Password')) ?>"<?php if($this->getCustomer()->getChangePassword()==1): ?> checked="checked"<?php endif; ?> class="checkbox" /><label for="change_password"><?php echo $this->__('Change Password') ?></label>
52
+ </li>
53
+ </ul>
54
+ </div>
55
+ <div class="fieldset" style="display:none;">
56
+ <h2 class="legend"><?php echo $this->__('Change Password') ?></h2>
57
+ <ul class="form-list">
58
+ <li class="fields">
59
+ <div class="field">
60
+ <label for="password" class="required"><em>*</em><?php echo $this->__('New Password') ?></label>
61
+ <div class="input-box">
62
+ <input type="password" title="<?php echo Mage::helper('core')->quoteEscape($this->__('New Password')) ?>" class="input-text required-entry validate-password" name="password" id="password" />
63
+ </div>
64
+ </div>
65
+ <div class="field">
66
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm New Password') ?></label>
67
+ <div class="input-box">
68
+ <input type="password" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Confirm New Password')) ?>" class="input-text required-entry validate-cpassword" name="confirmation" id="confirmation" />
69
+ </div>
70
+ </div>
71
+ </li>
72
+ </ul>
73
+ </div>
74
+ <div class="buttons-set">
75
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
76
+ <button type="submit" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Save')) ?>" class="button"><span><span><?php echo $this->__('Save') ?></span></span></button>
77
+ </div>
78
+ </form>
79
+ <script type="text/javascript">
80
+ //<![CDATA[
81
+ var dataForm = new VarienForm('form-validate', true);
82
+ function setPasswordForm(arg){
83
+ $('password').up('.fieldset')[arg ? 'show': 'hide']();
84
+ }
85
+
86
+ <?php if($this->getCustomer()->getChangePassword()): ?>
87
+ setPasswordForm(true);
88
+ <?php endif; ?>
89
+ //]]>
90
+ </script>
app/design/frontend/rwd/default/template/userandmobile/login.phtml ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="account-login<?php if (!$this->helper('customer')->isRegistrationAllowed()) echo ' login-only' ?>">
2
+ <div class="page-title">
3
+ <h1><?php if ($this->helper('customer')->isRegistrationAllowed()): ?>
4
+ <?php echo $this->__('Login or Create an Account') ?>
5
+ <?php else: ?>
6
+ <?php echo $this->__('Login'); ?>
7
+ <?php endif; ?></h1>
8
+ </div>
9
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
10
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form" class="scaffold-form">
11
+ <?php echo $this->getBlockHtml('formkey'); ?>
12
+ <div class="col2-set">
13
+ <?php if ($this->helper('customer')->isRegistrationAllowed()): ?>
14
+ <div class="col-1 new-users">
15
+ <div class="content">
16
+ <h2><?php echo $this->__('New Here?') ?></h2>
17
+ <p class="form-instructions"><?php echo $this->__('Registration is free and easy!') ?></p>
18
+ <ul class="benefits">
19
+ <li><?php echo $this->__('Faster checkout') ?></li>
20
+ <li><?php echo $this->__('Save multiple shipping addresses') ?></li>
21
+ <li><?php echo $this->__('View and track orders and more') ?></li>
22
+ </ul>
23
+ </div>
24
+ <div class="buttons-set">
25
+ <a title="<?php echo $this->quoteEscape($this->__('Create an Account')) ?>" class="button" href="<?php echo Mage::helper('persistent')->getCreateAccountUrl($this->getCreateAccountUrl()) ?>"><span><span><?php echo $this->__('Create an Account') ?></span></span></a>
26
+ </div>
27
+ </div>
28
+ <?php endif; ?>
29
+ <?php // This column should be col-1 if the registration column is not displayed ?>
30
+ <div class="<?php if ($this->helper('customer')->isRegistrationAllowed()): ?>col-2<?php else: ?>col-1<?php endif; ?> registered-users">
31
+ <div class="content fieldset">
32
+ <h2><?php echo $this->__('Already registered?') ?></h2>
33
+ <p class="form-instructions"><?php echo $this->__('If you have an account with us, please log in.') ?></p>
34
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
35
+ <ul class="form-list">
36
+ <li>
37
+ <label for="mobile" class="required"><em>*</em>Mobile/Email</label>
38
+ <div class="input-box">
39
+ <input type="text" name="login[username]" value="" id="mobile" class="input-text required-entry validate" title="Mobile Number">
40
+ </div>
41
+ </li>
42
+ <li>
43
+ <label for="pass" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
44
+ <div class="input-box">
45
+ <input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->quoteEscape($this->__('Password')) ?>" />
46
+ </div>
47
+ </li>
48
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
49
+ <li>
50
+ <a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('Forgot Your Password?') ?></a>
51
+ </li>
52
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
53
+ </ul>
54
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
55
+ </div>
56
+ <div class="buttons-set">
57
+ <button type="submit" class="button" title="<?php echo $this->quoteEscape($this->__('Login')) ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ <?php if (Mage::helper('checkout')->isContextCheckout()): ?>
62
+ <input name="context" type="hidden" value="checkout" />
63
+ <?php endif; ?>
64
+ </form>
65
+ <script type="text/javascript">
66
+ //<![CDATA[
67
+ var dataForm = new VarienForm('login-form', true);
68
+ //]]>
69
+ </script>
70
+ </div>
app/design/frontend/rwd/default/template/userandmobile/register.phtml ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="account-create">
2
+ <div class="page-title">
3
+ <h1><?php echo $this->__('Create an Account') ?></h1>
4
+ </div>
5
+ <?php echo $this->getChildHtml('form_fields_before')?>
6
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
7
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate" class="scaffold-form" enctype="multipart/form-data">
8
+ <div class="fieldset">
9
+ <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
10
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
11
+ <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
12
+ <p class="form-instructions"><?php echo $this->__('Please enter the following information to create your account.') ?></p>
13
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
14
+ <ul class="form-list">
15
+ <li class="fields">
16
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->setForceUseCustomerAttributes(true)->toHtml() ?>
17
+ </li>
18
+ <div class="field mobile">
19
+ <label for="mobile" class="required"><em>*</em>Mobile</label>
20
+ <div class="input-box">
21
+ <input type="text" id="mobile" name="mobile" value="" title="Mobile Number" class="input-text required-entry validate-length maximum-length-10 minimum-length-10 validate-digits">
22
+ </div>
23
+ </div>
24
+ <li>
25
+ <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
26
+ <div class="input-box">
27
+ <input type="email" autocapitalize="off" autocorrect="off" spellcheck="false" name="email" id="email_address" value="<?php echo $this->escapeHtml($this->getFormData()->getEmail()) ?>" title="<?php echo $this->quoteEscape($this->__('Email Address')) ?>" class="input-text validate-email required-entry" />
28
+ </div>
29
+ </li>
30
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
31
+ <?php if ($_dob->isEnabled()): ?>
32
+ <li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
33
+ <?php endif ?>
34
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
35
+ <?php if ($_taxvat->isEnabled()): ?>
36
+ <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
37
+ <?php endif ?>
38
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
39
+ <?php if ($_gender->isEnabled()): ?>
40
+ <li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
41
+ <?php endif ?>
42
+
43
+ <?php if($this->getShowAddressFields()): ?>
44
+ <li class="hidden">
45
+ <input type="hidden" name="create_address" value="1" />
46
+ </li>
47
+ <li class="fields">
48
+ <div class="field">
49
+ <label for="company"><?php echo $this->__('Company') ?></label>
50
+ <div class="input-box">
51
+ <input type="text" name="company" id="company" value="<?php echo $this->escapeHtml($this->getFormData()->getCompany()) ?>" title="<?php echo $this->quoteEscape($this->__('Company')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
52
+ </div>
53
+ </div>
54
+ <div class="field">
55
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
56
+ <div class="input-box">
57
+ <input type="tel" name="telephone" id="telephone" value="<?php echo $this->escapeHtml($this->getFormData()->getTelephone()) ?>" title="<?php echo $this->quoteEscape($this->__('Telephone')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" />
58
+ </div>
59
+ </div>
60
+ </li>
61
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
62
+ <li class="wide">
63
+ <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
64
+ <div class="input-box">
65
+ <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet(0)) ?>" title="<?php echo $this->quoteEscape($this->__('Street Address')) ?>" id="street_1" class="input-text <?php echo $_streetValidationClass ?>" />
66
+ </div>
67
+ </li>
68
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
69
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
70
+ <li class="wide">
71
+ <label for="billing:street<?php echo $_i ?>"><?php echo $this->__('Street Address %s', $_i) ?></label>
72
+ <div class="input-box">
73
+ <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet($_i - 1)) ?>" title="<?php echo $this->quoteEscape($this->__('Street Address %s', $_i)) ?>" id="street_<?php echo $_i ?>" class="input-text <?php echo $_streetValidationClass ?>" />
74
+ </div>
75
+ </li>
76
+ <?php endfor; ?>
77
+ <li class="fields">
78
+ <div class="field">
79
+ <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
80
+ <div class="input-box">
81
+ <input type="text" name="city" value="<?php echo $this->escapeHtml($this->getFormData()->getCity()) ?>" title="<?php echo $this->quoteEscape($this->__('City')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="city" />
82
+ </div>
83
+ </div>
84
+ <div class="field">
85
+ <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
86
+ <div class="input-box">
87
+ <select id="region_id" name="region_id" title="<?php echo $this->quoteEscape($this->__('State/Province')) ?>" class="validate-select" style="display:none;">
88
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
89
+ </select>
90
+ <script type="text/javascript">
91
+ //<![CDATA[
92
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
93
+ //]]>
94
+ </script>
95
+ <input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getRegion()) ?>" title="<?php echo $this->quoteEscape($this->__('State/Province')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
96
+ </div>
97
+ </div>
98
+ </li>
99
+ <li class="fields">
100
+ <div class="field">
101
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
102
+ <div class="input-box">
103
+ <input type="text" name="postcode" value="<?php echo $this->escapeHtml($this->getFormData()->getPostcode()) ?>" title="<?php echo $this->quoteEscape($this->__('Zip/Postal Code')) ?>" id="zip" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
104
+ </div>
105
+ </div>
106
+ <div class="field">
107
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
108
+ <div class="input-box">
109
+ <?php echo $this->getCountryHtmlSelect() ?>
110
+ </div>
111
+ </div>
112
+ </li>
113
+ <li class="hidden">
114
+ <input type="hidden" name="default_billing" value="1" />
115
+ <input type="hidden" name="default_shipping" value="1" />
116
+ </li>
117
+ <?php endif; ?>
118
+ <li class="fields">
119
+ <div class="field">
120
+ <label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
121
+ <div class="input-box">
122
+ <input type="password" name="password" id="password" title="<?php echo $this->quoteEscape($this->__('Password')) ?>" class="input-text required-entry validate-password" />
123
+ </div>
124
+ </div>
125
+ <div class="field">
126
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
127
+ <div class="input-box">
128
+ <input type="password" name="confirmation" title="<?php echo $this->quoteEscape($this->__('Confirm Password')) ?>" id="confirmation" class="input-text required-entry validate-cpassword" />
129
+ </div>
130
+ </div>
131
+ </li>
132
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
133
+ <?php if ($this->isNewsletterEnabled()): ?>
134
+ <li class="control">
135
+ <div class="input-box">
136
+ <input type="checkbox" name="is_subscribed" title="<?php echo $this->quoteEscape($this->__('Sign Up for Newsletter')) ?>" value="1" id="is_subscribed"<?php if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" />
137
+ </div>
138
+ <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
139
+ </li>
140
+ <?php endif ?>
141
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
142
+ </ul>
143
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
144
+ </div>
145
+ <div class="buttons-set">
146
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
147
+ <button type="submit" title="<?php echo $this->quoteEscape($this->__('Register')) ?>" class="button"><span><span><?php echo $this->__('Register') ?></span></span></button>
148
+ </div>
149
+ <?php if (Mage::helper('checkout')->isContextCheckout()): ?>
150
+ <input name="context" type="hidden" value="checkout" />
151
+ <?php endif; ?>
152
+ </form>
153
+ <script type="text/javascript">
154
+ //<![CDATA[
155
+ var dataForm = new VarienForm('form-validate', true);
156
+ <?php if($this->getShowAddressFields()): ?>
157
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
158
+ <?php endif; ?>
159
+ //]]>
160
+ </script>
161
+ </div>
app/etc/modules/Webcreta_UserandMobile.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Webcreta_UserandMobile>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <version>0.1.0</version>
8
+ </Webcreta_UserandMobile>
9
+ </modules>
10
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Webcreta_UserandMobile</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension will help you to let customer login with email or mobile number and password.</summary>
10
+ <description>By default customer login with email and password. But what if you want to let customers login with mobile and password also? In that case this extension will help you to do that. Using this extension customer will be able to login with email or mobile and password. Customer login with email and password will be as it is but we have implemented functionality which will also work for login with mobile and password.</description>
11
+ <notes>Fixed minor bugs</notes>
12
+ <authors><author><name>WebCreta</name><user>WebCreta</user><email>webcreta@gmail.com</email></author></authors>
13
+ <date>2017-03-01</date>
14
+ <time>12:16:33</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Webcreta_UserandMobile.xml" hash="e633981572cb0b4720a531157962452a"/></dir></target><target name="magecommunity"><dir name="Webcreta"><dir name="UserandMobile"><dir name="Helper"><file name="Data.php" hash="7053bf4763a4901f9ad94d2e100397cd"/></dir><dir name="Model"><dir name="Checkout"><dir name="Type"><file name="Onepage.php" hash="1c180ab0968064b32cc2921ff293af55"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CustomerController.php" hash="95444e752ed4887e063a1f32da72273c"/></dir><dir name="Checkout"><file name="OnepageController.php" hash="4b7069009f97447853acc163aee7a84c"/></dir><dir name="Customer"><file name="AccountController.php" hash="aaf561029473d076e0a69d1fcbb61869"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="06559247a043df9293564b2b05daf4a6"/><file name="config.xml" hash="18fde4ef94e6c1b6307baffddae4f364"/><file name="system.xml" hash="4d72af6d586bf246cae22633ee1d3c7f"/></dir><dir name="sql"><dir name="userandmobile_setup"><file name="install-1.0.1.php" hash="c4cbdd3dd2334fed53f01893d67494fe"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="rwd"><dir name="default"><dir name="layout"><file name="userandmobile.xml" hash="8de6120455f5aaea29dc3d89bea28d69"/></dir><dir name="template"><dir name="userandmobile"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="4a9069f0892619b9b67b47e7a790a76e"/><file name="login.phtml" hash="e044b193a2cfbfa4f3827036dd9665d3"/></dir></dir><file name="edit.phtml" hash="4e5b73edb2af68e66ee6560351ab62c1"/><file name="login.phtml" hash="cae3d1e63778de9b306abd2b631d96ca"/><file name="register.phtml" hash="88a452af38d443bbca8c6c92482c9e57"/></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="layout"><file name="userandmobile.xml" hash="8de6120455f5aaea29dc3d89bea28d69"/></dir><dir name="template"><dir name="userandmobile"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="4a9069f0892619b9b67b47e7a790a76e"/><file name="login.phtml" hash="e044b193a2cfbfa4f3827036dd9665d3"/></dir></dir><file name="edit.phtml" hash="4e5b73edb2af68e66ee6560351ab62c1"/><file name="login.phtml" hash="cae3d1e63778de9b306abd2b631d96ca"/><file name="register.phtml" hash="c383140085404a467796fb9cd53b5eea"/></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="layout"><file name="userandmobile.xml" hash="8de6120455f5aaea29dc3d89bea28d69"/></dir><dir name="template"><dir name="userandmobile"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="4a9069f0892619b9b67b47e7a790a76e"/><file name="login.phtml" hash="e044b193a2cfbfa4f3827036dd9665d3"/></dir></dir><file name="edit.phtml" hash="4e5b73edb2af68e66ee6560351ab62c1"/><file name="login.phtml" hash="cae3d1e63778de9b306abd2b631d96ca"/><file name="register.phtml" hash="c383140085404a467796fb9cd53b5eea"/></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>