Version Description
- Fix - attribute values from products on 2+ page wasn't used
- Fix - not all attributes in use because of array key duplication issue
Download this release
Release Info
Developer | dholovnia |
Plugin | Advanced AJAX Product Filters |
Version | 1.0.4.5 |
Comparing to | |
See all releases |
Code changes from version 1.0.4.4 to 1.0.4.5
- includes/widget.php +42 -46
- js/widget.min.js +296 -1
- readme.txt +10 -3
- woocommerce-filters.php +1 -1
includes/widget.php
CHANGED
@@ -137,21 +137,18 @@ class BeRocket_AAPF_Widget extends WP_Widget {
|
|
137 |
$price_range = BeRocket_AAPF_Widget::get_price_range( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items );
|
138 |
if( ! $price_range ) return false;
|
139 |
}else{
|
140 |
-
$
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
$terms[ $key ] = $val;
|
149 |
-
$sort_terms[ $key ] = $val->name;
|
150 |
-
}
|
151 |
}
|
152 |
}
|
153 |
}
|
154 |
-
|
155 |
if ( @ count( $terms ) < 2 ) return false;
|
156 |
|
157 |
array_multisort( $sort_terms, $terms );
|
@@ -256,17 +253,14 @@ class BeRocket_AAPF_Widget extends WP_Widget {
|
|
256 |
|
257 |
public static function get_price_range( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items ){
|
258 |
$price_range = array();
|
259 |
-
$
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
}
|
268 |
-
}
|
269 |
-
}
|
270 |
|
271 |
if ( @ count( $price_range ) < 2 ) {
|
272 |
$price_range = false;
|
@@ -276,37 +270,39 @@ class BeRocket_AAPF_Widget extends WP_Widget {
|
|
276 |
}
|
277 |
|
278 |
function get_filter_products( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items ) {
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
'ignore_sticky_posts' => 1
|
284 |
-
);
|
285 |
|
286 |
if ( $wp_query_product_cat != - 1 ) {
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
'terms' => array( $wp_query_product_cat ),
|
292 |
-
)
|
293 |
-
);
|
294 |
}
|
295 |
|
296 |
if ( $woocommerce_hide_out_of_stock_items == 'yes' ) {
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
'compare' => '='
|
302 |
-
)
|
303 |
-
);
|
304 |
}
|
305 |
|
306 |
-
|
307 |
-
|
308 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
}
|
|
|
310 |
/**
|
311 |
* Validating and updating widget data
|
312 |
*
|
137 |
$price_range = BeRocket_AAPF_Widget::get_price_range( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items );
|
138 |
if( ! $price_range ) return false;
|
139 |
}else{
|
140 |
+
$products = BeRocket_AAPF_Widget::get_filter_products( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items );
|
141 |
+
|
142 |
+
foreach ( $products as $product ) {
|
143 |
+
$t_terms = get_the_terms( $product->ID, $attribute );
|
144 |
+
if( $t_terms ) {
|
145 |
+
foreach ( $t_terms as $val ) {
|
146 |
+
$terms[ $val->term_id ] = $val;
|
147 |
+
$sort_terms[ $val->term_id ] = $val->name;
|
|
|
|
|
|
|
148 |
}
|
149 |
}
|
150 |
}
|
151 |
+
|
152 |
if ( @ count( $terms ) < 2 ) return false;
|
153 |
|
154 |
array_multisort( $sort_terms, $terms );
|
253 |
|
254 |
public static function get_price_range( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items ){
|
255 |
$price_range = array();
|
256 |
+
$products = BeRocket_AAPF_Widget::get_filter_products( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items );
|
257 |
+
|
258 |
+
foreach ( $products as $product ) {
|
259 |
+
$meta_values = get_post_meta( $product->ID, '_price' );
|
260 |
+
if ( $meta_values[0] or $woocommerce_hide_out_of_stock_items != 'yes' ) {
|
261 |
+
$price_range[] = $meta_values[0];
|
262 |
+
}
|
263 |
+
}
|
|
|
|
|
|
|
264 |
|
265 |
if ( @ count( $price_range ) < 2 ) {
|
266 |
$price_range = false;
|
270 |
}
|
271 |
|
272 |
function get_filter_products( $wp_query_product_cat, $woocommerce_hide_out_of_stock_items ) {
|
273 |
+
global $wpdb;
|
274 |
+
|
275 |
+
$from = $group = '';
|
276 |
+
$where = " AND ({$wpdb->posts}.post_status = 'publish') ";
|
|
|
|
|
277 |
|
278 |
if ( $wp_query_product_cat != - 1 ) {
|
279 |
+
$from = " INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id) ";
|
280 |
+
$where = " AND ( {$wpdb->term_relationships}.term_taxonomy_id IN ( {$wp_query_product_cat} ) )
|
281 |
+
AND ({$wpdb->posts}.post_status = 'publish' OR {$wpdb->posts}.post_status = 'private') ";
|
282 |
+
$group = " GROUP BY {$wpdb->posts}.ID ";
|
|
|
|
|
|
|
283 |
}
|
284 |
|
285 |
if ( $woocommerce_hide_out_of_stock_items == 'yes' ) {
|
286 |
+
$from = " INNER JOIN {$wpdb->postmeta} ON ({$wpdb->posts}.ID = {$wpdb->postmeta}.post_id) ";
|
287 |
+
$where .= " AND ({$wpdb->posts}.post_status = 'publish' OR {$wpdb->posts}.post_status = 'private')
|
288 |
+
AND ( ({$wpdb->postmeta}.meta_key = '_stock_status' AND CAST({$wpdb->postmeta}.meta_value AS CHAR) = 'instock') ) ";
|
289 |
+
$group = " GROUP BY {$wpdb->posts}.ID ";
|
|
|
|
|
|
|
290 |
}
|
291 |
|
292 |
+
$results = $wpdb->get_results("
|
293 |
+
SELECT SQL_CALC_FOUND_ROWS {$wpdb->posts}.ID
|
294 |
+
FROM {$wpdb->posts}
|
295 |
+
{$from}
|
296 |
+
WHERE 1=1
|
297 |
+
AND {$wpdb->posts}.post_type = 'product'
|
298 |
+
{$where}
|
299 |
+
{$group}
|
300 |
+
ORDER BY {$wpdb->posts}.post_date ASC"
|
301 |
+
, OBJECT );
|
302 |
+
|
303 |
+
return $results;
|
304 |
}
|
305 |
+
|
306 |
/**
|
307 |
* Validating and updating widget data
|
308 |
*
|
js/widget.min.js
CHANGED
@@ -1,2 +1,297 @@
|
|
1 |
/* http://dean.edwards.name/packer/ */
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
/* http://dean.edwards.name/packer/ */
|
2 |
+
(function ($){
|
3 |
+
$(document).ready(function (){
|
4 |
+
|
5 |
+
var berocket_aapf_widget_product_filters = JSON.parse(the_ajax_script.berocket_aapf_widget_product_filters),
|
6 |
+
berocket_aapf_widget_product_limits = [],
|
7 |
+
berocket_aapf_widget_product_price_limit = [],
|
8 |
+
woocommerce_pagination_page = 1;
|
9 |
+
|
10 |
+
if( $('.woocommerce-pagination').hasClass('.woocommerce-pagination') ){
|
11 |
+
woocommerce_pagination_page = parseInt( $('.woocommerce-pagination .current').text() );
|
12 |
+
if( woocommerce_pagination_page < 1 ) woocommerce_pagination_page = 1;
|
13 |
+
}
|
14 |
+
|
15 |
+
function updateProducts( $el ){
|
16 |
+
if ( typeof the_ajax_script.user_func != 'undefined'
|
17 |
+
&& the_ajax_script.user_func != null
|
18 |
+
&& typeof the_ajax_script.user_func.before_update != 'undefined'
|
19 |
+
&& the_ajax_script.user_func.before_update.length > 0
|
20 |
+
) {
|
21 |
+
eval( the_ajax_script.user_func.before_update );
|
22 |
+
}
|
23 |
+
|
24 |
+
$(the_ajax_script.products_holder_id).addClass('hide_products').append('<div class="berocket_aapf_widget_loading" />');
|
25 |
+
|
26 |
+
if( $el ){
|
27 |
+
if( $el.is("select") ) el_data = $el.find("option:selected").data();
|
28 |
+
else el_data = $el.data();
|
29 |
+
|
30 |
+
if( $el.is("select") ){
|
31 |
+
$(berocket_aapf_widget_product_filters).each(function (i, o) {
|
32 |
+
if (o[0] == el_data.taxonomy) {
|
33 |
+
berocket_aapf_widget_product_filters.splice(i, 1);
|
34 |
+
}
|
35 |
+
});
|
36 |
+
if( $el.val() )
|
37 |
+
berocket_aapf_widget_product_filters[berocket_aapf_widget_product_filters.length] = [el_data.taxonomy, el_data.term_id, el_data.operator];
|
38 |
+
}else {
|
39 |
+
if ($el.is(':checked') || $el.is(':selected')) {
|
40 |
+
berocket_aapf_widget_product_filters[berocket_aapf_widget_product_filters.length] = [el_data.taxonomy, el_data.term_id, el_data.operator];
|
41 |
+
} else {
|
42 |
+
$(berocket_aapf_widget_product_filters).each(function (i, o) {
|
43 |
+
if (o[0] == el_data.taxonomy && o[1] == el_data.term_id) {
|
44 |
+
berocket_aapf_widget_product_filters.splice(i, 1);
|
45 |
+
}
|
46 |
+
});
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
berocket_aapf_widget_product_limits = [];
|
52 |
+
berocket_aapf_widget_product_price_limit = [];
|
53 |
+
|
54 |
+
$t = $('.berocket_filter_slider');
|
55 |
+
if( $t.hasClass('berocket_filter_slider') ){
|
56 |
+
$t.each(function (i,o){
|
57 |
+
val1 = $('#'+$(o).data('fields_1')).val();
|
58 |
+
val2 = $('#'+$(o).data('fields_2')).val();
|
59 |
+
if( val1 != $(o).data('min') || val2 != $(o).data('max') ){
|
60 |
+
if( $(o).hasClass('berocket_filter_price_slider') ){
|
61 |
+
berocket_aapf_widget_product_price_limit = [val1, val2];
|
62 |
+
}else{
|
63 |
+
berocket_aapf_widget_product_limits[berocket_aapf_widget_product_limits.length] = [$(o).data('taxonomy'), val1, val2];
|
64 |
+
}
|
65 |
+
}
|
66 |
+
});
|
67 |
+
}
|
68 |
+
|
69 |
+
if( $('.woocommerce-pagination').hasClass( '.woocommerce-pagination' ) ){
|
70 |
+
$('.woocommerce-pagination ul.page-numbers li a');
|
71 |
+
}
|
72 |
+
|
73 |
+
args = {
|
74 |
+
terms: berocket_aapf_widget_product_filters,
|
75 |
+
price: berocket_aapf_widget_product_price_limit,
|
76 |
+
limits: berocket_aapf_widget_product_limits,
|
77 |
+
product_cat: the_ajax_script.product_cat,
|
78 |
+
action: 'berocket_aapf_listener',
|
79 |
+
orderby: $('.woocommerce-ordering select.orderby').val()
|
80 |
+
};
|
81 |
+
|
82 |
+
if( the_ajax_script.seo_friendly_urls && 'history' in window && 'pushState' in history ) {
|
83 |
+
updateLocation(args);
|
84 |
+
args.location = location.href;
|
85 |
+
}else{
|
86 |
+
args.location = the_ajax_script.current_page_url;
|
87 |
+
|
88 |
+
cur_page = $('.woocommerce-pagination span.current').text();
|
89 |
+
if( prev_page = location.href.replace(/.+\/page\/([0-9]+).+/, "$1") ){
|
90 |
+
if( ! parseInt( cur_page ) ){
|
91 |
+
cur_page = prev_page;
|
92 |
+
}
|
93 |
+
args.location = args.location.replace(/\/?/,"") + "/page/" + cur_page + "/";
|
94 |
+
}else if( prev_page = location.href.replace(/.+paged?=([0-9]+).+/, "$1") ){
|
95 |
+
if( ! parseInt( cur_page ) ){
|
96 |
+
cur_page = prev_page;
|
97 |
+
}
|
98 |
+
args.location = args.location.replace(/\/?/,"") + "?page=" + cur_page + "";
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
$.post(the_ajax_script.ajaxurl, args, function (data) {
|
103 |
+
$('.woocommerce-result-count').remove();
|
104 |
+
$('.woocommerce-pagination').remove();
|
105 |
+
$('form.woocommerce-ordering').remove();
|
106 |
+
|
107 |
+
if ( typeof the_ajax_script.user_func != 'undefined'
|
108 |
+
&& the_ajax_script.user_func != null
|
109 |
+
&& typeof the_ajax_script.user_func.on_update != 'undefined'
|
110 |
+
&& the_ajax_script.user_func.on_update.length > 0
|
111 |
+
) {
|
112 |
+
eval( the_ajax_script.user_func.on_update );
|
113 |
+
}
|
114 |
+
|
115 |
+
if ( $('.woocommerce-info').hasClass('woocommerce-info') && ! $(the_ajax_script.products_holder_id).is(':visible') ) {
|
116 |
+
if ( typeof data.products != 'undefined' ) {
|
117 |
+
$('.woocommerce-info').replaceWith(data.products);
|
118 |
+
}
|
119 |
+
} else {
|
120 |
+
if ( typeof data.no_products != 'undefined' ) {
|
121 |
+
$(the_ajax_script.products_holder_id).html(data.no_products).removeClass('hide_products');
|
122 |
+
} else {
|
123 |
+
$(the_ajax_script.products_holder_id).replaceWith(data.products).removeClass('hide_products');
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
$('.berocket_aapf_widget_loading').remove();
|
128 |
+
|
129 |
+
aapf_action_init();
|
130 |
+
|
131 |
+
if ( typeof the_ajax_script.user_func != 'undefined'
|
132 |
+
&& the_ajax_script.user_func != null
|
133 |
+
&& typeof the_ajax_script.user_func.after_update != 'undefined'
|
134 |
+
&& the_ajax_script.user_func.after_update.length > 0
|
135 |
+
) {
|
136 |
+
eval( the_ajax_script.user_func.after_update );
|
137 |
+
}
|
138 |
+
}, "json");
|
139 |
+
}
|
140 |
+
|
141 |
+
function updateLocation( args ){
|
142 |
+
uri_request_array = [];
|
143 |
+
uri_request = '';
|
144 |
+
|
145 |
+
if( args.orderby && $('.woocommerce-ordering select.orderby option:first').attr('value') != args.orderby ){
|
146 |
+
uri_request_array[uri_request_array.length] = 'order='+args.orderby;
|
147 |
+
}
|
148 |
+
if( args.product_cat && args.product_cat > 0 ){
|
149 |
+
uri_request_array[uri_request_array.length] = 'pcategory='+args.product_cat;
|
150 |
+
}
|
151 |
+
if( args.price ){
|
152 |
+
$price_obj = $('.berocket_filter_price_slider');
|
153 |
+
if( args.price[0] && args.price[1] && ( args.price[0] != $price_obj.data('min') || args.price[1] != $price_obj.data('max') ) ){
|
154 |
+
uri_request_array[uri_request_array.length] = 'price='+args.price[0]+'^'+args.price[1];
|
155 |
+
}
|
156 |
+
}
|
157 |
+
if( args.limits ){
|
158 |
+
$( args.limits).each(function (i,o){
|
159 |
+
uri_request_array[uri_request_array.length] = o[0].substring(3)+'='+o[1]+'^'+o[2];
|
160 |
+
});
|
161 |
+
}
|
162 |
+
if( args.terms ){
|
163 |
+
$( args.terms).each(function (i,o){
|
164 |
+
uri_request_array[uri_request_array.length] = o[0].substring(3)+'='+o[1]+'^'+o[2];
|
165 |
+
});
|
166 |
+
}
|
167 |
+
|
168 |
+
var uri = the_ajax_script.current_page_url;
|
169 |
+
|
170 |
+
if( uri_request_array.length ){
|
171 |
+
$(uri_request_array).each(function (i,o){
|
172 |
+
if( uri_request ) uri_request += "|";
|
173 |
+
uri_request += o;
|
174 |
+
});
|
175 |
+
}
|
176 |
+
|
177 |
+
cur_page = $('.woocommerce-pagination span.current').text();
|
178 |
+
if( prev_page = parseInt( location.href.replace(/.+\/page\/([0-9]+).+/, "$1") ) ){
|
179 |
+
if( ! parseInt( cur_page ) ){
|
180 |
+
cur_page = prev_page;
|
181 |
+
}
|
182 |
+
uri = uri.replace(/\/?$/,"") + "/page/" + cur_page + "/";
|
183 |
+
if( uri_request ){
|
184 |
+
uri = uri + "?filters=" + uri_request;
|
185 |
+
}
|
186 |
+
}else{
|
187 |
+
something_added = false;
|
188 |
+
if( /\?/.test(location.href) ){
|
189 |
+
passed_vars1 = location.href.split('?');
|
190 |
+
if( passed_vars1[1] ){
|
191 |
+
passed_vars2 = [];
|
192 |
+
temp2 = [];
|
193 |
+
if( /&/.test(passed_vars1[1]) ) {
|
194 |
+
passed_vars2 = passed_vars1[1].split('&');
|
195 |
+
passed_vars2_length = passed_vars2.length;
|
196 |
+
for ( k = 0; k < passed_vars2_length; k++ ){
|
197 |
+
temp = passed_vars2[k].split('=');
|
198 |
+
passed_vars2[k] = [];
|
199 |
+
passed_vars2[k][0] = temp.shift();
|
200 |
+
passed_vars2[k][1] = temp.join("=")
|
201 |
+
}
|
202 |
+
}else{
|
203 |
+
passed_vars2[0] = [];
|
204 |
+
temp = passed_vars1[1].split('=');
|
205 |
+
passed_vars2[0][0] = temp.shift();
|
206 |
+
passed_vars2[0][1] = temp.join("=")
|
207 |
+
}
|
208 |
+
for ( k = 0; k < passed_vars2.length; k++ ){
|
209 |
+
if( passed_vars2[k][0] == 'filters' || passed_vars2[k][0] == 'page' || passed_vars2[k][0] == 'paged' ) continue;
|
210 |
+
|
211 |
+
if( something_added ) uri += '&';
|
212 |
+
else uri += '?';
|
213 |
+
|
214 |
+
uri += passed_vars2[k][0]+'='+passed_vars2[k][1];
|
215 |
+
something_added = true;
|
216 |
+
}
|
217 |
+
}
|
218 |
+
}
|
219 |
+
if( something_added && uri_request ){
|
220 |
+
uri = uri + "&filters=" + uri_request;
|
221 |
+
if( cur_page > 1 ){
|
222 |
+
uri = uri + "&paged=" + parseInt( cur_page );
|
223 |
+
}
|
224 |
+
}else if( uri_request ){
|
225 |
+
uri = uri + "?filters=" + uri_request;
|
226 |
+
if( cur_page > 1 ){
|
227 |
+
uri = uri + "&paged=" + parseInt( cur_page );
|
228 |
+
}
|
229 |
+
}else if( cur_page > 1 ){
|
230 |
+
uri = uri + "?paged=" + parseInt( cur_page );
|
231 |
+
}
|
232 |
+
}
|
233 |
+
|
234 |
+
var stateParameters = { BeRocket: "Rules" };
|
235 |
+
history.pushState(stateParameters, "BeRocket Rules", uri);
|
236 |
+
history.pathname = uri;
|
237 |
+
}
|
238 |
+
|
239 |
+
function aapf_action_init(){
|
240 |
+
// Take control over (default) pagination and sorting, make it AJAXy and work with filters
|
241 |
+
$('.woocommerce-pagination').on('click', 'a', function (event) {
|
242 |
+
event.preventDefault();
|
243 |
+
$('.woocommerce-pagination span.current').removeClass('current');
|
244 |
+
$(this).after("<span class='page-numbers current'>"+$(this).text()+"</span>").remove();
|
245 |
+
updateProducts(false);
|
246 |
+
});
|
247 |
+
}
|
248 |
+
|
249 |
+
$('.berocket_aapf_widget').on("change", "input, select", function(){
|
250 |
+
updateProducts( $(this) );
|
251 |
+
});
|
252 |
+
|
253 |
+
$( ".berocket_filter_slider" ).each(function (i,o){
|
254 |
+
$(o).slider({
|
255 |
+
range: true,
|
256 |
+
min: $(o).data('min')>>0,
|
257 |
+
max: $(o).data('max')>>0,
|
258 |
+
values: [$(o).data('value1')>>0,$(o).data('value2')>>0],
|
259 |
+
slide: function( event, ui ) {
|
260 |
+
$o = $(ui.handle).parents('div.berocket_filter_slider');
|
261 |
+
vals = ui.values;
|
262 |
+
if( $(o).hasClass('berocket_filter_price_slider') ){
|
263 |
+
vals[0] = vals[0].toFixed(2);
|
264 |
+
vals[1] = vals[1].toFixed(2);
|
265 |
+
}
|
266 |
+
$( '#'+$o.data('fields_1') ).val( vals[0] );
|
267 |
+
$( '#'+$o.data('fields_2') ).val( vals[1] );
|
268 |
+
},
|
269 |
+
stop: function(){
|
270 |
+
updateProducts( false );
|
271 |
+
}
|
272 |
+
});
|
273 |
+
});
|
274 |
+
|
275 |
+
$(".berocket_aapf_widget_height_control").each(function (i,o){
|
276 |
+
$(o).mCustomScrollbar({
|
277 |
+
axis: "xy",
|
278 |
+
theme: $(o).data('scroll_theme'),
|
279 |
+
scrollInertia: 300
|
280 |
+
});
|
281 |
+
});
|
282 |
+
|
283 |
+
// Option to take control over (default) sorting, make it AJAXy and work with filters
|
284 |
+
if( the_ajax_script.control_sorting ) {
|
285 |
+
$(document).on('submit', 'form.woocommerce-ordering', function (event) {
|
286 |
+
event.preventDefault();
|
287 |
+
});
|
288 |
+
$(document).on('change', 'select.orderby', function (event) {
|
289 |
+
event.preventDefault();
|
290 |
+
updateProducts(false);
|
291 |
+
});
|
292 |
+
}
|
293 |
+
|
294 |
+
aapf_action_init();
|
295 |
+
|
296 |
+
});
|
297 |
+
})(jQuery);
|
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.4.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -78,7 +78,7 @@ http://woocommerce-product-filter.berocket.com
|
|
78 |
how it looks depends on the theme you choose.
|
79 |
|
80 |
|
81 |
-
=
|
82 |
* Plugin settings can be found in admin area, WooCommerce -> Product Filters
|
83 |
* "No Products" message - Text that will be shown if no products found
|
84 |
* "No Products" class - Add class and use it to style "No Products" box
|
@@ -86,7 +86,7 @@ http://woocommerce-product-filter.berocket.com
|
|
86 |
* Sorting control - Take control over WooCommerce's sorting selectbox
|
87 |
* SEO friendly urls - url will be changed when filter is selected/changed
|
88 |
* Turn all filters off - If you want to hide filters without losing current configuration just turn them off
|
89 |
-
|
90 |
|
91 |
|
92 |
== Installation ==
|
@@ -105,6 +105,13 @@ http://woocommerce-product-filter.berocket.com
|
|
105 |
|
106 |
== Changelog ==
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
= 1.0.4.4 =
|
109 |
* Enhancement - adding callback for before_update, on_update, after_update events.
|
110 |
* Other small fixes
|
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.4.6
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
78 |
how it looks depends on the theme you choose.
|
79 |
|
80 |
|
81 |
+
= Plugin Settings: =
|
82 |
* Plugin settings can be found in admin area, WooCommerce -> Product Filters
|
83 |
* "No Products" message - Text that will be shown if no products found
|
84 |
* "No Products" class - Add class and use it to style "No Products" box
|
86 |
* Sorting control - Take control over WooCommerce's sorting selectbox
|
87 |
* SEO friendly urls - url will be changed when filter is selected/changed
|
88 |
* Turn all filters off - If you want to hide filters without losing current configuration just turn them off
|
89 |
+
* JavaScript callback functions: Before, On and After Update. Use it for better implementation into custom/specific theme
|
90 |
|
91 |
|
92 |
== Installation ==
|
105 |
|
106 |
== Changelog ==
|
107 |
|
108 |
+
= 1.0.4.6 =
|
109 |
+
* Fix - database query issue that brake plugin in categories
|
110 |
+
|
111 |
+
= 1.0.4.5 =
|
112 |
+
* Fix - attribute values from products on 2+ page wasn't used
|
113 |
+
* Fix - not all attributes in use because of array key duplication issue
|
114 |
+
|
115 |
= 1.0.4.4 =
|
116 |
* Enhancement - adding callback for before_update, on_update, after_update events.
|
117 |
* Other small fixes
|
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.4.
|
7 |
Author: BeRocket
|
8 |
Author URI: http://berocket.com
|
9 |
*/
|
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.4.5
|
7 |
Author: BeRocket
|
8 |
Author URI: http://berocket.com
|
9 |
*/
|