Version Description
( 2021-07-19 ) = * Add - Support for Products Visibility by User Roles plugin * Add - Support for WPBakery plugin. Added search form element for page builder * Update - Settings page styles for tables * Update - Tested with WC 5.5 * Fix - Bug with not working pagination for search results page that was created with Load Dynamic Content for Elementor plugin * Fix - WooCommerce Product Filter by WooBeWoo plugin integration. Fix issue with filtering by attributes * Fix - Search form styles for Divi theme * Dev - Use new block_categories_all filter for blocks * Dev - Add awsLoaded js event
Download this release
Release Info
Developer | Mihail Barinov |
Plugin | Advanced Woo Search |
Version | 2.32 |
Comparing to | |
See all releases |
Code changes from version 2.31 to 2.32
- advanced-woo-search.php +3 -3
- assets/css/admin.css +3 -2
- assets/img/logo-small.png +0 -0
- assets/js/common.js +31 -0
- includes/class-aws-integrations.php +87 -5
- includes/modules/class-aws-products-visibility.php +180 -0
- includes/modules/class-aws-wpbakery.php +93 -0
- includes/modules/gutenberg/class-aws-gutenberg-init.php +6 -2
- readme.txt +12 -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: 5.
|
12 |
*/
|
13 |
|
14 |
|
@@ -96,7 +96,7 @@ final class AWS_Main {
|
|
96 |
*/
|
97 |
private function define_constants() {
|
98 |
|
99 |
-
$this->define( 'AWS_VERSION', '2.
|
100 |
|
101 |
$this->define( 'AWS_DIR', plugin_dir_path( AWS_FILE ) );
|
102 |
$this->define( 'AWS_URL', plugin_dir_url( AWS_FILE ) );
|
3 |
/*
|
4 |
Plugin Name: Advanced Woo Search
|
5 |
Description: Advance ajax WooCommerce product search.
|
6 |
+
Version: 2.32
|
7 |
Author: ILLID
|
8 |
Author URI: https://advanced-woo-search.com/
|
9 |
Text Domain: advanced-woo-search
|
10 |
WC requires at least: 3.0.0
|
11 |
+
WC tested up to: 5.5.0
|
12 |
*/
|
13 |
|
14 |
|
96 |
*/
|
97 |
private function define_constants() {
|
98 |
|
99 |
+
$this->define( 'AWS_VERSION', '2.32' );
|
100 |
|
101 |
$this->define( 'AWS_DIR', plugin_dir_path( AWS_FILE ) );
|
102 |
$this->define( 'AWS_URL', plugin_dir_url( AWS_FILE ) );
|
assets/css/admin.css
CHANGED
@@ -223,9 +223,10 @@ h1.aws-instance-name {
|
|
223 |
vertical-align: middle;
|
224 |
}
|
225 |
|
226 |
-
.aws-table td
|
|
|
227 |
vertical-align: middle;
|
228 |
-
padding: 7px;
|
229 |
line-height: 2em;
|
230 |
}
|
231 |
|
223 |
vertical-align: middle;
|
224 |
}
|
225 |
|
226 |
+
.aws-table td,
|
227 |
+
.form-table .aws-table td {
|
228 |
vertical-align: middle;
|
229 |
+
padding: 7px !important;
|
230 |
line-height: 2em;
|
231 |
}
|
232 |
|
assets/img/logo-small.png
ADDED
Binary file
|
assets/js/common.js
CHANGED
@@ -467,6 +467,34 @@ AwsHooks.filters = AwsHooks.filters || {};
|
|
467 |
return check;
|
468 |
},
|
469 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
470 |
};
|
471 |
|
472 |
|
@@ -518,6 +546,9 @@ AwsHooks.filters = AwsHooks.filters || {};
|
|
518 |
var d = self.data(pluginPfx);
|
519 |
|
520 |
|
|
|
|
|
|
|
521 |
|
522 |
if ( $searchForm.length > 0 ) {
|
523 |
methods.init.call(this);
|
467 |
return check;
|
468 |
},
|
469 |
|
470 |
+
createCustomEvent: function( event, params ) {
|
471 |
+
|
472 |
+
var customEvent = false;
|
473 |
+
params = params || null;
|
474 |
+
|
475 |
+
if ( typeof window.CustomEvent === "function" ) {
|
476 |
+
customEvent = new CustomEvent( event, { bubbles: true, cancelable: true, detail: params } );
|
477 |
+
|
478 |
+
}
|
479 |
+
else if ( document.createEvent ) {
|
480 |
+
customEvent = document.createEvent( 'CustomEvent' );
|
481 |
+
customEvent.initCustomEvent( event, true, true, params );
|
482 |
+
}
|
483 |
+
|
484 |
+
return customEvent;
|
485 |
+
|
486 |
+
},
|
487 |
+
|
488 |
+
createAndDispatchEvent: function( obj, event, params ) {
|
489 |
+
|
490 |
+
var customEvent = methods.createCustomEvent( event, params );
|
491 |
+
|
492 |
+
if ( customEvent ) {
|
493 |
+
obj.dispatchEvent( customEvent );
|
494 |
+
}
|
495 |
+
|
496 |
+
}
|
497 |
+
|
498 |
};
|
499 |
|
500 |
|
546 |
var d = self.data(pluginPfx);
|
547 |
|
548 |
|
549 |
+
// AWS is fully loaded
|
550 |
+
methods.createAndDispatchEvent( document, 'awsLoaded', { instance: instance, form: self, data: d } );
|
551 |
+
|
552 |
|
553 |
if ( $searchForm.length > 0 ) {
|
554 |
methods.init.call(this);
|
includes/class-aws-integrations.php
CHANGED
@@ -267,6 +267,11 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
|
|
267 |
add_filter( 'aws_exclude_products', array( $this, 'wcvo_exclude_products' ), 1 );
|
268 |
}
|
269 |
|
|
|
|
|
|
|
|
|
|
|
270 |
}
|
271 |
|
272 |
/**
|
@@ -320,6 +325,16 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
|
|
320 |
include_once( AWS_DIR . '/includes/modules/class-aws-awl.php' );
|
321 |
}
|
322 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
}
|
324 |
|
325 |
/*
|
@@ -1377,7 +1392,7 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
|
|
1377 |
$pattern = '/(<div class="aws-container"[\s\S]*?<form.*?<\/form><\/div>)/i';
|
1378 |
}
|
1379 |
|
1380 |
-
$html = '<style>.et_search_outer .aws-container { position: absolute;right: 40px;top: 20px; }</style>' . $html;
|
1381 |
$html = trim(preg_replace('/\s\s+/', ' ', $html));
|
1382 |
$html = preg_replace( $pattern, $form, $html );
|
1383 |
|
@@ -1871,9 +1886,9 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
|
|
1871 |
'terms' => $isAnd ? $idsAnd : $idsOr,
|
1872 |
'operator' => $operator
|
1873 |
);
|
1874 |
-
}
|
1875 |
|
1876 |
-
|
|
|
1877 |
|
1878 |
$idsAnd = explode(',', $param);
|
1879 |
$idsOr = explode('|', $param);
|
@@ -1883,11 +1898,50 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
|
|
1883 |
'terms' => $isAnd ? $idsAnd : $idsOr,
|
1884 |
'operator' => $operator
|
1885 |
);
|
1886 |
-
}
|
1887 |
|
1888 |
-
|
|
|
1889 |
$filters['on_sale'] = true;
|
1890 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1891 |
|
1892 |
}
|
1893 |
|
@@ -1950,6 +2004,34 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
|
|
1950 |
return $exclude_products;
|
1951 |
}
|
1952 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1953 |
}
|
1954 |
|
1955 |
endif;
|
267 |
add_filter( 'aws_exclude_products', array( $this, 'wcvo_exclude_products' ), 1 );
|
268 |
}
|
269 |
|
270 |
+
// Dynamic Content for Elementor plugin
|
271 |
+
if ( function_exists( 'dce_load' ) ) {
|
272 |
+
add_action( 'wp_footer', array( $this, 'dce_scripts' ) );
|
273 |
+
}
|
274 |
+
|
275 |
}
|
276 |
|
277 |
/**
|
325 |
include_once( AWS_DIR . '/includes/modules/class-aws-awl.php' );
|
326 |
}
|
327 |
|
328 |
+
// Products Visibility by User Roles plugin
|
329 |
+
if ( class_exists( 'Addify_Products_Visibility' ) ) {
|
330 |
+
include_once( AWS_DIR . '/includes/modules/class-aws-products-visibility.php' );
|
331 |
+
}
|
332 |
+
|
333 |
+
// WPBakery plugin
|
334 |
+
if ( defined( 'WPB_VC_VERSION' ) ) {
|
335 |
+
include_once( AWS_DIR . '/includes/modules/class-aws-wpbakery.php' );
|
336 |
+
}
|
337 |
+
|
338 |
}
|
339 |
|
340 |
/*
|
1392 |
$pattern = '/(<div class="aws-container"[\s\S]*?<form.*?<\/form><\/div>)/i';
|
1393 |
}
|
1394 |
|
1395 |
+
$html = '<style>.et_search_outer .aws-container { position: absolute;right: 40px;top: 20px; top: calc( 100% - 60px ); }</style>' . $html;
|
1396 |
$html = trim(preg_replace('/\s\s+/', ' ', $html));
|
1397 |
$html = preg_replace( $pattern, $form, $html );
|
1398 |
|
1886 |
'terms' => $isAnd ? $idsAnd : $idsOr,
|
1887 |
'operator' => $operator
|
1888 |
);
|
|
|
1889 |
|
1890 |
+
}
|
1891 |
+
elseif ( strpos($key, 'product_tag') !== false ) {
|
1892 |
|
1893 |
$idsAnd = explode(',', $param);
|
1894 |
$idsOr = explode('|', $param);
|
1898 |
'terms' => $isAnd ? $idsAnd : $idsOr,
|
1899 |
'operator' => $operator
|
1900 |
);
|
|
|
1901 |
|
1902 |
+
}
|
1903 |
+
elseif ( strpos( $key, 'pr_onsale' ) !== false ) {
|
1904 |
$filters['on_sale'] = true;
|
1905 |
}
|
1906 |
+
elseif ( strpos( $key, 'filter_' ) === 0 ) {
|
1907 |
+
|
1908 |
+
$taxonomy = str_replace( 'filter_', '', $key );
|
1909 |
+
if ( preg_match( '/([a-z]+?)_[\d]/', $taxonomy, $matches ) ) {
|
1910 |
+
$taxonomy = $matches[1];
|
1911 |
+
}
|
1912 |
+
|
1913 |
+
$idsAnd = explode(',', $param);
|
1914 |
+
$idsOr = explode('|', $param);
|
1915 |
+
$isAnd = count($idsAnd) > count($idsOr);
|
1916 |
+
$operator = $isAnd ? 'AND' : 'OR';
|
1917 |
+
|
1918 |
+
$terms_arr = $isAnd ? $idsAnd : $idsOr;
|
1919 |
+
|
1920 |
+
if ( preg_match( '/[a-z]/', $param ) ) {
|
1921 |
+
$new_terms_arr = array();
|
1922 |
+
foreach ( $terms_arr as $term_slug ) {
|
1923 |
+
$term = get_term_by('slug', $term_slug, $taxonomy );
|
1924 |
+
if ( $term ) {
|
1925 |
+
$new_terms_arr[] = $term->term_id;
|
1926 |
+
}
|
1927 |
+
if ( ! $term && strpos( $taxonomy, 'pa_' ) !== 0 ) {
|
1928 |
+
$term = get_term_by('slug', $term_slug, 'pa_' . $taxonomy );
|
1929 |
+
if ( $term ) {
|
1930 |
+
$new_terms_arr[] = $term->term_id;
|
1931 |
+
}
|
1932 |
+
}
|
1933 |
+
}
|
1934 |
+
if ( $new_terms_arr ) {
|
1935 |
+
$terms_arr = $new_terms_arr;
|
1936 |
+
}
|
1937 |
+
}
|
1938 |
+
|
1939 |
+
$filters['tax'][$taxonomy] = array(
|
1940 |
+
'terms' => $terms_arr,
|
1941 |
+
'operator' => $operator
|
1942 |
+
);
|
1943 |
+
|
1944 |
+
}
|
1945 |
|
1946 |
}
|
1947 |
|
2004 |
return $exclude_products;
|
2005 |
}
|
2006 |
|
2007 |
+
/*
|
2008 |
+
* Load Dynamic Content for Elementor plugin scripts for search page
|
2009 |
+
*/
|
2010 |
+
public function dce_scripts() {
|
2011 |
+
|
2012 |
+
if ( ! isset( $_GET['s'] ) || ! isset( $_GET['post_type'] ) || $_GET['post_type'] !== 'product' || ! isset( $_GET['type_aws'] ) ) {
|
2013 |
+
return;
|
2014 |
+
}
|
2015 |
+
|
2016 |
+
?>
|
2017 |
+
|
2018 |
+
<script>
|
2019 |
+
window.addEventListener('load', function() {
|
2020 |
+
if ( typeof jQuery !== 'undefined' ) {
|
2021 |
+
var $navItems = jQuery('.dce-page-numbers a.page-numbers');
|
2022 |
+
if ( $navItems.length > 0 ) {
|
2023 |
+
$navItems.each(function(){
|
2024 |
+
var s = encodeURIComponent( '<?php echo $_GET['s']; ?>' );
|
2025 |
+
var href = jQuery(this).attr( 'href' ) + '&post_type=product&type_aws=true&s=' + s;
|
2026 |
+
jQuery(this).attr( 'href', href );
|
2027 |
+
});
|
2028 |
+
}
|
2029 |
+
}
|
2030 |
+
}, false);
|
2031 |
+
</script>
|
2032 |
+
|
2033 |
+
<?php }
|
2034 |
+
|
2035 |
}
|
2036 |
|
2037 |
endif;
|
includes/modules/class-aws-products-visibility.php
ADDED
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Products Visibility by User Roles plugin integration
|
4 |
+
*/
|
5 |
+
|
6 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
7 |
+
exit; // Exit if accessed directly.
|
8 |
+
}
|
9 |
+
|
10 |
+
if ( ! class_exists( 'AWS_AFPVU' ) ) :
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Class
|
14 |
+
*/
|
15 |
+
class AWS_AFPVU {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Main AWS_AFPVU Instance
|
19 |
+
*
|
20 |
+
* Ensures only one instance of AWS_AFPVU is loaded or can be loaded.
|
21 |
+
*
|
22 |
+
* @static
|
23 |
+
* @return AWS_AFPVU - Main instance
|
24 |
+
*/
|
25 |
+
protected static $_instance = null;
|
26 |
+
|
27 |
+
private $data = array();
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Main AWS_AFPVU Instance
|
31 |
+
*
|
32 |
+
* Ensures only one instance of AWS_AFPVU is loaded or can be loaded.
|
33 |
+
*
|
34 |
+
* @static
|
35 |
+
* @return AWS_AFPVU - Main instance
|
36 |
+
*/
|
37 |
+
public static function instance() {
|
38 |
+
if ( is_null( self::$_instance ) ) {
|
39 |
+
self::$_instance = new self();
|
40 |
+
}
|
41 |
+
return self::$_instance;
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Constructor
|
46 |
+
*/
|
47 |
+
public function __construct() {
|
48 |
+
|
49 |
+
// Show/hide products
|
50 |
+
add_filter( 'aws_search_query_array', array( $this, 'search_query_array' ), 1 );
|
51 |
+
|
52 |
+
// Show/hide categories
|
53 |
+
add_filter( 'aws_terms_search_query', array( $this, 'terms_search_query' ), 1, 2 );
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
/*
|
58 |
+
* Filter products search results
|
59 |
+
*/
|
60 |
+
public function search_query_array( $query ) {
|
61 |
+
|
62 |
+
$filter = $this->get_filtered_terms();
|
63 |
+
|
64 |
+
if ( isset( $filter['ids'] ) && ! empty( $filter['ids'] ) ) {
|
65 |
+
|
66 |
+
$relation = isset( $filter['relation'] ) && $filter['relation'] === 'show' ? 'IN' : 'NOT IN';
|
67 |
+
|
68 |
+
$query['search'] .= sprintf( ' AND ( id %s ( %s ) )', $relation, implode( ',', $filter['ids'] ) );
|
69 |
+
|
70 |
+
}
|
71 |
+
|
72 |
+
return $query;
|
73 |
+
|
74 |
+
}
|
75 |
+
|
76 |
+
/*
|
77 |
+
* Filter categories search results
|
78 |
+
*/
|
79 |
+
public function terms_search_query( $sql, $taxonomy ) {
|
80 |
+
|
81 |
+
global $wpdb;
|
82 |
+
|
83 |
+
$filter = $this->get_filtered_terms();
|
84 |
+
|
85 |
+
if ( isset( $filter['terms'] ) && ! empty( $filter['terms'] ) ) {
|
86 |
+
|
87 |
+
$relation = isset( $filter['relation'] ) && $filter['relation'] === 'show' ? 'IN' : 'NOT IN';
|
88 |
+
|
89 |
+
$sql_terms = "AND $wpdb->term_taxonomy.term_id {$relation} ( " . implode( ',', $filter['terms'] ) . " )";
|
90 |
+
$sql = str_replace( 'WHERE 1 = 1', 'WHERE 1 = 1 ' . $sql_terms, $sql );
|
91 |
+
|
92 |
+
}
|
93 |
+
|
94 |
+
return $sql;
|
95 |
+
}
|
96 |
+
|
97 |
+
/*
|
98 |
+
* Get filtered products
|
99 |
+
*/
|
100 |
+
private function get_filtered_terms() {
|
101 |
+
|
102 |
+
if ( isset( $this->data['products'] ) && is_array( $this->data['products'] ) ) {
|
103 |
+
return $this->data['products'];
|
104 |
+
}
|
105 |
+
|
106 |
+
$products = array();
|
107 |
+
|
108 |
+
$afpvu_enable_global = get_option('afpvu_enable_global');
|
109 |
+
$curr_role = is_user_logged_in() ? current( wp_get_current_user()->roles ) : 'guest';
|
110 |
+
$role_selected_data = (array) get_option('afpvu_user_role_visibility');
|
111 |
+
|
112 |
+
if ( empty( $role_selected_data ) && 'yes' !== $afpvu_enable_global ) {
|
113 |
+
return $products;
|
114 |
+
}
|
115 |
+
|
116 |
+
$role_data = isset( $role_selected_data[$curr_role]['afpvu_enable_role'] ) ? $role_selected_data[$curr_role]['afpvu_enable_role'] : 'no';
|
117 |
+
|
118 |
+
if ( 'yes' === $afpvu_enable_global ) {
|
119 |
+
|
120 |
+
$afpvu_show_hide = get_option('afpvu_show_hide');
|
121 |
+
$afpvu_applied_products = (array) get_option('afpvu_applied_products');
|
122 |
+
$afpvu_applied_categories = (array) get_option('afpvu_applied_categories');
|
123 |
+
}
|
124 |
+
|
125 |
+
if ( 'yes' === $role_data ) {
|
126 |
+
|
127 |
+
$_data = $role_selected_data[$curr_role];
|
128 |
+
$afpvu_show_hide = isset( $_data['afpvu_show_hide_role'] ) ? $_data['afpvu_show_hide_role'] : 'hide' ;
|
129 |
+
$afpvu_applied_products = isset( $_data['afpvu_applied_products_role'] ) ? (array) $_data['afpvu_applied_products_role'] : array() ;
|
130 |
+
$afpvu_applied_categories = isset( $_data['afpvu_applied_categories_role'] ) ? (array) $_data['afpvu_applied_categories_role'] : array();
|
131 |
+
}
|
132 |
+
|
133 |
+
if ( empty( $afpvu_applied_products ) && empty( $afpvu_applied_categories ) ) {
|
134 |
+
return $products;
|
135 |
+
}
|
136 |
+
|
137 |
+
$products_ids = array();
|
138 |
+
|
139 |
+
if ( !empty($afpvu_applied_categories) ) {
|
140 |
+
|
141 |
+
$product_args = array(
|
142 |
+
'numberposts' => -1,
|
143 |
+
'post_status' => array('publish'),
|
144 |
+
'post_type' => array('product'), //skip types
|
145 |
+
'fields' => 'ids'
|
146 |
+
);
|
147 |
+
|
148 |
+
$product_args['tax_query'] = array(
|
149 |
+
array(
|
150 |
+
'taxonomy' => 'product_cat',
|
151 |
+
'field' => 'id',
|
152 |
+
'terms' => $afpvu_applied_categories,
|
153 |
+
'operator' => 'IN',
|
154 |
+
));
|
155 |
+
|
156 |
+
$products_ids = (array) get_posts($product_args);
|
157 |
+
}
|
158 |
+
|
159 |
+
$afpvu_applied_products = array_merge( (array) $afpvu_applied_products, (array) $products_ids );
|
160 |
+
|
161 |
+
$products['ids'] = $afpvu_applied_products;
|
162 |
+
$products['terms'] = $afpvu_applied_categories;
|
163 |
+
|
164 |
+
if ( ! empty( $afpvu_show_hide ) && 'hide' == $afpvu_show_hide) {
|
165 |
+
$products['relation'] = 'hide';
|
166 |
+
} elseif ( ! empty( $afpvu_show_hide ) && 'show' == $afpvu_show_hide ) {
|
167 |
+
$products['relation'] = 'show';
|
168 |
+
}
|
169 |
+
|
170 |
+
$this->data['products'] = $products;
|
171 |
+
|
172 |
+
return $products;
|
173 |
+
|
174 |
+
}
|
175 |
+
|
176 |
+
}
|
177 |
+
|
178 |
+
endif;
|
179 |
+
|
180 |
+
AWS_AFPVU::instance();
|
includes/modules/class-aws-wpbakery.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WPBakery plugin integration
|
4 |
+
*/
|
5 |
+
|
6 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
7 |
+
exit; // Exit if accessed directly.
|
8 |
+
}
|
9 |
+
|
10 |
+
if ( ! class_exists( 'AWS_WPBakery' ) ) :
|
11 |
+
|
12 |
+
class AWS_WPBakery extends WPBakeryShortCode {
|
13 |
+
|
14 |
+
function __construct() {
|
15 |
+
add_action( 'init', array( $this, 'create_shortcode' ), 999 );
|
16 |
+
add_shortcode( 'wpb_aws_search_form', array( $this, 'render_shortcode' ) );
|
17 |
+
}
|
18 |
+
|
19 |
+
public function create_shortcode() {
|
20 |
+
|
21 |
+
vc_map( array(
|
22 |
+
'name' => __('Search Form', 'advanced-woo-search'),
|
23 |
+
'base' => 'wpb_aws_search_form',
|
24 |
+
'description' => __( 'Plugin search form', 'advanced-woo-search'),
|
25 |
+
'category' => __( 'Advanced Woo Search', 'advanced-woo-search'),
|
26 |
+
"class" => "vc_aws_form",
|
27 |
+
"icon" => AWS_URL . '/assets/img/logo-small.png',
|
28 |
+
"controls" => "full",
|
29 |
+
'params' => array(
|
30 |
+
|
31 |
+
array(
|
32 |
+
'type' => 'textfield',
|
33 |
+
'holder' => 'div',
|
34 |
+
'heading' => __( 'Placeholder', 'advanced-woo-search' ),
|
35 |
+
'param_name' => 'placeholder',
|
36 |
+
'value' => __( 'Search', 'advanced-woo-search' ),
|
37 |
+
'description' => '',
|
38 |
+
),
|
39 |
+
|
40 |
+
array(
|
41 |
+
'type' => 'textfield',
|
42 |
+
'heading' => __( 'Element ID', 'advanced-woo-search' ),
|
43 |
+
'param_name' => 'element_id',
|
44 |
+
'value' => '',
|
45 |
+
'description' => '',
|
46 |
+
'group' => __( 'Extra', 'advanced-woo-search'),
|
47 |
+
),
|
48 |
+
|
49 |
+
array(
|
50 |
+
'type' => 'textfield',
|
51 |
+
'heading' => __( 'Extra class name', 'advanced-woo-search' ),
|
52 |
+
'param_name' => 'extra_class',
|
53 |
+
'value' => '',
|
54 |
+
'description' => '',
|
55 |
+
'group' => __( 'Extra', 'advanced-woo-search'),
|
56 |
+
),
|
57 |
+
|
58 |
+
),
|
59 |
+
));
|
60 |
+
|
61 |
+
}
|
62 |
+
|
63 |
+
public function render_shortcode( $atts, $content, $tag ) {
|
64 |
+
|
65 |
+
$atts = (shortcode_atts(array(
|
66 |
+
'placeholder' => '',
|
67 |
+
'extra_class' => '',
|
68 |
+
'element_id' => ''
|
69 |
+
), $atts));
|
70 |
+
|
71 |
+
$placeholder = esc_html($atts['placeholder']);
|
72 |
+
$extra_class = esc_attr($atts['extra_class']);
|
73 |
+
$element_id = esc_attr($atts['element_id']);
|
74 |
+
|
75 |
+
$output = '';
|
76 |
+
|
77 |
+
if ( function_exists( 'aws_get_search_form' ) ) {
|
78 |
+
$search_form = aws_get_search_form( false );
|
79 |
+
if ( $placeholder ) {
|
80 |
+
$search_form = preg_replace( '/placeholder="([\S\s]*?)"/i', 'placeholder="' . $placeholder . '"', $search_form );
|
81 |
+
}
|
82 |
+
$output = '<div class="aws-wpbakery-form ' . $extra_class . '" id="' . $element_id . '" >' . $search_form . '</div>';
|
83 |
+
}
|
84 |
+
|
85 |
+
return $output;
|
86 |
+
|
87 |
+
}
|
88 |
+
|
89 |
+
}
|
90 |
+
|
91 |
+
endif;
|
92 |
+
|
93 |
+
new AWS_WPBakery();
|
includes/modules/gutenberg/class-aws-gutenberg-init.php
CHANGED
@@ -43,7 +43,11 @@ if (!class_exists('AWS_Gutenberg_Init')) :
|
|
43 |
|
44 |
add_action( 'init', array( $this, 'register_block' ) );
|
45 |
|
46 |
-
|
|
|
|
|
|
|
|
|
47 |
|
48 |
}
|
49 |
|
@@ -101,7 +105,7 @@ if (!class_exists('AWS_Gutenberg_Init')) :
|
|
101 |
/*
|
102 |
* Add new blocks category
|
103 |
*/
|
104 |
-
public function add_block_category( $categories
|
105 |
return array_merge(
|
106 |
$categories,
|
107 |
array(
|
43 |
|
44 |
add_action( 'init', array( $this, 'register_block' ) );
|
45 |
|
46 |
+
if ( version_compare( get_bloginfo('version'),'5.8', '>=' ) ) {
|
47 |
+
add_filter( 'block_categories_all', array( $this, 'add_block_category' ) );
|
48 |
+
} else {
|
49 |
+
add_filter( 'block_categories', array( $this, 'add_block_category' ) );
|
50 |
+
}
|
51 |
|
52 |
}
|
53 |
|
105 |
/*
|
106 |
* Add new blocks category
|
107 |
*/
|
108 |
+
public function add_block_category( $categories ) {
|
109 |
return array_merge(
|
110 |
$categories,
|
111 |
array(
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: widget, plugin, woocommerce, search, product search, woocommerce search, ajax search, live search, custom search, ajax, shortcode, better search, relevance search, relevant search, search by sku, search plugin, shop, store, wordpress search, wp ajax search, wp search, wp search plugin, sidebar, ecommerce, merketing, products, category search, instant-search, search highlight, woocommerce advanced search, woocommerce live search, WooCommerce Plugin, woocommerce product search
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.8
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -167,6 +167,17 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
|
|
167 |
|
168 |
== Changelog ==
|
169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
= 2.31 ( 2021-07-05 ) =
|
171 |
* Update - Plugin settings page
|
172 |
* Dev - Add aws_create_index_table_sql filter
|
4 |
Tags: widget, plugin, woocommerce, search, product search, woocommerce search, ajax search, live search, custom search, ajax, shortcode, better search, relevance search, relevant search, search by sku, search plugin, shop, store, wordpress search, wp ajax search, wp search, wp search plugin, sidebar, ecommerce, merketing, products, category search, instant-search, search highlight, woocommerce advanced search, woocommerce live search, WooCommerce Plugin, woocommerce product search
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.8
|
7 |
+
Stable tag: 2.32
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
167 |
|
168 |
== Changelog ==
|
169 |
|
170 |
+
= 2.32 ( 2021-07-19 ) =
|
171 |
+
* Add - Support for Products Visibility by User Roles plugin
|
172 |
+
* Add - Support for WPBakery plugin. Added search form element for page builder
|
173 |
+
* Update - Settings page styles for tables
|
174 |
+
* Update - Tested with WC 5.5
|
175 |
+
* Fix - Bug with not working pagination for search results page that was created with Load Dynamic Content for Elementor plugin
|
176 |
+
* Fix - WooCommerce Product Filter by WooBeWoo plugin integration. Fix issue with filtering by attributes
|
177 |
+
* Fix - Search form styles for Divi theme
|
178 |
+
* Dev - Use new block_categories_all filter for blocks
|
179 |
+
* Dev - Add awsLoaded js event
|
180 |
+
|
181 |
= 2.31 ( 2021-07-05 ) =
|
182 |
* Update - Plugin settings page
|
183 |
* Dev - Add aws_create_index_table_sql filter
|