0, 'title' => esc_html__('Collection Title', 'ample-shop'), 'product_number'=>10, 'view' => esc_html__('View All', 'ample-shop'), ); return $defaults; } public function __construct() { parent::__construct( 'ample-shop-all-product-widget', esc_html__(' AT : Each Cat Product Widget', 'ample-shop'), array('description' => esc_html__('select woocommerce category', 'ample-shop')) ); } public function form($instance) { $instance = wp_parse_args( (array ) $instance, $this->defaults() ); $catid = absint($instance['cat_id']); $title = esc_attr($instance['title']); $product_number = absint( $instance[ 'product_number' ] ); $view = esc_attr($instance['view']); ?>



esc_html__('Choose product Categories', 'ample-shop'), 'orderby' => 'name', 'order' => 'asc', 'show_count' => 1, 'hide_empty' => 1, 'echo' => 1, 'selected' => $catid, 'hierarchical' => 1, 'name' => esc_attr($this->get_field_name('cat_id')), 'id' => esc_attr($this->get_field_name('cat_id')), 'class' => 'widefat', 'taxonomy' => 'product_cat', 'hide_if_empty' => false, ); wp_dropdown_categories($ample_shop_con_dropown_cat); ?>



defaults()); $catid = absint($instance['cat_id']); $title = apply_filters('widget_title', !empty($instance['title']) ? esc_html($instance['title']) : '', $instance, $this->id_base); $product_number = isset( $instance[ 'product_number' ] ) ? $instance[ 'product_number' ] : ''; $view = esc_html($instance['view']); ?>

0 ){ $cat_link = get_category_link( $catid ); }else{ $cat_link = ''; } ?>

'product', 'post_status' => 'publish', 'posts_per_page' => absint( $product_number ), 'tax_query' => array( array( 'taxonomy' => 'product_cat', 'terms' => $catid, ) ) ); } else { $home_product_section = array( 'post_type' => 'product', 'post_status' => 'publish', 'terms' => $catid, 'posts_per_page' => absint( $product_number ), 'orderby' => 'post_date', 'order' => 'DESC', ); } $home_product_section_query = new WP_Query($home_product_section); if ($home_product_section_query->have_posts()) { while ($home_product_section_query->have_posts()) { $home_product_section_query->the_post(); $product = wc_get_product($home_product_section_query->post->ID); $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id, 'ample-shop-shop', false); if ($i % 3 == 0) { ?>
is_on_sale() ){ ?>
<?php the_title_attribute(); ?>
get_average_rating())) { ?>
'; } ?>
get_price_html()) : ?>
get_id()); ?>