Advanced AJAX Product Filters - Version 1.4.0.1

Version Description

  • Fix - Compatibility with other BeRocket plugins on activation
Download this release

Release Info

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

Code changes from version 1.4 to 1.4.0.1

addons/additional_tables/additional_tables.php CHANGED
@@ -6,25 +6,25 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
6
  public $last_postion = 9;
7
  public $position_data = array(
8
  1 => array(
9
- 'percentage' => 0
10
  ),
11
  2 => array(
12
- 'percentage' => 7
13
  ),
14
  3 => array(
15
- 'percentage' => 0
16
  ),
17
  4 => array(
18
- 'percentage' => 90
19
  ),
20
  5 => array(
21
- 'percentage' => 0
22
  ),
23
  6 => array(
24
  'percentage' => 2
25
  ),
26
  7 => array(
27
- 'percentage' => 0
28
  ),
29
  8 => array(
30
  'percentage' => 1
@@ -86,16 +86,18 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
86
  } elseif( $current_position == 7 ) {
87
  $this->create_table_braapf_term_taxonomy_hierarchical();
88
  } elseif( $current_position == 8 ) {
89
- new berocket_information_notices(array(
90
- 'name' => $this->plugin_name.'_additional_table_status_end',
91
- 'html' => '<strong>BeRocket AJAX Product Filters</strong> '.__('Additional tables was succesfully generated. They will be used automatically when needed.', 'BeRocket_AJAX_domain'),
92
- 'righthtml' => '<a class="berocket_no_thanks">Got it</a>',
93
- 'rightwidth' => 50,
94
- 'nothankswidth' => 50,
95
- 'contentwidth' => 400,
96
- 'subscribe' => false,
97
- 'height' => 50,
98
- ));
 
 
99
  $this->set_current_create_position(9);
100
  }
101
  }
@@ -115,7 +117,7 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
115
  'start' => 0,
116
  'end' => 0,
117
  'name' => $this->plugin_name.'_additional_table_status',
118
- 'html' => '<strong>BeRocket AJAX Product Filters</strong> '.sprintf(__('Additional tables are generating. They will be used after generation is completed. Current status is <strong><span class="braapf_additional_table_status">%d</span>%%</strong>', 'BeRocket_AJAX_domain'), $current_status),
119
  'righthtml' => '',
120
  'rightwidth' => 0,
121
  'nothankswidth' => 0,
@@ -201,7 +203,7 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
201
  }
202
  }
203
  function insert_table_braapf_product_stock_status_parent($start_id, $min_id, $max_id) {
204
- $end_id = $start_id + 50000;
205
  global $wpdb;
206
  $table_name = $wpdb->prefix . 'braapf_product_stock_status_parent';
207
  $charset_collate = $wpdb->get_charset_collate();
@@ -250,7 +252,7 @@ class BeRocket_aapf_variations_tables_addon extends BeRocket_framework_addon_lib
250
  }
251
  }
252
  function insert_table_braapf_product_variation_attributes($start_id, $min_id, $max_id) {
253
- $end_id = $start_id + 50000;
254
  global $wpdb;
255
  $table_name = $wpdb->prefix . 'braapf_product_variation_attributes';
256
  $charset_collate = $wpdb->get_charset_collate();
6
  public $last_postion = 9;
7
  public $position_data = array(
8
  1 => array(
9
+ 'percentage' => 1
10
  ),
11
  2 => array(
12
+ 'percentage' => 13
13
  ),
14
  3 => array(
15
+ 'percentage' => 1
16
  ),
17
  4 => array(
18
+ 'percentage' => 80
19
  ),
20
  5 => array(
21
+ 'percentage' => 1
22
  ),
23
  6 => array(
24
  'percentage' => 2
25
  ),
26
  7 => array(
27
+ 'percentage' => 1
28
  ),
29
  8 => array(
30
  'percentage' => 1
86
  } elseif( $current_position == 7 ) {
87
  $this->create_table_braapf_term_taxonomy_hierarchical();
88
  } elseif( $current_position == 8 ) {
89
+ if( class_exists('berocket_information_notices') ) {
90
+ new berocket_information_notices(array(
91
+ 'name' => $this->plugin_name.'_additional_table_status_end',
92
+ 'html' => '<strong>BeRocket AJAX Product Filters</strong> '.__('Additional tables was succesfully generated. They will be used automatically when needed.', 'BeRocket_AJAX_domain'),
93
+ 'righthtml' => '<a class="berocket_no_thanks">Got it</a>',
94
+ 'rightwidth' => 50,
95
+ 'nothankswidth' => 50,
96
+ 'contentwidth' => 400,
97
+ 'subscribe' => false,
98
+ 'height' => 50,
99
+ ));
100
+ }
101
  $this->set_current_create_position(9);
102
  }
103
  }
117
  'start' => 0,
118
  'end' => 0,
119
  'name' => $this->plugin_name.'_additional_table_status',
120
+ 'html' => '<strong>BeRocket AJAX Product Filters</strong> '.sprintf(__('Additional tables are generating. They will be used after generation is completed. Current status is <strong><span class="braapf_additional_table_status">%d</span>%s</strong>', 'BeRocket_AJAX_domain'), $current_status, '%'),
121
  'righthtml' => '',
122
  'rightwidth' => 0,
123
  'nothankswidth' => 0,
203
  }
