Advanced AJAX Product Filters - Version 1.4.1.1

Version Description

  • Fix - Price replacements do not work
  • Fix - Divi theme compatibility replace with another module
  • Fix - PHP notices for some sorting
Download this release

Release Info

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

Code changes from version 1.4.1 to 1.4.1.1

addons/divi_theme_compat/divi_theme_compat.php DELETED
@@ -1,38 +0,0 @@
1
- <?php
2
- class BeRocket_aapf_divi_theme_compat_addon extends BeRocket_framework_addon_lib {
3
- public $addon_file = __FILE__;
4
- public $plugin_name = 'ajax_filters';
5
- function __construct() {
6
- parent::__construct();
7
- $active_addons = apply_filters('berocket_addons_active_'.$this->plugin_name, array());
8
- if( ! in_array($this->addon_file, $active_addons) ) {
9
- $dir = get_template_directory();
10
- $dir .= '/includes/builder/module';
11
- if( is_admin() ) {
12
- if( file_exists($dir. '/Shop_advanced.php') && is_writable($dir) ) {
13
- unlink($dir. '/Shop_advanced.php');
14
- }
15
- }
16
- }
17
- }
18
- function get_addon_data() {
19
- $data = parent::get_addon_data();
20
- return array_merge($data, array(
21
- 'addon_name' => __('DIVI Theme Compatibility', 'BeRocket_AJAX_domain'),
22
- 'paid' => true,
23
- 'tooltip' => __('Replace DIVI products module with custom products module, that has additional option. Provide better compatibility with filters', 'BeRocket_AJAX_domain')
24
- ));
25
- }
26
- function check_init() {
27
- if( is_admin() ) {
28
- $dir = get_template_directory();
29
- $dir .= '/includes/builder/module';
30
- if( ! file_exists($dir. '/Shop_advanced.php') && is_writable($dir) ) {
31
- copy(__DIR__ . '/Shop_advanced.php', $dir. '/Shop_advanced.php');
32
- }
33
- }
34
- }
35
- }
36
- new BeRocket_aapf_divi_theme_compat_addon();
37
-
38
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/divi-builder.php CHANGED
@@ -107,6 +107,33 @@ function berocket_filter_et_builder_ready() {
107
  }
108
  }
109
  new ET_Builder_Module_br_filters_group;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  }
111
  }
112
 
107
  }
108
  }
109
  new ET_Builder_Module_br_filters_group;
110
+
111
+ class ET_Builder_Module_braapf_filter_next extends ET_Builder_Module {
112
+ function init() {
113
+ $this->name = __( 'BeRocket Filter Next Product', 'BeRocket_AJAX_domain' );
114
+ $this->slug = 'et_pb_braapf_filter_next';
115
+ $this->fields_defaults = array();
116
+ }
117
+
118
+ function get_fields() {
119
+ $fields = array();
120
+ return $fields;
121
+ }
122
+
123
+ function render( $atts, $content = null, $function_name ) {
124
+ add_filter('berocket_aapf_wcshortcode_is_filtering', array($this, 'enable_filtering'));
125
+ return '';
126
+ }
127
+
128
+ protected function _add_additional_border_fields() {
129
+ $this->advanced_options["border"]['css'] = array();
130
+ }
131
+ function enable_filtering($enabled) {
132
+ remove_filter('berocket_aapf_wcshortcode_is_filtering', array($this, 'enable_filtering'));
133
+ return true;
134
+ }
135
+ }
136
+ new ET_Builder_Module_braapf_filter_next;
137
  }
138
  }
139
 
includes/filters/display_widget.php CHANGED
@@ -301,9 +301,8 @@ class BeRocket_AAPF_Widget extends WP_Widget {
301
  $br_widget_ids[] = array('instance' => $instance, 'args' => $args);
302
  }
303
 
304
- extract( $args );
305
- extract( $instance );
306
-
307
  $text_before_price = apply_filters('aapf_widget_text_before_price', ( isset($text_before_price) ? $text_before_price : '' ) );
308
  $text_after_price = apply_filters('aapf_widget_text_after_price', ( isset($text_after_price) ? $text_after_price : '' ) );
309
  if( ! empty($text_before_price) || ! empty($text_after_price) ) {
@@ -316,6 +315,10 @@ class BeRocket_AAPF_Widget extends WP_Widget {
316
  $text_after_price = str_replace(array('%cur_symbol%', '%cur_slug%'), array($cur_symbol, $cur_slug), $text_after_price);
317
  }
318
  }
 
 
 
 
319
 
