Advanced Woo Search - Version 1.88

Version Description

  • Add - WooCommerce Product Table plugin support
  • Add - aws_highlight_tag filter
  • Update - Search query speed-up. Removed unused lines
  • Update - Avada theme integration
  • Update - Settings page text
Download this release

Release Info

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

Code changes from version 1.87 to 1.88

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: 1.87
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', '1.87' );
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.88
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', '1.88' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
includes/admin/class-aws-admin-options.php CHANGED
@@ -354,7 +354,7 @@ if ( ! class_exists( 'AWS_Admin_Options' ) ) :
354
  "type" => "radio",
355
  'choices' => array(
356
  'content' => __( 'Content', 'advanced-woo-search' ),
357
- 'excerpt' => __( 'Excerpt', 'advanced-woo-search' ),
358
  )
359
  );
360
 
354
  "type" => "radio",
355
  'choices' => array(
356
  'content' => __( 'Content', 'advanced-woo-search' ),
357
+ 'excerpt' => __( 'Short description', 'advanced-woo-search' ),
358
  )
359
  );
360
 
includes/class-aws-integrations.php CHANGED
@@ -95,6 +95,11 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
95
  add_action( 'wp_head', array( $this, 'oceanwp_head_action' ) );
96
  }
97
 
 
 
 
 
 
98
  }
99
 
100
  // Wholesale plugin hide certain products
@@ -107,6 +112,12 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
107
  add_filter( 'aws_index_product_ids', array( $this, 'search_exclude_filter' ) );
108
  }
109
 
 
 
 
 
 
 
110
  }
111
 
112
  /*
@@ -428,6 +439,47 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
428
 
429
  <?php }
430
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
431
  /*
432
  * Porto theme seamless integration
433
  */
@@ -692,6 +744,23 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
692
 
693
  }
694
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
695
  }
696
 
697
  endif;
95
  add_action( 'wp_head', array( $this, 'oceanwp_head_action' ) );
96
  }
97
 
98
+ // Avada theme
99
+ if ( class_exists( 'Avada' ) ) {
100
+ add_action( 'wp_head', array( $this, 'avada_head_action' ) );
101
+ }
102
+
103
  }
104
 
105
  // Wholesale plugin hide certain products
112
  add_filter( 'aws_index_product_ids', array( $this, 'search_exclude_filter' ) );
113
  }
114
 
115
+ // WooCommerce Product Table plugin
116
+ if ( class_exists( 'WC_Product_Table_Plugin' ) ) {
117
+ add_filter( 'wc_product_table_data_config', array( $this, 'wc_product_table_data_config' ) );
118
+ add_filter( 'aws_posts_per_page', array( $this, 'wc_product_table_posts_per_page' ) );
119
+ }
120
+
121
  }
122
 
123
  /*
439
 
440
  <?php }
441
 
442
+ /*
443
+ * Avada wp theme
444
+ */
445
+ public function avada_head_action() { ?>
446
+
447
+ <style>
448
+
449
+ .fusion-flyout-search .aws-container {
450
+ margin: 0 auto;
451
+ padding: 0;
452
+ width: 100%;
453
+ width: calc(100% - 40px);
454
+ max-width: 600px;
455
+ position: absolute;
456
+ top: 40%;
457
+ left: 20px;
458
+ right: 20px;
459
+ }
460
+
461
+ </style>
462
+
463
+ <script>
464
+
465
+ window.addEventListener('load', function() {
466
+ var awsSearch = document.querySelectorAll(".fusion-menu .fusion-main-menu-search a, .fusion-flyout-menu-icons .fusion-icon-search");
467
+ if ( awsSearch ) {
468
+ for (var i = 0; i < awsSearch.length; i++) {
469
+ awsSearch[i].addEventListener('click', function() {
470
+ window.setTimeout(function(){
471
+ document.querySelector(".fusion-menu .fusion-main-menu-search .aws-search-field, .fusion-flyout-search .aws-search-field").focus();
472
+ }, 100);
473
+ }, false);
474
+ }
475
+ }
476
+
477
+ }, false);
478
+
479
+ </script>
480
+
481
+ <?php }
482
+
483
  /*
484
  * Porto theme seamless integration
485
  */
