<?php
/**
 * The template for displaying product content in the single-product.php template
 *
 * Override this template by copying it to yourtheme/woocommerce/content-single-product.php
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version    3.6.0
 */

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
	global $product, $post;
	$product_style_variation = emarket_options()->getCpanelValue('product_style_variation');
?>

<?php
	/**
	 * woocommerce_before_single_product hook
	 *
	 * @hooked woocommerce_show_messages - 10
	 */

	$product_id = $post->ID;
	$pd_template_id = get_post_meta( $product_id, 'pd_template_id', true );
	if ( post_password_required() ) {
		echo get_the_password_form();
		return;
	}
	$product_single_full_bg = emarket_options()->getCpanelValue('product_single_full_bg');
	
	$classes_single = ( sw_woocommerce_vendor_check() && emarket_sidebar_product() === 'full' ) ? 'has-vendor' : ''; 
	$classes_single .= $product_style_variation ? ' variation-select' : '';
	$classes_single .= ( $pd_template_id && $pd_template_id != 'none' ) ? ' single-design' : '';
?>
<div class="container">
	<div class="sidebar-row <?php echo esc_attr( ( in_array( emarket_sidebar_product(), ['left', 'right'] ) && ( is_active_sidebar('left-product-detail') || is_active_sidebar('right-product-detail') ) ) ? 'sidebar ' . emarket_sidebar_product() : '' ); ?>">
		<?php if ( is_active_sidebar('left-product-detail') && emarket_sidebar_product() == 'left' ): ?>
		<aside id="left" class="sidebar sidebar-product sidebar-widget">
			<button class="show-sidebar">
				<svg class="default-icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16" fill="currentColor"><path d="M10.2326 0H5.76744C1.72428 0 0 1.72428 0 5.76744V10.2326C0 14.2757 1.72428 16 5.76744 16H10.2326C14.2757 16 16 14.2757 16 10.2326V5.76744C16 1.72428 14.2757 0 10.2326 0ZM9.67442 14.8837H5.76744C2.33377 14.8837 1.11628 13.6662 1.11628 10.2326V5.76744C1.11628 2.33377 2.33377 1.11628 5.76744 1.11628H9.67442V14.8837ZM14.8837 10.2326C14.8837 13.4727 13.798 14.7379 10.7907 14.8703V1.12967C13.798 1.26214 14.8837 2.52726 14.8837 5.76744V10.2326ZM5.41767 5.70047L7.32279 7.60558C7.37463 7.65735 7.41576 7.71883 7.44382 7.78651C7.47188 7.85419 7.48633 7.92673 7.48633 8C7.48633 8.07327 7.47188 8.14581 7.44382 8.21349C7.41576 8.28117 7.37463 8.34265 7.32279 8.39442L5.41767 10.2995C5.31236 10.4012 5.17135 10.4573 5.025 10.456C4.87866 10.4547 4.7387 10.3959 4.63526 10.2924C4.53183 10.1888 4.4732 10.0488 4.47199 9.90248C4.47079 9.75613 4.52712 9.61517 4.62884 9.50995L6.13953 8L4.62884 6.49005C4.52712 6.38483 4.47079 6.24387 4.47199 6.09752C4.4732 5.95118 4.53183 5.81116 4.63526 5.70763C4.7387 5.6041 4.87866 5.54533 5.025 5.54399C5.17135 5.54265 5.31236 5.59884 5.41767 5.70047Z"></path></svg>
				<svg class="hidden-icon" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 36 36"><path fill="currentColor" d="m19.41 18l8.29-8.29a1 1 0 0 0-1.41-1.41L18 16.59l-8.29-8.3a1 1 0 0 0-1.42 1.42l8.3 8.29l-8.3 8.29A1 1 0 1 0 9.7 27.7l8.3-8.29l8.29 8.29a1 1 0 0 0 1.41-1.41Z"/></svg>
			</button>
			<div class="sidebar-widget-wrapper">
				<?php dynamic_sidebar('left-product-detail'); ?>
			</div>
		</aside>
		<?php endif; ?>

		<div id="contents-detail">
			<?php
				/**
				 * woocommerce_before_main_content hook
				 *
				 * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
				 * @hooked woocommerce_breadcrumb - 20
				 */
				do_action('woocommerce_before_main_content');
			?>
			<div class="single-product">
			
				<?php while ( have_posts() ) : the_post(); ?>
					<?php do_action( 'woocommerce_before_single_product' ); ?>
					<div id="product-<?php the_ID(); ?>" <?php post_class(); ?>>
						<div class="product_detail <?php echo esc_attr( $classes_single ); ?>">
							<div class="slider_img_productd">
								<!-- woocommerce_show_product_images -->
								<?php
									/**
									 * woocommerce_show_product_images hook
									 *
									 * @hooked woocommerce_show_product_sale_flash - 10
									 * @hooked woocommerce_show_product_images - 20
									 */
									do_action( 'woocommerce_before_single_product_summary' );
								?>
							</div>							
							<div class="content_product_detail">
								<?php echo do_shortcode( '[emarket_product_vendor]' ); ?>
								<!-- woocommerce_template_single_title - 5 -->
								<!-- woocommerce_template_single_rating - 10 -->
								<!-- woocommerce_template_single_price - 20 -->
								<!-- woocommerce_template_single_excerpt - 30 -->
								<!-- woocommerce_template_single_add_to_cart 40 -->
								<?php
									/**
									 * woocommerce_single_product_summary hook
									 *
									 * @hooked woocommerce_template_single_title - 5
									 * @hooked woocommerce_template_single_price - 10
									 * @hooked woocommerce_template_single_excerpt - 20
									 * @hooked woocommerce_template_single_add_to_cart - 30
									 * @hooked woocommerce_template_single_meta - 40
									 * @hooked woocommerce_template_single_sharing - 50
									 */
									do_action( 'woocommerce_single_product_summary' );
								?>								
							</div>
							<?php if( sw_woocommerce_vendor_check() && emarket_sidebar_product() === 'full' ) :?>
								<div class="content_vendor_info">
									<!-- woocommerce_show_vendor_info -->
									<?php
										/**
										 * woocommerce_single_product_summary hook
										 *
										 */
										do_action('vendor_single_product');
									?>
								</div>
							<?php endif; ?>
						</div>						
					</div>
					<?php if( emarket_options()->getCpanelValue( 'single_sticky' ) == 1 ) : ?>
						<div class="sticky-detail">
							<div class="container">
								<?php 
									do_action( 'woocommerce_before_shop_loop_item_title' );		
								?>		
								<div class="item-content">
								<?php do_action('sticky_single_product'); ?>
								</div>	
							</div>
						</div>
					<?php endif; ?>
					<div class="tabs clearfix">
						<?php
							/**
							 * woocommerce_after_single_product_summary hook
							 *
							 * @hooked woocommerce_output_product_data_tabs - 10
							 * @hooked woocommerce_output_related_products - 20
							 */
							do_action( 'woocommerce_after_single_product_summary' );
						?>
					</div>

					<?php if (is_active_sidebar('bottom-detail-product')) { ?>
						<div class="bottom-single-product theme-clearfix">
							<?php dynamic_sidebar('bottom-detail-product'); ?>
						</div>
					<?php } ?>
						
					<?php do_action( 'woocommerce_after_single_product' ); ?>
				<?php endwhile; // end of the loop. ?>
			</div>
			
			<?php
				/**
				 * woocommerce_after_main_content hook
				 *
				 * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
				 */
				do_action('woocommerce_after_main_content');
			?>
			<?php do_action( 'swg_bottom_detail_content' ); ?>
		</div>		
		
		<?php if ( is_active_sidebar('right-product-detail') && emarket_sidebar_product() == 'right' ):	?>
		<aside id="right" class="sidebar sidebar-product sidebar-widget">
			<button class="show-sidebar">
				<svg class="default-icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16" fill="currentColor"><path d="M10.2326 0H5.76744C1.72428 0 0 1.72428 0 5.76744V10.2326C0 14.2757 1.72428 16 5.76744 16H10.2326C14.2757 16 16 14.2757 16 10.2326V5.76744C16 1.72428 14.2757 0 10.2326 0ZM9.67442 14.8837H5.76744C2.33377 14.8837 1.11628 13.6662 1.11628 10.2326V5.76744C1.11628 2.33377 2.33377 1.11628 5.76744 1.11628H9.67442V14.8837ZM14.8837 10.2326C14.8837 13.4727 13.798 14.7379 10.7907 14.8703V1.12967C13.798 1.26214 14.8837 2.52726 14.8837 5.76744V10.2326ZM5.41767 5.70047L7.32279 7.60558C7.37463 7.65735 7.41576 7.71883 7.44382 7.78651C7.47188 7.85419 7.48633 7.92673 7.48633 8C7.48633 8.07327 7.47188 8.14581 7.44382 8.21349C7.41576 8.28117 7.37463 8.34265 7.32279 8.39442L5.41767 10.2995C5.31236 10.4012 5.17135 10.4573 5.025 10.456C4.87866 10.4547 4.7387 10.3959 4.63526 10.2924C4.53183 10.1888 4.4732 10.0488 4.47199 9.90248C4.47079 9.75613 4.52712 9.61517 4.62884 9.50995L6.13953 8L4.62884 6.49005C4.52712 6.38483 4.47079 6.24387 4.47199 6.09752C4.4732 5.95118 4.53183 5.81116 4.63526 5.70763C4.7387 5.6041 4.87866 5.54533 5.025 5.54399C5.17135 5.54265 5.31236 5.59884 5.41767 5.70047Z"></path></svg>
				<svg class="hidden-icon" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 36 36"><path fill="currentColor" d="m19.41 18l8.29-8.29a1 1 0 0 0-1.41-1.41L18 16.59l-8.29-8.3a1 1 0 0 0-1.42 1.42l8.3 8.29l-8.3 8.29A1 1 0 1 0 9.7 27.7l8.3-8.29l8.29 8.29a1 1 0 0 0 1.41-1.41Z"/></svg>
			</button>
			<div class="sidebar-widget-wrapper">
				<?php dynamic_sidebar('right-product-detail'); ?>
			</div>
		</aside>
		<?php endif; ?>
		
	</div>
</div>