Advanced Woo Search - Version 1.26

Version Description

  • Add Polylang plugin support
Download this release

Release Info

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

Code changes from version 1.25 to 1.26

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.25
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: aws
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
14
  exit;
15
  }
16
 
17
- define( 'AWS_VERSION', '1.25' );
18
 
19
 
20
  define( 'AWS_DIR', dirname( __FILE__ ) );
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
+ Version: 1.26
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: aws
14
  exit;
15
  }
16
 
17
+ define( 'AWS_VERSION', '1.26' );
18
 
19
 
20
  define( 'AWS_DIR', dirname( __FILE__ ) );
includes/class-aws-search.php CHANGED
@@ -269,13 +269,20 @@ if ( ! class_exists( 'AWS_Search' ) ) :
269
  }
270
 
271
 
272
- if ( defined( 'ICL_SITEPRESS_VERSION' ) && $reindex_version && version_compare( $reindex_version, '1.20', '>=' ) ) {
 
 
 
273
  if ( has_filter('wpml_current_language') ) {
274
  $current_lang = apply_filters( 'wpml_current_language', NULL );
275
- if ( $current_lang ) {
276
- $query['lang'] .= $wpdb->prepare( " AND ( lang LIKE %s OR lang = '' )", $current_lang );
277
- }
278
  }
 
 
 
 
 
279
  }
280
 
281
 
269
  }
270
 
271
 
272
+ if ( ( defined( 'ICL_SITEPRESS_VERSION' ) || function_exists( 'pll_current_language' ) ) && $reindex_version && version_compare( $reindex_version, '1.20', '>=' ) ) {
273
+
274
+ $current_lang = false;
275
+
276
  if ( has_filter('wpml_current_language') ) {
277
  $current_lang = apply_filters( 'wpml_current_language', NULL );
278
+ } elseif ( function_exists( 'pll_current_language' ) ) {
279
+ $current_lang = pll_current_language();
 
280
  }
281
+
282
+ if ( $current_lang ) {
283
+ $query['lang'] .= $wpdb->prepare( " AND ( lang LIKE %s OR lang = '' )", $current_lang );
284
+ }
285
+
286
  }
287
 
288
 
includes/class-aws-table.php CHANGED
@@ -244,11 +244,20 @@ if ( ! class_exists( 'AWS_Table' ) ) :
244
  continue;
245
  }
246
 
247
- $lang = has_filter( 'wpml_post_language_details' ) ? apply_filters( 'wpml_post_language_details', NULL, $data['id'] ) : '';
 
 
 
 
 
 
 
 
 
248
 
249
  $data['in_stock'] = method_exists( $product, 'get_stock_status' ) ? ( ( $product->get_stock_status() === 'outofstock' ) ? 0 : 1 ) : ( method_exists( $product, 'is_in_stock' ) ? $product->is_in_stock() : 1 );
250
  $data['visibility'] = method_exists( $product, 'get_catalog_visibility' ) ? $product->get_catalog_visibility() : ( method_exists( $product, 'get_visibility' ) ? $product->get_visibility() : 'visible' );
251
- $data['lang'] = $lang ? $lang['language_code'] : '';
252
 
253
  $sku = $product->get_sku();
254
 
@@ -305,7 +314,7 @@ if ( ! class_exists( 'AWS_Table' ) ) :
305
  $data['terms']['tag'] = $this->extract_terms( $tag_names );
306
 
307
 
308
- // Get translations if exists
309
  if ( defined( 'ICL_SITEPRESS_VERSION' ) && has_filter('wpml_element_has_translations') && has_filter('wpml_get_element_translations') ) {
310
 
311
  $is_translated = apply_filters( 'wpml_element_has_translations', NULL, $data['id'], 'post_product' );
244
  continue;
245
  }
246
 
247
+
248
+ $lang = '';
249
+
250
+ if ( defined( 'ICL_SITEPRESS_VERSION' ) && has_filter( 'wpml_post_language_details' ) ) {
251
+ $lang = apply_filters( 'wpml_post_language_details', NULL, $data['id'] );
252
+ $lang = $lang['language_code'];
253
+ } elseif ( function_exists( 'pll_default_language' ) && function_exists( 'pll_get_post_language' ) ) {
254
+ $lang = pll_get_post_language( $data['id'] ) ? pll_get_post_language( $data['id'] ) : pll_default_language();
255
+ }
256
+
257
 
258
  $data['in_stock'] = method_exists( $product, 'get_stock_status' ) ? ( ( $product->get_stock_status() === 'outofstock' ) ? 0 : 1 ) : ( method_exists( $product, 'is_in_stock' ) ? $product->is_in_stock() : 1 );
259
  $data['visibility'] = method_exists( $product, 'get_catalog_visibility' ) ? $product->get_catalog_visibility() : ( method_exists( $product, 'get_visibility' ) ? $product->get_visibility() : 'visible' );
260
+ $data['lang'] = $lang ? $lang : '';
261
 
262
  $sku = $product->get_sku();
263
 
314
  $data['terms']['tag'] = $this->extract_terms( $tag_names );
315
 
316
 
317
+ // Get translations if exists ( WPML )
318
  if ( defined( 'ICL_SITEPRESS_VERSION' ) && has_filter('wpml_element_has_translations') && has_filter('wpml_get_element_translations') ) {
319
 
320
  $is_translated = apply_filters( 'wpml_element_has_translations', NULL, $data['id'], 'post_product' );
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.8.2
7
- Stable tag: 1.25
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -25,7 +25,7 @@ Advanced Woo Search - powerful live search plugin for WooCommerce. Just start ty
25
  * **Terms search** - Search for product categories and tags
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
- * **WPML**, **WooCommerce Multilingual** support
29
  * Supports variable products
30
  * Plurals support
31
  * Google Analytics support
@@ -75,6 +75,9 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
75
 
76
  == Changelog ==
77
 
 
 
 
78
  = 1.25 =
79
  * Add markdown support for 'Nothing found' field
80
  * Fix WPML bug
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.8.3
7
+ Stable tag: 1.26
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
25
  * **Terms search** - Search for product categories and tags
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
+ * **WPML**, **Polylang**, **WooCommerce Multilingual** support
29
  * Supports variable products
30
  * Plurals support
31
  * Google Analytics support
75
 
76
  == Changelog ==
77
 
78
+ = 1.26 =
79
+ * Add Polylang plugin support
80
+
81
  = 1.25 =
82
  * Add markdown support for 'Nothing found' field
83
  * Fix WPML bug