Advanced AJAX Product Filters - Version 1.0.3.5

Version Description

  • Enhancement/Fix - Option to set selector for products holder is added. Now you control where data will returned to
Download this release

Release Info

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

Code changes from version 1.0.3.4 to 1.0.3.5

includes/widget.php CHANGED
@@ -41,26 +41,38 @@ class BeRocket_AAPF_Widget extends WP_Widget {
41
  if( !is_shop() and !is_product_category() ) return;
42
  global $wp_query;
43
 
44
- wp_register_style( 'berocket_aapf_widget-style', plugins_url('../css/widget.min.css', __FILE__) );
45
  wp_enqueue_style( 'berocket_aapf_widget-style' );
46
 
47
- /* custom scrollbar */
48
- wp_enqueue_script( 'berocket_aapf_widget-scroll-script', plugins_url('../js/custom-scrollbar/jquery.mCustomScrollbar.concat.min.js', __FILE__), array('jquery') );
49
- wp_register_style( 'berocket_aapf_widget-scroll-style', plugins_url('../js/custom-scrollbar/jquery.mCustomScrollbar.min.css', __FILE__) );
50
  wp_enqueue_style( 'berocket_aapf_widget-scroll-style' );
51
 
52
  wp_enqueue_script( 'jquery-ui-core' );
53
  wp_enqueue_script( 'jquery-ui-slider' );
54
- wp_enqueue_script( 'berocket_aapf_widget-script', plugins_url('../js/widget.js', __FILE__), array('jquery') );
55
- wp_enqueue_script( 'berocket_aapf_widget-hack-script', plugins_url('../js/mobiles.min.js', __FILE__), array('jquery') );
 
 
56
 
57
  $wp_query_product_cat = '-1';
58
- if ( @$wp_query->query['product_cat'] ) {
59
  $wp_query_product_cat = explode( "/", $wp_query->query['product_cat'] );
60
  $wp_query_product_cat = $wp_query_product_cat[ count( $wp_query_product_cat ) - 1 ];
61
  }
62
 
63
- wp_localize_script( 'berocket_aapf_widget-script', 'the_ajax_script', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'product_cat' => $wp_query_product_cat ) );
 
 
 
 
 
 
 
 
 
 
64
 
65
  extract( $args );
66
  extract( $instance );
