Magento 2 - How to change fotorama nav shaft thumbnail image size - for grouped products?
-
16-04-2021 - |
Question
I need to change the size of the small images below the gallery, but only for products of type grouped
Normaly you can change the size in the file THEME/etc/view.xml
:
<?xml version="1.0"?>
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/view.xsd">
<media>
<images module="Magento_Catalog">
...
<image id="product_page_image_small" type="thumbnail">
<width>110</width>
<height>110</height>
</image>
...
So I tried to change it for grouped products only like this:
<?xml version="1.0"?>
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/view.xsd">
<media>
<images module="Magento_GroupedProduct">
<image id="product_page_image_small" type="thumbnail">
<width>129</width>
<height>129</height>
</image>
</images>
<images module="Magento_Catalog">
...
<image id="product_page_image_small" type="thumbnail">
<width>110</width>
<height>110</height>
</image>
...
Then I flushed the cache. But it does not work. The image size still stays 110px instead of 129px.
Solution
I figured it out. Had to overwrite the method getImageAttribute
of the class Magento\Catalog\Block\Product\View\Gallery
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange