(Tried for comm. ver. 1.5.1.0)
First override following files(i.e. in local directory) rather than changing the core:
1) app/code/core/Mage/Checkout/Block/Onepage/Onepage.php
2) app/code/core/mage/checkout/controller/Onepagecontrollers.php
3) app/code/core/Mage/Sales/Model/Service/Quote.php
4) app/design/frontend/base/default/template/checkout/onepage/progress.phtml
5) app/code/core/Mage/Sales/Model/Service/Quote.php
Once done follow the below steps:
Step 1: app/code/local/Mage/Checkout/Block/Onepage/Onepage.php
Change the line:
$stepCodes = array('billing', 'shipping', 'shipping_method', 'payment', 'review');
with:
$stepCodes = array('billing', 'shipping', 'payment', 'review');
Step 2: app/code/local/Mage/Checkout/controller/Onepagecontrollers.php
Change the line:
protected $_sectionUpdateFunctions = array(
'payment-method' => '_getPaymentMethodsHtml',
'shpping-method' => '_getShippingMeghtoHtml',
'review' => '_getReviewHtml',
);
with:
protected $_sectionUpdateFunctions = array(
'payment-method' => '_getPaymentMethodsHtml',
'review' => '_getReviewHtml',
);
Step 3: app/code/local/Mage/Checkout/controller/Onepagecontrollers.php
Change saveBillingAction() function with:
public function saveBillingAction()
{
if ($this->_expireAjax()) {
return;
}
if ($this->getRequest()->isPost()) {
$postData = $this->getRequest()->getPost('billing', array());
$data = $this->_filterPostData($postData);
$data = $this->getRequest()->getPost('billing', array());
$customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
if (isset($data['email'])) {
$data['email'] = trim($data['email']);
}
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);
if (!isset($result['error'])) {
/* check quote for virtual */
if ($this->getOnepage()->getQuote()->isVirtual()) {
$result['goto_section'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
'html' => $this->_getPaymentMethodsHtml()
);
} elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
$result['goto_section'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
'html' => $this->_getPaymentMethodsHtml()
);
$result['allow_sections'] = array('shipping');
$result['duplicateBillingInfo'] = 'true';
} else {
$result['goto_section'] = 'shipping';
}
}
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
Change saveShippingAction() function with:
public function saveShippingAction()
{
if ($this->_expireAjax()) {
return;
}
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost('shipping', array());
$customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
$result = $this->getOnepage()->saveShipping($data, $customerAddressId);
if (!isset($result['error'])) {
$result['goto_section'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
'html' => $this->_getPaymentMethodsHtml()
);
}
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
Step 4: app/code/local/Mage/Sales/Model/Service/Quote.php
Change _validate() function with:
protected function _validate()
{
$helper = Mage::helper('sales');
if (!$this->getQuote()->isVirtual()) {
$address = $this->getQuote()->getShippingAddress();
$addressValidation = $address->validate();
if ($addressValidation !== true) {
Mage::throwException(
$helper->__('Please check shipping address information. %s', implode(' ', $addressValidation))
);
}
}
$addressValidation = $this->getQuote()->getBillingAddress()->validate();
if ($addressValidation !== true) {
Mage::throwException(
$helper->__('Please check billing address information. %s', implode(' ', $addressValidation))
);
}
if (!($this->getQuote()->getPayment()->getMethod())) {
Mage::throwException($helper->__('Please select a valid payment method.'));
}
return $this;
}
Step 5: app/design/frontend/default/default/template/checkout/onepage/progress.phtml
Remove the shipping method block.
Step 6: app/locale/en_US/template/email/sales/order_new.html
Remove the shipping method block(i.e. {{var order.getShippingDescription()}}).
Hope this help!
Njoy!
First override following files(i.e. in local directory) rather than changing the core:
1) app/code/core/Mage/Checkout/Block/Onepage/Onepage.php
2) app/code/core/mage/checkout/controller/Onepagecontrollers.php
3) app/code/core/Mage/Sales/Model/Service/Quote.php
4) app/design/frontend/base/default/template/checkout/onepage/progress.phtml
5) app/code/core/Mage/Sales/Model/Service/Quote.php
Once done follow the below steps:
Step 1: app/code/local/Mage/Checkout/Block/Onepage/Onepage.php
Change the line:
$stepCodes = array('billing', 'shipping', 'shipping_method', 'payment', 'review');
with:
$stepCodes = array('billing', 'shipping', 'payment', 'review');
Step 2: app/code/local/Mage/Checkout/controller/Onepagecontrollers.php
Change the line:
protected $_sectionUpdateFunctions = array(
'payment-method' => '_getPaymentMethodsHtml',
'shpping-method' => '_getShippingMeghtoHtml',
'review' => '_getReviewHtml',
);
with:
protected $_sectionUpdateFunctions = array(
'payment-method' => '_getPaymentMethodsHtml',
'review' => '_getReviewHtml',
);
Step 3: app/code/local/Mage/Checkout/controller/Onepagecontrollers.php
Change saveBillingAction() function with:
public function saveBillingAction()
{
if ($this->_expireAjax()) {
return;
}
if ($this->getRequest()->isPost()) {
$postData = $this->getRequest()->getPost('billing', array());
$data = $this->_filterPostData($postData);
$data = $this->getRequest()->getPost('billing', array());
$customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
if (isset($data['email'])) {
$data['email'] = trim($data['email']);
}
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);
if (!isset($result['error'])) {
/* check quote for virtual */
if ($this->getOnepage()->getQuote()->isVirtual()) {
$result['goto_section'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
'html' => $this->_getPaymentMethodsHtml()
);
} elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
$result['goto_section'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
'html' => $this->_getPaymentMethodsHtml()
);
$result['allow_sections'] = array('shipping');
$result['duplicateBillingInfo'] = 'true';
} else {
$result['goto_section'] = 'shipping';
}
}
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
Change saveShippingAction() function with:
public function saveShippingAction()
{
if ($this->_expireAjax()) {
return;
}
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost('shipping', array());
$customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
$result = $this->getOnepage()->saveShipping($data, $customerAddressId);
if (!isset($result['error'])) {
$result['goto_section'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
'html' => $this->_getPaymentMethodsHtml()
);
}
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
Step 4: app/code/local/Mage/Sales/Model/Service/Quote.php
Change _validate() function with:
protected function _validate()
{
$helper = Mage::helper('sales');
if (!$this->getQuote()->isVirtual()) {
$address = $this->getQuote()->getShippingAddress();
$addressValidation = $address->validate();
if ($addressValidation !== true) {
Mage::throwException(
$helper->__('Please check shipping address information. %s', implode(' ', $addressValidation))
);
}
}
$addressValidation = $this->getQuote()->getBillingAddress()->validate();
if ($addressValidation !== true) {
Mage::throwException(
$helper->__('Please check billing address information. %s', implode(' ', $addressValidation))
);
}
if (!($this->getQuote()->getPayment()->getMethod())) {
Mage::throwException($helper->__('Please select a valid payment method.'));
}
return $this;
}
Step 5: app/design/frontend/default/default/template/checkout/onepage/progress.phtml
Remove the shipping method block.
Step 6: app/locale/en_US/template/email/sales/order_new.html
Remove the shipping method block(i.e. {{var order.getShippingDescription()}}).
Hope this help!
Njoy!
thank you worked like charm :D
ReplyDeleteVery Helpful. Thanks a lot.
ReplyDeleteIt helped me alot to skip shipping method.
ReplyDeleteNot working on Magento 1.8.1.0 - I am stuck on billing address step.
ReplyDeleteHere are two issues I discovered:
1.)
The file Mage/Checkout/Block/Onepage/Onepage.php doesn't exist. I guess you are reffering to Mage/Checkout/Block/Onepage.php. However, this code "$stepCodes = array('billing', 'shipping', 'shipping_method', 'payment', 'review');" doesn't exist anywhere. Instead there is this code "$stepCodes = $this->_getStepCodes()" in Mage/Checkout/Block/Onepage.php
2.)
The file Mage/Checkout/controller/Onepagecontrollers.php doesn't exist. I guess what you are referring to is Mage/Checkout/controllers/Onepagecontrollers.php
Removing Onepage.php I can go through my checkout. With shipping method step active that is.... Altering stepCodes will result in me being stuck on billing step.
ReplyDeleteMage\Checkout\Block\Onepage\Abstract.php includes another stepcodes array. Still doesn't fix it though...
ReplyDeleteHello,
ReplyDeleteDo you have any blog to Remove/Skip Review Order step from onepage checkout in Magento.
If yes, kindly share.
Thanks in advance
i want to remove shipping_method step only... but how to pass method of shipping in checkout
ReplyDeletei want to remove shipping_method step only... but how to pass method of shipping in checkout
ReplyDeleteit is give error : please select shipping method
how to resolve
It's cool, but I already bought this extension https://www.magestyapps.com/magento-extensions/skip-checkout-steps.html Allows totally hide shipping or payment method
ReplyDeleteThanks, worked great.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteGet error every time
ReplyDeleteShipping method has not been selected yet .
Please guide