<?php

/**
 * List one template (style 1)
 *
 * @package storzen
 */

if (! defined('ABSPATH')) {
    exit;
}

if ($settings['style'] == 'style-1') :

?>
    <section class="shop-section fix section-padding">
        <div class="wco-container">
            <div class="wco-row wco-g-4">
                <?php
                if ($storzen_posts_query->have_posts()) :
                    while ($storzen_posts_query->have_posts()) : $storzen_posts_query->the_post();
                        $storzen_img_src = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
                        global $product;
                ?>
                        <div class="wco-col-xl-<?php echo esc_attr($settings['column']); ?> wco-col-lg-4 wco-col-sm-6">
                            <div class="shop-card-items mt-0">
                                <div class="image">
                                    <div class="badges">
                                    <?php do_action( 'storzen_shop_card_badges', $product ); ?>
								</div>
                                    <a href="<?php the_permalink(); ?>">
                                        <?php the_post_thumbnail(); ?>
                                    </a>
                                    <div class="social-style-two">
                                        <?php echo storzen_add_to_cart_button(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- storzen_add_to_cart_button() returns markup already escaped with esc_url/esc_attr/wc_implode_html_attributes. ?>
                                        <?php do_action( 'storzen_shop_card_overlay', $product ); ?>
                                    </div>
                                </div>
                                <div class="content">
                                    <?php
                                    $storzen_categories = get_the_terms(get_the_ID(), 'product_cat');
                                    if ($storzen_categories && !is_wp_error($storzen_categories)) :
                                        $storzen_category = array_shift($storzen_categories);
                                    ?>
                                        <a href="<?php echo esc_url(get_term_link($storzen_category)); ?>" class="category"><?php echo esc_html($storzen_category->name); ?></a>
                                    <?php endif; ?>
                                    <h6>
                                        <a <?php echo esc_attr(('new-window' == $settings['open-url'] ? 'target="_blank"' : '')); ?> href="<?php the_permalink(); ?>" class="woo-title">
                                            <?php
                                            if ('full' == $settings['dtitle']) :
                                                the_title();
                                            else :
                                                echo esc_html(wp_trim_words(get_the_title(), $settings['title_excerpt_length'], ''));
                                            endif;
                                            ?>
                                        </a>
                                    </h6>
                                    <div class="prices"><?php echo wp_kses_post($product->get_price_html()); ?></div>
								<?php do_action( 'storzen_shop_card_after_title', $product ); ?>
                                </div>
                            </div>
                        </div>
                    <?php endwhile; ?>
                    <?php include storzen_get_template('pagination.php'); ?>
                <?php
                    wp_reset_postdata();
                else :
                ?>
                    <h3 class="no-post-found"><?php esc_html_e('Sorry, No Product Found', 'storzen') ?></h3>
                <?php endif; ?>
            </div>
        </div>
    </section>
<?php endif;
