<?php
/**
 *
 * @package Luzuk Premium
 */
 if(get_theme_mod('Faturedproduct_newsletter_main_section_disable') != 'on' ){ ?>
 <?php 
            if( get_theme_mod('faturedproduct_toppadding',true) ) {
                $faturedproduct_toppadding = 'padding-top:'.esc_attr(get_theme_mod('faturedproduct_toppadding')).';';
            }
            if( get_theme_mod('faturedproduct_bottompadding',true) ) {
                $faturedproduct_bottompadding = 'padding-bottom:'.esc_attr(get_theme_mod('faturedproduct_bottompadding')).';';
            }
            if( get_theme_mod('faturedproduct_leftpadding',true) ) {
                $faturedproduct_leftpadding = 'padding-left:'.esc_attr(get_theme_mod('faturedproduct_leftpadding')).';';
            }
            if( get_theme_mod('faturedproduct_rightpadding',true) ) {
                $faturedproduct_rightpadding = 'padding-right:'.esc_attr(get_theme_mod('faturedproduct_rightpadding')).';';
            }
    ?>

<section id="ht-fproductnews-heading-section" class="lz-fproductnews-heading-section" style="<?php echo esc_attr($faturedproduct_toppadding); ?>" "<?php echo esc_attr($faturedproduct_bottompadding); ?>" "<?php echo esc_attr($faturedproduct_leftpadding); ?>" "<?php echo esc_attr($faturedproduct_rightpadding); ?>">
	<div class="container">
		<div class="row row-eq-height">
<?php

if(get_theme_mod('lz_fitness_premium_featured_product_section_disable') != 'on' ){?>
 
	<section id="featured-product-section" class="ht-section col-md-9">
		<div class="inside-full-height">
		<div class="featuredproductbox">
			<div class="featuredproduct-box">
				
					<?php
					$showStatic = true;
					for( $i = 1; $i < 4; $i++ ){
						$lz_fitness_featured_product_page_id = get_theme_mod('lz_fitness_featured_product_page'.$i); 
						if(!empty($lz_fitness_featured_product_page_id)){
							$showStatic = false;
							break;
						}
					}
					$lz_fitness_featured_product_title = get_theme_mod('lz_fitness_featured_product_title', 'Feature Products');
					?>
					<div class="row">
						<div class="ht-section-title-tagline">
							<h2 class="ht-section-title lz-featuredproduct-heading">
								<?php
								if(!empty($lz_fitness_featured_product_title))	{
									echo ($lz_fitness_featured_product_title);
								} ?>
							</h2>
							<div class="clearfix"></div>
						</div>
						<div class="clearfix"></div>
					</div>
					<div class="clearfix"></div>
					<div class="row">
									<?php
					    		if(function_exists('woocommerce_template_loop_add_to_cart') && function_exists('WC')){
					    			$args = array( 'post_type' => 'product', /*'stock' => 1,*/ 'posts_per_page' => 9, 'orderby' =>'date','order' => 'DESC' );
					    			$meta_query   = WC()->query->get_meta_query();
					    			$tax_query   = WC()->query->get_tax_query();
					    			$tax_query[] = array(
					    				'taxonomy' => 'product_visibility',
					    				'field'    => 'name',
					    				'terms'    => 'featured',
					    				'operator' => 'IN',
					    			);
					    			$args = array(
					    				'post_type'   =>  'product',
					    				'stock'       =>  1,
					    				'posts_per_page' => -1, 
					    				'orderby'     =>  'date',
					    				'order'       =>  'DESC',
					    				'meta_query'  =>  $meta_query,
					    				'tax_query'   => $tax_query,
					    			);
					    			$loop = new WP_Query( $args );
					    			if($loop->post_count > 0){
					    				while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
					    				<div class="col-md-4 col-sm-6 featured-product fpost wow zoomIn"> 
							    				<div id="recent-porduct" class="">
							    						<div class="col-md-5 padding0">
								    						<div class="pro-img text-center">
								    							<a id="id-<?php the_id(); ?>" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
								    								<?php if (has_post_thumbnail( $loop->post->ID )) 
								    								echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog');
								    								else
								    									echo '<img src="'.get_template_directory_uri().'/images/default.png" alt="Placeholder" width="100%" height="200px" />'; ?>	
								    							</a>
								    						</div>
							    						</div>
							    						<div class="col-md-7 padding0">
								    						<div class="total-product-title-wrap">
								    							<a id="id-<?php the_id(); ?>" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">	
																	<h6><?php the_title();?></h6>
																</a>
																<span class="price"><?php echo $product->get_price_html(); ?></span>
																<div class="clearfix"></div>
																<!-- <div class="add-to-cart">
																	<?php
																	// woocommerce_template_loop_add_to_cart( $loop->single-product, $product );
																	//woocommerce_template_loop_add_to_cart();
																	?>
																</div> -->
															</div>
														</div>
													<div class="clearfix"></div>
												</div>
										</div><!-- /span3 -->
										<?php
									endwhile; 
								}else{ ?>
								<div class="alert alert-warning text-center">
									<strong>Sorry, no featured product to show.</strong>
								</div>
								<?php
							}
							?>
							<!-- </div>-->
							<!-- </div>-->
							<?php
							wp_reset_query(); 
						}else{ ?>
						<div class="alert alert-warning text-center">
							Kindly Install or Activate the WooCommerce plugin.
						</div>
						<?php
					}
					?>
				</div>
				<div class="clearfix"></div>
			</div>
			<div class="clearfix"></div>
		</div>
		</div>
		<div class="clearfix"></div>
	</section>

	<script>
	jQuery.noConflict();
	$(function(){
		function fpostHeight(){
			var ht = 0;
			$('#featured-product-section #recent-porduct').each(function(i){
				var tHt = $(this).height();
				if(ht<tHt){
					ht=tHt;
				}
			});
			$('#featured-product-section #recent-porduct').height(ht+'px');
		}
		fpostHeight();
	});
	$( window ).resize(function(){
		fpostHeight();
	});
</script>

<?php }
?>


<?php
/**
 *
 * @package Luzuk Premium
 */
 if(get_theme_mod('lz_fitness_newslatter_section_disable') != 'on' ){ ?>
 	
<section id="ht-newslatter-section" class="col-md-3 lz-newslatter-section">
	<div class="inside-full-height">
		<div class="newscolors">
				<div class="newsbox">
			<?php
				$lz_fitness_newslatter_title = get_theme_mod('lz_fitness_newslatter_title', 'SIGN UP FOR <span> NEWSLETTER</span>');
				$lz_fitness_newslatter_sub_title = get_theme_mod('lz_fitness_newslatter_sub_title', 'Enter your email in the box bellow to receive letest news');
				$lz_fitness_newslatter_form_shortcode = get_theme_mod('lz_fitness_newslatter_form_shortcode', 'Add your form shortcode here.');
				?>
			<div class=" wow fadeInUp" data-wow-duration="1s">

				<div class="newslatter-box">
						
						<div class="sect-height-newslatter-box">

							<div class="inside-full-height">
								<?php if( $lz_fitness_newslatter_title || $lz_fitness_newslatter_title ){ ?>
								<div class="ht-section-title-tagline">
									<?php if($lz_fitness_newslatter_title){ ?>
									<h2 class="ht-section-title lz-newslatter-heading"><?php echo ($lz_fitness_newslatter_title); ?></h2>
									<?php } ?>

									<?php if($lz_fitness_newslatter_sub_title){ ?>
									<div class="ht-section-tagline lz-newslatter-text"><?php echo($lz_fitness_newslatter_sub_title); ?></div>
									<?php } ?>
									<div class="clearfix"></div>
								</div>
								<?php } ?>
									
								<div class="newsform-box">
									<div class="newsletter-form-box">
										<?php echo do_shortcode($lz_fitness_newslatter_form_shortcode);?>
										<div class="clearfix"></div>
									</div>
								</div>

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

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

			</div>
			<div class="clearfix"></div>
		</div>
			<div class="clearfix"></div>
		</div>
		<div class="clearfix"></div>
	</div>
	<div class="clearfix"></div>
</section>
<?php  }
?>

<div class="clearfix"></div>
</div>
</div>
</section>
<?php  }
?>
