Version Description
( 2020-10-19 ) = * Add - FacetWP plugin integration. Read more * Add - Support for 'Product Visibility by User Role for WooCommerce' plugin. Read more * Add - Support for Avada theme default shop filters * Update - Search results page query * Update - Divi builder search form styles * Dev - Add aws_products_order_by filter * Dev - Add aws_index_complete * Dev - Add aws_create_index_table
Download this release
Release Info
Developer | Mihail Barinov |
Plugin | Advanced Woo Search |
Version | 2.13 |
Comparing to | |
See all releases |
Code changes from version 2.12 to 2.13
- advanced-woo-search.php +3 -3
- assets/css/common.css +26 -2
- includes/class-aws-integrations.php +149 -0
- includes/class-aws-order.php +30 -1
- includes/class-aws-search-page.php +31 -17
- includes/class-aws-table.php +4 -0
- readme.txt +11 -1
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.
|
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.
|
12 |
*/
|
13 |
|
14 |
|
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
16 |
exit;
|
17 |
}
|
18 |
|
19 |
-
define( 'AWS_VERSION', '2.
|
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.13
|
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 |
exit;
|
17 |
}
|
18 |
|
19 |
+
define( 'AWS_VERSION', '2.13' );
|
20 |
|
21 |
|
22 |
define( 'AWS_DIR', dirname( __FILE__ ) );
|
assets/css/common.css
CHANGED
@@ -407,8 +407,8 @@
|
|
407 |
}
|
408 |
|
409 |
.aws-search-result .aws_no_result {
|
410 |
-
line-height:
|
411 |
-
padding:
|
412 |
cursor: auto;
|
413 |
}
|
414 |
|
@@ -483,4 +483,28 @@ body.aws-overlay {
|
|
483 |
}
|
484 |
.et_pb_menu__search .aws-container {
|
485 |
width: 100%;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
486 |
}
|
407 |
}
|
408 |
|
409 |
.aws-search-result .aws_no_result {
|
410 |
+
line-height: 1.5;
|
411 |
+
padding: 10px 6px;
|
412 |
cursor: auto;
|
413 |
}
|
414 |
|
483 |
}
|
484 |
.et_pb_menu__search .aws-container {
|
485 |
width: 100%;
|
486 |
+
}
|
487 |
+
|
488 |
+
#et-boc .aws-container .aws-search-field {
|
489 |
+
border: 1px solid #d8d8d8;
|
490 |
+
padding: 6px 15px;
|
491 |
+
}
|
492 |
+
#et-boc .aws-container .aws-search-form .aws-form-btn {
|
493 |
+
background: #ededed;
|
494 |
+
border: 1px solid #d8d8d8;
|
495 |
+
margin: 0 0 0 -1px;
|
496 |
+
}
|
497 |
+
#et-boc .aws-container .aws-search-form .aws-wrapper .aws-loader {
|
498 |
+
border-top: 3px solid #ededed;
|
499 |
+
border-right: 3px solid #ededed;
|
500 |
+
border-bottom: 3px solid #ededed;
|
501 |
+
border-left: 3px solid #555;
|
502 |
+
margin: 0;
|
503 |
+
margin-top: -10px;
|
504 |
+
}
|
505 |
+
#et-boc .aws-container .aws-search-form .aws-search-clear span {
|
506 |
+
margin-top: -12px;
|
507 |
+
}
|
508 |
+
#et-boc .aws-container .aws-search-form .aws-search-clear {
|
509 |
+
padding: 0 0 0 10px;
|
510 |
}
|
includes/class-aws-integrations.php
CHANGED
@@ -187,6 +187,23 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
|
|
187 |
add_filter( "option_psad_shop_page_enable", array( $this, 'psad_filter' ) );
|
188 |
}
|
189 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
}
|
191 |
|
192 |
/**
|
@@ -1266,6 +1283,138 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
|
|
1266 |
return $value;
|
1267 |
}
|
1268 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1269 |
}
|
1270 |
|
1271 |
endif;
|
187 |
add_filter( "option_psad_shop_page_enable", array( $this, 'psad_filter' ) );
|
188 |
}
|
189 |
|
190 |
+
if ( 'Avada' === $this->current_theme ) {
|
191 |
+
add_filter( 'aws_posts_per_page', array( $this, 'avada_posts_per_page' ), 1 );
|
192 |
+
add_filter( 'aws_products_order_by', array( $this, 'avada_aws_products_order_by' ), 1 );
|
193 |
+
add_filter( 'post_class', array( $this, 'avada_post_class' ) );
|
194 |
+
}
|
195 |
+
|
196 |
+
// FacetWP plugin
|
197 |
+
if ( class_exists( 'FacetWP' ) ) {
|
198 |
+
add_filter( 'facetwp_filtered_post_ids', array( $this, 'facetwp_filtered_post_ids' ), 1 );
|
199 |
+
add_filter( 'aws_searchpage_enabled', array( $this, 'facetwp_aws_searchpage_enabled' ), 1 );
|
200 |
+
}
|
201 |
+
|
202 |
+
// Product Visibility by User Role for WooCommerce plugin
|
203 |
+
if ( class_exists( 'Alg_WC_PVBUR' ) ) {
|
204 |
+
add_filter( 'aws_search_results_products', array( $this, 'pvbur_aws_search_results_products' ), 1 );
|
205 |
+
}
|
206 |
+
|
207 |
}
|
208 |
|
209 |
/**
|
1283 |
return $value;
|
1284 |
}
|
1285 |
|
1286 |
+
/*
|
1287 |
+
* Avada theme posts per page option
|
1288 |
+
*/
|
1289 |
+
public function avada_posts_per_page( $posts_per_page ) {
|
1290 |
+
$posts_per_page = isset( $_GET['product_count'] ) && intval( sanitize_text_field( $_GET['product_count'] ) ) ? intval( sanitize_text_field( $_GET['product_count'] ) ) : 12;
|
1291 |
+
return $posts_per_page;
|
1292 |
+
}
|
1293 |
+
|
1294 |
+
/*
|
1295 |
+
* Avada theme order by options
|
1296 |
+
*/
|
1297 |
+
public function avada_aws_products_order_by( $order_by ) {
|
1298 |
+
|
1299 |
+
$order_by_new = '';
|
1300 |
+
|
1301 |
+
if ( isset( $_GET['product_orderby'] ) ) {
|
1302 |
+
switch( sanitize_text_field( $_GET['product_orderby'] ) ) {
|
1303 |
+
case 'name':
|
1304 |
+
$order_by_new = 'title';
|
1305 |
+
break;
|
1306 |
+
case 'price':
|
1307 |
+
$order_by_new = 'price';
|
1308 |
+
break;
|
1309 |
+
case 'date':
|
1310 |
+
$order_by_new = 'date';
|
1311 |
+
break;
|
1312 |
+
case 'popularity':
|
1313 |
+
$order_by_new = 'popularity';
|
1314 |
+
break;
|
1315 |
+
case 'rating':
|
1316 |
+
$order_by_new = 'rating';
|
1317 |
+
break;
|
1318 |
+
}
|
1319 |
+
}
|
1320 |
+
|
1321 |
+
if ( isset( $_GET['product_order'] ) && $order_by_new ) {
|
1322 |
+
$product_order = sanitize_text_field( $_GET['product_order'] );
|
1323 |
+
if ( in_array( $product_order, array( 'asc', 'desc' ) ) ) {
|
1324 |
+
$order_by_new = $order_by_new . '-' . $product_order;
|
1325 |
+
}
|
1326 |
+
|
1327 |
+
}
|
1328 |
+
|
1329 |
+
if ( $order_by_new ) {
|
1330 |
+
$order_by = $order_by_new;
|
1331 |
+
}
|
1332 |
+
|
1333 |
+
return $order_by;
|
1334 |
+
|
1335 |
+
}
|
1336 |
+
|
1337 |
+
/*
|
1338 |
+
* Avada theme fix for product variations inside list products view
|
1339 |
+
*/
|
1340 |
+
public function avada_post_class( $classes ) {
|
1341 |
+
if ( 'product_variation' === get_post_type() ) {
|
1342 |
+
if ( isset( $_SERVER['QUERY_STRING'] ) ) {
|
1343 |
+
parse_str( sanitize_text_field( wp_unslash( $_SERVER['QUERY_STRING'] ) ), $params );
|
1344 |
+
if ( isset( $params['product_view'] ) && $params['product_view'] ) {
|
1345 |
+
$classes[] = 'product-' . $params['product_view'] . '-view';
|
1346 |
+
}
|
1347 |
+
}
|
1348 |
+
}
|
1349 |
+
return $classes;
|
1350 |
+
}
|
1351 |
+
|
1352 |
+
/*
|
1353 |
+
* FacetWP check for active filters
|
1354 |
+
*/
|
1355 |
+
public function facetwp_filtered_post_ids( $post_ids ) {
|
1356 |
+
if ( isset( $_GET['type_aws'] ) && isset( $_GET['s'] ) && ! empty( $post_ids ) ) {
|
1357 |
+
$this->data['facetwp'] = true;
|
1358 |
+
}
|
1359 |
+
return $post_ids;
|
1360 |
+
}
|
1361 |
+
|
1362 |
+
/*
|
1363 |
+
* Disable AWS search if FacetWP is active
|
1364 |
+
*/
|
1365 |
+
public function facetwp_aws_searchpage_enabled( $enabled ) {
|
1366 |
+
if ( isset( $this->data['facetwp'] ) && $this->data['facetwp'] ) {
|
1367 |
+
$enabled = false;
|
1368 |
+
}
|
1369 |
+
return $enabled;
|
1370 |
+
}
|
1371 |
+
|
1372 |
+
/*
|
1373 |
+
* Product Visibility by User Role for WooCommerce plugin hide products for certain users
|
1374 |
+
*/
|
1375 |
+
public function pvbur_aws_search_results_products( $products ) {
|
1376 |
+
|
1377 |
+
$user_role = 'guest';
|
1378 |
+
if ( is_user_logged_in() ) {
|
1379 |
+
$user = wp_get_current_user();
|
1380 |
+
$roles = ( array ) $user->roles;
|
1381 |
+
$user_role = $roles[0];
|
1382 |
+
}
|
1383 |
+
|
1384 |
+
foreach( $products as $key => $product ) {
|
1385 |
+
|
1386 |
+
$visible_roles = get_post_meta( $product['parent_id'], '_alg_wc_pvbur_visible', true );
|
1387 |
+
$invisible_roles = get_post_meta( $product['parent_id'], '_alg_wc_pvbur_invisible', true );
|
1388 |
+
|
1389 |
+
if ( is_array( $invisible_roles ) && ! empty( $invisible_roles ) ) {
|
1390 |
+
foreach( $invisible_roles as $invisible_role ) {
|
1391 |
+
if ( $user_role == $invisible_role ) {
|
1392 |
+
unset( $products[$key] );
|
1393 |
+
continue 2;
|
1394 |
+
}
|
1395 |
+
}
|
1396 |
+
}
|
1397 |
+
|
1398 |
+
if ( is_array( $visible_roles ) && ! empty( $visible_roles ) ) {
|
1399 |
+
$show = false;
|
1400 |
+
foreach( $visible_roles as $visible_role ) {
|
1401 |
+
if ( $user_role == $visible_role ) {
|
1402 |
+
$show = true;
|
1403 |
+
break;
|
1404 |
+
}
|
1405 |
+
}
|
1406 |
+
if ( ! $show ) {
|
1407 |
+
unset( $products[$key] );
|
1408 |
+
continue;
|
1409 |
+
}
|
1410 |
+
}
|
1411 |
+
|
1412 |
+
}
|
1413 |
+
|
1414 |
+
return $products;
|
1415 |
+
|
1416 |
+
}
|
1417 |
+
|
1418 |
}
|
1419 |
|
1420 |
endif;
|
includes/class-aws-order.php
CHANGED
@@ -273,6 +273,14 @@ if ( ! class_exists( 'AWS_Order' ) ) :
|
|
273 |
|
274 |
}
|
275 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
switch( $order_by ) {
|
277 |
|
278 |
case 'price':
|
@@ -310,6 +318,7 @@ if ( ! class_exists( 'AWS_Order' ) ) :
|
|
310 |
break;
|
311 |
|
312 |
case 'rating':
|
|
|
313 |
|
314 |
if ( isset( $this->products[0]['f_rating'] ) ) {
|
315 |
usort( $this->products, array( $this, 'compare_rating' ) );
|
@@ -317,6 +326,14 @@ if ( ! class_exists( 'AWS_Order' ) ) :
|
|
317 |
|
318 |
break;
|
319 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
320 |
case 'popularity':
|
321 |
case 'popularity-desc':
|
322 |
|
@@ -447,7 +464,19 @@ if ( ! class_exists( 'AWS_Order' ) ) :
|
|
447 |
}
|
448 |
|
449 |
/*
|
450 |
-
* Compare rating
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
*/
|
452 |
private function compare_reviews( $a, $b ) {
|
453 |
$a = intval( $a['f_reviews'] * 100 );
|
273 |
|
274 |
}
|
275 |
|
276 |
+
/**
|
277 |
+
* Filter order by value
|
278 |
+
* @since 2.13
|
279 |
+
* @param string $order_by Order by value
|
280 |
+
* @param object $query Page query
|
281 |
+
*/
|
282 |
+
$order_by = apply_filters( 'aws_products_order_by', $order_by, $query );
|
283 |
+
|
284 |
switch( $order_by ) {
|
285 |
|
286 |
case 'price':
|
318 |
break;
|
319 |
|
320 |
case 'rating':
|
321 |
+
case 'rating-desc':
|
322 |
|
323 |
if ( isset( $this->products[0]['f_rating'] ) ) {
|
324 |
usort( $this->products, array( $this, 'compare_rating' ) );
|
326 |
|
327 |
break;
|
328 |
|
329 |
+
case 'rating-asc':
|
330 |
+
|
331 |
+
if ( isset( $this->products[0]['f_rating'] ) ) {
|
332 |
+
usort( $this->products, array( $this, 'compare_rating_asc' ) );
|
333 |
+
}
|
334 |
+
|
335 |
+
break;
|
336 |
+
|
337 |
case 'popularity':
|
338 |
case 'popularity-desc':
|
339 |
|
464 |
}
|
465 |
|
466 |
/*
|
467 |
+
* Compare rating asc
|
468 |
+
*/
|
469 |
+
private function compare_rating_asc( $a, $b ) {
|
470 |
+
$a = intval( $a['f_rating'] * 100 );
|
471 |
+
$b = intval( $b['f_rating'] * 100 );
|
472 |
+
if ($a == $b) {
|
473 |
+
return 0;
|
474 |
+
}
|
475 |
+
return ($a < $b) ? -1 : 1;
|
476 |
+
}
|
477 |
+
|
478 |
+
/*
|
479 |
+
* Compare popularity
|
480 |
*/
|
481 |
private function compare_reviews( $a, $b ) {
|
482 |
$a = intval( $a['f_reviews'] * 100 );
|
includes/class-aws-search-page.php
CHANGED
@@ -85,6 +85,9 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
|
|
85 |
add_action( 'et_pb_shop_before_print_shop', array( $this, 'et_pb_shop_before_print_shop' ) );
|
86 |
add_action( 'et_pb_shop_after_print_shop', array( $this, 'et_pb_shop_after_print_shop' ) );
|
87 |
|
|
|
|
|
|
|
88 |
}
|
89 |
|
90 |
/**
|
@@ -101,10 +104,10 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
|
|
101 |
}
|
102 |
|
103 |
$new_posts = array();
|
104 |
-
|
105 |
$search_query = $query->query_vars['s'] ? $query->query_vars['s'] : $_GET['s'];
|
106 |
-
$search_res = $this->search( $search_query, $query );
|
107 |
$posts_per_page = apply_filters( 'aws_posts_per_page', $query->get( 'posts_per_page' ) );
|
|
|
|
|
108 |
|
109 |
$query->found_posts = count( $search_res['all'] );
|
110 |
$query->max_num_pages = ceil( count( $search_res['all'] ) / $posts_per_page );
|
@@ -191,9 +194,10 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
|
|
191 |
|
192 |
$products_ids = array();
|
193 |
$posts_per_page = apply_filters( 'aws_posts_per_page', $query->get( 'posts_per_page' ) );
|
|
|
194 |
$search_query = $_GET['s'];
|
195 |
|
196 |
-
$search_res = $this->search( $search_query, $query );
|
197 |
|
198 |
$query->found_posts = count( $search_res['all'] );
|
199 |
$query->max_num_pages = ceil( count( $search_res['all'] ) / $posts_per_page );
|
@@ -320,33 +324,46 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
|
|
320 |
|
321 |
}
|
322 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
/**
|
324 |
* Perform the search.
|
325 |
*
|
326 |
* @param string $s
|
327 |
* @param object $query
|
|
|
|
|
328 |
* @return array
|
329 |
*/
|
330 |
-
private function search( $s, $query ) {
|
331 |
|
332 |
-
$hash =
|
333 |
|
334 |
if ( isset( $this->data['search_res'][$hash] ) ) {
|
335 |
-
|
336 |
-
}
|
337 |
-
|
338 |
-
if ( isset( $this->data['search_res']['s'] ) ) {
|
339 |
-
$posts_array = $this->data['search_res']['s'];
|
340 |
} else {
|
341 |
$posts_array = (array) aws_search( $s );
|
342 |
-
$this->data['search_res'][
|
343 |
}
|
344 |
|
345 |
-
$posts_per_page = apply_filters( 'aws_posts_per_page', $query->get( 'posts_per_page' ) );
|
346 |
$post_array_products = $posts_array['products'];
|
347 |
|
348 |
// Filter and order output
|
349 |
-
if ( $post_array_products && is_array( $post_array_products ) && ! empty( $post_array_products ) ) {
|
350 |
$post_array_products = AWS()->order( $post_array_products, $query );
|
351 |
}
|
352 |
|
@@ -354,20 +371,17 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
|
|
354 |
$posts_per_page = 999999;
|
355 |
}
|
356 |
|
357 |
-
$paged = $query->query_vars['paged'] ? $query->query_vars['paged'] : 1;
|
358 |
$offset = ( $paged > 1 ) ? $paged * $posts_per_page - $posts_per_page : 0;
|
359 |
|
360 |
$products = array_slice( $post_array_products, $offset, $posts_per_page );
|
361 |
|
362 |
$this->data['all_products'] = $post_array_products;
|
363 |
|
364 |
-
|
365 |
'all' => $post_array_products,
|
366 |
'products' => $products
|
367 |
);
|
368 |
|
369 |
-
return $this->data['search_res'][$hash];
|
370 |
-
|
371 |
}
|
372 |
|
373 |
/*
|
85 |
add_action( 'et_pb_shop_before_print_shop', array( $this, 'et_pb_shop_before_print_shop' ) );
|
86 |
add_action( 'et_pb_shop_after_print_shop', array( $this, 'et_pb_shop_after_print_shop' ) );
|
87 |
|
88 |
+
// FacetWP support
|
89 |
+
add_filter( 'facetwp_pre_filtered_post_ids', array( $this, 'facetwp_pre_filtered_post_ids' ), 10, 2 );
|
90 |
+
|
91 |
}
|
92 |
|
93 |
/**
|
104 |
}
|
105 |
|
106 |
$new_posts = array();
|
|
|
107 |
$search_query = $query->query_vars['s'] ? $query->query_vars['s'] : $_GET['s'];
|
|
|
108 |
$posts_per_page = apply_filters( 'aws_posts_per_page', $query->get( 'posts_per_page' ) );
|
109 |
+
$paged = $query->query_vars['paged'] ? $query->query_vars['paged'] : 1;
|
110 |
+
$search_res = $this->search( $search_query, $query, $posts_per_page, $paged );
|
111 |
|
112 |
$query->found_posts = count( $search_res['all'] );
|
113 |
$query->max_num_pages = ceil( count( $search_res['all'] ) / $posts_per_page );
|
194 |
|
195 |
$products_ids = array();
|
196 |
$posts_per_page = apply_filters( 'aws_posts_per_page', $query->get( 'posts_per_page' ) );
|
197 |
+
$paged = $query->query_vars['paged'] ? $query->query_vars['paged'] : 1;
|
198 |
$search_query = $_GET['s'];
|
199 |
|
200 |
+
$search_res = $this->search( $search_query, $query, $posts_per_page, $paged );
|
201 |
|
202 |
$query->found_posts = count( $search_res['all'] );
|
203 |
$query->max_num_pages = ceil( count( $search_res['all'] ) / $posts_per_page );
|
324 |
|
325 |
}
|
326 |
|
327 |
+
/*
|
328 |
+
* FacetWP add unfiltered products IDs
|
329 |
+
*/
|
330 |
+
public function facetwp_pre_filtered_post_ids( $post_ids, $obj ) {
|
331 |
+
if ( isset( $_GET['type_aws'] ) && isset( $_GET['s'] ) ) {
|
332 |
+
$search_query = $_GET['s'];
|
333 |
+
$search_res = $this->search( $search_query, $obj->query, $obj->query_args['posts_per_page'], $obj->query_args['paged'] );
|
334 |
+
$products_ids = array();
|
335 |
+
foreach ( $search_res['all'] as $product ) {
|
336 |
+
$products_ids[] = $product['id'];
|
337 |
+
}
|
338 |
+
$post_ids = $products_ids;
|
339 |
+
}
|
340 |
+
return $post_ids;
|
341 |
+
}
|
342 |
+
|
343 |
/**
|
344 |
* Perform the search.
|
345 |
*
|
346 |
* @param string $s
|
347 |
* @param object $query
|
348 |
+
* @param int $posts_per_page
|
349 |
+
* @param int $paged
|
350 |
* @return array
|
351 |
*/
|
352 |
+
private function search( $s, $query, $posts_per_page, $paged = 1 ) {
|
353 |
|
354 |
+
$hash = hash( 'md2', $s );
|
355 |
|
356 |
if ( isset( $this->data['search_res'][$hash] ) ) {
|
357 |
+
$posts_array = $this->data['search_res'][$hash];
|
|
|
|
|
|
|
|
|
358 |
} else {
|
359 |
$posts_array = (array) aws_search( $s );
|
360 |
+
$this->data['search_res'][$hash] = $posts_array;
|
361 |
}
|
362 |
|
|
|
363 |
$post_array_products = $posts_array['products'];
|
364 |
|
365 |
// Filter and order output
|
366 |
+
if ( $post_array_products && is_array( $post_array_products ) && ! empty( $post_array_products ) && is_object( $query ) ) {
|
367 |
$post_array_products = AWS()->order( $post_array_products, $query );
|
368 |
}
|
369 |
|
371 |
$posts_per_page = 999999;
|
372 |
}
|
373 |
|
|
|
374 |
$offset = ( $paged > 1 ) ? $paged * $posts_per_page - $posts_per_page : 0;
|
375 |
|
376 |
$products = array_slice( $post_array_products, $offset, $posts_per_page );
|
377 |
|
378 |
$this->data['all_products'] = $post_array_products;
|
379 |
|
380 |
+
return array(
|
381 |
'all' => $post_array_products,
|
382 |
'products' => $products
|
383 |
);
|
384 |
|
|
|
|
|
385 |
}
|
386 |
|
387 |
/*
|
includes/class-aws-table.php
CHANGED
@@ -168,6 +168,8 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
168 |
|
169 |
delete_transient( 'aws_index_processed' );
|
170 |
|
|
|
|
|
171 |
}
|
172 |
|
173 |
}
|
@@ -309,6 +311,8 @@ if ( ! class_exists( 'AWS_Table' ) ) :
|
|
309 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
310 |
dbDelta( $sql );
|
311 |
|
|
|
|
|
312 |
}
|
313 |
|
314 |
/*
|
168 |
|
169 |
delete_transient( 'aws_index_processed' );
|
170 |
|
171 |
+
do_action( 'aws_index_complete', $index_meta );
|
172 |
+
|
173 |
}
|
174 |
|
175 |
}
|
311 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
312 |
dbDelta( $sql );
|
313 |
|
314 |
+
do_action( 'aws_create_index_table' );
|
315 |
+
|
316 |
}
|
317 |
|
318 |
/*
|
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.5
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -111,6 +111,16 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
|
|
111 |
|
112 |
== Changelog ==
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
= 2.12 ( 2020-10-05 ) =
|
115 |
* Fix - Results display for Divi builder search page template
|
116 |
* Fix - Plugin search module for Divi builder
|
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.13
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
111 |
|
112 |
== Changelog ==
|
113 |
|
114 |
+
= 2.13 ( 2020-10-19 ) =
|
115 |
+
* Add - FacetWP plugin integration. [Read more](https://advanced-woo-search.com/guide/facetwp/)
|
116 |
+
* Add - Support for 'Product Visibility by User Role for WooCommerce' plugin. [Read more](https://advanced-woo-search.com/guide/product-visibility-by-user-role-for-woocommerce/)
|
117 |
+
* Add - Support for Avada theme default shop filters
|
118 |
+
* Update - Search results page query
|
119 |
+
* Update - Divi builder search form styles
|
120 |
+
* Dev - Add aws_products_order_by filter
|
121 |
+
* Dev - Add aws_index_complete
|
122 |
+
* Dev - Add aws_create_index_table
|
123 |
+
|
124 |
= 2.12 ( 2020-10-05 ) =
|
125 |
* Fix - Results display for Divi builder search page template
|
126 |
* Fix - Plugin search module for Divi builder
|