<?php
/* Woocommerce template. */
$health_id = health_woo_get_page_id();
$health_isProduct = false;

if ( is_single() && get_post_type() == 'product' ) {
	$health_isProduct = true;
}

$health_custom = $health_id > 0 ? get_post_custom($health_id) : array();
$health_layout = isset ($health_custom['pix_page_layout']) ? reset($health_custom['pix_page_layout']) : '2';
$health_sidebar = isset ($health_custom['pix_selected_sidebar'][0]) ? reset($health_custom['pix_selected_sidebar']) : 'sidebar-1';

if ( $health_isProduct === true ) {
	$health_useSettingsGlobal = health_get_option( 'shop_settings_global_product', 'on' );
	if ( $health_useSettingsGlobal == 'on' ) {
		$health_layout = health_get_option( 'shop_settings_sidebar_type', '2');
		$health_sidebar = health_get_option( 'shop_settings_sidebar_content', 'product-sidebar-1' );
	}
}

if ( ! is_active_sidebar($health_sidebar) ) $health_layout = '1';

get_header(); ?>


<section class="page-section">
	<div class="container">
		<div class="row">
			<main class="main-content">

				<?php health_show_sidebar( 'left', $health_layout, $health_sidebar, 1 ); ?>

				<div class="rtd <?php if ( $health_layout == 1 ) : ?>col-lg-12 col-md-12<?php else : ?>col-lg-9 col-md-8<?php endif; ?> col-sm-12 col-xs-12 left-column sidebar-type-<?php echo esc_attr($health_layout == 2 ? 'right' : ($health_layout == 3 ? 'left' : 'hide')); ?>">

					<?php  woocommerce_content(); ?>

				</div>

				<?php health_show_sidebar( 'right', $health_layout, $health_sidebar, 1 ); ?>

			</main>

		</div>
	</div>
</section>

<?php get_footer();?>
