Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
renderer.phtml
Go to the documentation of this file.
1 <?php
6 ?>
7 <?php
9 $productId = $block->getProduct()->getId();
10 ?>
11 <div class="swatch-opt-<?= /* @escapeNotVerified */ $productId ?>"
12  data-role="swatch-option-<?= /* @escapeNotVerified */ $productId ?>"></div>
13 
14 <script type="text/x-magento-init">
15  {
16  "[data-role=swatch-option-<?= /* @escapeNotVerified */ $productId ?>]": {
17  "Magento_Swatches/js/swatch-renderer": {
18  "selectorProduct": ".product-item-details",
19  "onlySwatches": true,
20  "enableControlLabel": false,
21  "numberToShow": <?= /* @escapeNotVerified */ $block->getNumberSwatchesPerProduct(); ?>,
22  "jsonConfig": <?= /* @escapeNotVerified */ $block->getJsonConfig(); ?>,
23  "jsonSwatchConfig": <?= /* @escapeNotVerified */ $block->getJsonSwatchConfig(); ?>,
24  "mediaCallback": "<?= /* @escapeNotVerified */ $block->getMediaCallback() ?>"
25  }
26  }
27  }
28 </script>
29 
30 <script type="text/x-magento-init">
31  {
32  "[data-role=priceBox][data-price-box=product-id-<?= /* @escapeNotVerified */ $productId ?>]": {
33  "priceBox": {
34  "priceConfig": {
35  "priceFormat": <?= /* @escapeNotVerified */ $block->getPriceFormatJson(); ?>,
36  "prices": <?= /* @escapeNotVerified */ $block->getPricesJson(); ?>
37  }
38  }
39  }
40  }
41 </script>
$block
Definition: block.php:8
$productId
Definition: renderer.phtml:9