Advanced Woo Search - Version 1.42

Version Description

  • Add option to display View All Results button in the bottom of search results list
  • Fix bug with stop words option
  • Fix bug with links in 'noresults' fiels
  • Add 'aws_search_results_products', 'aws_search_results_categories', 'aws_search_results_tags' filters
Download this release

Release Info

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

Code changes from version 1.41 to 1.42

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.41
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: aws
10
  WC requires at least: 3.0.0
11
- WC tested up to: 3.3.0
12
  */
13
 
14
 
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
16
  exit;
17
  }
18
 
19
- define( 'AWS_VERSION', '1.41' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
@@ -141,8 +141,9 @@ final class AWS_Main {
141
  wp_enqueue_style( 'aws-style', AWS_URL . '/assets/css/common.css', array(), AWS_VERSION );
142
  wp_enqueue_script('aws-script', AWS_URL . '/assets/js/common.js', array('jquery'), AWS_VERSION, true);
143
  wp_localize_script('aws-script', 'aws_vars', array(
144
- 'sale' => __('Sale!', 'aws'),
145
- 'noresults' => $this->get_settings('not_found_text') ? $this->get_settings('not_found_text') : __('Nothing found', 'aws')
 
146
  ));
147
  }
148
 
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
+ Version: 1.42
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: aws
10
  WC requires at least: 3.0.0
11
+ WC tested up to: 3.4.0
12
  */
13
 
14
 
16
  exit;
17
  }
18
 
19
+ define( 'AWS_VERSION', '1.42' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
141
  wp_enqueue_style( 'aws-style', AWS_URL . '/assets/css/common.css', array(), AWS_VERSION );
142
  wp_enqueue_script('aws-script', AWS_URL . '/assets/js/common.js', array('jquery'), AWS_VERSION, true);
143
  wp_localize_script('aws-script', 'aws_vars', array(
144
+ 'sale' => __('Sale!', 'aws'),
145
+ 'showmore' => __('View all results', 'aws'),
146
+ 'noresults' => $this->get_settings('not_found_text') ? stripslashes( $this->get_settings('not_found_text') ) : __('Nothing found', 'aws')
147
  ));
148
  }
149
 
