Advanced Woo Search - Version 2.10

Version Description

( 2020-09-07 ) = * Update - Storefront theme integration * Fix - Search results page output * Dev - Add aws_results_layout js filter

Download this release

Release Info

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

Code changes from version 2.09 to 2.10

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.09
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.09' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
+ Version: 2.10
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.10' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
assets/js/common.js CHANGED
@@ -330,30 +330,31 @@ AwsHooks.filters = AwsHooks.filters || {};
330
 
331
  if ( offset && bodyOffset ) {
332
 
333
- var width = self.outerWidth();
334
- var top = 0;
335
- var left = 0;
 
 
336
 
337
  if ( bodyPosition === 'relative' || bodyPosition === 'absolute' || bodyPosition === 'fixed' ) {
338
- top = offset.top + $(self).innerHeight() - bodyOffset.top;
339
- left = offset.left - bodyOffset.left;
340
  } else {
341
- top = offset.top + $(self).innerHeight();
342
- left = offset.left;
343
  }
344
 
345
  if ( bodyHeight - offset.top < 500 ) {
346
  resultsHeight = methods.getResultsBlockHeight();
347
  if ( ( bodyHeight - offset.top < resultsHeight ) && ( offset.top >= resultsHeight ) ) {
348
- top = top - resultsHeight - $(self).innerHeight();
349
  }
350
  }
351
 
352
- $resultsBlock.css({
353
- width : width,
354
- top : top,
355
- left: left
356
- });
357
 
358
  }
359
 
330
 
331
  if ( offset && bodyOffset ) {
332
 
333
+ var styles = {
334
+ width: self.outerWidth(),
335
+ top : 0,
336
+ left: 0
337
+ };
338
 
339
  if ( bodyPosition === 'relative' || bodyPosition === 'absolute' || bodyPosition === 'fixed' ) {
340
+ styles.top = offset.top + $(self).innerHeight() - bodyOffset.top;
341
+ styles.left = offset.left - bodyOffset.left;
342
  } else {
343
+ styles.top = offset.top + $(self).innerHeight();
344
+ styles.left = offset.left;
345
  }
346
 
347
  if ( bodyHeight - offset.top < 500 ) {
348
  resultsHeight = methods.getResultsBlockHeight();
349
  if ( ( bodyHeight - offset.top < resultsHeight ) && ( offset.top >= resultsHeight ) ) {
350
+ styles.top = styles.top - resultsHeight - $(self).innerHeight();
351
  }
352
  }
353
 
354
+ // @since 2.10
355
+ styles = AwsHooks.apply_filters( 'aws_results_layout', styles, { resultsBlock: $resultsBlock, form: self } );
356
+
357
+ $resultsBlock.css( styles );
 
358
 
359
  }
360
 
includes/class-aws-integrations.php CHANGED
@@ -129,6 +129,10 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
129
  add_action( 'wp_head', array( $this, 'woodmart_head_action' ) );
130
  }
131
 
 
 
 
 
132
  // Elementor pro
133
  if ( defined( 'ELEMENTOR_PRO_VERSION' ) ) {
134
  add_action( 'wp_footer', array( $this, 'elementor_pro_popup' ) );
@@ -706,6 +710,43 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
706
 
707
  <?php }
708
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
709
  /*
710
  * Elementor popup search form init
711
  */
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
+ }
135
+
136
  // Elementor pro
137
  if ( defined( 'ELEMENTOR_PRO_VERSION' ) ) {
138
  add_action( 'wp_footer', array( $this, 'elementor_pro_popup' ) );
710
 
711
  <?php }
712
 
