1

Redirect to billing address form while clicking on back button in shipping method form in magento 1.9 one page checkout. I want when user click on back button while user on shipping method rediect back to billing form rather to shipping address form. one page check

login form

billing address form > ship on same address checked.

Shipping Method

When user click on back button from shipping method form, redirect to shipping method page but I want use get redirected to billing page

1

When you click on the back button in the onepage steps, you are calling a js prototype method Checkout.prototype.back() (see skin/frontend/base/default/js/opcheckout.js:245).

So, one way to modify the actual behaviour is to override this method :

1) If not already done, copy in your theme the file app/design/frontend/base-or-rwd/default/template/checkout/onepage.phtml. Then, after the line

<script type="text/javascript" src="<?php echo $this->getSkinUrl('js/opcheckout.js') ?>"></script>

Add the following line to add your own js file (that we will create soon) :

<script type="text/javascript" src="<?php echo $this->getSkinUrl('js/opcheckout-override.js') ?>"></script>

2) In your theme, create the file skin/frontend/<your-package>/<your-theme>/js/opcheckout-override.js.

3) In this file, we have to override the Checkout.prototype.back() method. I did not test it but we could write something like :

Checkout.prototype.back = Checkout.prototype.back.wrap(function(parentMethod) {

    if (this.loadWaiting) return;

    if(this.currentStep == 'shipping_method'){
        this.changeSection('opc-billing');
    }
    else{
       parentMethod();
    }
});

Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.