Advanced AJAX Product Filters - Version 1.1.8

Version Description

  • Fix - Better compatibility with WPML
Download this release

Release Info

Developer dholovnia
Plugin Icon wp plugin Advanced AJAX Product Filters
Version 1.1.8
Comparing to
See all releases

Code changes from version 1.1.5 to 1.1.8

README.md CHANGED
@@ -4,8 +4,8 @@ Contributors: dholovnia, berocket
4
  Donate link: http://berocket.com
5
  Tags: filters, product filters, ajax product filters, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce ajax product filters, widget, plugin
6
  Requires at least: 4.0
7
- Tested up to: 4.5.3
8
- Stable tag: 1.1.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -139,6 +139,20 @@ http://woocommerce-product-filter.berocket.com
139
 
140
  == Changelog ==
141
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  = 1.1.5 =
143
  * Fix - Shortcode doesn't work
144
  * Fix - Optimization for price filters
@@ -284,4 +298,4 @@ you set to order `by custom` you can drag&drop values up and down and set yo
284
  * Fix - better support for older PHP versions
285
 
286
  = 1.0.1 =
287
- * First public version
4
  Donate link: http://berocket.com
5
  Tags: filters, product filters, ajax product filters, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce ajax product filters, widget, plugin
6
  Requires at least: 4.0
7
+ Tested up to: 4.7.2
8
+ Stable tag: 1.1.8
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
139
 
140
  == Changelog ==
141
 
142
+ = 1.1.8 =
143
+ * Fix - Better compatibility with WPML
144
+
145
+ = 1.1.7 =
146
+ * Fix - Remove notices on PHP 7 and newer
147
+ * Fix - Fix fo Currency Exchange plugin
148
+ * Fix - Styles for admin panel
149
+ * Fix - Remove sliders from all filters
150
+
151
+ = 1.1.6 =
152
+ * Fix - Price for currency exchange
153
+ * Fix - Optimization for price widget
154
+ * Fix - Custom JavaScript errors
155
+
156
  = 1.1.5 =
157
  * Fix - Shortcode doesn't work
158
  * Fix - Optimization for price filters
298
  * Fix - better support for older PHP versions
299
 
300
  = 1.0.1 =
301
+ * First public version
assets/screenshot-1.png ADDED
Binary file
assets/screenshot-2.png ADDED
Binary file
assets/screenshot-3.png ADDED
Binary file
css/widget.css CHANGED
@@ -178,6 +178,7 @@ span.product-size{
178
  height: 4px;
179
  padding: 0;
180
  display: block;
 
181
  }
182
 
183
  .berocket_filter_slider.ui-widget-content .ui-slider-range, .berocket_filter_price_slider.ui-widget-content .ui-slider-range{
@@ -186,10 +187,11 @@ span.product-size{
186
 
187
  .berocket_filter_slider.ui-widget-content .ui-slider-handle, .berocket_filter_price_slider.ui-widget-content .ui-slider-handle{
188
  background: url("../images/handler.png") no-repeat scroll center center / cover transparent;
189
- width: 12px;
190
- height: 12px;
191
  border: 0;
192
  top: -4px;
 
193
  }
194
 
195
  .berocket_aapf_widget li.slider div.slide{
178
  height: 4px;
179
  padding: 0;
180
  display: block;
181
+ font-size: 10px;
182
  }
183
 
184
  .berocket_filter_slider.ui-widget-content .ui-slider-range, .berocket_filter_price_slider.ui-widget-content .ui-slider-range{
187
 
188
  .berocket_filter_slider.ui-widget-content .ui-slider-handle, .berocket_filter_price_slider.ui-widget-content .ui-slider-handle{
189
  background: url("../images/handler.png") no-repeat scroll center center / cover transparent;
190
+ width: 1.2em;
191
+ height: 1.2em;
192
  border: 0;
193
  top: -4px;
194
+ font-size: inherit;
195
  }
196
 
197
  .berocket_aapf_widget li.slider div.slide{
images/70p_sale.jpg ADDED
Binary file
includes/functions.php CHANGED
@@ -220,7 +220,7 @@ if( ! function_exists( 'br_aapf_args_converter' ) ) {
220
  }
221
 
222
  if ( $attribute == 'price' ) {
223
- $_POST['price'] = array( $min, $max );
224
  } elseif ( $attribute == 'order' ) {
225
  $_GET['orderby'] = $value;
226
  } else {
@@ -234,4 +234,4 @@ if( ! function_exists( 'br_aapf_args_converter' ) ) {
234
  }
235
  }
236
  }
237
- }
220
  }
221
 
222
  if ( $attribute == 'price' ) {
223
+ $_POST['price'] = apply_filters('berocket_min_max_filter', array( $min, $max ));
224
  } elseif ( $attribute == 'order' ) {
225
  $_GET['orderby'] = $value;
226
  } else {
234
  }
235
  }
236
  }
