<?php 
	/**
		* Layout Theme Default
		* @version     1.0.0
	**/
	if($template== 'default'){
?>
	<div id="<?php echo $pf_id ?>" class="sw-best-seller-product vc_element image-left image-left85">
		<?php if( $title != '' ){ ?>
			<div class="box-title"><h3><?php echo $title ?></h3></div>
		<?php } ?>
		<div class="wrap-content">
		<?php
			while ( $r -> have_posts() ) : $r -> the_post();
			global $product, $post;
		?>
			<div class="item">
				<div class="item-wrap">
					<div class="item-img">
						<a href="<?php echo get_permalink($post->ID) ?>" title="<?php echo esc_attr( $post->post_title ) ?>">
						<?php 
							if( has_post_thumbnail() ){  
								echo get_the_post_thumbnail( $r->post->ID, 'shop_thumbnail', array( 'alt' => $post->post_title ) );
							}else{
								echo '<img src="'.get_template_directory_uri().'/assets/img/placeholder/shop_thumbnail.png" alt="No thumb"/>';
							}
						?>
						</a>
					</div>
					<div class="item-content">
						<?php emarket_template_loop_product_title(); ?>	
						<?php woocommerce_template_loop_price(); ?>										 
					</div>
				</div>
			</div>
			<?php 
			endwhile;
			wp_reset_postdata();
			?>
		</div>
	</div>
	<?php
}elseif($template == 'slide'){ ?>
	<div id="<?php echo $pf_id ?>" class="sw-best-seller-product-slider vc_element carousel slide <?php echo $el_class ?>" data-interval="0">
		<?php if( $title != '' ){ ?>
			<div class="box-title"><h3><?php echo $title ?></h3></div>
		<?php } ?>
		<div class="customNavigation nav-left-product">
			<a title="<?php echo esc_attr__( 'Previous', 'emarket' ) ?>" class="btn-bs prev-bs"  href="#<?php echo $pf_id ?>" role="button" data-slide="prev"></a>
			<a title="<?php echo esc_attr__( 'Next', 'emarket' ) ?>" class="btn-bs next-bs" href="#<?php echo $pf_id ?>" role="button" data-slide="next"></a>
		</div>
		<div class="carousel-inner">
		<?php 
			$i = 0;
			while ( $r -> have_posts() ) : $r -> the_post();
			global $product, $post;
			if( ( $i % $item_slide ) == 0 && ( $item_slide != 0 ) ){
			$active = ( $i == 0 ) ? 'active' : '';
		?>
			<div class="item <?php echo $active ?>" >
			<?php } ?>
				<div class="item-wrap">
					<div class="item-img">
						<a href="<?php echo get_permalink($post->ID) ?>" title="<?php echo esc_attr( $post->post_title ) ?>">
							<?php 
							if( has_post_thumbnail() ){  
								echo ( get_the_post_thumbnail( $r->post->ID, 'shop_thumbnail', array( 'alt' => $post->post_title ) ) ) ? get_the_post_thumbnail( $r->post->ID, 'shop_thumbnail', array( 'alt' => $post->post_title ) ):'<img src="'.get_template_directory_uri().'/assets/img/placeholder/shop_thumbnail.png" alt="No thumb"/>' ;
							}else{ 
								echo '<img src="'.get_template_directory_uri().'/assets/img/placeholder/shop_thumbnail.png" alt="No thumb"/>';
							}
							?>
						</a>
						<?php sw_label_sales() ?>
						<?php echo emarket_quickview() ;?>
					</div>
					<div class="item-content">
						<?php emarket_template_loop_product_title(); ?>	
						<?php woocommerce_template_loop_rating(); ?>
						<?php woocommerce_template_loop_price(); ?>	
					</div>
				</div>
			<?php if( ( $i+1 ) % ($item_slide) == 0 || ( $i+1 ) == $numb_post ){ ?>
			</div>
		<?php }
			$i++;endwhile;
			wp_reset_postdata();
		?>
		</div>
	</div>
<?php 
}elseif($template == 'slide2'){ ?>
	<div id="<?php echo $pf_id ?>" class="sw-best-seller-product-slider2 vc_element carousel slide <?php echo $el_class ?>" data-interval="0">
		<?php if( $title != '' ){ ?>
			<div class="box-title"><h3><?php echo $title ?></h3></div>
		<?php } ?>
		<div class="customNavigation nav-left-product">
			<a title="<?php echo esc_attr__( 'Previous', 'emarket' ) ?>" class="btn-bs prev-bs"  href="#<?php echo $pf_id ?>" role="button" data-slide="prev"></a>
			<a title="<?php echo esc_attr__( 'Next', 'emarket' ) ?>" class="btn-bs next-bs" href="#<?php echo $pf_id ?>" role="button" data-slide="next"></a>
		</div>
		<div class="carousel-inner">
		<?php 
			$i = 0;
			while ( $r -> have_posts() ) : $r -> the_post();
			global $product, $post;
			if( ( $i % $item_slide ) == 0 && ( $item_slide != 0 ) ){
				$active = ( $i == 0 ) ? 'active' : '';
		?>
				<div class="item <?php echo $active ?>" >
			<?php } ?>
					<div class="item-wrap">
						<div class="item-img">
							<a href="<?php echo get_permalink($post->ID) ?>" title="<?php echo esc_attr( $post->post_title ) ?>">
							  <?php 
							  if( has_post_thumbnail() ){  
								echo ( get_the_post_thumbnail( $r->post->ID, 'shop_thumbnail', array( 'alt' => $post->post_title ) ) ) ? get_the_post_thumbnail( $r->post->ID, 'shop_thumbnail', array( 'alt' => $post->post_title ) ):'<img src="'.get_template_directory_uri().'/assets/img/placeholder/shop_thumbnail.png" alt="No thumb"/>' ;
							  }else{ 
								echo '<img src="'.get_template_directory_uri().'/assets/img/placeholder/shop_thumbnail.png" alt="No thumb"/>';
							  }
							  ?>
							</a>
						</div>
						<div class="item-content">
							<?php woocommerce_template_loop_rating(); ?>
							<?php woocommerce_template_loop_price(); ?>	
							<?php emarket_template_loop_product_title(); ?>	
						</div>
					</div>
					<?php if( ( $i+1 ) % ($item_slide) == 0 || ( $i+1 ) == $numb_post ){ ?>
				</div>
		<?php }
			$i++;endwhile;
			wp_reset_postdata();
		?>
		</div>
	</div>
<?php 
}