Advanced Woo Search - Version 2.01

Version Description

  • Add - Support for Ultimate Member plugin
  • Add - Support for WP all import plugin
  • Add - Allow some html tags for "Nothing found" message
  • Update - Remove Divi builder plugin dynamic text shortcodes from the product content
  • Add - Jupiter theme seamless integration
  • Fix - Bug with not sync product stock status with plugin index table on status change
  • Fix - Quantity ordering for search results page
  • Dev - aws_before_strip_shortcodes filter
  • Dev - aws_search_page_results filter
  • Dev - aws-focus class name when focus on search form
Download this release

Release Info

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

Code changes from version 2.00 to 2.01

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.00
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', '2.00' );
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.01
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', '2.01' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
assets/js/common.js CHANGED
@@ -428,9 +428,13 @@
428
 
429
 
430
  $searchField.on( 'focus', function (e) {
 
431
  methods.onFocus(e);
432
  });
433
 
 
 
 
434
 
435
  $searchForm.on( 'keypress', function(e) {
436
  if ( e.keyCode == 13 && ( ! d.showPage || $searchField.val() === '' ) ) {
428
 
429
 
430
  $searchField.on( 'focus', function (e) {
431
+ $searchForm.addClass('aws-focus');
432
  methods.onFocus(e);
433
  });
434
 
435
+ $searchField.on( 'focusout', function (e) {
436
+ $searchForm.removeClass('aws-focus');
437
+ });
438
 
439
  $searchForm.on( 'keypress', function(e) {
440
  if ( e.keyCode == 13 && ( ! d.showPage || $searchField.val() === '' ) ) {
includes/admin/class-aws-admin-fields.php CHANGED
@@ -89,7 +89,8 @@ if ( ! class_exists( 'AWS_Admin_Fields' ) ) :
89
  <td>
90
  <?php $textarea_cols = isset( $value['cols'] ) ? $value['cols'] : "55"; ?>
91
  <?php $textarea_rows = isset( $value['rows'] ) ? $value['rows'] : "4"; ?>
92
- <textarea id="<?php echo esc_attr( $value['id'] ); ?>" name="<?php echo esc_attr( $value['id'] ); ?>" cols="<?php echo $textarea_cols; ?>" rows="<?php echo $textarea_rows; ?>"><?php print stripslashes( $plugin_options[ $value['id'] ] ); ?></textarea>
 
93
  <br><span class="description"><?php echo wp_kses_post( $value['desc'] ); ?></span>
94
  </td>
95
  </tr>
89
  <td>
90
  <?php $textarea_cols = isset( $value['cols'] ) ? $value['cols'] : "55"; ?>
91
  <?php $textarea_rows = isset( $value['rows'] ) ? $value['rows'] : "4"; ?>
92
+ <?php $textarea_output = isset( $value['allow_tags'] ) ? wp_kses( $plugin_options[ $value['id'] ], AWS_Helpers::get_kses( $value['allow_tags'] ) ) : stripslashes( $plugin_options[ $value['id'] ] ); ?>
93
+ <textarea id="<?php echo esc_attr( $value['id'] ); ?>" name="<?php echo esc_attr( $value['id'] ); ?>" cols="<?php echo $textarea_cols; ?>" rows="<?php echo $textarea_rows; ?>"><?php print $textarea_output; ?></textarea>
94
  <br><span class="description"><?php echo wp_kses_post( $value['desc'] ); ?></span>
95
  </td>
96
  </tr>
includes/admin/class-aws-admin-options.php CHANGED
@@ -30,6 +30,11 @@ if ( ! class_exists( 'AWS_Admin_Options' ) ) :
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'] );
@@ -84,6 +89,11 @@ if ( ! class_exists( 'AWS_Admin_Options' ) ) :
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 );
@@ -272,7 +282,8 @@ if ( ! class_exists( 'AWS_Admin_Options' ) ) :
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(
30
  continue;
31
  }
32
 
33
+ if ( $values['type'] === 'textarea' && isset( $values['allow_tags'] ) ) {
34
+ $default_settings[$values['id']] = (string) addslashes( wp_kses( stripslashes( $values['value'] ), AWS_Helpers::get_kses( $values['allow_tags'] ) ) );
35
+ continue;
36
+ }
37
+
38
  if ( $values['type'] === 'textarea' ) {
39
  if ( function_exists('sanitize_textarea_field') ) {
40
  $default_settings[ $values['id'] ] = (string) sanitize_textarea_field( $values['value'] );
89
 
90
  $new_value = isset( $_POST[ $values['id'] ] ) ? $_POST[ $values['id'] ] : '';
91
 
92
+ if ( $values['type'] === 'textarea' && isset( $values['allow_tags'] ) ) {
93
+ $update_settings[ $values['id'] ] = (string) addslashes( wp_kses( stripslashes( $new_value ), AWS_Helpers::get_kses( $values['allow_tags'] ) ) );
94
+ continue;
95
+ }
96
+
97
  if ( $values['type'] === 'textarea' ) {
98
  if ( function_exists('sanitize_textarea_field') ) {
99
  $update_settings[ $values['id'] ] = (string) sanitize_textarea_field( $new_value );
282
  "desc" => __( "Text when there is no search results.", "advanced-woo-search" ),
283
  "id" => "not_found_text",
284
  "value" => __( "Nothing found", "advanced-woo-search" ),
285
+ "type" => "textarea",
286
+ 'allow_tags' => array( 'a', 'br', 'em', 'strong', 'b', 'code', 'blockquote', 'p', 'i' )
287
  );
288
 
289
  $options['form'][] = array(
includes/class-aws-helpers.php CHANGED
@@ -583,8 +583,17 @@ if ( ! class_exists( 'AWS_Helpers' ) ) :
583
  * Strip shortcodes
584
  */
585
  static public function strip_shortcodes( $str ) {
 
 
 
 
 
 
 
 
586
  $str = preg_replace( '#\[[^\]]+\]#', '', $str );
587
  return $str;
 
588
  }
589
 
590
  /*
@@ -767,6 +776,53 @@ if ( ! class_exists( 'AWS_Helpers' ) ) :
767
 
768
  }
769
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
770
  }
771
 
772
  endif;
583
  * Strip shortcodes
584
  */
585
  static public function strip_shortcodes( $str ) {
586
+
587
+ /**
588
+ * Filter content string before striping shortcodes
589
+ * @since 2.01
590
+ * @param string $str
591
+ */
592
+ $str = apply_filters( 'aws_before_strip_shortcodes', $str );
593
+
594
  $str = preg_replace( '#\[[^\]]+\]#', '', $str );
595
  return $str;
596
+
597
  }
598
 
599
  /*
776
 
777
  }
778
 
779
+ /**
780
+ * Get array of allowed tags for wp_kses function
781
+ * @param array $allowed_tags Tags that is allowed to display
782
+ * @return array $tags
783
+ */
784
+ static public function get_kses( $allowed_tags = array() ) {
785
+
786
+ $tags = array(
787
+ 'a' => array(
788
+ 'href' => array(),
789
+ 'title' => array()
790
+ ),
791
+ 'br' => array(),
792
+ 'em' => array(),
793
+ 'strong' => array(),
794
+ 'b' => array(),
795
+ 'code' => array(),
796
+ 'blockquote' => array(
797
+ 'cite' => array(),
798
+ ),
799
+ 'p' => array(),
800
+ 'i' => array(),
801
+ 'h1' => array(),
802
+ 'h2' => array(),
803
+ 'h3' => array(),
804
+ 'h4' => array(),
805
+ 'h5' => array(),
806
+ 'h6' => array(),
807
+ 'img' => array(
808
+ 'alt' => array(),
809
+ 'src' => array()
810
+ )
811
+ );
812
+
813
+ if ( is_array( $allowed_tags ) && ! empty( $allowed_tags ) ) {
814
+ foreach ( $tags as $tag => $tag_arr ) {
815
+ if ( array_search( $tag, $allowed_tags ) === false ) {
816
+ unset( $tags[$tag] );
817
+ }
818
+ }
819
+
820
+ }
821
+
822
+ return $tags;
823
+
824
+ }
825
+
826
  }
827
 
828
  endif;
includes/class-aws-integrations.php CHANGED
@@ -16,6 +16,11 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
16
 
17
  private $data = array();
18
 
 
 
 
 
 
19
  /**
20
  * @var AWS_Integrations The single instance of the class
21
  */
@@ -41,6 +46,16 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
41
  */
42
  public function __construct() {
43
 
 
 
 
 
 
 
 
 
 
 
44
  //add_action('woocommerce_product_query', array( $this, 'woocommerce_product_query' ) );
45
 
46
  if ( class_exists( 'BM' ) ) {
@@ -104,6 +119,10 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
104
  add_action( 'wp_head', array( $this, 'twenty_twenty_head_action' ) );
105
  }
106
 
 
 
 
 
107
  // Elementor pro
108
  if ( defined( 'ELEMENTOR_PRO_VERSION' ) ) {
109
  add_action( 'wp_footer', array( $this, 'elementor_pro_popup' ) );
@@ -115,7 +134,12 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
115
 
116
  // Wholesale plugin hide certain products
117
  if ( class_exists( 'WooCommerceWholeSalePrices' ) ) {
118
- add_filter( 'aws_search_results_products', array( $this,'wholesale_hide_products' ) );
 
 
 
 
 
119
  }
120
 
121
  // Search Exclude plugin
@@ -134,6 +158,14 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
134
  remove_action('woocommerce_after_main_content','flatsome_pages_in_search_results', 10);
135
  }
136
 
 
 
 
 
 
 
 
 
137
  }
138
 
139
  /*
@@ -545,6 +577,72 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
545
 
546
  <?php }
547
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
548
  /*
549
  * Elementor popup search form init
550
  */
@@ -721,6 +819,11 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
721
  $selectors[] = '#mobile-menu-search form';
722
  }
723
 
 
 
 
 
 
724
  return $selectors;
725
 
726
  }
@@ -813,6 +916,59 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
813
 
814
  }
815
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
816
  /*
817
  * Remove products that was excluded with Search Exclude plugin ( https://wordpress.org/plugins/search-exclude/ )
818
  */
@@ -849,6 +1005,24 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
849
  return 9999;
850
  }
851
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
852
  }
853
 
854
  endif;
16
 
17
  private $data = array();
18
 
19
+ /**
20
+ * @var AWS_Integrations Current theme name
21
+ */
22
+ private $current_theme = '';
23
+
24
  /**
25
  * @var AWS_Integrations The single instance of the class
26
  */
46
  */
47
  public function __construct() {
48
 
49
+ $theme = function_exists( 'wp_get_theme' ) ? wp_get_theme() : false;
50
+
51
+ if ( $theme ) {
52
+ $this->current_theme = $theme->name;
53
+ $this->child_theme = $theme->name;
54
+ if ( $theme->parent() ) {
55
+ $this->current_theme = $theme->parent();
56
+ }
57
+ }
58
+
59
  //add_action('woocommerce_product_query', array( $this, 'woocommerce_product_query' ) );
60
 
61
  if ( class_exists( 'BM' ) ) {
119
  add_action( 'wp_head', array( $this, 'twenty_twenty_head_action' ) );
120
  }
121
 
122
+ if ( 'Jupiter' === $this->current_theme ) {
123
+ add_action( 'wp_head', array( $this, 'jupiter_head_action' ) );
124
+ }
125
+
126
  // Elementor pro
127
  if ( defined( 'ELEMENTOR_PRO_VERSION' ) ) {
128
  add_action( 'wp_footer', array( $this, 'elementor_pro_popup' ) );
134
 
135
  // Wholesale plugin hide certain products
136
  if ( class_exists( 'WooCommerceWholeSalePrices' ) ) {
137
+ add_filter( 'aws_search_results_products', array( $this, 'wholesale_hide_products' ) );
138
+ }
139
+
140
+ // Ultimate Member plugin hide certain products
141
+ if ( class_exists( 'UM_Functions' ) ) {
142
+ add_filter( 'aws_search_results_products', array( $this, 'um_hide_products' ) );
143
  }
144
 
145
  // Search Exclude plugin
158
  remove_action('woocommerce_after_main_content','flatsome_pages_in_search_results', 10);
159
  }
160
 
161
+ // Divi builder dynamic text shortcodes
162
+ if ( defined( 'ET_BUILDER_PLUGIN_DIR' ) ) {
163
+ add_filter( 'aws_before_strip_shortcodes', array( $this, 'divi_builder_strip_shortcodes' ) );
164
+ }
165
+
166
+ // WP all import finish
167
+ add_action( 'pmxi_after_xml_import', array( $this, 'pmxi_after_xml_import' ) );
168
+
169
  }
170
 
171
  /*
577
 
578
  <?php }
579
 
580
+ /*
581
+ * Jupiter theme
582
+ */
583
+ public function jupiter_head_action() { ?>
584
+
585
+ <style>
586
+
587
+ .mk-fullscreen-search-overlay .aws-container .aws-search-form {
588
+ height: 60px;
589
+ }
590
+
591
+ .mk-fullscreen-search-overlay .aws-container .aws-search-field {
592
+ width: 800px;
593
+ background-color: transparent;
594
+ box-shadow: 0 3px 0 0 rgba(255,255,255,.1);
595
+ border: none;
596
+ font-size: 35px;
597
+ color: #fff;
598
+ padding-bottom: 20px;
599
+ text-align: center;
600
+ }
601
+
602
+ .mk-fullscreen-search-overlay .aws-container .aws-search-form .aws-form-btn {
603
+ background-color: transparent;
604
+ border: none;
605
+ box-shadow: 0 3px 0 0 rgba(255,255,255,.1);
606
+ }
607
+
608
+ .mk-fullscreen-search-overlay .aws-container .aws-search-form .aws-search-btn_icon {
609
+ height: 30px;
610
+ line-height: 30px;
611
+ }
612
+
613
+ .mk-header .aws-container {
614
+ margin: 10px;
615
+ }
616
+
617
+ .mk-header .mk-responsive-wrap {
618
+ padding-bottom: 1px;
619
+ }
620
+
621
+ </style>
622
+
623
+ <script>
624
+
625
+ window.addEventListener('load', function() {
626
+
627
+ var iconSearch = document.querySelectorAll(".mk-fullscreen-trigger");
628
+ if ( iconSearch ) {
629
+ for (var i = 0; i < iconSearch.length; i++) {
630
+ iconSearch[i].addEventListener('click', function() {
631
+ window.setTimeout(function(){
632
+ document.querySelector(".mk-fullscreen-search-overlay .aws-container .aws-search-field").focus();
633
+ jQuery( '.aws-search-result' ).hide();
634
+ }, 100);
635
+ }, false);
636
+ }
637
+ }
638
+
639
+
640
+ }, false);
641
+
642
+ </script>
643
+
644
+ <?php }
645
+
646
  /*
647
  * Elementor popup search form init
648
  */
819
  $selectors[] = '#mobile-menu-search form';
820
  }
821
 
822
+ if ( 'Jupiter' === $this->current_theme ) {
823
+ $selectors[] = '#mk-fullscreen-searchform';
824
+ $selectors[] = '.responsive-searchform';
825
+ }
826
+
827
  return $selectors;
828
 
829
  }
916
 
917
  }
