Tuesday 12 May 2015

Magento – How to check coupen code is applied or not before order place

/app/design/frontend/base/default/template/checkout/onepage/review/button.phtml

<button type=”submit”  id=”checkoutBtn” title=”<?php echo $this->__(‘Place Order’) ?>”><span><span><?php echo $this->__(‘Place Order’) ?></span></span></button>
            <?php
            $coupon_code = Mage::getSingleton(‘checkout/session’)->getQuote()->getCouponCode();

            if ($coupon_code) {
                $coupon_code = ‘yes';
                        } else {
                        $coupon_code = ‘no';
            }
            ?>

<script type=”text/javascript”>
    jQuery(document).ready(function(){

    jQuery(‘#checkoutBtn’).click(function() {

    var ccode = ‘<?php echo $coupon_code; ?> > ';
            if (ccode == ’yes’)
            {
            review.save();
                    }
    else {
    alert(‘Please Enter coupon code Before Order Place’);
            return false;
            }

    });
            });
</script>

No comments:

Post a Comment