OC_Checkout - Version 1.0.1

Version Notes

This is first release.

Download this release

Release Info

Developer Unicode Systems
Extension OC_Checkout
Version 1.0.1
Comparing to
See all releases


Version 1.0.1

Files changed (35) hide show
  1. app/code/community/Uni/Occheckout/Block/Catalog/Product/View.php +61 -0
  2. app/code/community/Uni/Occheckout/Block/Checkout/Onepage/Abstract.php +18 -0
  3. app/code/community/Uni/Occheckout/Block/Checkout/Onepage/Billing.php +73 -0
  4. app/code/community/Uni/Occheckout/Block/Checkout/Onepage/Payment/Methods.php +26 -0
  5. app/code/community/Uni/Occheckout/Block/Checkout/Onepage/Shipping.php +73 -0
  6. app/code/community/Uni/Occheckout/Block/Index.php +16 -0
  7. app/code/community/Uni/Occheckout/Block/Updatecart.php +29 -0
  8. app/code/community/Uni/Occheckout/Helper/Data.php +17 -0
  9. app/code/community/Uni/Occheckout/controllers/AccountController.php +128 -0
  10. app/code/community/Uni/Occheckout/controllers/CartController.php +389 -0
  11. app/code/community/Uni/Occheckout/controllers/IndexController.php +142 -0
  12. app/code/community/Uni/Occheckout/controllers/OneclickController.php +267 -0
  13. app/code/community/Uni/Occheckout/etc/adminhtml.xml +33 -0
  14. app/code/community/Uni/Occheckout/etc/config.xml +81 -0
  15. app/code/community/Uni/Occheckout/etc/system.xml +50 -0
  16. app/design/frontend/base/default/layout/occheckout.xml +82 -0
  17. app/design/frontend/base/default/template/occheckout/catalog/product/view/addtocart.phtml +136 -0
  18. app/design/frontend/base/default/template/occheckout/customer/form/login.phtml +100 -0
  19. app/design/frontend/base/default/template/occheckout/index.phtml +148 -0
  20. app/design/frontend/base/default/template/occheckout/onepage/billing.phtml +266 -0
  21. app/design/frontend/base/default/template/occheckout/onepage/payment.phtml +113 -0
  22. app/design/frontend/base/default/template/occheckout/onepage/payment/methods.phtml +74 -0
  23. app/design/frontend/base/default/template/occheckout/onepage/shipping.phtml +202 -0
  24. app/design/frontend/base/default/template/occheckout/onepage/shipping_method.phtml +65 -0
  25. app/design/frontend/base/default/template/occheckout/onepage/shipping_method/additional.phtml +29 -0
  26. app/design/frontend/base/default/template/occheckout/onepage/shipping_method/available.phtml +101 -0
  27. app/design/frontend/base/default/template/occheckout/success.phtml +69 -0
  28. app/design/frontend/base/default/template/occheckout/updatecart.phtml +160 -0
  29. app/etc/modules/Uni_Occheckout.xml +10 -0
  30. js/jquery/jquery.colorbox-min.js +6 -0
  31. package.xml +20 -0
  32. skin/frontend/base/default/css/colorbox.css +70 -0
  33. skin/frontend/base/default/css/occheckout.css +71 -0
  34. skin/frontend/base/default/images/ajax-loader.gif +0 -0
  35. skin/frontend/base/default/js/occheckout.js +907 -0
