I have only one coupon code, I want to display this coupon code on the cart page and the checkout page.
-
Hi Vinod@ you can use the below code which will be useful. thanks– Nagaraju KasaFeb 17, 2017 at 6:17
-
it is not working– Vinod KumarFeb 17, 2017 at 6:19
-
let me know exact error you are getting? first of all whether your coupon code applying properly..?– Nagaraju KasaFeb 17, 2017 at 6:19
-
it is neither display any error nor any result.– Vinod KumarFeb 17, 2017 at 6:23
-
1Thanks for your reply. I have got it using this code . Mage::getModel('salesrule/rule')->getCollection();– Vinod KumarFeb 17, 2017 at 6:31
3 Answers
You can use the following to Get Coupon code on cart page and checkout page
Mage::getSingleton('checkout/session')->getQuote()->getCouponCode();
This is a comment on the last answer's solution.
My webshop is using Magento 1.9.3.2.
I the answer's solution at the bottom of the file:
magento/app/design/frontend/YOUR_PACKAGE/YOUR_THEME/layout/local.xml
This is the code to add to local.xml:
<block type="core/template" name="getcoupon" output="toHtml" template="custom/info.phtml">
<block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/>
</block>
See screenshot of the added code in my local.xml:
But this not result in showing the coupon code on the checkout page.
To make it work right do I also have to add this same code to the file:
app/design/frontend/YOUR_PACKAGE/YOUR_THEME/template/custom/info.phtml ?
Use the following code to get the Coupon code on the cart page and checkout page:
magento/app/design/frontend/YOUR_PACKAGE/YOUR_THEME/layout/local.xml
<block type="core/template" name="getcoupon" output="toHtml" template="custom/info.phtml">
...
<block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/>
...
</block>
app/design/frontend/YOUR_PACKAGE/YOUR_THEME/template/custom/info.phtml