Advanced Woo Search - Version 2.55

Version Description

( 2022-05-30 ) = * Add - Support for Savoy theme * Update - Admin page integration notices * Update - Search form shortcode parameters * Fix - Issue with search results caching for certain user roles

Download this release

Release Info

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

Code changes from version 2.54 to 2.55

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.54
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.54' );
100
 
101
  $this->define( 'AWS_DIR', plugin_dir_path( AWS_FILE ) );
102
  $this->define( 'AWS_URL', plugin_dir_url( AWS_FILE ) );
@@ -141,7 +141,7 @@ final class AWS_Main {
141
  */
142
  public function markup( $args = array() ) {
143
 
144
- $markup = new AWS_Markup();
145
 
146
  return $markup->markup();
147
 
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
+ Version: 2.55
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.55' );
100
 
101
  $this->define( 'AWS_DIR', plugin_dir_path( AWS_FILE ) );
102
  $this->define( 'AWS_URL', plugin_dir_url( AWS_FILE ) );
141
  */
142
  public function markup( $args = array() ) {
143
 
144
+ $markup = new AWS_Markup( $args );
145
 
146
  return $markup->markup();
147
 
includes/admin/class-aws-admin-notices.php CHANGED
@@ -60,7 +60,7 @@ if ( ! class_exists( 'AWS_Admin_Notices' ) ) :
60
  return;
61
  }
62
 
63
- if ( ! class_exists( 'WCFMmp' ) && ! class_exists('ACF') && ! class_exists('YITH_WCWL') ) {
64
  return;
65
  }
66
 
@@ -84,6 +84,26 @@ if ( ! class_exists( 'AWS_Admin_Notices' ) ) :
84
  $notice_id .= 'yithwish|';
85
  }
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  $notice_id = 'aws_hide_int_notices=' . urlencode( trim( $notice_id, '|' ) );
88
 
89
  if ( $notice_message ) {
60
  return;
61
  }
62
 
63
+ if ( ! class_exists( 'WCFMmp' ) && ! class_exists('ACF') && ! class_exists('YITH_WCWL') && ! class_exists( 'WooCommerceWholeSalePrices' ) && ! class_exists( 'UM_Functions' ) && ! defined( 'PWB_PLUGIN_VERSION' ) && ! defined( 'TINVWL_FVERSION' ) ) {
64
  return;
65
  }
66
 
84
  $notice_id .= 'yithwish|';
85
  }
86
 
87
+ if ( class_exists( 'WooCommerceWholeSalePrices' ) && ( ! $hide_option || array_search( 'wholesaleprices', $hide_option ) === false ) ) {
88
+ $notice_message .= '<li>' . __( 'Wholesale Prices plugin.', 'advanced-woo-search' ) . ' <a target="_blank" href="https://advanced-woo-search.com/guide/wholesale-prices/?utm_source=wp-plugin&utm_medium=integration_notice&utm_campaign=wholesaleprices">' . __( 'Learn more', 'advanced-woo-search' ) . '</a></li>';
89
+ $notice_id .= 'wholesaleprices|';
90
+ }
91
+
92
+ if ( class_exists( 'UM_Functions' ) && ( ! $hide_option || array_search( 'um', $hide_option ) === false ) ) {
93
+ $notice_message .= '<li>' . __( 'Ultimate Member plugin.', 'advanced-woo-search' ) . ' <a target="_blank" href="https://advanced-woo-search.com/guide/ultimate-member/?utm_source=wp-plugin&utm_medium=integration_notice&utm_campaign=um">' . __( 'Learn more', 'advanced-woo-search' ) . '</a></li>';
94
+ $notice_id .= 'um|';
95
+ }
96
+
97
+ if ( defined( 'PWB_PLUGIN_VERSION' ) && ( ! $hide_option || array_search( 'pwb', $hide_option ) === false ) ) {
98
+ $notice_message .= '<li>' . __( 'Perfect Brands for WooCommerce plugin.', 'advanced-woo-search' ) . ' <a target="_blank" href="https://advanced-woo-search.com/guide/perfect-brands-for-woocommerce/?utm_source=wp-plugin&utm_medium=integration_notice&utm_campaign=pwb">' . __( 'Learn more', 'advanced-woo-search' ) . '</a></li>';
99
+ $notice_id .= 'pwb|';
100
+ }
101
+
102
+ if ( defined( 'TINVWL_FVERSION' ) && ( ! $hide_option || array_search( 'tinvwl', $hide_option ) === false ) ) {
103
+ $notice_message .= '<li>' . __( 'TI WooCommerce Wishlist plugin.', 'advanced-woo-search' ) . ' <a target="_blank" href="https://advanced-woo-search.com/guide/ti-woocommerce-wishlist/?utm_source=wp-plugin&utm_medium=integration_notice&utm_campaign=tinvwl">' . __( 'Learn more', 'advanced-woo-search' ) . '</a></li>';
104
+ $notice_id .= 'tinvwl|';
105
+ }
106
+
107
  $notice_id = 'aws_hide_int_notices=' . urlencode( trim( $notice_id, '|' ) );
