i'm trying to introduce an additional step in the one step checkout process (at the start, just after login). This is on Magento v1.8 and the items being sold are virtual product types (therefore the only sections that should appear at checkout are: [new section], billing, payment, and order review.
I've had a look at a number of articles - this one being most suited to my needs (albeit written for v1.4 i think, and uses a the overloading of existing pages instead of writing a new module). I've also followed along with this article however it aims to introduce a module - something which I don't think is absolutely required for this. SO article Magento Adding Step to Onepage Checkout was also referenced.
My problem:
I have the additional step appearing on the OPC page, however the accordion which should be expanding the active section isn't. This is due to the CSS class active
not being set, which is in turn not set since the new module is not marked as active.
My question: What have I missed from the steps below to ensure that the new module is set as the ActiveStep?
What I've attempted to so far:
In short, I've introduced <?php echo $this->getActiveStep(); ?>
statement on onepage.phtml and it's indicating that 'billing' is still the active page (the default first page).
I've made the following changes so far specifically around the ordering of pages:
added the new section (registerkids) to
_getStepCodes()
in abstract.phpreturn array('login', 'registerkids', 'billing', 'shipping', 'shipping_method', 'payment', 'review');
created a app/code/local file in Checkout/Block/Onepage/registerkids.php with
class Mage_Checkout_Block_Onepage_Registerkids extends Mage_Checkout_Block_Onepage_Abstract { protected function _construct() { $this->getCheckout()->setStepData('registerkids', array( 'label' => Mage::helper('checkout')->__('Assign your kids to the booking'), 'is_show' => $this->isShow() )); if ($this->isCustomerLoggedIn()) { $this->getCheckout()->setStepData('registerkids', 'allow', true); } parent::_construct(); } }
removed the
if ($this->isCustomerLoggedIn())
statement from Checkout\Block\Onepage\billing.php that sets the next stepupdated Checkout\Model\Type\Onepage.php
initCheckout()
withif (!($step==='login' || $customerSession->isLoggedIn() && $step==='registerkids')) { $checkout->setStepData($step, 'allow', false); // where 'registerkids' used to say 'billing'
made the following changes to opcheckout.js -
this.steps = ['login', 'registerkids', 'billing', 'shipping', 'shipping_method', 'payment', 'review'];
(added new section)this.currentStep = 'registerkids';
- updated
setMethod: function()
so that next section after login isthis.gotoSection('registerkids', true);
- updated template/persistent/checkout/onepage/login.phtml JS
customMethod()
tocheckout.gotoSection('registerkids');
- updated Checkout/Onepage.php
getActiveStep()
toreturn $this->isCustomerLoggedIn() ? 'registerkids' : 'login';