Esempio n. 1
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('tab_producs', $atts) : $atts;
        $atts = shortcode_atts(array('taxonomy' => '', 'size' => 'kt_shop_catalog_260', 'style' => '1', 'per_page' => 12, 'columns' => 4, 'border_heading' => '', 'css_animation' => '', 'el_class' => '', 'css' => '', 'autoplay' => 'false', 'navigation' => 'false', 'margin' => 30, 'slidespeed' => 200, 'css' => '', 'el_class' => '', 'nav' => 'true', 'loop' => 'false', 'use_responsive' => 1, 'items_destop' => 3, 'items_tablet' => 2, 'items_mobile' => 1), $atts);
        extract($atts);
        $this->product_size = $size;
        global $woocommerce_loop;
        $is_phone = false;
        if (function_exists('kt_is_phone') && kt_is_phone()) {
            $is_phone = true;
        }
        if ($style == 3) {
            $base_class = 'tab-product-13 option-13 style1 ';
        } else {
            $base_class = 'popular-tabs ';
        }
        $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $base_class, $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => $this->getCSSAnimation($css_animation), 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '));
        $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
        $elementClass = apply_filters('kt_product_tab_class_container', $elementClass);
        $tabs = array('best-sellers' => __('Best Sellers', 'kutetheme'), 'on-sales' => __('On Sales', 'kutetheme'), 'new-arrivals' => __('New Products', 'kutetheme'));
        $meta_query = WC()->query->get_meta_query();
        $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $per_page, 'meta_query' => $meta_query, 'suppress_filter' => true);
        if ($taxonomy) {
            $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => explode(",", $taxonomy)));
        }
        add_filter('kt_product_thumbnail_loop', array(&$this, 'get_size_product'));
        $uniqeID = uniqid();
        ob_start();
        ?>
        <div class="<?php 
        echo esc_attr($elementClass);
        ?>
 top-nav container-tab style<?php 
        echo esc_attr($style);
        ?>
