Advanced AJAX Product Filters - Version 1.2.6

Version Description

  • Upgrade - better plugin menu items location
  • Upgrade - Categories filter
  • Upgrade - Reset filters button
  • Upgrade - Values order
  • Upgrade - Custom CSS
  • Upgrade - Option to hide widget on mobile
Download this release

Release Info

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

Code changes from version 1.2.5 to 1.2.6

css/widget.css CHANGED
@@ -264,4 +264,9 @@ span.product-size{
264
  }
265
  .ui-slider-vertical .ui-slider-range-max {
266
  top: 0;
267
- }
 
 
 
 
 
264
  }
265
  .ui-slider-vertical .ui-slider-range-max {
266
  top: 0;
267
+ }
268
+ @media only screen and (max-device-width: 768px) {
269
+ .berocket_aapf_hide_mobile {
270
+ display: none !important;
271
+ }
272
+ }
images/44p_sale.jpg ADDED
Binary file
includes/admin_notices.php CHANGED
@@ -289,7 +289,13 @@ if( ! class_exists( 'berocket_admin_notices' ) ) {
289
  $notice = self::get_not_closed_notice($item, $end_soon, $closed, $count - 1);
290
  }
291
  } else {
292
- if( $item['closed'] <= $closed && ( ! self::$subscribed || ! $item['subscribe'] ) && ($item['start'] == 0 || $item['start'] < $time) && ($item['end'] == 0 || $item['end'] > $time) ) {
 
 
 
 
 
 
293
  return $item;
294
  }
295
  }
@@ -311,10 +317,13 @@ if( ! class_exists( 'berocket_admin_notices' ) ) {
311
  $notice = self::get_notices_with_priority($item, $priority, $count - 1);
312
  $notices = array_merge($notices, $notice);
313
  } else {
314
- if( ! self::$subscribed || ! $item['subscribe'] ) {
315
- if( $item['priority'] <= 5 || ! $item['closed'] ) {
316
- $notices[] = $item;
317
- }
 
 
 
318
  }
319
  }
320
  }
@@ -383,7 +392,7 @@ if( ! class_exists( 'berocket_admin_notices' ) ) {
383
  }
384
  $notice['righthtml'] =
385
  '<form class="berocket_subscribe_form" method="POST" action="' . admin_url( 'admin-ajax.php' ) . '">
386
- <input type="hidden" name="action" value="berocket_subscribe_email">
387
  <input class="berocket_subscribe_email" type="email" name="email" value="' . $user_email . '">
388
  <input type="submit" class="button-primary button berocket_notice_submit" value="Subscribe">
389
  </form>' . $notice['righthtml'];
@@ -534,8 +543,7 @@ if( ! class_exists( 'berocket_admin_notices' ) ) {
534
  jQuery(document).on("click", ".berocket_admin_notice.berocket_admin_notice_', self::$notice_index, ' .berocket_no_thanks", function(event){
535
  event.preventDefault();
536
  var notice = jQuery(this).parents(".berocket_admin_notice.berocket_admin_notice_', self::$notice_index, '").data("notice");
537
- console.log(notice);
538
- jQuery.post(ajaxurl, {action:"berocket_admin_close_notice", notice:notice}, function(data){console.log(data)});
539
  jQuery(this).parents(".berocket_admin_notice.berocket_admin_notice_', self::$notice_index, '").hide();
540
  });
541
  });';
@@ -653,11 +661,12 @@ if( ! class_exists( 'berocket_admin_notices' ) ) {
653
  berocket_email_submited = true;
654
  if( $this.is("form") ) {
655
  var data = $this.serialize();
 
656
  } else {
657
  if( jQuery(".berocket_plugin_id_subscribe").length ) {
658
- var data = {email:email, action: $this.find("[name=\'action\']").val(), plugin:jQuery(".berocket_plugin_id_subscribe").val()};
659
  } else {
660
- var data = {email:email, action: $this.find("[name=\'action\']").val()};
661
  }
662
  }
663
  var url = $this.attr("action");
@@ -716,7 +725,7 @@ if( ! class_exists( 'berocket_admin_notices' ) ) {
716
  } else {
717
  $current_notice['closed'] = 1;
718
  }
719
- if( ! empty($current_notice['repeat']) && ! empty($current_notice['repeatcount']) && ( ! self::$subscribed || ! $current_notice['subscribe'] ) ) {
720
  $new_notice = $current_notice;
721
  if( empty($current_notice['original']) ) {
722
  $new_notice['original'] = $find_names;
289
  $notice = self::get_not_closed_notice($item, $end_soon, $closed, $count - 1);
290
  }
291
  } else {
292
+ $display_notice = ( $item['closed'] <= $closed && ( ! self::$subscribed || ! $item['subscribe'] ) && ($item['start'] == 0 || $item['start'] < $time) && ($item['end'] == 0 || $item['end'] > $time) );
293
+ $display_notice = apply_filters( 'berocket_admin_notice_is_display_notice', $display_notice, $item, array(
294
+ 'subscribed' => self::$subscribed,
295
+ 'end_soon' => $end_soon,
296
+ 'closed' => $closed,
297
+ ) );
298
+ if( $display_notice ) {
299
  return $item;
300
  }
301
  }
317
  $notice = self::get_notices_with_priority($item, $priority, $count - 1);
318
  $notices = array_merge($notices, $notice);
319
  } else {
320
+ $display_notice = ( (!self::$subscribed || ! $item['subscribe']) && ($item['priority'] <= 5 || !$item['closed']) );
321
+ $display_notice = apply_filters( 'berocket_admin_notice_is_display_notice_priority', $display_notice, $item, array(
322
+ 'subscribed' => self::$subscribed,
323
+ 'priority' => $priority,
324
+ ) );
325
+ if( $display_notice ) {
326
+ $notices[] = $item;
327
  }
328
  }
329
  }
392
  }
393
  $notice['righthtml'] =
394
  '<form class="berocket_subscribe_form" method="POST" action="' . admin_url( 'admin-ajax.php' ) . '">
395
+ <input type="hidden" name="berocket_action" value="berocket_subscribe_email">
396
  <input class="berocket_subscribe_email" type="email" name="email" value="' . $user_email . '">
397
  <input type="submit" class="button-primary button berocket_notice_submit" value="Subscribe">
398
  </form>' . $notice['righthtml'];
543
  jQuery(document).on("click", ".berocket_admin_notice.berocket_admin_notice_', self::$notice_index, ' .berocket_no_thanks", function(event){
544
  event.preventDefault();
545
  var notice = jQuery(this).parents(".berocket_admin_notice.berocket_admin_notice_', self::$notice_index, '").data("notice");
546
+ jQuery.post(ajaxurl, {action:"berocket_admin_close_notice", notice:notice}, function(data){});
 
547
  jQuery(this).parents(".berocket_admin_notice.berocket_admin_notice_', self::$notice_index, '").hide();
548
  });
549
  });';
661
  berocket_email_submited = true;
662
  if( $this.is("form") ) {
663
  var data = $this.serialize();
664
+ data = data+"&action="+$this.find("[name=\'berocket_action\']").val();
665
  } else {
666
  if( jQuery(".berocket_plugin_id_subscribe").length ) {
667
+ var data = {email:email, action: $this.find("[name=\'berocket_action\']").val(), plugin:jQuery(".berocket_plugin_id_subscribe").val()};
668
  } else {
669
+ var data = {email:email, action: $this.find("[name=\'berocket_action\']").val()};
670
  }
671
  }
672
  var url = $this.attr("action");
725
  } else {
726
  $current_notice['closed'] = 1;
727
  }
