Advanced Woo Search - Version 1.94

Version Description

  • Update - Ajax function
  • Update - Twenty Twenty theme integration
  • Update - Default settings values. Enable search page support by default
  • Fix - WP AutoTerms plugin conflict
  • Fix - Elementor plugin search page template
  • Fix - Visibility get function for old WooCommerce versions
Download this release

Release Info

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

Code changes from version 1.93 to 1.94

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.93
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', '1.93' );
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.94
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', '1.94' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
assets/js/common.js CHANGED
@@ -86,10 +86,9 @@
86
  type: 'POST',
87
  url: ajaxUrl,
88
  data: data,
 
89
  success: function( response ) {
90
 
91
- var response = $.parseJSON( response );
92
-
93
  cachedResponse[searchFor] = response;
94
 
95
  methods.showResults( response );
86
  type: 'POST',
87
  url: ajaxUrl,
88
  data: data,
89
+ dataType: 'json',
90
  success: function( response ) {
91
 
 
 
92
  cachedResponse[searchFor] = response;
93
 
94
  methods.showResults( response );
includes/admin/class-aws-admin-options.php CHANGED
@@ -311,7 +311,7 @@ if ( ! class_exists( 'AWS_Admin_Options' ) ) :
311
  "name" => __( "Show 'View All Results'", "advanced-woo-search" ),
312
  "desc" => __( "Show link to search results page at the bottom of search results block.", "advanced-woo-search" ),
313
  "id" => "show_more",
314
- "value" => 'false',
315
  "type" => "radio",
316
  'choices' => array(
317
  'true' => __( 'On', 'advanced-woo-search' ),
@@ -323,7 +323,7 @@ if ( ! class_exists( 'AWS_Admin_Options' ) ) :
323
  "name" => __( "Search Results", "advanced-woo-search" ),
324
  "desc" => __( "Choose how to view search results.", "advanced-woo-search" ),
325
  "id" => "show_page",
326
- "value" => 'false',
327
  "type" => "radio",
328
  'choices' => array(
329
  'true' => __( 'Both ajax search results and search results page', 'advanced-woo-search' ),
311
  "name" => __( "Show 'View All Results'", "advanced-woo-search" ),
312
  "desc" => __( "Show link to search results page at the bottom of search results block.", "advanced-woo-search" ),
313
  "id" => "show_more",
314
+ "value" => 'true',
315
  "type" => "radio",
316
  'choices' => array(
317
  'true' => __( 'On', 'advanced-woo-search' ),
323
  "name" => __( "Search Results", "advanced-woo-search" ),
324
  "desc" => __( "Choose how to view search results.", "advanced-woo-search" ),
325
  "id" => "show_page",
326
+ "value" => 'true',
327
  "type" => "radio",
328
  'choices' => array(
329
  'true' => __( 'Both ajax search results and search results page', 'advanced-woo-search' ),
includes/class-aws-integrations.php CHANGED
@@ -100,6 +100,11 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
100
  add_action( 'wp_head', array( $this, 'avada_head_action' ) );
101
  }
102
 
 
 
 
 
 
103
  // Elementor pro
104
  if ( defined( 'ELEMENTOR_PRO_VERSION' ) ) {
105
  add_action( 'wp_footer', array( $this, 'elementor_pro_popup' ) );
@@ -490,6 +495,51 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
490
 
491
  <?php }
492
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
493
  /*
494
  * Elementor popup search form init
495
  */
100
  add_action( 'wp_head', array( $this, 'avada_head_action' ) );
101
  }
102
 
103
+ // Twenty Twenty theme
104
+ if ( function_exists( 'twentytwenty_theme_support' ) ) {
105
+ add_action( 'wp_head', array( $this, 'twenty_twenty_head_action' ) );
106
+ }
107
+
108
  // Elementor pro
109
  if ( defined( 'ELEMENTOR_PRO_VERSION' ) ) {
110
  add_action( 'wp_footer', array( $this, 'elementor_pro_popup' ) );
495
 
496
  <?php }
497
 
498
+ /*
499
+ * Twenty Twenty theme
500
+ */
501
+ public function twenty_twenty_head_action() { ?>
502
+
503
+ <style>
504
+
505
+ .search-modal .aws-container {
506
+ width: 100%;
507
+ margin: 20px 0;
508
+ }
509
+
510
+ </style>
511
+
512
+ <script>
513
+
514
+ window.addEventListener('load', function() {
515
+
516
+ var awsSearch = document.querySelectorAll("#site-header .search-toggle");
517
+ if ( awsSearch ) {
518
+ for (var i = 0; i < awsSearch.length; i++) {
519
+ awsSearch[i].addEventListener('click', function() {
520
+ window.setTimeout(function(){
521
+ document.querySelector(".aws-container .aws-search-field").focus();
522
+ jQuery( '.aws-search-result' ).hide();
523
+ }, 100);
524
+ }, false);
525
+ }
526
+ }
527
+
528
+ var searchToggler = document.querySelectorAll('[data-modal-target-string=".search-modal"]');
529
+ if ( searchToggler ) {
530
+ for (var i = 0; i < searchToggler.length; i++) {
531
+ searchToggler[i].addEventListener('toggled', function() {
532
+ jQuery( '.aws-search-result' ).hide();
533
+ }, false);
534
+ }
535
+ }
536
+
537
+ }, false);
538
+
539
+ </script>
540
+
541
+ <?php }
542
+
543
  /*
544
  * Elementor popup search form init
545
  */
includes/class-aws-search-page.php CHANGED
@@ -66,6 +66,9 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
66
  // Nukes the FOUND_ROWS() database query
67
  add_filter( 'found_posts_query', array( $this, 'filter_found_posts_query' ), 5, 2 );
68
 
 
 
 
69
  // WooCommerce default widget filters
70
  add_filter( 'woocommerce_layered_nav_link', array( $this, 'woocommerce_layered_nav_link' ) );
71
  add_filter( 'woocommerce_get_filtered_term_product_counts_query', array( $this, 'woocommerce_get_filtered_term_product_counts_query' ), 999 );
@@ -280,6 +283,24 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
280
  return '';
281
  }
282
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
  /**
284
  * Perform the search.
285
  *
66
  // Nukes the FOUND_ROWS() database query
67
  add_filter( 'found_posts_query', array( $this, 'filter_found_posts_query' ), 5, 2 );
68
 
69
+ // Update found post query param
70
+ add_filter( 'found_posts', array( $this, 'filter_found_posts' ), 999, 2 );
71
+
72
  // WooCommerce default widget filters
73
  add_filter( 'woocommerce_layered_nav_link', array( $this, 'woocommerce_layered_nav_link' ) );
74
  add_filter( 'woocommerce_get_filtered_term_product_counts_query', array( $this, 'woocommerce_get_filtered_term_product_counts_query' ), 999 );
283
  return '';
284
  }
285
 
286
+ /**
287
+ * Filters the number of found posts for the query.
288
+ *
289
+ * @param int $found_posts The number of posts found
290
+ * @param object $query
291
+ * @return string
292
+ */
293
+ public function filter_found_posts( $found_posts, $query ) {
294
+
295
+ // Elementor search template fix
296
+ if ( isset( $_GET['type_aws'] ) && isset( $this->data['all_products'] ) && $this->data['all_products'] && isset( $this->data['is_elementor'] ) && $this->data['is_elementor'] && isset( $query->query_vars['nopaging'] ) && ! $query->query_vars['nopaging'] ) {
297
+ $found_posts = count( $this->data['all_products'] );
298
+ }
299
+
300
+ return $found_posts;
301
+
302
+ }
303
+
304
  /**
305
  * Perform the search.
306
  *
includes/class-aws-search.php CHANGED
@@ -67,6 +67,10 @@ if ( ! class_exists( 'AWS_Search' ) ) :
67
  define( 'DOING_AJAX', true );
68
  }
69
 
 
 
 
 
70
  echo json_encode( $this->search() );
71
 
72
  die;
67
  define( 'DOING_AJAX', true );
68
  }
69
 
70
+ if ( ! headers_sent() ) {
71
+ header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
72
+ }
73
+
74
  echo json_encode( $this->search() );
75
 
76
  die;
includes/class-aws-table.php CHANGED
@@ -923,6 +923,8 @@ if ( ! class_exists( 'AWS_Table' ) ) :
923
  $visibility = $product->get_catalog_visibility();
924
  } elseif ( method_exists( $product, 'get_visibility' ) ) {
925
  $visibility = $product->get_visibility();
 
 
926
  }
927
 
928
  return $visibility;
923
  $visibility = $product->get_catalog_visibility();
924
  } elseif ( method_exists( $product, 'get_visibility' ) ) {
925
  $visibility = $product->get_visibility();
926
+ } else {
927
+ $visibility = $product->visibility;
928
  }
929
 
930
  return $visibility;
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.3
7
- Stable tag: 1.93
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -104,6 +104,14 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
104
 
105
  == Changelog ==
106
 
 
 
 
 
 
 
 
 
107
  = 1.93 =
108
  * Add - Synonyms support for taxonomies search
109
  * Add - aws_tax_search_data filter
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.3
7
+ Stable tag: 1.94
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
104
 
105
  == Changelog ==
106
 
107
+ = 1.94 =
108
+ * Update - Ajax function
109
+ * Update - Twenty Twenty theme integration
110
+ * Update - Default settings values. Enable search page support by default
111
+ * Fix - WP AutoTerms plugin conflict
112
+ * Fix - Elementor plugin search page template
113
+ * Fix - Visibility get function for old WooCommerce versions
114
+
115
  = 1.93 =
116
  * Add - Synonyms support for taxonomies search
117
  * Add - aws_tax_search_data filter