Version Description
- Fix - Compatibility filtering with WPML and Polylang
- Fix - Compatibility with WPML taxonomy translation
- Fix - Price filtering for variable products
- Fix - Attribute values with numeric slug
Download this release
Release Info
Developer | RazyRx |
Plugin | Advanced AJAX Product Filters |
Version | 1.6.1 |
Comparing to | |
See all releases |
Code changes from version 1.6.0.2 to 1.6.1
- addons/additional_tables/add_table.php +6 -6
- berocket/includes/updater.php +110 -4
- includes/url-parse.php +5 -4
- includes/url-parse/price.php +65 -9
- readme.txt +7 -1
- woocommerce-filters.php +2 -2
addons/additional_tables/add_table.php
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
class BeRocket_aapf_variations_tables {
|
3 |
public $variation_attributes = FALSE;
|
4 |
function __construct() {
|
5 |
-
add_filter('berocket_aapf_wcvariation_filtering_total_query', array($this, 'wcvariation_filtering_total_query'), 10,
|
6 |
add_filter('berocket_aapf_wcvariation_filtering_main_query', array($this, 'wcvariation_filtering_main_query'), 10, 2);
|
7 |
-
add_filter('berocket_aapf_wcvariation_filtering_single_attribute', array($this, 'wcvariation_filtering_single_attribute'), 10,
|
8 |
add_action( 'woocommerce_variation_set_stock_status', array($this, 'set_stock_status'), 10, 3 );
|
9 |
add_action( 'woocommerce_product_set_stock_status', array($this, 'set_stock_status'), 10, 3 );
|
10 |
add_action( 'delete_post', array($this, 'delete_post'), 10, 1 );
|
@@ -52,7 +52,7 @@ class BeRocket_aapf_variations_tables {
|
|
52 |
);
|
53 |
return $query;
|
54 |
}
|
55 |
-
function wcvariation_filtering_single_attribute($query, $data) {
|
56 |
$current_terms = array(0);
|
57 |
|
58 |
foreach($data['filters'] as $filter) {
|
@@ -75,9 +75,9 @@ class BeRocket_aapf_variations_tables {
|
|
75 |
'group' => 'GROUP BY ID, term_id',
|
76 |
'having' => 'HAVING out_of_stock = 1'
|
77 |
);
|
78 |
-
return $return_query;
|
79 |
}
|
80 |
-
function wcvariation_filtering_total_query($query, $data) {
|
81 |
$current_attributes = array();
|
82 |
$current_terms = array(0);
|
83 |
foreach($data['filters'] as $filter) {
|
@@ -109,7 +109,7 @@ class BeRocket_aapf_variations_tables {
|
|
109 |
$query['subquery']['where'] = 'WHERE filtered_post.meta_value_id IN ('.implode(',', $current_terms).')';
|
110 |
$query['subquery']['group'] = 'GROUP BY filtered_post.post_id';
|
111 |
unset($query['subquery']['subquery_1'], $query['subquery']['from_close'], $query['subquery']['join_open_2'], $query['subquery']['subquery_3'], $query['subquery']['join_close_2']);
|
112 |
-
return $query;
|
113 |
}
|
114 |
function delete_post($product_id) {
|
115 |
global $wpdb;
|
2 |
class BeRocket_aapf_variations_tables {
|
3 |
public $variation_attributes = FALSE;
|
4 |
function __construct() {
|
5 |
+
add_filter('berocket_aapf_wcvariation_filtering_total_query', array($this, 'wcvariation_filtering_total_query'), 10, 4);
|
6 |
add_filter('berocket_aapf_wcvariation_filtering_main_query', array($this, 'wcvariation_filtering_main_query'), 10, 2);
|
7 |
+
add_filter('berocket_aapf_wcvariation_filtering_single_attribute', array($this, 'wcvariation_filtering_single_attribute'), 10, 4);
|
8 |
add_action( 'woocommerce_variation_set_stock_status', array($this, 'set_stock_status'), 10, 3 );
|
9 |
add_action( 'woocommerce_product_set_stock_status', array($this, 'set_stock_status'), 10, 3 );
|
10 |
add_action( 'delete_post', array($this, 'delete_post'), 10, 1 );
|
52 |
);
|
53 |
return $query;
|
54 |
}
|
55 |
+
function wcvariation_filtering_single_attribute($query, $data, $current_attributes_part, $current_terms_part) {
|
56 |
$current_terms = array(0);
|
57 |
|
58 |
foreach($data['filters'] as $filter) {
|
75 |
'group' => 'GROUP BY ID, term_id',
|
76 |
'having' => 'HAVING out_of_stock = 1'
|
77 |
);
|
78 |
+
return apply_filters('berocket_aapf_wcvariation_filtering_single_attribute-add_table', $return_query, $data, $current_attributes_part, $current_terms_part);
|
79 |
}
|
80 |
+
function wcvariation_filtering_total_query($query, $data, $current_attributes, $current_terms) {
|
81 |
$current_attributes = array();
|
82 |
$current_terms = array(0);
|
83 |
foreach($data['filters'] as $filter) {
|
109 |
$query['subquery']['where'] = 'WHERE filtered_post.meta_value_id IN ('.implode(',', $current_terms).')';
|
110 |
$query['subquery']['group'] = 'GROUP BY filtered_post.post_id';
|
111 |
unset($query['subquery']['subquery_1'], $query['subquery']['from_close'], $query['subquery']['join_open_2'], $query['subquery']['subquery_3'], $query['subquery']['join_close_2']);
|
112 |
+
return apply_filters('berocket_aapf_wcvariation_filtering_total_query-add_table', $query, $data, $current_attributes, $current_terms);
|
113 |
}
|
114 |
function delete_post($product_id) {
|
115 |
global $wpdb;
|
berocket/includes/updater.php
CHANGED
@@ -19,7 +19,7 @@ if ( ! class_exists( 'BeRocket_updater' ) ) {
|
|
19 |
|
20 |
public static function admin_init() {
|
21 |
add_filter('woocommerce_addons_sections', array(__CLASS__, 'woocommerce_addons_sections'));
|
22 |
-
if( isset($_GET['page']) && isset($_GET['section']) && $_GET['page'] == 'wc-addons' && $_GET['section'] == 'berocket' ) {
|
23 |
add_action('admin_footer', array(__CLASS__, 'woocommerce_addons_berocket'));
|
24 |
}
|
25 |
}
|
@@ -919,7 +919,7 @@ if ( ! class_exists( 'BeRocket_updater' ) ) {
|
|
919 |
foreach($products as $product) {
|
920 |
$addons[] = (object)array(
|
921 |
'title' => $product->name,
|
922 |
-
'image' =>
|
923 |
'excerpt' => $product->about,
|
924 |
'link' => $product->plugin_url,
|
925 |
'price' => '$'.$product->price,
|
@@ -928,12 +928,22 @@ if ( ! class_exists( 'BeRocket_updater' ) ) {
|
|
928 |
);
|
929 |
}
|
930 |
|
931 |
-
set_transient( 'wc_addons_berocket', $addons,
|
932 |
}
|
933 |
|
934 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
935 |
?>
|
936 |
-
<ul class="
|
937 |
<?php foreach ( $addons as $addon ) : ?>
|
938 |
<li class="product">
|
939 |
<a href="<?php echo esc_attr( $addon->link ); ?>">
|
@@ -948,13 +958,109 @@ if ( ! class_exists( 'BeRocket_updater' ) ) {
|
|
948 |
</li>
|
949 |
<?php endforeach; ?>
|
950 |
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
951 |
<script>
|
952 |
if( jQuery('.berocket_section_wc_addons').length && jQuery('.wc_addons_wrap .search-form').length ) {
|
|
|
953 |
jQuery('.wc_addons_wrap .search-form').after(jQuery('.berocket_section_wc_addons'));
|
954 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
955 |
</script>
|
956 |
<?php
|
957 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
958 |
public static function hide_key($key) {
|
959 |
if( ! empty($key) ) {
|
960 |
$part = (int)(strlen($key) / 3);
|
19 |
|
20 |
public static function admin_init() {
|
21 |
add_filter('woocommerce_addons_sections', array(__CLASS__, 'woocommerce_addons_sections'));
|
22 |
+
if( isset($_GET['page']) && isset($_GET['section']) && $_GET['page'] == 'wc-addons' && ( $_GET['section'] == 'berocket' || ! empty($_GET['search']) ) ) {
|
23 |
add_action('admin_footer', array(__CLASS__, 'woocommerce_addons_berocket'));
|
24 |
}
|
25 |
}
|
919 |
foreach($products as $product) {
|
920 |
$addons[] = (object)array(
|
921 |
'title' => $product->name,
|
922 |
+
'image' => $product->mini_image,
|
923 |
'excerpt' => $product->about,
|
924 |
'link' => $product->plugin_url,
|
925 |
'price' => '$'.$product->price,
|
928 |
);
|
929 |
}
|
930 |
|
931 |
+
set_transient( 'wc_addons_berocket', $addons, DAY_IN_SECONDS );
|
932 |
}
|
933 |
|
934 |
}
|
935 |
+
if(! empty($_GET['search']) ) {
|
936 |
+
$correct_addon = array();
|
937 |
+
$search = isset( $_GET['search'] ) ? sanitize_text_field( wp_unslash( $_GET['search'] ) ) : '';
|
938 |
+
foreach($addons as $addon) {
|
939 |
+
if( stripos($addon->title, $search) !== FALSE || stripos($addon->excerpt, $search) !== FALSE ) {
|
940 |
+
$correct_addon[] = $addon;
|
941 |
+
}
|
942 |
+
}
|
943 |
+
$addons = $correct_addon;
|
944 |
+
}
|
945 |
?>
|
946 |
+
<ul class="berocket_section_wc_addons" style="display: none;">
|
947 |
<?php foreach ( $addons as $addon ) : ?>
|
948 |
<li class="product">
|
949 |
<a href="<?php echo esc_attr( $addon->link ); ?>">
|
958 |
</li>
|
959 |
<?php endforeach; ?>
|
960 |
</ul>
|
961 |
+
<ul class="berocket_section_wc_addons_new" style="display: none;">
|
962 |
+
<?php
|
963 |
+
$class_names = array( 'product' );
|
964 |
+
$product_details_classes = 'product-details';
|
965 |
+
foreach( $addons as $addon ) {
|
966 |
+
?>
|
967 |
+
<li class="<?php echo esc_attr( implode( ' ', $class_names ) ); ?>">
|
968 |
+
<div class="<?php echo esc_attr( $product_details_classes ); ?>">
|
969 |
+
<div class="product-text-container">
|
970 |
+
<a href="<?php echo esc_url( self::link_marketplace($addon->link) ); ?>">
|
971 |
+
<h2><?php echo esc_html( $addon->title ); ?></h2>
|
972 |
+
</a>
|
973 |
+
<div class="product-developed-by">
|
974 |
+
<?php
|
975 |
+
$vendor_url = self::link_marketplace('https://berocket.com');
|
976 |
+
|
977 |
+
printf(
|
978 |
+
/* translators: %s vendor link */
|
979 |
+
esc_html__( 'Developed by %s', 'woocommerce' ),
|
980 |
+
sprintf(
|
981 |
+
'<a class="product-vendor-link" href="%1$s" target="_blank">%2$s</a>',
|
982 |
+
esc_url_raw( $vendor_url ),
|
983 |
+
esc_html( 'BeRocket' )
|
984 |
+
)
|
985 |
+
);
|
986 |
+
?>
|
987 |
+
</div>
|
988 |
+
<p><?php echo wp_kses_post( $addon->excerpt ); ?></p>
|
989 |
+
</div>
|
990 |
+
<?php if ( ! empty( $addon->image ) ) : ?>
|
991 |
+
<span class="product-img-wrap">
|
992 |
+
<?php /* Show an icon if it exists */ ?>
|
993 |
+
<img src="<?php echo esc_url( $addon->image ); ?>" />
|
994 |
+
</span>
|
995 |
+
<?php endif; ?>
|
996 |
+
</div>
|
997 |
+
<div class="product-footer">
|
998 |
+
<div class="product-price-and-reviews-container">
|
999 |
+
<div class="product-price-block">
|
1000 |
+
<?php if ( $addon->price == 0 || $addon->price == '$0' ) : ?>
|
1001 |
+
<span class="price"><?php esc_html_e( 'Free', 'woocommerce' ); ?></span>
|
1002 |
+
<?php else : ?>
|
1003 |
+
<span class="price">
|
1004 |
+
<?php
|
1005 |
+
echo wp_kses(
|
1006 |
+
$addon->price,
|
1007 |
+
array(
|
1008 |
+
'span' => array(
|
1009 |
+
'class' => array(),
|
1010 |
+
),
|
1011 |
+
'bdi' => array(),
|
1012 |
+
)
|
1013 |
+
);
|
1014 |
+
?>
|
1015 |
+
</span>
|
1016 |
+
<span class="price-suffix"><?php esc_html_e( 'one time', 'woocommerce' ); ?></span>
|
1017 |
+
<?php endif; ?>
|
1018 |
+
</div>
|
1019 |
+
<?php if ( ! empty( $mapped->reviews_count ) && ! empty( $mapped->rating ) ) : ?>
|
1020 |
+
<?php /* Show rating and the number of reviews */ ?>
|
1021 |
+
<div class="product-reviews-block">
|
1022 |
+
<?php for ( $index = 1; $index <= 5; ++$index ) : ?>
|
1023 |
+
<?php $rating_star_class = 'product-rating-star product-rating-star__' . self::get_star_class( $mapped->rating, $index ); ?>
|
1024 |
+
<div class="<?php echo esc_attr( $rating_star_class ); ?>"></div>
|
1025 |
+
<?php endfor; ?>
|
1026 |
+
<span class="product-reviews-count">(<?php echo (int) $mapped->reviews_count; ?>)</span>
|
1027 |
+
</div>
|
1028 |
+
<?php endif; ?>
|
1029 |
+
</div>
|
1030 |
+
<a class="button" href="<?php echo esc_url( self::link_marketplace($addon->link) ); ?>">
|
1031 |
+
<?php esc_html_e( 'View details', 'woocommerce' ); ?>
|
1032 |
+
</a>
|
1033 |
+
</div>
|
1034 |
+
</li>
|
1035 |
+
<?php
|
1036 |
+
}
|
1037 |
+
?>
|
1038 |
+
</ul>
|
1039 |
<script>
|
1040 |
if( jQuery('.berocket_section_wc_addons').length && jQuery('.wc_addons_wrap .search-form').length ) {
|
1041 |
+
jQuery('.berocket_section_wc_addons').addClass('products').show();
|
1042 |
jQuery('.wc_addons_wrap .search-form').after(jQuery('.berocket_section_wc_addons'));
|
1043 |
}
|
1044 |
+
if( jQuery('.berocket_section_wc_addons_new').length && jQuery('.marketplace-content-wrapper').length ) {
|
1045 |
+
jQuery('.berocket_section_wc_addons_new').show();
|
1046 |
+
if( jQuery('.marketplace-content-wrapper .products').length > 0 ) {
|
1047 |
+
jQuery('.marketplace-content-wrapper .products').prepend(jQuery('.berocket_section_wc_addons_new .product'));
|
1048 |
+
} else {
|
1049 |
+
jQuery('.berocket_section_wc_addons_new').addClass('products');
|
1050 |
+
jQuery('.marketplace-content-wrapper').prepend(jQuery('.berocket_section_wc_addons_new'));
|
1051 |
+
}
|
1052 |
+
}
|
1053 |
</script>
|
1054 |
<?php
|
1055 |
}
|
1056 |
+
public static function link_marketplace($link) {
|
1057 |
+
$link = add_query_arg( array(
|
1058 |
+
'utm_source' => 'free_plugin',
|
1059 |
+
'utm_medium' => 'marketplace',
|
1060 |
+
'utm_campaign' => 'marketplace',
|
1061 |
+
), $link );
|
1062 |
+
return $link;
|
1063 |
+
}
|
1064 |
public static function hide_key($key) {
|
1065 |
if( ! empty($key) ) {
|
1066 |
$part = (int)(strlen($key) / 3);
|
includes/url-parse.php
CHANGED
@@ -16,7 +16,7 @@ if( ! class_exists('BeRocket_url_parse_page') ) {
|
|
16 |
include_once($filename);
|
17 |
}
|
18 |
add_action('woocommerce_product_query', array($this, 'woocommerce_product_query'), 99999999, 1);
|
19 |
-
add_filter('woocommerce_shortcode_products_query', array( $this, 'woocommerce_shortcode_products_query' ),
|
20 |
add_filter('woocommerce_shortcode_products_query', array( $this, 'woocommerce_shortcode_products_query_save_query_late' ), 9000000, 3);
|
21 |
add_filter('bapf_uparse_apply_filters_to_query_vars', array( $this, 'query_vars_apply_filters' ), 10, 1);
|
22 |
add_filter('bapf_uparse_apply_filters_to_query_vars_save', array( $this, 'query_vars_apply_filters_save' ), 10, 1);
|
@@ -617,10 +617,10 @@ if( ! class_exists('BeRocket_url_parse_page') ) {
|
|
617 |
$value = $result;
|
618 |
continue;
|
619 |
}
|
620 |
-
if(
|
621 |
-
$term_add = $this->get_term_by('id', $value['value'], $value['taxonomy']);
|
622 |
-
} else {
|
623 |
$term_add = $this->get_term_by('slug', $value['value'], $value['taxonomy']);
|
|
|
|
|
624 |
}
|
625 |
if( ! empty($term_add) && ! is_a($term_add, 'WP_Error') ) {
|
626 |
$value['term'] = (empty($options['slug_urls']) ? $term_add->term_id : $term_add->slug);
|
@@ -1089,6 +1089,7 @@ if( ! class_exists('BeRocket_url_parse_page') ) {
|
|
1089 |
return apply_filters('bapf_uparse_func_get_taxonomies_modify', $this->taxonomies, $this);
|
1090 |
}
|
1091 |
public function func_check_attribute_name($attribute_name) {
|
|
|
1092 |
$result = apply_filters('bapf_uparse_func_check_attribute_name', null, $this, $attribute_name);
|
1093 |
if( $result !== null ) {
|
1094 |
return $result;
|
16 |
include_once($filename);
|
17 |
}
|
18 |
add_action('woocommerce_product_query', array($this, 'woocommerce_product_query'), 99999999, 1);
|
19 |
+
add_filter('woocommerce_shortcode_products_query', array( $this, 'woocommerce_shortcode_products_query' ), 900000, 3);
|
20 |
add_filter('woocommerce_shortcode_products_query', array( $this, 'woocommerce_shortcode_products_query_save_query_late' ), 9000000, 3);
|
21 |
add_filter('bapf_uparse_apply_filters_to_query_vars', array( $this, 'query_vars_apply_filters' ), 10, 1);
|
22 |
add_filter('bapf_uparse_apply_filters_to_query_vars_save', array( $this, 'query_vars_apply_filters_save' ), 10, 1);
|
617 |
$value = $result;
|
618 |
continue;
|
619 |
}
|
620 |
+
if( is_string($value['value']) ) {
|
|
|
|
|
621 |
$term_add = $this->get_term_by('slug', $value['value'], $value['taxonomy']);
|
622 |
+
} else {
|
623 |
+
$term_add = $this->get_term_by('id', $value['value'], $value['taxonomy']);
|
624 |
}
|
625 |
if( ! empty($term_add) && ! is_a($term_add, 'WP_Error') ) {
|
626 |
$value['term'] = (empty($options['slug_urls']) ? $term_add->term_id : $term_add->slug);
|
1089 |
return apply_filters('bapf_uparse_func_get_taxonomies_modify', $this->taxonomies, $this);
|
1090 |
}
|
1091 |
public function func_check_attribute_name($attribute_name) {
|
1092 |
+
$attribute_name = berocket_wpml_attribute_untranslate($attribute_name);
|
1093 |
$result = apply_filters('bapf_uparse_func_check_attribute_name', null, $this, $attribute_name);
|
1094 |
if( $result !== null ) {
|
1095 |
return $result;
|
includes/url-parse/price.php
CHANGED
@@ -12,6 +12,12 @@ if( ! class_exists('BeRocket_url_parse_page_price') ) {
|
|
12 |
}
|
13 |
public function init($BeRocket_AAPF) {
|
14 |
$this->main_class = $BeRocket_AAPF;
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
}
|
16 |
public function name_price($result, $instance, $attribute_name) {
|
17 |
$price_taxonomy = apply_filters('bapf_uparse_price_taxonomy', 'price');
|
@@ -96,15 +102,7 @@ if( ! class_exists('BeRocket_url_parse_page_price') ) {
|
|
96 |
return $args;
|
97 |
}
|
98 |
public function advanced_price_to_post_clauses($args, $filter) {
|
99 |
-
|
100 |
-
$min = apply_filters('bapf_uparse_price_for_filtering_convert', (isset( $filter['val_arr']['from'] ) ? floatval( $filter['val_arr']['from'] ) : 0));
|
101 |
-
$max = apply_filters('bapf_uparse_price_for_filtering_convert', (isset( $filter['val_arr']['to'] ) ? floatval( $filter['val_arr']['to'] ) : 9999999999));
|
102 |
-
list($min, $max) = apply_filters('berocket_min_max_filter', array($min, $max));
|
103 |
-
$where = $wpdb->prepare(
|
104 |
-
'bapf_price_lookup.min_price >= %f AND bapf_price_lookup.max_price <= %f ',
|
105 |
-
$min,
|
106 |
-
$max
|
107 |
-
);
|
108 |
$args['join'] .= $this->get_advanced_price_temp_table($where);
|
109 |
return $args;
|
110 |
}
|
@@ -121,6 +119,18 @@ if( ! class_exists('BeRocket_url_parse_page_price') ) {
|
|
121 |
|
122 |
return $table;
|
123 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
function slider_selected($template_content, $terms, $berocket_query_var_title) {
|
125 |
if( in_array($berocket_query_var_title['new_template'], array('slider', 'new_slider')) ) {
|
126 |
foreach($terms as $term){break;}
|
@@ -140,6 +150,52 @@ if( ! class_exists('BeRocket_url_parse_page_price') ) {
|
|
140 |
}
|
141 |
return $template_content;
|
142 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
}
|
144 |
new BeRocket_url_parse_page_price();
|
145 |
}
|
12 |
}
|
13 |
public function init($BeRocket_AAPF) {
|
14 |
$this->main_class = $BeRocket_AAPF;
|
15 |
+
$options = $this->main_class->get_option();
|
16 |
+
if( ! empty($options['filter_price_variation']) ) {
|
17 |
+
add_filter('berocket_aapf_wcvariation_filtering_total_query-add_table', array($this, 'variation_product'), 1000, 4);
|
18 |
+
add_filter('berocket_aapf_wcvariation_filtering_single_attribute-add_table', array($this, 'variation_product_attribute'), 1000, 4);
|
19 |
+
add_filter('berocket_variation_cache_key', array($this, 'variation_cache'), 1000, 1);
|
20 |
+
}
|
21 |
}
|
22 |
public function name_price($result, $instance, $attribute_name) {
|
23 |
$price_taxonomy = apply_filters('bapf_uparse_price_taxonomy', 'price');
|
102 |
return $args;
|
103 |
}
|
104 |
public function advanced_price_to_post_clauses($args, $filter) {
|
105 |
+
$where = $this->get_advanced_where_price_query_part($filter);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
$args['join'] .= $this->get_advanced_price_temp_table($where);
|
107 |
return $args;
|
108 |
}
|
119 |
|
120 |
return $table;
|
121 |
}
|
122 |
+
public function get_advanced_where_price_query_part($filter) {
|
123 |
+
global $wpdb;
|
124 |
+
$min = apply_filters('bapf_uparse_price_for_filtering_convert', (isset( $filter['val_arr']['from'] ) ? floatval( $filter['val_arr']['from'] ) : 0));
|
125 |
+
$max = apply_filters('bapf_uparse_price_for_filtering_convert', (isset( $filter['val_arr']['to'] ) ? floatval( $filter['val_arr']['to'] ) : 9999999999));
|
126 |
+
list($min, $max) = apply_filters('berocket_min_max_filter', array($min, $max));
|
127 |
+
$where = $wpdb->prepare(
|
128 |
+
'bapf_price_lookup.min_price >= %f AND bapf_price_lookup.max_price <= %f ',
|
129 |
+
$min,
|
130 |
+
$max
|
131 |
+
);
|
132 |
+
return $where;
|
133 |
+
}
|
134 |
function slider_selected($template_content, $terms, $berocket_query_var_title) {
|
135 |
if( in_array($berocket_query_var_title['new_template'], array('slider', 'new_slider')) ) {
|
136 |
foreach($terms as $term){break;}
|
150 |
}
|
151 |
return $template_content;
|
152 |
}
|
153 |
+
function variation_product($query, $data, $current_attributes, $current_terms) {
|
154 |
+
global $berocket_parse_page_obj;
|
155 |
+
$data = $berocket_parse_page_obj->get_current();
|
156 |
+
if( ! empty($data['filters']) && count($data['filters']) > 0 ) {
|
157 |
+
foreach($data['filters'] as $filter) {
|
158 |
+
if( $filter['type'] == 'price' && ! empty($filter['val_arr']['op']) && $filter['val_arr']['op'] == 'SLIDER') {
|
159 |
+
$where = $this->get_advanced_where_price_query_part($filter);
|
160 |
+
global $wpdb;
|
161 |
+
$query_price = array(
|
162 |
+
'select' => "SELECT bapf_price_post.ID as product_id from {$wpdb->posts} as bapf_price_post",
|
163 |
+
'join' => "JOIN {$wpdb->wc_product_meta_lookup} as bapf_price_lookup ON bapf_price_post.ID = bapf_price_lookup.product_id",
|
164 |
+
'where' => "WHERE (" . $where . ") AND bapf_price_post.post_parent != 0"
|
165 |
+
);
|
166 |
+
$query_price = apply_filters('berocket_aapf_get_advanced_price_temp_table', $query_price, $where);
|
167 |
+
$query_price = implode(' ', $query_price);
|
168 |
+
$table = " LEFT JOIN ({$query_price}) as bapf_custom_price ON filtered_post.post_id = bapf_custom_price.product_id";
|
169 |
+
$query['subquery']['join_close_1'] .= $table;
|
170 |
+
$query['subquery']['select'] .= ',IF(min(bapf_custom_price.product_id) IS NULL, 1, 0) as not_in_price';
|
171 |
+
$query['select'] .= ',min(filtered_post.not_in_price) as not_in_price';
|
172 |
+
$query['having'] .= ' OR not_in_price = 1';
|
173 |
+
}
|
174 |
+
}
|
175 |
+
}
|
176 |
+
|
177 |
+
return $query;
|
178 |
+
}
|
179 |
+
function variation_product_attribute($query, $partial_data, $current_attributes_part, $current_terms_part) {
|
180 |
+
if( strpos($query['join_select'], 'not_in_price') !== FALSE ) {
|
181 |
+
$query['select'] .= ',min(out_of_stock_var.not_in_price) as not_in_price';
|
182 |
+
$query['having'] .= ' OR not_in_price = 1';
|
183 |
+
}
|
184 |
+
return $query;
|
185 |
+
}
|
186 |
+
function variation_cache($key) {
|
187 |
+
global $berocket_parse_page_obj;
|
188 |
+
$data = $berocket_parse_page_obj->get_current();
|
189 |
+
if( ! empty($data['filters']) && count($data['filters']) > 0 ) {
|
190 |
+
foreach($data['filters'] as $filter) {
|
191 |
+
if( $filter['type'] == 'price' && ! empty($filter['val_arr']['op']) && $filter['val_arr']['op'] == 'SLIDER') {
|
192 |
+
$where = $this->get_advanced_where_price_query_part($filter);
|
193 |
+
$key .= md5($where);
|
194 |
+
}
|
195 |
+
}
|
196 |
+
}
|
197 |
+
return $key;
|
198 |
+
}
|
199 |
}
|
200 |
new BeRocket_url_parse_page_price();
|
201 |
}
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Donate link: https://berocket.com/product/woocommerce-ajax-products-filter?utm_s
|
|
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: 5.0
|
7 |
Tested up to: 5.8
|
8 |
-
Stable tag: 1.6.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -185,6 +185,12 @@ You can try this plugin's admin side [here](https://berocket.com/product/woocomm
|
|
185 |
|
186 |
== Changelog ==
|
187 |
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
= 1.6.0.2 =
|
189 |
* Fix - Selected filters options do not work
|
190 |
* Fix - Link like WooCommerce add-on work incorrect in some cases
|
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: 5.0
|
7 |
Tested up to: 5.8
|
8 |
+
Stable tag: 1.6.1
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
185 |
|
186 |
== Changelog ==
|
187 |
|
188 |
+
= 1.6.1 =
|
189 |
+
* Fix - Compatibility filtering with WPML and Polylang
|
190 |
+
* Fix - Compatibility with WPML taxonomy translation
|
191 |
+
* Fix - Price filtering for variable products
|
192 |
+
* Fix - Attribute values with numeric slug
|
193 |
+
|
194 |
= 1.6.0.2 =
|
195 |
* Fix - Selected filters options do not work
|
196 |
* Fix - Link like WooCommerce add-on work incorrect in some cases
|
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.6.
|
7 |
* Author: BeRocket
|
8 |
* Requires at least: 5.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: 5.9
|
13 |
*/
|
14 |
-
define( "BeRocket_AJAX_filters_version", '1.6.
|
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.6.1
|
7 |
* Author: BeRocket
|
8 |
* Requires at least: 5.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: 5.9
|
13 |
*/
|
14 |
+
define( "BeRocket_AJAX_filters_version", '1.6.1' );
|
15 |
define( "BeRocket_AJAX_filters_file", __FILE__ );
|
16 |
include_once('main.php');
|