Version Description
( 2022-03-28 ) = * Update - Hooks for index table products sync * Fix - Search results page filters for default WooCommerce filter widgets * Fix - Astra theme integration. Bug with search form close button
Download this release
Release Info
Developer | Mihail Barinov |
Plugin | Advanced Woo Search |
Version | 2.51 |
Comparing to | |
See all releases |
Code changes from version 2.50 to 2.51
- advanced-woo-search.php +2 -2
- includes/class-aws-helpers.php +1 -0
- includes/class-aws-order.php +7 -1
- includes/class-aws-table.php +36 -2
- includes/modules/class-aws-astra.php +15 -5
- readme.txt +6 -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: 2.
|
7 |
Author: ILLID
|
8 |
Author URI: https://advanced-woo-search.com/
|
9 |
Text Domain: advanced-woo-search
|
@@ -96,7 +96,7 @@ final class AWS_Main {
|
|
96 |
*/
|
97 |
private function define_constants() {
|
98 |
|
99 |
-
$this->define( 'AWS_VERSION', '2.
|
100 |
|
101 |
$this->define( 'AWS_DIR', plugin_dir_path( AWS_FILE ) );
|
102 |
$this->define( 'AWS_URL', plugin_dir_url( AWS_FILE ) );
|
3 |
/*
|
4 |
Plugin Name: Advanced Woo Search
|
5 |
Description: Advance ajax WooCommerce product search.
|
6 |
+
Version: 2.51
|
7 |
Author: ILLID
|
8 |
Author URI: https://advanced-woo-search.com/
|
9 |
Text Domain: advanced-woo-search
|
96 |
*/
|
97 |
private function define_constants() {
|
98 |
|
99 |
+
$this->define( 'AWS_VERSION', '2.51' );
|
100 |
|
101 |
$this->define( 'AWS_DIR', plugin_dir_path( AWS_FILE ) );
|
102 |
$this->define( 'AWS_URL', plugin_dir_url( AWS_FILE ) );
|
includes/class-aws-helpers.php
CHANGED
@@ -871,6 +871,7 @@ if ( ! class_exists( 'AWS_Helpers' ) ) :
|
|
871 |
static public function page_filter_tax( $product_terms, $filter_terms, $operator = 'OR' ) {
|
872 |
|
873 |
$skip = true;
|
|
|
874 |
|
875 |
if ( $filter_terms && is_array( $filter_terms ) && ! empty( $filter_terms ) ) {
|
876 |
|
871 |
static public function page_filter_tax( $product_terms, $filter_terms, $operator = 'OR' ) {
|
872 |
|
873 |
$skip = true;
|
874 |
+
$operator = strtoupper( $operator );
|
875 |
|
876 |
if ( $filter_terms && is_array( $filter_terms ) && ! empty( $filter_terms ) ) {
|
877 |
|
includes/class-aws-order.php
CHANGED
@@ -87,6 +87,12 @@ if ( ! class_exists( 'AWS_Order' ) ) :
|
|
87 |
|
88 |
}
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
/**
|
92 |
* Filter available search page filters before apply
|
@@ -233,7 +239,7 @@ if ( ! class_exists( 'AWS_Order' ) ) :
|
|
233 |
|
234 |
foreach( $attr_filter as $attr_filter_name => $attr_filter_object ) {
|
235 |
|
236 |
-
$operator = isset( $attr_filter_object['operator'] ) ? $attr_filter_object['operator'] : 'OR';
|
237 |
$attr_filter_terms = $attr_filter_object['terms'];
|
238 |
|
239 |
$skip = AWS_Helpers::page_filter_tax( $product_terms_array, $attr_filter_terms, $operator );
|
87 |
|
88 |
}
|
89 |
|
90 |
+
if ( empty( $attr_filter ) && class_exists('WC_Query') && method_exists( 'WC_Query', 'get_layered_nav_chosen_attributes' ) && count( WC_Query::get_layered_nav_chosen_attributes() ) > 0 ) {
|
91 |
+
foreach ( WC_Query::get_layered_nav_chosen_attributes() as $taxonomy => $data ) {
|
92 |
+
$attr_filter[$taxonomy] = $data;
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
|
97 |
/**
|
98 |
* Filter available search page filters before apply
|
239 |
|
240 |
foreach( $attr_filter as $attr_filter_name => $attr_filter_object ) {
|
241 |
|
242 |
+
$operator = isset( $attr_filter_object['operator'] ) ? $attr_filter_object['operator'] : ( isset( $attr_filter_object['query_type'] ) ? $attr_filter_object['query_type'] : 'OR' ) ;
|
243 |
$attr_filter_terms = $attr_filter_object['terms'];
|
244 |
|
245 |
$skip = AWS_Helpers::page_filter_tax( $product_terms_array, $attr_filter_terms, $operator );
|
includes/class-aws-table.php
CHANGED
@@ -30,7 +30,13 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
30 |
|
31 |
$this->table_name = $wpdb->prefix . AWS_INDEX_TABLE_NAME;
|
32 |
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
add_action( 'delete_post', array( $this, 'product_deleted' ), 10, 2 );
|
35 |
|
36 |
add_action( 'create_term', array( &$this, 'term_changed' ), 10, 3 );
|
@@ -505,10 +511,15 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
505 |
/*
|
506 |
* Update index table
|
507 |
*/
|
508 |
-
public function product_changed( $post_id, $post ) {
|
509 |
|
510 |
$slug = 'product';
|
511 |
|
|
|
|
|
|
|
|
|
|
|
512 |
if ( $slug != $post->post_type ) {
|
513 |
return;
|
514 |
}
|
@@ -517,6 +528,29 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
517 |
return;
|
518 |
}
|
519 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
520 |
$this->update_table( $post_id );
|
521 |
|
522 |
}
|
30 |
|
31 |
$this->table_name = $wpdb->prefix . AWS_INDEX_TABLE_NAME;
|
32 |
|
33 |
+
// Create, update product
|
34 |
+
add_action( 'woocommerce_after_product_object_save', array( $this, 'woocommerce_after_product_object_save' ) );
|
35 |
+
|
36 |
+
// Change product status
|
37 |
+
add_action( 'wp_insert_post', array( $this, 'product_changed' ), 10, 3 );
|
38 |
+
|
39 |
+
// Delete product
|
40 |
add_action( 'delete_post', array( $this, 'product_deleted' ), 10, 2 );
|
41 |
|
42 |
add_action( 'create_term', array( &$this, 'term_changed' ), 10, 3 );
|
511 |
/*
|
512 |
* Update index table
|
513 |
*/
|
514 |
+
public function product_changed( $post_id, $post, $update ) {
|
515 |
|
516 |
$slug = 'product';
|
517 |
|
518 |
+
// Not run for newly created products
|
519 |
+
if ( ! $update ) {
|
520 |
+
return;
|
521 |
+
}
|
522 |
+
|
523 |
if ( $slug != $post->post_type ) {
|
524 |
return;
|
525 |
}
|
528 |
return;
|
529 |
}
|
530 |
|
531 |
+
if ( $post->post_status === 'publish' ) {
|
532 |
+
return;
|
533 |
+
}
|
534 |
+
|
535 |
+
$this->update_table( $post_id );
|
536 |
+
|
537 |
+
}
|
538 |
+
|
539 |
+
/*
|
540 |
+
* Update index table
|
541 |
+
*/
|
542 |
+
public function woocommerce_after_product_object_save( $product ) {
|
543 |
+
|
544 |
+
$post_id = $product->get_id();
|
545 |
+
|
546 |
+
if ( 'variation' === $product->get_type() ) {
|
547 |
+
return;
|
548 |
+
}
|
549 |
+
|
550 |
+
if ( wp_is_post_revision( $post_id ) ) {
|
551 |
+
return;
|
552 |
+
}
|
553 |
+
|
554 |
$this->update_table( $post_id );
|
555 |
|
556 |
}
|
includes/modules/class-aws-astra.php
CHANGED
@@ -68,11 +68,7 @@ if ( ! class_exists( 'AWS_Astra' ) ) :
|
|
68 |
* Markup for seamless js integration
|
69 |
*/
|
70 |
public function seamless_searchbox_markup( $markup ) {
|
71 |
-
|
72 |
-
$close_btn = '<span id="close" class="close">' . Astra_Icons::get_icons( 'close', true ) . '</span>';
|
73 |
-
$markup = str_replace( '</form>', $close_btn . '</form>', $markup );
|
74 |
-
$markup = str_replace( 'aws-search-field', 'aws-search-field search-field', $markup );
|
75 |
-
}
|
76 |
return $markup;
|
77 |
}
|
78 |
|
@@ -119,6 +115,20 @@ if ( ! class_exists( 'AWS_Astra' ) ) :
|
|
119 |
});
|
120 |
';
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
wp_add_inline_script( 'aws-script', $script);
|
123 |
wp_add_inline_script( 'aws-pro-script', $script);
|
124 |
|
68 |
* Markup for seamless js integration
|
69 |
*/
|
70 |
public function seamless_searchbox_markup( $markup ) {
|
71 |
+
$markup = str_replace( 'aws-search-field', 'aws-search-field search-field', $markup );
|
|
|
|
|
|
|
|
|
72 |
return $markup;
|
73 |
}
|
74 |
|
115 |
});
|
116 |
';
|
117 |
|
118 |
+
if ( function_exists('astra_get_option') && astra_get_option( 'header-search-box-type' ) === 'header-cover' && class_exists('Astra_Icons') ) {
|
119 |
+
|
120 |
+
$close_btn = '<span id="close" class="close">' . Astra_Icons::get_icons( 'close', true ) . '</span>';
|
121 |
+
|
122 |
+
$script .= '
|
123 |
+
document.addEventListener("awsLoaded", function() {
|
124 |
+
if ( ! jQuery(".ast-search-box.header-cover .close").length > 0 ) {
|
125 |
+
jQuery(".ast-search-box.header-cover form").append(\'' . $close_btn . '\');
|
126 |
+
}
|
127 |
+
});
|
128 |
+
';
|
129 |
+
|
130 |
+
}
|
131 |
+
|
132 |
wp_add_inline_script( 'aws-script', $script);
|
133 |
wp_add_inline_script( 'aws-pro-script', $script);
|
134 |
|
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.9
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -167,6 +167,11 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
|
|
167 |
|
168 |
== Changelog ==
|
169 |
|
|
|
|
|
|
|
|
|
|
|
170 |
= 2.50 ( 2022-03-22 ) =
|
171 |
* Update - Tested with WC 6.3
|
172 |
* Update - Integration with Astra theme
|
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.9
|
7 |
+
Stable tag: 2.51
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
167 |
|
168 |
== Changelog ==
|
169 |
|
170 |
+
= 2.51 ( 2022-03-28 ) =
|
171 |
+
* Update - Hooks for index table products sync
|
172 |
+
* Fix - Search results page filters for default WooCommerce filter widgets
|
173 |
+
* Fix - Astra theme integration. Bug with search form close button
|
174 |
+
|
175 |
= 2.50 ( 2022-03-22 ) =
|
176 |
* Update - Tested with WC 6.3
|
177 |
* Update - Integration with Astra theme
|