Advanced Woo Search - Version 2.20

Version Description

( 2021-02-02 ) = * Add - Beaver Builder plugin support * Update - Integration for Electro theme * Update - Porto theme integration * Fix - Hide 'Show all results' button if search results page is disabled * Fix - Scrolling for search results inside pop-ups via 'Popups for Divi' plugin

Download this release

Release Info

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

Code changes from version 2.19 to 2.20

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.19
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: 4.8.0
12
  */
13
 
14
 
@@ -80,7 +80,7 @@ final class AWS_Main {
80
 
81
  $this->includes();
82
 
83
- add_action( 'init', array( $this, 'init' ), 0 );
84
 
85
  add_filter( 'wcml_multi_currency_ajax_actions', array( $this, 'add_wpml_ajax_actions' ) );
86
 
@@ -96,7 +96,7 @@ final class AWS_Main {
96
  */
97
  private function define_constants() {
98
 
99
- $this->define( 'AWS_VERSION', '2.19' );
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.20
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: 4.9.0
12
  */
13
 
14
 
80
 
81
  $this->includes();
82
 
83
+ add_action( 'init', array( $this, 'init' ), 1 );
84
 
85
  add_filter( 'wcml_multi_currency_ajax_actions', array( $this, 'add_wpml_ajax_actions' ) );
86
 
96
  */
97
  private function define_constants() {
98
 
99
+ $this->define( 'AWS_VERSION', '2.20' );
100
 
101
  $this->define( 'AWS_DIR', plugin_dir_path( AWS_FILE ) );
102
  $this->define( 'AWS_URL', plugin_dir_url( AWS_FILE ) );
assets/js/common.js CHANGED
@@ -245,7 +245,7 @@ AwsHooks.filters = AwsHooks.filters || {};
245
 
246
  });
247
 
248
- if ( d.showMore ) {
249
  html += '<li class="aws_result_item aws_search_more"><a href="#">' + translate.showmore + '</a></li>';
250
  }
251
 
245
 
246
  });
247
 
248
+ if ( d.showMore && d.showPage ) {
249
  html += '<li class="aws_result_item aws_search_more"><a href="#">' + translate.showmore + '</a></li>';
250
  }
251
 
includes/class-aws-integrations.php CHANGED
@@ -88,9 +88,6 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
88
  add_action( 'wp_head', array( $this, 'myashop_head_action' ) );
89
  }
90
 
91
- // Porto theme
92
- add_filter( 'porto_search_form_content', array( $this, 'porto_search_form_content_filter' ) );
93
-
94
  add_filter( 'aws_terms_exclude_product_cat', array( $this, 'filter_protected_cats_term_exclude' ) );
95
  add_filter( 'aws_exclude_products', array( $this, 'filter_products_exclude' ) );
96
 
@@ -146,6 +143,11 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
146
  add_action( 'wp_head', array( $this, 'walker_head_action' ) );
147
  }
148
 
 
 
 
 
 
149
  }
150
 
151
  add_action( 'wp_head', array( $this, 'head_js_integration' ) );
@@ -200,6 +202,10 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
200
  add_filter( 'post_class', array( $this, 'avada_post_class' ) );
201
  }
202
 
 
 
 
 
203
  // FacetWP plugin
204
  if ( class_exists( 'FacetWP' ) ) {
205
  add_filter( 'facetwp_filtered_post_ids', array( $this, 'facetwp_filtered_post_ids' ), 1 );
@@ -223,6 +229,11 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
223
  add_filter( 'aws_indexed_data', array( $this, 'atum_index_data' ), 10, 2 );
224
  }
225
 
 
 
 
 
 
226
  }
227
 
228
  /**
@@ -240,6 +251,11 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
240
  include_once( AWS_DIR . '/includes/modules/divi/class-divi-aws-module.php' );
241
  }
242
 
 
 
 
 
 
243
  // WCFM - WooCommerce Multivendor Marketplace
244
  if ( class_exists( 'WCFMmp' ) ) {
245
  include_once( AWS_DIR . '/includes/modules/class-aws-wcfm.php' );
@@ -938,16 +954,35 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
938
  * Porto theme seamless integration
939
  */
940
  public function porto_search_form_content_filter( $markup ) {
941
-
942
- if ( AWS()->get_settings('seamless') === 'true' ) {
943
- $pattern = '/(<form[\S\s]*?<\/form>)/i';
944
  $markup = preg_replace( $pattern, aws_get_search_form( false ), $markup );
945
  }
946
-
947
  return $markup;
948
-
949
  }
950
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
951
  /*
952
  * Exclude product categories
953
  */
@@ -1459,6 +1494,15 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
1459
  return $classes;
1460
  }