@@ -74,18 +86,20 @@ class BeRocket_AAPF_Widget extends WP_Widget {
74
  $cur_cat_ancestors = get_ancestors( $cur_cat->term_id, 'product_cat' );
75
  $cur_cat_ancestors[] = $cur_cat->term_id;
76
 
77
- if ( $cat_propagation ){
78
- foreach ( $product_cat as $cat ) {
79
- $cat = get_term_by( 'slug', $cat, 'product_cat' );
 
80
 
81
- if ( @ in_array( $cat->term_id, $cur_cat_ancestors ) ) {
82
- $hide_widget = false;
 
83
  }
84
- }
85
- } else {
86
- foreach ( $product_cat as $cat ) {
87
- if ( $cat == $wp_query_product_cat ) {
88
- $hide_widget = false;
89
  }
90
  }
91
  }
@@ -108,9 +122,11 @@ class BeRocket_AAPF_Widget extends WP_Widget {
108
  while ( $my_query->have_posts() ) {
109
  $my_query->the_post();
110
  $t_terms = get_the_terms( $my_query->post->ID, $attribute );
111
- foreach( $t_terms as $key => $val ){
112
- $terms[$key] = $val;
113
- $sort_terms[$key] = $val->name;
 
 
114
  }
115
  }
116
  }
@@ -118,7 +134,7 @@ class BeRocket_AAPF_Widget extends WP_Widget {
118
  if ( @ count( $terms ) < 2 ) return false;
119
 
120
  array_multisort( $sort_terms, $terms );
121
- set_query_var( 'terms', $terms );
122
  }
123
 
124
  $style = $class = '';
@@ -130,9 +146,9 @@ class BeRocket_AAPF_Widget extends WP_Widget {
130
  if( !$scroll_theme ) $scroll_theme = 'dark';
131
 
132
  set_query_var( 'operator', $operator );
133
- set_query_var( 'title', $title );
134
- set_query_var( 'class', $class );
135
- set_query_var( 'style', $style );
136
  set_query_var( 'scroll_theme', $scroll_theme );
137
  set_query_var( 'x', time() );
138
 
@@ -145,17 +161,29 @@ class BeRocket_AAPF_Widget extends WP_Widget {
145
  $slider_class = 'berocket_filter_slider';
146
 
147
  if( $attribute == 'price' ){
148
- foreach( $price_range as $price ){
149
- if( $min === false or $min > (int) $price ) $min = $price;
150
- if( $max === false or $max < (int) $price ) $max = $price;
 
 
 
 
 
 
151
  }
152
  $id = rand( 0, time() );
153
  $slider_class = 'berocket_filter_price_slider';
154
  $main_class .= ' price';
155
  }else{
156
- foreach( $terms as $term ){
157
- if( $min === false or $min > (int) $term->slug ) $min = $term->slug;
158
- if( $max === false or $max < (int) $term->slug ) $max = $term->slug;
 
 
 
 
 
 
159
  }
160
  $id = $term->taxonomy;
161
  }
@@ -181,7 +209,7 @@ class BeRocket_AAPF_Widget extends WP_Widget {
181
  $hide = stripslashes( $hide );
182
  }
183
 
184
- return $hide;
185
  }
186
 
187
  public static function get_price_range( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items ){
@@ -199,10 +227,10 @@ class BeRocket_AAPF_Widget extends WP_Widget {
199
  }
200
 
201
  if ( @ count( $price_range ) < 2 ) {
202
- return false;
203
- }else{
204
- return $price_range;
205
  }
 
 
206
  }
207
 
208
  function get_filter_products( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items ) {
@@ -233,6 +261,8 @@ class BeRocket_AAPF_Widget extends WP_Widget {
233
  );
234
  }
235
 
 
 
236
  return new WP_Query( $args );
237
  }
238
  /**
@@ -263,7 +293,9 @@ class BeRocket_AAPF_Widget extends WP_Widget {
263
 
264
  if( $instance['attribute'] == 'price' ) $instance['type'] = 'slider';
265
 
266
- return $instance;
 
 
267
  }
268
 
269
  /**
@@ -289,6 +321,8 @@ class BeRocket_AAPF_Widget extends WP_Widget {
289
  'scroll_theme' => 'dark'
290
  );
291
 
 
 
292
  $instance = wp_parse_args( (array) $instance, $defaults );
293
  $attributes = $this->get_attributes();
294
  $categories = self::get_product_categories( @ json_decode( $instance['product_cat'] ) );
@@ -304,12 +338,14 @@ class BeRocket_AAPF_Widget extends WP_Widget {
304
 
305
  add_filter( 'post_class', array( __CLASS__, 'add_product_class' ) );
306
 
307
- $attributes = self::get_attributes();
308
  if( @$attributes ) {
309
  foreach ( $attributes as $k => $v ) {
310
  $terms = get_terms( array( $k ), $args = array( 'orderby' => 'name', 'order' => 'ASC' ) );
311
- foreach ( $terms as $term ) {
312
- $attributes_terms[ $k ][ $term->term_id ] = $term->slug;
 
 
313
  }
314
  }
315
  }
@@ -320,19 +356,27 @@ class BeRocket_AAPF_Widget extends WP_Widget {
320
  $taxonomies_operator[$t[0]] = $t[2];
321
  }
322
  }
323
-
 
 
 
324
  if( @$taxonomies ){
325
  $tax_query['relation'] = 'AND';
326
- foreach( $taxonomies as $k=>$v ){
327
- if( $taxonomies_operator[$k] == 'AND' ) $op = 'AND';
328
- else $op = 'IN';
329
-
330
- $tax_query[] = array(
331
- 'taxonomy' => $k,
332
- 'field' => 'slug',
333
- 'terms' => $v,
334
- 'operator' => $op
335
- );
 
 
 
 
 
336
  }
337
  }
338
 
@@ -345,9 +389,11 @@ class BeRocket_AAPF_Widget extends WP_Widget {
345
  );
346
 
347
  $args = array( 'tax_query' => $tax_query, 'posts_per_page' => 9, 'post_type' => 'product' );
348
-
 
 
349
  $query = new WP_Query( $args );
350
- $br_options = get_option('br_filters_options');
351
  $has_products = false;
352
 
353
  if( $query->have_posts() ){
@@ -376,7 +422,7 @@ class BeRocket_AAPF_Widget extends WP_Widget {
376
  }
377
 
378
  if( ! $has_products ){
379
- echo "<div class='no-products" . ( ( $br_options['no_products_class'] ) ? ' '.$br_options['no_products_class'] : '' ) . "'>" . $br_options['no_products_message'] . "</div>";
380
  }
381
  die();
382
  }
@@ -391,7 +437,7 @@ class BeRocket_AAPF_Widget extends WP_Widget {
391
  }
392
  }
393
 
394
- return $attributes;
395
  }
396
 
397
  function get_product_categories( $current_product_cat = '' ) {
@@ -411,6 +457,6 @@ class BeRocket_AAPF_Widget extends WP_Widget {
411
 
412
  public static function add_product_class( $classes ) {
413
  $classes[] = 'product';
414
- return $classes;
415
  }
416
  }
41
  if( !is_shop() and !is_product_category() ) return;
42
  global $wp_query;
43
 
44
+ wp_register_style( 'berocket_aapf_widget-style', plugins_url( '../css/widget.min.css', __FILE__ ) );
45
  wp_enqueue_style( 'berocket_aapf_widget-style' );
46
 
47
+ /* custom scrollbar */
48
+ wp_enqueue_script( 'berocket_aapf_widget-scroll-script', plugins_url( '../js/custom-scrollbar/jquery.mCustomScrollbar.concat.min.js', __FILE__ ), array( 'jquery' ) );
49
+ wp_register_style( 'berocket_aapf_widget-scroll-style', plugins_url( '../js/custom-scrollbar/jquery.mCustomScrollbar.min.css', __FILE__ ) );
50
  wp_enqueue_style( 'berocket_aapf_widget-scroll-style' );
51
 
52
  wp_enqueue_script( 'jquery-ui-core' );
53
  wp_enqueue_script( 'jquery-ui-slider' );
54
+ wp_enqueue_script( 'berocket_aapf_widget-script', plugins_url( '../js/widget.min.js', __FILE__ ), array( 'jquery' ) );
55
+ wp_enqueue_script( 'berocket_aapf_widget-hack-script', plugins_url( '../js/mobiles.min.js', __FILE__ ), array( 'jquery' ) );
56
+
57
+ $br_options = apply_filters( 'berocket_aapf_listener_br_options', get_option('br_filters_options') );
58
 
59
  $wp_query_product_cat = '-1';
60
+ if ( @ $wp_query->query['product_cat'] ) {
61
  $wp_query_product_cat = explode( "/", $wp_query->query['product_cat'] );
62
  $wp_query_product_cat = $wp_query_product_cat[ count( $wp_query_product_cat ) - 1 ];
63
  }
64
 
65
+ if( ! $br_options['products_holder_id'] ) $br_options['products_holder_id'] = 'ul.products';
66
+
67
+ wp_localize_script(
68
+ 'berocket_aapf_widget-script',
69
+ 'the_ajax_script',
70
+ array(
71
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
72
+ 'product_cat' => $wp_query_product_cat,
73
+ 'products_holder_id' => $br_options['products_holder_id']
74
+ )
75
+ );
76
 
77
  extract( $args );
78
  extract( $instance );
86
  $cur_cat_ancestors = get_ancestors( $cur_cat->term_id, 'product_cat' );
87
  $cur_cat_ancestors[] = $cur_cat->term_id;
88
 
89
+ if( $product_cat ) {
90
+ if ( $cat_propagation ) {
91
+ foreach ( $product_cat as $cat ) {
92
+ $cat = get_term_by( 'slug', $cat, 'product_cat' );
93
 
94
+ if ( @ in_array( $cat->term_id, $cur_cat_ancestors ) ) {
95
+ $hide_widget = false;
96
+ }
97
  }
98
+ } else {
99
+ foreach ( $product_cat as $cat ) {
100
+ if ( $cat == $wp_query_product_cat ) {
101
+ $hide_widget = false;
102
+ }
103
  }
104
  }
105
  }
122
  while ( $my_query->have_posts() ) {
123
  $my_query->the_post();
124
  $t_terms = get_the_terms( $my_query->post->ID, $attribute );
125
+ if( $t_terms ) {
126
+ foreach ( $t_terms as $key => $val ) {
127
+ $terms[ $key ] = $val;
128
+ $sort_terms[ $key ] = $val->name;
129
+ }
130
  }
131
  }
132
  }
