<?php
if(get_theme_mod('newarrival_area_disable') != 'on' ){
	?>
	<?php 
		if( get_theme_mod('newarrival_areaTpadding',true) ) {
			$newarrival_areaTpadding = 'padding-top:'.esc_attr(get_theme_mod('newarrival_areaTpadding')).';';
		}
		if( get_theme_mod('newarrival_areaBpadding',true) ) {
			$newarrival_areaBpadding = 'padding-bottom:'.esc_attr(get_theme_mod('newarrival_areaBpadding')).';';
		}
	?>			
	<div id="newarrival" class="newarrival-area ">		  
			<div class="container">
				<?php
					$showStatic = true;
					for( $i = 1; $i < 11; $i++ ){
						$newarrivalus_page_id = get_theme_mod('newarrivalus_page_icon'.$i); 
						if(!empty($newarrivalus_page_id)){
							$showStatic = false;
							break;
						}
					}
		
				?>
					<div class="row mr-0">
		          <div class="col-md-9">
		            <?php
		                $newarrival_title = get_theme_mod('newarrival_title', 'New Arrival From Novart');  
		                $narivlbtntxt = get_theme_mod('narivlbtntxt', 'See All'); 
										$narivlbtnlink = get_theme_mod('narivlbtnlink', 'add link here');
		            ?>
			            <?php if( $newarrival_title){ ?>
			            <div class="section-title">                         
			                  <h2><?php echo ($newarrival_title);  ?></h2>
			            </div>   
			            <?php } ?>
		          </div> 
		          <div class="col-md-3">
		          	<?php if(!empty($narivlbtntxt)){ ?>
		              <div class="narivlbtn">	
							<a href="<?php echo $narivlbtnlink ?>">
								<?php echo ($narivlbtntxt);  ?>
							</a>
					</div>
					<?php }?> 
		          </div>
	    		</div>		
				<div class="newarrivalus-post-wrap">
						<div class="newarrivalus-post-boxes row">
							<!-- <div class="owl-carousel owl-theme">  -->
								<?php
									if(function_exists('woocommerce_template_loop_add_to_cart') && function_exists('WC')){
						    			$args = array( 'post_type' => 'product', 'stock' => 1, 'posts_per_page' => 4, 'orderby' =>'date','order' => 'DESC' );
						    			$meta_query   = WC()->query->get_meta_query();
						    			$tax_query   = WC()->query->get_tax_query();
						    			
						    			$args = array(
						    				'post_type'   =>  'product',
						    				'stock'       =>  1,
						    				'posts_per_page' => 8, 
						    				'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;

										//global $woo_options;
								        //global $post;
								        $terms = get_the_terms( $post->ID, 'product_cat' );
								        foreach ($terms as $term) {
								            $product_cat = $term->name;
								            break;
		       							}
								?>
								<div class="newarrivalbx " data-wow-duration="1s">			
										<div class="newarrivalus-single" >
												<div class="newarrival-box"> 
														<div class="hi-icon">
																<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="featured products" />'; 
									    							?>
																</a>
														</div>
												</div> 
												<div class="newarrival-area-data">
														<a id="id-<?php the_id(); ?>" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
																<h4 class="inner-area-title"><?php the_title();?></h4>
														</a>
														<div class="price"><?php echo $product->get_price_html(); ?></div>
													
												</div>				 
										</div>
								</div>
								<?php					
								endwhile; 
									}
									else{
								?>
							<!-- 	<div class="item  newarrivalbx wow zoomIn" data-wow-duration="1s">
									<div class="newarrivalus-single" >
										<div class="newarrival-box"> 
											<div class="hi-icon">
												<a href="#">
													<img class="img-responsive" src="</?php echo esc_url(get_template_directory_uri().'/images/cat2.jpg');?>" alt="featured products" />
													<div class="skewd"></div>	
												</a>
											</div>
										</div> 
										<div class="newarrival-area-data">
											<a href="#"><h4 class="inner-area-title">Wooden Mirror</h4></a>
											<div class="price">$159.00</div>
											<div class="fea-btn">
												<a href="#">
													<span>Add To Cart</span>
													<span><i class="fa fa-shopping-cart" aria-hidden="true"></i></span>
												</a>
											</div>
										</div>				 
									</div>
								</div> -->
								<?php }
									//wp_reset_query(); 
								}
									?>
								<!-- </div>	 -->
						</div>
				</div>
			</div>
	</div>
<?php }  