320
  if ( empty($order_values_by) ) {
321
  $order_values_by = 'Default';
@@ -331,7 +334,10 @@ class BeRocket_AAPF_Widget extends WP_Widget {
331
  } else {
332
  echo '<script>jQuery(document).ready(function() {if(typeof(berocket_filters_first_load) == "function") {berocket_filters_first_load();}});</script>';
333
  }
334
- if( apply_filters( 'berocket_aapf_widget_display_custom_filter', false, berocket_isset($widget_type), $instance, $args, $this ) ) return '';
 
 
 
335
 
336
  if( ! empty($widget_type) && $custom_type_html = apply_filters('berocket_aapf_display_filter_custom_type', '', $widget_type, array('options' => $instance, 'args' => $args)) ) {
337
  if( $custom_type_html !== TRUE ) {
@@ -340,16 +346,14 @@ class BeRocket_AAPF_Widget extends WP_Widget {
340
  echo $after_widget;
341
  }
342
  $widget_error_log['return'] = $widget_type;
343
- BeRocket_AAPF::$error_log['6_widgets'][] = $widget_error_log;
344
- $this->restore_wp_the_query($br_wc_query, $wp_the_query, $wp_query, $wc_query, $old_the_query, $old_query);
345
  return '';
346
  }
347
 
348
  $woocommerce_hide_out_of_stock_items = BeRocket_AAPF_Widget_functions::woocommerce_hide_out_of_stock_items();
349
  if( $woocommerce_hide_out_of_stock_items == 'yes' && $filter_type == 'attribute' && $attribute == '_stock_status' ) {
350
  $widget_error_log['return'] = 'stock_status';
351
- BeRocket_AAPF::$error_log['6_widgets'][] = $widget_error_log;
352
- $this->restore_wp_the_query($br_wc_query, $wp_the_query, $wp_query, $wc_query, $old_the_query, $old_query);
353
  return true;
354
  }
355
 
@@ -368,8 +372,7 @@ class BeRocket_AAPF_Widget extends WP_Widget {
368
  } else {
369
  $widget_error_log['terms'] = $terms;
370
  $widget_error_log['return'] = $terms_error_return;
371
- BeRocket_AAPF::$error_log['6_widgets'][] = $widget_error_log;
372
- $this->restore_wp_the_query($br_wc_query, $wp_the_query, $wp_query, $wc_query, $old_the_query, $old_query);
373
  return false;
374
  }
375
  } else {
@@ -383,14 +386,25 @@ class BeRocket_AAPF_Widget extends WP_Widget {
383
  if ( ! $price_range or count( $price_range ) < 2 ) {
384
  $widget_error_log['price_range'] = $price_range;
385
  $widget_error_log['return'] = 'price_range < 2';
386
- BeRocket_AAPF::$error_log['6_widgets'][] = $widget_error_log;
387
- $this->restore_wp_the_query($br_wc_query, $wp_the_query, $wp_query, $wc_query, $old_the_query, $old_query);
388
  return false;
389
  }
390
  }
391
  if( BeRocket_AAPF::$debug_mode ) {
392
  $widget_error_log['price_range'] = $price_range;
393
  }
 
 
 
 
 
 
 
 
 
 
 
 
394
  } elseif ( $filter_type != 'attribute' || $attribute != 'price' ) {
395
  $get_terms_args = array(
396
  'taxonomy' => $attribute,
@@ -459,8 +473,7 @@ class BeRocket_AAPF_Widget extends WP_Widget {
459
  if ( isset($terms) && is_array($terms) && count( $terms ) < 1 ) {
460
  $widget_error_log['terms'] = $terms;
461
  $widget_error_log['return'] = 'terms < 1';
462
- BeRocket_AAPF::$error_log['6_widgets'][] = $widget_error_log;
463
- $this->restore_wp_the_query($br_wc_query, $wp_the_query, $wp_query, $wc_query, $old_the_query, $old_query);
464
  return false;
465
  }
466
  $set_query_var_title['terms'] = $terms;
@@ -570,11 +583,11 @@ class BeRocket_AAPF_Widget extends WP_Widget {
570
  $widget_error_log['terms'] = (isset($terms) ? $terms : null);
571
  }
572
  $widget_error_log['return'] = 'OK';
573
- BeRocket_AAPF::$error_log['6_widgets'][] = $widget_error_log;
574
- $this->restore_wp_the_query($br_wc_query, $wp_the_query, $wp_query, $wc_query, $old_the_query, $old_query);
575
  }
576
 
577
- public static function restore_wp_the_query(&$br_wc_query, &$wp_the_query, &$wp_query, &$wc_query, &$old_the_query, &$old_query) {
 
578
  if ( isset ( $br_wc_query ) ) {
579
  if ( isset ( $old_query ) ) {
580
  $wp_the_query = $old_the_query;
@@ -585,6 +598,7 @@ class BeRocket_AAPF_Widget extends WP_Widget {
585
  }
586
  wc()->query->remove_ordering_args();
587
  }
 
588
  }
589
  //DEPRECATED SOON
590
  function update( $new_instance, $old_instance ) {
301
  $br_widget_ids[] = array('instance' => $instance, 'args' => $args);
302
  }
303
 
304
+ $text_before_price = berocket_isset($instance['text_before_price']);
305
+ $text_after_price = berocket_isset($instance['text_after_price']);
 
306
  $text_before_price = apply_filters('aapf_widget_text_before_price', ( isset($text_before_price) ? $text_before_price : '' ) );
307
  $text_after_price = apply_filters('aapf_widget_text_after_price', ( isset($text_after_price) ? $text_after_price : '' ) );
308
  if( ! empty($text_before_price) || ! empty($text_after_price) ) {
315
  $text_after_price = str_replace(array('%cur_symbol%', '%cur_slug%'), array($cur_symbol, $cur_slug), $text_after_price);
316
  }
317
  }
318
+ $instance['text_before_price'] = $text_before_price;
319
+ $instance['text_after_price'] = $text_after_price;
320
+ extract( $args );
321
+ extract( $instance );
322
 
323
  if ( empty($order_values_by) ) {
324
  $order_values_by = 'Default';
334
  } else {
335
  echo '<script>jQuery(document).ready(function() {if(typeof(berocket_filters_first_load) == "function") {berocket_filters_first_load();}});</script>';
336
  }
337
+ if( apply_filters( 'berocket_aapf_widget_display_custom_filter', false, berocket_isset($widget_type), $instance, $args, $this ) ) {
338
+ $this->filter_return($br_wc_query, $wp_the_query, $wp_query, $wc_query, $old_the_query, $old_query, $widget_error_log);
339
+ return '';
340
+ }
341
 
342
  if( ! empty($widget_type) && $custom_type_html = apply_filters('berocket_aapf_display_filter_custom_type', '', $widget_type, array('options' => $instance, 'args' => $args)) ) {
343
  if( $custom_type_html !== TRUE ) {
346
  echo $after_widget;
347
  }
348
  $widget_error_log['return'] = $widget_type;
349
+ $this->filter_return($br_wc_query, $wp_the_query, $wp_query, $wc_query, $old_the_query, $old_query, $widget_error_log);
 
350
  return '';
351
  }
352
 
353
  $woocommerce_hide_out_of_stock_items = BeRocket_AAPF_Widget_functions::woocommerce_hide_out_of_stock_items();
354
  if( $woocommerce_hide_out_of_stock_items == 'yes' && $filter_type == 'attribute' && $attribute == '_stock_status' ) {
355
  $widget_error_log['return'] = 'stock_status';
356
+ $this->filter_return($br_wc_query, $wp_the_query, $wp_query, $wc_query, $old_the_query, $old_query, $widget_error_log);
 
357
  return true;
358
  }
359
 
372
  } else {
373
  $widget_error_log['terms'] = $terms;
374
  $widget_error_log['return'] = $terms_error_return;
375
+ $this->filter_return($br_wc_query, $wp_the_query, $wp_query, $wc_query, $old_the_query, $old_query, $widget_error_log);
 
376
  return false;
377
  }
378
  } else {
386
  if ( ! $price_range or count( $price_range ) < 2 ) {
387
  $widget_error_log['price_range'] = $price_range;
388
  $widget_error_log['return'] = 'price_range < 2';
389
+ $this->filter_return($br_wc_query, $wp_the_query, $wp_query, $wc_query, $old_the_query, $old_query, $widget_error_log);
 
390
  return false;
391
  }
392
  }
393
  if( BeRocket_AAPF::$debug_mode ) {
394
  $widget_error_log['price_range'] = $price_range;
395
  }
396
+ if( ! empty($text_before_price) || ! empty($text_after_price) ) {
397
+ wp_localize_script(
398
+ 'berocket_aapf_widget-script',
399
+ 'br_price_text',
400
+ array(
401
+ 'before' => (isset($text_before_price) ? $text_before_price : ''),
402
+ 'after' => (isset($text_after_price) ? $text_after_price : ''),
403
+ )
404
+ );
405
+ }
406
+ $set_query_var_title['text_before_price'] = (isset($text_before_price) ? $text_before_price : null);
407
+ $set_query_var_title['text_after_price'] = (isset($text_after_price) ? $text_after_price : null);
408
  } elseif ( $filter_type != 'attribute' || $attribute != 'price' ) {
409
  $get_terms_args = array(
410
  'taxonomy' => $attribute,
473
  if ( isset($terms) && is_array($terms) && count( $terms ) < 1 ) {
474
  $widget_error_log['terms'] = $terms;
475
  $widget_error_log['return'] = 'terms < 1';
476
+ $this->filter_return($br_wc_query, $wp_the_query, $wp_query, $wc_query, $old_the_query, $old_query, $widget_error_log);
 
477
  return false;
478
  }
479
  $set_query_var_title['terms'] = $terms;
583
  $widget_error_log['terms'] = (isset($terms) ? $terms : null);
584
  }
585
  $widget_error_log['return'] = 'OK';
586
+ $this->filter_return($br_wc_query, $wp_the_query, $wp_query, $wc_query, $old_the_query, $old_query, $widget_error_log);
 
587
  }
