YITH WooCommerce Ajax Product Filter - Version 3.8.3

Version Description

  • Released on 11 December 2019 =

  • Fix: Filter not working on product tag page

  • Update: plugin framework

Download this release

Release Info

Developer yithemes
Plugin Icon 128x128 YITH WooCommerce Ajax Product Filter
Version 3.8.3
Comparing to
See all releases

Code changes from version 3.8.2 to 3.8.3

README.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: yithemes
4
  Tags: woocommerce ajax product filter download, woocommerce, widget, ajax, ajax filtered nav, ajax navigation, ajax filtered navigation, woocommerce layered navigation, woocommerce layered nav, product filter, product filters, ajax product filter, woocommerce ajax product filter, woocommerce filters, sidebar filter, sidebar ajax filter, ajax price filter, price filter, product sorting, woocommerce filter, taxonomy filter, attribute filter, attributes filter, woocommerce product sort, ajax sort, woocommerce ajax product filter, advanced product filters, ajax product filters, filters, woocommerce ajax product filters, woocommerce product filters, woocommerce product filters, category filter, attribute filters, woocommerce products filter, woocommerce price filter, yit, yith, yithemes
5
  Requires at least: 4.0
6
  Tested up to: 5.3
7
- Stable tag: 3.8.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -159,10 +159,14 @@ If you want to see a demonstration version of the premium plugin, you can see it
159
 
160
  == Changelog ==
161
 
162
- = 3.8.1 - Released on 28 November 2019 =
 
 
 
 
 
163
 
164
  * Update: plugin framework
165
- * Update: Notice handler
166
 
167
  = 3.8.1 - Released on 04 November 2019 =
168
 
4
  Tags: woocommerce ajax product filter download, woocommerce, widget, ajax, ajax filtered nav, ajax navigation, ajax filtered navigation, woocommerce layered navigation, woocommerce layered nav, product filter, product filters, ajax product filter, woocommerce ajax product filter, woocommerce filters, sidebar filter, sidebar ajax filter, ajax price filter, price filter, product sorting, woocommerce filter, taxonomy filter, attribute filter, attributes filter, woocommerce product sort, ajax sort, woocommerce ajax product filter, advanced product filters, ajax product filters, filters, woocommerce ajax product filters, woocommerce product filters, woocommerce product filters, category filter, attribute filters, woocommerce products filter, woocommerce price filter, yit, yith, yithemes
5
  Requires at least: 4.0
6
  Tested up to: 5.3
7
+ Stable tag: 3.8.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
159
 
160
  == Changelog ==
161
 
162
+ = 3.8.3 - Released on 11 December 2019 =
163
+
164
+ * Fix: Filter not working on product tag page
165
+ * Update: plugin framework
166
+
167
+ = 3.8.2 - Released on 28 November 2019 =
168
 
169
  * Update: plugin framework
 
170
 
171
  = 3.8.1 - Released on 04 November 2019 =
172
 
