Advanced AJAX Product Filters - Version 1.0.3.6

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.6
Comparing to
See all releases

Code changes from version 1.0.3.4 to 1.0.3.6

css/widget.css DELETED
@@ -1,204 +0,0 @@
1
- ul.products{
2
- position: relative;
3
- min-height: 500px;
4
- }
5
-
6
- ul.products.hide_products li{
7
- visibility: hidden;
8
- height: 20px;
9
- }
10
-
11
- .berocket_aapf_widget input[type="checkbox"] {
12
- position: absolute;
13
- left: -9999px;
14
- }
15
-
16
- .berocket_aapf_widget input[type="checkbox"] + label:before {
17
- content: "";
18
- display: inline-block;
19
- width: 14px;
20
- height: 14px;
21
- background: url('../images/sprite.png') no-repeat;
22
- cursor: pointer;
23
- }
24
-
25
- .berocket_aapf_widget input[type="checkbox"]:checked + label:before {
26
- background-position: -14px 0;
27
- }
28
-
29
- .berocket_aapf_widget input[type="radio"] {
30
- position: absolute;
31
- left: -9999px;
32
- }
33
-
34
- .berocket_aapf_widget input[type="radio"] + label:before {
35
- content: "";
36
- display: inline-block;
37
- width: 14px;
38
- height: 14px;
39
- background: url('../images/sprite_radio.png') no-repeat;
40
- }
41
-
42
- .berocket_aapf_widget input[type="radio"]:checked + label:before {
43
- background-position: -14px 0;
44
- }
45
-
46
- .berocket_aapf_widget-title{
47
- margin-bottom: 5px;
48
- font-size: 14px;
49
- }
50
-
51
- ul.berocket_aapf_widget{
52
- margin-bottom: 30px;
53
- }
54
-
55
- ul.berocket_aapf_widget li{
56
- list-style-type: none;
57
- padding-left: 0;
58
- }
59
-
60
- ul.berocket_aapf_widget li > span{
61
- display: block;
62
- cursor: pointer;
63
- height: 20px;
64
- }
65
-
66
- ul.berocket_aapf_widget li > span:hover{
67
- color: #000000;
68
- }
69
-
70
- .berocket_aapf_widget_loading{
71
- position: absolute;
72
- top: 0;
73
- left: 0;
74
- right: 0;
75
- bottom: 0;
76
- background: white url('../images/ajax-loader.gif') no-repeat center center;
77
- z-index: 10000;
78
- }
79
-
80
- .no-products{
81
- font-size: 26px;
82
- font-weight: bold;
83
- line-height: 6em;
84
- text-align: center;
85
- }
86
-
87
- span.product-size{
88
- color: #777;
89
- display: block;
90
- text-align: center;
91
- }
92
-
93
- .berocket_aapf_widget li.slider span.left, .berocket_aapf_widget li.slider span.right{
94
- height: 40px;
95
- float: left;
96
- font-size: 12px;
97
- }
98
-
99
- .berocket_aapf_widget li.slider span.left input, .berocket_aapf_widget li.slider span.right input{
100
- border: 1px solid #E8E8E8;
101
- font-size: 13px;
102
- font-style: italic;
103
- padding: 4px 9px;
104
- text-align: right;
105
- width: 40px;
106
- background: white;
107
- }
108
-
109
- .berocket_aapf_widget li.slider{
110
- width: 80%;
111
- }
112
-
113
- .berocket_aapf_widget li.slider span.right{
114
- float: right;
115
- }
116
-
117
- .berocket_aapf_widget li.slider span.slide{
118
- clear: both;
119
- height: auto;
120
- }
121
-
122
- .berocket_filter_slider.ui-widget-content, .berocket_filter_price_slider.ui-widget-content{
123
- background: none repeat scroll 0 0 #b0b5b9;
124
- border: 0 none;
125
- border-radius: 0;
126
- height: 4px;
127
- padding: 0;
128
- }
129
-
130
- .berocket_filter_slider.ui-widget-content .ui-slider-range, .berocket_filter_price_slider.ui-widget-content .ui-slider-range{
131
- background: none repeat scroll 0 0 #000000;
132
- }
133
-
134
- .berocket_filter_slider.ui-widget-content .ui-slider-handle, .berocket_filter_price_slider.ui-widget-content .ui-slider-handle{
135
- background: url("../images/handler.png") no-repeat scroll center center / cover transparent;
136
- width: 12px;
137
- height: 12px;
138
- border: 0;
139
- top: -4px;
140
- }
141
-
142
- .ui-slider {
143
- position: relative;
144
- text-align: left;
145
- }
146
- .ui-slider .ui-slider-handle {
147
- position: absolute;
148
- z-index: 2;
149
- width: 1.2em;
150
- height: 1.2em;
151
- cursor: pointer;
152
- -ms-touch-action: none;
153
- touch-action: none;
154
- }
155
- .ui-slider .ui-slider-range {
156
- position: absolute;
157
- z-index: 1;
158
- font-size: .7em;
159
- display: block;
160
- border: 0;
161
- background-position: 0 0;
162
- }
163
- .ui-slider.ui-state-disabled .ui-slider-handle,
164
- .ui-slider.ui-state-disabled .ui-slider-range {
165
- filter: inherit;
166
- }
167
-
168
- .ui-slider-horizontal {
169
- height: .8em;
170
- }
171
- .ui-slider-horizontal .ui-slider-handle {
172
- top: -.3em;
173
- margin-left: -.6em;
174
- }
175
- .ui-slider-horizontal .ui-slider-range {
176
- top: 0;
177
- height: 100%;
178
- }
179
- .ui-slider-horizontal .ui-slider-range-min {
180
- left: 0;
181
- }
182
- .ui-slider-horizontal .ui-slider-range-max {
183
- right: 0;
184
- }
185
-
186
- .ui-slider-vertical {
187
- width: .8em;
188
- height: 100px;
189
- }
190
- .ui-slider-vertical .ui-slider-handle {
191
- left: -.3em;
192
- margin-left: 0;
193
- margin-bottom: -.6em;
194
- }
195
- .ui-slider-vertical .ui-slider-range {
196
- left: 0;
197
- width: 100%;
198
- }
199
- .ui-slider-vertical .ui-slider-range-min {
200
- bottom: 0;
201
- }
202
- .ui-slider-vertical .ui-slider-range-max {
203
- top: 0;
204
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/widget.min.css ADDED
@@ -0,0 +1 @@
 
1
+ ul.products{position:relative;min-height:500px}ul.products.hide_products li{visibility:hidden;height:20px}.berocket_aapf_widget input[type="checkbox"]{position:absolute;left:-9999px}.berocket_aapf_widget input[type="checkbox"] + label:before{content:"";display:inline-block;width:14px;height:14px;background:url(../images/sprite.png) no-repeat;cursor:pointer}.berocket_aapf_widget input[type="checkbox"]:checked + label:before{background-position:-14px 0}.berocket_aapf_widget input[type="radio"]{position:absolute;left:-9999px}.berocket_aapf_widget input[type="radio"] + label:before{content:"";display:inline-block;width:14px;height:14px;background:url(../images/sprite_radio.png) no-repeat}.berocket_aapf_widget input[type="radio"]:checked + label:before{background-position:-14px 0}.berocket_aapf_widget-title{margin-bottom:5px;font-size:14px}ul.berocket_aapf_widget{margin-bottom:30px}ul.berocket_aapf_widget li{list-style-type:none;padding-left:0}ul.berocket_aapf_widget li > span{display:block;cursor:pointer;height:20px}ul.berocket_aapf_widget li > span:hover{color:#000}.berocket_aapf_widget_loading{position:absolute;top:0;left:0;right:0;bottom:0;background:#fff url(../images/ajax-loader.gif) no-repeat center center;z-index:10000}.no-products{font-size:26px;font-weight:700;line-height:6em;text-align:center}span.product-size{color:#777;display:block;text-align:center}.berocket_aapf_widget li.slider span.left,.berocket_aapf_widget li.slider span.right{height:40px;float:left;font-size:12px}.berocket_aapf_widget li.slider span.left input,.berocket_aapf_widget li.slider span.right input{border:1px solid #E8E8E8;font-size:13px;font-style:italic;padding:4px 9px;text-align:right;width:40px;background:#fff}.berocket_aapf_widget li.slider{width:80%}.berocket_aapf_widget li.slider span.right{float:right}.berocket_aapf_widget li.slider span.slide{clear:both;height:auto}.berocket_filter_slider.ui-widget-content,.berocket_filter_price_slider.ui-widget-content{background:none repeat scroll 0 0 #b0b5b9;border:0 none;border-radius:0;height:4px;padding:0}.berocket_filter_slider.ui-widget-content .ui-slider-range,.berocket_filter_price_slider.ui-widget-content .ui-slider-range{background:none repeat scroll 0 0 #000}.berocket_filter_slider.ui-widget-content .ui-slider-handle,.berocket_filter_price_slider.ui-widget-content .ui-slider-handle{background:url(../images/handler.png) no-repeat scroll center center / cover transparent;width:12px;height:12px;border:0;top:-4px}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:pointer;-ms-touch-action:none;touch-action:none}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}
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/hack.js DELETED
@@ -1,145 +0,0 @@
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 ($) {
12
- // Detect touch support
13
- $.support.touch = 'ontouchend' in document;
14
- // Ignore browsers without touch support
15
- if (!$.support.touch) {
16
- return;
17
- }
18
- var mouseProto = $.ui.mouse.prototype,
19
- _mouseInit = mouseProto._mouseInit,
20
- _mouseDestroy = mouseProto._mouseDestroy,
21
- touchHandled;
22
-
23
- /**
24
- * Simulate a mouse event based on a corresponding touch event
25
- * @param {Object} event A touch event
26
- * @param {String} simulatedType The corresponding mouse event
27
- */
28
- function simulateMouseEvent(event, simulatedType) {
29
- // Ignore multi-touch events
30
- if (event.originalEvent.touches.length > 1) {
31
- return;
32
- }
33
- event.preventDefault();
34
- var touch = event.originalEvent.changedTouches[0],
35
- simulatedEvent = document.createEvent('MouseEvents');
36
- // Initialize the simulated mouse event using the touch event's coordinates
37
- simulatedEvent.initMouseEvent(
38
- simulatedType, // type
39
- true, // bubbles
40
- true, // cancelable
41
- window, // view
42
- 1, // detail
43
- touch.screenX, // screenX
44
- touch.screenY, // screenY
45
- touch.clientX, // clientX
46
- touch.clientY, // clientY
47
- false, // ctrlKey
48
- false, // altKey
49
- false, // shiftKey
50
- false, // metaKey
51
- 0, // button
52
- null // relatedTarget
53
- );
54
- // Dispatch the simulated event to the target element
55
- event.target.dispatchEvent(simulatedEvent);
56
- }
57
-
58
- /**
59
- * Handle the jQuery UI widget's touchstart events
60
- * @param {Object} event The widget element's touchstart event
61
- */
62
- mouseProto._touchStart = function (event) {
63
- var self = this;
64
- // Ignore the event if another widget is already being handled
65
- if (touchHandled || !self._mouseCapture(event.originalEvent.changedTouches[0])) {
66
- return;
67
- }
68
- // Set the flag to prevent other widgets from inheriting the touch event
69
- touchHandled = true;
70
- // Track movement to determine if interaction was a click
71
- self._touchMoved = false;
72
- // Simulate the mouseover event
73
- simulateMouseEvent(event, 'mouseover');
74
- // Simulate the mousemove event
75
- simulateMouseEvent(event, 'mousemove');
76
- // Simulate the mousedown event
77
- simulateMouseEvent(event, 'mousedown');
78
- };
79
- /**
80
- * Handle the jQuery UI widget's touchmove events
81
- * @param {Object} event The document's touchmove event
82
- */
83
- mouseProto._touchMove = function (event) {
84
- // Ignore event if not handled
85
- if (!touchHandled) {
86
- return;
87
- }
88
- // Interaction was not a click
89
- this._touchMoved = true;
90
- // Simulate the mousemove event
91
- simulateMouseEvent(event, 'mousemove');
92
- };
93
- /**
94
- * Handle the jQuery UI widget's touchend events
95
- * @param {Object} event The document's touchend event
96
- */
97
- mouseProto._touchEnd = function (event) {
98
- // Ignore event if not handled
99
- if (!touchHandled) {
100
- return;
101
- }
102
- // Simulate the mouseup event
103
- simulateMouseEvent(event, 'mouseup');
104
- // Simulate the mouseout event
105
- simulateMouseEvent(event, 'mouseout');
106
- // If the touch interaction did not move, it should trigger a click
107
- if (!this._touchMoved) {
108
- // Simulate the click event
109
- simulateMouseEvent(event, 'click');
110
- }
111
- // Unset the flag to allow other widgets to inherit the touch event
112
- touchHandled = false;
113
- };
114
- /**
115
- * A duck punch of the $.ui.mouse _mouseInit method to support touch events.
116
- * This method extends the widget with bound touch event handlers that
117
- * translate touch events to mouse events and pass them to the widget's
118
- * original mouse event handling methods.
119
- */
120
- mouseProto._mouseInit = function () {
121
- var self = this;
122
- // Delegate the touch handlers to the widget's element
123
- self.element.bind({
124
- touchstart: $.proxy(self, '_touchStart'),
125
- touchmove: $.proxy(self, '_touchMove'),
126
- touchend: $.proxy(self, '_touchEnd')
127
- });
128
- // Call the original $.ui.mouse init method
129
- _mouseInit.call(self);
130
- };
131
- /**
132
- * Remove the touch event handlers
133
- */
134
- mouseProto._mouseDestroy = function () {
135
- var self = this;
136
- // Delegate the touch handlers to the widget's element
137
- self.element.unbind({
138
- touchstart: $.proxy(self, '_touchStart'),
139
- touchmove: $.proxy(self, '_touchMove'),
140
- touchend: $.proxy(self, '_touchEnd')
141
- });
142
- // Call the original $.ui.mouse destroy method
143
- _mouseDestroy.call(self);
144
- };
145
- })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.js DELETED
@@ -1,108 +0,0 @@
1
- (function ($){
2
- $(document).ready(function (){
3
-
4
- var berocket_aapf_widget_product_filters = [],
5
- berocket_aapf_widget_product_limits = [],
6
- berocket_aapf_widget_product_price_limit = [];
7
- function updateProducts( $el ){
8
- $('ul.products').addClass('hide_products').append('<div class="berocket_aapf_widget_loading" />');
9
-
10
- if( $el ){
11
- $li = $el.parent().parent();
12
- if( $el.is("select") ) $li = $el.find("option:selected");
13
- taxonomy = $li.data('taxonomy');
14
- term_id = $li.data('term_id');
15
- operator = $li.data('operator');
16
-
17
- if( $el.is("select") ){
18
- $(berocket_aapf_widget_product_filters).each(function (i, o) {
19
- if (o[0] == taxonomy) {
20
- berocket_aapf_widget_product_filters.splice(i, 1);
21
- }
22
- });
23
- if( $li.val() )
24
- berocket_aapf_widget_product_filters[berocket_aapf_widget_product_filters.length] = [taxonomy, term_id, operator];
25
- }else {
26
- if ($el.is(':checked') || $el.is(':selected')) {
27
- berocket_aapf_widget_product_filters[berocket_aapf_widget_product_filters.length] = [taxonomy, term_id, operator];
28
- } else {
29
- $(berocket_aapf_widget_product_filters).each(function (i, o) {
30
- if (o[0] == taxonomy && o[1] == term_id) {
31
- berocket_aapf_widget_product_filters.splice(i, 1);
32
- }
33
- });
34
- }
35
- }
36
- }
37
-
38
- $t = $('.berocket_filter_slider');
39
- if( $t.hasClass('berocket_filter_slider') ){
40
- $t.each(function (i,o){
41
- val1 = $('#'+$(o).data('fields_1')).val();
42
- val2 = $('#'+$(o).data('fields_2')).val();
43
- berocket_aapf_widget_product_limits[berocket_aapf_widget_product_limits.length] = [$(o).data('taxonomy'), val1, val2];
44
- });
45
- }
46
- $d = $('.berocket_filter_price_slider');
47
- if( $d.hasClass('berocket_filter_price_slider') ){
48
- val1 = $('#'+$d.data('fields_1')).val();
49
- val2 = $('#'+$d.data('fields_2')).val();
50
- berocket_aapf_widget_product_price_limit = [val1, val2];
51
- }
52
-
53
- $.post( the_ajax_script.ajaxurl, { terms: berocket_aapf_widget_product_filters, price: berocket_aapf_widget_product_price_limit, limits: berocket_aapf_widget_product_limits, product_cat: the_ajax_script.product_cat, action: 'berocket_aapf_listener' }, function (data){
54
- $('ul.products').html(data).removeClass('hide_products');
55
- $('.berocket_aapf_widget_loading').remove();
56
- })
57
- }
58
-
59
- $('.berocket_aapf_widget').on("change", "input, select", function(){
60
- updateProducts( $(this) );
61
- });
62
-
63
- $( ".berocket_filter_slider" ).each(function (i,o){
64
- $(o).slider({
65
- range: true,
66
- min: $(o).data('min')>>0,
67
- max: $(o).data('max')>>0,
68
- values: [$(o).data('min')>>0,$(o).data('max')>>0],
69
- slide: function( event, ui ) {
70
- $o = $(ui.handle).parents('div.berocket_filter_slider');
71
-
72
- $( '#'+$o.data('fields_1') ).val( ui.values[0] );
73
- $( '#'+$o.data('fields_2') ).val( ui.values[1] );
74
- },
75
- stop: function(){
76
- updateProducts( false );
77
- }
78
- });
79
- });
80
-
81
- $( ".berocket_filter_price_slider" ).each(function (i,o){
82
- $(o).slider({
83
- range: true,
84
- min: $(o).data('min')>>0,
85
- max: $(o).data('max')>>0,
86
- values: [$(o).data('min')>>0,$(o).data('max')>>0],
87
- slide: function( event, ui ) {
88
- $o = $(ui.handle).parents('div.berocket_filter_price_slider');
89
-
90
- $( '#'+$o.data('fields_1') ).val( ui.values[0].toFixed(2) );
91
- $( '#'+$o.data('fields_2') ).val( ui.values[1].toFixed(2) );
92
- },
93
- stop: function( event, ui ){
94
- updateProducts( false );
95
- }
96
- });
97
- });
98
-
99
- $(".berocket_aapf_widget_height_control").each(function (i,o){
100
- $(o).mCustomScrollbar({
101
- axis: "xy",
102
- theme: $(o).data('scroll_theme'),
103
- scrollInertia: 300
104
- });
105
- })
106
-
107
- });
108
- })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
 
@@ -64,10 +64,15 @@ WooCommerce AJAX Filters - advanced AJAX product filters plugin for WooCommerce.
64
 
65
  = Next Release ( 1.1.0 ) =
66
 
 
 
 
67
  = Features: =
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 ==
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.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
64
 
65
  = Next Release ( 1.1.0 ) =
66
 
67
+ = 1.0.3.6 =
68
+ * Enhancement/Fix - Option to set selector for products holder is added. Now you control where data will returned to
69
+
70
  = Features: =
71
  * New type Image. Admin can upload image to select and deselect before/instead of text
72
  * Option to add icons before/after option text
73
  * Option to take control over (default) sorting function, make it AJAXy and work with filters
74
+ * Add filters and actions for other developers to make it easier extending plugin. Please don't edit plugin directly
75
+ I'm updating it almost daily =)
76
 
77
 
78
  == Installation ==
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(){