<?php
/**
 * The Template for displaying product archives, including the main shop page which is a post type archive
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/archive-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 	    http://docs.woothemes.com/document/template-structure/
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     2.0.0
 */

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

get_header( 'shop' ); ?>

	<?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 if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
			
			<?php $your_shop_page = get_post( wc_get_page_id( 'shop' ) ); ?>
			<?php if(!get_post_meta($your_shop_page->ID, 'progression_studios_disable_page_title', true)): ?>
			<div id="page-title-pro" <?php if(get_post_meta($your_shop_page->ID, 'progression_studios_header_image', true)): ?>style="background-image:url('<?php echo esc_url( get_post_meta($your_shop_page->ID, 'progression_studios_header_image', true) );?>');"<?php endif; ?>>
				<div class="width-container-pro">
					<h1 class="entry-title-pro"><?php woocommerce_page_title(); ?></h1>
					<?php if(get_post_meta($your_shop_page->ID, 'progression_studios_sub_title', true)): ?><h4 class="progression-sub-title"><?php echo esc_html(get_post_meta($your_shop_page->ID, 'progression_studios_sub_title', true)); ?></h4><?php endif; ?>
					<div class="clearfix-pro"></div>
				</div>
			</div><!-- #page-title-pro -->
			<?php endif; ?>
		<?php endif; ?>
		
		
		<div id="content-pro" class="site-content">
			<div class="width-container-pro<?php if(get_post_meta($your_shop_page->ID, 'progression_studios_page_sidebar', true) == 'left-sidebar' ) : ?> left-sidebar-pro<?php endif; ?>">
				
				<?php if(get_post_meta($your_shop_page->ID, 'progression_studios_page_sidebar', true) == 'right-sidebar' ) : ?><div id="main-container-pro"><?php endif; ?>
				<?php if(get_post_meta($your_shop_page->ID, 'progression_studios_page_sidebar', true) == 'left-sidebar' ) : ?><div id="main-container-pro"><?php endif; ?>
					
					<?php do_action( 'woocommerce_archive_description' ); ?>
				
					<?php if ( have_posts() ) : ?>

						<?php do_action( 'woocommerce_before_shop_loop' );?>
						<div class="clearfix-pro"></div>
						
						<?php woocommerce_product_loop_start(); ?>

							
							
							<div class="progression-shop-masonry-overflow <?php echo esc_attr(get_theme_mod('progression_studios_shop_layout')); ?>">
								<div class="progression-masonry-margins" style="margin-top:-<?php echo esc_attr(get_theme_mod('progression_studios_shop_gap', '10px')); ?>; margin-left:-<?php echo esc_attr(get_theme_mod('progression_studios_shop_gap', '10px')); ?>; margin-right:-<?php echo esc_attr(get_theme_mod('progression_studios_shop_gap', '10px')); ?>;">
									
									<div class="progression-shop-masonry">
										
										<?php woocommerce_product_subcategories(); ?>
										
										<?php while ( have_posts() ) : the_post(); ?>
											<div class="progression-masonry-item progression-masonry-col-<?php echo esc_attr(get_theme_mod( 'progression_studios_shop_columns', '3')); ?>"><?php wc_get_template_part( 'content', 'product' ); ?></div>
										<?php endwhile;  ?>
									<div class="clearfix-pro"></div>
									</div><!-- close .progression-shop-masonry -->
									
								</div><!-- close .progression-masonry-margins -->
							</div><!-- close .progression-masonry-overflow -->
							
							
						<?php woocommerce_product_loop_end(); ?>
						
						

						<?php do_action( 'woocommerce_after_shop_loop' ); ?>

					<?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?>

						<?php wc_get_template( 'loop/no-products-found.php' ); ?>

					<?php endif; ?>

					<?php do_action( 'woocommerce_after_main_content' ); ?>
				
				
				<?php if(get_post_meta($your_shop_page->ID, 'progression_studios_page_sidebar', true) == 'right-sidebar' ) : ?></div><!-- close #main-container-pro --><?php do_action( 'woocommerce_sidebar' ); ?><div class="clearfix-pro"></div><?php endif; ?>
				<?php if(get_post_meta($your_shop_page->ID, 'progression_studios_page_sidebar', true) == 'left-sidebar' ) : ?></div><!-- close #main-container-pro --><?php do_action( 'woocommerce_sidebar' ); ?><div class="clearfix-pro"></div><?php endif; ?>
				</div><!-- close #main-container-pro -->
				
					
		</div><!-- close .width-container-pro -->
	</div><!-- #content-pro -->
<?php get_footer( 'shop' ); ?>
