Advanced Woo Search - Version 1.66

Version Description

  • Update search page support
Download this release

Release Info

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

Code changes from version 1.65 to 1.66

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: 1.65
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: aws
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
16
  exit;
17
  }
18
 
19
- define( 'AWS_VERSION', '1.65' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
+ Version: 1.66
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: aws
16
  exit;
17
  }
18
 
19
+ define( 'AWS_VERSION', '1.66' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
includes/class-aws-search-page.php CHANGED
@@ -249,10 +249,14 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
249
  */
250
  private function aws_searchpage_enabled( $query ) {
251
  $enabled = true;
 
 
 
 
252
  if ( ( isset( $query->query_vars['s'] ) && ! isset( $_GET['type_aws'] ) ) ||
253
  ! isset( $query->query_vars['s'] ) ||
254
  ! $query->is_search() ||
255
- ( $query->get( 'post_type' ) && is_string( $query->get( 'post_type' ) ) && $query->get( 'post_type' ) !== 'product' )
256
  ) {
257
  $enabled = false;
258
  }
249
  */
250
  private function aws_searchpage_enabled( $query ) {
251
  $enabled = true;
252
+
253
+ $post_type_product = ( $query->get( 'post_type' ) && is_string( $query->get( 'post_type' ) ) && $query->get( 'post_type' ) === 'product' ) ? true :
254
+ ( ( isset( $_GET['post_type'] ) && $_GET['post_type'] === 'product' ) ? true : false );
255
+
256
  if ( ( isset( $query->query_vars['s'] ) && ! isset( $_GET['type_aws'] ) ) ||
257
  ! isset( $query->query_vars['s'] ) ||
258
  ! $query->is_search() ||
259
+ ! $post_type_product
260
  ) {
261
  $enabled = false;
262
  }
includes/class-aws-search.php CHANGED
@@ -412,7 +412,7 @@ if ( ! class_exists( 'AWS_Search' ) ) :
412
  FROM
413
  {$table_name}
414
  WHERE
415
- type = 'product'
416
  {$query['source']}
417
  {$query['search']}
418
  {$query['stock']}
412
  FROM
413
  {$table_name}
414
  WHERE
415
+ 1=1
416
  {$query['source']}
417
  {$query['search']}
418
  {$query['stock']}
includes/class-aws-table.php CHANGED
@@ -312,9 +312,9 @@ if ( ! class_exists( 'AWS_Table' ) ) :
312
  }
313
 
314
 
315
- $data['in_stock'] = method_exists( $product, 'get_stock_status' ) ? ( ( $product->get_stock_status() === 'outofstock' ) ? 0 : 1 ) : ( method_exists( $product, 'is_in_stock' ) ? $product->is_in_stock() : 1 );
316
  $data['on_sale'] = $product->is_on_sale();
317
- $data['visibility'] = method_exists( $product, 'get_catalog_visibility' ) ? $product->get_catalog_visibility() : ( method_exists( $product, 'get_visibility' ) ? $product->get_visibility() : 'visible' );
318
  $data['lang'] = $lang ? $lang : '';
319
 
320
  $sku = $product->get_sku();
@@ -652,6 +652,10 @@ if ( ! class_exists( 'AWS_Table' ) ) :
652
  return;
653
  }
654
 
 
 
 
 
655
  $this->update_table( $post_id );
656
 
657
  }
@@ -716,7 +720,9 @@ if ( ! class_exists( 'AWS_Table' ) ) :
716
  'lang' => ''
717
  ) );
718
 
719
- $this->fill_table( $posts );
 
 
720
 
721
  do_action('aws_cache_clear');
722
 
@@ -862,6 +868,44 @@ if ( ! class_exists( 'AWS_Table' ) ) :
862
 
863
  }
864
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
865
  }
866
 
867
  endif;
312
  }
313
 
314
 
315
+ $data['in_stock'] = $this->get_stock_status( $product );
316
  $data['on_sale'] = $product->is_on_sale();
317
+ $data['visibility'] = $this->get_visibility( $product );
318
  $data['lang'] = $lang ? $lang : '';
