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 @@ -177,12 +177,14 @@ define([
177
177
* @private
178
178
*/
179
179
clearEvents : function ( ) {
180
- this . fotoramaItem . off (
181
- 'fotorama:show.' + this . PV +
182
- ' fotorama:showend.' + this . PV +
183
- ' fotorama:fullscreenenter.' + this . PV +
184
- ' fotorama:fullscreenexit.' + this . PV
185
- ) ;
180
+ if ( this . fotoramaItem !== undefined ) {
181
+ this . fotoramaItem . off (
182
+ 'fotorama:show.' + this . PV +
183
+ ' fotorama:showend.' + this . PV +
184
+ ' fotorama:fullscreenenter.' + this . PV +
185
+ ' fotorama:fullscreenexit.' + this . PV
186
+ ) ;
187
+ }
186
188
} ,
187
189
188
190
/**
Original file line number Diff line number Diff line change @@ -1229,7 +1229,10 @@ define([
1229
1229
}
1230
1230
1231
1231
imagesToUpdate = this . _setImageIndex ( imagesToUpdate ) ;
1232
- gallery . updateData ( imagesToUpdate ) ;
1232
+
1233
+ if ( ! _ . isUndefined ( gallery ) ) {
1234
+ gallery . updateData ( imagesToUpdate ) ;
1235
+ }
1233
1236
1234
1237
if ( isInitial ) {
1235
1238
$ ( this . options . mediaGallerySelector ) . AddFotoramaVideoEvents ( ) ;
You can’t perform that action at this time.
0 commit comments