728
+ if( $current_notice['closed'] < 2 && ! empty($current_notice['repeat']) && ! empty($current_notice['repeatcount']) && ( ! self::$subscribed || ! $current_notice['subscribe'] ) ) {
729
  $new_notice = $current_notice;
730
  if( empty($current_notice['original']) ) {
731
  $new_notice['original'] = $find_names;
includes/functions.php CHANGED
@@ -176,7 +176,6 @@ if( ! function_exists( 'br_aapf_args_parser' ) ){
176
  }
177
  }
178
  unset( $attributes );
179
-
180
  if ( ! empty($_POST['terms']) ) {
181
  foreach ( $_POST['terms'] as $t ) {
182
  if( !isset($taxonomies[ $t[0] ]) ){
@@ -198,15 +197,25 @@ if( ! function_exists( 'br_aapf_args_parser' ) ){
198
  if ( $taxonomies_operator[ $k ] == 'AND' ) {
199
  $op = 'AND';
200
  } else {
201
- $op = 'IN';
202
  }
203
 
204
- $tax_query[] = array(
205
- 'taxonomy' => $k,
206
- 'field' => 'slug',
207
- 'terms' => $v,
208
- 'operator' => $op
209
- );
 
 
 
 
 
 
 
 
 
 
210
  }
211
  }
212
  }
@@ -235,6 +244,8 @@ if( ! function_exists( 'br_aapf_args_converter' ) ) {
235
  * convert args-url to normal filters
236
  */
237
  function br_aapf_args_converter() {
 
 
238
  if ( preg_match( "~\|~", $_GET['filters'] ) ) {
239
  $filters = explode( "|", $_GET['filters'] );
240
  } else {
176
  }
177
  }
178
  unset( $attributes );
 
179
  if ( ! empty($_POST['terms']) ) {
180
  foreach ( $_POST['terms'] as $t ) {
181
  if( !isset($taxonomies[ $t[0] ]) ){
197
  if ( $taxonomies_operator[ $k ] == 'AND' ) {
198
  $op = 'AND';
199
  } else {
200
+ $op = 'OR';
201
  }
202
 
203
+ $fields = 'id';
204
+ $current_tax_query = array();
205
+ $current_tax_query['relation'] = $op;
206
+ $include_children = false;
207
+ if( $k == 'product_cat' ) {
208
+ $include_children = true;
209
+ }
210
+ foreach($v as $v_i) {
211
+ $current_tax_query[] = apply_filters('berocket_aapf_tax_query_attribute', array(
212
+ 'taxonomy' => $k,
213
+ 'field' => 'slug',
214
+ 'terms' => $v_i,
215
+ 'operator' => 'IN'
216
+ ));
217
+ }
218
+ $tax_query[] = $current_tax_query;
219
  }
220
  }
221
  }
244
  * convert args-url to normal filters
245
  */
246
  function br_aapf_args_converter() {
247
+ $_POST['terms'] = array();
248
+ $_POST['limits'] = array();
249
  if ( preg_match( "~\|~", $_GET['filters'] ) ) {
250
  $filters = explode( "|", $_GET['filters'] );
251
  } else {
includes/widget.php CHANGED
@@ -122,6 +122,7 @@ class BeRocket_AAPF_Widget extends WP_Widget {
122
  unset( $args );
123
  unset( $instance );
124
 
 
125
  if ( $widget_type == 'update_button' ) {
126
  set_query_var( 'title', apply_filters( 'berocket_aapf_widget_title', $title ) );
127
  echo $before_widget;
@@ -129,7 +130,13 @@ class BeRocket_AAPF_Widget extends WP_Widget {
129
  echo $after_widget;
130
  return '';
131
  }
132
-
 
 
 
 
 
 
133
  $product_cat = @ json_decode( $product_cat );
134
 
135
  if ( $product_cat ) {
@@ -180,20 +187,18 @@ class BeRocket_AAPF_Widget extends WP_Widget {
180
 
181
  if ( empty($terms) || ! is_array($terms) || count( $terms ) < 1 ) return false;
182
 
183
- if ( $wc_order_by == 'menu_order' ) {
184
  foreach ( $terms as $term ) {
185
  $sort_array[] = get_woocommerce_term_meta( $term->term_id, 'order_' . $attribute );
186
  }
187
- array_multisort( $sort_array, $terms );
188
- } elseif ( $wc_order_by == 'name' or $wc_order_by == 'name_num' ) {
189
- foreach ( $terms as $term ) {
190
- $sort_array[] = $term->name;
191
- }
192
- $sort_as = SORT_STRING;
193
- if ( $wc_order_by == 'name_num' ) {
194
- $sort_as = SORT_NUMERIC;
195
- }
196
- array_multisort( $sort_array, $terms, SORT_ASC, $sort_as );
197
  }
198
 
199
  set_query_var( 'terms', apply_filters( 'berocket_aapf_widget_terms', $terms ) );
@@ -621,6 +626,9 @@ class BeRocket_AAPF_Widget extends WP_Widget {
621
  $instance['css_class'] = strip_tags( $new_instance['css_class'] );
622
  $instance['text_before_price'] = strip_tags( $new_instance['text_before_price'] );
623
  $instance['text_after_price'] = strip_tags( $new_instance['text_after_price'] );
 
 
 
624
 
625
  if( $new_instance['height'] != 'auto' ) $new_instance['height'] = (float) $new_instance['height'];
626
  if( !$new_instance['height'] ) $new_instance['height'] = 'auto';
@@ -907,4 +915,36 @@ class BeRocket_AAPF_Widget extends WP_Widget {
907
  else
908
  return esc_url_raw( $result );
909
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
910
  }
122
  unset( $args );
123
  unset( $instance );
124
 
125
+ set_query_var( 'is_hide_mobile', ( empty($is_hide_mobile) ? '' : $is_hide_mobile ) );
126
  if ( $widget_type == 'update_button' ) {
127
  set_query_var( 'title', apply_filters( 'berocket_aapf_widget_title', $title ) );
128
  echo $before_widget;
130
  echo $after_widget;
131
  return '';
132
  }
133
+ if ( ! empty($widget_type) && $widget_type == 'reset_button' ) {
134
+ set_query_var( 'title', apply_filters( 'berocket_aapf_widget_title', $title ) );
135
+ echo $before_widget;
136
+ br_get_template_part( 'widget_reset_button' );
137
+ echo $after_widget;
138
+ return '';
139
+ }
140
  $product_cat = @ json_decode( $product_cat );
141
 
142
  if ( $product_cat ) {
187
 
188
  if ( empty($terms) || ! is_array($terms) || count( $terms ) < 1 ) return false;
189
 
190
+ if ( $wc_order_by == 'menu_order' and (empty($order_values_by) or $order_values_by == 'Default') ) {
191
  foreach ( $terms as $term ) {
192
  $sort_array[] = get_woocommerce_term_meta( $term->term_id, 'order_' . $attribute );
193
  }
194
+ array_multisort( $sort_array, (empty($order_values_type) || $order_values_type == 'asc' ? SORT_ASC : SORT_DESC), $terms );
195
+ } else {
196
+ self::sort_terms( $terms, array(
197
+ "wc_order_by" => $wc_order_by,
198
+ "attribute" => $attribute,
199
+ "order_values_by" => (empty($order_values_by) ? 'Default' : $order_values_by),
200
+ "order_values_type"=> (empty($order_values_type) || $order_values_type == 'asc' ? SORT_ASC : SORT_DESC)
201
+ ) );
 
 
202
  }
203
 
204
  set_query_var( 'terms', apply_filters( 'berocket_aapf_widget_terms', $terms ) );
626
  $instance['css_class'] = strip_tags( $new_instance['css_class'] );
627
  $instance['text_before_price'] = strip_tags( $new_instance['text_before_price'] );
628
  $instance['text_after_price'] = strip_tags( $new_instance['text_after_price'] );
629
+ $instance['order_values_by'] = strip_tags( $new_instance['order_values_by'] );
630
+ $instance['order_values_type'] = strip_tags( $new_instance['order_values_type'] );
631
+ $instance['is_hide_mobile'] = ! empty($new_instance['is_hide_mobile'] );
632
 
633
  if( $new_instance['height'] != 'auto' ) $new_instance['height'] = (float) $new_instance['height'];
634
  if( !$new_instance['height'] ) $new_instance['height'] = 'auto';
915
  else
916
  return esc_url_raw( $result );
917
  }
918
+
919
+ public static function sort_terms( &$terms, $sort_data ) {
920
+ $sort_array = array();
921
+ if ( ! empty($terms) && is_array( $terms ) && count( $terms ) ) {
922
+ if ( ! empty($sort_data['attribute']) and $sort_data['attribute'] == 'product_cat' and ! empty($sort_data['order_values_by']) and $sort_data['order_values_by'] == 'Default' ) {
923
+ foreach ( $terms as $term ) {
924
+ $element_of_sort = get_woocommerce_term_meta( $term->term_id, 'order', true );
925
+ if( is_array($element_of_sort) || $element_of_sort === false ) {
926
+ $sort_array[] = 0;
927
+ } else {
928
+ $sort_array[] = $element_of_sort;
929
+ }
930
+ if ( ! empty($term->child) ) {
931
+ self::sort_terms( $term->child, $sort_data );
932
+ }
933
+ }
934
+ @ array_multisort( $sort_array, $sort_data['order_values_type'], SORT_NUMERIC, $terms );
935
+ } elseif ( ! empty($sort_data['wc_order_by']) or ! empty($sort_data['order_values_by']) ) {
936
+ if ( ! empty($sort_data['order_values_by']) and ( ( ! empty($sort_data['wc_order_by']) and $sort_data['wc_order_by'] == 'name' and $sort_data['order_values_by'] == 'Default' ) or $sort_data['order_values_by'] == 'Alpha' ) ) {
937
+ foreach ( $terms as $term ) {
938
+ $sort_array[] = strtolower($term->name);
939
+ }
940
+ @ array_multisort( $sort_array, $sort_data['order_values_type'], SORT_STRING, $terms );
941
+ } elseif ( ! empty($sort_data['order_values_by']) and ( ( ! empty($sort_data['wc_order_by']) and $sort_data['wc_order_by'] == 'name_num' and $sort_data['order_values_by'] == 'Default' ) or $sort_data['order_values_by'] == 'Numeric' ) ) {
942
+ foreach ( $terms as $term ) {
943
+ $sort_array[] = (float)preg_replace('/\s+/', '', str_replace(',', '.', $term->name));
944
+ }
945
+ @ array_multisort( $sort_array, $sort_data['order_values_type'], SORT_NUMERIC, $terms );
946
+ }
947
+ }
948
+ }
949
+ }
950
  }
js/admin.js CHANGED
@@ -5,11 +5,11 @@
5
  $parent = $(this).parents('form');
6
  if ($(this).val() == 'price') {
7
  $('.berocket_aapf_widget_admin_type_select', $parent).html('<option value="slider">Slider</option>');
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
  }
15
  $('.berocket_aapf_widget_admin_type_select', $parent).trigger('change');
@@ -64,6 +64,8 @@
64
  $('.berocket_aapf_admin_filter_widget_content', $parent).show();
65
  } else if( $(this).val() == 'update_button' ) {
66
  $('.berocket_aapf_admin_filter_widget_content', $parent).hide();
 
 
67
  } else if( $(this).val() == 'selected_area' ) {
68
  $('.berocket_aapf_admin_filter_widget_content', $parent).hide();
69
  }
5
  $parent = $(this).parents('form');
6
  if ($(this).val() == 'price') {
7
  $('.berocket_aapf_widget_admin_type_select', $parent).html('<option value="slider">Slider</option>');
8
+ $('.berocket_aapf_widget_admin_operator_select', $parent).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().parent().show(0);
13
  $('.berocket_aapf_widget_admin_price_attribute', $parent).hide(0);
14
  }
15
  $('.berocket_aapf_widget_admin_type_select', $parent).trigger('change');
64
  $('.berocket_aapf_admin_filter_widget_content', $parent).show();
65
  } else if( $(this).val() == 'update_button' ) {
66
  $('.berocket_aapf_admin_filter_widget_content', $parent).hide();
67
+ } else if( $(this).val() == 'reset_button' ) {
68
+ $('.berocket_aapf_admin_filter_widget_content', $parent).hide();
69
  } else if( $(this).val() == 'selected_area' ) {
70
  $('.berocket_aapf_admin_filter_widget_content', $parent).hide();
71
  }
js/widget.min.js CHANGED
@@ -266,6 +266,9 @@
266
  new_args = args;
267
  }
268
  var send_type = the_ajax_script.use_request_method;
 
 
 
269
  var berocket_this_ajax_request = berocket_last_ajax_request = $[send_type](url, new_args, function (data) {
270
  berocket_last_ajax_request = null;
271
  berocket_last_ajax_request_id = 1;
@@ -753,6 +756,14 @@
753
  location.reload();
754
  }
755
  };
 
 
 
 
 
 
 
 
756
  });
757
  })(jQuery);
758
 
266
  new_args = args;
267
  }
268
  var send_type = the_ajax_script.use_request_method;
269
+ if( send_type != 'get' && send_type != 'post' ) {
270
+ send_type = 'post';
271
+ }
272
  var berocket_this_ajax_request = berocket_last_ajax_request = $[send_type](url, new_args, function (data) {
273
  berocket_last_ajax_request = null;
274
  berocket_last_ajax_request_id = 1;
756
  location.reload();
757
  }
758
  };
759
+ $(document).on('click', '.berocket_aapf_reset_button', function(event) {
760
+ event.preventDefault();
761
+ $('.berocket_aapf_widget select').val('');
762
+ $('.berocket_aapf_widget input[type=checkbox], .berocket_aapf_widget input[type=radio]').each(function() {
763
+ $(this).prop('checked', false);
764
+ });
765
+ updateProducts();
766
+ });
767
  });
