Advanced Woo Search - Version 1.51

Version Description

  • Update seamless integration filter hook
  • Fix WPML language select
Download this release

Release Info

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

Code changes from version 1.50 to 1.51

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.50
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.50' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
@@ -90,8 +90,8 @@ final class AWS_Main {
90
  add_filter( 'wcml_multi_currency_ajax_actions', array( $this, 'add_wpml_ajax_actions' ) );
91
 
92
  if ( $this->get_settings('seamless') === 'true' ) {
93
- add_filter( 'get_search_form', array( $this, 'markup' ) );
94
- add_filter( 'get_product_search_form', array( $this, 'markup' ) );
95
  }
96
 
97
  }
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
+ Version: 1.51
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: aws
16
  exit;
17
  }
18
 
19
+ define( 'AWS_VERSION', '1.51' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
90
  add_filter( 'wcml_multi_currency_ajax_actions', array( $this, 'add_wpml_ajax_actions' ) );
91
 
92
  if ( $this->get_settings('seamless') === 'true' ) {
93
+ add_filter( 'get_search_form', array( $this, 'markup' ), 999999 );
94
+ add_filter( 'get_product_search_form', array( $this, 'markup' ), 999999 );
95
  }
96
 
97
  }
assets/js/common.js CHANGED
@@ -74,7 +74,8 @@
74
  var data = {
75
  action: 'aws_action',
76
  keyword : searchFor,
77
- page: 0
 
78
  };
79
 
