Advanced Woo Search - Version 2.14

Version Description

( 2020-11-02 ) = * Update - Elementor search page support * Update - Divi Builder search page support * Update - Astra theme integration * Update - Storefront theme integration for footer search form

Download this release

Release Info

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

Code changes from version 2.13 to 2.14

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.13
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: advanced-woo-search
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
16
  exit;
17
  }
18
 
19
- define( 'AWS_VERSION', '2.13' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
@@ -92,7 +92,6 @@ final class AWS_Main {
92
  if ( $this->get_settings('seamless') === 'true' ) {
93
  add_filter( 'get_search_form', array( $this, 'markup' ), 999999 );
94
  add_filter( 'get_product_search_form', array( $this, 'markup' ), 999999 );
95
- add_filter( 'astra_get_search_form', array( $this, 'markup' ), 999999 );
96
  }
97
 
98
  }
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
+ Version: 2.14
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: advanced-woo-search
16
  exit;
17
  }
18
 
19
+ define( 'AWS_VERSION', '2.14' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
92
  if ( $this->get_settings('seamless') === 'true' ) {
93
  add_filter( 'get_search_form', array( $this, 'markup' ), 999999 );
94
  add_filter( 'get_product_search_form', array( $this, 'markup' ), 999999 );
 
95
  }
96
 
97
  }
includes/class-aws-integrations.php CHANGED
@@ -129,6 +129,11 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
129
  add_action( 'wp_head', array( $this, 'woodmart_head_action' ) );
130
  }
131
 
 
 
 
 
 
132
  if ( 'Storefront' === $this->current_theme ) {
133
  add_action( 'wp_footer', array( $this, 'storefront_footer_action' ) );
134
  }
@@ -741,41 +746,128 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
741
 
742
  <?php }
743
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
744
  /*
745
  * Storefront theme search form layout
746
  */
747
- public function storefront_footer_action() { ?>
748
- <script>
749
- window.addEventListener('load', function() {
750
- function aws_results_layout( styles, options ) {
 
 
 
 
 
 
751
  if ( typeof jQuery !== 'undefined' ) {
752
- var $storefrontHandheld = options.form.closest('.storefront-handheld-footer-bar');
753
- if ( $storefrontHandheld.length ) {
754
- if ( ! $storefrontHandheld.find('.aws-search-result').length ) {
755
- $storefrontHandheld.append( options.resultsBlock );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
756
  }
757
- styles.top = 'auto';
758
- styles.bottom = 130;
759
  }
 
 
 
 
760
  }
761
- return styles;
 
 
 
 
 
 
 
762
  }
763
- if ( typeof AwsHooks === 'object' && typeof AwsHooks.add_filter === 'function' ) {
764
- AwsHooks.add_filter( 'aws_results_layout', aws_results_layout );
 
765
  }
766
- }, false);
767
- </script>
768
- <style>
769
- .storefront-handheld-footer-bar .aws-search-result ul li {
770
- float: none !important;
771
- display: block !important;
772
- text-align: left !important;
773
- }
774
- .storefront-handheld-footer-bar .aws-search-result ul li a {
775
- text-indent: 0 !important;
776
- text-decoration: none;
777
- }
778
- </style>
779
  <?php }
780
 
