Advanced AJAX Product Filters - Version 1.3.2.8

Version Description

  • Enhancement - Price slider speed woocommerce 3.6
  • Enhancement - WooCommerce shortcode add no products message
  • Fix - PHP notices
  • Fix - Remove some files
Download this release

Release Info

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

Code changes from version 1.3.2.7 to 1.3.2.8

berocket/framework.php CHANGED
@@ -846,8 +846,8 @@ if( ! class_exists( 'BeRocket_Framework' ) ) {
846
  echo '</form>';
847
  }
848
  if( ! $setup_style['hide_additional_blocks'] ) {
849
- if ( @ file_exists( plugin_dir_path( __FILE__ ) . '../templates/premium.php' ) ) {
850
- require_once( plugin_dir_path( __FILE__ ) . '../templates/premium.php' );
851
  } else {
852
  require_once( plugin_dir_path( __FILE__ ) . 'templates/premium.php');
853
  }
846
  echo '</form>';
847
  }
848
  if( ! $setup_style['hide_additional_blocks'] ) {
849
+ if ( file_exists( $this->info['plugin_dir'] . '/templates/premium.php' ) ) {
850
+ require_once( $this->info['plugin_dir'] . '/templates/premium.php' );
851
  } else {
852
  require_once( plugin_dir_path( __FILE__ ) . 'templates/premium.php');
853
  }
includes/functions.php CHANGED
@@ -2168,12 +2168,12 @@ if ( ! function_exists( 'br_filters_query' ) ) {
2168
  if( ! isset($query[ 'join' ]) ) {
2169
  $query[ 'join' ] = '';
2170
  }
2171
- $query[ 'join' ]
2172
- .= "
2173
  INNER JOIN {$wpdb->term_relationships} AS term_relationships ON {$wpdb->posts}.ID = term_relationships.object_id
2174
  INNER JOIN {$wpdb->term_taxonomy} AS term_taxonomy USING( term_taxonomy_id )
2175
  INNER JOIN {$wpdb->terms} AS terms USING( term_id )
2176
- " . $tax_query_sql[ 'join' ] . $meta_query_sql[ 'join' ];
 
2177
  if( ! isset($query[ 'where' ]) ) {
2178
  $query[ 'where' ] = '';
2179
  }
@@ -2191,10 +2191,10 @@ if ( ! function_exists( 'br_filters_query' ) ) {
2191
  if ( ! empty( $post__in ) ) {
2192
  $query[ 'where' ] .= " AND {$wpdb->posts}.ID IN (\"" . implode( '","', $post__in ) . "\")";
2193
  }
2194
- if( function_exists('wc_get_product_visibility_term_ids') ) {
2195
  $product_visibility_term_ids = wc_get_product_visibility_term_ids();
2196
- $query[ 'where' ] .= " AND {$wpdb->posts}.ID NOT IN (\"SELECT object_id FROM {$wpdb->term_relationships} WHERE term_taxonomy_id='" . $product_visibility_term_ids[ 'exclude-from-catalog' ] . "'\")";
2197
- }
2198
 
2199
  $query[ 'where' ] .= $old_join_posts;
2200
  //$query['group_by'] = "GROUP BY {$wpdb->posts}.ID";
2168
  if( ! isset($query[ 'join' ]) ) {
2169
  $query[ 'join' ] = '';
2170
  }
2171
+ /*$query[ 'join' ] .= "
 
2172
  INNER JOIN {$wpdb->term_relationships} AS term_relationships ON {$wpdb->posts}.ID = term_relationships.object_id
2173
  INNER JOIN {$wpdb->term_taxonomy} AS term_taxonomy USING( term_taxonomy_id )
2174
  INNER JOIN {$wpdb->terms} AS terms USING( term_id )
2175
+ ";*/
2176
+ $query[ 'join' ] .= $tax_query_sql[ 'join' ] . $meta_query_sql[ 'join' ];
2177
  if( ! isset($query[ 'where' ]) ) {
2178
  $query[ 'where' ] = '';
2179
  }
2191
  if ( ! empty( $post__in ) ) {
2192
  $query[ 'where' ] .= " AND {$wpdb->posts}.ID IN (\"" . implode( '","', $post__in ) . "\")";
2193
  }
2194
+ /*if( function_exists('wc_get_product_visibility_term_ids') ) {
2195
  $product_visibility_term_ids = wc_get_product_visibility_term_ids();
2196
+ $query[ 'where' ] .= " AND ( {$wpdb->posts}.ID NOT IN (SELECT object_id FROM {$wpdb->term_relationships} WHERE term_taxonomy_id='" . $product_visibility_term_ids[ 'exclude-from-catalog' ] . "') ) ";
2197
+ }*/
2198
 
2199
  $query[ 'where' ] .= $old_join_posts;
2200
  //$query['group_by'] = "GROUP BY {$wpdb->posts}.ID";
includes/new_widget.php CHANGED
@@ -31,20 +31,20 @@ class BeRocket_new_AAPF_Widget extends WP_Widget
31
  $custom_vars = apply_filters('berocket_aapf_group_before_all', $custom_vars, $filters);
32
  $new_args = apply_filters('berocket_aapf_group_new_args', $new_args, $filters, $custom_vars);
33
  foreach($filters['filters'] as $filter) {
34
- $new_args = apply_filters('berocket_aapf_group_new_args_filter', $new_args, $filters, $filter, $custom_vars);
35
  if( $is_shortcode ) {
36
- if( isset($new_args['before_widget']) ) {
37
- unset($new_args['before_widget']);
38
  }
39
- if( isset($new_args['after_widget']) ) {
40
- unset($new_args['after_widget']);
41
  }
42
  } else {
43
- $new_args['widget_id'] = $args['widget_id'].'-'.$i;
44
- $new_args['before_widget'] = sprintf($before_widget, $new_args['widget_id'], '%s');
45
  }
46
  $custom_vars = apply_filters('berocket_aapf_group_before_filter', $custom_vars, $filters);
47
- the_widget( 'BeRocket_new_AAPF_Widget_single', array('filter_id' => $filter), $new_args);
48
  $custom_vars = apply_filters('berocket_aapf_group_after_filter', $custom_vars, $filters);
49
  $i++;
50
  }
31
  $custom_vars = apply_filters('berocket_aapf_group_before_all', $custom_vars, $filters);
32
  $new_args = apply_filters('berocket_aapf_group_new_args', $new_args, $filters, $custom_vars);
33
  foreach($filters['filters'] as $filter) {
34
+ $new_args_filter = apply_filters('berocket_aapf_group_new_args_filter', $new_args, $filters, $filter, $custom_vars);
35
  if( $is_shortcode ) {
36
+ if( isset($new_args_filter['before_widget']) ) {
37
+ unset($new_args_filter['before_widget']);
38
  }
39
+ if( isset($new_args_filter['after_widget']) ) {
40
+ unset($new_args_filter['after_widget']);
41
  }
42
  } else {
43
+ $new_args_filter['widget_id'] = $args['widget_id'].'-'.$i;
44
+ $new_args_filter['before_widget'] = sprintf($before_widget, $new_args_filter['widget_id'], '%s');
45
  }
46
  $custom_vars = apply_filters('berocket_aapf_group_before_filter', $custom_vars, $filters);
47
+ the_widget( 'BeRocket_new_AAPF_Widget_single', array('filter_id' => $filter), $new_args_filter);
48
  $custom_vars = apply_filters('berocket_aapf_group_after_filter', $custom_vars, $filters);
49
  $i++;
50
  }
includes/widget.php CHANGED
@@ -572,6 +572,8 @@ class BeRocket_AAPF_Widget extends WP_Widget {
572
  if ( $attribute == 'price' ) {
573
  if ( ! empty($price_values) ) {
574
  $price_range = explode( ",", $price_values );
 
 
575
  } else {
576
  $price_range = br_get_cache( 'price_range', $wp_check_product_cat );
577
  if ( $price_range === false ) {
@@ -1240,25 +1242,35 @@ class BeRocket_AAPF_Widget extends WP_Widget {
1240
  public static function get_price_range( $wp_query_product_cat, $product_cat = null ) {
1241
  global $wpdb;
1242
 
1243
- $query[ 'select' ] = "SELECT MIN(cast(FLOOR(wp_price_check.meta_value) as decimal)) as min_price,
1244
- MAX(cast(CEIL(wp_price_check.meta_value) as decimal)) as max_price ";
1245
- $query[ 'from' ] = "FROM {$wpdb->postmeta} as wp_price_check";
1246
- $query[ 'join' ] = "INNER JOIN {$wpdb->posts} ON ({$wpdb->posts}.ID = wp_price_check.post_id)";
1247
 
 
 
 
 
 
 
 
 
 
 
 
1248
  if ( ! empty( $br_options[ 'show_all_values' ] ) ) {
1249
  $query[ 'where' ] = " WHERE {$wpdb->posts}.post_type = 'product' AND " . br_select_post_status();
1250
  } else {
1251
  $query = br_filters_query( $query, 'price', $product_cat );
1252
  }
1253
 
1254
- if ( $query[ 'where' ] ) {
1255
- $query[ 'where' ] .= "AND ";
1256
- } else {
1257
- $query[ 'where' ] = " WHERE ";
 
 
 
1258
  }
1259
 
1260
- $query[ 'where' ] .= "wp_price_check.meta_key = '".apply_filters('berocket_price_filter_meta_key', '_price', 'widget_1243')."' AND wp_price_check.meta_value > ''";
1261
-
1262
  $query_string = implode( ' ', $query );
1263
 
1264
  $query_string = $wpdb->get_row( $query_string );
@@ -1559,6 +1571,7 @@ if( BeRocket_AAPF::$debug_mode ) {
1559
  $query['where'] .= $old_join_posts;
1560
  }
1561
  $query = apply_filters( 'woocommerce_get_filtered_term_product_counts_query', $query );
 
1562
  $on_sale = array_merge( array( 0 ), wc_get_product_ids_on_sale() );
1563
  $not_on_sale = $on_sale;
1564
  $query_sale = $query;
@@ -1751,6 +1764,7 @@ if( BeRocket_AAPF::$debug_mode ) {
1751
  }
1752
  $query['group_by'] = "GROUP BY terms.term_id";
1753
  $query = apply_filters( 'woocommerce_get_filtered_term_product_counts_query', $query );
 
1754
  $query = implode( ' ', $query );
1755
  if( BeRocket_AAPF::$debug_mode ) {
1756
  $term_recount_log['query_1'] = $query;
@@ -1800,7 +1814,7 @@ if( BeRocket_AAPF::$debug_mode ) {
1800
  }
1801
  }
1802
 
1803
- $cache_result = array('terms' => $terms, 'term_count' => $term_count, 'results_pid' => $results_pid);
1804
  br_set_cache ( $cache_name, $cache_result, 'get_attribute_values_hide_empty', BeRocket_AJAX_cache_expire );
1805
  } else {
1806
  $terms = array();
@@ -1869,7 +1883,7 @@ if( BeRocket_AAPF::$debug_mode ) {
1869
  $terms2 = $input_terms;
1870
  unset( $input_terms );
1871
  }
1872
- if( $input_terms !== FALSE && is_array($input_terms) && is_array($re) ) {
1873
  $re2 = array();
1874
  $is_child = false;
1875
  foreach($re as $re_id => $re_term) {
@@ -2059,7 +2073,7 @@ if( BeRocket_AAPF::$debug_mode ) {
2059
  }
2060
  if( function_exists('wc_get_product_visibility_term_ids') ) {
2061
  $product_visibility_term_ids = wc_get_product_visibility_term_ids();
2062
- $query['where'] .= " AND {$wpdb->posts}.ID NOT IN (\"SELECT object_id FROM {$wpdb->term_relationships} WHERE term_taxonomy_id='" . $product_visibility_term_ids['exclude-from-catalog'] . "'\")";
2063
  }
2064
 
2065
  $query['where'] .= $old_join_posts;
@@ -2109,6 +2123,7 @@ if( BeRocket_AAPF::$debug_mode ) {
2109
  }
2110
  }
2111
  $query = apply_filters( 'woocommerce_get_filtered_term_product_counts_query', $query );
 
2112
 
2113
  $wpdb->query( 'SET SESSION group_concat_max_len = 1000000' );
2114
  if( ! empty($br_options['out_of_stock_variable_reload']) && ! empty($br_options['out_of_stock_variable_single']) ) {
572
  if ( $attribute == 'price' ) {
573
  if ( ! empty($price_values) ) {
574
  $price_range = explode( ",", $price_values );
575
+ } elseif( $use_min_price && $use_max_price ) {
576
+ $price_range = array($min_price, $max_price);
577
  } else {
578
  $price_range = br_get_cache( 'price_range', $wp_check_product_cat );
579
  if ( $price_range === false ) {
1242
  public static function get_price_range( $wp_query_product_cat, $product_cat = null ) {
1243
  global $wpdb;
1244
 
1245
+ $BeRocket_AAPF = BeRocket_AAPF::getInstance();
1246
+ $br_options = $BeRocket_AAPF->get_option();
 
 
1247
 
1248
+ if( br_woocommerce_version_check('3.6') ) {
1249
+ $query[ 'select' ] = "SELECT MIN(cast(FLOOR(wc_product_meta_lookup.min_price) as decimal)) as min_price,
1250
+ MAX(cast(CEIL(wc_product_meta_lookup.max_price) as decimal)) as max_price ";
1251
+ $query[ 'from' ] = "FROM {$wpdb->posts}";
1252
+ $query[ 'join' ] = " INNER JOIN {$wpdb->wc_product_meta_lookup} wc_product_meta_lookup ON $wpdb->posts.ID = wc_product_meta_lookup.product_id ";
1253
+ } else {
1254
+ $query[ 'select' ] = "SELECT MIN(cast(FLOOR(wp_price_check.meta_value) as decimal)) as min_price,
1255
+ MAX(cast(CEIL(wp_price_check.meta_value) as decimal)) as max_price ";
1256
+ $query[ 'from' ] = "FROM {$wpdb->postmeta} as wp_price_check";
1257
+ $query[ 'join' ] = "INNER JOIN {$wpdb->posts} ON ({$wpdb->posts}.ID = wp_price_check.post_id)";
1258
+ }
1259
  if ( ! empty( $br_options[ 'show_all_values' ] ) ) {
1260
  $query[ 'where' ] = " WHERE {$wpdb->posts}.post_type = 'product' AND " . br_select_post_status();
1261
  } else {
1262
  $query = br_filters_query( $query, 'price', $product_cat );
1263
  }
1264
 
1265
+ if( !br_woocommerce_version_check('3.6') ) {
1266
+ if ( $query[ 'where' ] ) {
1267
+ $query[ 'where' ] .= " AND ";
1268
+ } else {
1269
+ $query[ 'where' ] = " WHERE ";
1270
+ }
1271
+ $query[ 'where' ] .= "wp_price_check.meta_key = '".apply_filters('berocket_price_filter_meta_key', '_price', 'widget_1243')."' AND wp_price_check.meta_value > ''";
1272
  }
1273
 
 
 
1274
  $query_string = implode( ' ', $query );
1275
 
1276
  $query_string = $wpdb->get_row( $query_string );
1571
  $query['where'] .= $old_join_posts;
1572
  }
1573
  $query = apply_filters( 'woocommerce_get_filtered_term_product_counts_query', $query );
1574
+ $query = apply_filters( 'berocket_posts_clauses_recount', $query );
1575
  $on_sale = array_merge( array( 0 ), wc_get_product_ids_on_sale() );
1576
  $not_on_sale = $on_sale;
1577
  $query_sale = $query;
1764
  }
1765
  $query['group_by'] = "GROUP BY terms.term_id";
1766
  $query = apply_filters( 'woocommerce_get_filtered_term_product_counts_query', $query );
1767
+ $query = apply_filters( 'berocket_posts_clauses_recount', $query );
1768
  $query = implode( ' ', $query );
1769
  if( BeRocket_AAPF::$debug_mode ) {
1770
  $term_recount_log['query_1'] = $query;
1814
  }
1815
  }
1816
 
1817
+ $cache_result = array('terms' => $terms, 'term_count' => $term_count, 'results_pid' => (isset($results_pid) ? $results_pid : false));
1818
  br_set_cache ( $cache_name, $cache_result, 'get_attribute_values_hide_empty', BeRocket_AJAX_cache_expire );
1819
  } else {
1820
  $terms = array();
1883
  $terms2 = $input_terms;
1884
  unset( $input_terms );
1885
  }
1886
+ if( isset($input_terms) && $input_terms !== FALSE && is_array($input_terms) && is_array($re) ) {
1887
  $re2 = array();
1888
  $is_child = false;
1889
  foreach($re as $re_id => $re_term) {
2073
  }
2074
  if( function_exists('wc_get_product_visibility_term_ids') ) {
2075
  $product_visibility_term_ids = wc_get_product_visibility_term_ids();
2076
+ $query['where'] .= " AND ( {$wpdb->posts}.ID NOT IN (SELECT object_id FROM {$wpdb->term_relationships} WHERE term_taxonomy_id='" . $product_visibility_term_ids['exclude-from-catalog'] . "') ) ";
2077
  }
2078
 
2079
  $query['where'] .= $old_join_posts;
2123
  }
2124
  }
2125
  $query = apply_filters( 'woocommerce_get_filtered_term_product_counts_query', $query );
2126
+ $query = apply_filters( 'berocket_posts_clauses_recount', $query );
2127
 
2128
  $wpdb->query( 'SET SESSION group_concat_max_len = 1000000' );
2129
  if( ! empty($br_options['out_of_stock_variable_reload']) && ! empty($br_options['out_of_stock_variable_single']) ) {
js/themes/the7.js CHANGED
@@ -52,7 +52,7 @@ function fixWooOrdering() {
52
  jQuery(this).customSelect();
53
  });
54
  }
55
- jQuery(document).on('berocket_ajax_products_loaded', function() {
56
  fixWooIsotope();
57
  fixWooOrdering();
58
  });
52
  jQuery(this).customSelect();
53
  });
54
  }
55
+ jQuery(document).on('berocket_ajax_products_loaded berocket_lmp_end', function() {
56
  fixWooIsotope();
57
  fixWooOrdering();
58
  });
js/widget.min.js CHANGED
@@ -746,7 +746,7 @@ var berocket_aapf_widget_product_filters = [],
746
  $(the_ajax_script.products_holder_id).isotope( 'reloadItems' );
747
  $(the_ajax_script.products_holder_id).isotope();
748
  }
749
- $(the_ajax_script.products_holder_id).find('*').filter(function() {return $(this).css('opacity') == '0';}).css('opacity', 1);
750
  } else {
751
  $(the_ajax_script.products_holder_id).replaceWith($products);
752
  }
@@ -764,7 +764,7 @@ var berocket_aapf_widget_product_filters = [],
764
  }
765
  } else {
766
  if ( $(the_ajax_script.products_holder_id).length > 0 ) {
767
- $(the_ajax_script.products_holder_id).html('').removeClass('hide_products');
768
  } else if ( $('div.woocommerce').length > 0 ) {
769
  $('div.woocommerce').html('');
770
  }
746
  $(the_ajax_script.products_holder_id).isotope( 'reloadItems' );
747
  $(the_ajax_script.products_holder_id).isotope();
748
  }
749
+ jQuery(document).trigger('berocket_aapf_time_to_fix_products_style');
750
  } else {
751
  $(the_ajax_script.products_holder_id).replaceWith($products);
752
  }
764
  }
