File tree 3 files changed +20
-4
lines changed
templates/order/create/coupons
3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -797,3 +797,5 @@ Created,Created
797
797
Refunds,Refunds
798
798
"Allow Zero GrandTotal for Creditmemo","Allow Zero GrandTotal for Creditmemo"
799
799
"Allow Zero GrandTotal","Allow Zero GrandTotal"
800
+ "Please enter a coupon code!","Please enter a coupon code!"
801
+
Original file line number Diff line number Diff line change 12
12
<div class="admin__field-control">
13
13
<?php if (!$ block ->getCouponCode ()) : ?>
14
14
<input type="text" class="admin__control-text" id="coupons:code" value="" name="coupon_code" />
15
- <?= $ block ->getButtonHtml (__ ('Apply ' ), 'order.applyCoupon ($F( \'coupons:code \')) ' ) ?>
15
+ <?= $ block ->getButtonHtml (__ ('Apply ' ), 'order.handleOnclickCoupon ($F( \'coupons:code \')) ' ) ?>
16
16
<?php endif ; ?>
17
17
<?php if ($ block ->getCouponCode ()) : ?>
18
18
<p class="added-coupon-code">
22
22
</p>
23
23
<?php endif ; ?>
24
24
<script>
25
- require(["Magento_Sales/order/create/form"], function() {
25
+ require([
26
+ "jquery",
27
+ 'Magento_Ui/js/modal/alert',
28
+ 'mage/translate',
29
+ "Magento_Sales/order/create/form"
30
+ ], function($, alert) {
26
31
order.overlay('shipping-method-overlay', <?php if ($ block ->getQuote ()->isVirtual ()) : ?> false<?php else : ?> true<?php endif ; ?> );
27
32
order.overlay('address-shipping-overlay', <?php if ($ block ->getQuote ()->isVirtual ()) : ?> false<?php else : ?> true<?php endif ; ?> );
33
+ order.handleOnclickCoupon = function (code) {
34
+ if (!code) {
35
+ alert({
36
+ content: $.mage.__('Please enter a coupon code!')
37
+ });
38
+ } else {
39
+ order.applyCoupon(code);
40
+ }
41
+ };
28
42
});
29
43
</script>
30
44
</div>
Original file line number Diff line number Diff line change @@ -445,8 +445,8 @@ define([
445
445
*/
446
446
loadShippingRates : function ( ) {
447
447
var addressContainer = this . shippingAsBilling ?
448
- 'billingAddressContainer' :
449
- 'shippingAddressContainer' ,
448
+ 'billingAddressContainer' :
449
+ 'shippingAddressContainer' ,
450
450
data = this . serializeData ( this [ addressContainer ] ) . toObject ( ) ;
451
451
452
452
data [ 'collect_shipping_rates' ] = 1 ;
You can’t perform that action at this time.
0 commit comments