|
4 | 4 | * See COPYING.txt for license details.
|
5 | 5 | */
|
6 | 6 | ?>
|
7 |
| -<?php /** @var $block \Magento\Swatches\Block\Product\Renderer\Listing\Configurable */ ?> |
8 |
| -<div class="swatch-opt-<?php /* @escapeNotVerified */ echo $block->getProduct()->getId() ?>"></div> |
9 |
| -<script> |
10 |
| - require( |
11 |
| - ["jquery", "jquery/ui", "Magento_Swatches/js/swatch-renderer", "Magento_Swatches/js/catalog-add-to-cart"], |
12 |
| - function ($) { |
13 |
| - $('.swatch-opt-<?php /* @escapeNotVerified */ echo $block->getProduct()->getId() ?>').SwatchRenderer({ |
14 |
| - selectorProduct: '.product-item-details', |
15 |
| - onlySwatches: true, |
16 |
| - enableControlLabel: false, |
17 |
| - numberToShow: <?php /* @escapeNotVerified */ echo $block->getNumberSwatchesPerProduct(); ?>, |
18 |
| - jsonConfig: <?php /* @escapeNotVerified */ echo $block->getJsonConfig(); ?>, |
19 |
| - jsonSwatchConfig: <?php /* @escapeNotVerified */ echo $block->getJsonSwatchConfig(); ?>, |
20 |
| - mediaCallback: '<?php /* @escapeNotVerified */ echo $block->getMediaCallback() ?>' |
21 |
| - }); |
22 |
| - }); |
| 7 | +<div class="swatch-opt-<?php /* @escapeNotVerified */ echo $block->getProduct()->getId() ?>" |
| 8 | + data-role="swatch-option-<?php /* @escapeNotVerified */ echo $block->getProduct()->getId() ?>" |
| 9 | +></div> |
| 10 | + |
| 11 | +<script type="text/x-magento-init"> |
| 12 | + { |
| 13 | + "[data-role=swatch-option-<?php /* @escapeNotVerified */ echo $block->getProduct()->getId() ?>]": { |
| 14 | + "Magento_Swatches/js/swatch-renderer": { |
| 15 | + "selectorProduct": ".product-item-details", |
| 16 | + "onlySwatches": true, |
| 17 | + "enableControlLabel": false, |
| 18 | + "numberToShow": <?php /* @escapeNotVerified */ echo $block->getNumberSwatchesPerProduct(); ?>, |
| 19 | + "jsonConfig": <?php /* @escapeNotVerified */ echo $block->getJsonConfig(); ?>, |
| 20 | + "jsonSwatchConfig": <?php /* @escapeNotVerified */ echo $block->getJsonSwatchConfig(); ?>, |
| 21 | + "mediaCallback": "<?php /* @escapeNotVerified */ echo $block->getMediaCallback() ?>" |
| 22 | + }, |
| 23 | + "Magento_Swatches/js/catalog-add-to-cart": {} |
| 24 | + } |
| 25 | + } |
23 | 26 | </script>
|
0 commit comments