62 lines
2.7 KiB
PHTML
62 lines
2.7 KiB
PHTML
<?php
|
|
/**
|
|
* Coupon form displayed immediately above the cart checkout button.
|
|
*
|
|
* @var \Esun\Cart\Block\Cart\Coupon $block
|
|
* @var \Magento\Framework\Escaper $escaper
|
|
*/
|
|
$couponCode = (string)$block->getCouponCode();
|
|
$hasCouponCode = $couponCode !== '';
|
|
?>
|
|
<div class="esun-coupon esun-coupon--cart">
|
|
<div class="esun-coupon__title"><?= $escaper->escapeHtml(__('Discount Code')) ?></div>
|
|
<form class="esun-coupon__form"
|
|
data-role="esun-coupon-form"
|
|
data-save-url="<?= $escaper->escapeUrl($block->getUrl('esun_cart/coupon/save')) ?>">
|
|
<?= /* @noEscape */ $block->getBlockHtml('formkey') ?>
|
|
<?php if (!$hasCouponCode): ?>
|
|
<label class="esun-coupon__label" for="esun-cart-coupon-code">
|
|
<span><?= $escaper->escapeHtml(__('Enter discount code')) ?></span>
|
|
</label>
|
|
<div class="esun-coupon__controls">
|
|
<input class="input-text esun-coupon__input"
|
|
id="esun-cart-coupon-code"
|
|
name="coupon_code"
|
|
type="text"
|
|
autocomplete="off"
|
|
maxlength="255"
|
|
placeholder="<?= $escaper->escapeHtmlAttr(__('Enter discount code')) ?>"/>
|
|
<button class="action esun-coupon__button" type="submit">
|
|
<span><?= $escaper->escapeHtml(__('Apply')) ?></span>
|
|
</button>
|
|
<button class="action esun-coupon__picker-button"
|
|
type="button"
|
|
aria-haspopup="dialog"
|
|
data-role="open-coupon-picker">
|
|
<span><?= $escaper->escapeHtml(__('My Coupons')) ?></span>
|
|
</button>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="esun-coupon__applied">
|
|
<span>
|
|
<?= $escaper->escapeHtml(__('Applied:')) ?>
|
|
<strong><?= $escaper->escapeHtml($couponCode) ?></strong>
|
|
</span>
|
|
<button class="action esun-coupon__remove"
|
|
type="submit"
|
|
name="remove"
|
|
value="1">
|
|
<span><?= $escaper->escapeHtml(__('Cancel')) ?></span>
|
|
</button>
|
|
<button class="action esun-coupon__picker-button"
|
|
type="button"
|
|
aria-haspopup="dialog"
|
|
data-role="open-coupon-picker">
|
|
<span><?= $escaper->escapeHtml(__('My Coupons')) ?></span>
|
|
</button>
|
|
</div>
|
|
<?php endif; ?>
|
|
<div class="esun-coupon__message" data-role="esun-coupon-message" aria-live="polite"></div>
|
|
</form>
|
|
</div>
|