Advanced Woo Search - Version 1.30

Version Description

  • Add qTranslate plugin support
Download this release

Release Info

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

Code changes from version 1.29 to 1.30

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.29
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.29' );
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.30
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: aws
14
  exit;
15
  }
16
 
17
+ define( 'AWS_VERSION', '1.30' );
18
 
19
 
20
  define( 'AWS_DIR', dirname( __FILE__ ) );
includes/class-aws-search.php CHANGED
@@ -270,6 +270,14 @@ if ( ! class_exists( 'AWS_Search' ) ) :
270
  $query['lang'] .= $wpdb->prepare( " AND ( lang LIKE %s OR lang = '' )", $current_lang );
271
  }
272
 
 
 
 
 
 
 
 
 
273
  }
274
 
275
 
270
  $query['lang'] .= $wpdb->prepare( " AND ( lang LIKE %s OR lang = '' )", $current_lang );
271
  }
272
 
273
+ } elseif( function_exists( 'qtranxf_getLanguage' ) ) {
274
+
275
+ $current_lang = qtranxf_getLanguage();
276
+
277
+ if ( $current_lang ) {
278
+ $query['lang'] .= $wpdb->prepare( " AND ( lang LIKE %s OR lang = '' )", $current_lang );
279
+ }
280
+
281
  }
282
 
283
 
includes/class-aws-table.php CHANGED
@@ -82,7 +82,7 @@ if ( ! class_exists( 'AWS_Table' ) ) :
82
  }
83
 
84
  $index_meta = apply_filters( 'aws_index_meta', $index_meta );
85
- $posts_per_page = apply_filters( 'aws_index_posts_per_page', 50 );
86
 
87
 
88
  $args = array(
@@ -253,6 +253,8 @@ if ( ! class_exists( 'AWS_Table' ) ) :
253
  $lang = $lang['language_code'];
254
  } elseif ( function_exists( 'pll_default_language' ) && function_exists( 'pll_get_post_language' ) ) {
255
  $lang = pll_get_post_language( $data['id'] ) ? pll_get_post_language( $data['id'] ) : pll_default_language();
 
 
256
  }
257
 
258
 
@@ -265,6 +267,7 @@ if ( ! class_exists( 'AWS_Table' ) ) :
265
  $title = apply_filters( 'the_title', get_the_title( $data['id'] ) );
266
  $content = apply_filters( 'the_content', get_post_field( 'post_content', $data['id'] ) );
267
  $excerpt = get_post_field( 'post_excerpt', $data['id'] );
 
268
  $cat_names = $this->get_terms_names_list( $data['id'], 'product_cat' );
269
  $tag_names = $this->get_terms_names_list( $data['id'], 'product_tag' );
270
 
@@ -299,6 +302,7 @@ if ( ! class_exists( 'AWS_Table' ) ) :
299
 
300
  }
301
 
 
302
  // WP 4.2 emoji strip
303
  if ( function_exists( 'wp_encode_emoji' ) ) {
304
  $content = wp_encode_emoji( $content );
@@ -357,6 +361,51 @@ if ( ! class_exists( 'AWS_Table' ) ) :
357
  }
358
 
359
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360
 
361
 
362
  //Insert data into table
@@ -553,7 +602,11 @@ if ( ! class_exists( 'AWS_Table' ) ) :
553
  // Line feeds, carriage returns, tabs
554
  $str = preg_replace( '/[\x00-\x1F\x80-\x9F]/u', '', $str );
555
 
556
- $str = strtolower( $str );
 
 
 
 
557
 
558
  $str = preg_replace( '/^[a-z]$/i', "", $str );
559
 
82
  }
83
 
84
  $index_meta = apply_filters( 'aws_index_meta', $index_meta );
85
+ $posts_per_page = apply_filters( 'aws_index_posts_per_page', 30 );
86
 
87
 
