Magento Onepage Checkout Template Bug
I uncovered this bug after I had changed the template in app/design/frontend/default/default/layout/checkout.xml in the following block:
<checkout_onepage_index> <!-- Mage_Checkout --> ... <reference name="root"> <action method="setTemplate"> <template>page/2columns-right.phtml</template> </action> </reference> .... <checkout_onepage_index>
The default template specifies 2columns-right.phtml. When I switched to a different template (2columns-left.phtml in my case), onepage checkout broke.
Line 49 of opcheckout.js requires that the progress blocks (that summarize the user’s checkout information on the side) be within an element with the class col-right, which is how it references those blocks to update them when the user progresses to the next checkout step. col-right is part of the template 2columns-right.phtml, which as we saw is what the checkout process uses by default. This works out of the box, but unfortunately makes the onepage checkout process dependent on the 2columns-right.phtml template.
The bug stems from a poor design choice in basing this sidebar’s functionality on a specific CSS class selector that is part of the global 2columns-right.phtml template rather than on a selector that is directly related to the progress blocks (one which is already being created by that module).