includes/class.yith-wcan-admin.php CHANGED
@@ -230,7 +230,7 @@ if ( ! class_exists( 'YITH_WCAN_Admin' ) ) {
230
  * @return string The premium landing link
231
  */
232
  public function get_premium_landing_uri() {
233
- return defined( 'YITH_REFER_ID' ) ? $this->_premium_landing . '?refer_id=' . YITH_REFER_ID : $this->_premium_landing . '?refer_id=1030585';
234
  }
235
 
236
  /**
230
  * @return string The premium landing link
231
  */
232
  public function get_premium_landing_uri() {
233
+ return $this->_premium_landing;
234
  }
235
 
236
  /**
includes/class.yith-wcan-frontend.php CHANGED
@@ -120,101 +120,103 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
120
 
121
  else{
122
 
123
- $filtered_posts = array();
124
- $queried_post_ids = array();
125
-
126
- $problematic_theme = array(
127
- 'basel',
128
- 'ux-shop',
129
- 'aardvark'
130
- );
131
-
132
- $wp_theme = wp_get_theme();
133
- $template_name = $wp_theme->get_template();
134
-
135
- /**
136
- * Support for Flatsome Theme lower then 3.6.0
137
- */
138
- if( 'flatsome' == $template_name && version_compare( '3.6.0', $wp_theme->Version, '<' ) ){
139
- $problematic_theme[] = 'flatsome';
140
- }
141
-
142
- $is_qTranslateX_and_yit_core_1_0_0 = class_exists( 'QTX_Translator' ) && defined('YIT_CORE_VERSION') && '1.0.0' == YIT_CORE_VERSION;
143
- $is_problematic_theme = in_array( $template_name, $problematic_theme );
144
-
145
- if( $is_qTranslateX_and_yit_core_1_0_0 || $is_problematic_theme || class_exists( 'SiteOrigin_Panels' ) ){
146
- add_filter( 'yith_wcan_skip_layered_nav_query', '__return_true' );
147
- }
148
-
149
- $query_filtered_posts = $this->layered_nav_query();
150
-
151
- foreach ( $posts as $post ) {
152
-
153
- if ( in_array( $post->ID, $query_filtered_posts ) ) {
154
- $filtered_posts[] = $post;
155
- $queried_post_ids[] = $post->ID;
156
- }
157
- }
158
-
159
- $query->posts = $filtered_posts;
160
- $query->post_count = count( $filtered_posts );
161
-
162
- // Get main query
163
- $current_wp_query = $this->select_query_object( $query );
164
-
165
- if( is_array( $current_wp_query ) ){
166
- // Get WP Query for current page (without 'paged')
167
- unset( $current_wp_query['paged'] );
168
- }
169
-
170
- else {
171
- $current_wp_query = array();
172
- }
173
-
174
- // Ensure filters are set
175
- $unfiltered_args = array_merge(
176
- $current_wp_query,
177
- array(
178
- 'post_type' => 'product',
179
- 'numberposts' => - 1,
180
- 'post_status' => 'publish',
181
- 'meta_query' => is_object( $current_wp_query ) ? $current_wp_query->meta_query : array(),
182
- 'fields' => 'ids',
183
- 'no_found_rows' => true,
184
- 'update_post_meta_cache' => false,
185
- 'update_post_term_cache' => false,
186
- 'pagename' => '',
187
- 'wc_query' => 'get_products_in_view', //Only for WC <= 2.6.x
188
- 'suppress_filters' => true,
189
- )
190
- );
191
-
192
- $hide_out_of_stock_items = apply_filters( 'yith_wcan_hide_out_of_stock_items', 'yes' == get_option( 'woocommerce_hide_out_of_stock_items' ) ? true : false );
193
-
194
- if( $hide_out_of_stock_items ){
195
- $unfiltered_args['meta_query'][] = array(
196
- 'key' => '_stock_status',
197
- 'value' => 'instock',
198
- 'compare' => 'AND'
199
- );
200
- }
201
-
202
- $unfiltered_args = apply_filters( 'yith_wcan_unfiltered_args', $unfiltered_args );
203
- $this->unfiltered_product_ids = apply_filters( 'yith_wcan_unfiltered_product_ids', get_posts( $unfiltered_args ), $query, $current_wp_query );
204
- $this->filtered_product_ids = $queried_post_ids;
205
-
206
- // Also store filtered posts ids...
207
- if ( sizeof( $queried_post_ids ) > 0 ) {
208
- $this->filtered_product_ids = array_intersect( $this->unfiltered_product_ids, $queried_post_ids );
209
- } else {
210
- $this->filtered_product_ids = $this->unfiltered_product_ids;
211
- }
212
-
213
- if ( sizeof( $this->layered_nav_post__in ) > 0 ) {
214
- $this->layered_nav_product_ids = array_intersect( $this->unfiltered_product_ids, $this->layered_nav_post__in );
215
- } else {
216
- $this->layered_nav_product_ids = $this->unfiltered_product_ids;
217
- }
 
 
218
  }
219
  return $posts;
220
  }
120
 