assets/js/admin.js CHANGED
@@ -40,6 +40,7 @@ jQuery(document).ready(function ($) {
40
  data: data
41
  },
42
  dataType: "json",
 
43
  success: function (response) {
44
  if ( 'sync' !== syncStatus ) {
45
  return;
40
  data: data
41
  },
42
  dataType: "json",
43
+ timeout:0,
44
  success: function (response) {
45
  if ( 'sync' !== syncStatus ) {
46
  return;
assets/js/common.js CHANGED
@@ -6,6 +6,7 @@
6
  var pluginPfx = 'aws_opts';
7
  var translate = {
8
  sale : aws_vars.sale,
 
9
  noresults : aws_vars.noresults
10
  };
11
 
@@ -184,7 +185,10 @@
184
 
185
  });
186
 
187
- //html += '<li class="aws_result_item aws_search_more"><a href="' + opts.siteUrl + '/?s=' + searchFor + '&post_type=product">View all</a></li>';
 
 
 
188
  //html += '<li class="aws_result_item"><a href="#">Next Page</a></li>';
189
 
190
  }
@@ -325,6 +329,7 @@
325
  self.data( pluginPfx, {
326
  minChars : ( self.data('min-chars') !== undefined ) ? self.data('min-chars') : 1,
327
  showLoader: ( self.data('show-loader') !== undefined ) ? self.data('show-loader') : true,
 
328
  showPage: ( self.data('show-page') !== undefined ) ? self.data('show-page') : true,
329
  useAnalytics: ( self.data('use-analytics') !== undefined ) ? self.data('use-analytics') : false,
330
  instance: instance,
@@ -398,6 +403,12 @@
398
  });
399
 
400
 
 
 
 
 
 
 
401
  $(window).on( 'keydown', function(e) {
402
 
403
  if ( e.keyCode == 40 || e.keyCode == 38 ) {
6
  var pluginPfx = 'aws_opts';
7
  var translate = {
8
  sale : aws_vars.sale,
9
+ showmore : aws_vars.showmore,
10
  noresults : aws_vars.noresults
11
  };
12
 
185
 
186
  });
187
 
188
+ if ( d.showMore ) {
189
+ html += '<li class="aws_result_item aws_search_more"><a href="#">' + translate.showmore + '</a></li>';
190
+ }
191
+
192
  //html += '<li class="aws_result_item"><a href="#">Next Page</a></li>';
193
 
194
  }
329
  self.data( pluginPfx, {
330
  minChars : ( self.data('min-chars') !== undefined ) ? self.data('min-chars') : 1,
331
  showLoader: ( self.data('show-loader') !== undefined ) ? self.data('show-loader') : true,
332
+ showMore: ( self.data('show-more') !== undefined ) ? self.data('show-more') : true,
333
  showPage: ( self.data('show-page') !== undefined ) ? self.data('show-page') : true,
334
  useAnalytics: ( self.data('use-analytics') !== undefined ) ? self.data('use-analytics') : false,
335
  instance: instance,
403
  });
404
 
405
 
406
+ $( d.resultBlock ).on( 'click', '.aws_search_more', function(e) {
407
+ e.preventDefault();
408
+ $searchForm.submit();
409
+ });
410
+
411
+
412
  $(window).on( 'keydown', function(e) {
413
 
414
  if ( e.keyCode == 40 || e.keyCode == 38 ) {
includes/class-aws-markup.php CHANGED
@@ -29,6 +29,7 @@ if ( ! class_exists( 'AWS_Markup' ) ) :
29
  $placeholder = AWS()->get_settings( 'search_field_text' );
30
  $min_chars = AWS()->get_settings( 'min_chars' );
31
  $show_loader = AWS()->get_settings( 'show_loader' );
 
32
  $show_page = AWS()->get_settings( 'show_page' );
33
  $use_analytics = AWS()->get_settings( 'use_analytics' );
34
 
@@ -46,6 +47,7 @@ if ( ! class_exists( 'AWS_Markup' ) ) :
46
  'data-url' => admin_url('admin-ajax.php'),
47
  'data-siteurl' => home_url(),
48
  'data-show-loader' => $show_loader,
 
49
  'data-show-page' => $show_page,
50
  'data-use-analytics' => $use_analytics,
51
  'data-min-chars' => $min_chars,
29
  $placeholder = AWS()->get_settings( 'search_field_text' );
30
  $min_chars = AWS()->get_settings( 'min_chars' );
31
  $show_loader = AWS()->get_settings( 'show_loader' );
32
+ $show_more = AWS()->get_settings( 'show_more' );
33
  $show_page = AWS()->get_settings( 'show_page' );
34
  $use_analytics = AWS()->get_settings( 'use_analytics' );
35
 
47
  'data-url' => admin_url('admin-ajax.php'),
48
  'data-siteurl' => home_url(),
49
  'data-show-loader' => $show_loader,
50
+ 'data-show-more' => $show_more,
51
  'data-show-page' => $show_page,
52
  'data-use-analytics' => $use_analytics,
53
  'data-min-chars' => $min_chars,
includes/class-aws-search.php CHANGED
@@ -116,13 +116,47 @@ if ( ! class_exists( 'AWS_Search' ) ) :
116
  $posts_ids = $this->query_index_table();
117
  $products_array = $this->get_products( $posts_ids );
118
 
 
 
 
 
 
 
 
 
 
 
119
 
120
  if ( $show_cats === 'true' ) {
 
121
  $categories_array = $this->get_taxonomies( 'product_cat' );
 
 
 
 
 
 
 
 
 
 
 
122
  }
123
 
124
  if ( $show_tags === 'true' ) {
 
125
  $tags_array = $this->get_taxonomies( 'product_tag' );
 
 
 
 
 
 
 
 
 
 
 
126
  }
127
 
128
  $result_array = array(
@@ -131,12 +165,10 @@ if ( ! class_exists( 'AWS_Search' ) ) :
131
  'products' => $products_array
132
  );
133
 
134
-
135
  if ( $cache === 'true' && ! $keyword ) {
136
  AWS()->cache->insert_into_cache_table( $cache_option_name, $result_array );
137
  }
138
 
139
-
140
  return $result_array;
141
 
142
  }
116
  $posts_ids = $this->query_index_table();
117
  $products_array = $this->get_products( $posts_ids );
118
 
119
+ /**
120
+ * Filters array of products before they displayed in search results
121
+ *
122
+ * @since 1.42
123
+ *
124
+ * @param array $products_array Array of products results
125
+ * @param string $s Search query
126
+ */
127
+ $products_array = apply_filters( 'aws_search_results_products', $products_array, $s );
128
+
129
 
130
  if ( $show_cats === 'true' ) {
131
+
132
  $categories_array = $this->get_taxonomies( 'product_cat' );
133
+
134
+ /**
135
+ * Filters array of product categories before they displayed in search results
136
+ *
137
+ * @since 1.42
138
+ *
139
+ * @param array $categories_array Array of products categories
140
+ * @param string $s Search query
141
+ */
142
+ $categories_array = apply_filters( 'aws_search_results_categories', $categories_array, $s );
143
+
144
  }
145
 
146
  if ( $show_tags === 'true' ) {
147
+
148
  $tags_array = $this->get_taxonomies( 'product_tag' );
149
+
150
+ /**
151
+ * Filters array of product tags before they displayed in search results
152
+ *
153
+ * @since 1.42
154
+ *
155
+ * @param array $tags_array Array of products tags
156
+ * @param string $s Search query
157
+ */
158
+ $tags_array = apply_filters( 'aws_search_results_tags', $tags_array, $s );
159
+
160
  }
161
 
162
  $result_array = array(
165
  'products' => $products_array
166
  );
167
 
 
168
  if ( $cache === 'true' && ! $keyword ) {
169
  AWS()->cache->insert_into_cache_table( $cache_option_name, $result_array );
170
  }
171
 
 
172
  return $result_array;
173
 
174
  }
includes/class-aws-versions.php CHANGED
@@ -134,6 +134,19 @@ if ( ! class_exists( 'AWS_Versions' ) ) :
134
 
135
  }
136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  }
138
 
