Advanced Woo Search - Version 2.30

Version Description

( 2021-06-21 ) = * Add - Support for Advanced Woo Labels plugin * Update - WCFM plugin fix for vendors shop search. Fix searching for vendor taxonomies * Update - Fix styles for YITH Wishlist plugin * Update - Tested with WC 5.4

Download this release

Release Info

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

Code changes from version 2.29 to 2.30

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.29
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: 5.3.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.29' );
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.30
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: 5.4.0
12
  */
13
 
14
 
96
  */
97
  private function define_constants() {
98
 
99
+ $this->define( 'AWS_VERSION', '2.30' );
100
 
101
  $this->define( 'AWS_DIR', plugin_dir_path( AWS_FILE ) );
102
  $this->define( 'AWS_URL', plugin_dir_url( AWS_FILE ) );
assets/css/common.css CHANGED
@@ -530,4 +530,24 @@ body.aws-overlay {
530
  }
531
  #et-boc .aws-container .aws-search-form .aws-search-clear {
532
  padding: 0 0 0 10px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
533
  }
530
  }
531
  #et-boc .aws-container .aws-search-form .aws-search-clear {
532
  padding: 0 0 0 10px;
533
+ }
534
+
535
+ .aws-search-result .aws_result_title .advanced-woo-labels {
536
+ position: relative !important;
537
+ width: auto !important;
538
+ margin: 0 5px 5px 0 !important;
539
+ transform: none !important;
540
+ }
541
+
542
+ .aws-search-result .aws_result_title .advanced-woo-labels:last-child {
543
+ margin-bottom: 0 !important;
544
+ }
545
+
546
+ .aws-search-result .aws_result_title .aws_result_labels {
547
+ display: flex;
548
+ margin: 0 !important;
549
+ flex-wrap: wrap;
550
+ flex-direction: row;
551
+ text-align: left;
552
+ justify-content: flex-start;
553
  }
includes/class-aws-integrations.php CHANGED
@@ -315,6 +315,11 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
315
  include_once( AWS_DIR . '/includes/modules/class-aws-wholesale.php' );
316
  }
317
 
 
 
 
 
 
318
  }
319
 