319
 
320
  $sku = $product->get_sku();
652
  return;
653
  }
654
 
655
+ if ( wp_is_post_revision( $post_id ) ) {
656
+ return;
657
+ }
658
+
659
  $this->update_table( $post_id );
660
 
661
  }
720
  'lang' => ''
721
  ) );
722
 
723
+ if ( $posts ) {
724
+ $this->fill_table( $posts );
725
+ }
726
 
727
  do_action('aws_cache_clear');
728
 
868
 
869
  }
870
 
871
+ /*
872
+ * Get product stock status
873
+ *
874
+ * @return bool
875
+ */
876
+ private function get_stock_status( $product ) {
877
+
878
+ $stock_status = 1;
879
+
880
+ if ( method_exists( $product, 'get_stock_status' ) ) {
881
+ $stock_status = $product->get_stock_status() === 'outofstock' ? 0 : 1;
882
+ } elseif ( method_exists( $product, 'is_in_stock' ) ) {
883
+ $stock_status = $product->is_in_stock();
884
+ }
885
+
886
+ return $stock_status;
887
+
888
+ }
889
+
890
+ /*
891
+ * Get product visibility
892
+ *
893
+ * @return bool
894
+ */
895
+ private function get_visibility( $product ) {
896
+
897
+ $visibility = 'visible';
898
+
899
+ if ( method_exists( $product, 'get_catalog_visibility' ) ) {
900
+ $visibility = $product->get_catalog_visibility();
901
+ } elseif ( method_exists( $product, 'get_visibility' ) ) {
902
+ $visibility = $product->get_visibility();
903
+ }
904
+
905
+ return $visibility;
906
+
907
+ }
908
+
909
  }
910
 
911
  endif;
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.1
7
- Stable tag: 1.65
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -48,6 +48,7 @@ Additional features available only in PRO plugin version.
48
  * Search **form layouts**
49
  * **Filters**. Switch between tabs to show different search results
50
  * **Unlimited** amount of search form instances
 
51
  * Product **attributes** search ( including custom attributes)
52
  * Product **custom taxonomies** search
53
  * Product **custom fields** search
@@ -55,7 +56,7 @@ Additional features available only in PRO plugin version.
55
  * **Exclude/include** spicific products by its ids, taxonomies or attributes from search results
56
  * Ability to specify **source of image** for search results: featured image, gallery, product content, product short description or set default image if there is no other images
57
  * **Visibility/stock status option** - choose what catalog visibility and stock status must be for product to displayed in search results
58
- * Show product **categories** and **variations** in search results
59
  * AND or OR search logic
60
  * **Add to cart** button in search results
61
  * Support for [WooCommerce Brands plugin](https://woocommerce.com/products/brands/)
@@ -101,6 +102,9 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
101
 
102
  == Changelog ==
103
 
 
 
 
104
  = 1.65 =
105
  * Fix YITH WooCommerce Ajax Product Filter plugin support
106
 
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.1
7
+ Stable tag: 1.66
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
48
  * Search **form layouts**
49
  * **Filters**. Switch between tabs to show different search results
50
  * **Unlimited** amount of search form instances
51
+ * Support for **variable products**: show child products, parent product or both in search results.
52
  * Product **attributes** search ( including custom attributes)
53
  * Product **custom taxonomies** search
54
  * Product **custom fields** search
56
  * **Exclude/include** spicific products by its ids, taxonomies or attributes from search results
57
  * Ability to specify **source of image** for search results: featured image, gallery, product content, product short description or set default image if there is no other images
58
  * **Visibility/stock status option** - choose what catalog visibility and stock status must be for product to displayed in search results
59
+ * Show product **categories** and **tags** in search results
60
  * AND or OR search logic
61
  * **Add to cart** button in search results
62
  * Support for [WooCommerce Brands plugin](https://woocommerce.com/products/brands/)
102
 
103
  == Changelog ==
104
 
105
+ = 1.66 =
106
+ * Update search page support
107
+
108
  = 1.65 =
109
  * Fix YITH WooCommerce Ajax Product Filter plugin support
110