237
+ }
includes/widget.php CHANGED
@@ -22,7 +22,7 @@ class BeRocket_AAPF_Widget extends WP_Widget {
22
  /**
23
  * Constructor
24
  */
25
- function BeRocket_AAPF_Widget() {
26
  global $wp_version;
27
  /* Widget settings. */
28
  $widget_ops = array( 'classname' => 'widget_berocket_aapf', 'description' => __('Add Filters to Products page', 'BeRocket_AJAX_domain') );
@@ -31,11 +31,7 @@ class BeRocket_AAPF_Widget extends WP_Widget {
31
  $control_ops = array( 'id_base' => 'berocket_aapf_widget' );
32
 
33
  /* Create the widget. */
34
- if( strcmp( $wp_version, '4.3') < 0 ) {
35
- $this->WP_Widget( 'berocket_aapf_widget', __('AJAX Product Filters', 'BeRocket_AJAX_domain'), $widget_ops, $control_ops );
36
- } else {
37
- $this->__construct( 'berocket_aapf_widget', __('AJAX Product Filters', 'BeRocket_AJAX_domain'), $widget_ops, $control_ops );
38
- }
39
 
40
  add_filter( 'berocket_aapf_listener_wp_query_args', 'br_aapf_args_parser' );
41
  }
@@ -266,8 +262,8 @@ class BeRocket_AAPF_Widget extends WP_Widget {
266
  $slider_value2 = $max;
267
 
268
  if( $attribute == 'price' and @ $_POST['price'] ){
269
- $slider_value1 = $_POST['price'][0];
270
- $slider_value2 = $_POST['price'][1];
271
  }
272
  if( $attribute != 'price' and @ $_POST['limits'] ){
273
  foreach( $_POST['limits'] as $p_limit ){
@@ -310,49 +306,94 @@ class BeRocket_AAPF_Widget extends WP_Widget {
310
 
311
  public static function get_price_range( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items ){
312
  global $wpdb, $wp_query;
313
- $_POST['product_cat'] = $wp_query_product_cat;
314
- $extra_inner = $extra_where = '';
315
-
316
- if ( @ $_POST['product_cat'] and $_POST['product_cat'] != '-1' ) {
317
- $product_cat = get_term_by( 'slug', $_POST['product_cat'], 'product_cat' );
318
- $sub_categories = get_term_children($product_cat->term_id, 'product_cat');
319
- if( empty($sub_categories) || ! is_array($sub_categories) ) {
320
- $sub_categories = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
321
  }
322
- $sub_categories[] = $product_cat->term_id;
323
- $sub_categories = implode(',', $sub_categories);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
 
325
- $extra_inner = " INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id) ";
326
- $extra_where = " AND ( {$wpdb->term_relationships}.term_taxonomy_id IN (" . $sub_categories . ") ) ";
327
 
328
- unset( $sub_categories );
329
- } elseif ( isset($wp_query->query_vars['product_tag']) ) {
330
- $product_tag = get_term_by( 'slug', $wp_query->query_vars['product_tag'], 'product_tag' );
331
- $extra_inner = " INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id) ";
332
- $extra_where = " AND ( {$wpdb->term_relationships}.term_taxonomy_id IN (" . $product_tag->term_id . ") ) ";
333
- }
334
- $hide_out_of_stock = BeRocket_AAPF_Widget::woocommerce_hide_out_of_stock_items();
335
- $out_of_stock1 = '';
336
- $out_of_stock2 = '';
337
- if ( $hide_out_of_stock == 'yes' ) {
338
- $out_of_stock1 = "INNER JOIN {$wpdb->postmeta} AS pm2 ON ({$wpdb->posts}.ID = pm2.post_id)";
339
- $out_of_stock2 = "AND ( pm2.meta_key = '_stock_status' AND CAST(pm2.meta_value AS CHAR) = 'instock' )";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
  }
341
-
342
-
343
- $query_string = "
344
- SELECT MIN(cast({$wpdb->postmeta}.meta_value as unsigned)) as min_price, MAX(cast({$wpdb->postmeta}.meta_value as unsigned)) as max_price
345
- FROM {$wpdb->posts}
346
- INNER JOIN {$wpdb->postmeta} ON ({$wpdb->posts}.ID = {$wpdb->postmeta}.post_id)
347
- INNER JOIN {$wpdb->postmeta} AS pm1 ON ({$wpdb->posts}.ID = pm1.post_id)
348
- {$out_of_stock1}
349
- {$extra_inner}
350
- WHERE {$wpdb->posts}.post_type = 'product'
351
- AND {$wpdb->posts}.post_status = 'publish'
352
- {$extra_where}
353
- AND ( {$wpdb->postmeta}.meta_key = '_price' AND {$wpdb->postmeta}.meta_value > 0
354
- AND ( pm1.meta_key = '_visibility' AND CAST(pm1.meta_value AS CHAR) IN ('visible','catalog') )
355
- {$out_of_stock2} ) ";
356
 
357
  $prices = $wpdb->get_row($query_string);
358
  $price_range = false;
@@ -628,10 +669,12 @@ class BeRocket_AAPF_Widget extends WP_Widget {
628
  $args['post__in'] = BeRocket_AAPF::remove_hidden( $args['post__in'] );
629
 
630
  $args['post__in'] = BeRocket_AAPF::limits_filter( $args['post__in'] );
 
 
 
631
  $args['post__in'] = BeRocket_AAPF::price_filter( $args['post__in'] );
632
  $args['post_status'] = 'publish';
633
  $args['post_type'] = 'product';
634
- $args['post__in'] = BeRocket_AAPF::price_filter( $args['post__in'] );
635
  $default_posts_per_page = get_option( 'posts_per_page' );
636
  $args['posts_per_page'] = apply_filters( 'loop_shop_per_page', $default_posts_per_page );
637
  unset( $default_posts_per_page );
@@ -827,4 +870,4 @@ class BeRocket_AAPF_Widget extends WP_Widget {
827
  else
828
  return esc_url_raw( $result );
829
  }
830
- }
22
  /**
23
  * Constructor
24
  */
25
+ function __construct() {
26
  global $wp_version;
27
  /* Widget settings. */
28
  $widget_ops = array( 'classname' => 'widget_berocket_aapf', 'description' => __('Add Filters to Products page', 'BeRocket_AJAX_domain') );
31
  $control_ops = array( 'id_base' => 'berocket_aapf_widget' );
32
 
33
  /* Create the widget. */
34
+ parent::__construct( 'berocket_aapf_widget', __('AJAX Product Filters', 'BeRocket_AJAX_domain'), $widget_ops, $control_ops );
 
 
 
 
35
 
36
  add_filter( 'berocket_aapf_listener_wp_query_args', 'br_aapf_args_parser' );
37
  }
262
  $slider_value2 = $max;
263
 
264
  if( $attribute == 'price' and @ $_POST['price'] ){
265
+ $slider_value1 = apply_filters('woocommerce_price_filter_widget_min_amount', $_POST['price'][0]);
266
+ $slider_value2 = apply_filters('woocommerce_price_filter_widget_max_amount', $_POST['price'][1]);
267
  }
268
  if( $attribute != 'price' and @ $_POST['limits'] ){
269
  foreach( $_POST['limits'] as $p_limit ){
306
 
307
  public static function get_price_range( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items ){
308
  global $wpdb, $wp_query;
309
+
310
+ if( method_exists('WC_Query', 'get_main_tax_query') && method_exists('WC_Query', 'get_main_tax_query') &&
311
+ class_exists('WP_Meta_Query') && class_exists('WP_Tax_Query') ) {
312
+ $query_string = array(
313
+ 'select' => "SELECT MIN(cast(FLOOR(br_prices.meta_value) as decimal)) as min_price, MAX(cast(CEIL(br_prices.meta_value) as decimal)) as max_price
314
+ FROM {$wpdb->posts}",
315
+ 'join' => " INNER JOIN {$wpdb->postmeta} as br_prices ON ({$wpdb->posts}.ID = br_prices.post_id)",
316
+ 'where' => " WHERE {$wpdb->posts}.post_type = 'product'
317
+ AND {$wpdb->posts}.post_status = 'publish'
318
+ AND br_prices.meta_key = '_price' AND br_prices.meta_value > 0");
319
+ $tax_query = array();
320
+ $args = $wp_query->query_vars;
321
+ $meta_query = isset( $args['meta_query'] ) ? $args['meta_query'] : array();
322
+ foreach ( $meta_query as $key => $query ) {
323
+ if ( ! empty( $query['price_filter'] ) || ! empty( $query['rating_filter'] ) ) {
324
+ unset( $meta_query[ $key ] );
325
+ }
326
+ }
327
+ if ( ! empty( $args['product_cat'] ) ) {
328
+ $tax_query[ 'product_cat' ] = array(
329
+ 'taxonomy' => 'product_cat',
330
+ 'terms' => array( $args['product_cat'] ),
331
+ 'field' => 'slug',
332
+ );
333
+ }
334
+ $queried_object = $wp_query->get_queried_object_id();
335
+ if( ! empty($queried_object) ) {
336
+ $query_object = $wp_query->get_queried_object();
337
+ if( ! empty($query_object->taxonomy) && ! empty($query_object->slug) ) {
338
+ $tax_query[ $query_object->taxonomy ] = array(
339
+ 'taxonomy' => $query_object->taxonomy,
340
+ 'terms' => array( $query_object->slug ),
341
+ 'field' => 'slug',
342
+ );
343
+ }
344
  }
345
+ $meta_query = new WP_Meta_Query( $meta_query );
346
+ $tax_query = new WP_Tax_Query( $tax_query );
347
+ $meta_query_sql = $meta_query->get_sql( 'post', $wpdb->posts, 'ID' );
348
+ $tax_query_sql = $tax_query->get_sql( $wpdb->posts, 'ID' );
349
+ $query_string['join'] = $query_string['join'].' '. $tax_query_sql['join'] . $meta_query_sql['join'];
350
+ $query_string['where'] = $query_string['where'].' '. $tax_query_sql['where'] . $meta_query_sql['where'];
351
+ $query_string = implode( ' ', $query_string );
352
+ } else {
353
+ $_POST['product_cat'] = $wp_query_product_cat;
354
+ $extra_inner = $extra_where = '';
355
+
356
+ if ( @ $_POST['product_cat'] and $_POST['product_cat'] != '-1' ) {
357
+ $product_cat = get_term_by( 'slug', $_POST['product_cat'], 'product_cat' );
358
+ $sub_categories = get_term_children($product_cat->term_id, 'product_cat');
359
+ if( empty($sub_categories) || ! is_array($sub_categories) ) {
360
+ $sub_categories = array();
361
+ }
362
+ $sub_categories[] = $product_cat->term_id;
363
+ $sub_categories = implode(',', $sub_categories);
364
 
365
+ $extra_inner = " INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id) ";
366
+ $extra_where = " AND ( {$wpdb->term_relationships}.term_taxonomy_id IN (" . $sub_categories . ") ) ";
367
 
368
+ unset( $sub_categories );
369
+ } elseif ( isset($wp_query->query_vars['product_tag']) ) {
370
+ $product_tag = get_term_by( 'slug', $wp_query->query_vars['product_tag'], 'product_tag' );
371
+ $extra_inner = " INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id) ";
372
+ $extra_where = " AND ( {$wpdb->term_relationships}.term_taxonomy_id IN (" . $product_tag->term_id . ") ) ";
373
+ }
374
+ $hide_out_of_stock = BeRocket_AAPF_Widget::woocommerce_hide_out_of_stock_items();
375
+ $out_of_stock1 = '';
376
+ $out_of_stock2 = '';
377
+ if ( $hide_out_of_stock == 'yes' ) {
378
+ $out_of_stock1 = "INNER JOIN {$wpdb->postmeta} AS pm2 ON ({$wpdb->posts}.ID = pm2.post_id)";
379
+ $out_of_stock2 = "AND ( pm2.meta_key = '_stock_status' AND CAST(pm2.meta_value AS CHAR) = 'instock' )";
380
+ }
381
+
382
+
383
+ $query_string = "
384
+ SELECT MIN(cast({$wpdb->postmeta}.meta_value as unsigned)) as min_price, MAX(cast({$wpdb->postmeta}.meta_value as unsigned)) as max_price
385
+ FROM {$wpdb->posts}
386
+ INNER JOIN {$wpdb->postmeta} ON ({$wpdb->posts}.ID = {$wpdb->postmeta}.post_id)
387
+ INNER JOIN {$wpdb->postmeta} AS pm1 ON ({$wpdb->posts}.ID = pm1.post_id)
388
+ {$out_of_stock1}
389
+ {$extra_inner}
390
+ WHERE {$wpdb->posts}.post_type = 'product'
391
+ AND {$wpdb->posts}.post_status = 'publish'
392
+ {$extra_where}
393
+ AND ( {$wpdb->postmeta}.meta_key = '_price' AND {$wpdb->postmeta}.meta_value > 0
394
+ AND ( pm1.meta_key = '_visibility' AND CAST(pm1.meta_value AS CHAR) IN ('visible','catalog') )
395
+ {$out_of_stock2} ) ";
396
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
397
 
398
  $prices = $wpdb->get_row($query_string);
399
  $price_range = false;
669
  $args['post__in'] = BeRocket_AAPF::remove_hidden( $args['post__in'] );
670
 
671
  $args['post__in'] = BeRocket_AAPF::limits_filter( $args['post__in'] );
672
+ if( isset($_POST['price']) && is_array($_POST['price']) ) {
673
+ $_POST['price'] = apply_filters('berocket_min_max_filter', $_POST['price']);
674
+ }
675
  $args['post__in'] = BeRocket_AAPF::price_filter( $args['post__in'] );
676
  $args['post_status'] = 'publish';
677
  $args['post_type'] = 'product';
 
678
  $default_posts_per_page = get_option( 'posts_per_page' );
679
  $args['posts_per_page'] = apply_filters( 'loop_shop_per_page', $default_posts_per_page );
680
  unset( $default_posts_per_page );
870
  else
871
  return esc_url_raw( $result );
872
  }
873
+ }
js/admin.js CHANGED
@@ -8,7 +8,7 @@
8
  $('.berocket_aapf_widget_admin_operator_select', $parent).parent().parent().hide(0);
9
  $('.berocket_aapf_widget_admin_price_attribute', $parent).show(0);
10
  } else {
11
- $('.berocket_aapf_widget_admin_type_select', $parent).html('<option value="checkbox">Checkbox</option><option value="radio">Radio</option><option value="select">Select</option><option value="slider">Slider</option>');
12
  $('.berocket_aapf_widget_admin_operator_select', $parent).parent().parent().show(0);
13
  $('.berocket_aapf_widget_admin_price_attribute', $parent).hide(0);
14
  }
8
  $('.berocket_aapf_widget_admin_operator_select', $parent).parent().parent().hide(0);
9
  $('.berocket_aapf_widget_admin_price_attribute', $parent).show(0);
10
  } else {
11
+ $('.berocket_aapf_widget_admin_type_select', $parent).html('<option value="checkbox">Checkbox</option><option value="radio">Radio</option><option value="select">Select</option>');
12
  $('.berocket_aapf_widget_admin_operator_select', $parent).parent().parent().show(0);
13
  $('.berocket_aapf_widget_admin_price_attribute', $parent).hide(0);
14
  }
js/widget.min.js CHANGED
@@ -28,7 +28,11 @@
28
  && typeof func != 'undefined'
29
  && func.length > 0
30
  ) {
31
- eval( func );
 
 
 
 
32
  }
33
  }
34
 
@@ -481,6 +485,9 @@
481
  $(o2).prop('checked', false);
482
  $(o2).parents('li').first().removeClass('berocket_hide_sel_value');
483
  });
 
 
 
484
  } else {
485
  $('.'+$label.attr('for')).prop('checked', true);
486
  if( $label.parents('li').first().find('input').attr('type') == 'radio' ) {
@@ -491,7 +498,10 @@
491
  $(o2).parents('li').first().addClass('berocket_hide_sel_value');
492
  });
493
  }
494
- $label.addClass('berocket_checked');
 
 
 
495
  }
496
  $('.'+$label.attr('for')).parents('ul').find('input').trigger('refresh');
497
  if( the_ajax_script.hide_sel_value ) {
28
  && typeof func != 'undefined'
29
  && func.length > 0
30
  ) {
31
+ try{
32
+ eval( func );
33
+ } catch(err){
34
+ alert('You have some incorrect JavaScript code (AJAX Products Filter)');
35
+ }
36
  }
37
  }
