<?php
/**
 * The Template for displaying all single products
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/single-product.php.
 *
 * HOWEVER, on occasion WooCommerce will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see 	    https://docs.woocommerce.com/document/template-structure/
 * @package 	WooCommerce/Templates
 * @version     1.6.4
 */

if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly
}

get_header('shop');

$sparta_sidebar_class = '';
$col_class = array();
$wc_detail_layout = get_theme_mod('sparta_woo_detail_layout', 'no-sidebar');
if ($wc_detail_layout !== 'no-sidebar' && is_active_sidebar('sidebar-woo')):
    $col_class[] = 'col-lg-9 ';
else :
    $col_class[] = 'col-lg-12 ';
endif;

if ($wc_detail_layout === 'left-sidebar' && is_active_sidebar('sidebar-woo')):

    $sparta_sidebar_class = $wc_detail_layout;
endif;
?>
<section class="vk-content">
    <div class="vk-banner vk-background-image-4 page-title-product page-title-bg">
        <div class="vk-background-overlay"></div>
        <div class="container ">
            <div class="vk-banner-wrapper">
                <div class="page-heading">
                    <?php if (apply_filters('woocommerce_show_page_title', true)) : ?>
                        <h2 class="woocommerce-products-header__title page-title"><?php woocommerce_page_title(); ?></h2>
                    <?php endif; ?>
                </div>
                <div class="vk-breadcrumb">
                    <?php Sparta_Core::get_sparta_template('breadcrumbs'); ?>
                </div>
            </div>
        </div>
    </div>
    <div class="vk-page shop <?php echo esc_attr($sparta_sidebar_class);?>">
        <div class="container">
            <div class="row">
                <div class="<?php echo esc_attr(implode(' ', $col_class)); ?> prod-content">
                    <?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();
                        wc_get_template_part('content', 'single-product');
                    endwhile;
                    ?>

                    <?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');
                    ?>

                </div>
                <?php if (is_active_sidebar('sidebar-woo') && $wc_detail_layout === 'left-sidebar' || is_active_sidebar('sidebar-woo') && $wc_detail_layout === 'right-sidebar'): ?>
                    <div class="col-lg-3 prod-sidebar">
                        <?php get_sidebar(); ?>
                    </div>
                <?php endif; ?>
            </div>
        </div>
    </div>

</section>
<?php
get_footer();
?>