app/code/community/Uni/Occheckout/Block/Catalog/Product/View.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Occheckout
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ ?>
11
+
12
+ <?php
13
+
14
+ require_once 'Mage/Checkout/Block/Onepage/Abstract.php';
15
+
16
+ class Uni_Occheckout_Block_Catalog_Product_View extends Mage_Catalog_Block_Product_View {
17
+
18
+ /**
19
+ * Retrieve HTML for addresses dropdown
20
+ *
21
+ * @param $item
22
+ * @return string
23
+ */
24
+ public function getAddressesHtmlSelect($type) {
25
+ if ($this->isCustomerLoggedIn()) {
26
+ $options = array();
27
+ foreach ($this->getCustomer()->getAddresses() as $address) {
28
+ $options[] = array(
29
+ 'value' => $address->getId(),
30
+ 'label' => $address->format('oneline')
31
+ );
32
+ }
33
+
34
+ $addressId = $this->getAddress()->getCustomerAddressId();
35
+ if (empty($addressId)) {
36
+ if ($type == 'billing') {
37
+ $address = $this->getCustomer()->getPrimaryBillingAddress();
38
+ } else {
39
+ $address = $this->getCustomer()->getPrimaryShippingAddress();
40
+ }
41
+ if ($address) {
42
+ $addressId = $address->getId();
43
+ }
44
+ }
45
+
46
+ $select = $this->getLayout()->createBlock('core/html_select')
47
+ ->setName($type . '_address_id')
48
+ ->setId($type . '-address-select')
49
+ ->setClass('address-select')
50
+ ->setExtraParams('onchange="' . $type . '.newAddress(!this.value)"')
51
+ ->setValue($addressId)
52
+ ->setOptions($options);
53
+
54
+ $select->addOption('', Mage::helper('checkout')->__('New Address'));
55
+
56
+ return $select->getHtml();
57
+ }
58
+ return '';
59
+ }
60
+
61
+ }
app/code/community/Uni/Occheckout/Block/Checkout/Onepage/Abstract.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Occheckout
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ ?>
11
+
12
+ <?php
13
+
14
+ class Uni_Occheckout_Block_Checkout_Onepage_Abstract extends Mage_Checkout_Block_Onepage_Abstract {
15
+
16
+
17
+
18
+ }
app/code/community/Uni/Occheckout/Block/Checkout/Onepage/Billing.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Occheckout
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ ?>
11
+
12
+ <?php
13
+
14
+ class Uni_Occheckout_Block_Checkout_Onepage_Billing extends Mage_Checkout_Block_Onepage_Billing {
15
+
16
+ /**
17
+ * Get payment method step html
18
+ *
19
+ * @return string
20
+ */
21
+ protected function _getPaymentMethodsHtml() {
22
+ $layout = $this->getLayout();
23
+ $update = $layout->getUpdate();
24
+ $update->load('checkout_onepage_paymentmethod');
25
+ $layout->generateXml();
26
+ $layout->generateBlocks();
27
+ $output = $layout->getOutput();
28
+ return $output;
29
+ }
30
+
31
+ /**
32
+ * Retrieve HTML for addresses dropdown
33
+ *
34
+ * @param $item
35
+ * @return string
36
+ */
37
+ public function getAddressesHtmlSelect($type) {
38
+ if ($this->isCustomerLoggedIn()) {
39
+ $options = array();
40
+ foreach ($this->getCustomer()->getAddresses() as $address) {
41
+ $options[] = array(
42
+ 'value' => $address->getId(),
43
+ 'label' => $address->format('oneline')
44
+ );
45
+ }
46
+
47
+ $addressId = $this->getAddress()->getCustomerAddressId();
48
+ if (empty($addressId)) {
49
+ if ($type == 'billing') {
50
+ $address = $this->getCustomer()->getPrimaryBillingAddress();
51
+ } else {
52
+ $address = $this->getCustomer()->getPrimaryShippingAddress();
53
+ }
54
+ if ($address) {
55
+ $addressId = $address->getId();
56
+ }
57
+ }
58
+
59
+ $select = $this->getLayout()->createBlock('core/html_select')
60
+ ->setName($type . '_address_id')
61
+ ->setId($type . '-address-select')
62
+ ->setClass('address-select')
63
+ ->setValue($addressId)
64
+ ->setOptions($options);
65
+
66
+ $select->addOption('', Mage::helper('checkout')->__('New Address'));
67
+
68
+ return $select->getHtml();
69
+ }
70
+ return '';
71
+ }
72
+
73
+ }
app/code/community/Uni/Occheckout/Block/Checkout/Onepage/Payment/Methods.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Occheckout
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ ?>
11
+
12
+ <?php
13
+
14
+ class Uni_Occheckout_Block_Checkout_Onepage_Payment_Methods extends Mage_Checkout_Block_Onepage_Payment_Methods {
15
+
16
+ /**
17
+ * Payment method form html getter
18
+ * @param Mage_Payment_Model_Method_Abstract $method
19
+ */
20
+ public function getPaymentMethodFormHtml(Mage_Payment_Model_Method_Abstract $method) {
21
+ return $this->getChildHtml('payment.method.' . $method->getCode());
22
+ }
23
+
24
+
25
+
26
+ }
app/code/community/Uni/Occheckout/Block/Checkout/Onepage/Shipping.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Occheckout
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ ?>
11
+
12
+ <?php
13
+
14
+ class Uni_Occheckout_Block_Checkout_Onepage_Shipping extends Mage_Checkout_Block_Onepage_Shipping {
15
+
16
+ /**
17
+ * Retrieve HTML for addresses dropdown
18
+ *
19
+ * @param $item
20
+ * @return string
21
+ */
22
+ public function getAddressesHtmlSelect($type) {
23
+ if ($this->isCustomerLoggedIn()) {
24
+ $options = array();
25
+ foreach ($this->getCustomer()->getAddresses() as $address) {
26
+ $options[] = array(
27
+ 'value' => $address->getId(),
28
+ 'label' => $address->format('oneline')
29
+ );
30
+ }
31
+
32
+ $addressId = $this->getAddress()->getCustomerAddressId();
33
+ if (empty($addressId)) {
34
+ if ($type == 'billing') {
35
+ $address = $this->getCustomer()->getPrimaryBillingAddress();
36
+ } else {
37
+ $address = $this->getCustomer()->getPrimaryShippingAddress();
38
+ }
39
+ if ($address) {
40
+ $addressId = $address->getId();
41
+ }
42
+ }
43
+
44
+ $select = $this->getLayout()->createBlock('core/html_select')
45
+ ->setName($type . '_address_id')
46
+ ->setId($type . '-address-select')
47
+ ->setClass('address-select')
48
+ ->setValue($addressId)
49
+ ->setOptions($options);
50
+
51
+ $select->addOption('', Mage::helper('checkout')->__('New Address'));
52
+
53
+ return $select->getHtml();
54
+ }
55
+ return '';
56
+ }
57
+
58
+ public function getCountryHtmlSelect($type) {
59
+ $countryId = $this->getAddress()->getCountryId();
60
+ if (is_null($countryId)) {
61
+ $countryId = Mage::helper('core')->getDefaultCountry();
62
+ }
63
+ $select = $this->getLayout()->createBlock('core/html_select')
64
+ ->setName($type . '[country_id]')
65
+ ->setId($type . ':country_id')
66
+ ->setTitle(Mage::helper('checkout')->__('Country'))
67
+ ->setClass('validate-select')
68
+ ->setValue($countryId)
69
+ ->setOptions($this->getCountryOptions());
70
+ return $select->getHtml();
71
+ }
72
+
73
+ }
app/code/community/Uni/Occheckout/Block/Index.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Occheckout
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ ?>
11
+
12
+ <?php
13
+
14
+ class Uni_Occheckout_Block_Index extends Mage_Checkout_Block_Onepage_Abstract{
15
+
16
+ }
app/code/community/Uni/Occheckout/Block/Updatecart.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Occheckout
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ ?>
11
+
12
+ <?php
13
+
14
+ class Uni_Occheckout_Block_Updatecart extends Mage_Core_Block_Template {
15
+
16
+ /**
17
+ * getting product ids added in cart
18
+ * @return type
19
+ */
20
+ public function removeConfigurableProduct() {
21
+ $result = array();
22
+ $session = Mage::getSingleton('checkout/session');
23
+ foreach ($session->getQuote()->getAllItems() as $item) {
24
+ $result[] = $item->getProduct()->getId();
25
+ }
26
+ return $result;
27
+ }
28
+
29
+ }
app/code/community/Uni/Occheckout/Helper/Data.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Occheckout
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ ?>
11
+
12
+ <?php
13
+
14
+ class Uni_Occheckout_Helper_Data extends Mage_Core_Helper_Abstract{
15
+
16
+ }
17
+
app/code/community/Uni/Occheckout/controllers/AccountController.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Occheckout
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ ?>
11
+
12
+ <?php
13
+
14
+ require_once 'Mage/Customer/controllers/AccountController.php';
15
+
16
+ class Uni_Occheckout_AccountController extends Mage_Customer_AccountController {
17
+
18
+ /**
19
+ * Customer login form page
20
+ */
21
+ public function loginAction() {
22
+ if ($this->_getSession()->isLoggedIn()) {
23
+ $this->_redirect('*/*/');
24
+ return;
25
+ }
26
+ $this->getResponse()->setHeader('Login-Required', 'true');
27
+ $this->loadLayout();
28
+ $this->_initLayoutMessages('customer/session');
29
+ $this->_initLayoutMessages('catalog/session');
30
+ $this->renderLayout();
31
+ }
32
+
33
+ /**
34
+ * Login post action
35
+ */
36
+ public function loginPostAction() {
37
+ if ($this->_getSession()->isLoggedIn()) {
38
+ $this->_redirect('*/*/');
39
+ return;
40
+ }
41
+ $session = $this->_getSession();
42
+
43
+ if ($this->getRequest()->isPost()) {
44
+ $login = $this->getRequest()->getPost('login');
45
+ $isoneclick = $this->getRequest()->getParam('isoneclick');
46
+ if (!empty($login['username']) && !empty($login['password'])) {
47
+ try {
48
+ $session->login($login['username'], $login['password']);
49
+ if ($session->getCustomer()->getIsJustConfirmed()) {
50
+ $this->_welcomeCustomer($session->getCustomer(), true);
51
+ }
52
+ } catch (Mage_Core_Exception $e) {
53
+ switch ($e->getCode()) {
54
+ case Mage_Customer_Model_Customer::EXCEPTION_EMAIL_NOT_CONFIRMED:
55
+ $value = Mage::helper('customer')->getEmailConfirmationUrl($login['username']);
56
+ $message = Mage::helper('customer')->__('This account is not confirmed. <a href="%s">Click here</a> to resend confirmation email.', $value);
57
+ break;
58
+ case Mage_Customer_Model_Customer::EXCEPTION_INVALID_EMAIL_OR_PASSWORD:
59
+ $message = $e->getMessage();
60
+ break;
61
+ default:
62
+ $message = $e->getMessage();
63
+ }
64
+ $session->addError($message);
65
+ $session->setUsername($login['username']);
66
+ } catch (Exception $e) {
67
+ // Mage::logException($e); // PA DSS violation: this exception log can disclose customer password
68
+ }
69
+ } else {
70
+ $session->addError($this->__('Login and password are required.'));
71
+ }
72
+ }
73
+ if ($session->getCustomer()->getId()) {
74
+ if ($isoneclick) {
75
+ $url = Mage::getModel('core/url')
76
+ ->getRebuiltUrl(Mage::helper('core')->urlDecode($isoneclick));
77
+ $this->_redirectUrl($url);
78
+ }else{
79
+ $this->_loginPostRedirect();
80
+ }
81
+ }else{
82
+ $this->_loginPostRedirect();
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Define target URL and redirect customer after logging in
88
+ */
89
+ protected function _loginPostRedirect() {
90
+ $session = $this->_getSession();
91
+
92
+ if (!$session->getBeforeAuthUrl() || $session->getBeforeAuthUrl() == Mage::getBaseUrl()) {
93
+ // Set default URL to redirect customer to
94
+ $session->setBeforeAuthUrl(Mage::helper('customer')->getAccountUrl());
95
+ // Redirect customer to the last page visited after logging in
96
+ if ($session->isLoggedIn()) {
97
+ if (!Mage::getStoreConfigFlag(
98
+ Mage_Customer_Helper_Data::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD
99
+ )) {
100
+ $referer = $this->getRequest()->getParam(Mage_Customer_Helper_Data::REFERER_QUERY_PARAM_NAME);
101
+ if ($referer) {
102
+ // Rebuild referer URL to handle the case when SID was changed
103
+ $referer = Mage::getModel('core/url')
104
+ ->getRebuiltUrl(Mage::helper('core')->urlDecode($referer));
105
+ if ($this->_isUrlInternal($referer)) {
106
+ $session->setBeforeAuthUrl($referer);
107
+ }
108
+ }
109
+ } else if ($session->getAfterAuthUrl()) {
110
+ $session->setBeforeAuthUrl($session->getAfterAuthUrl(true));
111
+ }
112
+ } else {
113
+ $session->setBeforeAuthUrl(Mage::helper('customer')->getLoginUrl());
114
+ }
115
+ } else if ($session->getBeforeAuthUrl() == Mage::helper('customer')->getLogoutUrl()) {
116
+ $session->setBeforeAuthUrl(Mage::helper('customer')->getDashboardUrl());
117
+ } else {
118
+ if (!$session->getAfterAuthUrl()) {
119
+ $session->setAfterAuthUrl($session->getBeforeAuthUrl());
120
+ }
121
+ if ($session->isLoggedIn()) {
122
+ $session->setBeforeAuthUrl($session->getAfterAuthUrl(true));
123
+ }
124
+ }
125
+ $this->_redirectUrl($session->getBeforeAuthUrl(true));
126
+ }
127
+
128
+ }
app/code/community/Uni/Occheckout/controllers/CartController.php ADDED
@@ -0,0 +1,389 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Occheckout
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ ?>
11
+
12
+ <?php
13
+
14
+ require_once 'Mage/Checkout/controllers/CartController.php';
15
+
16
+ class Uni_Occheckout_CartController extends Mage_Checkout_CartController {
17
+
18
+ /**
19
+ * Add product to shopping cart action
20
+ */
21
+ public function addAction() {
22
+ $cart = $this->_getCart();
23
+ $params = $this->getRequest()->getParams();
24
+ /**
25
+ * adding product to cart using ajax
26
+ */
27
+ if ($params['isAjax'] == 1) {
28
+ $isTest = $params['checkData'];
29
+ $response = array();
30
+ try {
31
+ if (isset($params['qty'])) {
32
+ $filter = new Zend_Filter_LocalizedToNormalized(
33
+ array('locale' => Mage::app()->getLocale()->getLocaleCode())
34
+ );
35
+ $params['qty'] = $filter->filter($params['qty']);
36
+ }
37
+
38
+ $product = $this->_initProduct();
39
+ $related = $this->getRequest()->getParam('related_product');
40
+
41
+ /**
42
+ * Check product availability
43
+ */
44
+ if (!$product) {
45
+ $response['status'] = 'ERROR';
46
+ $response['message'] = $this->__('Unable to find Product ID');
47
+ }
48
+
49
+ $cart->addProduct($product, $params);
50
+ if (!empty($related)) {
51
+ $cart->addProductsByIds(explode(',', $related));
52
+ }
53
+ if (!$isTest) {
54
+
55
+ $cart->save();
56
+
57
+ $this->_getSession()->setCartWasUpdated(true);
58
+ }
59
+ /**
60
+ * @todo remove wishlist observer processAddToCart
61
+ */
62
+ Mage::dispatchEvent('checkout_cart_add_product_complete', array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse())
63
+ );
64
+
65
+ if (!$this->_getSession()->getNoCartRedirect(true)) {
66
+ if (!$cart->getQuote()->getHasError()) {
67
+ $message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->htmlEscape($product->getName()));
68
+ $response['status'] = 'SUCCESS';
69
+ $response['message'] = $message;
70
+ }
71
+ }
72
+ } catch (Mage_Core_Exception $e) {
73
+ $msg = "";
74
+ if ($this->_getSession()->getUseNotice(true)) {
75
+ $msg = $e->getMessage();
76
+ } else {
77
+ $messages = array_unique(explode("\n", $e->getMessage()));
78
+ foreach ($messages as $message) {
79
+ $msg .= $message . '<br/>';
80
+ }
81
+ }
82
+
83
+ $response['status'] = 'ERROR';
84
+ $response['message'] = strip_tags($msg);
85
+ } catch (Exception $e) {
86
+ $response['status'] = 'ERROR';
87
+ $response['message'] = $this->__('Cannot add the item to shopping cart.');
88
+ Mage::logException($e);
89
+ }
90
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
91
+ return;
92
+ }
93
+
94
+ /**
95
+ * end of ajax code
96
+ */
97
+ try {
98
+ if (isset($params['qty'])) {
99
+ $filter = new Zend_Filter_LocalizedToNormalized(
100
+ array('locale' => Mage::app()->getLocale()->getLocaleCode())
101
+ );
102
+ $params['qty'] = $filter->filter($params['qty']);
103
+ }
104
+
105
+ $product = $this->_initProduct();
106
+ $related = $this->getRequest()->getParam('related_product');
107
+
108
+ /**
109
+ * Check product availability
110
+ */
111
+ if (!$product) {
112
+ $this->_goBack();
113
+ return;
114
+ }
115
+
116
+ $cart->addProduct($product, $params);
117
+ if (!empty($related)) {
118
+ $cart->addProductsByIds(explode(',', $related));
119
+ }
120
+
121
+ $cart->save();
122
+
123
+ $this->_getSession()->setCartWasUpdated(true);
124
+
125
+ /**
126
+ * @todo remove wishlist observer processAddToCart
127
+ */
128
+ Mage::dispatchEvent('checkout_cart_add_product_complete', array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse())
129
+ );
130
+
131
+ if (!$this->_getSession()->getNoCartRedirect(true)) {
132
+ if (!$cart->getQuote()->getHasError()) {
133
+ $message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->escapeHtml($product->getName()));
134
+ $this->_getSession()->addSuccess($message);
135
+ }
136
+ $this->_goBack();
137
+ }
138
+ } catch (Mage_Core_Exception $e) {
139
+ if ($this->_getSession()->getUseNotice(true)) {
140
+ $this->_getSession()->addNotice(Mage::helper('core')->escapeHtml($e->getMessage()));
141
+ } else {
142
+ $messages = array_unique(explode("\n", $e->getMessage()));
143
+ foreach ($messages as $message) {
144
+ $this->_getSession()->addError(Mage::helper('core')->escapeHtml($message));
145
+ }
146
+ }
147
+
148
+ $url = $this->_getSession()->getRedirectUrl(true);
149
+ if ($url) {
150
+ $this->getResponse()->setRedirect($url);
151
+ } else {
152
+ $this->_redirectReferer(Mage::helper('checkout/cart')->getCartUrl());
153
+ }
154
+ } catch (Exception $e) {
155
+ $this->_getSession()->addException($e, $this->__('Cannot add the item to shopping cart.'));
156
+ Mage::logException($e);
157
+ $this->_goBack();
158
+ }
159
+ }
160
+
161
+ /**
162
+ * Update shoping cart on one click checkout
163
+ */
164
+ protected function _updateShoppingCart() {
165
+ try {
166
+ $cartData = $this->getRequest()->getParam('cart');
167
+ if (is_array($cartData)) {
168
+ $filter = new Zend_Filter_LocalizedToNormalized(
169
+ array('locale' => Mage::app()->getLocale()->getLocaleCode())
170
+ );
171
+ foreach ($cartData as $index => $data) {
172
+ if (isset($data['qty'])) {
173
+ $cartData[$index]['qty'] = $filter->filter(trim($data['qty']));
174
+ }
175
+ }
176
+ $cart = $this->_getCart();
177
+ if (!$cart->getCustomerSession()->getCustomer()->getId() && $cart->getQuote()->getCustomerId()) {
178
+ $cart->getQuote()->setCustomerId(null);
179
+ }
180
+
181
+ $cartData = $cart->suggestItemsQty($cartData);
182
+ $cart->updateItems($cartData)
183
+ ->save();
184
+ }
185
+ $this->_getSession()->setCartWasUpdated(true);
186
+ } catch (Mage_Core_Exception $e) {
187
+ $this->_getSession()->addError(Mage::helper('core')->escapeHtml($e->getMessage()));
188
+ } catch (Exception $e) {
189
+ $this->_getSession()->addException($e, $this->__('Cannot update shopping cart.'));
190
+ Mage::logException($e);
191
+ }
192
+ }
193
+
194
+ /**
195
+ * Delete shoping cart item action
196
+ */
197
+ public function updateItemOptionsAction() {
198
+ $cart = $this->_getCart();
199
+ $id = (int) $this->getRequest()->getParam('id');
200
+ $params = $this->getRequest()->getParams();
201
+ /**
202
+ * updating cart quantity using ajax
203
+ */
204
+ if ($params['isAjax'] == 1) {
205
+ if (!isset($params['options'])) {
206
+ $params['options'] = array();
207
+ }
208
+ try {
209
+ if (isset($params['qty'])) {
210
+ $filter = new Zend_Filter_LocalizedToNormalized(
211
+ array('locale' => Mage::app()->getLocale()->getLocaleCode())
212
+ );
213
+ $params['qty'] = $filter->filter($params['qty']);
214
+ }
215
+
216
+ $quoteItem = $cart->getQuote()->getItemById($id);
217
+ if (!$quoteItem) {
218
+ Mage::throwException($this->__('Quote item is not found.'));
219
+ }
220
+
221
+ $item = $cart->updateItem($id, new Varien_Object($params));
222
+ if (is_string($item)) {
223
+ Mage::throwException($item);
224
+ }
225
+ if ($item->getHasError()) {
226
+ Mage::throwException($item->getMessage());
227
+ }
228
+
229
+ $related = $this->getRequest()->getParam('related_product');
230
+ if (!empty($related)) {
231
+ $cart->addProductsByIds(explode(',', $related));
232
+ }
233
+
234
+ $cart->save();
235
+
236
+ $this->_getSession()->setCartWasUpdated(true);
237
+
238
+ Mage::dispatchEvent('checkout_cart_update_item_complete', array('item' => $item, 'request' => $this->getRequest(), 'response' => $this->getResponse())
239
+ );
240
+ if (!$this->_getSession()->getNoCartRedirect(true)) {
241
+ if (!$cart->getQuote()->getHasError()) {
242
+ $message = $this->__('%s was updated in your shopping cart.', Mage::helper('core')->htmlEscape($item->getProduct()->getName()));
243
+ $response['status'] = 'SUCCESS';
244
+ $response['message'] = $message;
245
+ }
246
+ }
247
+ } catch (Mage_Core_Exception $e) {
248
+ if ($this->_getSession()->getUseNotice(true)) {
249
+ $this->_getSession()->addNotice($e->getMessage());
250
+ } else {
251
+ $messages = array_unique(explode("\n", $e->getMessage()));
252
+ foreach ($messages as $message) {
253
+ $this->_getSession()->addError($message);
254
+ }
255
+ }
256
+ $response['status'] = 'ERROR';
257
+ $response['message'] = $message;
258
+ } catch (Exception $e) {
259
+ $this->_getSession()->addException($e, $this->__('Cannot update the item.'));
260
+ $response['status'] = 'ERROR';
261
+ $response['message'] = $this->__('Cannot add the item to shopping cart.');
262
+ Mage::logException($e);
263
+ }
264
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
265
+ return;
266
+ /**
267
+ * updating using ajax ends
268
+ */
269
+ } else {
270
+ if (!isset($params['options'])) {
271
+ $params['options'] = array();
272
+ }
273
+ try {
274
+ if (isset($params['qty'])) {
275
+ $filter = new Zend_Filter_LocalizedToNormalized(
276
+ array('locale' => Mage::app()->getLocale()->getLocaleCode())
277
+ );
278
+ $params['qty'] = $filter->filter($params['qty']);
279
+ }
280
+
281
+ $quoteItem = $cart->getQuote()->getItemById($id);
282
+ if (!$quoteItem) {
283
+ Mage::throwException($this->__('Quote item is not found.'));
284
+ }
285
+
286
+ $item = $cart->updateItem($id, new Varien_Object($params));
287
+ if (is_string($item)) {
288
+ Mage::throwException($item);
289
+ }
290
+ if ($item->getHasError()) {
291
+ Mage::throwException($item->getMessage());
292
+ }
293
+
294
+ $related = $this->getRequest()->getParam('related_product');
295
+ if (!empty($related)) {
296
+ $cart->addProductsByIds(explode(',', $related));
297
+ }
298
+
299
+ $cart->save();
300
+
301
+ $this->_getSession()->setCartWasUpdated(true);
302
+
303
+ Mage::dispatchEvent('checkout_cart_update_item_complete', array('item' => $item, 'request' => $this->getRequest(), 'response' => $this->getResponse())
304
+ );
305
+ if (!$this->_getSession()->getNoCartRedirect(true)) {
306
+ if (!$cart->getQuote()->getHasError()) {
307
+ $message = $this->__('%s was updated in your shopping cart.', Mage::helper('core')->htmlEscape($item->getProduct()->getName()));
308
+ $this->_getSession()->addSuccess($message);
309
+ }
310
+ $this->_goBack();
311
+ }
312
+ } catch (Mage_Core_Exception $e) {
313
+ if ($this->_getSession()->getUseNotice(true)) {
314
+ $this->_getSession()->addNotice($e->getMessage());
315
+ } else {
316
+ $messages = array_unique(explode("\n", $e->getMessage()));
317
+ foreach ($messages as $message) {
318
+ $this->_getSession()->addError($message);
319
+ }
320
+ }
321
+
322
+ $url = $this->_getSession()->getRedirectUrl(true);
323
+ if ($url) {
324
+ $this->getResponse()->setRedirect($url);
325
+ } else {
326
+ $this->_redirectReferer(Mage::helper('checkout/cart')->getCartUrl());
327
+ }
328
+ } catch (Exception $e) {
329
+ $this->_getSession()->addException($e, $this->__('Cannot update the item.'));
330
+ Mage::logException($e);
331
+ $this->_goBack();
332
+ }
333
+ $this->_redirect('*/*');
334
+ }
335
+ }
336
+
337
+ /**
338
+ * Delete shoping cart item action
339
+ */
340
+ public function deleteAction() {
341
+ $isAjaxRequest = $this->getRequest()->getParam('isAjax');
342
+ if ($isAjaxRequest) {
343
+ $id = (int) $this->getRequest()->getParam('id');
344
+ if ($id) {
345
+ try {
346
+ $this->_getCart()->removeItem($id)
347
+ ->save();
348
+ } catch (Exception $e) {
349
+ $this->_getSession()->addError($this->__('Cannot remove the item.'));
350
+ Mage::logException($e);
351
+ }
352
+ }
353
+ return;
354
+ } else {
355
+ $id = (int) $this->getRequest()->getParam('id');
356
+ if ($id) {
357
+ try {
358
+ $this->_getCart()->removeItem($id)
359
+ ->save();
360
+ } catch (Exception $e) {
361
+ $this->_getSession()->addError($this->__('Cannot remove the item.'));
362
+ Mage::logException($e);
363
+ }
364
+ }
365
+ $this->_redirectReferer(Mage::getUrl('*/*'));
366
+ }
367
+ }
368
+
369
+ /**
370
+ * checking the type of cart update action
371
+ */
372
+ public function updatePostAction() {
373
+ $updateAction = (string) $this->getRequest()->getParam('update_cart_action');
374
+
375
+ switch ($updateAction) {
376
+ case 'empty_cart':
377
+ $this->_emptyShoppingCart();
378
+ break;
379
+ case 'update_qty':
380
+ $this->_updateShoppingCart();
381
+ break;
382
+ default:
383
+ $this->_updateShoppingCart();
384
+ }
385
+
386
+ $this->_goBack();
387
+ }
388
+
389
+ }
app/code/community/Uni/Occheckout/controllers/IndexController.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Occheckout
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ ?>
11
+
12
+ <?php
13
+
14
+ /**
15
+ * Occheckout controller for saving checkout details
16
+ */
17
+
18
+ class Uni_Occheckout_IndexController extends Mage_Core_Controller_Front_Action {
19
+
20
+ /**
21
+ * One click checkout action for oneclick popup page functionality
22
+ */
23
+ public function occheckoutAction() {
24
+ $this->loadLayout();
25
+ $this->renderLayout();
26
+ }
27
+
28
+ /**
29
+ * Shipping methods for one click checkout.
30
+ */
31
+ public function shippingMethodAction() {
32
+ $data = $this->getRequest()->getPost();
33
+ $customerAddressId = Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling();
34
+ $_customer = Mage::getSingleton('customer/session')->getCustomer();
35
+ $storeId = Mage::app()->getStore()->getStoreId();
36
+ $customAddress = Mage::getModel('customer/address');
37
+ if ($data['bildata']) {
38
+ $billdata = Zend_Json_Decoder::decode($data['bildata']);
39
+ }
40
+ if ($data['street']) {
41
+ $streets = Zend_Json_Decoder::decode($data['street']);
42
+ }
43
+ if ($data['billing_address_id']) {
44
+ $billAddId = Zend_Json_Decoder::decode($data['billing_address_id']);
45
+ }
46
+ if ($data['new_adderss']) {
47
+ $newAdd = array();
48
+ foreach ($data['new_adderss'] as $key => $value) {
49
+ $newAdd[$value['name']] = $value['value'];
50
+ }
51
+ }
52
+ if ($billAddId) {
53
+ $customAddress->load($billAddId);
54
+ } else {
55
+ $_custom_address = array(
56
+ 'firstname' => $newAdd['billing[firstname]'],
57
+ 'lastname' => $newAdd['billing[lastname]'],
58
+ 'street' => array(
59
+ '0' => $newAdd['street'],
60
+ '1' => $newAdd['street2'],
61
+ ),
62
+ 'city' => $newAdd['city'],
63
+ 'region_id' => $newAdd['region_id'],
64
+ 'region' => $newAdd['region'],
65
+ 'postcode' => $newAdd['postcode'],
66
+ 'country_id' => $newAdd['billing[country_id]'], /* Croatia */
67
+ 'telephone' => $newAdd['telephone'],
68
+ 'fax' => $newAdd['fax'],
69
+ );
70
+ $customAddress->setData($_custom_address);
71
+ }
72
+ $customAddress->setCustomerId($_customer->getId());
73
+ if ($newAdd['use_for_shipping']) {
74
+ $customAddress->setIsDefaultShipping('1');
75
+ }
76
+ if ($newAdd['save_in_address_book']) {
77
+ $customAddress->setSaveInAddressBook('1');
78
+ }
79
+
80
+ try {
81
+ if ($newAdd['save_in_address_book']) {
82
+ $customAddress->save();
83
+ }
84
+ } catch (Exception $ex) {
85
+
86
+ }
87
+ Mage::getSingleton('checkout/session')->getQuote()->setBillingAddress(Mage::getSingleton('sales/quote_address')->importCustomerAddress($customAddress));
88
+ }
89
+
90
+ /**
91
+ * Payment methods for one click checkout.
92
+ */
93
+ public function paymentmthdsAction() {
94
+ $this->loadLayout();
95
+ $this->renderLayout();
96
+ }
97
+
98
+ protected function _getPaymentMethodsHtml() {
99
+ $layout = $this->getLayout();
100
+ $update = $layout->getUpdate();
101
+ $update->load('occheckout_index_paymentmethod');
102
+ $layout->generateXml();
103
+ $layout->generateBlocks();
104
+ $output = $layout->getOutput();
105
+ return $output;
106
+ }
107
+
108
+ protected function _getAdditionalHtml() {
109
+ $layout = $this->getLayout();
110
+ $update = $layout->getUpdate();
111
+ $update->load('occheckout_index_additional');
112
+ $layout->generateXml();
113
+ $layout->generateBlocks();
114
+ $output = $layout->getOutput();
115
+ return $output;
116
+ }
117
+
118
+ /**
119
+ * updating one click checkout cart through ajax
120
+ */
121
+ public function updateCartAction() {
122
+ $params = $this->getRequest()->getParams();
123
+ // if it is a ajax request
124
+ if ($params['isAjax'] == 1) {
125
+ $data = $this->getLayout()->getBlock('occheckout/updatecart')->setTemplate('occheckout/updatecart.phtml')->toHtml();
126
+ $this->getResponse()->setBody($data);
127
+ }
128
+ }
129
+
130
+ /**
131
+ * updating cart grand total through ajax
132
+ */
133
+ public function updategrandtotalAction() {
134
+ $params = $this->getRequest()->getParams();
135
+ // if it is a ajax request
136
+ if ($params['isAjax'] == 1) {
137
+ $data = $this->getLayout()->getBlock('checkout/cart_totals')->setTemplate('checkout/cart/totals.phtml')->toHtml();
138
+ $this->getResponse()->setBody($data);
139
+ }
140
+ }
141
+
142
+ }
app/code/community/Uni/Occheckout/controllers/OneclickController.php ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Occheckout
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ ?>
11
+
12
+ <?php
13
+
14
+ require_once 'Mage/Checkout/controllers/OnepageController.php';
15
+
16
+ class Uni_Occheckout_OneclickController extends Mage_Checkout_OnepageController {
17
+
18
+ /**
19
+ * save checkout billing address
20
+ */
21
+ public function saveBillingAction() {
22
+ if ($this->getRequest()->isPost()) {
23
+ $newAdd = $this->getRequest()->getPost('billing_address_id');
24
+ $data = $this->getRequest()->getPost('billing', array());
25
+ $customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
26
+ if (isset($data['email'])) {
27
+ $data['email'] = trim($data['email']);
28
+ }
29
+ $result = $this->getOnepage()->saveBilling($data, $customerAddressId);
30
+ if (!isset($result['error'])) {
31
+ /* check quote for virtual */
32
+ if ($this->getOnepage()->getQuote()->isVirtual()) {
33
+ $result['goto_section'] = 'payment';
34
+ $result['update_section'] = array(
35
+ 'name' => 'payment-method',
36
+ 'html' => $this->_getPaymentMethodsHtml()
37
+ );
38
+ } elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
39
+ $result['goto_section'] = 'shipping_method';
40
+ $result['update_section'] = array(
41
+ 'name' => 'shipping-method',
42
+ 'html' => $this->_getShippingMethodsHtml()
43
+ );
44
+
45
+ $result['allow_sections'] = array('shipping');
46
+ $result['duplicateBillingInfo'] = 'true';
47
+ } else {
48
+ $result['goto_section'] = 'shipping';
49
+ }
50
+ if (!$newAdd) {
51
+ $result['new_address'] = 'Billing address saved successfully';
52
+ }
53
+ }
54
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Shipping address save action
60
+ */
61
+ public function saveShippingAction() {
62
+ if ($this->getRequest()->isPost()) {
63
+ $newAdd = $this->getRequest()->getPost('shipping_address_id');
64
+ $data = $this->getRequest()->getPost('shipping', array());
65
+ $customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
66
+ $result = $this->getOnepage()->saveShipping($data, $customerAddressId);
67
+
68
+ if (!isset($result['error'])) {
69
+ $result['goto_section'] = 'shipping_method';
70
+ $result['update_section'] = array(
71
+ 'name' => 'shipping-method',
72
+ 'html' => $this->_getShippingMethodsHtml()
73
+ );
74
+ if (!$newAdd) {
75
+ $result['new_address'] = 'Shipping address saved successfully';
76
+ }
77
+ }
78
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
79
+ }
80
+ }
81
+
82
+ /**
83
+ * Reloading payment method on ajax request
84
+ */
85
+ public function reloadPaymentMethodAction() {
86
+ $data = $this->getLayout()->getBlock('checkout/onepage_payment_methods')->setTemplate('checkout/onepage/payment/methods.phtml')->toHtml();
87
+ $this->getResponse()->setBody($data);
88
+ }
89
+
90
+ /**
91
+ * reloading shipping method on ajax request
92
+ */
93
+ public function reloadSippingMethodAction() {
94
+ $data = $this->getLayout()->getBlock('checkout/onepage_shipping_method_available')->setTemplate('checkout/onepage/shipping_method/available.phtml')->toHtml();
95
+ $this->getResponse()->setBody($data);
96
+ }
97
+
98
+ /**
99
+ * Shipping method save action
100
+ */
101
+ public function saveShippingMethodAction() {
102
+ if ($this->getRequest()->isPost()) {
103
+ $data = $this->getRequest()->getPost('shipping_method', '');
104
+ $result = $this->getOnepage()->saveShippingMethod($data);
105
+ /*
106
+ $result will have erro data if shipping method is empty
107
+ */
108
+ if (!$result) {
109
+ Mage::dispatchEvent('checkout_controller_onepage_save_shipping_method', array('request' => $this->getRequest(),
110
+ 'quote' => $this->getOnepage()->getQuote()));
111
+ $this->getOnepage()->getQuote()->collectTotals();
112
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
113
+
114
+ $result['goto_section'] = 'payment';
115
+ $result['update_section'] = array(
116
+ 'name' => 'payment-method',
117
+ 'html' => $this->_getPaymentMethodsHtml()
118
+ );
119
+ }
120
+ $this->getOnepage()->getQuote()->collectTotals()->save();
121
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
122
+ }
123
+ }
124
+
125
+ /**
126
+ * Save payment ajax action
127
+ *
128
+ * Sets either redirect or a JSON response
129
+ */
130
+ public function savePaymentAction() {
131
+ try {
132
+ if (!$this->getRequest()->isPost()) {
133
+ $this->_ajaxRedirectResponse();
134
+ return;
135
+ }
136
+ // set payment to quote
137
+ $result = array();
138
+ $data = $this->getRequest()->getPost('payment', array());
139
+ $result = $this->getOnepage()->savePayment($data);
140
+ // get section and redirect data
141
+ $redirectUrl = $this->getOnepage()->getQuote()->getPayment()->getCheckoutRedirectUrl();
142
+ if (empty($result['error']) && !$redirectUrl) {
143
+ $this->loadLayout('checkout_onepage_review');
144
+ $result['goto_section'] = 'review';
145
+ $result['update_section'] = array(
146
+ 'name' => 'review',
147
+ 'html' => $this->_getReviewHtml()
148
+ );
149
+ }
150
+ if ($redirectUrl) {
151
+ $result['redirect'] = $redirectUrl;
152
+ }
153
+ } catch (Mage_Payment_Exception $e) {
154
+ if ($e->getFields()) {
155
+ $result['fields'] = $e->getFields();
156
+ }
157
+ $result['error'] = $e->getMessage();
158
+ } catch (Mage_Core_Exception $e) {
159
+ $result['error'] = $e->getMessage();
160
+ } catch (Exception $e) {
161
+ Mage::logException($e);
162
+ $result['error'] = $this->__('Unable to set Payment Method.');
163
+ }
164
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
165
+ }
166
+
167
+ /**
168
+ * Create order action
169
+ */
170
+ public function saveOrderAction() {
171
+ $result = array();
172
+ try {
173
+ if ($requiredAgreements = Mage::helper('checkout')->getRequiredAgreementIds()) {
174
+ $postedAgreements = array_keys($this->getRequest()->getPost('agreement', array()));
175
+ if ($diff = array_diff($requiredAgreements, $postedAgreements)) {
176
+ $result['success'] = false;
177
+ $result['error'] = true;
178
+ $result['error_messages'] = $this->__('Please agree to all the terms and conditions before placing the order.');
179
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
180
+ return;
181
+ }
182
+ }
183
+ if ($data = $this->getRequest()->getPost('payment', false)) {
184
+ $this->getOnepage()->getQuote()->getPayment()->importData($data);
185
+ }
186
+ $this->getOnepage()->saveOrder();
187
+
188
+ $redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl();
189
+ $result['success'] = true;
190
+ $result['error'] = false;
191
+ } catch (Mage_Payment_Model_Info_Exception $e) {
192
+ $message = $e->getMessage();
193
+ if (!empty($message)) {
194
+ $result['error_messages'] = $message;
195
+ }
196
+ $result['goto_section'] = 'payment';
197
+ $result['update_section'] = array(
198
+ 'name' => 'payment-method',
199
+ 'html' => $this->_getPaymentMethodsHtml()
200
+ );
201
+ } catch (Mage_Core_Exception $e) {
202
+ Mage::logException($e);
203
+ Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
204
+ $result['success'] = false;
205
+ $result['error'] = true;
206
+ $result['error_messages'] = $e->getMessage();
207
+
208
+ if ($gotoSection = $this->getOnepage()->getCheckout()->getGotoSection()) {
209
+ $result['goto_section'] = $gotoSection;
210
+ $this->getOnepage()->getCheckout()->setGotoSection(null);
211
+ }
212
+
213
+ if ($updateSection = $this->getOnepage()->getCheckout()->getUpdateSection()) {
214
+ if (isset($this->_sectionUpdateFunctions[$updateSection])) {
215
+ $updateSectionFunction = $this->_sectionUpdateFunctions[$updateSection];
216
+ $result['update_section'] = array(
217
+ 'name' => $updateSection,
218
+ 'html' => $this->$updateSectionFunction()
219
+ );
220
+ }
221
+ $this->getOnepage()->getCheckout()->setUpdateSection(null);
222
+ }
223
+ } catch (Exception $e) {
224
+ Mage::logException($e);
225
+ Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
226
+ $result['success'] = false;
227
+ $result['error'] = true;
228
+ $result['error_messages'] = $this->__('There was an error processing your order. Please contact us or try again later.');
229
+ }
230
+ $this->getOnepage()->getQuote()->save();
231
+ /**
232
+ * when there is redirect to third party, we don't want to save order yet.
233
+ * we will save the order in return action.
234
+ */
235
+ if (isset($redirectUrl)) {
236
+ $result['redirect'] = $redirectUrl;
237
+ }
238
+
239
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
240
+ }
241
+
242
+ /**
243
+ * Order success action
244
+ */
245
+ public function successAction() {
246
+ $session = $this->getOnepage()->getCheckout();
247
+ if (!$session->getLastSuccessQuoteId()) {
248
+ $this->_redirect('checkout/cart');
249
+ return;
250
+ }
251
+
252
+ $lastQuoteId = $session->getLastQuoteId();
253
+ $lastOrderId = $session->getLastOrderId();
254
+ $lastRecurringProfiles = $session->getLastRecurringProfileIds();
255
+ if (!$lastQuoteId || (!$lastOrderId && empty($lastRecurringProfiles))) {
256
+ $this->_redirect('checkout/cart');
257
+ return;
258
+ }
259
+
260
+ $session->clear();
261
+ $this->loadLayout();
262
+ $this->_initLayoutMessages('checkout/session');
263
+ Mage::dispatchEvent('occheckout_oneclick_controller_success_action', array('order_ids' => array($lastOrderId)));
264
+ $this->renderLayout();
265
+ }
266
+
267
+ }
app/code/community/Uni/Occheckout/etc/adminhtml.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Occheckout
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ -->
11
+
12
+ <config>
13
+ <acl>
14
+ <resources>
15
+ <admin>
16
+ <children>
17
+ <system>
18
+ <children>
19
+ <config>
20
+ <children>
21
+ <occheckout translate="title" module="occheckout">
22
+ <title>One click checkout Section</title>
23
+ <sort_order>0</sort_order>
24
+ </occheckout>
25
+ </children>
26
+ </config>
27
+ </children>
28
+ </system>
29
+ </children>
30
+ </admin>
31
+ </resources>
32
+ </acl>
33
+ </config>
app/code/community/Uni/Occheckout/etc/config.xml ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Occheckout
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ -->
11
+ <config>
12
+ <modules>
13
+ <Uni_Occheckout>
14
+ <version>1.0.1</version>
15
+ </Uni_Occheckout>
16
+ </modules>
17
+ <frontend>
18
+ <routers>
19
+ <occheckout>
20
+ <use>standard</use>
21
+ <args>
22
+ <module>Uni_Occheckout</module>
23
+ <frontName>occheckout</frontName>
24
+ </args>
25
+ </occheckout>
26
+ <checkout>
27
+ <args>
28
+ <modules>
29
+ <Uni_Occheckout before="Mage_Checkout">Uni_Occheckout</Uni_Occheckout>
30
+ </modules>
31
+ </args>
32
+ </checkout>
33
+ <customer>
34
+ <args>
35
+ <modules>
36
+ <Uni_Occheckout before="Mage_Customer">Uni_Occheckout</Uni_Occheckout>
37
+ </modules>
38
+ </args>
39
+ </customer>
40
+ </routers>
41
+ <layout>
42
+ <updates>
43
+ <occheckout>
44
+ <file>occheckout.xml</file>
45
+ </occheckout>
46
+ </updates>
47
+ </layout>
48
+ </frontend>
49
+ <global>
50
+ <helpers>
51
+ <occheckout>
52
+ <class>Uni_Occheckout_Helper</class>
53
+ </occheckout>
54
+ </helpers>
55
+ <blocks>
56
+ <occheckout>
57
+ <class>Uni_Occheckout_Block</class>
58
+ </occheckout>
59
+ <catalog>
60
+ <rewrite>
61
+ <product_view>Uni_Occheckout_Block_Catalog_Product_View</product_view>
62
+ </rewrite>
63
+ </catalog>
64
+ <checkout>
65
+ <rewrite>
66
+ <onepage_billing>Uni_Occheckout_Block_Checkout_Onepage_Billing</onepage_billing>
67
+ </rewrite>
68
+ </checkout>
69
+ <checkout>
70
+ <rewrite>
71
+ <onepage_shipping>Uni_Occheckout_Block_Checkout_Onepage_Shipping</onepage_shipping>
72
+ </rewrite>
73
+ </checkout>
74
+ <checkout>
75
+ <rewrite>
76
+ <onepage_payment_methods>Uni_Occheckout_Block_Checkout_Onepage_Payment_Methods</onepage_payment_methods>
77
+ </rewrite>
78
+ </checkout>
79
+ </blocks>
80
+ </global>
81
+ </config>
app/code/community/Uni/Occheckout/etc/system.xml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Unicode Systems
5
+ * @category Uni
6
+ * @package Uni_Occheckout
7
+ * @copyright Copyright (c) 2010-2011 Unicode Systems. (http://www.unicodesystems.in)
8
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
9
+ */
10
+ -->
11
+ <config>
12
+ <tabs>
13
+ <unicode_extensionsv translate="label" module="occheckout">
14
+ <label>Unicode Systems Extensions</label>
15
+ <sort_order>102</sort_order>
16
+ </unicode_extensionsv>
17
+ </tabs>
18
+ <sections>
19
+ <occheckout translate="label" module="occheckout">
20
+ <label>One click checkout </label>
21
+ <tab>unicode_extensionsv</tab>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>0</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ <groups>
28
+ <configuration translate="label">
29
+ <label>Configuration</label>
30
+ <frontend_type>text</frontend_type>
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
+ <fields>
36
+ <occheckout_status translate="label">
37
+ <label>Enable one click checkout</label>
38
+ <frontend_type>select</frontend_type>
39
+ <source_model>adminhtml/system_config_source_yesno</source_model>
40
+ <sort_order>0</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ </occheckout_status>
45
+ </fields>
46
+ </configuration>
47
+ </groups>
48
+ </occheckout>
49
+ </sections>
50
+ </config>
app/design/frontend/base/default/layout/occheckout.xml ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="1.0.1">
3
+ <customer_account_login>
4
+ <reference name="customer_form_login">
5
+ <action method="setTemplate">
6
+ <template>occheckout/customer/form/login.phtml</template>
7
+ </action>
8
+ <block type="persistent/form_remember" name="persistent.remember.me" template="persistent/remember_me.phtml" />
9
+ <block type="core/template" name="persistent.remember.me.tooltip" template="persistent/remember_me_tooltip.phtml" />
10
+ </reference>
11
+ </customer_account_login>
12
+ <catalog_product_view>
13
+ <reference name="product.info.addtocart">
14
+ <action method="setTemplate">
15
+ <template>occheckout/catalog/product/view/addtocart.phtml</template>
16
+ </action>
17
+ </reference>
18
+ </catalog_product_view>
19
+ <default translate="label" module="page">
20
+ <reference type="page/html_head" name="head" as="head">
21
+ <action method="addJs">
22
+ <script>jquery/jquery.colorbox-min.js</script>
23
+ </action>
24
+ <action method="addCss">
25
+ <stylesheet>css/colorbox.css</stylesheet>
26
+ </action>
27
+ <action method="addItem">
28
+ <type>skin_css</type>
29
+ <script>css/occheckout.css</script>
30
+ </action>
31
+ </reference>
32
+ </default>
33
+ <occheckout_index_occheckout>
34
+ <reference name="root">
35
+ <action method="setTemplate">
36
+ <template>page/1column.phtml</template>
37
+ </action>
38
+ </reference>
39
+ <reference type="page/html_head" name="head" as="head">
40
+ <action method="addItem">
41
+ <type>skin_js</type>
42
+ <script>js/occheckout.js</script>
43
+ </action>
44
+ </reference>
45
+ <remove name="header"/>
46
+ <remove name="footer"/>
47
+ <reference name="content">
48
+ <block type="occheckout/checkout_onepage_billing" name='opceckout_billing' template="occheckout/index.phtml">
49
+ <block type="occheckout/updatecart" name="updatecart" as="updatecartajax" output="toHtml" template="occheckout/updatecart.phtml"/>
50
+ <block type="checkout/onepage_billing" name="checkout.onepage.billing" as="billing" template="occheckout/onepage/billing.phtml"/>
51
+ <block type="checkout/onepage_shipping" name="checkout.onepage.shipping" as="shipping" template="occheckout/onepage/shipping.phtml"/>
52
+
53
+ <block type="checkout/onepage_shipping_method" name="checkout.onepage.shipping_method" as="shipping_method" template="occheckout/onepage/shipping_method.phtml">
54
+ <block type="checkout/onepage_shipping_method_available" name="checkout.onepage.shipping_method.available" as="available" template="occheckout/onepage/shipping_method/available.phtml"/>
55
+ <block type="checkout/onepage_shipping_method_additional" name="checkout.onepage.shipping_method.additional" as="additional" template="occheckout/onepage/shipping_method/additional.phtml"/>
56
+ </block>
57
+ <block type="checkout/onepage_payment" name="checkout.onepage.payment" as="payment" template="occheckout/onepage/payment.phtml">
58
+ <block type="checkout/cart_totals" name="checkout.cart.totals" as="totals" template="checkout/cart/totals.phtml"/>
59
+ <block type="checkout/onepage_payment_methods" name="checkout.payment.methods" as="methods" template="occheckout/onepage/payment/methods.phtml">
60
+ <action method="setMethodFormTemplate">
61
+ <method>purchaseorder</method>
62
+ <template>payment/form/purchaseorder.phtml</template>
63
+ </action>
64
+ </block>
65
+ </block>
66
+ </block>
67
+ </reference>
68
+ </occheckout_index_occheckout>
69
+
70
+ <occheckout_oneclick_success translate="label">
71
+ <label>One Page Checkout Success</label>
72
+ <reference name="root">
73
+ <action method="setTemplate">
74
+ <template>page/1column.phtml</template>
75
+ </action>
76
+ </reference>
77
+ <reference name="content">
78
+ <block type="checkout/onepage_success" name="checkout.success" template="occheckout/success.phtml"/>
79
+ </reference>
80
+ </occheckout_oneclick_success>
81
+ </layout>
82
+
app/design/frontend/base/default/template/occheckout/catalog/product/view/addtocart.phtml ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php $_product = $this->getProduct(); ?>
28
+ <?php $buttonTitle = $this->__('Add to Cart'); ?>
29
+ <?php if ($_product->isSaleable()): ?>
30
+ <div class="add-to-cart">
31
+ <?php if (!$_product->isGrouped()): ?>
32
+ <label for="qty"><?php echo $this->__('Qty:') ?></label>
33
+ <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
34
+ <?php endif; ?>
35
+ <button type="button" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>
36
+ <?php echo $this->getChildHtml('', true, true) ?>
37
+ </div>
38
+ <?php endif; ?>
39
+
40
+ <!-- One click checkout -->
41
+
42
+ <?php if (Mage::getStoreConfig('occheckout/configuration/occheckout_status')): ?>
43
+ <div class="occheckout occheckout-fl">
44
+ <?php if (Mage::helper('customer')->isLoggedIn()) : ?>
45
+ <a id="occheckout-popup" class="openform occheckout-btn-cart"><span><?php echo $this->__('One click checkout') ?></span></a>
46
+ <?php else : ?>
47
+ <?php $url = Mage::helper('core/url')->getCurrentUrl(); ?>
48
+ <a class="logout-btn-cart occheckout-btn-cart" href="<?php echo $this->getUrl('customer/account/login', array('isoneclick' => strtr(base64_encode($url), '+/=', '-_,'))) ?>"><?php echo $this->__('Login to use One Click Checkout'); ?></a>
49
+ <?php endif; ?>
50
+ </div>
51
+ <?php endif; ?>
52
+
53
+ <!-- End One click checkout -->
54
+ <script type="text/javascript">
55
+
56
+ var productAddToCartFormAjax = new VarienForm('product_addtocart_form');
57
+
58
+ //Add product in cart using ajax
59
+ productAddToCartFormAjax.submit = function(button, url) {
60
+ if (this.validator.validate()) {
61
+ var form = this.form;
62
+ var oldUrl = form.action;
63
+
64
+ if (url) {
65
+ form.action = url;
66
+ }
67
+ var e = null;
68
+ //Start of our new ajax code
69
+ if (!url) {
70
+ url = jQuery('#product_addtocart_form').attr('action');
71
+ }
72
+ var data = jQuery('#product_addtocart_form').serialize();
73
+ data += '&isAjax=1';
74
+ try {
75
+ jQuery.ajax({
76
+ url: url,
77
+ dataType: 'json',
78
+ type: 'post',
79
+ data: data,
80
+ success: function(data) {
81
+ openColorbox();
82
+ }
83
+ });
84
+ } catch (e) {
85
+ }
86
+ //End of our new ajax code
87
+ this.form.action = oldUrl;
88
+ if (e) {
89
+ throw e;
90
+ }
91
+ }
92
+ }.bind(productAddToCartFormAjax);
93
+
94
+
95
+ jQuery('#occheckout-popup').click(function(e) {
96
+ if (!(productAddToCartFormAjax.validator.validate())) {
97
+ alert('Please select the required options');
98
+ } else {
99
+ testData();
100
+ }
101
+ });
102
+
103
+
104
+ function testData() {
105
+ var data = jQuery('#product_addtocart_form').serialize();
106
+ data += '&isAjax=1';
107
+ data += '&checkData=1';
108
+ jQuery.ajax({
109
+ url: '<?php echo $this->getUrl('occheckout/cart/add'); ?>',
110
+ dataType: 'json',
111
+ type: 'post',
112
+ data: data,
113
+ success: function(response) {
114
+ if (response.status == 'ERROR') {
115
+ alert(response.message);
116
+ }
117
+ if (response.status == 'SUCCESS') {
118
+ productAddToCartFormAjax.submit();
119
+ }
120
+ },
121
+ });
122
+ }
123
+ function openColorbox() {
124
+ var myHref = "<?php echo $this->getUrl('occheckout/index/occheckout'); ?>";
125
+ jQuery.colorbox({
126
+ width: '1100px',
127
+ height: '700px',
128
+ iframe: true,
129
+ href: myHref,
130
+ opacity: 0.6,
131
+ className: 'openform'
132
+ });
133
+ }
134
+
135
+ </script>
136
+
app/design/frontend/base/default/template/occheckout/customer/form/login.phtml ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Customer login form template
30
+ *
31
+ * @see app/design/frontend/base/default/template/customer/form/login.phtml
32
+ */
33
+ /** @var $this Mage_Customer_Block_Form_Login */
34
+ ?>
35
+ <?php $oneClick = $this->getRequest()->getParam('isoneclick');?>
36
+ <div class="account-login">
37
+ <div class="page-title">
38
+ <h1><?php echo $this->__('Login or Create an Account') ?></h1>
39
+ </div>
40
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
41
+ <?php if($oneClick):?>
42
+ <form action="<?php echo $this->getUrl('customer/account/loginPost',array('isoneclick'=>$oneClick)) ?>" method="post" id="login-form">
43
+ <?php else:?>
44
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form">
45
+ <?php endif;?>
46
+ <div class="col2-set">
47
+ <div class="col-1 new-users">
48
+ <div class="content">
49
+ <h2><?php echo $this->__('New Customers') ?></h2>
50
+ <p><?php echo $this->__('By creating an account with our store, you will be able to move through the checkout process faster, store multiple shipping addresses, view and track your orders in your account and more.') ?></p>
51
+ </div>
52
+ </div>
53
+ <div class="col-2 registered-users">
54
+ <div class="content">
55
+ <h2><?php echo $this->__('Registered Customers') ?></h2>
56
+ <p><?php echo $this->__('If you have an account with us, please log in.') ?></p>
57
+ <ul class="form-list">
58
+ <li>
59
+ <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
60
+ <div class="input-box">
61
+ <input type="text" name="login[username]" value="<?php echo $this->htmlEscape($this->getUsername()) ?>" id="email" class="input-text required-entry validate-email" title="<?php echo $this->__('Email Address') ?>" />
62
+ </div>
63
+ </li>
64
+ <li>
65
+ <label for="pass" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
66
+ <div class="input-box">
67
+ <input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->__('Password') ?>" />
68
+ </div>
69
+ </li>
70
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
71
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
72
+ </ul>
73
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
74
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
75
+ </div>
76
+ </div>
77
+ </div>
78
+ <div class="col2-set">
79
+ <div class="col-1 new-users">
80
+ <div class="buttons-set">
81
+ <button type="button" title="<?php echo $this->__('Create an Account') ?>" class="button" onclick="window.location='<?php echo Mage::helper('persistent')->getCreateAccountUrl($this->getCreateAccountUrl()) ?>';"><span><span><?php echo $this->__('Create an Account') ?></span></span></button>
82
+ </div>
83
+ </div>
84
+ <div class="col-2 registered-users">
85
+ <div class="buttons-set">
86
+ <a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('Forgot Your Password?') ?></a>
87
+ <button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button>
88
+ </div>
89
+ </div>
90
+ </div>
91
+ <?php if (Mage::helper('checkout')->isContextCheckout()): ?>
92
+ <input name="context" type="hidden" value="checkout" />
93
+ <?php endif; ?>
94
+ </form>
95
+ <script type="text/javascript">
96
+ //<![CDATA[
97
+ var dataForm = new VarienForm('login-form', true);
98
+ //]]>
99
+ </script>
100
+ </div>
app/design/frontend/base/default/template/occheckout/index.phtml ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="page-title title-buttons occheckout-title">
2
+ <h1>Checkout</h1>
3
+ <ul class="checkout-types">
4
+ <li><button onclick="parent.location.href = '<?php echo $this->getUrl('checkout/onepage/index') ?>'" class="button btn-proceed-checkout btn-checkout"><span><span>Standard Checkout</span></span></button></li>
5
+ <li><button onclick="parent.location.href = '<?php echo $this->getUrl() ?>'" class="button btn-update"><span><span>Continue Shopping</span></span></button></li>
6
+ </ul>
7
+ </div>
8
+ <div class="occheckout-left">
9
+ <div class="billing-shipping-addresses">
10
+ <div class="billing-address" style="float: left">
11
+ <?php echo $this->getChildHtml('billing'); ?>
12
+ </div>
13
+ <div class="ajax-loader" style="display: none">
14
+ <img src="<?php echo $this->getSkinUrl('images/ajax-loader.gif'); ?>" alt="loader"/>
15
+ </div>
16
+ <div class="shipping-address" style="float: right">
17
+ <?php echo $this->getChildHtml('shipping'); ?>
18
+ </div>
19
+ </div>
20
+ </div>
21
+ <div class="occheckout-right">
22
+ <div class='cart-manual'>
23
+ <h2>Shopping Cart</h2>
24
+ <form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="post" id="product_updatecart_form" enctype="multipart/form-data" >
25
+ <div class='cart-data'>
26
+ <?php echo $this->getChildHtml('updatecartajax'); ?>
27
+ </div>
28
+ <button type="button" onclick="productUpdateCartForm.submit(this)" name="update_cart_action" value="update_qty" title="<?php echo $this->__('Update Cart'); ?>" class="button btn-update"><span><span><?php echo $this->__('Update Cart'); ?></span></span></button>
29
+ </form>
30
+ </div>
31
+ <div class="shipping-payment-methods">
32
+ <div class="payment-methods">
33
+ <span><h3>Payment Methods</h3></span>
34
+ <?php echo $this->getChildHtml('payment'); ?>
35
+ </div>
36
+ <div class="shipping-method">
37
+ <span><h3>Shipping Methods</h3></span>
38
+ <?php echo $this->getChildHtml('shipping_method'); ?>
39
+ </div>
40
+ </div>
41
+ </div>
42
+
43
+
44
+
45
+
46
+
47
+
48
+ <!--<button type="submit" title="<?php echo $this->__('Place Order') ?>" class="button btn-checkout" onclick="review.save();"><span><span><?php echo $this->__('Place Order') ?></span></span></button>-->
49
+
50
+ <?php // echo $this->getLayout()->getBlock('checkout/onepage_review')->setTemplate('checkout/onepage/review.phtml')->toHtml(); ?>
51
+ <!--</div>-->
52
+ <?php // echo $this->getPaymentMethodFormHtml() ?>
53
+
54
+
55
+
56
+ <?php
57
+ $billing = array();
58
+ $address = $this->getCustomer()->getDefaultBillingAddress();
59
+ if ($address) {
60
+ $address = $address->getData();
61
+ }
62
+ $tags = preg_split('/\\r\\n|\\r|\\n/', $address['street']);
63
+ $strt = array();
64
+ foreach ($tags as $v) {
65
+ $strt[] = $v;
66
+ }
67
+ ?>
68
+
69
+ <script type="text/javascript">
70
+ jQuery(document).ready(function() {
71
+ jQuery('.occheckout-index-occheckout').children('div.cart-items-details').remove();
72
+
73
+ });
74
+ jQuery(document).ajaxComplete(function() {
75
+ jQuery('#billing-new-address-form .fields:nth-child(2)').css('margin-bottom', 0);
76
+ });
77
+ // updating cart quantity using ajax
78
+ var productUpdateCartForm = new VarienForm('product_updatecart_form');
79
+ productUpdateCartForm.submit = function(button, url) {
80
+ if (this.validator.validate()) {
81
+ var form = this.form;
82
+ var oldUrl = form.action;
83
+
84
+ if (url) {
85
+ form.action = url;
86
+ }
87
+ var e = null;
88
+ //Start of our new ajax code
89
+ if (!url) {
90
+ url = jQuery('#product_updatecart_form').attr('action');
91
+ }
92
+ var data = jQuery('#product_updatecart_form').serialize();
93
+ data += '&isAjax=1';
94
+ try {
95
+ jQuery('.grand-total-loader').show();
96
+ jQuery('#shopping-cart-totals-table').hide();
97
+ jQuery.ajax({
98
+ url: url,
99
+ dataType: 'json',
100
+ type: 'post',
101
+ data: data,
102
+ complete: function() {
103
+ reloadCartPage();
104
+ reloadShippingMethod();
105
+ updateGrandTotal();
106
+ }
107
+ });
108
+ } catch (e) {
109
+ }
110
+ //End of our new ajax code
111
+ this.form.action = oldUrl;
112
+ if (e) {
113
+ throw e;
114
+ }
115
+ }
116
+ }.bind(productUpdateCartForm);
117
+
118
+ // function to refresh cart using ajax
119
+ function reloadCartPage() {
120
+
121
+ var data = 'isAjax=' + 1;
122
+ jQuery.ajax({
123
+ url: "<?php $this->getUrl('occheckout/index/updatecart') ?>",
124
+ type: 'post',
125
+ data: data,
126
+ success: function(data) {
127
+ var val = jQuery(data).find('.cart-items-details');
128
+ jQuery('.cart-data').html(val);
129
+ updateGrandTotal();
130
+ },
131
+ });
132
+ }
133
+ // function to refresh grand total using ajax
134
+ function updateGrandTotal() {
135
+ var data = 'isAjax=' + 1;
136
+ jQuery.ajax({
137
+ url: "<?php $this->getUrl('occheckout/index/updategrandtotal') ?>",
138
+ type: 'post',
139
+ data: data,
140
+ success: function(data) {
141
+ jQuery('.grand-total-loader').hide();
142
+ jQuery('#shopping-cart-totals-table').show();
143
+ var val = jQuery(data).find('#shopping-cart-totals-table');
144
+ jQuery('.grand-total-refresh').html(val);
145
+ },
146
+ });
147
+ }
148
+ </script>
app/design/frontend/base/default/template/occheckout/onepage/billing.phtml ADDED
@@ -0,0 +1,266 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <form id="co-billing-form" action="">
28
+ <fieldset>
29
+ <ul class="form-list">
30
+ <?php if ($this->customerHasAddresses()): ?>
31
+ <li class="wide">
32
+ <label for="billing-address-select"><?php echo $this->__('Select a billing address.') ?></label>
33
+ <div class="input-box">
34
+ <?php echo $this->getAddressesHtmlSelect('billing') ?>
35
+ </div>
36
+ </li>
37
+ <?php else: ?>
38
+ <li class="wide">
39
+ <label for="billing-address-select"><?php echo $this->__('Billing Information.') ?></label>
40
+ </li>
41
+ <?php endif; ?>
42
+ <li class="custom-billing-form" id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?>>
43
+ <fieldset>
44
+ <input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
45
+ <ul>
46
+ <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>
47
+ <li class="fields">
48
+ <div class="field">
49
+ <label for="billing:company"><?php echo $this->__('Company') ?></label>
50
+ <div class="input-box">
51
+ <input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
52
+ </div>
53
+ </div>
54
+ <?php if (!$this->isCustomerLoggedIn()): ?>
55
+ <div class="field">
56
+ <label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
57
+ <div class="input-box">
58
+ <input type="text" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
59
+ </div>
60
+ </div>
61
+ <?php endif; ?>
62
+ </li>
63
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
64
+ <li class="wide">
65
+ <label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
66
+ <div class="input-box">
67
+ <input type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
68
+ </div>
69
+ </li>
70
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
71
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
72
+ <li class="wide">
73
+ <div class="input-box">
74
+ <input type="text" title="<?php echo $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 ?>" />
75
+ </div>
76
+ </li>
77
+ <?php endfor; ?>
78
+ <?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
79
+ <li class="wide">
80
+ <label for="billing:vat_id"><?php echo $this->__('VAT Number') ?></label>
81
+ <div class="input-box">
82
+ <input type="text" id="billing:vat_id" name="billing[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" title="<?php echo $this->__('VAT Number') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
83
+ </div>
84
+ </li>
85
+ <?php endif; ?>
86
+ <li class="fields">
87
+ <div class="field">
88
+ <label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
89
+ <div class="input-box">
90
+ <input type="text" title="<?php echo $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" />
91
+ </div>
92
+ </div>
93
+ <div class="field">
94
+ <label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
95
+ <div class="input-box">
96
+ <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
97
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
98
+ </select>
99
+ <script type="text/javascript">
100
+ //<![CDATA[
101
+ $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
102
+ //]]>
103
+ </script>
104
+ <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
105
+ </div>
106
+ </div>
107
+ </li>
108
+ <li class="fields">
109
+ <div class="field">
110
+ <label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
111
+ <div class="input-box">
112
+ <input type="text" title="<?php echo $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') ?>" />
113
+ </div>
114
+ </div>
115
+ <div class="field">
116
+ <label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
117
+ <div class="input-box">
118
+ <?php echo $this->getCountryHtmlSelect('billing') ?>
119
+ </div>
120
+ </div>
121
+ </li>
122
+ <li class="fields">
123
+ <div class="field">
124
+ <label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
125
+ <div class="input-box">
126
+ <input type="text" name="billing[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="billing:telephone" />
127
+ </div>
128
+ </div>
129
+ <div class="field">
130
+ <label for="billing:fax"><?php echo $this->__('Fax') ?></label>
131
+ <div class="input-box">
132
+ <input type="text" name="billing[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="billing:fax" />
133
+ </div>
134
+ </div>
135
+ </li>
136
+ <?php if (!$this->isCustomerLoggedIn()): ?>
137
+
138
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
139
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
140
+ <?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
141
+ <li class="fields">
142
+ <?php if ($_dob->isEnabled()): ?>
143
+ <div class="field">
144
+ <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
145
+ </div>
146
+ <?php endif; ?>
147
+ <?php if ($_gender->isEnabled()): ?>
148
+ <div class="field">
149
+ <?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
150
+ </div>
151
+ <?php endif ?>
152
+ </li>
153
+ <?php endif ?>
154
+
155
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
156
+ <?php if ($_taxvat->isEnabled()): ?>
157
+ <li>
158
+ <?php echo $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
159
+ </li>
160
+ <?php endif ?>
161
+
162
+ <li class="fields" id="register-customer-password">
163
+ <div class="field">
164
+ <label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
165
+ <div class="input-box">
166
+ <input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
167
+ </div>
168
+ </div>
169
+ <div class="field">
170
+ <label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
171
+ <div class="input-box">
172
+ <input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
173
+ </div>
174
+ </div>
175
+ </li>
176
+ <?php endif; ?>
177
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()): ?>
178
+ <li class="control">
179
+ <input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="billing:save_in_address_book" <?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>
180
+ </li>
181
+ <?php else: ?>
182
+ <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
183
+ <?php endif; ?>
184
+ <?php /* Extensions placeholder */ ?>
185
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
186
+ <?php if ($this->canShip()): ?>
187
+ <li class="control">
188
+ <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->__('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>
189
+ <li class="control">
190
+ <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->__('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>
191
+ </li>
192
+ <?php endif; ?>
193
+ </ul>
194
+ </fieldset>
195
+ <?php if (!$this->canShip()): ?>
196
+ <input type="hidden" name="billing[use_for_shipping]" value="1" />
197
+ <?php endif; ?>
198
+ <div class="" id="billing-buttons-container">
199
+ <button type="button" title="<?php echo $this->__('Save') ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Save') ?></span></span></button>
200
+ </div>
201
+ <span class="save-success" id="billing-new-add-save"></span>
202
+ </li>
203
+ <?php /* Extensions placeholder */ ?>
204
+ </ul>
205
+ </fieldset>
206
+ </form>
207
+ <script type="text/javascript">
208
+
209
+ var billing = new VarienForm('co-billing-form');
210
+ billing.save = function() {
211
+ if (billing.validator.validate()) {
212
+ jQuery('.ajax-loader').show();
213
+ var baseUrl = "<?php echo Mage::getBaseUrl(); ?>";
214
+ var data = jQuery('#co-billing-form').serialize();
215
+ jQuery.ajax({
216
+ type: "POST",
217
+ dataType: "JSON",
218
+ data: data,
219
+ url: baseUrl + "occheckout/oneclick/saveBilling",
220
+ complete: function() {
221
+ reloadPaymentMethod();
222
+ },
223
+ success: function(response) {
224
+ if (response.new_address) {
225
+ jQuery('#billing-new-add-save').html(response.new_address);
226
+ }
227
+ reloadShippingMethod();
228
+ },
229
+ });
230
+ }
231
+ }
232
+
233
+ // ajax call to reload payment action
234
+ function reloadPaymentMethod() {
235
+ jQuery.ajax({
236
+ url: "<?php $this->getUrl('occheckout/oneclick/reloadPaymentMethod'); ?>",
237
+ type: 'post',
238
+ success: function(data) {
239
+ var val = jQuery(data).find('#checkout-payment-method-load');
240
+ jQuery('#co-payment-form').find('#checkout-payment-method-load').replaceWith(val);
241
+ jQuery('.ajax-loader').hide();
242
+ },
243
+ });
244
+ }
245
+ // saving billing address on change event
246
+ jQuery(document).ready(function() {
247
+ jQuery('#billing-address-select').change(function() {
248
+ var address_id = jQuery("#billing-address-select").val();
249
+
250
+ if (address_id !== '') {
251
+ billing.save();
252
+ }
253
+ if (address_id === '') {
254
+ jQuery('#billing-new-address-form').show();
255
+ } else {
256
+ jQuery('#billing-new-address-form').hide();
257
+ }
258
+ });
259
+ var billing_id = jQuery("#billing-address-select").val();
260
+ if (typeof billing_id !== "undefined" && billing_id !== '') {
261
+ billing.save();
262
+ }
263
+
264
+ });
265
+ var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'billing:postcode');
266
+ </script>
app/design/frontend/base/default/template/occheckout/onepage/payment.phtml ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <script type="text/javascript">
28
+ //<![CDATA[
29
+ var quoteBaseGrandTotal = <?php echo (float) $this->getQuoteBaseGrandTotal(); ?>;
30
+ var checkQuoteBaseGrandTotal = quoteBaseGrandTotal;
31
+ var payment = new Payment('co-payment-form', '<?php echo $this->getUrl('occheckout/oneclick/savePayment') ?>');
32
+ var lastPrice;
33
+ //]]>
34
+ </script>
35
+ <form action="" id="co-payment-form">
36
+ <fieldset>
37
+ <?php echo $this->getChildHtml('methods') ?>
38
+ </fieldset>
39
+ </form>
40
+ <div class="tool-tip" id="payment-tool-tip" style="display:none;">
41
+ <div class="tool-tip-content"><img src="<?php echo $this->getSkinUrl('images/cvv.gif') ?>" alt="<?php echo $this->__('Card Verification Number Visual Reference') ?>" title="<?php echo $this->__('Card Verification Number Visual Reference') ?>" /></div>
42
+ </div>
43
+ <div class="grand-total" style="float: right">
44
+ <div class="grand-total-loader" style="display: none">
45
+ <img src="<?php echo $this->getSkinUrl('images/ajax-loader.gif'); ?>" alt="loader"/>
46
+ </div>
47
+ <h3><?php echo $this->__('Grand Total') ?></h3>
48
+ <div class="grand-total grand-total-refresh">
49
+ <?php echo $this->getChildHtml('totals'); ?>
50
+ </div>
51
+ </div>
52
+ <div class="buttons-set" id="payment-buttons-container">
53
+ <button type="button" class="button btn-proceed-checkout btn-checkout" onclick="payment.save()"><span><span><?php echo $this->__('Place Order') ?></span></span></button>
54
+ </div>
55
+ <script type="text/javascript">
56
+ //<![CDATA[
57
+ function toggleToolTip(event) {
58
+ if ($('payment-tool-tip')) {
59
+ $('payment-tool-tip').setStyle({
60
+ top: (Event.pointerY(event) - 560) + 'px'//,
61
+ })
62
+ $('payment-tool-tip').toggle();
63
+ }
64
+ Event.stop(event);
65
+ }
66
+ if ($('payment-tool-tip-close')) {
67
+ Event.observe($('payment-tool-tip-close'), 'click', toggleToolTip);
68
+ }
69
+ //]]>
70
+ </script>
71
+ <script type="text/javascript">
72
+ //<![CDATA[
73
+ payment.save = function() {
74
+ jQuery('.ajax-loader').show();
75
+ var billForm = new VarienForm('co-billing-form');
76
+ var shipForm = new VarienForm('co-shipping-form');
77
+ var paymentForm = new VarienForm('co-payment-form');
78
+ var paymentForm = new VarienForm('co-shipping-method-form');
79
+ var productUpdateCartForm = new VarienForm('product_updatecart_form');
80
+
81
+ var baseUrl = "<?php echo Mage::getBaseUrl(); ?>";
82
+ var data = jQuery('#co-payment-form').serialize();
83
+ jQuery.ajax({
84
+ type: "POST",
85
+ dataType: "JSON",
86
+ data: data,
87
+ url: baseUrl + "occheckout/oneclick/savePayment",
88
+ complete: function() {
89
+ jQuery.ajax({
90
+ type: "POST",
91
+ dataType: "JSON",
92
+ data: data,
93
+ url: baseUrl + "occheckout/oneclick/saveOrder",
94
+ success: function(result) {
95
+ if (!result.error_messages) {
96
+ parent.location.href = baseUrl + "occheckout/oneclick/success";
97
+ }
98
+ if (result.error_messages) {
99
+ jQuery('.ajax-loader').hide();
100
+ alert(result.error_messages);
101
+ }
102
+ },
103
+ });
104
+ },
105
+ });
106
+ }
107
+
108
+ //]]>
109
+
110
+ //<![CDATA[
111
+ payment.currentMethod = "<?php echo $this->getChild('methods')->getSelectedMethodCode() ?>";
112
+ //]]>
113
+ </script>
app/design/frontend/base/default/template/occheckout/onepage/payment/methods.phtml ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * One page checkout payment methods
30
+ *
31
+ * @see Mage_Checkout_Block_Onepage_Payment_Methods
32
+ */
33
+ ?>
34
+ <dl class="sp-methods manual-payment-method" id="checkout-payment-method-load">
35
+ <?php
36
+ $methods = $this->getMethods();
37
+ $oneMethod = count($methods) <= 1;
38
+ ?>
39
+ <?php
40
+ foreach ($methods as $_method):
41
+ $_code = $_method->getCode();
42
+ ?>
43
+ <dt>
44
+ <?php if (!$oneMethod): ?>
45
+ <input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" title="<?php echo $this->htmlEscape($_method->getTitle()) ?>" onclick="payment.switchMethod('<?php echo $_code ?>')"<?php if ($this->getSelectedMethodCode() == $_code): ?> checked="checked"<?php endif; ?> class="radio" />
46
+ <?php else: ?>
47
+ <span class="no-display"><input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" checked="checked" class="radio" /></span>
48
+ <?php $oneMethod = $_code; ?>
49
+ <?php endif; ?>
50
+ <label for="p_method_<?php echo $_code ?>"><?php echo $this->escapeHtml($this->getMethodTitle($_method)) ?> <?php echo $this->getMethodLabelAfterHtml($_method) ?></label>
51
+ </dt>
52
+ <?php if ($html = $this->getPaymentMethodFormHtml($_method)): ?>
53
+ <dd>
54
+ <?php echo $html; ?>
55
+ </dd>
56
+ <?php endif; ?>
57
+ <?php endforeach; ?>
58
+ </dl>
59
+ <?php echo $this->getChildChildHtml('additional'); ?>
60
+
61
+
62
+ <script type="text/javascript">
63
+
64
+ </script>
65
+
66
+ <script type="text/javascript">
67
+ //<![CDATA[
68
+ <?php echo $this->getChildChildHtml('scripts'); ?>
69
+ payment.init();
70
+ <?php if (is_string($oneMethod)): ?>
71
+ payment.switchMethod('<?php echo $oneMethod ?>');
72
+ <?php endif; ?>
73
+ //]]>
74
+ </script>
app/design/frontend/base/default/template/occheckout/onepage/shipping.phtml ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <form action="" id="co-shipping-form">
28
+ <ul class="form-list">
29
+ <?php if ($this->customerHasAddresses()): ?>
30
+ <li class="wide">
31
+ <label for="shipping-address-select"><?php echo $this->__('Select a shipping address.') ?></label>
32
+ <div class="input-box">
33
+ <?php echo $this->getAddressesHtmlSelect('shipping') ?>
34
+ </div>
35
+ </li>
36
+ <?php else: ?>
37
+ <li class="wide">
38
+ <label for="shipping-address-select"><?php echo $this->__('Shipping Information.') ?></label>
39
+ </li>
40
+ <?php endif ?>
41
+ <li class="manual-shipping-show" id="shipping-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif ?>>
42
+ <fieldset>
43
+ <input type="hidden" name="shipping[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="shipping:address_id" />
44
+ <ul>
45
+ <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress())->setFieldIdFormat('shipping:%s')->setFieldNameFormat('shipping[%s]')->toHtml() ?></li>
46
+ <li class="fields">
47
+ <div class="fields">
48
+ <label for="shipping:company"><?php echo $this->__('Company') ?></label>
49
+ <div class="input-box">
50
+ <input type="text" id="shipping:company" name="shipping[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
51
+ </div>
52
+ </div>
53
+ </li>
54
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
55
+ <li class="wide">
56
+ <label for="shipping:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
57
+ <div class="input-box">
58
+ <input type="text" title="<?php echo $this->__('Street Address') ?>" name="shipping[street][]" id="shipping:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>"/>
59
+ </div>
60
+ </li>
61
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
62
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
63
+ <li class="wide">
64
+ <div class="input-box">
65
+ <input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="shipping[street][]" id="shipping:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>"/>
66
+ </div>
67
+ </li>
68
+ <?php endfor; ?>
69
+ <?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
70
+ <li class="wide">
71
+ <label for="billing:vat_id"><?php echo $this->__('VAT Number'); ?></label>
72
+ <div class="input-box">
73
+ <input type="text" id="shipping:vat_id" name="shipping[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()); ?>" title="<?php echo $this->__('VAT Number'); ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
74
+ </div>
75
+ </li>
76
+ <?php endif; ?>
77
+ <li class="fields">
78
+ <div class="field">
79
+ <label for="shipping:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
80
+ <div class="input-box">
81
+ <input type="text" title="<?php echo $this->__('City') ?>" name="shipping[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="shipping:city"/>
82
+ </div>
83
+ </div>
84
+ <div class="field">
85
+ <label for="shipping:region" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
86
+ <div class="input-box">
87
+ <select id="shipping:region_id" name="shipping[region_id]" title="<?php echo $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
+ $('shipping:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
93
+ //]]>
94
+ </script>
95
+ <input type="text" id="shipping:region" name="shipping[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $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="shipping:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
102
+ <div class="input-box">
103
+ <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="shipping[postcode]" id="shipping:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" 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="shipping:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
108
+ <div class="input-box">
109
+ <?php echo $this->getCountryHtmlSelect('shipping') ?>
110
+ </div>
111
+ </div>
112
+ </li>
113
+ <li class="fields">
114
+ <div class="field">
115
+ <label for="shipping:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
116
+ <div class="input-box">
117
+ <input type="text" name="shipping[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="shipping:telephone" />
118
+ </div>
119
+ </div>
120
+ <div class="field">
121
+ <label for="shipping:fax"><?php echo $this->__('Fax') ?></label>
122
+ <div class="input-box">
123
+ <input type="text" name="shipping[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="shipping:fax"/>
124
+ </div>
125
+ </div>
126
+ </li>
127
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()): ?>
128
+ <li class="control">
129
+ <input type="checkbox" name="shipping[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="shipping:save_in_address_book" <?php if ($this->getAddress()->getSaveInAddressBook()): ?> checked="checked"<?php endif; ?> class="checkbox" /><label for="shipping:save_in_address_book"><?php echo $this->__('Save in address book') ?></label></li>
130
+ <?php else: ?>
131
+ <li class="no-display"><input type="hidden" name="shipping[save_in_address_book]" value="1" /></li>
132
+ <?php endif; ?>
133
+ <li class="control">
134
+ <input type="hidden" name="shipping[same_as_billing]" id="shipping:same_as_billing" value="1"<?php if ($this->getAddress()->getSameAsBilling()): ?> checked="checked"<?php endif; ?> title="<?php echo $this->__('Use Billing Address') ?>" class="checkbox" />
135
+ </li>
136
+ </ul>
137
+ </fieldset>
138
+ <div class="" id="shipping-buttons-container">
139
+ <button type="button" class="button" title="<?php echo $this->__('Save') ?>" onclick="shipping.save()"><span><span><?php echo $this->__('Save') ?></span></span></button>
140
+ </div>
141
+ <span class="save-success" id="shipping-new-add-save"></span>
142
+ </li>
143
+ </ul>
144
+ </form>
145
+ <script type="text/javascript">
146
+ var shipping = new VarienForm('co-shipping-form');
147
+ shipping.save = function() {
148
+ if (shipping.validator.validate()) {
149
+ jQuery('.ajax-loader').show();
150
+ var baseUrl = "<?php echo Mage::getBaseUrl(); ?>";
151
+ var data = jQuery('#co-shipping-form').serialize();
152
+ jQuery.ajax({
153
+ type: "POST",
154
+ dataType: "JSON",
155
+ data: data,
156
+ url: baseUrl + "occheckout/oneclick/saveShipping",
157
+ complete: function() {
158
+ reloadShippingMethod();
159
+ saveShippingMethod();
160
+ },
161
+ success: function(response) {
162
+ if (response.new_address) {
163
+ jQuery('#shipping-new-add-save').html(response.new_address);
164
+ }
165
+ reloadShippingMethod();
166
+ saveShippingMethod();
167
+ },
168
+ });
169
+ }
170
+ }
171
+
172
+ //ajax call to reload shipping methods
173
+ function reloadShippingMethod() {
174
+ jQuery.ajax({
175
+ url: "<?php $this->getUrl('occheckout/oneclick/reloadSippingMethosAction') ?>",
176
+ type: 'post',
177
+ success: function(data) {
178
+ var val = jQuery(data).find('#shipping-methods-manual');
179
+ jQuery('#co-shipping-method-form').find('#shipping-methods-manual').replaceWith(val);
180
+ jQuery('.ajax-loader').hide();
181
+ },
182
+ });
183
+ }
184
+ // saving shipping address on change event
185
+ jQuery(document).ready(function() {
186
+ jQuery('#co-shipping-form').find('#shipping-address-select').change(function() {
187
+ var shipping_id = jQuery('#shipping-address-select').val();
188
+ if (shipping_id === '') {
189
+ jQuery('.manual-shipping-show').show();
190
+ } else {
191
+ jQuery('.manual-shipping-show').hide();
192
+ shipping.save();
193
+ }
194
+ });
195
+ var shipping_id = jQuery('#shipping-address-select').val();
196
+ if (typeof shipping_id !== "undefined" && shipping_id !== '') {
197
+ shipping.save();
198
+ }
199
+ });
200
+ var shippingRegionUpdater = new RegionUpdater('shipping:country_id', 'shipping:region', 'shipping:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'shipping:postcode');
201
+
202
+ </script>
app/design/frontend/base/default/template/occheckout/onepage/shipping_method.phtml ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <form id="co-shipping-method-form" action="">
28
+ <div id="checkout-shipping-method-load">
29
+ <?php echo $this->getChildHtml('available') ?>
30
+ </div>
31
+ <script type="text/javascript">
32
+ //<![CDATA[
33
+ var shippingMethod = new ShippingMethod('co-shipping-method-form', "<?php echo $this->getUrl('checkout/onepage/saveShippingMethod') ?>");
34
+ //]]>
35
+ </script>
36
+ </form>
37
+ <script type="text/javascript">
38
+
39
+ var shippingMethod = new VarienForm('co-shipping-method-form');
40
+ shippingMethod.save = function() {
41
+ jQuery('.grand-total-loader').show();
42
+ jQuery('#shopping-cart-totals-table').hide();
43
+ var baseUrl = "<?php echo Mage::getBaseUrl(); ?>";
44
+ var data = jQuery('#co-shipping-method-form').serialize();
45
+ jQuery.ajax({
46
+ type: "POST",
47
+ dataType: "JSON",
48
+ data: data,
49
+ url: baseUrl + "occheckout/oneclick/saveShippingMethod",
50
+ complete: function() {
51
+ reloadPaymentMethod();
52
+ updateGrandTotal();
53
+ },
54
+ });
55
+ }
56
+ var listItems = jQuery("#shipping-methods-manual").find('li');
57
+ var count = listItems.length;
58
+ if(count == 1){
59
+ shippingMethod.save();
60
+ }
61
+
62
+ function saveShippingMethod(){
63
+ shippingMethod.save();
64
+ }
65
+ </script>
app/design/frontend/base/default/template/occheckout/onepage/shipping_method/additional.phtml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php if (!$this->getQuote()->isVirtual()): ?>
28
+ <?php echo $this->helper('giftmessage/message')->getInline('onepage_checkout', $this->getQuote(), $this->getDontDisplayContainer()) ?>
29
+ <?php endif; ?>
app/design/frontend/base/default/template/occheckout/onepage/shipping_method/available.phtml ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php /** @var $this Mage_Checkout_Block_Onepage_Shipping_Method_Available */ ?>
28
+ <?php $_shippingRateGroups = $this->getShippingRates(); ?>
29
+ <dl class="sp-methods" id="shipping-methods-manual">
30
+ <?php if (!$_shippingRateGroups): ?>
31
+ <p><?php echo $this->__('Sorry, no quotes are available for this order at this time.') ?></p>
32
+ <?php else: ?>
33
+ <?php $shippingCodePrice = array(); ?>
34
+ <?php
35
+ $_sole = count($_shippingRateGroups) == 1;
36
+ foreach ($_shippingRateGroups as $code => $_rates):
37
+ ?>
38
+ <dt><?php echo $this->escapeHtml($this->getCarrierName($code)) ?></dt>
39
+ <dd>
40
+ <ul>
41
+ <?php
42
+ $_sole = $_sole && count($_rates) == 1;
43
+ foreach ($_rates as $_rate):
44
+ ?>
45
+ <?php $shippingCodePrice[] = "'" . $_rate->getCode() . "':" . (float) $_rate->getPrice(); ?>
46
+ <li>
47
+ <?php if ($_rate->getErrorMessage()): ?>
48
+ <ul class="messages"><li class="error-msg"><ul><li><?php echo $this->escapeHtml($_rate->getErrorMessage()) ?></li></ul></li></ul>
49
+ <?php else: ?>
50
+ <input name="shipping_method" onclick="shippingMethod.save()" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if ($_rate->getCode() === $this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio"/>
51
+ <?php if ($_rate->getCode() === $this->getAddressShippingMethod()): ?>
52
+ <script type="text/javascript">
53
+ //<![CDATA[
54
+ lastPrice = <?php echo (float) $_rate->getPrice(); ?>;
55
+ //]]>
56
+ </script>
57
+ <?php endif; ?>
58
+ <?php endif; ?>
59
+ <label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $this->escapeHtml($_rate->getMethodTitle()) ?>
60
+ <?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
61
+ <?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
62
+ <?php echo $_excl; ?>
63
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
64
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
65
+ <?php endif; ?>
66
+ </label>
67
+ </li>
68
+ <?php endforeach; ?>
69
+ </ul>
70
+ </dd>
71
+ <?php endforeach; ?>
72
+ </dl>
73
+ <script type="text/javascript">
74
+ //<![CDATA[
75
+ <?php if (!empty($shippingCodePrice)): ?>
76
+ var shippingCodePrice = {<?php echo implode(',', $shippingCodePrice); ?>};
77
+ <?php endif; ?>
78
+
79
+ $$('input[type="radio"][name="shipping_method"]').each(function(el) {
80
+ Event.observe(el, 'click', function() {
81
+ if (el.checked == true) {
82
+ var getShippingCode = el.getValue();
83
+ <?php if (!empty($shippingCodePrice)): ?>
84
+ var newPrice = shippingCodePrice[getShippingCode];
85
+ if (!lastPrice) {
86
+ lastPrice = newPrice;
87
+ quoteBaseGrandTotal += newPrice;
88
+ }
89
+ if (newPrice != lastPrice) {
90
+ quoteBaseGrandTotal += (newPrice - lastPrice);
91
+ lastPrice = newPrice;
92
+ }
93
+ <?php endif; ?>
94
+ checkQuoteBaseGrandTotal = quoteBaseGrandTotal;
95
+ return false;
96
+ }
97
+ });
98
+ });
99
+ //]]>
100
+ </script>
101
+ <?php endif; ?>
app/design/frontend/base/default/template/occheckout/success.phtml ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <div class="page-title">
28
+ <h1><?php echo $this->__('Your order has been received.') ?></h1>
29
+ </div>
30
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
31
+ <h2 class="sub-title"><?php echo $this->__('Thank you for your purchase!') ?></h2>
32
+
33
+ <?php if ($this->getOrderId()):?>
34
+ <?php if ($this->getCanViewOrder()) :?>
35
+ <p><?php echo $this->__('Your order # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getViewOrderUrl()), $this->escapeHtml($this->getOrderId()))) ?></p>
36
+ <?php else :?>
37
+ <p><?php echo $this->__('Your order # is: %s.', $this->escapeHtml($this->getOrderId())) ?></p>
38
+ <?php endif;?>
39
+ <p><?php echo $this->__('You will receive an order confirmation email with details of your order and a link to track its progress.') ?></p>
40
+ <?php if ($this->getCanViewOrder() && $this->getCanPrintOrder()) :?>
41
+ <p>
42
+ <?php echo $this->__('Click <a href="%s" onclick="this.target=\'_blank\'">here to print</a> a copy of your order confirmation.', $this->getPrintUrl()) ?>
43
+ <?php echo $this->getChildHtml() ?>
44
+ </p>
45
+ <?php endif;?>
46
+ <?php endif;?>
47
+
48
+ <?php if ($this->getAgreementRefId()): ?>
49
+ <p><?php echo $this->__('Your billing agreement # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getAgreementUrl()), $this->escapeHtml($this->getAgreementRefId())))?></p>
50
+ <?php endif;?>
51
+
52
+ <?php if ($profiles = $this->getRecurringProfiles()):?>
53
+ <p><?php echo $this->__('Your recurring payment profiles:'); ?></p>
54
+ <ul class="disc">
55
+ <?php foreach($profiles as $profile):?>
56
+ <?php $profileIdHtml = ($this->getCanViewProfiles() ? sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getProfileUrl($profile)), $this->escapeHtml($this->getObjectData($profile, 'reference_id'))) : $this->escapeHtml($this->getObjectData($profile, 'reference_id')));?>
57
+ <li><?php echo $this->__('Payment profile # %s: "%s".', $profileIdHtml, $this->escapeHtml($this->getObjectData($profile, 'schedule_description')))?></li>
58
+ <?php endforeach;?>
59
+ </ul>
60
+ <?php endif;?>
61
+
62
+ <div class="buttons-set">
63
+ <button type="button" class="button cnt-shopping" title="<?php echo $this->__('Continue Shopping') ?>" onclick="continueShopping();"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
64
+ </div>
65
+ <script type="text/javascript">
66
+ jQuery('.cnt-shopping').click(function(){
67
+ parent.location.href='<?php echo $this->getUrl() ?>'
68
+ });
69
+ </script>
app/design/frontend/base/default/template/occheckout/updatecart.phtml ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_coreHelper = $this->helper('core'); ?>
2
+ <div class='cart-items-details'>
3
+ <div class="show-cart-items">
4
+ <fieldset>
5
+ <table border="1" cellspacing="5" width='100%' class="data-table cart-table octable">
6
+ <colgroup>
7
+ <col>
8
+ <col width="1">
9
+ <col width="1">
10
+ <col width="1">
11
+ <col width="1">
12
+ </colgroup>
13
+ <thead>
14
+ <tr class="first last">
15
+ <th class="a-center" rowspan="1"><?php echo $this->__('Product Name') ?></th>
16
+ <th class="a-center" rowspan="1"><?php echo $this->__('Price') ?></th>
17
+ <th class="a-center" rowspan="1"><?php echo $this->__('Qty') ?></th>
18
+ <th class="a-center" rowspan="1"><?php echo $this->__('Subtotal') ?></th>
19
+ <th colspan="1"></th>
20
+ </tr>
21
+ </thead>
22
+ <tbody>
23
+ <?php
24
+ $session = Mage::getSingleton('checkout/session');
25
+ $productIds = $this->removeConfigurableProduct();
26
+ $parentId = array();
27
+ foreach ($session->getQuote()->getAllItems() as $item) :
28
+ $parentId = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($item->getProduct()->getId());
29
+ if ($parentId) {
30
+ continue;
31
+ }
32
+ ?>
33
+ <tr class="product-listing-cart">
34
+ <td class="a-left"><?php
35
+ echo $item->getName() . '<br>';
36
+ // Check for options
37
+ $options = $item->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct());
38
+ if ($options) {
39
+ if (!empty($options['options'])) {
40
+ foreach ($options['options'] as $option) {
41
+ ?>
42
+ <dl class="item-options">
43
+ <dt><?php echo $option['label']; ?></dt>
44
+ <dd><?php echo $option['value']; ?></dd>
45
+ </dl>
46
+ <?php
47
+ }
48
+ }
49
+ if (!empty($options['attributes_info'])) {
50
+ foreach ($options['attributes_info'] as $attributes_info) {
51
+ ?>
52
+ <dl class="item-options">
53
+ <dt><?php echo $attributes_info['label']; ?></dt>
54
+ <dd><?php echo $attributes_info['value']; ?></dd>
55
+ </dl>
56
+ <?php
57
+ }
58
+ }
59
+ if (!empty($options['additional_options'])) {
60
+ foreach ($options['additional_options'] as $additional_options) {
61
+
62
+ }
63
+ }
64
+ }
65
+ ?>
66
+ </td>
67
+ <td class="a-center"><?php echo $_coreHelper->currency($item->getPrice()); ?></td>
68
+ <td class="a-center">
69
+ <input class="a-center" name="cart[<?php echo $item->getId() ?>][qty]" value="<?php echo $item->getQty() ?>" size="4" title="<?php echo $this->__('Qty') ?>" class="input-text qty" maxlength="12" />
70
+ </td>
71
+ <td class="a-center"><?php
72
+ $total = $item->getQty() * $item->getPrice();
73
+ echo $_coreHelper->currency($total);
74
+ ?>
75
+ </td>
76
+ <td class="last">
77
+ <button type="button" class="btn-remove btn-remove2" id="prdt-value" value="<?php echo $item->getId() ?>" title="<?php echo $this->__('Del') ?>" class="button" onclick="product.delete(this)"></button>
78
+ </td>
79
+ </tr>
80
+ <?php endforeach;
81
+ ?>
82
+ </tbody>
83
+ </table>
84
+ </fieldset>
85
+ </div>
86
+ </div>
87
+
88
+ <script type="text/javascript">
89
+ var product = Class.create();
90
+ product.delete = function(obj) {
91
+ var id = jQuery(obj).val();
92
+ var data = 'isAjax=' + 1;
93
+ jQuery('.ajax-loader').show();
94
+ var baseUrl = '<?php echo $this->getUrl('occheckout/cart/delete') ?>';
95
+ jQuery.ajax({
96
+ type: "POST",
97
+ dataType: "JSON",
98
+ data: data,
99
+ url: baseUrl + '?id=' + id,
100
+ complete: function() {
101
+ reloadShippingMethod();
102
+ reloadCartPage();
103
+ jQuery('.ajax-loader').hide();
104
+ },
105
+ success: function() {
106
+ }
107
+ });
108
+ }
109
+
110
+
111
+ // function to refresh cart using ajax
112
+
113
+ jQuery(document).ajaxComplete(function() {
114
+ jQuery('.octable tbody tr:even').addClass('even');
115
+ jQuery('.octable tbody tr:odd').addClass('odd');
116
+ jQuery('.octable tbody tr:first').addClass('first');
117
+ jQuery('.octable tbody tr:last-child').addClass('last');
118
+ jQuery('#ccsave_expiration_yr').parent().addClass('v-right');
119
+ });
120
+ function reloadCartPage() {
121
+ var data = 'isAjax=' + 1;
122
+ jQuery.ajax({
123
+ url: "<?php $this->getUrl('occheckout/index/updatecart') ?>",
124
+ type: 'post',
125
+ data: data,
126
+ success: function(data) {
127
+ var val = jQuery(data).find('.cart-items-details');
128
+ jQuery('.cart-data').html(val);
129
+ updateGrandTotal();
130
+ var cart_item_count = jQuery('.product-listing-cart').length;
131
+ if (cart_item_count === 0) {
132
+ parent.location.href = "<?php echo Mage::getUrl('checkout/cart/') ?>";
133
+ }
134
+ }
135
+ });
136
+ }
137
+ function updateGrandTotal() {
138
+ var data = 'isAjax=' + 1;
139
+ jQuery.ajax({
140
+ url: "<?php $this->getUrl('occheckout/index/updategrandtotal') ?>",
141
+ type: 'post',
142
+ data: data,
143
+ success: function(data) {
144
+ jQuery('.grand-total-loader').hide();
145
+ jQuery('#shopping-cart-totals-table').show();
146
+ var val = jQuery(data).find('#shopping-cart-totals-table');
147
+ jQuery('.grand-total-refresh').html(val);
148
+ }
149
+ });
150
+ }
151
+
152
+ document.observe('dom:loaded', function() {
153
+ var cart_item_count = jQuery('.product-listing-cart').length;
154
+ if (cart_item_count === 0) {
155
+ parent.location.href = "<?php echo Mage::getUrl('checkout/cart/') ?>";
156
+ }
157
+ });
158
+
159
+
160
+ </script>
app/etc/modules/Uni_Occheckout.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Uni_Occheckout>
5
+ <active>1</active>
6
+ <codePool>community</codePool>
7
+ <version>1.0.1</version>
8
+ </Uni_Occheckout>
9
+ </modules>
10
+ </config>
js/jquery/jquery.colorbox-min.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ /*!
2
+ Colorbox 1.5.14
3
+ license: MIT
4
+ http://www.jacklmoore.com/colorbox
5
+ */
6
+ (function(t,e,i){function n(i,n,o){var r=e.createElement(i);return n&&(r.id=Z+n),o&&(r.style.cssText=o),t(r)}function o(){return i.innerHeight?i.innerHeight:t(i).height()}function r(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var n;return void 0===this.cache[e]&&(n=t(this.el).attr("data-cbox-"+e),void 0!==n?this.cache[e]=n:void 0!==i[e]?this.cache[e]=i[e]:void 0!==X[e]&&(this.cache[e]=X[e])),this.cache[e]},this.get=function(e){var i=this.value(e);return t.isFunction(i)?i.call(this.el,this):i}}function h(t){var e=W.length,i=(z+t)%e;return 0>i?e+i:i}function a(t,e){return Math.round((/%/.test(t)?("x"===e?E.width():o())/100:1)*parseInt(t,10))}function s(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function l(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function d(t){"contains"in y[0]&&!y[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),y.focus())}function c(t){c.str!==t&&(y.add(v).removeClass(c.str).addClass(t),c.str=t)}function g(e){z=0,e&&e!==!1&&"nofollow"!==e?(W=t("."+te).filter(function(){var i=t.data(this,Y),n=new r(this,i);return n.get("rel")===e}),z=W.index(_.el),-1===z&&(W=W.add(_.el),z=W.length-1)):W=t(_.el)}function u(i){t(e).trigger(i),ae.triggerHandler(i)}function f(i){var o;if(!G){if(o=t(i).data(Y),_=new r(i,o),g(_.get("rel")),!$){$=q=!0,c(_.get("className")),y.css({visibility:"hidden",display:"block",opacity:""}),L=n(se,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),b.css({width:"",height:""}).append(L),D=T.height()+k.height()+b.outerHeight(!0)-b.height(),j=C.width()+H.width()+b.outerWidth(!0)-b.width(),A=L.outerHeight(!0),N=L.outerWidth(!0);var h=a(_.get("initialWidth"),"x"),s=a(_.get("initialHeight"),"y"),l=_.get("maxWidth"),f=_.get("maxHeight");_.w=(l!==!1?Math.min(h,a(l,"x")):h)-N-j,_.h=(f!==!1?Math.min(s,a(f,"y")):s)-A-D,L.css({width:"",height:_.h}),J.position(),u(ee),_.get("onOpen"),O.add(F).hide(),y.focus(),_.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",d,!0),ae.one(re,function(){e.removeEventListener("focus",d,!0)})),_.get("returnFocus")&&ae.one(re,function(){t(_.el).focus()})}var p=parseFloat(_.get("opacity"));v.css({opacity:p===p?p:"",cursor:_.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),_.get("closeButton")?B.html(_.get("close")).appendTo(b):B.appendTo("<div/>"),w()}}function p(){y||(V=!1,E=t(i),y=n(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),v=n(se,"Overlay").hide(),S=t([n(se,"LoadingOverlay")[0],n(se,"LoadingGraphic")[0]]),x=n(se,"Wrapper"),b=n(se,"Content").append(F=n(se,"Title"),I=n(se,"Current"),P=t('<button type="button"/>').attr({id:Z+"Previous"}),K=t('<button type="button"/>').attr({id:Z+"Next"}),R=n("button","Slideshow"),S),B=t('<button type="button"/>').attr({id:Z+"Close"}),x.append(n(se).append(n(se,"TopLeft"),T=n(se,"TopCenter"),n(se,"TopRight")),n(se,!1,"clear:left").append(C=n(se,"MiddleLeft"),b,H=n(se,"MiddleRight")),n(se,!1,"clear:left").append(n(se,"BottomLeft"),k=n(se,"BottomCenter"),n(se,"BottomRight"))).find("div div").css({"float":"left"}),M=n(se,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),O=K.add(P).add(I).add(R)),e.body&&!y.parent().length&&t(e.body).append(v,y.append(x,M))}function m(){function i(t){t.which>1||t.shiftKey||t.altKey||t.metaKey||t.ctrlKey||(t.preventDefault(),f(this))}return y?(V||(V=!0,K.click(function(){J.next()}),P.click(function(){J.prev()}),B.click(function(){J.close()}),v.click(function(){_.get("overlayClose")&&J.close()}),t(e).bind("keydown."+Z,function(t){var e=t.keyCode;$&&_.get("escKey")&&27===e&&(t.preventDefault(),J.close()),$&&_.get("arrowKey")&&W[1]&&!t.altKey&&(37===e?(t.preventDefault(),P.click()):39===e&&(t.preventDefault(),K.click()))}),t.isFunction(t.fn.on)?t(e).on("click."+Z,"."+te,i):t("."+te).live("click."+Z,i)),!0):!1}function w(){var e,o,r,h=J.prep,d=++le;if(q=!0,U=!1,u(he),u(ie),_.get("onLoad"),_.h=_.get("height")?a(_.get("height"),"y")-A-D:_.get("innerHeight")&&a(_.get("innerHeight"),"y"),_.w=_.get("width")?a(_.get("width"),"x")-N-j:_.get("innerWidth")&&a(_.get("innerWidth"),"x"),_.mw=_.w,_.mh=_.h,_.get("maxWidth")&&(_.mw=a(_.get("maxWidth"),"x")-N-j,_.mw=_.w&&_.w<_.mw?_.w:_.mw),_.get("maxHeight")&&(_.mh=a(_.get("maxHeight"),"y")-A-D,_.mh=_.h&&_.h<_.mh?_.h:_.mh),e=_.get("href"),Q=setTimeout(function(){S.show()},100),_.get("inline")){var c=t(e);r=t("<div>").hide().insertBefore(c),ae.one(he,function(){r.replaceWith(c)}),h(c)}else _.get("iframe")?h(" "):_.get("html")?h(_.get("html")):s(_,e)?(e=l(_,e),U=new Image,t(U).addClass(Z+"Photo").bind("error",function(){h(n(se,"Error").html(_.get("imgError")))}).one("load",function(){d===le&&setTimeout(function(){var e;t.each(["alt","longdesc","aria-describedby"],function(e,i){var n=t(_.el).attr(i)||t(_.el).attr("data-"+i);n&&U.setAttribute(i,n)}),_.get("retinaImage")&&i.devicePixelRatio>1&&(U.height=U.height/i.devicePixelRatio,U.width=U.width/i.devicePixelRatio),_.get("scalePhotos")&&(o=function(){U.height-=U.height*e,U.width-=U.width*e},_.mw&&U.width>_.mw&&(e=(U.width-_.mw)/U.width,o()),_.mh&&U.height>_.mh&&(e=(U.height-_.mh)/U.height,o())),_.h&&(U.style.marginTop=Math.max(_.mh-U.height,0)/2+"px"),W[1]&&(_.get("loop")||W[z+1])&&(U.style.cursor="pointer",U.onclick=function(){J.next()}),U.style.width=U.width+"px",U.style.height=U.height+"px",h(U)},1)}),U.src=e):e&&M.load(e,_.get("data"),function(e,i){d===le&&h("error"===i?n(se,"Error").html(_.get("xhrError")):t(this).contents())})}var v,y,x,b,T,C,H,k,W,E,L,M,S,F,I,R,K,P,B,O,_,D,j,A,N,z,U,$,q,G,Q,J,V,X={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,opacity:.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,rel:function(){return this.rel},href:function(){return t(this).attr("href")},title:function(){return this.title}},Y="colorbox",Z="cbox",te=Z+"Element",ee=Z+"_open",ie=Z+"_load",ne=Z+"_complete",oe=Z+"_cleanup",re=Z+"_closed",he=Z+"_purge",ae=t("<a/>"),se="div",le=0,de={},ce=function(){function t(){clearTimeout(h)}function e(){(_.get("loop")||W[z+1])&&(t(),h=setTimeout(J.next,_.get("slideshowSpeed")))}function i(){R.html(_.get("slideshowStop")).unbind(s).one(s,n),ae.bind(ne,e).bind(ie,t),y.removeClass(a+"off").addClass(a+"on")}function n(){t(),ae.unbind(ne,e).unbind(ie,t),R.html(_.get("slideshowStart")).unbind(s).one(s,function(){J.next(),i()}),y.removeClass(a+"on").addClass(a+"off")}function o(){r=!1,R.hide(),t(),ae.unbind(ne,e).unbind(ie,t),y.removeClass(a+"off "+a+"on")}var r,h,a=Z+"Slideshow_",s="click."+Z;return function(){r?_.get("slideshow")||(ae.unbind(oe,o),o()):_.get("slideshow")&&W[1]&&(r=!0,ae.one(oe,o),_.get("slideshowAuto")?i():n(),R.show())}}();t[Y]||(t(p),J=t.fn[Y]=t[Y]=function(e,i){var n,o=this;if(e=e||{},t.isFunction(o))o=t("<a/>"),e.open=!0;else if(!o[0])return o;return o[0]?(p(),m()&&(i&&(e.onComplete=i),o.each(function(){var i=t.data(this,Y)||{};t.data(this,Y,t.extend(i,e))}).addClass(te),n=new r(o[0],e),n.get("open")&&f(o[0])),o):o},J.position=function(e,i){function n(){T[0].style.width=k[0].style.width=b[0].style.width=parseInt(y[0].style.width,10)-j+"px",b[0].style.height=C[0].style.height=H[0].style.height=parseInt(y[0].style.height,10)-D+"px"}var r,h,s,l=0,d=0,c=y.offset();if(E.unbind("resize."+Z),y.css({top:-9e4,left:-9e4}),h=E.scrollTop(),s=E.scrollLeft(),_.get("fixed")?(c.top-=h,c.left-=s,y.css({position:"fixed"})):(l=h,d=s,y.css({position:"absolute"})),d+=_.get("right")!==!1?Math.max(E.width()-_.w-N-j-a(_.get("right"),"x"),0):_.get("left")!==!1?a(_.get("left"),"x"):Math.round(Math.max(E.width()-_.w-N-j,0)/2),l+=_.get("bottom")!==!1?Math.max(o()-_.h-A-D-a(_.get("bottom"),"y"),0):_.get("top")!==!1?a(_.get("top"),"y"):Math.round(Math.max(o()-_.h-A-D,0)/2),y.css({top:c.top,left:c.left,visibility:"visible"}),x[0].style.width=x[0].style.height="9999px",r={width:_.w+N+j,height:_.h+A+D,top:l,left:d},e){var g=0;t.each(r,function(t){return r[t]!==de[t]?(g=e,void 0):void 0}),e=g}de=r,e||y.css(r),y.dequeue().animate(r,{duration:e||0,complete:function(){n(),q=!1,x[0].style.width=_.w+N+j+"px",x[0].style.height=_.h+A+D+"px",_.get("reposition")&&setTimeout(function(){E.bind("resize."+Z,J.position)},1),t.isFunction(i)&&i()},step:n})},J.resize=function(t){var e;$&&(t=t||{},t.width&&(_.w=a(t.width,"x")-N-j),t.innerWidth&&(_.w=a(t.innerWidth,"x")),L.css({width:_.w}),t.height&&(_.h=a(t.height,"y")-A-D),t.innerHeight&&(_.h=a(t.innerHeight,"y")),t.innerHeight||t.height||(e=L.scrollTop(),L.css({height:"auto"}),_.h=L.height()),L.css({height:_.h}),e&&L.scrollTop(e),J.position("none"===_.get("transition")?0:_.get("speed")))},J.prep=function(i){function o(){return _.w=_.w||L.width(),_.w=_.mw&&_.mw<_.w?_.mw:_.w,_.w}function a(){return _.h=_.h||L.height(),_.h=_.mh&&_.mh<_.h?_.mh:_.h,_.h}if($){var d,g="none"===_.get("transition")?0:_.get("speed");L.remove(),L=n(se,"LoadedContent").append(i),L.hide().appendTo(M.show()).css({width:o(),overflow:_.get("scrolling")?"auto":"hidden"}).css({height:a()}).prependTo(b),M.hide(),t(U).css({"float":"none"}),c(_.get("className")),d=function(){function i(){t.support.opacity===!1&&y[0].style.removeAttribute("filter")}var n,o,a=W.length;$&&(o=function(){clearTimeout(Q),S.hide(),u(ne),_.get("onComplete")},F.html(_.get("title")).show(),L.show(),a>1?("string"==typeof _.get("current")&&I.html(_.get("current").replace("{current}",z+1).replace("{total}",a)).show(),K[_.get("loop")||a-1>z?"show":"hide"]().html(_.get("next")),P[_.get("loop")||z?"show":"hide"]().html(_.get("previous")),ce(),_.get("preloading")&&t.each([h(-1),h(1)],function(){var i,n=W[this],o=new r(n,t.data(n,Y)),h=o.get("href");h&&s(o,h)&&(h=l(o,h),i=e.createElement("img"),i.src=h)})):O.hide(),_.get("iframe")?(n=e.createElement("iframe"),"frameBorder"in n&&(n.frameBorder=0),"allowTransparency"in n&&(n.allowTransparency="true"),_.get("scrolling")||(n.scrolling="no"),t(n).attr({src:_.get("href"),name:(new Date).getTime(),"class":Z+"Iframe",allowFullScreen:!0}).one("load",o).appendTo(L),ae.one(he,function(){n.src="//about:blank"}),_.get("fastIframe")&&t(n).trigger("load")):o(),"fade"===_.get("transition")?y.fadeTo(g,1,i):i())},"fade"===_.get("transition")?y.fadeTo(g,0,function(){J.position(0,d)}):J.position(g,d)}},J.next=function(){!q&&W[1]&&(_.get("loop")||W[z+1])&&(z=h(1),f(W[z]))},J.prev=function(){!q&&W[1]&&(_.get("loop")||z)&&(z=h(-1),f(W[z]))},J.close=function(){$&&!G&&(G=!0,$=!1,u(oe),_.get("onCleanup"),E.unbind("."+Z),v.fadeTo(_.get("fadeOut")||0,0),y.stop().fadeTo(_.get("fadeOut")||0,0,function(){y.hide(),v.hide(),u(he),L.remove(),setTimeout(function(){G=!1,u(re),_.get("onClosed")},1)}))},J.remove=function(){y&&(y.stop(),t[Y].close(),y.stop(!1,!0).remove(),v.remove(),G=!1,y=null,t("."+te).removeData(Y).removeClass(te),t(e).unbind("click."+Z).unbind("keydown."+Z))},J.element=function(){return t(_.el)},J.settings=X)})(jQuery,document,window);
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>OC_Checkout</name>
4
+ <version>1.0.1</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Allows placing an order directly from the product pages with a single mouse click.</summary>
10
+ <description>The "One Click Checkout" extension enable your registered customers to make instant purchases without having to click countless "Continue" buttons of the standard checkout procedure.&#xD;
11
+ &#xD;
12
+ The extra "One Click Checkout" button is introduced to product pages, and after clicking this button the order will be immediately created. A customer will only have to confirm their cart content and select the preferred payment method, all through a handy pop-up window.</description>
13
+ <notes>This is first release.</notes>
14
+ <authors><author><name>Unicode Systems</name><user>Unicode_Systems</user><email>magento@unicodesystems.in</email></author></authors>
15
+ <date>2014-12-11</date>
16
+ <time>11:26:07</time>
17
+ <contents><target name="magecommunity"><dir name="Uni"><dir name="Occheckout"><dir name="Block"><dir name="Catalog"><dir name="Product"><file name="View.php" hash="466783e36d4674a3d4a326a2fc195e08"/></dir></dir><dir name="Checkout"><dir name="Onepage"><file name="Abstract.php" hash="423a9c78764b348b12a3b6a8ce8be9ab"/><file name="Billing.php" hash="e57f312fee9b72184bd266ca19d00637"/><dir name="Payment"><file name="Methods.php" hash="3cc19814fb858848abcf6d8ef1ffd5a7"/></dir><file name="Shipping.php" hash="09527cc3f749f3feb228fa64e8818525"/></dir></dir><file name="Index.php" hash="37673aaa36dc3dfcde4c64edd2e26e06"/><file name="Updatecart.php" hash="2ccea37eb22d06bd1f189b4a55ddda65"/></dir><dir name="Helper"><file name="Data.php" hash="18879dbd47e20f5790a0ccbe494fc57c"/></dir><dir name="controllers"><file name="AccountController.php" hash="6a8cc872b9b3da19cb1eb83c1d7a620d"/><file name="CartController.php" hash="a7eb8a2436270afd54bfbb5506addf60"/><file name="IndexController.php" hash="4dbe03ef5bcd77867d28e8c3e95095b4"/><file name="OneclickController.php" hash="7024aae92b0030a6383ab7d57b3c22ef"/></dir><dir name="etc"><file name="adminhtml.xml" hash="11fb2343f4e9c929e48597f9d5145c18"/><file name="config.xml" hash="0d72462b698678ada7927cc083dc3dec"/><file name="system.xml" hash="2371006ecd171bc40c8c8a9d4886cc18"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Uni_Occheckout.xml" hash="c54d0f386cd15ac491be5ee6b9ddbee6"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="occheckout.xml" hash="de3eac5c8c68d5956d15edad808decc3"/></dir><dir name="template"><dir name="occheckout"><dir name="catalog"><dir name="product"><dir name="view"><file name="addtocart.phtml" hash="d158f41909b1e7b88e24ac7ea4ecc49d"/></dir></dir></dir><dir name="customer"><dir name="form"><file name="login.phtml" hash="ccf96b407afb840f68279fdcb7dd2840"/></dir></dir><file name="index.phtml" hash="cb26b461f068f2eeae773417eb9dee90"/><dir name="onepage"><file name="billing.phtml" hash="5fbea9beecce53019eed043a61ef2801"/><dir name="payment"><file name="methods.phtml" hash="e77dce5870d1b89c7f4050d48f0ea8bb"/></dir><file name="payment.phtml" hash="4c3d718bdebaad50cdc927ebacdbf243"/><file name="shipping.phtml" hash="11a15a5119c54e4f79acc03011a858ed"/><dir name="shipping_method"><file name="additional.phtml" hash="e13cd269e9feb9f0be1c10005bc19801"/><file name="available.phtml" hash="9161272bd02e76ed9c25e5d81ecb32ac"/></dir><file name="shipping_method.phtml" hash="c3d2e09f9bb08866d8ba6cb3d6fa06f9"/></dir><file name="success.phtml" hash="f989bc1505cad4362375839fa7c5f82a"/><file name="updatecart.phtml" hash="26d9bd962efe0691431009352d8deb3f"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="colorbox.css" hash="9e43754d573085ff71ff3057ace5a016"/><file name="occheckout.css" hash="0aa29d449cc8598d0bcd3e5788ff0ec9"/></dir><dir name="js"><file name="occheckout.js" hash="8ab02be621e57113c9d23d9211a16a74"/></dir><dir name="images"><file name="ajax-loader.gif" hash="e7ad9834ee1e5cb63538758f6861562a"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="jquery"><file name="jquery.colorbox-min.js" hash="2910ed8ce52b70f2a1f53b64b9c343de"/></dir></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0.0</min><max>1.8.1.0</max></package><extension><name>gd</name><min>1.6.0.0</min><max>1.9.0.1</max></extension></required></dependencies>
20
+ </package>
skin/frontend/base/default/css/colorbox.css ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Colorbox Core Style:
3
+ The following CSS is consistent between example themes and should not be altered.
4
+ */
5
+ #colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
6
+ #cboxWrapper {max-width:none;}
7
+ #cboxOverlay{position:fixed; width:100%; height:100%;}
8
+ #cboxMiddleLeft, #cboxBottomLeft{clear:left;}
9
+ #cboxContent{position:relative;}
10
+ #cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;}
11
+ #cboxTitle{margin:0;}
12
+ #cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
13
+ #cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
14
+ .cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;}
15
+ .cboxIframe{width:100%; height:100%; display:block; border:0; padding:0; margin:0;}
16
+ #colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;}
17
+
18
+ /*
19
+ User Style:
20
+ Change the following styles to modify the appearance of Colorbox. They are
21
+ ordered & tabbed in a way that represents the nesting of the generated HTML.
22
+ */
23
+ #cboxOverlay{background:url(../images/overlay.png) repeat #fff; opacity: 0.9; filter: alpha(opacity = 90);}
24
+ #colorbox{outline:0;}
25
+ /* #cboxTopLeft{width:21px; height:21px; background:url(images/controls.png) no-repeat -101px 0;}
26
+ #cboxTopRight{width:21px; height:21px; background:url(images/controls.png) no-repeat -130px 0;}
27
+ #cboxBottomLeft{width:21px; height:21px; background:url(images/controls.png) no-repeat -101px -29px;}
28
+ #cboxBottomRight{width:21px; height:21px; background:url(images/controls.png) no-repeat -130px -29px;}
29
+ #cboxMiddleLeft{width:21px; background:url(images/controls.png) left top repeat-y;}
30
+ #cboxMiddleRight{width:21px; background:url(images/controls.png) right top repeat-y;}
31
+ #cboxTopCenter{height:21px; background:url(images/border.png) 0 0 repeat-x;}
32
+ #cboxBottomCenter{height:21px; background:url(images/border.png) 0 -29px repeat-x;}*/
33
+ #cboxContent{background:#fff; overflow:hidden;}
34
+ .cboxIframe{background:#fff;}
35
+ #cboxError{padding:50px; border:1px solid #ccc;}
36
+ #cboxLoadedContent{margin-bottom:28px;}
37
+ #cboxTitle{position:absolute; bottom:4px; left:0; text-align:center; width:100%; color:#949494;}
38
+ #cboxCurrent{position:absolute; bottom:4px; left:58px; color:#949494;}
39
+ #cboxLoadingOverlay{background:url(images/loading_background.png) no-repeat center center;}
40
+ #cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;}
41
+
42
+ /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
43
+ #cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; }
44
+
45
+ /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
46
+ #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;}
47
+
48
+ #cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;}
49
+ #cboxPrevious{position:absolute; bottom:0; left:0; background:url(images/controls.png) no-repeat -75px 0; width:25px; height:25px; text-indent:-9999px;}
50
+ #cboxPrevious:hover{background-position:-75px -25px;}
51
+ #cboxNext{position:absolute; bottom:0; left:27px; background:url(images/controls.png) no-repeat -50px 0; width:25px; height:25px; text-indent:-9999px;}
52
+ #cboxNext:hover{background-position:-50px -25px;}
53
+ #cboxClose{position:absolute; bottom:0; right:0; background:url(images/controls.png) no-repeat -25px 0; width:25px; height:25px; text-indent:-9999px;}
54
+ #cboxClose:hover{background-position:-25px -25px;}
55
+
56
+ /*
57
+ The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
58
+ when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9.
59
+ See: http://jacklmoore.com/notes/ie-transparency-problems/
60
+ */
61
+ .cboxIE #cboxTopLeft,
62
+ .cboxIE #cboxTopCenter,
63
+ .cboxIE #cboxTopRight,
64
+ .cboxIE #cboxBottomLeft,
65
+ .cboxIE #cboxBottomCenter,
66
+ .cboxIE #cboxBottomRight,
67
+ .cboxIE #cboxMiddleLeft,
68
+ .cboxIE #cboxMiddleRight {
69
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
70
+ }
skin/frontend/base/default/css/occheckout.css ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Academic Free License (AFL 3.0)
7
+ * that is bundled with this package in the file LICENSE_AFL.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/afl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to license@magentocommerce.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future. If you wish to customize Magento for your
18
+ * needs please refer to http://www.magentocommerce.com for more information.
19
+ *
20
+ * @category design
21
+ * @package default_default
22
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
23
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
24
+ */
25
+
26
+ /* Reset ================================================================================= */
27
+ .occheckout-index-occheckout{background:transparent;}
28
+ .occheckout-index-occheckout .main{width:100%; padding:20px 20px 80px; box-sizing: border-box; background-size:100%;}
29
+ .occheckout-left{float:left; width:45.5%;}
30
+ .occheckout-right{float:right; border-left: 1px solid #cfcfcf; padding-left: 14px; width: 52%;}
31
+ .shipping-address, .billing-address{width:48.5%;}
32
+ .occheckout-title{padding:8px 0;}
33
+ .occheckout-title h1{margin-top:5px;}
34
+ .occheckout-title ul li{display:inline-block;}
35
+ .occheckout-title ul li:first-child{margin-right:20px;}
36
+ .octable thead th{border:none; border-right:1px solid #c2d3e0;}
37
+ .octable thead th.last{border:0px;}
38
+ .octable tbody th, .octable tbody td {border:0px; border-bottom: 1px solid #d9dde3; border-right: 1px solid #d9dde3;}
39
+ .octable .btn-remove2{border:none; background-color:transparent; padding:0px; }
40
+ .occheckout-index-occheckout .btn-update span{background: #618499; border-color: #406a83; padding:0 10px; font:bold 12px/30px Arial,Helvetica,sans-serif; height: 25px; line-height:25px; border-radius:5px; }
41
+ .occheckout-title .btn-update span {padding:0px; background: #618499; border-color: #406a83; font:bold 15px/40px Arial,Helvetica,sans-serif; height: 35px; line-height:35px; border-radius:5px; width:180px;}
42
+ .occheckout-index-occheckout .cart-data{margin-bottom:15px;}
43
+ .occheckout-index-occheckout .cart-manual {border-bottom: 1px solid #cfcfcf; margin-bottom: 15px; padding-bottom: 15px;}
44
+ .occheckout-index-occheckout .form-list li.wide .input-box,
45
+ .occheckout-index-occheckout .form-list .input-box,
46
+ .occheckout-index-occheckout .form-list .field{width:100%; float:left;}
47
+ .occheckout-index-occheckout .form-list li.wide input.input-text,
48
+ .occheckout-index-occheckout .form-list input.input-text,
49
+ .occheckout-index-occheckout .form-list select,
50
+ .occheckout-index-occheckout .form-list li.wide select{width:100%; box-sizing: border-box;padding: 5px;}
51
+ .occheckout-index-occheckout .sp-methods select.year{width: 96px;}
52
+ .occheckout-index-occheckout .fields > div:first-child, .occheckout-index-occheckout .name-firstname{margin-bottom:8px;}
53
+ .v-right{float:right;}
54
+ .occheckout-left label[for="new-billing-address-form"],
55
+ .occheckout-left label[for="new-shipping-address-form"],
56
+ .occheckout-index-occheckout label[for="billing-address-select"],
57
+ .occheckout-index-occheckout label[for="shipping-address-select"],
58
+ .occheckout-left h2, .occheckout-right h2, .occheckout-right h3{font-size:16px; color:#0a263c; font-weight: normal; line-height: 18px; margin-bottom:8px;}
59
+ .payment-methods {float: right; width: 50%;}
60
+ .shipping-method{float:left;}
61
+ .occheckout-index-occheckout .grand-total {margin-top: 15px;}
62
+ .occheckout-index-occheckout #shopping-cart-totals-table td{padding:3px 5px; border:1px solid #cfcfcf; border-width: 1px 0 0 1px;}
63
+ .occheckout-index-occheckout #shopping-cart-totals-table{border:1px solid #cfcfcf; border-width: 0 1px 1px 0;}
64
+ .occheckout-index-occheckout .grand-total{float:left !important;}
65
+ .occheckout-index-occheckout .buttons-set{border:none;}
66
+
67
+ .occheckout-btn-cart{background:#f18200; text-decoration: none; border: 1px solid #de5400; color: #ffffff; display: block; font: bold 12px/19px Arial,Helvetica,sans-serif; height: 19px; padding: 0 8px; text-align: center; white-space: nowrap;}
68
+ .occheckout-fl{float:left;}
69
+ .occheckout-btn-cart{float:left; margin-left:5px;}
70
+ .logout-btn-cart{margin-top:5px; margin-left:0px;}
71
+ #occheckout-popup{cursor: pointer}
skin/frontend/base/default/images/ajax-loader.gif ADDED
Binary file
skin/frontend/base/default/js/occheckout.js ADDED
@@ -0,0 +1,907 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Academic Free License (AFL 3.0)
7
+ * that is bundled with this package in the file LICENSE_AFL.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/afl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to license@magentocommerce.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future. If you wish to customize Magento for your
18
+ * needs please refer to http://www.magentocommerce.com for more information.
19
+ *
20
+ * @category design
21
+ * @package base_default
22
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
23
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
24
+ */
25
+ var Checkout = Class.create();
26
+ Checkout.prototype = {
27
+ initialize: function(accordion, urls){
28
+ this.accordion = accordion;
29
+ this.progressUrl = urls.progress;
30
+ this.reviewUrl = urls.review;
31
+ this.saveMethodUrl = urls.saveMethod;
32
+ this.failureUrl = urls.failure;
33
+ this.billingForm = false;
34
+ this.shippingForm= false;
35
+ this.syncBillingShipping = false;
36
+ this.method = '';
37
+ this.payment = '';
38
+ this.loadWaiting = false;
39
+ this.steps = ['login', 'billing', 'shipping', 'shipping_method', 'payment', 'review'];
40
+
41
+ this.accordion.sections.each(function(section) {
42
+ Event.observe($(section).down('.step-title'), 'click', this._onSectionClick.bindAsEventListener(this));
43
+ }.bind(this));
44
+
45
+ this.accordion.disallowAccessToNextSections = true;
46
+ },
47
+
48
+ /**
49
+ * Section header click handler
50
+ *
51
+ * @param event
52
+ */
53
+ _onSectionClick: function(event) {
54
+ var section = $(Event.element(event).up().up());
55
+ if (section.hasClassName('allow')) {
56
+ Event.stop(event);
57
+ this.gotoSection(section.readAttribute('id').replace('opc-', ''));
58
+ return false;
59
+ }
60
+ },
61
+
62
+ ajaxFailure: function(){
63
+ location.href = this.failureUrl;
64
+ },
65
+
66
+ reloadProgressBlock: function(toStep) {
67
+ var updater = new Ajax.Updater('checkout-progress-wrapper', this.progressUrl, {
68
+ method: 'get',
69
+ onFailure: this.ajaxFailure.bind(this),
70
+ parameters: toStep ? {toStep: toStep} : null
71
+ });
72
+ },
73
+
74
+ reloadReviewBlock: function(){
75
+ var updater = new Ajax.Updater('checkout-review-load', this.reviewUrl, {method: 'get', onFailure: this.ajaxFailure.bind(this)});
76
+ },
77
+
78
+ _disableEnableAll: function(element, isDisabled) {
79
+ var descendants = element.descendants();
80
+ for (var k in descendants) {
81
+ descendants[k].disabled = isDisabled;
82
+ }
83
+ element.disabled = isDisabled;
84
+ },
85
+
86
+ setLoadWaiting: function(step, keepDisabled) {
87
+ if (step) {
88
+ if (this.loadWaiting) {
89
+ this.setLoadWaiting(false);
90
+ }
91
+ var container = $(step+'-buttons-container');
92
+ container.addClassName('disabled');
93
+ container.setStyle({opacity:.5});
94
+ this._disableEnableAll(container, true);
95
+ Element.show(step+'-please-wait');
96
+ } else {
97
+ if (this.loadWaiting) {
98
+ var container = $(this.loadWaiting+'-buttons-container');
99
+ var isDisabled = (keepDisabled ? true : false);
100
+ if (!isDisabled) {
101
+ container.removeClassName('disabled');
102
+ container.setStyle({opacity:1});
103
+ }
104
+ this._disableEnableAll(container, isDisabled);
105
+ Element.hide(this.loadWaiting+'-please-wait');
106
+ }
107
+ }
108
+ this.loadWaiting = step;
109
+ },
110
+
111
+ gotoSection: function(section)
112
+ {
113
+ var sectionElement = $('opc-'+section);
114
+ sectionElement.addClassName('allow');
115
+ this.accordion.openSection('opc-'+section);
116
+ this.reloadProgressBlock(section);
117
+ },
118
+
119
+ setMethod: function(){
120
+ if ($('login:guest') && $('login:guest').checked) {
121
+ this.method = 'guest';
122
+ var request = new Ajax.Request(
123
+ this.saveMethodUrl,
124
+ {method: 'post', onFailure: this.ajaxFailure.bind(this), parameters: {method:'guest'}}
125
+ );
126
+ Element.hide('register-customer-password');
127
+ this.gotoSection('billing');
128
+ }
129
+ else if($('login:register') && ($('login:register').checked || $('login:register').type == 'hidden')) {
130
+ this.method = 'register';
131
+ var request = new Ajax.Request(
132
+ this.saveMethodUrl,
133
+ {method: 'post', onFailure: this.ajaxFailure.bind(this), parameters: {method:'register'}}
134
+ );
135
+ Element.show('register-customer-password');
136
+ this.gotoSection('billing');
137
+ }
138
+ else{
139
+ alert(Translator.translate('Please choose to register or to checkout as a guest').stripTags());
140
+ return false;
141
+ }
142
+ document.body.fire('login:setMethod', {method : this.method});
143
+ },
144
+
145
+ setBilling: function() {
146
+ if (($('billing:use_for_shipping_yes')) && ($('billing:use_for_shipping_yes').checked)) {
147
+ shipping.syncWithBilling();
148
+ $('opc-shipping').addClassName('allow');
149
+ this.gotoSection('shipping_method');
150
+ } else if (($('billing:use_for_shipping_no')) && ($('billing:use_for_shipping_no').checked)) {
151
+ $('shipping:same_as_billing').checked = false;
152
+ this.gotoSection('shipping');
153
+ } else {
154
+ $('shipping:same_as_billing').checked = true;
155
+ this.gotoSection('shipping');
156
+ }
157
+
158
+ // this refreshes the checkout progress column
159
+
160
+ // if ($('billing:use_for_shipping') && $('billing:use_for_shipping').checked){
161
+ // shipping.syncWithBilling();
162
+ // //this.setShipping();
163
+ // //shipping.save();
164
+ // $('opc-shipping').addClassName('allow');
165
+ // this.gotoSection('shipping_method');
166
+ // } else {
167
+ // $('shipping:same_as_billing').checked = false;
168
+ // this.gotoSection('shipping');
169
+ // }
170
+ // this.reloadProgressBlock();
171
+ // //this.accordion.openNextSection(true);
172
+ },
173
+
174
+ setShipping: function() {
175
+ //this.nextStep();
176
+ this.gotoSection('shipping_method');
177
+ //this.accordion.openNextSection(true);
178
+ },
179
+
180
+ setShippingMethod: function() {
181
+ //this.nextStep();
182
+ this.gotoSection('payment');
183
+ //this.accordion.openNextSection(true);
184
+ },
185
+
186
+ setPayment: function() {
187
+ //this.nextStep();
188
+ this.gotoSection('review');
189
+ //this.accordion.openNextSection(true);
190
+ },
191
+
192
+ setReview: function() {
193
+ this.reloadProgressBlock();
194
+ //this.nextStep();
195
+ //this.accordion.openNextSection(true);
196
+ },
197
+
198
+ back: function(){
199
+ if (this.loadWaiting) return;
200
+ this.accordion.openPrevSection(true);
201
+ },
202
+
203
+ setStepResponse: function(response){
204
+ if (response.update_section) {
205
+ $('checkout-'+response.update_section.name+'-load').update(response.update_section.html);
206
+ }
207
+ if (response.allow_sections) {
208
+ response.allow_sections.each(function(e){
209
+ $('opc-'+e).addClassName('allow');
210
+ });
211
+ }
212
+
213
+ if(response.duplicateBillingInfo)
214
+ {
215
+ shipping.setSameAsBilling(true);
216
+ }
217
+
218
+ if (response.goto_section) {
219
+ this.gotoSection(response.goto_section);
220
+ return true;
221
+ }
222
+ if (response.redirect) {
223
+ location.href = response.redirect;
224
+ return true;
225
+ }
226
+ return false;
227
+ }
228
+ }
229
+
230
+ // billing
231
+ var Billing = Class.create();
232
+ Billing.prototype = {
233
+ initialize: function(form, addressUrl, saveUrl){
234
+ alert(form);
235
+ alert(addressUrl);
236
+ alert(saveUrl);
237
+
238
+ this.form = form;
239
+ if ($(this.form)) {
240
+ $(this.form).observe('submit', function(event){this.save();Event.stop(event);}.bind(this));
241
+ }
242
+ this.addressUrl = addressUrl;
243
+ this.saveUrl = saveUrl;
244
+ this.onAddressLoad = this.fillForm.bindAsEventListener(this);
245
+ this.onSave = this.nextStep.bindAsEventListener(this);
246
+ this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
247
+ },
248
+
249
+ setAddress: function(addressId){
250
+ if (addressId) {
251
+ request = new Ajax.Request(
252
+ this.addressUrl+addressId,
253
+ {method:'get', onSuccess: this.onAddressLoad, onFailure: checkout.ajaxFailure.bind(checkout)}
254
+ );
255
+ }
256
+ else {
257
+ this.fillForm(false);
258
+ }
259
+ },
260
+
261
+ newAddress: function(isNew){
262
+ if (isNew) {
263
+ this.resetSelectedAddress();
264
+ Element.show('billing-new-address-form');
265
+ } else {
266
+ Element.hide('billing-new-address-form');
267
+ }
268
+ },
269
+
270
+ resetSelectedAddress: function(){
271
+ var selectElement = $('billing-address-select')
272
+ if (selectElement) {
273
+ selectElement.value='';
274
+ }
275
+ },
276
+
277
+ fillForm: function(transport){
278
+ var elementValues = {};
279
+ if (transport && transport.responseText){
280
+ try{
281
+ elementValues = eval('(' + transport.responseText + ')');
282
+ }
283
+ catch (e) {
284
+ elementValues = {};
285
+ }
286
+ }
287
+ else{
288
+ this.resetSelectedAddress();
289
+ }
290
+ arrElements = Form.getElements(this.form);
291
+ for (var elemIndex in arrElements) {
292
+ if (arrElements[elemIndex].id) {
293
+ var fieldName = arrElements[elemIndex].id.replace(/^billing:/, '');
294
+ arrElements[elemIndex].value = elementValues[fieldName] ? elementValues[fieldName] : '';
295
+ if (fieldName == 'country_id' && billingForm){
296
+ billingForm.elementChildLoad(arrElements[elemIndex]);
297
+ }
298
+ }
299
+ }
300
+ },
301
+
302
+ setUseForShipping: function(flag) {
303
+ $('shipping:same_as_billing').checked = flag;
304
+ },
305
+
306
+ // save: function(){
307
+ // if (checkout.loadWaiting!=false) return;
308
+ //
309
+ // var validator = new Validation(this.form);
310
+ // if (validator.validate()) {
311
+ // checkout.setLoadWaiting('billing');
312
+ //
313
+ //// if ($('billing:use_for_shipping') && $('billing:use_for_shipping').checked) {
314
+ //// $('billing:use_for_shipping').value=1;
315
+ //// }
316
+ //
317
+ // var request = new Ajax.Request(
318
+ // this.saveUrl,
319
+ // {
320
+ // method: 'post',
321
+ // onComplete: this.onComplete,
322
+ // onSuccess: this.onSave,
323
+ // onFailure: checkout.ajaxFailure.bind(checkout),
324
+ // parameters: Form.serialize(this.form)
325
+ // }
326
+ // );
327
+ // }
328
+ // },
329
+
330
+ resetLoadWaiting: function(transport){
331
+ checkout.setLoadWaiting(false);
332
+ document.body.fire('billing-request:completed', {transport: transport});
333
+ },
334
+
335
+ /**
336
+ This method recieves the AJAX response on success.
337
+ There are 3 options: error, redirect or html with shipping options.
338
+ */
339
+ nextStep: function(transport){
340
+ if (transport && transport.responseText){
341
+ try{
342
+ response = eval('(' + transport.responseText + ')');
343
+ }
344
+ catch (e) {
345
+ response = {};
346
+ }
347
+ }
348
+
349
+ if (response.error){
350
+ if ((typeof response.message) == 'string') {
351
+ alert(response.message);
352
+ } else {
353
+ if (window.billingRegionUpdater) {
354
+ billingRegionUpdater.update();
355
+ }
356
+
357
+ alert(response.message.join("\n"));
358
+ }
359
+
360
+ return false;
361
+ }
362
+
363
+ checkout.setStepResponse(response);
364
+ payment.initWhatIsCvvListeners();
365
+ // DELETE
366
+ //alert('error: ' + response.error + ' / redirect: ' + response.redirect + ' / shipping_methods_html: ' + response.shipping_methods_html);
367
+ // This moves the accordion panels of one page checkout and updates the checkout progress
368
+ //checkout.setBilling();
369
+ }
370
+ }
371
+
372
+ // shipping
373
+ var Shipping = Class.create();
374
+ Shipping.prototype = {
375
+ initialize: function(form, addressUrl, saveUrl, methodsUrl){
376
+ this.form = form;
377
+ if ($(this.form)) {
378
+ $(this.form).observe('submit', function(event){this.save();Event.stop(event);}.bind(this));
379
+ }
380
+ this.addressUrl = addressUrl;
381
+ this.saveUrl = saveUrl;
382
+ this.methodsUrl = methodsUrl;
383
+ this.onAddressLoad = this.fillForm.bindAsEventListener(this);
384
+ this.onSave = this.nextStep.bindAsEventListener(this);
385
+ this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
386
+ },
387
+
388
+ setAddress: function(addressId){
389
+ if (addressId) {
390
+ request = new Ajax.Request(
391
+ this.addressUrl+addressId,
392
+ {method:'get', onSuccess: this.onAddressLoad, onFailure: checkout.ajaxFailure.bind(checkout)}
393
+ );
394
+ }
395
+ else {
396
+ this.fillForm(false);
397
+ }
398
+ },
399
+
400
+ newAddress: function(isNew){
401
+ if (isNew) {
402
+ this.resetSelectedAddress();
403
+ Element.show('shipping-new-address-form');
404
+ } else {
405
+ Element.hide('shipping-new-address-form');
406
+ }
407
+ shipping.setSameAsBilling(false);
408
+ },
409
+
410
+ resetSelectedAddress: function(){
411
+ var selectElement = $('shipping-address-select')
412
+ if (selectElement) {
413
+ selectElement.value='';
414
+ }
415
+ },
416
+
417
+ fillForm: function(transport){
418
+ var elementValues = {};
419
+ if (transport && transport.responseText){
420
+ try{
421
+ elementValues = eval('(' + transport.responseText + ')');
422
+ }
423
+ catch (e) {
424
+ elementValues = {};
425
+ }
426
+ }
427
+ else{
428
+ this.resetSelectedAddress();
429
+ }
430
+ arrElements = Form.getElements(this.form);
431
+ for (var elemIndex in arrElements) {
432
+ if (arrElements[elemIndex].id) {
433
+ var fieldName = arrElements[elemIndex].id.replace(/^shipping:/, '');
434
+ arrElements[elemIndex].value = elementValues[fieldName] ? elementValues[fieldName] : '';
435
+ if (fieldName == 'country_id' && shippingForm){
436
+ shippingForm.elementChildLoad(arrElements[elemIndex]);
437
+ }
438
+ }
439
+ }
440
+ },
441
+
442
+ setSameAsBilling: function(flag) {
443
+ $('shipping:same_as_billing').checked = flag;
444
+ // #5599. Also it hangs up, if the flag is not false
445
+ $('billing:use_for_shipping_yes').checked = flag;
446
+ if (flag) {
447
+ this.syncWithBilling();
448
+ }
449
+ },
450
+
451
+ syncWithBilling: function () {
452
+ // $('billing-address-select') && this.newAddress(!$('billing-address-select').value);
453
+ $('shipping:same_as_billing').checked = true;
454
+ if (!$('billing-address-select') || !$('billing-address-select').value) {
455
+ arrElements = Form.getElements(this.form);
456
+ for (var elemIndex in arrElements) {
457
+ if (arrElements[elemIndex].id) {
458
+ var sourceField = $(arrElements[elemIndex].id.replace(/^shipping:/, 'billing:'));
459
+ if (sourceField){
460
+ arrElements[elemIndex].value = sourceField.value;
461
+ }
462
+ }
463
+ }
464
+ //$('shipping:country_id').value = $('billing:country_id').value;
465
+ shippingRegionUpdater.update();
466
+ $('shipping:region_id').value = $('billing:region_id').value;
467
+ $('shipping:region').value = $('billing:region').value;
468
+ //shippingForm.elementChildLoad($('shipping:country_id'), this.setRegionValue.bind(this));
469
+ } else {
470
+ $('shipping-address-select').value = $('billing-address-select').value;
471
+ }
472
+ },
473
+
474
+ setRegionValue: function(){
475
+ $('shipping:region').value = $('billing:region').value;
476
+ },
477
+
478
+ // save: function(){
479
+ // if (checkout.loadWaiting!=false) return;
480
+ // var validator = new Validation(this.form);
481
+ // if (validator.validate()) {
482
+ // checkout.setLoadWaiting('shipping');
483
+ // var request = new Ajax.Request(
484
+ // this.saveUrl,
485
+ // {
486
+ // method:'post',
487
+ // onComplete: this.onComplete,
488
+ // onSuccess: this.onSave,
489
+ // onFailure: checkout.ajaxFailure.bind(checkout),
490
+ // parameters: Form.serialize(this.form)
491
+ // }
492
+ // );
493
+ // }
494
+ // },
495
+
496
+ resetLoadWaiting: function(transport){
497
+ checkout.setLoadWaiting(false);
498
+ },
499
+
500
+ nextStep: function(transport){
501
+ if (transport && transport.responseText){
502
+ try{
503
+ response = eval('(' + transport.responseText + ')');
504
+ }
505
+ catch (e) {
506
+ response = {};
507
+ }
508
+ }
509
+ if (response.error){
510
+ if ((typeof response.message) == 'string') {
511
+ alert(response.message);
512
+ } else {
513
+ if (window.shippingRegionUpdater) {
514
+ shippingRegionUpdater.update();
515
+ }
516
+ alert(response.message.join("\n"));
517
+ }
518
+
519
+ return false;
520
+ }
521
+
522
+ checkout.setStepResponse(response);
523
+
524
+ /*
525
+ var updater = new Ajax.Updater(
526
+ 'checkout-shipping-method-load',
527
+ this.methodsUrl,
528
+ {method:'get', onSuccess: checkout.setShipping.bind(checkout)}
529
+ );
530
+ */
531
+ //checkout.setShipping();
532
+ }
533
+ }
534
+
535
+ // shipping method
536
+ var ShippingMethod = Class.create();
537
+ ShippingMethod.prototype = {
538
+ initialize: function(form, saveUrl){
539
+ this.form = form;
540
+ if ($(this.form)) {
541
+ $(this.form).observe('submit', function(event){this.save();Event.stop(event);}.bind(this));
542
+ }
543
+ this.saveUrl = saveUrl;
544
+ this.validator = new Validation(this.form);
545
+ this.onSave = this.nextStep.bindAsEventListener(this);
546
+ this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
547
+ },
548
+
549
+ validate: function() {
550
+ var methods = document.getElementsByName('shipping_method');
551
+ if (methods.length==0) {
552
+ alert(Translator.translate('Your order cannot be completed at this time as there is no shipping methods available for it. Please make necessary changes in your shipping address.').stripTags());
553
+ return false;
554
+ }
555
+
556
+ if(!this.validator.validate()) {
557
+ return false;
558
+ }
559
+
560
+ for (var i=0; i<methods.length; i++) {
561
+ if (methods[i].checked) {
562
+ return true;
563
+ }
564
+ }
565
+ alert(Translator.translate('Please specify shipping method.').stripTags());
566
+ return false;
567
+ },
568
+
569
+ // save: function(){
570
+ //
571
+ // if (checkout.loadWaiting!=false) return;
572
+ // if (this.validate()) {
573
+ // checkout.setLoadWaiting('shipping-method');
574
+ // var request = new Ajax.Request(
575
+ // this.saveUrl,
576
+ // {
577
+ // method:'post',
578
+ // onComplete: this.onComplete,
579
+ // onSuccess: this.onSave,
580
+ // onFailure: checkout.ajaxFailure.bind(checkout),
581
+ // parameters: Form.serialize(this.form)
582
+ // }
583
+ // );
584
+ // }
585
+ // },
586
+
587
+ resetLoadWaiting: function(transport){
588
+ checkout.setLoadWaiting(false);
589
+ },
590
+
591
+ nextStep: function(transport){
592
+ if (transport && transport.responseText){
593
+ try{
594
+ response = eval('(' + transport.responseText + ')');
595
+ }
596
+ catch (e) {
597
+ response = {};
598
+ }
599
+ }
600
+
601
+ if (response.error) {
602
+ alert(response.message);
603
+ return false;
604
+ }
605
+
606
+ if (response.update_section) {
607
+ $('checkout-'+response.update_section.name+'-load').update(response.update_section.html);
608
+ }
609
+
610
+ payment.initWhatIsCvvListeners();
611
+
612
+ if (response.goto_section) {
613
+ checkout.gotoSection(response.goto_section);
614
+ checkout.reloadProgressBlock();
615
+ return;
616
+ }
617
+
618
+ if (response.payment_methods_html) {
619
+ $('checkout-payment-method-load').update(response.payment_methods_html);
620
+ }
621
+
622
+ checkout.setShippingMethod();
623
+ }
624
+ }
625
+
626
+
627
+ // payment
628
+ var Payment = Class.create();
629
+ Payment.prototype = {
630
+ beforeInitFunc:$H({}),
631
+ afterInitFunc:$H({}),
632
+ beforeValidateFunc:$H({}),
633
+ afterValidateFunc:$H({}),
634
+ initialize: function(form, saveUrl){
635
+ this.form = form;
636
+ this.saveUrl = saveUrl;
637
+ this.onSave = this.nextStep.bindAsEventListener(this);
638
+ this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
639
+ },
640
+
641
+ addBeforeInitFunction : function(code, func) {
642
+ this.beforeInitFunc.set(code, func);
643
+ },
644
+
645
+ beforeInit : function() {
646
+ (this.beforeInitFunc).each(function(init){
647
+ (init.value)();;
648
+ });
649
+ },
650
+
651
+ init : function () {
652
+ this.beforeInit();
653
+ var elements = Form.getElements(this.form);
654
+ if ($(this.form)) {
655
+ $(this.form).observe('submit', function(event){this.save();Event.stop(event);}.bind(this));
656
+ }
657
+ var method = null;
658
+ for (var i=0; i<elements.length; i++) {
659
+ if (elements[i].name=='payment[method]') {
660
+ if (elements[i].checked) {
661
+ method = elements[i].value;
662
+ }
663
+ } else {
664
+ elements[i].disabled = true;
665
+ }
666
+ elements[i].setAttribute('autocomplete','off');
667
+ }
668
+ if (method) this.switchMethod(method);
669
+ this.afterInit();
670
+ },
671
+
672
+ addAfterInitFunction : function(code, func) {
673
+ this.afterInitFunc.set(code, func);
674
+ },
675
+
676
+ afterInit : function() {
677
+ (this.afterInitFunc).each(function(init){
678
+ (init.value)();
679
+ });
680
+ },
681
+
682
+ switchMethod: function(method){
683
+ if (this.currentMethod && $('payment_form_'+this.currentMethod)) {
684
+ this.changeVisible(this.currentMethod, true);
685
+ $('payment_form_'+this.currentMethod).fire('payment-method:switched-off', {method_code : this.currentMethod});
686
+ }
687
+ if ($('payment_form_'+method)){
688
+ this.changeVisible(method, false);
689
+ $('payment_form_'+method).fire('payment-method:switched', {method_code : method});
690
+ } else {
691
+ //Event fix for payment methods without form like "Check / Money order"
692
+ document.body.fire('payment-method:switched', {method_code : method});
693
+ }
694
+ if (method) {
695
+ this.lastUsedMethod = method;
696
+ }
697
+ this.currentMethod = method;
698
+ },
699
+
700
+ changeVisible: function(method, mode) {
701
+ var block = 'payment_form_' + method;
702
+ [block + '_before', block, block + '_after'].each(function(el) {
703
+ element = $(el);
704
+ if (element) {
705
+ element.style.display = (mode) ? 'none' : '';
706
+ element.select('input', 'select', 'textarea', 'button').each(function(field) {
707
+ field.disabled = mode;
708
+ });
709
+ }
710
+ });
711
+ },
712
+
713
+ addBeforeValidateFunction : function(code, func) {
714
+ this.beforeValidateFunc.set(code, func);
715
+ },
716
+
717
+ beforeValidate : function() {
718
+ var validateResult = true;
719
+ var hasValidation = false;
720
+ (this.beforeValidateFunc).each(function(validate){
721
+ hasValidation = true;
722
+ if ((validate.value)() == false) {
723
+ validateResult = false;
724
+ }
725
+ }.bind(this));
726
+ if (!hasValidation) {
727
+ validateResult = false;
728
+ }
729
+ return validateResult;
730
+ },
731
+
732
+ validate: function() {
733
+ var result = this.beforeValidate();
734
+ if (result) {
735
+ return true;
736
+ }
737
+ var methods = document.getElementsByName('payment[method]');
738
+ if (methods.length==0) {
739
+ alert(Translator.translate('Your order cannot be completed at this time as there is no payment methods available for it.').stripTags());
740
+ return false;
741
+ }
742
+ for (var i=0; i<methods.length; i++) {
743
+ if (methods[i].checked) {
744
+ return true;
745
+ }
746
+ }
747
+ result = this.afterValidate();
748
+ if (result) {
749
+ return true;
750
+ }
751
+ alert(Translator.translate('Please specify payment method.').stripTags());
752
+ return false;
753
+ },
754
+
755
+ addAfterValidateFunction : function(code, func) {
756
+ this.afterValidateFunc.set(code, func);
757
+ },
758
+
759
+ afterValidate : function() {
760
+ var validateResult = true;
761
+ var hasValidation = false;
762
+ (this.afterValidateFunc).each(function(validate){
763
+ hasValidation = true;
764
+ if ((validate.value)() == false) {
765
+ validateResult = false;
766
+ }
767
+ }.bind(this));
768
+ if (!hasValidation) {
769
+ validateResult = false;
770
+ }
771
+ return validateResult;
772
+ },
773
+
774
+ save: function(){
775
+ if (checkout.loadWaiting!=false) return;
776
+ var validator = new Validation(this.form);
777
+ if (this.validate() && validator.validate()) {
778
+ checkout.setLoadWaiting('payment');
779
+ var request = new Ajax.Request(
780
+ this.saveUrl,
781
+ {
782
+ method:'post',
783
+ onComplete: this.onComplete,
784
+ onSuccess: this.onSave,
785
+ onFailure: checkout.ajaxFailure.bind(checkout),
786
+ parameters: Form.serialize(this.form)
787
+ }
788
+ );
789
+ }
790
+ },
791
+
792
+ resetLoadWaiting: function(){
793
+ checkout.setLoadWaiting(false);
794
+ },
795
+
796
+ nextStep: function(transport){
797
+ if (transport && transport.responseText){
798
+ try{
799
+ response = eval('(' + transport.responseText + ')');
800
+ }
801
+ catch (e) {
802
+ response = {};
803
+ }
804
+ }
805
+ /*
806
+ * if there is an error in payment, need to show error message
807
+ */
808
+ if (response.error) {
809
+ if (response.fields) {
810
+ var fields = response.fields.split(',');
811
+ for (var i=0;i<fields.length;i++) {
812
+ var field = null;
813
+ if (field = $(fields[i])) {
814
+ Validation.ajaxError(field, response.error);
815
+ }
816
+ }
817
+ return;
818
+ }
819
+ alert(response.error);
820
+ return;
821
+ }
822
+
823
+ checkout.setStepResponse(response);
824
+
825
+ //checkout.setPayment();
826
+ },
827
+
828
+ initWhatIsCvvListeners: function(){
829
+ $$('.cvv-what-is-this').each(function(element){
830
+ Event.observe(element, 'click', toggleToolTip);
831
+ });
832
+ }
833
+ }
834
+
835
+ var Review = Class.create();
836
+ Review.prototype = {
837
+ initialize: function(saveUrl, successUrl, agreementsForm){
838
+ this.saveUrl = saveUrl;
839
+ this.successUrl = successUrl;
840
+ this.agreementsForm = agreementsForm;
841
+ this.onSave = this.nextStep.bindAsEventListener(this);
842
+ this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
843
+ },
844
+
845
+ save: function(){
846
+ if (checkout.loadWaiting!=false) return;
847
+ checkout.setLoadWaiting('review');
848
+ var params = Form.serialize(payment.form);
849
+ if (this.agreementsForm) {
850
+ params += '&'+Form.serialize(this.agreementsForm);
851
+ }
852
+ params.save = true;
853
+ var request = new Ajax.Request(
854
+ this.saveUrl,
855
+ {
856
+ method:'post',
857
+ parameters:params,
858
+ onComplete: this.onComplete,
859
+ onSuccess: this.onSave,
860
+ onFailure: checkout.ajaxFailure.bind(checkout)
861
+ }
862
+ );
863
+ },
864
+
865
+ resetLoadWaiting: function(transport){
866
+ checkout.setLoadWaiting(false, this.isSuccess);
867
+ },
868
+
869
+ nextStep: function(transport){
870
+ if (transport && transport.responseText) {
871
+ try{
872
+ response = eval('(' + transport.responseText + ')');
873
+ }
874
+ catch (e) {
875
+ response = {};
876
+ }
877
+ if (response.redirect) {
878
+ this.isSuccess = true;
879
+ location.href = response.redirect;
880
+ return;
881
+ }
882
+ if (response.success) {
883
+ this.isSuccess = true;
884
+ window.location=this.successUrl;
885
+ }
886
+ else{
887
+ var msg = response.error_messages;
888
+ if (typeof(msg)=='object') {
889
+ msg = msg.join("\n");
890
+ }
891
+ if (msg) {
892
+ alert(msg);
893
+ }
894
+ }
895
+
896
+ if (response.update_section) {
897
+ $('checkout-'+response.update_section.name+'-load').update(response.update_section.html);
898
+ }
899
+
900
+ if (response.goto_section) {
901
+ checkout.gotoSection(response.goto_section);
902
+ }
903
+ }
904
+ },
905
+
906
+ isSuccess: false
907
+ }