134
  if ( @ count( $terms ) < 2 ) return false;
135
 
136
  array_multisort( $sort_terms, $terms );
137
+ set_query_var( 'terms', apply_filters( 'berocket_aapf_widget_terms', $terms ) );
138
  }
139
 
140
  $style = $class = '';
146
  if( !$scroll_theme ) $scroll_theme = 'dark';
147
 
148
  set_query_var( 'operator', $operator );
149
+ set_query_var( 'title', apply_filters( 'berocket_aapf_widget_title', $title ) );
150
+ set_query_var( 'class', apply_filters( 'berocket_aapf_widget_class', $class ) );
151
+ set_query_var( 'style', apply_filters( 'berocket_aapf_widget_style', $style ) );
152
  set_query_var( 'scroll_theme', $scroll_theme );
153
  set_query_var( 'x', time() );
154
 
161
  $slider_class = 'berocket_filter_slider';
162
 
163
  if( $attribute == 'price' ){
164
+ if( $price_range ) {
165
+ foreach ( $price_range as $price ) {
166
+ if ( $min === false or $min > (int) $price ) {
167
+ $min = $price;
168
+ }
169
+ if ( $max === false or $max < (int) $price ) {
170
+ $max = $price;
171
+ }
172
+ }
173
  }
174
  $id = rand( 0, time() );
175
  $slider_class = 'berocket_filter_price_slider';
176
  $main_class .= ' price';
177
  }else{
178
+ if( $terms ) {
179
+ foreach ( $terms as $term ) {
180
+ if ( $min === false or $min > (int) $term->slug ) {
181
+ $min = $term->slug;
182
+ }
183
+ if ( $max === false or $max < (int) $term->slug ) {
184
+ $max = $term->slug;
185
+ }
186
+ }
187
  }
188
  $id = $term->taxonomy;
189
  }
