Version Description
- Add aws_search_start action
- Update caching naming
- Update cron job action. Now its must works fine with large amount of products
- Fix singular form of terms
- Add aws_search_current_lang filter
- Add B2B Market plugin support
- Add Datafeedr WooCommerce Importer plugin support
- Add option to hide price for out-of-stock products
Download this release
Release Info
Developer | Mihail Barinov |
Plugin | Advanced Woo Search |
Version | 1.59 |
Comparing to | |
See all releases |
Code changes from version 1.58 to 1.59
- advanced-woo-search.php +2 -2
- includes/class-aws-cache.php +10 -1
- includes/class-aws-integrations.php +175 -37
- includes/class-aws-search.php +30 -14
- includes/class-aws-table.php +63 -7
- includes/class-aws-versions.php +13 -0
- includes/options.php +12 -0
- languages/aws.pot +6 -0
- readme.txt +11 -1
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.
|
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.
|
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.59
|
7 |
Author: ILLID
|
8 |
Author URI: https://advanced-woo-search.com/
|
9 |
Text Domain: aws
|
16 |
exit;
|
17 |
}
|
18 |
|
19 |
+
define( 'AWS_VERSION', '1.59' );
|
20 |
|
21 |
|
22 |
define( 'AWS_DIR', dirname( __FILE__ ) );
|
includes/class-aws-cache.php
CHANGED
@@ -65,6 +65,15 @@ if ( ! class_exists( 'AWS_Cache' ) ) :
|
|
65 |
}
|
66 |
}
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
return $cache_option_name;
|
69 |
|
70 |
}
|
@@ -90,7 +99,7 @@ if ( ! class_exists( 'AWS_Cache' ) ) :
|
|
90 |
$charset_collate = $wpdb->get_charset_collate();
|
91 |
|
92 |
$sql = "CREATE TABLE {$this->cache_table_name} (
|
93 |
-
name VARCHAR(
|
94 |
value LONGTEXT NOT NULL
|
95 |
) $charset_collate;";
|
96 |
|
65 |
}
|
66 |
}
|
67 |
|
68 |
+
if ( is_user_logged_in() ) {
|
69 |
+
$user = wp_get_current_user();
|
70 |
+
$role = ( array ) $user->roles;
|
71 |
+
$user_role = $role[0];
|
72 |
+
if ( $user_role ) {
|
73 |
+
$cache_option_name = $cache_option_name . '_' . $user_role;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
return $cache_option_name;
|
78 |
|
79 |
}
|
99 |
$charset_collate = $wpdb->get_charset_collate();
|
100 |
|
101 |
$sql = "CREATE TABLE {$this->cache_table_name} (
|
102 |
+
name VARCHAR(100) NOT NULL,
|
103 |
value LONGTEXT NOT NULL
|
104 |
) $charset_collate;";
|
105 |
|
includes/class-aws-integrations.php
CHANGED
@@ -41,44 +41,78 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
|
|
41 |
*/
|
42 |
public function __construct() {
|
43 |
|
44 |
-
//
|
45 |
-
if ( class_exists('WC_PPC_Util' ) ) {
|
46 |
|
47 |
-
|
48 |
-
$
|
|
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
-
|
|
|
|
|
|
|
|
|
60 |
|
61 |
$args = array(
|
62 |
-
'posts_per_page'
|
63 |
-
'
|
64 |
-
'
|
65 |
-
'post_status' => 'publish',
|
66 |
-
'ignore_sticky_posts' => true,
|
67 |
-
'suppress_filters' => true,
|
68 |
-
'tax_query' => array(
|
69 |
-
array(
|
70 |
-
'taxonomy' => 'product_cat',
|
71 |
-
'field' => 'id',
|
72 |
-
'terms' => $hidden_categories
|
73 |
-
)
|
74 |
-
)
|
75 |
);
|
76 |
|
77 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
-
|
80 |
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
}
|
84 |
|
@@ -86,13 +120,77 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
|
|
86 |
|
87 |
}
|
88 |
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
}
|
92 |
|
93 |
-
if (
|
94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
}
|
|
|
|
|
96 |
|
97 |
}
|
98 |
|
@@ -100,8 +198,10 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
|
|
100 |
* Exclude product categories
|
101 |
*/
|
102 |
public function filter_protected_cats_term_exclude( $exclude ) {
|
103 |
-
|
104 |
-
$
|
|
|
|
|
105 |
}
|
106 |
return $exclude;
|
107 |
}
|
@@ -110,14 +210,52 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
|
|
110 |
* Exclude products
|
111 |
*/
|
112 |
public function filter_products_exclude( $exclude ) {
|
113 |
-
|
114 |
-
$
|
|
|
|
|
115 |
}
|
116 |
return $exclude;
|
117 |
}
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
}
|
120 |
|
121 |
endif;
|
122 |
|
123 |
-
|
41 |
*/
|
42 |
public function __construct() {
|
43 |
|
44 |
+
//add_action('woocommerce_product_query', array( $this, 'woocommerce_product_query' ) );
|
|
|
45 |
|
46 |
+
if ( class_exists( 'BM' ) ) {
|
47 |
+
add_action( 'aws_search_start', array( $this, 'b2b_set_filter' ) );
|
48 |
+
}
|
49 |
|
50 |
+
if ( class_exists( 'WC_PPC_Util' ) ) {
|
51 |
+
add_action( 'aws_search_start', array( $this, 'wc_ppc_set_filter' ) );
|
52 |
+
}
|
53 |
+
|
54 |
+
if ( function_exists( 'dfrapi_currency_code_to_sign' ) ) {
|
55 |
+
add_filter( 'woocommerce_currency_symbol', array( $this, 'dfrapi_set_currency_symbol_filter' ), 10, 2 );
|
56 |
+
}
|
57 |
+
|
58 |
+
add_filter( 'aws_terms_exclude_product_cat', array( $this, 'filter_protected_cats_term_exclude' ) );
|
59 |
+
add_filter( 'aws_exclude_products', array( $this, 'filter_products_exclude' ) );
|
60 |
+
|
61 |
+
}
|
62 |
|
63 |
+
/*
|
64 |
+
* B2B market plugin
|
65 |
+
*/
|
66 |
+
public function b2b_set_filter() {
|
67 |
+
|
68 |
+
if ( is_user_logged_in() ) {
|
69 |
|
70 |
+
$user = wp_get_current_user();
|
71 |
+
$role = ( array ) $user->roles;
|
72 |
+
$user_role = $role[0];
|
73 |
+
|
74 |
+
if ( $user_role ) {
|
75 |
|
76 |
$args = array(
|
77 |
+
'posts_per_page' => - 1,
|
78 |
+
'post_type' => 'customer_groups',
|
79 |
+
'post_status' => 'publish',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
);
|
81 |
|
82 |
+
$posts = get_posts( $args );
|
83 |
+
$customer_groups = array();
|
84 |
+
|
85 |
+
foreach ( $posts as $customer_group ) {
|
86 |
+
$customer_groups[$customer_group->post_name] = $customer_group->ID;
|
87 |
+
}
|
88 |
+
|
89 |
+
if ( isset( $customer_groups[$user_role] ) ) {
|
90 |
+
$curret_customer_group_id = $customer_groups[$user_role];
|
91 |
+
|
92 |
+
$whitelist = get_post_meta( $curret_customer_group_id, 'bm_conditional_all_products', true );
|
93 |
|
94 |
+
if ( $whitelist && $whitelist === 'off' ) {
|
95 |
|
96 |
+
$products_to_exclude = get_post_meta( $curret_customer_group_id, 'bm_conditional_products', false );
|
97 |
+
$cats_to_exclude = get_post_meta( $curret_customer_group_id, 'bm_conditional_categories', false );
|
98 |
+
|
99 |
+
if ( $products_to_exclude && ! empty( $products_to_exclude ) ) {
|
100 |
+
|
101 |
+
foreach( $products_to_exclude as $product_to_exclude ) {
|
102 |
+
$this->data['exclude_products'][] = trim( $product_to_exclude, ',' );
|
103 |
+
}
|
104 |
+
|
105 |
+
}
|
106 |
+
|
107 |
+
if ( $cats_to_exclude && ! empty( $cats_to_exclude ) ) {
|
108 |
+
|
109 |
+
foreach( $cats_to_exclude as $cat_to_exclude ) {
|
110 |
+
$this->data['exclude_categories'][] = trim( $cat_to_exclude, ',' );
|
111 |
+
}
|
112 |
+
|
113 |
+
}
|
114 |
+
|
115 |
+
}
|
116 |
|
117 |
}
|
118 |
|
120 |
|
121 |
}
|
122 |
|
123 |
+
}
|
124 |
+
|
125 |
+
/*
|
126 |
+
* Protected categories plugin
|
127 |
+
*/
|
128 |
+
public function wc_ppc_set_filter() {
|
129 |
+
|
130 |
+
$hidden_categories = array();
|
131 |
+
$show_protected = WC_PPC_Util::showing_protected_categories();
|
132 |
+
|
133 |
+
// Get all the product categories, and check which are hidden.
|
134 |
+
foreach ( WC_PPC_Util::to_category_visibilities( WC_PPC_Util::get_product_categories() ) as $category ) {
|
135 |
+
if ( $category->is_private() || ( ! $show_protected && $category->is_protected() ) ) {
|
136 |
+
$hidden_categories[] = $category->term_id;
|
137 |
+
}
|
138 |
}
|
139 |
|
140 |
+
if ( $hidden_categories && ! empty( $hidden_categories ) ) {
|
141 |
+
|
142 |
+
foreach( $hidden_categories as $hidden_category ) {
|
143 |
+
$this->data['exclude_categories'][] = $hidden_category;
|
144 |
+
}
|
145 |
+
|
146 |
+
$args = array(
|
147 |
+
'posts_per_page' => -1,
|
148 |
+
'fields' => 'ids',
|
149 |
+
'post_type' => 'product',
|
150 |
+
'post_status' => 'publish',
|
151 |
+
'ignore_sticky_posts' => true,
|
152 |
+
'suppress_filters' => true,
|
153 |
+
'tax_query' => array(
|
154 |
+
array(
|
155 |
+
'taxonomy' => 'product_cat',
|
156 |
+
'field' => 'id',
|
157 |
+
'terms' => $hidden_categories
|
158 |
+
)
|
159 |
+
)
|
160 |
+
);
|
161 |
+
|
162 |
+
$exclude_products = get_posts( $args );
|
163 |
+
|
164 |
+
if ( $exclude_products && count( $exclude_products ) > 0 ) {
|
165 |
+
|
166 |
+
foreach( $exclude_products as $exclude_product ) {
|
167 |
+
$this->data['exclude_products'][] = $exclude_product;
|
168 |
+
}
|
169 |
+
|
170 |
+
}
|
171 |
+
|
172 |
+
}
|
173 |
+
|
174 |
+
}
|
175 |
+
|
176 |
+
/*
|
177 |
+
* Datafeedr WooCommerce Importer plugin
|
178 |
+
*/
|
179 |
+
public function dfrapi_set_currency_symbol_filter( $currency_symbol, $currency ) {
|
180 |
+
|
181 |
+
global $product;
|
182 |
+
if ( ! is_object( $product ) || ! isset( $product ) ) {
|
183 |
+
return $currency_symbol;
|
184 |
+
}
|
185 |
+
$fields = get_post_meta( $product->get_id(), '_dfrps_product', true );
|
186 |
+
if ( empty( $fields ) ) {
|
187 |
+
return $currency_symbol;
|
188 |
+
}
|
189 |
+
if ( ! isset( $fields['currency'] ) ) {
|
190 |
+
return $currency_symbol;
|
191 |
}
|
192 |
+
$currency_symbol = dfrapi_currency_code_to_sign( $fields['currency'] );
|
193 |
+
return $currency_symbol;
|
194 |
|
195 |
}
|
196 |
|
198 |
* Exclude product categories
|
199 |
*/
|
200 |
public function filter_protected_cats_term_exclude( $exclude ) {
|
201 |
+
if ( isset( $this->data['exclude_categories'] ) ) {
|
202 |
+
foreach( $this->data['exclude_categories'] as $to_exclude ) {
|
203 |
+
$exclude[] = $to_exclude;
|
204 |
+
}
|
205 |
}
|
206 |
return $exclude;
|
207 |
}
|
210 |
* Exclude products
|
211 |
*/
|
212 |
public function filter_products_exclude( $exclude ) {
|
213 |
+
if ( isset( $this->data['exclude_products'] ) ) {
|
214 |
+
foreach( $this->data['exclude_products'] as $to_exclude ) {
|
215 |
+
$exclude[] = $to_exclude;
|
216 |
+
}
|
217 |
}
|
218 |
return $exclude;
|
219 |
}
|
220 |
|
221 |
+
public function woocommerce_product_query( $query ) {
|
222 |
+
|
223 |
+
$query_args = array(
|
224 |
+
's' => 'a',
|
225 |
+
'post_type' => 'product',
|
226 |
+
'suppress_filters' => true,
|
227 |
+
'fields' => 'ids',
|
228 |
+
'posts_per_page' => 1
|
229 |
+
);
|
230 |
+
|
231 |
+
$query = new WP_Query( $query_args );
|
232 |
+
$query_vars = $query->query_vars;
|
233 |
+
|
234 |
+
$query_args_options = get_option( 'aws_search_query_args' );
|
235 |
+
|
236 |
+
if ( ! $query_args_options ) {
|
237 |
+
$query_args_options = array();
|
238 |
+
}
|
239 |
+
|
240 |
+
$user_role = 'non_login';
|
241 |
+
|
242 |
+
if ( is_user_logged_in() ) {
|
243 |
+
$user = wp_get_current_user();
|
244 |
+
$role = ( array ) $user->roles;
|
245 |
+
$user_role = $role[0];
|
246 |
+
}
|
247 |
+
|
248 |
+
$query_args_options[$user_role] = array(
|
249 |
+
'post__not_in' => $query_vars['post__not_in'],
|
250 |
+
'category__not_in' => $query_vars['category__not_in'],
|
251 |
+
);
|
252 |
+
|
253 |
+
update_option( 'aws_search_query_args', $query_args_options );
|
254 |
+
|
255 |
+
}
|
256 |
+
|
257 |
}
|
258 |
|
259 |
endif;
|
260 |
|
261 |
+
AWS_Integrations::instance();
|
includes/class-aws-search.php
CHANGED
@@ -90,6 +90,14 @@ if ( ! class_exists( 'AWS_Search' ) ) :
|
|
90 |
$s = AWS_Helpers::normalize_string( $s );
|
91 |
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
//$s = strtolower( $s );
|
94 |
|
95 |
$cache_option_name = '';
|
@@ -280,7 +288,7 @@ if ( ! class_exists( 'AWS_Search' ) ) :
|
|
280 |
|
281 |
$search_term_norm = preg_replace( '/(s|es|ies)$/i', '', $search_term );
|
282 |
|
283 |
-
if ( $search_term_norm && $search_term_len > 3 ) {
|
284 |
$search_term = $search_term_norm;
|
285 |
}
|
286 |
|
@@ -380,6 +388,13 @@ if ( ! class_exists( 'AWS_Search' ) ) :
|
|
380 |
$current_lang = AWS_Helpers::get_lang();
|
381 |
}
|
382 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
if ( $current_lang && $reindex_version && version_compare( $reindex_version, '1.20', '>=' ) ) {
|
384 |
$query['lang'] = $wpdb->prepare( " AND ( lang LIKE %s OR lang = '' )", $current_lang );
|
385 |
}
|
@@ -447,16 +462,17 @@ if ( ! class_exists( 'AWS_Search' ) ) :
|
|
447 |
|
448 |
if ( count( $posts_ids ) > 0 ) {
|
449 |
|
450 |
-
$show_excerpt
|
451 |
-
$excerpt_source
|
452 |
-
$excerpt_length
|
453 |
-
$mark_search_words
|
454 |
-
$show_price
|
455 |
-
$
|
456 |
-
$
|
457 |
-
$
|
458 |
-
$
|
459 |
-
$
|
|
|
460 |
|
461 |
|
462 |
foreach ( $posts_ids as $post_id ) {
|
@@ -505,11 +521,11 @@ if ( ! class_exists( 'AWS_Search' ) ) :
|
|
505 |
$excerpt = wp_trim_words( $excerpt, $excerpt_length, '...' );
|
506 |
}
|
507 |
|
508 |
-
if ( $show_price === 'true' ) {
|
509 |
$price = $product->get_price_html();
|
510 |
}
|
511 |
|
512 |
-
if ( $show_sale === 'true' ) {
|
513 |
$on_sale = $product->is_on_sale();
|
514 |
}
|
515 |
|
@@ -540,7 +556,7 @@ if ( ! class_exists( 'AWS_Search' ) ) :
|
|
540 |
);
|
541 |
}
|
542 |
}
|
543 |
-
|
544 |
|
545 |
$f_price = $product->get_price();
|
546 |
$f_rating = $product->get_average_rating();
|
90 |
$s = AWS_Helpers::normalize_string( $s );
|
91 |
|
92 |
|
93 |
+
/**
|
94 |
+
* Fires each time when performing the search
|
95 |
+
* @since 1.59
|
96 |
+
* @param string $s Search query
|
97 |
+
*/
|
98 |
+
do_action( 'aws_search_start', $s );
|
99 |
+
|
100 |
+
|
101 |
//$s = strtolower( $s );
|
102 |
|
103 |
$cache_option_name = '';
|
288 |
|
289 |
$search_term_norm = preg_replace( '/(s|es|ies)$/i', '', $search_term );
|
290 |
|
291 |
+
if ( $search_term_norm && $search_term_len > 3 && strlen( $search_term_norm ) > 2 ) {
|
292 |
$search_term = $search_term_norm;
|
293 |
}
|
294 |
|
388 |
$current_lang = AWS_Helpers::get_lang();
|
389 |
}
|
390 |
|
391 |
+
/**
|
392 |
+
* Filter current language code
|
393 |
+
* @since 1.59
|
394 |
+
* @param string $current_lang Lang code
|
395 |
+
*/
|
396 |
+
$current_lang = apply_filters( 'aws_search_current_lang', $current_lang );
|
397 |
+
|
398 |
if ( $current_lang && $reindex_version && version_compare( $reindex_version, '1.20', '>=' ) ) {
|
399 |
$query['lang'] = $wpdb->prepare( " AND ( lang LIKE %s OR lang = '' )", $current_lang );
|
400 |
}
|
462 |
|
463 |
if ( count( $posts_ids ) > 0 ) {
|
464 |
|
465 |
+
$show_excerpt = AWS()->get_settings( 'show_excerpt' );
|
466 |
+
$excerpt_source = AWS()->get_settings( 'desc_source' );
|
467 |
+
$excerpt_length = AWS()->get_settings( 'excerpt_length' );
|
468 |
+
$mark_search_words = AWS()->get_settings( 'mark_words' );
|
469 |
+
$show_price = AWS()->get_settings( 'show_price' );
|
470 |
+
$show_outofstockprice = AWS()->get_settings( 'show_outofstock_price' );
|
471 |
+
$show_sale = AWS()->get_settings( 'show_sale' );
|
472 |
+
$show_image = AWS()->get_settings( 'show_image' );
|
473 |
+
$show_sku = AWS()->get_settings( 'show_sku' );
|
474 |
+
$show_stock_status = AWS()->get_settings( 'show_stock' );
|
475 |
+
$show_featured = AWS()->get_settings( 'show_featured' );
|
476 |
|
477 |
|
478 |
foreach ( $posts_ids as $post_id ) {
|
521 |
$excerpt = wp_trim_words( $excerpt, $excerpt_length, '...' );
|
522 |
}
|
523 |
|
524 |
+
if ( $show_price === 'true' && ( $product->is_in_stock() || ( ! $product->is_in_stock() && $show_outofstockprice === 'true' ) ) ) {
|
525 |
$price = $product->get_price_html();
|
526 |
}
|
527 |
|
528 |
+
if ( $show_sale === 'true' && ( $product->is_in_stock() || ( ! $product->is_in_stock() && $show_outofstockprice === 'true' ) ) ) {
|
529 |
$on_sale = $product->is_on_sale();
|
530 |
}
|
531 |
|
556 |
);
|
557 |
}
|
558 |
}
|
559 |
+
|
560 |
|
561 |
$f_price = $product->get_price();
|
562 |
$f_rating = $product->get_average_rating();
|
includes/class-aws-table.php
CHANGED
@@ -147,13 +147,69 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
147 |
*/
|
148 |
public function reindex_table_job() {
|
149 |
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
|
152 |
-
|
153 |
-
$meta = $this->reindex_table( $meta );
|
154 |
-
$offset = (int) isset( $meta['offset'] ) ? $meta['offset'] : 0;
|
155 |
-
$start = (int) isset( $meta['start'] ) ? $meta['start'] : 0;
|
156 |
-
} while ( !( $offset === 0 && ! $start ) );
|
157 |
|
158 |
}
|
159 |
|
@@ -734,7 +790,7 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
734 |
if ( $str_item_term ) {
|
735 |
$new_array_key = preg_replace( '/(s|es|ies)$/i', '', $str_item_term );
|
736 |
|
737 |
-
if ( $new_array_key && strlen( $str_item_term ) > 3 ) {
|
738 |
if ( ! isset( $str_new_array[$new_array_key] ) ) {
|
739 |
$str_new_array[$new_array_key] = $str_item_num;
|
740 |
}
|
147 |
*/
|
148 |
public function reindex_table_job() {
|
149 |
|
150 |
+
/*
|
151 |
+
* Added in WordPress v4.6.0
|
152 |
+
*/
|
153 |
+
if ( function_exists( 'wp_raise_memory_limit' ) ) {
|
154 |
+
wp_raise_memory_limit( 'admin' );
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Max execution time for script
|
159 |
+
* @since 1.59
|
160 |
+
* @param integer
|
161 |
+
*/
|
162 |
+
@set_time_limit( apply_filters( 'aws_index_cron_runner_time_limit', 600 ) );
|
163 |
+
|
164 |
+
$meta = get_option( 'aws_cron_job' );
|
165 |
+
|
166 |
+
if ( ! $meta || ! is_array( $meta ) ) {
|
167 |
+
$meta = 'start';
|
168 |
+
} else {
|
169 |
+
$meta['attemps'] = (int) isset( $meta['attemps'] ) ? $meta['attemps'] + 1 : 1;
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Max number of script repeats
|
174 |
+
* @since 1.59
|
175 |
+
* @param integer
|
176 |
+
*/
|
177 |
+
$max_cron_attemps = apply_filters( 'aws_index_max_cron_attemps', 10 );
|
178 |
+
|
179 |
+
try {
|
180 |
+
|
181 |
+
do {
|
182 |
+
|
183 |
+
wp_clear_scheduled_hook( 'aws_reindex_table', array( 'inner' ) );
|
184 |
+
|
185 |
+
// Fallback if re-index failed by timeout in this iteration
|
186 |
+
if ( ! isset( $meta['attemps'] ) || ( isset( $meta['attemps'] ) && $meta['attemps'] < $max_cron_attemps ) ) {
|
187 |
+
if ( ! wp_next_scheduled( 'aws_reindex_table', array( 'inner' ) ) ) {
|
188 |
+
wp_schedule_single_event( time() + 700, 'aws_reindex_table', array( 'inner' ) );
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
$meta = $this->reindex_table( $meta );
|
193 |
+
$offset = (int) isset( $meta['offset'] ) ? $meta['offset'] : 0;
|
194 |
+
$start = (int) isset( $meta['start'] ) ? $meta['start'] : 0;
|
195 |
+
|
196 |
+
// No more attemps
|
197 |
+
if ( isset( $meta['attemps'] ) && $meta['attemps'] >= $max_cron_attemps ) {
|
198 |
+
delete_option( 'aws_cron_job' );
|
199 |
+
} else {
|
200 |
+
update_option( 'aws_cron_job', $meta );
|
201 |
+
}
|
202 |
+
|
203 |
+
} while ( !( $offset === 0 && ! $start ) );
|
204 |
+
|
205 |
+
} catch ( Exception $e ) {
|
206 |
+
|
207 |
+
}
|
208 |
+
|
209 |
+
// Its no longer needs
|
210 |
+
wp_clear_scheduled_hook( 'aws_reindex_table', array( 'inner' ) );
|
211 |
|
212 |
+
delete_option( 'aws_cron_job' );
|
|
|
|
|
|
|
|
|
213 |
|
214 |
}
|
215 |
|
790 |
if ( $str_item_term ) {
|
791 |
$new_array_key = preg_replace( '/(s|es|ies)$/i', '', $str_item_term );
|
792 |
|
793 |
+
if ( $new_array_key && strlen( $str_item_term ) > 3 && strlen( $new_array_key ) > 2 ) {
|
794 |
if ( ! isset( $str_new_array[$new_array_key] ) ) {
|
795 |
$str_new_array[$new_array_key] = $str_item_num;
|
796 |
}
|
includes/class-aws-versions.php
CHANGED
@@ -244,6 +244,19 @@ if ( ! class_exists( 'AWS_Versions' ) ) :
|
|
244 |
|
245 |
}
|
246 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
}
|
248 |
|
249 |
update_option( 'aws_plugin_ver', AWS_VERSION );
|
244 |
|
245 |
}
|
246 |
|
247 |
+
if ( version_compare( $current_version, '1.59', '<' ) ) {
|
248 |
+
|
249 |
+
$settings = get_option( 'aws_settings' );
|
250 |
+
|
251 |
+
if ( $settings ) {
|
252 |
+
if ( ! isset( $settings['show_outofstock_price'] ) ) {
|
253 |
+
$settings['show_outofstock_price'] = 'true';
|
254 |
+
update_option( 'aws_settings', $settings );
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
}
|
259 |
+
|
260 |
}
|
261 |
|
262 |
update_option( 'aws_plugin_ver', AWS_VERSION );
|
includes/options.php
CHANGED
@@ -254,6 +254,18 @@ $options['results'][] = array(
|
|
254 |
)
|
255 |
);
|
256 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
$options['results'][] = array(
|
258 |
"name" => __( "Show categories", "aws" ),
|
259 |
"desc" => __( "Include categories in search result.", "aws" ),
|
254 |
)
|
255 |
);
|
256 |
|
257 |
+
$options['results'][] = array(
|
258 |
+
"name" => __( "Show price for out of stock", "aws" ),
|
259 |
+
"desc" => __( "Show product price for out of stock products.", "aws" ),
|
260 |
+
"id" => "show_outofstock_price",
|
261 |
+
"value" => 'true',
|
262 |
+
"type" => "radio",
|
263 |
+
'choices' => array(
|
264 |
+
'true' => __( 'On', 'aws' ),
|
265 |
+
'false' => __( 'Off', 'aws' ),
|
266 |
+
)
|
267 |
+
);
|
268 |
+
|
269 |
$options['results'][] = array(
|
270 |
"name" => __( "Show categories", "aws" ),
|
271 |
"desc" => __( "Include categories in search result.", "aws" ),
|
languages/aws.pot
CHANGED
@@ -306,6 +306,12 @@ msgstr ""
|
|
306 |
msgid "Show product price for each search result."
|
307 |
msgstr ""
|
308 |
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
#: includes/options.php:105
|
310 |
msgid "Description content"
|
311 |
msgstr ""
|
306 |
msgid "Show product price for each search result."
|
307 |
msgstr ""
|
308 |
|
309 |
+
msgid "Show price for out of stock"
|
310 |
+
msgstr ""
|
311 |
+
|
312 |
+
msgid "Show product price for out of stock products."
|
313 |
+
msgstr ""
|
314 |
+
|
315 |
#: includes/options.php:105
|
316 |
msgid "Description content"
|
317 |
msgstr ""
|
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: 5.0
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -101,6 +101,16 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
|
|
101 |
|
102 |
== Changelog ==
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
= 1.58 =
|
105 |
* Add option for preventing submit of empty search form
|
106 |
* Add support for Protected Categories plugin
|
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: 5.0
|
7 |
+
Stable tag: 1.59
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
101 |
|
102 |
== Changelog ==
|
103 |
|
104 |
+
= 1.59 =
|
105 |
+
* Add aws_search_start action
|
106 |
+
* Update caching naming
|
107 |
+
* Update cron job action. Now its must works fine with large amount of products
|
108 |
+
* Fix singular form of terms
|
109 |
+
* Add aws_search_current_lang filter
|
110 |
+
* Add B2B Market plugin support
|
111 |
+
* Add Datafeedr WooCommerce Importer plugin support
|
112 |
+
* Add option to hide price for out-of-stock products
|
113 |
+
|
114 |
= 1.58 =
|
115 |
* Add option for preventing submit of empty search form
|
116 |
* Add support for Protected Categories plugin
|