Skip to content

Commit c0b879b

Browse files
author
Sergey Semenov
committed
MAGETWO-47017: [Github] Add Configurable Product To Cart from Category Page #2574 #5850 #5882 #6572 #5558 #4184
1 parent ac97a48 commit c0b879b

File tree

1 file changed

+7
-3
lines changed
  • app/code/Magento/Swatches/view/frontend/templates/product/listing

1 file changed

+7
-3
lines changed

app/code/Magento/Swatches/view/frontend/templates/product/listing/renderer.phtml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66
?>
77
<?php /** @var $block \Magento\Swatches\Block\Product\Renderer\Configurable */ ?>
8-
<?php $jsonConfig = $block->getJsonConfig(); ?>
98
<div class="swatch-opt-<?php /* @escapeNotVerified */ echo $block->getProduct()->getId() ?>"></div>
109
<script>
1110
require([
@@ -15,12 +14,14 @@
1514
'Magento_Swatches/js/catalog-add-to-cart',
1615
'priceBox'
1716
], function ($) {
17+
var jsonConfig = <?php /* @escapeNotVerified */ echo $block->getJsonConfig(); ?>;
18+
1819
$('.swatch-opt-<?php /* @escapeNotVerified */ echo $block->getProduct()->getId() ?>').SwatchRenderer({
1920
selectorProduct: '.product-item-details',
2021
onlySwatches: true,
2122
enableControlLabel: false,
2223
numberToShow: <?php /* @escapeNotVerified */ echo $block->getNumberSwatchesPerProduct(); ?>,
23-
jsonConfig: <?php /* @escapeNotVerified */ echo $jsonConfig; ?>,
24+
jsonConfig: jsonConfig,
2425
jsonSwatchConfig: <?php /* @escapeNotVerified */ echo $block->getJsonSwatchConfig(); ?>,
2526
mediaCallback: '<?php /* @escapeNotVerified */ echo $block->getMediaCallback() ?>'
2627
});
@@ -30,7 +31,10 @@
3031
priceBoxes = $(dataPriceBoxSelector + dataProductIdSelector);
3132

3233
priceBoxes.priceBox({
33-
'priceConfig': <?php /* @escapeNotVerified */ echo $jsonConfig; ?>
34+
'priceConfig': {
35+
priceFormat: jsonConfig.priceFormat,
36+
prices: jsonConfig.prices
37+
}
3438
});
3539
});
3640
</script>

0 commit comments

Comments
 (0)