209
  $hide = stripslashes( $hide );
210
  }
211
 
212
+ return apply_filters( 'berocket_aapf_hide_out_of_stock_items', $hide );
213
  }
214
 
215
  public static function get_price_range( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items ){
227
  }
228
 
229
  if ( @ count( $price_range ) < 2 ) {
230
+ $price_range = false;
 
 
231
  }
232
+
233
+ return apply_filters( 'berocket_aapf_get_price_range', $price_range );
234
  }
235
 
236
  function get_filter_products( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items ) {
261
  );
262
  }
263
 
264
+ $args = apply_filters( 'berocket_aapf_get_filter_products_args', $args );
265
+
266
  return new WP_Query( $args );
267
  }
268
  /**
293
 
294
  if( $instance['attribute'] == 'price' ) $instance['type'] = 'slider';
295
 
296
+ do_action( 'berocket_aapf_admin_update', $instance, $new_instance, $old_instance );
297
+
298
+ return apply_filters( 'berocket_aapf_admin_update_instance', $instance );
299
  }
300
 
301
  /**
321
  'scroll_theme' => 'dark'
322
  );
323
 
324
+ $defaults = apply_filters( 'berocket_aapf_form_defaults', $defaults );
325
+
326
  $instance = wp_parse_args( (array) $instance, $defaults );
327
  $attributes = $this->get_attributes();
328
  $categories = self::get_product_categories( @ json_decode( $instance['product_cat'] ) );
338
 
339
  add_filter( 'post_class', array( __CLASS__, 'add_product_class' ) );
340
 
341
+ $attributes = apply_filters( 'berocket_aapf_listener_get_attributes', self::get_attributes() );
342
  if( @$attributes ) {
343
  foreach ( $attributes as $k => $v ) {
344
  $terms = get_terms( array( $k ), $args = array( 'orderby' => 'name', 'order' => 'ASC' ) );
345
+ if( $terms ) {
346
+ foreach ( $terms as $term ) {
347
+ $attributes_terms[ $k ][ $term->term_id ] = $term->slug;
348
+ }
349
  }
350
  }
351
  }
356
  $taxonomies_operator[$t[0]] = $t[2];
357
  }
358
  }
359
+
360
+ $taxonomies = apply_filters( 'berocket_aapf_listener_taxonomies', @$taxonomies );
361
+ $taxonomies_operator = apply_filters( 'berocket_aapf_listener_taxonomies_operator', @$taxonomies_operator );
362
+
363
  if( @$taxonomies ){
364
  $tax_query['relation'] = 'AND';
365
+ if( $taxonomies ) {
366
+ foreach ( $taxonomies as $k => $v ) {
367
+ if ( $taxonomies_operator[ $k ] == 'AND' ) {
368
+ $op = 'AND';
369
+ } else {
370
+ $op = 'IN';
371
+ }
372
+
373
+ $tax_query[] = array(
374
+ 'taxonomy' => $k,
375
+ 'field' => 'slug',
376
+ 'terms' => $v,
377
+ 'operator' => $op
378
+ );
379
+ }
380
  }
381
  }
382
 
389
  );
390
 
391
  $args = array( 'tax_query' => $tax_query, 'posts_per_page' => 9, 'post_type' => 'product' );
392
+
393
+ $args = apply_filters( 'berocket_aapf_listener_wp_query_args', $args );
394
+
395
  $query = new WP_Query( $args );
396
+ $br_options = apply_filters( 'berocket_aapf_listener_br_options', get_option('br_filters_options') );
397
  $has_products = false;
398
 
399
  if( $query->have_posts() ){
422
  }
423
 
424
  if( ! $has_products ){
425
+ echo apply_filters( 'berocket_aapf_listener_no_products_message', "<div class='no-products" . ( ( $br_options['no_products_class'] ) ? ' '.$br_options['no_products_class'] : '' ) . "'>" . $br_options['no_products_message'] . "</div>" );
426
  }
427
  die();
428
  }
437
  }
438
  }
439
 
440
+ return apply_filters( 'berocket_aapf_get_attributes', $attributes );
441
  }
442
 
443
  function get_product_categories( $current_product_cat = '' ) {
457
 
458
  public static function add_product_class( $classes ) {
459
  $classes[] = 'product';
460
+ return apply_filters( 'berocket_aapf_add_product_class', $classes );
461
  }
462
  }
js/mobiles.min.js CHANGED
@@ -1,11 +1,2 @@
1
- /*!
2
- * jQuery UI Touch Punch 0.2.3
3
- *
4
- * Copyright 2011–2014, Dave Furfero
5
- * Dual licensed under the MIT or GPL Version 2 licenses.
6
- *
7
- * Depends:
8
- * jquery.ui.widget.js
9
- * jquery.ui.mouse.js
10
- */
11
- (function(b){b.support.touch="ontouchend" in document;if(!b.support.touch){return}var d=b.ui.mouse.prototype,f=d._mouseInit,c=d._mouseDestroy,a;function e(h,i){if(h.originalEvent.touches.length>1){return}h.preventDefault();var j=h.originalEvent.changedTouches[0],g=document.createEvent("MouseEvents");g.initMouseEvent(i,true,true,window,1,j.screenX,j.screenY,j.clientX,j.clientY,false,false,false,false,0,null);h.target.dispatchEvent(g)}d._touchStart=function(h){var g=this;if(a||!g._mouseCapture(h.originalEvent.changedTouches[0])){return}a=true;g._touchMoved=false;e(h,"mouseover");e(h,"mousemove");e(h,"mousedown")};d._touchMove=function(g){if(!a){return}this._touchMoved=true;e(g,"mousemove")};d._touchEnd=function(g){if(!a){return}e(g,"mouseup");e(g,"mouseout");if(!this._touchMoved){e(g,"click")}a=false};d._mouseInit=function(){var g=this;g.element.bind({touchstart:b.proxy(g,"_touchStart"),touchmove:b.proxy(g,"_touchMove"),touchend:b.proxy(g,"_touchEnd")});f.call(g)};d._mouseDestroy=function(){var g=this;g.element.unbind({touchstart:b.proxy(g,"_touchStart"),touchmove:b.proxy(g,"_touchMove"),touchend:b.proxy(g,"_touchEnd")});c.call(g)}})(jQuery);
1
+ /*! jQuery UI Touch Punch 0.2.3 | Copyright 2011–2014, Dave Furfero | Dual licensed under the MIT or GPL Version 2 licenses. | Depends: jquery.ui.widget.js, jquery.ui.mouse.js */
2
+ eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(2(b){b.p.q="B"C r;3(!b.p.q){6}7 d=b.D.E.F,f=d.s,c=d.t,a;2 e(h,i){3(h.k.G.H>1){6}h.I();7 j=h.k.u[0],g=r.J("K");g.L(i,9,9,M,1,j.N,j.O,j.P,j.Q,4,4,4,4,0,R);h.S.T(g)}d.l=2(h){7 g=8;3(a||!g.U(h.k.u[0])){6}a=9;g.m=4;e(h,"V");e(h,"v");e(h,"W")};d.n=2(g){3(!a){6}8.m=9;e(g,"v")};d.o=2(g){3(!a){6}e(g,"X");e(g,"Y");3(!8.m){e(g,"Z")}a=4};d.s=2(){7 g=8;g.w.10({x:b.5(g,"l"),y:b.5(g,"n"),z:b.5(g,"o")});f.A(g)};d.t=2(){7 g=8;g.w.11({x:b.5(g,"l"),y:b.5(g,"n"),z:b.5(g,"o")});c.A(g)}})(12);',62,65,'||function|if|false|proxy|return|var|this|true|||||||||||originalEvent|_touchStart|_touchMoved|_touchMove|_touchEnd|support|touch|document|_mouseInit|_mouseDestroy|changedTouches|mousemove|element|touchstart|touchmove|touchend|call|ontouchend|in|ui|mouse|prototype|touches|length|preventDefault|createEvent|MouseEvents|initMouseEvent|window|screenX|screenY|clientX|clientY|null|target|dispatchEvent|_mouseCapture|mouseover|mousedown|mouseup|mouseout|click|bind|unbind|jQuery'.split('|'),0,{}))
 
 
 
 
 
 
 
 
 