1461
 
 
 
 
 
 
 
 
 
 
1462
  /*
1463
  * FacetWP check for active filters
1464
  */
@@ -1601,6 +1645,34 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
1601
  return $data;
1602
  }
1603
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1604
  }
1605
 
1606
  endif;
88
  add_action( 'wp_head', array( $this, 'myashop_head_action' ) );
89
  }
90
 
 
 
 
91
  add_filter( 'aws_terms_exclude_product_cat', array( $this, 'filter_protected_cats_term_exclude' ) );
92
  add_filter( 'aws_exclude_products', array( $this, 'filter_products_exclude' ) );
93
 
143
  add_action( 'wp_head', array( $this, 'walker_head_action' ) );
144
  }
145
 
146
+ if ( 'Porto' === $this->current_theme ) {
147
+ add_filter( 'porto_search_form_content', array( $this, 'porto_search_form_content_filter' ) );
148
+ add_action( 'wp_head', array( $this, 'porto_head_action' ) );
149
+ }
150
+
151
  }
152
 
153
  add_action( 'wp_head', array( $this, 'head_js_integration' ) );
202
  add_filter( 'post_class', array( $this, 'avada_post_class' ) );
203
  }
204
 
205
+ if ( 'Electro' === $this->current_theme ) {
206
+ add_filter( 'aws_searchbox_markup', array( $this, 'electro_searchbox_markup' ), 1, 2 );
207
+ }
208
+
209
  // FacetWP plugin
210
  if ( class_exists( 'FacetWP' ) ) {
211
  add_filter( 'facetwp_filtered_post_ids', array( $this, 'facetwp_filtered_post_ids' ), 1 );
229
  add_filter( 'aws_indexed_data', array( $this, 'atum_index_data' ), 10, 2 );
230
  }
231
 
232
+ // Popups for Divi plugin
233
+ if ( defined( 'DIVI_POPUP_PLUGIN' ) ) {
234
+ add_action( 'wp_enqueue_scripts', array( $this, 'divi_popups_enqueue_scripts' ), 999 );
235
+ }
236
+
237
  }
238
 
239
  /**
251
  include_once( AWS_DIR . '/includes/modules/divi/class-divi-aws-module.php' );
252
  }
253
 
254
+ // Beaver builder module
255
+ if ( class_exists( 'FLBuilder' ) ) {
256
+ include_once( AWS_DIR . '/includes/modules/bb-aws-search/class-aws-bb-module.php' );
257
+ }
258
+
259
  // WCFM - WooCommerce Multivendor Marketplace
260
  if ( class_exists( 'WCFMmp' ) ) {
261
  include_once( AWS_DIR . '/includes/modules/class-aws-wcfm.php' );
954
  * Porto theme seamless integration
955
  */
956
  public function porto_search_form_content_filter( $markup ) {
957
+ $pattern = '/(<form[\S\s]*?<\/form>)/i';
958
+ if ( strpos( $markup, 'aws-container' ) === false ) {
 
959
  $markup = preg_replace( $pattern, aws_get_search_form( false ), $markup );
960
  }
961
+ $markup = str_replace( 'aws-container', 'aws-container searchform', $markup );
962
  return $markup;
 
963
  }
964
 
965
+ /*
966
+ * Porto theme styles
967
+ */
968
+ public function porto_head_action() { ?>
969
+
970
+ <style>
971
+ #header .aws-container .aws-search-field {
972
+ border: 1px solid #eeeeee !important;
973
+ height: 100%;
974
+ }
975
+ #header .aws-container .aws-search-form {
976
+ height: 36px;
977
+ }
978
+ #header .aws-container .aws-search-form .aws-form-btn {
979
+ background: #fff;
980
+ border-color: #eeeeee;
981
+ }
982
+ </style>
983
+
984
+ <?php }
985
+
986
  /*
987
  * Exclude product categories
988
  */
1494
  return $classes;
1495
  }
1496
 
1497
+ /*
1498
+ * Electro them update search form markup
1499
+ */
1500
+ public function electro_searchbox_markup( $markup, $params ) {
1501
+ $pattern = '/<div class="aws-search-btn aws-form-btn">[\S\s]*?<\/div>/i';
1502
+ $markup = preg_replace( $pattern, '', $markup );
1503
+ return $markup;
1504
+ }
1505
+
1506
  /*
1507
  * FacetWP check for active filters
1508
  */
1645
  return $data;
1646
  }
1647
 
