coupon.phtml 3.69 KB
Newer Older
John Punzalan's avatar
John Punzalan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<div class="panel panel-default panel-coupon">
    <div class="panel-heading">
        <h4 class="panel-title">
            <a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo"><?php echo $this->__('Discount Codes') ?><i class="pull-right fa fa-plus-square-o"></i></span></a>
        </h4>
    </div>
    <div id="collapseTwo" class="panel-collapse collapse">
        <div class="panel-body">
            <form id="discount-coupon-form" action="<?php echo $this->getUrl('checkout/cart/couponPost') ?>" method="post" role="form">
                <fieldset>
                    <div class="form-group">
                        <label for="coupon_code"><?php echo $this->__('Enter your coupon code if you have one.') ?></label>
                        <input type="hidden" name="remove" id="remove-coupone" value="0" />
                        <?php if(!strlen($this->getCouponCode())): ?>
                            <input class="form-control" id="coupon_code" name="coupon_code" value="<?php echo $this->htmlEscape($this->getCouponCode()) ?>" />
                            <button class="btn btn-primary" onclick="discountForm.submit(false)" type="button" value="<?php echo $this->__('Apply Coupon') ?>"><span><span><?php echo $this->__('Apply Coupon') ?></span></span></button>
                        <?php else: ?>
                            <input class="input-text" id="coupon_code" name="coupon_code" value="<?php echo $this->htmlEscape($this->getCouponCode()) ?>" />
                            <button type="button" class="btn btn-primary" onclick="discountForm.submit(false)" value="<?php echo $this->__('Apply Coupon') ?>"><span><span><?php echo $this->__('Apply Coupon') ?></span></span></button>
                            <button  type="button" class="btn btn-danger" onclick="discountForm.submit(true)" value="<?php echo $this->__('Cancel Coupon') ?>"><span><span><?php echo $this->__('Cancel Coupon') ?></span></span></button>
                        <?php endif;?>
                    </div>
                </fieldset>
            </form>
            <script type="text/javascript">
                //<![CDATA[
                var discountForm = new VarienForm('discount-coupon-form');
                discountForm.submit = function (isRemove) {
                    if (isRemove) {
                        $('coupon_code').removeClassName('required-entry');
                        $('remove-coupone').value = "1";
                    } else {
                        $('coupon_code').addClassName('required-entry');
                        $('remove-coupone').value = "0";
                    }
                    return VarienForm.prototype.submit.bind(discountForm)();
                }
                //]]>
            </script>
        </div>
    </div>
</div>