YITH WooCommerce Ajax Product Filter - Version 3.1.1

Version Description

  • Released: 28 December, 2016 =

  • Added: yit_get_terms_args hook

  • Added: yith_wcan_skip_no_products_color hook

  • Added: yith_wcan_show_no_products_attributes hook

  • Added: yith_wcan_after_reset_widget hook

  • Added: yith_wcan_before_reset_widget hook

  • Removed: yith_wcan_hide_no_products_attributes hook

Download this release

Release Info

Developer yithemes
Plugin Icon 128x128 YITH WooCommerce Ajax Product Filter
Version 3.1.1
Comparing to
See all releases

Code changes from version 3.1.0 to 3.1.1

README.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: yithemes
4
  Tags: woocommerce ajax product filter download, woocommerce, widget, ajax, ajax filtered nav, ajax navigation, ajax filtered navigation, woocommerce layered navigation, woocommerce layered nav, product filter, product filters, ajax product filter, woocommerce ajax product filter, woocommerce filters, sidebar filter, sidebar ajax filter, ajax price filter, price filter, product sorting, woocommerce filter, taxonomy filter, attribute filter, attributes filter, woocommerce product sort, ajax sort, woocommerce ajax product filter, advanced product filters, ajax product filters, filters, woocommerce ajax product filters, woocommerce product filters, woocommerce product filters, category filter, attribute filters, woocommerce products filter, woocommerce price filter, yit, yith, yithemes
5
  Requires at least: 4.0
6
  Tested up to: 4.7
7
- Stable tag: 3.1.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -159,6 +159,15 @@ If you want to see a demonstration version of the premium plugin, you can see it
159
 
160
  == Changelog ==
161
 
 
 
 
 
 
 
 
 
 
162
  = 3.1.0 - Released: 05 December, 2016 =
163
 
164
  * Added: Support to WordPress 4.7
4
  Tags: woocommerce ajax product filter download, woocommerce, widget, ajax, ajax filtered nav, ajax navigation, ajax filtered navigation, woocommerce layered navigation, woocommerce layered nav, product filter, product filters, ajax product filter, woocommerce ajax product filter, woocommerce filters, sidebar filter, sidebar ajax filter, ajax price filter, price filter, product sorting, woocommerce filter, taxonomy filter, attribute filter, attributes filter, woocommerce product sort, ajax sort, woocommerce ajax product filter, advanced product filters, ajax product filters, filters, woocommerce ajax product filters, woocommerce product filters, woocommerce product filters, category filter, attribute filters, woocommerce products filter, woocommerce price filter, yit, yith, yithemes
5
  Requires at least: 4.0
6
  Tested up to: 4.7
7
+ Stable tag: 3.1.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
159
 
160
  == Changelog ==
161
 
162
+ = 3.1.1 - Released: 28 December, 2016 =
163
+
164
+ * Added: yit_get_terms_args hook
165
+ * Added: yith_wcan_skip_no_products_color hook
166
+ * Added: yith_wcan_show_no_products_attributes hook
167
+ * Added: yith_wcan_after_reset_widget hook
168
+ * Added: yith_wcan_before_reset_widget hook
169
+ * Removed: yith_wcan_hide_no_products_attributes hook
170
+
171
  = 3.1.0 - Released: 05 December, 2016 =
172
 
173
  * Added: Support to WordPress 4.7
assets/js/yith-wcan-frontend.js CHANGED
@@ -280,7 +280,7 @@ jQuery(function ($) {
280
  }
281
 
282
  //See al categories in ajax
283
- see_all_taxonomies()
284
  }
285
  });
286
  };
280
  }
281
 
282
  //See al categories in ajax
283
+ see_all_taxonomies();
284
  }
285
  });
286
  };
