Advanced Woo Search - Version 1.93

Version Description

  • Add - Synonyms support for taxonomies search
  • Add - aws_tax_search_data filter
  • Fix - Taxonomies search
  • Fix - Remove potential link from product pricing
Download this release

Release Info

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

Code changes from version 1.92 to 1.93

advanced-woo-search.php CHANGED
@@ -3,12 +3,12 @@
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
- Version: 1.92
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: advanced-woo-search
10
  WC requires at least: 3.0.0
11
- WC tested up to: 3.8.0
12
  */
13
 
14
 
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
16
  exit;
17
  }
18
 
19
- define( 'AWS_VERSION', '1.92' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
+ Version: 1.93
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: advanced-woo-search
10
  WC requires at least: 3.0.0
11
+ WC tested up to: 3.9.0
12
  */
13
 
14
 
16
  exit;
17
  }
18
 
19
+ define( 'AWS_VERSION', '1.93' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
includes/class-aws-search.php CHANGED
@@ -548,6 +548,7 @@ if ( ! class_exists( 'AWS_Search' ) ) :
548
 
549
  if ( $show_price === 'true' && ( $product->is_in_stock() || ( ! $product->is_in_stock() && $show_outofstockprice === 'true' ) ) ) {
550
  $price = $product->get_price_html();
 
551
  }
552
 
553
  if ( $show_sale === 'true' && ( $product->is_in_stock() || ( ! $product->is_in_stock() && $show_outofstockprice === 'true' ) ) ) {
548
 
549
  if ( $show_price === 'true' && ( $product->is_in_stock() || ( ! $product->is_in_stock() && $show_outofstockprice === 'true' ) ) ) {
550
  $price = $product->get_price_html();
551
+ $price = preg_replace("/<a\s(.+?)>(.+?)<\/a>/is", "<span>$2</span>", $price);
552
  }
553
 
554
  if ( $show_sale === 'true' && ( $product->is_in_stock() || ( ! $product->is_in_stock() && $show_outofstockprice === 'true' ) ) ) {
includes/class-aws-tax-search.php CHANGED
@@ -36,6 +36,14 @@ if ( ! class_exists( 'AWS_Tax_Search' ) ) :
36
  */
37
  public function __construct( $taxonomy, $data ) {
38
 
 
 
 
 
 
 
 
 
39
  $this->taxonomy = $taxonomy;
40
  $this->search_string = isset( $data['s'] ) ? $data['s'] : '';
41
  $this->search_string_unfiltered = isset( $data['s_nonormalize'] ) ? $data['s_nonormalize'] : $this->search_string ;
@@ -60,7 +68,9 @@ if ( ! class_exists( 'AWS_Tax_Search' ) ) :
60
 
61
  $filtered_terms_full = $wpdb->prepare( '( name LIKE %s )', '%' . $wpdb->esc_like( $this->search_string_unfiltered ) . '%' );
62
 
63
- $search_array = $this->get_search_array( $this->search_terms );
 
 
64
 
65
  $search_array_chars = $this->get_unfiltered_search_array();
66
 
@@ -272,14 +282,6 @@ if ( ! class_exists( 'AWS_Tax_Search' ) ) :
272
 
273
  foreach ( $search_terms as $search_term ) {
274
 
275
- $search_term_len = strlen( $search_term );
276
-
277
- $search_term_norm = AWS_Plurals::singularize( $search_term );
278
-
279
- if ( $search_term_norm && $search_term_len > 3 && strlen( $search_term_norm ) > 2 ) {
280
- $search_term = $search_term_norm;
281
- }
282
-
283
  $like = '%' . $wpdb->esc_like($search_term) . '%';
284
 
285
  $search_array[] = $wpdb->prepare('( name LIKE %s )', $like);
@@ -375,6 +377,49 @@ if ( ! class_exists( 'AWS_Tax_Search' ) ) :
375
  return $wpdb->prepare('%s', $name);
376
  }
377
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
378
  }
379
 
380
  endif;
36
  */
37
  public function __construct( $taxonomy, $data ) {
38
 
39
+ /**
40
+ * Filters array taxonomies search data
41
+ * @since 1.93
42
+ * @param array $data Array of search data
43
+ * @param string $taxonomy Taxonomy name
44
+ */
45
+ $data = apply_filters( 'aws_tax_search_data', $data, $taxonomy );
46
+
47
  $this->taxonomy = $taxonomy;
48
  $this->search_string = isset( $data['s'] ) ? $data['s'] : '';
49
  $this->search_string_unfiltered = isset( $data['s_nonormalize'] ) ? $data['s_nonormalize'] : $this->search_string ;
68
 
69
  $filtered_terms_full = $wpdb->prepare( '( name LIKE %s )', '%' . $wpdb->esc_like( $this->search_string_unfiltered ) . '%' );
70
 
71
+ $search_array = array_map( array( $this, 'singularize' ), $this->search_terms );
72
+ $search_array = $this->synonyms( $search_array );
73
+ $search_array = $this->get_search_array( $search_array );
74
 
75
  $search_array_chars = $this->get_unfiltered_search_array();
76
 
282
 
283
  foreach ( $search_terms as $search_term ) {
284
 
 
 
 
 
 
 
 
 
285
  $like = '%' . $wpdb->esc_like($search_term) . '%';
286
 
287
  $search_array[] = $wpdb->prepare('( name LIKE %s )', $like);
377
  return $wpdb->prepare('%s', $name);
378
  }
379
 
380
+ /*
381
+ * Singularize terms
382
+ * @param string $search_term Search term
383
+ * @return string Singularized search term
384
+ */
385
+ private function singularize( $search_term ) {
386
+
387
+ $search_term_len = strlen( $search_term );
388
+ $search_term_norm = AWS_Plurals::singularize( $search_term );
389
+
390
+ if ( $search_term_norm && $search_term_len > 3 && strlen( $search_term_norm ) > 2 ) {
391
+ $search_term = $search_term_norm;
392
+ }
393
+
394
+ return $search_term;
395
+
396
+ }
397
+
398
+ /*
399
+ * Add synonyms
400
+ * @param array $search_terms Search term
401
+ * @return array Search term with synonyms
402
+ */
403
+ private function synonyms( $search_terms ) {
404
+
405
+ if ( $search_terms && ! empty( $search_terms ) ) {
406
+
407
+ $new_search_terms = array();
408
+
409
+ foreach( $search_terms as $search_term ) {
410
+ $new_search_terms[$search_term] = 1;
411
+ }
412
+
413
+ $new_search_terms = AWS_Helpers::get_synonyms( $new_search_terms );
414
+
415
+ return array_keys( $new_search_terms );
416
+
417
+ }
418
+
419
+ return $search_terms;
420
+
421
+ }
422
+
423
  }
424
 
425
  endif;
readme.txt CHANGED
@@ -4,15 +4,15 @@ 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.3
7
- Stable tag: 1.92
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Advanced AJAX search plugin for WooCommerce
12
 
13
  == Description ==
14
 
15
- Advanced Woo Search - powerful live search plugin for WooCommerce. Just start typing and you will immediately see the products that you search.
16
 
17
  = Main Features =
18
 
@@ -104,6 +104,12 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
104
 
105
  == Changelog ==
106
 
 
 
 
 
 
 
107
  = 1.92 =
108
  * Update - Flatsome theme support
109
  * Update - Taxonomies search query
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.3
7
+ Stable tag: 1.93
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ WooCommerce search plugin. Advanced search features. Support for both AJAX search and search results page.
12
 
13
  == Description ==
14
 
15
+ Advanced Woo Search - powerful search plugin for WooCommerce. Supports **AJAX** search and **search results page** display.
16
 
17
  = Main Features =
18
 
104
 
105
  == Changelog ==
106
 
107
+ = 1.93 =
108
+ * Add - Synonyms support for taxonomies search
109
+ * Add - aws_tax_search_data filter
110
+ * Fix - Taxonomies search
111
+ * Fix - Remove potential link from product pricing
112
+
113
  = 1.92 =
114
  * Update - Flatsome theme support
115
  * Update - Taxonomies search query