38
 
485
  $(o2).prop('checked', false);
486
  $(o2).parents('li').first().removeClass('berocket_hide_sel_value');
487
  });
488
+ $('.'+$label.attr('for')).each(function( i2, o2 ) {
489
+ $(o2).parents('li').first().find('label').removeClass('berocket_checked');
490
+ });
491
  } else {
492
  $('.'+$label.attr('for')).prop('checked', true);
493
  if( $label.parents('li').first().find('input').attr('type') == 'radio' ) {
498
  $(o2).parents('li').first().addClass('berocket_hide_sel_value');
499
  });
500
  }
501
+ $('.'+$label.attr('for')).each(function( i2, o2 ) {
502
+ $(o2).parents('li').first().find('label').addClass('berocket_checked');
503
+ });
504
+ //$label.addClass('berocket_checked');
505
  }
506
  $('.'+$label.attr('for')).parents('ul').find('input').trigger('refresh');
507
  if( the_ajax_script.hide_sel_value ) {
readme.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: dholovnia, berocket
4
  Donate link: http://berocket.com
5
  Tags: filters, product filters, ajax product filters, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce ajax product filters, widget, plugin
6
  Requires at least: 4.0
7
- Tested up to: 4.5.3
8
- Stable tag: 1.1.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -30,7 +30,8 @@ WooCommerce AJAX Product Filters - advanced AJAX product filters plugin for WooC
30
 
31
  = Additional Features in Paid Plugin: =
32
 
33
- * Filter by Attribute, Tag, Custom Taxonomy, Color, Sub-categories and Availability( in stock | out of stock | any )
 
34
  * Customize filters look through admin
35
  * Option to re-count products amount in values when some value selected
36
  * Tag Cloud for Tag filter
@@ -38,20 +39,32 @@ WooCommerce AJAX Product Filters - advanced AJAX product filters plugin for WooC
38
  * Slider can use strings as a value
39
  * Filters can be collapsed by clicking on title, option to collapse filter on start
40
  * Price Filter Custom Min and Max values
 
41
  * Add custom CSS on admin settings page
42
  * Show icons before/after widget title and/or before/after values
43
  * Option to upload "Loading..." gif image and set label after/before/above/under it
44
- * Show icons before/after widget title and/or before/after values
45
  * Scroll top position can be controlled by the admin
46
  * Option to hide on mobile devices
47
  * Much better support for custom theme
48
  * Enhancements of the free features
 
 
 
 
 
 
 
 
 
49
 
50
  = Paid Plugin Link =
51
  http://berocket.com/product/woocommerce-ajax-products-filter
52
 
53
  = Demo =
54
- http://woocommerce-product-filter.berocket.com
 
 
 
55
 
56
 
57
  = How It Works: =
@@ -134,11 +147,34 @@ http://woocommerce-product-filter.berocket.com
134
  ---
135
 
136
  == Screenshots ==
 
 
 
137
 
138
  ---
139
 
140
  == Changelog ==
141
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  = 1.1.5 =
143
  * Fix - Shortcode doesn't work
144
  * Fix - Optimization for price filters
@@ -283,4 +319,4 @@ you set to order `by custom` you can drag&amp;drop values up and down and set yo
283
  * Fix - better support for older PHP versions
284
 
285
  = 1.0.1 =
286
- * First public version
4
  Donate link: http://berocket.com
5
  Tags: filters, product filters, ajax product filters, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce ajax product filters, widget, plugin
6
  Requires at least: 4.0
7
+ Tested up to: 4.7.2
8
+ Stable tag: 1.1.8
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
30
 
31
  = Additional Features in Paid Plugin: =
32
 
33
+ * Filter by Attribute, Tag, Custom Taxonomy, Color, Image, Sale status, Sub-categories and Availability( in stock | out of stock | any )
34
+ * Nice URLs for SEO Friendly URLs
35
  * Customize filters look through admin
36
  * Option to re-count products amount in values when some value selected
37
  * Tag Cloud for Tag filter
39
  * Slider can use strings as a value
40
  * Filters can be collapsed by clicking on title, option to collapse filter on start
41
  * Price Filter Custom Min and Max values
42
+ * Price as checkbox with min and max values
43
  * Add custom CSS on admin settings page
44
  * Show icons before/after widget title and/or before/after values
45
  * Option to upload "Loading..." gif image and set label after/before/above/under it
 
46
  * Scroll top position can be controlled by the admin
47
  * Option to hide on mobile devices
48
  * Much better support for custom theme
49
  * Enhancements of the free features
50
+ * Shortcode Builder for Easy Shortcode Creation
51
+ * Show amount of products before update with "Update button" widget
52
+ * Optimization to Handle up to 5 000 Products Total
53
+ * Option to Set Values for the Price Slider Manually
54
+ * Selected Filters Area
55
+ * Reset button and Search box widget
56
+ * Cache for Widgets
57
+ * Filters Visibility by Pages
58
+ * Display only selected attribute values or hide selected attribute values
59
 
60
  = Paid Plugin Link =
61
  http://berocket.com/product/woocommerce-ajax-products-filter
62
 
63
  = Demo =
64
+ http://woocommerce-products-filter.berocket.com/shop/
65
+
66
+ = Demo Description =
67
+ http://woocommerce-products-filter.berocket.com/
68
 
69
 
70
  = How It Works: =
147
  ---
148
 
149
  == Screenshots ==
150
+ 1. General settings
151
+ 2. JavaScript settings
152
+ 3. Widget
153
 
154
  ---
155
 
156
  == Changelog ==
157
 
158
+ = 1.1.8 =
159
+ * Fix - Better compatibility with WPML
160
+
161
+ = 1.1.7 =
162
+ * Fix - Remove notices on PHP 7 and newer
163
+ * Fix - Fix fo Currency Exchange plugin
164
+ * Fix - Styles for admin panel
165
+ * Fix - Remove sliders from all filters
166
+
167
+ = 1.1.7 =
168
+ * Fix - Remove notices on PHP 7 and newer
169
+ * Fix - Fix fo Currency Exchange plugin
170
+ * Fix - Styles for admin panel
171
+ * Fix - Remove sliders from all filters
172
+
173
+ = 1.1.6 =
174
+ * Fix - Price for currency exchange
175
+ * Fix - Optimization for price widget
176
+ * Fix - Custom JavaScript errors
177
+
178
  = 1.1.5 =
179
  * Fix - Shortcode doesn't work
180
  * Fix - Optimization for price filters
319
  * Fix - better support for older PHP versions
320
 
321
  = 1.0.1 =
322
+ * First public version
templates/admin-settings.php CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  <div class="wrap">
2
  <form method="post" action="options.php">
3
  <?php
@@ -141,6 +149,9 @@
141
  <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
142
  </p>
143
  </form>
 
 
 
144
  <h3>Receive more features and control with Paid version of the plugin:</h3>
145
  <ul>
146
  <li><b>- Filter by Attribute, Tag, Custom Taxonomy, Color, Sub-categories and Availability( in stock | out of stock | any )</b></li>
@@ -161,5 +172,30 @@
161
  <li><b>- Enhancements of the free features</b></li>
162
  </ul>
163
  <h4>Support the plugin by purchasing paid version. This will provide faster growth, better support and much more functionality for the plugin!</h4>
164
- <h4>Both <a href="https://wordpress.org/plugins/woocommerce-ajax-filters/" target="_blank">Free</a> and <a href="http://berocket.com/product/woocommerce-ajax-products-filter" target="_blank">Paid</a> versions of WooCommerce AJAX Product Filters developed by <a href="http://berocket.com" target="_blank">BeRocket</a></h4>
165
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $dplugin_name = 'WooCommerce AJAX Products Filter';
3
+ $dplugin_link = 'http://berocket.com/product/woocommerce-ajax-products-filter';
4
+ $dplugin_price = 26;
5
+ $dplugin_desc = '';
6
+ @ include 'settings_head.php';
7
+ @ include 'discount.php';
8
+ ?>
9
  <div class="wrap">
10
  <form method="post" action="options.php">
11
  <?php
149
  <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
150
  </p>
151
  </form>
152
+ </div>
153
+ <?php
154
+ /*
155
  <h3>Receive more features and control with Paid version of the plugin:</h3>
156
  <ul>
157
  <li><b>- Filter by Attribute, Tag, Custom Taxonomy, Color, Sub-categories and Availability( in stock | out of stock | any )</b></li>
172
  <li><b>- Enhancements of the free features</b></li>
173
  </ul>
174
  <h4>Support the plugin by purchasing paid version. This will provide faster growth, better support and much more functionality for the plugin!</h4>
175
+ */
176
+ $feature_list = array(
177
+ 'Filter by Tag and Custom Taxonomy',
178
+ 'Nice URLs for SEO Friendly URLs',
179
+ 'Customization for text, checkbox, radio, slider and other elements',
180
+ 'Filters Can be Collapsed, Option to Collapse Filter on Start',
181
+ 'Shortcode Builder for Easy Shortcode Creation',
182
+ 'Optimization to Handle up to 5 000 Products Total',
183
+ 'Price Filter Custom Min and Max Values',
184
+ 'Option to Set Values for the Price Slider Manually',
185
+ 'Description for Widgets',
186
+ 'Support 99% of the Themes',
187
+ 'Selected Filters Area',
188
+ 'Reset button widget',
189
+ 'Search box widget',
190
+ 'Cache for Widgets',
191
+ 'Color and Image Type of Widgets',
192
+ 'Custom CSS Styles',
193
+ 'Filters Visibility by Pages',
194
+ 'Icons Before and After Title',
195
+ 'Icons Before and After Values',
196
+ 'Count of Products with Attribute Values',
197
+ 'Show amount of products before update',
198
+ 'Price as checkbox with min and max values',
199
+ );
200
+ @ include 'settings_footer.php';
201
+ ?>
templates/admin.php CHANGED
@@ -31,8 +31,9 @@
31
  <option <?php if ($instance['type'] == 'checkbox') echo 'selected'; ?> value="checkbox">Checkbox</option>
32
  <option <?php if ($instance['type'] == 'radio') echo 'selected'; ?> value="radio">Radio</option>
33
  <option <?php if ($instance['type'] == 'select') echo 'selected'; ?> value="select">Select</option>
34
- <?php } ?>
35
  <option <?php if ($instance['type'] == 'slider') echo 'selected'; ?> value="slider">Slider</option>
 
