cancel
Showing results for 
Search instead for 
Did you mean: 

change order in checkout steps

change order in checkout steps

I need to make a change to the checkout page in Magento.

by default the steps are:

-Billing -Shipping Address -Shipping Method -Payment Method -Review

And now I need to have the steps like:

-Billing -Shipping Address -Shipping Method -Review -Payment Method

Right now I managed to have the "look" of it. So that I have the structure that I want, but now I need to make changes to the javascript file opcheckout.js

(To explain better my problem: right now it goes by the steps 1, 2, 3, 5, 4)

I've tried to look at the js file and changing it like this:

Checkout.prototype = {initialize: function(accordion, urls){
  [...]
    this.payment = '';
    this.loadWaiting = false;
    this.steps = ['login', 'billing', 'shipping', 'shipping_method', 'review', 'payment'];
   [...]
},

and

    setShippingMethod: function() {
    //this.nextStep();
    this.gotoSection('review', true);
    //this.accordion.openNextSection(true);
},setReview: function() {
    //this.nextStep();
    this.gotoSection('payment', true);
    //this.accordion.openNextSection(true);
},setPayment: function() {
    this.reloadProgressBlock();
    //this.nextStep();
    //this.accordion.openNextSection(true);
},

But nothing changed, what I need to do?

 

UPDATE 1

I found out that I need to modify the OnePageController.php

I edited function saveShippingMethodAction

 public function saveShippingMethodAction()
{
    if ($this->_expireAjax()) {
        return;
    }
    if ($this->getRequest()->isPost()) {        $data = $this->getRequest()->getPost('shipping_method', '');        $result = $this->getOnepage()->saveShippingMethod($data);
        // $result will contain error 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-method',
                'html' => $this->_getReviewHtml()
            );
        }        $this->getOnepage()->getQuote()->collectTotals()->save();        $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
    }
}

It works but it is not quite right. I mean it works because now it goes by step 1,2,3,4,5 but it gets stuck at step 4 (review) because it doesn't show anything.

 

UPDATE 2

I have reinstalled the installation of magento just to be sure to not to have something that makes my work bad.

Reinstalling it and making all the changes I wrote up here now I have the Review Step befor the Payment Method, the Review Step shows the "review" (sorry for the repetition).

Now I need to make the last change:

  • Review Step: right now the review step shows the "Place Order" button and it needs to have "Continue"
  • Payment Method: needs to have the Place Order Button

Any ideas?

1 REPLY

Re: change order in checkout steps

I don't know what are your business requirements for switching last two steps, but I'd like to point out that they are like they are for reason. There are Shopping Cart rules that are based on payment method chosen, such as surcharges. Basically it means that price may change after review.

Tanel Raja