How do I code grouped product's children product to open fotorama gallary page when clicking on children product picture?
Grouped Products Page
Fotorama Gallary Page
Magento_GroupedProduct\templates\product\view\type\grouped.phtml edited:
<?php $_item = get('\Magento\Catalog\Model\Product\Gallery\ReadHandler'); ?>
<?php $readHandler->execute($_item); ?>
<?php $images=$_item->getMediaGalleryImages(); ?>
<td>
<div data-gallery-role="gallery-placeholder-<?php echo $_item->getId(); ?>">
<img alt="main product photo" class="gallery-placeholder__image" src="<?= $block->getUrl('pub/media/catalog').'product'.$childProduct->getImage() ?>" alt width="200"/>
</div>
<script type="text/x-magento-init">
{
"[data-gallery-role=gallery-placeholder-<?php echo $_item->getId(); ?>]": {
"mage/gallery/gallery": {
"mixins":["magnifier/magnify"],
"magnifierOpts": <?= /* @noEscape */ $block->getMagnifier() ?>,
"data": <?= /* @noEscape */ $block->getGalleryImagesJson() ?>,
"options": <?= /* @noEscape */ $block->getGalleryOptions()->getOptionsJson() ?>,
"fullscreen": <?= /* @noEscape */ $block->getGalleryOptions()->getFSOptionsJson() ?>,
"breakpoints": <?= /* @noEscape */ $block->getBreakpoints() ?>
}
}
}
</script>
</td>
Is this correctly added? Isn't data value in script going to be a issue with having specific urls? Is that where $images should be added? I am getting error on line 1 code $_item = get('\Magento\Catalog\Model\Product\Gallery\ReadHandler');