js/widget.min.js CHANGED
@@ -1 +1,2 @@
1
- (function(a){a(document).ready(function(){var e=[],d=[],c=[];function b(f){a("ul.products").addClass("hide_products").append('<div class="berocket_aapf_widget_loading" />');if(f){$li=f.parent().parent();taxonomy=$li.data("taxonomy");term_id=$li.data("term_id");operator=$li.data("operator");if(f.is(":checked")||f.is(":selected")){e[e.length]=[taxonomy,term_id,operator]}else{a(e).each(function(g,h){if(h[0]==taxonomy&&h[1]==term_id){e.splice(g,1)}})}}$t=a(".berocket_filter_slider");if($t.hasClass("berocket_filter_slider")){$t.each(function(g,h){val1=a("#"+a(h).data("fields_1")).val();val2=a("#"+a(h).data("fields_2")).val();d[d.length]=[a(h).data("taxonomy"),val1,val2]})}$d=a(".berocket_filter_price_slider");if($d.hasClass("berocket_filter_price_slider")){val1=a("#"+$d.data("fields_1")).val();val2=a("#"+$d.data("fields_2")).val();c=[val1,val2]}a.post(the_ajax_script.ajaxurl,{terms:e,price:c,limits:d,product_cat:the_ajax_script.product_cat,action:"berocket_aapf_listener"},function(g){a("ul.products").html(g).removeClass("hide_products");a(".berocket_aapf_widget_loading").remove()})}a(".berocket_aapf_widget").on("change","input, select",function(){b(a(this))});a(".berocket_filter_slider").each(function(f,g){a(g).slider({range:true,min:a(g).data("min")>>0,max:a(g).data("max")>>0,values:[a(g).data("min")>>0,a(g).data("max")>>0],slide:function(h,i){$o=a(i.handle).parents("div.berocket_filter_slider");a("#"+$o.data("fields_1")).val(i.values[0]);a("#"+$o.data("fields_2")).val(i.values[1])},stop:function(){b(false)}})});a(".berocket_filter_price_slider").each(function(f,g){a(g).slider({range:true,min:a(g).data("min")>>0,max:a(g).data("max")>>0,values:[a(g).data("min")>>0,a(g).data("max")>>0],slide:function(h,i){$o=a(i.handle).parents("div.berocket_filter_price_slider");a("#"+$o.data("fields_1")).val(i.values[0].toFixed(2));a("#"+$o.data("fields_2")).val(i.values[1].toFixed(2))},stop:function(h,i){b(false)}})});a(".berocket_aapf_widget_height_control").each(function(f,g){a(g).mCustomScrollbar({axis:"xy",theme:a(g).data("scroll_theme"),scrollInertia:300})})})})(jQuery);
 