918
 
919
+ /*
920
+ * Ultimate Member hide products
921
+ */
922
+ public function um_hide_products( $products ) {
923
+
924
+ foreach( $products as $key => $product ) {
925
+
926
+ $um_content_restriction = get_post_meta( $product['id'], 'um_content_restriction', true );
927
+
928
+ if ( $um_content_restriction && is_array( $um_content_restriction ) && ! empty( $um_content_restriction ) ) {
929
+
930
+ $um_custom_access_settings = isset( $um_content_restriction['_um_custom_access_settings'] ) ? $um_content_restriction['_um_custom_access_settings'] : false;
931
+ $um_access_hide_from_queries = isset( $um_content_restriction['_um_access_hide_from_queries'] ) ? $um_content_restriction['_um_access_hide_from_queries'] : false;
932
+
933
+ if ( $um_custom_access_settings && $um_custom_access_settings === '1' && $um_access_hide_from_queries && $um_access_hide_from_queries === '1' ) {
934
+
935
+ $um_accessible = isset( $um_content_restriction['_um_accessible'] ) ? $um_content_restriction['_um_accessible'] : false;
936
+
937
+ if ( $um_accessible ) {
938
+
939
+ if ( $um_accessible === '1' && is_user_logged_in() ) {
940
+ unset( $products[$key] );
941
+ }
942
+ elseif ( $um_accessible === '2' && ! is_user_logged_in() ) {
943
+ unset( $products[$key] );
944
+ }
945
+ elseif ( $um_accessible === '2' && is_user_logged_in() ) {
946
+
947
+ $um_access_roles = isset( $um_content_restriction['_um_access_roles'] ) ? $um_content_restriction['_um_access_roles'] : false;
948
+
949
+ if ( $um_access_roles && is_array( $um_access_roles ) && ! empty( $um_access_roles ) ) {
950
+ $user = wp_get_current_user();
951
+ $role = ( array ) $user->roles;
952
+ $user_role = $role[0];
953
+ if ( $user_role && $user_role !== 'administrator' && ! isset( $um_access_roles[$user_role] ) ) {
954
+ unset( $products[$key] );
955
+ }
956
+ }
957
+
958
+ }
959
+
960
+ }
961
+
962
+ }
963
+
964
+ }
965
+
966
+ }
967
+
968
+ return $products;
969
+
970
+ }
971
+
972
  /*
973
  * Remove products that was excluded with Search Exclude plugin ( https://wordpress.org/plugins/search-exclude/ )
974
  */