">
            <ul class="nav-tab">
                <?php 
        $i = 0;
        ?>
                <?php 
        foreach ($tabs as $k => $v) {
            ?>
                    <li <?php 
            echo $i == 0 ? 'class="active"' : '';
            ?>
 >
                        <a data-toggle="tab" href="#tab-<?php 
            echo esc_attr($k) . $uniqeID;
            ?>
"><?php 
            echo esc_html($v);
            ?>
</a>
                    </li>
                    <?php 
            $i++;
            ?>
                <?php 
        }
        ?>
            </ul>
            <div class="tab-container">
                <?php 
        $data_carousel = array("autoplay" => $autoplay, "navigation" => $navigation, "margin" => $margin, "smartSpeed" => $slidespeed, "theme" => 'style-navigation-bottom', "autoheight" => 'false', 'nav' => $navigation, 'dots' => 'false', 'loop' => $loop, 'autoplayTimeout' => 1000, 'autoplayHoverPause' => 'true');
        $i = 0;
        ?>
                <?php 
        foreach ($tabs as $k => $v) {
            ?>
                    <?php 
            $newargs = $args;
            if ($k == 'best-sellers') {
                $newargs['meta_key'] = 'total_sales';
                $newargs['orderby'] = 'meta_value_num';
            } elseif ($k == 'on-sales') {
                $product_ids_on_sale = wc_get_product_ids_on_sale();
                $newargs['post__in'] = array_merge(array(0), $product_ids_on_sale);
                $newargs['orderby'] = 'date';
                $newargs['order'] = 'DESC';
            } else {
                $newargs['orderby'] = 'date';
                $newargs['order'] = 'DESC';
            }
            $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $newargs, $atts));
            if ($products->have_posts()) {
                if ($use_responsive) {
                    $arr = array('0' => array("items" => $items_mobile), '768' => array("items" => $items_tablet), '992' => array("items" => $items_destop));
                    $data_responsive = json_encode($arr);
                    $data_carousel["responsive"] = $data_responsive;
                    if ($products->post_count < $items_mobile || $products->post_count < $items_tablet || $products->post_count < $items_destop) {
                        $data_carousel['loop'] = 'false';
                    } else {
                        $data_carousel['loop'] = $loop;
                    }
                } else {
                    if ($style == 3) {
                        $data_carousel['items'] = 4;
                        if ($products->post_count < 4) {
                            $data_carousel['loop'] = 'false';
                        } else {
                            $data_carousel['loop'] = $loop;
                        }
                    } else {
                        $data_carousel['items'] = 3;
                        if ($products->post_count < 3) {
                            $data_carousel['loop'] = 'false';
                        } else {
                            $data_carousel['loop'] = $loop;
                        }
                    }
                }
                $carousel = _data_carousel($data_carousel);
                ?>
                    <!-- Style 1 -->
                    <?php 
                if ($style == 1) {
                    ?>
                    <div id="tab-<?php 
                    echo esc_attr($k) . $uniqeID;
                    ?>
" class="tab-panel <?php 
                    echo $i == 0 ? 'active' : '';
                    ?>
">
                        <ul class="product-list owl-carousel" <?php 
                    echo apply_filters('kt_shortcode_tab_product_carousel', $carousel);
                    ?>
>
                            
                            <?php 
                    while ($products->have_posts()) {
                        $products->the_post();
                        ?>
                                <?php 
                        wc_get_template_part('content', 'product-tab');
                        ?>
                            <?php 
                    }
                    ?>
                        </ul>
                    </div>
                    <!-- ./Style 1 -->
                    <?php 
                }
                ?>
                    <!-- Style 2 -->
                    <?php 
                if ($style == 2) {
                    ?>
                        <div id="tab-<?php 
                    echo esc_attr($k) . $uniqeID;
                    ?>
" class="tab-panel <?php 
                    echo $i == 0 ? 'active' : '';
                    ?>
">
                        <ul class="products-style8 columns-<?php 
                    echo esc_attr($columns);
                    ?>
">
                            <?php 
                    while ($products->have_posts()) {
                        $products->the_post();
                        ?>
                                <li class="product kt-template-loop">
                                    <div class="product-container ">
                                        <div class="product-thumb">
                                            <?php 
                        global $product;
                        $attachment_ids = $product->get_gallery_attachment_ids();
                        $secondary_image = '';
                        if ($attachment_ids) {
                            $secondary_image = wp_get_attachment_image($attachment_ids[0], $size);
                        }
                        if (has_post_thumbnail()) {
                            ?>
                                                    <a class="primary_image owl-lazy" href="<?php 
                            the_permalink();
                            ?>
"><?php 
                            the_post_thumbnail($size);
                            ?>
</a>
                                                <?php 
                        } else {
                            ?>
                                                    <a class="primary_image owl-lazy" href="<?php 
                            the_permalink();
                            ?>
"><?php 
                            echo wc_placeholder_img($size);
                            ?>
</a>
                                                <?php 
                        }
                        if ($secondary_image != "") {
                            ?>
                                                    <a class="secondary_image owl-lazy" href="<?php 
                            the_permalink();
                            ?>
"><?php 
                            echo $secondary_image;
                            ?>
</a>
                                                <?php 
                        } else {
                            ?>
                                                    <a class="secondary_image owl-lazy" href="<?php 
                            the_permalink();
                            ?>
"><?php 
                            echo wc_placeholder_img($size);
                            ?>
</a>
                                                <?php 
                        }
                        ?>
                                            <?php 
                        kt_get_tool_quickview();
                        ?>
                                            <div class="product-label"><?php 
                        do_action('kt_loop_product_label');
                        ?>
</div>
                                        </div>
                                        <div class="product-info">
                                            <div class="product-name">
                                                <a href="<?php 
                        the_permalink();
                        ?>
"> <?php 
                        the_title();
                        ?>
</a>
                                            </div>
                                            <div class="box-price">
                                                <?php 
                        do_action('kt_after_shop_loop_item_title');
                        ?>
                                            </div>
                                            <div class="button-control">
                                                <?php 
                        kt_get_tool_compare();
                        ?>
                                                <?php 
                        do_action('woocommerce_after_shop_loop_item');
                        ?>
                                                <?php 
                        kt_get_tool_wishlish();
                        ?>
                                            </div>
                                        </div>
                                    </div>
                                </li>
                            <?php 
                    }
                    ?>
                        </ul>
                    </div>
                    <?php 
                }
                ?>
                    <!-- ./Style 2 -->
                    <!-- Style 3 -->
                    <?php 
                if ($style == 3) {
                    ?>
                        <div id="tab-<?php 
                    echo esc_attr($k) . $uniqeID;
                    ?>
" class="tab-panel <?php 
                    echo $i == 0 ? 'active' : '';
                    ?>
">
                            <ul class="tab-products owl-carousel" <?php 
                    echo apply_filters('kt_shortcode_tab_product_carousel', $carousel);
                    ?>
>
                                <?php 
                    while ($products->have_posts()) {
                        $products->the_post();
                        ?>
                                    <li class="product-style3">
                                        <?php 
                        wc_get_template_part('content', 'product-style3');
                        ?>
                                    </li>
                                <?php 
                    }
                    ?>
                            </ul>
                        </div>
                    <?php 
                }
                ?>
                    <!-- ./Style 3 -->
                    <?php 
            }
            ?>
                    <?php 
            wp_reset_query();
            wp_reset_postdata();
            $i++;
            ?>
                <?php 
        }
        ?>
            </div>
        </div>
        <?php 
        remove_filter('kt_product_thumbnail_loop', array(&$this, 'get_size_product'));
        return ob_get_clean();
    }
