Okay
  Public Ticket #1745320
Image width dialog hidden in Customizer
Closed

Comments

  •  2
    FreedomNetworking started the conversation

    WooCommerce 3.3 moved the image width dialog to the Customizer.  In the process they also decided to hide it if the widths are specified by the theme, which Aurum does.  The bottom line is since labor_actions.php has these 2 width additions:

    // Add theme support for WooCommerce

            add_theme_support( 'woocommerce', array(

                  'single_image_width'    => apply_filters( 'aurum_woocommerce_single_image_width', 680 ),

                  'thumbnail_image_width' => apply_filters( 'aurum_woocommerce_thumbnail_image_width', 330 ),

                    'product_grid' => array(

                            'default_rows' => 4,

                            'min_rows'     => 1,

                            'max_rows'     => 50,

                            'default_columns' => 3,

                            'min_columns'     => 1,

                            'max_columns'     => 6,

                    ),

            ) );

    The width is now hidden and cannot be specified.  This is a concern for implementation that set the widths previously.  Please allow us to have access to the image widths again (now in the customizer).

    I had to comment out 

    // 'single_image_width'    => apply_filters( 'aurum_woocommerce_single_image_width', 680 ),

     //  'thumbnail_image_width' => apply_filters( 'aurum_woocommerce_thumbnail_image_width', 330 ),

    which will break the next update you folks do.

    Thanks,

    Don

  • [deleted] replied

    Hi Don,

    Our theme has predefined width that fits for theme containers sizes, this is added because default WooCommerce image size doesn't look as it should for Aurum theme because we have had these image settings before they moved them in customizer, they generally recommend themes to use these options.

    If you want to revert it back, then simply add these filters in child theme:

    add_filter( 'aurum_woocommerce_single_image_width', '__return_empty_string' );
    add_filter( 'aurum_woocommerce_thumbnail_image_width', '__return_empty_string' );

    This will lead to default WooCommerce settings usage:


    (view large image)

  •  2
    FreedomNetworking replied

    Hi Arlind,

    That will work great, thank you.  

    Could I trouble you and abuse your kindness with one more question?  Using the 2 filters you provided, I was able to have the Image Widths show up again in the Customizer and the customer set the width of the product catalog images to 360 (they are doing 3 across images).  This works great on all Product Category pages (like https://www.personalizedandprinted.com/shop-type-of-gift/desk-wall-clocks ).  This issue remains the Shop page (https://www.personalizedandprinted.com/shop-type-of-gift/ ).  It is specifying a 300 width in the <img tag and then the browser is blowing up the image to 360 pixel width, causing the image to be a bit blurry.

    Is there a way to specify the image width of the images on the Shop page, so it is like the Product Category pages?  In our case, that would allow us to specify a width of 360 pixels for the Shop page images.


    Thanks again!

    Don 

  • [deleted] replied

    Hi Don,

    Don't worry about other questions, you are free to ask anything it may concern about the theme. Thanks for your kindness too!

    After analyzing that code I saw that if the properties are present in add_theme_support:


    (view large image)

    Even with empty values they will still have some impact and cause WooCommerce to behave strangely. So I have found a better approach by removing entirely those indexes with the following code (the previous code I gave you is not valid anymore):

    /**
    * Unset theme support indexes for WooCommerce (single_image_width, thumbnail_image_width)
    */
    function remove_default_theme_support_for_product_images() {
    $support = get_theme_support( 'woocommerce' );
    $support = $support[0];

    foreach ( [ 'single_image_width' , 'thumbnail_image_width' ] as $index ) {
    if ( isset( $support[ $index ] ) ) {
    unset( $support[ $index ] );
    }
    }

    add_theme_support( 'woocommerce', $support );
    }

    add_action( 'after_setup_theme', 'remove_default_theme_support_for_product_images', 10 );

    I tested and it worked for me. Can you please  try it and let me know about the results? 

    If you don't notice any changes immediately then run thumbnail regeneration from WooCommerce > Status > Tools > Regenerate shop thumbnails (the very last option):


    (view large image)

    Then wait a while until some images are processed.