Skip to content

Commit d608f9e

Browse files
MAGETWO-53439: [Github][PR] Removed inline JavaScript from template #4141
1 parent a5fa3af commit d608f9e

File tree

1 file changed

+8
-23
lines changed
  • app/code/Magento/Catalog/view/frontend/templates/product/view

1 file changed

+8
-23
lines changed

app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
</div>
4141
</div>
4242
<?php endif; ?>
43-
<?php if ($block->isRedirectToCartEnabled()) : ?>
4443
<script type="text/x-magento-init">
4544
{
4645
"#product_addtocart_form": {
@@ -50,28 +49,14 @@
5049
}
5150
}
5251
</script>
53-
<?php else : ?>
54-
<script>
55-
require([
56-
'jquery',
57-
'mage/mage',
58-
'Magento_Catalog/product/view/validation',
59-
'Magento_Catalog/js/catalog-add-to-cart'
60-
], function ($) {
61-
'use strict';
62-
63-
$('#product_addtocart_form').mage('validation', {
64-
radioCheckboxClosest: '.nested',
65-
submitHandler: function (form) {
66-
var widget = $(form).catalogAddToCart({
67-
bindSubmit: false
68-
});
69-
70-
widget.catalogAddToCart('submitForm', $(form));
71-
72-
return false;
52+
<?php if (!$block->isRedirectToCartEnabled()) : ?>
53+
<script type="text/x-magento-init">
54+
{
55+
"#product_addtocart_form": {
56+
"catalogAddToCart": {
57+
"bindSubmit": "false"
7358
}
74-
});
75-
});
59+
}
60+
}
7661
</script>
7762
<?php endif; ?>

0 commit comments

Comments
 (0)