I have searched a lot on google but didn't get the solution for this.
I new to Magento, can any help me to how to add the coupon code section in Mini cart of magento.
Like the Below Example:
I have added this in items.phtml
<?php $getCouponCode = Mage::getSingleton('checkout/cart')->getQuote()->getCouponCode(); ?>
<form id="discount-coupon-form" action="<?php echo $this->getUrl('checkout/onepage/coupon')?>" method="post">
<!-- <label for="coupon_code"> <?php //echo $this->__('Enter your coupon code if you have one.') ?></label> -->
<input id="coupon_code" name="coupon_code" value="<?php echo $getCouponCode; ?>"/>
<?php if(strlen($getCouponCode)) { ?>
<button type="button" onclick="updateminiCoupon(2); return false;" value="<?php echo $this->__('Remove Coupon')?>"><span><?php echo $this->__('Remove Coupon') ?></span></button>
<?php } ?>
<button type="button" onclick="updateminiCoupon(1); return false;" value="<?php echo $this->__('Apply Coupon')?>"><span><?php echo $this->__('Apply Coupon') ?></span></button>
</form>
and js :
<script type="text/javascript">
//<![CDATA[
function updateminiCoupon(reqid) {
//alert('d');
var reqid;
if(reqid == 2) { $('coupon_code').setValue(''); }
$('discount-coupon-form').request({
method: 'post',
onComplete: payment.onComplete,
onSuccess: payment.onSave,
onFailure: checkout.ajaxFailure.bind(checkout),
})
}
//]]>
</script>
by reference link:
http://www.endreywalder.com/blog/add-coupon-code-form-to-magento-onepage-checkout-review-step/
Check the Reference site : http://www.nykaa.com/
Best Answer
Please make use the above code and call the same in the file path
Note: i have used the default mangento 1.9.x with rwd theme
And