Advanced Woo Search - Version 2.21

Version Description

( 2021-02-15 ) = * Add - Plugin search form module for Gutenberg * Add - Label element for search form * Add - Integration for BoxShop theme * Add - Aurum theme integration. Add search form to mobile menu * Update - Search form widget. Remove title markup if title value is empty * Update - Porto theme integration

Download this release

Release Info

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

Code changes from version 2.20 to 2.21

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.20
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.9.0
12
  */
13
 
14
 
@@ -96,7 +96,7 @@ final class AWS_Main {
96
  */
97
  private function define_constants() {
98
 
99
- $this->define( 'AWS_VERSION', '2.20' );
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.21
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.0.0
12
  */
13
 
14
 
96
  */
97
  private function define_constants() {
98
 
99
+ $this->define( 'AWS_VERSION', '2.21' );
100
 
101
  $this->define( 'AWS_DIR', plugin_dir_path( AWS_FILE ) );
102
  $this->define( 'AWS_URL', plugin_dir_url( AWS_FILE ) );
assets/css/common.css CHANGED
@@ -85,6 +85,15 @@
85
  }
86
  }
87
 
 
 
 
 
 
 
 
 
 
88
 
89
  .aws-container .aws-search-field {
90
  width: 100%;
85
  }
86
  }
87
 
88
+ .aws-container .aws-search-label {
89
+ position: absolute !important;
90
+ left: -10000px;
91
+ top: auto;
92
+ width: 1px;
93
+ height: 1px;
94
+ overflow: hidden;
95
+ clip: rect(1px, 1px, 1px, 1px);
96
+ }
97
 
98
  .aws-container .aws-search-field {
99
  width: 100%;
includes/class-aws-integrations.php CHANGED
@@ -148,6 +148,15 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
148
  add_action( 'wp_head', array( $this, 'porto_head_action' ) );
149
  }
150
 
 
 
 
 
 
 
 
 
 
151
  }
152
 
153
  add_action( 'wp_head', array( $this, 'head_js_integration' ) );
@@ -241,6 +250,11 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
241
  */
242
  public function includes() {
243
 
 
 
 
 
 
244
  // Elementor plugin widget
245
  if ( defined( 'ELEMENTOR_VERSION' ) || defined( 'ELEMENTOR_PRO_VERSION' ) ) {
246
  include_once( AWS_DIR . '/includes/modules/elementor-widget/class-elementor-aws-init.php' );
@@ -968,6 +982,10 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
968
  public function porto_head_action() { ?>
969
 
970
  <style>
 
 
 
 
971
  #header .aws-container .aws-search-field {
972
  border: 1px solid #eeeeee !important;
973
  height: 100%;
@@ -983,6 +1001,36 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
983
 
984
  <?php }
985
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
986
  /*
987
  * Exclude product categories
988
  */
@@ -1150,6 +1198,10 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
1150
  $selectors[] = '#site-header .products-search';
1151
  }
1152
 
 
 
 
 
1153
  // WCFM - WooCommerce Multivendor Marketplace
1154
  if ( class_exists( 'WCFMmp' ) ) {
1155
  $selectors[] = '#wcfmmp-store .woocommerce-product-search';
148
  add_action( 'wp_head', array( $this, 'porto_head_action' ) );
149
  }
150
 
151
+ if ( 'BoxShop' === $this->current_theme ) {
152
+ add_action( 'wp_head', array( $this, 'boxshop_head_action' ) );
153
+ }
154
+
155
+ if ( 'Aurum' === $this->current_theme ) {
156
+ add_filter( 'aurum_show_search_field_on_mobile', '__return_false' );
157
+ add_filter( 'wp_nav_menu', array( $this, 'aurum_mobile_menu' ), 10, 2 );
158
+ }
159
+
160
  }
161
 
162
  add_action( 'wp_head', array( $this, 'head_js_integration' ) );
250
  */
