Advanced Woo Search - Version 2.45

Version Description

( 2022-01-24 ) = * Update - Tested with WC 6.1 * Update - Divi theme support. Autofocus on search field in the header * Update - Admin page 'Get started' notice * Fix - Remove error notice on first search if cache table not exist * Dev - Add aws_results_force_position js filter * Dev - Remove unused parameter for wp_insert_post hook

Download this release

Release Info

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

Code changes from version 2.44 to 2.45

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.44
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: 6.0.0
12
  */
13
 
14
 
@@ -96,7 +96,7 @@ final class AWS_Main {
96
  */
97
  private function define_constants() {
98
 
99
- $this->define( 'AWS_VERSION', '2.44' );
100
 
101
  $this->define( 'AWS_DIR', plugin_dir_path( AWS_FILE ) );
102
  $this->define( 'AWS_URL', plugin_dir_url( AWS_FILE ) );
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
+ Version: 2.45
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: 6.1.0
12
  */
13
 
14
 
96
  */
97
  private function define_constants() {
98
 
99
+ $this->define( 'AWS_VERSION', '2.45' );
100
 
101
  $this->define( 'AWS_DIR', plugin_dir_path( AWS_FILE ) );
102
  $this->define( 'AWS_URL', plugin_dir_url( AWS_FILE ) );
assets/js/common.js CHANGED
@@ -338,6 +338,9 @@ AwsHooks.filters = AwsHooks.filters || {};
338
  var bodyHeight = $(document).height();
339
  var resultsHeight = $resultsBlock.height();
340
 
 
 
 
341
  if ( offset && bodyOffset ) {
342
 
343
  var styles = {
@@ -354,9 +357,9 @@ AwsHooks.filters = AwsHooks.filters || {};
354
  styles.left = offset.left;
355
  }
356
 
357
- if ( bodyHeight - offset.top < 500 ) {
358
  resultsHeight = methods.getResultsBlockHeight();
359
- if ( ( bodyHeight - offset.top < resultsHeight ) && ( offset.top >= resultsHeight ) ) {
360
  styles.top = styles.top - resultsHeight - $(self).innerHeight();
361
  }
362
  }
338
  var bodyHeight = $(document).height();
339
  var resultsHeight = $resultsBlock.height();
340
 
341
+ // @since 2.45
342
+ var forcePosition = AwsHooks.apply_filters( 'aws_results_force_position', false, { resultsBlock: $resultsBlock, form: self } );
343
+
344
  if ( offset && bodyOffset ) {
345
 
346
  var styles = {
357
  styles.left = offset.left;
358
  }
359
 
360
+ if ( ( ( bodyHeight - offset.top < 500 ) && ! forcePosition ) || ( forcePosition && forcePosition == 'top' ) ) {
361
  resultsHeight = methods.getResultsBlockHeight();
362
+ if ( ( ( bodyHeight - offset.top < resultsHeight ) && ( offset.top >= resultsHeight ) ) || forcePosition ) {
363
  styles.top = styles.top - resultsHeight - $(self).innerHeight();
364
  }
365
  }
includes/admin/class-aws-admin-meta-boxes.php CHANGED
@@ -90,6 +90,7 @@ if ( ! class_exists( 'AWS_Admin_Meta_Boxes' ) ) :
90
  $html .= '<div class="welcome-panel-column">';
91
  $html .= '<h4>' . __( 'Documentation', 'advanced-woo-search' ) . '</h4>';
92
  $html .= '<ul>';
 
93
  $html .= '<li><a href="https://advanced-woo-search.com/guide/search-form/" class="welcome-icon welcome-edit-page" target="_blank">' . __( 'How to Add Search Form', 'advanced-woo-search' ) . '</a></li>';
94
  $html .= '<li><a href="https://advanced-woo-search.com/guide/search-source/" class="welcome-icon welcome-edit-page" target="_blank">' . __( 'Search Sources', 'advanced-woo-search' ) . '</a></li>';
95
  $html .= '<li><a href="https://advanced-woo-search.com/guide/terms-search/" class="welcome-icon welcome-edit-page" target="_blank">' . __( 'Terms Pages Search', 'advanced-woo-search' ) . '</a></li>';
90
  $html .= '<div class="welcome-panel-column">';
91
  $html .= '<h4>' . __( 'Documentation', 'advanced-woo-search' ) . '</h4>';
92
  $html .= '<ul>';
93
+ $html .= '<li><a href="https://advanced-woo-search.com/guide/steps-to-get-started/" class="welcome-icon welcome-edit-page" target="_blank">' . __( 'Steps to Get Started', 'advanced-woo-search' ) . '</a></li>';
94
  $html .= '<li><a href="https://advanced-woo-search.com/guide/search-form/" class="welcome-icon welcome-edit-page" target="_blank">' . __( 'How to Add Search Form', 'advanced-woo-search' ) . '</a></li>';
95
  $html .= '<li><a href="https://advanced-woo-search.com/guide/search-source/" class="welcome-icon welcome-edit-page" target="_blank">' . __( 'Search Sources', 'advanced-woo-search' ) . '</a></li>';
96
  $html .= '<li><a href="https://advanced-woo-search.com/guide/terms-search/" class="welcome-icon welcome-edit-page" target="_blank">' . __( 'Terms Pages Search', 'advanced-woo-search' ) . '</a></li>';
includes/class-aws-cache.php CHANGED
@@ -90,7 +90,7 @@ if ( ! class_exists( 'AWS_Cache' ) ) :
90
  /*
91
  * Check if cache table exist
92
  */
93
- private function is_cache_table_not_exist() {
94
 
95
  global $wpdb;
96
 
@@ -101,7 +101,7 @@ if ( ! class_exists( 'AWS_Cache' ) ) :
101
  /*
102
  * Create cache table
103
  */
104
- private function create_cache_table() {
105
 
106
  global $wpdb;
107
 
90
  /*
91
  * Check if cache table exist
92
  */
93
+ public function is_cache_table_not_exist() {
94
 
95
  global $wpdb;
96
 
101
  /*
102
  * Create cache table
103
  */
104
+ public function create_cache_table() {
105
 
106
  global $wpdb;
107
 
includes/class-aws-integrations.php CHANGED
@@ -89,6 +89,7 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
89
 
90
  add_filter( 'et_html_main_header', array( $this, 'et_html_main_header' ) );
91
  add_filter( 'et_html_slide_header', array( $this, 'et_html_main_header' ) );
 
92
  add_filter( 'generate_navigation_search_output', array( $this, 'generate_navigation_search_output' ) );
93
  add_filter( 'et_pb_search_shortcode_output', array( $this, 'divi_builder_search_module' ) );
94
  add_filter( 'et_pb_menu_shortcode_output', array( $this, 'divi_builder_search_module' ) );
@@ -1582,6 +1583,36 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
1582
  return $html;
1583
  }
1584
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1585
  /*
1586
  * Generatepress theme support
1587
  */
89
 
90
  add_filter( 'et_html_main_header', array( $this, 'et_html_main_header' ) );
91
  add_filter( 'et_html_slide_header', array( $this, 'et_html_main_header' ) );
92
+ add_action( 'wp_head', array( $this, 'divi_wp_head' ) );
93
  add_filter( 'generate_navigation_search_output', array( $this, 'generate_navigation_search_output' ) );
94
  add_filter( 'et_pb_search_shortcode_output', array( $this, 'divi_builder_search_module' ) );
95
  add_filter( 'et_pb_menu_shortcode_output', array( $this, 'divi_builder_search_module' ) );
1583
  return $html;
1584
  }
1585
 
1586
+ /*
1587
+ * Divi theme: focus search field on icon click
1588
+ */
1589
+ public function divi_wp_head() {
1590
+
1591
+ $html = '
1592
+ <script>
1593
+
1594
+ window.addEventListener("load", function() {
1595
+
1596
+ var awsDiviSearch = document.querySelectorAll("header .et_pb_menu__search-button");
1597
+ if ( awsDiviSearch ) {
1598
+ for (var i = 0; i < awsDiviSearch.length; i++) {
1599
+ awsDiviSearch[i].addEventListener("click", function() {
1600
+ window.setTimeout(function(){
1601
+ document.querySelector(".et_pb_menu__search-container .aws-container .aws-search-field").focus();
1602
+ jQuery( ".aws-search-result" ).hide();
1603
+ }, 100);
1604
+ }, false);
1605
+ }
1606
+ }
1607
+
1608
+ }, false);
1609
+
1610
+ </script>';
1611
+
1612
+ echo $html;
1613
+
1614
+ }
1615
+
1616
  /*
1617
  * Generatepress theme support
1618
  */
includes/class-aws-table.php CHANGED
@@ -30,7 +30,7 @@ if ( ! class_exists( 'AWS_Table' ) ) :
30
 
31
  $this->table_name = $wpdb->prefix . AWS_INDEX_TABLE_NAME;
32
 
33
- add_action( 'wp_insert_post', array( $this, 'product_changed' ), 10, 3 );
34
  add_action( 'delete_post', array( $this, 'product_deleted' ), 10, 2 );
35
 
36
  add_action( 'create_term', array( &$this, 'term_changed' ), 10, 3 );
@@ -109,6 +109,10 @@ if ( ! class_exists( 'AWS_Table' ) ) :
109
 
110
  $this->create_table();
111
 
 
 
 
 
112
  $index_meta['found_posts'] = $this->get_number_of_products();
113
 
114
  } else if ( ! empty( $index_meta['site_stack'] ) && $index_meta['offset'] >= $index_meta['found_posts'] ) {
@@ -501,8 +505,8 @@ if ( ! class_exists( 'AWS_Table' ) ) :
501
  /*
502
  * Update index table
503
  */
504
- public function product_changed( $post_id, $post, $update ) {
505
-
506
  $slug = 'product';
507
 
508
  if ( $slug != $post->post_type ) {
30
 
31
  $this->table_name = $wpdb->prefix . AWS_INDEX_TABLE_NAME;
32
 
33
+ add_action( 'wp_insert_post', array( $this, 'product_changed' ), 10, 2 );
34
  add_action( 'delete_post', array( $this, 'product_deleted' ), 10, 2 );
35
 
36
  add_action( 'create_term', array( &$this, 'term_changed' ), 10, 3 );
109
 
110
  $this->create_table();
111
 
112
+ if ( AWS()->cache->is_cache_table_not_exist() ) {
113
+ AWS()->cache->create_cache_table();
114
+ }
115
+
116
  $index_meta['found_posts'] = $this->get_number_of_products();
117
 
118
  } else if ( ! empty( $index_meta['site_stack'] ) && $index_meta['offset'] >= $index_meta['found_posts'] ) {
505
  /*
506
  * Update index table
507
  */
508
+ public function product_changed( $post_id, $post ) {
509
+
510
  $slug = 'product';
511
 
512
  if ( $slug != $post->post_type ) {
languages/advanced-woo-search.pot CHANGED
@@ -516,6 +516,9 @@ msgstr ""
516
  msgid "Documentation"
517
  msgstr ""
518
 
 
 
 
519
  msgid "How to Add Search Form"
520
  msgstr ""
521
 
516
  msgid "Documentation"
517
  msgstr ""
518
 
519
+ msgid "Steps to Get Started"
520
+ msgstr ""
521
+
522
  msgid "How to Add Search Form"
523
  msgstr ""
524
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Mihail Barinov
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=GSE37FC4Y7CEY
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.8
7
- Stable tag: 2.44
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -167,6 +167,14 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
167
 
168
  == Changelog ==
169
 
 
 
 
 
 
 
 
 
170
  = 2.44 ( 2022-01-10 ) =
171
  * Fix - FacetWP plugin compatibility issue
172
 
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=GSE37FC4Y7CEY
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.9
7
+ Stable tag: 2.45
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
167
 
168
  == Changelog ==
169
 
170
+ = 2.45 ( 2022-01-24 ) =
171
+ * Update - Tested with WC 6.1
172
+ * Update - Divi theme support. Autofocus on search field in the header
173
+ * Update - Admin page 'Get started' notice
174
+ * Fix - Remove error notice on first search if cache table not exist
175
+ * Dev - Add aws_results_force_position js filter
176
+ * Dev - Remove unused parameter for wp_insert_post hook
177
+
178
  = 2.44 ( 2022-01-10 ) =
179
  * Fix - FacetWP plugin compatibility issue
180