1
+ /* http://dean.edwards.name/packer/ */
2
+ eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(4($){$(S).T(4(){U c=[],j=[],w=[];4 k(b){$(l.A).V(\'B\').W(\'<x X="C" />\');5(b){$8=b.D().D();5(b.m("y"))$8=b.Y("Z:E");7=$8.3(\'7\');h=$8.3(\'h\');n=$8.3(\'n\');5(b.m("y")){$(c).9(4(i,o){5(o[0]==7){c.F(i,1)}});5($8.6())c[c.z]=[7,h,n]}G{5(b.m(\':10\')||b.m(\':E\')){c[c.z]=[7,h,n]}G{$(c).9(4(i,o){5(o[0]==7&&o[1]==h){c.F(i,1)}})}}}$t=$(\'.p\');5($t.H(\'p\')){$t.9(4(i,o){q=$(\'#\'+$(o).3(\'r\')).6();s=$(\'#\'+$(o).3(\'u\')).6();j[j.z]=[$(o).3(\'7\'),q,s]})}$d=$(\'.v\');5($d.H(\'v\')){q=$(\'#\'+$d.3(\'r\')).6();s=$(\'#\'+$d.3(\'u\')).6();w=[q,s]}$.11(l.12,{13:c,14:w,15:j,I:l.I,16:\'17\'},4(a){$(l.A).18(a).19(\'B\');$(\'.C\').1a()})}$(\'.1b\').1c("1d","1e, y",4(){k($(1f))});$(".p").9(4(i,o){$(o).J({K:L,e:$(o).3(\'e\')>>0,f:$(o).3(\'f\')>>0,g:[$(o).3(\'e\')>>0,$(o).3(\'f\')>>0],M:4(a,b){$o=$(b.N).O(\'x.p\');$(\'#\'+$o.3(\'r\')).6(b.g[0]);$(\'#\'+$o.3(\'u\')).6(b.g[1])},P:4(){k(Q)}})});$(".v").9(4(i,o){$(o).J({K:L,e:$(o).3(\'e\')>>0,f:$(o).3(\'f\')>>0,g:[$(o).3(\'e\')>>0,$(o).3(\'f\')>>0],M:4(a,b){$o=$(b.N).O(\'x.v\');$(\'#\'+$o.3(\'r\')).6(b.g[0].R(2));$(\'#\'+$o.3(\'u\')).6(b.g[1].R(2))},P:4(a,b){k(Q)}})});$(".1g").9(4(i,o){$(o).1h({1i:"1j",1k:$(o).3(\'1l\'),1m:1n})})})})(1o);',62,87,'|||data|function|if|val|taxonomy|li|each|||||min|max|values|term_id||berocket_aapf_widget_product_limits|updateProducts|the_ajax_script|is|operator||berocket_filter_slider|val1|fields_1|val2||fields_2|berocket_filter_price_slider|berocket_aapf_widget_product_price_limit|div|select|length|products_holder_id|hide_products|berocket_aapf_widget_loading|parent|selected|splice|else|hasClass|product_cat|slider|range|true|slide|handle|parents|stop|false|toFixed|document|ready|var|addClass|append|class|find|option|checked|post|ajaxurl|terms|price|limits|action|berocket_aapf_listener|html|removeClass|remove|berocket_aapf_widget|on|change|input|this|berocket_aapf_widget_height_control|mCustomScrollbar|axis|xy|theme|scroll_theme|scrollInertia|300|jQuery'.split('|'),0,{}))
readme.txt CHANGED
@@ -5,7 +5,7 @@ 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
6
  Requires at least: 3.9
7
  Tested up to: 4.1
8
- Stable tag: 1.0.3.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -68,6 +68,8 @@ WooCommerce AJAX Filters - advanced AJAX product filters plugin for WooCommerce.
68
  * New type Image. Admin can upload image to select and deselect before/instead of text
69
  * Option to add icons before/after option text
70
  * Option to take control over (default) sorting function, make it AJAXy and work with filters
 
 
71
 
72
 
73
  == Installation ==
@@ -86,6 +88,9 @@ WooCommerce AJAX Filters - advanced AJAX product filters plugin for WooCommerce.
86
 
87
  == Changelog ==
88
 
 
 
 
89
  = 1.0.3.3 =
90
  * Enhancement/Fix - Showing products and options now depending on woocommerce_hide_out_of_stock_items option
91
  * Enhancement/Fix - If not enough data available( quantity of options < 2 ) filters will not be shown.
5
  Tags: filters, product filters, ajax product filters, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce ajax product filters
6
  Requires at least: 3.9
7
  Tested up to: 4.1
8
+ Stable tag: 1.0.3.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
68
  * New type Image. Admin can upload image to select and deselect before/instead of text
69
  * Option to add icons before/after option text
70
  * Option to take control over (default) sorting function, make it AJAXy and work with filters
71
+ * Add filters and actions for other developers to make it easier extending plugin. Please don't edit plugin directly
72
+ I'm updating it almost daily =)
73
 
74
 
75
  == Installation ==
88
 
89
  == Changelog ==
90
 
91
+ = 1.0.3.5 =
92
+ * Enhancement/Fix - Option to set selector for products holder is added. Now you control where data will returned to
93
+
94
  = 1.0.3.3 =
95
  * Enhancement/Fix - Showing products and options now depending on woocommerce_hide_out_of_stock_items option
96
  * Enhancement/Fix - If not enough data available( quantity of options < 2 ) filters will not be shown.
templates/admin-settings.php CHANGED
@@ -22,6 +22,14 @@
22
  <span style="color:#666666;margin-left:2px;">Add class and use it to style "No Products" box</span>
23
  </td>
24
  </tr>
 
 
 
 
 
 
 
 
25
  <tr>
26
  <th scope="row">Sorting control</th>
27
  <td>
22
  <span style="color:#666666;margin-left:2px;">Add class and use it to style "No Products" box</span>
23
  </td>
24
  </tr>
25
+ <tr>
26
+ <th scope="row">Products selector</th>
27
+ <td>
28
+ <input name="br_filters_options[products_holder_id]" type='text' value='<?php echo @$options['products_holder_id']?$options['products_holder_id']:'ul.products'?>'/>
29
+ <br />
30
+ <span style="color:#666666;margin-left:2px;">Selector for tag that is holding products. Don't change this if you don't know what it is</span>
31
+ </td>
32
+ </tr>
33
  <tr>
34
  <th scope="row">Sorting control</th>
35
  <td>
templates/admin.php CHANGED
@@ -15,16 +15,16 @@
15
  <p>
16
  <label>Type:
17
  <select id="<?php echo $this->get_field_id( 'type' ); ?>" name="<?php echo $this->get_field_name( 'type' ); ?>" class="berocket_aapf_widget_admin_type_select">
18
- <? if ( $instance['attribute'] != 'price' ){ ?>
19
  <option <?php if ($instance['type'] == 'checkbox') echo 'selected'; ?> value="checkbox">Checkbox</option>
20
  <option <?php if ($instance['type'] == 'radio') echo 'selected'; ?> value="radio">Radio</option>
21
  <option <?php if ($instance['type'] == 'select') echo 'selected'; ?> value="select">Select</option>
22
- <? } ?>
23
  <option <?php if ($instance['type'] == 'slider') echo 'selected'; ?> value="slider">Slider</option>
24
  </select>
25
  </label>
26
  </p>
27
- <p <? if ( $instance['attribute'] == 'price' ) echo " style='display: none;'"; ?> >
28
  <label>Operator:
29
  <select id="<?php echo $this->get_field_id( 'operator' ); ?>" name="<?php echo $this->get_field_name( 'operator' ); ?>" class="berocket_aapf_widget_admin_operator_select">
30
  <option <?php if ($instance['operator'] == 'AND') echo 'selected'; ?> value="AND">AND</option>
15
  <p>
16
  <label>Type:
17
  <select id="<?php echo $this->get_field_id( 'type' ); ?>" name="<?php echo $this->get_field_name( 'type' ); ?>" class="berocket_aapf_widget_admin_type_select">
18
+ <?php if ( $instance['attribute'] != 'price' ){ ?>
19
  <option <?php if ($instance['type'] == 'checkbox') echo 'selected'; ?> value="checkbox">Checkbox</option>
20
  <option <?php if ($instance['type'] == 'radio') echo 'selected'; ?> value="radio">Radio</option>
21
  <option <?php if ($instance['type'] == 'select') echo 'selected'; ?> value="select">Select</option>
22
+ <?php } ?>
23
  <option <?php if ($instance['type'] == 'slider') echo 'selected'; ?> value="slider">Slider</option>
24
  </select>
25
  </label>
26
  </p>
27
+ <p <?php if ( $instance['attribute'] == 'price' ) echo " style='display: none;'"; ?> >
28
  <label>Operator:
29
  <select id="<?php echo $this->get_field_id( 'operator' ); ?>" name="<?php echo $this->get_field_name( 'operator' ); ?>" class="berocket_aapf_widget_admin_operator_select">
30
  <option <?php if ($instance['operator'] == 'AND') echo 'selected'; ?> value="AND">AND</option>
woocommerce-filters.php CHANGED
@@ -3,7 +3,7 @@
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.0.3.4
7
  Author: BeRocket
8
  Author URI: http://berocket.com
9
  */
@@ -22,7 +22,8 @@ class BeRocket_AAPF {
22
  public static $defaults = array(
23
  "no_products_message" => "There are no products meeting your criteria",
24
  "no_products_class" => "",
25
- "control_sorting" => "0"
 
26
  );
27
 
28
  function __construct(){
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.0.3.6
7
  Author: BeRocket
8
  Author URI: http://berocket.com
9
  */
22
  public static $defaults = array(
23
  "no_products_message" => "There are no products meeting your criteria",
24
  "no_products_class" => "",
25
+ "control_sorting" => "0",
26
+ "products_holder_id" => "ul.products"
27
  );
28
 
29
  function __construct(){