<?php

echo '<div class="col-12 full-sidebar shop-nosidebar">';
	if ( woocommerce_product_loop() ) {
		/**
		 * Hook: woocommerce_before_shop_loop.
		 *
		 * @hooked woocommerce_output_all_notices - 10
		 * @hooked woocommerce_result_count - 20
		 * @hooked woocommerce_catalog_ordering - 30
		 */

		if( class_exists( 'ReduxFramework' ) ) {
			$celebshine_options = get_option( 'celebshine_options' );
			if( $celebshine_options['shop-page-display'] == "categories" || $celebshine_options['shop-page-display'] == "both" ){
				do_action( 'woocommerce_shop_loop_categories' );
			}
			if( $celebshine_options['category-page-display'] == "subcategories" || $celebshine_options['category-page-display'] == "both" ){
				do_action( 'woocommerce_shop_loop_subcategories' );
			}
		}
		
		echo '<div class="product-top-sorting">';
			do_action( 'woocommerce_before_shop_loop' );
		echo '</div>';
		
		echo '<div class="col-12 full toggle-res" id="post_sidebar">';
			/**
			 * Hook: woocommerce_sidebar.
			 *
			 * @hooked woocommerce_get_sidebar - 10
			 */
			do_action( 'woocommerce_sidebar' ); // Update shop page default widget to custom
		echo '</div>';

		woocommerce_product_loop_start();

		if ( wc_get_loop_prop( 'total' ) ) {
			while ( have_posts() ) {
				the_post();

				/**
				 * Hook: woocommerce_shop_loop.
				 */
				do_action( 'woocommerce_shop_loop' );

				if( class_exists( 'ReduxFramework' ) && function_exists( 'loadmore_postSC' ) ) {
					if( is_shop() ){
						if( $celebshine_options['shop-page-display'] == "products" || $celebshine_options['shop-page-display'] == "both" ){
							$celebshine_options = get_option( 'celebshine_options' );
							$product_layout = isset( $_GET['product_layout'] ) ? sanitize_text_field( $_GET['product_layout'] ) : '';

							if( $product_layout == "default" ){
								wc_get_template_part( 'content', 'product' );
							}elseif( $product_layout == "morden" ){
								wc_get_template_part( 'content', 'product-morden' );
							}elseif( $product_layout == "classic" ){
								wc_get_template_part( 'content', 'product-classic' );
							}elseif( $celebshine_options['product-layout'] == "product-layout-default" ){
								wc_get_template_part( 'content', 'product' );
							}elseif( $celebshine_options['product-layout'] == "product-layout-morden" ){
								wc_get_template_part( 'content', 'product-morden' );
							}elseif( $celebshine_options['product-layout'] == "product-layout-classic" ){
								wc_get_template_part( 'content', 'product-classic' );
							}
						}
					}
					if( ! is_shop() ){
						if( $celebshine_options['category-page-display'] == "products" || $celebshine_options['category-page-display'] == "both" ){

							$celebshine_options = get_option( 'celebshine_options' );
							$product_layout = isset( $_GET['product_layout'] ) ? sanitize_text_field( $_GET['product_layout'] ) : '';

							if( $product_layout == "default" ){
								wc_get_template_part( 'content', 'product' );
							}elseif( $product_layout == "morden" ){
								wc_get_template_part( 'content', 'product-morden' );
							}elseif( $product_layout == "classic" ){
								wc_get_template_part( 'content', 'product-classic' );
							}elseif( $celebshine_options['product-layout'] == "product-layout-default" ){
								wc_get_template_part( 'content', 'product' );
							}elseif( $celebshine_options['product-layout'] == "product-layout-morden" ){
								wc_get_template_part( 'content', 'product-morden' );
							}elseif( $celebshine_options['product-layout'] == "product-layout-classic" ){
								wc_get_template_part( 'content', 'product-classic' );
							} 			
						}
					}
				}else{
					wc_get_template_part( 'content', 'product-classic' );
				}
			}
		}

		woocommerce_product_loop_end();

		if( class_exists( 'ReduxFramework' ) ) {
			$celebshine_options = get_option( 'celebshine_options' );
			if( $celebshine_options['shop-page-display'] == "products" || $celebshine_options['shop-page-display'] == "both" ){
				/**
				 * Hook: woocommerce_after_shop_loop.
				 *
				 * @hooked woocommerce_pagination - 10
				 */
				do_action( 'woocommerce_after_shop_loop' );
			}
		}else{
			do_action( 'woocommerce_after_shop_loop' );
		}
	} else {
		/**
		 * Hook: woocommerce_no_products_found.
		 *
		 * @hooked wc_no_products_found - 10
		 */
		do_action( 'woocommerce_no_products_found' );
	}
echo '</div>';
