<?php 
global $product;
$swg_featured_video   = get_post_meta( $product->get_id(), 'featured_video_product', true );
$swg_single_product_layout = emarket_options()->getCpanelValue( 'product_single_style' );
$row = ( $swg_single_product_layout === 'style13' ) ? 1 : 2;
$arrow = ( $swg_single_product_layout === 'style13' ) ? 'true' : 'false';
?>
<div id="product_img_<?php echo esc_attr( $post->ID ); ?>" class="swg-product-gallery-style2 woocommerce-product-gallery woocommerce-product-gallery--with-images loading" data-column="2" data-row="<?php echo esc_attr( $row ); ?>" data-dots="true" data-arrow="<?php echo esc_attr( $arrow ); ?>" data-video="<?php echo sprintf( ( $swg_featured_video != '' ) ? '%s' : '', esc_url( 'https://www.youtube.com/embed/' . $swg_featured_video ) ); ?>">
	<div class="woocommerce-product-gallery__wrapper">
		<div class="product-images-container">
			<?php do_action( 'swg_single_product_gallery_before_slider' ); ?>
			<?php 
				$attachments = $product->get_gallery_image_ids();
				if( has_post_thumbnail() ){ 				
					$image_id 	 = get_post_thumbnail_id();
					array_unshift( $attachments, $image_id );
					$attachments = array_unique( $attachments );
				}
				if( sizeof( $attachments ) ){			
			?>
			<!-- Image Slider -->
			<div class="slider product-responsive">
				<?php foreach ( $attachments as $key => $attachment ) { ?>
					<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 
							if( wp_get_attachment_image( $attachment, 'shop_single' ) ){
								$full_size_image  = wp_get_attachment_image_src( $attachment, 'full' );
								$attributes = array(
									'class' => 'wp-post-image',
									'title'                   => get_post_field( 'post_title', $attachment ),
									'data-caption'            => get_post_field( 'post_excerpt', $attachment ),
									'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],
								);
								echo wp_get_attachment_image( $attachment, 'shop_single', false, $attributes ); 
							}else{
								echo  wc_placeholder_img( 'shop_single' );
							}
							?>
						</a>
					</div>
					<?php } ?>
			</div>
			<?php }else{ ?>			
				<div class="single-img-product">
					<?php echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<img src="%s" alt="%s" />', wc_placeholder_img_src(), esc_attr__( 'Placeholder', 'emarket' ) ), $post->ID ); ?>
				</div>
			<?php } ?>
		</div>
	</div>
</div>