includes/functions.yith-wcan.php CHANGED
@@ -248,15 +248,23 @@ if ( ! function_exists( 'yit_get_terms' ) ) {
248
  $exclude = apply_filters( 'yith_wcan_exclude_terms', array(), $instance );
249
  $include = apply_filters( 'yith_wcan_include_terms', array(), $instance );
250
  $reordered = false;
 
 
 
 
 
 
 
 
251
 
252
  switch ( $case ) {
253
 
254
  case 'all':
255
- $terms = yith_wcan_wp_get_terms( array( 'taxonomy' => $taxonomy, 'hide_empty' => true, 'exclude' => $exclude ) );
256
  break;
257
 
258
  case 'hierarchical':
259
- $terms = yith_wcan_wp_get_terms( array( 'taxonomy' => $taxonomy, 'hide_empty' => true, 'exclude' => $exclude ) );
260
  if( ! in_array( $instance['type'], apply_filters( 'yith_wcan_display_type_list', array( 'list' ) ) ) ) {
261
  $terms = yit_reorder_terms_by_parent( $terms, $taxonomy );
262
  $reordered = true;
@@ -264,11 +272,13 @@ if ( ! function_exists( 'yit_get_terms' ) ) {
264
  break;
265
 
266
  case 'parent' :
267
- $terms = yith_wcan_wp_get_terms( array( 'taxonomy' => $taxonomy, 'hide_empty' => true, 'parent' => false, 'exclude' => $exclude ) );
 
268
  break;
269
 
270
  default:
271
- $args = array( 'taxonomy' => $taxonomy, 'hide_empty' => true, 'exclude' => $exclude, 'include' => $include );
 
272
  if ( 'parent' == $instance['display'] ) {
273
  $args['parent'] = false;
274
  }
248
  $exclude = apply_filters( 'yith_wcan_exclude_terms', array(), $instance );
249
  $include = apply_filters( 'yith_wcan_include_terms', array(), $instance );
250
  $reordered = false;
251
+
252
+ $args = array(
253
+ 'taxonomy' => $taxonomy,
254
+ 'hide_empty' => true,
255
+ 'exclude' => $exclude
256
+ );
257
+
258
+ $args = apply_filters( 'yit_get_terms_args', $args );
259
 
260
  switch ( $case ) {
261
 
262
  case 'all':
263
+ $terms = yith_wcan_wp_get_terms( $args );
264
  break;
265
 
266
  case 'hierarchical':
267
+ $terms = yith_wcan_wp_get_terms( $args );
268
  if( ! in_array( $instance['type'], apply_filters( 'yith_wcan_display_type_list', array( 'list' ) ) ) ) {
269
  $terms = yit_reorder_terms_by_parent( $terms, $taxonomy );
270
  $reordered = true;
272
  break;
273
 
274
  case 'parent' :
275
+ $args['parent'] = false;
276
+ $terms = yith_wcan_wp_get_terms( $args );
277
  break;
278
 
279
  default:
280
+ $args['include'] = $include;
281
+
282
  if ( 'parent' == $instance['display'] ) {
283
  $args['parent'] = false;
284
  }
init.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: YITH WooCommerce Ajax Product Filter
4
  * Plugin URI: http://yithemes.com/
5
  * Description: YITH WooCommerce Ajax Product Filter offers the perfect way to filter all the products of your shop.
6
- * Version: 3.1.0
7
  * Author: YITHEMES
8
  * Author URI: http://yithemes.com/
9
  * Text Domain: yith-woocommerce-ajax-navigation
@@ -64,7 +64,7 @@ load_plugin_textdomain( 'yith-woocommerce-ajax-navigation', false, dirname( plug
64
  ! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
65
  ! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
66
  ! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
67
- ! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '3.1.0' );
68
  ! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
69
  ! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
70
 
3
  * Plugin Name: YITH WooCommerce Ajax Product Filter
4
  * Plugin URI: http://yithemes.com/
5
  * Description: YITH WooCommerce Ajax Product Filter offers the perfect way to filter all the products of your shop.
6
+ * Version: 3.1.1
7
  * Author: YITHEMES
8
  * Author URI: http://yithemes.com/
9
  * Text Domain: yith-woocommerce-ajax-navigation
64
  ! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
65
  ! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
66
  ! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
67
+ ! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '3.1.1' );
68
  ! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
69
  ! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
70
 
widgets/class.yith-wcan-navigation-widget.php CHANGED
@@ -352,7 +352,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
352
  $this->found = true;
353
  }
354
 
355
- if ( $count == 0 && ! $option_is_set ) {
356
  continue;
357
  }
358
 
@@ -1050,20 +1050,24 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
1050
  $link = esc_url( urldecode( apply_filters( 'woocommerce_layered_nav_link', $link ) ) );
1051
 
1052
  $li_printed = false;
 
1053
 
1054
  if( $count > 0 || $option_is_set ) {
 
1055
  printf( '<li %s><a href="%s">%s</a>', $class, $link, $term->name );
1056
  $li_printed = true;
1057
  }
1058
 
1059
  else {
1060
- $to_print = apply_filters( 'yith_wcan_hide_no_products_attributes', ! $filter_by_tags_hierarchical && $query_type != 'and' );
1061
 
1062
  $to_print && printf( '<li %s><span>%s</span>', $class, $term->name );
1063
  $li_printed = true;
1064
  }
1065
 
1066
- if ( $count != 0 && apply_filters( "{$args['widget_id']}-show_product_count", true, $instance ) ) {
 
 
1067
  echo ' <small class="count">' . $count . '</small><div class="clear"></div>';
1068
  }
1069
 
352
  $this->found = true;
353
  }
354
 
355
+ if ( apply_filters( 'yith_wcan_skip_no_products_color', $count == 0 && ! $option_is_set ) ) {
356
  continue;
357
  }
358
 
1050
  $link = esc_url( urldecode( apply_filters( 'woocommerce_layered_nav_link', $link ) ) );
1051
 
1052
  $li_printed = false;
1053
+ $to_print = false;
1054
 
1055
  if( $count > 0 || $option_is_set ) {
1056
+ $to_print = true;
1057
  printf( '<li %s><a href="%s">%s</a>', $class, $link, $term->name );
1058
  $li_printed = true;
1059
  }
1060
 
1061
  else {
1062
+ $to_print = apply_filters( 'yith_wcan_show_no_products_attributes', ! $filter_by_tags_hierarchical && $query_type != 'and' );
1063
 
1064
  $to_print && printf( '<li %s><span>%s</span>', $class, $term->name );
1065
  $li_printed = true;
1066
  }
1067
 
1068
+ $show_count = $count != 0 && apply_filters( "{$args['widget_id']}-show_product_count", true, $instance );
1069
+
1070
+ if ( $to_print && apply_filters( 'yith_wcan_force_show_count', true || $show_count ) ) {
1071
  echo ' <small class="count">' . $count . '</small><div class="clear"></div>';
1072
  }
1073
 
widgets/class.yith-wcan-reset-navigation-widget.php CHANGED
@@ -41,6 +41,9 @@ if ( ! class_exists( 'YITH_WCAN_Reset_Navigation_Widget' ) ) {
41
  $min_price = isset( $_GET['min_price'] ) ? esc_attr( $_GET['min_price'] ) : 0;
42
  $max_price = isset( $_GET['max_price'] ) ? esc_attr( $_GET['max_price'] ) : 0;
43
 
 
 
 
44
  ob_start();
45
 
46
  if ( count( $_chosen_attributes ) > 0 || $min_price > 0 || $max_price > 0 || apply_filters( 'yith_woocommerce_reset_filters_attributes', false ) ) {
41
  $min_price = isset( $_GET['min_price'] ) ? esc_attr( $_GET['min_price'] ) : 0;
42
  $max_price = isset( $_GET['max_price'] ) ? esc_attr( $_GET['max_price'] ) : 0;
43
 
44
+ $after_widget = apply_filters( 'yith_wcan_after_reset_widget', $after_widget );
45
+ $before_widget = apply_filters( 'yith_wcan_before_reset_widget', $before_widget );
46
+
47
  ob_start();
48
 
49
  if ( count( $_chosen_attributes ) > 0 || $min_price > 0 || $max_price > 0 || apply_filters( 'yith_woocommerce_reset_filters_attributes', false ) ) {