Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

37 строки
1.0 KiB

  1. /**
  2. * Copyright © Magento, Inc. All rights reserved.
  3. * See COPYING.txt for license details.
  4. */
  5. define([
  6. 'jquery',
  7. 'jquery-ui-modules/widget'
  8. ], function ($) {
  9. 'use strict';
  10. $.widget('mage.discountCode', {
  11. options: {
  12. },
  13. /** @inheritdoc */
  14. _create: function () {
  15. this.couponCode = $(this.options.couponCodeSelector);
  16. this.removeCoupon = $(this.options.removeCouponSelector);
  17. $(this.options.applyButton).on('click', $.proxy(function () {
  18. this.couponCode.attr('data-validate', '{required:true}');
  19. this.removeCoupon.attr('value', '0');
  20. $(this.element).validation().trigger('submit');
  21. }, this));
  22. $(this.options.cancelButton).on('click', $.proxy(function () {
  23. this.couponCode.removeAttr('data-validate');
  24. this.removeCoupon.attr('value', '1');
  25. this.element.trigger('submit');
  26. }, this));
  27. }
  28. });
  29. return $.mage.discountCode;
  30. });