From cd3d61bf98024508c3ae2bbba6e2f852dfecc10f Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 23 Nov 2017 14:26:12 +0000 Subject: [PATCH 1/7] Add back category filtering which somehow was removed --- .../class-wc-admin-list-table-products.php | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/includes/admin/list-tables/class-wc-admin-list-table-products.php b/includes/admin/list-tables/class-wc-admin-list-table-products.php index dcd44e706fb..591c8bcbc8b 100644 --- a/includes/admin/list-tables/class-wc-admin-list-table-products.php +++ b/includes/admin/list-tables/class-wc-admin-list-table-products.php @@ -299,22 +299,29 @@ class WC_Admin_List_Table_Products extends WC_Admin_List_Table { * Render any custom filters and search inputs for the list table. */ protected function render_filters() { - $current_category_slug = isset( $_REQUEST['product_cat'] ) ? wc_clean( wp_unslash( $_REQUEST['product_cat'] ) ) : false; // WPCS: input var ok, sanitization ok. - $current_product_type = isset( $_REQUEST['product_type'] ) ? wc_clean( wp_unslash( $_REQUEST['product_type'] ) ) : false; // WPCS: input var ok, sanitization ok. - // @codingStandardsIgnoreStart - $current_category = $current_category_slug ? get_term_by( 'slug', $current_category_slug, 'product_cat' ): false; - // @codingStandardsIgnoreEnd - ?> - - '; - $output .= ''; + if ( $categories_count <= apply_filters( 'woocommerce_product_category_filter_threshold', 100 ) ) { + wc_product_dropdown_categories( array( + 'option_select_text' => __( 'Filter by category', 'woocommerce' ), + ) ); + } else { + $current_category_slug = isset( $_GET['product_cat'] ) ? wc_clean( wp_unslash( $_GET['product_cat'] ) ) : false; // WPCS: input var ok, CSRF ok. + $current_category = $current_category_slug ? get_term_by( 'slug', $current_category_slug, 'product_cat' ) : false; + ?> + + '; foreach ( $terms as $term ) { $output .= '