588
 
589
+ public function filter_return(&$br_wc_query, &$wp_the_query, &$wp_query, &$wc_query, &$old_the_query, &$old_query, $widget_error_log) {
590
+ BeRocket_AAPF::$error_log['6_widgets'][] = $widget_error_log;
591
  if ( isset ( $br_wc_query ) ) {
592
  if ( isset ( $old_query ) ) {
593
  $wp_the_query = $old_the_query;
598
  }
599
  wc()->query->remove_ordering_args();
600
  }
601
+ do_action('berocket_aapf_filter_end_generation');
602
  }
603
  //DEPRECATED SOON
604
  function update( $new_instance, $old_instance ) {
includes/functions.php CHANGED
@@ -362,6 +362,7 @@ if( ! function_exists( 'br_aapf_parse_order_by' ) ) {
362
  // needed for woocommerce sorting funtionality
363
  if ( ! empty($orderby) and ! empty($order) ) {
364
 
 
365
  // Get ordering from query string unless defined
366
  $orderby = strtolower( $orderby );
367
  $order = strtoupper( $order );
@@ -387,11 +388,11 @@ if( ! function_exists( 'br_aapf_parse_order_by' ) ) {
387
  $args['meta_key'] = 'total_sales';
388
 
389
  // Sorting handled later though a hook
390
- add_filter( 'posts_clauses', array( 'BeRocket_AAPF', 'order_by_popularity_post_clauses' ) );
391
  break;
392
  case 'rating' :
393
  // Sorting handled later though a hook
394
- add_filter( 'posts_clauses', array( 'BeRocket_AAPF', 'order_by_rating_post_clauses' ) );
395
  break;
396
  case 'title' :
397
  $args['orderby'] = 'title';
362
  // needed for woocommerce sorting funtionality
363
  if ( ! empty($orderby) and ! empty($order) ) {
364
 
365
+ $BeRocket_AAPF = BeRocket_AAPF::getInstance();
366
  // Get ordering from query string unless defined
367
  $orderby = strtolower( $orderby );
368
  $order = strtoupper( $order );
388
  $args['meta_key'] = 'total_sales';
389
 
390
  // Sorting handled later though a hook
391
+ add_filter( 'posts_clauses', array( $BeRocket_AAPF, 'order_by_popularity_post_clauses' ) );
392
  break;
393
  case 'rating' :
394
  // Sorting handled later though a hook
395
+ add_filter( 'posts_clauses', array( $BeRocket_AAPF, 'order_by_rating_post_clauses' ) );
396
  break;
397
  case 'title' :
398
  $args['orderby'] = 'title';
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: 4.0
7
  Tested up to: 5.3
8
- Stable tag: 1.4.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -184,6 +184,11 @@ You can try this plugin's admin side [here](https://berocket.com/product/woocomm
184
 
185
  == Changelog ==
186
 
 
 
 
 
 
187
  = 1.4.1 =
188
  * Enhancement - New recount options
189
  * Enhancement - Rename some options to be more correct
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: 4.0
7
  Tested up to: 5.3
8
+ Stable tag: 1.4.1.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
184
 
185
  == Changelog ==
186
 
187
+ = 1.4.1.1 =
188
+ * Fix - Price replacements do not work
189
+ * Fix - Divi theme compatibility replace with another module
190
+ * Fix - PHP notices for some sorting
191
+
192
  = 1.4.1 =
193
  * Enhancement - New recount options
194
  * Enhancement - Rename some options to be more correct
woocommerce-filters.php CHANGED
@@ -3,7 +3,7 @@
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.4.1
7
  * Author: BeRocket
8
  * Requires at least: 4.0
9
  * Author URI: https://berocket.com?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters
@@ -11,6 +11,6 @@
11
  * Domain Path: /languages/
12
  * WC tested up to: 3.8.1
13
  */
14
- define( "BeRocket_AJAX_filters_version", '1.4.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.4.1.1
7
  * Author: BeRocket
8
  * Requires at least: 4.0
9
  * Author URI: https://berocket.com?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters
11
  * Domain Path: /languages/
12
  * WC tested up to: 3.8.1
13
  */
14
+ define( "BeRocket_AJAX_filters_version", '1.4.1.1' );
15
  define( "BeRocket_AJAX_filters_file", __FILE__ );
16
  include_once('main.php');