Esempio n. 2
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('product_sidebar', $atts) : $atts;
        $atts = shortcode_atts(array('title' => __('NEW PRODUCTS', 'kutetheme'), 'style' => 'style-1', 'target' => 'best-seller', 'orderby' => 'date', 'order' => 'DESC', 'ids' => '', 'taxonomy' => '', 'number_product' => 14, 'per_page' => 7, 'css_animation' => '', 'el_class' => '', 'css' => '', 'autoplay' => 'false', 'navigation' => 'false', 'margin' => 30, 'slidespeed' => 200, 'css' => '', 'el_class' => '', 'nav' => 'true', 'loop' => 'false'), $atts);
        extract($atts);
        global $woocommerce_loop;
        $is_phone = false;
        if (function_exists('kt_is_phone') && kt_is_phone()) {
            $is_phone = true;
        }
        $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, ' ', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => $this->getCSSAnimation($css_animation), 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '));
        $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
        $elementClass = apply_filters('kt_product_sidebar_class_container', $elementClass);
        $tabs = array('best-sellers' => __('Best Sellers', 'kutetheme'), 'on-sales' => __('On Sales', 'kutetheme'), 'new-arrivals' => __('New Products', 'kutetheme'));
        $meta_query = WC()->query->get_meta_query();
        $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $number_product, 'meta_query' => $meta_query, 'suppress_filter' => true);
        if ($taxonomy) {
            $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => explode(",", $taxonomy)));
        }
        $data_carousel = array("autoplay" => $autoplay, "nav" => $navigation, "margin" => $margin, "smartSpeed" => $slidespeed, "theme" => 'style-navigation-bottom', "autoheight" => 'false', 'items' => 1, 'dots' => 'false', 'loop' => $loop, 'autoplayTimeout' => 1000, 'autoplayHoverPause' => 'true');
        if ($target == 'new-arrival') {
            $args['orderby'] = 'date';
            $args['order'] = 'DESC';
        } elseif ($target == 'on-sales') {
            $product_ids_on_sale = wc_get_product_ids_on_sale();
            $args['post__in'] = array_merge(array(0), $product_ids_on_sale);
            if ($orderby == '_sale_price') {
                $orderby = 'date';
                $order = 'DESC';
            }
            $args['orderby'] = $orderby;
            $args['order'] = $order;
        } elseif ($target == 'custom') {
            if ($orderby == '_sale_price') {
                $args['meta_query'] = array('relation' => 'OR', array('key' => '_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric'), array('key' => '_min_variation_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric'));
            } else {
                $args['orderby'] = $orderby;
                $args['order'] = $order;
            }
        } elseif ($target == 'most-review') {
            add_filter('posts_clauses', array($this, 'order_by_rating_post_clauses'));
        } elseif ($target == 'by-ids' && count($ids) > 0) {
            $args['post__in'] = $ids;
            $args['orderby'] = 'post__in';
        } else {
            $args['meta_key'] = 'total_sales';
            $args['orderby'] = 'meta_value_num';
        }
        $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
        if ($target == 'most-review') {
            remove_filter('posts_clauses', array($this, 'order_by_rating_post_clauses'));
        }
        remove_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 10);
        $uniqeID = uniqid();
        ob_start();
        if ($products->have_posts()) {
            if ($style == 'style-1') {
                ?>
            <div class="block-new-product12 <?php 
                echo esc_attr($elementClass);
                ?>
">
                <?php 
                if ($title) {
                    ?>
                    <div class="title"><?php 
                    echo esc_html($title);
                    ?>
</div>
                <?php 
                }
                ?>
                <div class="inner owl-carousel" <?php 
                echo _data_carousel($data_carousel);
                ?>
>
                    <?php 
                $i = 1;
                ?>
                    <?php 
                while ($products->have_posts()) {
                    $products->the_post();
                    ?>
                    <?php 
                    if ($i == 1) {
                        ?>
                    <ul class="list-product">
                    <?php 
                    }
                    ?>
                        <li class="product">
                            <div class="image">
                                <a href="<?php 
                    the_permalink();
                    ?>
">
                                    <?php 
                    echo kt_get_product_thumbnail('shop_thumbnail');
                    ?>
                                </a>
                            </div>
                            <div class="info">
                                <h3 class="product-name"><a title="<?php 
                    echo esc_attr(get_the_title());
                    ?>
" href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    echo esc_attr(get_the_title());
                    ?>
</a></h3>
                                <?php 
                    /**
                     * woocommerce_after_shop_loop_item_title hook
                     * 
                     * @hooked woocommerce_template_loop_price - 5
                     * @hooked woocommerce_template_loop_rating - 10
                     */
                    do_action('kt_after_shop_loop_item_title');
                    ?>
                            </div>
                        </li>
                    <?php 
                    if ($i == $per_page) {
                        $i = 1;
                        echo '</ul><!--End Ul-->';
                    } else {
                        $i++;
                    }
                    ?>
                    
                    <?php 
                }
                ?>
                    <?php 
                if ($i > 1) {
                    ?>
                    </ul><!--./ End ul-->
                    <?php 
                }
                ?>
                </div>
            </div>
            <?php 
            } else {
                add_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 10);
                ?>
                <div class="block-static option-14">
                    <?php 
                if ($title) {
                    ?>
                        <h3 class="title"><span><?php 
                    echo esc_html($title);
                    ?>
</span></h3>
                    <?php 
                }
                ?>
                    <div class="block-static-products owl-carousel" <?php 
                echo _data_carousel($data_carousel);
                ?>
>
                        <?php 
                $i = 1;
                ?>
                        <?php 
                while ($products->have_posts()) {
                    $products->the_post();
                    ?>
                        <?php 
                    if ($i == 1) {
                        ?>
                        <ul class="list">
                        <?php 
                    }
                    ?>
                            <li>
                                <div class="product-thumb">
                                    <a href="<?php 
                    the_permalink();
                    ?>
">
                                        <?php 
                    echo kt_get_product_thumbnail('shop_thumbnail');
                    ?>
                                    </a>
                                </div>
                                <div class="product-info">
                                    <h3 class="product-name">
                                        <a title="<?php 
                    echo esc_attr(get_the_title());
                    ?>
" href="<?php 
                    the_permalink();
                    ?>
">
                                            <?php 
                    echo esc_attr(get_the_title());
                    ?>
                                        </a>
                                    </h3>
                                    <?php 
                    /**
                     * woocommerce_after_shop_loop_item_title hook
                     * 
                     * @hooked woocommerce_template_loop_price - 5
                     * @hooked woocommerce_template_loop_rating - 10
                     */
                    do_action('kt_after_shop_loop_item_title');
                    ?>
                                    <div class="group-button-control">
                                        <?php 
                    woocommerce_template_loop_add_to_cart();
                    ?>
                                        <?php 
                    kt_get_tool_wishlish();
                    ?>
                                        <?php 
                    kt_get_tool_compare();
                    ?>
                                        <?php 
                    kt_get_tool_quickview();
                    ?>
                                    </div>
                                </div>
                            </li>
                            
                        <?php 
                    if ($i == $per_page) {
                        $i = 1;
                        echo '</ul><!--End Ul-->';
                    } else {
                        $i++;
                    }
                    ?>
                        <?php 
                }
                ?>
                        <?php 
                if ($i > 1) {
                    ?>
                        </ul><!--./ End ul-->
                        <?php 
                }
                ?>
                    </div>
                </div>
            <?php 
            }
        }
        add_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 10);
        wp_reset_query();
        wp_reset_postdata();
        return ob_get_clean();
    }
    </h4>
    <div class="content_price">
        <?php 