1005
  return 9999;
1006
  }
1007
 
1008
+ /*
1009
+ * Divi builder remove dynamic text shortcodes
1010
+ */
1011
+ public function divi_builder_strip_shortcodes( $str ) {
1012
+ $str = preg_replace( '#\[et_pb_text.[^\]]*?_dynamic_attributes.*?\]@ET-.*?\[\/et_pb_text\]#', '', $str );
1013
+ return $str;
1014
+ }
1015
+
1016
+ /*
1017
+ * WP all import cron job
1018
+ */
1019
+ public function pmxi_after_xml_import() {
1020
+ $sunc = AWS()->get_settings( 'autoupdates' );
1021
+ if ( $sunc === 'true' ) {
1022
+ wp_schedule_single_event( time() + 1, 'aws_reindex_table' );
1023
+ }
1024
+ }
1025
+
1026
  }
1027
 
1028
  endif;
includes/class-aws-order.php CHANGED
@@ -471,10 +471,6 @@ if ( ! class_exists( 'AWS_Order' ) ) :
471
  $a_val = AWS_Helpers::get_quantity( $product_a );
472
  $b_val = AWS_Helpers::get_quantity( $product_b );
473
 
474
- if ( ! is_numeric( $a_val['f_price'] ) || ! is_numeric( $b_val['f_price'] ) ) {
475
- return 0;
476
- }
477
-
478
  if ($a_val == $b_val) {
479
  return 0;
480
  }
