Advanced AJAX Product Filters - Version 1.4.1.2

Version Description

Download this release

Release Info

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

Code changes from version 1.4.1.1 to 1.4.1.2

addons/additional_tables/add_table.php CHANGED
@@ -218,10 +218,11 @@ class BeRocket_aapf_variations_tables {
218
  $newmd5 = apply_filters('BRaapf_cache_check_md5', $newmd5, 'br_generate_child_relation', $taxonomy);
219
  $md5 = get_option(apply_filters('br_aapf_md5_cache_text', 'br_custom_table_hierarhical_'.$taxonomy));
220
  if($md5 != $newmd5) {
221
- $categories_ids = get_terms(array('taxonomy' => $taxonomy, 'hide_empty' => false));
222
  if( empty($categories_ids) || is_wp_error($categories_ids) ) {
223
  return;
224
  }
 
225
  $new_categories = array();
226
  foreach($categories_ids as $categories_id) {
227
  $new_categories[$categories_id->term_id] = $categories_id;
@@ -229,7 +230,6 @@ class BeRocket_aapf_variations_tables {
229
  unset($categories_ids);
230
  $table_name = $wpdb->prefix . 'braapf_term_taxonomy_hierarchical';
231
  $wpdb->query("DELETE FROM $table_name WHERE taxonomy = '$taxonomy';");
232
- $hierarchy = br_get_taxonomy_hierarchy(array('taxonomy' => $taxonomy, 'return' => 'child'));
233
  $join_query = "INSERT IGNORE INTO $table_name VALUES ";
234
  $join_list = array();
235
  $drop_query = array();
@@ -238,10 +238,10 @@ class BeRocket_aapf_variations_tables {
238
  foreach($term_childs as $term_child) {
239
  if( ! empty($new_categories[$term_id]) && ! empty($new_categories[$term_child]) ) {
240
  $drop_query[] = sprintf("(%d,%d,%d,%d,'%s')",
241
- $new_categories[$term_id]->term_taxonomy_id,
242
- $new_categories[$term_id]->term_id,
243
  $new_categories[$term_child]->term_taxonomy_id,
244
  $new_categories[$term_child]->term_id,
 
 
245
  $new_categories[$term_id]->taxonomy);
246
  $count++;
247
  if( $count > 100 ) {
@@ -263,5 +263,57 @@ class BeRocket_aapf_variations_tables {
263
  update_option(apply_filters('br_aapf_md5_cache_text', 'br_custom_table_hierarhical_'.$taxonomy), $newmd5);
264
  }
265
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
266
  }
267
  new BeRocket_aapf_variations_tables();
218
  $newmd5 = apply_filters('BRaapf_cache_check_md5', $newmd5, 'br_generate_child_relation', $taxonomy);
219
  $md5 = get_option(apply_filters('br_aapf_md5_cache_text', 'br_custom_table_hierarhical_'.$taxonomy));
220
  if($md5 != $newmd5) {
221
+ $categories_ids = $this->get_terms_all(array('taxonomy' => $taxonomy, 'hide_empty' => false, 'suppress_filter' => true));
222
  if( empty($categories_ids) || is_wp_error($categories_ids) ) {
223
  return;
224
  }
225
+ $hierarchy = $this->taxonomy_hierarchical_get($taxonomy);
226
  $new_categories = array();
227
  foreach($categories_ids as $categories_id) {
228
  $new_categories[$categories_id->term_id] = $categories_id;
230
  unset($categories_ids);
231
  $table_name = $wpdb->prefix . 'braapf_term_taxonomy_hierarchical';
232
  $wpdb->query("DELETE FROM $table_name WHERE taxonomy = '$taxonomy';");
 
233
  $join_query = "INSERT IGNORE INTO $table_name VALUES ";
234
  $join_list = array();
235
  $drop_query = array();
238
  foreach($term_childs as $term_child) {
239
  if( ! empty($new_categories[$term_id]) && ! empty($new_categories[$term_child]) ) {
240
  $drop_query[] = sprintf("(%d,%d,%d,%d,'%s')",
 
 
241
  $new_categories[$term_child]->term_taxonomy_id,
242
  $new_categories[$term_child]->term_id,
243
+ $new_categories[$term_id]->term_taxonomy_id,
244
+ $new_categories[$term_id]->term_id,
245
  $new_categories[$term_id]->taxonomy);
246
  $count++;
247
  if( $count > 100 ) {
263
  update_option(apply_filters('br_aapf_md5_cache_text', 'br_custom_table_hierarhical_'.$taxonomy), $newmd5);
264
  }
265
  }
266
+ function taxonomy_hierarchical_get($taxonomy) {
267
+ $terms = $this->get_terms_all(array(
268
+ 'hide_empty' => false,
269
+ 'taxonomy' => $taxonomy,
270
+ 'suppress_filter' => true
271
+ ));
272
+ $term_id_terms = array();
273
+ foreach($terms as $term) {
274
+ $term_id_terms[$term->term_id] = $term;
275
+ }
276
+ unset($terms);
277
+ foreach($term_id_terms as $term_id => $term) {
278
+ $term_id_terms = $this->find_all_parent($term_id_terms, $term_id);
279
+ }
280
+ foreach($term_id_terms as $term_id => $term) {
281
+ $term_id_terms[$term_id] = $term->all_parents;
282
+ }
283
+ return $term_id_terms;
284
+ }
285
+ function find_all_parent($terms, $i) {
286
+ if( ! empty($terms[$i]->all_parents) ) {
287
+ return $terms;
288
+ }
289
+ $ids = array();
290
+ $ids[] = $terms[$i]->term_id;
291
+ if( $terms[$i]->parent != 0 && isset($terms[$terms[$i]->parent]) ) {
292
+ if( empty($terms[$terms[$i]->parent]->all_parents) ) {
293
+ $terms = $this->find_all_parent($terms, $terms[$i]->parent);
294
+ }
295
+ $ids = array_merge($ids, $terms[$terms[$i]->parent]->all_parents);
296
+ }
297
+ $terms[$i]->all_parents = $ids;
298
+ return $terms;
299
+ }
300
+ function get_terms_all($args) {
301
+ $languages = apply_filters('wpml_active_languages', array());
302
+ $wpml_active_languages = apply_filters('wpml_current_language', NULL);
303
+ if( is_array($languages) && count($languages) && $wpml_active_languages != NULL ) {
304
+ $terms = array();
305
+ foreach($languages as $language_code => $language) {
306
+ do_action( 'wpml_switch_language', $language_code );
307
+ $single_lang_terms = get_terms($args);
308
+ if( is_array($single_lang_terms) ) {
309
+ $terms = array_merge($terms, $single_lang_terms);
310
+ }
311
+ }
312
+ do_action( 'wpml_switch_language', $wpml_active_languages );
313
+ } else {
314
+ $terms = get_terms($args);
315
+ }
316
+ return $terms;
317
+ }
318
  }
319
  new BeRocket_aapf_variations_tables();
js/widget.min.js CHANGED
@@ -2332,17 +2332,29 @@ load_hash_test();
2332
  e.preventDefault();
2333
  $(this).toggleClass( "active" ).next().slideToggle(200, 'linear');
2334
  });
 
 
 
 
 
 
 
 
 
 
 
 
2335
  $(document).on('click', '.berocket_ajax_filters_sidebar_toggle', function (e){
2336
  e.preventDefault();
2337
- $(this).toggleClass( "active" );
2338
- $('#berocket-ajax-filters-sidebar').toggleClass('active');
2339
- $('body').toggleClass('berocket_ajax_filters_sidebar_active');
 
 
2340
  });
2341
  $(document).on('click', '#berocket-ajax-filters-sidebar-shadow, #berocket-ajax-filters-sidebar-close', function (e) {
2342
  e.preventDefault();
2343
- $('.berocket_ajax_filters_sidebar_toggle').removeClass( "active" );
2344
- $('#berocket-ajax-filters-sidebar').removeClass('active');
2345
- $('body').removeClass('berocket_ajax_filters_sidebar_active');
2346
  });
2347
  $(document).on('berocket_filters_first_load', function (){
2348
  berocket_rewidth_inline_filters(function (){
2332
  e.preventDefault();
2333
  $(this).toggleClass( "active" ).next().slideToggle(200, 'linear');
2334
  });
2335
+ function berocket_custom_sidebar_close() {
2336
+ $('.berocket_ajax_filters_sidebar_toggle').removeClass( "active" );
2337
+ $('#berocket-ajax-filters-sidebar').removeClass('active');
2338
+ $('body').removeClass('berocket_ajax_filters_sidebar_active');
2339
+ }
2340
+ function berocket_custom_sidebar_open() {
2341
+ $('.berocket_ajax_filters_sidebar_toggle').addClass( "active" );
2342
+ $('#berocket-ajax-filters-sidebar').addClass('active');
2343
+ $('body').addClass('berocket_ajax_filters_sidebar_active');
2344
+ }
2345
+ $(document).on('berocket_custom_sidebar_close', berocket_custom_sidebar_close);
2346
+ $(document).on('berocket_custom_sidebar_open', berocket_custom_sidebar_open);
2347
  $(document).on('click', '.berocket_ajax_filters_sidebar_toggle', function (e){
2348
  e.preventDefault();
2349
+ if( $(this).is('.active') && $('#berocket-ajax-filters-sidebar').is('.active') ) {
2350
+ berocket_custom_sidebar_close();
2351
+ } else {
2352
+ berocket_custom_sidebar_open();
2353
+ }
2354
  });
2355
  $(document).on('click', '#berocket-ajax-filters-sidebar-shadow, #berocket-ajax-filters-sidebar-close', function (e) {
2356
  e.preventDefault();
2357
+ berocket_custom_sidebar_close();
 
 
2358
  });
2359
  $(document).on('berocket_filters_first_load', function (){
2360
  berocket_rewidth_inline_filters(function (){
readme.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: dholovnia, berocket
4
  Donate link: https://berocket.com/product/woocommerce-ajax-products-filter?utm_source=wordpress_org&utm_medium=donate&utm_campaign=ajax_filters
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,6 +184,10 @@ You can try this plugin's admin side [here](https://berocket.com/product/woocomm
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
4
  Donate link: https://berocket.com/product/woocommerce-ajax-products-filter?utm_source=wordpress_org&utm_medium=donate&utm_campaign=ajax_filters
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.1
8
+ Stable tag: 1.4.1.2
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 - Categories work incorrect with WPML and Additional table addon
189
+ * Fix - Nice URL do not work with WPML
190
+
191
  = 1.4.1.1 =
192
  * Fix - Price replacements do not work
193
  * Fix - Divi theme compatibility replace with another module
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.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.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.2
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.2' );
15
  define( "BeRocket_AJAX_filters_file", __FILE__ );
16
  include_once('main.php');