Advanced Woo Search - Version 1.97

Version Description

  • Update - Fully compatible with WooCommerce 4.0
  • Update - Increase memory and time limit for index process
  • Update - Ocean WP theme integration update
  • Dev - Add new parameter for aws_extracted_terms filter
  • Dev - Update taxonomies search class
Download this release

Release Info

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

Code changes from version 1.96 to 1.97

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.96
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,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
16
  exit;
17
  }
18
 
19
- define( 'AWS_VERSION', '1.96' );
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.97
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: 4.0.0
12
  */
13
 
14
 
16
  exit;
17
  }
18
 
19
+ define( 'AWS_VERSION', '1.97' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
includes/class-aws-integrations.php CHANGED
@@ -422,6 +422,10 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
422
  top: -100px;
423
  }
424
 
 
 
 
 
425
  </style>
426
 
427
  <script>
@@ -712,6 +716,7 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
712
  if ( class_exists( 'OCEANWP_Theme_Class' ) ) {
713
  $selectors[] = '#searchform-header-replace form';
714
  $selectors[] = '#searchform-overlay form';
 
715
  }
716
 
717
  return $selectors;
422
  top: -100px;
423
  }
424
 
425
+ #sidr .aws-container {
426
+ margin: 30px 20px 0;
427
+ }
428
+
429
  </style>
430
 
431
  <script>
716
  if ( class_exists( 'OCEANWP_Theme_Class' ) ) {
717
  $selectors[] = '#searchform-header-replace form';
718
  $selectors[] = '#searchform-overlay form';
719
+ $selectors[] = '#sidr .sidr-class-mobile-searchform';
720
  }
721
 
722
  return $selectors;
includes/class-aws-table.php CHANGED
@@ -58,8 +58,17 @@ if ( ! class_exists( 'AWS_Table' ) ) :
58
  * Reindex plugin table ajax hook
59
  */
60
  public function reindex_table_ajax() {
 
61
  check_ajax_referer( 'aws_admin_ajax_nonce' );
 
 
 
 
 
 
 
62
  $this->reindex_table();
 
63
  }
64
 
65
  /*
@@ -465,22 +474,22 @@ if ( ! class_exists( 'AWS_Table' ) ) :
465
  $excerpt = apply_filters( 'aws_indexed_excerpt', $excerpt, $data['id'], $product );
466
 
467
 
468
- $data['terms']['title'] = $this->extract_terms( $title );
469
- $data['terms']['content'] = $this->extract_terms( $content );
470
- $data['terms']['excerpt'] = $this->extract_terms( $excerpt );
471
- $data['terms']['sku'] = $this->extract_terms( $sku );
472
- $data['terms']['id'] = $this->extract_terms( $ids );
473
 
474
 
475
  if ( $cat_array && ! empty( $cat_array ) ) {
476
  foreach( $cat_array as $cat_source => $cat_terms ) {
477
- $data['terms'][$cat_source] = $this->extract_terms( $cat_terms );
478
  }
479
  }
480
 
481
  if ( $tag_array && ! empty( $tag_array ) ) {
482
  foreach( $tag_array as $tag_source => $tag_terms ) {
483
- $data['terms'][$tag_source] = $this->extract_terms( $tag_terms );
484
  }
485
  }
486
 
@@ -518,11 +527,11 @@ if ( ! class_exists( 'AWS_Table' ) ) :
518
  $translated_content = AWS_Helpers::strip_shortcodes( $translated_content );
519
  $translated_excerpt = AWS_Helpers::strip_shortcodes( $translated_excerpt );
520
 
521
- $translated_post_data['terms']['title'] = $this->extract_terms( $translated_title );
522
- $translated_post_data['terms']['content'] = $this->extract_terms( $translated_content );
523
- $translated_post_data['terms']['excerpt'] = $this->extract_terms( $translated_excerpt );
524
- $translated_post_data['terms']['sku'] = $this->extract_terms( $sku );
525
- $translated_post_data['terms']['id'] = $this->extract_terms( $translated_post->ID );
526
 
527
 
528
  //Insert translated product data into table
@@ -545,7 +554,7 @@ if ( ! class_exists( 'AWS_Table' ) ) :
545
 
546
  if ( $current_lang == $lang ) {
547
  $default_lang_title = qtranxf_use( $current_lang, $product->get_name(), true, true );
548
- $data['terms']['title'] = $this->extract_terms( $default_lang_title );
549
  continue;
550
  }
551
 
@@ -579,11 +588,11 @@ if ( ! class_exists( 'AWS_Table' ) ) :
579
  $translated_content = AWS_Helpers::strip_shortcodes( $translated_content );
580
  $translated_excerpt = AWS_Helpers::strip_shortcodes( $translated_excerpt );
581
 
582
- $translated_post_data['terms']['title'] = $this->extract_terms( $translated_title );
583
- $translated_post_data['terms']['content'] = $this->extract_terms( $translated_content );
584
- $translated_post_data['terms']['excerpt'] = $this->extract_terms( $translated_excerpt );
585
- $translated_post_data['terms']['sku'] = $this->extract_terms( $sku );
586
- $translated_post_data['terms']['id'] = $this->extract_terms( $ids );
587
 
588
 
589
  //Insert translated product data into table
@@ -804,7 +813,7 @@ if ( ! class_exists( 'AWS_Table' ) ) :
804
  /*
805
  * Extract terms from content
806
  */
