widget_cssclass = 'woocommerce best_shop_product_carousel_widget'; $this->widget_description = __( 'Display Product Carousel.', 'best-shop' ); $this->widget_id = 'best_shop_product_carousel_widget'; $this->widget_name = __( '+ Gradient Product Carousel', 'best-shop' ); parent::__construct(); } public function widget( $args, $instance ) { if(is_admin() ) { ?>
'product', 'post_status' => 'publish', 'posts_per_page'=> $max_items, 'order' => 'DESC', ); switch($category){ case 'featured': $product_args['tax_query'] = array(array('taxonomy' => 'product_visibility', 'field' => 'name', 'terms' => 'featured')); break; case 'best_selling': $product_args['meta_key'] = 'total_sales'; $product_args['orderby'] = 'meta_value_num'; break; case 'on_sale': $product_args['meta_query'] = array( 'relation' => 'OR', array( // Simple products type 'key' => '_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric' ), array( // Variable products type 'key' => '_min_variation_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric' ) ) ; break; case 'latest': $product_args['orderby'] = 'date'; $product_args['order']= 'DESC'; break; case 'top_rated': $product_args['meta_query'] = WC()->query->get_meta_query(); $product_args['orderby'] = 'meta_value_num'; $product_args['meta_key'] = '_wc_average_rating'; break; //heigh to low case 'price': $product_args['orderby'] = 'meta_value_num'; $product_args['meta_key'] = '_price'; break; } } else { //category if ($category == '-1') { $product_args = array('post_type' => 'product', 'post_status' => 'publish', 'posts_per_page' => $max_items ); } else { $product_args = array ( 'post_type' => 'product', 'posts_per_page'=> $max_items, 'tax_query' => array( array( 'taxonomy' => 'product_cat', 'terms' => $category, 'operator' => $operator ))); } } //print_r($product_args); $loop = new WP_Query($product_args ); ?> 'product_cat', 'orderby' => 'date', 'order' => 'ASC', 'show_count' => 1, 'pad_counts' => 0, 'hierarchical' => 0, 'title_li' => '', 'hide_empty' => 1, ); $categories = get_categories( $args ); $category_list = ''; $categories = best_shop_get_product_category_list(); if(0 == $category){ //$category_list = $category_list.''; } else{ //$category_list = $category_list.''; } foreach ( $categories as $cat=> $value ) { $selected =''; if(($cat)==$category){ $selected ='Selected=selected'; } $category_list = $category_list.''; } ?>


id="get_field_id( 'hide_navigation' )); ?>" name="get_field_name( 'hide_navigation' )); ?>" />

id="get_field_id( 'hide_dots' )); ?>" name="get_field_name( 'hide_dots' )); ?>" />