@@ -498,10 +494,6 @@ if ( ! class_exists( 'AWS_Order' ) ) :
498
  $a_val = AWS_Helpers::get_quantity( $product_a );
499
  $b_val = AWS_Helpers::get_quantity( $product_b );
500
 
501
- if ( ! is_numeric( $a_val['f_price'] ) || ! is_numeric( $b_val['f_price'] ) ) {
502
- return 0;
503
- }
504
-
505
  if ($a_val == $b_val) {
506
  return 0;
507
  }
471
  $a_val = AWS_Helpers::get_quantity( $product_a );
472
  $b_val = AWS_Helpers::get_quantity( $product_b );
473
 
 
 
 
 
474
  if ($a_val == $b_val) {
475
  return 0;
476
  }
494
  $a_val = AWS_Helpers::get_quantity( $product_a );
495
  $b_val = AWS_Helpers::get_quantity( $product_b );
496
 
 
 
 
 
497
  if ($a_val == $b_val) {
498
  return 0;
499
  }
includes/class-aws-search-page.php CHANGED
@@ -151,10 +151,17 @@ if ( ! class_exists( 'AWS_Search_Page' ) ) :
151
  }
152
  }
153
 
 
 
 
 
 
 
 
 
154
 
155
  $this->posts_by_query[spl_object_hash( $query )] = $new_posts;
