문제

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.

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top