Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1362307

    Hi,

    In case #1361748 I reported a bug in Enfold that makes the settings for WooCommerce product images useless if a 450 x 450 pixel image has been generated for the product.

    I came up with a workaround

    add_filter( 'avf_wc_before_shop_loop_item_title_img_size', 'temp_thumbnail_size_fix', 10, 1 );
    
    function temp_thumbnail_size_fix( $thumbnail_size ) {
        return 'woocommerce_thumbnail';
    }

    My case was closed with the comment “Glad to hear that this has been sorted out, if you have any further questions please create a new thread and we will gladly try to help you”. I just want to make sure that this bug will get a permanent fix, my “solution” should not be permanent. Product images have displayed correctly up until a quite recent update of Enfold, so this is a bug. Just in the last few days since I noticed this issue I have noticed a number of users reporting the same bug:
    https://kriesi.at/support/topic/thumbnails-in-woocommerce-being-cropped-to-square-when-they-are-45/#post-1361952
    https://kriesi.at/support/topic/woocommerce-problems-image-size-and-price-with-variations/#post-1361830
    https://kriesi.at/support/topic/woocommerce-product-grid-image-choice/#post-1361987
    https://kriesi.at/support/topic/woo-product-archive-thumnail-size/#post-1361707

    If you handle this bug in another system and want to close this case it’s fine with me. I just want to make sure that an update of Enfold eventually will come that fixes the bug.

    Best regards
    Martin

    • This topic was modified 2 years, 3 months ago by martin_e83.
    • This topic was modified 2 years, 2 months ago by Mike.
    #1362443

    Hey Martin,

    Thank you for the update.

    We are currently working on a solution for this. Just to clarify, in your “Butik” page, are you using the Product Grid element from the Advance Layout Builder? Have you tried setting the Styling > Image Size > Select image size to Use default – Woocommerce thumbnail.

    Best regards,
    Ismael

    #1362475

    Hi Ismael,

    Thank you, that sounds good!

    Nope, novellix.se/butiken is just the WooCommerce shop page (set in WooCommerce -> Settings -> Poducts -> Shop Page) so we can’t use the Advance Layout Builder to edit anything (the layout builder is disabled by default on that page). novellix.se/butiken/bokstod/ and so on are just the default product category pages so they also use the default WooCommerce shop page and no layout builder is used.

    Best regards,
    Martin

    #1362576

    Hi,

    The avia_woocommerce_thumbnail function, which contains the avf_wc_before_shop_loop_item_title_img_size filter, is also used for the related products and product sliders, so any changes to the function might break existing layouts. And most users do not seem to have any problem with the default size (shop_catalog), so according to @guenter, we will not be changing the function anytime soon. Please keep the filter for now.

    Thank you for your understanding.

    Best regards,
    Ismael

    #1362624

    Hi @Ismael and @guenter,

    Thanks for your answer! Just to make it clear, you have already introduced a bug that breaks existing layouts. I’m not in any means saying you should change what thumbnail is being used. My fix is a quick and dirty solution to fix a urgent problem for me and some others that have updated to a newer version of Enfold and then got this problem. But I don’t want to change what thumbnail is being used as a permanent fix.

    Have you looked into why this problem occurs. Why the 450×450 px image is being favoured over the settings Enfold provides regarding cropping/ratio of product catalogue images? No settings have been changed after updating and all of a sudden 450×450 px is being displayed even though the setting is set to display uncropped images if a 450×450 px is generated for the product.

    If you will not do anything more about this, then is there a way for me to see what changes have been made in the last three (or so) versions of Enfold? Can I get access to other versions than the latest?

    Best regards,
    Martin

    #1363586

    Hi,

    The issue occurs because Woocommerce just returns the declared thumbnail shop_catalog instead of using the values set in the Woocommerce > Product Images options. The function that controls the image size is located in the plugins/woocommerce/includes/wc-core-functions.php file, look for the wc_get_image_size (line 928).

    Your filter works because when the thumbnail is set to woocommerce_thumbnail, the following condition block (line 971) gets executed and return the values or options set in the Woocommerce > Product Images panel.

    } elseif ( 'thumbnail' === $image_size ) {
    			$size['width'] = absint( wc_get_theme_support( 'thumbnail_image_width', get_option( 'woocommerce_thumbnail_image_width', 300 ) ) );
    			$cropping      = get_option( 'woocommerce_thumbnail_cropping', '1:1' );
    
    			if ( 'uncropped' === $cropping ) {
    				$size['height'] = '';
    				$size['crop']   = 0;
    			} elseif ( 'custom' === $cropping ) {
    				$width          = max( 1, (float) get_option( 'woocommerce_thumbnail_cropping_custom_width', '4' ) );
    				$height         = max( 1, (float) get_option( 'woocommerce_thumbnail_cropping_custom_height', '3' ) );
    				$size['height'] = absint( NumberUtil::round( ( $size['width'] / $width ) * $height ) );
    				$size['crop']   = 1;
    			} else {
    				$cropping_split = explode( ':', $cropping );
    				$width          = max( 1, (float) current( $cropping_split ) );
    				$height         = max( 1, (float) end( $cropping_split ) );
    				$size['height'] = absint( NumberUtil::round( ( $size['width'] / $width ) * $height ) );
    				$size['crop']   = 1;
    			}
    		}
    

    Please try to edit the enfold/config-woocommerce/config.php file and look for this code around line 442.

    
    $size = apply_filters( 'avf_wc_before_shop_loop_item_title_img_size', 'shop_catalog' );
    

    Replace it with:

    
    $woocommerce_thumbnail_image_width = get_option( 'woocommerce_thumbnail_image_width' );
    		$default_size = $woocommerce_thumbnail_image_width == 300 ? 'shop_catalog' : 'woocommerce_thumbnail';
    		$size = apply_filters( 'avf_wc_before_shop_loop_item_title_img_size', $default_size );
    

    Best regards,
    Ismael

    #1363705

    I am having the exact same issue that you are having. Unclear how to proceed as I don’t have the technical skills to add and/or alter code – that’s one of the main reasons I bought Enfold – not to have to deal with it. It just worked until it didn’t (a week or so ago).

    Please offer a real and permanent solution as I have noticed many others encountering the issue so it is NOT a user issue or error – it is a theme bug.

    Thank you

    #1363749

    Hi la_tripping,

    Please try this filter in your functions.php file:

    add_filter( 'avf_wc_before_shop_loop_item_title_img_size', 'temp_thumbnail_size_fix', 10, 1 );
    
    function temp_thumbnail_size_fix( $thumbnail_size ) {
        return 'woocommerce_thumbnail';
    }

    Best regards,
    Rikard

    #1363815

    Hi Rikard,
    I finally figured out how to apply the “filter” and it worked. I hope this will continue to work with future updates.

    Thank you for the help.

    #1363818

    Hi,
    Glad Ismael & Rikard could help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Bug in Enfold for WooCommerce prduct images’ is closed to new replies.