How to remove steps from the Magento Onepage checkout?
-
16-10-2019 - |
Question
I'm using CE 1.7 and I am currently trying to remove the shipping, shipping method, and payment steps from Onepage checkout. I already removed the steps from local\mage\checkout\block\onepage\abstract.php
. My issue comes when trying to progress from billing information to review when i click continue it loads the loading next step image than sits still. Any ideas would be much appreciated.
Solution
Try to rewrite below block files with following functions:
Rewrite class Mage_Checkout_Block_Onepage_Billing
public function canShip()
{
return false;
}
Rewrite class Mage_Checkout_Block_Onepage_Shipping_Method
public function isShow()
{
return false;
}
Rewrite class Mage_Checkout_Block_Onepage_Shipping
public function isShow()
{
return false;
}
I hope now issue related to progress will not occurs.
OTHER TIPS
A little old but have a look here:
Remove login http://excellencemagentoblog.com/magento-onestep-checkout-remove-login-step
Remove payment + shipping http://excellencemagentoblog.com/magento-onestep-checkout-remove-payment-and-shipping-method-step
remove payment http://excellencemagentoblog.com/magento-onestep-checkout-remove-payment-method-step
remove shipping http://excellencemagentoblog.com/magento-onestep-checkout-remove-shipping-method-step
Add step http://excellencemagentoblog.com/magento-onestep-checkout-add-step
@heaven7 I changed these bits in the OnepageController.php overall i did more than manipulate this but i will list my code so you can see what I changed exactly. Just remember to do this in only a local copy and not in the core folder.
`protected $_sectionUpdateFunctions = array(
/* 'payment-method' => '_getPaymentMethodsHtml',
'shipping-method' => '_getShippingMethodsHtml',*/
'review' => '_getReviewHtml',
); public function saveBillingAction()
{
if ($this->_expireAjax()){
return;
}
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost('billing', array());
$customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);
// if (!isset($result['error'])) {
// if ($this->getOnepage()->getQuote()->isVirtual()) {
$this->loadLayout('checkout_onepage_review');
$result['goto_section'] = 'review';
$result['update_section'] = array(
'name' => 'review',
'html' => $this->_getReviewHtml()
);
}
/*elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
$this->saveShippingMethodAction();
$this->loadLayout('checkout_onepage_review');
$result['goto_section'] = 'review';
$result['update_section'] = array(
'name' => 'review',
'html' => $this->_getReviewHtml()
);
$result['allow_sections'] = array('shipping','review');
$result['duplicateBillingInfo'] = 'true';
}*/
/* else {
//$result['goto_section'] = 'shipping';
//TODO There is an error with loading the layout of the Review tab.
$result['goto_section'] = 'review';
}*/
// }
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
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'])) {
$this->saveShippingMethodAction();
$this->loadLayout('checkout_onepage_review');
$result['goto_section'] = 'review';
$result['update_section'] = array(
'name' => 'review',
'html' => $this->_getReviewHtml()
);
}
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
public function saveShippingMethodAction()
{
if ($this->_expireAjax()) {
return;
}
if ($this->getRequest()->isPost()) {
$data = $this->getRequest()->getPost('shipping_method', '');
$result = $this->getOnepage()->saveShippingMethod($data);
/*
$result will have erro data if shipping method is empty
*/
if(!$result) {
Mage::dispatchEvent('checkout_controller_onepage_save_shipping_method',
array('request'=>$this->getRequest(),
'quote'=>$this->getOnepage()->getQuote()));
$this->getOnepage()->getQuote()->collectTotals();
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
$result['goto_section'] = 'review';
$result['update_section'] = array(
'name' => 'review',
'html' => $this->_getReviewHtml()
);
}
$this->getOnepage()->getQuote()->collectTotals()->save();
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
please follow this link
http://sapnandu-magento.blogspot.in/2012/04/magento-onestep-checkout-remove.html
or
http://knowledgevalley.blogspot.in/2012/01/magento-skip-shipping-method-from.html
it may help you