Version Description
- Fix - Bug with WooCommerce attributes filter widget. Now its display proper number of attributes on search page
- Fix - Filter by attributes on search results page. Now search results works proper with multiple attributes filters
- Fix - WooCommerce price filter widget bug
- Fix - Search page queries
- Add - aws_index_apply_filters filter
- Update - aws_indexed_data filter filter
- Update - Improve synonyms support
Download this release
Release Info
Developer | Mihail Barinov |
Plugin | Advanced Woo Search |
Version | 1.82 |
Comparing to | |
See all releases |
Code changes from version 1.81 to 1.82
- advanced-woo-search.php +9 -4
- includes/{class-aws-admin-fields.php → admin/class-aws-admin-fields.php} +4 -3
- includes/admin/class-aws-admin-options.php +520 -0
- includes/{class-aws-admin.php → admin/class-aws-admin.php} +9 -101
- includes/class-aws-helpers.php +1 -1
- includes/class-aws-order.php +45 -33
- includes/class-aws-search-page.php +67 -4
- includes/class-aws-table.php +50 -32
- includes/options.php +0 -366
- readme.txt +10 -1
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: 1.
|
7 |
Author: ILLID
|
8 |
Author URI: https://advanced-woo-search.com/
|
9 |
Text Domain: advanced-woo-search
|
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
16 |
exit;
|
17 |
}
|
18 |
|
19 |
-
define( 'AWS_VERSION', '1.
|
20 |
|
21 |
|
22 |
define( 'AWS_DIR', dirname( __FILE__ ) );
|
@@ -101,10 +101,9 @@ final class AWS_Main {
|
|
101 |
* Include required core files used in admin and on the frontend.
|
102 |
*/
|
103 |
public function includes() {
|
|
|
104 |
include_once( 'includes/class-aws-helpers.php' );
|
105 |
include_once( 'includes/class-aws-versions.php' );
|
106 |
-
include_once( 'includes/class-aws-admin-fields.php' );
|
107 |
-
include_once( 'includes/class-aws-admin.php' );
|
108 |
include_once( 'includes/class-aws-cache.php' );
|
109 |
include_once( 'includes/class-aws-plurals.php' );
|
110 |
include_once( 'includes/class-aws-table.php' );
|
@@ -114,6 +113,12 @@ final class AWS_Main {
|
|
114 |
include_once( 'includes/class-aws-order.php' );
|
115 |
include_once( 'includes/class-aws-integrations.php' );
|
116 |
include_once( 'includes/widget.php' );
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
}
|
118 |
|
119 |
/*
|
3 |
/*
|
4 |
Plugin Name: Advanced Woo Search
|
5 |
Description: Advance ajax WooCommerce product search.
|
6 |
+
Version: 1.82
|
7 |
Author: ILLID
|
8 |
Author URI: https://advanced-woo-search.com/
|
9 |
Text Domain: advanced-woo-search
|
16 |
exit;
|
17 |
}
|
18 |
|
19 |
+
define( 'AWS_VERSION', '1.82' );
|
20 |
|
21 |
|
22 |
define( 'AWS_DIR', dirname( __FILE__ ) );
|
101 |
* Include required core files used in admin and on the frontend.
|
102 |
*/
|
103 |
public function includes() {
|
104 |
+
|
105 |
include_once( 'includes/class-aws-helpers.php' );
|
106 |
include_once( 'includes/class-aws-versions.php' );
|
|
|
|
|
107 |
include_once( 'includes/class-aws-cache.php' );
|
108 |
include_once( 'includes/class-aws-plurals.php' );
|
109 |
include_once( 'includes/class-aws-table.php' );
|
113 |
include_once( 'includes/class-aws-order.php' );
|
114 |
include_once( 'includes/class-aws-integrations.php' );
|
115 |
include_once( 'includes/widget.php' );
|
116 |
+
|
117 |
+
// Admin
|
118 |
+
include_once( 'includes/admin/class-aws-admin.php' );
|
119 |
+
include_once( 'includes/admin/class-aws-admin-fields.php' );
|
120 |
+
include_once( 'includes/admin/class-aws-admin-options.php' );
|
121 |
+
|
122 |
}
|
123 |
|
124 |
/*
|
includes/{class-aws-admin-fields.php → admin/class-aws-admin-fields.php}
RENAMED
@@ -24,10 +24,11 @@ if ( ! class_exists( 'AWS_Admin_Fields' ) ) :
|
|
24 |
/*
|
25 |
* Constructor
|
26 |
*/
|
27 |
-
public function __construct( $
|
28 |
|
29 |
-
$
|
30 |
-
$this->
|
|
|
31 |
|
32 |
$this->generate_fields();
|
33 |
|
24 |
/*
|
25 |
* Constructor
|
26 |
*/
|
27 |
+
public function __construct( $tab_name ) {
|
28 |
|
29 |
+
$options = AWS_Admin_Options::options_array( $tab_name );
|
30 |
+
$this->options_array = $options[$tab_name];
|
31 |
+
$this->plugin_options = AWS_Admin_Options::get_settings();
|
32 |
|
33 |
$this->generate_fields();
|
34 |
|
includes/admin/class-aws-admin-options.php
ADDED
@@ -0,0 +1,520 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
|
7 |
+
|
8 |
+
if ( ! class_exists( 'AWS_Admin_Options' ) ) :
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Class for plugin admin options methods
|
12 |
+
*/
|
13 |
+
class AWS_Admin_Options {
|
14 |
+
|
15 |
+
/*
|
16 |
+
* Get default settings values
|
17 |
+
* @param string $tab Tab name
|
18 |
+
* @return array
|
19 |
+
*/
|
20 |
+
static public function get_default_settings( $tab = false ) {
|
21 |
+
|
22 |
+
$options = self::options_array( $tab );
|
23 |
+
$default_settings = array();
|
24 |
+
|
25 |
+
foreach ( $options as $section_name => $section ) {
|
26 |
+
|
27 |
+
foreach ( $section as $values ) {
|
28 |
+
|
29 |
+
if ( $values['type'] === 'heading' ) {
|
30 |
+
continue;
|
31 |
+
}
|
32 |
+
|
33 |
+
if ( $values['type'] === 'textarea' ) {
|
34 |
+
if ( function_exists('sanitize_textarea_field') ) {
|
35 |
+
$default_settings[ $values['id'] ] = (string) sanitize_textarea_field( $values['value'] );
|
36 |
+
} else {
|
37 |
+
$default_settings[ $values['id'] ] = (string) str_replace( "<\n", "<\n", wp_strip_all_tags( $values['value'] ) );
|
38 |
+
}
|
39 |
+
continue;
|
40 |
+
}
|
41 |
+
|
42 |
+
$default_settings[$values['id']] = (string) sanitize_text_field( $values['value'] );
|
43 |
+
|
44 |
+
if ( isset( $values['sub_option'] ) ) {
|
45 |
+
$default_settings[$values['sub_option']['id']] = (string) sanitize_text_field( $values['sub_option']['value'] );
|
46 |
+
}
|
47 |
+
|
48 |
+
}
|
49 |
+
|
50 |
+
}
|
51 |
+
|
52 |
+
return $default_settings;
|
53 |
+
|
54 |
+
}
|
55 |
+
|
56 |
+
/*
|
57 |
+
* Update plugin settings
|
58 |
+
*/
|
59 |
+
static public function update_settings() {
|
60 |
+
|
61 |
+
$options = self::options_array();
|
62 |
+
$update_settings = self::get_settings();
|
63 |
+
$current_tab = empty( $_GET['tab'] ) ? 'general' : sanitize_text_field( $_GET['tab'] );
|
64 |
+
|
65 |
+
foreach ( $options[$current_tab] as $values ) {
|
66 |
+
|
67 |
+
if ( $values['type'] === 'heading' ) {
|
68 |
+
continue;
|
69 |
+
}
|
70 |
+
|
71 |
+
if ( $values['type'] === 'checkbox' ) {
|
72 |
+
|
73 |
+
$checkbox_array = array();
|
74 |
+
|
75 |
+
foreach ( $values['choices'] as $key => $value ) {
|
76 |
+
$new_value = isset( $_POST[ $values['id'] ][$key] ) ? '1' : '0';
|
77 |
+
$checkbox_array[$key] = (string) sanitize_text_field( $new_value );
|
78 |
+
}
|
79 |
+
|
80 |
+
$update_settings[ $values['id'] ] = $checkbox_array;
|
81 |
+
|
82 |
+
continue;
|
83 |
+
}
|
84 |
+
|
85 |
+
$new_value = isset( $_POST[ $values['id'] ] ) ? $_POST[ $values['id'] ] : '';
|
86 |
+
|
87 |
+
if ( $values['type'] === 'textarea' ) {
|
88 |
+
if ( function_exists('sanitize_textarea_field') ) {
|
89 |
+
$update_settings[ $values['id'] ] = (string) sanitize_textarea_field( $new_value );
|
90 |
+
} else {
|
91 |
+
$update_settings[ $values['id'] ] = (string) str_replace( "<\n", "<\n", wp_strip_all_tags( $new_value ) );
|
92 |
+
}
|
93 |
+
continue;
|
94 |
+
}
|
95 |
+
|
96 |
+
$update_settings[ $values['id'] ] = (string) sanitize_text_field( $new_value );
|
97 |
+
|
98 |
+
if ( isset( $values['sub_option'] ) ) {
|
99 |
+
$new_value = isset( $_POST[ $values['sub_option']['id'] ] ) ? $_POST[ $values['sub_option']['id'] ] : '';
|
100 |
+
$update_settings[ $values['sub_option']['id'] ] = (string) sanitize_text_field( $new_value );
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
update_option( 'aws_settings', $update_settings );
|
105 |
+
|
106 |
+
AWS_Helpers::register_wpml_translations( $update_settings );
|
107 |
+
|
108 |
+
do_action( 'aws_settings_saved' );
|
109 |
+
|
110 |
+
do_action( 'aws_cache_clear' );
|
111 |
+
|
112 |
+
}
|
113 |
+
|
114 |
+
/*
|
115 |
+
* Get plugin settings
|
116 |
+
* @return array
|
117 |
+
*/
|
118 |
+
static public function get_settings() {
|
119 |
+
$plugin_options = get_option( 'aws_settings' );
|
120 |
+
return $plugin_options;
|
121 |
+
}
|
122 |
+
|
123 |
+
/*
|
124 |
+
* Options array that generate settings page
|
125 |
+
*
|
126 |
+
* @param string $tab Tab name
|
127 |
+
* @return array
|
128 |
+
*/
|
129 |
+
static public function options_array( $tab = false ) {
|
130 |
+
|
131 |
+
$options = self::include_options();
|
132 |
+
$options_arr = array();
|
133 |
+
|
134 |
+
foreach ( $options as $tab_name => $tab_options ) {
|
135 |
+
|
136 |
+
if ( $tab && $tab !== $tab_name ) {
|
137 |
+
continue;
|
138 |
+
}
|
139 |
+
|
140 |
+
$options_arr[$tab_name] = $tab_options;
|
141 |
+
|
142 |
+
}
|
143 |
+
|
144 |
+
return $options_arr;
|
145 |
+
|
146 |
+
}
|
147 |
+
|
148 |
+
/*
|
149 |
+
* Include options array
|
150 |
+
* @return array
|
151 |
+
*/
|
152 |
+
static public function include_options() {
|
153 |
+
|
154 |
+
$options = array();
|
155 |
+
|
156 |
+
$options['general'][] = array(
|
157 |
+
"name" => __( "Main Settings", "advanced-woo-search" ),
|
158 |
+
"type" => "heading"
|
159 |
+
);
|
160 |
+
|
161 |
+
$options['general'][] = array(
|
162 |
+
"name" => __( "Seamless integration", "advanced-woo-search" ),
|
163 |
+
"desc" => __( "Replace all the standard search forms on your website ( may not work with some themes ).", "advanced-woo-search" ),
|
164 |
+
"id" => "seamless",
|
165 |
+
"value" => 'false',
|
166 |
+
"type" => "radio",
|
167 |
+
'choices' => array(
|
168 |
+
'true' => __( 'On', 'advanced-woo-search' ),
|
169 |
+
'false' => __( 'Off', 'advanced-woo-search' ),
|
170 |
+
)
|
171 |
+
);
|
172 |
+
|
173 |
+
$options['general'][] = array(
|
174 |
+
"name" => __( "Cache results", "advanced-woo-search" ),
|
175 |
+
"desc" => __( "Turn off if you have old data in the search results after content of products was changed.<br><strong>CAUTION:</strong> can dramatically increase search speed", "advanced-woo-search" ),
|
176 |
+
"id" => "cache",
|
177 |
+
"value" => 'true',
|
178 |
+
"type" => "radio",
|
179 |
+
'choices' => array(
|
180 |
+
'true' => __( 'On', 'advanced-woo-search' ),
|
181 |
+
'false' => __( 'Off', 'advanced-woo-search' ),
|
182 |
+
)
|
183 |
+
);
|
184 |
+
|
185 |
+
$options['general'][] = array(
|
186 |
+
"name" => __( "Sync index table", "advanced-woo-search" ),
|
187 |
+
"desc" => __( "Automatically update plugin index table when product content was changed. This means that in search there will be always latest product data.", "advanced-woo-search" ) . '<br>' .
|
188 |
+
__( "Turn this off if you have any problems with performance.", "advanced-woo-search" ),
|
189 |
+
"id" => "autoupdates",
|
190 |
+
"value" => 'true',
|
191 |
+
"type" => "radio",
|
192 |
+
'choices' => array(
|
193 |
+
'true' => __( 'On', 'advanced-woo-search' ),
|
194 |
+
'false' => __( 'Off', 'advanced-woo-search' ),
|
195 |
+
)
|
196 |
+
);
|
197 |
+
|
198 |
+
$options['general'][] = array(
|
199 |
+
"name" => __( "Search in", "advanced-woo-search" ),
|
200 |
+
"desc" => __( "Search source: Drag&drop sources to activate or deactivate them.", "advanced-woo-search" ),
|
201 |
+
"id" => "search_in",
|
202 |
+
"value" => "title,content,sku,excerpt",
|
203 |
+
"choices" => array( "title", "content", "sku", "excerpt", "category", "tag", "id" ),
|
204 |
+
"type" => "sortable"
|
205 |
+
);
|
206 |
+
|
207 |
+
$options['general'][] = array(
|
208 |
+
"name" => __( "Show out-of-stock", "advanced-woo-search" ),
|
209 |
+
"desc" => __( "Show out-of-stock products in search", "advanced-woo-search" ),
|
210 |
+
"id" => "outofstock",
|
211 |
+
"value" => 'true',
|
212 |
+
"type" => "radio",
|
213 |
+
'choices' => array(
|
214 |
+
'true' => __( 'Show', 'advanced-woo-search' ),
|
215 |
+
'false' => __( 'Hide', 'advanced-woo-search' ),
|
216 |
+
)
|
217 |
+
);
|
218 |
+
|
219 |
+
$options['general'][] = array(
|
220 |
+
"name" => __( "Stop words list", "advanced-woo-search" ),
|
221 |
+
"desc" => __( "Comma separated list of words that will be excluded from search.", "advanced-woo-search" ) . '<br>' . __( "Re-index required on change.", "advanced-woo-search" ),
|
222 |
+
"id" => "stopwords",
|
223 |
+
"value" => "a, also, am, an, and, are, as, at, be, but, by, call, can, co, con, de, do, due, eg, eight, etc, even, ever, every, for, from, full, go, had, has, hasnt, have, he, hence, her, here, his, how, ie, if, in, inc, into, is, it, its, ltd, me, my, no, none, nor, not, now, of, off, on, once, one, only, onto, or, our, ours, out, over, own, part, per, put, re, see, so, some, ten, than, that, the, their, there, these, they, this, three, thru, thus, to, too, top, un, up, us, very, via, was, we, well, were, what, when, where, who, why, will",
|
224 |
+
"cols" => "85",
|
225 |
+
"rows" => "3",
|
226 |
+
"type" => "textarea"
|
227 |
+
);
|
228 |
+
|
229 |
+
$options['general'][] = array(
|
230 |
+
"name" => __( "Synonyms", "advanced-woo-search" ),
|
231 |
+
"desc" => __( "Comma separated list of synonym words. Each group of synonyms must be on separated text line.", "advanced-woo-search" ) . '<br>' . __( "Re-index required on change.", "advanced-woo-search" ),
|
232 |
+
"id" => "synonyms",
|
233 |
+
"value" => "buy, pay, purchase, acquire box, housing, unit, package",
|
234 |
+
"cols" => "85",
|
235 |
+
"rows" => "3",
|
236 |
+
"type" => "textarea"
|
237 |
+
);
|
238 |
+
|
239 |
+
$options['general'][] = array(
|
240 |
+
"name" => __( "Use Google Analytics", "advanced-woo-search" ),
|
241 |
+
"desc" => __( "Use google analytics to track searches. You need google analytics to be installed on your site.", "advanced-woo-search" ) .
|
242 |
+
'<br>' . sprintf( __( "Data will be visible inside Google Analytics 'Site Search' report. Need to activate 'Site Search' feature inside GA. %s", "advanced-woo-search" ), '<a href="https://advanced-woo-search.com/guide/google-analytics/" target="_blank">' . __( 'More info', 'advanced-woo-search' ) . '</a>' ) .
|
243 |
+
'<br>' . __( "Also will send event with category - 'AWS search', action - 'AWS Search Term' and label of value of search term.", "advanced-woo-search" ),
|
244 |
+
"id" => "use_analytics",
|
245 |
+
"value" => 'false',
|
246 |
+
"type" => "radio",
|
247 |
+
'choices' => array(
|
248 |
+
'true' => __( 'On', 'advanced-woo-search' ),
|
249 |
+
'false' => __( 'Off', 'advanced-woo-search' ),
|
250 |
+
)
|
251 |
+
);
|
252 |
+
|
253 |
+
// Search Form Settings
|
254 |
+
$options['form'][] = array(
|
255 |
+
"name" => __( "Text for search field", "advanced-woo-search" ),
|
256 |
+
"desc" => __( "Text for search field placeholder.", "advanced-woo-search" ),
|
257 |
+
"id" => "search_field_text",
|
258 |
+
"value" => __( "Search", "advanced-woo-search" ),
|
259 |
+
"type" => "text"
|
260 |
+
);
|
261 |
+
|
262 |
+
$options['form'][] = array(
|
263 |
+
"name" => __( "Text for show more button", "advanced-woo-search" ),
|
264 |
+
"desc" => __( "Text for link to search results page at the bottom of search results block.", "advanced-woo-search" ),
|
265 |
+
"id" => "show_more_text",
|
266 |
+
"value" => __( "View all results", "advanced-woo-search" ),
|
267 |
+
"type" => "text"
|
268 |
+
);
|
269 |
+
|
270 |
+
$options['form'][] = array(
|
271 |
+
"name" => __( "Nothing found field", "advanced-woo-search" ),
|
272 |
+
"desc" => __( "Text when there is no search results.", "advanced-woo-search" ),
|
273 |
+
"id" => "not_found_text",
|
274 |
+
"value" => __( "Nothing found", "advanced-woo-search" ),
|
275 |
+
"type" => "textarea"
|
276 |
+
);
|
277 |
+
|
278 |
+
$options['form'][] = array(
|
279 |
+
"name" => __( "Minimum number of characters", "advanced-woo-search" ),
|
280 |
+
"desc" => __( "Minimum number of characters required to run ajax search.", "advanced-woo-search" ),
|
281 |
+
"id" => "min_chars",
|
282 |
+
"value" => 1,
|
283 |
+
"type" => "number"
|
284 |
+
);
|
285 |
+
|
286 |
+
$options['form'][] = array(
|
287 |
+
"name" => __( "Show loader", "advanced-woo-search" ),
|
288 |
+
"desc" => __( "Show loader animation while searching.", "advanced-woo-search" ),
|
289 |
+
"id" => "show_loader",
|
290 |
+
"value" => 'true',
|
291 |
+
"type" => "radio",
|
292 |
+
'choices' => array(
|
293 |
+
'true' => __( 'On', 'advanced-woo-search' ),
|
294 |
+
'false' => __( 'Off', 'advanced-woo-search' ),
|
295 |
+
)
|
296 |
+
);
|
297 |
+
|
298 |
+
$options['form'][] = array(
|
299 |
+
"name" => __( "Show clear button", "advanced-woo-search" ),
|
300 |
+
"desc" => __( "Show 'Clear search string' button for desktop devices ( for mobile it is always visible ).", "advanced-woo-search" ),
|
301 |
+
"id" => "show_clear",
|
302 |
+
"value" => 'true',
|
303 |
+
"type" => "radio",
|
304 |
+
'choices' => array(
|
305 |
+
'true' => __( 'On', 'advanced-woo-search' ),
|
306 |
+
'false' => __( 'Off', 'advanced-woo-search' ),
|
307 |
+
)
|
308 |
+
);
|
309 |
+
|
310 |
+
$options['form'][] = array(
|
311 |
+
"name" => __( "Show 'View All Results'", "advanced-woo-search" ),
|
312 |
+
"desc" => __( "Show link to search results page at the bottom of search results block.", "advanced-woo-search" ),
|
313 |
+
"id" => "show_more",
|
314 |
+
"value" => 'false',
|
315 |
+
"type" => "radio",
|
316 |
+
'choices' => array(
|
317 |
+
'true' => __( 'On', 'advanced-woo-search' ),
|
318 |
+
'false' => __( 'Off', 'advanced-woo-search' )
|
319 |
+
)
|
320 |
+
);
|
321 |
+
|
322 |
+
$options['form'][] = array(
|
323 |
+
"name" => __( "Search Results", "advanced-woo-search" ),
|
324 |
+
"desc" => __( "Choose how to view search results.", "advanced-woo-search" ),
|
325 |
+
"id" => "show_page",
|
326 |
+
"value" => 'false',
|
327 |
+
"type" => "radio",
|
328 |
+
'choices' => array(
|
329 |
+
'true' => __( 'Both ajax search results and search results page', 'advanced-woo-search' ),
|
330 |
+
'false' => __( 'Only ajax search results ( no search results page )', 'advanced-woo-search' ),
|
331 |
+
'ajax_off' => __( 'Only search results page ( no ajax search results )', 'advanced-woo-search' )
|
332 |
+
)
|
333 |
+
);
|
334 |
+
|
335 |
+
$options['form'][] = array(
|
336 |
+
"name" => __( "Form Styling", "advanced-woo-search" ),
|
337 |
+
"desc" => __( "Choose search form layout", "advanced-woo-search" ) . '<br>' . __( "Filter button will be visible only if you have more than one active filter for current search form instance.", "advanced-woo-search" ),
|
338 |
+
"id" => "buttons_order",
|
339 |
+
"value" => '1',
|
340 |
+
"type" => "radio-image",
|
341 |
+
'choices' => array(
|
342 |
+
'1' => 'btn-layout1.png',
|
343 |
+
'2' => 'btn-layout2.png',
|
344 |
+
'3' => 'btn-layout3.png',
|
345 |
+
)
|
346 |
+
);
|
347 |
+
|
348 |
+
// Search Results Settings
|
349 |
+
$options['results'][] = array(
|
350 |
+
"name" => __( "Description source", "advanced-woo-search" ),
|
351 |
+
"desc" => __( "From where to take product description.<br>If first source is empty data will be taken from other sources.", "advanced-woo-search" ),
|
352 |
+
"id" => "desc_source",
|
353 |
+
"value" => 'content',
|
354 |
+
"type" => "radio",
|
355 |
+
'choices' => array(
|
356 |
+
'content' => __( 'Content', 'advanced-woo-search' ),
|
357 |
+
'excerpt' => __( 'Excerpt', 'advanced-woo-search' ),
|
358 |
+
)
|
359 |
+
);
|
360 |
+
|
361 |
+
$options['results'][] = array(
|
362 |
+
"name" => __( "Description length", "advanced-woo-search" ),
|
363 |
+
"desc" => __( "Maximal allowed number of words for product description.", "advanced-woo-search" ),
|
364 |
+
"id" => "excerpt_length",
|
365 |
+
"value" => 20,
|
366 |
+
"type" => "number"
|
367 |
+
);
|
368 |
+
|
369 |
+
$options['results'][] = array(
|
370 |
+
"name" => __( "Max number of results", "advanced-woo-search" ),
|
371 |
+
"desc" => __( "Maximum number of displayed search results.", "advanced-woo-search" ),
|
372 |
+
"id" => "results_num",
|
373 |
+
"value" => 10,
|
374 |
+
"type" => "number"
|
375 |
+
);
|
376 |
+
|
377 |
+
$options['results'][] = array(
|
378 |
+
"name" => __( "View", "advanced-woo-search" ),
|
379 |
+
"type" => "heading"
|
380 |
+
);
|
381 |
+
|
382 |
+
$options['results'][] = array(
|
383 |
+
"name" => __( "Show image", "advanced-woo-search" ),
|
384 |
+
"desc" => __( "Show product image for each search result.", "advanced-woo-search" ),
|
385 |
+
"id" => "show_image",
|
386 |
+
"value" => 'true',
|
387 |
+
"type" => "radio",
|
388 |
+
'choices' => array(
|
389 |
+
'true' => __( 'On', 'advanced-woo-search' ),
|
390 |
+
'false' => __( 'Off', 'advanced-woo-search' ),
|
391 |
+
)
|
392 |
+
);
|
393 |
+
|
394 |
+
$options['results'][] = array(
|
395 |
+
"name" => __( "Show description", "advanced-woo-search" ),
|
396 |
+
"desc" => __( "Show product description for each search result.", "advanced-woo-search" ),
|
397 |
+
"id" => "show_excerpt",
|
398 |
+
"value" => 'true',
|
399 |
+
"type" => "radio",
|
400 |
+
'choices' => array(
|
401 |
+
'true' => __( 'On', 'advanced-woo-search' ),
|
402 |
+
'false' => __( 'Off', 'advanced-woo-search' ),
|
403 |
+
)
|
404 |
+
);
|
405 |
+
|
406 |
+
$options['results'][] = array(
|
407 |
+
"name" => __( "Description content", "advanced-woo-search" ),
|
408 |
+
"desc" => __( "What to show in product description?", "advanced-woo-search" ),
|
409 |
+
"id" => "mark_words",
|
410 |
+
"value" => 'true',
|
411 |
+
"type" => "radio",
|
412 |
+
'choices' => array(
|
413 |
+
'true' => __( "Smart scrapping sentences with searching terms from product description.", "advanced-woo-search" ),
|
414 |
+
'false' => __( "First N words of product description ( number of words that you choose below. )", "advanced-woo-search" ),
|
415 |
+
)
|
416 |
+
);
|
417 |
+
|
418 |
+
$options['results'][] = array(
|
419 |
+
"name" => __( "Show price", "advanced-woo-search" ),
|
420 |
+
"desc" => __( "Show product price for each search result.", "advanced-woo-search" ),
|
421 |
+
"id" => "show_price",
|
422 |
+
"value" => 'true',
|
423 |
+
"type" => "radio",
|
424 |
+
'choices' => array(
|
425 |
+
'true' => __( 'On', 'advanced-woo-search' ),
|
426 |
+
'false' => __( 'Off', 'advanced-woo-search' ),
|
427 |
+
)
|
428 |
+
);
|
429 |
+
|
430 |
+
$options['results'][] = array(
|
431 |
+
"name" => __( "Show price for out of stock", "advanced-woo-search" ),
|
432 |
+
"desc" => __( "Show product price for out of stock products.", "advanced-woo-search" ),
|
433 |
+
"id" => "show_outofstock_price",
|
434 |
+
"value" => 'true',
|
435 |
+
"type" => "radio",
|
436 |
+
'choices' => array(
|
437 |
+
'true' => __( 'On', 'advanced-woo-search' ),
|
438 |
+
'false' => __( 'Off', 'advanced-woo-search' ),
|
439 |
+
)
|
440 |
+
);
|
441 |
+
|
442 |
+
$options['results'][] = array(
|
443 |
+
"name" => __( "Show categories archive", "advanced-woo-search" ),
|
444 |
+
"desc" => __( "Include categories archives pages to search result.", "advanced-woo-search" ),
|
445 |
+
"id" => "show_cats",
|
446 |
+
"value" => 'false',
|
447 |
+
"type" => "radio",
|
448 |
+
'choices' => array(
|
449 |
+
'true' => __( 'On', 'advanced-woo-search' ),
|
450 |
+
'false' => __( 'Off', 'advanced-woo-search' ),
|
451 |
+
)
|
452 |
+
);
|
453 |
+
|
454 |
+
$options['results'][] = array(
|
455 |
+
"name" => __( "Show tags archive", "advanced-woo-search" ),
|
456 |
+
"desc" => __( "Include tags archives pages to search results.", "advanced-woo-search" ),
|
457 |
+
"id" => "show_tags",
|
458 |
+
"value" => 'false',
|
459 |
+
"type" => "radio",
|
460 |
+
'choices' => array(
|
461 |
+
'true' => __( 'On', 'advanced-woo-search' ),
|
462 |
+
'false' => __( 'Off', 'advanced-woo-search' ),
|
463 |
+
)
|
464 |
+
);
|
465 |
+
|
466 |
+
$options['results'][] = array(
|
467 |
+
"name" => __( "Show sale badge", "advanced-woo-search" ),
|
468 |
+
"desc" => __( "Show sale badge for products in search results.", "advanced-woo-search" ),
|
469 |
+
"id" => "show_sale",
|
470 |
+
"value" => 'true',
|
471 |
+
"type" => "radio",
|
472 |
+
'choices' => array(
|
473 |
+
'true' => __( 'On', 'advanced-woo-search' ),
|
474 |
+
'false' => __( 'Off', 'advanced-woo-search' ),
|
475 |
+
)
|
476 |
+
);
|
477 |
+
|
478 |
+
$options['results'][] = array(
|
479 |
+
"name" => __( "Show product SKU", "advanced-woo-search" ),
|
480 |
+
"desc" => __( "Show product SKU in search results.", "advanced-woo-search" ),
|
481 |
+
"id" => "show_sku",
|
482 |
+
"value" => 'false',
|
483 |
+
"type" => "radio",
|
484 |
+
'choices' => array(
|
485 |
+
'true' => __( 'On', 'advanced-woo-search' ),
|
486 |
+
'false' => __( 'Off', 'advanced-woo-search' ),
|
487 |
+
)
|
488 |
+
);
|
489 |
+
|
490 |
+
$options['results'][] = array(
|
491 |
+
"name" => __( "Show stock status", "advanced-woo-search" ),
|
492 |
+
"desc" => __( "Show stock status for every product in search results.", "advanced-woo-search" ),
|
493 |
+
"id" => "show_stock",
|
494 |
+
"value" => 'false',
|
495 |
+
"type" => "radio",
|
496 |
+
'choices' => array(
|
497 |
+
'true' => __( 'On', 'advanced-woo-search' ),
|
498 |
+
'false' => __( 'Off', 'advanced-woo-search' ),
|
499 |
+
)
|
500 |
+
);
|
501 |
+
|
502 |
+
$options['results'][] = array(
|
503 |
+
"name" => __( "Show featured icon", "advanced-woo-search" ),
|
504 |
+
"desc" => __( "Show or not star icon for featured products.", "advanced-woo-search" ),
|
505 |
+
"id" => "show_featured",
|
506 |
+
"value" => 'false',
|
507 |
+
"type" => "radio",
|
508 |
+
'choices' => array(
|
509 |
+
'true' => __( 'On', 'advanced-woo-search' ),
|
510 |
+
'false' => __( 'Off', 'advanced-woo-search' ),
|
511 |
+
)
|
512 |
+
);
|
513 |
+
|
514 |
+
return $options;
|
515 |
+
|
516 |
+
}
|
517 |
+
|
518 |
+
}
|
519 |
+
|
520 |
+
endif;
|
includes/{class-aws-admin.php → admin/class-aws-admin.php}
RENAMED
@@ -42,14 +42,17 @@ class AWS_Admin {
|
|
42 |
* Constructor
|
43 |
*/
|
44 |
public function __construct() {
|
|
|
45 |
add_action( 'admin_menu', array( &$this, 'add_admin_page' ) );
|
46 |
add_action( 'admin_init', array( &$this, 'register_settings' ) );
|
47 |
|
48 |
-
if ( !
|
49 |
-
$
|
|
|
50 |
}
|
51 |
|
52 |
add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) );
|
|
|
53 |
}
|
54 |
|
55 |
/**
|
@@ -64,7 +67,6 @@ class AWS_Admin {
|
|
64 |
*/
|
65 |
public function display_admin_page() {
|
66 |
|
67 |
-
$options = $this->options_array();
|
68 |
$nonce = wp_create_nonce( 'plugin-settings' );
|
69 |
|
70 |
$tabs = array(
|
@@ -86,58 +88,8 @@ class AWS_Admin {
|
|
86 |
|
87 |
$tabs_html = '<h2 class="nav-tab-wrapper woo-nav-tab-wrapper">'.$tabs_html.'</h2>';
|
88 |
|
89 |
-
|
90 |
if ( isset( $_POST["Submit"] ) && current_user_can( 'manage_options' ) && isset( $_POST["_wpnonce"] ) && wp_verify_nonce( $_POST["_wpnonce"], 'plugin-settings' ) ) {
|
91 |
-
|
92 |
-
$update_settings = $this->get_settings();
|
93 |
-
|
94 |
-
foreach ( $options[$current_tab] as $values ) {
|
95 |
-
|
96 |
-
if ( $values['type'] === 'heading' ) {
|
97 |
-
continue;
|
98 |
-
}
|
99 |
-
|
100 |
-
if ( $values['type'] === 'checkbox' ) {
|
101 |
-
|
102 |
-
$checkbox_array = array();
|
103 |
-
|
104 |
-
foreach ( $values['choices'] as $key => $value ) {
|
105 |
-
$new_value = isset( $_POST[ $values['id'] ][$key] ) ? '1' : '0';
|
106 |
-
$checkbox_array[$key] = (string) sanitize_text_field( $new_value );
|
107 |
-
}
|
108 |
-
|
109 |
-
$update_settings[ $values['id'] ] = $checkbox_array;
|
110 |
-
|
111 |
-
continue;
|
112 |
-
}
|
113 |
-
|
114 |
-
$new_value = isset( $_POST[ $values['id'] ] ) ? $_POST[ $values['id'] ] : '';
|
115 |
-
|
116 |
-
if ( $values['type'] === 'textarea' ) {
|
117 |
-
if ( function_exists('sanitize_textarea_field') ) {
|
118 |
-
$update_settings[ $values['id'] ] = (string) sanitize_textarea_field( $new_value );
|
119 |
-
} else {
|
120 |
-
$update_settings[ $values['id'] ] = (string) str_replace( "<\n", "<\n", wp_strip_all_tags( $new_value ) );
|
121 |
-
}
|
122 |
-
continue;
|
123 |
-
}
|
124 |
-
|
125 |
-
$update_settings[ $values['id'] ] = (string) sanitize_text_field( $new_value );
|
126 |
-
|
127 |
-
if ( isset( $values['sub_option'] ) ) {
|
128 |
-
$new_value = isset( $_POST[ $values['sub_option']['id'] ] ) ? $_POST[ $values['sub_option']['id'] ] : '';
|
129 |
-
$update_settings[ $values['sub_option']['id'] ] = (string) sanitize_text_field( $new_value );
|
130 |
-
}
|
131 |
-
}
|
132 |
-
|
133 |
-
update_option( 'aws_settings', $update_settings );
|
134 |
-
|
135 |
-
AWS_Helpers::register_wpml_translations( $update_settings );
|
136 |
-
|
137 |
-
do_action( 'aws_settings_saved' );
|
138 |
-
|
139 |
-
do_action( 'aws_cache_clear' );
|
140 |
-
|
141 |
}
|
142 |
|
143 |
echo '<div class="wrap">';
|
@@ -152,14 +104,14 @@ class AWS_Admin {
|
|
152 |
|
153 |
switch ($current_tab) {
|
154 |
case('form'):
|
155 |
-
new AWS_Admin_Fields(
|
156 |
break;
|
157 |
case('results'):
|
158 |
-
new AWS_Admin_Fields(
|
159 |
break;
|
160 |
default:
|
161 |
$this->update_table();
|
162 |
-
new AWS_Admin_Fields(
|
163 |
}
|
164 |
|
165 |
echo '<input type="hidden" name="_wpnonce" value="' . esc_attr( $nonce ) . '">';
|
@@ -225,16 +177,6 @@ class AWS_Admin {
|
|
225 |
|
226 |
}
|
227 |
|
228 |
-
/*
|
229 |
-
* Options array that generate settings page
|
230 |
-
*/
|
231 |
-
public function options_array() {
|
232 |
-
|
233 |
-
require_once AWS_DIR .'/includes/options.php';
|
234 |
-
|
235 |
-
return $options;
|
236 |
-
}
|
237 |
-
|
238 |
/*
|
239 |
* Register plugin settings
|
240 |
*/
|
@@ -250,40 +192,6 @@ class AWS_Admin {
|
|
250 |
return $plugin_options;
|
251 |
}
|
252 |
|
253 |
-
/**
|
254 |
-
* Initialize settings to their default values
|
255 |
-
*/
|
256 |
-
public function initialize_settings() {
|
257 |
-
$options = $this->options_array();
|
258 |
-
$default_settings = array();
|
259 |
-
|
260 |
-
foreach ( $options as $section ) {
|
261 |
-
foreach ($section as $values) {
|
262 |
-
|
263 |
-
if ( $values['type'] === 'heading' ) {
|
264 |
-
continue;
|
265 |
-
}
|
266 |
-
|
267 |
-
if ( $values['type'] === 'textarea' ) {
|
268 |
-
if ( function_exists('sanitize_textarea_field') ) {
|
269 |
-
$default_settings[ $values['id'] ] = (string) sanitize_textarea_field( $values['value'] );
|
270 |
-
} else {
|
271 |
-
$default_settings[ $values['id'] ] = (string) str_replace( "<\n", "<\n", wp_strip_all_tags( $values['value'] ) );
|
272 |
-
}
|
273 |
-
continue;
|
274 |
-
}
|
275 |
-
|
276 |
-
$default_settings[$values['id']] = (string) sanitize_text_field( $values['value'] );
|
277 |
-
|
278 |
-
if (isset( $values['sub_option'])) {
|
279 |
-
$default_settings[$values['sub_option']['id']] = (string) sanitize_text_field( $values['sub_option']['value'] );
|
280 |
-
}
|
281 |
-
}
|
282 |
-
}
|
283 |
-
|
284 |
-
update_option( 'aws_settings', $default_settings );
|
285 |
-
}
|
286 |
-
|
287 |
/*
|
288 |
* Enqueue admin scripts and styles
|
289 |
*/
|
42 |
* Constructor
|
43 |
*/
|
44 |
public function __construct() {
|
45 |
+
|
46 |
add_action( 'admin_menu', array( &$this, 'add_admin_page' ) );
|
47 |
add_action( 'admin_init', array( &$this, 'register_settings' ) );
|
48 |
|
49 |
+
if ( ! AWS_Admin_Options::get_settings() ) {
|
50 |
+
$default_settings = AWS_Admin_Options::get_default_settings();
|
51 |
+
update_option( 'aws_settings', $default_settings );
|
52 |
}
|
53 |
|
54 |
add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) );
|
55 |
+
|
56 |
}
|
57 |
|
58 |
/**
|
67 |
*/
|
68 |
public function display_admin_page() {
|
69 |
|
|
|
70 |
$nonce = wp_create_nonce( 'plugin-settings' );
|
71 |
|
72 |
$tabs = array(
|
88 |
|
89 |
$tabs_html = '<h2 class="nav-tab-wrapper woo-nav-tab-wrapper">'.$tabs_html.'</h2>';
|
90 |
|
|
|
91 |
if ( isset( $_POST["Submit"] ) && current_user_can( 'manage_options' ) && isset( $_POST["_wpnonce"] ) && wp_verify_nonce( $_POST["_wpnonce"], 'plugin-settings' ) ) {
|
92 |
+
AWS_Admin_Options::update_settings();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
}
|
94 |
|
95 |
echo '<div class="wrap">';
|
104 |
|
105 |
switch ($current_tab) {
|
106 |
case('form'):
|
107 |
+
new AWS_Admin_Fields( 'form' );
|
108 |
break;
|
109 |
case('results'):
|
110 |
+
new AWS_Admin_Fields( 'results' );
|
111 |
break;
|
112 |
default:
|
113 |
$this->update_table();
|
114 |
+
new AWS_Admin_Fields( 'general' );
|
115 |
}
|
116 |
|
117 |
echo '<input type="hidden" name="_wpnonce" value="' . esc_attr( $nonce ) . '">';
|
177 |
|
178 |
}
|
179 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
/*
|
181 |
* Register plugin settings
|
182 |
*/
|
192 |
return $plugin_options;
|
193 |
}
|
194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
/*
|
196 |
* Enqueue admin scripts and styles
|
197 |
*/
|
includes/class-aws-helpers.php
CHANGED
@@ -517,7 +517,7 @@ if ( ! class_exists( 'AWS_Helpers' ) ) :
|
|
517 |
$synonym_array = explode( ',', $synonyms_string );
|
518 |
|
519 |
if ( $synonym_array && ! empty( $synonym_array ) ) {
|
520 |
-
$synonym_array = array_map( '
|
521 |
foreach ( $synonym_array as $synonym_item ) {
|
522 |
if ( $synonym_item && isset( $str_array[$synonym_item] ) ) {
|
523 |
$new_str_array = array_merge( $new_str_array, $synonym_array );
|
517 |
$synonym_array = explode( ',', $synonyms_string );
|
518 |
|
519 |
if ( $synonym_array && ! empty( $synonym_array ) ) {
|
520 |
+
$synonym_array = array_map( array( 'AWS_Helpers', 'normalize_string' ), $synonym_array );
|
521 |
foreach ( $synonym_array as $synonym_item ) {
|
522 |
if ( $synonym_item && isset( $str_array[$synonym_item] ) ) {
|
523 |
$new_str_array = array_merge( $new_str_array, $synonym_array );
|
includes/class-aws-order.php
CHANGED
@@ -60,11 +60,11 @@ if ( ! class_exists( 'AWS_Order' ) ) :
|
|
60 |
|
61 |
}
|
62 |
|
63 |
-
if ( ! $price_min && isset( $_GET['min_price'] )
|
64 |
$price_min = sanitize_text_field( $_GET['min_price'] );
|
65 |
}
|
66 |
|
67 |
-
if ( ! $price_max && isset( $_GET['max_price'] )
|
68 |
$price_max = sanitize_text_field( $_GET['max_price'] );
|
69 |
}
|
70 |
|
@@ -94,7 +94,7 @@ if ( ! class_exists( 'AWS_Order' ) ) :
|
|
94 |
|
95 |
foreach( $this->products as $post_array ) {
|
96 |
|
97 |
-
if ( $price_min && $price_max ) {
|
98 |
if ( isset( $post_array['f_price'] ) && $post_array['f_price'] ) {
|
99 |
if ( $post_array['f_price'] > $price_max || $post_array['f_price'] < $price_min ) {
|
100 |
continue;
|
@@ -134,9 +134,11 @@ if ( ! class_exists( 'AWS_Order' ) ) :
|
|
134 |
|
135 |
$product = wc_get_product( $post_array['id'] );
|
136 |
$attributes = $product->get_attributes();
|
|
|
137 |
$skip = true;
|
138 |
|
139 |
if ( $attributes && ! empty( $attributes ) ) {
|
|
|
140 |
foreach( $attributes as $attr_name => $attribute_object ) {
|
141 |
if ( $attribute_object ) {
|
142 |
if ( ( is_object( $attribute_object ) && method_exists( $attribute_object, 'is_taxonomy' ) && $attribute_object->is_taxonomy() ) ||
|
@@ -146,60 +148,70 @@ if ( ! class_exists( 'AWS_Order' ) ) :
|
|
146 |
$product_terms = wp_get_object_terms( $post_array['id'], $attr_name );
|
147 |
|
148 |
if ( ! is_wp_error( $product_terms ) && ! empty( $product_terms ) ) {
|
149 |
-
|
150 |
-
$product_terms_array = array();
|
151 |
-
|
152 |
foreach ( $product_terms as $product_term ) {
|
153 |
$product_terms_array[$product_term->slug] = $product_term->slug;
|
154 |
}
|
|
|
155 |
|
156 |
-
|
157 |
-
|
|
|
|
|
158 |
|
159 |
-
|
160 |
|
161 |
-
|
162 |
|
163 |
-
|
|
|
|
|
164 |
|
165 |
-
|
166 |
-
if ( ! isset( $product_terms_array[$term] ) ) {
|
167 |
-
$has_all = false;
|
168 |
-
break;
|
169 |
-
}
|
170 |
-
}
|
171 |
|
172 |
-
|
173 |
-
$skip = false;
|
174 |
-
}
|
175 |
|
176 |
-
|
177 |
|
178 |
-
|
|
|
|
|
|
|
|
|
|
|
179 |
|
180 |
-
|
|
|
|
|
181 |
|
182 |
-
|
183 |
-
if ( isset( $product_terms_array[$term] ) ) {
|
184 |
-
$has_all = true;
|
185 |
-
break;
|
186 |
-
}
|
187 |
-
}
|
188 |
|
189 |
-
|
190 |
-
$skip = false;
|
191 |
-
}
|
192 |
|
193 |
-
|
194 |
|
|
|
|
|
|
|
|
|
195 |
}
|
|
|
196 |
|
|
|
|
|
197 |
}
|
198 |
|
199 |
}
|
|
|
|
|
|
|
|
|
|
|
200 |
}
|
|
|
201 |
}
|
|
|
202 |
}
|
|
|
203 |
}
|
204 |
|
205 |
if ( $skip ) {
|
60 |
|
61 |
}
|
62 |
|
63 |
+
if ( ! $price_min && isset( $_GET['min_price'] ) ) {
|
64 |
$price_min = sanitize_text_field( $_GET['min_price'] );
|
65 |
}
|
66 |
|
67 |
+
if ( ! $price_max && isset( $_GET['max_price'] ) ) {
|
68 |
$price_max = sanitize_text_field( $_GET['max_price'] );
|
69 |
}
|
70 |
|
94 |
|
95 |
foreach( $this->products as $post_array ) {
|
96 |
|
97 |
+
if ( ( $price_min || $price_min == '0' ) && $price_max ) {
|
98 |
if ( isset( $post_array['f_price'] ) && $post_array['f_price'] ) {
|
99 |
if ( $post_array['f_price'] > $price_max || $post_array['f_price'] < $price_min ) {
|
100 |
continue;
|
134 |
|
135 |
$product = wc_get_product( $post_array['id'] );
|
136 |
$attributes = $product->get_attributes();
|
137 |
+
$product_terms_array = array();
|
138 |
$skip = true;
|
139 |
|
140 |
if ( $attributes && ! empty( $attributes ) ) {
|
141 |
+
|
142 |
foreach( $attributes as $attr_name => $attribute_object ) {
|
143 |
if ( $attribute_object ) {
|
144 |
if ( ( is_object( $attribute_object ) && method_exists( $attribute_object, 'is_taxonomy' ) && $attribute_object->is_taxonomy() ) ||
|
148 |
$product_terms = wp_get_object_terms( $post_array['id'], $attr_name );
|
149 |
|
150 |
if ( ! is_wp_error( $product_terms ) && ! empty( $product_terms ) ) {
|
|
|
|
|
|
|
151 |
foreach ( $product_terms as $product_term ) {
|
152 |
$product_terms_array[$product_term->slug] = $product_term->slug;
|
153 |
}
|
154 |
+
}
|
155 |
|
156 |
+
}
|
157 |
+
}
|
158 |
+
}
|
159 |
+
}
|
160 |
|
161 |
+
if ( $product_terms_array ) {
|
162 |
|
163 |
+
foreach( $attr_filter as $attr_filter_name => $attr_filter_object ) {
|
164 |
|
165 |
+
$skip = true;
|
166 |
+
$attr_filter_operator = $attr_filter_object['operator'];
|
167 |
+
$attr_filter_terms = $attr_filter_object['terms'];
|
168 |
|
169 |
+
if ( $attr_filter_terms && is_array( $attr_filter_terms ) && ! empty( $attr_filter_terms ) ) {
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
+
if ( $attr_filter_operator === 'AND' ) {
|
|
|
|
|
172 |
|
173 |
+
$has_all = true;
|
174 |
|
175 |
+
foreach( $attr_filter_terms as $term ) {
|
176 |
+
if ( ! isset( $product_terms_array[$term] ) ) {
|
177 |
+
$has_all = false;
|
178 |
+
break;
|
179 |
+
}
|
180 |
+
}
|
181 |
|
182 |
+
if ( $has_all ) {
|
183 |
+
$skip = false;
|
184 |
+
}
|
185 |
|
186 |
+
}
|
|
|
|
|
|
|
|
|
|
|
187 |
|
188 |
+
if ( $attr_filter_operator === 'IN' || $attr_filter_operator === 'OR' ) {
|
|
|
|
|
189 |
|
190 |
+
$has_all = false;
|
191 |
|
192 |
+
foreach( $attr_filter_terms as $term ) {
|
193 |
+
if ( isset( $product_terms_array[$term] ) ) {
|
194 |
+
$has_all = true;
|
195 |
+
break;
|
196 |
}
|
197 |
+
}
|
198 |
|
199 |
+
if ( $has_all ) {
|
200 |
+
$skip = false;
|
201 |
}
|
202 |
|
203 |
}
|
204 |
+
|
205 |
+
if ( $skip ) {
|
206 |
+
break;
|
207 |
+
}
|
208 |
+
|
209 |
}
|
210 |
+
|
211 |
}
|
212 |
+
|
213 |
}
|
214 |
+
|
215 |
}
|
216 |
|
217 |
if ( $skip ) {
|
includes/class-aws-search-page.php
CHANGED
@@ -52,10 +52,10 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
|
|
52 |
public function setup() {
|
53 |
|
54 |
// Make sure we return nothing for MySQL posts query
|
55 |
-
add_filter( 'posts_request', array( $this, 'filter_posts_request' ),
|
56 |
|
57 |
// Query and filter to WP_Query
|
58 |
-
add_filter( 'the_posts', array( $this, 'filter_the_posts' ),
|
59 |
|
60 |
// Add header
|
61 |
add_action( 'pre_get_posts', array( $this, 'action_pre_get_posts' ), 5 );
|
@@ -66,10 +66,12 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
|
|
66 |
// Nukes the FOUND_ROWS() database query
|
67 |
add_filter( 'found_posts_query', array( $this, 'filter_found_posts_query' ), 5, 2 );
|
68 |
|
69 |
-
//
|
70 |
add_filter( 'woocommerce_layered_nav_link', array( $this, 'woocommerce_layered_nav_link' ) );
|
|
|
|
|
71 |
|
72 |
-
add_filter( 'posts_pre_query', array( $this, 'posts_pre_query' ),
|
73 |
|
74 |
add_filter( 'body_class', array( $this, 'body_class' ), 999 );
|
75 |
|
@@ -305,6 +307,8 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
|
|
305 |
|
306 |
$products = array_slice( $post_array_products, $offset, $posts_per_page );
|
307 |
|
|
|
|
|
308 |
return array(
|
309 |
'all' => $post_array_products,
|
310 |
'products' => $products
|
@@ -334,6 +338,65 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
|
|
334 |
|
335 |
}
|
336 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
337 |
/*
|
338 |
* Check some strings inside body classes
|
339 |
*/
|
52 |
public function setup() {
|
53 |
|
54 |
// Make sure we return nothing for MySQL posts query
|
55 |
+
add_filter( 'posts_request', array( $this, 'filter_posts_request' ), 999, 2 );
|
56 |
|
57 |
// Query and filter to WP_Query
|
58 |
+
add_filter( 'the_posts', array( $this, 'filter_the_posts' ), 999, 2 );
|
59 |
|
60 |
// Add header
|
61 |
add_action( 'pre_get_posts', array( $this, 'action_pre_get_posts' ), 5 );
|
66 |
// Nukes the FOUND_ROWS() database query
|
67 |
add_filter( 'found_posts_query', array( $this, 'filter_found_posts_query' ), 5, 2 );
|
68 |
|
69 |
+
// WooCommerce default widget filters
|
70 |
add_filter( 'woocommerce_layered_nav_link', array( $this, 'woocommerce_layered_nav_link' ) );
|
71 |
+
add_filter( 'woocommerce_get_filtered_term_product_counts_query', array( $this, 'woocommerce_get_filtered_term_product_counts_query' ), 999 );
|
72 |
+
add_filter( 'woocommerce_price_filter_sql', array( $this, 'woocommerce_price_filter_sql' ), 999 );
|
73 |
|
74 |
+
add_filter( 'posts_pre_query', array( $this, 'posts_pre_query' ), 999, 2 );
|
75 |
|
76 |
add_filter( 'body_class', array( $this, 'body_class' ), 999 );
|
77 |
|
307 |
|
308 |
$products = array_slice( $post_array_products, $offset, $posts_per_page );
|
309 |
|
310 |
+
$this->data['all_products'] = $post_array_products;
|
311 |
+
|
312 |
return array(
|
313 |
'all' => $post_array_products,
|
314 |
'products' => $products
|
338 |
|
339 |
}
|
340 |
|
341 |
+
/*
|
342 |
+
* Enable cache for WooCommerce filter widget
|
343 |
+
*/
|
344 |
+
public function woocommerce_layered_nav_count_maybe_cache( $cache ) {
|
345 |
+
if ( ! isset( $_GET['type_aws'] ) ) {
|
346 |
+
return $cache;
|
347 |
+
}
|
348 |
+
return true;
|
349 |
+
}
|
350 |
+
|
351 |
+
/*
|
352 |
+
* Change WooCommerce attributes filter widget query
|
353 |
+
*/
|
354 |
+
public function woocommerce_get_filtered_term_product_counts_query( $query ) {
|
355 |
+
if ( ! isset( $_GET['type_aws'] ) ) {
|
356 |
+
return $query;
|
357 |
+
}
|
358 |
+
|
359 |
+
$search = ' AND ' . WC_Query::get_main_search_query_sql();
|
360 |
+
$product_ids = array();
|
361 |
+
|
362 |
+
$query['where'] = str_replace( $search, '', $query['where'] );
|
363 |
+
|
364 |
+
if ( isset( $this->data['all_products'] ) && $this->data['all_products'] ) {
|
365 |
+
global $wpdb;
|
366 |
+
|
367 |
+
foreach( $this->data['all_products'] as $sproduct ) {
|
368 |
+
$product_ids[] = $sproduct['id'];
|
369 |
+
}
|
370 |
+
|
371 |
+
$query['where'] .= " AND {$wpdb->posts}.ID IN (". implode( ',', array_map( 'absint', $product_ids ) ) .")";
|
372 |
+
|
373 |
+
}
|
374 |
+
|
375 |
+
return $query;
|
376 |
+
}
|
377 |
+
|
378 |
+
/*
|
379 |
+
* Change WooCommerce price filter widget query
|
380 |
+
*/
|
381 |
+
public function woocommerce_price_filter_sql( $sql ) {
|
382 |
+
|
383 |
+
if ( isset( $_GET['type_aws'] ) && isset( $this->data['all_products'] ) && $this->data['all_products'] ) {
|
384 |
+
global $wpdb;
|
385 |
+
|
386 |
+
foreach( $this->data['all_products'] as $sproduct ) {
|
387 |
+
$product_ids[] = $sproduct['id'];
|
388 |
+
}
|
389 |
+
|
390 |
+
$sql = "SELECT min( min_price ) as min_price, MAX( max_price ) as max_price
|
391 |
+
FROM {$wpdb->wc_product_meta_lookup}
|
392 |
+
WHERE product_id IN (". implode( ',', array_map( 'absint', $product_ids ) ) .")";
|
393 |
+
|
394 |
+
}
|
395 |
+
|
396 |
+
return $sql;
|
397 |
+
|
398 |
+
}
|
399 |
+
|
400 |
/*
|
401 |
* Check some strings inside body classes
|
402 |
*/
|
includes/class-aws-table.php
CHANGED
@@ -297,6 +297,13 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
297 |
*/
|
298 |
$posts = apply_filters( 'aws_index_product_ids', $posts );
|
299 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
300 |
foreach ( $posts as $found_post_id ) {
|
301 |
|
302 |
$data = array();
|
@@ -332,13 +339,17 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
332 |
|
333 |
$ids = $data['id'];
|
334 |
|
335 |
-
$title =
|
|
|
|
|
336 |
|
337 |
-
$content = apply_filters( 'the_content', get_post_field( 'post_content', $data['id'] ), $data['id'] );
|
338 |
$excerpt = get_post_field( 'post_excerpt', $data['id'] );
|
339 |
$cat_array = AWS_Helpers::get_terms_array( $data['id'], 'product_cat' );
|
340 |
$tag_array = AWS_Helpers::get_terms_array( $data['id'], 'product_tag' );
|
341 |
|
|
|
|
|
|
|
342 |
|
343 |
// Get all child products if exists
|
344 |
if ( $product->is_type( 'variable' ) && class_exists( 'WC_Product_Variation' ) ) {
|
@@ -473,10 +484,14 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
473 |
$translated_post_data['lang'] = $lang_obj->language_code;
|
474 |
$translated_post_data['terms'] = array();
|
475 |
|
476 |
-
$translated_title =
|
477 |
-
$translated_content =
|
478 |
$translated_excerpt = get_post_field( 'post_excerpt', $translated_post->ID );
|
479 |
|
|
|
|
|
|
|
|
|
480 |
$translated_content = AWS_Helpers::strip_shortcodes( $translated_content );
|
481 |
$translated_excerpt = AWS_Helpers::strip_shortcodes( $translated_excerpt );
|
482 |
|
@@ -550,17 +565,6 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
550 |
|
551 |
}
|
552 |
|
553 |
-
/**
|
554 |
-
* Filters product data array before it will be added to index table.
|
555 |
-
*
|
556 |
-
* @since 1.62
|
557 |
-
*
|
558 |
-
* @param array $data Product data array.
|
559 |
-
* @param int $data['id'] Product id.
|
560 |
-
* @param object $product Current product object.
|
561 |
-
*/
|
562 |
-
$data = apply_filters( 'aws_indexed_data', $data, $data['id'], $product );
|
563 |
-
|
564 |
//Insert data into table
|
565 |
$this->insert_into_table( $data );
|
566 |
|
@@ -575,37 +579,51 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
575 |
|
576 |
global $wpdb;
|
577 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
578 |
$values = array();
|
579 |
|
580 |
-
|
|
|
|
|
581 |
|
582 |
-
|
583 |
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
|
|
588 |
}
|
589 |
-
}
|
590 |
|
591 |
-
|
592 |
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
|
602 |
-
|
|
|
|
|
603 |
|
604 |
}
|
605 |
|
606 |
}
|
607 |
|
608 |
-
|
609 |
if ( count( $values ) > 0 ) {
|
610 |
|
611 |
$values = implode( ', ', $values );
|
297 |
*/
|
298 |
$posts = apply_filters( 'aws_index_product_ids', $posts );
|
299 |
|
300 |
+
/**
|
301 |
+
* Apply or not WP filters to indexed contetn
|
302 |
+
* @since 1.82
|
303 |
+
* @param bool false
|
304 |
+
*/
|
305 |
+
$apply_filters = apply_filters( 'aws_index_apply_filters', false );
|
306 |
+
|
307 |
foreach ( $posts as $found_post_id ) {
|
308 |
|
309 |
$data = array();
|
339 |
|
340 |
$ids = $data['id'];
|
341 |
|
342 |
+
$title = get_the_title( $data['id'] );
|
343 |
+
|
344 |
+
$content = get_post_field( 'post_content', $data['id'] );
|
345 |
|
|
|
346 |
$excerpt = get_post_field( 'post_excerpt', $data['id'] );
|
347 |
$cat_array = AWS_Helpers::get_terms_array( $data['id'], 'product_cat' );
|
348 |
$tag_array = AWS_Helpers::get_terms_array( $data['id'], 'product_tag' );
|
349 |
|
350 |
+
if ( $apply_filters ) {
|
351 |
+
$content = apply_filters( 'the_content', $content, $data['id'] );
|
352 |
+
}
|
353 |
|
354 |
// Get all child products if exists
|
355 |
if ( $product->is_type( 'variable' ) && class_exists( 'WC_Product_Variation' ) ) {
|
484 |
$translated_post_data['lang'] = $lang_obj->language_code;
|
485 |
$translated_post_data['terms'] = array();
|
486 |
|
487 |
+
$translated_title = get_the_title( $translated_post->ID );
|
488 |
+
$translated_content = get_post_field( 'post_content', $translated_post->ID );
|
489 |
$translated_excerpt = get_post_field( 'post_excerpt', $translated_post->ID );
|
490 |
|
491 |
+
if ( $apply_filters ) {
|
492 |
+
$translated_content = apply_filters( 'the_content', $translated_content, $translated_post->ID );
|
493 |
+
}
|
494 |
+
|
495 |
$translated_content = AWS_Helpers::strip_shortcodes( $translated_content );
|
496 |
$translated_excerpt = AWS_Helpers::strip_shortcodes( $translated_excerpt );
|
497 |
|
565 |
|
566 |
}
|
567 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
568 |
//Insert data into table
|
569 |
$this->insert_into_table( $data );
|
570 |
|
579 |
|
580 |
global $wpdb;
|
581 |
|
582 |
+
/**
|
583 |
+
* Filters product data array before it will be added to index table.
|
584 |
+
*
|
585 |
+
* @since 1.62
|
586 |
+
*
|
587 |
+
* @param array $data Product data array.
|
588 |
+
* @param int $data['id'] Product id.
|
589 |
+
* @param null ( since 1.82 )
|
590 |
+
*/
|
591 |
+
$data = apply_filters( 'aws_indexed_data', $data, $data['id'], null );
|
592 |
+
|
593 |
$values = array();
|
594 |
|
595 |
+
if ( $data && is_array( $data ) && isset( $data['terms'] ) ) {
|
596 |
+
|
597 |
+
foreach( $data['terms'] as $source => $all_terms ) {
|
598 |
|
599 |
+
$term_id = 0;
|
600 |
|
601 |
+
if ( preg_match( '/\%(\d+)\%/', $source, $matches ) ) {
|
602 |
+
if ( isset( $matches[1] ) ) {
|
603 |
+
$term_id = $matches[1];
|
604 |
+
$source = preg_replace( '/\%(\d+)\%/', '', $source );
|
605 |
+
}
|
606 |
}
|
|
|
607 |
|
608 |
+
foreach ( $all_terms as $term => $count ) {
|
609 |
|
610 |
+
if ( ! $term ) {
|
611 |
+
continue;
|
612 |
+
}
|
613 |
|
614 |
+
$value = $wpdb->prepare(
|
615 |
+
"(%d, %s, %s, %s, %d, %d, %d, %d, %s, %s)",
|
616 |
+
$data['id'], $term, $source, 'product', $count, $data['in_stock'], $data['on_sale'], $term_id, $data['visibility'], $data['lang']
|
617 |
+
);
|
618 |
|
619 |
+
$values[] = $value;
|
620 |
+
|
621 |
+
}
|
622 |
|
623 |
}
|
624 |
|
625 |
}
|
626 |
|
|
|
627 |
if ( count( $values ) > 0 ) {
|
628 |
|
629 |
$values = implode( ', ', $values );
|
includes/options.php
DELETED
@@ -1,366 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Array of plugin options
|
4 |
-
*/
|
5 |
-
|
6 |
-
$options = array();
|
7 |
-
|
8 |
-
$options['general'][] = array(
|
9 |
-
"name" => __( "Main Settings", "advanced-woo-search" ),
|
10 |
-
"type" => "heading"
|
11 |
-
);
|
12 |
-
|
13 |
-
$options['general'][] = array(
|
14 |
-
"name" => __( "Seamless integration", "advanced-woo-search" ),
|
15 |
-
"desc" => __( "Replace all the standard search forms on your website ( may not work with some themes ).", "advanced-woo-search" ),
|
16 |
-
"id" => "seamless",
|
17 |
-
"value" => 'false',
|
18 |
-
"type" => "radio",
|
19 |
-
'choices' => array(
|
20 |
-
'true' => __( 'On', 'advanced-woo-search' ),
|
21 |
-
'false' => __( 'Off', 'advanced-woo-search' ),
|
22 |
-
)
|
23 |
-
);
|
24 |
-
|
25 |
-
$options['general'][] = array(
|
26 |
-
"name" => __( "Cache results", "advanced-woo-search" ),
|
27 |
-
"desc" => __( "Turn off if you have old data in the search results after content of products was changed.<br><strong>CAUTION:</strong> can dramatically increase search speed", "advanced-woo-search" ),
|
28 |
-
"id" => "cache",
|
29 |
-
"value" => 'true',
|
30 |
-
"type" => "radio",
|
31 |
-
'choices' => array(
|
32 |
-
'true' => __( 'On', 'advanced-woo-search' ),
|
33 |
-
'false' => __( 'Off', 'advanced-woo-search' ),
|
34 |
-
)
|
35 |
-
);
|
36 |
-
|
37 |
-
$options['general'][] = array(
|
38 |
-
"name" => __( "Sync index table", "advanced-woo-search" ),
|
39 |
-
"desc" => __( "Automatically update plugin index table when product content was changed. This means that in search there will be always latest product data.", "advanced-woo-search" ) . '<br>' .
|
40 |
-
__( "Turn this off if you have any problems with performance.", "advanced-woo-search" ),
|
41 |
-
"id" => "autoupdates",
|
42 |
-
"value" => 'true',
|
43 |
-
"type" => "radio",
|
44 |
-
'choices' => array(
|
45 |
-
'true' => __( 'On', 'advanced-woo-search' ),
|
46 |
-
'false' => __( 'Off', 'advanced-woo-search' ),
|
47 |
-
)
|
48 |
-
);
|
49 |
-
|
50 |
-
$options['general'][] = array(
|
51 |
-
"name" => __( "Search in", "advanced-woo-search" ),
|
52 |
-
"desc" => __( "Search source: Drag&drop sources to activate or deactivate them.", "advanced-woo-search" ),
|
53 |
-
"id" => "search_in",
|
54 |
-
"value" => "title,content,sku,excerpt",
|
55 |
-
"choices" => array( "title", "content", "sku", "excerpt", "category", "tag", "id" ),
|
56 |
-
"type" => "sortable"
|
57 |
-
);
|
58 |
-
|
59 |
-
$options['general'][] = array(
|
60 |
-
"name" => __( "Show out-of-stock", "advanced-woo-search" ),
|
61 |
-
"desc" => __( "Show out-of-stock products in search", "advanced-woo-search" ),
|
62 |
-
"id" => "outofstock",
|
63 |
-
"value" => 'true',
|
64 |
-
"type" => "radio",
|
65 |
-
'choices' => array(
|
66 |
-
'true' => __( 'Show', 'advanced-woo-search' ),
|
67 |
-
'false' => __( 'Hide', 'advanced-woo-search' ),
|
68 |
-
)
|
69 |
-
);
|
70 |
-
|
71 |
-
$options['general'][] = array(
|
72 |
-
"name" => __( "Stop words list", "advanced-woo-search" ),
|
73 |
-
"desc" => __( "Comma separated list of words that will be excluded from search.", "advanced-woo-search" ) . '<br>' . __( "Re-index required on change.", "advanced-woo-search" ),
|
74 |
-
"id" => "stopwords",
|
75 |
-
"value" => "a, also, am, an, and, are, as, at, be, but, by, call, can, co, con, de, do, due, eg, eight, etc, even, ever, every, for, from, full, go, had, has, hasnt, have, he, hence, her, here, his, how, ie, if, in, inc, into, is, it, its, ltd, me, my, no, none, nor, not, now, of, off, on, once, one, only, onto, or, our, ours, out, over, own, part, per, put, re, see, so, some, ten, than, that, the, their, there, these, they, this, three, thru, thus, to, too, top, un, up, us, very, via, was, we, well, were, what, when, where, who, why, will",
|
76 |
-
"cols" => "85",
|
77 |
-
"rows" => "3",
|
78 |
-
"type" => "textarea"
|
79 |
-
);
|
80 |
-
|
81 |
-
$options['general'][] = array(
|
82 |
-
"name" => __( "Synonyms", "advanced-woo-search" ),
|
83 |
-
"desc" => __( "Comma separated list of synonym words. Each group of synonyms must be on separated text line.", "advanced-woo-search" ) . '<br>' . __( "Re-index required on change.", "advanced-woo-search" ),
|
84 |
-
"id" => "synonyms",
|
85 |
-
"value" => "buy, pay, purchase, acquire box, housing, unit, package",
|
86 |
-
"cols" => "85",
|
87 |
-
"rows" => "3",
|
88 |
-
"type" => "textarea"
|
89 |
-
);
|
90 |
-
|
91 |
-
$options['general'][] = array(
|
92 |
-
"name" => __( "Use Google Analytics", "advanced-woo-search" ),
|
93 |
-
"desc" => __( "Use google analytics to track searches. You need google analytics to be installed on your site.", "advanced-woo-search" ) .
|
94 |
-
'<br>' . sprintf( __( "Data will be visible inside Google Analytics 'Site Search' report. Need to activate 'Site Search' feature inside GA. %s", "advanced-woo-search" ), '<a href="https://advanced-woo-search.com/guide/google-analytics/" target="_blank">' . __( 'More info', 'advanced-woo-search' ) . '</a>' ) .
|
95 |
-
'<br>' . __( "Also will send event with category - 'AWS search', action - 'AWS Search Term' and label of value of search term.", "advanced-woo-search" ),
|
96 |
-
"id" => "use_analytics",
|
97 |
-
"value" => 'false',
|
98 |
-
"type" => "radio",
|
99 |
-
'choices' => array(
|
100 |
-
'true' => __( 'On', 'advanced-woo-search' ),
|
101 |
-
'false' => __( 'Off', 'advanced-woo-search' ),
|
102 |
-
)
|
103 |
-
);
|
104 |
-
|
105 |
-
// Search Form Settings
|
106 |
-
$options['form'][] = array(
|
107 |
-
"name" => __( "Text for search field", "advanced-woo-search" ),
|
108 |
-
"desc" => __( "Text for search field placeholder.", "advanced-woo-search" ),
|
109 |
-
"id" => "search_field_text",
|
110 |
-
"value" => __( "Search", "advanced-woo-search" ),
|
111 |
-
"type" => "text"
|
112 |
-
);
|
113 |
-
|
114 |
-
$options['form'][] = array(
|
115 |
-
"name" => __( "Text for show more button", "advanced-woo-search" ),
|
116 |
-
"desc" => __( "Text for link to search results page at the bottom of search results block.", "advanced-woo-search" ),
|
117 |
-
"id" => "show_more_text",
|
118 |
-
"value" => __( "View all results", "advanced-woo-search" ),
|
119 |
-
"type" => "text"
|
120 |
-
);
|
121 |
-
|
122 |
-
$options['form'][] = array(
|
123 |
-
"name" => __( "Nothing found field", "advanced-woo-search" ),
|
124 |
-
"desc" => __( "Text when there is no search results.", "advanced-woo-search" ),
|
125 |
-
"id" => "not_found_text",
|
126 |
-
"value" => __( "Nothing found", "advanced-woo-search" ),
|
127 |
-
"type" => "textarea"
|
128 |
-
);
|
129 |
-
|
130 |
-
$options['form'][] = array(
|
131 |
-
"name" => __( "Minimum number of characters", "advanced-woo-search" ),
|
132 |
-
"desc" => __( "Minimum number of characters required to run ajax search.", "advanced-woo-search" ),
|
133 |
-
"id" => "min_chars",
|
134 |
-
"value" => 1,
|
135 |
-
"type" => "number"
|
136 |
-
);
|
137 |
-
|
138 |
-
$options['form'][] = array(
|
139 |
-
"name" => __( "Show loader", "advanced-woo-search" ),
|
140 |
-
"desc" => __( "Show loader animation while searching.", "advanced-woo-search" ),
|
141 |
-
"id" => "show_loader",
|
142 |
-
"value" => 'true',
|
143 |
-
"type" => "radio",
|
144 |
-
'choices' => array(
|
145 |
-
'true' => __( 'On', 'advanced-woo-search' ),
|
146 |
-
'false' => __( 'Off', 'advanced-woo-search' ),
|
147 |
-
)
|
148 |
-
);
|
149 |
-
|
150 |
-
$options['form'][] = array(
|
151 |
-
"name" => __( "Show clear button", "advanced-woo-search" ),
|
152 |
-
"desc" => __( "Show 'Clear search string' button for desktop devices ( for mobile it is always visible ).", "advanced-woo-search" ),
|
153 |
-
"id" => "show_clear",
|
154 |
-
"value" => 'true',
|
155 |
-
"type" => "radio",
|
156 |
-
'choices' => array(
|
157 |
-
'true' => __( 'On', 'advanced-woo-search' ),
|
158 |
-
'false' => __( 'Off', 'advanced-woo-search' ),
|
159 |
-
)
|
160 |
-
);
|
161 |
-
|
162 |
-
$options['form'][] = array(
|
163 |
-
"name" => __( "Show 'View All Results'", "advanced-woo-search" ),
|
164 |
-
"desc" => __( "Show link to search results page at the bottom of search results block.", "advanced-woo-search" ),
|
165 |
-
"id" => "show_more",
|
166 |
-
"value" => 'false',
|
167 |
-
"type" => "radio",
|
168 |
-
'choices' => array(
|
169 |
-
'true' => __( 'On', 'advanced-woo-search' ),
|
170 |
-
'false' => __( 'Off', 'advanced-woo-search' )
|
171 |
-
)
|
172 |
-
);
|
173 |
-
|
174 |
-
$options['form'][] = array(
|
175 |
-
"name" => __( "Search Results", "advanced-woo-search" ),
|
176 |
-
"desc" => __( "Choose how to view search results.", "advanced-woo-search" ),
|
177 |
-
"id" => "show_page",
|
178 |
-
"value" => 'false',
|
179 |
-
"type" => "radio",
|
180 |
-
'choices' => array(
|
181 |
-
'true' => __( 'Both ajax search results and search results page', 'advanced-woo-search' ),
|
182 |
-
'false' => __( 'Only ajax search results ( no search results page )', 'advanced-woo-search' ),
|
183 |
-
'ajax_off' => __( 'Only search results page ( no ajax search results )', 'advanced-woo-search' )
|
184 |
-
)
|
185 |
-
);
|
186 |
-
|
187 |
-
$options['form'][] = array(
|
188 |
-
"name" => __( "Form Styling", "advanced-woo-search" ),
|
189 |
-
"desc" => __( "Choose search form layout", "advanced-woo-search" ) . '<br>' . __( "Filter button will be visible only if you have more than one active filter for current search form instance.", "advanced-woo-search" ),
|
190 |
-
"id" => "buttons_order",
|
191 |
-
"value" => '1',
|
192 |
-
"type" => "radio-image",
|
193 |
-
'choices' => array(
|
194 |
-
'1' => 'btn-layout1.png',
|
195 |
-
'2' => 'btn-layout2.png',
|
196 |
-
'3' => 'btn-layout3.png',
|
197 |
-
)
|
198 |
-
);
|
199 |
-
|
200 |
-
|
201 |
-
// Search Results Settings
|
202 |
-
|
203 |
-
$options['results'][] = array(
|
204 |
-
"name" => __( "Description source", "advanced-woo-search" ),
|
205 |
-
"desc" => __( "From where to take product description.<br>If first source is empty data will be taken from other sources.", "advanced-woo-search" ),
|
206 |
-
"id" => "desc_source",
|
207 |
-
"value" => 'content',
|
208 |
-
"type" => "radio",
|
209 |
-
'choices' => array(
|
210 |
-
'content' => __( 'Content', 'advanced-woo-search' ),
|
211 |
-
'excerpt' => __( 'Excerpt', 'advanced-woo-search' ),
|
212 |
-
)
|
213 |
-
);
|
214 |
-
|
215 |
-
$options['results'][] = array(
|
216 |
-
"name" => __( "Description length", "advanced-woo-search" ),
|
217 |
-
"desc" => __( "Maximal allowed number of words for product description.", "advanced-woo-search" ),
|
218 |
-
"id" => "excerpt_length",
|
219 |
-
"value" => 20,
|
220 |
-
"type" => "number"
|
221 |
-
);
|
222 |
-
|
223 |
-
$options['results'][] = array(
|
224 |
-
"name" => __( "Max number of results", "advanced-woo-search" ),
|
225 |
-
"desc" => __( "Maximum number of displayed search results.", "advanced-woo-search" ),
|
226 |
-
"id" => "results_num",
|
227 |
-
"value" => 10,
|
228 |
-
"type" => "number"
|
229 |
-
);
|
230 |
-
|
231 |
-
$options['results'][] = array(
|
232 |
-
"name" => __( "View", "advanced-woo-search" ),
|
233 |
-
"type" => "heading"
|
234 |
-
);
|
235 |
-
|
236 |
-
$options['results'][] = array(
|
237 |
-
"name" => __( "Show image", "advanced-woo-search" ),
|
238 |
-
"desc" => __( "Show product image for each search result.", "advanced-woo-search" ),
|
239 |
-
"id" => "show_image",
|
240 |
-
"value" => 'true',
|
241 |
-
"type" => "radio",
|
242 |
-
'choices' => array(
|
243 |
-
'true' => __( 'On', 'advanced-woo-search' ),
|
244 |
-
'false' => __( 'Off', 'advanced-woo-search' ),
|
245 |
-
)
|
246 |
-
);
|
247 |
-
|
248 |
-
$options['results'][] = array(
|
249 |
-
"name" => __( "Show description", "advanced-woo-search" ),
|
250 |
-
"desc" => __( "Show product description for each search result.", "advanced-woo-search" ),
|
251 |
-
"id" => "show_excerpt",
|
252 |
-
"value" => 'true',
|
253 |
-
"type" => "radio",
|
254 |
-
'choices' => array(
|
255 |
-
'true' => __( 'On', 'advanced-woo-search' ),
|
256 |
-
'false' => __( 'Off', 'advanced-woo-search' ),
|
257 |
-
)
|
258 |
-
);
|
259 |
-
|
260 |
-
$options['results'][] = array(
|
261 |
-
"name" => __( "Description content", "advanced-woo-search" ),
|
262 |
-
"desc" => __( "What to show in product description?", "advanced-woo-search" ),
|
263 |
-
"id" => "mark_words",
|
264 |
-
"value" => 'true',
|
265 |
-
"type" => "radio",
|
266 |
-
'choices' => array(
|
267 |
-
'true' => __( "Smart scrapping sentences with searching terms from product description.", "advanced-woo-search" ),
|
268 |
-
'false' => __( "First N words of product description ( number of words that you choose below. )", "advanced-woo-search" ),
|
269 |
-
)
|
270 |
-
);
|
271 |
-
|
272 |
-
$options['results'][] = array(
|
273 |
-
"name" => __( "Show price", "advanced-woo-search" ),
|
274 |
-
"desc" => __( "Show product price for each search result.", "advanced-woo-search" ),
|
275 |
-
"id" => "show_price",
|
276 |
-
"value" => 'true',
|
277 |
-
"type" => "radio",
|
278 |
-
'choices' => array(
|
279 |
-
'true' => __( 'On', 'advanced-woo-search' ),
|
280 |
-
'false' => __( 'Off', 'advanced-woo-search' ),
|
281 |
-
)
|
282 |
-
);
|
283 |
-
|
284 |
-
$options['results'][] = array(
|
285 |
-
"name" => __( "Show price for out of stock", "advanced-woo-search" ),
|
286 |
-
"desc" => __( "Show product price for out of stock products.", "advanced-woo-search" ),
|
287 |
-
"id" => "show_outofstock_price",
|
288 |
-
"value" => 'true',
|
289 |
-
"type" => "radio",
|
290 |
-
'choices' => array(
|
291 |
-
'true' => __( 'On', 'advanced-woo-search' ),
|
292 |
-
'false' => __( 'Off', 'advanced-woo-search' ),
|
293 |
-
)
|
294 |
-
);
|
295 |
-
|
296 |
-
$options['results'][] = array(
|
297 |
-
"name" => __( "Show categories archive", "advanced-woo-search" ),
|
298 |
-
"desc" => __( "Include categories archives pages to search result.", "advanced-woo-search" ),
|
299 |
-
"id" => "show_cats",
|
300 |
-
"value" => 'false',
|
301 |
-
"type" => "radio",
|
302 |
-
'choices' => array(
|
303 |
-
'true' => __( 'On', 'advanced-woo-search' ),
|
304 |
-
'false' => __( 'Off', 'advanced-woo-search' ),
|
305 |
-
)
|
306 |
-
);
|
307 |
-
|
308 |
-
$options['results'][] = array(
|
309 |
-
"name" => __( "Show tags archive", "advanced-woo-search" ),
|
310 |
-
"desc" => __( "Include tags archives pages to search results.", "advanced-woo-search" ),
|
311 |
-
"id" => "show_tags",
|
312 |
-
"value" => 'false',
|
313 |
-
"type" => "radio",
|
314 |
-
'choices' => array(
|
315 |
-
'true' => __( 'On', 'advanced-woo-search' ),
|
316 |
-
'false' => __( 'Off', 'advanced-woo-search' ),
|
317 |
-
)
|
318 |
-
);
|
319 |
-
|
320 |
-
$options['results'][] = array(
|
321 |
-
"name" => __( "Show sale badge", "advanced-woo-search" ),
|
322 |
-
"desc" => __( "Show sale badge for products in search results.", "advanced-woo-search" ),
|
323 |
-
"id" => "show_sale",
|
324 |
-
"value" => 'true',
|
325 |
-
"type" => "radio",
|
326 |
-
'choices' => array(
|
327 |
-
'true' => __( 'On', 'advanced-woo-search' ),
|
328 |
-
'false' => __( 'Off', 'advanced-woo-search' ),
|
329 |
-
)
|
330 |
-
);
|
331 |
-
|
332 |
-
$options['results'][] = array(
|
333 |
-
"name" => __( "Show product SKU", "advanced-woo-search" ),
|
334 |
-
"desc" => __( "Show product SKU in search results.", "advanced-woo-search" ),
|
335 |
-
"id" => "show_sku",
|
336 |
-
"value" => 'false',
|
337 |
-
"type" => "radio",
|
338 |
-
'choices' => array(
|
339 |
-
'true' => __( 'On', 'advanced-woo-search' ),
|
340 |
-
'false' => __( 'Off', 'advanced-woo-search' ),
|
341 |
-
)
|
342 |
-
);
|
343 |
-
|
344 |
-
$options['results'][] = array(
|
345 |
-
"name" => __( "Show stock status", "advanced-woo-search" ),
|
346 |
-
"desc" => __( "Show stock status for every product in search results.", "advanced-woo-search" ),
|
347 |
-
"id" => "show_stock",
|
348 |
-
"value" => 'false',
|
349 |
-
"type" => "radio",
|
350 |
-
'choices' => array(
|
351 |
-
'true' => __( 'On', 'advanced-woo-search' ),
|
352 |
-
'false' => __( 'Off', 'advanced-woo-search' ),
|
353 |
-
)
|
354 |
-
);
|
355 |
-
|
356 |
-
$options['results'][] = array(
|
357 |
-
"name" => __( "Show featured icon", "advanced-woo-search" ),
|
358 |
-
"desc" => __( "Show or not star icon for featured products.", "advanced-woo-search" ),
|
359 |
-
"id" => "show_featured",
|
360 |
-
"value" => 'false',
|
361 |
-
"type" => "radio",
|
362 |
-
'choices' => array(
|
363 |
-
'true' => __( 'On', 'advanced-woo-search' ),
|
364 |
-
'false' => __( 'Off', 'advanced-woo-search' ),
|
365 |
-
)
|
366 |
-
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.2
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -104,6 +104,15 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
|
|
104 |
|
105 |
== Changelog ==
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
= 1.81 =
|
108 |
* Add - Support for Google Analytics site search feature
|
109 |
* Update - Plugin settings page
|
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.2
|
7 |
+
Stable tag: 1.82
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
104 |
|
105 |
== Changelog ==
|
106 |
|
107 |
+
= 1.82 =
|
108 |
+
* Fix - Bug with WooCommerce attributes filter widget. Now its display proper number of attributes on search page
|
109 |
+
* Fix - Filter by attributes on search results page. Now search results works proper with multiple attributes filters
|
110 |
+
* Fix - WooCommerce price filter widget bug
|
111 |
+
* Fix - Search page queries
|
112 |
+
* Add - aws_index_apply_filters filter
|
113 |
+
* Update - aws_indexed_data filter filter
|
114 |
+
* Update - Improve synonyms support
|
115 |
+
|
116 |
= 1.81 =
|
117 |
* Add - Support for Google Analytics site search feature
|
118 |
* Update - Plugin settings page
|