Advanced Woo Search - Version 2.12

Version Description

( 2020-10-05 ) = * Fix - Results display for Divi builder search page template * Fix - Plugin search module for Divi builder * Fix - 'BeRocket Advanced AJAX Product Filters for WooCommerce' plugin integration * Fix - Bug with 'Product Sort and Display for WooCommerce' plugin

Download this release

Release Info

Developer Mihail Barinov
Plugin Icon 128x128 Advanced Woo Search
Version 2.12
Comparing to
See all releases

Code changes from version 2.11 to 2.12

advanced-woo-search.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
- Version: 2.11
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: advanced-woo-search
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
16
  exit;
17
  }
18
 
19
- define( 'AWS_VERSION', '2.11' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
+ Version: 2.12
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: advanced-woo-search
16
  exit;
17
  }
18
 
19
+ define( 'AWS_VERSION', '2.12' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
includes/class-aws-integrations.php CHANGED
@@ -182,6 +182,11 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
182
  add_filter( 'aws_search_page_filters', array( $this, 'berocket_search_page_filters' ) );
183
  }
184
 
 
 
 
 
 
185
  }
186
 
187
  /**
@@ -195,7 +200,7 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
195
  }
196
 
197
  // Divi module
198
- if ( defined( 'ET_BUILDER_PLUGIN_DIR' ) ) {
199
  include_once( AWS_DIR . '/includes/modules/divi/class-divi-aws-module.php' );
200
  }
201
 
@@ -1228,7 +1233,12 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
1228
  $filters['on_sale'] = true;
1229
  } elseif ( $get_filter === '_sale[2]' ) {
1230
  $filters['on_sale'] = false;
1231
- } elseif( preg_match( '/([\w]+)\[(.+?)\]/', $get_filter, $matches ) ) {
 
 
 
 
 
1232
  $taxonomy = $matches[1];
1233
  $operator = strpos( $matches[2], '-' ) !== false ? 'OR' : 'AND';
1234
  $explode_char = strpos( $matches[2], '-' ) !== false ? '-' : '+';
@@ -1246,6 +1256,16 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
1246
 
1247
  }
1248
 
 
 
 
 
 
 
 
 
 
 
1249
  }
1250
 
1251
  endif;
182
  add_filter( 'aws_search_page_filters', array( $this, 'berocket_search_page_filters' ) );
183
  }
184
 
185
+ // Product Sort and Display for WooCommerce plugin
186
+ if ( defined( 'WC_PSAD_NAME' ) ) {
187
+ add_filter( "option_psad_shop_page_enable", array( $this, 'psad_filter' ) );
188
+ }
189
+
190
  }
191
 
192
  /**
200
  }
201
 
202
  // Divi module
203
+ if ( defined( 'ET_BUILDER_PLUGIN_DIR' ) || function_exists( 'et_setup_theme' ) ) {
204
  include_once( AWS_DIR . '/includes/modules/divi/class-divi-aws-module.php' );
205
  }
206
 
1233
  $filters['on_sale'] = true;
1234
  } elseif ( $get_filter === '_sale[2]' ) {
1235
  $filters['on_sale'] = false;
1236
+ } elseif ( strpos( $get_filter, 'price[' ) === 0 ) {
1237
+ if ( preg_match( '/([\w]+)\[(\d+)_(\d+)\]/', $get_filter, $matches ) ) {
1238
+ $filters['price_min'] = intval( $matches[2] );
1239
+ $filters['price_max'] = intval( $matches[3] );
1240
+ }
1241
+ } elseif ( preg_match( '/(.+)\[(.+?)\]/', $get_filter, $matches ) ) {
1242
  $taxonomy = $matches[1];
1243
  $operator = strpos( $matches[2], '-' ) !== false ? 'OR' : 'AND';
1244
  $explode_char = strpos( $matches[2], '-' ) !== false ? '-' : '+';
1256
 
1257
  }
1258
 
1259
+ /*
1260
+ * Product Sort and Display for WooCommerce plugin disable on search page
1261
+ */
1262
+ function psad_filter( $value ) {
1263
+ if ( isset( $_GET['type_aws'] ) ) {
1264
+ return 'no';
1265
+ }
1266
+ return $value;
1267
+ }
1268
+
1269
  }
1270
 
1271
  endif;
includes/class-aws-search-page.php CHANGED
@@ -81,6 +81,10 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
81
 
82
  add_filter( 'body_class', array( $this, 'body_class' ), 999 );
83
 
 
 
 
 
84
  }
85
 
