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.