Advanced Woo Search - Version 1.45

Version Description

  • Fix bug with re-index process ( too much requests error )
  • Add timeout for keyup event
  • Fix bug with special characters search
Download this release

Release Info

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

Code changes from version 1.44 to 1.45

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.44
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: aws
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
16
  exit;
17
  }
18
 
19
- define( 'AWS_VERSION', '1.44' );
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.45
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: aws
16
  exit;
17
  }
18
 
19
+ define( 'AWS_VERSION', '1.45' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
assets/js/admin.js CHANGED
@@ -78,7 +78,7 @@ jQuery(document).ready(function ($) {
78
  }
79
 
80
  },
81
- error : function( jqXHR, textStatus ) {
82
  console.log( "Request failed: " + textStatus );
83
 
84
  if ( textStatus == 'timeout' || jqXHR.status == 504 ) {
@@ -86,10 +86,18 @@ jQuery(document).ready(function ($) {
86
  if ( syncData ) {
87
  setTimeout(function() { sync( syncData ); }, 1000);
88
  }
 
 
 
 
 
 
 
 
89
  }
90
 
91
  },
92
- complete: function () {
93
  }
94
  });
95
 
78
  }
79
 
80
  },
81
+ error : function( jqXHR, textStatus, errorThrown ) {
82
  console.log( "Request failed: " + textStatus );
83
 
84
  if ( textStatus == 'timeout' || jqXHR.status == 504 ) {
86
  if ( syncData ) {
87
  setTimeout(function() { sync( syncData ); }, 1000);
88
  }
89
+ } else if ( textStatus == 'error') {
90
+ if ( syncData ) {
91
+
92
+ if ( 0 !== syncData.offset && ! syncData.start ) {
93
+ setTimeout(function() { sync( syncData ); }, 3000);
94
+ }
95
+
96
+ }
97
  }
98
 
99
  },
100
+ complete: function ( jqXHR, textStatus ) {
101
  }
102
  });
103
 
assets/js/common.js CHANGED
@@ -62,6 +62,15 @@
62
  methods.showLoader();
63
  }
64
 
 
 
 
 
 
 
 
 
 
65
  var data = {
66
  action: 'aws_action',
67
  keyword : searchFor,
@@ -312,6 +321,7 @@
312
  haveResults = false,
313
  requests = Array(),
314
  searchFor = '',
 
315
  cachedResponse = new Array();
316
 
317
 
62
  methods.showLoader();
63
  }
64
 