80
  requests.push(
@@ -339,6 +340,7 @@
339
 
340
  self.data( pluginPfx, {
341
  minChars : ( self.data('min-chars') !== undefined ) ? self.data('min-chars') : 1,
 
342
  showLoader: ( self.data('show-loader') !== undefined ) ? self.data('show-loader') : true,
343
  showMore: ( self.data('show-more') !== undefined ) ? self.data('show-more') : true,
344
  showPage: ( self.data('show-page') !== undefined ) ? self.data('show-page') : true,
74
  var data = {
75
  action: 'aws_action',
76
  keyword : searchFor,
77
+ page: 0,
78
+ lang: d.lang
79
  };
80
 
81
  requests.push(
340
 
341
  self.data( pluginPfx, {
342
  minChars : ( self.data('min-chars') !== undefined ) ? self.data('min-chars') : 1,
343
+ lang : ( self.data('lang') !== undefined ) ? self.data('lang') : false,
344
  showLoader: ( self.data('show-loader') !== undefined ) ? self.data('show-loader') : true,
345
  showMore: ( self.data('show-more') !== undefined ) ? self.data('show-more') : true,
346
  showPage: ( self.data('show-page') !== undefined ) ? self.data('show-page') : true,
includes/class-aws-helpers.php CHANGED
@@ -252,6 +252,33 @@ if ( ! class_exists( 'AWS_Helpers' ) ) :
252
 
253
  }
254
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
  }
256
 
257
  endif;
252
 
253
  }
254
 
255
+ /*
256
+ * Get current active site language
257
+ *
258
+ * @return string Language code
259
+ */
260
+ static public function get_lang() {
261
+
262
+ $current_lang = false;
263
+
264
+ if ( ( defined( 'ICL_SITEPRESS_VERSION' ) || function_exists( 'pll_current_language' ) ) ) {
265
+
266
+ if ( has_filter('wpml_current_language') ) {
267
+ $current_lang = apply_filters( 'wpml_current_language', NULL );
268
+ } elseif ( function_exists( 'pll_current_language' ) ) {
269
+ $current_lang = pll_current_language();
270
+ }
271
+
272
+ } elseif( function_exists( 'qtranxf_getLanguage' ) ) {
273
+
274
+ $current_lang = qtranxf_getLanguage();
275
+
276
+ }
277
+
278
+ return $current_lang;
279
+
280
+ }
281
+
282
  }
283
 
284
  endif;
includes/class-aws-markup.php CHANGED
@@ -34,6 +34,8 @@ if ( ! class_exists( 'AWS_Markup' ) ) :
34
  $show_clear = AWS()->get_settings( 'show_clear' );
35
  $use_analytics = AWS()->get_settings( 'use_analytics' );
36
 
 
 
37
  $url_array = parse_url( home_url() );
38
  $url_query_parts = array();
39
 
@@ -47,6 +49,7 @@ if ( ! class_exists( 'AWS_Markup' ) ) :
47
  $params = array(
48
  'data-url' => admin_url('admin-ajax.php'),
49
  'data-siteurl' => home_url(),
 
50
  'data-show-loader' => $show_loader,
51
  'data-show-more' => $show_more,
52
  'data-show-page' => $show_page,
@@ -66,6 +69,10 @@ if ( ! class_exists( 'AWS_Markup' ) ) :
66
  $markup .= '<input type="hidden" name="post_type" value="product">';
67
  $markup .= '<input type="hidden" name="type_aws" value="true">';
68
 
 
 
 
 
69
  if ( $url_query_parts ) {
70
  foreach( $url_query_parts as $url_query_key => $url_query_value ) {
71
  $markup .= '<input type="hidden" name="' . $url_query_key . '" value="' . $url_query_value . '">';
34
  $show_clear = AWS()->get_settings( 'show_clear' );
35
  $use_analytics = AWS()->get_settings( 'use_analytics' );
36
 
37
+ $current_lang = AWS_Helpers::get_lang();
38
+
39
  $url_array = parse_url( home_url() );
40
  $url_query_parts = array();
41
 
49
  $params = array(
50
  'data-url' => admin_url('admin-ajax.php'),
51
  'data-siteurl' => home_url(),
52
+ 'data-lang' => $current_lang ? $current_lang : '',
53
  'data-show-loader' => $show_loader,
54
  'data-show-more' => $show_more,
55
  'data-show-page' => $show_page,
69
  $markup .= '<input type="hidden" name="post_type" value="product">';
70
  $markup .= '<input type="hidden" name="type_aws" value="true">';
71
 
72
+ if ( $current_lang ) {
73
+ $markup .= '<input type="hidden" name="lang" value="' . $current_lang . '">';
74
+ }
75
+
76
  if ( $url_query_parts ) {
77
  foreach( $url_query_parts as $url_query_key => $url_query_value ) {
78
  $markup .= '<input type="hidden" name="' . $url_query_key . '" value="' . $url_query_value . '">';
includes/class-aws-search.php CHANGED
@@ -16,6 +16,11 @@ if ( ! class_exists( 'AWS_Search' ) ) :
16
  */
17
  private $data = array();
18
 
 
 
 
 
 
19
  /**
20
  * Return a singleton instance of the current class
21
  *
@@ -71,6 +76,8 @@ if ( ! class_exists( 'AWS_Search' ) ) :
71
 
72
  global $wpdb;
73
 
 
 
74
  $cache = AWS()->get_settings( 'cache' );
75
  $special_chars = AWS_Helpers::get_special_chars();
76
 
@@ -330,28 +337,14 @@ if ( ! class_exists( 'AWS_Search' ) ) :
330
  }
331
 
332
 
333
- if ( ( defined( 'ICL_SITEPRESS_VERSION' ) || function_exists( 'pll_current_language' ) ) && $reindex_version && version_compare( $reindex_version, '1.20', '>=' ) ) {
334
-
335
- $current_lang = false;
336
-
337
- if ( has_filter('wpml_current_language') ) {
338
- $current_lang = apply_filters( 'wpml_current_language', NULL );
339
- } elseif ( function_exists( 'pll_current_language' ) ) {
340
- $current_lang = pll_current_language();
341
- }
342
-
343
- if ( $current_lang ) {
344
- $query['lang'] .= $wpdb->prepare( " AND ( lang LIKE %s OR lang = '' )", $current_lang );
345
- }
346
-
347
- } elseif( function_exists( 'qtranxf_getLanguage' ) ) {
348
-
349
- $current_lang = qtranxf_getLanguage();
350
-
351
- if ( $current_lang ) {
352
- $query['lang'] .= $wpdb->prepare( " AND ( lang LIKE %s OR lang = '' )", $current_lang );
353
- }
354
 
 
 
355
  }
356
 
357
 
16
  */
17
  private $data = array();
18
 
19
+ /**
20
+ * @var AWS_Search Current language $lang
21
+ */
22
+ private $lang = 0;
23
+
24
  /**
25
  * Return a singleton instance of the current class
26
  *
76
 
77
  global $wpdb;
78
 
79
+ $this->lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : '';
80
+
81
  $cache = AWS()->get_settings( 'cache' );
82
  $special_chars = AWS_Helpers::get_special_chars();
83
 
337
  }
338
 
339
 
340
+ if ( $this->lang ) {
341
+ $current_lang = $this->lang;
342
+ } else {
343
+ $current_lang = AWS_Helpers::get_lang();
344
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
345
 
346
+ if ( $current_lang && $reindex_version && version_compare( $reindex_version, '1.20', '>=' ) ) {
347
+ $query['lang'] .= $wpdb->prepare( " AND ( lang LIKE %s OR lang = '' )", $current_lang );
348
  }
349
 
350
 
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.8
7
- Stable tag: 1.50
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -96,6 +96,10 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
96
 
97
  == Changelog ==
98
 
 
 
 
 
99
  = 1.50 =
100
  * Fix bug with cyrillic letters search
101
 
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.8
7
+ Stable tag: 1.51
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
96
 
97
  == Changelog ==
98
 
99
+ = 1.51 =
100
+ * Update seamless integration filter hook
101
+ * Fix WPML language select
102
+
103
  = 1.50 =
104
  * Fix bug with cyrillic letters search
105