744
 
745
  }
746
 
747
+ /*
748
+ * Fix WooCommerce Product Table for search page
749
+ */
750
+ public function wc_product_table_data_config( $config ) {
751
+ if ( isset( $_GET['type_aws'] ) && isset( $config['search'] ) ) {
752
+ $config['search']['search'] = '';
753
+ }
754
+ return $config;
755
+ }
756
+
757
+ /*
758
+ * WooCommerce Product Table plugin change number of products on page
759
+ */
760
+ public function wc_product_table_posts_per_page( $num ) {
761
+ return 9999;
762
+ }
763
+
764
  }
765
 
766
  endif;
includes/class-aws-search.php CHANGED
@@ -267,7 +267,6 @@ if ( ! class_exists( 'AWS_Search' ) ) :
267
 
268
  $query['select'] = '';
269
  $query['search'] = '';
270
- $query['source'] = '';
271
  $query['relevance'] = '';
272
  $query['stock'] = '';
273
  $query['visibility'] = '';
@@ -275,7 +274,6 @@ if ( ! class_exists( 'AWS_Search' ) ) :
275
  $query['lang'] = '';
276
 
277
  $search_array = array();
278
- $source_array = array();
279
  $relevance_array = array();
280
  $new_relevance_array = array();
281
 
@@ -366,14 +364,9 @@ if ( ! class_exists( 'AWS_Search' ) ) :
366
  }
367
  }
368
 
369
- foreach ( $search_in_arr as $search_in_term ) {
370
- $source_array[] = "term_source = '{$search_in_term}'";
371
- }
372
-
373
  $query['select'] = ' distinct ID';
374
  $query['relevance'] = sprintf( ' (SUM( %s )) ', implode( ' + ', $new_relevance_array ) );
375
  $query['search'] = sprintf( ' AND ( %s )', implode( ' OR ', $search_array ) );
376
- $query['source'] = sprintf( ' AND ( %s )', implode( ' OR ', $source_array ) );
377
 
378
 
379
  if ( $reindex_version && version_compare( $reindex_version, '1.16', '>=' ) ) {
@@ -432,13 +425,13 @@ if ( ! class_exists( 'AWS_Search' ) ) :
432
  {$table_name}
433
  WHERE
434
  1=1
435
- {$query['source']}
436
  {$query['search']}
437
  {$query['stock']}
438
  {$query['visibility']}
439
  {$query['exclude_products']}
440
  {$query['lang']}
441
  GROUP BY ID
 
442
  ORDER BY
443
  relevance DESC, id DESC
444
  LIMIT 0, {$results_num}
@@ -740,8 +733,17 @@ if ( ! class_exists( 'AWS_Search' ) ) :
740
 
741
  }
742
 
743
- $title = preg_replace($pattern, '<strong>${0}</strong>', $title );
744
- $content = preg_replace( $pattern, '<strong>${0}</strong>', $content );
 
 
 
 
 
 
 
 
 
745
 
746
  return array(
747
  'title' => $title,
267
 
268
  $query['select'] = '';
269
  $query['search'] = '';
 
270
  $query['relevance'] = '';
271
  $query['stock'] = '';
272
  $query['visibility'] = '';
274
  $query['lang'] = '';
275
 
276
  $search_array = array();
 
277
  $relevance_array = array();
278
  $new_relevance_array = array();
279
 
364
  }
365
  }
366
 
 
 
 
 
367
  $query['select'] = ' distinct ID';
368
  $query['relevance'] = sprintf( ' (SUM( %s )) ', implode( ' + ', $new_relevance_array ) );
369
  $query['search'] = sprintf( ' AND ( %s )', implode( ' OR ', $search_array ) );
 
370
 
371
 
