File tree Expand file tree Collapse file tree 3 files changed +28
-8
lines changed
ProductVideo/view/frontend/web/js
Swatches/view/frontend/web/js Expand file tree Collapse file tree 3 files changed +28
-8
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ define([
73
73
this . initTierPopup ( ) ;
74
74
}
75
75
$ ( this . options . cartButtonId ) . on ( 'click' , this . _addToCartSubmit . bind ( this ) ) ;
76
+ $ ( this . options . cartForm ) . on ( 'submit' , this . _onSubmitForm . bind ( this ) ) ;
76
77
} ,
77
78
78
79
/**
@@ -249,8 +250,10 @@ define([
249
250
250
251
/**
251
252
* Handler for addToCart action
253
+ *
254
+ * @param {Object } e
252
255
*/
253
- _addToCartSubmit : function ( ) {
256
+ _addToCartSubmit : function ( e ) {
254
257
this . element . trigger ( 'addToCart' , this . element ) ;
255
258
256
259
if ( this . element . data ( 'stop-processing' ) ) {
@@ -266,8 +269,20 @@ define([
266
269
if ( this . options . addToCartUrl ) {
267
270
$ ( '.mage-dropdown-dialog > .ui-dialog-content' ) . dropdownDialog ( 'close' ) ;
268
271
}
272
+
273
+ e . preventDefault ( ) ;
269
274
$ ( this . options . cartForm ) . submit ( ) ;
275
+ } ,
270
276
277
+ /**
278
+ * Handler for submit form
279
+ *
280
+ * @private
281
+ */
282
+ _onSubmitForm : function ( ) {
283
+ if ( $ ( this . options . cartForm ) . valid ( ) ) {
284
+ $ ( this . options . cartButtonId ) . prop ( 'disabled' , true ) ;
285
+ }
271
286
}
272
287
} ) ;
273
288
Original file line number Diff line number Diff line change @@ -179,12 +179,14 @@ define([
179
179
* @private
180
180
*/
181
181
clearEvents : function ( ) {
182
- this . fotoramaItem . off (
183
- 'fotorama:show.' + this . PV +
184
- ' fotorama:showend.' + this . PV +
185
- ' fotorama:fullscreenenter.' + this . PV +
186
- ' fotorama:fullscreenexit.' + this . PV
187
- ) ;
182
+ if ( this . fotoramaItem !== undefined ) {
183
+ this . fotoramaItem . off (
184
+ 'fotorama:show.' + this . PV +
185
+ ' fotorama:showend.' + this . PV +
186
+ ' fotorama:fullscreenenter.' + this . PV +
187
+ ' fotorama:fullscreenexit.' + this . PV
188
+ ) ;
189
+ }
188
190
} ,
189
191
190
192
/**
Original file line number Diff line number Diff line change @@ -1248,7 +1248,10 @@ define([
1248
1248
}
1249
1249
1250
1250
imagesToUpdate = this . _setImageIndex ( imagesToUpdate ) ;
1251
- gallery . updateData ( imagesToUpdate ) ;
1251
+
1252
+ if ( ! _ . isUndefined ( gallery ) ) {
1253
+ gallery . updateData ( imagesToUpdate ) ;
1254
+ }
1252
1255
1253
1256
if ( isInitial ) {
1254
1257
$ ( this . options . mediaGallerySelector ) . AddFotoramaVideoEvents ( ) ;
You can’t perform that action at this time.
0 commit comments