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 :
If not already done, copy in your theme the file
getSkinUrl('js/opcheckout.js') ?>">app/design/frontend/base-or-rwd/default/template/checkout/onepage.phtml
. Then, after the line
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>
In your theme, create the file
skin/frontend/<your-theme>package>/default<your-theme>/js/opcheckout-override.js
.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.