36
  </select>
37
  </label>
38
  </p>
31
  <option <?php if ($instance['type'] == 'checkbox') echo 'selected'; ?> value="checkbox">Checkbox</option>
32
  <option <?php if ($instance['type'] == 'radio') echo 'selected'; ?> value="radio">Radio</option>
33
  <option <?php if ($instance['type'] == 'select') echo 'selected'; ?> value="select">Select</option>
34
+ <?php } else { ?>
35
  <option <?php if ($instance['type'] == 'slider') echo 'selected'; ?> value="slider">Slider</option>
36
+ <?php } ?>
37
  </select>
38
  </label>
39
  </p>
templates/checkbox.php CHANGED
@@ -36,7 +36,16 @@ if ( @ $terms ):
36
  }
37
  }
38
  }
39
- ?> /><label for='checkbox_<?php echo $term->term_id ?>' class="berocket_label_widgets"> <?php echo $term->name ?></label>
 
 
 
 
 
 
 
 
 
40
  </span>
41
  </li>
42
  <?php
36
  }
37
  }
38
  }
39
+ ?> /><label for='checkbox_<?php echo $term->term_id ?>' class="berocket_label_widgets<?php
40
+ if( @ $_POST['terms'] ){
41
+ foreach( $_POST['terms'] as $p_term ){
42
+ if( @ $p_term[0] == $term->taxonomy and $term->term_id == @ $p_term[1] ){
43
+ echo ' berocket_checked';
44
+ break;
45
+ }
46
+ }
47
+ }
48
+ ?>"> <?php echo $term->name ?></label>
49
  </span>
