Advanced Woo Search - Version 2.36

Version Description

( 2021-09-21 ) = * Update - Woodmart theme support. Update search results page pagination links * Update - Avada theme support. Set number of products per search results page * Fix - Taxonomies search by description. Not strip special characters from the search query * Fix - Error with not valid scripts loaded for new widgets block editor * Fix - Ultimate Member plugin support * Fix - Avada theme support for search results page

Download this release

Release Info

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

Code changes from version 2.35 to 2.36

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.35
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.35' );
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.36
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.36' );
100
 
101
  $this->define( 'AWS_DIR', plugin_dir_path( AWS_FILE ) );
102
  $this->define( 'AWS_URL', plugin_dir_url( AWS_FILE ) );
includes/class-aws-integrations.php CHANGED
@@ -226,16 +226,19 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
226
  }
227
 
228
  if ( 'Avada' === $this->current_theme ) {
229
- add_filter( 'aws_posts_per_page', array( $this, 'avada_posts_per_page' ), 1 );
230
  add_filter( 'aws_products_order_by', array( $this, 'avada_aws_products_order_by' ), 1 );
231
  add_filter( 'post_class', array( $this, 'avada_post_class' ) );
232
- add_filter( 'aws_search_page_custom_data', array( $this, 'avada_modify_s_page_query' ) );
233
  }
234
 
235
  if ( 'Electro' === $this->current_theme ) {
236
  add_filter( 'aws_searchbox_markup', array( $this, 'electro_searchbox_markup' ), 1, 2 );
237
  }
238
 
 
 
 
 
239
  // FacetWP plugin
240
  if ( class_exists( 'FacetWP' ) ) {
241
  add_filter( 'facetwp_filtered_post_ids', array( $this, 'facetwp_filtered_post_ids' ), 1 );
@@ -1728,7 +1731,12 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
1728
  * Avada theme posts per page option
1729
  */
1730
  public function avada_posts_per_page( $posts_per_page ) {
1731
- $posts_per_page = isset( $_GET['product_count'] ) && intval( sanitize_text_field( $_GET['product_count'] ) ) ? intval( sanitize_text_field( $_GET['product_count'] ) ) : 12;
 
 
 
 
 
1732
  return $posts_per_page;
1733
  }
1734
 
@@ -1790,14 +1798,6 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
1790
  return $classes;
1791
  }
1792
 
1793
- /*
1794
- * Avada theme fix search page query
1795
- */
1796
- public function avada_modify_s_page_query( $data ) {
1797
- $data['force_ids'] = true;
1798
- return $data;
1799
- }
1800
-
1801
  /*
1802
  * Electro them update search form markup
1803
  */
@@ -1807,6 +1807,18 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
1807
  return $markup;
1808
  }
1809
 
 
 
 
 
 
 
 
 
 
 
 
 
1810
  /*
1811
  * FacetWP check for active filters
1812
  */
226
  }
227
 
228
  if ( 'Avada' === $this->current_theme ) {
229
+ add_filter( 'aws_posts_per_page', array( $this, 'avada_posts_per_page' ), 2 );
230
  add_filter( 'aws_products_order_by', array( $this, 'avada_aws_products_order_by' ), 1 );
231
  add_filter( 'post_class', array( $this, 'avada_post_class' ) );
 
232
  }
233
 
234
  if ( 'Electro' === $this->current_theme ) {
235
  add_filter( 'aws_searchbox_markup', array( $this, 'electro_searchbox_markup' ), 1, 2 );
236
  }
237
 
238
+ if ( 'Woodmart' === $this->current_theme ) {
239
+ add_filter( 'woodmart_shop_page_link', array( $this, 'woodmart_shop_page_link' ), 9999 );
240
+ }
241
+
242
  // FacetWP plugin
243
  if ( class_exists( 'FacetWP' ) ) {
244
  add_filter( 'facetwp_filtered_post_ids', array( $this, 'facetwp_filtered_post_ids' ), 1 );
1731
  * Avada theme posts per page option
1732
  */
1733
  public function avada_posts_per_page( $posts_per_page ) {
1734
+ $num = 12;
1735
+ $search_page_res_per_page = AWS()->get_settings( 'search_page_res_per_page' );
1736
+ if ( $search_page_res_per_page ) {
1737
+ $num = intval( $search_page_res_per_page );
1738
+ }
1739
+ $posts_per_page = isset( $_GET['product_count'] ) && intval( sanitize_text_field( $_GET['product_count'] ) ) ? intval( sanitize_text_field( $_GET['product_count'] ) ) : $num;
1740
  return $posts_per_page;
1741
  }
1742
 
1798
  return $classes;
1799
  }
1800
 
 
 
 
 
 
 
 
 
1801
  /*
1802
  * Electro them update search form markup
1803
  */
1807
  return $markup;
1808
  }
1809
 
1810
+ /*
1811
+ * Woodmart theme update search page pagination links
1812
+ */
1813
+ public function woodmart_shop_page_link( $link ) {
1814
+ if ( isset( $_GET['type_aws'] ) && strpos( $link, 'type_aws' ) === false ) {
1815
+ $link = add_query_arg( array(
1816
+ 'type_aws' => 'true',
1817
+ ), $link );
1818
+ }
1819
+ return $link;
1820
+ }
1821
+
1822
  /*
1823
  * FacetWP check for active filters
1824
  */