139
  update_option( 'aws_plugin_ver', AWS_VERSION );
134
 
135
  }
136
 
137
+ if ( version_compare( $current_version, '1.42', '<' ) ) {
138
+
139
+ $settings = get_option( 'aws_settings' );
140
+
141
+ if ( $settings ) {
142
+ if ( ! isset( $settings['show_more'] ) ) {
143
+ $settings['show_more'] = 'false';
144
+ update_option( 'aws_settings', $settings );
145
+ }
146
+ }
147
+
148
+ }
149
+
150
  }
151
 
152
  update_option( 'aws_plugin_ver', AWS_VERSION );
includes/options.php CHANGED
@@ -95,6 +95,18 @@ $options['form'][] = array(
95
  )
96
  );
97
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  $options['form'][] = array(
99
  "name" => __( "Search Results", "aws" ),
100
  "desc" => __( "Choose how to view search results.", "aws" ),
95
  )
96
  );
97
 
98
+ $options['form'][] = array(
99
+ "name" => __( "Show 'View All Results'", "aws" ),
100
+ "desc" => __( "Show link to search results page at the bottom of search results block.", "aws" ),
101
+ "id" => "show_more",
102
+ "value" => 'false',
103
+ "type" => "radio",
104
+ 'choices' => array(
105
+ 'true' => __( 'On', 'aws' ),
106
+ 'false' => __( 'Off', 'aws' )
107
+ )
108
+ );
109
+
110
  $options['form'][] = array(
111
  "name" => __( "Search Results", "aws" ),
112
  "desc" => __( "Choose how to view search results.", "aws" ),
languages/aws.pot CHANGED
@@ -61,6 +61,9 @@ msgstr ""
61
  msgid "Sale!"
62
  msgstr ""
63
 
 
 
 
64
  #: advanced-woo-search.php:127
65
  msgid "Settings"
66
  msgstr ""
@@ -178,6 +181,12 @@ msgstr ""
178
  msgid "Show loader animation while searching."
179
  msgstr ""
180
 
 
 
 
 
 
 
181
  msgid "Search Results"
182
  msgstr ""
183
 
61
  msgid "Sale!"
62
  msgstr ""
63
 
64
+ msgid "View all results"
65
+ msgstr ""
66
+
67
  #: advanced-woo-search.php:127
68
  msgid "Settings"
69
  msgstr ""
181
  msgid "Show loader animation while searching."
182
  msgstr ""
183
 
184
+ msgid "Show 'View All Results'"
185
+ msgstr ""
186
+
187
+ msgid "Show link to search results page at the bottom of search results block."
188
+ msgstr ""
189
+
190
  msgid "Search Results"
191
  msgstr ""
192
 
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: 4.9.5
7
- Stable tag: 1.41
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -87,6 +87,12 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
87
 
88
  == Changelog ==
89
 
 
 
 
 
 
 
90
  = 1.41 =
91
  * Add new column form index table - term_id. With id help it is possible to sunc any changes in product term
92
  * Add shortcode to settings page
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: 4.9.6
7
+ Stable tag: 1.42
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
87
 
88
  == Changelog ==
89
 
90
+ = 1.42 =
91
+ * Add option to display ‘View All Results’ button in the bottom of search results list
92
+ * Fix bug with stop words option
93
+ * Fix bug with links in 'noresults' fiels
94
+ * Add 'aws_search_results_products', 'aws_search_results_categories', 'aws_search_results_tags' filters
95
+
96
  = 1.41 =
97
  * Add new column form index table - term_id. With id help it is possible to sunc any changes in product term
98
  * Add shortcode to settings page