File tree Expand file tree Collapse file tree 3 files changed +54
-7
lines changed
Theme/view/frontend/web/js/view Expand file tree Collapse file tree 3 files changed +54
-7
lines changed Original file line number Diff line number Diff line change 40
40
</div>
41
41
</div>
42
42
<?php endif ; ?>
43
- <script type="text/x-magento-init">
43
+ <?php if ($ block ->isRedirectToCartEnabled ()) : ?>
44
+ <script type="text/x-magento-init">
44
45
{
45
46
"#product_addtocart_form": {
46
47
"Magento_Catalog/product/view/validation": {
49
50
}
50
51
}
51
52
</script>
52
- <?php if (! $ block -> isRedirectToCartEnabled ()) : ?>
53
- <script type="text/x-magento-init">
53
+ <?php else : ?>
54
+ <script type="text/x-magento-init">
54
55
{
55
56
"#product_addtocart_form": {
56
- "catalogAddToCart": {
57
- "bindSubmit": false
58
- }
57
+ "Magento_Catalog/js/validate-product": {}
59
58
}
60
59
}
61
60
</script>
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright © Magento, Inc. All rights reserved.
3
+ * See COPYING.txt for license details.
4
+ */
5
+ define ( [
6
+ 'jquery' ,
7
+ 'mage/mage' ,
8
+ 'Magento_Catalog/product/view/validation' ,
9
+ 'catalogAddToCart'
10
+ ] , function ( $ ) {
11
+ 'use strict' ;
12
+
13
+ $ . widget ( 'mage.productValidate' , {
14
+ options : {
15
+ bindSubmit : false ,
16
+ radioCheckboxClosest : '.nested'
17
+ } ,
18
+
19
+ /**
20
+ * Uses Magento's validation widget for the form object.
21
+ * @private
22
+ */
23
+ _create : function ( ) {
24
+ var bindSubmit = this . options . bindSubmit ;
25
+
26
+ this . element . validation ( {
27
+ radioCheckboxClosest : this . options . radioCheckboxClosest ,
28
+
29
+ /**
30
+ * Uses catalogAddToCart widget as submit handler.
31
+ * @param {Object } form
32
+ * @returns {Boolean }
33
+ */
34
+ submitHandler : function ( form , event ) {
35
+ var jqForm = $ ( form ) . catalogAddToCart ( {
36
+ bindSubmit : bindSubmit
37
+ } ) ;
38
+
39
+ jqForm . catalogAddToCart ( 'submitForm' , jqForm , event ) ;
40
+
41
+ return false ;
42
+ }
43
+ } ) ;
44
+ }
45
+ } ) ;
46
+
47
+ return $ . mage . productValidate ;
48
+ } ) ;
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ define([
21
21
initialize : function ( ) {
22
22
this . _super ( ) ;
23
23
24
- this . cookieMessages = $ . cookieStorage . get ( 'mage-messages' ) ;
24
+ this . cookieMessages = _ . unique ( $ . cookieStorage . get ( 'mage-messages' ) , 'text ') ;
25
25
this . messages = customerData . get ( 'messages' ) . extend ( {
26
26
disposableCustomerData : 'messages'
27
27
} ) ;
You can’t perform that action at this time.
0 commit comments