0

I need to change the size of the small images below the gallery, but only for products of type grouped

enter image description here

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.

1 Answer 1

0

I figured it out. Had to overwrite the method getImageAttribute of the class Magento\Catalog\Block\Product\View\Gallery

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.