Advanced Woo Search - Version 2.17

Version Description

( 2020-12-14 ) = * Dev - Specify global $product variable for search results items * Dev - Add aws_show_mobile_layout js filter

Download this release

Release Info

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

Code changes from version 2.16 to 2.17

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: 2.16
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: advanced-woo-search
@@ -96,7 +96,7 @@ final class AWS_Main {
96
  */
97
  private function define_constants() {
98
 
99
- $this->define( 'AWS_VERSION', '2.16' );
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.17
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: advanced-woo-search
96
  */
97
  private function define_constants() {
98
 
99
+ $this->define( 'AWS_VERSION', '2.17' );
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
@@ -91,6 +91,11 @@
91
  margin-right: -40px;
92
  }
93
 
 
 
 
 
 
94
  /* Image select option */
95
  #aws_form .img-select {
96
  position: relative;
91
  margin-right: -40px;
92
  }
93
 
94
+ #aws_form select {
95
+ min-width: 170px;
96
+ display: block;
97
+ }
98
+
99
  /* Image select option */
100
  #aws_form .img-select {
101
  position: relative;
assets/js/common.js CHANGED
@@ -387,12 +387,16 @@ AwsHooks.filters = AwsHooks.filters || {};
387
  },
388
 
389
  showMobileLayout: function() {
390
- if ( ! methods.isFixed() ) {
 
 
 
391
  self.after('<div class="aws-placement-container"></div>');
392
  self.addClass('aws-mobile-fixed').prepend('<div class="aws-mobile-fixed-close"><svg width="17" height="17" viewBox="1.5 1.5 21 21"><path d="M22.182 3.856c.522-.554.306-1.394-.234-1.938-.54-.543-1.433-.523-1.826-.135C19.73 2.17 11.955 10 11.955 10S4.225 2.154 3.79 1.783c-.438-.371-1.277-.4-1.81.135-.533.537-.628 1.513-.25 1.938.377.424 8.166 8.218 8.166 8.218s-7.85 7.864-8.166 8.219c-.317.354-.34 1.335.25 1.805.59.47 1.24.455 1.81 0 .568-.456 8.166-7.951 8.166-7.951l8.167 7.86c.747.72 1.504.563 1.96.09.456-.471.609-1.268.1-1.804-.508-.537-8.167-8.219-8.167-8.219s7.645-7.665 8.167-8.218z"></path></svg></div>');
393
  $('body').addClass('aws-overlay').append('<div class="aws-overlay-mask"></div>').append( self );
394
  $searchField.focus();
395
  }
 
396
  },
397
 
398
  hideMobileLayout: function() {
@@ -575,6 +579,15 @@ AwsHooks.filters = AwsHooks.filters || {};
575
  $searchForm.submit();
576
  });
577
 
 
 
 
 
 
 
 
 
 
578
  $( self ).on( 'click', '.aws-mobile-fixed-close', function(e) {
579
  methods.hideMobileLayout();
580
  });
387
  },
388
 
389
  showMobileLayout: function() {
390
+
391
+ var show = AwsHooks.apply_filters( 'aws_show_mobile_layout', false, { instance: instance, form: self, data: d } );
392
+
393
+ if ( ! methods.isFixed() || show ) {
394
  self.after('<div class="aws-placement-container"></div>');
395
  self.addClass('aws-mobile-fixed').prepend('<div class="aws-mobile-fixed-close"><svg width="17" height="17" viewBox="1.5 1.5 21 21"><path d="M22.182 3.856c.522-.554.306-1.394-.234-1.938-.54-.543-1.433-.523-1.826-.135C19.73 2.17 11.955 10 11.955 10S4.225 2.154 3.79 1.783c-.438-.371-1.277-.4-1.81.135-.533.537-.628 1.513-.25 1.938.377.424 8.166 8.218 8.166 8.218s-7.85 7.864-8.166 8.219c-.317.354-.34 1.335.25 1.805.59.47 1.24.455 1.81 0 .568-.456 8.166-7.951 8.166-7.951l8.167 7.86c.747.72 1.504.563 1.96.09.456-.471.609-1.268.1-1.804-.508-.537-8.167-8.219-8.167-8.219s7.645-7.665 8.167-8.218z"></path></svg></div>');
396
  $('body').addClass('aws-overlay').append('<div class="aws-overlay-mask"></div>').append( self );
397
  $searchField.focus();
398
  }
399
+
400
  },
401
 
402
  hideMobileLayout: function() {
579
  $searchForm.submit();
580
  });
581
 
582
+ $( d.resultBlock ).on( 'click', 'span[href], [data-link]', function(e) {
583
+ e.preventDefault();
584
+ e.stopPropagation();
585
+ var link = $(this).data('link') ? $(this).data('link') : $(this).attr('href');
586
+ if ( link ) {
587
+ window.location = link;
588
+ }
589
+ });
590
+
591
  $( self ).on( 'click', '.aws-mobile-fixed-close', function(e) {
592
  methods.hideMobileLayout();
593
  });
