Advanced AJAX Product Filters - Version 1.6.1.2

Version Description

  • Enhancement - Compatibility version: WooCommerce 6.1
  • Enhancement - Compatibility with WP Search WooCommerce
  • Fix - Compatibility with Product Table
Download this release

Release Info

Developer RazyRx
Plugin Icon wp plugin Advanced AJAX Product Filters
Version 1.6.1.2
Comparing to
See all releases

Code changes from version 1.6.1.1 to 1.6.1.2

berocket/includes/error_notices.php CHANGED
@@ -20,7 +20,7 @@ if( ! class_exists('BeRocket_error_notices') ) {
20
  return $errors;
21
  }
22
  public static function save_plugin_error($plugin_id, $errors) {
23
- if( count($errors) > 5000 ) {
24
  $i = 0;
25
  foreach($errors as $error_id => $error) {
26
  if($i > 100) break;
20
  return $errors;
21
  }
22
  public static function save_plugin_error($plugin_id, $errors) {
23
+ if( count($errors) > 200 ) {
24
  $i = 0;
25
  foreach($errors as $error_id => $error) {
26
  if($i > 100) break;
includes/compatibility/product-table.php CHANGED
@@ -24,7 +24,9 @@ class BeRocket_AAPF_compat_product_table {
24
  }
25
  public static function plugins_loaded() {
26
  if( class_exists('WC_Product_Table_Plugin')
27
- && ( function_exists( 'Barn2\Plugin\WC_Product_Table\wc_product_table' ) || (function_exists( 'wc_product_table' ) && version_compare(WC_Product_Table_Plugin::VERSION, '2.1.3', '>')) ) ) {
 
 
28
  add_filter('aapf_localize_widget_script', array( __CLASS__, 'aapf_localize_widget_script' ));
29
  add_action( 'wc_product_table_get_table', array( __CLASS__, 'wc_product_table_get_table' ), 10, 1 );
30
  add_action( 'wc_product_table_after_get_table', array( __CLASS__, 'wc_product_table_get_table' ), 10, 1 );
24
  }
25
  public static function plugins_loaded() {
26
  if( class_exists('WC_Product_Table_Plugin')
27
+ && ( function_exists( 'Barn2\Plugin\WC_Product_Table\wc_product_table' )
28
+ || function_exists( 'Barn2\Plugin\WC_Product_Table\wpt' )
29
+ || (function_exists( 'wc_product_table' ) && version_compare(WC_Product_Table_Plugin::VERSION, '2.1.3', '>')) ) ) {
30
  add_filter('aapf_localize_widget_script', array( __CLASS__, 'aapf_localize_widget_script' ));
31
  add_action( 'wc_product_table_get_table', array( __CLASS__, 'wc_product_table_get_table' ), 10, 1 );
32
  add_action( 'wc_product_table_after_get_table', array( __CLASS__, 'wc_product_table_get_table' ), 10, 1 );
includes/compatibility/wpsearch_wc_compatibility.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( ! class_exists('BeRocket_AAPF_compat_wpsearch_woocommerce') ) {
3
+ class BeRocket_AAPF_compat_wpsearch_woocommerce {
4
+ public $instance = false;
5
+ function __construct() {
6
+ add_action('searchwp_woocommerce_before_search', array($this, 'save_instance'));
7
+ add_filter('berocket_widget_attribute_type_terms', array($this, 'remove_hook'), 1);
8
+ add_filter('berocket_widget_attribute_type_terms', array($this, 'add_hook'), 999999);
9
+ }
10
+ function save_instance($instance) {
11
+ $this->instance = $instance;
12
+ }
13
+ function remove_hook($filtered) {
14
+ if( $this->instance != false ) {
15
+ remove_filter( 'woocommerce_price_filter_widget_min_amount', array( $this->instance, 'get_price_min_amount' ), 999 );
16
+ remove_filter( 'woocommerce_price_filter_widget_max_amount', array( $this->instance, 'get_price_max_amount' ), 999 );
17
+ }
18
+ return $filtered;
19
+ }
20
+ function add_hook($filtered) {
21
+ if( $this->instance != false ) {
22
+ add_filter( 'woocommerce_price_filter_widget_min_amount', array( $this->instance, 'get_price_min_amount' ), 999 );
23
+ add_filter( 'woocommerce_price_filter_widget_max_amount', array( $this->instance, 'get_price_max_amount' ), 999 );
24
+ }
25
+ return $filtered;
26
+ }
27
+ }
28
+ new BeRocket_AAPF_compat_wpsearch_woocommerce();
29
+ }
includes/functions.php CHANGED
@@ -178,11 +178,9 @@ if ( ! function_exists( 'br_is_term_selected' ) ) {
178
  if( $term_taxonomy == '_rating' ) {
179
  $term_taxonomy = 'product_visibility';
180
  }
181
- $is_checked = false;
182
 
183
- global $berocket_parse_page_obj;
184
- $filter_data = $berocket_parse_page_obj->get_current();
185
- if ( $child_parent ) {
186
  $selected_terms = br_get_selected_term( $term_taxonomy );
187
  foreach( $selected_terms as $selected_term ) {
188
  $ancestors = get_ancestors( $selected_term, $term_taxonomy );
@@ -193,14 +191,21 @@ if ( ! function_exists( 'br_is_term_selected' ) ) {
193
  }
194
  }
195
  }
196
- if( isset($filter_data['filters']) && is_array($filter_data['filters']) ) {
197
- foreach($filter_data['filters'] as $filter) {
198
- if( $is_checked || ($filter['taxonomy'] == $term_taxonomy && in_array($term->term_id, $filter['val_ids'])) ) {
199
- if($checked) return ' checked="checked"';
200
- else return ' selected="selected"';
 
 
 
201
  }
202
  }
203
  }
 
 
 
 
204
  return '';
205
  }
206
  }
178
  if( $term_taxonomy == '_rating' ) {
179
  $term_taxonomy = 'product_visibility';
180
  }
181
+ $is_checked = apply_filters('br_is_term_selected_checked', false, $term_taxonomy, $term, $checked, $child_parent, $depth);
182
 
183
+ if ( ! $is_checked && $child_parent ) {
 
 
184
  $selected_terms = br_get_selected_term( $term_taxonomy );
185
  foreach( $selected_terms as $selected_term ) {
186
  $ancestors = get_ancestors( $selected_term, $term_taxonomy );
191
  }
192
  }
193
  }
194
+ if( ! $is_checked ) {
195
+ global $berocket_parse_page_obj;
196
+ $filter_data = $berocket_parse_page_obj->get_current();
197
+ if( isset($filter_data['filters']) && is_array($filter_data['filters']) ) {
198
+ foreach($filter_data['filters'] as $filter) {
199
+ if( $filter['taxonomy'] == $term_taxonomy && in_array($term->term_id, $filter['val_ids']) ) {
200
+ $is_checked = true;
201
+ }
202
  }
203
  }
204
  }
205
+ if( $is_checked ) {
206
+ if($checked) return ' checked="checked"';
207
+ else return ' selected="selected"';
208
+ }
209
  return '';
210
  }
211
  }
main.php CHANGED
@@ -575,6 +575,9 @@ class BeRocket_AAPF extends BeRocket_Framework {
575
  if( ! empty($GLOBALS['woocommerce-aelia-currencyswitcher']) ) {
576
  include_once(plugin_dir_path( __FILE__ ) . "includes/compatibility/aelia-currencyswitcher.php");
577
  }
 
 
 
578
  if( apply_filters('BeRocket_AAPF_widget_load_file', true) ) {
579
  foreach (glob(__DIR__ . "/includes/display_filter/*.php") as $filename)
580
  {
575
  if( ! empty($GLOBALS['woocommerce-aelia-currencyswitcher']) ) {
576
  include_once(plugin_dir_path( __FILE__ ) . "includes/compatibility/aelia-currencyswitcher.php");
577
  }
578
+ if( defined( 'SEARCHWP_WOOCOMMERCE_VERSION') ) {
579
+ include_once(plugin_dir_path( __FILE__ ) . "includes/compatibility/wpsearch_wc_compatibility.php");
580
+ }
581
  if( apply_filters('BeRocket_AAPF_widget_load_file', true) ) {
582
  foreach (glob(__DIR__ . "/includes/display_filter/*.php") as $filename)
583
  {
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://berocket.com/product/woocommerce-ajax-products-filter?utm_s
5
  Tags: filters, product filters, ajax product filters, ajax filter, ajax filter widget, color filter, size filter, product onsale filter, product preview, product category filter, product reset filter, product sort by filter, stock filter, product tag filter, price range filter, price box filter, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce products filter, woocommerce ajax product filters, widget, plugin, woocommerce item filters, filters plugin, ajax filters plugin, filter woocommerce products, filter woocommerce products plugin, wc filters, wc filters products, wc products filters, wc ajax products filters, wc product filters, wc advanced product filters, woocommerce layered nav, woocommerce layered navigation, ajax filtered nav, ajax filtered navigation, price filter, ajax price filter, woocommerce product sorting, sidebar filter, sidebar ajax filter, taxonomy filter, category filter, attribute filter, attributes filter, woocommerce product sort, ajax products filter plugin for woocommerce, rocket, berocket, berocket woocommerce ajax products filter
6
  Requires at least: 5.0
7
  Tested up to: 5.8
8
- Stable tag: 1.6.1.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -185,6 +185,11 @@ You can try this plugin's admin side [here](https://berocket.com/product/woocomm
185
 
186
  == Changelog ==
187
 
 
 
 
 
 
188
  = 1.6.1.1 =
189
  * Fix - Compatibility with Product Table plugin
190
  * Fix - URL decoding option with Product Table plugin
5
  Tags: filters, product filters, ajax product filters, ajax filter, ajax filter widget, color filter, size filter, product onsale filter, product preview, product category filter, product reset filter, product sort by filter, stock filter, product tag filter, price range filter, price box filter, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce products filter, woocommerce ajax product filters, widget, plugin, woocommerce item filters, filters plugin, ajax filters plugin, filter woocommerce products, filter woocommerce products plugin, wc filters, wc filters products, wc products filters, wc ajax products filters, wc product filters, wc advanced product filters, woocommerce layered nav, woocommerce layered navigation, ajax filtered nav, ajax filtered navigation, price filter, ajax price filter, woocommerce product sorting, sidebar filter, sidebar ajax filter, taxonomy filter, category filter, attribute filter, attributes filter, woocommerce product sort, ajax products filter plugin for woocommerce, rocket, berocket, berocket woocommerce ajax products filter
6
  Requires at least: 5.0
7
  Tested up to: 5.8
8
+ Stable tag: 1.6.1.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
185
 
186
  == Changelog ==
187
 
188
+ = 1.6.1.2 =
189
+ * Enhancement - Compatibility version: WooCommerce 6.1
190
+ * Enhancement - Compatibility with WP Search WooCommerce
191
+ * Fix - Compatibility with Product Table
192
+
193
  = 1.6.1.1 =
194
  * Fix - Compatibility with Product Table plugin
195
  * Fix - URL decoding option with Product Table plugin
woocommerce-filters.php CHANGED
@@ -3,14 +3,14 @@
3
  * Plugin Name: Advanced AJAX Product Filters for WooCommerce
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-ajax-filters/?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters
5
  * Description: Unlimited AJAX products filters to make your shop perfect
6
- * Version: 1.6.1.1
7
  * Author: BeRocket
8
  * Requires at least: 5.0
9
  * Author URI: https://berocket.com?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters
10
  * Text Domain: BeRocket_AJAX_domain
11
  * Domain Path: /languages/
12
- * WC tested up to: 5.9
13
  */
14
- define( "BeRocket_AJAX_filters_version", '1.6.1.1' );
15
  define( "BeRocket_AJAX_filters_file", __FILE__ );
16
  include_once('main.php');
3
  * Plugin Name: Advanced AJAX Product Filters for WooCommerce
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-ajax-filters/?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters
5
  * Description: Unlimited AJAX products filters to make your shop perfect
6
+ * Version: 1.6.1.2
7
  * Author: BeRocket
8
  * Requires at least: 5.0
9
  * Author URI: https://berocket.com?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters
10
  * Text Domain: BeRocket_AJAX_domain
11
  * Domain Path: /languages/
12
+ * WC tested up to: 6.1
13
  */
14
+ define( "BeRocket_AJAX_filters_version", '1.6.1.2' );
15
  define( "BeRocket_AJAX_filters_file", __FILE__ );
16
  include_once('main.php');