Downloads

Downloads

To download support materials, please select your product from the list below. You will automatically be shown all downloads for that product, including extensions, brochures, sales presenters and technotes.

  • 1. Select your section, category and chosen product.
  • 2. Click on the Manual, brochure, sales presenter or technote of your choice.
  • 3. Take careful note of any applicable instructions, especially for extensions.
  • 4. Download the file to your hard drive.
Knowledge Base

Knowledge Base

Skip Order Review step on Onepage Checkout

Date Created: 21 Apr 2016
Last Updated: 14 Dec 2018

Now and then, shop owners just want their customers be able to process orders as fast as possible and omit some unnecessary, annoying and time-consuming steps. This topic demonstrates some solutions to omit Order Review step at Checkout page in Magento.

First of all, we need to rewrite  _getStepCodes() function configured in Mage_Checkout_Block_Onepage.Actually, this function is located in Mage_Checkout_Block_Onepage_Abstract but we can not rewrite Abstract class, so just put it directly in extending class from Mage_Checkout_Block_Onepage
 
protected function _getStepCodes()
    {
        if ($this->getQuote()->isVirtual()) {
                return array('login', 'billing', 'payment');
        }
        return array('login', 'billing', 'shipping', 'shipping_method', 'payment');
    }

On Onpage Checkout, once customers fill in all payment information and move to the next step, we can force this event to save Order and move to Checkout success page by using Event Observer. The Event which needs to be configured here is controller_action_postdispatch_checkout_onepage_savePayment.

config.xml file of the module will be as following:

<events>
      <controller_action_postdispatch_checkout_onepage_savePayment>
        <observers>
          <controller_action_postdispatch_checkout_onepage_savePayment_handler>
            <type>model</type>
            <class>skiporderreview/observer</class>
            <method>saveOrder</method>
            <args></args>
          </controller_action_postdispatch_checkout_onepage_savePayment_handler>
        </observers>
      </controller_action_postdispatch_checkout_onepage_savePayment>
    </events>

Observer model File has saveOrder()  function as following:

public function saveOrder(Varien_Event_Observer $observer)
    {
        $controllerAction = $observer->getEvent()->getControllerAction();
        $response = $controllerAction->getResponse();
        $paymentResponse = Mage::helper('core')->jsonDecode($response->getBody());
        if (!isset($paymentResponse['error']) || !$paymentResponse['error']) {
            $controllerAction->getRequest()->setParam('form_key', Mage::getSingleton('core/session')->getFormKey());
            $controllerAction->getRequest()->setPost('agreement', array_flip(Mage::helper('checkout')->getRequiredAgreementIds()));
            $controllerAction->saveOrderAction();
            $orderResponse = Mage::helper('core')->jsonDecode($response->getBody());
            if ($orderResponse['error'] === false && $orderResponse['success'] === true) {
                if (!isset($orderResponse['redirect']) || !$orderResponse['redirect']) {
                        $orderResponse['redirect'] = Mage::getUrl('*/*/success');
                }
                $controllerAction->getResponse()->setBody(Mage::helper('core')->jsonEncode($orderResponse));
            }
        }
    }
 

 

When customers finish Payment step, the next step will directly move to Checkout success Page. 

Support Enquiry

Support Enquiry

If you have a question or require technical support for a Magespacex hosting or extensions you have purchased, please fill out the form below and a member of our support team will contact you shortly.

  • * Required Fields

Warranty