<?php 

/**
	* Layout Tab Category Default
	* @version     1.0.0
**/

	$tag_id = 'sw_woo_rplisting_'. rand().time();
	$nav_id = 'nav_tabs_res'.rand().time();
	$attribute = 'columns-'.$columns.' columns-md-'.$columns1.' columns-sm-'.$columns2.' columns-xs-'.$columns3;
	$default = array(
		'post_type' => 'product',
		'orderby' => $orderby,
		'order' => $order,
		'meta_key'		=> 'recommend_product',
		'meta_value'	=> '1',
		'post_status' => 'publish',
		'showposts' => $numberposts
	);
	if( $category != '' ){
		$default['tax_query'] = array(
			array(
				'taxonomy'  => 'product_cat',
				'field'     => 'slug',
				'terms'     => $category ),
				'operator' => 'IN'
			);	
	}
	$default = sw_check_product_visiblity( $default );				
	$list = new WP_Query( $default );
	$max_page = $list -> max_num_pages;
	if( $list->have_posts() ) : 
	
?>
<div class="sw-woo-tab-listing style3 woocommerce" id="<?php echo esc_attr( $tag_id ); ?>" >
	<?php if( $title1 != '' ){ ?>
		<div class="box-title"><h3><?php echo  $title1; ?></h3></div>
	<?php } ?>
	<ul class="tab-listing-container products products-loop <?php echo esc_attr( $attribute ); ?>">
		<?php							 
			while($list->have_posts()): $list->the_post();
				wc_get_template_part( 'content', 'product' );
			endwhile; wp_reset_postdata();				
		?>			
	</ul>
	<div class="item item-listing item-more">
		<a href="javascript:void(0)" data-ajaxurl="<?php echo esc_url( sw_ajax_url() ) ?>" data-layout="<?php echo esc_attr( isset( $widget_template ) ? $widget_template : $layout );?>" data-maxpage="<?php echo esc_attr( $max_page ) ?>" data-attributes="<?php echo esc_attr( $attribute ) ?>" data-number="<?php echo esc_attr( $numberposts ) ?>" data-orderby="<?php echo esc_attr( $orderby ) ?>" data-order="<?php echo esc_attr( $order ) ?>" data-category="<?php echo esc_attr( $category ) ?>" data-label-loaded="<?php esc_attr_e( 'All Item', 'emarket' ); ?>" data-label="<?php esc_attr_e( 'Load More', 'emarket' ); ?>"></a>
	</div>
</div>
<?php endif; ?>
