Magento 2 view.xml Redundant Variables – Optimization Guide

magento2theme

I'm trying to figure out what's the point in the following vars from view.xml in the Luma theme:

    <var name="product_small_image_sidebar_size">100</var>  <!-- Override for small product image -->
    <var name="product_base_image_size">275</var>           <!-- Override for base product image -->
    <var name="product_base_image_icon_size">48</var>       <!-- Base product image icon size -->

    <var name="product_list_image_size">166</var>           <!-- New Product image size used in product list -->
    <var name="product_zoom_image_size">370</var> 

I don't see they are being used in the code. Is this just an artifact or I've missed something?

Best Answer

According to documentation it is possible to configure your image properties your module in, such way:

<images module="Magento_Catalog">
    <image id="unique_image_id" type="image">
        <width>100</width> <!-- Image width in px --> 
        <height>100</height> <!-- Image height in px -->
    </image>
</images>

http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/themes/theme-images.html

So in your own theme based on Luma, or module, you can change this settings or add new image types etc.

I also had no chance to found usage of such theme variables in my local Magento v 2.0

<var name="product_zoom_image_size">370</var>

But according to some articles it's image resizing actions right from the layout http://inchoo.net/magento-2/frontend-theme-architecture/ which actually the same.

And if we look at old version of view.xml , then it looks like that is just old code style, so it's better to use new way described in current documentation.

Related Topic