Magento: Get current active step in onepage checkout
magento
How can I get the active step in onepage checkout?
Thanks for help.
Best Answer
Active step section will have "active" class for it's LI tag.
It's done via the Accordion js class - method openSection (see js\varien\accordion.js). The Accordion itself is triggered by the Checkout js class - method gotoSection (file \skin\frontend\base\default\js\opcheckout.js).
Both Checkout and Accordion classes are instantiated in onepage.phtml template.
In summary, you need to extend/override Mage_Checkout_Block_Onepage::getSteps() to add your new step in the sequence.
Create your new step's block/template (loaded using an Ajax request when the previous step is completed) Your block class will need to extend: Mage_Checkout_Block_Onepage_Abstract
You also need to extend the onepagecheckout javascript as this does much of the heavy lifting. The Prototype library has a nice way of doing this.
Finally you will need to extend the controller class (Mage_Checkout_OnepageController) to override the responses of any existing steps, return the content of your new step (loaded using ajax), and handle the save action of any data (form fields etc) entered in your new step.
Best Answer
Active step section will have "active" class for it's LI tag.
It's done via the Accordion js class - method openSection (see js\varien\accordion.js). The Accordion itself is triggered by the Checkout js class - method gotoSection (file \skin\frontend\base\default\js\opcheckout.js).
Both Checkout and Accordion classes are instantiated in onepage.phtml template.