3

I have only one coupon code, I want to display this coupon code on the cart page and the checkout page.

6
  • Hi Vinod@ you can use the below code which will be useful. thanks Feb 17, 2017 at 6:17
  • it is not working Feb 17, 2017 at 6:19
  • let me know exact error you are getting? first of all whether your coupon code applying properly..? Feb 17, 2017 at 6:19
  • it is neither display any error nor any result. Feb 17, 2017 at 6:23
  • 1
    Thanks for your reply. I have got it using this code . Mage::getModel('salesrule/rule')->getCollection(); Feb 17, 2017 at 6:31

3 Answers 3

2

You can use the following to Get Coupon code on cart page and checkout page

Mage::getSingleton('checkout/session')->getQuote()->getCouponCode();
2

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:

https://snag.gy/F1ACQs.jpg

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 ?

0
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.