768
  })(jQuery);
769
 
readme.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: dholovnia, berocket
4
  Donate link: http://berocket.com/product/woocommerce-ajax-products-filter
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: 4.9.5
8
- Stable tag: 1.2.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -16,12 +16,6 @@ WooCommerce AJAX Product Filters - Advanced product filtering ability for your W
16
  WooCommerce AJAX Product Filters - Advanced product filtering ability for your WooCommerce shop. Add unlimited filters with one widget.
17
 
18
  = &#128226; BeRocket Promotions - Summer Sale &#127774; : =
19
- *21/06 - 30/06*
20
- &#127775; [Premium WooCommerce Advanced Product Labels – Save $20](https://berocket.com/product/woocommerce-advanced-product-labels)
21
-
22
- *1/07 - 10/07*
23
- &#128181; [Premium WooCommerce Min/Max Quantity – Save $20](https://berocket.com/product/woocommerce-minmax-quantity)
24
-
25
  *11/07 - 20/07*
26
  &#128181; [Premium WooCommerce Load More Products – Save $20](https://berocket.com/product/woocommerce-load-more-products)
27
 
@@ -195,6 +189,14 @@ You can try this plugin's admin side [here](http://berocket.com/product/woocomme
195
 
196
  == Changelog ==
197
 
 
 
 
 
 
 
 
 
198
  = 1.2.5 =
199
  * Enhancement - Product categories filtering
200
  * Enhancement - Select2 script for dropdown menu in filters
4
  Donate link: http://berocket.com/product/woocommerce-ajax-products-filter
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: 4.9.6
8
+ Stable tag: 1.2.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
16
  WooCommerce AJAX Product Filters - Advanced product filtering ability for your WooCommerce shop. Add unlimited filters with one widget.
17
 
18
  = &#128226; BeRocket Promotions - Summer Sale &#127774; : =
 
 
 
 
 
 
19
  *11/07 - 20/07*
20
  &#128181; [Premium WooCommerce Load More Products – Save $20](https://berocket.com/product/woocommerce-load-more-products)
21
 
189
 
190
  == Changelog ==
191
 
192
+ = 1.2.6 =
193
+ * Upgrade - better plugin menu items location
194
+ * Upgrade - Categories filter
195
+ * Upgrade - Reset filters button
196
+ * Upgrade - Values order
197
+ * Upgrade - Custom CSS
198
+ * Upgrade - Option to hide widget on mobile
199
+
200
  = 1.2.5 =
201
  * Enhancement - Product categories filtering
202
  * Enhancement - Select2 script for dropdown menu in filters
templates/admin-settings.php CHANGED
@@ -12,10 +12,12 @@ $dplugin_desc = '';
12
  <?php
13
  settings_fields('br_filters_plugin_options');
14
  $options = get_option('br_filters_options');
15
- $tabs_array = array( 'general', 'design', 'javascript', 'customcss' );
16
  ?>
17
  <h2 class="nav-tab-wrapper filter_settings_tabs">
18
  <a href="#general" class="nav-tab <?php if(@$options['br_opened_tab'] == 'general' || !in_array( @$options['br_opened_tab'], $tabs_array ) ) echo 'nav-tab-active'; ?>"><?php _e('General', 'BeRocket_AJAX_domain') ?></a>
 
 