781
  /*
129
  add_action( 'wp_head', array( $this, 'woodmart_head_action' ) );
130
  }
131
 
132
+ if ( 'Astra' === $this->current_theme ) {
133
+ add_filter( 'astra_get_search_form', array( $this, 'astra_markup' ), 999999 );
134
+ add_action( 'wp_head', array( $this, 'astra_head_action' ) );
135
+ }
136
+
137
  if ( 'Storefront' === $this->current_theme ) {
138
  add_action( 'wp_footer', array( $this, 'storefront_footer_action' ) );
139
  }
746
 
747
  <?php }
748
 
749
+ /*
750
+ * Astra theme form markup
751
+ */
752
+ public function astra_markup( $output ) {
753
+ if ( function_exists( 'aws_get_search_form' ) && is_string( $output ) ) {
754
+
755
+ $pattern = '/(<form[\s\S]*?<\/form>)/i';
756
+ $form = aws_get_search_form(false);
757
+
758
+ if ( strpos( $output, 'aws-container' ) !== false ) {
759
+ $pattern = '/(<div class="aws-container"[\s\S]*?<form.*?<\/form><\/div>)/i';
760
+ }
761
+
762
+ $output = trim(preg_replace('/\s\s+/', ' ', $output));
763
+ $output = preg_replace( $pattern, $form, $output );
764
+ $output = str_replace( 'aws-container', 'aws-container search-form', $output );
765
+ $output = str_replace( 'aws-search-field', 'aws-search-field search-field', $output );
766
+
767
+ }
768
+ return $output;
769
+ }
770
+
771
+ /*
772
+ * Astra theme
773
+ */
774
+ public function astra_head_action() { ?>
775
+
776
+ <style>
777
+ .ast-search-menu-icon.slide-search .search-form {
778
+ width: auto;
779
+ }
780
+ .ast-search-menu-icon .search-form {
781
+ padding: 0 !important;
782
+ }
783
+ .ast-search-menu-icon.ast-dropdown-active.slide-search .ast-search-icon {
784
+ opacity: 0;
785
+ }
786
+ .ast-search-menu-icon.slide-search .aws-container .aws-search-field {
787
+ width: 0;
788
+ background: #fff;
789
+ border: none;
790
+ }
791
+ .ast-search-menu-icon.ast-dropdown-active.slide-search .aws-search-field {
792
+ width: 235px;
793
+ }
794
+ .ast-search-menu-icon.slide-search .aws-container .aws-search-form .aws-form-btn {
795
+ background: #fff;
796
+ border: none;
797
+ }
798
+ </style>
799
+
800
+ <?php }
801
+
802
  /*
803
  * Storefront theme search form layout
804
  */
805
+ public function storefront_footer_action() {
806
+
807
+ $mobile_screen = AWS()->get_settings( 'mobile_overlay' );
808
+
809
+ ?>
810
+
811
+ <?php if ( $mobile_screen && $mobile_screen === 'true' ): ?>
812
+
813
+ <script>
814
+ window.addEventListener('load', function() {
815
  if ( typeof jQuery !== 'undefined' ) {
816
+ var search = jQuery('.storefront-handheld-footer-bar .search a');
817
+ search.on( 'click', function() {
818
+ var searchForm = jQuery('.storefront-handheld-footer-bar .aws-container');
819
+ searchForm.after('<div class="aws-placement-container"></div>');
820
+ searchForm.addClass('aws-mobile-fixed').prepend('<div class="aws-mobile-fixed-close"><svg width="17" height="17" viewBox="1.5 1.5 21 21"><path d="M22.182 3.856c.522-.554.306-1.394-.234-1.938-.54-.543-1.433-.523-1.826-.135C19.73 2.17 11.955 10 11.955 10S4.225 2.154 3.79 1.783c-.438-.371-1.277-.4-1.81.135-.533.537-.628 1.513-.25 1.938.377.424 8.166 8.218 8.166 8.218s-7.85 7.864-8.166 8.219c-.317.354-.34 1.335.25 1.805.59.47 1.24.455 1.81 0 .568-.456 8.166-7.951 8.166-7.951l8.167 7.86c.747.72 1.504.563 1.96.09.456-.471.609-1.268.1-1.804-.508-.537-8.167-8.219-8.167-8.219s7.645-7.665 8.167-8.218z"></path></svg></div>');
821
+ jQuery('body').addClass('aws-overlay').append('<div class="aws-overlay-mask"></div>').append( searchForm );
822
+ searchForm.find('.aws-search-field').focus();
823
+ } );
824
+ }
825
+ }, false);
826
+ </script>
827
+
828
+ <style>
829
+ .storefront-handheld-footer-bar ul li.search.active .site-search {
830
+ display: none !important;
831
+ }
832
+ </style>
833
+
834
+ <?php else: ?>
835
+
836
+ <script>
837
+ window.addEventListener('load', function() {
838
+ function aws_results_layout( styles, options ) {
839
+ if ( typeof jQuery !== 'undefined' ) {
840
+ var $storefrontHandheld = options.form.closest('.storefront-handheld-footer-bar');
841
+ if ( $storefrontHandheld.length ) {
842
+ if ( ! $storefrontHandheld.find('.aws-search-result').length ) {
843
+ $storefrontHandheld.append( options.resultsBlock );
844
+ }
845
+ styles.top = 'auto';
846
+ styles.bottom = 130;
847
  }
 
 
848
  }
849
+ return styles;
850
+ }
851
+ if ( typeof AwsHooks === 'object' && typeof AwsHooks.add_filter === 'function' ) {
852
+ AwsHooks.add_filter( 'aws_results_layout', aws_results_layout );
853
  }
854
+ }, false);
855
+ </script>
856
+
857
+ <style>
858
+ .storefront-handheld-footer-bar .aws-search-result ul li {
859
+ float: none !important;
860
+ display: block !important;
861
+ text-align: left !important;
862
  }
863
+ .storefront-handheld-footer-bar .aws-search-result ul li a {
864
+ text-indent: 0 !important;
865
+ text-decoration: none;
866
  }
867
+ </style>
868
+
869
+ <?php endif; ?>
870
+
 
 
 
 
 
 
 
 
 
871
  <?php }