88
  $args = array(
253
  $lang = $lang['language_code'];
254
  } elseif ( function_exists( 'pll_default_language' ) && function_exists( 'pll_get_post_language' ) ) {
255
  $lang = pll_get_post_language( $data['id'] ) ? pll_get_post_language( $data['id'] ) : pll_default_language();
256
+ } elseif ( function_exists( 'qtranxf_getLanguageDefault' ) ) {
257
+ $lang = qtranxf_getLanguageDefault();
258
  }
259
 
260
 
267
  $title = apply_filters( 'the_title', get_the_title( $data['id'] ) );
268
  $content = apply_filters( 'the_content', get_post_field( 'post_content', $data['id'] ) );
269
  $excerpt = get_post_field( 'post_excerpt', $data['id'] );
270
+
271
  $cat_names = $this->get_terms_names_list( $data['id'], 'product_cat' );
272
  $tag_names = $this->get_terms_names_list( $data['id'], 'product_tag' );
273
 
302
 
303
  }
304
 
305
+
306
  // WP 4.2 emoji strip
307
  if ( function_exists( 'wp_encode_emoji' ) ) {
308
  $content = wp_encode_emoji( $content );
361
  }
362
 
363
  }
364
+ elseif ( function_exists( 'qtranxf_use' ) ) {
365
+
366
+ $enabled_languages = get_option( 'qtranslate_enabled_languages' );
367
+
368
+ if ( $enabled_languages ) {
369
+
370
+ foreach( $enabled_languages as $current_lang ) {
371
+
372
+ if ( $current_lang == $lang ) {
373
+ continue;
374
+ }
375
+
376
+ if ( function_exists( 'qtranxf_isAvailableIn' ) && qtranxf_isAvailableIn( $data['id'], $current_lang ) ) {
377
+
378
+ if ( method_exists( $product, 'get_description' ) && method_exists( $product, 'get_name' ) && method_exists( $product, 'get_short_description' ) ) {
379
+
380
+ $translated_post_data = array();
381
+ $translated_post_data['id'] = $data['id'];
382
+ $translated_post_data['in_stock'] = $data['in_stock'];
383
+ $translated_post_data['visibility'] = $data['visibility'];
384
+ $translated_post_data['lang'] = $current_lang;
385
+ $translated_post_data['terms'] = array();
386
+
387
+ $translated_title = qtranxf_use( $current_lang, $product->get_name(), true, true );
388
+ $translated_content = qtranxf_use( $current_lang, $product->get_description(), true, true );
389
+ $translated_excerpt = qtranxf_use( $current_lang, $product->get_short_description(), true, true );
390
+
391
+ $translated_post_data['terms']['title'] = $this->extract_terms( $translated_title );
392
+ $translated_post_data['terms']['content'] = $this->extract_terms( $translated_content );
393
+ $translated_post_data['terms']['excerpt'] = $this->extract_terms( $translated_excerpt );
394
+ $translated_post_data['terms']['sku'] = $this->extract_terms( $sku );
395
+
396
+
397
+ //Insert translated product data into table
398
+ $this->insert_into_table( $translated_post_data );
399
+
400
+ }
401
+
402
+ }
403
+
404
+ }
405
+
406
+ }
407
+
408
+ }
409
 
410
 
411
  //Insert data into table
602
  // Line feeds, carriage returns, tabs
603
  $str = preg_replace( '/[\x00-\x1F\x80-\x9F]/u', '', $str );
604
 
605
+ if ( function_exists( 'mb_strtolower' ) ) {
606
+ $str = mb_strtolower( $str );
607
+ } else {
608
+ $str = strtolower( $str );
609
+ }
610
 
611
  $str = preg_replace( '/^[a-z]$/i', "", $str );
612
 
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
7
- Stable tag: 1.29
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**, **Polylang**, **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.29 =
79
  * Fix bug with search results page
80
 
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
7
+ Stable tag: 1.30
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**, **qTranslate** support
29
  * Supports variable products
30
  * Plurals support
31
  * Google Analytics support
75
 
76
  == Changelog ==
77
 
78
+ = 1.30 =
79
+ * Add qTranslate plugin support
80
+
81
  = 1.29 =
82
  * Fix bug with search results page
83