19
  <a href="#design" class="nav-tab <?php if(@$options['br_opened_tab'] == 'design' ) echo 'nav-tab-active'; ?>"><?php _e('Design', 'BeRocket_AJAX_domain') ?></a>
20
  <a href="#javascript" class="nav-tab <?php if(@$options['br_opened_tab'] == 'javascript' ) echo 'nav-tab-active'; ?>"><?php _e('JavaScript', 'BeRocket_AJAX_domain') ?></a>
21
  <a href="#customcss" class="nav-tab <?php if(@$options['br_opened_tab'] == 'customcss' ) echo 'nav-tab-active'; ?>"><?php _e('Custom CSS', 'BeRocket_AJAX_domain') ?></a>
@@ -40,13 +42,54 @@ $dplugin_desc = '';
40
  </td>
41
  </tr>
42
  <tr>
43
- <th scope="row"><?php _e('"No Products" class', 'BeRocket_AJAX_domain') ?></th>
44
  <td>
45
- <input name="br_filters_options[no_products_class]" type='text' value='<?php echo @$options['no_products_class']?>'/>
46
- <br />
47
- <span style="color:#666666;margin-left:2px;"><?php _e('Add class and use it to style "No Products" box', 'BeRocket_AJAX_domain') ?></span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  </td>
49
  </tr>
 
 
 
 
50
  <tr>
51
  <th scope="row"><?php _e('Get selectors automatically (BETA)', 'BeRocket_AJAX_domain') ?></th>
52
  <td>
@@ -88,18 +131,16 @@ $dplugin_desc = '';
88
  <span style="color:#666666;margin-left:2px;"><?php _e("Selector for tag that is holding products. Don't change this if you don't know what it is", 'BeRocket_AJAX_domain') ?></span>
89
  </td>
90
  </tr>
 
 
 
 
91
  <tr>
92
- <th scope="row"><?php _e('Sorting control', 'BeRocket_AJAX_domain') ?></th>
93
- <td>
94
- <input name="br_filters_options[control_sorting]" type='checkbox' value='1' <?php if( @$options['control_sorting'] ) echo "checked='checked'";?>/>
95
- <span style="color:#666666;margin-left:2px;"><?php _e("Take control over WooCommerce's sorting selectbox?", 'BeRocket_AJAX_domain') ?></span>
96
- </td>
97
- </tr>
98
- <tr>
99
- <th scope="row"><?php _e('SEO friendly urls', 'BeRocket_AJAX_domain') ?></th>
100
  <td>
101
- <input name="br_filters_options[seo_friendly_urls]" type='checkbox' value='1' <?php if( @$options['seo_friendly_urls'] ) echo "checked='checked'";?>/>
102
- <span style="color:#666666;margin-left:2px;"><?php _e('If this option is on url will be changed when filter is selected/changed', 'BeRocket_AJAX_domain') ?></span>
 
103
  </td>
104
  </tr>
105
  <tr>
@@ -116,37 +157,6 @@ $dplugin_desc = '';
116
  <span style="color:#666666;margin-left:2px;"><?php _e('Check if you want to show not used attribute values too', 'BeRocket_AJAX_domain') ?></span>
117
  </td>
118
  </tr>
119
- <tr>
120
- <th scope="row"><?php _e('Hide values', 'BeRocket_AJAX_domain') ?></th>
121
- <td>
122
- <input name="br_filters_options[hide_value][o]" type='checkbox' value='1' <?php if( @$options['hide_value']['o'] ) echo "checked='checked'";?>/>
123
- <span style="color:#666666;margin-left:2px;"><?php _e('Hide values without products', 'BeRocket_AJAX_domain') ?></span><br>
124
- <input name="br_filters_options[hide_value][sel]" type='checkbox' value='1' <?php if( @$options['hide_value']['sel'] ) echo "checked='checked'";?>/>
125
- <span style="color:#666666;margin-left:2px;"><?php _e('Hide selected values', 'BeRocket_AJAX_domain') ?></span>
126
- </td>
127
- <td>
128
- </tr>
129
- <tr>
130
- <th scope="row"><?php _e('Jump to first page', 'BeRocket_AJAX_domain') ?></th>
131
- <td>
132
- <input name="br_filters_options[first_page_jump]" type='checkbox' value='1' <?php if( @$options['first_page_jump'] ) echo "checked='checked'";?>/>
133
- <span style="color:#666666;margin-left:2px;"><?php _e('Check if you want load first page after filters change', 'BeRocket_AJAX_domain') ?></span>
134
- </td>
135
- </tr>
136
- <tr>
137
- <th scope="row">Scroll page to the top</th>
138
- <td>
139
- <input name="br_filters_options[scroll_shop_top]" type='checkbox' value='1' <?php if( @$options['scroll_shop_top'] ) echo "checked='checked'";?>/>
140
- <span style="color:#666666;margin-left:2px;">Check if you want scroll page to the top of shop after filters change</span>
141
- </td>
142
- </tr>
143
- <tr>
144
- <th scope="row"><?php _e('Select2', 'BeRocket_AJAX_domain') ?></th>
145
- <td>
146
- <input name="br_filters_options[use_select2]" type='checkbox' value='1' <?php if( ! empty($options['use_select2']) ) echo "checked='checked'";?>/>
147
- <span style="color:#666666;margin-left:2px;"><?php _e('Use Select2 script for dropdown menu', 'BeRocket_AJAX_domain') ?></span>
148
- </td>
149
- </tr>
150
  <tr>
151
  <th scope="row"><?php _e('Template ajax load fix', 'BeRocket_AJAX_domain') ?></th>
152
  <td>
@@ -157,7 +167,7 @@ $dplugin_desc = '';
157
  <span style="color:#666666;margin-left:2px;"><?php _e('Use GET query instead POST for filtering', 'BeRocket_AJAX_domain') ?></span>
158
  <script>
