For grouped products, I would like to see the picture of the by-products.
I tried several things but without success:
in files : Magento_GroupedProduct\templates\product\view\type
In the loop of associated product, i wrote this code :
$productImage = $block->getImage($_item, 'product_base_image');
<a href="<?php /* @escapeNotVerified */ echo $_product->getProductUrl() ?>" class="product photo product-item-photo" tabindex="-1">
<?php echo $productImage->toHtml(); ?>
</a>
but it does not work!!
Would anyone have an idea.
Thanks
Best Answer
This is what I have done which might point you in the right direction:
1) It took me forever to get the right path to extend the template from
vendor\magento\module-grouped-product\view\frontend\templates\product\view\type\grouped.phtml
to my theme directoryapp\design\frontend\Vendorname\Themename\Magento_GroupedProduct\templates\product\view\type\grouped.html
2) I added the line
<?php $productImage = $block->getImage($_item, $image); echo $productImage->toHtml(); ?>
3) the trick now is to figure out how to define what goes in
$image
- i have created my own definition in my themeapp\design\frontend\Vendorname\Themename\etc\view.xml
So for me,
$image = "grouped_list_product_thumbnail";
This is working for me although it is showing the placeholder and not the thumbnail - it seems my test migration did not copy the thumbnail linkage properly
This might help you solve yours though :)