Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1095886
    LiquidPrintOne
    Participant

    I am trying to override woocommerce composite product image settings. I am trying to change which images size is used with composite products. Currently it is using the thumbnail of the “Catalog Images” but I want it to use a “Single product Image” as that is a quare image and the ctalog images need to be rectangles, I have tried to use the image.php (/wp-content/plugins/woocommerce-composite-products/templates/composited-product/image.php) and the component-options.php (/wp-content/plugins/woocommerce-composite-products/templates/single-product/component-options.php)…

    According to the instructions at the top of both docs:

    Override this template by copying it to 
    
    image.php
    yourtheme/woocommerce/composited-product/image.php
    
    component-options.php
    yourtheme/woocommerce/single-product/component-options.php

    So I tried that for each one separately and at the same time using the following locations:

    image.php
    /wp-content/themes/x-child/woocommerce/composited-product/image.php
    
    component-options.php
    /wp-content/themes/x-child/woocommerce/single-product/component-options.php

    Within the files themselves I am just changing ‘shop_catalog’ to ‘shop_thumbnail’ or ‘shop_single’ but neither option seems to be working. Am I using the wrong location? I am changing the wrong thing in the file?

    #1095890
    LiquidPrintOne
    Participant
    This reply has been marked as private.
    #1096238
    Nico
    Moderator

    Hi There,

    Thanks for writing in.

    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    Thanks.

    #1096957
    LiquidPrintOne
    Participant
    This reply has been marked as private.
    #1097175
    Darshana
    Moderator
    This reply has been marked as private.
    #1097186
    LiquidPrintOne
    Participant
    This reply has been marked as private.
    #1097788
    Rad
    Moderator

    Hi there,

    What you need to change is in this file, wp-content\themes\x\framework\functions\global\plugins\woocommerce.php

    And this code,

    function x_woocommerce_shop_product_thumbnails() {
    
      GLOBAL $product;
    
      $id     = get_the_ID();
      $thumb  = 'entry';
      $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, $thumb );
          if ( ! empty( $rating ) ) {
            echo '<div class="star-rating-container aggregate">' . $rating . '</div>';
          }
        echo '</a>';
      echo "</div>";
    
    }

    and change this line

    $thumb = 'entry';

    to $thumb = 'shop_catalog'; or $thumb = 'shop_single';

    Hope this helps.

    #1098578
    LiquidPrintOne
    Participant

    Thanks I will give that a try! Just to make sure I am doing this right… For my child theme would i put it in:
    /wp-content/themes/x-child/framework/views/global/plugins/woocommerce.php

    Thanks!

    #1098609
    Joao
    Moderator

    Hi There,

    That seems to be correct.

    Please let us know how it goes.

    Joao

    #1102364
    LiquidPrintOne
    Participant

    It does not seem to work there “/wp-content/themes/x-child/framework/views/global/plugins/woocommerce.php” nothing happens… any other suggestions? Also just to make sure you are looking at the right image on that page, it is the composite product thumbnails that are currently rectangles on that page that I am trying to change into the ‘shop_catalog’ image. Like the “Prym1 White Out (Pattern Pack)” image and the others below it. NOT the main woocommerce thumbnail.

    Thanks.

    #1104655
    Lely
    Moderator

    Hi There,

    Try adding this code instead on your functions.php file:

    
    // Declare function to remove the X hook during initialization
    function remove_X_action() {
      remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
    
    }
    
    // Register the action that will remove the X hook during initialization
    add_action('init','remove_X_action');
    
    // Declare the new custom function
    function custom_woocommerce_shop_product_thumbnails() {
      GLOBAL $product;
    
      $id     = get_the_ID();
      $thumb  = 'entry';
      $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, $thumb );
          if ( ! empty( $rating ) ) {
            echo '<div class="star-rating-container aggregate">' . $rating . '</div>';
          }
        echo '</a>';
      echo "</div>";
    
    }
    
    // Register new action now
      add_action( 'woocommerce_before_shop_loop_item_title', 'custom_woocommerce_shop_product_thumbnails', 10 );
    
    

    Then feel free to update this line: $thumb = 'entry'; from that code.

    Hope this helps.

    #1105209
    LiquidPrintOne
    Participant

    Unfortunately that did not seem to work, It did not make a difference. I left the change up so you can see. I also tried changing $thumb = ‘entry’; to $thumb = ‘shop_single’; and $thumb = ‘shop_catalog’; with no changes.

    #1105927
    Rad
    Moderator

    Hi there,

    Please try this one,

    function x_woocommerce_shop_product_thumbnails_v2() {
    
      GLOBAL $product;
    
      $id     = get_the_ID();
      $thumb  = 'shop_single';
      $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, $thumb );
          if ( ! empty( $rating ) ) {
            echo '<div class="star-rating-container aggregate">' . $rating . '</div>';
          }
        echo '</a>';
      echo "</div>";
    
    }
    
    add_action('init', 'change_x_woo_hooks', 99999);
    
    function change_x_woo_hooks () {
    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_product_thumbnails_v2', 10 );
    }

    Then clear your cache before testing.

    Thanks!

    #1107033
    LiquidPrintOne
    Participant

    Yea, that is not doing anything either. I have it in my functions.php if you want to take a look. Maybe i am not doing something right?

    Thanks!

    #1107709
    Rad
    Moderator

    Hi there,

    Sorry for the confusion, but seems the customization isn’t related to the issue. The available options section are from
    WooCommerce Composite Products plugin. You should contact the plugin author, their implementation is different from our theme and it’s not connected.

    Thanks!

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