@@ -22,9 +22,9 @@ define([
22
22
priceBoxSelector : '.price-box' ,
23
23
optionHandlers : { } ,
24
24
optionTemplate : '<%- data.label %>' +
25
- '<% if (data.finalPrice.value) { %>' +
26
- ' +<%- data.finalPrice.formatted %>' +
27
- '<% } %>' ,
25
+ '<% if (data.finalPrice.value) { %>' +
26
+ ' +<%- data.finalPrice.formatted %>' +
27
+ '<% } %>' ,
28
28
controlContainer : 'dd' , // should be eliminated
29
29
priceFormat : { } ,
30
30
isFixedPrice : false ,
@@ -107,10 +107,11 @@ define([
107
107
changes = defaultGetOptionValue ( bundleOption , this . options . optionConfig ) ; //eslint-disable-line
108
108
}
109
109
110
- if ( checkIsValidateQty ( bundleOption . data ( 'qtyField' ) ) ) {
110
+ if ( checkIsValidateQty ( bundleOption ) ) {
111
111
if ( changes ) {
112
112
priceBox . trigger ( 'updatePrice' , changes ) ;
113
113
}
114
+
114
115
this . _displayTierPriceBlock ( bundleOption ) ;
115
116
this . updateProductSummary ( ) ;
116
117
}
@@ -132,7 +133,9 @@ define([
132
133
. options [ field . data ( 'optionId' ) ]
133
134
. selections [ field . data ( 'optionValueId' ) ] ;
134
135
optionConfig . qty = field . val ( ) ;
135
- optionInstance . trigger ( 'change' ) ;
136
+ if ( checkIsValidateQty ( optionInstance ) ) {
137
+ optionInstance . trigger ( 'change' ) ;
138
+ }
136
139
}
137
140
} ,
138
141
@@ -373,13 +376,25 @@ define([
373
376
return changes ;
374
377
}
375
378
376
- function checkIsValidateQty ( qtyElem ) {
377
- var isValid = 0 ;
378
- if ( qtyElem . val ( ) >= qtyElem . data ( 'validate' ) [ 'validate-item-quantity' ] . minAllowed &&
379
- qtyElem . val ( ) <= qtyElem . data ( 'validate' ) [ 'validate-item-quantity' ] . maxAllowed
380
- ) {
379
+ /**
380
+ * Check the quantity field if negative value occurs.
381
+ *
382
+ * @param bundleOption
383
+ */
384
+ function checkIsValidateQty ( bundleOption )
385
+ {
386
+ let isValid = 0 ,
387
+ qtyElem = bundleOption . data ( 'qtyField' ) ;
388
+ if ( bundleOption . prop ( 'type' ) === 'radio' || bundleOption . prop ( 'type' ) === 'select-one' ) {
389
+ if ( qtyElem . val ( ) >= qtyElem . data ( 'validate' ) [ 'validate-item-quantity' ] . minAllowed
390
+ && qtyElem . val ( ) <= qtyElem . data ( 'validate' ) [ 'validate-item-quantity' ] . maxAllowed
391
+ ) {
392
+ isValid = 1 ;
393
+ }
394
+ } else {
381
395
isValid = 1 ;
382
396
}
397
+
383
398
return isValid ;
384
399
}
385
400
@@ -461,4 +476,4 @@ define([
461
476
462
477
return oneItemPrice ;
463
478
}
464
- } ) ;
479
+ } ) ;
0 commit comments