includes/class-aws-tax-search.php CHANGED
@@ -272,6 +272,7 @@ if ( ! class_exists( 'AWS_Tax_Search' ) ) :
272
  if ( $terms_desc_search = apply_filters( 'aws_search_terms_description', false ) ) {
273
  $relevance_desc = 10 + 2 * $search_term_len;
274
  $relevance_array[] = $wpdb->prepare( "( case when ( description LIKE %s ) then {$relevance_desc} else 0 end )", $like );
 
275
  }
276
 
277
  }
@@ -299,6 +300,7 @@ if ( ! class_exists( 'AWS_Tax_Search' ) ) :
299
 
300
  if ( $terms_desc_search = apply_filters( 'aws_search_terms_description', false ) ) {
301
  $search_array[] = $wpdb->prepare('( description LIKE %s )', $like);
 
302
  }
303
 
304
  }
272
  if ( $terms_desc_search = apply_filters( 'aws_search_terms_description', false ) ) {
273
  $relevance_desc = 10 + 2 * $search_term_len;
274
  $relevance_array[] = $wpdb->prepare( "( case when ( description LIKE %s ) then {$relevance_desc} else 0 end )", $like );
275
+ $relevance_array[] = $wpdb->prepare( "( case when ( description LIKE %s ) then {$relevance_desc} else 0 end )", '%' . $wpdb->esc_like( $this->search_string_unfiltered ) . '%' );
276
  }
277
 
278
  }
300
 
301
  if ( $terms_desc_search = apply_filters( 'aws_search_terms_description', false ) ) {
302
  $search_array[] = $wpdb->prepare('( description LIKE %s )', $like);
303
+ $search_array[] = $wpdb->prepare('( description LIKE %s )', '%' . $wpdb->esc_like( $this->search_string_unfiltered ) . '%' );
304
  }
305
 
306
  }
includes/modules/class-aws-um.php CHANGED
@@ -246,16 +246,16 @@ if ( ! class_exists( 'AWS_UM' ) ) :
246
 
247
  if ( $restricted_terms ) {
248
  foreach( $restricted_terms as $restricted_term ) {
249
- $um_content_restriction = get_term_meta( $restricted_term->term_id, 'um_content_restriction', true );
250
- $is_restricted = $this->is_restricted( $um_content_restriction );
251
- if ( $is_restricted ) {
252
- $restricted_terms_arr[$restricted_term->taxonomy][] = $restricted_term->term_id;
 
 
253
  }
254
-
255
  }
256
  }
257
 
258
-
259
  }
260
  }
261
 
246
 
247
  if ( $restricted_terms ) {
248
  foreach( $restricted_terms as $restricted_term ) {
249
+ if ( is_object( $restricted_term ) ) {
250
+ $um_content_restriction = get_term_meta( $restricted_term->term_id, 'um_content_restriction', true );
251
+ $is_restricted = $this->is_restricted( $um_content_restriction );
252
+ if ( $is_restricted ) {
253
+ $restricted_terms_arr[$restricted_term->taxonomy][] = $restricted_term->term_id;
254
+ }
255
  }
 
256
  }
257
  }
258
 
 
259
  }
260
  }
261
 
includes/modules/gutenberg/class-aws-gutenberg-init.php CHANGED
@@ -56,10 +56,17 @@ if (!class_exists('AWS_Gutenberg_Init')) :
56
  */
57
  public function register_block() {
58
 
 
 
 
 
 
 
 
59
  wp_register_script(
60
  'aws-gutenberg-search-block',
61
  AWS_URL . '/includes/modules/gutenberg/aws-gutenberg-search-block.js',
62
- array('wp-blocks','wp-editor'),
63
  AWS_VERSION
64
  );
65
 
56
  */
57
  public function register_block() {
58
 
59
+ global $pagenow;
60
+
61
+ $scripts = array( 'wp-blocks', 'wp-editor' );
62
+ if ( $pagenow && $pagenow === 'widgets.php' && version_compare( get_bloginfo('version'),'5.8', '>=' ) ) {
63
+ $scripts = array( 'wp-blocks', 'wp-edit-widgets' );
64
+ }
65
+
66
  wp_register_script(
67
  'aws-gutenberg-search-block',
68
  AWS_URL . '/includes/modules/gutenberg/aws-gutenberg-search-block.js',
69
+ $scripts,
70
  AWS_VERSION
71
  );
72
 
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.8
7
- Stable tag: 2.35
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.35 ( 2021-08-31 ) =
171
  * Add - Seamless integration for Modern Store theme
172
  * Update - WholeSale plugin support. Change products filter script to improve execution time
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.36
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
167
 
168
  == Changelog ==
169
 
170
+ = 2.36 ( 2021-09-21 ) =
171
+ * Update - Woodmart theme support. Update search results page pagination links
172
+ * Update - Avada theme support. Set number of products per search results page
173
+ * Fix - Taxonomies search by description. Not strip special characters from the search query
174
+ * Fix - Error with not valid scripts loaded for new widgets block editor
175
+ * Fix - Ultimate Member plugin support
176
+ * Fix - Avada theme support for search results page
177
+
178
  = 2.35 ( 2021-08-31 ) =
179
  * Add - Seamless integration for Modern Store theme
180
  * Update - WholeSale plugin support. Change products filter script to improve execution time