372
  if ( $reindex_version && version_compare( $reindex_version, '1.16', '>=' ) ) {
425
  {$table_name}
426
  WHERE
427
  1=1
 
428
  {$query['search']}
429
  {$query['stock']}
430
  {$query['visibility']}
431
  {$query['exclude_products']}
432
  {$query['lang']}
433
  GROUP BY ID
434
+ having relevance > 0
435
  ORDER BY
436
  relevance DESC, id DESC
437
  LIMIT 0, {$results_num}
733
 
734
  }
735
 
736
+ /**
737
+ * Tag to use for highlighting search words inside content
738
+ * @since 1.88
739
+ * @param string Tag for highlighting
740
+ */
741
+ $highlight_tag = apply_filters( 'aws_highlight_tag', 'strong' );
742
+
743
+ $highlight_tag_pattern = '<' . $highlight_tag . '>${0}</' . $highlight_tag . '>';
744
+
745
+ $title = preg_replace($pattern, $highlight_tag_pattern, $title );
746
+ $content = preg_replace( $pattern, $highlight_tag_pattern, $content );
747
 
748
  return array(
749
  'title' => $title,
languages/advanced-woo-search-hu_HU.po CHANGED
@@ -190,7 +190,7 @@ msgid "Content"
190
  msgstr "Teljes leírás"
191
 
192
  #: includes/options.php:80
193
- msgid "Excerpt"
194
  msgstr "Rövid leírás"
195
 
196
  #: includes/options.php:85
190
  msgstr "Teljes leírás"
191
 
192
  #: includes/options.php:80
193
+ msgid "Short description"
194
  msgstr "Rövid leírás"
195
 
196
  #: includes/options.php:85
languages/advanced-woo-search-ru_RU.po CHANGED
@@ -352,7 +352,7 @@ msgid "Content"
352
  msgstr "Содержание"
353
 
354
  #: includes/options.php:80
355
- msgid "Excerpt"
356
  msgstr "Отрывок"
357
 
358
  #: includes/options.php:85
352
  msgstr "Содержание"
353
 
354
  #: includes/options.php:80
355
+ msgid "Short description"
356
  msgstr "Отрывок"
357
 
358
  #: includes/options.php:85
languages/advanced-woo-search.pot CHANGED
@@ -296,7 +296,7 @@ msgid "Content"
296
  msgstr ""
297
 
298
  #: includes/options.php:80
299
- msgid "Excerpt"
300
  msgstr ""
301
 
302
  #: includes/options.php:85
296
  msgstr ""
297
 
298
  #: includes/options.php:80
299
+ msgid "Short description"
300
  msgstr ""
301
 
302
  #: includes/options.php:85
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.3
7
- Stable tag: 1.87
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -27,7 +27,7 @@ Advanced Woo Search - powerful live search plugin for WooCommerce. Just start ty
27
  * **Fast** - Nothing extra. Just what you need for proper work
28
  * **Stop Words** support to exclude certain words from search.
29
  * Supports **variable products**
30
- * Support for your current **search page**. Plugin search results will be integrated to your current page layout.
31
  * Automatically synchronize all products data. No need to re-index all content manually after avery change.
32
  * **Plurals** support
33
  * **Synonyms** support
@@ -104,6 +104,13 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
104
 
105
  == Changelog ==
106
 
 
 
 
 
 
 
 
107
  = 1.87 =
108
  * Fix - Bug with search results sorting
109
  * Update - Hide disabled variations from search
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.88
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
27
  * **Fast** - Nothing extra. Just what you need for proper work
28
  * **Stop Words** support to exclude certain words from search.
29
  * Supports **variable products**
30
+ * **Search results page** support. Plugin search results will be integrated to your current page layout.
31
  * Automatically synchronize all products data. No need to re-index all content manually after avery change.
32
  * **Plurals** support
33
  * **Synonyms** support
104
 
105
  == Changelog ==
106
 
107
+ = 1.88 =
108
+ * Add - WooCommerce Product Table plugin support
109
+ * Add - aws_highlight_tag filter
110
+ * Update - Search query speed-up. Removed unused lines
111
+ * Update - Avada theme integration
112
+ * Update - Settings page text
113
+
114
  = 1.87 =
115
  * Fix - Bug with search results sorting
116
  * Update - Hide disabled variations from search