Version Description
- Add new column form index table - term_id. With id help it is possible to sunc any changes in product term
- Add shortcode to settings page
- Update search page integration
Download this release
Release Info
Developer | Mihail Barinov |
Plugin | Advanced Woo Search |
Version | 1.41 |
Comparing to | |
See all releases |
Code changes from version 1.40 to 1.41
- advanced-woo-search.php +3 -3
- assets/css/admin.css +20 -0
- includes/class-aws-admin.php +5 -0
- includes/class-aws-helpers.php +68 -0
- includes/class-aws-search-page.php +19 -14
- includes/class-aws-table.php +64 -52
- includes/class-aws-versions.php +18 -2
- languages/aws.pot +3 -0
- readme.txt +22 -7
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__ ) );
|
@@ -93,8 +93,8 @@ final class AWS_Main {
|
|
93 |
* Include required core files used in admin and on the frontend.
|
94 |
*/
|
95 |
public function includes() {
|
96 |
-
include_once( 'includes/class-aws-versions.php' );
|
97 |
include_once( 'includes/class-aws-helpers.php' );
|
|
|
98 |
include_once( 'includes/class-aws-admin.php' );
|
99 |
include_once( 'includes/class-aws-cache.php' );
|
100 |
include_once( 'includes/class-aws-table.php' );
|
3 |
/*
|
4 |
Plugin Name: Advanced Woo Search
|
5 |
Description: Advance ajax WooCommerce product search.
|
6 |
+
Version: 1.41
|
7 |
Author: ILLID
|
8 |
Author URI: https://advanced-woo-search.com/
|
9 |
Text Domain: aws
|
16 |
exit;
|
17 |
}
|
18 |
|
19 |
+
define( 'AWS_VERSION', '1.41' );
|
20 |
|
21 |
|
22 |
define( 'AWS_DIR', dirname( __FILE__ ) );
|
93 |
* Include required core files used in admin and on the frontend.
|
94 |
*/
|
95 |
public function includes() {
|
|
|
96 |
include_once( 'includes/class-aws-helpers.php' );
|
97 |
+
include_once( 'includes/class-aws-versions.php' );
|
98 |
include_once( 'includes/class-aws-admin.php' );
|
99 |
include_once( 'includes/class-aws-cache.php' );
|
100 |
include_once( 'includes/class-aws-table.php' );
|
assets/css/admin.css
CHANGED
@@ -97,4 +97,24 @@
|
|
97 |
font-size: 14px;
|
98 |
border-bottom: 1px solid #ccc;
|
99 |
padding-bottom: 4px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
}
|
97 |
font-size: 14px;
|
98 |
border-bottom: 1px solid #ccc;
|
99 |
padding-bottom: 4px;
|
100 |
+
}
|
101 |
+
|
102 |
+
|
103 |
+
h1.aws-instance-name {
|
104 |
+
position: relative;
|
105 |
+
padding-bottom: 20px;
|
106 |
+
padding-right: 20px;
|
107 |
+
display: inline-block;
|
108 |
+
cursor: pointer;
|
109 |
+
}
|
110 |
+
|
111 |
+
.aws-instance-shortcode {
|
112 |
+
display: inline-block;
|
113 |
+
background: #fff;
|
114 |
+
padding: 4px;
|
115 |
+
margin-left: 20px;
|
116 |
+
font-size: 14px;
|
117 |
+
font-weight: 600;
|
118 |
+
position: relative;
|
119 |
+
top: -4px;
|
120 |
}
|
includes/class-aws-admin.php
CHANGED
@@ -127,6 +127,11 @@ class AWS_Admin {
|
|
127 |
|
128 |
echo '<div class="wrap">';
|
129 |
|
|
|
|
|
|
|
|
|
|
|
130 |
echo $tabs_html;
|
131 |
|
132 |
echo '<form action="" name="aws_form" id="aws_form" method="post">';
|
127 |
|
128 |
echo '<div class="wrap">';
|
129 |
|
130 |
+
echo '<h1></h1>';
|
131 |
+
|
132 |
+
echo '<h1 class="aws-instance-name">Advanced Woo Search</h1>';
|
133 |
+
echo '<div class="aws-instance-shortcode">[aws_search_form]</div>';
|
134 |
+
|
135 |
echo $tabs_html;
|
136 |
|
137 |
echo '<form action="" name="aws_form" id="aws_form" method="post">';
|
includes/class-aws-helpers.php
CHANGED
@@ -38,6 +38,19 @@ if ( ! class_exists( 'AWS_Helpers' ) ) :
|
|
38 |
return $str;
|
39 |
}
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
/*
|
42 |
* Get amount of indexed products
|
43 |
*/
|
@@ -60,6 +73,35 @@ if ( ! class_exists( 'AWS_Helpers' ) ) :
|
|
60 |
return $indexed_products;
|
61 |
|
62 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
/*
|
65 |
* Get special characters that must be striped
|
@@ -138,6 +180,32 @@ if ( ! class_exists( 'AWS_Helpers' ) ) :
|
|
138 |
return $str;
|
139 |
}
|
140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
}
|
142 |
|
143 |
endif;
|
38 |
return $str;
|
39 |
}
|
40 |
|
41 |
+
/*
|
42 |
+
* Check if index table exist
|
43 |
+
*/
|
44 |
+
static public function is_table_not_exist() {
|
45 |
+
|
46 |
+
global $wpdb;
|
47 |
+
|
48 |
+
$table_name = $wpdb->prefix . AWS_INDEX_TABLE_NAME;
|
49 |
+
|
50 |
+
return ( $wpdb->get_var( "SHOW TABLES LIKE '{$table_name}'" ) != $table_name );
|
51 |
+
|
52 |
+
}
|
53 |
+
|
54 |
/*
|
55 |
* Get amount of indexed products
|
56 |
*/
|
73 |
return $indexed_products;
|
74 |
|
75 |
}
|
76 |
+
|
77 |
+
/*
|
78 |
+
* Check if index table has new terms columns
|
79 |
+
*/
|
80 |
+
static public function is_index_table_has_terms() {
|
81 |
+
|
82 |
+
global $wpdb;
|
83 |
+
|
84 |
+
$table_name = $wpdb->prefix . AWS_INDEX_TABLE_NAME;
|
85 |
+
|
86 |
+
$return = false;
|
87 |
+
|
88 |
+
if ( $wpdb->get_var( "SHOW TABLES LIKE '{$table_name}'" ) === $table_name ) {
|
89 |
+
|
90 |
+
$columns = $wpdb->get_row("
|
91 |
+
SELECT * FROM {$table_name} LIMIT 0, 1
|
92 |
+
", ARRAY_A );
|
93 |
+
|
94 |
+
if ( $columns && ! isset( $columns['term_id'] ) ) {
|
95 |
+
$return = 'no_terms';
|
96 |
+
} else {
|
97 |
+
$return = 'has_terms';
|
98 |
+
}
|
99 |
+
|
100 |
+
}
|
101 |
+
|
102 |
+
return $return;
|
103 |
+
|
104 |
+
}
|
105 |
|
106 |
/*
|
107 |
* Get special characters that must be striped
|
180 |
return $str;
|
181 |
}
|
182 |
|
183 |
+
/*
|
184 |
+
* Get index table specific source name from taxonomy name
|
185 |
+
*
|
186 |
+
* @return string Source name
|
187 |
+
*/
|
188 |
+
static public function get_source_name( $taxonomy ) {
|
189 |
+
|
190 |
+
switch ( $taxonomy ) {
|
191 |
+
|
192 |
+
case 'product_cat':
|
193 |
+
$source_name = 'category';
|
194 |
+
break;
|
195 |
+
|
196 |
+
case 'product_tag':
|
197 |
+
$source_name = 'tag';
|
198 |
+
break;
|
199 |
+
|
200 |
+
default:
|
201 |
+
$source_name = '';
|
202 |
+
|
203 |
+
}
|
204 |
+
|
205 |
+
return $source_name;
|
206 |
+
|
207 |
+
}
|
208 |
+
|
209 |
}
|
210 |
|
211 |
endif;
|
includes/class-aws-search-page.php
CHANGED
@@ -63,20 +63,6 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
|
|
63 |
|
64 |
}
|
65 |
|
66 |
-
/**
|
67 |
-
* Check if we should override default search query
|
68 |
-
*
|
69 |
-
* @param string $query
|
70 |
-
* @return bool
|
71 |
-
*/
|
72 |
-
private function aws_searchpage_enabled( $query ) {
|
73 |
-
$enabled = true;
|
74 |
-
if ( ( isset( $query->query_vars['s'] ) && ! isset( $_GET['type_aws'] ) ) || ! isset( $query->query_vars['s'] ) || ! $query->query_vars['s'] ) {
|
75 |
-
$enabled = false;
|
76 |
-
}
|
77 |
-
return apply_filters( 'aws_searchpage_enabled', $enabled, $query );
|
78 |
-
}
|
79 |
-
|
80 |
/**
|
81 |
* Filter query string used for get_posts(). Query for posts and save for later.
|
82 |
* Return a query that will return nothing.
|
@@ -237,6 +223,25 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
|
|
237 |
return '';
|
238 |
}
|
239 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
}
|
241 |
|
242 |
|
63 |
|
64 |
}
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
/**
|
67 |
* Filter query string used for get_posts(). Query for posts and save for later.
|
68 |
* Return a query that will return nothing.
|
223 |
return '';
|
224 |
}
|
225 |
|
226 |
+
/**
|
227 |
+
* Check if we should override default search query
|
228 |
+
*
|
229 |
+
* @param string $query
|
230 |
+
* @return bool
|
231 |
+
*/
|
232 |
+
private function aws_searchpage_enabled( $query ) {
|
233 |
+
$enabled = true;
|
234 |
+
if ( ( isset( $query->query_vars['s'] ) && ! isset( $_GET['type_aws'] ) ) ||
|
235 |
+
! isset( $query->query_vars['s'] ) ||
|
236 |
+
! $query->is_search() ||
|
237 |
+
( $query->get( 'post_type' ) && is_string( $query->get( 'post_type' ) ) && $query->get( 'post_type' ) !== 'product' )
|
238 |
+
) {
|
239 |
+
$enabled = false;
|
240 |
+
}
|
241 |
+
|
242 |
+
return apply_filters( 'aws_searchpage_enabled', $enabled, $query );
|
243 |
+
}
|
244 |
+
|
245 |
}
|
246 |
|
247 |
|
includes/class-aws-table.php
CHANGED
@@ -30,6 +30,8 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
30 |
add_action( 'create_term', array( &$this, 'term_changed' ), 10, 3 );
|
31 |
add_action( 'delete_term', array( &$this, 'term_changed' ), 10, 3 );
|
32 |
add_action( 'edit_term', array( &$this, 'term_changed' ), 10, 3 );
|
|
|
|
|
33 |
|
34 |
if ( defined('WOOCOMMERCE_VERSION') ) {
|
35 |
if ( version_compare( WOOCOMMERCE_VERSION, '3.0', ">=" ) ) {
|
@@ -185,17 +187,6 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
185 |
|
186 |
}
|
187 |
|
188 |
-
/*
|
189 |
-
* Check if index table exist
|
190 |
-
*/
|
191 |
-
private function is_table_not_exist() {
|
192 |
-
|
193 |
-
global $wpdb;
|
194 |
-
|
195 |
-
return ( $wpdb->get_var( "SHOW TABLES LIKE '{$this->table_name}'" ) != $this->table_name );
|
196 |
-
|
197 |
-
}
|
198 |
-
|
199 |
/*
|
200 |
* Create index table
|
201 |
*/
|
@@ -212,6 +203,7 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
212 |
type VARCHAR(50) NOT NULL DEFAULT 0,
|
213 |
count BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
|
214 |
in_stock INT(11) NOT NULL DEFAULT 0,
|
|
|
215 |
visibility VARCHAR(20) NOT NULL DEFAULT 0,
|
216 |
lang VARCHAR(20) NOT NULL DEFAULT 0
|
217 |
) $charset_collate;";
|
@@ -265,10 +257,8 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
265 |
$title = apply_filters( 'the_title', get_the_title( $data['id'] ), $data['id'] );
|
266 |
$content = apply_filters( 'the_content', get_post_field( 'post_content', $data['id'] ), $data['id'] );
|
267 |
$excerpt = get_post_field( 'post_excerpt', $data['id'] );
|
268 |
-
|
269 |
-
|
270 |
-
$cat_names = $this->get_terms_names_list( $data['id'], 'product_cat' );
|
271 |
-
$tag_names = $this->get_terms_names_list( $data['id'], 'product_tag' );
|
272 |
|
273 |
|
274 |
// Get all child products if exists
|
@@ -364,8 +354,19 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
364 |
$data['terms']['content'] = $this->extract_terms( $content );
|
365 |
$data['terms']['excerpt'] = $this->extract_terms( $excerpt );
|
366 |
$data['terms']['sku'] = $this->extract_terms( $sku );
|
367 |
-
|
368 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
369 |
|
370 |
|
371 |
// Get translations if exists ( WPML )
|
@@ -483,6 +484,15 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
483 |
|
484 |
foreach( $data['terms'] as $source => $all_terms ) {
|
485 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
486 |
foreach ( $all_terms as $term => $count ) {
|
487 |
|
488 |
if ( ! $term ) {
|
@@ -490,8 +500,8 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
490 |
}
|
491 |
|
492 |
$value = $wpdb->prepare(
|
493 |
-
"(%d, %s, %s, %s, %d, %d, %s, %s)",
|
494 |
-
$data['id'], $term, $source, 'product', $count, $data['in_stock'], $data['visibility'], $data['lang']
|
495 |
);
|
496 |
|
497 |
$values[] = $value;
|
@@ -506,7 +516,7 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
506 |
$values = implode( ', ', $values );
|
507 |
|
508 |
$query = "INSERT IGNORE INTO {$this->table_name}
|
509 |
-
(`id`, `term`, `term_source`, `type`, `count`, `in_stock`, `visibility`, `lang`)
|
510 |
VALUES $values
|
511 |
";
|
512 |
|
@@ -527,6 +537,33 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
527 |
|
528 |
}
|
529 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
530 |
/*
|
531 |
* Update index table
|
532 |
*/
|
@@ -579,7 +616,7 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
579 |
|
580 |
global $wpdb;
|
581 |
|
582 |
-
if (
|
583 |
$this->create_table();
|
584 |
}
|
585 |
|
@@ -682,39 +719,12 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
682 |
|
683 |
}
|
684 |
|
685 |
-
/*
|
686 |
-
* Get string with current product terms ids
|
687 |
-
*
|
688 |
-
* @return string List of terms ids
|
689 |
-
*/
|
690 |
-
private function get_terms_list( $id, $taxonomy ) {
|
691 |
-
|
692 |
-
$terms = get_the_terms( $id, $taxonomy );
|
693 |
-
|
694 |
-
if ( is_wp_error( $terms ) ) {
|
695 |
-
return '';
|
696 |
-
}
|
697 |
-
|
698 |
-
if ( empty( $terms ) ) {
|
699 |
-
return '';
|
700 |
-
}
|
701 |
-
|
702 |
-
$cats_array_temp = array();
|
703 |
-
|
704 |
-
foreach ( $terms as $term ) {
|
705 |
-
$cats_array_temp[] = $term->term_id;
|
706 |
-
}
|
707 |
-
|
708 |
-
return implode( ', ', $cats_array_temp );
|
709 |
-
|
710 |
-
}
|
711 |
-
|
712 |
/*
|
713 |
* Get string with current product terms names
|
714 |
*
|
715 |
* @return string List of terms names
|
716 |
*/
|
717 |
-
private function
|
718 |
|
719 |
$terms = get_the_terms( $id, $taxonomy );
|
720 |
|
@@ -726,13 +736,15 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
726 |
return '';
|
727 |
}
|
728 |
|
729 |
-
$
|
|
|
730 |
|
731 |
foreach ( $terms as $term ) {
|
732 |
-
$
|
|
|
733 |
}
|
734 |
|
735 |
-
return
|
736 |
|
737 |
}
|
738 |
|
30 |
add_action( 'create_term', array( &$this, 'term_changed' ), 10, 3 );
|
31 |
add_action( 'delete_term', array( &$this, 'term_changed' ), 10, 3 );
|
32 |
add_action( 'edit_term', array( &$this, 'term_changed' ), 10, 3 );
|
33 |
+
|
34 |
+
add_action( 'delete_term', array( $this, 'term_deleted' ), 10, 4 );
|
35 |
|
36 |
if ( defined('WOOCOMMERCE_VERSION') ) {
|
37 |
if ( version_compare( WOOCOMMERCE_VERSION, '3.0', ">=" ) ) {
|
187 |
|
188 |
}
|
189 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
/*
|
191 |
* Create index table
|
192 |
*/
|
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
|
209 |
) $charset_collate;";
|
257 |
$title = apply_filters( 'the_title', get_the_title( $data['id'] ), $data['id'] );
|
258 |
$content = apply_filters( 'the_content', get_post_field( 'post_content', $data['id'] ), $data['id'] );
|
259 |
$excerpt = get_post_field( 'post_excerpt', $data['id'] );
|
260 |
+
$cat_array = $this->get_terms_array( $data['id'], 'product_cat' );
|
261 |
+
$tag_array = $this->get_terms_array( $data['id'], 'product_tag' );
|
|
|
|
|
262 |
|
263 |
|
264 |
// Get all child products if exists
|
354 |
$data['terms']['content'] = $this->extract_terms( $content );
|
355 |
$data['terms']['excerpt'] = $this->extract_terms( $excerpt );
|
356 |
$data['terms']['sku'] = $this->extract_terms( $sku );
|
357 |
+
|
358 |
+
|
359 |
+
if ( $cat_array && ! empty( $cat_array ) ) {
|
360 |
+
foreach( $cat_array as $cat_source => $cat_terms ) {
|
361 |
+
$data['terms'][$cat_source] = $this->extract_terms( $cat_terms );
|
362 |
+
}
|
363 |
+
}
|
364 |
+
|
365 |
+
if ( $tag_array && ! empty( $tag_array ) ) {
|
366 |
+
foreach( $tag_array as $tag_source => $tag_terms ) {
|
367 |
+
$data['terms'][$tag_source] = $this->extract_terms( $tag_terms );
|
368 |
+
}
|
369 |
+
}
|
370 |
|
371 |
|
372 |
// Get translations if exists ( WPML )
|
484 |
|
485 |
foreach( $data['terms'] as $source => $all_terms ) {
|
486 |
|
487 |
+
$term_id = 0;
|
488 |
+
|
489 |
+
if ( preg_match( '/\%(\d+)\%/', $source, $matches ) ) {
|
490 |
+
if ( isset( $matches[1] ) ) {
|
491 |
+
$term_id = $matches[1];
|
492 |
+
$source = preg_replace( '/\%(\d+)\%/', '', $source );
|
493 |
+
}
|
494 |
+
}
|
495 |
+
|
496 |
foreach ( $all_terms as $term => $count ) {
|
497 |
|
498 |
if ( ! $term ) {
|
500 |
}
|
501 |
|
502 |
$value = $wpdb->prepare(
|
503 |
+
"(%d, %s, %s, %s, %d, %d, %d, %s, %s)",
|
504 |
+
$data['id'], $term, $source, 'product', $count, $data['in_stock'], $term_id, $data['visibility'], $data['lang']
|
505 |
);
|
506 |
|
507 |
$values[] = $value;
|
516 |
$values = implode( ', ', $values );
|
517 |
|
518 |
$query = "INSERT IGNORE INTO {$this->table_name}
|
519 |
+
(`id`, `term`, `term_source`, `type`, `count`, `in_stock`, `term_id`, `visibility`, `lang`)
|
520 |
VALUES $values
|
521 |
";
|
522 |
|
537 |
|
538 |
}
|
539 |
|
540 |
+
/*
|
541 |
+
* Fires when product term is deleted
|
542 |
+
*/
|
543 |
+
public function term_deleted( $term_id, $tt_id, $taxonomy, $deleted_term ) {
|
544 |
+
|
545 |
+
$source_name = AWS_Helpers::get_source_name( $taxonomy );
|
546 |
+
|
547 |
+
if ( $source_name ) {
|
548 |
+
|
549 |
+
if ( AWS_Helpers::is_index_table_has_terms() == 'has_terms' ) {
|
550 |
+
|
551 |
+
global $wpdb;
|
552 |
+
|
553 |
+
$sql = "DELETE FROM {$this->table_name}
|
554 |
+
WHERE term_source = '{$source_name}'
|
555 |
+
AND term_id = {$term_id}";
|
556 |
+
|
557 |
+
$wpdb->query( $sql );
|
558 |
+
|
559 |
+
do_action( 'aws_cache_clear' );
|
560 |
+
|
561 |
+
}
|
562 |
+
|
563 |
+
}
|
564 |
+
|
565 |
+
}
|
566 |
+
|
567 |
/*
|
568 |
* Update index table
|
569 |
*/
|
616 |
|
617 |
global $wpdb;
|
618 |
|
619 |
+
if ( AWS_Helpers::is_table_not_exist() ) {
|
620 |
$this->create_table();
|
621 |
}
|
622 |
|
719 |
|
720 |
}
|
721 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
722 |
/*
|
723 |
* Get string with current product terms names
|
724 |
*
|
725 |
* @return string List of terms names
|
726 |
*/
|
727 |
+
private function get_terms_array( $id, $taxonomy ) {
|
728 |
|
729 |
$terms = get_the_terms( $id, $taxonomy );
|
730 |
|
736 |
return '';
|
737 |
}
|
738 |
|
739 |
+
$tax_array_temp = array();
|
740 |
+
$source_name = AWS_Helpers::get_source_name( $taxonomy );
|
741 |
|
742 |
foreach ( $terms as $term ) {
|
743 |
+
$source = $source_name . '%' . $term->term_id . '%';
|
744 |
+
$tax_array_temp[$source] = $term->name;
|
745 |
}
|
746 |
|
747 |
+
return $tax_array_temp;
|
748 |
|
749 |
}
|
750 |
|
includes/class-aws-versions.php
CHANGED
@@ -118,6 +118,22 @@ if ( ! class_exists( 'AWS_Versions' ) ) :
|
|
118 |
|
119 |
}
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
}
|
122 |
|
123 |
update_option( 'aws_plugin_ver', AWS_VERSION );
|
@@ -129,7 +145,7 @@ if ( ! class_exists( 'AWS_Versions' ) ) :
|
|
129 |
*/
|
130 |
public function admin_notice_no_index() { ?>
|
131 |
<div class="updated notice is-dismissible">
|
132 |
-
<p><?php printf( esc_html__( 'Advanced Woo Search: Please go to plugin setting page and start the indexing of your products. %s', 'aws' ), '<a class="button button-secondary" href="'.esc_url( admin_url('admin.php?page=aws-options') ).'">'.esc_html__( '
|
133 |
</div>
|
134 |
<?php }
|
135 |
|
@@ -138,7 +154,7 @@ if ( ! class_exists( 'AWS_Versions' ) ) :
|
|
138 |
*/
|
139 |
public function admin_notice_reindex() { ?>
|
140 |
<div class="updated notice is-dismissible">
|
141 |
-
<p><?php printf( esc_html__( 'Advanced Woo Search: Please reindex table for proper work of new plugin features. %s', 'aws' ), '<a class="button button-secondary" href="'.esc_url( admin_url('admin.php?page=aws-options') ).'">'.esc_html__( '
|
142 |
</div>
|
143 |
<?php }
|
144 |
|
118 |
|
119 |
}
|
120 |
|
121 |
+
if ( version_compare( $current_version, '1.41', '<' ) ) {
|
122 |
+
|
123 |
+
if ( AWS_Helpers::is_index_table_has_terms() == 'no_terms' ) {
|
124 |
+
|
125 |
+
global $wpdb;
|
126 |
+
$table_name = $wpdb->prefix . AWS_INDEX_TABLE_NAME;
|
127 |
+
|
128 |
+
$wpdb->query("
|
129 |
+
ALTER TABLE {$table_name}
|
130 |
+
ADD COLUMN `term_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0
|
131 |
+
");
|
132 |
+
|
133 |
+
}
|
134 |
+
|
135 |
+
}
|
136 |
+
|
137 |
}
|
138 |
|
139 |
update_option( 'aws_plugin_ver', AWS_VERSION );
|
145 |
*/
|
146 |
public function admin_notice_no_index() { ?>
|
147 |
<div class="updated notice is-dismissible">
|
148 |
+
<p><?php printf( esc_html__( 'Advanced Woo Search: Please go to plugin setting page and start the indexing of your products. %s', 'aws' ), '<a class="button button-secondary" href="'.esc_url( admin_url('admin.php?page=aws-options') ).'">'.esc_html__( 'Go to Settings Page', 'aws' ).'</a>' ); ?></p>
|
149 |
</div>
|
150 |
<?php }
|
151 |
|
154 |
*/
|
155 |
public function admin_notice_reindex() { ?>
|
156 |
<div class="updated notice is-dismissible">
|
157 |
+
<p><?php printf( esc_html__( 'Advanced Woo Search: Please reindex table for proper work of new plugin features. %s', 'aws' ), '<a class="button button-secondary" href="'.esc_url( admin_url('admin.php?page=aws-options') ).'">'.esc_html__( 'Go to Settings Page', 'aws' ).'</a>' ); ?></p>
|
158 |
</div>
|
159 |
<?php }
|
160 |
|
languages/aws.pot
CHANGED
@@ -27,6 +27,9 @@ msgstr ""
|
|
27 |
msgid "Reindex table"
|
28 |
msgstr ""
|
29 |
|
|
|
|
|
|
|
30 |
#: includes/class-aws-admin.php:352
|
31 |
msgid ""
|
32 |
"Update all data in plugins index table. Index table - table with products "
|
27 |
msgid "Reindex table"
|
28 |
msgstr ""
|
29 |
|
30 |
+
msgid "Go to Settings Page"
|
31 |
+
msgstr ""
|
32 |
+
|
33 |
#: includes/class-aws-admin.php:352
|
34 |
msgid ""
|
35 |
"Update all data in plugins index table. Index table - table with products "
|
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.5
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -17,16 +17,19 @@ Advanced Woo Search - powerful live search plugin for WooCommerce. Just start ty
|
|
17 |
= Main Features =
|
18 |
|
19 |
* **Products search** - Search across all your WooCommerce products
|
20 |
-
* **Settings page** - User-friendly settings page with lot of options
|
21 |
* **Search in** - Search in product title, content, excerpt, categories, tags and sku. Or just in some of them
|
22 |
-
* **
|
|
|
23 |
* **Product image** - Each search result contains product image
|
24 |
* **Product price** - Each search result contains product price
|
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 |
-
*
|
|
|
|
|
|
|
30 |
* Plurals support
|
31 |
* Google Analytics support
|
32 |
* Custom Product Tabs for WooCommerce plugin support
|
@@ -37,15 +40,20 @@ Advanced Woo Search - powerful live search plugin for WooCommerce. Just start ty
|
|
37 |
[Premium Version Demo](https://advanced-woo-search.com/)
|
38 |
|
39 |
* Search **results layouts**
|
|
|
40 |
* **Filters**. Switch between tabs to show different search results
|
41 |
* **Unlimited** amount of search form instances
|
|
|
|
|
42 |
* **Advanced settings page** with lot of options
|
43 |
-
* **Exclude** spicific products by its categories or tags from search results
|
44 |
* 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
|
45 |
-
* **Visibility option** - choose what catalog visibility must be for product to displayed in search results
|
46 |
* Show product **categories** and **variations** in search results
|
47 |
* Support for [WooCommerce Brands plugin](https://woocommerce.com/products/brands/)
|
48 |
|
|
|
|
|
49 |
== Installation ==
|
50 |
|
51 |
1. Upload advanced-woo-search to the /wp-content/plugins/ directory
|
@@ -73,10 +81,17 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
|
|
73 |
== Screenshots ==
|
74 |
|
75 |
1. Front-end view
|
76 |
-
2. Plugin settings page
|
|
|
|
|
77 |
|
78 |
== Changelog ==
|
79 |
|
|
|
|
|
|
|
|
|
|
|
80 |
= 1.40 =
|
81 |
* Fix bug with not working stop-words for taxonomies
|
82 |
* Fix bug with hided search form if its parent node has fixed layout
|
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.5
|
7 |
+
Stable tag: 1.41
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
17 |
= Main Features =
|
18 |
|
19 |
* **Products search** - Search across all your WooCommerce products
|
|
|
20 |
* **Search in** - Search in product title, content, excerpt, categories, tags and sku. Or just in some of them
|
21 |
+
* **Settings page** - User-friendly settings page with lot of options
|
22 |
+
* **Shortcode** and **widget** - Use shortcode and widget to place search box anywhere you want
|
23 |
* **Product image** - Each search result contains product image
|
24 |
* **Product price** - Each search result contains product price
|
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 |
+
* **Stop Words** support to exclude certain words from search.
|
30 |
+
* Supports **variable products**
|
31 |
+
* Support for your current **search page**. Plugin search results will be integrated to your current page layout.
|
32 |
+
* Automatically synchronize all products data. No need to re-index all content manually after avery change.
|
33 |
* Plurals support
|
34 |
* Google Analytics support
|
35 |
* Custom Product Tabs for WooCommerce plugin support
|
40 |
[Premium Version Demo](https://advanced-woo-search.com/)
|
41 |
|
42 |
* Search **results layouts**
|
43 |
+
* Search **form layouts**
|
44 |
* **Filters**. Switch between tabs to show different search results
|
45 |
* **Unlimited** amount of search form instances
|
46 |
+
* Product **attributes** search ( including custom attributes)
|
47 |
+
* Product **custom taxonomies** search
|
48 |
* **Advanced settings page** with lot of options
|
49 |
+
* **Exclude/include** spicific products by its ids, categories or tags from search results
|
50 |
* 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
|
51 |
+
* **Visibility/stock status option** - choose what catalog visibility and stock status must be for product to displayed in search results
|
52 |
* Show product **categories** and **variations** in search results
|
53 |
* Support for [WooCommerce Brands plugin](https://woocommerce.com/products/brands/)
|
54 |
|
55 |
+
[Features list](https://advanced-woo-search.com/features/)
|
56 |
+
|
57 |
== Installation ==
|
58 |
|
59 |
1. Upload advanced-woo-search to the /wp-content/plugins/ directory
|
81 |
== Screenshots ==
|
82 |
|
83 |
1. Front-end view
|
84 |
+
2. Plugin settings page. General options
|
85 |
+
3. Plugin settings page. Search form options
|
86 |
+
4. Plugin settings page. Search results options
|
87 |
|
88 |
== Changelog ==
|
89 |
|
90 |
+
= 1.41 =
|
91 |
+
* Add new column form index table - term_id. With id help it is possible to sunc any changes in product term
|
92 |
+
* Add shortcode to settings page
|
93 |
+
* Update search page integration
|
94 |
+
|
95 |
= 1.40 =
|
96 |
* Fix bug with not working stop-words for taxonomies
|
97 |
* Fix bug with hided search form if its parent node has fixed layout
|