includes/admin/class-aws-admin-fields.php CHANGED
@@ -114,7 +114,8 @@ if ( ! class_exists( 'AWS_Admin_Fields' ) ) :
114
  <th scope="row"><?php echo esc_html( $value['name'] ); ?></th>
115
  <td>
116
  <?php foreach ( $value['choices'] as $val => $label ) { ?>
117
- <input class="radio" type="radio" name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'].$val ); ?>" value="<?php echo esc_attr( $val ); ?>" <?php checked( $plugin_options[ $value['id'] ], $val ); ?>> <label for="<?php echo esc_attr( $value['id'].$val ); ?>"><?php echo esc_html( $label ); ?></label><br>
 
118
  <?php } ?>
119
  <br><span class="description"><?php echo wp_kses_post( $value['desc'] ); ?></span>
120
  </td>
@@ -127,7 +128,8 @@ if ( ! class_exists( 'AWS_Admin_Fields' ) ) :
127
  <td>
128
  <select name="<?php echo esc_attr( $value['id'] ); ?>">
129
  <?php foreach ( $value['choices'] as $val => $label ) { ?>
130
- <option value="<?php echo esc_attr( $val ); ?>" <?php selected( $plugin_options[ $value['id'] ], $val ); ?>><?php echo esc_html( $label ); ?></option>
 
131
  <?php } ?>
132
  </select>
133
  <br><span class="description"><?php echo wp_kses_post( $value['desc'] ); ?></span>
114
  <th scope="row"><?php echo esc_html( $value['name'] ); ?></th>
115
  <td>
116
  <?php foreach ( $value['choices'] as $val => $label ) { ?>
117
+ <?php $option_val = isset( $plugin_options[ $value['id'] ] ) ? $plugin_options[ $value['id'] ] : ''; ?>
118
+ <input class="radio" type="radio" name="<?php echo esc_attr( $value['id'] ); ?>" id="<?php echo esc_attr( $value['id'].$val ); ?>" value="<?php echo esc_attr( $val ); ?>" <?php checked( $option_val, $val ); ?>> <label for="<?php echo esc_attr( $value['id'].$val ); ?>"><?php echo esc_html( $label ); ?></label><br>
119
  <?php } ?>
120
  <br><span class="description"><?php echo wp_kses_post( $value['desc'] ); ?></span>
121
  </td>
128
  <td>
129
  <select name="<?php echo esc_attr( $value['id'] ); ?>">
130
  <?php foreach ( $value['choices'] as $val => $label ) { ?>
131
+ <?php $option_val = isset( $plugin_options[ $value['id'] ] ) ? $plugin_options[ $value['id'] ] : ''; ?>
132
+ <option value="<?php echo esc_attr( $val ); ?>" <?php selected( $option_val, $val ); ?>><?php echo esc_html( $label ); ?></option>
133
  <?php } ?>
134
  </select>
135
  <br><span class="description"><?php echo wp_kses_post( $value['desc'] ); ?></span>
includes/class-aws-search.php CHANGED
@@ -517,6 +517,8 @@ if ( ! class_exists( 'AWS_Search' ) ) :
517
  continue;
518
  }
519
 
 
 
520
  $post_id = method_exists( $product, 'get_id' ) ? $product->get_id() : $post_item;
521
  $parent_id = $product->is_type( 'variation' ) && method_exists( $product, 'get_parent_id' ) ? $product->get_parent_id() : $post_id;
522
 
@@ -666,6 +668,9 @@ if ( ! class_exists( 'AWS_Search' ) ) :
666
  );
667
 
668
  $products_array[] = $new_result;
 
 
 
669
  }
670
 
671
  }
517
  continue;
518
  }
519
 
520
+ setup_postdata( $post_item );
521
+
522
  $post_id = method_exists( $product, 'get_id' ) ? $product->get_id() : $post_item;
523
  $parent_id = $product->is_type( 'variation' ) && method_exists( $product, 'get_parent_id' ) ? $product->get_parent_id() : $post_id;
524
 
668
  );
669
 
670
  $products_array[] = $new_result;
671
+
672
+ wp_reset_postdata();
673
+
674
  }
675
 
676
  }
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.16
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -112,6 +112,10 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
112
 
113
  == Changelog ==
114
 
 
 
 
 
115
  = 2.16 ( 2020-11-30 ) =
116
  * Add - Welcome message
117
  * Add - Support for Elessi 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.17
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
112
 
113
  == Changelog ==
114
 
115
+ = 2.17 ( 2020-12-14 ) =
116
+ * Dev - Specify global $product variable for search results items
117
+ * Dev - Add aws_show_mobile_layout js filter
118
+
119
  = 2.16 ( 2020-11-30 ) =
120
  * Add - Welcome message
121
  * Add - Support for Elessi Theme