File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed
templates/order/create/coupons Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -797,3 +797,5 @@ Created,Created
797797Refunds,Refunds
798798"Allow Zero GrandTotal for Creditmemo","Allow Zero GrandTotal for Creditmemo"
799799"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 1212 <div class="admin__field-control">
1313 <?php if (!$ block ->getCouponCode ()) : ?>
1414 <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 \')) ' ) ?>
1616 <?php endif ; ?>
1717 <?php if ($ block ->getCouponCode ()) : ?>
1818 <p class="added-coupon-code">
2222 </p>
2323 <?php endif ; ?>
2424 <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) {
2631 order.overlay('shipping-method-overlay', <?php if ($ block ->getQuote ()->isVirtual ()) : ?> false<?php else : ?> true<?php endif ; ?> );
2732 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+ };
2842 });
2943 </script>
3044 </div>
Original file line number Diff line number Diff line change @@ -445,8 +445,8 @@ define([
445445 */
446446 loadShippingRates : function ( ) {
447447 var addressContainer = this . shippingAsBilling ?
448- 'billingAddressContainer' :
449- 'shippingAddressContainer' ,
448+ 'billingAddressContainer' :
449+ 'shippingAddressContainer' ,
450450 data = this . serializeData ( this [ addressContainer ] ) . toObject ( ) ;
451451
452452 data [ 'collect_shipping_rates' ] = 1 ;
You can’t perform that action at this time.
0 commit comments