159
  jQuery(document).on('change', '.load_fix_ajax_request_load', function() {
160
- if( $(this).prop('checked') ) {
161
  jQuery('.load_fix_use_get_query').show();
162
  } else {
163
  jQuery('.load_fix_use_get_query').hide();
@@ -219,9 +229,87 @@ $dplugin_desc = '';
219
  </table>
220
  </div>
221
  <div id="customcss" class="tab-item <?php if(@$options['br_opened_tab'] == 'customcss' ) echo 'current'; ?>">
222
- <a href="http://berocket.com/product/woocommerce-ajax-products-filter" target="_blank">
223
- <img src="<?php echo AAPF_URL; ?>images/paid/custom_css.png" style="max-width: 100%;" />
224
- </a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  <input type="hidden" id="br_opened_tab" name="br_filters_options[br_opened_tab]" value="<?php echo @$options['br_opened_tab'] ?>">
226
  </div>
227
  <p class="submit">
12
  <?php
13
  settings_fields('br_filters_plugin_options');
14
  $options = get_option('br_filters_options');
15
+ $tabs_array = array( 'general', 'selectors', 'advanced', 'design', 'javascript', 'customcss' );
16
  ?>
17
  <h2 class="nav-tab-wrapper filter_settings_tabs">
18
  <a href="#general" class="nav-tab <?php if(@$options['br_opened_tab'] == 'general' || !in_array( @$options['br_opened_tab'], $tabs_array ) ) echo 'nav-tab-active'; ?>"><?php _e('General', 'BeRocket_AJAX_domain') ?></a>
19
+ <a href="#selectors" class="nav-tab <?php if(@$options['br_opened_tab'] == 'selectors' ) echo 'nav-tab-active'; ?>"><?php _e('Selectors', 'BeRocket_AJAX_domain') ?></a>
20
+ <a href="#advanced" class="nav-tab <?php if(@$options['br_opened_tab'] == 'advanced' ) echo 'nav-tab-active'; ?>"><?php _e('Advanced', 'BeRocket_AJAX_domain') ?></a>
21
  <a href="#design" class="nav-tab <?php if(@$options['br_opened_tab'] == 'design' ) echo 'nav-tab-active'; ?>"><?php _e('Design', 'BeRocket_AJAX_domain') ?></a>
22
  <a href="#javascript" class="nav-tab <?php if(@$options['br_opened_tab'] == 'javascript' ) echo 'nav-tab-active'; ?>"><?php _e('JavaScript', 'BeRocket_AJAX_domain') ?></a>
23
  <a href="#customcss" class="nav-tab <?php if(@$options['br_opened_tab'] == 'customcss' ) echo 'nav-tab-active'; ?>"><?php _e('Custom CSS', 'BeRocket_AJAX_domain') ?></a>
42
  </td>
43
  </tr>
44
  <tr>
45
+ <th scope="row"><?php _e('Sorting control', 'BeRocket_AJAX_domain') ?></th>
46
  <td>
47
+ <input name="br_filters_options[control_sorting]" type='checkbox' value='1' <?php if( @$options['control_sorting'] ) echo "checked='checked'";?>/>
48
+ <span style="color:#666666;margin-left:2px;"><?php _e("Take control over WooCommerce's sorting selectbox?", 'BeRocket_AJAX_domain') ?></span>
49
+ </td>
50
+ </tr>
51
+ <tr>
52
+ <th scope="row"><?php _e('SEO friendly urls', 'BeRocket_AJAX_domain') ?></th>
53
+ <td>
54
+ <input name="br_filters_options[seo_friendly_urls]" type='checkbox' value='1' <?php if( @$options['seo_friendly_urls'] ) echo "checked='checked'";?>/>
55
+ <span style="color:#666666;margin-left:2px;"><?php _e('If this option is on url will be changed when filter is selected/changed', 'BeRocket_AJAX_domain') ?></span>
56
+ </td>
57
+ </tr>
58
+ <tr>
59
+ <th scope="row"><?php _e('Hide values', 'BeRocket_AJAX_domain') ?></th>
60
+ <td>
61
+ <input name="br_filters_options[hide_value][o]" type='checkbox' value='1' <?php if( @$options['hide_value']['o'] ) echo "checked='checked'";?>/>
62
+ <span style="color:#666666;margin-left:2px;"><?php _e('Hide values without products', 'BeRocket_AJAX_domain') ?></span><br>
63
+ <input name="br_filters_options[hide_value][sel]" type='checkbox' value='1' <?php if( @$options['hide_value']['sel'] ) echo "checked='checked'";?>/>
64
+ <span style="color:#666666;margin-left:2px;"><?php _e('Hide selected values', 'BeRocket_AJAX_domain') ?></span>
65
+ </td>
66
+ <td>
67
+ </tr>
68
+ <tr>
69
+ <th scope="row"><?php _e('Jump to first page', 'BeRocket_AJAX_domain') ?></th>
70
+ <td>
71
+ <input name="br_filters_options[first_page_jump]" type='checkbox' value='1' <?php if( @$options['first_page_jump'] ) echo "checked='checked'";?>/>
72
+ <span style="color:#666666;margin-left:2px;"><?php _e('Check if you want load first page after filters change', 'BeRocket_AJAX_domain') ?></span>
73
+ </td>
74
+ </tr>
75
+ <tr>
76
+ <th scope="row">Scroll page to the top</th>
77
+ <td>
78
+ <input name="br_filters_options[scroll_shop_top]" type='checkbox' value='1' <?php if( @$options['scroll_shop_top'] ) echo "checked='checked'";?>/>
79
+ <span style="color:#666666;margin-left:2px;">Check if you want scroll page to the top of shop after filters change</span>
80
+ </td>
81
+ </tr>
82
+ <tr>
83
+ <th scope="row"><?php _e('Select2', 'BeRocket_AJAX_domain') ?></th>
84
+ <td>
85
+ <input name="br_filters_options[use_select2]" type='checkbox' value='1' <?php if( ! empty($options['use_select2']) ) echo "checked='checked'";?>/>
86
+ <span style="color:#666666;margin-left:2px;"><?php _e('Use Select2 script for dropdown menu', 'BeRocket_AJAX_domain') ?></span>
87
  </td>
88
  </tr>
89
+ </table>
90
+ </div>
91
+ <div id="selectors" class="tab-item <?php if(@$options['br_opened_tab'] == 'selectors' ) echo 'current'; ?>">
92
+ <table class="form-table">
93
  <tr>
94
  <th scope="row"><?php _e('Get selectors automatically (BETA)', 'BeRocket_AJAX_domain') ?></th>
95
  <td>
131
  <span style="color:#666666;margin-left:2px;"><?php _e("Selector for tag that is holding products. Don't change this if you don't know what it is", 'BeRocket_AJAX_domain') ?></span>
132
  </td>
133
  </tr>
134
+ </table>
135
+ </div>
136
+ <div id="advanced" class="tab-item <?php if(@$options['br_opened_tab'] == 'advanced' ) echo 'current'; ?>">
137
+ <table class="form-table">
138
  <tr>
139
+ <th scope="row"><?php _e('"No Products" class', 'BeRocket_AJAX_domain') ?></th>
 
 
 
 
 
 
 
140
  <td>
141
+ <input name="br_filters_options[no_products_class]" type='text' value='<?php echo @$options['no_products_class']?>'/>
142
+ <br />
143
+ <span style="color:#666666;margin-left:2px;"><?php _e('Add class and use it to style "No Products" box', 'BeRocket_AJAX_domain') ?></span>
144
  </td>
145
  </tr>
146
  <tr>
157
  <span style="color:#666666;margin-left:2px;"><?php _e('Check if you want to show not used attribute values too', 'BeRocket_AJAX_domain') ?></span>
158
  </td>
159
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  <tr>
161
  <th scope="row"><?php _e('Template ajax load fix', 'BeRocket_AJAX_domain') ?></th>
162
  <td>
167
  <span style="color:#666666;margin-left:2px;"><?php _e('Use GET query instead POST for filtering', 'BeRocket_AJAX_domain') ?></span>
168
  <script>
169
  jQuery(document).on('change', '.load_fix_ajax_request_load', function() {
170
+ if( jQuery(this).prop('checked') ) {
171
  jQuery('.load_fix_use_get_query').show();
172
  } else {
173
  jQuery('.load_fix_use_get_query').hide();
229
  </table>
230
  </div>
231
  <div id="customcss" class="tab-item <?php if(@$options['br_opened_tab'] == 'customcss' ) echo 'current'; ?>">
232
+ <table class="form-table">
233
+ <tr>
234
+ <th colspan="2"><?php _e('User custom CSS style:', 'BeRocket_AJAX_domain') ?></th>
235
+ </tr>
236
+ <tr>
237
+ <td style="width:600px;">
238
+ <textarea style="width: 100%; min-height: 400px; height:900px" name="br_filters_options[user_custom_css]"><?php echo br_get_value_from_array($options, 'user_custom_css') ?></textarea>
239
+ </td>
240
+ <td><div class="berocket_css_examples"style="max-width:300px;">
241
+ <h4>Add border to widget</h4>
242
+ <div style="background-color:white;"><pre>#widget#{
243
+ border:2px solid #FF8800;
244
+ }</pre></div>
245
+ <h4>Set font size and font color for title</h4>
246
+ <div style="background-color:white;"><pre>#widget-title#{
247
+ font-size:36px!important;
248
+ color:orange!important;
249
+ }</pre></div>
250
+ <h4>Display all inline</h4>
251
+ <div style="background-color:white;"><pre>#widget# li{
252
+ display: inline-block;
253
+ }</pre></div>
254
+ <h4>Use WooCommerce font for checkbox</h4>
255
+ <div style="background-color:white;">
256
+ <pre>#widget# input[type=checkbox] + label:before{
257
+ font-family: WooCommerce!important;
258
+ speak: none!important;
259
+ font-weight: 400!important;
260
+ font-variant: normal!important;
261
+ text-transform: none!important;
262
+ content: "\e039"!important;
263
+ text-decoration: none!important;
264
+ background:none!important;
265
+ }
266
+ #widget# input[type=checkbox]:checked + label:before {
267
+ content: "\e015"!important;
268
+ }</pre></div>
269
+ <h4>Use block for slider handler instead image</h4>
270
+ <div style="background-color:white;"><pre>#widget# .ui-slider-handle {
271
+ background:none!important;
272
+ border-radius:50px!important;
273
+ background-color:white!important;
274
+ border: 2px solid black!important;
275
+ outline:none!important;
276
+ }
277
+ #widget# .ui-slider-handle.ui-state-active {
278
+ border: 3px solid black!important;
279
+ }</pre></div>
280
+ <style>
281
+ .berocket_css_examples {
282
+ width:300px;
283
+ overflow:visible;
284
+ }
285
+ .berocket_css_examples div{
286
+ background-color:white;
287
+ width:100%;
288
+ min-width:100%;
289
+ overflow:hidden;
290
+ float:right;
291
+ border:1px solid white;
292
+ padding: 2px;
293
+ }
294
+ .berocket_css_examples div:hover {
295
+ position:relative;
296
+ z-index: 9999;
297
+ width: initial;
298
+ border:1px solid #888;
299
+ }
300
+ </style>
301
+ </div></td>
302
+ </tr>
303
+ </table>
304
+ <table class="form-table">
305
+ <tr>
306
+ <th scope="row"><?php _e('Definitions:', 'BeRocket_AJAX_domain') ?></th>
307
+ <td>
308
+ <span style="color:#6666FF;margin-left:2px;">#widget#</span><span style="color:#666666;margin-left:2px;"> - <?php _e('widget block.', 'BeRocket_AJAX_domain') ?></span><br />
309
+ <span style="color:#6666FF ;margin-left:2px;">#widget-title#</span><span style="color:#666666;margin-left:2px;"> - <?php _e('widget title.', 'BeRocket_AJAX_domain') ?></span>
310
+ </td>
311
+ </tr>
312
+ </table>
313
  <input type="hidden" id="br_opened_tab" name="br_filters_options[br_opened_tab]" value="<?php echo @$options['br_opened_tab'] ?>">
