Version Description
- Fix - "Hide variations that are out of stock" option do not work without "Additional table" add-on
- Fix - WPML: "Hide variations that are out of stock" option work only on base language
- Fix - WPML: "Additional table" add-on compatibility
Download this release
Release Info
Developer | RazyRx |
Plugin | Advanced AJAX Product Filters |
Version | 1.4.1.3 |
Comparing to | |
See all releases |
Code changes from version 1.4.1.2 to 1.4.1.3
- addons/additional_tables/add_table.php +12 -5
- includes/addons/woocommerce-variation.php +10 -6
- includes/faster_recount.php +1 -0
- main.php +3 -2
- readme.txt +8 -3
- woocommerce-filters.php +2 -2
addons/additional_tables/add_table.php
CHANGED
@@ -137,9 +137,15 @@ class BeRocket_aapf_variations_tables {
|
|
137 |
}
|
138 |
}
|
139 |
function variation_object_save($product) {
|
140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
global $wpdb;
|
142 |
-
$product_id = $product->get_id();
|
143 |
$parent_id = $product->get_parent_id();
|
144 |
$product_attributes = $product->get_variation_attributes();
|
145 |
$parent_product = wc_get_product($parent_id);
|
@@ -165,8 +171,7 @@ class BeRocket_aapf_variations_tables {
|
|
165 |
}
|
166 |
}
|
167 |
}
|
168 |
-
}
|
169 |
-
if( $product->get_type() == 'variable' ) {
|
170 |
foreach ( $product->get_children() as $child_id ) {
|
171 |
$variation = wc_get_product( $child_id );
|
172 |
if ( ! $variation || ! $variation->exists() || $variation->get_type() != 'variation' ) {
|
@@ -175,7 +180,6 @@ class BeRocket_aapf_variations_tables {
|
|
175 |
$this->variation_object_save($variation);
|
176 |
}
|
177 |
global $wpdb;
|
178 |
-
$product_id = $product->get_id();
|
179 |
$sql = "DELETE FROM {$wpdb->prefix}braapf_variation_attributes WHERE post_id={$product_id};";
|
180 |
$wpdb->query($sql);
|
181 |
$sql = "INSERT IGNORE INTO {$wpdb->prefix}braapf_variation_attributes
|
@@ -185,6 +189,9 @@ class BeRocket_aapf_variations_tables {
|
|
185 |
GROUP BY meta_key, parent_id";
|
186 |
$wpdb->query($sql);
|
187 |
}
|
|
|
|
|
|
|
188 |
}
|
189 |
function recount_terms_initialized($recount_object) {
|
190 |
remove_filter('berocket_aapf_recount_terms_query', array($recount_object, 'child_include'), 50, 3);
|
137 |
}
|
138 |
}
|
139 |
function variation_object_save($product) {
|
140 |
+
$product_id = $product->get_id();
|
141 |
+
$product_type = $product->get_type();
|
142 |
+
if ( defined( 'ICL_SITEPRESS_VERSION' ) && ! ICL_PLUGIN_INACTIVE && class_exists( 'SitePress' ) ) {
|
143 |
+
$current_language = apply_filters( 'wpml_current_language', NULL );
|
144 |
+
$language_code = apply_filters('wpml_element_language_code', NULL, array('element_id' => $product_id, 'element_type' => ( $product_type == 'variation' ? 'product_variation' : 'product' ) ));
|
145 |
+
do_action( 'wpml_switch_language', $language_code );
|
146 |
+
}
|
147 |
+
if( $product_type == 'variation' ) {
|
148 |
global $wpdb;
|
|
|
149 |
$parent_id = $product->get_parent_id();
|
150 |
$product_attributes = $product->get_variation_attributes();
|
151 |
$parent_product = wc_get_product($parent_id);
|
171 |
}
|
172 |
}
|
173 |
}
|
174 |
+
} elseif( $product_type == 'variable' ) {
|
|
|
175 |
foreach ( $product->get_children() as $child_id ) {
|
176 |
$variation = wc_get_product( $child_id );
|
177 |
if ( ! $variation || ! $variation->exists() || $variation->get_type() != 'variation' ) {
|
180 |
$this->variation_object_save($variation);
|
181 |
}
|
182 |
global $wpdb;
|
|
|
183 |
$sql = "DELETE FROM {$wpdb->prefix}braapf_variation_attributes WHERE post_id={$product_id};";
|
184 |
$wpdb->query($sql);
|
185 |
$sql = "INSERT IGNORE INTO {$wpdb->prefix}braapf_variation_attributes
|
189 |
GROUP BY meta_key, parent_id";
|
190 |
$wpdb->query($sql);
|
191 |
}
|
192 |
+
if ( defined( 'ICL_SITEPRESS_VERSION' ) && ! ICL_PLUGIN_INACTIVE && class_exists( 'SitePress' ) ) {
|
193 |
+
do_action( 'wpml_switch_language', $current_language );
|
194 |
+
}
|
195 |
}
|
196 |
function recount_terms_initialized($recount_object) {
|
197 |
remove_filter('berocket_aapf_recount_terms_query', array($recount_object, 'child_include'), 50, 3);
|
includes/addons/woocommerce-variation.php
CHANGED
@@ -121,8 +121,8 @@ class BeRocket_AAPF_compat_woocommerce_variation {
|
|
121 |
}
|
122 |
$current_terms = array_unique($current_terms);
|
123 |
$current_attributes = array_unique($current_attributes);
|
124 |
-
$current_terms =
|
125 |
-
$current_attributes =
|
126 |
$query_filtered_posts = apply_filters( 'berocket_aapf_wcvariation_filtering_main_query', array(
|
127 |
'select' => 'SELECT %1$s.id as var_id, %1$s.post_parent as ID, COUNT(%1$s.id) as meta_count',
|
128 |
'from' => 'FROM %1$s',
|
@@ -260,13 +260,17 @@ class BeRocket_AAPF_compat_woocommerce_variation {
|
|
260 |
$limit_post__not_in[$term_data->term_taxonomy_id] = apply_filters('berocket_add_out_of_stock_variable', array(), $new_post_terms, $new_post_limits);
|
261 |
}
|
262 |
|
|
|
263 |
if( is_array($limit_post__not_in) && count($limit_post__not_in) ) {
|
264 |
-
$limit_post__not_in_where_array = array();
|
265 |
$limit_post__term_id_without_product = array();
|
266 |
foreach($limit_post__not_in as $terms_id => $limit_post) {
|
267 |
-
$
|
268 |
-
|
269 |
-
|
|
|
|
|
|
|
|
|
270 |
if( is_array($limit_post) && count($limit_post) ) {
|
271 |
$limit_post__not_in_where_array[$wp_terms_id] = "({$wpdb->posts}.ID NOT IN (\"" . implode('","', $limit_post) . "\") AND term_relationships.term_taxonomy_id = {$wp_terms_id})";
|
272 |
} else {
|
121 |
}
|
122 |
$current_terms = array_unique($current_terms);
|
123 |
$current_attributes = array_unique($current_attributes);
|
124 |
+
$current_terms = implode('","', $current_terms);
|
125 |
+
$current_attributes = implode('","', $current_attributes);
|
126 |
$query_filtered_posts = apply_filters( 'berocket_aapf_wcvariation_filtering_main_query', array(
|
127 |
'select' => 'SELECT %1$s.id as var_id, %1$s.post_parent as ID, COUNT(%1$s.id) as meta_count',
|
128 |
'from' => 'FROM %1$s',
|
260 |
$limit_post__not_in[$term_data->term_taxonomy_id] = apply_filters('berocket_add_out_of_stock_variable', array(), $new_post_terms, $new_post_limits);
|
261 |
}
|
262 |
|
263 |
+
$limit_post__not_in_where_array = array();
|
264 |
if( is_array($limit_post__not_in) && count($limit_post__not_in) ) {
|
|
|
265 |
$limit_post__term_id_without_product = array();
|
266 |
foreach($limit_post__not_in as $terms_id => $limit_post) {
|
267 |
+
if( in_array($term_data->taxonomy, array('_sale', '_stock_status')) ) {
|
268 |
+
$wp_terms_id = $terms_id;
|
269 |
+
} else {
|
270 |
+
$wp_term = get_term($terms_id);
|
271 |
+
if( empty($wp_term) || is_wp_error($wp_term) ) continue;
|
272 |
+
$wp_terms_id = $wp_term->term_taxonomy_id;
|
273 |
+
}
|
274 |
if( is_array($limit_post) && count($limit_post) ) {
|
275 |
$limit_post__not_in_where_array[$wp_terms_id] = "({$wpdb->posts}.ID NOT IN (\"" . implode('","', $limit_post) . "\") AND term_relationships.term_taxonomy_id = {$wp_terms_id})";
|
276 |
} else {
|
includes/faster_recount.php
CHANGED
@@ -293,6 +293,7 @@ class BeRocket_AAPF_faster_attribute_recount {
|
|
293 |
$join_query .= "SELECT {$wpdb->wc_product_meta_lookup}.product_id as object_id, IF({$wpdb->wc_product_meta_lookup}.onsale = 1, 1, 2) as term_taxonomy_id, 0 as term_order FROM {$wpdb->wc_product_meta_lookup}";
|
294 |
} else {*/
|
295 |
$products_id = wc_get_product_ids_on_sale();
|
|
|
296 |
$join_query .= "SELECT {$wpdb->posts}.ID as object_id, IF({$wpdb->posts}.ID IN (".implode(',', $products_id)."), 1, 2) as term_taxonomy_id, 0 as term_order FROM {$wpdb->posts} WHERE {$wpdb->posts}.post_type = 'product'";
|
297 |
//}
|
298 |
$join_query .= ") as term_relationships ON {$wpdb->posts}.ID = term_relationships.object_id";
|
293 |
$join_query .= "SELECT {$wpdb->wc_product_meta_lookup}.product_id as object_id, IF({$wpdb->wc_product_meta_lookup}.onsale = 1, 1, 2) as term_taxonomy_id, 0 as term_order FROM {$wpdb->wc_product_meta_lookup}";
|
294 |
} else {*/
|
295 |
$products_id = wc_get_product_ids_on_sale();
|
296 |
+
$products_id[] = 0;
|
297 |
$join_query .= "SELECT {$wpdb->posts}.ID as object_id, IF({$wpdb->posts}.ID IN (".implode(',', $products_id)."), 1, 2) as term_taxonomy_id, 0 as term_order FROM {$wpdb->posts} WHERE {$wpdb->posts}.post_type = 'product'";
|
298 |
//}
|
299 |
$join_query .= ") as term_relationships ON {$wpdb->posts}.ID = term_relationships.object_id";
|
main.php
CHANGED
@@ -2630,8 +2630,8 @@ jQuery(document).on('change', '.br_selected_area_show', br_selected_area_show);
|
|
2630 |
if( ! empty($filters) && is_array($filters) ) {
|
2631 |
foreach($filters as $term) {
|
2632 |
if( empty($attributes[$term[0]]) || ! empty($filter_attribute[$term[0]]) ) continue;
|
2633 |
-
if( in_array($term[3], $attributes[$term[0]]) ) {
|
2634 |
-
$filter_attribute[$term[0]] = $term[3];
|
2635 |
}
|
2636 |
}
|
2637 |
}
|
@@ -2793,6 +2793,7 @@ jQuery(document).on('change', '.br_selected_area_show', br_selected_area_show);
|
|
2793 |
public function save_settings_callback( $settings ) {
|
2794 |
$options = $this->get_option();
|
2795 |
delete_option( 'rewrite_rules' );
|
|
|
2796 |
|
2797 |
return parent::save_settings_callback( $settings );
|
2798 |
}
|
2630 |
if( ! empty($filters) && is_array($filters) ) {
|
2631 |
foreach($filters as $term) {
|
2632 |
if( empty($attributes[$term[0]]) || ! empty($filter_attribute[$term[0]]) ) continue;
|
2633 |
+
if( in_array(strtolower(urlencode(urldecode($term[3]))), $attributes[$term[0]]) ) {
|
2634 |
+
$filter_attribute[$term[0]] = urldecode($term[3]);
|
2635 |
}
|
2636 |
}
|
2637 |
}
|
2793 |
public function save_settings_callback( $settings ) {
|
2794 |
$options = $this->get_option();
|
2795 |
delete_option( 'rewrite_rules' );
|
2796 |
+
flush_rewrite_rules(true);
|
2797 |
|
2798 |
return parent::save_settings_callback( $settings );
|
2799 |
}
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Contributors: dholovnia, berocket
|
|
4 |
Donate link: https://berocket.com/product/woocommerce-ajax-products-filter?utm_source=wordpress_org&utm_medium=donate&utm_campaign=ajax_filters
|
5 |
Tags: filters, product filters, ajax product filters, ajax filter, ajax filter widget, color filter, size filter, product onsale filter, product preview, product category filter, product reset filter, product sort by filter, stock filter, product tag filter, price range filter, price box filter, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce products filter, woocommerce ajax product filters, widget, plugin, woocommerce item filters, filters plugin, ajax filters plugin, filter woocommerce products, filter woocommerce products plugin, wc filters, wc filters products, wc products filters, wc ajax products filters, wc product filters, wc advanced product filters, woocommerce layered nav, woocommerce layered navigation, ajax filtered nav, ajax filtered navigation, price filter, ajax price filter, woocommerce product sorting, sidebar filter, sidebar ajax filter, taxonomy filter, category filter, attribute filter, attributes filter, woocommerce product sort, ajax products filter plugin for woocommerce, rocket, berocket, berocket woocommerce ajax products filter
|
6 |
Requires at least: 4.0
|
7 |
-
Tested up to: 5.3.
|
8 |
-
Stable tag: 1.4.1.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -184,7 +184,12 @@ You can try this plugin's admin side [here](https://berocket.com/product/woocomm
|
|
184 |
|
185 |
== Changelog ==
|
186 |
|
187 |
-
= 1.4.1.
|
|
|
|
|
|
|
|
|
|
|
188 |
* Fix - Categories work incorrect with WPML and Additional table addon
|
189 |
* Fix - Nice URL do not work with WPML
|
190 |
|
4 |
Donate link: https://berocket.com/product/woocommerce-ajax-products-filter?utm_source=wordpress_org&utm_medium=donate&utm_campaign=ajax_filters
|
5 |
Tags: filters, product filters, ajax product filters, ajax filter, ajax filter widget, color filter, size filter, product onsale filter, product preview, product category filter, product reset filter, product sort by filter, stock filter, product tag filter, price range filter, price box filter, advanced product filters, woocommerce filters, woocommerce product filters, woocommerce products filter, woocommerce ajax product filters, widget, plugin, woocommerce item filters, filters plugin, ajax filters plugin, filter woocommerce products, filter woocommerce products plugin, wc filters, wc filters products, wc products filters, wc ajax products filters, wc product filters, wc advanced product filters, woocommerce layered nav, woocommerce layered navigation, ajax filtered nav, ajax filtered navigation, price filter, ajax price filter, woocommerce product sorting, sidebar filter, sidebar ajax filter, taxonomy filter, category filter, attribute filter, attributes filter, woocommerce product sort, ajax products filter plugin for woocommerce, rocket, berocket, berocket woocommerce ajax products filter
|
6 |
Requires at least: 4.0
|
7 |
+
Tested up to: 5.3.2
|
8 |
+
Stable tag: 1.4.1.3
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
184 |
|
185 |
== Changelog ==
|
186 |
|
187 |
+
= 1.4.1.3 =
|
188 |
+
* Fix - "Hide variations that are out of stock" option do not work without "Additional table" add-on
|
189 |
+
* Fix - WPML: "Hide variations that are out of stock" option work only on base language
|
190 |
+
* Fix - WPML: "Additional table" add-on compatibility
|
191 |
+
|
192 |
+
= 1.4.1.2 =
|
193 |
* Fix - Categories work incorrect with WPML and Additional table addon
|
194 |
* Fix - Nice URL do not work with WPML
|
195 |
|
woocommerce-filters.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Advanced AJAX Product Filters for WooCommerce
|
4 |
* Plugin URI: https://wordpress.org/plugins/woocommerce-ajax-filters/?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters
|
5 |
* Description: Unlimited AJAX products filters to make your shop perfect
|
6 |
-
* Version: 1.4.1.
|
7 |
* Author: BeRocket
|
8 |
* Requires at least: 4.0
|
9 |
* Author URI: https://berocket.com?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters
|
@@ -11,6 +11,6 @@
|
|
11 |
* Domain Path: /languages/
|
12 |
* WC tested up to: 3.8.1
|
13 |
*/
|
14 |
-
define( "BeRocket_AJAX_filters_version", '1.4.1.
|
15 |
define( "BeRocket_AJAX_filters_file", __FILE__ );
|
16 |
include_once('main.php');
|
3 |
* Plugin Name: Advanced AJAX Product Filters for WooCommerce
|
4 |
* Plugin URI: https://wordpress.org/plugins/woocommerce-ajax-filters/?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters
|
5 |
* Description: Unlimited AJAX products filters to make your shop perfect
|
6 |
+
* Version: 1.4.1.3
|
7 |
* Author: BeRocket
|
8 |
* Requires at least: 4.0
|
9 |
* Author URI: https://berocket.com?utm_source=free_plugin&utm_medium=plugins&utm_campaign=ajax_filters
|
11 |
* Domain Path: /languages/
|
12 |
* WC tested up to: 3.8.1
|
13 |
*/
|
14 |
+
define( "BeRocket_AJAX_filters_version", '1.4.1.3' );
|
15 |
define( "BeRocket_AJAX_filters_file", __FILE__ );
|
16 |
include_once('main.php');
|