|
Hi,
i did it now myself and this is who it goes:
/app/code/core/Mage/Checkout/Block/Onepage.php: Add the code, in my case “coupon”
$stepCodes = array('billing', 'coupon', 'shipping', 'shipping_method', 'payment', 'review');
/app/code/core/Mage/Checkout/Block/Onepage/Coupon.php
class Mage_Checkout_Block_Onepage_Coupon extends Mage_Checkout_Block_Onepage_Abstract { protected function _construct() { $this->getCheckout()->setStepData('coupon', array( 'label' => Mage::helper('checkout')->__('Coupon Information'), 'is_show' => $this->isShow() ));
parent::_construct(); }
public function getMethod() { return $this->getQuote()->getCheckoutMethod(); } }
/app/design/frontend/default/<theme>/template/checkout/onepage/coupon.phtml
create a template, like billing.phtml
/app/code/core/Mage/Checkout/Block/Onepage/Progress.php Don’t know if needed but add
public function getCoupon() { return $this->getQuote()->getShippingAddress(); }
/app/code/core/Mage/Checkout/controllers/OnepageController.php
It is imporant to set in one step the goto_section to “coupon” to get there… additionally you need a new function to save or at least go to the next step
public function saveCouponAction() { $this->_expireAjax(); if ($this->getRequest()->isPost()) { $result['goto_section'] = 'shipping_method'; $this->getResponse()->setBody(Zend_Json::encode($result)); }
}
/app/design/frontend/default/cyberhouse/layout/checkout.xml
add
<block type="checkout/onepage_coupon" name="checkout.onepage.coupon" as="coupon" template="checkout/onepage/coupon.phtml"/>
/app/code/core/Mage/Checkout/Model/Type/Onepage.php Dont know if needed
public function saveCoupon($data, $customerAddressId) {
$this->getCheckout() ->setStepData('coupon', 'allow', true) ->setStepData('coupon', 'complete', true) ->setStepData('shipping_method', 'allow', true);
return array(); }
/skin/frontend/default/<theme>/js/opcheckout.js
tricky part: I copied the Billing class and renamed it to Coupon. Still i got some troubles and so I did in coupon.phtml
<button class="form-button right" onclick="checkout.accordion.openNextSection(true); return false;"><span><?php echo $this->__('Continue') ?></span></button>
to load the next step
I hope it helps!
|