<?php if ( get_theme_mod('arcade_games_products_section_enable', true) == true ) : ?>
<div id="hot_products" class="py-5">
	<div class="container">
    <div class="text-center wow fadeInLeft">
      <?php if ( get_theme_mod('arcade_games_products_short_heading') ) : ?>
        <h6><?php echo esc_html(get_theme_mod('arcade_games_products_short_heading'));?></h6>
      <?php endif; ?>
      <?php if ( get_theme_mod('arcade_games_products_main_heading') ) : ?>
  		  <h3><?php echo esc_html(get_theme_mod('arcade_games_products_main_heading'));?></h3>
      <?php endif; ?>
    </div>
    <div class="row mt-5">
      <div class="col-lg-2">
      </div>
      <div class="col-lg-4 col-md-6 product-cat-main">
        <?php if(class_exists('woocommerce')){ ?>
          <button class="product-btn"><?php esc_html_e('System Type','arcade-games'); ?><i class="fas fa-chevron-down"></i></button>
          <div class="product-cat">
            <?php
              $arcade_games_args = array(
                'orderby'    => 'title',
                'order'      => 'ASC',
                'hide_empty' => 0,
                'parent'  => 0
              );
              $product_categories = get_terms( 'product_cat', $arcade_games_args );
              $arcade_games_count = count($product_categories);
              if ( $arcade_games_count > 0 ){
                  foreach ( $product_categories as $arcade_games_product_category ) {
                    $product_cat_id   = $arcade_games_product_category->term_id;
                    $cat_link = get_category_link( $product_cat_id );
                    if ($arcade_games_product_category->category_parent == 0) { ?>
                  <li class="drp_dwn_menu"><a href="<?php echo esc_url(get_term_link( $arcade_games_product_category ) ); ?>">
                  <?php
                }
                echo esc_html( $arcade_games_product_category->name ); ?></a><i class="fas fa-chevron-right ms-3"></i></li>
            <?php } } ?>
          </div>
        <?php }?>
      </div>
      <div class="col-lg-4 col-md-6 text-center">
        <?php if(class_exists('woocommerce')){ ?>
          <form method="get" class="woocommerce-product-search" action="<?php echo esc_url(home_url('/')); ?>">
            <label class="screen-reader-text" for="woocommerce-product-search-field"><?php esc_html_e('Search for:', 'arcade-games'); ?></label>
            <input type="search" id="woocommerce-product-search-field" class="search-field " placeholder="<?php echo esc_attr('Search Here','arcade-games'); ?>" value="<?php echo get_search_query(); ?>" name="s"/>
            <button type="submit" value="" class="search-button"><i class="fas fa-search"></i></button>
            <input type="hidden" name="post_type" value="product"/>
          </form>
        <?php }?>
      </div>
      <div class="col-lg-2">
      </div>
    </div>
    <div class="owl-carousel">
      <?php
      $arcade_games_product_data = get_theme_mod('arcade_games_products_category');
      if ( class_exists( 'WooCommerce' ) ) {
        $arcade_games_args = array(
          'post_type' => 'product',
          'posts_per_page' => get_theme_mod('arcade_games_products_per_page'),
          'product_cat' => $arcade_games_product_data,
          'order' => 'ASC'
        );
        $loop = new WP_Query( $arcade_games_args );
        while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
        	<div class="product-box">
            <div class="tab-product wow zoomIn">
              <div class="product-image my-2">
                <figure>
                  <?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); else echo '<img src="'.esc_url(wc_placeholder_img_src()).'" />'; ?>
                </figure>
              </div>
              <div class="product-details text-left align-self-center row">
                <div class="col-lg-9 col-md-8 col-sm-9 col-9 align-self-center">
                  <h4 class="product-text mt-2 "><a href="<?php echo esc_url(get_permalink( $loop->post->ID )); ?>"><?php the_title(); ?></a></h4>
                </div>
                <div class="col-lg-3 col-md-4 col-sm-3 col-3 text-start align-self-center">
                  <div class="cart-button">
                    <span class="icon" href="<?php if(function_exists('wc_get_cart_url')){ echo esc_url(wc_get_cart_url()); } ?>"><span class="button1"><?php if( $product->is_type( 'simple' ) ) { woocommerce_template_loop_add_to_cart(  $loop->post, $product );} ?></span></span>
                  </div>
                </div>
              </div>
            </div>
          </div>
        <?php endwhile; wp_reset_query(); ?>
      <?php } ?>
	  </div>
	</div>
</div>
<?php endif; ?>
