Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi,
    and thank you for writing in!

    You cannot see the badge in single product badge, because your theme probably doesn’t use the standard WordPress and WooCommerce hooks and functions to print the images.
    You should override the template wp-content/themes/shopkeeper/woocommerce/single-product/product-image-default.php by copying and pasting it into wp-content/themes/shopkeeper-child/woocommerce/single-product/ folder.
    Then you should replace the lines 92-96 in wp-content/themes/shopkeeper/woocommerce/single-product/product-image-default.php:

    <?php if ( has_post_thumbnail() ) { ?>
    	<img src="<?php echo esc_url($featured_image_src[0]); ?>" data-src="<?php echo esc_url($featured_image_data_src[0]); ?>" alt="<?php echo $featured_image_title; ?>" class="swiper-lazy wp-post-image">
    <?php } else { ?>
    	<img src="<?php echo esc_url(wc_placeholder_img_src()); ?>" data-src="<?php echo esc_url(wc_placeholder_img_src()); ?>" class="swiper-lazy">
    <?php } ?>

    with the following code snippet:

    <?php ob_start(); ?>
    <?php if ( has_post_thumbnail() ) { ?>
    	<img src="<?php echo esc_url($featured_image_src[0]); ?>" data-src="<?php echo esc_url($featured_image_data_src[0]); ?>" alt="<?php echo $featured_image_title; ?>" class="swiper-lazy wp-post-image">
    <?php } else { ?>
    	<img src="<?php echo esc_url(wc_placeholder_img_src()); ?>" data-src="<?php echo esc_url(wc_placeholder_img_src()); ?>" class="swiper-lazy">
    <?php } ?>
    <?php echo apply_filters('post_thumbnail_html', ob_get_clean(), $post->ID); ?>

    Best Regards
    YITH Support

    • This reply was modified 7 years, 7 months ago by YITHEMES.
    Thread Starter mcpsalmy

    (@mcpsalmy)

    Dear Team,

    Thanks for the feedback.

    However, my problem is that once i activate the badge on any product, the thumbnails wont be clickable again and i get the badge scattered all over the thumbnail of the product gallery.

    I gave both instances so that you will see how normal the site is without the badge and how unclickable the product gallery becomes on products that i activated the badge.

    Please dont get tired of assisting me. lol

    see this image to understand better
    https://ibb.co/dTyy1a

    Same problem. The badge gets placed on gallery images, making them unclickable. Instead it’d make more sense to put the badge only on the main image.

    However it doesn’t appear on the main image at all

    Plugin Author YITHEMES

    (@yithemes)

    Hi there!

    You can remove the badges on product thumbnails by adding the following code snippet in your theme functions.php:

    if ( function_exists( 'YITH_WCBM' ) && !empty( YITH_WCBM()->frontend ) ) {
            remove_filter( 'woocommerce_single_product_image_thumbnail_html', array( YITH_WCBM()->frontend, 'show_badge_on_product_thumbnail' ), 99 );
    }

    This way the thumbnails will be clickable again! ??

    However it doesn’t appear on the main image at all

    Probably you are not using the default style for product thumbnail. Please, @ponicshop, could you provide us with a link in which this issue occurs?

    Best Regards
    YITH Support

    • This reply was modified 7 years, 6 months ago by YITHEMES.
    • This reply was modified 7 years, 6 months ago by YITHEMES.
    • This reply was modified 7 years, 6 months ago by YITHEMES.

    Here is an example of a page that has free shipping but the free shipping badge doesn’t show up on the image.

    https://ponicshop.com/shop/nutrients-fertilizer-ph/general-organics-biobud-qt/

    The thumbnail issue was fixed though, thanks!

    Is this being addressed?

    Plugin Author YITHEMES

    (@yithemes)

    HI @ponicshop,
    We see you are using the default style for product thumbnail; we tested it with the following configuration:

    • WordPress 4.8.1
    • WooCommerce 3.1.1
    • YITH WooCommerce Badge Management 1.3.5
    • Shopkeeper 2.0.5

    and the code we sent works fine on our local installation.

    Please note: we see you are not using any child theme; in this case, you should either put the code that we sent directly into wp-content/themes/shopkeeper/woocommerce/single-product/product-image-default.php or create a child theme first.

    However, in this case we always suggest contacting the theme developers and asking them to add/use the post_thumbnail_html missing hooks in their theme.

    Best Regards
    YITH Support

    Plugin Author YITHEMES

    (@yithemes)

    Hi there,
    our developers made some other tests.
    To show the badge in single product page with Shopkeeper theme, you should only add the following code snippet to your theme functions.php:

    if ( function_exists( 'YITH_WCBM' ) && !empty( YITH_WCBM()->frontend ) ) {
        remove_filter( 'woocommerce_single_product_image_thumbnail_html', array( YITH_WCBM()->frontend, 'show_badge_on_product_thumbnail' ), 99 );
        add_action( 'woocommerce_before_single_product_summary_product_images', array( YITH_WCBM()->frontend, 'theme_badge_container_start' ), 19 );
        add_action( 'woocommerce_before_single_product_summary_product_images', array( YITH_WCBM()->frontend, 'theme_badge_container_end' ), 21 );
    }

    Please note: overriding templates is not required!

    Best Regards
    YITH Support

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Badge showing on single product page and covering product gallery pictures’ is closed to new replies.