@@ -22,9 +22,9 @@ define([
2222 priceBoxSelector : '.price-box' ,
2323 optionHandlers : { } ,
2424 optionTemplate : '<%- data.label %>' +
25- '<% if (data.finalPrice.value) { %>' +
26- ' +<%- data.finalPrice.formatted %>' +
27- '<% } %>' ,
25+ '<% if (data.finalPrice.value) { %>' +
26+ ' +<%- data.finalPrice.formatted %>' +
27+ '<% } %>' ,
2828 controlContainer : 'dd' , // should be eliminated
2929 priceFormat : { } ,
3030 isFixedPrice : false ,
@@ -107,10 +107,11 @@ define([
107107 changes = defaultGetOptionValue ( bundleOption , this . options . optionConfig ) ; //eslint-disable-line
108108 }
109109
110- if ( checkIsValidateQty ( bundleOption . data ( 'qtyField' ) ) ) {
110+ if ( checkIsValidateQty ( bundleOption ) ) {
111111 if ( changes ) {
112112 priceBox . trigger ( 'updatePrice' , changes ) ;
113113 }
114+
114115 this . _displayTierPriceBlock ( bundleOption ) ;
115116 this . updateProductSummary ( ) ;
116117 }
@@ -132,7 +133,9 @@ define([
132133 . options [ field . data ( 'optionId' ) ]
133134 . selections [ field . data ( 'optionValueId' ) ] ;
134135 optionConfig . qty = field . val ( ) ;
135- optionInstance . trigger ( 'change' ) ;
136+ if ( checkIsValidateQty ( optionInstance ) ) {
137+ optionInstance . trigger ( 'change' ) ;
138+ }
136139 }
137140 } ,
138141
@@ -373,13 +376,25 @@ define([
373376 return changes ;
374377 }
375378
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 {
381395 isValid = 1 ;
382396 }
397+
383398 return isValid ;
384399 }
385400
@@ -461,4 +476,4 @@ define([
461476
462477 return oneItemPrice ;
463478 }
464- } ) ;
479+ } ) ;
0 commit comments