314
  </div>
315
  <p class="submit">
templates/admin.php CHANGED
@@ -3,6 +3,7 @@
3
  <select id="<?php echo $this->get_field_id( 'widget_type' ); ?>" name="<?php echo $this->get_field_name( 'widget_type' ); ?>" class="berocket_aapf_widget_admin_widget_type_select">
4
  <option <?php if ($instance['widget_type'] == 'filter' or ! $instance['widget_type']) echo 'selected'; ?> value="filter"><?php _e('Filter', 'BeRocket_AJAX_domain') ?></option>
5
  <option <?php if ($instance['widget_type'] == 'update_button') echo 'selected'; ?> value="update_button"><?php _e('Update Products button', 'BeRocket_AJAX_domain') ?></option>
 
6
  </select>
7
  </label>
8
  </p>
@@ -13,7 +14,7 @@
13
  <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title:', 'BeRocket_AJAX_domain') ?> </label>
14
  <input id="<?php echo $this->get_field_id( 'title' ); ?>" type="text" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" />
15
  </p>
16
- <div class="berocket_aapf_admin_filter_widget_content" <?php if ( $instance['widget_type'] == 'update_button' or $instance['widget_type'] == 'selected_area' ){ echo 'style="display: none;"';} else { echo 'style="float: none;"'; } ?>>
17
  <p>
18
  <label><?php _e('Attribute:', 'BeRocket_AJAX_domain') ?>
19
  <select id="<?php echo $this->get_field_id( 'attribute' ); ?>" name="<?php echo $this->get_field_name( 'attribute' ); ?>" class="berocket_aapf_widget_admin_attribute_select">
@@ -38,18 +39,37 @@
38
  </label>
39
  </p>
40
 
41
- <p <?php if ( $instance['attribute'] == 'price' or $instance['type'] == 'slider' ) echo " style='display: none;'"; ?> >
42
- <label><?php _e('Operator:', 'BeRocket_AJAX_domain') ?>
43
- <select id="<?php echo $this->get_field_id( 'operator' ); ?>" name="<?php echo $this->get_field_name( 'operator' ); ?>" class="berocket_aapf_widget_admin_operator_select">
44
- <option <?php if ($instance['operator'] == 'AND') echo 'selected'; ?> value="AND">AND</option>
45
- <option <?php if ($instance['operator'] == 'OR') echo 'selected'; ?> value="OR">OR</option>
 
 
 
 
 
 
 
 
 
 
 
46
  </select>
47
- </label>
48
- </p>
 
 
 
 
 
 
 
 
49
  <p class="berocket_widget_multiple_select" <?php if ( $instance['type'] != 'select' ) echo " style='display: none;'"; ?> >
50
  <label>
51
  <input type="checkbox" name="<?php echo $this->get_field_name( 'select_multiple' ); ?>" <?php if ( ! empty($instance['select_multiple']) ) echo 'checked'; ?> value="1" />
52
- <?php _e('Multiplde select', 'BeRocket_AJAX_domain') ?>
53
  </label>
54
  </p>
55
  <p <?php if ( $instance['attribute'] != 'price' ) echo " style='display: none;'"; ?> class="berocket_aapf_widget_admin_price_attribute" >
@@ -120,3 +140,9 @@
120
  </p>
121
  </div>
122
  </div>
 
 
 
 
 
 
3
  <select id="<?php echo $this->get_field_id( 'widget_type' ); ?>" name="<?php echo $this->get_field_name( 'widget_type' ); ?>" class="berocket_aapf_widget_admin_widget_type_select">
4
  <option <?php if ($instance['widget_type'] == 'filter' or ! $instance['widget_type']) echo 'selected'; ?> value="filter"><?php _e('Filter', 'BeRocket_AJAX_domain') ?></option>
5
  <option <?php if ($instance['widget_type'] == 'update_button') echo 'selected'; ?> value="update_button"><?php _e('Update Products button', 'BeRocket_AJAX_domain') ?></option>
6
+ <option <?php if ($instance['widget_type'] == 'reset_button') echo 'selected'; ?> value="reset_button"><?php _e('Reset Products button', 'BeRocket_AJAX_domain') ?></option>
7
  </select>
8
  </label>
9
  </p>
14
  <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title:', 'BeRocket_AJAX_domain') ?> </label>
15
  <input id="<?php echo $this->get_field_id( 'title' ); ?>" type="text" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" />
16
  </p>
17
+ <div class="berocket_aapf_admin_filter_widget_content" <?php if ( $instance['widget_type'] == 'update_button' or $instance['widget_type'] == 'reset_button' or $instance['widget_type'] == 'selected_area' ){ echo 'style="display: none;"';} else { echo 'style="float: none;"'; } ?>>
18
  <p>
19
  <label><?php _e('Attribute:', 'BeRocket_AJAX_domain') ?>
20
  <select id="<?php echo $this->get_field_id( 'attribute' ); ?>" name="<?php echo $this->get_field_name( 'attribute' ); ?>" class="berocket_aapf_widget_admin_attribute_select">
39
  </label>
40
  </p>
41
 
42
+ <div <?php if ( $instance['attribute'] == 'price' or $instance['type'] == 'slider' ) echo " style='display: none;'"; ?>>
43
+ <p <?php if ( $instance['attribute'] == 'price' or $instance['type'] == 'slider' ) echo " style='display: none;'"; ?> >
44
+ <label><?php _e('Operator:', 'BeRocket_AJAX_domain') ?>
45
+ <select id="<?php echo $this->get_field_id( 'operator' ); ?>" name="<?php echo $this->get_field_name( 'operator' ); ?>" class="berocket_aapf_widget_admin_operator_select">
46
+ <option <?php if ($instance['operator'] == 'AND') echo 'selected'; ?> value="AND">AND</option>
47
+ <option <?php if ($instance['operator'] == 'OR') echo 'selected'; ?> value="OR">OR</option>
48
+ </select>
49
+ </label>
50
+ </p>
51
+ <p>
52
+ <label><?php _e('Values Order', 'BeRocket_AJAX_domain') ?></label>
53
+ <select id="<?php echo $this->get_field_id( 'order_values_by' ); ?>" name="<?php echo $this->get_field_name( 'order_values_by' ); ?>">
54
+ <option value=""><?php _e('Default', 'BeRocket_AJAX_domain') ?></option>
55
+ <?php foreach ( array( 'Alpha', 'Numeric' ) as $v ) { ?>
56
+ <option <?php if ( ! empty($instance['order_values_by']) && $instance['order_values_by'] == $v ) echo 'selected'; ?> value="<?php _e( $v, 'BeRocket_AJAX_domain' ) ?>"><?php _e( $v, 'BeRocket_AJAX_domain' ) ?></option>
57
+ <?php } ?>
58
  </select>
