Version Notes
First Release
Download this release
Release Info
Developer | Chandan Kumar Singh |
Extension | Skip_shipping_method |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Chandan/Checkout/Block/Onepage.php +11 -0
- app/code/community/Chandan/Checkout/Helper/Data.php +20 -0
- app/code/community/Chandan/Checkout/Model/Adminhtml/System/Config/Source/Shipping/Methods.php +25 -0
- app/code/community/Chandan/Checkout/controllers/OnepageController - Copy.php +93 -0
- app/code/community/Chandan/Checkout/controllers/OnepageController.php +93 -0
- app/code/community/Chandan/Checkout/etc/config.xml +55 -0
- app/code/community/Chandan/Checkout/etc/system.xml +31 -0
- app/etc/modules/Chandan_Checkout.xml +9 -0
- package.xml +20 -0
app/code/community/Chandan/Checkout/Block/Onepage.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Chandan_Checkout_Block_Onepage extends Mage_Checkout_Block_Onepage
|
3 |
+
{
|
4 |
+
protected function _getStepCodes()
|
5 |
+
{
|
6 |
+
if (!Mage::helper('chandan_checkout')->getHideShipping()){
|
7 |
+
return parent::_getStepCodes();
|
8 |
+
}
|
9 |
+
return array_diff(parent::_getStepCodes(), array('shipping_method'));
|
10 |
+
}
|
11 |
+
}
|
app/code/community/Chandan/Checkout/Helper/Data.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Chandan_Checkout_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
const XML_HIDE_SHIPPING_PATH = 'checkout/options/hide_shipping';
|
5 |
+
const XML_DEFAULT_SHIPPING_PATH = 'checkout/options/default_shipping';
|
6 |
+
public function getHideShipping()
|
7 |
+
{
|
8 |
+
if (!Mage::getStoreConfigFlag(self::XML_HIDE_SHIPPING_PATH)){
|
9 |
+
return false;
|
10 |
+
}
|
11 |
+
if (!$this->getDefaultShippingMethod()){
|
12 |
+
return false;
|
13 |
+
}
|
14 |
+
return true;
|
15 |
+
}
|
16 |
+
public function getDefaultShippingMethod()
|
17 |
+
{
|
18 |
+
return Mage::getStoreConfig(self::XML_DEFAULT_SHIPPING_PATH);
|
19 |
+
}
|
20 |
+
}
|
app/code/community/Chandan/Checkout/Model/Adminhtml/System/Config/Source/Shipping/Methods.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Chandan_Checkout_Model_Adminhtml_System_Config_Source_Shipping_Methods
|
4 |
+
{
|
5 |
+
protected $_options;
|
6 |
+
|
7 |
+
public function toOptionArray()
|
8 |
+
{
|
9 |
+
$methods = Mage::getSingleton('shipping/config')->getActiveCarriers();
|
10 |
+
$shipping = array();
|
11 |
+
foreach($methods as $_ccode => $_carrier) {
|
12 |
+
if($_methods = $_carrier->getAllowedMethods()) {
|
13 |
+
if(!$_title = Mage::getStoreConfig("carriers/$_ccode/title"))
|
14 |
+
$_title = $_ccode;
|
15 |
+
foreach($_methods as $_mcode => $_method) {
|
16 |
+
$_code = $_ccode . '_' . $_mcode;
|
17 |
+
$this->_options[] = array('value'=>$_code, 'label'=>$_title);
|
18 |
+
}
|
19 |
+
}
|
20 |
+
}
|
21 |
+
$options = $this->_options;
|
22 |
+
array_unshift($options, array('value'=>'', 'label'=> ''));
|
23 |
+
return $options;
|
24 |
+
}
|
25 |
+
}
|
app/code/community/Chandan/Checkout/controllers/OnepageController - Copy.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require 'Mage/Checkout/controllers/OnepageController.php';
|
3 |
+
class Chandan_Checkout_OnepageController extends Mage_Checkout_OnepageController
|
4 |
+
{
|
5 |
+
public function saveBillingAction()
|
6 |
+
{
|
7 |
+
if (!Mage::helper('chandan_checkout')->getHideShipping()){
|
8 |
+
parent::saveBillingAction();
|
9 |
+
return;
|
10 |
+
}
|
11 |
+
|
12 |
+
if ($this->_expireAjax()) {
|
13 |
+
return;
|
14 |
+
}
|
15 |
+
if ($this->getRequest()->isPost()) {
|
16 |
+
$data = $this->getRequest()->getPost('billing', array());
|
17 |
+
$customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
|
18 |
+
|
19 |
+
if (isset($data['email'])) {
|
20 |
+
$data['email'] = trim($data['email']);
|
21 |
+
}
|
22 |
+
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);
|
23 |
+
|
24 |
+
if (!isset($result['error'])) {
|
25 |
+
/* check quote for virtual */
|
26 |
+
if ($this->getOnepage()->getQuote()->isVirtual()) {
|
27 |
+
$result['goto_section'] = 'payment';
|
28 |
+
$result['update_section'] = array(
|
29 |
+
'name' => 'payment-method',
|
30 |
+
'html' => $this->_getPaymentMethodsHtml()
|
31 |
+
);
|
32 |
+
} elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
|
33 |
+
//add default shipping method
|
34 |
+
$data = Mage::helper('chandan_checkout')->getDefaultShippingMethod();
|
35 |
+
$result = $this->getOnepage()->saveShippingMethod($data);
|
36 |
+
$this->getOnepage()->getQuote()->save();
|
37 |
+
/*
|
38 |
+
$result will have erro data if shipping method is empty
|
39 |
+
*/
|
40 |
+
if(!$result) {
|
41 |
+
Mage::dispatchEvent('checkout_controller_onepage_save_shipping_method',
|
42 |
+
array('request'=>$this->getRequest(),
|
43 |
+
'quote'=>$this->getOnepage()->getQuote()));
|
44 |
+
$this->getOnepage()->getQuote()->collectTotals();
|
45 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
46 |
+
|
47 |
+
$result['goto_section'] = 'payment';
|
48 |
+
$result['update_section'] = array(
|
49 |
+
'name' => 'payment-method',
|
50 |
+
'html' => $this->_getPaymentMethodsHtml()
|
51 |
+
);
|
52 |
+
}
|
53 |
+
|
54 |
+
|
55 |
+
$result['allow_sections'] = array('shipping');
|
56 |
+
$result['duplicateBillingInfo'] = 'true';
|
57 |
+
} else {
|
58 |
+
$result['goto_section'] = 'shipping';
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
63 |
+
}
|
64 |
+
}
|
65 |
+
public function saveShippingAction()
|
66 |
+
{
|
67 |
+
if (!Mage::helper('chandan_checkout')->getHideShipping()){
|
68 |
+
parent::saveShippingAction();
|
69 |
+
return;
|
70 |
+
}
|
71 |
+
if ($this->_expireAjax()) {
|
72 |
+
return;
|
73 |
+
}
|
74 |
+
if ($this->getRequest()->isPost()) {
|
75 |
+
$data = $this->getRequest()->getPost('shipping', array());
|
76 |
+
$customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
|
77 |
+
$result = $this->getOnepage()->saveShipping($data, $customerAddressId);
|
78 |
+
|
79 |
+
$data = Mage::helper('chandan_checkout')->getDefaultShippingMethod();
|
80 |
+
$result = $this->getOnepage()->saveShippingMethod($data);
|
81 |
+
$this->getOnepage()->getQuote()->save();
|
82 |
+
|
83 |
+
if (!isset($result['error'])) {
|
84 |
+
$result['goto_section'] = 'payment';
|
85 |
+
$result['update_section'] = array(
|
86 |
+
'name' => 'payment-method',
|
87 |
+
'html' => $this->_getPaymentMethodsHtml()
|
88 |
+
);
|
89 |
+
}
|
90 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
app/code/community/Chandan/Checkout/controllers/OnepageController.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require 'Mage/Checkout/controllers/OnepageController.php';
|
3 |
+
class Chandan_Checkout_OnepageController extends Mage_Checkout_OnepageController
|
4 |
+
{
|
5 |
+
public function saveBillingAction()
|
6 |
+
{
|
7 |
+
if (!Mage::helper('chandan_checkout')->getHideShipping()){
|
8 |
+
parent::saveBillingAction();
|
9 |
+
return;
|
10 |
+
}
|
11 |
+
|
12 |
+
if ($this->_expireAjax()) {
|
13 |
+
return;
|
14 |
+
}
|
15 |
+
if ($this->getRequest()->isPost()) {
|
16 |
+
$data = $this->getRequest()->getPost('billing', array());
|
17 |
+
$customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
|
18 |
+
|
19 |
+
if (isset($data['email'])) {
|
20 |
+
$data['email'] = trim($data['email']);
|
21 |
+
}
|
22 |
+
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);
|
23 |
+
|
24 |
+
if (!isset($result['error'])) {
|
25 |
+
/* check quote for virtual */
|
26 |
+
if ($this->getOnepage()->getQuote()->isVirtual()) {
|
27 |
+
$result['goto_section'] = 'payment';
|
28 |
+
$result['update_section'] = array(
|
29 |
+
'name' => 'payment-method',
|
30 |
+
'html' => $this->_getPaymentMethodsHtml()
|
31 |
+
);
|
32 |
+
} elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
|
33 |
+
//add default shipping method
|
34 |
+
$data = Mage::helper('chandan_checkout')->getDefaultShippingMethod();
|
35 |
+
$result = $this->getOnepage()->saveShippingMethod($data);
|
36 |
+
$this->getOnepage()->getQuote()->save();
|
37 |
+
/*
|
38 |
+
$result will have erro data if shipping method is empty
|
39 |
+
*/
|
40 |
+
if(!$result) {
|
41 |
+
Mage::dispatchEvent('checkout_controller_onepage_save_shipping_method',
|
42 |
+
array('request'=>$this->getRequest(),
|
43 |
+
'quote'=>$this->getOnepage()->getQuote()));
|
44 |
+
$this->getOnepage()->getQuote()->collectTotals();
|
45 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
46 |
+
|
47 |
+
$result['goto_section'] = 'payment';
|
48 |
+
$result['update_section'] = array(
|
49 |
+
'name' => 'payment-method',
|
50 |
+
'html' => $this->_getPaymentMethodsHtml()
|
51 |
+
);
|
52 |
+
}
|
53 |
+
|
54 |
+
|
55 |
+
$result['allow_sections'] = array('shipping');
|
56 |
+
$result['duplicateBillingInfo'] = 'true';
|
57 |
+
} else {
|
58 |
+
$result['goto_section'] = 'shipping';
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
63 |
+
}
|
64 |
+
}
|
65 |
+
public function saveShippingAction()
|
66 |
+
{
|
67 |
+
if (!Mage::helper('chandan_checkout')->getHideShipping()){
|
68 |
+
parent::saveShippingAction();
|
69 |
+
return;
|
70 |
+
}
|
71 |
+
if ($this->_expireAjax()) {
|
72 |
+
return;
|
73 |
+
}
|
74 |
+
if ($this->getRequest()->isPost()) {
|
75 |
+
$data = $this->getRequest()->getPost('shipping', array());
|
76 |
+
$customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
|
77 |
+
$result = $this->getOnepage()->saveShipping($data, $customerAddressId);
|
78 |
+
|
79 |
+
$data = Mage::helper('chandan_checkout')->getDefaultShippingMethod();
|
80 |
+
$result = $this->getOnepage()->saveShippingMethod($data);
|
81 |
+
$this->getOnepage()->getQuote()->save();
|
82 |
+
|
83 |
+
if (!isset($result['error'])) {
|
84 |
+
$result['goto_section'] = 'payment';
|
85 |
+
$result['update_section'] = array(
|
86 |
+
'name' => 'payment-method',
|
87 |
+
'html' => $this->_getPaymentMethodsHtml()
|
88 |
+
);
|
89 |
+
}
|
90 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
app/code/community/Chandan/Checkout/etc/config.xml
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Chandan_Checkout>
|
5 |
+
<version>0.0.1</version>
|
6 |
+
</Chandan_Checkout>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<blocks>
|
10 |
+
<checkout>
|
11 |
+
<rewrite>
|
12 |
+
<onepage>Chandan_Checkout_Block_Onepage</onepage>
|
13 |
+
</rewrite>
|
14 |
+
</checkout>
|
15 |
+
</blocks>
|
16 |
+
<helpers>
|
17 |
+
<chandan_checkout>
|
18 |
+
<class>Chandan_Checkout_Helper</class>
|
19 |
+
</chandan_checkout>
|
20 |
+
</helpers>
|
21 |
+
<models>
|
22 |
+
<chandan_checkout>
|
23 |
+
<class>Chandan_Checkout_Model</class>
|
24 |
+
</chandan_checkout>
|
25 |
+
</models>
|
26 |
+
</global>
|
27 |
+
<default>
|
28 |
+
<checkout>
|
29 |
+
<options>
|
30 |
+
<hide_shipping>1</hide_shipping>
|
31 |
+
<default_shipping>tablerate_bestway</default_shipping>
|
32 |
+
</options>
|
33 |
+
</checkout>
|
34 |
+
</default>
|
35 |
+
<frontend>
|
36 |
+
<routers>
|
37 |
+
<checkout>
|
38 |
+
<args>
|
39 |
+
<modules>
|
40 |
+
<Chandan_Checkout before="Mage_Checkout">Chandan_Checkout</Chandan_Checkout>
|
41 |
+
</modules>
|
42 |
+
</args>
|
43 |
+
</checkout>
|
44 |
+
</routers>
|
45 |
+
<translate>
|
46 |
+
<modules>
|
47 |
+
<Chandan_Checkout>
|
48 |
+
<files>
|
49 |
+
<default>Chandan_Checkout.csv</default>
|
50 |
+
</files>
|
51 |
+
</Chandan_Checkout>
|
52 |
+
</modules>
|
53 |
+
</translate>
|
54 |
+
</frontend>
|
55 |
+
</config>
|
app/code/community/Chandan/Checkout/etc/system.xml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<checkout>
|
5 |
+
<groups>
|
6 |
+
<options>
|
7 |
+
<fields>
|
8 |
+
<hide_shipping translate="label" module="chandan_checkout">
|
9 |
+
<label>Hide shipping method step</label>
|
10 |
+
<frontend_type>select</frontend_type>
|
11 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
12 |
+
<sort_order>100</sort_order>
|
13 |
+
<show_in_default>1</show_in_default>
|
14 |
+
<show_in_website>1</show_in_website>
|
15 |
+
<show_in_store>1</show_in_store>
|
16 |
+
</hide_shipping>
|
17 |
+
<default_shipping translate="label" module="chandan_checkout">
|
18 |
+
<label>Default shipping method code</label>
|
19 |
+
<frontend_type>select</frontend_type>
|
20 |
+
<source_model>chandan_checkout/adminhtml_system_config_source_shipping_methods</source_model>
|
21 |
+
<sort_order>110</sort_order>
|
22 |
+
<show_in_default>1</show_in_default>
|
23 |
+
<show_in_website>1</show_in_website>
|
24 |
+
<show_in_store>1</show_in_store>
|
25 |
+
</default_shipping>
|
26 |
+
</fields>
|
27 |
+
</options>
|
28 |
+
</groups>
|
29 |
+
</checkout>
|
30 |
+
</sections>
|
31 |
+
</config>
|
app/etc/modules/Chandan_Checkout.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Chandan_Checkout>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Chandan_Checkout>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Skip_shipping_method</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="https://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>The extension is easy to install and use. The order place without user fill shipping method Extension is lightweight, completes the task with minimum obstruction, and is in line with the Magento Order Management Workflow.</summary>
|
10 |
+
<description>This extension allows admin to add skip shipping method while using placing orders. The admin can set default shipping method for every user on sales order grid and this is also added to the invoice. Shipping method for Magento enables you to provide better to choosing customers by letting them write an about the order at time of checkout. The admin can view default shipping method in the form of grid listing or in the order detail page as a customer order request. 
|
11 |
+

|
12 |
+
The extension is easy to install and use. The order place without user fill shipping method Extension is lightweight, completes the task with minimum obstruction, and is in line with the Magento Order Management Workflow.</description>
|
13 |
+
<notes>First Release</notes>
|
14 |
+
<authors><author><name>Chandan Kumar Singh</name><user>chandan8050</user><email>chandankumar8050@gmail.com</email></author></authors>
|
15 |
+
<date>2016-12-19</date>
|
16 |
+
<time>06:20:28</time>
|
17 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Chandan_Checkout.xml" hash="89d58c1a5a578d839244ab6f619a4834"/></dir></target><target name="magecommunity"><dir name="Chandan"><dir name="Checkout"><dir name="Block"><file name="Onepage.php" hash="1a2a832d395a35dedfb40a56fa159556"/></dir><dir name="Helper"><file name="Data.php" hash="e4e04a136093341dc918167a96c946ac"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><dir name="Shipping"><file name="Methods.php" hash="5e3eaafe5b5e75b1545bd79f9e2b2776"/></dir></dir></dir></dir></dir></dir><dir name="controllers"><file name="OnepageController - Copy.php" hash="540700c5b9778db8d8acbf96fec1bbca"/><file name="OnepageController.php" hash="540700c5b9778db8d8acbf96fec1bbca"/></dir><dir name="etc"><file name="config.xml" hash="2ceee514c069feae832c9af22119c1a0"/><file name="system.xml" hash="a1448cf9b42868ea88ae8ff4873d9217"/></dir></dir></dir></target></contents>
|
18 |
+
<compatible/>
|
19 |
+
<dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
|
20 |
+
</package>
|