<?php get_header();

if(is_shop() || is_product_category() || is_product_tag()) {
	
	
	
} 

?>
            <div id="main" class="container">
            	
                   <?php
			
					global $smof_data;
		
					$main_shop_layout = (!empty($smof_data['main_shop_layout'])) ? $smof_data['main_shop_layout'] : 'no-sidebar';
					$single_product_layout = (!empty($smof_data['single_product_layout'])) ? $smof_data['single_product_layout'] : 'no-sidebar';
					
					//single product layout
					if(is_product()){
						
						if($single_product_layout == 'right-sidebar' || $single_product_layout == 'left-sidebar'){ 
							add_filter('loop_shop_columns', 'loop_columns');
						}
						
						switch($single_product_layout) {
							case 'no-sidebar':
								woocommerce_content(); 
								break; 
							case 'right-sidebar':
								echo '<div class="row">';
								echo '<div class="span9 singleProduct">';
									woocommerce_content(); 
								echo '</div><!--/span9-->';
								
		
									get_sidebar(); 
		
								echo '</div><!--/row-->';
								break; 
								
							case 'left-sidebar':
								echo '<div class="row">';
				
									get_sidebar(); 
					
								
								echo '<div class="span9 singleProduct">';
									woocommerce_content(); 
								echo '</div><!--/span9-->';
								echo '</div><!--/row-->';
								break; 
							default: 
								woocommerce_content(); 
								break; 
						}
				
					}
					
					//Main Shop page layout 
					elseif(is_shop() || is_product_category() || is_product_tag()) {
						
						if($main_shop_layout == 'right-sidebar' || $main_shop_layout == 'left-sidebar'){ 
							add_filter('loop_shop_columns', 'loop_columns');
						}
						
						switch($main_shop_layout) {
							case 'no-sidebar':
								woocommerce_content(); 
								break; 
							case 'right-sidebar':
								echo '<div class="row">';
								echo '<div id="post-area" class="span9">';
								/* ====== Change Products Columns ====== */

add_filter('loop_shop_columns', 'loop_columns');
if (!function_exists('loop_columns')) {
    function loop_columns() {
        ob_start();
        dynamic_sidebar("WooCommerce Sidebar");
        $wsidebar = ob_get_clean();
        if($wsidebar)
            return 3; // 3 products per row
        return 4; // 3 products per row
    }
}

									woocommerce_content(); 
								echo '</div><!--/span9-->';
								
								
									get_sidebar(); 
					
								echo '</div><!--/row-->';
								
								break; 
								
							case 'left-sidebar':
								echo '<div class="row">';
					
									get_sidebar(); 
						
								
								echo '<div id="post-area" class="span9">';
								/* ====== Change Products Columns ====== */

add_filter('loop_shop_columns', 'loop_columns');
if (!function_exists('loop_columns')) {
    function loop_columns() {
        ob_start();
        dynamic_sidebar("WooCommerce Sidebar");
        $wsidebar = ob_get_clean();
        if($wsidebar)
            return 3; // 3 products per row
        return 4; // 3 products per row
    }
}

									woocommerce_content(); 
								echo '</div><!--/span9-->';
								echo '</div><!--/row-->';
								break; 
							default: 
								echo '<div class="row">';
								echo '<div id="post-area" class="span12">';
									woocommerce_content(); 
								echo '</div><!--/span12-->';
								
								
								 
					
								echo '</div><!--/row-->';
								break; 
						}
		
					}
					
					//regular WooCommerce page layout 
					else {
						 woocommerce_content(); 
					}
					
					?>

               
            </div><!--End Main-->
        </div><!--End Content-->
<?php get_footer();?>
