Advanced Woo Search - Version 2.27

Version Description

( 2021-05-10 ) = * Fix - WOOF - WooCommerce Products Filter plugin integration * Dev - Fix posts_per_page filter for search results page * Dev - Update files loading

Download this release

Release Info

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

Code changes from version 2.26 to 2.27

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.26
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: advanced-woo-search
@@ -96,7 +96,7 @@ final class AWS_Main {
96
  */
97
  private function define_constants() {
98
 
99
- $this->define( 'AWS_VERSION', '2.26' );
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.27
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: advanced-woo-search
96
  */
97
  private function define_constants() {
98
 
99
+ $this->define( 'AWS_VERSION', '2.27' );
100
 
101
  $this->define( 'AWS_DIR', plugin_dir_path( AWS_FILE ) );
102
  $this->define( 'AWS_URL', plugin_dir_url( AWS_FILE ) );
includes/admin/class-aws-admin-fields.php CHANGED
@@ -336,10 +336,11 @@ if ( ! class_exists( 'AWS_Admin_Fields' ) ) :
336
 
337
  $heading_tag = isset( $value['heading_type'] ) && $value['heading_type'] === 'text' ? 'span' : 'h3';
338
  $heading_description = isset( $value['desc'] ) ? $value['desc'] : '';
 
339
  ?>
340
 
341
  <tr valign="top">
342
- <th scope="row"><<?php echo $heading_tag; ?> class="aws-heading"><?php echo esc_html( $value['name'] ); ?></<?php echo $heading_tag; ?>></th>
343
 
344
  <?php if ( $heading_description ): ?>
345
  <td>
336
 
337
  $heading_tag = isset( $value['heading_type'] ) && $value['heading_type'] === 'text' ? 'span' : 'h3';
338
  $heading_description = isset( $value['desc'] ) ? $value['desc'] : '';
339
+ $id = isset($value['id']) && $value['id'] ? 'id="' . $value['id'] . '"' : '';
340
  ?>
341
 
342
  <tr valign="top">
343
+ <th scope="row"><<?php echo $heading_tag; ?> <?php echo $id; ?> class="aws-heading"><?php echo esc_html( $value['name'] ); ?></<?php echo $heading_tag; ?>></th>
344
 
345
  <?php if ( $heading_description ): ?>
346
  <td>
includes/admin/class-aws-admin-options.php CHANGED
@@ -328,6 +328,7 @@ if ( ! class_exists( 'AWS_Admin_Options' ) ) :
328
 
329
  $options['performance'][] = array(
330
  "name" => __( "Index table options", "advanced-woo-search" ),
 
331
  "type" => "heading"
332
  );
333
 
328
 
329
  $options['performance'][] = array(
330
  "name" => __( "Index table options", "advanced-woo-search" ),
331
+ "id" => "index_sources",
332
  "type" => "heading"
333
  );
334
 
includes/admin/class-aws-admin.php CHANGED
@@ -198,7 +198,7 @@ class AWS_Admin {
198
  if ( isset( $option['id'] ) && $option['id'] === 'search_in' && isset( $option['choices'] ) ) {
199
  foreach( $option['choices'] as $choice_key => $choice_label ) {
200
  if ( isset( $index_options['index'][$choice_key] ) && ! $index_options['index'][$choice_key] ) {
201
- $text = '<span style="color:#dc3232;">' . __( '(index disabled)', 'advanced-woo-search' ) . '</span>' . ' <a href="'.esc_url( admin_url('admin.php?page=aws-options&tab=performance') ).'">' . __( '(enable)', 'advanced-woo-search' ) . '</a>';
202
  $options[$options_key][$key]['choices'][$choice_key] = $choice_label . ' ' . $text;
203
  }
204
  }
198
  if ( isset( $option['id'] ) && $option['id'] === 'search_in' && isset( $option['choices'] ) ) {
199
  foreach( $option['choices'] as $choice_key => $choice_label ) {
200
  if ( isset( $index_options['index'][$choice_key] ) && ! $index_options['index'][$choice_key] ) {
201
+ $text = '<span style="color:#dc3232;">' . __( '(index disabled)', 'advanced-woo-search' ) . '</span>' . ' <a href="'.esc_url( admin_url('admin.php?page=aws-options&tab=performance#index_sources') ).'">' . __( '(enable)', 'advanced-woo-search' ) . '</a>';
202
  $options[$options_key][$key]['choices'][$choice_key] = $choice_label . ' ' . $text;
203
  }
204
  }
includes/class-aws-search-page.php CHANGED
@@ -112,6 +112,7 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
112
 
113
  $query->found_posts = count( $search_res['all'] );
114
  $query->max_num_pages = ceil( count( $search_res['all'] ) / $posts_per_page );
 
115
 
116
  $new_posts = $this->set_posts_objects( $search_res, $query );
117
 
112
 
113
  $query->found_posts = count( $search_res['all'] );
114
  $query->max_num_pages = ceil( count( $search_res['all'] ) / $posts_per_page );
115
+ $query->set( 'posts_per_page', $posts_per_page );
116
 
117
  $new_posts = $this->set_posts_objects( $search_res, $query );
118
 
includes/modules/class-aws-woof-filter.php CHANGED
@@ -20,6 +20,8 @@ if (!class_exists('AWS_Woof_Filter_Init')) :
20
  */
21
  protected static $_instance = null;
22
 
 
 
23
  /**
24
  * Main AWS_Woof_Filter_Init Instance
25
  *
@@ -43,7 +45,7 @@ if (!class_exists('AWS_Woof_Filter_Init')) :
43
 
44
  add_filter( 'aws_search_page_filters', array( $this, 'woof_search_page_filters' ) );
45
 
46
- add_filter( 'aws_searchpage_enabled', array( $this, 'woof_searchpage_enabled' ) );
47
 
48
  add_filter( 'aws_search_page_query', array( $this, 'woof_aws_searchpage_query' ) );
49
 
@@ -51,6 +53,10 @@ if (!class_exists('AWS_Woof_Filter_Init')) :
51
 
52
  add_filter( 'woof_get_request_data', array( $this, 'woof_get_request_data' ), 999 );
53
 
 
 
 
 
54
  }
55
 
56
  /*
@@ -92,8 +98,8 @@ if (!class_exists('AWS_Woof_Filter_Init')) :
92
  /*
93
  * Enable aws search
94
  */
95
- public function woof_searchpage_enabled( $enabled ) {
96
- if ( isset( $_GET['post_type'] ) && $_GET['post_type'] === 'product' && isset( $_GET['type_aws'] ) && isset( $_GET['woof_text'] ) ) {
97
  return true;
98
  }
99
  return $enabled;
@@ -126,9 +132,30 @@ if (!class_exists('AWS_Woof_Filter_Init')) :
126
  if ( isset( $_GET['post_type'] ) && $_GET['post_type'] === 'product' && isset( $_GET['type_aws'] ) && isset( $_GET['s'] ) && ! isset( $_GET['woof_text'] ) ) {
127
  $request['woof_text'] = $request['s'];
128
  }
 
 
 
129
  return $request;
130
  }
131
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
 
133
  }
134
 
20
  */
21
  protected static $_instance = null;
22
 
23
+ private $data = array();
24
+
25
  /**
26
  * Main AWS_Woof_Filter_Init Instance
27
  *
45
 
46
  add_filter( 'aws_search_page_filters', array( $this, 'woof_search_page_filters' ) );
47
 
48
+ add_filter( 'aws_searchpage_enabled', array( $this, 'woof_searchpage_enabled' ), 1, 2 );
49
 
50
  add_filter( 'aws_search_page_query', array( $this, 'woof_aws_searchpage_query' ) );
51
 
53
 
54
  add_filter( 'woof_get_request_data', array( $this, 'woof_get_request_data' ), 999 );
55
 
56
+ add_filter( 'posts_where_request', array( $this, 'posts_where_request' ), 1 );
57
+
58
+ add_filter( 'aws_search_page_custom_data', array( $this, 'aws_search_page_custom_data' ) );
59
+
60
  }
61
 
62
  /*
98
  /*
99
  * Enable aws search
100
  */
101
+ public function woof_searchpage_enabled( $enabled, $query ) {
102
+ if ( isset( $_GET['post_type'] ) && $_GET['post_type'] === 'product' && isset( $_GET['type_aws'] ) && isset( $_GET['woof_text'] ) && ! isset( $_REQUEST['woof_dyn_recount_going'] ) && ( $query->get( 'post_type' ) && is_string( $query->get( 'post_type' ) ) && $query->get( 'post_type' ) === 'product' ) ) {
103
  return true;
104
  }
105
  return $enabled;
132
  if ( isset( $_GET['post_type'] ) && $_GET['post_type'] === 'product' && isset( $_GET['type_aws'] ) && isset( $_GET['s'] ) && ! isset( $_GET['woof_text'] ) ) {
133
  $request['woof_text'] = $request['s'];
134
  }
135
+ if ( isset( $_REQUEST['woof_dyn_recount_going'] ) ) {
136
+ return '';
137
+ }
138
  return $request;
139
  }
140
 
141
+ /*
142
+ * Set WHERE request for filters counter
143
+ */
144
+ public function posts_where_request( $where ) {
145
+ if ( isset( $_REQUEST['woof_dyn_recount_going'] ) && $this->data && isset( $this->data['ids'] ) ) {
146
+ global $wpdb;
147
+ $where .= " AND {$wpdb->posts}.ID IN ( " . implode( ',', $this->data['ids'] ) . " ) ";
148
+ }
149
+ return $where;
150
+ }
151
+
152
+ /*
153
+ * Set search query custom data
154
+ */
155
+ public function aws_search_page_custom_data( $data ) {
156
+ $this->data = $data;
157
+ return $data;
158
+ }
159
 
160
  }
161
 
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.7
7
- Stable tag: 2.26
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -167,6 +167,11 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
167
 
168
  == Changelog ==
169
 
 
 
 
 
 
170
  = 2.26 ( 2021-04-27 ) =
171
  * Update - Tested with WC 5.2
172
  * Update - Wholesale Pricing plugin support
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.7
7
+ Stable tag: 2.27
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
167
 
168
  == Changelog ==
169
 
170
+ = 2.27 ( 2021-05-10 ) =
171
+ * Fix - WOOF - WooCommerce Products Filter plugin integration
172
+ * Dev - Fix posts_per_page filter for search results page
173
+ * Dev - Update files loading
174
+
175
  = 2.26 ( 2021-04-27 ) =
176
  * Update - Tested with WC 5.2
177
  * Update - Wholesale Pricing plugin support