Version Description
- Add search in product terms ( categories, tags )
- Fix issue with not saving settings
Download this release
Release Info
Developer | Mihail Barinov |
Plugin | Advanced Woo Search |
Version | 1.03 |
Comparing to | |
See all releases |
Code changes from version 1.02 to 1.03
- advanced-woo-search.php +28 -5
- assets/css/admin.css +2 -2
- includes/class-aws-admin.php +1 -3
- includes/options.php +2 -2
- readme.txt +6 -2
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 |
Text Domain: aws
|
9 |
*/
|
@@ -141,7 +141,10 @@ final class AWS_Main {
|
|
141 |
|
142 |
if ( !empty( $search_results ) && !is_wp_error( $search_results ) && is_array( $search_results ) ) {
|
143 |
foreach ( $search_results as $search_result ) {
|
144 |
-
|
|
|
|
|
|
|
145 |
}
|
146 |
}
|
147 |
|
@@ -204,6 +207,7 @@ final class AWS_Main {
|
|
204 |
|
205 |
$query['search'] = '';
|
206 |
$query['relevance'] = '';
|
|
|
207 |
|
208 |
$temp_search_array = array();
|
209 |
$relevance_array = array();
|
@@ -234,6 +238,24 @@ final class AWS_Main {
|
|
234 |
$relevance_array['content'][] = $wpdb->prepare( "( case when ( post_excerpt LIKE %s ) then 7 else 0 end )", $like );
|
235 |
break;
|
236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
case 'sku':
|
238 |
$search_in_array[] = $wpdb->prepare( '( postmeta.meta_value LIKE %s )', $like );
|
239 |
break;
|
@@ -262,8 +284,9 @@ final class AWS_Main {
|
|
262 |
distinct ID,
|
263 |
{$query['relevance']} as relevance
|
264 |
FROM
|
265 |
-
|
266 |
-
$wpdb->
|
|
|
267 |
WHERE
|
268 |
posts.post_type = 'product'
|
269 |
AND posts.post_status = 'publish'
|
@@ -276,7 +299,6 @@ final class AWS_Main {
|
|
276 |
LIMIT 0, {$results_num}
|
277 |
";
|
278 |
|
279 |
-
|
280 |
$posts_ids = $this->get_posts_ids( $sql );
|
281 |
|
282 |
$products_array = $this->get_products( $posts_ids );
|
@@ -291,6 +313,7 @@ final class AWS_Main {
|
|
291 |
}
|
292 |
|
293 |
echo json_encode( array(
|
|
|
294 |
'cats' => $categories_array,
|
295 |
'tags' => $tags_array,
|
296 |
'products' => $products_array
|
3 |
/*
|
4 |
Plugin Name: Advanced Woo Search
|
5 |
Description: Advance ajax WooCommerce product search.
|
6 |
+
Version: 1.03
|
7 |
Author: ILLID
|
8 |
Text Domain: aws
|
9 |
*/
|
141 |
|
142 |
if ( !empty( $search_results ) && !is_wp_error( $search_results ) && is_array( $search_results ) ) {
|
143 |
foreach ( $search_results as $search_result ) {
|
144 |
+
$post_id = intval( $search_result->ID );
|
145 |
+
if ( ! in_array( $post_id, $posts_ids ) ) {
|
146 |
+
$posts_ids[] = $post_id;
|
147 |
+
}
|
148 |
}
|
149 |
}
|
150 |
|
207 |
|
208 |
$query['search'] = '';
|
209 |
$query['relevance'] = '';
|
210 |
+
$query['join'] = '';
|
211 |
|
212 |
$temp_search_array = array();
|
213 |
$relevance_array = array();
|
238 |
$relevance_array['content'][] = $wpdb->prepare( "( case when ( post_excerpt LIKE %s ) then 7 else 0 end )", $like );
|
239 |
break;
|
240 |
|
241 |
+
case 'category':
|
242 |
+
$search_in_array[] = $wpdb->prepare( "( $wpdb->terms.name LIKE %s AND $wpdb->term_taxonomy.taxonomy = 'product_cat' )", $like );
|
243 |
+
$relevance_array['category'][] = $wpdb->prepare( "( case when ( $wpdb->terms.name LIKE %s AND $wpdb->term_taxonomy.taxonomy = 'product_cat' ) then 5 else 0 end )", $like );
|
244 |
+
|
245 |
+
$query['join'] = "LEFT JOIN $wpdb->term_relationships ON posts.ID = $wpdb->term_relationships.object_id
|
246 |
+
LEFT JOIN $wpdb->term_taxonomy ON $wpdb->term_taxonomy.term_taxonomy_id = $wpdb->term_relationships.term_taxonomy_id
|
247 |
+
LEFT JOIN $wpdb->terms ON $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id";
|
248 |
+
break;
|
249 |
+
|
250 |
+
case 'tag':
|
251 |
+
$search_in_array[] = $wpdb->prepare( "( $wpdb->terms.name LIKE %s AND $wpdb->term_taxonomy.taxonomy = 'product_tag' )", $like );
|
252 |
+
$relevance_array['tag'][] = $wpdb->prepare( "( case when ( $wpdb->terms.name LIKE %s AND $wpdb->term_taxonomy.taxonomy = 'product_tag' ) then 5 else 0 end )", $like );
|
253 |
+
|
254 |
+
$query['join'] = "LEFT JOIN $wpdb->term_relationships ON posts.ID = $wpdb->term_relationships.object_id
|
255 |
+
LEFT JOIN $wpdb->term_taxonomy ON $wpdb->term_taxonomy.term_taxonomy_id = $wpdb->term_relationships.term_taxonomy_id
|
256 |
+
LEFT JOIN $wpdb->terms ON $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id";
|
257 |
+
break;
|
258 |
+
|
259 |
case 'sku':
|
260 |
$search_in_array[] = $wpdb->prepare( '( postmeta.meta_value LIKE %s )', $like );
|
261 |
break;
|
284 |
distinct ID,
|
285 |
{$query['relevance']} as relevance
|
286 |
FROM
|
287 |
+
$wpdb->postmeta AS postmeta,
|
288 |
+
$wpdb->posts AS posts
|
289 |
+
{$query['join']}
|
290 |
WHERE
|
291 |
posts.post_type = 'product'
|
292 |
AND posts.post_status = 'publish'
|
299 |
LIMIT 0, {$results_num}
|
300 |
";
|
301 |
|
|
|
302 |
$posts_ids = $this->get_posts_ids( $sql );
|
303 |
|
304 |
$products_array = $this->get_products( $posts_ids );
|
313 |
}
|
314 |
|
315 |
echo json_encode( array(
|
316 |
+
//'sql' => $wpdb->get_results( $sql ),
|
317 |
'cats' => $categories_array,
|
318 |
'tags' => $tags_array,
|
319 |
'products' => $products_array
|
assets/css/admin.css
CHANGED
@@ -18,14 +18,14 @@
|
|
18 |
margin: 0;
|
19 |
padding: 5px;
|
20 |
margin-right: 10px;
|
21 |
-
height: 180px;
|
22 |
}
|
23 |
|
24 |
.sti-sortable li.sti-btn,
|
25 |
.sti-sortable li.highlight,
|
26 |
.sti-sortable li#excerpt {
|
27 |
display: inline-block;
|
28 |
-
float: left
|
29 |
width: 100%;
|
30 |
height: auto;
|
31 |
margin: 0 3px 3px 0;
|
18 |
margin: 0;
|
19 |
padding: 5px;
|
20 |
margin-right: 10px;
|
21 |
+
min-height: 180px;
|
22 |
}
|
23 |
|
24 |
.sti-sortable li.sti-btn,
|
25 |
.sti-sortable li.highlight,
|
26 |
.sti-sortable li#excerpt {
|
27 |
display: inline-block;
|
28 |
+
/*float: left;*/
|
29 |
width: 100%;
|
30 |
height: auto;
|
31 |
margin: 0 3px 3px 0;
|
includes/class-aws-admin.php
CHANGED
@@ -46,8 +46,6 @@ class AWS_Admin {
|
|
46 |
|
47 |
$options = $this->options_array();
|
48 |
|
49 |
-
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
50 |
-
|
51 |
$tabs = array(
|
52 |
'general' => __( 'General', 'aws' ),
|
53 |
//'query' => __( 'Query', 'aws' ),
|
@@ -103,7 +101,7 @@ class AWS_Admin {
|
|
103 |
|
104 |
echo $tabs_html;
|
105 |
|
106 |
-
echo '<form action="
|
107 |
|
108 |
echo '<table class="form-table">';
|
109 |
echo '<tbody>';
|
46 |
|
47 |
$options = $this->options_array();
|
48 |
|
|
|
|
|
49 |
$tabs = array(
|
50 |
'general' => __( 'General', 'aws' ),
|
51 |
//'query' => __( 'Query', 'aws' ),
|
101 |
|
102 |
echo $tabs_html;
|
103 |
|
104 |
+
echo '<form action="" name="aws_form" id="aws_form" method="post">';
|
105 |
|
106 |
echo '<table class="form-table">';
|
107 |
echo '<tbody>';
|
includes/options.php
CHANGED
@@ -73,7 +73,7 @@ $options['general'][] = array(
|
|
73 |
"name" => __( "Description length", "aws" ),
|
74 |
"desc" => __( "Maximal allowed number of words for product description.", "aws" ),
|
75 |
"id" => "excerpt_length",
|
76 |
-
"value" =>
|
77 |
"type" => "number"
|
78 |
);
|
79 |
|
@@ -164,6 +164,6 @@ $options['general'][] = array(
|
|
164 |
"desc" => __( "Source of searching. Set the source of searching by drag&drop needed fields to the right area.", "aws" ),
|
165 |
"id" => "search_in",
|
166 |
"value" => "title,content,sku,excerpt",
|
167 |
-
"choices" => array( "title", "content", "sku", "excerpt" ),
|
168 |
"type" => "sortable"
|
169 |
);
|
73 |
"name" => __( "Description length", "aws" ),
|
74 |
"desc" => __( "Maximal allowed number of words for product description.", "aws" ),
|
75 |
"id" => "excerpt_length",
|
76 |
+
"value" => 20,
|
77 |
"type" => "number"
|
78 |
);
|
79 |
|
164 |
"desc" => __( "Source of searching. Set the source of searching by drag&drop needed fields to the right area.", "aws" ),
|
165 |
"id" => "search_in",
|
166 |
"value" => "title,content,sku,excerpt",
|
167 |
+
"choices" => array( "title", "content", "sku", "excerpt", "category", "tag" ),
|
168 |
"type" => "sortable"
|
169 |
);
|
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.4.2
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -18,7 +18,7 @@ Advanced Woo Search - powerful live search plugin for WooCommerce. Just start ty
|
|
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 and sku. Or just in some of them
|
22 |
* **Shortcode** - Use shortcode 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
|
@@ -53,6 +53,10 @@ Or insert this function inside php file ( often it used to insert form inside pa
|
|
53 |
|
54 |
== Changelog ==
|
55 |
|
|
|
|
|
|
|
|
|
56 |
= 1.02 =
|
57 |
* Add single page search for 'product' custom post type
|
58 |
* Fix problem with dublicate products in the search results
|
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.4.2
|
7 |
+
Stable tag: 1.03
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
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 |
* **Shortcode** - Use shortcode 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
|
53 |
|
54 |
== Changelog ==
|
55 |
|
56 |
+
= 1.03 =
|
57 |
+
* Add search in product terms ( categories, tags )
|
58 |
+
* Fix issue with not saving settings
|
59 |
+
|
60 |
= 1.02 =
|
61 |
* Add single page search for 'product' custom post type
|
62 |
* Fix problem with dublicate products in the search results
|