/**
 * woocommerce_after_shop_loop_item_title hook
 * 
 * @hooked woocommerce_template_loop_price - 5
 * @hooked woocommerce_template_loop_rating - 10
 */
do_action('kt_after_shop_loop_item_title');
?>
    </div>
</div>
<div class="group-button-control">
        <?php 
kt_get_tool_wishlish();
?>
	    <?php 
kt_get_tool_compare();
?>
	    <?php 
kt_get_tool_quickview();
?>
</div>
<?php 
/**
 * woocommerce_after_shop_loop_item hook
 *
 * @hooked woocommerce_template_loop_add_to_cart - 10
 */
do_action('woocommerce_after_shop_loop_item');
Esempio n. 4
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('kt_featured_products', $atts) : $atts;
        $atts = shortcode_atts(array('title' => __('Hot Categories', 'kutetheme'), 'size' => 'kt_shop_catalog_270', 'display_type' => '1', 'box_type' => 'featured', 'ids' => '', 'number' => 4, 'css_animation' => '', 'el_class' => '', 'css' => '', 'autoplay' => 'false', 'navigation' => 'false', 'margin' => 30, 'slidespeed' => 200, 'css' => '', 'el_class' => '', 'loop' => 'false', 'use_responsive' => 1, 'items_destop' => 3, 'items_tablet' => 2, 'items_mobile' => 1), $atts);
        extract($atts);
        $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, ' trending ', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => $this->getCSSAnimation($css_animation), 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '));
        $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
        $data_carousel = array("autoplay" => $autoplay, "nav" => $navigation, "margin" => $margin, "smartSpeed" => $slidespeed, "theme" => 'style-navigation-bottom', "autoheight" => 'false', 'dots' => 'false', 'loop' => $loop, 'autoplayTimeout' => 1000, 'autoplayHoverPause' => 'true');
        ob_start();
        $args = array('post_type' => 'product', 'meta_key' => '_featured', 'meta_value' => 'yes', 'posts_per_page' => $number);
        if ($ids) {
            $ids = explode(',', $ids);
        } else {
            $ids = array();
        }
        if ($box_type == 'by_id') {
            $args = array('post_type' => 'product', 'post__in' => $ids);
        }
        $products = get_posts($args);
        $count = count($products);
        $per_page = 2;
        $loop = false;
        if ($count > 2) {
            $loop = true;
        }
        ?>
        <!-- Style 1 -->
        <?php 
        if ($display_type == 1) {
            ?>
        <div class=" <?php 
            echo esc_attr($elementClass);
            ?>
">
            <?php 
            if ($title) {
                ?>
            <h2 class="trending-title"><?php 
                echo esc_html($title);
                ?>
</h2>
            <?php 
            }
            ?>
            <div class="trending-product owl-carousel nav-center" data-items="1" data-dots="false" data-nav="true" data-autoplay="true" <?php 
            if ($loop) {
                ?>
 data-loop="true" <?php 
            }
            ?>
>
                <?php 
            $page = 1;
            if ($count % $per_page == 0) {
                $page = $count / $per_page;
            } else {
                $page = $count / $per_page + 1;
            }
            ?>
                <?php 
            for ($i = 1; $i <= $page; $i++) {
                ?>
                    <ul>
                        <?php 
                $from = ($i - 1) * $per_page;
                $to = $i * $per_page;
                for ($from; $from < $to; $from++) {
                    if (isset($products[$from]) && $products[$from]) {
                        $p = $products[$from];
                        $product = new WC_Product($p->ID);
                        ?>
                                    <li>
                                        <div class="product-container">
                                            <div class="product-image">
                                                <a href="<?php 
                        echo get_permalink($p->ID);
                        ?>
">
                                                   <?php 
                        echo get_the_post_thumbnail($p->ID, $size);
                        ?>
                                                </a>
                                            </div>
                                            <div class="product-info">
                                                <h5 class="product-name">
                                                    <a href="<?php 
                        echo get_permalink($p->ID);
                        ?>
"><?php 
                        echo esc_html($p->post_title);
                        ?>
</a>
                                                </h5>
                                                <div class="product-price">
                                                    <?php 
                        echo $product->get_price_html();
                        ?>
                                                </div>
                                            </div>
                                        </div>
                                    </li>
                                <?php 
                    }
                }
                ?>
                    </ul>
                <?php 
            }
            ?>
            </div>
        </div>
        <?php 
        }
        ?>
        <!-- Style 2 -->
        <?php 
        if ($display_type == 2) {
            ?>
            <?php 
            $products = new WP_Query($args);
            ?>
            <?php 
            if ($use_responsive) {
                $arr = array('0' => array("items" => $items_mobile), '768' => array("items" => $items_tablet), '992' => array("items" => $items_destop));
                $data_responsive = json_encode($arr);
                $data_carousel["responsive"] = $data_responsive;
                if ($products->post_count < $items_mobile || $products->post_count < $items_tablet || $products->post_count < $items_destop) {
                    $data_carousel['loop'] = 'false';
                } else {
                    $data_carousel['loop'] = $loop;
                }
            } else {
                $data_carousel['items'] = 3;
                if ($products->post_count < 3) {
                    $data_carousel['loop'] = 'false';
                } else {
                    $data_carousel['loop'] = $loop;
                }
            }
            ?>
            <div class="section8 block-trending <?php 
            echo esc_attr($elementClass);
            ?>
">
            <h3 class="section-title"><?php 
            echo esc_html($title);
            ?>
</h3>
            <?php 
            if ($products->have_posts()) {
                ?>
            <ul class="products-style8 owl-carousel" <?php 
                echo _data_carousel($data_carousel);
                ?>
>
                <?php 
                while ($products->have_posts()) {
                    $products->the_post();
                    ?>
                <li class="product autoHeight-item">
                    <div class="product-container">
                        <div class="product-thumb">
                            <?php 
                    $product = new WC_Product(get_the_ID());
                    $attachment_ids = $product->get_gallery_attachment_ids();
                    $secondary_image = '';
                    if ($attachment_ids) {
                        $secondary_image = wp_get_attachment_image($attachment_ids[0], $size);
                    }
                    if (has_post_thumbnail()) {
                        ?>
                                    <a class="primary_image" href="<?php 
                        the_permalink();
                        ?>
"><?php 
                        the_post_thumbnail($size);
                        ?>
</a>
                                <?php 
                    } else {
                        ?>
                                    <a class="primary_image" href="<?php 
                        the_permalink();
                        ?>
"><?php 
                        echo wc_placeholder_img($size);
                        ?>
</a>
                                <?php 
                    }
                    if ($secondary_image != "") {
                        ?>
                                    <a class="secondary_image" href="<?php 
                        the_permalink();
                        ?>
"><?php 
                        echo $secondary_image;
                        ?>
</a>
                                <?php 
                    } else {
                        ?>
                                    <a class="secondary_image" href="<?php 
                        the_permalink();
                        ?>
"><?php 
                        echo wc_placeholder_img($size);
                        ?>
</a>
                                <?php 
                    }
                    ?>
                            <?php 
                    kt_get_tool_quickview();
                    ?>
                            <div class="product-label"><?php 
                    do_action('kt_loop_product_label');
                    ?>
</div>
                        </div>
                        <div class="product-info">
                            <div class="product-name">
                                <a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
</a>
                            </div>
                            <div class="box-price">
                                <?php 
                    do_action('kt_after_shop_loop_item_title');
                    ?>
                            </div>
                            <div class="button-control">
                                <?php 
                    kt_get_tool_compare();
                    ?>
                                <?php 
                    do_action('woocommerce_after_shop_loop_item');
                    ?>
                                <?php 
                    kt_get_tool_wishlish();
                    ?>
                            </div>
                        </div>
                    </div>
                </li>
                <?php 
                }
                ?>
            </ul>
            <?php 
            }
            ?>
.
            </div>
        <?php 
        }
        ?>
        <?php 
        wp_reset_postdata();
        $result = ob_get_contents();
        ob_end_clean();
        return $result;
    }