Version Description
- Update re-index function
- Add support for custom tabs content made with Custom Product Tabs for WooCommerce plugin
- Add support for Search Exclude plugin
Download this release
Release Info
Developer | Mihail Barinov |
Plugin | Advanced Woo Search |
Version | 1.36 |
Comparing to | |
See all releases |
Code changes from version 1.35 to 1.36
- advanced-woo-search.php +2 -2
- assets/js/common.js +4 -2
- includes/class-aws-table.php +76 -35
- readme.txt +9 -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 |
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.36
|
7 |
Author: ILLID
|
8 |
Author URI: https://advanced-woo-search.com/
|
9 |
Text Domain: aws
|
16 |
exit;
|
17 |
}
|
18 |
|
19 |
+
define( 'AWS_VERSION', '1.36' );
|
20 |
|
21 |
|
22 |
define( 'AWS_DIR', dirname( __FILE__ ) );
|
assets/js/common.js
CHANGED
@@ -99,7 +99,8 @@
|
|
99 |
html += '<a class="aws_result_link" href="' + result.link + '" >';
|
100 |
html += '<span class="aws_result_content">';
|
101 |
html += '<span class="aws_result_title">';
|
102 |
-
html += result.name
|
|
|
103 |
html += '</span>';
|
104 |
html += '</span>';
|
105 |
html += '</a>';
|
@@ -117,7 +118,8 @@
|
|
117 |
html += '<a class="aws_result_link" href="' + result.link + '" >';
|
118 |
html += '<span class="aws_result_content">';
|
119 |
html += '<span class="aws_result_title">';
|
120 |
-
html += result.name
|
|
|
121 |
html += '</span>';
|
122 |
html += '</span>';
|
123 |
html += '</a>';
|
99 |
html += '<a class="aws_result_link" href="' + result.link + '" >';
|
100 |
html += '<span class="aws_result_content">';
|
101 |
html += '<span class="aws_result_title">';
|
102 |
+
html += result.name;
|
103 |
+
html += '<span class="aws_result_count"> (' + result.count + ')</span>';
|
104 |
html += '</span>';
|
105 |
html += '</span>';
|
106 |
html += '</a>';
|
118 |
html += '<a class="aws_result_link" href="' + result.link + '" >';
|
119 |
html += '<span class="aws_result_content">';
|
120 |
html += '<span class="aws_result_title">';
|
121 |
+
html += result.name;
|
122 |
+
html += '<span class="aws_result_count"> (' + result.count + ')</span>';
|
123 |
html += '</span>';
|
124 |
html += '</span>';
|
125 |
html += '</a>';
|
includes/class-aws-table.php
CHANGED
@@ -25,7 +25,7 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
25 |
|
26 |
$this->table_name = $wpdb->prefix . AWS_INDEX_TABLE_NAME;
|
27 |
|
28 |
-
add_action( 'wp_insert_post', array( $this, '
|
29 |
|
30 |
add_action( 'create_term', array( &$this, 'term_changed' ), 10, 3 );
|
31 |
add_action( 'delete_term', array( &$this, 'term_changed' ), 10, 3 );
|
@@ -38,7 +38,9 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
38 |
add_action( 'woocommerce_variable_product_sync', array( $this, 'variable_product_changed' ), 10, 2 );
|
39 |
}
|
40 |
}
|
41 |
-
|
|
|
|
|
42 |
add_action( 'wp_ajax_aws-reindex', array( $this, 'reindex_table' ) );
|
43 |
|
44 |
add_action( 'aws_reindex_table', array( $this, 'reindex_table_job' ) );
|
@@ -80,7 +82,7 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
80 |
}
|
81 |
|
82 |
$index_meta = apply_filters( 'aws_index_meta', $index_meta );
|
83 |
-
$posts_per_page = apply_filters( 'aws_index_posts_per_page',
|
84 |
|
85 |
|
86 |
$args = array(
|
@@ -229,6 +231,10 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
229 |
$data['terms'] = array();
|
230 |
$data['id'] = $found_post_id;
|
231 |
|
|
|
|
|
|
|
|
|
232 |
$product = wc_get_product( $data['id'] );
|
233 |
|
234 |
if( ! is_a( $product, 'WC_Product' ) ) {
|
@@ -294,6 +300,22 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
294 |
}
|
295 |
|
296 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
// WP 4.2 emoji strip
|
298 |
if ( function_exists( 'wp_encode_emoji' ) ) {
|
299 |
$content = wp_encode_emoji( $content );
|
@@ -459,69 +481,71 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
459 |
}
|
460 |
|
461 |
/*
|
462 |
-
*
|
463 |
*/
|
464 |
-
public function
|
465 |
-
|
466 |
-
global $wpdb;
|
467 |
|
468 |
-
if ( $
|
469 |
-
|
470 |
}
|
471 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
472 |
$slug = 'product';
|
473 |
|
474 |
if ( $slug != $post->post_type ) {
|
475 |
return;
|
476 |
}
|
477 |
|
478 |
-
$
|
479 |
|
480 |
-
|
481 |
-
'posts_per_page' => -1,
|
482 |
-
'fields' => 'ids',
|
483 |
-
'post_type' => 'product',
|
484 |
-
'post_status' => 'publish',
|
485 |
-
'suppress_filters' => false,
|
486 |
-
'no_found_rows' => 1,
|
487 |
-
'include' => $post_id
|
488 |
-
) );
|
489 |
|
490 |
-
|
|
|
|
|
|
|
491 |
|
492 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
493 |
|
494 |
}
|
495 |
|
496 |
/*
|
497 |
-
*
|
498 |
*/
|
499 |
-
public function
|
|
|
|
|
|
|
|
|
500 |
|
501 |
-
if ( $taxonomy === 'product_cat' || $taxonomy === 'product_tag' ) {
|
502 |
-
do_action( 'aws_cache_clear' );
|
503 |
}
|
504 |
|
505 |
}
|
506 |
|
507 |
/*
|
508 |
-
*
|
509 |
*/
|
510 |
-
|
511 |
|
512 |
global $wpdb;
|
513 |
|
514 |
-
$product_id = '';
|
515 |
-
|
516 |
if ( $this->is_table_not_exist() ) {
|
517 |
$this->create_table();
|
518 |
}
|
519 |
-
|
520 |
-
if ( is_object( $product ) ) {
|
521 |
-
$product_id = $product->get_id();
|
522 |
-
} else {
|
523 |
-
$product_id = $product;
|
524 |
-
}
|
525 |
|
526 |
$wpdb->delete( $this->table_name, array( 'id' => $product_id ) );
|
527 |
|
@@ -541,6 +565,23 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
541 |
|
542 |
}
|
543 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
544 |
/*
|
545 |
* Strip shortcodes
|
546 |
*/
|
25 |
|
26 |
$this->table_name = $wpdb->prefix . AWS_INDEX_TABLE_NAME;
|
27 |
|
28 |
+
add_action( 'wp_insert_post', array( $this, 'product_changed' ), 10, 3 );
|
29 |
|
30 |
add_action( 'create_term', array( &$this, 'term_changed' ), 10, 3 );
|
31 |
add_action( 'delete_term', array( &$this, 'term_changed' ), 10, 3 );
|
38 |
add_action( 'woocommerce_variable_product_sync', array( $this, 'variable_product_changed' ), 10, 2 );
|
39 |
}
|
40 |
}
|
41 |
+
|
42 |
+
add_action( 'updated_postmeta', array( $this, 'updated_custom_tabs' ), 10, 4 );
|
43 |
+
|
44 |
add_action( 'wp_ajax_aws-reindex', array( $this, 'reindex_table' ) );
|
45 |
|
46 |
add_action( 'aws_reindex_table', array( $this, 'reindex_table_job' ) );
|
82 |
}
|
83 |
|
84 |
$index_meta = apply_filters( 'aws_index_meta', $index_meta );
|
85 |
+
$posts_per_page = apply_filters( 'aws_index_posts_per_page', 10 );
|
86 |
|
87 |
|
88 |
$args = array(
|
231 |
$data['terms'] = array();
|
232 |
$data['id'] = $found_post_id;
|
233 |
|
234 |
+
if ( $this->is_excluded( $data['id'] ) ) {
|
235 |
+
continue;
|
236 |
+
}
|
237 |
+
|
238 |
$product = wc_get_product( $data['id'] );
|
239 |
|
240 |
if( ! is_a( $product, 'WC_Product' ) ) {
|
300 |
}
|
301 |
|
302 |
|
303 |
+
// Get content from Custom Product Tabs
|
304 |
+
if ( $custom_tabs = get_post_meta( $data['id'], 'yikes_woo_products_tabs' ) ) {
|
305 |
+
if ( $custom_tabs && ! empty( $custom_tabs ) ) {
|
306 |
+
foreach( $custom_tabs as $custom_tab_array ) {
|
307 |
+
if ( $custom_tab_array && ! empty( $custom_tab_array ) ) {
|
308 |
+
foreach( $custom_tab_array as $custom_tab ) {
|
309 |
+
if ( isset( $custom_tab['content'] ) && $custom_tab['content'] ) {
|
310 |
+
$content = $content . ' ' . $custom_tab['content'];
|
311 |
+
}
|
312 |
+
}
|
313 |
+
}
|
314 |
+
}
|
315 |
+
}
|
316 |
+
}
|
317 |
+
|
318 |
+
|
319 |
// WP 4.2 emoji strip
|
320 |
if ( function_exists( 'wp_encode_emoji' ) ) {
|
321 |
$content = wp_encode_emoji( $content );
|
481 |
}
|
482 |
|
483 |
/*
|
484 |
+
* Fires when products terms are changed
|
485 |
*/
|
486 |
+
public function term_changed( $term_id, $tt_id, $taxonomy ) {
|
|
|
|
|
487 |
|
488 |
+
if ( $taxonomy === 'product_cat' || $taxonomy === 'product_tag' ) {
|
489 |
+
do_action( 'aws_cache_clear' );
|
490 |
}
|
491 |
|
492 |
+
}
|
493 |
+
|
494 |
+
/*
|
495 |
+
* Update index table
|
496 |
+
*/
|
497 |
+
public function product_changed( $post_id, $post, $update ) {
|
498 |
+
|
499 |
$slug = 'product';
|
500 |
|
501 |
if ( $slug != $post->post_type ) {
|
502 |
return;
|
503 |
}
|
504 |
|
505 |
+
$this->update_table( $post_id );
|
506 |
|
507 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
508 |
|
509 |
+
/*
|
510 |
+
* Fires when products variations are changed
|
511 |
+
*/
|
512 |
+
public function variable_product_changed( $product, $children = null ) {
|
513 |
|
514 |
+
$product_id = '';
|
515 |
+
|
516 |
+
if ( is_object( $product ) ) {
|
517 |
+
$product_id = $product->get_id();
|
518 |
+
} else {
|
519 |
+
$product_id = $product;
|
520 |
+
}
|
521 |
+
|
522 |
+
$this->update_table( $product_id );
|
523 |
|
524 |
}
|
525 |
|
526 |
/*
|
527 |
+
* Custom Tabs was updated
|
528 |
*/
|
529 |
+
public function updated_custom_tabs( $meta_id, $object_id, $meta_key, $meta_value ) {
|
530 |
+
|
531 |
+
if ( $meta_key === 'yikes_woo_products_tabs' ) {
|
532 |
+
|
533 |
+
$this->update_table( $object_id );
|
534 |
|
|
|
|
|
535 |
}
|
536 |
|
537 |
}
|
538 |
|
539 |
/*
|
540 |
+
* Update index table
|
541 |
*/
|
542 |
+
private function update_table( $product_id ) {
|
543 |
|
544 |
global $wpdb;
|
545 |
|
|
|
|
|
546 |
if ( $this->is_table_not_exist() ) {
|
547 |
$this->create_table();
|
548 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
549 |
|
550 |
$wpdb->delete( $this->table_name, array( 'id' => $product_id ) );
|
551 |
|
565 |
|
566 |
}
|
567 |
|
568 |
+
/*
|
569 |
+
* Check is product excluded with Search Exclude plugin ( https://wordpress.org/plugins/search-exclude/ )
|
570 |
+
*/
|
571 |
+
private function is_excluded( $id ) {
|
572 |
+
|
573 |
+
$excluded = get_option('sep_exclude');
|
574 |
+
|
575 |
+
if ( $excluded && is_array( $excluded ) && ! empty( $excluded ) ) {
|
576 |
+
if ( false !== array_search( $id, $excluded ) ) {
|
577 |
+
return true;
|
578 |
+
}
|
579 |
+
}
|
580 |
+
|
581 |
+
return false;
|
582 |
+
|
583 |
+
}
|
584 |
+
|
585 |
/*
|
586 |
* Strip shortcodes
|
587 |
*/
|
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.4
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -29,6 +29,8 @@ Advanced Woo Search - powerful live search plugin for WooCommerce. Just start ty
|
|
29 |
* Supports variable products
|
30 |
* Plurals support
|
31 |
* Google Analytics support
|
|
|
|
|
32 |
|
33 |
= Premium Features =
|
34 |
|
@@ -42,7 +44,7 @@ Advanced Woo Search - powerful live search plugin for WooCommerce. Just start ty
|
|
42 |
* 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
|
43 |
* **Visibility option** - choose what catalog visibility must be for product to displayed in search results
|
44 |
* Show product **categories** and **variations** in search results
|
45 |
-
* Support for
|
46 |
|
47 |
== Installation ==
|
48 |
|
@@ -75,6 +77,11 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
|
|
75 |
|
76 |
== Changelog ==
|
77 |
|
|
|
|
|
|
|
|
|
|
|
78 |
= 1.35 =
|
79 |
* Fix issue with position of search results box
|
80 |
* Add 'aws_page_results' filter
|
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.4
|
7 |
+
Stable tag: 1.36
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
29 |
* Supports variable products
|
30 |
* Plurals support
|
31 |
* Google Analytics support
|
32 |
+
* Custom Product Tabs for WooCommerce plugin support
|
33 |
+
* Search Exclude plugin support
|
34 |
|
35 |
= Premium Features =
|
36 |
|
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 |
|
77 |
|
78 |
== Changelog ==
|
79 |
|
80 |
+
= 1.36 =
|
81 |
+
* Update re-index function
|
82 |
+
* Add support for custom tabs content made with Custom Product Tabs for WooCommerce plugin
|
83 |
+
* Add support for Search Exclude plugin
|
84 |
+
|
85 |
= 1.35 =
|
86 |
* Fix issue with position of search results box
|
87 |
* Add 'aws_page_results' filter
|