59
+ </p>
60
+ <p>
61
+ <label class="br_admin_center"><?php _e('Order Type', 'BeRocket_AJAX_domain') ?></label>
62
+ <select id="<?php echo $this->get_field_id( 'order_values_type' ); ?>" name="<?php echo $this->get_field_name( 'order_values_type' ); ?>">
63
+ <?php foreach ( array( 'asc' => __( 'Ascending', 'BeRocket_AJAX_domain' ), 'desc' => __( 'Descending', 'BeRocket_AJAX_domain' ) ) as $v_i => $v ) { ?>
64
+ <option <?php if ( ! empty($instance['order_values_type']) && $instance['order_values_type'] == $v_i ) echo 'selected'; ?> value="<?php echo $v_i; ?>"><?php echo $v; ?></option>
65
+ <?php } ?>
66
+ </select>
67
+ </p>
68
+ </div>
69
  <p class="berocket_widget_multiple_select" <?php if ( $instance['type'] != 'select' ) echo " style='display: none;'"; ?> >
70
  <label>
71
  <input type="checkbox" name="<?php echo $this->get_field_name( 'select_multiple' ); ?>" <?php if ( ! empty($instance['select_multiple']) ) echo 'checked'; ?> value="1" />
72
+ <?php _e('Multiple select', 'BeRocket_AJAX_domain') ?>
73
  </label>
74
  </p>
75
  <p <?php if ( $instance['attribute'] != 'price' ) echo " style='display: none;'"; ?> class="berocket_aapf_widget_admin_price_attribute" >
140
  </p>
141
  </div>
142
  </div>
143
+ <p>
144
+ <label>
145
+ <input type="checkbox" name="<?php echo $this->get_field_name( 'is_hide_mobile' ); ?>" <?php if ( ! empty($instance['is_hide_mobile']) ) echo 'checked'; ?> value="1" />
146
+ <?php _e('Hide this widget on mobile?', 'BeRocket_AJAX_domain') ?>
147
+ </label>
148
+ </p>
templates/widget_reset_button.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <div class="berocket_aapf_widget<?php if ( ! empty($is_hide_mobile) ) echo ' berocket_aapf_hide_mobile'; ?>">
2
+ <input value="<?php echo berocket_isset($title) ?>" class="berocket_aapf_reset_button" type="button" />
3
+ </div>
templates/widget_start.php CHANGED
@@ -1,3 +1,3 @@
1
- <div class="berocket_aapf_widget-wrapper">
2
  <?php if ( ! empty($title) ) { ?><h3 class="widget-title berocket_aapf_widget-title <?php echo $css_class ?>"><span><?php echo $title ?></span></h3><?php } ?>
3
  <ul class='berocket_aapf_widget <?php echo $class ?> <?php echo $css_class ?>' <?php echo $style ?> data-scroll_theme='<?php echo $scroll_theme ?>'>
1
+ <div class="berocket_aapf_widget-wrapper<?php if ( ! empty($is_hide_mobile) ) echo ' berocket_aapf_hide_mobile'; ?>">
2
  <?php if ( ! empty($title) ) { ?><h3 class="widget-title berocket_aapf_widget-title <?php echo $css_class ?>"><span><?php echo $title ?></span></h3><?php } ?>
3
  <ul class='berocket_aapf_widget <?php echo $class ?> <?php echo $css_class ?>' <?php echo $style ?> data-scroll_theme='<?php echo $scroll_theme ?>'>
templates/widget_update_button.php CHANGED
@@ -1,3 +1,3 @@
1
- <div class="berocket_aapf_widget">
2
  <input type="button" value="<?php echo $title ?>" class="berocket_aapf_widget_update_button" />
3
  </div>
1
+ <div class="berocket_aapf_widget<?php if ( ! empty($is_hide_mobile) ) echo ' berocket_aapf_hide_mobile'; ?>">
2
  <input type="button" value="<?php echo $title ?>" class="berocket_aapf_widget_update_button" />
3
  </div>
woocommerce-filters.php CHANGED
@@ -3,15 +3,16 @@
3
  * Plugin Name: Advanced AJAX Product Filters for WooCommerce
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-ajax-filters/
5
  * Description: Advanced product filtering ability for your WooCommerce shop. Add unlimited filters with one widget.
6
- * Version: 1.2.5
7
  * Author: BeRocket
8
  * Requires at least: 4.0
9
  * Author URI: http://berocket.com
10
  * Text Domain: BeRocket_AJAX_domain
11
  * Domain Path: /languages/
 
12
  */
13
 
14
- define( "BeRocket_AJAX_filters_version", '1.2.5' );
15
  define( "BeRocket_AJAX_domain", 'BeRocket_AJAX_domain' );
16
 
17
  define( "AAPF_TEMPLATE_PATH", plugin_dir_path( __FILE__ ) . "templates/" );
@@ -72,6 +73,7 @@ class BeRocket_AAPF {
72
  'on_update' => '',
73
  'after_update' => '',
74
  ),
 
75
  );