320
  /*
315
  include_once( AWS_DIR . '/includes/modules/class-aws-wholesale.php' );
316
  }
317
 
318
+ // Advanced Woo Labels plugin
319
+ if ( function_exists( 'AWL' ) || function_exists( 'AWL_PRO' ) ) {
320
+ include_once( AWS_DIR . '/includes/modules/class-aws-awl.php' );
321
+ }
322
+
323
  }
324
 
325
  /*
includes/class-aws-tax-search.php CHANGED
@@ -186,12 +186,14 @@ if ( ! class_exists( 'AWS_Tax_Search' ) ) :
186
  foreach ( $search_results as $result ) {
187
 
188
  $parent = '';
 
189
 
190
  $term = get_term( $result->term_id, $result->taxonomy );
191
 
192
  if ( $term != null && !is_wp_error( $term ) ) {
193
  $term_link = get_term_link( $term );
194
  $parent = is_object( $term ) && property_exists( $term, 'parent' ) ? $term->parent : '';
 
195
  } else {
196
  continue;
197
  }
@@ -199,6 +201,7 @@ if ( ! class_exists( 'AWS_Tax_Search' ) ) :
199
  $new_result = array(
200
  'name' => $result->name,
201
  'id' => $result->term_id,
 
202
  'count' => ( $result->count > 0 ) ? $result->count : '',
203
  'link' => $term_link,
204
  'excerpt' => '',
186
  foreach ( $search_results as $result ) {
187
 
188
  $parent = '';
189
+ $slug = '';
190
 
191
  $term = get_term( $result->term_id, $result->taxonomy );
192
 
193
  if ( $term != null && !is_wp_error( $term ) ) {
194
  $term_link = get_term_link( $term );
195
  $parent = is_object( $term ) && property_exists( $term, 'parent' ) ? $term->parent : '';
196
+ $slug = $term->slug;
197
  } else {
198
  continue;
199
  }
201
  $new_result = array(
202
  'name' => $result->name,
203
  'id' => $result->term_id,
204
+ 'slug' => $slug,
205
  'count' => ( $result->count > 0 ) ? $result->count : '',
206
  'link' => $term_link,
207
  'excerpt' => '',
includes/modules/class-aws-awl.php ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Advanced Woo Labels plugin
4
+ */
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit; // Exit if accessed directly.
8
+ }
9
+
10
+ if ( ! class_exists( 'AWS_AWL' ) ) :
11
+
12
+ /**
13
+ * Class
14
+ */
15
+ class AWS_AWL {
16
+
17
+ /**
18
+ * Main AWS_AWL Instance
19
+ *
20
+ * Ensures only one instance of AWS_AWL is loaded or can be loaded.
21
+ *
22
+ * @static
23
+ * @return AWS_AWL - Main instance
24
+ */
25
+ protected static $_instance = null;
26
+
27
+ public $old_title = true;
28
+
29
+ /**
30
+ * Main AWS_AWL Instance
31
+ *
32
+ * Ensures only one instance of AWS_AWL is loaded or can be loaded.
33
+ *
34
+ * @static
35
+ * @return AWS_AWL - Main instance
36
+ */
37
+ public static function instance() {
38
+ if ( is_null( self::$_instance ) ) {
39
+ self::$_instance = new self();
40
+ }
41
+ return self::$_instance;
42
+ }
43
+
44
+ /**
45
+ * Constructor
46
+ */
47
+ public function __construct() {
48
+ add_filter( 'aws_admin_page_options', array( $this, 'add_admin_options' ) );
49
+ add_filter( 'aws_title_search_result', array( $this, 'aws_old_title_search_result' ), 9 );
50
+ add_filter( 'aws_title_search_result', array( $this, 'aws_title_search_result' ), 11 );
51
+ }
52
+
53
+ /*
54
+ * Add wishlist admin options
55
+ */
56
+ public function add_admin_options( $options ) {
57
+
58
+ $new_options = array();
59
+
60
+ if ( $options ) {
61
+ foreach ( $options as $section_name => $section ) {
62
+ foreach ( $section as $values ) {
63
+
64
+ $new_options[$section_name][] = $values;
65
+
66
+ if ( isset( $values['id'] ) && $values['id'] === 'show_stock' ) {
67
+
68
+ $new_options[$section_name][] = array(
69
+ "name" => __( "Show AWL labels?", "advanced-woo-search" ),
70
+ "desc" => __( "Show or not AWL plugin labels for all products inside search results.", "advanced-woo-search" ),
71
+ "id" => "show_awl_labels",
72
+ "value" => 'true',
73
+ "type" => "radio",
74
+ 'choices' => array(
75
+ 'true' => __( 'On', 'advanced-woo-search' ),
76
+ 'false' => __( 'Off', 'advanced-woo-search' )
77
+ )
78
+ );
79
+
80
+ }
81
+
82
+ }
83
+ }
84
+
85
+ return $new_options;
86
+
87
+ }
88
+
89
+ return $options;
90
+
91
+ }
92
+
93
+ /*
94
+ * Save product title before adding labels to it
95
+ */
96
+ public function aws_old_title_search_result( $title ) {
97
+ $this->old_title = $title;
98
+ return $title;
99
+ }
100
+
101
+ /*
102
+ * Hide labels is such option is enabled
103
+ */
104
+ public function aws_title_search_result( $title ) {
105
+
106
+ if ( $title && preg_match( '/aws_result_labels/i', $title ) ) {
107
+
108
+ $show_labels = AWS()->get_settings( 'show_awl_labels' );
109
+ if ( ! $show_labels ) {
110
+ $show_labels = 'true';
111
+ }
112
+
113
+ if ( $show_labels === 'false' ) {
114
+ $title = $this->old_title;
115
+ }
116
+
117
+ }
118
+
119
+ return $title;
120
+
121
+ }
122
+
123
+ }
124
+
125
+ endif;
126
+
127
+ AWS_AWL::instance();
includes/modules/class-aws-wcfm.php CHANGED
@@ -47,6 +47,8 @@ if ( ! class_exists( 'AWS_WCFM' ) ) :
47
  add_filter( 'aws_searchbox_markup', array( $this, 'wcfm_searchbox_markup' ), 1, 2 );
48
  add_filter( 'aws_front_data_parameters', array( $this, 'wcfm_front_data_parameters' ), 1 );
49
  add_filter( 'aws_search_query_array', array( $this, 'wcfm_search_query_array' ), 1 );
 
 
50
  }
51
 
52
  /*
@@ -165,6 +167,71 @@ if ( ! class_exists( 'AWS_WCFM' ) ) :
165
 
166
  }
167
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  /*
169
  * Get current store object
170
  */
47
  add_filter( 'aws_searchbox_markup', array( $this, 'wcfm_searchbox_markup' ), 1, 2 );
