25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

73 satır
3.5 KiB

  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. // phpcs:disable Generic.Files.LineLength.TooLong
  7. /**
  8. * @var \Magento\Framework\View\Element\AbstractBlock $block
  9. */
  10. // We should use strlen function because coupon code could be "0", converted to bool will lead to false
  11. $hasCouponCode = $block->getCouponCode() !== null && strlen($block->getCouponCode()) > 0;
  12. ?>
  13. <div class="block discount"
  14. id="block-discount"
  15. data-mage-init='{"collapsible":{"active": <?= $hasCouponCode ? 'true' : 'false' ?>, "openedState": "active", "saveState": false}}'>
  16. <div class="title" data-role="title">
  17. <strong id="block-discount-heading" role="heading" aria-level="2"><?= $block->escapeHtml(__('Apply Discount Code')) ?></strong>
  18. </div>
  19. <div class="content" data-role="content" aria-labelledby="block-discount-heading">
  20. <form id="discount-coupon-form"
  21. action="<?= $block->escapeUrl($block->getUrl('checkout/cart/couponPost')) ?>"
  22. method="post"
  23. data-mage-init='{"discountCode":{"couponCodeSelector": "#coupon_code",
  24. "removeCouponSelector": "#remove-coupon",
  25. "applyButton": "button.action.apply",
  26. "cancelButton": "button.action.cancel"}}'>
  27. <div class="fieldset coupon<?= $hasCouponCode ? ' applied' : '' ?>">
  28. <input type="hidden" name="remove" id="remove-coupon" value="0" />
  29. <div class="field">
  30. <label for="coupon_code" class="label">
  31. <span><?= $block->escapeHtml(__('Enter discount code')) ?></span>
  32. </label>
  33. <div class="control">
  34. <input type="text"
  35. class="input-text"
  36. id="coupon_code"
  37. name="coupon_code"
  38. value="<?= $block->escapeHtmlAttr($block->getCouponCode()) ?>"
  39. placeholder="<?= $block->escapeHtmlAttr(__('Enter discount code')) ?>"
  40. <?php if ($hasCouponCode): ?>
  41. disabled="disabled"
  42. <?php endif; ?>
  43. />
  44. </div>
  45. </div>
  46. <div class="actions-toolbar">
  47. <?php if (!$hasCouponCode): ?>
  48. <div class="primary">
  49. <button class="action apply primary" type="button"
  50. value="<?= $block->escapeHtmlAttr(__('Apply Discount')) ?>">
  51. <span><?= $block->escapeHtml(__('Apply Discount')) ?></span>
  52. </button>
  53. </div>
  54. <?php else: ?>
  55. <div class="primary">
  56. <button type="button" class="action cancel primary"
  57. value="<?= $block->escapeHtmlAttr(__('Cancel Coupon')) ?>">
  58. <span><?= $block->escapeHtml(__('Cancel Coupon')) ?></span>
  59. </button>
  60. </div>
  61. <?php endif; ?>
  62. </div>
  63. </div>
  64. <?php if (!$hasCouponCode): ?>
  65. <?= /* @noEscape */ $block->getChildHtml('captcha') ?>
  66. <?php endif; ?>
  67. </form>
  68. </div>
  69. </div>