76
  public static $values = array(
77
  'settings_name' => '',
@@ -82,6 +84,7 @@ class BeRocket_AAPF {
82
  function __construct(){
83
  register_activation_hook(__FILE__, array( __CLASS__, 'br_add_defaults' ) );
84
  register_uninstall_hook(__FILE__, array( __CLASS__, 'br_delete_plugin_options' ) );
 
85
 
86
  if ( ( is_plugin_active( 'woocommerce/woocommerce.php' ) || is_plugin_active_for_network( 'woocommerce/woocommerce.php' ) ) && br_get_woocommerce_version() >= 2.1 ) {
87
  $last_version = get_option('br_filters_version');
@@ -113,6 +116,8 @@ class BeRocket_AAPF {
113
  add_filter( 'plugin_action_links_' . $plugin_base_slug, array( __CLASS__, 'plugin_action_links' ) );
114
  add_filter( 'is_berocket_settings_page', array( __CLASS__, 'is_settings_page' ) );
115
  add_filter('woocommerce_product_loop_start', array(__CLASS__, 'fix_categories_on_filtering'));
 
 
116
  } else {
117
  if( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
118
  add_action( 'admin_notices', array( __CLASS__, 'update_woocommerce' ) );
@@ -123,6 +128,34 @@ class BeRocket_AAPF {
123
  add_filter('berocket_admin_notices_subscribe_plugins', array(__CLASS__, 'admin_notices_subscribe_plugins'));
124
  }
125
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  public static function update_from_older( $version ) {
127
  $option = self::get_aapf_option();
128
  if ( version_compare($version, '1.2.4', '<') ) {
@@ -562,6 +595,20 @@ class BeRocket_AAPF {
562
  }
563
  return $result;
564
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
565
  }
566
 
567
  new BeRocket_AAPF;
@@ -571,24 +618,56 @@ berocket_admin_notices::generate_subscribe_notice();
571
  /**
572
  * Creating admin notice if it not added already
573
  */
574
- new berocket_admin_notices(array(
575
- 'start' => 1505100638, // timestamp when notice start
576
- 'end' => 1506816001, // timestamp when notice end
577
- 'name' => 'SALE_LABELS', //notice name must be unique for this time period
578
- 'html' => 'Only <strong>$9.6</strong> for <strong>Premium</strong> WooCommerce Advanced Product Labels!
579
- <a class="berocket_button" href="http://berocket.com/product/woocommerce-advanced-product-labels" target="_blank">Buy Now</a>
580
- &nbsp; <span>Get your <strong class="red">60% discount</strong> and save <strong>$14.4</strong> today</span>
581
- ', //text or html code as content of notice
582
- 'righthtml' => '<a class="berocket_no_thanks">No thanks</a>', //content in the right block, this is default value. This html code must be added to all notices
583
- 'rightwidth' => 80, //width of right content is static and will be as this value. berocket_no_thanks block is 60px and 20px is additional
584
- 'nothankswidth' => 60, //berocket_no_thanks width. set to 0 if block doesn't uses. Or set to any other value if uses other text inside berocket_no_thanks
585
- 'contentwidth' => 910, //width that uses for mediaquery is image + contentwidth + rightwidth + 210 other elements
586
- 'subscribe' => false, //add subscribe form to the righthtml
587
- 'priority' => 7, //priority of notice. 1-5 is main priority and displays on settings page always
588
- 'height' => 50, //height of notice. image will be scaled
589
- 'repeat' => '+2 week', //repeat notice after some time. time can use any values that accept function strtotime
590
- 'repeatcount' => 2, //repeat count. how many times notice will be displayed after close
591
- 'image' => array(
592
- 'local' => plugin_dir_url( __FILE__ ) . 'images/ad_white_on_orange.png', //notice will be used this image directly
593
- ),
594
- ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  * Plugin Name: Advanced AJAX Product Filters for WooCommerce
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-ajax-filters/
5
  * Description: Advanced product filtering ability for your WooCommerce shop. Add unlimited filters with one widget.
6
+ * Version: 1.2.6
7
  * Author: BeRocket
8
  * Requires at least: 4.0
9
  * Author URI: http://berocket.com
10
  * Text Domain: BeRocket_AJAX_domain
11
  * Domain Path: /languages/
12
+ * WC tested up to: 3.4.3
13
  */
14
 
15
+ define( "BeRocket_AJAX_filters_version", '1.2.6' );
16
  define( "BeRocket_AJAX_domain", 'BeRocket_AJAX_domain' );
17
 
18
  define( "AAPF_TEMPLATE_PATH", plugin_dir_path( __FILE__ ) . "templates/" );
73
  'on_update' => '',
74
  'after_update' => '',
75
  ),
76
+ 'user_custom_css' => '',
77
  );
78
  public static $values = array(
79
  'settings_name' => '',
84
  function __construct(){
85
  register_activation_hook(__FILE__, array( __CLASS__, 'br_add_defaults' ) );
86
  register_uninstall_hook(__FILE__, array( __CLASS__, 'br_delete_plugin_options' ) );
87
+ add_filter( 'BeRocket_updater_add_plugin', array( __CLASS__, 'updater_info' ) );
88
 
89
  if ( ( is_plugin_active( 'woocommerce/woocommerce.php' ) || is_plugin_active_for_network( 'woocommerce/woocommerce.php' ) ) && br_get_woocommerce_version() >= 2.1 ) {
90
  $last_version = get_option('br_filters_version');
116
  add_filter( 'plugin_action_links_' . $plugin_base_slug, array( __CLASS__, 'plugin_action_links' ) );
117
  add_filter( 'is_berocket_settings_page', array( __CLASS__, 'is_settings_page' ) );
118
  add_filter('woocommerce_product_loop_start', array(__CLASS__, 'fix_categories_on_filtering'));
119
+ add_action( 'wp_head', array( __CLASS__, 'br_custom_user_css' ) );
120
+ add_filter( 'is_active_sidebar', array(__CLASS__, 'is_active_sidebar'), 10, 2);
121
  } else {
122
  if( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
123
  add_action( 'admin_notices', array( __CLASS__, 'update_woocommerce' ) );
128
  add_filter('berocket_admin_notices_subscribe_plugins', array(__CLASS__, 'admin_notices_subscribe_plugins'));
129
  }
130
 
131
+ public static function updater_info ( $plugins ) {
132
+ self::$info['slug'] = basename( __DIR__ );
133
+ self::$info['plugin'] = plugin_basename( __FILE__ );
134
+ self::$info = apply_filters( 'berocket_aapf_update_info', self::$info );
135
+ $info = get_plugin_data( __FILE__ );
136
+ self::$info['name'] = $info['Name'];
137
+ $plugins[] = self::$info;
138
+ return $plugins;
139
+ }
140
+ public static function is_active_sidebar($is_active_sidebar, $index) {
141
+ if( $is_active_sidebar ) {
142
+ $sidebars_widgets = wp_get_sidebars_widgets();
143
+ $sidebars_widgets = $sidebars_widgets[$index];
144
+ global $wp_registered_widgets;
145
+ $test = $wp_registered_widgets;
146
+ if( is_array($sidebars_widgets) ) {
147
+ $br_options = apply_filters( 'berocket_aapf_listener_br_options', get_option('br_filters_options') );
148
+ foreach($sidebars_widgets as $widgets) {
149
+ if( strpos($widgets, 'berocket_aapf_widget') === false ) {
150
+ return $is_active_sidebar;
151
+ }
152
+ }
153
+ if( ! empty($br_options['filters_turn_off']) || ( ! is_shop() && ! is_product_category() && ! is_product_taxonomy() && ! is_product_tag() ) ) return false;
154
+ }
155
+ }
156
+ return $is_active_sidebar;
157
+ }
158
+
159
  public static function update_from_older( $version ) {
160
  $option = self::get_aapf_option();
161
  if ( version_compare($version, '1.2.4', '<') ) {
595
  }
596
  return $result;
597
  }
598
+ public static function br_custom_user_css() {
599
+ $options = self::get_aapf_option();
600
+ $replace_css = array(
601
+ '#widget#' => '.berocket_aapf_widget',
602
+ '#widget-title#' => '.berocket_aapf_widget-title'
603
+ );
604
+ $result_css = ( empty($options['user_custom_css']) ? '' : $options['user_custom_css'] );
605
+ foreach ( $replace_css as $key => $value ) {
606
+ $result_css = str_replace( $key, $value, $result_css );
607
+ }
608
+ if( ! empty($result_css) ) {
609
+ echo '<style type="text/css">' . $result_css . '</style>';
610
+ }
611
+ }
612
  }
613
 
614
  new BeRocket_AAPF;
618
  /**
619
  * Creating admin notice if it not added already
620
  */
621
+ if( ! function_exists('BeRocket_generate_sales_2018') ) {
622
+ function BeRocket_generate_sales_2018($data = array()) {
623
+ if( time() < strtotime('-7 days', $data['end']) ) {
624
+ $close_text = 'hide this for 7 days';
625
+ $nothankswidth = 115;
626
+ } else {
627
+ $close_text = 'not interested';
628
+ $nothankswidth = 90;
629
+ }
630
+ $data = array_merge(array(
631
+ 'righthtml' => '<a class="berocket_no_thanks">'.$close_text.'</a>',
632
+ 'rightwidth' => ($nothankswidth+20),
633
+ 'nothankswidth' => $nothankswidth,
634
+ 'contentwidth' => 400,
635
+ 'subscribe' => false,
636
+ 'priority' => 15,
637
+ 'height' => 50,
638
+ 'repeat' => '+7 days',
639
+ 'repeatcount' => 3,
640
+ 'image' => array(
641
+ 'local' => plugin_dir_url( __FILE__ ) . 'images/44p_sale.jpg',
642
+ ),
643
+ ), $data);
644
+ new berocket_admin_notices($data);
645
+ }
646
+ BeRocket_generate_sales_2018(array(
647
+ 'start' => 1529532000,
648
+ 'end' => 1530392400,
649
+ 'name' => 'SALE_LABELS_2018',
650
+ 'for_plugin' => array('id' => 18, 'version' => '2.0', 'onlyfree' => true),
651
+ 'html' => 'Save <strong>$20</strong> with <strong>Premium Product Labels</strong> today!
652
+ &nbsp; <span>Get your <strong class="red">44% discount</strong> now!</span>
653
+ <a class="berocket_button" href="https://berocket.com/product/woocommerce-advanced-product-labels" target="_blank">Save $20</a>',
654
+ ));
655
+ BeRocket_generate_sales_2018(array(
656
+ 'start' => 1530396000,
657
+ 'end' => 1531256400,
658
+ 'name' => 'SALE_MIN_MAX_2018',
659
+ 'for_plugin' => array('id' => 9, 'version' => '2.0', 'onlyfree' => true),
660
+ 'html' => 'Save <strong>$20</strong> with <strong>Premium Min/Max Quantity</strong> today!
661
+ &nbsp; <span>Get your <strong class="red">44% discount</strong> now!</span>
662
+ <a class="berocket_button" href="https://berocket.com/product/woocommerce-minmax-quantity" target="_blank">Save $20</a>',
663
+ ));
664
+ BeRocket_generate_sales_2018(array(
665
+ 'start' => 1531260000,
666
+ 'end' => 1532120400,
667
+ 'name' => 'SALE_LOAD_MORE_2018',
668
+ 'for_plugin' => array('id' => 3, 'version' => '2.0', 'onlyfree' => true),
669
+ 'html' => 'Save <strong>$20</strong> with <strong>Premium Load More Products</strong> today!
670
+ &nbsp; <span>Get your <strong class="red">44% discount</strong> now!</span>
671
+ <a class="berocket_button" href="https://berocket.com/product/woocommerce-load-more-products" target="_blank">Save $20</a>',
672
+ ));
673
+ }