Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1178117
    kiovic
    Participant

    I’ve searched and found the answer to this topic before but for some reason my child theme breaks and results in a fatal error if I try to put in the functions.php code for product picture sizes on Woocommerce settings. Some topics I am referring too:

    https://community.theme.co/forums/topic/woocommerce-product-sizes-in-x-theme/

    https://community.theme.co/forums/topic/woocommerce-product-image-sizes-missing/

    I have tried these solutions (installed child theme and paste code in functions.php) but result in a functions.php error that forces me to contact support.

    Thank you for your consideration and hope to hear from you soon, I will post private login credentials for reference.

    P.S You guys have a great product and service!

    #1178123
    kiovic
    Participant
    This reply has been marked as private.
    #1178558
    Darshana
    Moderator

    Hi there,

    Please provide us with your FTP credentials to check your functions.php file.

    Thanks!

    #1178620
    kiovic
    Participant
    This reply has been marked as private.
    #1179054
    Rad
    Moderator

    Hi there,

    Please implement the code again and provide the error you’re getting. Right now, I’m not sure which one and how you implemented them. Then I’ll guide you about the solution bit by bit 🙂

    Thanks!

    #1182204
    kiovic
    Participant

    Hello,

    I implemented this code

    function enable_product_settings() {
       remove_filter( 'woocommerce_product_settings', 'x_woocommerce_remove_plugin_settings' );
    }
    
    add_filter('admin_init', 'enable_product_settings', 20 );
    
    add_action('init', 'default_woocommerce_thumbnails', 99 );
    
    function default_woocommerce_thumbnails() {
        remove_action( 'woocommerce_before_shop_loop_item_title', 'x_woocommerce_shop_thumbnail', 10 );  
        add_action( 'woocommerce_before_shop_loop_item_title', 'x_woocommerce_shop_thumbnail_v2', 99 );
    }
    
    function x_woocommerce_shop_thumbnail_v2() {
    
      GLOBAL $product;
    
      $stack            = x_get_stack();
      $stack_thumb      = 'shop_catalog';
      $stack_shop_thumb = $stack_thumb;
      $id               = get_the_ID();
      $rating           = $product->get_rating_html();
    
      woocommerce_show_product_sale_flash();
      echo '<div class="entry-featured">';
        echo '<a href="' . get_the_permalink() . '">';
          echo get_the_post_thumbnail( $id , $stack_shop_thumb );
          if ( ! empty( $rating ) ) {
            echo '<div class="star-rating-container aggregate">' . $rating . '</div>';
          }
        echo '</a>';
      echo "</div>";
    
    }

    This resulted in blurry and out-scaled images even after using the regeneration thumbnail tool and saving the settings in the product image option. You can see the shop page at brignolskincare.com/shop

    Please advise thank you!

    #1182702
    Lely
    Moderator

    Hi There,

    Please add the following CSS on Appearance > Customize > Custom > Edit Global CSS:

    .woocommerce li.product .entry-featured img {
        min-width: initial;
    }

    Hope this helps.

    #1183081
    kiovic
    Participant

    I implemented your latest code to the CSS

    It did help but still has a repeat image on the shop page.

    Please advise.

    Thank you for your help and patience.

    #1183997
    Lely
    Moderator

    Hi There,

    From your code above, please check this part:

    function default_woocommerce_thumbnails() {
        remove_action( 'woocommerce_before_shop_loop_item_title', 'x_woocommerce_shop_thumbnail', 10 );  
        add_action( 'woocommerce_before_shop_loop_item_title', 'x_woocommerce_shop_thumbnail_v2', 99 );
    }

    Update to this:

    function default_woocommerce_thumbnails() {
        remove_action( 'woocommerce_before_shop_loop_item_title', 'x_woocommerce_shop_product_thumbnails', 10 );
        add_action( 'woocommerce_before_shop_loop_item_title', 'x_woocommerce_shop_thumbnail_v2', 99 );
    }
    

    Hope this helps.

    #1192518
    kiovic
    Participant

    I replaced and implemented the code above but resulted in the following error:

    Parse error: syntax error, unexpected ‘default_woocommerce_thumbnails’ (T_STRING), expecting ‘(‘ in /home/content/p3nexnas06_data02/05/3580505/html/wp-content/themes/x-child/functions.php on line 52

    Please consider that resulting in these errors are spending a lot of time fixing them because I can no longer access the wordpress dashboard.

    Please advise.

    #1193316
    Lely
    Moderator

    Hi There,

    I have logged in to your site via FTP. This part is incorrect

    add_filter('init', function default_woocommerce_thumbnails() {
        remove_action( 'woocommerce_before_shop_loop_item_title', 'x_woocommerce_shop_product_thumbnails', 10 );
        add_action( 'woocommerce_before_shop_loop_item_title', 'x_woocommerce_shop_thumbnail_v2', 99 );
    } 
    

    It should be like this:

    function default_woocommerce_thumbnails() {
        remove_action( 'woocommerce_before_shop_loop_item_title', 'x_woocommerce_shop_product_thumbnails', 10 );
        add_action( 'woocommerce_before_shop_loop_item_title', 'x_woocommerce_shop_thumbnail_v2', 99 );
    } 
    

    I made the update and the error is gone and your site is back now.
    Hope this helps.

    #1194193
    kiovic
    Participant

    Thank you, that omitted the duplicate photo. However the sizes do not change in the shop/collections page after I change them in the woocommerce product display settings.

    Thank you,

    #1194734
    Rad
    Moderator

    Hi there,

    Try regenerating your thumbnails. Like using Force regenerate thumbnails plugin. Woocoomerce recommend it on every change you made for image sizes.

    Thanks!

    #1196063
    kiovic
    Participant

    Hello,

    I have installed the regenerate thumbnails and regenerated the thumbnails, however still resulted in no change to the product pictures in the shop page.

    #1196415
    Rad
    Moderator

    Hi there,

    I updated your code to this

    function x_woocommerce_shop_thumbnail2() {
    
      GLOBAL $product;
    
      $stack            = x_get_stack();
      $stack_thumb      = 'shop_catalog';
      $stack_shop_thumb = $stack_thumb;
      $id               = get_the_ID();
      $rating           = $product->get_rating_html();
    
      woocommerce_show_product_sale_flash();
      echo '<div class="entry-featured">';
        echo '<a href="' . get_the_permalink() . '">';
          echo get_the_post_thumbnail( $id , $stack_shop_thumb );
          if ( ! empty( $rating ) ) {
            echo '<div class="star-rating-container aggregate ">' . $rating . '</div>';
          }
        echo '</a>';
      echo "</div>";
    
    }
    
    function default_woocommerce_media_setting() {
       remove_filter( 'woocommerce_product_settings', 'x_woocommerce_remove_plugin_settings' );
       remove_action( 'woocommerce_before_shop_loop_item_title', 'x_woocommerce_shop_product_thumbnails', 10 );
       add_action( 'woocommerce_before_shop_loop_item_title', 'x_woocommerce_shop_thumbnail2', 10 );
    }
    
    add_filter('init', 'default_woocommerce_media_setting', 99999);

    Should be working now.

    Cheers!

  • <script> jQuery(function($){ $("#no-reply-1178117 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>