50
  </li>
51
  <?php
templates/discount.php ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $start_time = 1490705082;
3
+ $end_time = 1493297082;
4
+ $price = '$7.00';
5
+ $discount = '70%';
6
+ $save_amount = '$15.00';
7
+ $dplugin_name = 'WooCommerce Min/Max Quantity';
8
+ $dplugin_link = 'http://berocket.com/product/woocommerce-minmax-quantity';
9
+ if ( time() > $start_time && time() < $end_time ) { ?>
10
+ <div class="discount-block-check"></div>
11
+ <div class="wrap discount-block">
12
+ <img src="<?php echo plugin_dir_url( __FILE__ ) ?>../images/70p_sale.jpg" />
13
+ <div>
14
+ <?php
15
+ $text = 'Only <strong>%price%</strong> for <strong>Premium</strong> %name% plugin!<br>
16
+ <span>Get your <strong class="red">%disc% discount</strong> and save <strong>%amount%</strong> today</span>
17
+ <a class="buy_button" href="%link%" target="_blank">Buy Now</a>';
18
+ $text = str_replace('%name%', $dplugin_name, $text);
19
+ $text = str_replace('%link%', $dplugin_link, $text);
20
+ $text = str_replace('%price%', $price, $text);
21
+ $text = str_replace('%disc%', $discount, $text);
22
+ $text = str_replace('%amount%', $save_amount, $text);
23
+ echo $text;
24
+ ?>
25
+ </div>
26
+ </div>
27
+ <script>
28
+ jQuery(window).scroll(function() {
29
+ var top = jQuery('.discount-block-check').offset().top - 32;
30
+
31
+ if( jQuery(window).width() <= 782 ) {
32
+ jQuery('.discount-block').removeClass('fixed');
33
+ jQuery('.discount-block-check').height(0);
34
+ } else {
35
+ if( jQuery(window).scrollTop() > top ) {
36
+ if( ! jQuery('.discount-block').is('.fixed') ) {
37
+ jQuery('.discount-block-check').height(jQuery('.discount-block').outerHeight(true));
38
+ jQuery('.discount-block').addClass('fixed');
39
+ }
40
+ } else {
41
+ if( jQuery('.discount-block').is('.fixed') ) {
42
+ jQuery('.discount-block-check').height(0);
43
+ jQuery('.discount-block').removeClass('fixed');
44
+ }
45
+ }
46
+ }
47
+ });
48
+ </script>
49
+ <style>
50
+ .discount-block-check {
51
+ margin: 0!important;
52
+ padding: 0!important;
53
+ }
54
+ .discount-block{
55
+ text-align: center;
56
+ background: #ffffff;
57
+ padding: 0;
58
+ font-size: 24px;
59
+ border: 2px solid #ef3542;
60
+ line-height: 1.8em;
61
+ }
62
+ .discount-block > img{
63
+ float: left;
64
+ max-height: 130px;
65
+ }
66
+ .discount-block > div{
67
+ padding: 20px;
68
+ height: 90px;
69
+ }
70
+ .discount-block.fixed{
71
+ position: fixed;
72
+ top: 32px;
73
+ left: 180px;
74
+ right: 0px;
75
+ }
76
+ .discount-block .buy_button {
77
+ font-size: 20px;
78
+ padding: 8px 30px;
79
+ color: #fff;
80
+ line-height: 28px;
81
+ font-weight: 600;
82
+ text-transform: uppercase;
83
+ display: inline-block;
84
+ text-align: center;
85
+ text-decoration: none;
86
+ background-color: #ef3542;
87
+ cursor: pointer;
88
+ }
89
+ .discount-block .buy_button:hover {
90
+ background-color: #F54C57;
91
+ }
92
+ .red {
93
+ color: #ef3542;
94
+ }
95
+ @media screen and (max-width: 1200px) {
96
+ .discount-block{
97
+ font-size: 20px;
98
+ }
99
+ }
100
+ @media screen and (max-width: 1100px) {
101
+ .discount-block{
102
+ font-size: 18px;
103
+ line-height: 1.5em;
104
+ }
105
+ }
106
+ @media screen and (max-width: 960px) {
107
+ .discount-block.fixed{
108
+ left: 56px;
109
+ }
110
+ }
111
+ @media screen and (max-width: 782px) {
112
+ .discount-block.fixed{
113
+ left: 10px;
114
+ }
115
+ }
116
+ @media screen and (max-width: 767px) {
117
+ .discount-block{
118
+ font-size: 16px;
119
+ line-height: 1.6em;
120
+ }
121
+ .discount-block > img{
122
+ max-height: 110px;
123
+ }
124
+ .discount-block > div{
125
+ padding: 10px;
126
+ height: 90px;
127
+ }
128
+ .discount-block .buy_button{
129
+ padding: 4px 15px;
130
+ margin-top: 2px;
131
+ }
132
+ }
133
+ @media screen and (max-width: 610px) {
134
+ .discount-block{
135
+ font-size: 14px;
136
+ line-height: 1.6em;
137
+ }
138
+ }
139
+ @media screen and (max-width: 570px) {
140
+ .discount-block > div > span{
141
+ display: none;
142
+ }
143
+ }
144
+ @media screen and (max-width: 400px) {
145
+ .discount-block .buy_button{
146
+ font-size: 16px;
147
+ padding: 2px 15px;
148
+ }
149
+ }
150
+ </style>
151
+ <?php } ?>
templates/radio.php CHANGED
@@ -27,7 +27,16 @@ if ( $terms ):
27
  }