86
  /**
@@ -181,7 +185,8 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
181
  public function posts_pre_query( $posts, $query ) {
182
 
183
  if ( isset( $_GET['type_aws'] ) && isset( $query->query_vars['s'] ) && $query->query && isset( $query->query['fields'] ) && $query->query['fields'] == 'ids' &&
184
- isset( $this->data['is_elementor'] ) && $this->data['is_elementor'] )
 
185
  {
186
 
187
  $products_ids = array();
@@ -305,7 +310,9 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
305
  public function filter_found_posts( $found_posts, $query ) {
306
 
307
  // Elementor search template fix
308
- if ( isset( $_GET['type_aws'] ) && isset( $this->data['all_products'] ) && $this->data['all_products'] && isset( $this->data['is_elementor'] ) && $this->data['is_elementor'] && isset( $query->query_vars['nopaging'] ) && ! $query->query_vars['nopaging'] ) {
 
 
309
  $found_posts = count( $this->data['all_products'] );
310
  }
311
 
@@ -469,6 +476,16 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
469
  return $classes;
470
  }
471
 
 
 
 
 
 
 
 
 
 
 
472
  /**
473
  * Check if we should override default search query
474
  *
81
 
82
  add_filter( 'body_class', array( $this, 'body_class' ), 999 );
83
 
84
+ // Divi builder support
85
+ add_action( 'et_pb_shop_before_print_shop', array( $this, 'et_pb_shop_before_print_shop' ) );
86
+ add_action( 'et_pb_shop_after_print_shop', array( $this, 'et_pb_shop_after_print_shop' ) );
87
+
88
  }
89
 
90
  /**
185
  public function posts_pre_query( $posts, $query ) {
186
 
187
  if ( isset( $_GET['type_aws'] ) && isset( $query->query_vars['s'] ) && $query->query && isset( $query->query['fields'] ) && $query->query['fields'] == 'ids' &&
188
+ ( ( isset( $this->data['is_elementor'] ) && $this->data['is_elementor'] ) || ( isset( $this->data['is_divi_s_page'] ) && $this->data['is_divi_s_page'] ) )
189
+ )
190
  {
191
 
192
  $products_ids = array();
310
  public function filter_found_posts( $found_posts, $query ) {
311
 
312
  // Elementor search template fix
313
+ if ( isset( $_GET['type_aws'] ) && isset( $this->data['all_products'] ) && $this->data['all_products'] && isset( $query->query_vars['nopaging'] ) && ! $query->query_vars['nopaging'] &&
314
+ ( ( isset( $this->data['is_elementor'] ) && $this->data['is_elementor'] ) || ( isset( $this->data['is_divi_s_page'] ) && $this->data['is_divi_s_page'] ) )
315
+ ) {
316
  $found_posts = count( $this->data['all_products'] );
317
  }
318
 
476
  return $classes;
477
  }
478
 
479
+ /*
480
+ * Is it Divi builder search page template with Shop module?
481
+ */
482
+ public function et_pb_shop_before_print_shop() {
483
+ $this->data['is_divi_s_page'] = true;
484
+ }
485
+ public function et_pb_shop_after_print_shop() {
486
+ $this->data['is_divi_s_page'] = false;
487
+ }
488
+
489
  /**
490
  * Check if we should override default search query
491
  *
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: widget, plugin, woocommerce, search, product search, woocommerce search, ajax search, live search, custom search, ajax, shortcode, better search, relevance search, relevant search, search by sku, search plugin, shop, store, wordpress search, wp ajax search, wp search, wp search plugin, sidebar, ecommerce, merketing, products, category search, instant-search, search highlight, woocommerce advanced search, woocommerce live search, WooCommerce Plugin, woocommerce product search
5
  Requires at least: 4.0
6
  Tested up to: 5.5
7
- Stable tag: 2.11
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -111,6 +111,12 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
111
 
112
  == Changelog ==
113
 
 
 
 
 
 
 
114
  = 2.11 ( 2020-09-21 ) =
115
  * Add - Venedor theme support
116
  * Update - Option to add description for archive pages inside search results
4
  Tags: widget, plugin, woocommerce, search, product search, woocommerce search, ajax search, live search, custom search, ajax, shortcode, better search, relevance search, relevant search, search by sku, search plugin, shop, store, wordpress search, wp ajax search, wp search, wp search plugin, sidebar, ecommerce, merketing, products, category search, instant-search, search highlight, woocommerce advanced search, woocommerce live search, WooCommerce Plugin, woocommerce product search
5
  Requires at least: 4.0
6
  Tested up to: 5.5
7
+ Stable tag: 2.12
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
111
 
112
  == Changelog ==
113
 
114
+ = 2.12 ( 2020-10-05 ) =
115
+ * Fix - Results display for Divi builder search page template
116
+ * Fix - Plugin search module for Divi builder
117
+ * Fix - 'BeRocket Advanced AJAX Product Filters for WooCommerce' plugin integration
118
+ * Fix - Bug with 'Product Sort and Display for WooCommerce' plugin
119
+
120
  = 2.11 ( 2020-09-21 ) =
121
  * Add - Venedor theme support
122
  * Update - Option to add description for archive pages inside search results