'', 'number' => '8', 'cats' => '', 'order_by' => 'date', 'order' => 'DESC', 'product_type' => 'latest', ),$attr)); $custom_list = array(); $args = array( 'post_type' => 'product', 'posts_per_page' => $number, 'orderby' => $order_by, 'order' => $order, ); if($product_type == 'toprate'){ add_filter( 'posts_clauses', array( WC()->query, 'order_by_rating_post_clauses' ) ); $args['no_found_rows'] = 1; $args['meta_query'] = WC()->query->get_meta_query(); } if($product_type == 'mostview'){ $args['meta_key'] = 'post_views'; $args['orderby'] = 'meta_value_num'; } if($product_type == 'bestsell'){ $args['meta_key'] = 'total_sales'; $args['orderby'] = 'meta_value_num'; } if($product_type=='onsale'){ $args['meta_query'][]=array( 'key' => '_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric' ); } if($product_type == 'featured'){ $args['meta_key'] = '_featured'; $args['meta_value'] = 'yes'; } if(!empty($cats)) { $custom_list = explode(",",$cats); $args['tax_query'][]=array( 'taxonomy'=>'product_cat', 'field'=>'slug', 'terms'=> $custom_list ); } $product_query = new WP_Query($args); $count_query = $product_query->post_count; if(!empty($cats)){ $pre = rand(0,1000); $cats = explode(',', $cats); $tab_title_html = $icon_html = ''; $tab_title_html .= ''; $html .= ''; $html .= '
'; $ccount = 1; foreach ($cats as $cat_id) { $f_class = ''; if($ccount == 1) $f_class = 'active'; $term = get_term_by( 'slug',$cat_id, 'product_cat' ); $args['tax_query'] = array(); $args['tax_query'][]=array( 'taxonomy'=>'product_cat', 'field'=>'slug', 'terms'=> $cat_id ); $product_query = new WP_Query($args); $count_query = $product_query->post_count; $html .= '
'; $html .= '
'; $count = 1; if($product_query->have_posts()) { while($product_query->have_posts()) { $product_query->the_post(); global $product,$post; $thumb_html = ''; if(has_post_thumbnail(get_the_ID())) $thumb_html = get_the_post_thumbnail(get_the_ID(),array(270,270),array('class'=>'img-responsive')); $html .= '
'.$thumb_html.' '.sv_product_box_hover().' '.sv_get_meta_product('yes').'

'.get_the_title().'

'.$product->get_price_html().'
'; } } $html .= '
'; $ccount++; } $html .= '
'; } wp_reset_postdata(); return $html; } } stp_reg_shortcode('sv_product_tab_slider','sv_vc_product_tab_slider'); add_action( 'vc_build_admin_page','sv_add_tab_slider_product' ); if ( ! function_exists( 'sv_add_tab_slider_product' ) ) { function sv_add_tab_slider_product(){ vc_map( array( "name" => esc_html__("SV Product Tab slider", 'bigc'), "base" => "sv_product_tab_slider", "icon" => "icon-st", "category" => '7Up-theme', "params" => array( array( 'heading' => esc_html__( 'Number', 'bigc' ), 'type' => 'textfield', 'description' => esc_html__( 'Enter number of product. Default is 8.', 'bigc' ), 'param_name' => 'number', ), array( 'heading' => esc_html__( 'Product Type', 'bigc' ), 'type' => 'dropdown', 'param_name' => 'product_type', 'value' => array( esc_html__('Latest Products','bigc') => 'latest', esc_html__('Featured Products','bigc') => 'featured', esc_html__('Best Sellers','bigc') => 'bestsell', esc_html__('On Sale','bigc') => 'onsale', esc_html__('Top rate','bigc') => 'toprate', esc_html__('Most view','bigc') => 'mostview', ), 'description' => esc_html__( 'Select Product View Type', 'bigc' ), ), array( 'holder' => 'div', 'heading' => esc_html__( 'Product Categories', 'bigc' ), 'type' => 'checkbox', 'param_name' => 'cats', 'value' => sv_list_taxonomy('product_cat',false) ), array( 'type' => 'dropdown', 'heading' => esc_html__( 'Order By', 'bigc' ), 'value' => array( esc_html__('Date','bigc') => 'date', esc_html__('Rand','bigc') => 'rand', esc_html__('Name','bigc') => 'title', esc_html__('Price','bigc') => 'price', ), 'param_name' => 'orderby', 'description' => esc_html__( 'Select Orderby Type ', 'bigc' ), 'edit_field_class'=>'vc_col-sm-6 vc_column', ), array( 'heading' => esc_html__( 'Order', 'bigc' ), 'type' => 'dropdown', 'param_name' => 'order', 'value' => array( esc_html__('Desc','bigc') => 'DESC', esc_html__('Asc','bigc') => 'ASC', ), 'description' => esc_html__( 'Select Order Type ', 'bigc' ), 'edit_field_class'=>'vc_col-sm-6 vc_column', ), array( 'heading' => esc_html__( 'Tab Icon', 'bigc' ), 'type' => 'add_icon_cat', 'param_name' => 'icon_cat', 'group' => esc_html__( 'Icon', 'bigc' ), ), ) )); } }