28
  }
29
  }
30
- ?> /><label for='radio_<?php echo $term->term_id ?>' class="berocket_label_widgets"> <?php echo $term->name ?></label>
 
 
 
 
 
 
 
 
 
31
  </span>
32
  </li>
33
  <?php endforeach; ?>
27
  }
28
  }
29
  }
30
+ ?> /><label for='radio_<?php echo $term->term_id ?>' class="berocket_label_widgets<?php
31
+ if( @ $_POST['terms'] ){
32
+ foreach( $_POST['terms'] as $p_term ){
33
+ if( $p_term[0] == $term->taxonomy and $term->term_id == $p_term[1] ){
34
+ echo ' berocket_checked';
35
+ break;
36
+ }
37
+ }
38
+ }
39
+ ?>"> <?php echo $term->name ?></label>
40
  </span>
41
  </li>
42
  <?php endforeach; ?>
templates/settings_footer.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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%', @ $plugin_info['Name'], $text);
20
+ $text = str_replace('%plugin_link%', @ $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%', @ $plugin_info['Name'], $text);
31
+ $text = str_replace('%plugin_link%', @ $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 ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
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
@@ -1,16 +1,16 @@
1
  <?php
2
  /**
3
- * Plugin Name: Advanced AJAX Product Filters for WooCommerce
4
- * Plugin URI: http://berocket.com/wp-plugins/product-filters
5
- * Description: Advanced AJAX Product Filters for WooCommerce
6
- * Version: 1.1.5
7
  * Author: BeRocket
8
  * Author URI: http://berocket.com
9
  * Text Domain: BeRocket_AJAX_domain
10
  * Domain Path: /languages/
11
  */
12
 
13
- define( "BeRocket_AJAX_filters_version", '1.1.5' );
14
  define( "BeRocket_AJAX_domain", 'BeRocket_AJAX_domain' );
15
 
16
  define( "AAPF_TEMPLATE_PATH", plugin_dir_path( __FILE__ ) . "templates/" );
@@ -34,6 +34,11 @@ class BeRocket_AAPF {
34
  "filters_turn_off" => "0",
35
  "seo_friendly_urls" => "0"
36
  );
 
 
 
 
 
37
 
38
  function __construct(){
39
  register_activation_hook(__FILE__, array( __CLASS__, 'br_add_defaults' ) );
@@ -59,6 +64,9 @@ class BeRocket_AAPF {
59
  add_action( 'wp_footer', array( 'BeRocket_AAPF_Widget', 'end_clean'), 999999 );
60
  add_action( 'init', array( 'BeRocket_AAPF_Widget', 'start_clean'), 1 );
61
  }
 
 
 
62
  } else {
63
  if( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
64
  add_action( 'admin_notices', array( __CLASS__, 'update_woocommerce' ) );
@@ -67,6 +75,24 @@ class BeRocket_AAPF {
67
  }
68
  }
69
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  public static function init() {
72
 
@@ -133,6 +159,7 @@ class BeRocket_AAPF {
133
  wp_enqueue_style( 'berocket_aapf_widget-colorpicker-style' );
134
  wp_enqueue_style( 'berocket_aapf_widget-admin-style' );
135
 
 
136
  include AAPF_TEMPLATE_PATH . "admin-settings.php";
137
  }
138
 
@@ -143,7 +170,7 @@ class BeRocket_AAPF {
143
 
144
  if ( @ $_POST['price'] ) {
145
  list( $_GET['min_price'], $_GET['max_price'] ) = $_POST['price'];
146
- add_filter( 'loop_shop_post_in', array( 'WC_QUERY', 'price_filter' ) );
147
  }
148
  }
149
  }
@@ -157,7 +184,7 @@ class BeRocket_AAPF {
157
 
158
  if ( @ $_POST['price'] ) {
159
  list( $_GET['min_price'], $_GET['max_price'] ) = $_POST['price'];
160
- add_filter( 'loop_shop_post_in', array( 'WC_QUERY', 'price_filter' ) );
161
  }
162
 
163
  if ( @ $_POST['limits'] ) {
@@ -391,4 +418,4 @@ class BeRocket_AAPF {
391
  }
392
  }
393
 
394
- new BeRocket_AAPF;
1
  <?php
2
  /**
3
+ * Plugin Name: Advanced AJAX Product Filter for WooCommerce
4
+ * Plugin URI: https://wordpress.org/plugins/woocommerce-ajax-filters/
5
+ * Description: Take a look at this fantastic AJAX products filter plugin for WooCommerce. Add unlimited filters with one widget.
6
+ * Version: 1.1.8
7
  * Author: BeRocket
8
  * Author URI: http://berocket.com
9
  * Text Domain: BeRocket_AJAX_domain
10
  * Domain Path: /languages/
11
  */
12
 
13
+ define( "BeRocket_AJAX_filters_version", '1.1.8' );
14
  define( "BeRocket_AJAX_domain", 'BeRocket_AJAX_domain' );
15
 
16
  define( "AAPF_TEMPLATE_PATH", plugin_dir_path( __FILE__ ) . "templates/" );
34
  "filters_turn_off" => "0",
35
  "seo_friendly_urls" => "0"
36
  );
37
+ public static $values = array(
38
+ 'settings_name' => '',
39
+ 'option_page' => 'br-product-filters',
40
+ 'premium_slug' => 'woocommerce-ajax-products-filter',
41
+ );
42
 
43
  function __construct(){
44
  register_activation_hook(__FILE__, array( __CLASS__, 'br_add_defaults' ) );
64
  add_action( 'wp_footer', array( 'BeRocket_AAPF_Widget', 'end_clean'), 999999 );
65
  add_action( 'init', array( 'BeRocket_AAPF_Widget', 'start_clean'), 1 );
66
  }
67
+ add_filter( 'plugin_row_meta', array( __CLASS__, 'plugin_row_meta' ), 10, 2 );
68
+ $plugin_base_slug = plugin_basename( __FILE__ );
69
+ add_filter( 'plugin_action_links_' . $plugin_base_slug, array( __CLASS__, 'plugin_action_links' ) );
70
  } else {
71
  if( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
72
  add_action( 'admin_notices', array( __CLASS__, 'update_woocommerce' ) );
75
  }
76
  }
77
  }
78
+ public static function plugin_action_links($links) {
79
+ $action_links = array(
80
+ 'settings' => '<a href="' . admin_url( 'admin.php?page='.self::$values['option_page'] ) . '" title="' . __( 'View Plugin Settings', 'BeRocket_products_label_domain' ) . '">' . __( 'Settings', 'BeRocket_products_label_domain' ) . '</a>',
81
+ );
82
+ return array_merge( $action_links, $links );
83
+ }
84
+ public static function plugin_row_meta($links, $file) {
85
+ $plugin_base_slug = plugin_basename( __FILE__ );
86
+ if ( $file == $plugin_base_slug ) {
87
+ $row_meta = array(
88
+ 'docs' => '<a href="http://berocket.com/docs/plugin/'.self::$values['premium_slug'].'" title="' . __( 'View Plugin Documentation', 'BeRocket_products_label_domain' ) . '" target="_blank">' . __( 'Docs', 'BeRocket_products_label_domain' ) . '</a>',
89
+ 'premium' => '<a href="http://berocket.com/product/'.self::$values['premium_slug'].'" title="' . __( 'View Premium Version Page', 'BeRocket_products_label_domain' ) . '" target="_blank">' . __( 'Premium Version', 'BeRocket_products_label_domain' ) . '</a>',
90
+ );
91
+
92
+ return array_merge( $links, $row_meta );
93
+ }
94
+ return (array) $links;
95
+ }
96
 
97
  public static function init() {
98
 
159
  wp_enqueue_style( 'berocket_aapf_widget-colorpicker-style' );
160
  wp_enqueue_style( 'berocket_aapf_widget-admin-style' );
161
 
162
+ $plugin_info = get_plugin_data(__FILE__, false, true);
163
  include AAPF_TEMPLATE_PATH . "admin-settings.php";
164
  }
165
 
170
 
171
  if ( @ $_POST['price'] ) {
172
  list( $_GET['min_price'], $_GET['max_price'] ) = $_POST['price'];
173
+ add_filter( 'loop_shop_post_in', array( __CLASS__, 'price_filter' ) );
174
  }
175
  }
176
  }
184
 
185
  if ( @ $_POST['price'] ) {
186
  list( $_GET['min_price'], $_GET['max_price'] ) = $_POST['price'];
187
+ add_filter( 'loop_shop_post_in', array( __CLASS__, 'price_filter' ) );
188
  }
189
 
190
  if ( @ $_POST['limits'] ) {
418
  }
419
  }
420
 
421
+ new BeRocket_AAPF;
wpml-config.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <wpml-config>
2
+ <admin-texts>
3
+ <key name="br_filters_options">
4
+ <key name="no_products_message" />
5
+ <key name="ub_product_text" />
6
+ <key name="ub_product_button_text" />
7
+ <key name="ajax_load_text">
8
+ <key name="top" />
9
+ <key name="bottom" />
10
+ <key name="left" />
11
+ <key name="right" />
12
+ </key>
13
+ </key>
14
+ </admin-texts>
15
+ <shortcodes>
16
+ <shortcode>
17
+ <tag>br_filters</tag>
18
+ <attributes>
19
+ <attribute>title</attribute>
20
+ </attributes>
21
+ </shortcode>
22
+ </shortcodes>
23
+ </wpml-config>