Advanced Woo Search - Version 2.06

Version Description

  • Fix - Search results layout positions
  • Fix - Search results page query
  • Update - Wholesale plugin support. Add categories excluding
  • Dev - Add aws_search_query_string filter
  • Dev - Add aws_image_size filter
Download this release

Release Info

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

Code changes from version 2.05 to 2.06

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.05
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.2.0
12
  */
13
 
14
 
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
16
  exit;
17
  }
18
 
19
- define( 'AWS_VERSION', '2.05' );
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.06
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.3.0
12
  */
13
 
14
 
16
  exit;
17
  }
18
 
19
+ define( 'AWS_VERSION', '2.06' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
assets/js/common.js CHANGED
@@ -325,7 +325,7 @@ AwsHooks.filters = AwsHooks.filters || {};
325
  var offset = self.offset();
326
  var bodyOffset = $('body').offset();
327
  var bodyPosition = $('body').css('position');
328
- var bodyHeight = $('body').height();
329
  var resultsHeight = $resultsBlock.height();
330
 
331
  if ( offset && bodyOffset ) {
@@ -344,7 +344,7 @@ AwsHooks.filters = AwsHooks.filters || {};
344
 
345
  if ( bodyHeight - offset.top < 500 ) {
346
  resultsHeight = methods.getResultsBlockHeight();
347
- if ( bodyHeight - offset.top < resultsHeight ) {
348
  top = top - resultsHeight - $(self).innerHeight();
349
  }
350
  }
325
  var offset = self.offset();
326
  var bodyOffset = $('body').offset();
327
  var bodyPosition = $('body').css('position');
328
+ var bodyHeight = $(document).height();
329
  var resultsHeight = $resultsBlock.height();
330
 
331
  if ( offset && bodyOffset ) {
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
  }
includes/class-aws-integrations.php CHANGED
@@ -959,6 +959,17 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
959
  $all_registered_wholesale_roles = array();
960
  }
961
 
 
 
 
 
 
 
 
 
 
 
 
962
  $new_products_array = array();
963
 
964
  foreach( $products as $product ) {
@@ -975,6 +986,17 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
975
  continue;
976
  }
977
 
 
 
 
 
 
 
 
 
 
 
 
978
  $new_products_array[] = $product;
979
 
980
  }
959
  $all_registered_wholesale_roles = array();
960
  }
961
 
962
+ $product_cat_wholesale_role_filter = get_option( 'wwpp_option_product_cat_wholesale_role_filter' );
963
+ $categories_exclude_list = array();
964
+
965
+ if ( is_array( $product_cat_wholesale_role_filter ) && ! empty( $product_cat_wholesale_role_filter ) && $user_role !== 'administrator' ) {
966
+ foreach( $product_cat_wholesale_role_filter as $term_id => $term_roles ) {
967
+ if ( array_search( $user_role, $term_roles ) === false ) {
968
+ $categories_exclude_list[] = $term_id;
969
+ }
970
+ }
971
+ }
972
+
973
  $new_products_array = array();
974
 
975
  foreach( $products as $product ) {
986
  continue;
987
  }
988
 
989
+ if ( ! empty( $categories_exclude_list ) ) {
990
+ $terms = wp_get_object_terms( $product['id'], 'product_cat' );
991
+ if ( ! is_wp_error( $terms ) && ! empty( $terms ) ) {
992
+ foreach ( $terms as $term ) {
993
+ if ( array_search( $term->term_id, $categories_exclude_list ) !== false ) {
994
+ continue 2;
995
+ }
996
+ }
997
+ }
998
+ }
999
+
1000
  $new_products_array[] = $product;
1001
 
1002
  }
includes/class-aws-search-page.php CHANGED
@@ -95,7 +95,7 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
95
 
96
  $new_posts = array();
97
 
98
- $search_query = $query->query_vars['s'];
99
  $search_res = $this->search( $search_query, $query );
100
  $posts_per_page = apply_filters( 'aws_posts_per_page', $query->get( 'posts_per_page' ) );
101
 
95
 
96
  $new_posts = array();
97
 
98
+ $search_query = $query->query_vars['s'] ? $query->query_vars['s'] : $_GET['s'];
99
  $search_res = $this->search( $search_query, $query );
100
  $posts_per_page = apply_filters( 'aws_posts_per_page', $query->get( 'posts_per_page' ) );
101
 
includes/class-aws-search.php CHANGED
@@ -439,6 +439,13 @@ if ( ! class_exists( 'AWS_Search' ) ) :
439
  LIMIT 0, {$results_num}
440
  ";
441
 
 
 
 
 
 
 
 
442
  $this->data['sql'] = $sql;
443
 
444
  $posts_ids = $this->get_posts_ids( $sql );
@@ -570,9 +577,20 @@ if ( ! class_exists( 'AWS_Search' ) ) :
570
  }
571
 
572
  if ( $show_image === 'true' ) {
 
573
  $image_id = $product->get_image_id();
574
- $image_attributes = wp_get_attachment_image_src( $image_id );
 
 
 
 
 
 
 
 
 
575
  $image = $image_attributes[0];
 
576
  }
577
 
578
  if ( $show_sku === 'true' ) {
439
  LIMIT 0, {$results_num}
440
  ";
441
 
442
+ /**
443
+ * Filter search query string
444
+ * @since 2.06
445
+ * @param array $query Query string
446
+ */
447
+ $sql = apply_filters( 'aws_search_query_string', $sql );
448
+
449
  $this->data['sql'] = $sql;
450
 
451
  $posts_ids = $this->get_posts_ids( $sql );
577
  }
578
 
579
  if ( $show_image === 'true' ) {
580
+
581
  $image_id = $product->get_image_id();
582
+ $image_size = 'thumbnail';
583
+
584
+ /**
585
+ * Filter products images size
586
+ * @since 2.06
587
+ * @param string $image_size Image size
588
+ */
589
+ $image_size = apply_filters( 'aws_image_size', $image_size );
590
+
591
+ $image_attributes = wp_get_attachment_image_src( $image_id, $image_size );
592
  $image = $image_attributes[0];
593
+
594
  }
595
 
596
  if ( $show_sku === 'true' ) {
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.4
7
- Stable tag: 2.05
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -111,6 +111,13 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
111
 
112
  == Changelog ==
113
 
 
 
 
 
 
 
 
114
  = 2.05 =
115
  * Add - Support for Perfect Brands for WooCommerce plugin
116
  * Update - Show ajax block in top if no space at bottom
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.4
7
+ Stable tag: 2.06
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
111
 
112
  == Changelog ==
113
 
114
+ = 2.06 =
115
+ * Fix - Search results layout positions
116
+ * Fix - Search results page query
117
+ * Update - Wholesale plugin support. Add categories excluding
118
+ * Dev - Add aws_search_query_string filter
119
+ * Dev - Add aws_image_size filter
120
+
121
  = 2.05 =
122
  * Add - Support for Perfect Brands for WooCommerce plugin
123
  * Update - Show ajax block in top if no space at bottom