108
 
109
  if ( $notice_message ) {
includes/class-aws-cache.php CHANGED
@@ -77,7 +77,7 @@ if ( ! class_exists( 'AWS_Cache' ) ) :
77
  if ( is_user_logged_in() ) {
78
  $user = wp_get_current_user();
79
  $role = ( array ) $user->roles;
80
- $user_role = $role[0];
81
  if ( $user_role ) {
82
  $cache_option_name = $cache_option_name . '_' . $user_role;
83
  }
77
  if ( is_user_logged_in() ) {
78
  $user = wp_get_current_user();
79
  $role = ( array ) $user->roles;
80
+ $user_role = array_values( $role )[0];
81
  if ( $user_role ) {
82
  $cache_option_name = $cache_option_name . '_' . $user_role;
83
  }
includes/class-aws-integrations.php CHANGED
@@ -201,6 +201,10 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
201
  add_filter( 'aws_js_seamless_searchbox_markup', array( $this, 'gecko_seamless_searchbox_markup' ), 1 );
202
  }
203
 
 
 
 
 
204
  }
205
 
206
  add_action( 'wp_head', array( $this, 'head_js_integration' ) );
@@ -1492,6 +1496,14 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
1492
  return $markup;
1493
  }
1494
 
 
 
 
 
 
 
 
 
1495
  /*
1496
  * Exclude product categories
1497
  */
@@ -1734,6 +1746,10 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
1734
  $selectors[] = '#jas-wrapper .header__search';
1735
  }
1736
 
 
 
 
 
1737
  // WCFM - WooCommerce Multivendor Marketplace
1738
  if ( class_exists( 'WCFMmp' ) ) {
1739
  $selectors[] = '#wcfmmp-store .woocommerce-product-search';
201
  add_filter( 'aws_js_seamless_searchbox_markup', array( $this, 'gecko_seamless_searchbox_markup' ), 1 );
202
  }
203
 
204
+ if ( 'Savoy' === $this->current_theme ) {
205
+ add_filter( 'aws_js_seamless_searchbox_markup', array( $this, 'savoy_seamless_searchbox_markup' ), 1 );
206
+ }
207
+
208
  }
209
 
210
  add_action( 'wp_head', array( $this, 'head_js_integration' ) );
1496
  return $markup;
1497
  }
1498
 
1499
+ /*
1500
+ * Savoy theme markup for seamless js integration
1501
+ */
1502
+ public function savoy_seamless_searchbox_markup( $markup ) {
1503
+ $markup = str_replace( 'name="s"', 'name="s" id="nm-header-search-input"', $markup );
1504
+ return $markup;
1505
+ }
1506
+
1507
  /*
1508
  * Exclude product categories
1509
  */
1746
  $selectors[] = '#jas-wrapper .header__search';
1747
  }
1748
 
1749
+ if ( 'Savoy' === $this->current_theme ) {
1750
+ $selectors[] = '#nm-header-search-form';
1751
+ }
1752
+
1753
  // WCFM - WooCommerce Multivendor Marketplace
