File tree Expand file tree Collapse file tree 1 file changed +18
-9
lines changed
app/code/Magento/CatalogWidget/view/frontend/templates/product/widget/content Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,15 @@ use Magento\Framework\App\Action\Action;
11
11
// phpcs:disable Generic.Files.LineLength.TooLong
12
12
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundHelper
13
13
?>
14
+
15
+ <?php
16
+ /**
17
+ * Product carousel widget template
18
+ *
19
+ * @var \Magento\Framework\Escaper $escaper
20
+ */
21
+ ?>
22
+
14
23
<?php if ($ exist = ($ block ->getProductCollection () && $ block ->getProductCollection ()->getSize ())): ?>
15
24
<?php
16
25
$ type = 'widget-product-grid ' ;
@@ -76,6 +85,15 @@ use Magento\Framework\App\Action\Action;
76
85
<span><?= $ block ->escapeHtml (__ ('Add to Cart ' )) ?> </span>
77
86
</button>
78
87
</form>
88
+ <script type="text/x-magento-init">
89
+ {
90
+ "[data-role=tocart-form], .form.map.checkout": {
91
+ "catalogAddToCart": {
92
+ "product_sku": "<?= $ escaper ->escapeJs ($ _item ->getSku ()); ?> "
93
+ }
94
+ }
95
+ }
96
+ </script>
79
97
<?php else : ?>
80
98
<?php if ($ _item ->isAvailable ()): ?>
81
99
<div class="stock available"><span><?= $ block ->escapeHtml (__ ('In stock ' )) ?> </span></div>
@@ -113,13 +131,4 @@ use Magento\Framework\App\Action\Action;
113
131
<?= $ block ->getPagerHtml () ?>
114
132
</div>
115
133
</div>
116
- <?php if ($ block ->getBlockHtml ('formkey ' )): ?>
117
- <script type="text/x-magento-init">
118
- {
119
- ".block.widget [data-role=tocart-form]": {
120
- "Magento_Catalog/js/validate-product": {}
121
- }
122
- }
123
- </script>
124
- <?php endif ;?>
125
134
<?php endif ;?>
You can’t perform that action at this time.
0 commit comments