Version Notes
Stable version release for approval
Download this release
Release Info
Developer | Rajneesh Vyas |
Extension | 26e794300ae96a620bdec2bed0b7cc14 |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/Sunarc/Skipcheckout/Helper/Data.php +153 -0
- app/code/local/Sunarc/Skipcheckout/Helper/Order.php +34 -0
- app/code/local/Sunarc/Skipcheckout/Helper/Url.php +73 -0
- app/code/local/Sunarc/Skipcheckout/Model/Observer.php +114 -0
- app/code/local/Sunarc/Skipcheckout/Model/System/Config/Source/Login/Step.php +11 -0
- app/code/local/Sunarc/Skipcheckout/Model/System/Config/Source/Payment/Enabledmethods.php +22 -0
- app/code/local/Sunarc/Skipcheckout/Model/System/Config/Source/Shipping/Enabledmethods.php +21 -0
- app/code/local/Sunarc/Skipcheckout/controllers/Adminhtml/SkipcheckoutController.php +30 -0
- app/code/local/Sunarc/Skipcheckout/controllers/OnepageController.php +300 -0
- app/code/local/Sunarc/Skipcheckout/etc/adminhtml.xml +25 -0
- app/code/local/Sunarc/Skipcheckout/etc/config.xml +77 -0
- app/code/local/Sunarc/Skipcheckout/etc/system.xml +76 -0
- app/code/local/Sunarc/Skipcheckout/sql/skipcheckout_setup/install-1.0.0.php +5 -0
- app/design/frontend/base/default/layout/sunarc/skipcheckout/skipcheckout.xml +42 -0
- app/design/frontend/base/default/template/sunarc/skipcheckout/onepage.phtml +52 -0
- app/etc/modules/Sunarc_Skipcheckout.xml +8 -0
- package.xml +19 -0
app/code/local/Sunarc/Skipcheckout/Helper/Data.php
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Sunarc_Skipcheckout_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
const LOGIN_STEP_DEFAULT = 0;
|
5 |
+
const LOGIN_STEP_GUESTONLY = 1;
|
6 |
+
const LOGIN_STEP_CUSTOM = 2;
|
7 |
+
public function getPaymentMethod()
|
8 |
+
{
|
9 |
+
$value = Mage::getStoreConfig('sunarc_skipcheckout_settings/skipcheckout/default_payment');
|
10 |
+
return $value;
|
11 |
+
} // end
|
12 |
+
public function getShippingMethod()
|
13 |
+
{
|
14 |
+
$value = Mage::getStoreConfig('sunarc_skipcheckout_settings/skipcheckout/default_shipping');
|
15 |
+
return $value;
|
16 |
+
} // end
|
17 |
+
public function isLoginStepDefault()
|
18 |
+
{
|
19 |
+
return ($this->getLoginStepType() == self::LOGIN_STEP_DEFAULT);
|
20 |
+
} // end
|
21 |
+
public function isLoginStepGuestOnly()
|
22 |
+
{
|
23 |
+
return ($this->getLoginStepType() == self::LOGIN_STEP_GUESTONLY);
|
24 |
+
} // end
|
25 |
+
public function isLoginStepCustom()
|
26 |
+
{
|
27 |
+
return ($this->getLoginStepType() == self::LOGIN_STEP_CUSTOM);
|
28 |
+
} // end
|
29 |
+
protected function getLoginStepType()
|
30 |
+
{
|
31 |
+
$value = Mage::getStoreConfig('sunarc_skipcheckout_settings/skipcheckout/loginstep_type');
|
32 |
+
return $value;
|
33 |
+
} // end
|
34 |
+
public function isFix28112Enabled()
|
35 |
+
{
|
36 |
+
$value = Mage::getStoreConfig('sunarc_skipcheckout_settings/skipcheckout/enable28112fix');
|
37 |
+
return $value;
|
38 |
+
} // end
|
39 |
+
public function hideTelephoneAndFax()
|
40 |
+
{
|
41 |
+
$value = Mage::getStoreConfig('sunarc_skipcheckout_settings/skipcheckout/hide_telephone_fax');
|
42 |
+
return $value;
|
43 |
+
} // end
|
44 |
+
public function guestsCanRegisterOnOrderSuccess()
|
45 |
+
{
|
46 |
+
$value = Mage::getStoreConfig('sunarc_skipcheckout_settings/skipcheckout/register_on_order_success');
|
47 |
+
return $value;
|
48 |
+
} // end
|
49 |
+
public function getCMSBlockIdForOrderSuccessForm()
|
50 |
+
{
|
51 |
+
$value = Mage::getStoreConfig('sunarc_skipcheckout_settings/skipcheckout/register_on_order_success_cms_block');
|
52 |
+
return $value;
|
53 |
+
} // end
|
54 |
+
public function getCustomerGroupsEnabled()
|
55 |
+
{
|
56 |
+
$value = Mage::getStoreConfig('sunarc_skipcheckout_settings/skipcheckout_customergroups/customergroups_enabled');
|
57 |
+
return $value;
|
58 |
+
} // end
|
59 |
+
public function getShippingCustomerGroups()
|
60 |
+
{
|
61 |
+
if ($this->getCustomerGroupsEnabled() == 0) {
|
62 |
+
return array();
|
63 |
+
} // end
|
64 |
+
$value = Mage::getStoreConfig('sunarc_skipcheckout_settings/skipcheckout_customergroups/shipping_noskip_customergroups');
|
65 |
+
$value = explode(',', $value);
|
66 |
+
return $value;
|
67 |
+
} // end
|
68 |
+
public function getPaymentCustomerGroups()
|
69 |
+
{
|
70 |
+
if ($this->getCustomerGroupsEnabled() == 0) {
|
71 |
+
return array();
|
72 |
+
} // end
|
73 |
+
$value = Mage::getStoreConfig('sunarc_skipcheckout_settings/skipcheckout_customergroups/payment_noskip_customergroups');
|
74 |
+
$value = explode(',', $value);
|
75 |
+
return $value;
|
76 |
+
} // end
|
77 |
+
/**
|
78 |
+
* Returns the current logged in customers group.
|
79 |
+
* If the customer is not logged in return false
|
80 |
+
*
|
81 |
+
* @return boolean
|
82 |
+
*/
|
83 |
+
protected function getCurrentCustomersGroup()
|
84 |
+
{
|
85 |
+
// Check Customer is loggedin or not
|
86 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
87 |
+
// Get group Id
|
88 |
+
$groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
|
89 |
+
return $groupId;
|
90 |
+
//Get customer Group name
|
91 |
+
//$group = Mage::getModel('customer/group')->load($groupId);
|
92 |
+
//return $group->getCode();
|
93 |
+
} // end
|
94 |
+
return false;
|
95 |
+
} // end
|
96 |
+
/**
|
97 |
+
* Returns true if we should force the payment method
|
98 |
+
* @return boolean
|
99 |
+
*/
|
100 |
+
public function skipPaymentMethod()
|
101 |
+
{
|
102 |
+
$code = $this->getPaymentMethod();
|
103 |
+
$noskip_groups = $this->getPaymentCustomerGroups();
|
104 |
+
$current_group = $this->getCurrentCustomersGroup();
|
105 |
+
switch ($code) {
|
106 |
+
case "noskip":
|
107 |
+
$return = false;
|
108 |
+
break;
|
109 |
+
default:
|
110 |
+
$return = $this->skipThisSection($current_group, $noskip_groups);
|
111 |
+
break;
|
112 |
+
} // end sw
|
113 |
+
return $return;
|
114 |
+
} // end fun
|
115 |
+
/**
|
116 |
+
* Returns true if we should force the shipping method
|
117 |
+
* @return boolean
|
118 |
+
*/
|
119 |
+
public function skipShippingMethod()
|
120 |
+
{
|
121 |
+
$code = $this->getShippingMethod();
|
122 |
+
$noskip_groups = $this->getShippingCustomerGroups();
|
123 |
+
$current_group = $this->getCurrentCustomersGroup();
|
124 |
+
switch ($code) {
|
125 |
+
case "noskip":
|
126 |
+
$return = false;
|
127 |
+
break;
|
128 |
+
default:
|
129 |
+
$return = $this->skipThisSection($current_group, $noskip_groups);
|
130 |
+
break;
|
131 |
+
} // end sw
|
132 |
+
return $return;
|
133 |
+
} // end fun
|
134 |
+
/**
|
135 |
+
* Returns true if we should skip this section
|
136 |
+
*
|
137 |
+
* @param int $current_group customers group id
|
138 |
+
* @param array $noskip_groups array of groupid's
|
139 |
+
*/
|
140 |
+
private function skipThisSection($current_group, $noskip_groups)
|
141 |
+
{
|
142 |
+
// var_dump($current_group);
|
143 |
+
// var_dump($noskip_groups);
|
144 |
+
// var_dump(is_array($noskip_groups));
|
145 |
+
// var_dump(array_search($current_group, $noskip_groups));
|
146 |
+
// if we find the current users groupid in the "dont skip" array, tell checkout not to skip this section
|
147 |
+
if ($current_group !== false && is_array($noskip_groups) && array_search($current_group, $noskip_groups) > -1) {
|
148 |
+
return false;
|
149 |
+
} // end
|
150 |
+
return true;
|
151 |
+
} // end
|
152 |
+
}
|
153 |
+
|
app/code/local/Sunarc/Skipcheckout/Helper/Order.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Sunarc_Skipcheckout_Helper_Order extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* We use this during the user signup phase.
|
6 |
+
* @var string
|
7 |
+
*/
|
8 |
+
public $_session_key = 'skipcheckout_register_key';
|
9 |
+
public function getSessionKey()
|
10 |
+
{
|
11 |
+
return $this->_session_key;
|
12 |
+
} // end
|
13 |
+
public function getOrder()
|
14 |
+
{
|
15 |
+
//get the order id from the session
|
16 |
+
$session = Mage::getSingleton('checkout/session');
|
17 |
+
$lastOrderId = $session->getLastOrderId();
|
18 |
+
// load the order
|
19 |
+
$order = Mage::getSingleton('sales/order');
|
20 |
+
$order->load($lastOrderId);
|
21 |
+
return $order;
|
22 |
+
} // end
|
23 |
+
/**
|
24 |
+
*
|
25 |
+
* @return Ambigous <mixed, unknown, multitype:>
|
26 |
+
*/
|
27 |
+
public function getEmail()
|
28 |
+
{
|
29 |
+
$order = $this->getOrder();
|
30 |
+
// get the orders email address
|
31 |
+
$email = $order->getCustomerEmail();
|
32 |
+
return $email;
|
33 |
+
} // end
|
34 |
+
}
|
app/code/local/Sunarc/Skipcheckout/Helper/Url.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Sunarc_Skipcheckout_Helper_Url extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
protected $is_secure;
|
5 |
+
/**
|
6 |
+
* Returns a true/false if the current page is https or not
|
7 |
+
* @return boolean
|
8 |
+
*/
|
9 |
+
public function getIsSecure()
|
10 |
+
{
|
11 |
+
if ($this->is_secure == null) {
|
12 |
+
$this->is_secure = Mage::app()->getStore()->isCurrentlySecure();
|
13 |
+
} // end if
|
14 |
+
return $this->is_secure;
|
15 |
+
} // end
|
16 |
+
/**
|
17 |
+
*
|
18 |
+
*/
|
19 |
+
public function getProgressUrl()
|
20 |
+
{
|
21 |
+
return Mage::getUrl('skipcheckout/onepage/progress', array(
|
22 |
+
"_secure" => $this->getIsSecure()
|
23 |
+
));
|
24 |
+
} // end
|
25 |
+
public function getReviewUrl()
|
26 |
+
{
|
27 |
+
return Mage::getUrl('skipcheckout/onepage/review', array(
|
28 |
+
"_secure" => $this->getIsSecure()
|
29 |
+
));
|
30 |
+
} // end
|
31 |
+
public function getSaveMethodUrl()
|
32 |
+
{
|
33 |
+
return Mage::getUrl('skipcheckout/onepage/saveMethod', array(
|
34 |
+
"_secure" => $this->getIsSecure()
|
35 |
+
));
|
36 |
+
}
|
37 |
+
public function getFailureUrl()
|
38 |
+
{
|
39 |
+
return Mage::getUrl('checkout/cart', array(
|
40 |
+
"_secure" => $this->getIsSecure()
|
41 |
+
));
|
42 |
+
}
|
43 |
+
public function getAddressUrl()
|
44 |
+
{
|
45 |
+
return Mage::getUrl('skipcheckout/onepage/getAddress', array(
|
46 |
+
"_secure" => $this->getIsSecure()
|
47 |
+
));
|
48 |
+
} // end
|
49 |
+
public function getSaveBillingUrl()
|
50 |
+
{
|
51 |
+
return Mage::getUrl('skipcheckout/onepage/saveBilling', array(
|
52 |
+
"_secure" => $this->getIsSecure()
|
53 |
+
));
|
54 |
+
} // end
|
55 |
+
public function getSaveShippingUrl()
|
56 |
+
{
|
57 |
+
return Mage::getUrl('skipcheckout/onepage/saveShipping', array(
|
58 |
+
"_secure" => $this->getIsSecure()
|
59 |
+
));
|
60 |
+
}
|
61 |
+
public function getSaveShippingMethod()
|
62 |
+
{
|
63 |
+
return Mage::getUrl('skipcheckout/onepage/saveShippingMethod', array(
|
64 |
+
"_secure" => $this->getIsSecure()
|
65 |
+
));
|
66 |
+
}
|
67 |
+
public function getSavePaymentUrl()
|
68 |
+
{
|
69 |
+
return Mage::getUrl('skipcheckout/onepage/savePayment', array(
|
70 |
+
"_secure" => $this->getIsSecure()
|
71 |
+
));
|
72 |
+
}
|
73 |
+
} // end class
|
app/code/local/Sunarc/Skipcheckout/Model/Observer.php
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Sunarc_Skipcheckout_Model_Observer extends Mage_Core_Model_Observer
|
3 |
+
{
|
4 |
+
public function checkSkipCheckout(Varien_Event_Observer $observer)
|
5 |
+
{
|
6 |
+
// exit now if reduced checkout is not enabled or this is not checkout_onepage_index
|
7 |
+
if ($this->isSkipCheckoutEnabled() == false) {
|
8 |
+
return;
|
9 |
+
}
|
10 |
+
$handles = $observer->getEvent()->getLayout()->getUpdate()->getHandles();
|
11 |
+
$this->_update = $observer->getEvent()->getLayout()->getUpdate();
|
12 |
+
// find the handle we're looking for
|
13 |
+
if (array_search('checkout_onepage_index', $handles) == true) {
|
14 |
+
$this->_update->addHandle('sunarc_checkout_skip');
|
15 |
+
$this->_loginStepHandle();
|
16 |
+
$this->_paymentStepHandle();
|
17 |
+
$this->_shippingStepHandle();
|
18 |
+
$this->_telephoneFaxHandle();
|
19 |
+
return;
|
20 |
+
} // end
|
21 |
+
// find the handle we're looking for
|
22 |
+
if (array_search('customer_address_form', $handles) == true) {
|
23 |
+
$this->_telephoneFaxHandle();
|
24 |
+
return;
|
25 |
+
} // end
|
26 |
+
return;
|
27 |
+
} // end
|
28 |
+
/**
|
29 |
+
* Adds the handle "sunarc_checkout_skip_forceguestonly"
|
30 |
+
* @see app/design/frontend/base/default/layout/sunarc/skipcheckout/skipcheckout.xml
|
31 |
+
*/
|
32 |
+
protected function _loginStepHandle()
|
33 |
+
{
|
34 |
+
// should we remove the login step..
|
35 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn() == false && Mage::helper('sunarc_skipcheckout/data')->isLoginStepGuestOnly() == true) {
|
36 |
+
$this->getUpdate()->addHandle('sunarc_checkout_skip_forceguestonly');
|
37 |
+
} // end
|
38 |
+
} // end
|
39 |
+
/**
|
40 |
+
* Adds the Handle "sunarc_checkout_skip_skip_shippingmethod"
|
41 |
+
* @see app/design/frontend/base/default/layout/sunarc/skipcheckout/skipcheckout.xml
|
42 |
+
*/
|
43 |
+
protected function _paymentStepHandle()
|
44 |
+
{
|
45 |
+
// should we remove the payment method step..
|
46 |
+
if (Mage::helper('sunarc_skipcheckout/data')->skipShippingMethod() == true) {
|
47 |
+
$this->getUpdate()->addHandle('sunarc_checkout_skip_skip_shippingmethod');
|
48 |
+
} // end
|
49 |
+
} // end
|
50 |
+
/**
|
51 |
+
* Adds the Handle "sunarc_checkout_skip_skip_paymentmethod"
|
52 |
+
* @see app/design/frontend/base/default/layout/sunarc/skipcheckout/skipcheckout.xml
|
53 |
+
*/
|
54 |
+
protected function _shippingStepHandle()
|
55 |
+
{
|
56 |
+
// should we remove the shipping method step..
|
57 |
+
if (Mage::helper('sunarc_skipcheckout/data')->skipPaymentMethod() == true) {
|
58 |
+
$this->getUpdate()->addHandle('sunarc_checkout_skip_skip_paymentmethod');
|
59 |
+
} // end
|
60 |
+
} // end
|
61 |
+
/**
|
62 |
+
* Adds the Handle "sunarc_checkout_skip_hide_telephonefax"
|
63 |
+
* @see app/design/frontend/base/default/layout/sunarc/skipcheckout/skipcheckout.xml
|
64 |
+
*/
|
65 |
+
protected function _telephoneFaxHandle()
|
66 |
+
{
|
67 |
+
// hide the telphone input fields
|
68 |
+
// end
|
69 |
+
} // end
|
70 |
+
/**
|
71 |
+
* Returns true if the the user is not logged in and email doesn't already exist.
|
72 |
+
* @return boolean
|
73 |
+
*/
|
74 |
+
protected function _isValidGuest()
|
75 |
+
{
|
76 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn() || $this->_customerExists()) {
|
77 |
+
return false;
|
78 |
+
} // end
|
79 |
+
return true;
|
80 |
+
} // end
|
81 |
+
/**
|
82 |
+
* Returns true if the last order's email address already exists
|
83 |
+
* @return boolean
|
84 |
+
*/
|
85 |
+
protected function _customerExists()
|
86 |
+
{
|
87 |
+
$helper = Mage::helper('sunarc_skipcheckout/order');
|
88 |
+
$email = $helper->getEmail();
|
89 |
+
$customer = Mage::getSingleton('customer/customer')->setStore(Mage::app()->getStore())->loadByEmail($email);
|
90 |
+
if ($customer->getId()) {
|
91 |
+
return true;
|
92 |
+
} // end
|
93 |
+
return false;
|
94 |
+
} // end
|
95 |
+
/**
|
96 |
+
* Returns true if Reduced Checkout is Enabled in the Admin Configuration
|
97 |
+
*
|
98 |
+
* @return boolean
|
99 |
+
*/
|
100 |
+
protected function isSkipCheckoutEnabled()
|
101 |
+
{
|
102 |
+
$enabled = Mage::getStoreConfig('sunarc_skipcheckout_settings/skipcheckout/isenabled');
|
103 |
+
// return early if we're not enabled
|
104 |
+
if ($enabled != true) {
|
105 |
+
return false;
|
106 |
+
} // end
|
107 |
+
return true;
|
108 |
+
} // end
|
109 |
+
protected function getUpdate()
|
110 |
+
{
|
111 |
+
return $this->_update;
|
112 |
+
} // end
|
113 |
+
} // end
|
114 |
+
|
app/code/local/Sunarc/Skipcheckout/Model/System/Config/Source/Login/Step.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Sunarc_Skipcheckout_Model_System_Config_Source_Login_Step
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
return array(
|
7 |
+
"0" => "Default Magento login",
|
8 |
+
"1" => "Skip Magento Login"
|
9 |
+
);
|
10 |
+
} // end
|
11 |
+
}
|
app/code/local/Sunarc/Skipcheckout/Model/System/Config/Source/Payment/Enabledmethods.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Sunarc_Skipcheckout_Model_System_Config_Source_Payment_Enabledmethods
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
$active_methods = Mage::getSingleton('payment/config')->getActiveMethods();
|
7 |
+
$methods = array();
|
8 |
+
$methods['noskip'] = Mage::helper('sunarc_skipcheckout')->__("Do not skip [Default]");
|
9 |
+
foreach ($active_methods as $code => $value) {
|
10 |
+
switch ($code) {
|
11 |
+
// we can't skip this method so make sure its not added to the array
|
12 |
+
case "ccsave":
|
13 |
+
break;
|
14 |
+
default:
|
15 |
+
$label = Mage::getStoreConfig('payment/' . $code . '/title');
|
16 |
+
$methods[$code] = $label;
|
17 |
+
break;
|
18 |
+
} // end
|
19 |
+
} // end
|
20 |
+
return $methods;
|
21 |
+
} // end fun
|
22 |
+
} // end class
|
app/code/local/Sunarc/Skipcheckout/Model/System/Config/Source/Shipping/Enabledmethods.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Sunarc_Skipcheckout_Model_System_Config_Source_Shipping_Enabledmethods
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
$active_carriers = Mage::getSingleton('shipping/config')->getActiveCarriers();
|
7 |
+
$carrier_methods = array();
|
8 |
+
$carrier_methods['noskip'] = Mage::helper('sunarc_skipcheckout')->__("Do not skip [Default]");
|
9 |
+
foreach ($active_carriers as $code => $carrier) {
|
10 |
+
$label = Mage::getStoreConfig('carriers/' . $code . '/title');
|
11 |
+
$enabled = Mage::getStoreConfig('carriers/' . $code . '/active');
|
12 |
+
$methods = $carrier->getAllowedMethods();
|
13 |
+
foreach ($methods as $method_code => $method_label) {
|
14 |
+
if ($label != null && $enabled == 1) {
|
15 |
+
$carrier_methods[$code . '_' . $method_code] = $label . " [" . $method_label . "]";
|
16 |
+
} // end
|
17 |
+
}
|
18 |
+
} // end
|
19 |
+
return $carrier_methods;
|
20 |
+
} // end fun
|
21 |
+
} // end class
|
app/code/local/Sunarc/Skipcheckout/controllers/Adminhtml/SkipcheckoutController.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Sunarc_Skipcheckout_Adminhtml_SkipcheckoutController extends Mage_Adminhtml_Controller_Action
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
public function issecureenabledAction()
|
8 |
+
{
|
9 |
+
$value = Mage::getStoreConfig('web/secure/base_url', Mage::app()->getStore());
|
10 |
+
echo $value;
|
11 |
+
return;
|
12 |
+
} // end
|
13 |
+
/**
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
public function isfrontendsslAction()
|
17 |
+
{
|
18 |
+
$value = Mage::getStoreConfig('web/secure/use_in_frontend', Mage::app()->getStore());
|
19 |
+
switch ($value) {
|
20 |
+
case "1":
|
21 |
+
$value = 'Enabled';
|
22 |
+
break;
|
23 |
+
default:
|
24 |
+
$value = 'Disabled';
|
25 |
+
break;
|
26 |
+
} // end
|
27 |
+
echo $value;
|
28 |
+
return;
|
29 |
+
} // end
|
30 |
+
} // end
|
app/code/local/Sunarc/Skipcheckout/controllers/OnepageController.php
ADDED
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once "Mage/Checkout/controllers/OnepageController.php";
|
3 |
+
class Sunarc_Skipcheckout_OnepageController extends Mage_Checkout_OnepageController
|
4 |
+
{
|
5 |
+
public $layout;
|
6 |
+
protected $_helper;
|
7 |
+
/**
|
8 |
+
* (non-PHPdoc)
|
9 |
+
* @see Mage_Core_Controller_Varien_Action::_construct()
|
10 |
+
*/
|
11 |
+
public function _construct()
|
12 |
+
{
|
13 |
+
parent::_construct();
|
14 |
+
$this->_helper = Mage::helper('sunarc_skipcheckout');
|
15 |
+
} // end
|
16 |
+
/**
|
17 |
+
* (non-PHPdoc)
|
18 |
+
* @see Mage_Checkout_OnepageController::saveMethodAction()
|
19 |
+
*/
|
20 |
+
public function saveMethodAction()
|
21 |
+
{
|
22 |
+
if ($this->_expireAjax()) {
|
23 |
+
return;
|
24 |
+
} // end if
|
25 |
+
// set the checkout method
|
26 |
+
if ($this->getRequest()->isPost()) {
|
27 |
+
$method = $this->getCheckoutMethod();
|
28 |
+
$result = $this->getOnepage()->saveCheckoutMethod($method);
|
29 |
+
} // end if
|
30 |
+
} // end if
|
31 |
+
/**
|
32 |
+
* Checks the System > Configuration Setting for this extension and sets the
|
33 |
+
* CheckoutMethod as appropriate
|
34 |
+
*
|
35 |
+
* @return Ambigous <mixed, unknown>
|
36 |
+
*/
|
37 |
+
private function getCheckoutMethod()
|
38 |
+
{
|
39 |
+
switch ($this->_helper->isLoginStepGuestOnly()) {
|
40 |
+
case true:
|
41 |
+
$method = "guest";
|
42 |
+
break;
|
43 |
+
default:
|
44 |
+
$method = $this->getRequest()->getPost('method');
|
45 |
+
break;
|
46 |
+
} // end
|
47 |
+
return $method;
|
48 |
+
} /// end
|
49 |
+
/**
|
50 |
+
* (non-PHPdoc)
|
51 |
+
* @see Mage_Checkout_OnepageController::saveShippingMethodAction()
|
52 |
+
* $gotonext = false forces the method not to go to the next section and return to the calling method
|
53 |
+
*/
|
54 |
+
public function saveShippingMethodAction($gotonext = true)
|
55 |
+
{
|
56 |
+
if ($this->_expireAjax()) {
|
57 |
+
return;
|
58 |
+
} // end if
|
59 |
+
// this is the default way
|
60 |
+
$shipping = $this->getRequest()->getPost('shipping_method', '');
|
61 |
+
// override the default value if we need to
|
62 |
+
if ($this->_helper->skipShippingMethod() == true) {
|
63 |
+
$shipping = $this->_helper->getShippingMethod();
|
64 |
+
} // end if
|
65 |
+
// set the shipping method
|
66 |
+
$result = $this->getOnepage()->saveShippingMethod($shipping);
|
67 |
+
// calculations for the checkout totals
|
68 |
+
$this->getOnepage()->getQuote()->collectTotals();
|
69 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
70 |
+
$this->getOnepage()->getQuote()->collectTotals()->save();
|
71 |
+
// save shipping method event
|
72 |
+
Mage::dispatchEvent('checkout_controller_onepage_save_shipping_method', array(
|
73 |
+
'request' => $this->getRequest(),
|
74 |
+
'quote' => $this->getOnepage()->getQuote()
|
75 |
+
));
|
76 |
+
$this->getOnepage()->getQuote()->setTotalsCollectedFlag(false);
|
77 |
+
// attempt to load the next section
|
78 |
+
if ($gotonext == true) {
|
79 |
+
$result = $this->getNextSection($result, $current = 'shippingmethod');
|
80 |
+
} // end if
|
81 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
82 |
+
} // end
|
83 |
+
/**
|
84 |
+
* (non-PHPdoc)
|
85 |
+
* @see Mage_Checkout_OnepageController::savePaymentAction()
|
86 |
+
*/
|
87 |
+
public function savePaymentAction($gotonext = true)
|
88 |
+
{
|
89 |
+
if ($this->_expireAjax()) {
|
90 |
+
return;
|
91 |
+
} // end if
|
92 |
+
if (!$this->getRequest()->isPost()) {
|
93 |
+
$this->_ajaxRedirectResponse();
|
94 |
+
return;
|
95 |
+
}
|
96 |
+
// this is the default way
|
97 |
+
$data = $this->getRequest()->getPost('payment', array());
|
98 |
+
// override the default value if we need to
|
99 |
+
if ($this->_helper->skipPaymentMethod() == true) {
|
100 |
+
$payment = $this->_helper->getPaymentMethod();
|
101 |
+
$data = array(
|
102 |
+
'method' => $payment
|
103 |
+
);
|
104 |
+
} // end if
|
105 |
+
// start forming the JSON result
|
106 |
+
$result = $this->getOnepage()->savePayment($data);
|
107 |
+
// get section and redirect data
|
108 |
+
$redirectUrl = $this->getOnepage()->getQuote()->getPayment()->getCheckoutRedirectUrl();
|
109 |
+
// if the redirect URL has been set in this step then make it visibile for the entire Checkout object
|
110 |
+
if ($redirectUrl) {
|
111 |
+
$this->getOnepage()->getCheckout()->setRedirectUrl($redirectUrl);
|
112 |
+
}
|
113 |
+
// attempt to load the next section
|
114 |
+
if ($gotonext == true) {
|
115 |
+
$result = $this->getNextSection($result, $current = 'payment');
|
116 |
+
} // end if
|
117 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
118 |
+
} // end
|
119 |
+
/**
|
120 |
+
* (non-PHPdoc)
|
121 |
+
* @see Mage_Checkout_OnepageController::saveShippingAction()
|
122 |
+
*/
|
123 |
+
public function saveShippingAction($gotonext = true)
|
124 |
+
{
|
125 |
+
if ($this->_expireAjax()) {
|
126 |
+
return;
|
127 |
+
}
|
128 |
+
if ($this->getRequest()->isPost()) {
|
129 |
+
$data = $this->getRequest()->getPost('shipping', array());
|
130 |
+
$customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
|
131 |
+
// save the billing address info
|
132 |
+
$result = $this->getOnepage()->saveShipping($data, $customerAddressId);
|
133 |
+
} // end
|
134 |
+
// attempt to load the next section
|
135 |
+
if ($gotonext == true) {
|
136 |
+
$result = $this->getNextSection($result, $current = 'billing');
|
137 |
+
} // end if
|
138 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
139 |
+
} // end
|
140 |
+
/**
|
141 |
+
* (non-PHPdoc)
|
142 |
+
* @see Mage_Checkout_OnepageController::saveBillingAction()
|
143 |
+
*/
|
144 |
+
public function saveBillingAction()
|
145 |
+
{
|
146 |
+
if ($this->_expireAjax()) {
|
147 |
+
return;
|
148 |
+
}
|
149 |
+
if ($this->getRequest()->isPost()) {
|
150 |
+
if ($this->_helper->isLoginStepGuestOnly() == true) {
|
151 |
+
// set the checkout method
|
152 |
+
$this->saveMethodAction();
|
153 |
+
} // end if
|
154 |
+
$data = $this->getRequest()->getPost('billing', array());
|
155 |
+
$customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
|
156 |
+
if (isset($data['email'])) {
|
157 |
+
$data['email'] = trim($data['email']);
|
158 |
+
} // end if
|
159 |
+
// save the billing address info
|
160 |
+
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);
|
161 |
+
// render the onepage review
|
162 |
+
if (!isset($result['error'])) {
|
163 |
+
/* check quote for virtual */
|
164 |
+
if ($this->getOnepage()->getQuote()->isVirtual()) {
|
165 |
+
// find out which section we should go to next
|
166 |
+
$result = $this->getNextSection($result, $current = 'billing');
|
167 |
+
} elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
|
168 |
+
// find out which section we should go to next
|
169 |
+
$result = $this->getNextSection($result, $current = 'billing');
|
170 |
+
$result['duplicateBillingInfo'] = 'true';
|
171 |
+
} else {
|
172 |
+
// go to the shipping section
|
173 |
+
$result['goto_section'] = 'shipping';
|
174 |
+
} // end if
|
175 |
+
} // end
|
176 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
177 |
+
}
|
178 |
+
} // end
|
179 |
+
/**
|
180 |
+
* (non-PHPdoc)
|
181 |
+
* @see Mage_Checkout_OnepageController::_getReviewHtml()
|
182 |
+
*/
|
183 |
+
protected function _getReviewHtml()
|
184 |
+
{
|
185 |
+
$layout = $this->getLayout();
|
186 |
+
$update = $layout->getUpdate();
|
187 |
+
$update->merge('checkout_onepage_review');
|
188 |
+
$layout->generateXml();
|
189 |
+
$layout->generateBlocks();
|
190 |
+
$output = $layout->getBlock('root')->toHtml();
|
191 |
+
return $output;
|
192 |
+
} // end
|
193 |
+
/**
|
194 |
+
* (non-PHPdoc)
|
195 |
+
* @see Mage_Checkout_OnepageController::progressAction()
|
196 |
+
*/
|
197 |
+
public function progressAction()
|
198 |
+
{
|
199 |
+
$version_array = Mage::getVersionInfo();
|
200 |
+
// Quick fix Magento 1.8 and pre 1.8 have different methods to generate the right hand progress bar.
|
201 |
+
if ($version_array['major'] == 1 && $version_array['minor'] < 8) {
|
202 |
+
return $this->preV8ProgressAction();
|
203 |
+
} // end
|
204 |
+
return parent::progressAction();
|
205 |
+
} // end
|
206 |
+
/**
|
207 |
+
* Quick fix Magento 1.8 and pre 1.8 have different methods to generate the right hand progress bar.
|
208 |
+
* This method runs if magento 1.7 or older is being used.
|
209 |
+
* @return string
|
210 |
+
*/
|
211 |
+
protected function preV8ProgressAction()
|
212 |
+
{
|
213 |
+
$layout = $this->getLayout();
|
214 |
+
$update = $layout->getUpdate();
|
215 |
+
$update->load('checkout_onepage_progress');
|
216 |
+
$layout->generateXml();
|
217 |
+
$layout->generateBlocks();
|
218 |
+
$output = $layout->getOutput();
|
219 |
+
$this->renderLayout();
|
220 |
+
} // end
|
221 |
+
/**
|
222 |
+
* Returns html for the next step to display depending on logic set in the System > Configuration
|
223 |
+
*
|
224 |
+
* @param array $result
|
225 |
+
* @param string $current Current step code
|
226 |
+
* @return multitype:string html <string, unknown>
|
227 |
+
*/
|
228 |
+
private function getNextSection($result, $current)
|
229 |
+
{
|
230 |
+
// set the shipping method
|
231 |
+
if ($this->_helper->skipShippingMethod() == true) {
|
232 |
+
$this->saveShippingMethodAction($gotonext = false);
|
233 |
+
} // end
|
234 |
+
// set the payment method
|
235 |
+
if ($this->_helper->skipPaymentMethod() == true) {
|
236 |
+
$this->savePaymentAction($gotonext = false);
|
237 |
+
} // end if
|
238 |
+
switch ($current) {
|
239 |
+
case "billing":
|
240 |
+
if ($this->_helper->skipShippingMethod() == true && $this->_helper->skipPaymentMethod() == true) {
|
241 |
+
$result['goto_section'] = 'review';
|
242 |
+
$result['allow_sections'] = array(
|
243 |
+
'review'
|
244 |
+
);
|
245 |
+
$result['update_section'] = array(
|
246 |
+
'name' => 'review',
|
247 |
+
'html' => $this->_getReviewHtml()
|
248 |
+
);
|
249 |
+
} elseif ($this->_helper->skipShippingMethod() == true && $this->_helper->skipPaymentMethod() == false) {
|
250 |
+
$result['goto_section'] = 'payment';
|
251 |
+
$result['allow_sections'] = array(
|
252 |
+
'payment'
|
253 |
+
);
|
254 |
+
$result['update_section'] = array(
|
255 |
+
'name' => 'payment-method',
|
256 |
+
'html' => $this->_getPaymentMethodsHtml()
|
257 |
+
);
|
258 |
+
} elseif ($this->_helper->skipShippingMethod() == false) {
|
259 |
+
$result['goto_section'] = 'shipping_method';
|
260 |
+
$result['allow_sections'] = array(
|
261 |
+
'shipping'
|
262 |
+
);
|
263 |
+
$result['update_section'] = array(
|
264 |
+
'name' => 'shipping-method',
|
265 |
+
'html' => $this->_getShippingMethodsHtml()
|
266 |
+
);
|
267 |
+
} // end
|
268 |
+
break;
|
269 |
+
case "shippingmethod":
|
270 |
+
if ($this->_helper->skipPaymentMethod() == true) {
|
271 |
+
$result['goto_section'] = 'review';
|
272 |
+
$result['allow_sections'] = array(
|
273 |
+
'review'
|
274 |
+
);
|
275 |
+
$result['update_section'] = array(
|
276 |
+
'name' => 'review',
|
277 |
+
'html' => $this->_getReviewHtml()
|
278 |
+
);
|
279 |
+
} elseif ($this->_helper->skipPaymentMethod() == false) {
|
280 |
+
$result['goto_section'] = 'payment';
|
281 |
+
$result['allow_sections'] = array(
|
282 |
+
'payment'
|
283 |
+
);
|
284 |
+
$result['update_section'] = array(
|
285 |
+
'name' => 'payment-method',
|
286 |
+
'html' => $this->_getPaymentMethodsHtml()
|
287 |
+
);
|
288 |
+
} // end
|
289 |
+
break;
|
290 |
+
case "payment":
|
291 |
+
$result['goto_section'] = 'review';
|
292 |
+
$result['update_section'] = array(
|
293 |
+
'name' => 'review',
|
294 |
+
'html' => $this->_getReviewHtml()
|
295 |
+
);
|
296 |
+
break;
|
297 |
+
} // end sw
|
298 |
+
return $result;
|
299 |
+
} // end
|
300 |
+
} // end class
|
app/code/local/Sunarc/Skipcheckout/etc/adminhtml.xml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<all>
|
6 |
+
<title>Allow Everything</title>
|
7 |
+
</all>
|
8 |
+
<admin>
|
9 |
+
<children>
|
10 |
+
<system>
|
11 |
+
<children>
|
12 |
+
<config>
|
13 |
+
<children>
|
14 |
+
<sunarc_skipcheckout_settings>
|
15 |
+
<title>Sunarc SkipCheckout Section</title>
|
16 |
+
</sunarc_skipcheckout_settings>
|
17 |
+
</children>
|
18 |
+
</config>
|
19 |
+
</children>
|
20 |
+
</system>
|
21 |
+
</children>
|
22 |
+
</admin>
|
23 |
+
</resources>
|
24 |
+
</acl>
|
25 |
+
</config>
|
app/code/local/Sunarc/Skipcheckout/etc/config.xml
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Sunarc_Skipcheckout>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</Sunarc_Skipcheckout>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<blocks>
|
10 |
+
<sunarc_skipcheckout>
|
11 |
+
<class>Sunarc_Skipcheckout_Block</class>
|
12 |
+
</sunarc_skipcheckout>
|
13 |
+
</blocks>
|
14 |
+
<models>
|
15 |
+
<sunarc_skipcheckout>
|
16 |
+
<class>Sunarc_Skipcheckout_Model</class>
|
17 |
+
</sunarc_skipcheckout>
|
18 |
+
</models>
|
19 |
+
<helpers>
|
20 |
+
<sunarc_skipcheckout>
|
21 |
+
<class>Sunarc_Skipcheckout_Helper</class>
|
22 |
+
</sunarc_skipcheckout>
|
23 |
+
</helpers>
|
24 |
+
<events>
|
25 |
+
<controller_action_layout_load_before>
|
26 |
+
<observers>
|
27 |
+
<checkSkipCheckout>
|
28 |
+
<class>Sunarc_Skipcheckout_Model_Observer</class>
|
29 |
+
<method>checkSkipCheckout</method>
|
30 |
+
</checkSkipCheckout>
|
31 |
+
</observers>
|
32 |
+
</controller_action_layout_load_before>
|
33 |
+
</events>
|
34 |
+
</global>
|
35 |
+
<admin>
|
36 |
+
<routers>
|
37 |
+
<adminhtml>
|
38 |
+
<args>
|
39 |
+
<modules>
|
40 |
+
<sunarc_skipcheckout before="Mage_Adminhtml">Sunarc_Skipcheckout_Adminhtml</sunarc_skipcheckout>
|
41 |
+
</modules>
|
42 |
+
</args>
|
43 |
+
</adminhtml>
|
44 |
+
</routers>
|
45 |
+
</admin>
|
46 |
+
<adminhtml>
|
47 |
+
<layout>
|
48 |
+
<updates>
|
49 |
+
<sunarc_skipcheckout>
|
50 |
+
<file>sunarc/skipcheckout.xml</file>
|
51 |
+
</sunarc_skipcheckout>
|
52 |
+
</updates>
|
53 |
+
</layout>
|
54 |
+
</adminhtml>
|
55 |
+
<frontend>
|
56 |
+
<routers>
|
57 |
+
<!-- Sets up the frontend URL we need to hit to run code, needs to be a unique handle (use the extension name a prefix?)-->
|
58 |
+
<sunarc_skipcheckout>
|
59 |
+
<use>standard</use>
|
60 |
+
<args>
|
61 |
+
<module>Sunarc_Skipcheckout</module>
|
62 |
+
<frontName>skipcheckout</frontName>
|
63 |
+
</args>
|
64 |
+
</sunarc_skipcheckout>
|
65 |
+
</routers>
|
66 |
+
<default>
|
67 |
+
<router>skipcheckout</router>
|
68 |
+
</default>
|
69 |
+
<layout>
|
70 |
+
<updates>
|
71 |
+
<sunarc_skipcheckout>
|
72 |
+
<file>sunarc/skipcheckout/skipcheckout.xml</file>
|
73 |
+
</sunarc_skipcheckout>
|
74 |
+
</updates>
|
75 |
+
</layout>
|
76 |
+
</frontend>
|
77 |
+
</config>
|
app/code/local/Sunarc/Skipcheckout/etc/system.xml
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<sunarc translate="label">
|
5 |
+
<label>Sunarc</label>
|
6 |
+
<sort_order>1</sort_order>
|
7 |
+
</sunarc>
|
8 |
+
</tabs>
|
9 |
+
<!-- Admin right side -->
|
10 |
+
<sections>
|
11 |
+
<sunarc_skipcheckout_settings>
|
12 |
+
<label>Customize Checkout Steps</label>
|
13 |
+
<tab>sunarc</tab>
|
14 |
+
<frontend_type>text</frontend_type>
|
15 |
+
<sort_order>1020</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>1</show_in_store>
|
19 |
+
<groups>
|
20 |
+
<skipcheckout>
|
21 |
+
<label>Customize Checkout Settings </label>
|
22 |
+
<frontend_type>text</frontend_type>
|
23 |
+
<sort_order>20</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 |
+
<expanded>1</expanded>
|
28 |
+
<fields>
|
29 |
+
<isenabled>
|
30 |
+
<label>Enable Customize Checkout Steps</label>
|
31 |
+
<frontend_type>select</frontend_type>
|
32 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
33 |
+
<comment>Enable Customize Checkout Steps functionality</comment>
|
34 |
+
<sort_order>10</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
</isenabled>
|
39 |
+
<loginstep_type>
|
40 |
+
<label>Customer Login</label>
|
41 |
+
<frontend_type>select</frontend_type>
|
42 |
+
<source_model>sunarc_skipcheckout/system_config_source_login_step</source_model>
|
43 |
+
<comment></comment>
|
44 |
+
<sort_order>20</sort_order>
|
45 |
+
<show_in_default>1</show_in_default>
|
46 |
+
<show_in_website>1</show_in_website>
|
47 |
+
<show_in_store>1</show_in_store>
|
48 |
+
</loginstep_type>
|
49 |
+
<!-- Dropdown menu -->
|
50 |
+
<default_shipping>
|
51 |
+
<label>Shipping Method</label>
|
52 |
+
<frontend_type>select</frontend_type>
|
53 |
+
<source_model>sunarc_skipcheckout/system_config_source_shipping_enabledmethods</source_model>
|
54 |
+
<comment>The option for the default shipping method</comment>
|
55 |
+
<sort_order>30</sort_order>
|
56 |
+
<show_in_default>1</show_in_default>
|
57 |
+
<show_in_website>1</show_in_website>
|
58 |
+
<show_in_store>1</show_in_store>
|
59 |
+
</default_shipping>
|
60 |
+
<default_payment>
|
61 |
+
<!-- Dropdown menu -->
|
62 |
+
<label>Payment Method</label>
|
63 |
+
<frontend_type>select</frontend_type>
|
64 |
+
<source_model>sunarc_skipcheckout/system_config_source_payment_enabledmethods</source_model>
|
65 |
+
<comment>The option for the default payment method</comment>
|
66 |
+
<sort_order>40</sort_order>
|
67 |
+
<show_in_default>1</show_in_default>
|
68 |
+
<show_in_website>1</show_in_website>
|
69 |
+
<show_in_store>1</show_in_store>
|
70 |
+
</default_payment>
|
71 |
+
</fields>
|
72 |
+
</skipcheckout>
|
73 |
+
</groups>
|
74 |
+
</sunarc_skipcheckout_settings>
|
75 |
+
</sections>
|
76 |
+
</config>
|
app/code/local/Sunarc/Skipcheckout/sql/skipcheckout_setup/install-1.0.0.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer = $this;
|
3 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->endSetup();
|
app/design/frontend/base/default/layout/sunarc/skipcheckout/skipcheckout.xml
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
|
4 |
+
<sunarc_checkout_skip>
|
5 |
+
<reference name="content">
|
6 |
+
<block type="checkout/onepage" name="checkout.onepage.reduced.setup" template="sunarc/skipcheckout/onepage.phtml" />
|
7 |
+
</reference>
|
8 |
+
</sunarc_checkout_skip>
|
9 |
+
|
10 |
+
<sunarc_checkout_skip_forceguestonly>
|
11 |
+
|
12 |
+
<reference name="content">
|
13 |
+
<reference name="checkout.onepage">
|
14 |
+
<remove name="checkout.onepage.login" />
|
15 |
+
</reference>
|
16 |
+
</reference>
|
17 |
+
|
18 |
+
</sunarc_checkout_skip_forceguestonly>
|
19 |
+
|
20 |
+
<sunarc_checkout_skip_skip_paymentmethod>
|
21 |
+
|
22 |
+
<reference name="content">
|
23 |
+
<reference name="checkout.onepage">
|
24 |
+
<remove name="checkout.onepage.payment" />
|
25 |
+
</reference>
|
26 |
+
</reference>
|
27 |
+
|
28 |
+
</sunarc_checkout_skip_skip_paymentmethod>
|
29 |
+
|
30 |
+
<sunarc_checkout_skip_skip_shippingmethod>
|
31 |
+
|
32 |
+
<reference name="content">
|
33 |
+
<reference name="checkout.onepage">
|
34 |
+
<remove name="checkout.onepage.shipping_method" />
|
35 |
+
</reference>
|
36 |
+
</reference>
|
37 |
+
|
38 |
+
</sunarc_checkout_skip_skip_shippingmethod>
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
</layout>
|
app/design/frontend/base/default/template/sunarc/skipcheckout/onepage.phtml
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="multiple-checkout">
|
2 |
+
<span></span>
|
3 |
+
</div>
|
4 |
+
|
5 |
+
<input type="hidden" name="suite_ms_payment_method" id="suite_ms_payment_method" value="<?php echo Mage::helper('sunarc_skipcheckout')->getPaymentMethod(); ?>" />
|
6 |
+
<?php /* -- END SAGEPAY INTEGRATION -- */ ?>
|
7 |
+
|
8 |
+
|
9 |
+
<!-- REQUIRED -->
|
10 |
+
<form action="" id="co-payment-form">
|
11 |
+
<fieldset>
|
12 |
+
<input name="payment[method]" type="hidden" value="<?php echo Mage::helper('sunarc_skipcheckout')->getPaymentMethod(); ?>" checked="checked" />
|
13 |
+
<span id="payment-buttons-container"></span>
|
14 |
+
</fieldset>
|
15 |
+
</form>
|
16 |
+
|
17 |
+
<!-- Sunarc_Skipcheckout V<?php echo Mage::getConfig()->getNode()->modules->Sunarc_Skipcheckout->version; ?> -->
|
18 |
+
|
19 |
+
<script type="text/javascript">
|
20 |
+
//<![CDATA[
|
21 |
+
|
22 |
+
<?php // get an instance of the URL helper class
|
23 |
+
$url_helper = $this->helper('sunarc_skipcheckout/url');
|
24 |
+
?>
|
25 |
+
|
26 |
+
|
27 |
+
var checkout = new Checkout(accordion,{
|
28 |
+
progress: '<?php echo $url_helper->getProgressUrl(); ?>',
|
29 |
+
review: '<?php echo $url_helper->getReviewUrl(); ?>',
|
30 |
+
saveMethod: '<?php echo $url_helper->getSaveMethodUrl(); ?>',
|
31 |
+
failure: '<?php echo $url_helper->getFailureUrl(); ?>'}
|
32 |
+
);
|
33 |
+
|
34 |
+
var billing = new Billing('co-billing-form', '<?php echo $url_helper->getAddressUrl(); ?>address/', '<?php echo $url_helper->getSaveBillingUrl(); ?>');
|
35 |
+
var shipping = new Shipping('co-shipping-form', '<?php echo $url_helper->getAddressUrl(); ?>address/', '<?php echo $url_helper->getSaveShippingUrl(); ?>','<?php echo $url_helper->getSaveShippingMethod(); ?>');
|
36 |
+
var shippingMethod = new ShippingMethod('co-shipping-method-form', "<?php echo $this->getUrl('skipcheckout/onepage/saveShippingMethod', array("_secure"=>true)) ?>");
|
37 |
+
var payment = new Payment('co-payment-form', '<?php echo $url_helper->getSavePaymentUrl(); ?>');
|
38 |
+
|
39 |
+
<?php
|
40 |
+
// this is to enable forced guest checkout
|
41 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn() == false &&
|
42 |
+
$this->helper('sunarc_skipcheckout/data')->isLoginStepGuestOnly() == true
|
43 |
+
) {
|
44 |
+
?>
|
45 |
+
Element.hide('register-customer-password');
|
46 |
+
checkout.gotoSection('billing');
|
47 |
+
<?php
|
48 |
+
} // end if
|
49 |
+
?>
|
50 |
+
|
51 |
+
//]]>
|
52 |
+
</script>
|
app/etc/modules/Sunarc_Skipcheckout.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<modules>
|
3 |
+
<Sunarc_Skipcheckout>
|
4 |
+
<active>true</active>
|
5 |
+
<codePool>local</codePool>
|
6 |
+
</Sunarc_Skipcheckout>
|
7 |
+
</modules>
|
8 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>26e794300ae96a620bdec2bed0b7cc14</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Allows customizing checkout process by skipping any of login page, shipping or payment methods.</summary>
|
10 |
+
<description>Allows to customize the checkout process by skipping login, shipping or payment methods helping to reduce the checkout steps enabling faster checkout.
|
11 |
+
You can skip any of the option or all the options altogether just through simple admin interface with enable/disable options.</description>
|
12 |
+
<notes>Stable version release for approval</notes>
|
13 |
+
<authors><author><name>Rajneesh Vyas</name><user>sunarcmagento</user><email>rajneesh.vyas@sunarctechnologies.com</email></author></authors>
|
14 |
+
<date>2016-08-13</date>
|
15 |
+
<time>11:47:43</time>
|
16 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Sunarc_Skipcheckout.xml" hash="ca3dc5ba98d4e5b5bdb8f9f69aba8f97"/></dir></target><target name="magelocal"><dir name="Sunarc"><dir name="Skipcheckout"><dir name="Helper"><file name="Data.php" hash="1d0ec141f1aa1ce195f168f8d670e8b7"/><file name="Order.php" hash="72c4d1d2e4fee3bebde5dd25e7cd3449"/><file name="Url.php" hash="1e7b356fadffc0e0b69e8927b985477c"/></dir><dir name="Model"><file name="Observer.php" hash="2030076ab2123da626b30ded1630753c"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Login"><file name="Step.php" hash="171392b9c4174b259108a06dc7361d18"/></dir><dir name="Payment"><file name="Enabledmethods.php" hash="21b376b14c7dc9800052d587558d3b93"/></dir><dir name="Shipping"><file name="Enabledmethods.php" hash="a0ab79c3cc262296cbd2362c29990aeb"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="SkipcheckoutController.php" hash="8eb53f0c88a8d4aaabd5e0c8c5e8de98"/></dir><file name="OnepageController.php" hash="81ec3a9b87c0a1e326ca401b5f99c724"/></dir><dir name="etc"><file name="adminhtml.xml" hash="d12e851fdea4fe3abe3039d488a45613"/><file name="config.xml" hash="17dbdc514b6ddf9da373c1e6ed1bf7b7"/><file name="system.xml" hash="ebdcd8c699b8402a971f78e251c3ab75"/></dir><dir name="sql"><dir name="skipcheckout_setup"><file name="install-1.0.0.php" hash="d4f7ea9ca2cb7d23d643ac5c0fd1d4f2"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="sunarc"><dir name="skipcheckout"><file name="onepage.phtml" hash="b1d8d4bc4565fb182eec7cd7341d6cea"/></dir></dir></dir><dir name="layout"><dir name="sunarc"><dir name="skipcheckout"><file name="skipcheckout.xml" hash="28fd6d6feed70788be149ab7e35ce29e"/></dir></dir></dir></dir></dir></dir></target></contents>
|
17 |
+
<compatible/>
|
18 |
+
<dependencies><required><php><min>5.3.0</min><max>5.6.19</max></php></required></dependencies>
|
19 |
+
</package>
|