251
  public function includes() {
252
 
253
+ // Getenberg block
254
+ if ( function_exists( 'register_block_type' ) ) {
255
+ include_once( AWS_DIR . '/includes/modules/gutenberg/class-aws-gutenberg-init.php' );
256
+ }
257
+
258
  // Elementor plugin widget
259
  if ( defined( 'ELEMENTOR_VERSION' ) || defined( 'ELEMENTOR_PRO_VERSION' ) ) {
260
  include_once( AWS_DIR . '/includes/modules/elementor-widget/class-elementor-aws-init.php' );
982
  public function porto_head_action() { ?>
983
 
984
  <style>
985
+ #header .aws-container.searchform {
986
+ border: 0 !important;
987
+ border-radius: 0 !important;
988
+ }
989
  #header .aws-container .aws-search-field {
990
  border: 1px solid #eeeeee !important;
991
  height: 100%;
1001
 
1002
  <?php }
1003
 
1004
+ /*
1005
+ * BoxShop theme styles
1006
+ */
1007
+ public function boxshop_head_action() { ?>
1008
+
1009
+ <style>
1010
+ .ts-header .aws-container .aws-search-form .aws-search-btn.aws-form-btn {
1011
+ background-color: #e72304;
1012
+ }
1013
+ .ts-header .aws-container .aws-search-form .aws-search-btn.aws-form-btn:hover {
1014
+ background-color: #000000;
1015
+ }
1016
+ .aws-container .aws-search-form .aws-search-btn_icon {
1017
+ color: #fff;
1018
+ }
1019
+ </style>
1020
+
1021
+ <?php }
1022
+
1023
+ /*
1024
+ * Add search form to Aurum theme mobile menu
1025
+ */
1026
+ public function aurum_mobile_menu( $nav_menu, $args ) {
1027
+ if ( $args->theme_location === 'main-menu' && $args->menu_class && $args->menu_class === 'mobile-menu' ) {
1028
+ $form = aws_get_search_form( false );
1029
+ $nav_menu = $form . $nav_menu;
1030
+ }
1031
+ return $nav_menu;
1032
+ }
1033
+
1034
  /*
1035
  * Exclude product categories
1036
  */
1198
  $selectors[] = '#site-header .products-search';
1199
  }
1200
 
1201
+ if ( 'BoxShop' === $this->current_theme ) {
1202
+ $selectors[] = '.ts-header .search-wrapper form';
1203
+ }
1204
+
1205
  // WCFM - WooCommerce Multivendor Marketplace
1206
  if ( class_exists( 'WCFMmp' ) ) {
1207
  $selectors[] = '#wcfmmp-store .woocommerce-product-search';
includes/class-aws-markup.php CHANGED
@@ -48,6 +48,7 @@ if ( ! class_exists( 'AWS_Markup' ) ) :
48
  }
49
 
50
  $form_action = AWS_Helpers::get_search_url();
 
51
 
52
  $params_string = '';
53
 
@@ -87,7 +88,8 @@ if ( ! class_exists( 'AWS_Markup' ) ) :
87
 
88
  $markup .= '<div class="aws-wrapper">';
89
 
90
- $markup .= '<input type="search" name="s" value="' . get_search_query() . '" class="aws-search-field" placeholder="' . esc_attr( $placeholder ) . '" autocomplete="off" />';
 
91
  $markup .= '<input type="hidden" name="post_type" value="product">';
92
  $markup .= '<input type="hidden" name="type_aws" value="true">';
93
 
48
  }
49
 
50
  $form_action = AWS_Helpers::get_search_url();
51
+ $input_id = uniqid();
52
 
53
  $params_string = '';
54
 
88
 
89
  $markup .= '<div class="aws-wrapper">';
90
 
91
+ $markup .= '<label style="position:absolute !important;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden;" class="aws-search-label" for="' . esc_attr( $input_id ) . '">' . esc_attr( $placeholder ) . '</label>';
92
+ $markup .= '<input type="search" name="s" id="' . esc_attr( $input_id ) . '" value="' . get_search_query() . '" class="aws-search-field" placeholder="' . esc_attr( $placeholder ) . '" autocomplete="off" />';
93
  $markup .= '<input type="hidden" name="post_type" value="product">';
94
  $markup .= '<input type="hidden" name="type_aws" value="true">';
95
 
