Advanced Woo Search - Version 2.50

Version Description

( 2022-03-22 ) = * Update - Tested with WC 6.3 * Update - Integration with Astra theme * Dev - Add aws_search_data_parameters filter

Download this release

Release Info

Developer Mihail Barinov
Plugin Icon 128x128 Advanced Woo Search
Version 2.50
Comparing to
See all releases

Code changes from version 2.49 to 2.50

advanced-woo-search.php CHANGED
@@ -3,12 +3,12 @@
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
- Version: 2.49
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: advanced-woo-search
10
  WC requires at least: 3.0.0
11
- WC tested up to: 6.2.0
12
  */
13
 
14
 
@@ -96,7 +96,7 @@ final class AWS_Main {
96
  */
97
  private function define_constants() {
98
 
99
- $this->define( 'AWS_VERSION', '2.49' );
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.50
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: advanced-woo-search
10
  WC requires at least: 3.0.0
11
+ WC tested up to: 6.3.0
12
  */
13
 
14
 
96
  */
97
  private function define_constants() {
98
 
99
+ $this->define( 'AWS_VERSION', '2.50' );
100
 
101
  $this->define( 'AWS_DIR', plugin_dir_path( AWS_FILE ) );
102
  $this->define( 'AWS_URL', plugin_dir_url( AWS_FILE ) );
includes/class-aws-integrations.php CHANGED
@@ -119,12 +119,6 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
119
  add_filter( 'aws_seamless_search_form_filter', array( $this, 'woodmart_seamless_search_form_filter' ), 10, 2 );
120
  }
121
 
122
- if ( 'Astra' === $this->current_theme ) {
123
- add_filter( 'astra_get_search_form', array( $this, 'astra_markup' ), 999999 );
124
- add_filter( 'aws_searchbox_markup', array( $this, 'astra_aws_searchbox_markup' ), 1 );
125
- add_action( 'wp_head', array( $this, 'astra_head_action' ) );
126
- }
127
-
128
  if ( 'Storefront' === $this->current_theme ) {
129
  add_action( 'wp_footer', array( $this, 'storefront_footer_action' ) );
130
  }
@@ -373,6 +367,11 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
373
  include_once( AWS_DIR . '/includes/modules/class-aws-barn2-protected-categories.php' );
374
  }
375
 
 
 
 
 
 
376
  }
377
 
378
  /*
@@ -872,67 +871,6 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
872
  return $markup;
873
  }
874
 
875
- /*
876
- * Astra theme form markup
877
- */
878
- public function astra_markup( $output ) {
879
- if ( function_exists( 'aws_get_search_form' ) && is_string( $output ) ) {
880
-
881
- $pattern = '/(<form[\s\S]*?<\/form>)/i';
882
- $form = aws_get_search_form(false);
883
-
884
- if ( strpos( $output, 'aws-container' ) !== false ) {
885
- $pattern = '/(<div class="aws-container"[\s\S]*?<form.*?<\/form><\/div>)/i';
886
- }
887
-
888
- $output = trim(preg_replace('/\s\s+/', ' ', $output));
889
- $output = preg_replace( $pattern, $form, $output );
890
- $output = str_replace( 'aws-container', 'aws-container search-form', $output );
891
- $output = str_replace( 'aws-search-field', 'aws-search-field search-field', $output );
892
-
893
- }
894
- return $output;
895
- }
896
-
897
- /*
898
- * Astra theme form markup
899
- */
900
- public function astra_aws_searchbox_markup( $markup ) {
901
- $markup = str_replace( 'aws-container', 'aws-container search-form', $markup );
902
- return $markup;
903
- }
904
-
905
- /*
906
- * Astra theme
907
- */
908
- public function astra_head_action() { ?>
909
-
910
- <style>
911
- .ast-search-menu-icon.slide-search .search-form {
912
- width: auto;
913
- }
914
- .ast-search-menu-icon .search-form {
915
- padding: 0 !important;
916
- }
917
- .ast-search-menu-icon.ast-dropdown-active.slide-search .ast-search-icon {
918
- opacity: 0;
919
- }
920
- .ast-search-menu-icon.slide-search .aws-container .aws-search-field {
921
- width: 0;
922
- background: #fff;
923
- border: none;
924
- }
925
- .ast-search-menu-icon.ast-dropdown-active.slide-search .aws-search-field {
926
- width: 235px;
927
- }
928
- .ast-search-menu-icon.slide-search .aws-container .aws-search-form .aws-form-btn {
929
- background: #fff;
930
- border: none;
931
- }
932
- </style>
933
-
934
- <?php }
935
-
936
  /*
937
  * Elessi theme
938
  */
119
  add_filter( 'aws_seamless_search_form_filter', array( $this, 'woodmart_seamless_search_form_filter' ), 10, 2 );
120
  }