65
+ clearTimeout( keyupTimeout );
66
+ keyupTimeout = setTimeout( function() {
67
+ methods.ajaxRequest();
68
+ }, 300 );
69
+
70
+ },
71
+
72
+ ajaxRequest: function() {
73
+
74
  var data = {
75
  action: 'aws_action',
76
  keyword : searchFor,
321
  haveResults = false,
322
  requests = Array(),
323
  searchFor = '',
324
+ keyupTimeout,
325
  cachedResponse = new Array();
326
 
327
 
includes/class-aws-admin.php CHANGED
@@ -386,6 +386,7 @@ class AWS_Admin {
386
  echo '<td>';
387
  echo '<div id="aws-reindex"><input class="button" type="button" value="' . __( 'Reindex table', 'aws' ) . '"><span class="loader"></span><span class="reindex-progress">0%</span></div><br><br>';
388
  echo '<span class="description">' .
 
389
  __( 'Update all data in plugins index table. Index table - table with products data where plugin is searching all typed terms.<br>Use this button if you think that plugin not shows last actual data in its search results.<br><strong>CAUTION:</strong> this can take large amount of time.', 'aws' ) . '<br><br>' .
390
  __( 'Products in index:', 'aws' ) . '<span id="aws-reindex-count"> <strong>' . AWS_Helpers::get_indexed_products_count() . '</strong></span>';
391
  echo '</span>';
386
  echo '<td>';
387
  echo '<div id="aws-reindex"><input class="button" type="button" value="' . __( 'Reindex table', 'aws' ) . '"><span class="loader"></span><span class="reindex-progress">0%</span></div><br><br>';
388
  echo '<span class="description">' .
389
+ sprintf( __( 'This action only need for %s one time %s - after you activate this plugin. After this all products changes will be re-indexed automatically.', 'aws' ), '<strong>', '</strong>' ) . '<br>' .
390
  __( 'Update all data in plugins index table. Index table - table with products data where plugin is searching all typed terms.<br>Use this button if you think that plugin not shows last actual data in its search results.<br><strong>CAUTION:</strong> this can take large amount of time.', 'aws' ) . '<br><br>' .
391
  __( 'Products in index:', 'aws' ) . '<span id="aws-reindex-count"> <strong>' . AWS_Helpers::get_indexed_products_count() . '</strong></span>';
392
  echo '</span>';
includes/class-aws-search.php CHANGED
@@ -71,9 +71,11 @@ if ( ! class_exists( 'AWS_Search' ) ) :
71
  $special_chars = AWS_Helpers::get_special_chars();
72
 
73
  $s = $keyword ? esc_attr( $keyword ) : esc_attr( $_POST['keyword'] );
 
74
  $s = stripslashes( $s );
75
  $s = str_replace( array( "\r", "\n" ), '', $s );
76
  $s = str_replace( $special_chars, '', $s );
 
77
 
78
  $cache_option_name = '';
79
 
@@ -104,15 +106,29 @@ if ( ! class_exists( 'AWS_Search' ) ) :
104
  $categories_array = array();
105
  $tags_array = array();
106
 
107
-
108
  $this->data['s'] = $s;
109
  $this->data['results_num'] = $results_num ? $results_num : 10;
110
  $this->data['search_terms'] = array();
111
- $this->data['search_terms'] = array_unique( explode( ' ', $s ) );
112
  $this->data['search_in'] = $search_in_arr;
113
  $this->data['outofstock'] = $outofstock;
114
 
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  $posts_ids = $this->query_index_table();
117
  $products_array = $this->get_products( $posts_ids );
118
 
71
  $special_chars = AWS_Helpers::get_special_chars();
72
 
73
  $s = $keyword ? esc_attr( $keyword ) : esc_attr( $_POST['keyword'] );
74
+ $s = htmlspecialchars_decode( $s );
75
  $s = stripslashes( $s );
76
  $s = str_replace( array( "\r", "\n" ), '', $s );
77
  $s = str_replace( $special_chars, '', $s );
78
+ $s = trim( $s );
79
 
80
  $cache_option_name = '';
81
 
106
  $categories_array = array();
107
  $tags_array = array();
108
 
 
109
  $this->data['s'] = $s;
110
  $this->data['results_num'] = $results_num ? $results_num : 10;
111
  $this->data['search_terms'] = array();
 
112
  $this->data['search_in'] = $search_in_arr;
113
  $this->data['outofstock'] = $outofstock;
114
 
115
 
116
+ $search_array = array_unique( explode( ' ', $s ) );
117
+
118
+ if ( is_array( $search_array ) && ! empty( $search_array ) ) {
119
+ foreach ( $search_array as $search_term ) {
120
+ $search_term = trim( $search_term );
121
+ if ( $search_term ) {
122
+ $this->data['search_terms'][] = $search_term;
123
+ }
124
+ }
125
+ }
126
+
127
+ if ( empty( $this->data['search_terms'] ) ) {
128
+ $this->data['search_terms'][] = '';
129
+ }
130
+
131
+
132
  $posts_ids = $this->query_index_table();
133
  $products_array = $this->get_products( $posts_ids );
134
 
includes/options.php CHANGED
@@ -19,7 +19,7 @@ $options['general'][] = array(
19
 
20
  $options['general'][] = array(
21
  "name" => __( "Search in", "aws" ),
22
- "desc" => __( "Search source: Drag&drop sources order to change priority, or exclude by moving to deactivated sources.", "aws" ),
23
  "id" => "search_in",
24
  "value" => "title,content,sku,excerpt",
25
  "choices" => array( "title", "content", "sku", "excerpt", "category", "tag" ),
19
 
20
  $options['general'][] = array(
21
  "name" => __( "Search in", "aws" ),
22
+ "desc" => __( "Search source: Drag&drop sources to activate or deactivate them.", "aws" ),
23
  "id" => "search_in",
24
  "value" => "title,content,sku,excerpt",
25
  "choices" => array( "title", "content", "sku", "excerpt", "category", "tag" ),
languages/aws.pot CHANGED
@@ -27,6 +27,9 @@ msgstr ""
27
  msgid "Reindex table"
28
  msgstr ""
29
 
 
 
 
30
  msgid "Go to Settings Page"
31
  msgstr ""
32
 
@@ -314,7 +317,7 @@ msgid "Search in"
314
  msgstr ""
315
 
316
  #: includes/options.php:176
317
- msgid "Search source: Drag&drop sources order to change priority, or exclude by moving to deactivated sources."
318
  msgstr ""
319
 
320
  #: includes/options.php:30
27
  msgid "Reindex table"
28
  msgstr ""
29
 
30
+ msgid "This action only need for %s one time %s - after you activate this plugin. After this all products changes will be re-indexed automatically."
31
+ msgstr ""
32
+
33
  msgid "Go to Settings Page"
34
  msgstr ""
35
 
317
  msgstr ""
318
 
319
  #: includes/options.php:176
320
+ msgid "Search source: Drag&drop sources to activate or deactivate them."
321
  msgstr ""
322
 
323
  #: includes/options.php:30
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: 4.9.6
7
- Stable tag: 1.44
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -65,6 +65,10 @@ Advanced Woo Search - powerful live search plugin for WooCommerce. Just start ty
65
 
66
  == Frequently Asked Questions ==
67
 
 
 
 
 
68
  = How to insert search form? =
69
 
70
  You can use build-in widget to place plugins search form to your sidebar.
@@ -90,6 +94,11 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
90
 
91
  == Changelog ==
92
 
 
 
 
 
 
93
  = 1.44 =
94
  * Make SKU string in search results translatable
95
  * Strip some new special chars from products content
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: 4.9.6
7
+ Stable tag: 1.45
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
65
 
66
  == Frequently Asked Questions ==
67
 
68
+ = Knowledge Base =
69
+
70
+ You can find solutions and answers at the [Advanced Woo Search guide](https://advanced-woo-search.com/guide/).
71
+
72
  = How to insert search form? =
73
 
74
  You can use build-in widget to place plugins search form to your sidebar.
94
 
95
  == Changelog ==
96
 
97
+ = 1.45 =
98
+ * Fix bug with re-index process ( too much requests error )
99
+ * Add timeout for keyup event
100
+ * Fix bug with special characters search
101
+
102
  = 1.44 =
103
  * Make SKU string in search results translatable
104
  * Strip some new special chars from products content