Advanced Woo Search - Version 2.15

Version Description

( 2020-11-16 ) = * Update - Support for WCFM - WooCommerce Multivendor Marketplace plugin: add seamless integration for the vendors shop page, limit search results to vendor products only * Update - Settings page styles * Dev - Add aws_admin_page_options filter

Download this release

Release Info

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

Code changes from version 2.14 to 2.15

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.14
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: 4.6.0
12
  */
13
 
14
 
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
16
  exit;
17
  }
18
 
19
- define( 'AWS_VERSION', '2.14' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
+ Version: 2.15
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: 4.7.0
12
  */
13
 
14
 
16
  exit;
17
  }
18
 
19
+ define( 'AWS_VERSION', '2.15' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
includes/admin/class-aws-admin-options.php CHANGED
@@ -566,6 +566,13 @@ if ( ! class_exists( 'AWS_Admin_Options' ) ) :
566
  )
567
  );
568
 
 
 
 
 
 
 
 
569
  return $options;
570
 
571
  }
566
  )
567
  );
568
 
569
+ /**
570
+ * Filter admin page options
571
+ * @since 2.15
572
+ * @param array $options Array of options
573
+ */
574
+ $options = apply_filters( 'aws_admin_page_options', $options );
575
+
576
  return $options;
577
 
578
  }
includes/class-aws-integrations.php CHANGED
@@ -226,6 +226,12 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
226
  include_once( AWS_DIR . '/includes/modules/divi/class-divi-aws-module.php' );
227
  }
228
 
 
 
 
 
 
 
229
  }
230
 