156
 
157
-
158
  global $wpdb;
159
 
160
  return "SELECT * FROM $wpdb->posts WHERE 1=0";
151
  }
152
  }
153
 
154
+ /**
155
+ * Filter search page results
156
+ * @since 2.01
157
+ * @param array $new_posts Posts array
158
+ * @param object $query Query
159
+ * @param array $this->data Search results data array
160
+ */
161
+ $new_posts = apply_filters( 'aws_search_page_results', $new_posts, $query, $this->data );
162
 
163
  $this->posts_by_query[spl_object_hash( $query )] = $new_posts;
164
 
 
165
  global $wpdb;
166
 
167
  return "SELECT * FROM $wpdb->posts WHERE 1=0";
includes/class-aws-table.php CHANGED
@@ -46,6 +46,8 @@ if ( ! class_exists( 'AWS_Table' ) ) :
46
  }
47
  }
48
 
 
 
49
  add_action( 'updated_postmeta', array( $this, 'updated_custom_tabs' ), 10, 4 );
50
 
51
  add_action( 'wp_ajax_aws-reindex', array( $this, 'reindex_table_ajax' ) );
@@ -762,6 +764,24 @@ if ( ! class_exists( 'AWS_Table' ) ) :
762
 
763
  }
764
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
765
  /*
766
  * Custom Tabs was updated
767
  */