1754
  if ( class_exists( 'WCFMmp' ) ) {
1755
  $selectors[] = '#wcfmmp-store .woocommerce-product-search';
includes/class-aws-markup.php CHANGED
@@ -11,6 +11,20 @@ if ( ! class_exists( 'AWS_Markup' ) ) :
11
  */
12
  class AWS_Markup {
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  /*
15
  * Generate search box markup
16
  */
@@ -27,18 +41,19 @@ if ( ! class_exists( 'AWS_Markup' ) ) :
27
  return;
28
  }
29
 
30
-
31
- $placeholder = AWS_Helpers::translate( 'search_field_text', AWS()->get_settings( 'search_field_text' ) );
32
- $min_chars = AWS()->get_settings( 'min_chars' );
33
- $show_loader = AWS()->get_settings( 'show_loader' );
34
- $show_more = AWS()->get_settings( 'show_more' );
35
- $ajax_search = AWS()->get_settings( 'enable_ajax' );
36
- $show_page = AWS()->get_settings( 'search_page' );
37
- $show_clear = AWS()->get_settings( 'show_clear' );
38
- $mobile_screen = AWS()->get_settings( 'mobile_overlay' );
39
- $use_analytics = AWS()->get_settings( 'use_analytics' );
40
- $buttons_order = AWS()->get_settings( 'buttons_order' );
41
- $search_timeout = AWS()->get_settings( 'search_timeout' );
 
42
 
43
  $current_lang = AWS_Helpers::get_lang();
44
 
11
  */
12
  class AWS_Markup {
13
 
14
+ /**
15
+ * @var AWS_Markup Array of form parameters $atts
16
+ */
17
+ private $atts;
18
+
19
+ /*
20
+ * Constructor
21
+ */
22
+ public function __construct( $atts = array() ) {
23
+
24
+ $this->atts = $atts;
25
+
26
+ }
27
+
28
  /*
29
  * Generate search box markup
30
  */
41
  return;
42
  }
43
 
44
+ extract( shortcode_atts( array(
45
+ 'placeholder' => AWS_Helpers::translate( 'search_field_text', AWS()->get_settings( 'search_field_text' ) ),
46
+ 'min_chars' => AWS()->get_settings( 'min_chars' ),
47
+ 'show_loader' => AWS()->get_settings( 'show_loader' ),
48
+ 'show_more' => AWS()->get_settings( 'show_more' ),
49
+ 'ajax_search' => AWS()->get_settings( 'enable_ajax' ),
50
+ 'show_page' => AWS()->get_settings( 'search_page' ),
51
+ 'show_clear' => AWS()->get_settings( 'show_clear' ),
52
+ 'mobile_screen' => AWS()->get_settings( 'mobile_overlay' ),
53
+ 'use_analytics' => AWS()->get_settings( 'use_analytics' ),
54
+ 'buttons_order' => AWS()->get_settings( 'buttons_order' ),
55
+ 'search_timeout' => AWS()->get_settings( 'search_timeout' )
56
+ ), $this->atts ) );
57
 
58
  $current_lang = AWS_Helpers::get_lang();
59
 
includes/modules/bb-aws-search/includes/frontend.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- $search_form = aws_get_search_form( false );
4
- $search_form = preg_replace( '/placeholder="([\S\s]*?)"/i', 'placeholder="' . esc_attr( $settings->placeholder ) . '"', $search_form );
5
 
6
  echo $search_form;
1
  <?php
2
 
3
+ $args = $settings->placeholder ? array( 'placeholder' => $settings->placeholder ) : array();
4
+ $search_form = aws_get_search_form( false, $args );
5
 
6
  echo $search_form;
includes/modules/class-aws-wpbakery.php CHANGED
@@ -75,10 +75,8 @@ class AWS_WPBakery extends WPBakeryShortCode {
75
  $output = '';
76
 
77
  if ( function_exists( 'aws_get_search_form' ) ) {
78
- $search_form = aws_get_search_form( false );
79
- if ( $placeholder ) {
80
- $search_form = preg_replace( '/placeholder="([\S\s]*?)"/i', 'placeholder="' . $placeholder . '"', $search_form );
81
- }
82
  $output = '<div class="aws-wpbakery-form ' . $extra_class . '" id="' . $element_id . '" >' . $search_form . '</div>';
83
  }
84
 
75
  $output = '';
76
 
77
  if ( function_exists( 'aws_get_search_form' ) ) {
78
+ $args = $placeholder ? array( 'placeholder' => $placeholder ) : array();
79
+ $search_form = aws_get_search_form( false, $args );
 
 
80
  $output = '<div class="aws-wpbakery-form ' . $extra_class . '" id="' . $element_id . '" >' . $search_form . '</div>';
81
  }
82
 
includes/modules/divi/class-divi-aws-module.php CHANGED
@@ -34,10 +34,8 @@ function aws_divi_register_modules() {
34
 
35
  public function render( $unprocessed_props, $content = null, $render_slug = null ) {
36
  if ( function_exists( 'aws_get_search_form' ) ) {
37
- $search_form = aws_get_search_form( false );
38
- if ( $this->props['placeholder'] ) {
39
- $search_form = preg_replace( '/placeholder="([\S\s]*?)"/i', 'placeholder="' . $this->props['placeholder'] . '"', $search_form );
40
- }
41
  return $search_form;
42
  }
43
  return '';
34
 
35
  public function render( $unprocessed_props, $content = null, $render_slug = null ) {
36
  if ( function_exists( 'aws_get_search_form' ) ) {
37
+ $args = $this->props['placeholder'] ? array( 'placeholder' => $this->props['placeholder'] ) : array();
38
+ $search_form = aws_get_search_form( false, $args );
 
 
39
  return $search_form;
40
  }
41
  return '';
includes/modules/elementor-widget/class-elementor-aws-widget.php CHANGED
@@ -98,10 +98,8 @@ class Elementor_AWS_Widget extends \Elementor\Widget_Base {
98
  $settings = $this->get_settings_for_display();
99
 
100
  if ( function_exists( 'aws_get_search_form' ) ) {
101
- $search_form = aws_get_search_form( false );
102
- if ( $settings['placeholder'] ) {
103
- $search_form = preg_replace( '/placeholder="([\S\s]*?)"/i', 'placeholder="' . $settings['placeholder'] . '"', $search_form );
104
- }
105
  echo $search_form;
106
  }
107
 
98
  $settings = $this->get_settings_for_display();
99
 
100
  if ( function_exists( 'aws_get_search_form' ) ) {
101
+ $args = $settings['placeholder'] ? array( 'placeholder' => $settings['placeholder'] ) : array();
102
+ $search_form = aws_get_search_form( false, $args );
 
 
103
  echo $search_form;
104
  }
105
 
includes/modules/gutenberg/class-aws-gutenberg-init.php CHANGED
@@ -98,12 +98,8 @@ if (!class_exists('AWS_Gutenberg_Init')) :
98
  public function search_block_dynamic_render_callback( $block_attributes, $content ) {
99
 
100
  $placeholder = $block_attributes['placeholder'];
101
- $search_form = aws_get_search_form( false );
102
-
103
- if ( $placeholder ) {
104
- $search_form = preg_replace( '/placeholder="([\S\s]*?)"/i', 'placeholder="' . esc_attr( $placeholder ) . '"', $search_form );
105
-
106
- }
107
 
108
  return $search_form;
109
 
98
  public function search_block_dynamic_render_callback( $block_attributes, $content ) {
99
 
100
  $placeholder = $block_attributes['placeholder'];
101
+ $args = $placeholder ? array( 'placeholder' => $placeholder ) : array();
102
+ $search_form = aws_get_search_form( false, $args );
 
 
 
 
103
 
104
  return $search_form;
105
 
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: 6.0
7
- Stable tag: 2.54
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -167,6 +167,12 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
167
 
168
  == Changelog ==
169
 
 
 
 
 
 
 
170
  = 2.54 ( 2022-05-16 ) =
171
  * Add - Support for Gecko theme
172
  * Update - Tested with WC 6.5
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: 6.0
7
+ Stable tag: 2.55
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
167
 
168
  == Changelog ==
169
 
170
+ = 2.55 ( 2022-05-30 ) =
171
+ * Add - Support for Savoy theme
172
+ * Update - Admin page integration notices
173
+ * Update - Search form shortcode parameters
174
+ * Fix - Issue with search results caching for certain user roles
175
+
176
  = 2.54 ( 2022-05-16 ) =
177
  * Add - Support for Gecko theme
178
  * Update - Tested with WC 6.5