首頁>Magento>source

我有一个令人困惑的問题.點击 - 当我在 checkout cart page時 .我無法點击按钮申請 coupon code .結果 Javascrip seems it does not work   (我尝試輸入空,但没有驗證或任何反應)。 但如果我在 checkout onepage .我能做到。
我檢查模板路徑提示,並使用1模板 default/template/checkout/cart/coupon.phtml查看它们 點击 有人可以解釋一下吗?

更新代碼 coupon.phtml

<form id="discount-coupon-form" action="<?php echo $this->getFormActionUrl() ?>" method="post">
    <div class="discount">
        <div class="discount-form">
            <input type="hidden" name="remove" id="remove-coupone" value="0" />
            <div class="field-wrapper">
                <input class="input-text" type="text" id="coupon_code" name="coupon_code" value="<?php echo $this->escapeHtml($this->getCouponCode()) ?>" />
                <div class="button-wrapper">
                    <button type="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Discount Codes')) ?>" class="button2" onclick="discountForm.submit(false)" value="<?php echo $this->__('Discount Codes') ?>"><span><span><?php echo $this->__('Discount Codes') ?></span></span></button>
                    <?php if(strlen($this->getCouponCode())): ?>
                        <button type="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Cancel')) ?>" class="button2 cancel-coupon" onclick="discountForm.submit(true)" value="<?php echo $this->__('Cancel') ?>"><span><span><?php echo $this->__('Cancel') ?></span></span>
                        </button>
                    <?php endif;?>
                </div>
            </div>
        </div>
    </div>
</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>
最新回復
  • 2019-12-5
    1 #

    將優惠券代碼按钮替換為此。

    <button title="Apply Coupon" onclick="discountForm.submit(false)" value="Apply Coupon"><span><span>Apply Coupon</span></span></button>
    

  • magento 1.9:品牌標識而不是名稱
  • magento 2.1:Magento2 - 分層匯航如何使用代碼建立多選功能