/
renderer.phtml
41 lines (39 loc) · 1.55 KB
/
renderer.phtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?>
<?php
/** @var $block \Magento\Swatches\Block\Product\Renderer\Listing\Configurable */
$productId = $block->getProduct()->getId();
?>
<div class="swatch-opt-<?= /* @escapeNotVerified */ $productId ?>"
data-role="swatch-option-<?= /* @escapeNotVerified */ $productId ?>"></div>
<script type="text/x-magento-init">
{
"[data-role=swatch-option-<?= /* @escapeNotVerified */ $productId ?>]": {
"Magento_Swatches/js/swatch-renderer": {
"selectorProduct": ".product-item-details",
"onlySwatches": true,
"enableControlLabel": false,
"numberToShow": <?= /* @escapeNotVerified */ $block->getNumberSwatchesPerProduct(); ?>,
"jsonConfig": <?= /* @escapeNotVerified */ $block->getJsonConfig(); ?>,
"jsonSwatchConfig": <?= /* @escapeNotVerified */ $block->getJsonSwatchConfig(); ?>,
"mediaCallback": "<?= /* @escapeNotVerified */ $block->getMediaCallback() ?>"
}
}
}
</script>
<script type="text/x-magento-init">
{
"[data-role=priceBox][data-price-box=product-id-<?= /* @escapeNotVerified */ $productId ?>]": {
"priceBox": {
"priceConfig": {
"priceFormat": <?= /* @escapeNotVerified */ $block->getPriceFormatJson(); ?>,
"prices": <?= /* @escapeNotVerified */ $block->getPricesJson(); ?>
}
}
}
}
</script>