• Casper

    (@reycasper21)


    Hi i was using ShoppyStore theme and the badge in single product is not working homepage and category badge is working fine only the single product is having some issue.

    Based on the previous issue posted here also using ShoppyStore theme you recommend some changes on the code under product-image.php but comparing the code posted its has different code.

    Please see code below for product-images.php, could you please help me what need to changes here.

    <div id="product_img_<?php echo esc_attr( $post->ID ); ?>" class="woocommerce-product-gallery woocommerce-product-gallery--with-images images product-images loading" data-vertical="<?php echo ( ($sidebar_product == 'full' && $pdetail_layout == 'default') ||( $sidebar_product == 'full' && $pdetail_layout == 'full1') || ( $sidebar_product == 'lr' && $pdetail_layout == 'full3') ) ? 'true' : 'false'; ?>" data-video="<?php echo ( $ya_featured_video != '' ) ?  esc_url( 'https://www.youtube.com/embed/' . $ya_featured_video ) : ''; ?>">
    	<figure class="woocommerce-product-gallery__wrapper">
    		<?php  sw_label_sales(); ?>	
    	<div class="product-images-container clearfix <?php echo ( ($sidebar_product == 'full' && $pdetail_layout == 'default') ||( $sidebar_product == 'full' && $pdetail_layout == 'full1') || ( $sidebar_product == 'lr' && $pdetail_layout == 'full3') ) ? 'thumbnail-left' : 'thumbnail-bottom'; ?>">
    		<?php 
    			$attachments = ( sw_woocommerce_version_check( '3.0' ) ) ? $product->get_gallery_image_ids() : $product->get_gallery_attachment_ids();
    			if( has_post_thumbnail() ){ 				
    				$image_id 	 = get_post_thumbnail_id();
    				array_unshift( $attachments, $image_id );
    				$attachments = array_unique( $attachments );
    			}
    			if( sizeof( $attachments ) ){
    		?>
    		<?php 
    			if( ($sidebar_product == 'full' && $pdetail_layout == 'default') || ($sidebar_product == 'full' && $pdetail_layout == 'full1') || ( $sidebar_product == 'lr' && $pdetail_layout == 'full3') ){
    				do_action('woocommerce_product_thumbnails');
    			}
    		?>
    		<!-- Image Slider -->
    		<div class="slider product-responsive">
    			<?php
    				foreach ( $attachments as $key => $attachment ) {
    				$full_size_image  = wp_get_attachment_image_src( $attachment, 'full' );
    				$attributes = array(
    					'class' => 'wp-post-image',
    					'title'                   => get_post_field( 'post_title', $post_thumbnail_id ),
    					'data-caption'            => get_post_field( 'post_excerpt', $post_thumbnail_id ),
    					'data-src'                => $full_size_image[0],
    					'data-large_image'        => $full_size_image[0],
    					'data-large_image_width'  => $full_size_image[1],
    					'data-large_image_height' => $full_size_image[2],
    				);
    			?>
    			<div data-thumb="<?php echo wp_get_attachment_image_url( $attachment, 'shop_thumbnail' ) ?>" class="woocommerce-product-gallery__image">	
    				<a href="<?php echo wp_get_attachment_url( $attachment ) ?>"><?php echo wp_get_attachment_image( $attachment, 'shop_single', false, $attributes ); ?></a>
    			</div>
    			<?php } ?>
    		</div>
    		<!-- Thumbnail Slider -->
    		<?php 
    			if( $sidebar_product == 'left' || $sidebar_product == 'right' || ($sidebar_product == 'full' && $pdetail_layout == 'full2') ){
    				do_action('woocommerce_product_thumbnails'); 
    			}
    		?>
    		<?php }else{ 
    				echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<img src="%s" alt="%s" />', wc_placeholder_img_src(), __( 'Placeholder', 'shoppystore' ) ), $post->ID );
    			} 
    		?>
    	</div>
    	</figure>	
    </div>
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Giuseppe Madaudo

    (@askmagic)

    Hi there,
    could you share with me the link of the other post?
    Thank you

    Thread Starter Casper

    (@reycasper21)

    Hello there,

    I hope you’re doing well 😀

    I checked the code you sent us and I added the same filter we added in the past.

    Unfortunately I cannot test it because I cannot find the theme in the themes repository.

    Could you try it and let me know?

    <div id="product_img_<?php echo esc_attr( $post->ID ); ?>" class="woocommerce-product-gallery woocommerce-product-gallery--with-images images product-images loading" data-vertical="<?php echo ( ($sidebar_product == 'full' && $pdetail_layout == 'default') ||( $sidebar_product == 'full' && $pdetail_layout == 'full1') || ( $sidebar_product == 'lr' && $pdetail_layout == 'full3') ) ? 'true' : 'false'; ?>" data-video="<?php echo ( $ya_featured_video != '' ) ?  esc_url( 'https://www.youtube.com/embed/' . $ya_featured_video ) : ''; ?>">
    	<figure class="woocommerce-product-gallery__wrapper">
    		<?php  sw_label_sales(); ?>
    	<div class="product-images-container clearfix <?php echo ( ($sidebar_product == 'full' && $pdetail_layout == 'default') ||( $sidebar_product == 'full' && $pdetail_layout == 'full1') || ( $sidebar_product == 'lr' && $pdetail_layout == 'full3') ) ? 'thumbnail-left' : 'thumbnail-bottom'; ?>">
    		<?php
    			$attachments = ( sw_woocommerce_version_check( '3.0' ) ) ? $product->get_gallery_image_ids() : $product->get_gallery_attachment_ids();
    			if( has_post_thumbnail() ){
    				$image_id 	 = get_post_thumbnail_id();
    				array_unshift( $attachments, $image_id );
    				$attachments = array_unique( $attachments );
    			}
    			if( sizeof( $attachments ) ){
    		?>
    		<?php
    			if( ($sidebar_product == 'full' && $pdetail_layout == 'default') || ($sidebar_product == 'full' && $pdetail_layout == 'full1') || ( $sidebar_product == 'lr' && $pdetail_layout == 'full3') ){
    				do_action('woocommerce_product_thumbnails');
    			}
    		?>
    		<!-- Image Slider -->
    		<div class="slider product-responsive">
    			<?php
    				foreach ( $attachments as $key => $attachment ) {
    				$full_size_image  = wp_get_attachment_image_src( $attachment, 'full' );
    				$attributes = array(
    					'class' => 'wp-post-image',
    					'title'                   => get_post_field( 'post_title', $post_thumbnail_id ),
    					'data-caption'            => get_post_field( 'post_excerpt', $post_thumbnail_id ),
    					'data-src'                => $full_size_image[0],
    					'data-large_image'        => $full_size_image[0],
    					'data-large_image_width'  => $full_size_image[1],
    					'data-large_image_height' => $full_size_image[2],
    				);
    			?>
    			<div data-thumb="<?php echo wp_get_attachment_image_url( $attachment, 'shop_thumbnail' ) ?>" class="woocommerce-product-gallery__image">
    				<a href="<?php echo wp_get_attachment_url( $attachment ) ?>"><?php echo apply_filters( 'post_thumbnail_html', wp_get_attachment_image( $attachment, 'shop_single', false, $attributes ), $post->ID  ); ?></a>
    			</div>
    			<?php } ?>
    		</div>
    		<!-- Thumbnail Slider -->
    		<?php
    			if( $sidebar_product == 'left' || $sidebar_product == 'right' || ($sidebar_product == 'full' && $pdetail_layout == 'full2') ){
    				do_action('woocommerce_product_thumbnails');
    			}
    		?>
    		<?php }else{
    				echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<img src="%s" alt="%s" />', wc_placeholder_img_src(), __( 'Placeholder', 'shoppystore' ) ), $post->ID );
    			}
    		?>
    	</div>
    	</figure>
    </div>

    Also I suggest you to contact to theme developers in order to take a look about it and maybe offer you a stable solution.

    Have a good day.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Single Products not working on ShoppyStore theme’ is closed to new replies.