765
  } else {
766
  if ( $(the_ajax_script.products_holder_id).length > 0 ) {
767
+ $(the_ajax_script.products_holder_id).html(the_ajax_script.no_products).removeClass('hide_products');
768
  } else if ( $('div.woocommerce').length > 0 ) {
769
  $('div.woocommerce').html('');
770
  }
main.php CHANGED
@@ -268,6 +268,11 @@ class BeRocket_AAPF extends BeRocket_Framework {
268
  add_filter( 'plugin_action_links_' . $plugin_base_slug, array( $this, 'plugin_action_links' ) );
269
  add_filter( 'berocket_aapf_widget_terms', array($this, 'wpml_attribute_slug_translate'));
270
  add_filter ( 'BeRocket_updater_menu_order_custom_post', array($this, 'menu_order_custom_post') );
 
 
 
 
 
271
  } else {
272
  if( is_plugin_active( 'woocommerce/woocommerce.php' ) || is_plugin_active_for_network( 'woocommerce/woocommerce.php' ) ) {
273
  add_action( 'admin_notices', array( $this, 'update_woocommerce' ) );
@@ -1249,6 +1254,20 @@ jQuery(document).on('change', '.br_selected_area_show', br_selected_area_show);
1249
  add_filter( 'pre_get_posts', array( $this, 'apply_user_price' ) );
1250
  add_filter( 'pre_get_posts', array( $this, 'apply_user_filters' ), 900000 );
1251
  add_filter( 'woocommerce_shortcode_products_query', array( $this, 'woocommerce_shortcode_products_query' ), 10, 3 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1252
  add_filter( 'shortcode_atts_sale_products', array($this, 'shortcode_atts_products'), 10, 3);
1253
  add_filter( 'shortcode_atts_featured_products', array($this, 'shortcode_atts_products'), 10, 3);
1254
  add_filter( 'shortcode_atts_best_selling_products', array($this, 'shortcode_atts_products'), 10, 3);
@@ -1298,6 +1317,7 @@ jQuery(document).on('change', '.br_selected_area_show', br_selected_area_show);
1298
  public function include_all_scripts() {
1299
  /* theme scripts */
1300
  if( defined('THE7_VERSION') && THE7_VERSION ) {
 
1301
  wp_enqueue_script( 'berocket_ajax_fix-the7', plugins_url( 'js/themes/the7.js', __FILE__ ), array( 'jquery' ), BeRocket_AJAX_filters_version );
1302
  }
1303
  global $wp_query, $wp, $sitepress, $wp_rewrite;
@@ -1562,6 +1582,32 @@ jQuery(document).on('change', '.br_selected_area_show', br_selected_area_show);
1562
  }
1563
  return $query_vars;
1564
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1565
  public function woocommerce_filter_query_vars( $query_vars, $atts = array(), $name = 'products' ) {
1566
  $new_query_vars = $query_vars;
1567
  $new_query_vars['nopaging'] = true;
@@ -1623,6 +1669,7 @@ jQuery(document).on('change', '.br_selected_area_show', br_selected_area_show);
1623
  }
1624
  $query_vars['post__not_in'] = array_merge($query_vars['post__not_in'], apply_filters('berocket_add_out_of_stock_variable', array(), $custom_terms, berocket_isset($_POST['limits_arr'])));
1625
  $query_vars['post__in'] = apply_filters( 'loop_shop_post_in', $query_vars['post__in']);
 
1626
  global $br_wc_query;
1627
  $br_wc_query = $query_vars;
1628
  add_action( 'wp_footer', array( $this, 'wp_footer_widget'), 99999 );
@@ -1689,6 +1736,8 @@ jQuery(document).on('change', '.br_selected_area_show', br_selected_area_show);
1689
  }
1690
  }
1691
 
 
 
1692
  //THIS CAN BE NEW FIX FOR SORTING, BUT NOT SURE
1693
  if( class_exists('WC_Query') && method_exists('WC_Query', 'product_query') ) {
1694
 
@@ -1749,7 +1798,7 @@ jQuery(document).on('change', '.br_selected_area_show', br_selected_area_show);
1749
  $args['meta_query'] = $meta_query;
1750
  }
1751
  $_POST['terms'] = $old_post_terms;
1752
- if ( ! empty($_POST['price']) ) {
1753
  $min = isset( $_POST['price'][0] ) ? floatval( $_POST['price'][0] ) : 0;
1754
  $max = isset( $_POST['price'][1] ) ? floatval( $_POST['price'][1] ) : 9999999999;
1755
  if ( wc_tax_enabled() && 'incl' === get_option( 'woocommerce_tax_display_shop' ) && ! wc_prices_include_tax() ) {
@@ -2521,6 +2570,16 @@ jQuery(document).on('change', '.br_selected_area_show', br_selected_area_show);
2521
  public function option_page_capability($capability = '') {
2522
  return 'manage_berocket_aapf';
2523
  }
 
 
 
 
 
 
 
 
 
 
2524
  }
2525
 
2526
  new BeRocket_AAPF;
268
  add_filter( 'plugin_action_links_' . $plugin_base_slug, array( $this, 'plugin_action_links' ) );
269
  add_filter( 'berocket_aapf_widget_terms', array($this, 'wpml_attribute_slug_translate'));
270
  add_filter ( 'BeRocket_updater_menu_order_custom_post', array($this, 'menu_order_custom_post') );
271
+ if( br_woocommerce_version_check('3.6') ) {
272
+ //TEST FUNCTIONS
273
+ add_filter( 'posts_clauses', array( $this, 'price_filter_post_clauses' ), 10, 2 );
274
+ add_filter( 'berocket_posts_clauses_recount', array( $this, 'add_price_to_post_clauses' ), 10, 1 );
275
+ }
276
  } else {
277
  if( is_plugin_active( 'woocommerce/woocommerce.php' ) || is_plugin_active_for_network( 'woocommerce/woocommerce.php' ) ) {
278
  add_action( 'admin_notices', array( $this, 'update_woocommerce' ) );
1254
  add_filter( 'pre_get_posts', array( $this, 'apply_user_price' ) );
1255
  add_filter( 'pre_get_posts', array( $this, 'apply_user_filters' ), 900000 );
1256
  add_filter( 'woocommerce_shortcode_products_query', array( $this, 'woocommerce_shortcode_products_query' ), 10, 3 );
1257
+ $shortcode_types = array(
1258
+ 'products',
1259
+ 'product',
1260
+ 'sale_products',
1261
+ 'recent_products',
1262
+ 'best_selling_products',
1263
+ 'top_rated_products',
1264
+ 'featured_products',
1265
+ 'product_attribute',
1266
+ 'product_category',
1267
+ );
1268
+ foreach($shortcode_types as $shortcode_type) {
1269
+ add_action( "woocommerce_shortcode_{$shortcode_type}_loop_no_results", array( $this, 'woocommerce_shortcode_no_result' ), 10, 1 );
1270
+ }
1271
  add_filter( 'shortcode_atts_sale_products', array($this, 'shortcode_atts_products'), 10, 3);
1272
  add_filter( 'shortcode_atts_featured_products', array($this, 'shortcode_atts_products'), 10, 3);
1273
  add_filter( 'shortcode_atts_best_selling_products', array($this, 'shortcode_atts_products'), 10, 3);
1317
  public function include_all_scripts() {
1318
  /* theme scripts */
1319
  if( defined('THE7_VERSION') && THE7_VERSION ) {
1320
+ add_filter('berocket_aapf_time_to_fix_products_style', '__return_false');
1321
  wp_enqueue_script( 'berocket_ajax_fix-the7', plugins_url( 'js/themes/the7.js', __FILE__ ), array( 'jquery' ), BeRocket_AJAX_filters_version );
1322
  }
1323
  global $wp_query, $wp, $sitepress, $wp_rewrite;
1582
  }
1583
  return $query_vars;
1584
  }
1585
+ public function woocommerce_shortcode_no_result($atts) {
1586
+ if( ! empty($atts['berocket_aapf']) ) {
1587
+ wc_no_products_found();
1588
+ }
1589
+ }
1590
+ public function price_filter_post_clauses( $args, $wp_query ) {
1591
+ if( empty($wp_query->query_vars['berocket_filtered']) || empty($_POST['price']) ) {
1592
+ return $args;
1593
+ }
1594
+ return $this->add_price_to_post_clauses($args);
1595
+ }
1596
+ public function add_price_to_post_clauses($args) {
1597
+ global $wpdb;
1598
+
1599
+ if ( ! strstr( $args['join'], 'wc_product_meta_lookup' ) ) {
1600
+ $args['join'] .= " LEFT JOIN {$wpdb->wc_product_meta_lookup} wc_product_meta_lookup ON {$wpdb->posts}.ID = wc_product_meta_lookup.product_id ";
1601
+ }
1602
+ $min = isset( $_POST['price'][0] ) ? floatval( $_POST['price'][0] ) : 0;
1603
+ $max = isset( $_POST['price'][1] ) ? floatval( $_POST['price'][1] ) : 9999999999;
1604
+ $args['where'] .= $wpdb->prepare(
1605
+ ' AND wc_product_meta_lookup.min_price >= %f AND wc_product_meta_lookup.max_price <= %f ',
1606
+ $min,
1607
+ $max
1608
+ );
1609
+ return $args;
1610
+ }
1611
  public function woocommerce_filter_query_vars( $query_vars, $atts = array(), $name = 'products' ) {
1612
  $new_query_vars = $query_vars;
1613
  $new_query_vars['nopaging'] = true;
1669
  }
1670
  $query_vars['post__not_in'] = array_merge($query_vars['post__not_in'], apply_filters('berocket_add_out_of_stock_variable', array(), $custom_terms, berocket_isset($_POST['limits_arr'])));
1671
  $query_vars['post__in'] = apply_filters( 'loop_shop_post_in', $query_vars['post__in']);
1672
+ $query_vars['berocket_filtered'] = true;
1673
  global $br_wc_query;
1674
  $br_wc_query = $query_vars;
1675
  add_action( 'wp_footer', array( $this, 'wp_footer_widget'), 99999 );
1736
  }
1737
  }
1738
 
1739
+ $query->set('berocket_filtered', true);
1740
+
1741
  //THIS CAN BE NEW FIX FOR SORTING, BUT NOT SURE
1742
  if( class_exists('WC_Query') && method_exists('WC_Query', 'product_query') ) {
1743
 
1798
  $args['meta_query'] = $meta_query;
1799
  }
1800
  $_POST['terms'] = $old_post_terms;
1801
+ if ( ! br_woocommerce_version_check('3.6') && ! empty($_POST['price']) ) {
1802
  $min = isset( $_POST['price'][0] ) ? floatval( $_POST['price'][0] ) : 0;
1803
  $max = isset( $_POST['price'][1] ) ? floatval( $_POST['price'][1] ) : 9999999999;
1804
  if ( wc_tax_enabled() && 'incl' === get_option( 'woocommerce_tax_display_shop' ) && ! wc_prices_include_tax() ) {
2570
  public function option_page_capability($capability = '') {
2571
  return 'manage_berocket_aapf';
2572
  }
2573
+ public function set_scripts() {
2574
+ if( apply_filters('berocket_aapf_time_to_fix_products_style', true) ) {
2575
+ echo '<script>
2576
+ jQuery(document).on("berocket_aapf_time_to_fix_products_style", function() {
2577
+ jQuery(the_ajax_script.products_holder_id).find("*").filter(function() {return jQuery(this).css("opacity") == "0";}).css("opacity", 1);
2578
+ });
2579
+ </script>';
2580
+ }
2581
+ parent::set_scripts();
2582
+ }
2583
  }
2584
 
2585
  new BeRocket_AAPF;
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.2
8
- Stable tag: 1.3.2.7
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -184,6 +184,12 @@ You can try this plugin's admin side [here](https://berocket.com/product/woocomm
184
 
185
  == Changelog ==
186
 
 
 
 
 
 
 
187
  = 1.3.2.7 =
188
  * Fix - Links to BeRocket
189
  * Fix - Compatibility with other BeRocket plugins
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.2
8
+ Stable tag: 1.3.2.8
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
184
 
185
  == Changelog ==
186
 
187
+ = 1.3.2.8 =
188
+ * Enhancement - Price slider speed woocommerce 3.6
189
+ * Enhancement - WooCommerce shortcode add no products message
190
+ * Fix - PHP notices
191
+ * Fix - Remove some files
192
+
193
  = 1.3.2.7 =
194
  * Fix - Links to BeRocket
195
  * Fix - Compatibility with other BeRocket plugins
templates/filter_condition.php DELETED
@@ -1,293 +0,0 @@
1
- <?php
2
- echo '<div class="submitbox" id="submitpost">';
3
- $product_categories = get_terms( 'product_cat' );
4
- $condition_types = array(
5
- 'page' => __('Page', 'BeRocket_products_label_domain'),
6
- 'attribute' => __('Product Attribute', 'BeRocket_products_label_domain'),
7
- 'search' => __('Search', 'BeRocket_products_label_domain'),
8
- );
9
- if( is_array($product_categories) && count($product_categories) > 0 ) {
10
- $condition_types['category'] = __('Product category', 'BeRocket_products_label_domain');
11
- }
12
- $condition_types = apply_filters('berocket_filters_condition_types', $condition_types);
13
- ?>
14
- <div class="">
15
- <div class="br_filter_group_example" style="display:none;">
16
- <div class="br_cond_select" data-current="1">
17
- <span>
18
- <select class="br_cond_type">
19
- <?php
20
- foreach($condition_types as $condition_type_slug => $condition_type_name) {
21
- echo '<option value="', $condition_type_slug, '">', $condition_type_name, '</option>';
22
- }
23
- ?>
24
- </select>
25
- </span>
26
- <span class="button berocket_remove_condition"><i class="fa fa-minus"></i></span>
27
- <div class="br_current_cond">
28
- </div>
29
- </div>
30
- <span class="button berocket_add_condition"><i class="fa fa-plus"></i></span>
31
- <span class="button br_remove_group"><i class="fa fa-minus"></i></span>
32
- </div>
33
- <div class="br_cond_example" style="display:none;">
34
- <?php
35
- foreach($condition_types as $condition_type_slug => $condition_type_name) {
36
- $condition_html = apply_filters('berocket_filters_condition_type_' . $condition_type_slug, '', '%name%[data][%id%][%current_id%]', array());
37
- if( ! empty($condition_html) ) {
38
- echo '<div class="br_cond br_cond_', $condition_type_slug, '">
39
- ', $condition_html, '
40
- <input type="hidden" name="%name%[data][%id%][%current_id%][type]" value="', $condition_type_slug, '">
41
- </div>';
42
- }
43
- }
44
- ?>
45
- </div>
46
- <div class="br_conditions">
47
- <?php
48
- $last_id = 0;
49
- foreach($filters['data'] as $id => $data) {
50
- $current_id = 1;
51
- ob_start();
52
- foreach($data as $current => $conditions) {
53
- if( $current > $current_id ) {
54
- $current_id = $current;
55
- }
56
- ?>
57
- <div class="br_cond_select" data-current="<?php echo $current; ?>">
58
- <span>
59
- <select class="br_cond_type">
60
- <?php
61
- foreach($condition_types as $condition_type_slug => $condition_type_name) {
62
- echo '<option value="', $condition_type_slug, '"', ( isset($conditions['type']) && $conditions['type'] == $condition_type_slug ? ' selected' : '' ) , '>', $condition_type_name, '</option>';
63
- }
64
- ?>
65
- </select>
66
- </span>
67
- <span class="button berocket_remove_condition"><i class="fa fa-minus"></i></span>
68
- <div class="br_current_cond">
69
- </div>
70
- <?php
71
- $condition_html = apply_filters('berocket_filters_condition_type_' . $conditions['type'], '', 'BeRocket_product_new_filter[data][' . $id . '][' . $current . ']', $conditions);
72
- if( ! empty($condition_html) ) {
73
- echo '<div class="br_cond br_cond_', $conditions['type'], '">
74
- ', $condition_html, '
75
- <input type="hidden" name="BeRocket_product_new_filter[data][' . $id . '][' . $current . '][type]" value="', $conditions['type'], '">
76
- </div>';
77
- }
78
- ?>
79
- </div>
80
- <?php
81
- }
82
- ?>
83
- <span class="button berocket_add_condition"><i class="fa fa-plus"></i></span>
84
- <span class="button br_remove_group"><i class="fa fa-minus"></i></span>
85
- <?php
86
- $html = ob_get_clean();
87
- echo '<div class="br_filter_group_condition" data-id="'.$id.'" data-current="'.$current_id.'">';
88
- echo $html;
89
- echo '</div>';
90
- if( $id > $last_id ) {
91
- $last_id = $id;
92
- }
93
- }
94
- $last_id++;
95
- ?>
96
- <span class="button br_add_group"><i class="fa fa-plus"></i></span>
97
- </div>
98
- <script>
99
- var last_id = <?php echo $last_id; ?>;
100
- var $html = jQuery('.br_filter_group_example').html();
101
- $html = '<div class="br_cond_one">'+$html+'</div>';
102
- jQuery(document).on('change', '.br_cond_type', function(event) {
103
- var $parent = jQuery(this).parents('.br_cond_select');
104
- $parent.find('.br_cond').remove();
105
- var id = $parent.parents('.br_filter_group_condition');
106
- var current_id = $parent.data('current');
107
- id = id.data('id');
108
- var html_need = jQuery('.br_cond_example .br_cond_'+jQuery(this).val()).get(0);
109
- html_need = html_need.outerHTML;
110
- html_need = html_need.replace(/%id%/g, id);
111
- html_need = html_need.replace(/%current_id%/g, current_id);
112
- html_need = html_need.replace(/%name%/g, 'BeRocket_product_new_filter');
113
- $parent.find('.br_current_cond').html(html_need);
114
- });
115
- jQuery(document).on('click', '.berocket_add_condition', function() {
116
- var id = jQuery(this).parents('.br_filter_group_condition');
117
- var current_id = id.data('current');
118
- current_id = current_id + 1;
119
- id.data('current', current_id);
120
- id = id.data('id');
121
- var $html = jQuery('.br_filter_group_example .br_cond_select').html();
122
- $html = '<div class="br_cond_select" data-current="'+current_id+'">'+$html+'</div>';
123
- $html = $html.replace('%id%', id);
124
- jQuery(this).before($html);
125
- $parent = jQuery(this).prev();
126
- $parent.find('.br_cond_type').trigger('change');
127
- });
128
- jQuery(document).on('click', '.berocket_remove_condition', function() {
129
- $parent = jQuery(this).parents('.br_cond_select');
130
- $parent.remove();
131
- });
132
- jQuery(document).on('click', '.br_add_group', function() {
133
- last_id++;
134
- var html = $html.replace( '%id%', last_id );
135
- var html = '<div class="br_filter_group_condition" data-id="'+last_id+'" data-current="1">'+html+'</div>';
136
- jQuery(this).before(html);
137
- $parent = jQuery(this).prev();
138
- $parent.find('.br_cond_type').trigger('change');
139
- });
140
- jQuery(document).on('click', '.br_remove_group', function() {
141
- $parent = jQuery(this).parents('.br_filter_group_condition');
142
- $parent.remove();
143
- });
144
- jQuery(document).on('change', '.br_cond_attr_select', function() {
145
- var $attr_block = jQuery(this).parents('.br_cond_attribute');
146
- $attr_block.find('.br_attr_values').hide();
147
- $attr_block.find('.br_attr_value_'+jQuery(this).val()).show();
148
- });
149
- jQuery(document).on('change', '.price_from', function() {
150
- var val_price_from = jQuery(this).val();
151
- var val_price_to = jQuery(this).parents('.br_cond').first().find('.price_to').val();
152
- price_from = parseFloat(val_price_from);
153
- price_to = parseFloat(val_price_to);
154
- price_to_int = parseInt(val_price_to);
155
- if( val_price_from == '' ) {
156
- jQuery(this).val(0);
157
- price_from = 0;
158
- }
159
- if( price_from > price_to ) {
160
- jQuery(this).val(price_to_int);
161
- }
162
- });
163
- jQuery(document).on('change', '.price_to', function() {
164
- var val_price_from = jQuery(this).parents('.br_cond').first().find('.price_from').val();
165
- var val_price_to = jQuery(this).val();
166
- price_from = parseFloat(val_price_from);
167
- price_from_int = parseInt(val_price_from);
168
- price_to = parseFloat(val_price_to);
169
- if( val_price_to == '' ) {
170
- jQuery(this).val(0);
171
- price_to = 0;
172
- }
173
- if( price_from > price_to ) {
174
- jQuery(this).val(price_from_int);
175
- }
176
- });
177
- </script>
178
- <style>
179
- .br_conditions .br_filter_group_condition {
180
- margin-top: 40px;
181
- }
182
- .br_conditions .br_filter_group_condition:first-child {
183
- margin-top: 0;
184
- }
185
- .br_conditions .br_filter_group_condition:before {
186
- content: "OR";
187
- display: block;
188
- position: absolute;
189
- top: -30px;
190
- font-size: 30px;
191
- }
192
- .br_conditions .br_filter_group_condition:first-child:before {
193
- display: none;
194
- }
195
- .br_filter_group_condition .br_cond_select {
196
- margin-top: 40px;
197
- position: relative;
198
- }
199
- .br_filter_group_condition .br_cond_select:first-child {
200
- margin-top: 0;
201
- }
202
- .br_filter_group_condition .br_cond_select:before {
203
- content: "AND";
204
- display: block;
205
- position: absolute;
206
- top: -30px;
207
- font-size: 30px;
208
- }
209
- .br_filter_group_condition .br_cond_select:first-child:before {
210
- display: none;
211
- }
212
- .br_filter_group_condition .br_cond_one .br_cond_select:first-child .berocket_remove_condition {
213
- display: none;
214
- }
215
- .br_filter_group_condition {
216
- border: 1px solid #999;
217
- background-color: #fafafa;
218
- padding: 0.5em;
219
- margin-bottom: 1em;
220
- position: relative;
221
- }
222
- .br_filter_group_condition .br_remove_group {
223
- position: absolute!important;
224
- top:-10px;
225
- right: -10px;
226
- }
227
- .br_cond_select {
228
- padding-bottom: 1em;
229
- }
230
- .br_cond_select {
231
- border: 1px solid #999;
232
- padding: 0.5em;
233
- margin-bottom: 0.5em;
234
- background-color: #eee;
235
- }
236
- .br_framework_settings .button.berocket_remove_condition,
237
- .br_framework_settings .button.berocket_add_condition,
238
- .br_framework_settings .button.br_remove_group,
239
- .br_framework_settings .button.br_add_group {
240
- padding: 0 10px;
241
- margin: 0;
242
- width: initial;
243
- min-width: initial;
244
- }
245
-
246
- .berocket_label_preview_wrap {
247
- display: inline-block;
248
- width: 240px;
249
- padding: 20px;
250
- background: white;
251
- position: fixed;
252
- top: 100%;
253
- margin-top: -320px;
254
- min-height: 320px;
255
- right: 20px;
256
- box-sizing: border-box;
257
- }
258
- .berocket_label_preview_wrap .berocket_label_preview {
259
- position: relative;
260
- }
261
- .berocket_label_preview_wrap .berocket_product_image {
262
- display: block;
263
- width: 200px;
264
- }
265
- @media screen and (max-width: 850px) {
266
- .berocket_label_preview_wrap {
267
- position: relative;
268
- }
269
- }
270
- </style>
271
- </div>
272
- <div>
273
- <table>
274
- <tr>
275
- <th>Hide this group on:</th>
276
- <td>
277
- <label>
278
- <input type="checkbox" value="1" name="BeRocket_product_new_filter[is_hide_mobile]"<?php if( ! empty($filters['is_hide_mobile']) ) echo ' checked'; ?>>
279
- <?php _e('Mobile', 'BeRocket_AJAX_domain'); ?>
280
- </label>
281
- <label>
282
- <input type="checkbox" value="1" name="BeRocket_product_new_filter[hide_group][tablet]"<?php if( ! empty($filters['hide_group']['tablet']) ) echo ' checked'; ?>>
283
- <?php _e('Tablet', 'BeRocket_AJAX_domain'); ?>
284
- </label>
285
- <label>
286
- <input type="checkbox" value="1" name="BeRocket_product_new_filter[hide_group][desktop]"<?php if( ! empty($filters['hide_group']['desktop']) ) echo ' checked'; ?>>
287
- <?php _e('Desktop', 'BeRocket_AJAX_domain'); ?>
288
- </label>
289
- </td>
290
- </tr>
291
- </table>
292
- </div>
293
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/filters_condition.php DELETED
@@ -1,293 +0,0 @@
1
- <?php
2
- echo '<div class="submitbox" id="submitpost">';
3
- $product_categories = get_terms( 'product_cat' );
4
- $condition_types = array(
5
- 'page' => __('Page', 'BeRocket_products_label_domain'),
6
- 'attribute' => __('Product Attribute', 'BeRocket_products_label_domain'),
7
- 'search' => __('Search', 'BeRocket_products_label_domain'),
8
- );
9
- if( is_array($product_categories) && count($product_categories) > 0 ) {
10
- $condition_types['category'] = __('Product category', 'BeRocket_products_label_domain');
11
- }
12
- $condition_types = apply_filters('berocket_filters_condition_types', $condition_types);
13
- ?>
14
- <div class="">
15
- <div class="br_filter_group_example" style="display:none;">
16
- <div class="br_cond_select" data-current="1">
17
- <span>
18
- <select class="br_cond_type">
19
- <?php
20
- foreach($condition_types as $condition_type_slug => $condition_type_name) {
21
- echo '<option value="', $condition_type_slug, '">', $condition_type_name, '</option>';
22
- }
23
- ?>
24
- </select>
25
- </span>
26
- <span class="button berocket_remove_condition"><i class="fa fa-minus"></i></span>
27
- <div class="br_current_cond">
28
- </div>
29
- </div>
30
- <span class="button berocket_add_condition"><i class="fa fa-plus"></i></span>
31
- <span class="button br_remove_group"><i class="fa fa-minus"></i></span>
32
- </div>
33
- <div class="br_cond_example" style="display:none;">
34
- <?php
35
- foreach($condition_types as $condition_type_slug => $condition_type_name) {
36
- $condition_html = apply_filters('berocket_filters_condition_type_' . $condition_type_slug, '', '%name%[data][%id%][%current_id%]', array());
37
- if( ! empty($condition_html) ) {
38
- echo '<div class="br_cond br_cond_', $condition_type_slug, '">
39
- ', $condition_html, '
40
- <input type="hidden" name="%name%[data][%id%][%current_id%][type]" value="', $condition_type_slug, '">
41
- </div>';
42
- }
43
- }
44
- ?>
45
- </div>
46
- <div class="br_conditions">
47
- <?php
48
- $last_id = 0;
49
- foreach($filters['data'] as $id => $data) {
50
- $current_id = 1;
51
- ob_start();
52
- foreach($data as $current => $conditions) {
53
- if( $current > $current_id ) {
54
- $current_id = $current;
55
- }
56
- ?>
57
- <div class="br_cond_select" data-current="<?php echo $current; ?>">
58
- <span>
59
- <select class="br_cond_type">
60
- <?php
61
- foreach($condition_types as $condition_type_slug => $condition_type_name) {
62
- echo '<option value="', $condition_type_slug, '"', ( isset($conditions['type']) && $conditions['type'] == $condition_type_slug ? ' selected' : '' ) , '>', $condition_type_name, '</option>';
63
- }
64
- ?>
65
- </select>
66
- </span>
67
- <span class="button berocket_remove_condition"><i class="fa fa-minus"></i></span>
68
- <div class="br_current_cond">
69
- </div>
70
- <?php
71
- $condition_html = apply_filters('berocket_filters_condition_type_' . $conditions['type'], '', 'br_filter_group[data][' . $id . '][' . $current . ']', $conditions);
72
- if( ! empty($condition_html) ) {
73
- echo '<div class="br_cond br_cond_', $conditions['type'], '">
74
- ', $condition_html, '
75
- <input type="hidden" name="br_filter_group[data][' . $id . '][' . $current . '][type]" value="', $conditions['type'], '">
76
- </div>';
77
- }
78
- ?>
79
- </div>
80
- <?php
81
- }
82
- ?>
83
- <span class="button berocket_add_condition"><i class="fa fa-plus"></i></span>
84
- <span class="button br_remove_group"><i class="fa fa-minus"></i></span>
85
- <?php
86
- $html = ob_get_clean();
87
- echo '<div class="br_filter_group_condition" data-id="'.$id.'" data-current="'.$current_id.'">';
88
- echo $html;
89
- echo '</div>';
90
- if( $id > $last_id ) {
91
- $last_id = $id;
92
- }
93
- }
94
- $last_id++;
95
- ?>
96
- <span class="button br_add_group"><i class="fa fa-plus"></i></span>
97
- </div>
98
- <script>
99
- var last_id = <?php echo $last_id; ?>;
100
- var $html = jQuery('.br_filter_group_example').html();
101
- $html = '<div class="br_cond_one">'+$html+'</div>';
102
- jQuery(document).on('change', '.br_cond_type', function(event) {
103
- var $parent = jQuery(this).parents('.br_cond_select');
104
- $parent.find('.br_cond').remove();
105
- var id = $parent.parents('.br_filter_group_condition');
106
- var current_id = $parent.data('current');
107
- id = id.data('id');
108
- var html_need = jQuery('.br_cond_example .br_cond_'+jQuery(this).val()).get(0);
109
- html_need = html_need.outerHTML;
110
- html_need = html_need.replace(/%id%/g, id);
111
- html_need = html_need.replace(/%current_id%/g, current_id);
112
- html_need = html_need.replace(/%name%/g, 'br_filter_group');
113
- $parent.find('.br_current_cond').html(html_need);
114
- });
115
- jQuery(document).on('click', '.berocket_add_condition', function() {
116
- var id = jQuery(this).parents('.br_filter_group_condition');
117
- var current_id = id.data('current');
118
- current_id = current_id + 1;
119
- id.data('current', current_id);
120
- id = id.data('id');
121
- var $html = jQuery('.br_filter_group_example .br_cond_select').html();
122
- $html = '<div class="br_cond_select" data-current="'+current_id+'">'+$html+'</div>';
123
- $html = $html.replace('%id%', id);
124
- jQuery(this).before($html);
125
- $parent = jQuery(this).prev();
126
- $parent.find('.br_cond_type').trigger('change');
127
- });
128
- jQuery(document).on('click', '.berocket_remove_condition', function() {
129
- $parent = jQuery(this).parents('.br_cond_select');
130
- $parent.remove();
131
- });
132
- jQuery(document).on('click', '.br_add_group', function() {
133
- last_id++;
134
- var html = $html.replace( '%id%', last_id );
135
- var html = '<div class="br_filter_group_condition" data-id="'+last_id+'" data-current="1">'+html+'</div>';
136
- jQuery(this).before(html);
137
- $parent = jQuery(this).prev();
138
- $parent.find('.br_cond_type').trigger('change');
139
- });
140
- jQuery(document).on('click', '.br_remove_group', function() {
141
- $parent = jQuery(this).parents('.br_filter_group_condition');
142
- $parent.remove();
143
- });
144
- jQuery(document).on('change', '.br_cond_attr_select', function() {
145
- var $attr_block = jQuery(this).parents('.br_cond_attribute');
146
- $attr_block.find('.br_attr_values').hide();
147
- $attr_block.find('.br_attr_value_'+jQuery(this).val()).show();
148
- });
149
- jQuery(document).on('change', '.price_from', function() {
150
- var val_price_from = jQuery(this).val();
151
- var val_price_to = jQuery(this).parents('.br_cond').first().find('.price_to').val();
152
- price_from = parseFloat(val_price_from);
153
- price_to = parseFloat(val_price_to);
154
- price_to_int = parseInt(val_price_to);
155
- if( val_price_from == '' ) {
156
- jQuery(this).val(0);
157
- price_from = 0;
158
- }
159
- if( price_from > price_to ) {
160
- jQuery(this).val(price_to_int);
161
- }
162
- });
163
- jQuery(document).on('change', '.price_to', function() {
164
- var val_price_from = jQuery(this).parents('.br_cond').first().find('.price_from').val();
165
- var val_price_to = jQuery(this).val();
166
- price_from = parseFloat(val_price_from);
167
- price_from_int = parseInt(val_price_from);
168
- price_to = parseFloat(val_price_to);
169
- if( val_price_to == '' ) {
170
- jQuery(this).val(0);
171
- price_to = 0;
172
- }
173
- if( price_from > price_to ) {
174
- jQuery(this).val(price_from_int);
175
- }
176
- });
177
- </script>
178
- <style>
179
- .br_conditions .br_filter_group_condition {
180
- margin-top: 40px;
181
- }
182
- .br_conditions .br_filter_group_condition:first-child {
183
- margin-top: 0;
184
- }
185
- .br_conditions .br_filter_group_condition:before {
186
- content: "OR";
187
- display: block;
188
- position: absolute;
189
- top: -30px;
190
- font-size: 30px;
191
- }
192
- .br_conditions .br_filter_group_condition:first-child:before {
193
- display: none;
194
- }
195
- .br_filter_group_condition .br_cond_select {
196
- margin-top: 40px;
197
- position: relative;
198
- }
199
- .br_filter_group_condition .br_cond_select:first-child {
200
- margin-top: 0;
201
- }
202
- .br_filter_group_condition .br_cond_select:before {
203
- content: "AND";
204
- display: block;
205
- position: absolute;
206
- top: -30px;
207
- font-size: 30px;
208
- }
209
- .br_filter_group_condition .br_cond_select:first-child:before {
210
- display: none;
211
- }
212
- .br_filter_group_condition .br_cond_one .br_cond_select:first-child .berocket_remove_condition {
213
- display: none;
214
- }
215
- .br_filter_group_condition {
216
- border: 1px solid #999;
217
- background-color: #fafafa;
218
- padding: 0.5em;
219
- margin-bottom: 1em;
220
- position: relative;
221
- }
222
- .br_filter_group_condition .br_remove_group {
223
- position: absolute!important;
224
- top:-10px;
225
- right: -10px;
226
- }
227
- .br_cond_select {
228
- padding-bottom: 1em;
229
- }
230
- .br_cond_select {
231
- border: 1px solid #999;
232
- padding: 0.5em;
233
- margin-bottom: 0.5em;
234
- background-color: #eee;
235
- }
236
- .br_framework_settings .button.berocket_remove_condition,
237
- .br_framework_settings .button.berocket_add_condition,
238
- .br_framework_settings .button.br_remove_group,
239
- .br_framework_settings .button.br_add_group {
240
- padding: 0 10px;
241
- margin: 0;
242
- width: initial;
243
- min-width: initial;
244
- }
245
-
246
- .berocket_label_preview_wrap {
247
- display: inline-block;
248
- width: 240px;
249
- padding: 20px;
250
- background: white;
251
- position: fixed;
252
- top: 100%;
253
- margin-top: -320px;
254
- min-height: 320px;
255
- right: 20px;
256
- box-sizing: border-box;
257
- }
258
- .berocket_label_preview_wrap .berocket_label_preview {
259
- position: relative;
260
- }
261
- .berocket_label_preview_wrap .berocket_product_image {
262
- display: block;
263
- width: 200px;
264
- }
265
- @media screen and (max-width: 850px) {
266
- .berocket_label_preview_wrap {
267
- position: relative;
268
- }
269
- }
270
- </style>
271
- </div>
272
- <div>
273
- <table>
274
- <tr>
275
- <th>Hide this group on:</th>
276
- <td>
277
- <label>
278
- <input type="checkbox" value="1" name="br_filter_group[hide_group][mobile]"<?php if( ! empty($filters['hide_group']['mobile']) ) echo ' checked'; ?>>
279
- <?php _e('Mobile', 'BeRocket_AJAX_domain'); ?>
280
- </label>
281
- <label>
282
- <input type="checkbox" value="1" name="br_filter_group[hide_group][tablet]"<?php if( ! empty($filters['hide_group']['tablet']) ) echo ' checked'; ?>>
283
- <?php _e('Tablet', 'BeRocket_AJAX_domain'); ?>
284
- </label>
285
- <label>
286
- <input type="checkbox" value="1" name="br_filter_group[hide_group][desktop]"<?php if( ! empty($filters['hide_group']['desktop']) ) echo ' checked'; ?>>
287
- <?php _e('Desktop', 'BeRocket_AJAX_domain'); ?>
288
- </label>
289
- </td>
290
- </tr>
291
- </table>
292
- </div>
293
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/settings_footer.php DELETED
@@ -1,62 +0,0 @@
1
- <div class="wrap">
2
- <?php if( ! empty($feature_list) && count($feature_list) > 0 ) { ?>
3
- <div class="paid_features">
4
- <?php
5
- $feature_text = '';
6
- foreach($feature_list as $feature) {
7
- $feature_text .= '<li>'.$feature.'</li>';
8
- }
9
- $text = '<h3>Receive more features and control with Paid version of the plugin:</h3>
10
- <div>
11
- <ul>
12
- %feature_list%
13
- </ul>
14
- </div>
15
- <div><a class="get_premium_version" href="%link%">PREMIUM VERSION</a></div>
16
- <p>Support the plugin by purchasing paid version. This will provide faster growth, better support and much more functionality for the plugin</p>';
17
- $text = str_replace('%feature_list%', $feature_text, $text);
18
- $text = str_replace('%link%', $dplugin_link, $text);
19
- $text = str_replace('%plugin_name%', br_get_value_from_array($plugin_info, 'Name'), $text);
20
- $text = str_replace('%plugin_link%', br_get_value_from_array($plugin_info, 'PluginURI'), $text);
21
- echo $text;
22
- ?>
23
- </div>
24
- <?php
25
- $text = '<h4>Both <a href="%plugin_link%" target="_blank">Free</a> and <a href="%link%" target="_blank">Paid</a> versions of %plugin_name% developed by <a href="http://berocket.com" target="_blank">BeRocket</a></h4>';
26
- } else {
27
- $text = '<h4><a href="%plugin_link%" target="_blank">%plugin_name%</a> developed by <a href="http://berocket.com" target="_blank">BeRocket</a></h4>';
28
- }
29
- $text = str_replace('%link%', $dplugin_link, $text);
30
- $text = str_replace('%plugin_name%', br_get_value_from_array($plugin_info, 'Name'), $text);
31
- $text = str_replace('%plugin_link%', br_get_value_from_array($plugin_info, 'PluginURI'), $text);
32
- echo $text;
33
- ?>
34
- </div>
35
- <style>
36
- .paid_features {
37
- border: 1px solid #c29a9a;
38
- background: white;
39
- padding: 20px 20px 10px 30px;
40
- font-weight: 600;
41
- }
42
- .get_premium_version {
43
- display: inline-block;
44
- background-color: rgb(239, 109, 109);
45
- border-color: rgb(222, 72, 72);
46
- color: white;
47
- font-size: 20px;
48
- height: auto;
49
- padding: 10px 41px;
50
- margin: 1em 0 1em 0;
51
- text-decoration: none;
52
- cursor: pointer;
53
- }
54
- .get_premium_version:hover {
55
- color: white;
56
- background-color: rgb(222, 72, 72);
57
- }
58
- .paid_features ul li{
59
- list-style: initial;
60
- margin-left: 2em;
61
- }
62
- </style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/settings_head.php DELETED
@@ -1,9 +0,0 @@
1
- <div class="wrap">
2
- <?php
3
- $text = '<h1>%plugin_name% by BeRocket</h1>
4
- <div>%desc%</div>';
5
- $text = str_replace('%plugin_name%', $plugin_info['Name'], $text);
6
- $text = str_replace('%desc%', $plugin_info['Description'], $text);
7
- echo $text;
8
- ?>
9
- </div>
 
 
 
 
 
 
 
 
 
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.3.2.7
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
10
  * Text Domain: BeRocket_AJAX_domain
11
  * Domain Path: /languages/
12
- * WC tested up to: 3.6.4
13
  */
14
- define( "BeRocket_AJAX_filters_version", '1.3.2.7' );
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.3.2.8
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
10
  * Text Domain: BeRocket_AJAX_domain
11
  * Domain Path: /languages/
12
+ * WC tested up to: 3.6.5
13
  */
14
+ define( "BeRocket_AJAX_filters_version", '1.3.2.8' );
15
  define( "BeRocket_AJAX_filters_file", __FILE__ );
16
  include_once('main.php');