Advanced Woo Search - Version 1.17

Version Description

  • Fix layout bugs
  • Fix bugs with older versions of WooCommerce
  • Add Google Analytics support
Download this release

Release Info

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

Code changes from version 1.16 to 1.17

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.16
7
  Author: ILLID
8
  Text Domain: aws
9
  */
@@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) {
13
  exit;
14
  }
15
 
16
- define( 'AWS_VERSION', '1.16' );
17
 
18
 
19
  define( 'AWS_DIR', dirname( __FILE__ ) );
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
+ Version: 1.17
7
  Author: ILLID
8
  Text Domain: aws
9
  */
13
  exit;
14
  }
15
 
16
+ define( 'AWS_VERSION', '1.17' );
17
 
18
 
19
  define( 'AWS_DIR', dirname( __FILE__ ) );
assets/js/common.js CHANGED
@@ -73,7 +73,9 @@
73
 
74
  methods.showResults( response );
75
 
76
- $(d.resultBlock).show();
 
 
77
 
78
  },
79
  error: function (data, dummy) {
@@ -182,8 +184,13 @@
182
 
183
  $(d.resultBlock).html( html );
184
 
185
- $(d.resultBlock).show();
 
 
186
 
 
 
 
187
  },
188
 
189
  showLoader: function() {
@@ -196,7 +203,7 @@
196
 
197
  onFocus: function( event ) {
198
  if ( searchFor !== '' ) {
199
- $(d.resultBlock).show();
200
  }
201
  },
202
 
@@ -223,6 +230,16 @@
223
 
224
  }
225
 
 
 
 
 
 
 
 
 
 
 
226
  }
227
 
228
  };
@@ -252,6 +269,7 @@
252
  self.data( pluginPfx, {
253
  minChars : ( self.data('min-chars') !== undefined ) ? self.data('min-chars') : 1,
254
  showLoader: ( self.data('show-loader') !== undefined ) ? self.data('show-loader') : true,
 
255
  instance: instance,
256
  resultBlock: '#aws-search-result-' + instance
257
  });
@@ -286,6 +304,12 @@
286
  });
287
 
288
 
 
 
 
 
 
 
289
  };
290
 
291
 
73
 
74
  methods.showResults( response );
75
 
76
+ methods.showResultsBlock();
77
+
78
+ methods.analytics( searchFor );
79
 
80
  },
81
  error: function (data, dummy) {
184
 
185
  $(d.resultBlock).html( html );
186
 
187
+ methods.showResultsBlock();
188
+
189
+ },
190
 
191
+ showResultsBlock: function() {
192
+ methods.resultLayout();
193
+ $(d.resultBlock).show();
194
  },
195
 
196
  showLoader: function() {
203
 
204
  onFocus: function( event ) {
205
  if ( searchFor !== '' ) {
206
+ methods.showResultsBlock();
207
  }
208
  },
209
 
230
 
231
  }
232
 
233
+ },
234
+
235
+ analytics: function( label ) {
236
+ if ( d.useAnalytics ) {
237
+ try {
238
+ ga('send', 'event', 'AWS search', 'AWS Search Term', label);
239
+ }
240
+ catch (error) {
241
+ }
242
+ }
243
  }
244
 
245
  };
269
  self.data( pluginPfx, {
270
  minChars : ( self.data('min-chars') !== undefined ) ? self.data('min-chars') : 1,
271
  showLoader: ( self.data('show-loader') !== undefined ) ? self.data('show-loader') : true,
272
+ useAnalytics: ( self.data('use-analytics') !== undefined ) ? self.data('use-analytics') : false,
273
  instance: instance,
274
  resultBlock: '#aws-search-result-' + instance
275
  });
304
  });
305
 
306
 
307
+ $(window).on( 'scroll', function(e) {
308
+ if ( $( d.resultBlock ).css('display') == 'block' ) {
309
+ methods.resultLayout();
310
+ }
311
+ });
312
+
313
  };
314
 
315
 
includes/class-aws-markup.php CHANGED
@@ -26,17 +26,19 @@ if ( ! class_exists( 'AWS_Markup' ) ) :
26
  }
27
 
28
 
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
 
33
  $params_string = '';
34
 
