<?php 
/**
 * Template part for displaying Featured Classes Section
 *
 * @package Dog Groomer
 */

$dog_groomer_args = array(
  'post_type' => 'post',
  'post_status' => 'publish',
  'category_name' => get_theme_mod('dog_groomer_student_category'),
); 

$dog_groomer_classes = get_theme_mod('dog_groomer_classes_setting', false);
$dog_groomer_hot_products_cat = get_theme_mod('dog_groomer_hot_products_cat');
?>

<?php if ( $dog_groomer_classes ) { ?>
<div class="our-classes">
    <div class="container">
        <?php if ( class_exists('woocommerce') ) { ?>
        <div class="owl-carousel">
            <?php
            $args = array(
              'post_type' => 'product',
              'posts_per_page' => 50,
              'product_cat' => get_theme_mod('dog_groomer_hot_products_cat'),
              'order' => 'ASC'
            );
            $loop = new WP_Query( $args );
            while ( $loop->have_posts() ) : $loop->the_post(); global $product;
              $dog_groomer_regular_price = $product->get_regular_price();
              $dog_groomer_sale_price = $product->get_sale_price();
            ?>
            <div class="product-box wow zoomInUp delay-1000" data-wow-duration="2s">
              <div class="product-image">
                  <?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() ) . '" alt="" />';
                  } 
                  ?>
                  <div class="cart-button">
                      <?php 
                      if ( $product->is_type('simple') ) { 
                          woocommerce_template_loop_add_to_cart( $loop->post, $product ); 
                      } 
                      ?>
                  </div>
              </div>
              <div class="box-content">
                  <h3 class="product-text mb-0">
                      <a href="<?php echo esc_url( get_permalink( $loop->post->ID ) ); ?>">
                          <?php the_title(); ?>
                      </a>
                  </h3>
                  <div class="price mb-2"><?php echo $product->get_price_html(); ?></div>
              </div>
            </div>
            <?php endwhile; 
            wp_reset_postdata(); ?>
        </div>
        <?php } ?>
    </div>
</div>
<?php } ?>