48
  add_filter( 'aws_front_data_parameters', array( $this, 'wcfm_front_data_parameters' ), 1 );
49
  add_filter( 'aws_search_query_array', array( $this, 'wcfm_search_query_array' ), 1 );
50
+ add_filter( 'aws_terms_search_query', array( $this, 'wcfm_terms_search_query' ), 1, 2 );
51
+ add_filter( 'aws_search_tax_results', array( $this, 'wcfm_search_tax_results' ), 1 );
52
  }
53
 
54
  /*
167
 
168
  }
169
 
170
+ /*
171
+ * WCFM - WooCommerce Multivendor Marketplace limit search inside vendoes shop for taxonomies
172
+ */
173
+ public function wcfm_terms_search_query( $sql, $taxonomy ) {
174
+
175
+ global $wpdb;
176
+
177
+ $store = false;
178
+
179
+ if ( isset( $_REQUEST['aws_tax'] ) && $_REQUEST['aws_tax'] && strpos( $_REQUEST['aws_tax'], 'store:' ) !== false ) {
180
+ $vendor_id = intval( str_replace( 'store:', '', $_REQUEST['aws_tax'] ) );
181
+ $store = function_exists( 'wcfmmp_get_store' ) ? wcfmmp_get_store( $vendor_id ) : false;
182
+ } else {
183
+ $store = $this->get_current_store();
184
+ }
185
+
186
+ if ( $store ) {
187
+ $all_vendor_tax = array();
188
+ foreach ( $taxonomy as $taxonomy_slug ) {
189
+ $vendor_tax = $store->get_store_taxonomies( $taxonomy_slug );
190
+ if ( ! empty( $vendor_tax) ) {
191
+ $all_vendor_tax = array_merge( $all_vendor_tax, $vendor_tax );
192
+ }
193
+ }
194
+
195
+ if ( ! empty( $all_vendor_tax ) ) {
196
+ $sql_terms = "AND $wpdb->term_taxonomy.term_id IN ( " . implode( ',', $all_vendor_tax ) . " )";
197
+ $sql = str_replace( 'WHERE 1 = 1', 'WHERE 1 = 1 ' . $sql_terms, $sql );
198
+ } else {
199
+ $sql = '';
200
+ }
201
+
202
+ }
203
+
204
+ return $sql;
205
+
206
+ }
207
+
208
+ /*
209
+ * WCFM - Update links for taxonomies inside vendors store
210
+ */
211
+ public function wcfm_search_tax_results( $result_array ) {
212
+
213
+ $store = false;
214
+ if ( isset( $_REQUEST['aws_tax'] ) && $_REQUEST['aws_tax'] && strpos( $_REQUEST['aws_tax'], 'store:' ) !== false ) {
215
+ $vendor_id = intval( str_replace( 'store:', '', $_REQUEST['aws_tax'] ) );
216
+ $store = function_exists( 'wcfmmp_get_store' ) ? wcfmmp_get_store( $vendor_id ) : false;
217
+ } else {
218
+ $store = $this->get_current_store();
219
+ }
220
+
221
+ if ( $store && $result_array ) {
222
+ foreach ( $result_array as $tax_name => $items ) {
223
+ $url_base = ( $tax_name === 'product_cat' ) ? 'category' : 'tax-' . $tax_name;
224
+ foreach ( $items as $item_key => $item ) {
225
+ $result_array[$tax_name][$item_key]['link'] = $store->get_shop_url() . $url_base . '/' . $item['slug'];
226
+ $result_array[$tax_name][$item_key]['count'] = '';
227
+ }
228
+ }
229
+ }
230
+
231
+ return $result_array;
232
+
233
+ }
234
+
235
  /*
236
  * Get current store object
237
  */
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.29
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -167,6 +167,12 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
167
 
168
  == Changelog ==
169
 
 
 
 
 
 
 
170
  = 2.29 ( 2021-06-07 ) =
171
  * Add - Woostify theme support
172
  * Dev - Fix search page filters
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.30
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
167
 
168
  == Changelog ==
169
 
170
+ = 2.30 ( 2021-06-21 ) =
171
+ * Add - Support for Advanced Woo Labels plugin
172
+ * Update - WCFM plugin fix for vendors shop search. Fix searching for vendor taxonomies
173
+ * Update - Fix styles for YITH Wishlist plugin
174
+ * Update - Tested with WC 5.4
175
+
176
  = 2.29 ( 2021-06-07 ) =
177
  * Add - Woostify theme support
178
  * Dev - Fix search page filters