includes/modules/gutenberg/aws-gutenberg-search-block.js ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ( function( blocks, element, serverSideRender, blockEditor, components ) {
2
+
3
+ var el = element.createElement;
4
+ var useBlockProps = blockEditor.useBlockProps;
5
+ var RichText = blockEditor.RichText;
6
+ var ServerSideRender = serverSideRender;
7
+
8
+ var InspectorControls = blockEditor.InspectorControls;
9
+ var Fragment = element.Fragment;
10
+
11
+ var TextControl = components.TextControl;
12
+ var Panel = components.Panel;
13
+ var PanelBody = components.PanelBody;
14
+ var PanelRow = components.PanelRow;
15
+
16
+ var sIcon = el('svg', { width: 20, height: 20 },
17
+ el('path', { fill: "#7f54b3", d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" } )
18
+ );
19
+
20
+ blocks.updateCategory('aws', { icon: sIcon });
21
+
22
+ var blockStyle = {
23
+ backgroundColor: '#900',
24
+ color: '#fff',
25
+ padding: '20px',
26
+ };
27
+
28
+ blocks.registerBlockType( 'advanced-woo-search/search-block', {
29
+ apiVersion: 2,
30
+ title: 'Search Form',
31
+ description: 'Advanced Woo Search form block inserts plugin search form into the page.',
32
+ icon: sIcon,
33
+ category: 'aws',
34
+ example: {},
35
+ edit: function( props ) {
36
+
37
+ var blockProps = blockEditor.hasOwnProperty('useBlockProps') ? blockEditor.useBlockProps() : null;
38
+
39
+ return (
40
+ el( Fragment, {},
41
+ el( InspectorControls, {},
42
+ el( PanelBody, { title: 'Search Form Settings', initialOpen: true },
43
+
44
+ /* Text Field */
45
+ el( PanelRow, {},
46
+ el( TextControl,
47
+ {
48
+ label: 'Placeholder text',
49
+ onChange: ( value ) => {
50
+ props.setAttributes( { placeholder: value } );
51
+ },
52
+ value: props.attributes.placeholder
53
+ }
54
+ )
55
+ ),
56
+
57
+ ),
58
+
59
+ ),
60
+ el(
61
+ 'div',
62
+ blockProps,
63
+ el( ServerSideRender, {
64
+ block: 'advanced-woo-search/search-block',
65
+ attributes: props.attributes,
66
+ } )
67
+ )
68
+ )
69
+
70
+ );
71
+
72
+
73
+ },
74
+ save: function( props ) {
75
+ return null;
76
+ },
77
+ } );
78
+ }(
79
+ window.wp.blocks,
80
+ window.wp.element,
81
+ window.wp.serverSideRender,
82
+ window.wp.blockEditor,
83
+ window.wp.components,
84
+ ) );
includes/modules/gutenberg/class-aws-gutenberg-init.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * AWS plugin gutenberg integrations init
5
+ */
6
+
7
+ if (!defined('ABSPATH')) {
8
+ exit; // Exit if accessed directly.
9
+ }
10
+
11
+ if (!class_exists('AWS_Gutenberg_Init')) :
12
+
13
+ /**
14
+ * Class for main plugin functions
15
+ */
16
+ class AWS_Gutenberg_Init {
17
+
18
+ /**
19
+ * @var AWS_Gutenberg_Init The single instance of the class
20
+ */
21
+ protected static $_instance = null;
22
+
23
+ /**
24
+ * Main AWS_Gutenberg_Init Instance
25
+ *
26
+ * Ensures only one instance of AWS_Gutenberg_Init is loaded or can be loaded.
27
+ *
28
+ * @static
29
+ * @return AWS_Gutenberg_Init - Main instance
30
+ */
31
+ public static function instance()
32
+ {
33
+ if (is_null(self::$_instance)) {
34
+ self::$_instance = new self();
35
+ }
36
+ return self::$_instance;
37
+ }
38
+
39
+ /**
40
+ * Constructor
41
+ */
42
+ public function __construct() {
43
+
44
+ add_action( 'init', array( $this, 'register_block' ) );
45
+
46
+ add_filter( 'block_categories', array( $this, 'add_block_category' ), 10, 2 );
47
+
48
+ }
49
+
50
+ /*
51
+ * Register gutenberg blocks
52
+ */
53
+ public function register_block() {
54
+
55
+ wp_register_script(
56
+ 'aws-gutenberg-search-block',
57
+ AWS_URL . '/includes/modules/gutenberg/aws-gutenberg-search-block.js',
58
+ array('wp-blocks','wp-editor'),
59
+ AWS_VERSION
60
+ );
61
+
62
+ wp_register_style(
63
+ 'aws-gutenberg-styles-editor',
64
+ AWS_URL . '/assets/css/common.css',
65
+ array( 'wp-edit-blocks' ),
66
+ AWS_VERSION
67
+ );
68
+
69
+ register_block_type( 'advanced-woo-search/search-block', array(
70
+ 'apiVersion' => 2,
71
+ 'editor_script' => 'aws-gutenberg-search-block',
72
+ 'editor_style' => 'aws-gutenberg-styles-editor',
73
+ 'render_callback' => array( $this, 'search_block_dynamic_render_callback' ),
74
+ 'attributes' => array(
75
+ 'placeholder' => array(
76
+ 'type' => 'string',
77
+ 'default' => AWS_Helpers::translate( 'search_field_text', AWS()->get_settings( 'search_field_text' ) ),
78
+ ),
79
+ ),
80
+ ) );
81
+
82
+ }
83
+
84
+ /*
85
+ * Render dynamic content
86
+ */
87
+ public function search_block_dynamic_render_callback( $block_attributes, $content ) {
88
+
89
+ $placeholder = $block_attributes['placeholder'];
90
+ $search_form = aws_get_search_form( false );
91
+
92
+ if ( $placeholder ) {
93
+ $search_form = preg_replace( '/placeholder="([\S\s]*?)"/i', 'placeholder="' . esc_attr( $placeholder ) . '"', $search_form );
94
+
95
+ }
96
+
97
+ $search_form = '<div style="margin: 20px 0;">' . $search_form . '</div>';
98
+
99
+ return $search_form;
100
+
101
+ }
102
+
103
+ /*
104
+ * Add new blocks category
105
+ */
106
+ public function add_block_category( $categories, $post ) {
107
+ return array_merge(
108
+ $categories,
109
+ array(
110
+ array(
111
+ 'slug' => 'aws',
112
+ 'title' => 'Advanced Woo Search',
113
+ 'icon' => 'search',
114
+ ),
115
+ )
116
+ );
117
+ }
118
+
119
+ }
120
+
121
+
122
+ endif;
123
+
124
+ AWS_Gutenberg_Init::instance();
includes/widget.php CHANGED
@@ -32,10 +32,12 @@ class AWS_Widget extends WP_Widget {
32
  $this->id_base
33
  );
34
 
35
- echo $before_widget;
36
- echo $before_title;
37
- echo $title;
38
- echo $after_title;
 
 
39
 
40
  // Generate search form markup
41
  echo AWS()->markup();
32
  $this->id_base
33
  );
34
 
35
+ if ( $title ) {
36
+ echo $before_widget;
37
+ echo $before_title;
38
+ echo $title;
39
+ echo $after_title;
40
+ }
41
 
42
  // Generate search form markup
43
  echo AWS()->markup();
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.6
7
- Stable tag: 2.20
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -166,6 +166,14 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
166
 
167
  == Changelog ==
168
 
 
 
 
 
 
 
 
 
169
  = 2.20 ( 2021-02-02 ) =
170
  * Add - Beaver Builder plugin support
171
  * Update - Integration for Electro theme
4
  Tags: widget, plugin, woocommerce, search, product search, woocommerce search, ajax search, live search, custom search, ajax, shortcode, better search, relevance search, relevant search, search by sku, search plugin, shop, store, wordpress search, wp ajax search, wp search, wp search plugin, sidebar, ecommerce, merketing, products, category search, instant-search, search highlight, woocommerce advanced search, woocommerce live search, WooCommerce Plugin, woocommerce product search
5
  Requires at least: 4.0
6
  Tested up to: 5.6
7
+ Stable tag: 2.21
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
166
 
167
  == Changelog ==
168
 
169
+ = 2.21 ( 2021-02-15 ) =
170
+ * Add - Plugin search form module for Gutenberg
171
+ * Add - Label element for search form
172
+ * Add - Integration for BoxShop theme
173
+ * Add - Aurum theme integration. Add search form to mobile menu
174
+ * Update - Search form widget. Remove title markup if title value is empty
175
+ * Update - Porto theme integration
176
+
177
  = 2.20 ( 2021-02-02 ) =
178
  * Add - Beaver Builder plugin support
179
  * Update - Integration for Electro theme