121
  else{
122
 
123
+ if( is_shop() || is_product_taxonomy() || ! apply_filters( 'yith_wcan_is_search', is_search() ) ){
124
+ $filtered_posts = array();
125
+ $queried_post_ids = array();
126
+
127
+ $problematic_theme = array(
128
+ 'basel',
129
+ 'ux-shop',
130
+ 'aardvark'
131
+ );
132
+
133
+ $wp_theme = wp_get_theme();
134
+ $template_name = $wp_theme->get_template();
135
+
136
+ /**
137
+ * Support for Flatsome Theme lower then 3.6.0
138
+ */
139
+ if( 'flatsome' == $template_name && version_compare( '3.6.0', $wp_theme->Version, '<' ) ){
140
+ $problematic_theme[] = 'flatsome';
141
+ }
142
+
143
+ $is_qTranslateX_and_yit_core_1_0_0 = class_exists( 'QTX_Translator' ) && defined('YIT_CORE_VERSION') && '1.0.0' == YIT_CORE_VERSION;
144
+ $is_problematic_theme = in_array( $template_name, $problematic_theme );
145
+
146
+ if( $is_qTranslateX_and_yit_core_1_0_0 || $is_problematic_theme || class_exists( 'SiteOrigin_Panels' ) ){
147
+ add_filter( 'yith_wcan_skip_layered_nav_query', '__return_true' );
148
+ }
149
+
150
+ $query_filtered_posts = $this->layered_nav_query();
151
+
152
+ foreach ( $posts as $post ) {
153
+
154
+ if ( in_array( $post->ID, $query_filtered_posts ) ) {
155
+ $filtered_posts[] = $post;
156
+ $queried_post_ids[] = $post->ID;
157
+ }
158
+ }
159
+
160
+ $query->posts = $filtered_posts;
161
+ $query->post_count = count( $filtered_posts );
162
+
163
+ // Get main query
164
+ $current_wp_query = $this->select_query_object( $query );
165
+
166
+ if( is_array( $current_wp_query ) ){
167
+ // Get WP Query for current page (without 'paged')
168
+ unset( $current_wp_query['paged'] );
169
+ }
170
+
171
+ else {
172
+ $current_wp_query = array();
173
+ }
174
+
175
+ // Ensure filters are set
176
+ $unfiltered_args = array_merge(
177
+ $current_wp_query,
178
+ array(
179
+ 'post_type' => 'product',
180
+ 'numberposts' => - 1,
181
+ 'post_status' => 'publish',
182
+ 'meta_query' => is_object( $current_wp_query ) ? $current_wp_query->meta_query : array(),
183
+ 'fields' => 'ids',
184
+ 'no_found_rows' => true,
185
+ 'update_post_meta_cache' => false,
186
+ 'update_post_term_cache' => false,
187
+ 'pagename' => '',
188
+ 'wc_query' => 'get_products_in_view', //Only for WC <= 2.6.x
189
+ 'suppress_filters' => true,
190
+ )
191
+ );
192
+
193
+ $hide_out_of_stock_items = apply_filters( 'yith_wcan_hide_out_of_stock_items', 'yes' == get_option( 'woocommerce_hide_out_of_stock_items' ) ? true : false );
194
+
195
+ if( $hide_out_of_stock_items ){
196
+ $unfiltered_args['meta_query'][] = array(
197
+ 'key' => '_stock_status',
198
+ 'value' => 'instock',
199
+ 'compare' => 'AND'
200
+ );
201
+ }
202
+
203
+ $unfiltered_args = apply_filters( 'yith_wcan_unfiltered_args', $unfiltered_args );
204
+ $this->unfiltered_product_ids = apply_filters( 'yith_wcan_unfiltered_product_ids', get_posts( $unfiltered_args ), $query, $current_wp_query );
205
+ $this->filtered_product_ids = $queried_post_ids;
206
+
207
+ // Also store filtered posts ids...
208
+ if ( sizeof( $queried_post_ids ) > 0 ) {
209
+ $this->filtered_product_ids = array_intersect( $this->unfiltered_product_ids, $queried_post_ids );
210
+ } else {
211
+ $this->filtered_product_ids = $this->unfiltered_product_ids;
212
+ }
213
+
214
+ if ( sizeof( $this->layered_nav_post__in ) > 0 ) {
215
+ $this->layered_nav_product_ids = array_intersect( $this->unfiltered_product_ids, $this->layered_nav_post__in );
216
+ } else {
217
+ $this->layered_nav_product_ids = $this->unfiltered_product_ids;
218
+ }
219
+ }
220
  }
221
  return $posts;
222
  }
includes/functions.yith-wcan.php CHANGED
@@ -493,6 +493,10 @@ if ( ! function_exists( 'yit_get_filter_args' ) ) {
493
  $filter_value['product_tag'] = urlencode( $_GET['product_tag'] );
494
  }
