<?php
/**
 *
 * @package theme-eye-Premium
 */
if(get_theme_mod('product_category_section_disable') != 'on' ){ ?>
<section id="product-category-section" class="ht-section product-category-section">
	<div class="lightbox">
		<div class="col-md-10 col-md-offset-1">
			<div class="row">
				<div class="product-grid">
					<?php
					$static=true;
					for($i=1;$i<=2;$i++){

						$title = get_theme_mod('product_catelauge_title'.$i);
						$link = get_theme_mod('product_category_link'.$i);
						$img = get_theme_mod('product_category_image'.$i);
						if (!empty($title) || !empty($img) || !empty($link)){
							$static=false;
						}
					}

					if(function_exists('get_woocommerce_term_meta')){
						for($i=1;$i<=2;$i++){

							if($static==false){
								$title = get_theme_mod('product_catelauge_title'.$i);
								$link = get_theme_mod('product_category_link'.$i);
								$img = get_theme_mod('product_category_image'.$i);
								$url = get_theme_mod('product_catelauge_url_'.$i, '#');
								$category = get_term_by( 'id', $link, 'product_cat' );

								$img = !empty($img)?$img:get_template_directory_uri().'/images/collection1.jpg';

								if( !empty($url) || !empty($category) ){
							    	//echo $term->name;
									?>
									<div class="col-md-6 col-sm-6 cat-product">
										<a href="<?php echo esc_url(!empty($url)?$url:'#');?>">
											<img src="<?php echo esc_url($img);?>" alt="" width="520" height="280">
										</a>
										<?php
										$theme_eye_product_cat_page_id = get_theme_mod('theme_eye_product_cat_page');
										$theme_eye_product_cat_button_title = get_theme_mod('theme_eye_product_cat_button_title_'.$i, 'SHOP COLLECTION');
										?>
										<h5>
											<a href="<?php echo esc_url(!empty($url)?$url:'#');?>"><?php echo esc_html($title);?></a>
											<a href="<?php echo esc_url(!empty($url)?$url:'#');?>">
												<div class="category-read-more">
													<button> <?php echo $theme_eye_product_cat_button_title; ?></button>
												</div>
											</a>
										</h5>
									</div>
									<?php
								}
							}
						}
						//echo '<div class="clearfix"></div></div>';
					}else{ ?>
					<div class="alert alert-warning">
						Kindly Install or Activate the WooCommerce plugin.
					</div>
					<?php }

					if($static==true){
						?>
						<div class="col-md-4 col-sm-4 cat-product padding10">
							<a href="#">
								<img class="img-responsive" src="<?php echo get_template_directory_uri(); ?>/images/collection2.jpg" alt="">
							</a>
							<h5>
								<a href="#">SPECIAL WINTER EXCLUSIVE</a>
								<a href="#">
									<div class="category-read-more">
										<button> SHOP NOW</button>
									</div>
								</a>
							</h5>
						</div>
						<div class="col-md-4 col-sm-4 cat-product padding10">
							<a href="#">
								<img class="img-responsive" src="<?php echo get_template_directory_uri(); ?>/images/collection3.jpg" alt="">
							</a>
							<h5>
								<a href="#">MEN'S EXCLUSIVE COLLECTIONS</a>
								<p>SALE UP TO 50% OFF</p>
								<a href="#">
									<div class="category-read-more"> 
										<button> SHOP NOW</button>
									</div>
								</a>
							</h5>
						</div>
						<div class="col-md-4 col-sm-4 cat-product padding10">
							<a href="#">
								<img class="img-responsive" src="<?php echo get_template_directory_uri(); ?>/images/collection1.jpg" alt="">
							</a>
							<h5>
								<a href="#">WOMEN'S EXCLUSIVE COLLECTIONS</a>
								<p>SALE UP TO 50% OFF</p>
								<a href="#">
									<div class="category-read-more">
										<button> SHOP NOW</button>
									</div> 
								</a>
							</h5>
						</div>
						<?php
					}?>

				</div>
			</div>

			<div class="clearfix"></div>
		</div>
		<div class="clearfix"></div>

	</div>

</section>
<?php }