35
  $params = array(
36
- 'data-url' => admin_url('admin-ajax.php'),
37
- 'data-siteurl' => home_url(),
38
- 'data-show-loader' => $show_loader,
39
- 'data-min-chars' => $min_chars,
 
40
  );
41
 
42
  foreach( $params as $key => $value ) {
26
  }
27
 
28
 
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
+ $use_analytics = AWS()->get_settings( 'use_analytics' );
33
 
34
  $params_string = '';
35
 
36
  $params = array(
37
+ 'data-url' => admin_url('admin-ajax.php'),
38
+ 'data-siteurl' => home_url(),
39
+ 'data-show-loader' => $show_loader,
40
+ 'data-use-analytics' => $use_analytics,
41
+ 'data-min-chars' => $min_chars,
42
  );
43
 
44
  foreach( $params as $key => $value ) {
includes/class-aws-table.php CHANGED
@@ -193,7 +193,7 @@ if ( ! class_exists( 'AWS_Table' ) ) :
193
  $product = wc_get_product( $id );
194
 
195
  $in_stock = ( $product->stock_status === 'outofstock' ) ? 0 : 1;
196
- $visibility = $product->catalog_visibility;
197
 
198
  $sku = $product->get_sku();
199
 
@@ -205,7 +205,7 @@ if ( ! class_exists( 'AWS_Table' ) ) :
205
 
206
 
207
  // Get all child products if exists
208
- if ( $product->is_type( 'variable' ) ) {
209
 
210
  if ( sizeof( $product->get_children() ) > 0 ) {
211
 
@@ -214,7 +214,11 @@ if ( ! class_exists( 'AWS_Table' ) ) :
214
  $variation_product = new WC_Product_Variation( $child_id );
215
 
216
  $variation_sku = $variation_product->get_sku();
217
- $variation_desc = $variation_product->get_variation_description();
 
 
 
 
218
 
219
  if ( $variation_sku ) {
220
  $sku = $sku . ' ' . $variation_sku;
193
  $product = wc_get_product( $id );
194
 
195
  $in_stock = ( $product->stock_status === 'outofstock' ) ? 0 : 1;
196
+ $visibility = $product->catalog_visibility ? $product->catalog_visibility : ( $product->visibility ? $product->visibility : 'visible' );
197
 
198
  $sku = $product->get_sku();
199
 
205
 
206
 
207
  // Get all child products if exists
208
+ if ( $product->is_type( 'variable' ) && class_exists( 'WC_Product_Variation' ) ) {
209
 
210
  if ( sizeof( $product->get_children() ) > 0 ) {
211
 
214
  $variation_product = new WC_Product_Variation( $child_id );
215
 
216
  $variation_sku = $variation_product->get_sku();
217
+
218
+ $variation_desc = '';
219
+ if ( method_exists( $variation_product, 'get_description' ) ) {
220
+ $variation_desc = $variation_product->get_description();
221
+ }
222
 
223
  if ( $variation_sku ) {
224
  $sku = $sku . ' ' . $variation_sku;
includes/class-aws-versions.php CHANGED
@@ -58,12 +58,22 @@ if ( ! class_exists( 'AWS_Versions' ) ) :
58
  $settings = get_option( 'aws_settings' );
59
 
60
  if ( $settings ) {
61
- if ( ! $settings['outofstock'] ) {
62
-
63
  $settings['outofstock'] = 'false';
64
-
65
  update_option( 'aws_settings', $settings );
 
 
 
 
66
 
 
 
 
 
 
 
 
 
67
  }
68
  }
69
 
58
  $settings = get_option( 'aws_settings' );
59
 
60
  if ( $settings ) {
61
+ if ( ! isset( $settings['outofstock'] ) ) {
 
62
  $settings['outofstock'] = 'false';
 
63
  update_option( 'aws_settings', $settings );
64
+ }
65
+ }
66
+
67
+ }
68
 
69
+ if ( version_compare( $current_version, '1.17', '<' ) ) {
70
+
71
+ $settings = get_option( 'aws_settings' );
72
+
73
+ if ( $settings ) {
74
+ if ( ! isset( $settings['use_analytics'] ) ) {
75
+ $settings['use_analytics'] = 'false';
76
+ update_option( 'aws_settings', $settings );
77
  }
78
  }
79
 
includes/options.php CHANGED
@@ -38,6 +38,18 @@ $options['general'][] = array(
38
  )
39
  );
40
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  // Search Form Settings
42
  $options['form'][] = array(
43
  "name" => __( "Text for search field", "aws" ),
38
  )
39
  );
40
 
41
+ $options['general'][] = array(
42
+ "name" => __( "Use Google Analytics", "aws" ),
43
+ "desc" => __( "Use google analytics to track searches. You need google analytics to be installed on your site.", "aws" ) . '<br>' . __( "Will send event with category - 'AWS search', action - 'AWS Search Term' and label of value of search term.", "aws" ),
44
+ "id" => "use_analytics",
45
+ "value" => 'false',
46
+ "type" => "radio",
47
+ 'choices' => array(
48
+ 'true' => __( 'On', 'aws' ),
49
+ 'false' => __( 'Off', 'aws' ),
50
+ )
51
+ );
52
+
53
  // Search Form Settings
54
  $options['form'][] = array(
55
  "name" => __( "Text for search field", "aws" ),
languages/aws.pot CHANGED
@@ -281,6 +281,26 @@ msgstr ""
281
  msgid "Search source: Drag&drop sources order to change priority, or exclude by moving to deactivated sources."
282
  msgstr ""
283
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  #. Name of the plugin
285
  msgid "Advanced Woo Search"
286
  msgstr ""
281
  msgid "Search source: Drag&drop sources order to change priority, or exclude by moving to deactivated sources."
282
  msgstr ""
283
 
284
+ #: includes/options.php:30
285
+ msgid "Show out-of-stock"
286
+ msgstr ""
287
+
288
+ #: includes/options.php:31
289
+ msgid "Show out-of-stock products in search"
290
+ msgstr ""
291
+
292
+ #: includes/options.php:42
293
+ msgid "Use Google Analytics"
294
+ msgstr ""
295
+
296
+ #: includes/options.php:42
297
+ msgid "Use google analytics to track searches. You need google analytics to be installed on your site."
298
+ msgstr ""
299
+
300
+ #: includes/options.php:42
301
+ msgid "Will send event with category - 'AWS search', action - 'AWS Search Term' and label of value of search term."
302
+ msgstr ""
303
+
304
  #. Name of the plugin
305
  msgid "Advanced Woo Search"
306
  msgstr ""
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.7.4
7
- Stable tag: 1.15
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -26,6 +26,7 @@ Advanced Woo Search - powerful live search plugin for WooCommerce. Just start ty
26
  * **Smart ordering** - Search results ordered by the priority of source where they were found
27
  * **Fast** - Nothing extra. Just what you need for proper work
28
  * Supports variable products
 
29
 
30
  = Premium Features =
31
 
@@ -38,6 +39,7 @@ Advanced Woo Search - powerful live search plugin for WooCommerce. Just start ty
38
  * **Exclude** spicific products by its categories or tags from search results
39
  * Ability to specify **source of image** for search results: featured image, gallery, product content, product short description or set default image if there is no other images
40
  * **Visibility option** - choose what catalog visibility must be for product to displayed in search results
 
41
  * Support for **WooCommerce Brands plugin**
42
 
43
  == Installation ==
@@ -71,6 +73,11 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
71
 
72
  == Changelog ==
73
 
 
 
 
 
 
74
  = 1.16 =
75
  * Option for 'Out of stock' products
76
  * Fix bugs
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.7.5
7
+ Stable tag: 1.17
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
26
  * **Smart ordering** - Search results ordered by the priority of source where they were found
27
  * **Fast** - Nothing extra. Just what you need for proper work
28
  * Supports variable products
29
+ * Google Analytics support
30
 
31
  = Premium Features =
32
 
39
  * **Exclude** spicific products by its categories or tags from search results
40
  * Ability to specify **source of image** for search results: featured image, gallery, product content, product short description or set default image if there is no other images
41
  * **Visibility option** - choose what catalog visibility must be for product to displayed in search results
42
+ * Show product **categories** and **variations** in search results
43
  * Support for **WooCommerce Brands plugin**
44
 
45
  == Installation ==
73
 
74
  == Changelog ==
75
 
76
+ = 1.17 =
77
+ * Fix layout bugs
78
+ * Fix bugs with older versions of WooCommerce
79
+ * Add Google Analytics support
80
+
81
  = 1.16 =
82
  * Option for 'Out of stock' products
83
  * Fix bugs