1648
+ /*
1649
+ * Popups for Divi plugin fix scrolling for search results
1650
+ */
1651
+ function divi_popups_enqueue_scripts() {
1652
+
1653
+ $script = "
1654
+ if ( typeof DiviArea === 'object' ) {
1655
+ DiviArea.addAction('disabled_scrolling', function() {
1656
+ var aws_form = jQuery('[data-da-area] .aws-search-form');
1657
+ if ( aws_form.length > 0 ) {
1658
+ DiviArea.Core.enableBodyScroll();
1659
+ jQuery('body').addClass('da-overlay-visible');
1660
+ }
1661
+ });
1662
+ DiviArea.addAction('close_area', function() {
1663
+ var aws_form = jQuery('[data-da-area] .aws-search-form');
1664
+ if ( aws_form.length > 0 ) {
1665
+ jQuery('body').removeClass('da-overlay-visible');
1666
+ jQuery('.aws-search-result').hide();
1667
+ }
1668
+ });
1669
+ }
1670
+ ";
1671
+
1672
+ wp_add_inline_script( 'aws-script', $script );
1673
+
1674
+ }
1675
+
1676
  }
1677
 
1678
  endif;
includes/modules/bb-aws-search/class-aws-bb-module.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AwsSearchModule extends FLBuilderModule {
4
+
5
+ public function __construct() {
6
+
7
+ parent::__construct(array(
8
+ 'name' => __( 'Advanced Woo Search', 'advanced-woo-search' ),
9
+ 'description' => __( 'WooCommerce search form', 'advanced-woo-search' ),
10
+ 'category' => __( 'WooCommerce', 'fl-builder' ),
11
+ 'dir' => AWS_DIR . '/includes/modules/bb-aws-search/',
12
+ 'url' => AWS_URL . '/includes/modules/bb-aws-search/',
13
+ 'icon' => 'search.svg',
14
+ 'partial_refresh' => true,
15
+ ));
16
+
17
+ }
18
+
19
+ }
20
+
21
+ $placeholder = AWS_Helpers::translate( 'search_field_text', AWS()->get_settings( 'search_field_text' ) );
22
+
23
+ FLBuilder::register_module( 'AwsSearchModule', array(
24
+ 'general' => array(
25
+ 'title' => __( 'General', 'advanced-woo-search' ),
26
+ 'sections' => array(
27
+ 'general' => array(
28
+ 'title' => '',
29
+ 'fields' => array(
30
+ 'placeholder' => array(
31
+ 'type' => 'text',
32
+ 'label' => __( 'Placeholder', 'advanced-woo-search' ),
33
+ 'default' => $placeholder,
34
+ 'preview' => array(
35
+ 'type' => 'text',
36
+ 'selector' => '.fl-heading-text',
37
+ ),
38
+ 'connections' => array( 'string' ),
39
+ ),
40
+ ),
41
+ ),
42
+ ),
43
+ 'description' => sprintf( esc_html__( 'To configure your Advanced Woo Search form please visit %s.', 'advanced-woo-search' ), '<a target="_blank" href="'.esc_url( admin_url('admin.php?page=aws-options') ).'">'.esc_html__( 'plugin settings page', 'advanced-woo-search' ).'</a>' ),
44
+ ),
45
+ ) );
includes/modules/bb-aws-search/includes/frontend.php ADDED
@@ -0,0 +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;
languages/advanced-woo-search.pot CHANGED
@@ -681,4 +681,13 @@ msgid "Features"
681
  msgstr ""
682
 
683
  msgid "Pricing"
 
 
 
 
 
 
 
 
 
684
  msgstr ""
681
  msgstr ""
682
 
683
  msgid "Pricing"
684
+ msgstr ""
685
+
686
+ msgid "WooCommerce search form"
687
+ msgstr ""
688
+
689
+ msgid "To configure your Advanced Woo Search form please visit %s."
690
+ msgstr ""
691
+
692
+ msgid "plugin settings page"
693
  msgstr ""
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.6
7
- Stable tag: 2.19
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -166,6 +166,13 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
166
 
167
  == Changelog ==
168
 
 
 
 
 
 
 
 
169
  = 2.19 ( 2021-01-18 ) =
170
  * Add - Support for WooCommerce Product Filter by WooBeWoo plugin
171
  * Add - Integration for Martfury 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.6
7
+ Stable tag: 2.20
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
166
 
167
  == Changelog ==
168
 
169
+ = 2.20 ( 2021-02-02 ) =
170
+ * Add - Beaver Builder plugin support
171
+ * Update - Integration for Electro theme
172
+ * Update - Porto theme integration
173
+ * Fix - Hide 'Show all results' button if search results page is disabled
174
+ * Fix - Scrolling for search results inside pop-ups via 'Popups for Divi' plugin
175
+
176
  = 2.19 ( 2021-01-18 ) =
177
  * Add - Support for WooCommerce Product Filter by WooBeWoo plugin
178
  * Add - Integration for Martfury theme