<?php
/**
 * The Template for displaying all single products.
 *
 * Override this template by copying it to yourtheme/woocommerce/single-product.php
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     3.2.1
 */
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}
$meta = _WSH()->get_meta('_bunch_layout_settings');
$meta1 = _WSH()->get_meta('_bunch_header_settings');
$layout = buildark_set( $meta, 'layout', 'left' );
$sidebar = buildark_set( $meta, 'sidebar', 'default-sidebar' );

$layout = ($layout) ? $layout : 'left';
$sidebar = ($sidebar) ? $sidebar : 'default-sidebar';

$classes = ( !$layout || $layout == 'full' || buildark_set($_GET, 'layout_style')=='full' ) ? ' col-lg-12 col-md-12 col-sm-12 col-xs-12 ' : ' content-side col-lg-9 col-md-8 col-sm-12 col-xs-12 ' ;

$title = buildark_set($meta1, 'header_title');
$desc = buildark_set($meta1, 'header_desc');

get_header( 'shop' ); ?>

<!--Page Title-->
<section class="page-title">
	<div class="auto-container">
		<h1><?php if($title) echo wp_kses_post($title); else wp_title('');?></h1>
		<div class="text"><?php echo wp_kses_post( $desc );  ?></div>
	</div>
</section>
<!--End Page Title-->

<!--Page Info-->
<section class="page-info">
	<div class="auto-container">
		<?php echo wp_kses_post(buildark_get_the_breadcrumb()) ?>
	</div>
</section>
<!--End Page Info-->

<div class="sidebar-page-container">
    <div class="auto-container">
    	<div class="row clearfix">
			
            <!-- sidebar area -->
			<?php if ( $layout == 'left' ) : ?>
				<?php if ( is_active_sidebar( $sidebar ) ) : ?>
					<div class="sidebar-side col-lg-3 col-md-4 col-sm-12 col-xs-12">        
						<aside class="sidebar default-sidebar">
							<?php dynamic_sidebar( $sidebar ); ?>
							<?php
									/**
									 * woocommerce_sidebar hook
									 *
									 * @hooked woocommerce_get_sidebar - 10
									 */
									do_action( 'woocommerce_sidebar' );
								?>
						</aside>
					</div>
				<?php endif; ?>
			<?php endif; ?>
			
            <section class="<?php echo esc_attr($classes);?>">
            <?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' );
            ?>
                <?php while ( have_posts() ) : the_post(); ?>
                    <?php wc_get_template_part( 'content', 'single-product' ); ?>
                <?php endwhile; // end of the loop. ?>
            <?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' );
            ?>
            
            </section>
		
        	<!-- sidebar area -->
			<?php if( $layout == 'right' ): ?>
				<?php if ( is_active_sidebar( $sidebar ) ) : ?>
					<div class="sidebar-side col-lg-3 col-md-4 col-sm-12 col-xs-12">        
						<aside class="sidebar default-sidebar">
							<?php dynamic_sidebar( $sidebar ); ?>
							<?php
								/**
								 * woocommerce_sidebar hook
								 *
								 * @hooked woocommerce_get_sidebar - 10
								 */
								do_action( 'woocommerce_sidebar' );
							?>
						</aside>
					</div>
				<?php endif; ?>
			<?php endif; ?>
		</div>
	</div>
</div>
<?php get_footer( 'shop' ); ?>