495
 
 
 
 
 
496
  if (isset($_GET['product_cat'])) {
497
  $filter_value['product_cat'] = urlencode( $_GET['product_cat'] );
498
  }
493
  $filter_value['product_tag'] = urlencode( $_GET['product_tag'] );
494
  }
495
 
496
+ elseif( is_product_tag() && $queried_object ){
497
+ $filter_value['product_tag'] = $queried_object->slug;
498
+ }
499
+
500
  if (isset($_GET['product_cat'])) {
501
  $filter_value['product_cat'] = urlencode( $_GET['product_cat'] );
502
  }
init.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: YITH WooCommerce Ajax Product Filter
4
  * Plugin URI: https://wordpress.org/plugins/yith-woocommerce-ajax-navigation/
5
  * Description:<code><strong>YITH WooCommerce AJAX Product Filter</strong></code> allows your users to find the product they are looking for as quickly as possible. Thanks to the plugin you will be able to set up one or more search filters for your WooCommerce products, improve the user experience and give the impression of being in a big and reliable store. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>
6
- * Version: 3.8.2
7
  * Author: YITH
8
  * Author URI: https://yithemes.com/
9
  * Text Domain: yith-woocommerce-ajax-navigation
@@ -67,7 +67,7 @@ load_plugin_textdomain( 'yith-woocommerce-ajax-navigation', false, dirname( plug
67
  ! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
68
  ! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
69
  ! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
70
- ! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '3.8.2' );
71
  ! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
72
  ! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
73
 
3
  * Plugin Name: YITH WooCommerce Ajax Product Filter
4
  * Plugin URI: https://wordpress.org/plugins/yith-woocommerce-ajax-navigation/
5
  * Description:<code><strong>YITH WooCommerce AJAX Product Filter</strong></code> allows your users to find the product they are looking for as quickly as possible. Thanks to the plugin you will be able to set up one or more search filters for your WooCommerce products, improve the user experience and give the impression of being in a big and reliable store. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>
6
+ * Version: 3.8.3
7
  * Author: YITH
8
  * Author URI: https://yithemes.com/
9
  * Text Domain: yith-woocommerce-ajax-navigation
67
  ! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
68
  ! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
69
  ! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
70
+ ! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '3.8.3' );
71
  ! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
72
  ! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
73
 
plugin-fw/init.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
- * Version: 3.4.3
5
  * Author: YITHEMES
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author Your Inspiration Themes
10
- * @version 3.4.0
11
  */
12
  /**
13
  * This file belongs to the YIT Plugin Framework.
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
+ * Version: 3.4.5
5
  * Author: YITHEMES
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author Your Inspiration Themes
10
+ * @version 3.4.5
11
  */