231
  /*
@@ -1102,6 +1108,11 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
1102
  $selectors[] = '#search-form form';
1103
  }
1104
 
 
 
 
 
 
1105
  return $selectors;
1106
 
1107
  }
226
  include_once( AWS_DIR . '/includes/modules/divi/class-divi-aws-module.php' );
227
  }
228
 
229
+ // WCFM - WooCommerce Multivendor Marketplace
230
+ if ( class_exists( 'WCFMmp' ) ) {
231
+ include_once( AWS_DIR . '/includes/modules/class-aws-wcfm.php' );
232
+ AWS_WCFM::instance();
233
+ }
234
+
235
  }
236
 
237
  /*
1108
  $selectors[] = '#search-form form';
1109
  }
1110
 
1111
+ // WCFM - WooCommerce Multivendor Marketplace
1112
+ if ( class_exists( 'WCFMmp' ) ) {
1113
+ $selectors[] = '#wcfmmp-store .woocommerce-product-search';
1114
+ }
1115
+
1116
  return $selectors;
1117
 
1118
  }
includes/modules/class-aws-wcfm.php ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WCFM - WooCommerce Multivendor Marketplace plugin support
4
+ */
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit; // Exit if accessed directly.
8
+ }
9
+
10
+ if ( ! class_exists( 'AWS_WCFM' ) ) :
11
+
12
+ /**
13
+ * Class
14
+ */
15
+ class AWS_WCFM {
16
+
17
+ /**
18
+ * Main AWS_WCFM Instance
19
+ *
20
+ * Ensures only one instance of AWS_WCFM is loaded or can be loaded.
21
+ *
22
+ * @static
23
+ * @return AWS_WCFM - Main instance
24
+ */
25
+ protected static $_instance = null;
26
+
27
+ /**
28
+ * Main AWS_WCFM Instance
29
+ *
30
+ * Ensures only one instance of AWS_WCFM is loaded or can be loaded.
31
+ *
32
+ * @static
33
+ * @return AWS_WCFM - Main instance
34
+ */
35
+ public static function instance() {
36
+ if ( is_null( self::$_instance ) ) {
37
+ self::$_instance = new self();
38
+ }
39
+ return self::$_instance;
40
+ }
41
+
42
+ /**
43
+ * Constructor
44
+ */
45
+ public function __construct() {
46
+ add_filter( 'aws_searchbox_markup', array( $this, 'wcfm_searchbox_markup' ), 1, 2 );
47
+ add_filter( 'aws_front_data_parameters', array( $this, 'wcfm_front_data_parameters' ), 1 );
48
+ add_filter( 'aws_search_query_array', array( $this, 'wcfm_search_query_array' ), 1 );
49
+ }
50
+
51
+ /*
52
+ * WCFM - WooCommerce Multivendor Marketplace update search page url for vendors shops
53
+ */
54
+ public function wcfm_searchbox_markup( $markup, $params ) {
55
+
56
+ $store = $this->get_current_store();
57
+
58
+ if ( $store ) {
59
+ $markup = preg_replace( '/action="(.+?)"/i', 'action="' . $store->get_shop_url() . '"', $markup );
60
+ }
61
+
62
+ return $markup;
63
+
64
+ }
65
+
66
+ /*
67
+ * WCFM - WooCommerce Multivendor Marketplace limit search inside vendors shop
68
+ */
69
+ public function wcfm_front_data_parameters( $params ) {
70
+
71
+ $store = $this->get_current_store();
72
+
73
+ if ( $store ) {
74
+ $params['data-tax'] = 'store:' . $store->get_id();
75
+ }
76
+
77
+ return $params;
78
+
79
+ }
80
+
81
+ /*
82
+ * WCFM - WooCommerce Multivendor Marketplace limit search inside vendoes shop
83
+ */
84
+ public function wcfm_search_query_array( $query ) {
85
+
86
+ $vendor_id = false;
87
+
88
+ if ( isset( $_REQUEST['aws_tax'] ) && $_REQUEST['aws_tax'] && strpos( $_REQUEST['aws_tax'], 'store:' ) !== false ) {
89
+ $vendor_id = intval( str_replace( 'store:', '', $_REQUEST['aws_tax'] ) );
90
+ } else {
91
+ $store = $this->get_current_store();
92
+ if ( $store ) {
93
+ $vendor_id = $store->get_id();
94
+ }
95
+ }
96
+
97
+ if ( $vendor_id ) {
98
+
99
+ $store_products = get_posts( array(
100
+ 'posts_per_page' => -1,
101
+ 'fields' => 'ids',
102
+ 'post_type' => 'product',
103
+ 'post_status' => 'publish',
104
+ 'ignore_sticky_posts' => true,
105
+ 'suppress_filters' => true,
106
+ 'no_found_rows' => 1,
107
+ 'orderby' => 'ID',
108
+ 'order' => 'DESC',
109
+ 'lang' => '',
110
+ 'author' => $vendor_id
111
+ ) );
112
+
113
+ if ( $store_products ) {
114
+ $query['search'] .= " AND ( id IN ( " . implode( ',', $store_products ) . " ) )";
115
+ }
116
+
117
+ }
118
+
119
+ return $query;
120
+
121
+ }
122
+
123
+ /*
124
+ * Get current store object
125
+ */
126
+ private function get_current_store() {
127
+
128
+ $store = false;
129
+
130
+ if ( function_exists('wcfmmp_is_store_page') && function_exists('wcfm_get_option') && wcfmmp_is_store_page() ) {
131
+
132
+ $wcfm_store_url = wcfm_get_option( 'wcfm_store_url', 'store' );
133
+ $wcfm_store_name = apply_filters( 'wcfmmp_store_query_var', get_query_var( $wcfm_store_url ) );
134
+
135
+ if ( $wcfm_store_name ) {
136
+ $seller_info = get_user_by( 'slug', $wcfm_store_name );
137
+ if ( $seller_info && function_exists( 'wcfmmp_get_store' ) ) {
138
+ $store_user = wcfmmp_get_store( $seller_info->ID );
139
+ if ( $store_user ) {
140
+ $store = $store_user;
141
+ }
142
+ }
143
+ }
144
+
145
+ }
146
+
147
+ return $store;
148
+
149
+ }
150
+
151
+ }
152
+
153
+ endif;
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.5
7
- Stable tag: 2.14
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -64,6 +64,7 @@ Additional features available only in PRO plugin version.
64
  * **Add to cart** button in search results
65
  * Support for [WooCommerce Brands plugin](https://woocommerce.com/products/brands/)
66
  * Support for Advanced Custom Fields plugin
 
67
 
68
  [Features list](https://advanced-woo-search.com/features/?utm_source=wp-repo&utm_medium=listing&utm_campaign=aws-repo)
69
 
@@ -111,6 +112,11 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
111
 
112
  == Changelog ==
113
 
 
 
 
 
 
114
  = 2.14 ( 2020-11-02 ) =
115
  * Update - Elementor search page support
116
  * Update - Divi Builder search page support
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.6
7
+ Stable tag: 2.15
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
64
  * **Add to cart** button in search results
65
  * Support for [WooCommerce Brands plugin](https://woocommerce.com/products/brands/)
66
  * Support for Advanced Custom Fields plugin
67
+ * Support for WCFM - WooCommerce Multivendor Marketplace plugin
68
 
69
  [Features list](https://advanced-woo-search.com/features/?utm_source=wp-repo&utm_medium=listing&utm_campaign=aws-repo)
70
 
112
 
113
  == Changelog ==
114
 
115
+ = 2.15 ( 2020-11-16 ) =
116
+ * Update - Support for WCFM - WooCommerce Multivendor Marketplace plugin: add seamless integration for the vendors shop page, limit search results to vendor products only
117
+ * Update - Settings page styles
118
+ * Dev - Add aws_admin_page_options filter
119
+
120
  = 2.14 ( 2020-11-02 ) =
121
  * Update - Elementor search page support
122
  * Update - Divi Builder search page support