204
  }
205
  function insert_table_braapf_product_stock_status_parent($start_id, $min_id, $max_id) {
206
+ $end_id = $start_id + 5000;
207
  global $wpdb;
208
  $table_name = $wpdb->prefix . 'braapf_product_stock_status_parent';
209
  $charset_collate = $wpdb->get_charset_collate();
252
  }
253
  }
254
  function insert_table_braapf_product_variation_attributes($start_id, $min_id, $max_id) {
255
+ $end_id = $start_id + 10000;
256
  global $wpdb;
257
  $table_name = $wpdb->prefix . 'braapf_product_variation_attributes';
258
  $charset_collate = $wpdb->get_charset_collate();
includes/addons/woocommerce-variation.php CHANGED
@@ -129,7 +129,11 @@ class BeRocket_AAPF_compat_woocommerce_variation {
129
  $query = apply_filters('berocket_aapf_wcvariation_filtering_total_query', $query, $input, $terms, $limits, $current_attributes, $current_terms);
130
  $query = self::implode_recursive($query);
131
  $query = sprintf( $query, $wpdb->posts, $wpdb->postmeta, $wpdb->term_relationships, $current_attributes, $current_terms );
132
- $out_of_stock_variable = $wpdb->get_results( $query, ARRAY_N );
 
 
 
 
133
  if( BeRocket_AAPF::$debug_mode ) {
134
  if( ! isset(BeRocket_AAPF::$error_log['_addons_variations_query']) || ! is_array(BeRocket_AAPF::$error_log['_addons_variations_query']) ) {
135
  BeRocket_AAPF::$error_log['_addons_variations_query'] = array();
129
  $query = apply_filters('berocket_aapf_wcvariation_filtering_total_query', $query, $input, $terms, $limits, $current_attributes, $current_terms);
130
  $query = self::implode_recursive($query);
131
  $query = sprintf( $query, $wpdb->posts, $wpdb->postmeta, $wpdb->term_relationships, $current_attributes, $current_terms );
132
+ $out_of_stock_variable = br_get_cache(apply_filters('berocket_variation_cache_key', md5($query)), 'berocket_variation');
133
+ if( empty($out_of_stock_variable) ) {
134
+ $out_of_stock_variable = $wpdb->get_results( $query, ARRAY_N );
135
+ br_set_cache(apply_filters('berocket_variation_cache_key', md5($query)), $out_of_stock_variable, 'berocket_variation', MINUTE_IN_SECONDS);
136
+ }
137
  if( BeRocket_AAPF::$debug_mode ) {
138
  if( ! isset(BeRocket_AAPF::$error_log['_addons_variations_query']) || ! is_array(BeRocket_AAPF::$error_log['_addons_variations_query']) ) {
139
  BeRocket_AAPF::$error_log['_addons_variations_query'] = array();
includes/compatibility/bodycommerce.php CHANGED
@@ -100,16 +100,18 @@ if ( ! function_exists('berocket_aapf_bodycommerce_archive_module_args') ) {
100
  if( isset($_POST['price']) && is_array($_POST['price']) ) {
101
  $_POST['price'] = apply_filters('berocket_min_max_filter', $_POST['price']);
102
  }
103
- $min = isset( $_POST['price'][0] ) ? floatval( $_POST['price'][0] ) : 0;
104
- $max = isset( $_POST['price'][1] ) ? floatval( $_POST['price'][1] ) : 9999999999;
 
105
 
106
- $args['meta_query'][] = array(
107
- 'key' => apply_filters('berocket_price_filter_meta_key', '_price', 'widget_2847'),
108
- 'value' => array( $min, $max ),
109
- 'compare' => 'BETWEEN',
110
- 'type' => 'DECIMAL',
111
- 'price_filter' => true,
112
- );
 
113
  /*$args['post_status'] = 'publish';
114
  if ( is_user_logged_in() ) {
115
  $args['post_status'] .= '|private';
100
  if( isset($_POST['price']) && is_array($_POST['price']) ) {
101
  $_POST['price'] = apply_filters('berocket_min_max_filter', $_POST['price']);
102
  }
103
+ if ( ! empty( $_POST['price'] ) ) {
104
+ $min = isset( $_POST['price'][0] ) ? floatval( $_POST['price'][0] ) : 0;
105
+ $max = isset( $_POST['price'][1] ) ? floatval( $_POST['price'][1] ) : 9999999999;
106
 
107
+ $args['meta_query'][] = array(
108
+ 'key' => apply_filters('berocket_price_filter_meta_key', '_price', 'widget_2847'),
109
+ 'value' => array( $min, $max ),
110
+ 'compare' => 'BETWEEN',
111
+ 'type' => 'DECIMAL',
112
+ 'price_filter' => true,
113
+ );
114
+ }
115
  /*$args['post_status'] = 'publish';
116
  if ( is_user_logged_in() ) {
117
  $args['post_status'] .= '|private';
includes/widget.php CHANGED
@@ -1429,7 +1429,11 @@ class BeRocket_AAPF_Widget extends WP_Widget {
1429
  if ( ! empty($sort_data['order_values_by']) and $sort_data['order_values_by'] == 'Alpha' ) {
1430
  $orderby = 'name';
1431
  } else {
1432
- $orderby = wc_attribute_orderby( $terms[0]->taxonomy );
 
 
 
 
1433
  }
1434
 
1435
  switch ( $orderby ) {
1429
  if ( ! empty($sort_data['order_values_by']) and $sort_data['order_values_by'] == 'Alpha' ) {
1430
  $orderby = 'name';
1431
  } else {
1432
+ $orderby = 'name';
1433
+ foreach($terms as $term_sort) {
1434
+ $orderby = wc_attribute_orderby( $term_sort->taxonomy );
1435
+ break;
1436
+ }
1437
  }
1438
 
1439
  switch ( $orderby ) {
main.php CHANGED
@@ -169,6 +169,15 @@ class BeRocket_AAPF extends BeRocket_Framework {
169
  'premium_slug' => 'woocommerce-ajax-products-filter',
170
  'free_slug' => 'woocommerce-ajax-filters',
171
  );
 
 
 
 
 
 
 
 
 
172
  $this->feature_list = array();
173
  $this->framework_data['fontawesome_frontend'] = true;
174
  $this->active_libraries = array('addons', 'feature');
@@ -2663,9 +2672,7 @@ jQuery(document).on('change', '.br_selected_area_show', br_selected_area_show);
2663
  }
2664
  public function save_settings_callback( $settings ) {
2665
  $options = $this->get_option();
2666
- if ( $options['nice_urls'] != $settings['nice_urls'] ) {
2667
- delete_option( 'rewrite_rules' );
2668
- }
2669
 
2670
  return parent::save_settings_callback( $settings );
2671
  }
169
  'premium_slug' => 'woocommerce-ajax-products-filter',
170
  'free_slug' => 'woocommerce-ajax-filters',
171
  );
172
+ if( version_compare(self::$framework_version, '2.5.5.2', '<') ) {
173
+ unset($this->defaults['addons']);
174
+ $option_fix = get_option($this->values['settings_name']);
175
+ if( is_array($option_fix) && isset($option_fix['addons']) && is_array($option_fix['addons']) && (! count($option_fix['addons']) || empty($option_fix['addons'][0])) ) {
176
+ $option_fix['addons'] = '';
177
+ }
178
+ update_option($this->values['settings_name'], $option_fix);
179
+ unset($option_fix);
180
+ }
181
  $this->feature_list = array();
182
  $this->framework_data['fontawesome_frontend'] = true;
183
  $this->active_libraries = array('addons', 'feature');
2672
  }
2673
  public function save_settings_callback( $settings ) {
2674
  $options = $this->get_option();
2675
+ delete_option( 'rewrite_rules' );
 
 
2676
 
2677
  return parent::save_settings_callback( $settings );
2678
  }
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.2.3
8
- Stable tag: 1.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -184,6 +184,9 @@ You can try this plugin's admin side [here](https://berocket.com/product/woocomm
184
 
185
  == Changelog ==
186
 
 
 
 
187
  = 1.4 =
188
  * Enhancement - Additional table for taxonomies (Product categories work faster with it)
189
  * Enhancement - Additional table for variable products
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.2.3
8
+ Stable tag: 1.4.0.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.0.1 =
188
+ * Fix - Compatibility with other BeRocket plugins on activation
189
+
190
  = 1.4 =
191
  * Enhancement - Additional table for taxonomies (Product categories work faster with it)
192
  * Enhancement - Additional table for variable products
uninstall.php CHANGED
@@ -28,19 +28,23 @@ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
28
  exit;
29
  }
30
  global $wpdb;
31
- //Delete Variations table
32
- $table_name = $wpdb->prefix . 'braapf_product_stock_status_parent';
33
- $sql = "DROP TABLE IF EXISTS {$table_name};";
34
- $wpdb->query($sql);
35
- $table_name = $wpdb->prefix . 'braapf_product_variation_attributes';
36
- $sql = "DROP TABLE IF EXISTS {$table_name};";
37
- $wpdb->query($sql);
38
- delete_option('BeRocket_aapf_variations_tables_addon_ready');
39
- //Delete Hierarchical table
40
- $table_name = $wpdb->prefix . 'braapf_term_taxonomy_hierarchical';
41
- $sql = "DROP TABLE IF EXISTS {$table_name};";
42
- $wpdb->query($sql);
43
- delete_option('BeRocket_aapf_hierarchical_tables_addon_ready');
 
 
 
 
44
  if ( defined( 'BR_AAPF_REMOVE_ALL_DATA' ) && true === BR_AAPF_REMOVE_ALL_DATA ) {
45
 
46
  }
28
  exit;
29
  }
30
  global $wpdb;
31
+ //Delete Additional table
32
+ wp_unschedule_hook('berocket_create_table_braapf_product_stock_status_parent');
33
+ wp_unschedule_hook('berocket_create_table_braapf_product_variation_attributes');
34
+ wp_unschedule_hook('berocket_create_table_braapf_variation_attributes');
35
+ $tables_drop = array(
36
+ 'braapf_product_stock_status_parent',
37
+ 'braapf_product_variation_attributes',
38
+ 'braapf_variation_attributes',
39
+ 'braapf_term_taxonomy_hierarchical'
40
+ );
41
+ foreach($tables_drop as $table_drop) {
42
+ $table_name = $wpdb->prefix . $table_drop;
43
+ $sql = "DROP TABLE IF EXISTS {$table_name};";
44
+ $wpdb->query($sql);
45
+ }
46
+ $wpdb->query("DELETE FROM {$wpdb->prefix}options WHERE option_name LIKE '%br_custom_table_hierarhical_%';");
47
+ delete_option('BeRocket_aapf_additional_tables_addon_position');
48
  if ( defined( 'BR_AAPF_REMOVE_ALL_DATA' ) && true === BR_AAPF_REMOVE_ALL_DATA ) {
49
 
50
  }
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
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.7.0
13
  */
14
- define( "BeRocket_AJAX_filters_version", '1.4' );
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.0.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.7.0
13
  */
14
+ define( "BeRocket_AJAX_filters_version", '1.4.0.1' );
15
  define( "BeRocket_AJAX_filters_file", __FILE__ );
16
  include_once('main.php');