Advanced Woo Search - Version 1.54

Version Description

  • Update plugin index table
  • Update WooCommerce version support
Download this release

Release Info

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

Code changes from version 1.53 to 1.54

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.53
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,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
16
  exit;
17
  }
18
 
19
- define( 'AWS_VERSION', '1.53' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
+ Version: 1.54
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.5.0
12
  */
13
 
14
 
16
  exit;
17
  }
18
 
19
+ define( 'AWS_VERSION', '1.54' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
includes/class-aws-helpers.php CHANGED
@@ -102,6 +102,35 @@ if ( ! class_exists( 'AWS_Helpers' ) ) :
102
  return $return;
103
 
104
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
 
106
  /*
107
  * Get special characters that must be striped
102
  return $return;
103
 
104
  }
105
+
106
+ /*
107
+ * Check if index table has new on_sale columns
108
+ */
109
+ static public function is_index_table_has_on_sale() {
110
+
111
+ global $wpdb;
112
+
113
+ $table_name = $wpdb->prefix . AWS_INDEX_TABLE_NAME;
114
+
115
+ $return = false;
116
+
117
+ if ( $wpdb->get_var( "SHOW TABLES LIKE '{$table_name}'" ) === $table_name ) {
118
+
119
+ $columns = $wpdb->get_row("
120
+ SELECT * FROM {$table_name} LIMIT 0, 1
121
+ ", ARRAY_A );
122
+
123
+ if ( $columns && ! isset( $columns['on_sale'] ) ) {
124
+ $return = 'no';
125
+ } else {
126
+ $return = 'has';
127
+ }
128
+
129
+ }
130
+
131
+ return $return;
132
+
133
+ }
134
 
135
  /*
136
  * Get special characters that must be striped
includes/class-aws-table.php CHANGED
@@ -203,6 +203,7 @@ if ( ! class_exists( 'AWS_Table' ) ) :
203
  type VARCHAR(50) NOT NULL DEFAULT 0,
204
  count BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
205
  in_stock INT(11) NOT NULL DEFAULT 0,
 
206
  term_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
207
  visibility VARCHAR(20) NOT NULL DEFAULT 0,
208
  lang VARCHAR(20) NOT NULL DEFAULT 0
@@ -249,6 +250,7 @@ if ( ! class_exists( 'AWS_Table' ) ) :
249
 
250
 
251
  $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 );
 
252
  $data['visibility'] = method_exists( $product, 'get_catalog_visibility' ) ? $product->get_catalog_visibility() : ( method_exists( $product, 'get_visibility' ) ? $product->get_visibility() : 'visible' );
253
  $data['lang'] = $lang ? $lang : '';
254
 
@@ -387,6 +389,7 @@ if ( ! class_exists( 'AWS_Table' ) ) :
387
  $translated_post_data = array();
388
  $translated_post_data['id'] = $translated_post->ID;
389
  $translated_post_data['in_stock'] = $data['in_stock'];
 
390
  $translated_post_data['visibility'] = $data['visibility'];
391
  $translated_post_data['lang'] = $lang_obj->language_code;
392
  $translated_post_data['terms'] = array();
@@ -435,6 +438,7 @@ if ( ! class_exists( 'AWS_Table' ) ) :
435
  $translated_post_data = array();
436
  $translated_post_data['id'] = $data['id'];
437
  $translated_post_data['in_stock'] = $data['in_stock'];
 
438
  $translated_post_data['visibility'] = $data['visibility'];
439
  $translated_post_data['lang'] = $current_lang;
440
  $translated_post_data['terms'] = array();
@@ -501,8 +505,8 @@ if ( ! class_exists( 'AWS_Table' ) ) :
501
  }
502
 
503
  $value = $wpdb->prepare(
504
- "(%d, %s, %s, %s, %d, %d, %d, %s, %s)",
505
- $data['id'], $term, $source, 'product', $count, $data['in_stock'], $term_id, $data['visibility'], $data['lang']
506
  );
507
 
508
  $values[] = $value;
@@ -517,7 +521,7 @@ if ( ! class_exists( 'AWS_Table' ) ) :
517
  $values = implode( ', ', $values );
518
 
519
  $query = "INSERT IGNORE INTO {$this->table_name}
520
- (`id`, `term`, `term_source`, `type`, `count`, `in_stock`, `term_id`, `visibility`, `lang`)
521
  VALUES $values
522
  ";
523
 
203
  type VARCHAR(50) NOT NULL DEFAULT 0,
204
  count BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
205
  in_stock INT(11) NOT NULL DEFAULT 0,
206
+ on_sale INT(11) NOT NULL DEFAULT 0,
207
  term_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
208
  visibility VARCHAR(20) NOT NULL DEFAULT 0,
209
  lang VARCHAR(20) NOT NULL DEFAULT 0
250
 
251
 
252
  $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 );
253
+ $data['on_sale'] = $product->is_on_sale();
254
  $data['visibility'] = method_exists( $product, 'get_catalog_visibility' ) ? $product->get_catalog_visibility() : ( method_exists( $product, 'get_visibility' ) ? $product->get_visibility() : 'visible' );
255
  $data['lang'] = $lang ? $lang : '';
256
 
389
  $translated_post_data = array();
390
  $translated_post_data['id'] = $translated_post->ID;
391
  $translated_post_data['in_stock'] = $data['in_stock'];
392
+ $translated_post_data['on_sale'] = $data['on_sale'];
393
  $translated_post_data['visibility'] = $data['visibility'];
394
  $translated_post_data['lang'] = $lang_obj->language_code;
395
  $translated_post_data['terms'] = array();
438
  $translated_post_data = array();
439
  $translated_post_data['id'] = $data['id'];
440
  $translated_post_data['in_stock'] = $data['in_stock'];
441
+ $translated_post_data['on_sale'] = $data['on_sale'];
442
  $translated_post_data['visibility'] = $data['visibility'];
443
  $translated_post_data['lang'] = $current_lang;
444
  $translated_post_data['terms'] = array();
505
  }
506
 
507
  $value = $wpdb->prepare(
508
+ "(%d, %s, %s, %s, %d, %d, %d, %d, %s, %s)",
509
+ $data['id'], $term, $source, 'product', $count, $data['in_stock'], $data['on_sale'], $term_id, $data['visibility'], $data['lang']
510
  );
511
 
512
  $values[] = $value;
521
  $values = implode( ', ', $values );
522
 
523
  $query = "INSERT IGNORE INTO {$this->table_name}
524
+ (`id`, `term`, `term_source`, `type`, `count`, `in_stock`, `on_sale`, `term_id`, `visibility`, `lang`)
525
  VALUES $values
526
  ";
527
 
includes/class-aws-versions.php CHANGED
@@ -215,6 +215,22 @@ if ( ! class_exists( 'AWS_Versions' ) ) :
215
 
216
  }
217
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  }
219
 
220
  update_option( 'aws_plugin_ver', AWS_VERSION );
215
 
216
  }
217
 
218
+ if ( version_compare( $current_version, '1.54', '<' ) ) {
219
+
220
+ if ( AWS_Helpers::is_index_table_has_on_sale() == 'no' ) {
221
+
222
+ global $wpdb;
223
+ $table_name = $wpdb->prefix . AWS_INDEX_TABLE_NAME;
224
+
225
+ $wpdb->query("
226
+ ALTER TABLE {$table_name}
227
+ ADD COLUMN `on_sale` INT(11) NOT NULL DEFAULT 0
228
+ ");
229
+
230
+ }
231
+
232
+ }
233
+
234
  }
235
 
236
  update_option( 'aws_plugin_ver', AWS_VERSION );
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.53
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -52,7 +52,7 @@ Additional features available only in PRO plugin version.
52
  * Product **custom taxonomies** search
53
  * Product **custom fields** search
54
  * **Advanced settings page** with lot of options
55
- * **Exclude/include** spicific products by its ids, categories or tags from search results
56
  * 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
57
  * **Visibility/stock status option** - choose what catalog visibility and stock status must be for product to displayed in search results
58
  * Show product **categories** and **variations** in search results
@@ -101,6 +101,10 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
101
 
102
  == Changelog ==
103
 
 
 
 
 
104
  = 1.53 =
105
  * Fix bug with search results page ordering
106
  * Add svg loading icon
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.54
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
52
  * Product **custom taxonomies** search
53
  * Product **custom fields** search
54
  * **Advanced settings page** with lot of options
55
+ * **Exclude/include** spicific products by its ids, taxonomies or attributes from search results
56
  * 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
57
  * **Visibility/stock status option** - choose what catalog visibility and stock status must be for product to displayed in search results
58
  * Show product **categories** and **variations** in search results
101
 
102
  == Changelog ==
103
 
104
+ = 1.54 =
105
+ * Update plugin index table
106
+ * Update WooCommerce version support
107
+
108
  = 1.53 =
109
  * Fix bug with search results page ordering
110
  * Add svg loading icon