121
 
 
 
 
 
 
 
122
  if ( 'Storefront' === $this->current_theme ) {
123
  add_action( 'wp_footer', array( $this, 'storefront_footer_action' ) );
124
  }
367
  include_once( AWS_DIR . '/includes/modules/class-aws-barn2-protected-categories.php' );
368
  }
369
 
370
+ // Astra theme
371
+ if ( 'Astra' === $this->current_theme ) {
372
+ include_once( AWS_DIR . '/includes/modules/class-aws-astra.php' );
373
+ }
374
+
375
  }
376
 
377
  /*
871
  return $markup;
872
  }
873
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
874
  /*
875
  * Elessi theme
876
  */
includes/class-aws-search.php CHANGED
@@ -175,6 +175,13 @@ if ( ! class_exists( 'AWS_Search' ) ) :
175
  // $this->data['search_terms'][] = '';
176
  // }
177
 
 
 
 
 
 
 
 
178
  if ( ! empty( $this->data['search_terms'] ) ) {
179
 
180
  if ( ! empty( $this->data['search_in'] ) ) {
175
  // $this->data['search_terms'][] = '';
176
  // }
177
 
178
+ /**
179
+ * Filter search data parameters
180
+ * @since 2.50
181
+ * @param array $this->data Array of data parameters
182
+ */
183
+ $this->data = apply_filters( 'aws_search_data_parameters', $this->data );
184
+
185
  if ( ! empty( $this->data['search_terms'] ) ) {
186
 
187
  if ( ! empty( $this->data['search_in'] ) ) {
includes/modules/class-aws-astra.php ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Astra theme integration
4
+ */
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit; // Exit if accessed directly.
8
+ }
9
+
10
+ if ( ! class_exists( 'AWS_Astra' ) ) :
11
+
12
+ /**
13
+ * Class
14
+ */
15
+ class AWS_Astra {
16
+
17
+ /**
18
+ * Main AWS_Astra Instance
19
+ *
20
+ * Ensures only one instance of AWS_Astra is loaded or can be loaded.
21
+ *
22
+ * @static
23
+ * @return AWS_Astra - Main instance
24
+ */
25
+ protected static $_instance = null;
26
+
27
+ /**
28
+ * Main AWS_Astra Instance
29
+ *
30
+ * Ensures only one instance of AWS_Astra is loaded or can be loaded.
31
+ *
32
+ * @static
33
+ * @return AWS_Astra - Main instance
34
+ */
35
+ public static function instance() {
36
+ if ( is_null( self::$_instance ) ) {
37
+ self::$_instance = new self();
38
+ }
39
+ return self::$_instance;
40
+ }
41
+
42
+ /**
43
+ * Constructor
44
+ */
45
+ public function __construct() {
46
+
47
+ if ( AWS()->get_settings( 'seamless' ) === 'true' ) {
48
+ add_filter( 'aws_js_seamless_selectors', array( $this, 'js_seamless_selectors' ), 1 );
49
+ add_filter( 'aws_js_seamless_searchbox_markup', array( $this, 'seamless_searchbox_markup' ), 1 );
50
+ add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 999 );
51
+ add_filter( 'astra_get_search_form', array( $this, 'astra_markup' ), 999999 );
52
+ add_filter( 'aws_searchbox_markup', array( $this, 'astra_aws_searchbox_markup' ), 1 );
53
+ add_action( 'wp_head', array( $this, 'astra_head_action' ) );
54
+ }
55
+
56
+ }
57
+
58
+ /*
59
+ * Selector filter of js seamless
60
+ */
61
+ public function js_seamless_selectors( $selectors ) {
62
+ $selectors[] = '.ast-search-box.header-cover form';
63
+ $selectors[] = '.ast-search-box.full-screen form';
64
+ return $selectors;
65
+ }
66
+
67
+ /*
68
+ * Markup for seamless js integration
69
+ */
70
+ public function seamless_searchbox_markup( $markup ) {
71
+ if ( class_exists('Astra_Icons') ) {
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
+
79
+ /*
80
+ * Astra theme form markup
81
+ */
82
+ public function astra_markup( $output ) {
83
+ if ( function_exists( 'aws_get_search_form' ) && is_string( $output ) ) {
84
+
85
+ $pattern = '/(<form[\s\S]*?<\/form>)/i';
86
+ $form = aws_get_search_form(false);
87
+
88
+ if ( strpos( $output, 'aws-container' ) !== false ) {
89
+ $pattern = '/(<div class="aws-container"[\s\S]*?<form.*?<\/form><\/div>)/i';
90
+ }
91
+
92
+ $output = trim(preg_replace('/\s\s+/', ' ', $output));
93
+ $output = preg_replace( $pattern, $form, $output );
94
+ $output = str_replace( 'aws-container', 'aws-container search-form', $output );
95
+ $output = str_replace( 'aws-search-field', 'aws-search-field search-field', $output );
96
+
97
+ }
98
+ return $output;
99
+ }
100
+
101
+ /*
102
+ * Astra theme form markup
103
+ */
104
+ public function astra_aws_searchbox_markup( $markup ) {
105
+ $markup = str_replace( 'aws-container', 'aws-container search-form', $markup );
106
+ return $markup;
107
+ }
108
+
109
+ /*
110
+ * Add custom js scripts
111
+ */
112
+ public function wp_enqueue_scripts() {
113
+
114
+ $script = '
115
+ document.addEventListener("awsLoaded", function() {
116
+ jQuery(document).on("click", ".ast-search-box .close", function(e) {
117
+ jQuery(this).closest(".ast-search-box.header-cover").attr("style", "");
118
+ });
119
+ });
120
+ ';
121
+
122
+ wp_add_inline_script( 'aws-script', $script);
123
+ wp_add_inline_script( 'aws-pro-script', $script);
124
+
125
+ }
126
+
127
+ /*
128
+ * Astra theme
129
+ */
130
+ public function astra_head_action() { ?>
131
+
132
+ <style>
133
+ .ast-search-menu-icon.slide-search .search-form {
134
+ width: auto;
135
+ }
136
+ .ast-search-menu-icon .search-form {
137
+ padding: 0 !important;
138
+ }
139
+ .ast-search-menu-icon.ast-dropdown-active.slide-search .ast-search-icon {
140
+ opacity: 0;
141
+ }
142
+ .ast-search-menu-icon.slide-search .aws-container .aws-search-field {
143
+ width: 0;
144
+ background: #fff;
145
+ border: none;
146
+ }
147
+ .ast-search-menu-icon.ast-dropdown-active.slide-search .aws-search-field {
148
+ width: 235px;
149
+ }
150
+ .ast-search-menu-icon.slide-search .aws-container .aws-search-form .aws-form-btn {
151
+ background: #fff;
152
+ border: none;
153
+ }
154
+ .ast-search-menu-icon.ast-dropdown-active.slide-search .ast-search-icon {
155
+ opacity: 1;
156
+ }
157
+ .ast-search-menu-icon.ast-dropdown-active.slide-search .ast-search-icon .slide-search.astra-search-icon {
158
+ opacity: 0;
159
+ }
160
+ .ast-search-box.header-cover .aws-container .aws-search-form {
161
+ background: transparent;
162
+ }
163
+ .ast-search-box.header-cover .aws-container .aws-search-form .aws-search-field,
164
+ .ast-search-box.full-screen .aws-container .aws-search-form .aws-search-field {
165
+ outline: none;
166
+ }
167
+ .ast-search-box.header-cover .aws-container .aws-search-form .aws-form-btn,
168
+ .ast-search-box.full-screen .aws-container .aws-search-form .aws-form-btn {
169
+ background: transparent;
170
+ border: none;
171
+ }
172
+ .ast-search-box.header-cover .aws-container .aws-search-form .aws-search-btn_icon,
173
+ .ast-search-box.full-screen .aws-container .aws-search-form .aws-search-btn_icon,
174
+ .ast-search-box.header-cover .aws-container .aws-search-form .aws-main-filter .aws-main-filter__current,
175
+ .ast-search-box.full-screen .aws-container .aws-search-form .aws-main-filter .aws-main-filter__current {
176
+ color: #fff;
177
+ }
178
+ .ast-search-box.full-screen .aws-container {
179
+ margin: 40px auto !important;
180
+ }
181
+ .ast-search-box.full-screen .aws-container #close {
182
+ display: none;
183
+ }
184
+ .ast-search-box.full-screen .aws-container .aws-search-form {
185
+ background: transparent;
186
+ border-bottom: 2px solid #9E9E9E;
187
+ height: 50px;
188
+ }
189
+ .ast-search-box.full-screen .aws-container .aws-search-form .aws-search-field {
190
+ padding-bottom: 10px;
191
+ }
192
+ </style>
193
+
194
+ <?php }
195
+
196
+ }
197
+
198
+ endif;
199
+
200
+ AWS_Astra::instance();
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.49
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.49 ( 2022-03-07 ) =
171
  * Update - Admin notices
172
  * Fix - WCFM - WooCommerce Multivendor Marketplace plugin integration. Change store link
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.50
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
167
 
168
  == Changelog ==
169
 
170
+ = 2.50 ( 2022-03-22 ) =
171
+ * Update - Tested with WC 6.3
172
+ * Update - Integration with Astra theme
173
+ * Dev - Add aws_search_data_parameters filter
174
+
175
  = 2.49 ( 2022-03-07 ) =
176
  * Update - Admin notices
177
  * Fix - WCFM - WooCommerce Multivendor Marketplace plugin integration. Change store link