12
  /**
13
  * This file belongs to the YIT Plugin Framework.
plugin-fw/languages/yith-plugin-fw-es_ES.mo CHANGED
Binary file
plugin-fw/languages/yith-plugin-fw-es_ES.po CHANGED
@@ -5,14 +5,14 @@ msgstr ""
5
  "Project-Id-Version: YITH Plugin Starter 1.0.0 Plugin FW\n"
6
  "Report-Msgid-Bugs-To: Your Inspiration Themes <plugins@yithemes.com>\n"
7
  "POT-Creation-Date: 2019-02-04 16:04+0100\n"
8
- "PO-Revision-Date: 2019-02-04 16:05+0100\n"
9
  "Last-Translator: \n"
10
  "Language-Team: Your Inspiration Themes <info@yithemes.com>\n"
11
  "Language: es_ES\n"
12
  "MIME-Version: 1.0\n"
13
  "Content-Type: text/plain; charset=UTF-8\n"
14
  "Content-Transfer-Encoding: 8bit\n"
15
- "X-Generator: Poedit 2.2.1\n"
16
  "X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
17
  "_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
18
  "esc_html_x:1,2c\n"
@@ -921,7 +921,7 @@ msgstr "Barra lateral derecha"
921
  #: templates/fields/upload.php:18 templates/metaboxes/types/icon-list.php:70
922
  #: templates/panel/woocommerce/woocommerce-upload.php:40
923
  msgid "Upload"
924
- msgstr "Actualiza"
925
 
926
  #: templates/fields/upload.php:19
927
  msgid "Reset"
5
  "Project-Id-Version: YITH Plugin Starter 1.0.0 Plugin FW\n"
6
  "Report-Msgid-Bugs-To: Your Inspiration Themes <plugins@yithemes.com>\n"
7
  "POT-Creation-Date: 2019-02-04 16:04+0100\n"
8
+ "PO-Revision-Date: 2019-12-02 10:38+0000\n"
9
  "Last-Translator: \n"
10
  "Language-Team: Your Inspiration Themes <info@yithemes.com>\n"
11
  "Language: es_ES\n"
12
  "MIME-Version: 1.0\n"
13
  "Content-Type: text/plain; charset=UTF-8\n"
14
  "Content-Transfer-Encoding: 8bit\n"
15
+ "X-Generator: Poedit 1.8.12\n"
16
  "X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
17
  "_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
18
  "esc_html_x:1,2c\n"
921
  #: templates/fields/upload.php:18 templates/metaboxes/types/icon-list.php:70
922
  #: templates/panel/woocommerce/woocommerce-upload.php:40
923
  msgid "Upload"
924
+ msgstr "Subir"
925
 
926
  #: templates/fields/upload.php:19
927
  msgid "Reset"
plugin-fw/lib/yit-plugin-panel-wc.php CHANGED
@@ -549,6 +549,12 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
549
 
550
  if ( $value && isset( $option[ 'elements' ] ) && !empty( $option[ 'elements' ] ) ) {
551
 
 
 
 
 
 
 
552
  foreach ( $value as $index => $single_toggle ) {
553
 
554
  if ( $value && isset( $option[ 'onoff_field' ] ) && !empty( $option[ 'onoff_field' ] ) ) {
@@ -561,7 +567,8 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
561
  }
562
 
563
  foreach ( $option[ 'elements' ] as $element ) {
564
- $value[ $index ][ $element[ 'id' ] ] = self::sanitize_option( $value[ $index ][ $element[ 'id' ] ], $element, $value[ $index ][ $element[ 'id' ] ] );
 
565
  }
566
  }
567
  }
549
 
550
  if ( $value && isset( $option[ 'elements' ] ) && !empty( $option[ 'elements' ] ) ) {
551
 
552
+ $value = maybe_unserialize( $value );
553
+
554
+ if( isset( $value['box_id'] ) ){
555
+ unset( $value['box_id'] );
556
+ }
557
+
558
  foreach ( $value as $index => $single_toggle ) {
559
 
560
  if ( $value && isset( $option[ 'onoff_field' ] ) && !empty( $option[ 'onoff_field' ] ) ) {
567
  }
568
 
569
  foreach ( $option[ 'elements' ] as $element ) {
570
+ $element_value = isset( $value[ $index ][ $element[ 'id' ] ] ) ? $value[ $index ][ $element[ 'id' ] ] : false;
571
+ $value[ $index ][ $element[ 'id' ] ] = self::sanitize_option( $element_value, $element, $element_value );
572
  }
573
  }
574
  }
plugin-fw/lib/yit-plugin-panel.php CHANGED
@@ -496,7 +496,7 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
496
  $url = admin_url( "admin.php{$url}" );
497
  }
498
 
499
- return $url;
500
  }
501
 
502
  /**
496
  $url = admin_url( "admin.php{$url}" );
497
  }
498
 
499
+ return apply_filters( 'yith_plugin_fw_panel_url', $url, $page, $tab, $sub_tab, $parent_page );
500
  }
501
 
502
  /**
plugin-fw/yit-plugin.php CHANGED
@@ -158,7 +158,8 @@ if( ! function_exists( 'yit_plugin_fw_row_meta' ) ){
158
  }
159
 
160
  if( ! empty( $url ) && ! empty( $label ) ){
161
- $plugin_meta[] = sprintf( '<a href="%s" target="_blank"><span class="%s"></span>%s</a>', $url, $icon, $label );
 
162
  }
163
  }
164
 
158
  }
159
 
160
  if( ! empty( $url ) && ! empty( $label ) ){
161
+ $url = trailingslashit( $url );
162
+ $plugin_meta[] = sprintf( '<a href="%s" target="_blank"><span class="%s"></span>%s</a>', $url, $icon, $label );
163
  }
164
  }
165