Advanced AJAX Product Filters - Version 1.1.0.3

Version Description

  • Enhancement - Custom CSS class can be added per widget/filter
  • Enhancement - Update button. If added products will be updated only when user click Update button
  • Enhancement - Radio-box can be unselected by clicking it again
  • Enhancement/Fix - Urls are shortened using better structure to save filters. ~ symbol is not used now
  • Fix - issue with shortened tags for shortcode.
  • Fix - on widgets page widget now has subcategories(hierarchy)
  • Fix - all categories are visible, not only that have products inside(popular)
  • Minor fixes
Download this release

Release Info

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

Code changes from version 1.1.0.2 to 1.1.0.3

README.md DELETED
@@ -1,185 +0,0 @@
1
- === Advanced AJAX Product Filters ===
2
- Plugin Name: Advanced AJAX Product Filters
3
- Contributors: dholovnia, berocket
4
- Donate link: http://berocket.com
5
- Tags: filters, product filters, ajax product filters, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce ajax product filters
6
- Requires at least: 3.9
7
- Tested up to: 4.1
8
- Stable tag: 2.0.1
9
- License: GPLv2 or later
10
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
-
12
- WooCommerce AJAX Filters - advanced AJAX product filters plugin for WooCommerce.
13
-
14
- == Description ==
15
-
16
- WooCommerce AJAX Filters - advanced AJAX product filters plugin for WooCommerce. Add unlimited filters with one widget.
17
-
18
- = Features: =
19
-
20
- * AJAX Filters, Pagination and Sorting!
21
- * Unlimited Filters
22
- * Multiple User Interface Elements
23
- * SEO Friendly Urls ( with HTML5 PushState )
24
- * Filter Visibility By Product Category And Globals.
25
- * Accessible through shortcode
26
- * Filter box height limit with scroll themes
27
- * Working great with custom widget area
28
- * Drag and Drop Filter Building
29
- * And More...
30
-
31
- = Demo =
32
- http://woocommerce-product-filter.berocket.com
33
-
34
- = How It Works: =
35
- *check installation*
36
-
37
-
38
- = In recent updates: =
39
- * Show all values - on plugin settings page you can enable option to show all values no matter if they are used or not
40
- * Values order - you can set values order when editing attribute. You can set how to order (by id, name or custom). If
41
- you set to order `by custom` you can drag&drop values up and down and set your own order.
42
- * Fixes
43
-
44
-
45
- = Shortcode: =
46
- * In editor `[br_filters attribute=price type=slider title="Price Filter"]`
47
- * In PHP `do_shortcode('[br_filters attribute=price type=slider title="Price Filter"]');`
48
-
49
- = Shortcode Options: =
50
- * `attribute`(required) - product attribute, eg price or length. Don't forget that woocommerce adding pa_ suffix for created attributes.
51
- So if you create new attribute `jump` its name is `pa_jump`
52
- * `type`(required) - checkbox, radio, slider or select
53
- * `operator` - OR or AND
54
- * `title` - whatever you want to see as title. Can be empty
55
- * `product_cat` - parent category id
56
- * `cat_propagation` - should we propagate this filter to child categories? set 1 to turn this on
57
- * `height` - max filter box height. When height is met scroll will be added
58
- * `scroll_theme` - pretty clear name, scroll theme. Will be used if height is set and real height of box is more
59
-
60
-
61
- = Advanced Settings (Widget area): =
62
-
63
- * Product Category - if you want to pin your filter to category of the product this is good place to do it.
64
- Eg. You selling Phones and Cases for them. If user choose Category "Phones" filter "Have Wi-Fi" will appear
65
- but if user will choose "Cases" it will not be there as Admin set that "Have Wi-Fi" filter will be visible only on
66
- "Phones" category.
67
- * Filter Box Height - if your filter have too much options it is nice to limit height of the filter to not prolong
68
- the page too much. Scroll will appear.
69
- * Scroll theme - if "Filter Box Height" is set and box length is more than "Filter Box Height" scroll appear and
70
- how it looks depends on the theme you choose.
71
-
72
-
73
- = Advanced Settings (Plugin Settings): =
74
- * Plugin settings can be found in admin area, WooCommerce -> Product Filters
75
- * "No Products" message - Text that will be shown if no products found
76
- * "No Products" class - Add class and use it to style "No Products" box
77
- * Products selector - Selector for tag that is holding products
78
- * Sorting control - Take control over WooCommerce's sorting selectbox
79
- * SEO friendly urls - url will be changed when filter is selected/changed
80
- * Turn all filters off - If you want to hide filters without losing current configuration just turn them off
81
-
82
-
83
-
84
- == Installation ==
85
-
86
- = Step 1: =
87
- * First you need to add attributes to the products ( WooCommerce plugin should be installed and activated already )
88
- * Go to Admin area -> Products -> Attributes and add attributes your products will have, add them all
89
- * Click attribute's name where type is select and add values to it. Predefine product options
90
- * Go to your products and add attributes to each of them
91
-
92
- = Step 2: =
93
- * Install and activate plugin
94
- * Go to Admin area -> Appearance -> Widgets
95
- * In Available Widgets ( left side of the screen ) find AJAX Product Filters
96
- * Drag it to Sidebar you choose for it
97
- * Enter title, choose attribute that will be used for filtering products, choose filter type,
98
- choose operator( whether product should have all selected values (AND) or one of them (OR) ),
99
- * Click save and go to your shop to check how it work.
100
- * That's it =)
101
-
102
-
103
- == Frequently Asked Questions ==
104
-
105
- ---
106
-
107
- == Screenshots ==
108
-
109
- ---
110
-
111
- == Changelog ==
112
-
113
- = 1.0.4.5 =
114
- * Enhancement - values order added. Now order of values can be controlled through attribute options
115
- * Enhancement/Fix - Better support for for category pages
116
- * Other small fixes
117
-
118
- = 1.0.4.4 =
119
- * Enhancement - adding callback for before_update, on_update, after_update events.
120
- * Other small fixes
121
-
122
- = 1.0.4.3 =
123
- * Enhancement - shortcode added
124
- * Critical/Fix - If slider match none its values wasn't counted
125
- * Enhancement/Fix - Changing attribute data location from url to action-element, providing more flexibility for template
126
- * Enhancement/Templating - Using full products loop instead of including product content template
127
- * Fix - Pagination with SEO url issue
128
-
129
- = 1.0.4.2 =
130
- * Enhancement/Fix - Better support for SEO urls with permalinks on/off
131
- * Fix - Critical bug that was returning incorrect products.
132
-
133
- = 1.0.4.1 =
134
- * Enhancement - Adding AJAX for pagination.
135
- * Enhancement - Adding PushState for pagination.
136
- * Enhancement/Fix - Pagination wasn't updating when filters used.
137
- * Enhancement/Fix - Text with amount of results (Eg "Showing all 2 results") wasn't updating after filters applied
138
- * Enhancement/Fix - When choosing Slider in admin Operator became hidden
139
- * Fix - All sliders except price wasn't working with SEO url
140
- * Fix - When changing attribute to/from price in admin all filters jumping
141
- * Fix - After filter applied all products was showed. Even those with Draft status.
142
-
143
- = 1.0.4 =
144
- * Enhancement - SEO friendly urls with possibility for users to share/bookmark their search. Will be shortened in future
145
- * Enhancement - Option added to turn SEO friendly urls on/off. Off by default as this is first version of this feature
146
- * Enhancement - Option to turn filters on/off globally
147
- * Enhancement - Option to take control over (default) sorting function, make it AJAXy and work with filters
148
- * Fix - Sorting remain correct after using filters. Sorting wasn't counted before
149
- * Fix - If there are 2 or more sliders they are not working correctly.
150
- * Fix - Values in slider was converted to float even when value ia not a price.
151
- * Fix - If there are 2 or more values for attribute it was not validated when used in slider.
152
-
153
- = 1.0.3.6 =
154
- * Fix - Removed actions that provide warning messages
155
- * Enhancement - Actions and filters inside plugin
156
-
157
- = 1.0.3.3 =
158
- * Enhancement/Fix - Showing products and options now depending on woocommerce_hide_out_of_stock_items option
159
- * Enhancement/Fix - If not enough data available( quantity of options < 2 ) filters will not be shown.
160
- * Fix - If in category, only products/options from this category will be shown
161
-
162
- = 1.0.3.2 =
163
- * Fix - wrong path was committed in previous version that killed plugin
164
-
165
- = 1.0.3 =
166
- * Enhancement - CSS and JavaScript files minimized
167
- * Enhancement - Settings page added
168
- * Enhancement - "No Products" message and it's class can be changed through admin
169
- * Enhancement - Option added that can enable control over sorting( if visible )
170
- * Enhancement - User can select several categories instead of one. Now you don't need to create several same filters
171
- for different categories.
172
- * Enhancement - Added option "include subcats?". if selected filter will be shown in selected categories and their
173
- subcategories
174
- * Fix - Adding support to themes that require product div to have "product" class
175
- * Fix - Slider in categories wasn't initialized
176
- * Fix - Subcategories wasn't working. Only Main categories were showing filters
177
- * Templating - return woocommerce/theme default structure for product
178
- * Templating - html parts moved to separate files in templates folder. You can overwrite them by creating folder
179
- "woocommerce-filters" and file with same name as in plugin templates folder.
180
-
181
- = 1.0.2 =
182
- * Fix - better support for older PHP versions
183
-
184
- = 1.0.1 =
185
- * First public version
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/admin.css CHANGED
@@ -1,17 +1 @@
1
- .berocket_aapf_advanced_settings{display: none;}.berocket_aapf_widget_admin_height_input{width: 43px;}.berocket_aapf_advanced_settings_categories_list{max-height: 200px;overflow:auto;}.berocket_aapf_advanced_settings_subcategory{float: right;position: relative;top: 3px;}
2
-
3
- .colorpicker_field{width: 30px; height: 30px; margin: 5px auto; border: 1px solid black;}
4
-
5
- .admin-column-color{width: 6%; text-align: center!important;}
6
- .admin-column-font-family{width: 15%;}
7
- .admin-column-font-family select{max-width: 100%;}
8
- .admin-column-font-weight{width: 12%;}
9
- .admin-column-font-weight select{max-width: 100%;}
10
- .admin-column-font-size{width: 10%; text-align: center!important;}
11
- .admin-column-font-size input{max-width: 100%; text-align: center!important;}
12
- .admin-column-dimensions{width: 10%;}
13
- .admin-column-dimensions select{max-width: 100%;}
14
- .admin-column-theme{width: 14%;}
15
- .admin-column-theme select{max-width: 100%;}
16
- .tab-item{display: none;}
17
- .tab-item.current{display: block;}
1
+ .berocket_aapf_advanced_settings{display:none}.berocket_aapf_widget_admin_height_input{width:43px}.berocket_aapf_advanced_settings_categories_list{max-height:200px;overflow:auto}.berocket_aapf_advanced_settings_subcategory{float:right;position:relative;top:3px}.colorpicker_field{width:30px;height:30px;margin:5px auto;border:1px solid #000}.admin-column-color{width:6%;text-align:center!important}.admin-column-font-family{width:15%}.admin-column-font-family select{max-width:100%}.admin-column-font-weight{width:12%}.admin-column-font-weight select{max-width:100%}.admin-column-font-size{width:10%;text-align:center!important}.admin-column-font-size input{max-width:100%;text-align:center!important}.admin-column-dimensions{width:10%}.admin-column-dimensions select{max-width:100%}.admin-column-theme{width:14%}.admin-column-theme select{max-width:100%}.tab-item{display:none}.tab-item.current{display:block}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/widget.css CHANGED
@@ -1,204 +1 @@
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
- }
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:url(../images/ajax-loader.gif) center center no-repeat #fff;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_price_slider.ui-widget-content,.berocket_filter_slider.ui-widget-content{background:#b0b5b9;border:0;border-radius:0;height:4px;padding:0}.berocket_filter_price_slider.ui-widget-content .ui-slider-range,.berocket_filter_slider.ui-widget-content .ui-slider-range{background:#000}.berocket_filter_price_slider.ui-widget-content .ui-slider-handle,.berocket_filter_slider.ui-widget-content .ui-slider-handle{background:url(../images/handler.png) center center/cover no-repeat;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/functions.php CHANGED
@@ -168,26 +168,42 @@ if( ! function_exists( 'br_aapf_args_converter' ) ) {
168
  * convert args-url to normal filters
169
  */
170
  function br_aapf_args_converter() {
171
- if ( preg_match( "~\|~", $_GET['filters'] ) ) {
172
  $filters = explode( "|", $_GET['filters'] );
173
  } else {
174
  $filters[0] = $_GET['filters'];
175
  }
176
 
177
  foreach ( $filters as $filter ) {
178
- list( $attribute, $value ) = explode( "=", $filter );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
 
180
  if ( $attribute == 'price' ) {
181
- $_POST['price'] = explode( "^", $value );
182
  } elseif ( $attribute == 'order' ) {
183
  $_GET['orderby'] = $value;
184
  } else {
185
- $term_or_limit = explode( "^", $value );
186
- if ( $term_or_limit[1] == 'OR' or $term_or_limit[1] == 'AND' ) {
187
- $_POST['terms'][] = array( "pa_" . $attribute, $term_or_limit[0], $term_or_limit[1] );
188
- } else {
189
- $_POST['limits'][] = array( "pa_" . $attribute, $term_or_limit[0], $term_or_limit[1] );
190
- }
 
191
  }
192
  }
193
  }
168
  * convert args-url to normal filters
169
  */
170
  function br_aapf_args_converter() {
171
+ if ( preg_match( "~\|~", $_GET['filters'] ) ) {
172
  $filters = explode( "|", $_GET['filters'] );
173
  } else {
174
  $filters[0] = $_GET['filters'];
175
  }
176
 
177
  foreach ( $filters as $filter ) {
178
+
179
+ if ( preg_match( "~\[~", $filter ) ) {
180
+ list( $attribute, $value ) = explode( "[", trim( preg_replace( "~\]~", "", $filter) ), 2 );
181
+ if ( preg_match( "~\-~", $value ) ) {
182
+ $value = explode( "-", $value );
183
+ $operator = 'OR';
184
+ } elseif ( preg_match( "~\_~", $value ) ) {
185
+ list( $min, $max ) = explode( "_", $value );
186
+ $operator = '';
187
+ } else {
188
+ $value = explode( " ", $value );
189
+ $operator = 'AND';
190
+ }
191
+ }else{
192
+ list( $attribute, $value ) = explode( "-", $filter, 2 );
193
+ }
194
 
195
  if ( $attribute == 'price' ) {
196
+ $_POST['price'] = array( $min, $max );
197
  } elseif ( $attribute == 'order' ) {
198
  $_GET['orderby'] = $value;
199
  } else {
200
+ if ( $operator ) {
201
+ foreach ( $value as $v ) {
202
+ $_POST['terms'][] = array( "pa_" . $attribute, $v, $operator );
203
+ }
204
+ } else {
205
+ $_POST['limits'][] = array( "pa_" . $attribute, $min, $max );
206
+ }
207
  }
208
  }
209
  }
includes/widget.php CHANGED
@@ -67,10 +67,9 @@ class BeRocket_AAPF_Widget extends WP_Widget {
67
 
68
  if ( ! $br_options['products_holder_id'] ) $br_options['products_holder_id'] = 'ul.products';
69
 
 
70
  if ( @ $_POST['terms'] ) {
71
  $post_temrs = @ json_encode( $_POST['terms'] );
72
- } else {
73
- $post_temrs = "[]";
74
  }
75
 
76
  wp_localize_script(
@@ -91,8 +90,13 @@ class BeRocket_AAPF_Widget extends WP_Widget {
91
  extract( $args );
92
  extract( $instance );
93
 
94
- $product_cat = @ json_decode( $product_cat );
 
 
 
 
95
 
 
96
 
97
  if ( $product_cat ) {
98
  $hide_widget = true;
@@ -172,6 +176,7 @@ class BeRocket_AAPF_Widget extends WP_Widget {
172
  set_query_var( 'operator', $operator );
173
  set_query_var( 'title', apply_filters( 'berocket_aapf_widget_title', $title ) );
174
  set_query_var( 'class', apply_filters( 'berocket_aapf_widget_class', $class ) );
 
175
  set_query_var( 'style', apply_filters( 'berocket_aapf_widget_style', $style ) );
176
  set_query_var( 'scroll_theme', $scroll_theme );
177
  set_query_var( 'x', time() );
@@ -259,10 +264,10 @@ class BeRocket_AAPF_Widget extends WP_Widget {
259
 
260
  public static function get_price_range( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items ){
261
  $price_range = array();
262
- $products = BeRocket_AAPF_Widget::get_filter_products( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items );
263
 
264
- foreach ( $products as $product ) {
265
- $meta_values = get_post_meta( $product->ID, '_price' );
266
  if ( $meta_values[0] or $woocommerce_hide_out_of_stock_items != 'yes' ) {
267
  $price_range[] = $meta_values[0];
268
  }
@@ -287,41 +292,49 @@ class BeRocket_AAPF_Widget extends WP_Widget {
287
  return get_terms( $taxonomy, $args );
288
  }
289
 
290
- public static function get_filter_products( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items ) {
291
- global $wpdb;
 
 
 
 
 
292
 
293
- $from = $group = '';
294
- $where = " AND ({$wpdb->posts}.post_status = 'publish') ";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
 
296
- if ( $wp_query_product_cat != - 1 ) {
297
- $wp_query_product_cat = get_term_by( 'slug', $wp_query_product_cat, 'product_cat', OBJECT );
298
- $wp_query_product_cat_id = $wp_query_product_cat->term_id;
299
 
300
- $from = " INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id) ";
301
- $where = " AND ( {$wpdb->term_relationships}.term_taxonomy_id IN ( {$wp_query_product_cat_id} ) )
302
- AND ({$wpdb->posts}.post_status = 'publish' OR {$wpdb->posts}.post_status = 'private') ";
303
- $group = " GROUP BY {$wpdb->posts}.ID ";
304
  }
305
 
306
- if ( $woocommerce_hide_out_of_stock_items == 'yes' ) {
307
- $from .= " INNER JOIN {$wpdb->postmeta} ON ({$wpdb->posts}.ID = {$wpdb->postmeta}.post_id) ";
308
- $where .= " AND ({$wpdb->posts}.post_status = 'publish' OR {$wpdb->posts}.post_status = 'private')
309
- AND ( ({$wpdb->postmeta}.meta_key = '_stock_status' AND CAST({$wpdb->postmeta}.meta_value AS CHAR) = 'instock') ) ";
310
- $group = " GROUP BY {$wpdb->posts}.ID ";
 
311
  }
312
 
313
- $results = $wpdb->get_results("
314
- SELECT SQL_CALC_FOUND_ROWS {$wpdb->posts}.ID
315
- FROM {$wpdb->posts}
316
- {$from}
317
- WHERE 1=1
318
- AND {$wpdb->posts}.post_type = 'product'
319
- {$where}
320
- {$group}
321
- ORDER BY {$wpdb->posts}.post_date ASC"
322
- , OBJECT );
323
-
324
- return $results;
325
  }
326
 
327
  /**
@@ -343,6 +356,7 @@ class BeRocket_AAPF_Widget extends WP_Widget {
343
  $instance['product_cat'] = ( $new_instance['product_cat'] ) ? json_encode( $new_instance['product_cat'] ) : '';
344
  $instance['scroll_theme'] = strip_tags( $new_instance['scroll_theme'] );
345
  $instance['cat_propagation'] = (int) $new_instance['cat_propagation'];
 
346
 
347
  if( $new_instance['height'] != 'auto' ) $new_instance['height'] = (float) $new_instance['height'];
348
  if( !$new_instance['height'] ) $new_instance['height'] = 'auto';
@@ -407,6 +421,7 @@ class BeRocket_AAPF_Widget extends WP_Widget {
407
  $args['post__in'] = BeRocket_AAPF::price_filter( $args['post__in'] );
408
  $args['post_status'] = 'publish';
409
  $args['post_type'] = 'product';
 
410
 
411
  $wp_query = new WP_Query( $args );
412
 
@@ -449,19 +464,28 @@ class BeRocket_AAPF_Widget extends WP_Widget {
449
  die();
450
  }
451
 
452
- function get_product_categories( $current_product_cat = '' ) {
453
  $args = array(
454
  'pad_counts' => 1,
455
  'show_counts' => 1,
456
- 'hierarchical' => 1,
457
  'hide_empty' => 0,
458
  'show_uncategorized' => 0,
459
- 'orderby' => 'name',
460
  'selected' => $current_product_cat,
461
  'menu_order' => false
462
  );
463
 
464
- return get_terms( 'product_cat', apply_filters( 'wc_product_dropdown_categories_get_terms_args', $args ) );
 
 
 
 
 
 
 
 
 
465
  }
466
 
467
  public static function add_product_class( $classes ) {
67
 
68
  if ( ! $br_options['products_holder_id'] ) $br_options['products_holder_id'] = 'ul.products';
69
 
70
+ $post_temrs = "[]";
71
  if ( @ $_POST['terms'] ) {
72
  $post_temrs = @ json_encode( $_POST['terms'] );
 
 
73
  }
74
 
75
  wp_localize_script(
90
  extract( $args );
91
  extract( $instance );
92
 
93
+ if ( $widget_type == 'update_button' ) {
94
+ set_query_var( 'title', apply_filters( 'berocket_aapf_widget_title', $title ) );
95
+ br_get_template_part( 'widget_update_button' );
96
+ return '';
97
+ }
98
 
99
+ $product_cat = @ json_decode( $product_cat );
100
 
101
  if ( $product_cat ) {
102
  $hide_widget = true;
176
  set_query_var( 'operator', $operator );
177
  set_query_var( 'title', apply_filters( 'berocket_aapf_widget_title', $title ) );
178
  set_query_var( 'class', apply_filters( 'berocket_aapf_widget_class', $class ) );
179
+ set_query_var( 'css_class', apply_filters( 'berocket_aapf_widget_css_class', $css_class ) );
180
  set_query_var( 'style', apply_filters( 'berocket_aapf_widget_style', $style ) );
181
  set_query_var( 'scroll_theme', $scroll_theme );
182
  set_query_var( 'x', time() );
264
 
265
  public static function get_price_range( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items ){
266
  $price_range = array();
267
+ $products = BeRocket_AAPF_Widget::get_filter_products( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items, false );
268
 
269
+ foreach ( $products as $ID ) {
270
+ $meta_values = get_post_meta( $ID, '_price' );
271
  if ( $meta_values[0] or $woocommerce_hide_out_of_stock_items != 'yes' ) {
272
  $price_range[] = $meta_values[0];
273
  }
292
  return get_terms( $taxonomy, $args );
293
  }
294
 
295
+ public static function get_filter_products( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items, $use_filters = true ) {
296
+ global $wp_query, $wp_rewrite;
297
+ $_POST['product_cat'] = $wp_query_product_cat;
298
+
299
+ add_filter( 'woocommerce_pagination_args', array( __CLASS__, 'pagination_args' ) );
300
+
301
+ $args = apply_filters( 'berocket_aapf_listener_wp_query_args', array() );
302
 
303
+ if ( $use_filters ) {
304
+ $args['post__in'] = BeRocket_AAPF::limits_filter( array() );
305
+ $args['post__in'] = BeRocket_AAPF::price_filter( $args['post__in'] );
306
+ } else {
307
+ $args = array( 'posts_per_page' => -1 );
308
+ if ( @$_POST['product_cat'] and $_POST['product_cat'] != '-1' ) {
309
+ $args['tax_query'][] = array(
310
+ 'taxonomy' => 'product_cat',
311
+ 'field' => 'slug',
312
+ 'terms' => strip_tags( $_POST['product_cat'] ),
313
+ 'operator' => 'IN'
314
+ );
315
+ }
316
+ }
317
+
318
+ $args['post_status'] = 'publish';
319
+ $args['post_type'] = 'product';
320
 
321
+ $wp_query = new WP_Query( $args );
 
 
322
 
323
+ // here we get max products to know if current page is not too big
324
+ if ( $wp_rewrite->using_permalinks() and preg_match( "~/page/([0-9]+)~", $_POST['location'], $mathces ) or preg_match( "~paged?=([0-9]+)~", $_POST['location'], $mathces ) ) {
325
+ $args['paged'] = min( $mathces[1], $wp_query->max_num_pages );
326
+ $wp_query = new WP_Query( $args );
327
  }
328
 
329
+ $products = array();
330
+ if ( $wp_query->have_posts() ) {
331
+ while ( have_posts() ) {
332
+ the_post();
333
+ $products[] = get_the_ID();
334
+ }
335
  }
336
 
337
+ return $products;
 
 
 
 
 
 
 
 
 
 
 
338
  }
339
 
340
  /**
356
  $instance['product_cat'] = ( $new_instance['product_cat'] ) ? json_encode( $new_instance['product_cat'] ) : '';
357
  $instance['scroll_theme'] = strip_tags( $new_instance['scroll_theme'] );
358
  $instance['cat_propagation'] = (int) $new_instance['cat_propagation'];
359
+ $instance['css_class'] = strip_tags( $new_instance['css_class'] );
360
 
361
  if( $new_instance['height'] != 'auto' ) $new_instance['height'] = (float) $new_instance['height'];
362
  if( !$new_instance['height'] ) $new_instance['height'] = 'auto';
421
  $args['post__in'] = BeRocket_AAPF::price_filter( $args['post__in'] );
422
  $args['post_status'] = 'publish';
423
  $args['post_type'] = 'product';
424
+ $args['post__in'] = BeRocket_AAPF::price_filter( $args['post__in'] );
425
 
426
  $wp_query = new WP_Query( $args );
427
 
464
  die();
465
  }
466
 
467
+ function get_product_categories( $current_product_cat = '', $parent = 0, $data = array(), $depth = 0 ) {
468
  $args = array(
469
  'pad_counts' => 1,
470
  'show_counts' => 1,
471
+ 'hierarchical' => 0,
472
  'hide_empty' => 0,
473
  'show_uncategorized' => 0,
474
+ 'parent' => $parent,
475
  'selected' => $current_product_cat,
476
  'menu_order' => false
477
  );
478
 
479
+ $product_cats = get_terms( 'product_cat', apply_filters( 'wc_product_dropdown_categories_get_terms_args', $args ) );
480
+ if ( ! empty( $product_cats ) ) {
481
+ foreach ( $product_cats as $single_cat ) {
482
+ $single_cat->depth = $depth;
483
+ $data[] = $single_cat;
484
+ $data = self::get_product_categories( $current_product_cat, $single_cat->term_id, $data, $depth + 1 );
485
+ }
486
+ }
487
+
488
+ return $data;
489
  }
490
 
491
  public static function add_product_class( $classes ) {
js/admin.js CHANGED
@@ -1,62 +1 @@
1
- (function ($) {
2
- $(document).ready(function () {
3
-
4
- $(document).on('change', '.berocket_aapf_widget_admin_attribute_select', function () {
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
- } else {
10
- $('.berocket_aapf_widget_admin_type_select', $parent).html('<option value="checkbox">Checkbox</option><option value="radio">Radio</option><option value="select">Select</option><option value="slider">Slider</option>');
11
- $('.berocket_aapf_widget_admin_operator_select', $parent).parent().parent().show(0);
12
- }
13
- });
14
-
15
- $(document).on('change', '.berocket_aapf_widget_admin_type_select', function () {
16
- $parent = $(this).parents('form');
17
- if ($(this).val() == 'slider') {
18
- $('.berocket_aapf_widget_admin_operator_select', $parent).parent().parent().hide(0);
19
- } else {
20
- $('.berocket_aapf_widget_admin_operator_select', $parent).parent().parent().show(0);
21
- }
22
- });
23
-
24
- $(document).on('click', '.berocket_aapf_advanced_settings_pointer', function (event) {
25
- event.preventDefault();
26
- $(this).parent().next().slideDown(300);
27
- $(this).parent().slideUp(200);
28
- });
29
-
30
- $('.colorpicker_field').each(function (i,o){
31
- $(o).css('backgroundColor', '#'+$(o).data('color')).next().val($(o).data('color'));
32
- $(o).colpick({
33
- layout: 'hex',
34
- submit: 0,
35
- color: $(o).data('color'),
36
- onChange: function(hsb,hex,rgb,el,bySetColor) {
37
- $(el).css('backgroundColor', '#'+hex).next().val(hex);
38
- }
39
- })
40
- });
41
-
42
- $('.filter_settings_tabs').on('click', 'a', function (event) {
43
- event.preventDefault();
44
- $id = $(this).attr('href');
45
- $('.tab-item.current').removeClass('current');
46
- $($id).addClass('current');
47
-
48
- $('.filter_settings_tabs .nav-tab').removeClass('nav-tab-active');
49
- $(this).addClass('nav-tab-active');
50
- });
51
-
52
- $(document).on('change', '.berocket_aapf_widget_admin_widget_type_select', function () {
53
- if ( $(this).val() == 'filter' ) {
54
- $('.berocket_aapf_admin_filter_widget_content').show();
55
- } else if( $(this).val() == 'update_button' ) {
56
- $('.berocket_aapf_admin_filter_widget_content').hide();
57
- } else if( $(this).val() == 'selected_area' ) {
58
- $('.berocket_aapf_admin_filter_widget_content').hide();
59
- }
60
- });
61
- })
62
- })(jQuery);
1
+ !function(e){e(document).ready(function(){e(document).on("change",".berocket_aapf_widget_admin_attribute_select",function(){$parent=e(this).parents("form"),"price"==e(this).val()?(e(".berocket_aapf_widget_admin_type_select",$parent).html('<option value="slider">Slider</option>'),e(".berocket_aapf_widget_admin_operator_select",$parent).parent().parent().hide(0)):(e(".berocket_aapf_widget_admin_type_select",$parent).html('<option value="checkbox">Checkbox</option><option value="radio">Radio</option><option value="select">Select</option><option value="slider">Slider</option>'),e(".berocket_aapf_widget_admin_operator_select",$parent).parent().parent().show(0))}),e(document).on("change",".berocket_aapf_widget_admin_type_select",function(){$parent=e(this).parents("form"),"slider"==e(this).val()?e(".berocket_aapf_widget_admin_operator_select",$parent).parent().parent().hide(0):e(".berocket_aapf_widget_admin_operator_select",$parent).parent().parent().show(0)}),e(document).on("click",".berocket_aapf_advanced_settings_pointer",function(t){t.preventDefault(),e(this).parent().next().slideDown(300),e(this).parent().slideUp(200)}),e(".colorpicker_field").each(function(t,a){e(a).css("backgroundColor","#"+e(a).data("color")).next().val(e(a).data("color")),e(a).colpick({layout:"hex",submit:0,color:e(a).data("color"),onChange:function(t,a,n,o,i){e(o).css("backgroundColor","#"+a).next().val(a)}})}),e(".filter_settings_tabs").on("click","a",function(t){t.preventDefault(),$id=e(this).attr("href"),e(".tab-item.current").removeClass("current"),e($id).addClass("current"),e(".filter_settings_tabs .nav-tab").removeClass("nav-tab-active"),e(this).addClass("nav-tab-active")}),e(document).on("change",".berocket_aapf_widget_admin_widget_type_select",function(){"filter"==e(this).val()?e(".berocket_aapf_admin_filter_widget_content").show():"update_button"==e(this).val()?e(".berocket_aapf_admin_filter_widget_content").hide():"selected_area"==e(this).val()&&e(".berocket_aapf_admin_filter_widget_content").hide()})})}(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/widget.min.js CHANGED
@@ -1,416 +1 @@
1
- /* packer link http://dean.edwards.name/packer/ */
2
-
3
- (function ($){
4
- $(document).ready(function (){
5
-
6
- var berocket_aapf_widget_product_filters = [],
7
- berocket_aapf_widget_product_limits = [],
8
- berocket_aapf_widget_product_price_limit = [],
9
- woocommerce_pagination_page = 1,
10
- berocket_aapf_widget_wait_for_button = false,
11
- berocket_aapf_widget_selected_filters = [];
12
-
13
- if( $('.woocommerce-pagination').hasClass('.woocommerce-pagination') ){
14
- woocommerce_pagination_page = parseInt( $('.woocommerce-pagination .current').text() );
15
- if( woocommerce_pagination_page < 1 ) woocommerce_pagination_page = 1;
16
- }
17
-
18
- if( $('.berocket_aapf_widget_update_button').hasClass('berocket_aapf_widget_update_button') ){
19
- berocket_aapf_widget_wait_for_button = true;
20
- }
21
-
22
- function update_selected_area() {
23
- if ( ! $('.berocket_aapf_widget_selected_area').hasClass('berocket_aapf_widget_selected_area') ) {
24
- return false;
25
- }
26
- tmp_html = '';
27
- prev_label = '';
28
- el_type = '';
29
- $(berocket_aapf_widget_selected_filters).each(function (i, $el) {
30
- if ( $el.is('select') ) {
31
- label = $el.data('taxonomy').slice(3).charAt(0).toUpperCase() + $el.data('taxonomy').slice(4);
32
- option = $el.find('option:selected').text();
33
- el_type = 'select';
34
- el_id = $el.attr('id');
35
- } else if ( $el.is('input') ) {
36
- label = $el.data('taxonomy').slice(3).charAt(0).toUpperCase() + $el.data('taxonomy').slice(4);
37
- option = $el.closest('li').find('label').text();
38
- el_type = $el.attr('type');
39
- el_id = $el.attr('id');
40
- } else if ( $el.hasClass('berocket_filter_slider') ) {
41
- val1 = $('#'+$el.data('fields_1')).val();
42
- val2 = $('#'+$el.data('fields_2')).val();
43
- if ( val1 != $el.data('min') || val2 != $el.data('max') ) {
44
- if ( $el.hasClass('berocket_filter_price_slider') ) {
45
- label = 'Price';
46
- } else {
47
- label = $el.data('taxonomy').slice(3).charAt(0).toUpperCase() + $el.data('taxonomy').slice(4);
48
- }
49
- }
50
- el_type = 'slider';
51
- el_id = $el.data('fields_2');
52
- option = val1+' - '+val2;
53
- }
54
-
55
- option = '<li><a href="Unselect '+label+'" data-el_type="'+el_type+'" data-el_id="'+el_id+'">'+option+'</a></li>';
56
-
57
- if ( prev_label == '' ) {
58
- tmp_html += '<div><span>'+label+'</span><ul>'+option;
59
- } else if ( prev_label == label ) {
60
- tmp_html += option;
61
- } else {
62
- tmp_html += '</ul></div><div><span>'+label+'</span><ul>'+option;
63
- }
64
-
65
- prev_label = label;
66
- });
67
-
68
- if ( tmp_html == '' ) {
69
- $('.berocket_aapf_widget_selected_area').html('').hide().prev().hide();
70
- } else {
71
- tmp_html += '</ul></div>'
72
- $('.berocket_aapf_widget_selected_area').html(tmp_html).show().prev().show();
73
- }
74
- }
75
-
76
- function update_data_containers() {
77
- berocket_aapf_widget_product_filters = [];
78
- berocket_aapf_widget_selected_filters = [];
79
- $('.berocket_aapf_widget li:not(.slider) input, .berocket_aapf_widget li:not(slider) select').each(function (i,o) {
80
- $el = $(o);
81
-
82
- if ( $el.is("select") ) {
83
- el_data = $el.find("option:selected").data();
84
-
85
- $(berocket_aapf_widget_product_filters).each(function (i, o) {
86
- if (o[0] == el_data.taxonomy) {
87
- berocket_aapf_widget_product_filters.splice(i, 1);
88
- }
89
- });
90
- if( $el.val() ){
91
- berocket_aapf_widget_product_filters[berocket_aapf_widget_product_filters.length] = [el_data.taxonomy, el_data.term_id, el_data.operator];
92
- berocket_aapf_widget_selected_filters[berocket_aapf_widget_selected_filters.length] = $el;
93
- }
94
- } else {
95
- el_data = $el.data();
96
-
97
- if ($el.is(':checked') || $el.is(':selected')) {
98
- berocket_aapf_widget_product_filters[berocket_aapf_widget_product_filters.length] = [el_data.taxonomy, el_data.term_id, el_data.operator];
99
- berocket_aapf_widget_selected_filters[berocket_aapf_widget_selected_filters.length] = $el;
100
- } else {
101
- $(berocket_aapf_widget_product_filters).each(function (i, o) {
102
- if (o[0] == el_data.taxonomy && o[1] == el_data.term_id) {
103
- berocket_aapf_widget_product_filters.splice(i, 1);
104
- }
105
- });
106
- }
107
- }
108
- });
109
-
110
- berocket_aapf_widget_product_limits = [];
111
- berocket_aapf_widget_product_price_limit = [];
112
- $t = $('.berocket_filter_slider');
113
- if( $t.hasClass('berocket_filter_slider') ){
114
- $t.each(function (i,o){
115
- val1 = $('#'+$(o).data('fields_1')).val();
116
- val2 = $('#'+$(o).data('fields_2')).val();
117
- if( val1 != $(o).data('min') || val2 != $(o).data('max') ){
118
- berocket_aapf_widget_selected_filters[berocket_aapf_widget_selected_filters.length] = $(o);
119
- if( $(o).hasClass('berocket_filter_price_slider') ){
120
- berocket_aapf_widget_product_price_limit = [val1, val2];
121
- }else{
122
- berocket_aapf_widget_product_limits[berocket_aapf_widget_product_limits.length] = [$(o).data('taxonomy'), val1, val2];
123
- }
124
- }
125
- });
126
- }
127
- }
128
-
129
- function updateProducts( $force ){
130
- if ( typeof $force == 'undefined' ) $force = false;
131
- // if we have update_button on the page we must wait for it to be clicked
132
- if ( ! $force && berocket_aapf_widget_wait_for_button ) return false;
133
-
134
- if ( typeof the_ajax_script.user_func != 'undefined'
135
- && the_ajax_script.user_func != null
136
- && typeof the_ajax_script.user_func.before_update != 'undefined'
137
- && the_ajax_script.user_func.before_update.length > 0
138
- ) {
139
- eval( the_ajax_script.user_func.before_update );
140
- }
141
-
142
- $(the_ajax_script.products_holder_id).addClass('hide_products').append('<div class="berocket_aapf_widget_loading" />');
143
-
144
- update_data_containers();
145
- update_selected_area();
146
-
147
- args = {
148
- terms: berocket_aapf_widget_product_filters,
149
- price: berocket_aapf_widget_product_price_limit,
150
- limits: berocket_aapf_widget_product_limits,
151
- product_cat: the_ajax_script.product_cat,
152
- action: 'berocket_aapf_listener',
153
- orderby: $('.woocommerce-ordering select.orderby').val()
154
- };
155
-
156
- if( the_ajax_script.seo_friendly_urls && 'history' in window && 'pushState' in history ) {
157
- updateLocation(args);
158
- args.location = location.href;
159
- }else{
160
- args.location = the_ajax_script.current_page_url;
161
-
162
- cur_page = $('.woocommerce-pagination span.current').text();
163
- if( prev_page = location.href.replace(/.+\/page\/([0-9]+).+/, "$1") ){
164
- if( ! parseInt( cur_page ) ){
165
- cur_page = prev_page;
166
- }
167
- args.location = args.location.replace(/\/?/,"") + "/page/" + cur_page + "/";
168
- }else if( prev_page = location.href.replace(/.+paged?=([0-9]+).+/, "$1") ){
169
- if( ! parseInt( cur_page ) ){
170
- cur_page = prev_page;
171
- }
172
- args.location = args.location.replace(/\/?/,"") + "?page=" + cur_page + "";
173
- }
174
- }
175
-
176
- $.post(the_ajax_script.ajaxurl, args, function (data) {
177
- $('.woocommerce-result-count').remove();
178
- $('.woocommerce-pagination').remove();
179
- $('form.woocommerce-ordering').remove();
180
-
181
- if ( typeof the_ajax_script.user_func != 'undefined'
182
- && the_ajax_script.user_func != null
183
- && typeof the_ajax_script.user_func.on_update != 'undefined'
184
- && the_ajax_script.user_func.on_update.length > 0
185
- ) {
186
- eval( the_ajax_script.user_func.on_update );
187
- }
188
-
189
- if ( $('.woocommerce-info').hasClass('woocommerce-info') && ! $(the_ajax_script.products_holder_id).is(':visible') ) {
190
- if ( typeof data.products != 'undefined' ) {
191
- $('.woocommerce-info').replaceWith(data.products);
192
- }
193
- } else {
194
- if ( typeof data.no_products != 'undefined' ) {
195
- $(the_ajax_script.products_holder_id).html(data.no_products).removeClass('hide_products');
196
- } else {
197
- $(the_ajax_script.products_holder_id).replaceWith(data.products).removeClass('hide_products');
198
- }
199
- }
200
-
201
- $('.berocket_aapf_widget_loading').remove();
202
-
203
- aapf_action_init();
204
-
205
- if ( typeof the_ajax_script.user_func != 'undefined'
206
- && the_ajax_script.user_func != null
207
- && typeof the_ajax_script.user_func.after_update != 'undefined'
208
- && the_ajax_script.user_func.after_update.length > 0
209
- ) {
210
- eval( the_ajax_script.user_func.after_update );
211
- }
212
- }, "json");
213
- }
214
-
215
- function updateLocation( args ){
216
- uri_request_array = [];
217
- uri_request = '';
218
-
219
- if( args.orderby && $('.woocommerce-ordering select.orderby option:first').attr('value') != args.orderby ){
220
- uri_request_array[uri_request_array.length] = 'order='+args.orderby;
221
- }
222
- if( args.product_cat && args.product_cat > 0 ){
223
- uri_request_array[uri_request_array.length] = 'pcategory='+args.product_cat;
224
- }
225
- if( args.price ){
226
- $price_obj = $('.berocket_filter_price_slider');
227
- if( args.price[0] && args.price[1] && ( args.price[0] != $price_obj.data('min') || args.price[1] != $price_obj.data('max') ) ){
228
- uri_request_array[uri_request_array.length] = 'price='+args.price[0]+'^'+args.price[1];
229
- }
230
- }
231
- if( args.limits ){
232
- $(args.limits).each(function (i,o){
233
- uri_request_array[uri_request_array.length] = o[0].substring(3)+'='+o[1]+'^'+o[2];
234
- });
235
- }
236
- if( args.terms ){
237
- $(args.terms).each(function (i,o){
238
- uri_request_array[uri_request_array.length] = o[0].substring(3)+'='+o[1]+'^'+o[2];
239
- });
240
- }
241
-
242
- var uri = the_ajax_script.current_page_url;
243
-
244
- if( uri_request_array.length ){
245
- $(uri_request_array).each(function (i,o){
246
- if( uri_request ) uri_request += "|";
247
- uri_request += o;
248
- });
249
- }
250
-
251
- cur_page = $('.woocommerce-pagination span.current').text();
252
- if( prev_page = parseInt( location.href.replace(/.+\/page\/([0-9]+).+/, "$1") ) ){
253
- if( ! parseInt( cur_page ) ){
254
- cur_page = prev_page;
255
- }
256
- uri = uri.replace(/\/?$/,"") + "/page/" + cur_page + "/";
257
- if( uri_request ){
258
- uri = uri + "?filters=" + uri_request;
259
- }
260
- }else{
261
- something_added = false;
262
- if( /\?/.test(location.href) ){
263
- passed_vars1 = location.href.split('?');
264
- if( passed_vars1[1] ){
265
- passed_vars2 = [];
266
- temp2 = [];
267
- if( /&/.test(passed_vars1[1]) ) {
268
- passed_vars2 = passed_vars1[1].split('&');
269
- passed_vars2_length = passed_vars2.length;
270
- for ( k = 0; k < passed_vars2_length; k++ ){
271
- temp = passed_vars2[k].split('=');
272
- passed_vars2[k] = [];
273
- passed_vars2[k][0] = temp.shift();
274
- passed_vars2[k][1] = temp.join("=")
275
- }
276
- }else{
277
- passed_vars2[0] = [];
278
- temp = passed_vars1[1].split('=');
279
- passed_vars2[0][0] = temp.shift();
280
- passed_vars2[0][1] = temp.join("=")
281
- }
282
- for ( k = 0; k < passed_vars2.length; k++ ){
283
- if( passed_vars2[k][0] == 'filters' || passed_vars2[k][0] == 'page' || passed_vars2[k][0] == 'paged' ) continue;
284
-
285
- if( something_added ) uri += '&';
286
- else uri += '?';
287
-
288
- uri += passed_vars2[k][0]+'='+passed_vars2[k][1];
289
- something_added = true;
290
- }
291
- }
292
- }
293
- if( something_added && uri_request ){
294
- uri = uri + "&filters=" + uri_request;
295
- if( cur_page > 1 ){
296
- uri = uri + "&paged=" + parseInt( cur_page );
297
- }
298
- }else if( uri_request ){
299
- uri = uri + "?filters=" + uri_request;
300
- if( cur_page > 1 ){
301
- uri = uri + "&paged=" + parseInt( cur_page );
302
- }
303
- }else if( cur_page > 1 ){
304
- uri = uri + "?paged=" + parseInt( cur_page );
305
- }
306
- }
307
-
308
- var stateParameters = { BeRocket: "Rules" };
309
- history.pushState(stateParameters, "BeRocket Rules", uri);
310
- history.pathname = uri;
311
- }
312
-
313
- function aapf_action_init(){
314
- // Take control over (default) pagination and sorting, make it AJAXy and work with filters
315
- $('.woocommerce-pagination').on('click', 'a', function (event) {
316
- event.preventDefault();
317
- if ( $(this).hasClass('next') ) {
318
- _next_page = parseInt( $('.woocommerce-pagination span.current').text() ) + 1;
319
- } else if ( $(this).hasClass('prev') ) {
320
- _next_page = parseInt( $('.woocommerce-pagination span.current').text() ) - 1;
321
- } else {
322
- _next_page = $(this).text();
323
- }
324
- $('.woocommerce-pagination span.current').removeClass('current');
325
- $(this).after("<span class='page-numbers current'>"+_next_page+"</span>").remove();
326
- updateProducts(true);
327
- });
328
- }
329
-
330
- $('.berocket_aapf_widget').on("change", "input, select", function(){
331
- updateProducts();
332
- });
333
-
334
- $( ".berocket_filter_slider" ).each(function (i,o){
335
- $(o).slider({
336
- range: true,
337
- min: $(o).data('min')>>0,
338
- max: $(o).data('max')>>0,
339
- values: [$(o).data('value1')>>0,$(o).data('value2')>>0],
340
- slide: function( event, ui ) {
341
- $o = $(ui.handle).parents('div.berocket_filter_slider');
342
- vals = ui.values;
343
- if( $(o).hasClass('berocket_filter_price_slider') ){
344
- vals[0] = vals[0].toFixed(2);
345
- vals[1] = vals[1].toFixed(2);
346
- }
347
- $( '#'+$o.data('fields_1') ).val( vals[0] );
348
- $( '#'+$o.data('fields_2') ).val( vals[1] );
349
- },
350
- stop: function(){
351
- updateProducts();
352
- }
353
- });
354
- });
355
-
356
- $(".berocket_aapf_widget_height_control").each(function (i,o){
357
- $(o).mCustomScrollbar({
358
- axis: "xy",
359
- theme: $(o).data('scroll_theme'),
360
- scrollInertia: 300
361
- });
362
- });
363
-
364
- $(".berocket_aapf_widget_selected_area").on('click', 'a', function (event){
365
- event.preventDefault();
366
- $obj = $(this);
367
- el_type = $obj.data('el_type');
368
- if ( el_type == 'checkbox' ) {
369
- $('#'+$obj.data('el_id')+'-styler').click();
370
- } else if ( el_type == 'radio' ) {
371
- $('#'+$obj.data('el_id')+'-styler').reset();
372
- //$('#'+$obj.data('el_id')).prop('checked', false);
373
- } else if ( el_type == 'select' ) {
374
- $('#'+$obj.data('el_id')+' option:selected').prop('checked', false);
375
- } else if ( el_type == 'slider' ) {
376
- $slider = $('#'+$obj.data('el_id')).closest('li').find('.berocket_filter_slider');
377
- console.log( $slider );
378
- val1 = parseFloat($slider.data('min'));
379
- val2 = parseFloat($slider.data('max'));
380
-
381
- if( $slider.hasClass('berocket_filter_price_slider') ){
382
- val1 = val1.toFixed(2);
383
- val2 = val2.toFixed(2);
384
- }
385
-
386
- $( '#'+$slider.data('fields_1') ).val( val1 );
387
- $( '#'+$slider.data('fields_2') ).val( val2 );
388
- console.log( [ val1, val2 ] );
389
- $slider.slider( "values", [ val1, val2 ] );
390
-
391
- updateProducts();
392
- }
393
- });
394
-
395
- // Option to take control over (default) sorting, make it AJAXy and work with filters
396
- if( the_ajax_script.control_sorting ) {
397
- $(document).on('submit', 'form.woocommerce-ordering', function (event) {
398
- event.preventDefault();
399
- });
400
- $(document).on('change', 'select.orderby', function (event) {
401
- event.preventDefault();
402
- updateProducts(true);
403
- });
404
- }
405
-
406
- aapf_action_init();
407
-
408
- $(document).on('click', '.berocket_aapf_widget_update_button', function (event) {
409
- event.preventDefault();
410
- updateProducts(true);
411
- });
412
-
413
- update_data_containers();
414
- update_selected_area();
415
- });
416
- })(jQuery);
1
+ 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}('(7($){$(1r).2D(7(){1s f=[],1f=[],1t=[],1u=1,1N=P,J=[];5($(\'.h-G\').u(\'.h-G\')){1u=H($(\'.h-G .Q\').R());5(1u<1)1u=1}5($(\'.1O\').u(\'1O\')){1N=U}7 1v(a){5(S n.1g!=\'V\'&&n.1g!=2E&&S a!=\'V\'&&a.p>0){2F(a)}}7 1P(){5(!$(\'.1h\').u(\'1h\')){1Q P}W=\'\';1w=\'\';v=\'\';$(J).z(7(i,a){5(a.13(\'K\')){A=a.6(\'B\').14(3).1R(0).1S()+a.6(\'B\').14(4);w=a.1x(\'w:1y\').R();v=\'K\';L=a.1z(\'2c\')}8 5(a.13(\'1A\')){A=a.6(\'B\').14(3).1R(0).1S()+a.6(\'B\').14(4);w=a.2d(\'15\').1x(\'A\').R();v=a.1z(\'1T\');L=a.1z(\'2c\')}8 5(a.u(\'16\')){r=$(\'#\'+a.6(\'1B\')).I();s=$(\'#\'+a.6(\'1i\')).I();5(r!=a.6(\'17\')||s!=a.6(\'18\')){5(a.u(\'1j\')){A=\'2G\'}8{A=a.6(\'B\').14(3).1R(0).1S()+a.6(\'B\').14(4)}}v=\'q\';L=a.6(\'1i\');w=r+\' - \'+s}w=\'<15><a X="2H \'+A+\'" 6-v="\'+v+\'" 6-L="\'+L+\'">\'+w+\'</a></15>\';5(1w==\'\'){W+=\'<19><C>\'+A+\'</C><1C>\'+w}8 5(1w==A){W+=w}8{W+=\'</1C></19><19><C>\'+A+\'</C><1C>\'+w}1w=A});5(W==\'\'){$(\'.1h\').1U(\'\').2e().1k().2e()}8{W+=\'</1C></19>\';$(\'.1h\').1U(W).2f().1k().2f()}}7 1V(){f=[];J=[];$(\'.1D 15:1W(.q) 1A, .1D 15:1W(q) K\').z(7(i,o){$M=$(o);5($M.13("K")){D=$M.1x("w:1y").6();$(f).z(7(i,o){5(o[0]==D.B){f.2g(i,1)}});5($M.I()){f[f.p]=[D.B,D.1X,D.2h];J[J.p]=$M}}8{D=$M.6();5($M.13(\':1E\')||$M.13(\':1y\')){f[f.p]=[D.B,D.1X,D.2h];J[J.p]=$M}8{$(f).z(7(i,o){5(o[0]==D.B&&o[1]==D.1X){f.2g(i,1)}})}}});1f=[];1t=[];$t=$(\'.16\');5($t.u(\'16\')){$t.z(7(i,o){r=$(\'#\'+$(o).6(\'1B\')).I();s=$(\'#\'+$(o).6(\'1i\')).I();5(r!=$(o).6(\'17\')||s!=$(o).6(\'18\')){J[J.p]=$(o);5($(o).u(\'1j\')){1t=[r,s]}8{1f[1f.p]=[$(o).6(\'B\'),r,s]}}})}}7 T(b){5(S b==\'V\')b=P;5(!b&&1N)1Q P;1v(n.1g.2I);$(n.1F).2J(\'1Y\').2K(\'<19 2i="2j" />\');1V();1P();N={1Z:f,O:1t,20:1f,1l:n.1l,2L:\'2M\',Y:$(\'.h-1G K.Y\').I()};5(n.2N&&\'1H\'21 2O&&\'2k\'21 1H){2l(N);N.x=x.X}8{N.x=n.2m;j=$(\'.h-G C.Q\').R();5(1a=x.X.1b(/.+\\/Z\\/([0-9]+).+/,"$1")){5(!H(j)){j=1a}N.x=N.x.1b(/\\/?/,"")+"/Z/"+j+"/"}8 5(1a=x.X.1b(/.+1m?=([0-9]+).+/,"$1")){5(!H(j)){j=1a}N.x=N.x.1b(/\\/?/,"")+"?Z="+j+""}}$.2P(n.2Q,N,7(a){$(\'.h-2R-2S\').1n();$(\'.h-G\').1n();$(\'2n.h-1G\').1n();1v(n.1g.2T);5($(\'.h-22\').u(\'h-22\')&&!$(n.1F).13(\':2U\')){5(S a.23!=\'V\'){$(\'.h-22\').2o(a.23)}}8{5(S a.2p!=\'V\'){$(n.1F).1U(a.2p).24(\'1Y\')}8{$(n.1F).2o(a.23).24(\'1Y\')}}$(\'.2j\').1n();25();1v(n.1g.2V)},"2W")}7 2l(c){E=[];g=\'\';l=[];5(c.Y&&$(\'.h-1G K.Y w:2X\').1z(\'2Y\')!=c.Y){g+=\'2Z-\'+c.Y}5(c.1l&&c.1l>0){5(g)g+="|";g+=\'30-\'+c.1l}5(c.O){$26=$(\'.1j\');5(c.O[0]&&c.O[1]&&(c.O[0]!=$26.6(\'17\')||c.O[1]!=$26.6(\'18\'))){5(g)g+="|";g+=\'O[\'+c.O[0]+\'2q\'+c.O[1]+\']\'}}5(c.20){$(c.20).z(7(i,o){5(!F(o[0].y(3),l)){l[l.p]=o[0].y(3)}5(S E[F(o[0].y(3),l)]==\'V\'){E[F(o[0].y(3),l)]=[]}E[F(o[0].y(3),l)][E[F(o[0].y(3),l)].p]=[o[1],o[2]]})}5(c.1Z){$(c.1Z).z(7(i,o){5(!F(o[0].y(3),l)){l[l.p]=o[0].y(3)}5(S E[F(o[0].y(3),l)]==\'V\'){E[F(o[0].y(3),l)]=[]}E[F(o[0].y(3),l)][E[F(o[0].y(3),l)].p]=[o[1],o[2]]})}1s d=n.2m;5(E.p){$(E).z(7(i,o){5(g)g+="|";5(S o!=\'31\'){g+=o}8{27=P;g+=l[i]+\'[\';$(o).z(7(a,b){5((b[1]==\'2r\'||b[1]==\'32\')){5(27){5(b[1]==\'2r\'){g+=\'+\'}8{g+=\'-\'}}}8{b[0]+=\'2q\'+b[1]}g+=b[0];27=U});g+=\']\'}})}j=$(\'.h-G C.Q\').R();5(1a=H(x.X.1b(/.+\\/Z\\/([0-9]+).+/,"$1"))){5(!H(j)){j=1a}d=d.1b(/\\/?$/,"")+"/Z/"+j+"/";5(g){d=d+"?1I="+g}}8{1J=P;5(/\\?/.2s(x.X)){1o=x.X.1K(\'?\');5(1o[1]){m=[];33=[];5(/&/.2s(1o[1])){m=1o[1].1K(\'&\');2t=m.p;28(k=0;k<2t;k++){1c=m[k].1K(\'=\');m[k]=[];m[k][0]=1c.2u();m[k][1]=1c.2v("=")}}8{m[0]=[];1c=1o[1].1K(\'=\');m[0][0]=1c.2u();m[0][1]=1c.2v("=")}28(k=0;k<m.p;k++){5(m[k][0]==\'1I\'||m[k][0]==\'Z\'||m[k][0]==\'1m\')34;5(1J)d+=\'&\';8 d+=\'?\';d+=m[k][0]+\'=\'+m[k][1];1J=U}}}5(1J&&g){d=d+"&1I="+g;5(j>1){d=d+"&1m="+H(j)}}8 5(g){d=d+"?1I="+g;5(j>1){d=d+"&1m="+H(j)}}8 5(j>1){d=d+"?1m="+H(j)}}1s e={2w:"2x"};1H.2k(e,"2w 2x",d);1H.35=d}7 25(){$(\'.h-G\').10(\'1p\',\'a\',7(a){a.1d();5($(11).u(\'36\')){1L=H($(\'.h-G C.Q\').R())+1}8 5($(11).u(\'1k\')){1L=H($(\'.h-G C.Q\').R())-1}8{1L=$(11).R()}$(\'.h-G C.Q\').24(\'Q\');$(11).37("<C 2i=\'Z-38 Q\'>"+1L+"</C>").1n();T(U)})}7 F(a,b,c){1s d=P,1q,c=!!c;28(1q 21 b){5((c&&b[1q]===a)||(!c&&b[1q]==a)){d=1q;39}}1Q d}$(\'.1D\').10("1p","1A[1T=\'29\'] + A",7(a){a.1d()||$(11).1k().2a(\'1E\',!$(11).1k().2a(\'1E\'));T()});$(\'.1D\').10("2y","1A:1W([1T=\'29\']), K",7(a){T()});$(".16").z(7(i,o){$(o).q({3a:U,17:$(o).6(\'17\')>>0,18:$(o).6(\'18\')>>0,2b:[$(o).6(\'3b\')>>0,$(o).6(\'3c\')>>0],3d:7(a,b){$o=$(b.3e).3f(\'19.16\');12=b.2b;5($(o).u(\'1j\')){12[0]=12[0].1M(2);12[1]=12[1].1M(2)}$(\'#\'+$o.6(\'1B\')).I(12[0]);$(\'#\'+$o.6(\'1i\')).I(12[1])},3g:7(){T()}})});$(".3h").z(7(i,o){$(o).3i({3j:"3k",3l:$(o).6(\'3m\'),3n:3o})});$(".1h").10(\'1p\',\'a\',7(a){a.1d();$1e=$(11);v=$1e.6(\'v\');5(v==\'3p\'){$(\'#\'+$1e.6(\'L\')+\'-2z\').1p()}8 5(v==\'29\'){$(\'#\'+$1e.6(\'L\')+\'-2z\').3q()}8 5(v==\'K\'){$(\'#\'+$1e.6(\'L\')+\' w:1y\').2a(\'1E\',P)}8 5(v==\'q\'){$q=$(\'#\'+$1e.6(\'L\')).2d(\'15\').1x(\'.16\');2A.2B($q);r=2C($q.6(\'17\'));s=2C($q.6(\'18\'));5($q.u(\'1j\')){r=r.1M(2);s=s.1M(2)}$(\'#\'+$q.6(\'1B\')).I(r);$(\'#\'+$q.6(\'1i\')).I(s);2A.2B([r,s]);$q.q("2b",[r,s]);T()}});5(n.3r){$(1r).10(\'3s\',\'2n.h-1G\',7(a){a.1d()});$(1r).10(\'2y\',\'K.Y\',7(a){a.1d();T(U)})}25();$(1r).10(\'1p\',\'.1O\',7(a){a.1d();T(U)});1V();1P()})})(3t);',62,216,'|||||if|data|function|else||||||||uri_request|woocommerce||cur_page||temp_terms|passed_vars2|the_ajax_script||length|slider|val1|val2||hasClass|el_type|option|location|substring|each|label|taxonomy|span|el_data|uri_request_array|in_array|pagination|parseInt|val|berocket_aapf_widget_selected_filters|select|el_id|el|args|price|false|current|text|typeof|updateProducts|true|undefined|tmp_html|href|orderby|page|on|this|vals|is|slice|li|berocket_filter_slider|min|max|div|prev_page|replace|temp|preventDefault|obj|berocket_aapf_widget_product_limits|user_func|berocket_aapf_widget_selected_area|fields_2|berocket_filter_price_slider|prev|product_cat|paged|remove|passed_vars1|click|key|document|var|berocket_aapf_widget_product_price_limit|woocommerce_pagination_page|berocket_fire|prev_label|find|selected|attr|input|fields_1|ul|berocket_aapf_widget|checked|products_holder_id|ordering|history|filters|something_added|split|_next_page|toFixed|berocket_aapf_widget_wait_for_button|berocket_aapf_widget_update_button|update_selected_area|return|charAt|toUpperCase|type|html|update_data_containers|not|term_id|hide_products|terms|limits|in|info|products|removeClass|aapf_action_init|price_obj|cnt_oo|for|radio|prop|values|id|closest|hide|show|splice|operator|class|berocket_aapf_widget_loading|pushState|updateLocation|current_page_url|form|replaceWith|no_products|_|AND|test|passed_vars2_length|shift|join|BeRocket|Rules|change|styler|console|log|parseFloat|ready|null|eval|Price|Unselect|before_update|addClass|append|action|berocket_aapf_listener|seo_friendly_urls|window|post|ajaxurl|result|count|on_update|visible|after_update|json|first|value|order|pcategory|object|OR|temp2|continue|pathname|next|after|numbers|break|range|value1|value2|slide|handle|parents|stop|berocket_aapf_widget_height_control|mCustomScrollbar|axis|xy|theme|scroll_theme|scrollInertia|300|checkbox|reset|control_sorting|submit|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.1
8
- Stable tag: 1.1.0.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -35,11 +35,14 @@ http://woocommerce-product-filter.berocket.com
35
  *check installation*
36
 
37
 
38
- = New in recent version: =
39
- * Show all values - on plugin settings page you can enable option to show all values no matter if they are used or not
40
- * Values order - you can set values order when editing attribute. You can set how to order (by id, name or custom). If
41
- you set to order `by custom` you can drag&amp;drop values up and down and set your own order.
42
- * Fixes
 
 
 
43
 
44
 
45
  = Shortcode: =
@@ -47,6 +50,7 @@ you set to order `by custom` you can drag&amp;drop values up and down and set yo
47
  * In PHP `do_shortcode('[br_filters attribute=price type=slider title="Price Filter"]');`
48
 
49
  = Shortcode Options: =
 
50
  * `attribute`(required) - product attribute, eg price or length. Don't forget that woocommerce adding pa_ suffix for created attributes.
51
  So if you create new attribute `jump` its name is `pa_jump`
52
  * `type`(required) - checkbox, radio, slider or select
@@ -60,6 +64,7 @@ you set to order `by custom` you can drag&amp;drop values up and down and set yo
60
 
61
  = Advanced Settings (Widget area): =
62
 
 
63
  * Product Category - if you want to pin your filter to category of the product this is good place to do it.
64
  Eg. You selling Phones and Cases for them. If user choose Category "Phones" filter "Have Wi-Fi" will appear
65
  but if user will choose "Cases" it will not be there as Admin set that "Have Wi-Fi" filter will be visible only on
@@ -110,6 +115,16 @@ you set to order `by custom` you can drag&amp;drop values up and down and set yo
110
 
111
  == Changelog ==
112
 
 
 
 
 
 
 
 
 
 
 
113
  = 1.1.0.2 =
114
  * Fix - another js issue that stops plugin from work
115
  * Fix - order by name, name_numeric and attribute ID wasn't working
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.1
8
+ Stable tag: 1.1.0.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
35
  *check installation*
36
 
37
 
38
+ = New in recent version(s): =
39
+ * Custom CSS class can be added per widget/filter
40
+ * Update button - if added products will be updated only when user click Update button
41
+ * Radio-box can be unselected by clicking it again
42
+ * Urls are shortened using better structure to save filters
43
+ * Fixed issue with shortened tags for shortcode.
44
+ * Widget now has subcategories(hierarchy) to show all possible categories
45
+ * Minor fixes
46
 
47
 
48
  = Shortcode: =
50
  * In PHP `do_shortcode('[br_filters attribute=price type=slider title="Price Filter"]');`
51
 
52
  = Shortcode Options: =
53
+ * `widget_type` - filter or update_button
54
  * `attribute`(required) - product attribute, eg price or length. Don't forget that woocommerce adding pa_ suffix for created attributes.
55
  So if you create new attribute `jump` its name is `pa_jump`
56
  * `type`(required) - checkbox, radio, slider or select
64
 
65
  = Advanced Settings (Widget area): =
66
 
67
+ * CSS Class - if you want to style filters in different manner you can add class here and use it in css
68
  * Product Category - if you want to pin your filter to category of the product this is good place to do it.
69
  Eg. You selling Phones and Cases for them. If user choose Category "Phones" filter "Have Wi-Fi" will appear
70
  but if user will choose "Cases" it will not be there as Admin set that "Have Wi-Fi" filter will be visible only on
115
 
116
  == Changelog ==
117
 
118
+ = 1.1.0.3 =
119
+ * Enhancement - Custom CSS class can be added per widget/filter
120
+ * Enhancement - Update button. If added products will be updated only when user click Update button
121
+ * Enhancement - Radio-box can be unselected by clicking it again
122
+ * Enhancement/Fix - Urls are shortened using better structure to save filters. `~` symbol is not used now
123
+ * Fix - issue with shortened tags for shortcode.
124
+ * Fix - on widgets page widget now has subcategories(hierarchy)
125
+ * Fix - all categories are visible, not only that have products inside(popular)
126
+ * Minor fixes
127
+
128
  = 1.1.0.2 =
129
  * Fix - another js issue that stops plugin from work
130
  * Fix - order by name, name_numeric and attribute ID wasn't working
templates/admin.php CHANGED
@@ -3,7 +3,6 @@
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">Filter</option>
5
  <option <?php if ($instance['widget_type'] == 'update_button') echo 'selected'; ?> value="update_button">Update Products button</option>
6
- <option <?php if ($instance['widget_type'] == 'selected_area') echo 'selected'; ?> value="selected_area">Selected Filters area</option>
7
  </select>
8
  </label>
9
  </p>
@@ -49,6 +48,11 @@
49
  <a href="#" class='berocket_aapf_advanced_settings_pointer'>Advanced Settings</a>
50
  </p>
51
  <div class='berocket_aapf_advanced_settings'>
 
 
 
 
 
52
  <p>
53
  <label>Product Category:
54
  <label class="berocket_aapf_advanced_settings_subcategory">
@@ -70,6 +74,9 @@
70
  }
71
  ?>
72
  <li>
 
 
 
73
  <input type="checkbox" name="<?php echo $this->get_field_name( 'product_cat' ); ?>[]" <?php if ( $selected_category ) echo 'checked'; ?> value="<?php echo $category->slug ?>" class="berocket_aapf_widget_admin_height_input" />
74
  <?php echo $category->name ?>
75
  </li>
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">Filter</option>
5
  <option <?php if ($instance['widget_type'] == 'update_button') echo 'selected'; ?> value="update_button">Update Products button</option>
 
6
  </select>
7
  </label>
8
  </p>
48
  <a href="#" class='berocket_aapf_advanced_settings_pointer'>Advanced Settings</a>
49
  </p>
50
  <div class='berocket_aapf_advanced_settings'>
51
+ <p>
52
+ <label for="<?php echo $this->get_field_id( 'css_class' ); ?>">CSS Class: </label>
53
+ <input id="<?php echo $this->get_field_id( 'css_class' ); ?>" type="text" name="<?php echo $this->get_field_name( 'css_class' ); ?>" value="<?php echo $instance['css_class']; ?>" class="berocket_aapf_widget_admin_css_class_input" />
54
+ <small>(use white space for multiple classes)</small>
55
+ </p>
56
  <p>
57
  <label>Product Category:
58
  <label class="berocket_aapf_advanced_settings_subcategory">
74
  }
75
  ?>
76
  <li>
77
+ <?php
78
+ if ( @ (int)$category->depth ) for ( $depth_i = 0; $depth_i < $category->depth*3; $depth_i++ ) echo "&nbsp;";
79
+ ?>
80
  <input type="checkbox" name="<?php echo $this->get_field_name( 'product_cat' ); ?>[]" <?php if ( $selected_category ) echo 'checked'; ?> value="<?php echo $category->slug ?>" class="berocket_aapf_widget_admin_height_input" />
81
  <?php echo $category->name ?>
82
  </li>
templates/checkbox.php CHANGED
@@ -9,11 +9,11 @@
9
  * @version 1.0.1
10
  */
11
  ?>
12
- <?php foreach( $terms as $term ):?>
13
  <li>
14
  <span>
15
- <input class="<?=$uo['class']['checkbox_radio']?>" type='checkbox' id='radio_<?=$term->term_id?>'
16
- data-term_id='<?=$term->term_id?>' data-taxonomy='<?=$term->taxonomy?>' data-operator='<?=$operator?>'
17
  <?php
18
  if( @ $_POST['terms'] ){
19
  foreach( $_POST['terms'] as $p_term ){
@@ -23,7 +23,7 @@
23
  }
24
  }
25
  }
26
- ?> /><label for='radio_<?=$term->term_id?>'> <?=$term->name?></label>
27
  </span>
28
  </li>
29
  <?php endforeach; ?>
9
  * @version 1.0.1
10
  */
11
  ?>
12
+ <?php foreach( $terms as $term ): ?>
13
  <li>
14
  <span>
15
+ <input class="<?php echo $uo['class']['checkbox_radio'] ?>" type='checkbox' id='radio_<?php echo $term->term_id ?>'
16
+ data-term_id='<?php echo $term->term_id ?>' data-taxonomy='<?php echo $term->taxonomy ?>' data-operator='<?php echo $operator ?>'
17
  <?php
18
  if( @ $_POST['terms'] ){
19
  foreach( $_POST['terms'] as $p_term ){
23
  }
24
  }
25
  }
26
+ ?> /><label for='radio_<?php echo $term->term_id ?>'> <?php echo $term->name ?></label>
27
  </span>
28
  </li>
29
  <?php endforeach; ?>
templates/radio.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php foreach( $terms as $term ): ?>
2
  <li>
3
  <span>
4
- <input class="<?=$uo['class']['checkbox_radio']?>" type='radio' id='radio_<?=$term->term_id?>'
5
- name='radio_<?=$term->taxonomy?>_<?=$x?>' data-term_id='<?=$term->term_id?>'
6
- data-taxonomy='<?=$term->taxonomy?>' data-operator='<?=$operator?>'
7
  <?php
8
  if( @ $_POST['terms'] ){
9
  foreach( $_POST['terms'] as $p_term ){
@@ -13,7 +13,7 @@
13
  }
14
  }
15
  }
16
- ?> /><label for='radio_<?=$term->term_id?>'> <?=$term->name?></label>
17
  </span>
18
  </li>
19
  <?php endforeach; ?>
1
  <?php foreach( $terms as $term ): ?>
2
  <li>
3
  <span>
4
+ <input class="<?php echo $uo['class']['checkbox_radio'] ?>" type='radio' id='radio_<?php echo $term->term_id ?>'
5
+ name='radio_<?php echo $term->taxonomy ?>_<?php echo $x ?>' data-term_id='<?php echo $term->term_id ?>'
6
+ data-taxonomy='<?php echo $term->taxonomy ?>' data-operator='<?php echo $operator ?>'
7
  <?php
8
  if( @ $_POST['terms'] ){
9
  foreach( $_POST['terms'] as $p_term ){
13
  }
14
  }
15
  }
16
+ ?> /><label for='radio_<?php echo $term->term_id ?>'> <?php echo $term->name ?></label>
17
  </span>
18
  </li>
19
  <?php endforeach; ?>
templates/select.php CHANGED
@@ -1,9 +1,10 @@
1
  <li>
2
  <span>
3
- <select class="<?=$uo['class']['selectbox']?>">
4
- <option data-taxonomy='<?=$terms[0]->taxonomy?>' value=''>Any</option>
5
  <?php foreach( $terms as $term ): ?>
6
- <option data-term_id='<?=$term->term_id?>' data-taxonomy='<?=$term->taxonomy?>' data-operator='<?=$operator?>'
 
7
  <?php
8
  if( @ $_POST['terms'] ){
9
  foreach( $_POST['terms'] as $p_term ){
@@ -14,7 +15,7 @@
14
  }
15
  }
16
  ?>
17
- ><?=$term->name?></option>
18
  <?php endforeach; ?>
19
  </select>
20
  </span>
1
  <li>
2
  <span>
3
+ <select class="<?php echo $uo['class']['selectbox'] ?>">
4
+ <option data-taxonomy='<?php echo $terms[0]->taxonomy ?>' value=''>Any</option>
5
  <?php foreach( $terms as $term ): ?>
6
+ <option data-term_id='<?php echo $term->term_id ?>' data-taxonomy='<?php echo $term->taxonomy ?>'
7
+ data-operator='<?php echo $operator ?>'
8
  <?php
9
  if( @ $_POST['terms'] ){
10
  foreach( $_POST['terms'] as $p_term ){
15
  }
16
  }
17
  ?>
18
+ ><?php echo $term->name ?></option>
19
  <?php endforeach; ?>
20
  </select>
21
  </span>
templates/slider.php CHANGED
@@ -1,12 +1,15 @@
1
  <?php $unique = rand( 0, time() ); ?>
2
- <li class='<?=$main_class?>'>
3
  <span class='left'>
4
- <input type='text' disabled id='text_<?=$filter_slider_id . $unique?>_1' value='<?=$slider_value1?>'/>
5
  </span>
6
  <span class='right'>
7
- <input type='text' disabled id='text_<?=$filter_slider_id . $unique?>_2' value='<?=$slider_value2?>'/>
8
  </span>
9
- <span class='slide <?=$uo['class']['slider']?>'>
10
- <div class='<?=$slider_class?>' data-taxonomy='<?=$filter_slider_id?>' data-min='<?=$min?>' data-max='<?=$max?>' data-value1='<?=$slider_value1?>' data-value2='<?=$slider_value2?>' data-fields_1='text_<?=$filter_slider_id . $unique?>_1' data-fields_2='text_<?=$filter_slider_id . $unique?>_2'></div>
 
 
 
11
  </span>
12
  </li>
1
  <?php $unique = rand( 0, time() ); ?>
2
+ <li class='<?php echo $main_class ?>'>
3
  <span class='left'>
4
+ <input type='text' disabled id='text_<?php echo $filter_slider_id . $unique ?>_1' value='<?php echo $slider_value1 ?>'/>
5
  </span>
6
  <span class='right'>
7
+ <input type='text' disabled id='text_<?php echo $filter_slider_id . $unique ?>_2' value='<?php echo $slider_value2 ?>'/>
8
  </span>
9
+ <span class='slide <?php echo $uo['class']['slider'] ?>'>
10
+ <div class='<?php echo $slider_class ?>' data-taxonomy='<?php echo $filter_slider_id ?>' data-min='<?php echo $min ?>'
11
+ data-max='<?php echo $max ?>' data-value1='<?php echo $slider_value1 ?>' data-value2='<?php echo $slider_value2 ?>'
12
+ data-fields_1='text_<?php echo $filter_slider_id . $unique ?>_1'
13
+ data-fields_2='text_<?php echo $filter_slider_id . $unique ?>_2'></div>
14
  </span>
15
  </li>
templates/widget_start.php CHANGED
@@ -1,2 +1,2 @@
1
- <h3 class="widget-title berocket_aapf_widget-title"><?=$title?></h3>
2
- <ul class='berocket_aapf_widget <?=$class?>' <?=$style?> data-scroll_theme='<?=$scroll_theme?>'>
1
+ <h3 class="widget-title berocket_aapf_widget-title <?php echo $css_class ?>"><?php echo $title ?></h3>
2
+ <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 ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <div class="berocket_aapf_widget">
2
+ <input type="button" value="<?php echo $title ?>" class="berocket_aapf_widget_update_button" />
3
+ </div>
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.1.0.2
7
  Author: BeRocket
8
  Author URI: http://berocket.com
9
  */
@@ -49,6 +49,7 @@ class BeRocket_AAPF {
49
  public static function shortcode( $atts = array() ){
50
  $a = shortcode_atts(
51
  array(
 
52
  'attribute' => '',
53
  'type' => 'checkbox',
54
  'operator' => 'OR',
3
  Plugin Name: Advanced AJAX Product Filters for WooCommerce
4
  Plugin URI: http://berocket.com/wp-plugins/product-filters
5
  Description: Advanced AJAX Product Filters for WooCommerce
6
+ Version: 1.1.0.3
7
  Author: BeRocket
8
  Author URI: http://berocket.com
9
  */
49
  public static function shortcode( $atts = array() ){
50
  $a = shortcode_atts(
51
  array(
52
+ 'widget_type' => 'filter',
53
  'attribute' => '',
54
  'type' => 'checkbox',
55
  'operator' => 'OR',