File tree Expand file tree Collapse file tree 3 files changed +22
-22
lines changed
ConfigurableProduct/view/frontend/web/js
Swatches/view/frontend/web/js Expand file tree Collapse file tree 3 files changed +22
-22
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ require([
11
11
} ,
12
12
configurableWidget ,
13
13
productOptions ,
14
- tempProductOptions ,
14
+ changedProductOptions ,
15
15
cartData = customerData . get ( 'cart' ) ,
16
16
productId = $ ( selectors . productIdSelector ) . val ( ) ,
17
17
updateConfigurableOptions ,
@@ -40,21 +40,21 @@ require([
40
40
if ( ! ( data && data . items && data . items . length && productId ) ) {
41
41
return false ;
42
42
}
43
- tempProductOptions = data . items . find ( function ( item ) {
43
+ changedProductOptions = data . items . find ( function ( item ) {
44
44
return item [ 'product_id' ] === productId ;
45
45
} ) ;
46
- tempProductOptions = tempProductOptions && tempProductOptions . options &&
47
- tempProductOptions . options . reduce ( function ( obj , val ) {
46
+ changedProductOptions = changedProductOptions && changedProductOptions . options &&
47
+ changedProductOptions . options . reduce ( function ( obj , val ) {
48
48
obj [ val [ 'option_id' ] ] = val [ 'option_value' ] ;
49
49
50
50
return obj ;
51
51
} , { } ) ;
52
52
53
- if ( JSON . stringify ( productOptions || { } ) === JSON . stringify ( tempProductOptions || { } ) ) {
53
+ if ( JSON . stringify ( productOptions || { } ) === JSON . stringify ( changedProductOptions || { } ) ) {
54
54
return false ;
55
55
}
56
56
57
- productOptions = tempProductOptions ;
57
+ productOptions = changedProductOptions ;
58
58
59
59
return true ;
60
60
} ;
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ require([
12
12
} ,
13
13
swatchWidget ,
14
14
productOptions ,
15
- tempProductOptions ,
15
+ changedProductOptions ,
16
16
cartData = customerData . get ( 'cart' ) ,
17
17
productId = $ ( selectors . productIdSelector ) . val ( ) ,
18
18
updateSwatchOptions ,
@@ -40,21 +40,21 @@ require([
40
40
if ( ! ( data && data . items && data . items . length && productId ) ) {
41
41
return false ;
42
42
}
43
- tempProductOptions = data . items . find ( function ( item ) {
43
+ changedProductOptions = data . items . find ( function ( item ) {
44
44
return item [ 'product_id' ] === productId ;
45
45
} ) ;
46
- tempProductOptions = tempProductOptions && tempProductOptions . options &&
47
- tempProductOptions . options . reduce ( function ( obj , val ) {
46
+ changedProductOptions = changedProductOptions && changedProductOptions . options &&
47
+ changedProductOptions . options . reduce ( function ( obj , val ) {
48
48
obj [ val [ 'option_id' ] ] = val [ 'option_value' ] ;
49
49
50
50
return obj ;
51
51
} , { } ) ;
52
52
53
- if ( JSON . stringify ( productOptions || { } ) === JSON . stringify ( tempProductOptions || { } ) ) {
53
+ if ( JSON . stringify ( productOptions || { } ) === JSON . stringify ( changedProductOptions || { } ) ) {
54
54
return false ;
55
55
}
56
56
57
- productOptions = tempProductOptions ;
57
+ productOptions = changedProductOptions ;
58
58
59
59
return true ;
60
60
} ;
Original file line number Diff line number Diff line change @@ -962,17 +962,17 @@ define([
962
962
var elem = this . element . find ( '.' + this . options . classes . attributeClass +
963
963
'[attribute-id="' + attributeId + '"] [option-id="' + optionId + '"]' ) ,
964
964
parentInput = elem . parent ( ) ;
965
-
966
- if ( elem . hasClass ( 'selected' ) ) {
967
- return ;
968
- }
969
965
970
- if ( parentInput . hasClass ( this . options . classes . selectClass ) ) {
971
- parentInput . val ( optionId ) ;
972
- parentInput . trigger ( 'change' ) ;
973
- } else {
974
- elem . trigger ( 'click' ) ;
975
- }
966
+ if ( elem . hasClass ( 'selected' ) ) {
967
+ return ;
968
+ }
969
+
970
+ if ( parentInput . hasClass ( this . options . classes . selectClass ) ) {
971
+ parentInput . val ( optionId ) ;
972
+ parentInput . trigger ( 'change' ) ;
973
+ } else {
974
+ elem . trigger ( 'click' ) ;
975
+ }
976
976
} , this ) ) ;
977
977
} ,
978
978
You can’t perform that action at this time.
0 commit comments