46
  }
47
  }
48
 
49
+ add_action( 'woocommerce_product_set_stock_status', array( $this, 'stock_status_changes' ), 10, 3 );
50
+
51
  add_action( 'updated_postmeta', array( $this, 'updated_custom_tabs' ), 10, 4 );
52
 
53
  add_action( 'wp_ajax_aws-reindex', array( $this, 'reindex_table_ajax' ) );
764
 
765
  }
766
 
767
+ /*
768
+ * Product stock status changed
769
+ */
770
+ public function stock_status_changes( $product_id, $stock_status, $product ) {
771
+ global $wp_current_filter, $wpdb;
772
+ if ( ! in_array( 'save_post', $wp_current_filter ) || in_array( 'woocommerce_process_shop_order_meta', $wp_current_filter ) ) {
773
+ $sync = AWS()->get_settings( 'autoupdates' );
774
+ if ( AWS_Helpers::is_table_not_exist() ) {
775
+ $this->create_table();
776
+ }
777
+ if ( $sync !== 'false' ) {
778
+ $in_stock = $stock_status === 'instock' ? 1 : 0;
779
+ $wpdb->update( $this->table_name, array( 'in_stock' => $in_stock ), array( 'id' => $product_id ) );
780
+ do_action('aws_cache_clear');
781
+ }
782
+ }
783
+ }
784
+
785
  /*
786
  * Custom Tabs was updated
787
  */
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.4
7
- Stable tag: 2.00
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -104,6 +104,18 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
104
 
105
  == Changelog ==
106
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  = 2.00 =
108
  * Update - Search page ordering. Add order by quantity
109
  * Update - Remove sql query from output
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.4
7
+ Stable tag: 2.01
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
104
 
105
  == Changelog ==
106
 
107
+ = 2.01 =
108
+ * Add - Support for Ultimate Member plugin
109
+ * Add - Support for WP all import plugin
110
+ * Add - Allow some html tags for "Nothing found" message
111
+ * Update - Remove Divi builder plugin dynamic text shortcodes from the product content
112
+ * Add - Jupiter theme seamless integration
113
+ * Fix - Bug with not sync product stock status with plugin index table on status change
114
+ * Fix - Quantity ordering for search results page
115
+ * Dev - aws_before_strip_shortcodes filter
116
+ * Dev - aws_search_page_results filter
117
+ * Dev - aws-focus class name when focus on search form
118
+
119
  = 2.00 =
120
  * Update - Search page ordering. Add order by quantity
121
  * Update - Remove sql query from output