807
- private function extract_terms( $str ) {
808
 
809
  // Avoid single A-Z.
810
  //$str = preg_replace( '/\b\w{1}\b/i', " ", $str );
@@ -847,8 +856,9 @@ if ( ! class_exists( 'AWS_Table' ) ) :
847
  * @since 1.44
848
  *
849
  * @param string $str String of product content
 
850
  */
851
- $str = apply_filters( 'aws_extracted_string', $str );
852
 
853
  $str_array = explode( ' ', $str );
854
  $str_array = AWS_Helpers::filter_stopwords( $str_array );
@@ -860,8 +870,9 @@ if ( ! class_exists( 'AWS_Table' ) ) :
860
  * @since 1.44
861
  *
862
  * @param string $str_array Array of terms
 
863
  */
864
- $str_array = apply_filters( 'aws_extracted_terms', $str_array );
865
 
866
  $str_new_array = array();
867
 
58
  * Reindex plugin table ajax hook
59
  */
60
  public function reindex_table_ajax() {
61
+
62
  check_ajax_referer( 'aws_admin_ajax_nonce' );
63
+
64
+ if ( function_exists( 'wp_raise_memory_limit' ) ) {
65
+ wp_raise_memory_limit( 'admin' );
66
+ }
67
+
68
+ @set_time_limit( 600 );
69
+
70
  $this->reindex_table();
71
+
72
  }
73
 
74
  /*
474
  $excerpt = apply_filters( 'aws_indexed_excerpt', $excerpt, $data['id'], $product );
475
 
476
 
477
+ $data['terms']['title'] = $this->extract_terms( $title, 'title' );
478
+ $data['terms']['content'] = $this->extract_terms( $content, 'content' );
479
+ $data['terms']['excerpt'] = $this->extract_terms( $excerpt, 'excerpt' );
480
+ $data['terms']['sku'] = $this->extract_terms( $sku, 'sku' );
481
+ $data['terms']['id'] = $this->extract_terms( $ids, 'id' );
482
 
483
 
484
  if ( $cat_array && ! empty( $cat_array ) ) {
485
  foreach( $cat_array as $cat_source => $cat_terms ) {
486
+ $data['terms'][$cat_source] = $this->extract_terms( $cat_terms, 'cat' );
487
  }
488
  }
489
 
490
  if ( $tag_array && ! empty( $tag_array ) ) {
491
  foreach( $tag_array as $tag_source => $tag_terms ) {
492
+ $data['terms'][$tag_source] = $this->extract_terms( $tag_terms, 'tag' );
493
  }
494
  }
495
 
527
  $translated_content = AWS_Helpers::strip_shortcodes( $translated_content );
528
  $translated_excerpt = AWS_Helpers::strip_shortcodes( $translated_excerpt );
529
 
530
+ $translated_post_data['terms']['title'] = $this->extract_terms( $translated_title, 'title' );
531
+ $translated_post_data['terms']['content'] = $this->extract_terms( $translated_content, 'content' );
532
+ $translated_post_data['terms']['excerpt'] = $this->extract_terms( $translated_excerpt, 'excerpt' );
533
+ $translated_post_data['terms']['sku'] = $this->extract_terms( $sku, 'sku' );
534
+ $translated_post_data['terms']['id'] = $this->extract_terms( $translated_post->ID, 'id' );
535
 
536
 
537
  //Insert translated product data into table
554
 
555
  if ( $current_lang == $lang ) {
556
  $default_lang_title = qtranxf_use( $current_lang, $product->get_name(), true, true );
557
+ $data['terms']['title'] = $this->extract_terms( $default_lang_title, 'title' );
558
  continue;
559
  }
560
 
588
  $translated_content = AWS_Helpers::strip_shortcodes( $translated_content );
589
  $translated_excerpt = AWS_Helpers::strip_shortcodes( $translated_excerpt );
590
 
591
+ $translated_post_data['terms']['title'] = $this->extract_terms( $translated_title, 'title' );
592
+ $translated_post_data['terms']['content'] = $this->extract_terms( $translated_content, 'content' );
593
+ $translated_post_data['terms']['excerpt'] = $this->extract_terms( $translated_excerpt, 'excerpt' );
594
+ $translated_post_data['terms']['sku'] = $this->extract_terms( $sku, 'sku' );
595
+ $translated_post_data['terms']['id'] = $this->extract_terms( $ids, 'id' );
596
 
597
 
598
  //Insert translated product data into table
813
  /*
814
  * Extract terms from content
815
  */
816
+ private function extract_terms( $str, $source = '' ) {
817
 
818
  // Avoid single A-Z.
819
  //$str = preg_replace( '/\b\w{1}\b/i', " ", $str );
856
  * @since 1.44
857
  *
858
  * @param string $str String of product content
859
+ * @param @since 1.97 string $source Terms source
860
  */
861
+ $str = apply_filters( 'aws_extracted_string', $str, $source );
862
 
863
  $str_array = explode( ' ', $str );
864
  $str_array = AWS_Helpers::filter_stopwords( $str_array );
870
  * @since 1.44
871
  *
872
  * @param string $str_array Array of terms
873
+ * @param @since 1.97 string $source Terms source
874
  */
875
+ $str_array = apply_filters( 'aws_extracted_terms', $str_array, $source );
876
 
877
  $str_new_array = array();
878
 
includes/class-aws-tax-search.php CHANGED
@@ -172,10 +172,6 @@ if ( ! class_exists( 'AWS_Tax_Search' ) ) :
172
 
173
  foreach ( $search_results as $result ) {
174
 
175
- if ( ! $result->count > 0 ) {
176
- continue;
177
- }
178
-
179
  if ( function_exists( 'wpml_object_id_filter' ) ) {
180
  $term = wpml_object_id_filter( $result->term_id, $result->taxonomy );
181
  if ( $term != $result->term_id ) {
@@ -193,7 +189,7 @@ if ( ! class_exists( 'AWS_Tax_Search' ) ) :
193
 
194
  $new_result = array(
195
  'name' => $result->name,
196
- 'count' => $result->count,
197
  'link' => $term_link
198
  );
199
 
172
 
173
  foreach ( $search_results as $result ) {
174
 
 
 
 
 
175
  if ( function_exists( 'wpml_object_id_filter' ) ) {
176
  $term = wpml_object_id_filter( $result->term_id, $result->taxonomy );
177
  if ( $term != $result->term_id ) {
189
 
190
  $new_result = array(
191
  'name' => $result->name,
192
+ 'count' => ( $result->count > 0 ) ? $result->count : '',
193
  'link' => $term_link
194
  );
195
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Mihail Barinov
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=GSE37FC4Y7CEY
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.96
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -104,6 +104,13 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
104
 
105
  == Changelog ==
106
 
 
 
 
 
 
 
 
107
  = 1.96 =
108
  * Add - Mobile full screen search option
109
  * Fix - Search form markup
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=GSE37FC4Y7CEY
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.4
7
+ Stable tag: 1.97
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
104
 
105
  == Changelog ==
106
 
107
+ = 1.97 =
108
+ * Update - Fully compatible with WooCommerce 4.0
109
+ * Update - Increase memory and time limit for index process
110
+ * Update - Ocean WP theme integration update
111
+ * Dev - Add new parameter for aws_extracted_terms filter
112
+ * Dev - Update taxonomies search class
113
+
114
  = 1.96 =
115
  * Add - Mobile full screen search option
116
  * Fix - Search form markup