Home Forums Basel support forum External feature images

External feature images

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #25885

    veikkopalo
    Participant

    Dears,

    In my store I don’t upload product images to the backend/same server as where the website is hosted. The images are hosted in an external server/website.

    Here is a product page of one of my test products: http://vaatehaukka.fi/product/angulus-kengat/

    You can see that the product image is shown well and is coming from an external link.

    But when I view my products from the product catalogue/shop page: http://vaatehaukka.fi/shop/

    The external product image is not shown as the product thumbnail. Instead it just shows some dummy image.

    This is not an issue in the woocommerce default theme or in the previous theme I used. Thus I would ask if you would know how to fix this and/or if there is some php file I have to tweak somehow in order to make the product category pages use the correct external link as the product image thumbnail?

    Kind regards,
    Veikko

    Attachments:
    You must be logged in to view attached files.
    #25890

    veikkopalo
    Participant

    I’m not a coder but this is as far as I got:

    In ../themes/basel/inc/woocommerce.php I noticed there is this “Hover image” code (see below). Should I somehow change this code so that it echoes the external product image url saved in the products meta?

    /**
    * ————————————————————————————————
    * Hover image
    * ————————————————————————————————
    */

    if( ! function_exists( ‘basel_hover_image’ ) ) {
    function basel_hover_image() {
    global $product, $woocommerce_loop;

    $attachment_ids = $product->get_gallery_image_ids();

    $hover_image = ”;

    if ( ! empty( $attachment_ids[0] ) ) {
    $hover_image = basel_get_product_thumbnail( ‘shop_catalog’, $attachment_ids[0] );
    }

    if( $hover_image != ” && basel_get_opt( ‘hover_image’ ) ): ?>
    <div class=”hover-img”>
    “>
    <?php echo ( $hover_image ); ?>

    </div>
    <?php endif;

    }
    }

    #25895

    veikkopalo
    Participant

    In the same php file i found the below code. Could this be the one that needs to be tweaked to make the feature images work?

    /**
    * ————————————————————————————————
    * Custom thumbnail for category (wide items)
    * ————————————————————————————————
    */

    if( ! function_exists( ‘basel_category_thumb_double_size’ ) ) {
    function basel_category_thumb_double_size( $category ) {
    global $basel_loop;
    $small_thumbnail_size = apply_filters( ‘subcategory_archive_thumbnail_size’, ‘shop_catalog’ );
    $dimensions = wc_get_image_size( $small_thumbnail_size );
    $thumbnail_id = get_woocommerce_term_meta( $category->term_id, ‘thumbnail_id’, true );

    if( ! empty( $basel_loop[‘double_size’] ) && $basel_loop[‘double_size’] ) {
    $small_thumbnail_size = ‘shop_catalog_x2’;
    $dimensions[‘width’] *= 2;
    $dimensions[‘height’] *= 2;
    }

    if ( $thumbnail_id ) {
    $image = wp_get_attachment_image_src( $thumbnail_id, $small_thumbnail_size );
    $image = $image[0];
    } else {
    $image = wc_placeholder_img_src();
    }

    if ( $image ) {
    // Prevent esc_url from breaking spaces in urls for image embeds
    // Ref: https://core.trac.wordpress.org/ticket/23605
    $image = str_replace( ‘ ‘, ‘%20’, $image );

    echo ‘name ) . ‘” width=”‘ . esc_attr( $dimensions[‘width’] ) . ‘” height=”‘ . esc_attr( $dimensions[‘height’] ) . ‘” />’;
    }
    }
    }

    #25913

    Artem Temos
    Keymaster

    Hello,

    Thank you for choosing our theme and contacting us.

    Try to add the following code snippet to the functions.php file in the child theme to fix it

    remove_action( 'woocommerce_before_shop_loop_item_title', 'basel_template_loop_product_thumbnail', 10 );
    add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
    

    Kind Regards
    XTemos Studio

Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)