713
+ /*
714
+ * Storefront theme search form layout
715
+ */
716
+ public function storefront_footer_action() { ?>
717
+ <script>
718
+ window.addEventListener('load', function() {
719
+ function aws_results_layout( styles, options ) {
720
+ if ( typeof jQuery !== 'undefined' ) {
721
+ var $storefrontHandheld = options.form.closest('.storefront-handheld-footer-bar');
722
+ if ( $storefrontHandheld.length ) {
723
+ if ( ! $storefrontHandheld.find('.aws-search-result').length ) {
724
+ $storefrontHandheld.append( options.resultsBlock );
725
+ }
726
+ styles.top = 'auto';
727
+ styles.bottom = 130;
728
+ }
729
+ }
730
+ return styles;
731
+ }
732
+ if ( typeof AwsHooks === 'object' && typeof AwsHooks.add_filter === 'function' ) {
733
+ AwsHooks.add_filter( 'aws_results_layout', aws_results_layout );
734
+ }
735
+ }, false);
736
+ </script>
737
+ <style>
738
+ .storefront-handheld-footer-bar .aws-search-result ul li {
739
+ float: none !important;
740
+ display: block !important;
741
+ text-align: left !important;
742
+ }
743
+ .storefront-handheld-footer-bar .aws-search-result ul li a {
744
+ text-indent: 0 !important;
745
+ text-decoration: none;
746
+ }
747
+ </style>
748
+ <?php }
749
+
750
  /*
751
  * Elementor popup search form init
752
  */
includes/class-aws-search-page.php CHANGED
@@ -108,7 +108,7 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
108
  $post_array = (array) $post_array;
109
  $post_data = $post_array['post_data'];
110
 
111
- $post->ID = $post_data->ID;
112
  $post->site_id = get_current_blog_id();
113
 
114
  if ( ! empty( $post_data->site_id ) ) {
@@ -273,6 +273,8 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
273
 
274
  }
275
 
 
 
276
  }
277
 
278
  /**
108
  $post_array = (array) $post_array;
109
  $post_data = $post_array['post_data'];
110
 
111
+ $post->ID = ( isset( $post_array['parent_id'] ) && $post_array['parent_id'] ) ? $post_array['parent_id'] : $post_data->ID;
112
  $post->site_id = get_current_blog_id();
113
 
114
  if ( ! empty( $post_data->site_id ) ) {
273
 
274
  }
275
 
276
+ $query->set( 'aws_query', true );
277
+
278
  }
279
 
280
  /**
includes/class-aws-search.php CHANGED
@@ -518,6 +518,7 @@ if ( ! class_exists( 'AWS_Search' ) ) :
518
  }
519
 
520
  $post_id = method_exists( $product, 'get_id' ) ? $product->get_id() : $post_item;
 
521
 
522
  /**
523
  * Filter additional product data
@@ -644,6 +645,7 @@ if ( ! class_exists( 'AWS_Search' ) ) :
644
 
645
  $new_result = array(
646
  'id' => $post_id,
 
647
  'title' => $title,
648
  'excerpt' => $excerpt,
649
  'link' => get_permalink( $post_id ),
518
  }
519
 
520
  $post_id = method_exists( $product, 'get_id' ) ? $product->get_id() : $post_item;
521
+ $parent_id = $product->is_type( 'variation' ) && method_exists( $product, 'get_parent_id' ) ? $product->get_parent_id() : $post_id;
522
 
523
  /**
524
  * Filter additional product data
645
 
646
  $new_result = array(
647
  'id' => $post_id,
648
+ 'parent_id' => $parent_id,
649
  'title' => $title,
650
  'excerpt' => $excerpt,
651
  'link' => get_permalink( $post_id ),
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.09
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -111,6 +111,11 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
111
 
112
  == Changelog ==
113
 
 
 
 
 
 
114
  = 2.09 ( 2020-08-23 ) =
115
  * Update - Support for latest WooCommerce version
116
  * Update - AJAX request fix
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.10
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
111
 
112
  == Changelog ==
113
 
114
+ = 2.10 ( 2020-09-07 ) =
115
+ * Update - Storefront theme integration
116
+ * Fix - Search results page output
117
+ * Dev - Add aws_results_layout js filter
118
+
119
  = 2.09 ( 2020-08-23 ) =
120
  * Update - Support for latest WooCommerce version
121
  * Update - AJAX request fix