?> </a></p> <div class="content_price"> <?php /** * woocommerce_after_shop_loop_item_title hook * * @hooked woocommerce_template_loop_price - 10 */ do_action('kt_after_loop_item_title'); ?> </div> <div class="show-count-down"> <?php $time = kt_get_max_date_sale(get_the_ID()); $y = date('Y', $time); $m = date('m', $time); $d = date('d', $time); ?> <span class="countdown-lastest count-down-time" data-y="<?php echo esc_attr($y); ?> " data-m="<?php echo esc_attr($m); ?> " data-d="<?php echo esc_attr($d); ?> " data-h="00" data-i="00" data-s="00"></span> </div>
protected function content($atts, $content = null) { $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('hot_deal', $atts) : $atts; extract(shortcode_atts(array('title' => 'Tabs Name', 'per_page' => 5, 'taxonomy' => 0, 'orderby' => 'date', 'order' => 'DESC', 'style' => 'style-1', 'autoplay' => 'false', 'navigation' => 'false', 'loop' => 'false', 'slidespeed' => 250, 'margin' => 0, 'css' => '', 'el_class' => '', 'nav' => 'true', 'items_destop' => 4, 'items_tablet' => 3, 'items_mobile' => 1, 'use_responsive' => 1, 'css_animation' => ''), $atts)); global $woocommerce_loop; $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, ' box-tab-category ', $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)); $meta_query = WC()->query->get_meta_query(); $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $per_page, 'suppress_filter' => true, 'orderby' => $orderby, 'order' => $order); if ($taxonomy) { $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => explode(",", $taxonomy))); } $product_ids_on_sale = wc_get_product_ids_on_sale(); $args['post__in'] = array_merge(array(0), $product_ids_on_sale); $data_carousel = array("autoplay" => $autoplay, "navigation" => $navigation, "margin" => $margin, "slidespeed" => $slidespeed, "theme" => 'style-navigation-bottom', "autoheight" => 'false', 'nav' => 'true', 'dots' => 'false', 'loop' => $loop, 'autoplayTimeout' => 1000, 'autoplayHoverPause' => 'true'); 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; } else { if ($items_destop > 0) { $items_destop = 4; } $data_carousel['items'] = $items_destop; } $carousel = _data_carousel($data_carousel); $tabs = kt_get_all_attributes('tab_sections', $content); if (count($tabs) > 0) { $unique = uniqid(); $new_title = array(__('hot'), __('deals')); $charact = explode(' ', $title); if (is_array($charact) && count($charact) > 1) { $new_title = $charact; } ?> <?php ob_start(); ?> <div class="<?php if ($style == "style-1") { ?> option3 <?php } else { ?> option4 <?php } ?> "> <!-- Hot deals --> <div class="hot-deals-row container-tab"> <div class="hot-deals-box only_countdown"> <div class="row"> <div class="col-sm-12 col-md-12 col-lg-4"> <div class="hot-deals-tab"> <div class="hot-deals-title vertical-text"> <?php if (isset($new_title[0]) && $new_title[0]) { ?> <?php for ($i = 0; $i < strlen($new_title[0]); $i++) { ?> <?php if (isset($new_title[0][$i])) { ?> <span><?php echo esc_html($new_title[0][$i]); ?> </span> <?php } ?> <?php } ?> <?php } ?> <?php for ($j = 1; $j < count($new_title); $j++) { ?> <?php if (isset($new_title[$j]) && $new_title[$j]) { ?> <?php for ($i = 0; $i < strlen($new_title[$j]); $i++) { ?> <?php if (isset($new_title[$j][$i])) { ?> <span class="yellow"><?php echo esc_html($new_title[$j][$i]); ?> </span> <?php } ?> <?php } ?> <?php } ?> <?php } ?> </div> <div class="hot-deals-tab-box"> <ul class="nav-tab"> <?php $i = 1; ?> <?php foreach ($tabs as $tab) { extract(shortcode_atts(array('header' => __('Tab name', 'kutetheme'), 'reduction_from' => 0, 'reduction_to' => 0), $tab)); ?> <li <?php if ($i == 1) { ?> class="active" <?php } ?> ><a data-toggle="tab" href="#hotdeals-<?php echo $unique; ?> -<?php echo $i; ?> "><?php echo $header; ?> </a></li> <?php $i++; ?> <?php } ?> </ul> <div class="box-count-down"> <span class="countdown-only"></span> </div> </div> </div> </div> <div class="col-sm-12 col-md-12 col-lg-8 hot-deals-tab-content-col"> <div class="hot-deals-tab-content tab-container"> <?php $i = 1; ?> <?php $max_time = 0; foreach ($tabs as $tab) { extract(shortcode_atts(array('header' => __('Tab name', 'kutetheme'), 'reduction_from' => 0, 'reduction_to' => 0), $tab)); $meta = $meta_query; $meta[] = array('key' => '_reduction_percent', 'value' => array($reduction_from, $reduction_to), 'compare' => 'BETWEEN'); $args['meta_query'] = $meta; $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts)); if ($products->have_posts()) { add_filter("woocommerce_get_price_html_from_to", "kt_get_price_html_from_to", 10, 4); add_filter('woocommerce_sale_price_html', 'woocommerce_custom_sales_price', 10, 2); remove_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 10); ?> <div id="hotdeals-<?php echo $unique; ?> -<?php echo $i; ?> " class="tab-panel <?php if ($i == 1) { ?> active<?php } ?> "> <?php do_action("woocommerce_shortcode_before_hot_deal_loop"); ?> <ul class="product-list owl-carousel nav-center" <?php echo $carousel; ?> > <?php while ($products->have_posts()) { $products->the_post(); ?> <li> <?php wc_get_template_part('content', 'product-hot-deal'); // Get date sale $time = kt_get_max_date_sale(get_the_ID()); if ($time > $max_time) { $max_time = $time; } ?> </li> <?php } ?> </ul> <?php do_action("woocommerce_shortcode_after_hot_deal_loop"); ?> </div> <?php remove_filter("woocommerce_get_price_html_from_to", "kt_get_price_html_from_to", 10, 4); remove_filter('woocommerce_sale_price_html', 'woocommerce_custom_sales_price', 10, 2); add_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 10); ?> <?php } else { ?> <div id="hotdeals-<?php echo $unique; ?> -<?php echo $i; ?> " class="tab-panel <?php if ($i == 1) { ?> active<?php } ?> "> <label><?php _e('Empty product', 'kutetheme'); ?> </label> </div> <?php } ?> <?php wp_reset_query(); wp_reset_postdata(); ?> <?php $i++; ?> <?php } ?> <?php if ($max_time > 0) { $y = date('Y', $max_time); $m = date('m', $max_time); $d = date('d', $max_time); ?> <input class="max-time-sale" data-y="<?php echo esc_attr($y); ?> " data-m="<?php echo esc_attr($m); ?> " data-d="<?php echo esc_attr($d); ?> " type="hidden" value="" /> <?php } ?> </div> </div> </div> </div> </div> </div> <!-- ./Hot deals --> <?php } $result = ob_get_contents(); ob_end_clean(); return $result; }
protected function content($atts, $content = null) { $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('lastest_deal_products', $atts) : $atts; $atts = shortcode_atts(array('title' => ' ', 'taxonomy' => '', 'number' => 10, 'product_column' => 5, 'orderby' => 'date', 'order' => 'DESC', 'autoplay' => '', 'navigation' => '', 'margin' => 10, 'slidespeed' => 200, 'css' => '', 'el_class' => '', 'nav' => "true", 'loop' => "false", 'use_responsive' => 1, 'items_destop' => 5, 'items_tablet' => 3, 'items_mobile' => 1, 'columns' => 1), $atts); extract($atts); // Get products on sale $product_ids_on_sale = wc_get_product_ids_on_sale(); $meta_query = WC()->query->get_meta_query(); $args = array('posts_per_page' => $number, 'post_type' => 'product', 'order' => $order, 'no_found_rows' => 1, 'post_status' => 'publish', 'meta_query' => $meta_query, 'post__in' => array_merge(array(0), $product_ids_on_sale)); $args["orderby"] = $orderby; if ($taxonomy) { $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => explode(",", $taxonomy))); } $q = apply_filters('woocommerce_shortcode_products_query', $args, $atts); $query_product = new WP_Query($q); global $woocommerce_loop, $post; $woocommerce_loop['columns'] = $columns; ob_start(); if ($query_product->have_posts()) { $data_carousel = array("autoplay" => $autoplay, "navigation" => $navigation, "margin" => $margin, "slidespeed" => $slidespeed, "loop" => $loop, "theme" => 'style-navigation-bottom', "autoheight" => "false", 'nav' => "true", 'dots' => "false"); 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; } else { if ($product_column > 0) { $data_carousel['items'] = $product_column; } } $elementClass = array('shortcode_custom' => vc_shortcode_custom_css_class($css, ' ')); $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass)); ?> <div class="<?php echo esc_attr($el_class); ?> "> <?php if ($title) { ?> <h2 class="page-heading"> <span class="page-heading-title"><?php echo esc_html($title); ?> </span> </h2> <?php } ?> <div class="latest-deals-product container-data-time"> <span class="count-down-time2"> <span class="icon-clock"></span> <span><?php _e('end in', 'kutetheme'); ?> </span> <span class="countdown-lastest stick-countdown"></span> </span> <ul class="product-list owl-carousel" <?php echo _data_carousel($data_carousel); ?> > <?php add_filter("woocommerce_get_price_html_from_to", "kt_get_price_html_from_to", 10, 4); add_filter('woocommerce_sale_price_html', 'woocommerce_custom_sales_price', 10, 2); $max = 0; while ($query_product->have_posts()) { $query_product->the_post(); $id = get_the_ID(); global $post; ?> <?php $time = kt_get_max_date_sale($id); if ($time > $max) { $max = $time; } ?> <li> <?php wc_get_template_part('content', 'product-lastest-deal'); ?> </li> <?php } // end of the loop. remove_filter("woocommerce_get_price_html_from_to", "kt_get_price_html_from_to", 10, 4); remove_filter('woocommerce_sale_price_html', 'woocommerce_custom_sales_price', 10, 2); ?> </ul> <?php if ($max > 0) { $y = date('Y', $max); $m = date('m', $max); $d = date('d', $max); ?> <input class="max-time" type="hidden" value="" data-y="<?php echo esc_attr($y); ?> " data-m="<?php echo esc_attr($m); ?> " data-d="<?php echo esc_attr($d); ?> " /> <?php } ?> </div> </div> <?php } wp_reset_postdata(); wp_reset_query(); $result = ob_get_contents(); ob_end_clean(); return $result; }
protected function content($atts, $content = null) { $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('box_hot_deal', $atts) : $atts; extract(shortcode_atts(array('title' => __('Hot deal', 'kutetheme'), 'size' => 'kt_shop_catalog_164', 'per_page' => 5, 'taxonomy' => 0, 'orderby' => 'date', 'order' => 'DESC', 'autoplay' => 'false', 'navigation' => 'false', 'loop' => 'false', 'slidespeed' => 250, 'margin' => 0, 'css' => '', 'el_class' => '', 'nav' => 'true', 'items_destop' => 5, 'items_tablet' => 3, 'items_mobile' => 1, 'use_responsive' => 1, 'css_animation' => ''), $atts)); global $woocommerce_loop; $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, ' option7 ', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => $this->getCSSAnimation($css_animation), 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' ')); $this->product_size = $size; $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass)); $meta_query = WC()->query->get_meta_query(); $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $per_page, 'suppress_filter' => true, 'orderby' => $orderby, 'order' => $order); if ($taxonomy) { $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => explode(",", $taxonomy))); } $product_ids_on_sale = wc_get_product_ids_on_sale(); $args['post__in'] = array_merge(array(0), $product_ids_on_sale); $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'); $new_title = array(__('hot'), __('deals')); $charact = explode(' ', $title); if (is_array($charact) && count($charact) > 1) { $new_title = $charact; } $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts)); ob_start(); 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 ($items_destop > 0) { $items_destop = 5; } $data_carousel['items'] = $items_destop; if ($products->post_count < $items_destop) { $data_carousel['loop'] = 'false'; } else { $data_carousel['loop'] = $loop; } } $carousel = _data_carousel($data_carousel); remove_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_price', 5); remove_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 10); add_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5); add_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10); add_filter('kt_product_thumbnail_loop', array(&$this, 'get_size_product')); $max_time = 0; ?> <!-- Hot deals --> <div class="<?php echo apply_filters('kt_class_hot_deal', $elementClass); ?> "> <div class="hot-deals-box only_countdown"> <div class="row"> <div class="col-sm-12 col-md-2 col-lg-2"> <div class="hot-deals-tab"> <div class="hot-deals-title vertical-text"> <?php if (isset($new_title[0]) && $new_title[0]) { ?> <?php for ($i = 0; $i < strlen($new_title[0]); $i++) { ?> <?php if (isset($new_title[0][$i])) { ?> <span><?php echo esc_html($new_title[0][$i]); ?> </span> <?php } ?> <?php } ?> <?php } ?> <?php for ($j = 1; $j < count($new_title); $j++) { ?> <?php if (isset($new_title[$j]) && $new_title[$j]) { ?> <?php for ($i = 0; $i < strlen($new_title[$j]); $i++) { ?> <?php if (isset($new_title[$j][$i])) { ?> <span class="yellow"><?php echo esc_html($new_title[$j][$i]); ?> </span> <?php } ?> <?php } ?> <?php } ?> <?php } ?> </div> <div class="hot-deals-tab-box"> <div class="box-count-down"> <span class="countdown-only"></span> </div> </div> </div> </div> <div class="col-sm-12 col-md-10 col-lg-10 hot-deals-tab-content-col"> <div class="hot-deals-tab-content tab-container"> <?php do_action("woocommerce_shortcode_before_hot_deal_loop"); ?> <ul class="products owl-carousel" <?php echo apply_filters('kt_hot_deal_carousel', $carousel); ?> > <?php while ($products->have_posts()) { $products->the_post(); ?> <li class="product"> <?php wc_get_template_part('content', 'product-hotdeal'); // Get date sale $time = kt_get_max_date_sale(get_the_ID()); if ($time > $max_time) { $max_time = $time; } ?> </li> <?php } ?> </ul> <?php do_action("woocommerce_shortcode_after_hot_deal_loop"); ?> </div> <?php if ($max_time > 0) { $y = date('Y', $max_time); $m = date('m', $max_time); $d = date('d', $max_time); ?> <input class="max-time-sale" data-y="<?php echo esc_attr($y); ?> " data-m="<?php echo esc_attr($m); ?> " data-d="<?php echo esc_attr($d); ?> " type="hidden" value="" /> <?php } ?> </div> </div> </div> </div> <!-- ./Hot deals --> <?php remove_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5); remove_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10); add_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_price', 5); add_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 10); remove_action('kt_product_thumbnail_loop', array(&$this, 'get_size_product')); } return ob_get_clean(); }
* * * @author KuteTheme * @package Kute Theme * @version KuteTheme 1.0 */ if (!defined('ABSPATH')) { exit; // Exit if accessed directly } global $product, $woocommerce_loop, $post; $id = get_the_ID(); ?> <li> <?php $time = kt_get_max_date_sale($id); $y = date('Y', $time); $m = date('m', $time); $d = date('d', $time); ?> <div class="count-down-time" data-y="<?php echo esc_attr($y); ?> " data-m="<?php echo esc_attr($m); ?> " data-d="<?php echo esc_attr($d); ?> " data-h="00" data-i="00" data-s="00" ></div> <div class="left-block">