872
 
873
  /*
includes/class-aws-search-page.php CHANGED
@@ -187,7 +187,9 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
187
  */
188
  public function posts_pre_query( $posts, $query ) {
189
 
190
- if ( isset( $_GET['type_aws'] ) && isset( $query->query_vars['s'] ) && $query->query && isset( $query->query['fields'] ) && $query->query['fields'] == 'ids' &&
 
 
191
  ( ( isset( $this->data['is_elementor'] ) && $this->data['is_elementor'] ) || ( isset( $this->data['is_divi_s_page'] ) && $this->data['is_divi_s_page'] ) )
192
  )
193
  {
@@ -313,8 +315,9 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
313
  */
314
  public function filter_found_posts( $found_posts, $query ) {
315
 
316
- // Elementor search template fix
317
- if ( isset( $_GET['type_aws'] ) && isset( $this->data['all_products'] ) && $this->data['all_products'] && isset( $query->query_vars['nopaging'] ) && ! $query->query_vars['nopaging'] &&
 
318
  ( ( isset( $this->data['is_elementor'] ) && $this->data['is_elementor'] ) || ( isset( $this->data['is_divi_s_page'] ) && $this->data['is_divi_s_page'] ) )
319
  ) {
320
  $found_posts = count( $this->data['all_products'] );
187
  */
188
  public function posts_pre_query( $posts, $query ) {
189
 
190
+ $post_type_product = ( $query->get( 'post_type' ) && is_string( $query->get( 'post_type' ) ) && $query->get( 'post_type' ) === 'product' ) ? true : false;
191
+
192
+ if ( $post_type_product && isset( $_GET['type_aws'] ) && isset( $query->query_vars['s'] ) && $query->query && isset( $query->query['fields'] ) && $query->query['fields'] == 'ids' &&
193
  ( ( isset( $this->data['is_elementor'] ) && $this->data['is_elementor'] ) || ( isset( $this->data['is_divi_s_page'] ) && $this->data['is_divi_s_page'] ) )
194
  )
195
  {
315
  */
316
  public function filter_found_posts( $found_posts, $query ) {
317
 
318
+ $post_type_product = ( $query->get( 'post_type' ) && is_string( $query->get( 'post_type' ) ) && $query->get( 'post_type' ) === 'product' ) ? true : false;
319
+
320
+ if ( $post_type_product && isset( $_GET['type_aws'] ) && isset( $this->data['all_products'] ) && $this->data['all_products'] && isset( $query->query_vars['nopaging'] ) && ! $query->query_vars['nopaging'] &&
321
  ( ( isset( $this->data['is_elementor'] ) && $this->data['is_elementor'] ) || ( isset( $this->data['is_divi_s_page'] ) && $this->data['is_divi_s_page'] ) )
322
  ) {
323
  $found_posts = count( $this->data['all_products'] );
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.5
7
- Stable tag: 2.13
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -111,6 +111,12 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
111
 
112
  == Changelog ==
113
 
 
 
 
 
 
 
114
  = 2.13 ( 2020-10-19 ) =
115
  * Add - FacetWP plugin integration. [Read more](https://advanced-woo-search.com/guide/facetwp/)
116
  * Add - Support for 'Product Visibility by User Role for WooCommerce' plugin. [Read more](https://advanced-woo-search.com/guide/product-visibility-by-user-role-for-woocommerce/)
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.5
7
+ Stable tag: 2.14
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
111
 
112
  == Changelog ==
113
 
114
+ = 2.14 ( 2020-11-02 ) =
115
+ * Update - Elementor search page support
116
+ * Update - Divi Builder search page support
117
+ * Update - Astra theme integration
118
+ * Update - Storefront theme integration for footer search form
119
+
120
  = 2.13 ( 2020-10-19 ) =
121
  * Add - FacetWP plugin integration. [Read more](https://advanced-woo-search.com/guide/facetwp/)
122
  * Add - Support for 'Product Visibility by User Role for WooCommerce' plugin. [Read more](https://advanced-woo-search.com/guide/product-visibility-by-user-role-for-woocommerce/)