YITH WooCommerce Ajax Product Filter - Version 3.3.2

Version Description

  • Released: 19 April, 2017 =

  • New: Support for Salient theme

  • New: Support for WooCommerce Grid/List view

  • Tweak: Create dropdown style dynamically

  • Fix: Filter by label and filter by dropdown lost current filter

  • Fix: Reset button doesn't works fine on product category page

  • Fix: Support to visibility taxonomy in WooCommerce 3.0.x

Download this release

Release Info

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

Code changes from version 3.3.1 to 3.3.2

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: 4.7.3
7
- Stable tag: 3.3.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -159,6 +159,15 @@ If you want to see a demonstration version of the premium plugin, you can see it
159
 
160
  == Changelog ==
161
 
 
 
 
 
 
 
 
 
 
162
  = 3.3.1 - Released: 20 MArch, 2017 =
163
 
164
  * Fix: Filter by color lost current filter
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: 4.7.3
7
+ Stable tag: 3.3.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
159
 
160
  == Changelog ==
161
 
162
+ = 3.3.2 - Released: 19 April, 2017 =
163
+
164
+ * New: Support for Salient theme
165
+ * New: Support for WooCommerce Grid/List view
166
+ * Tweak: Create dropdown style dynamically
167
+ * Fix: Filter by label and filter by dropdown lost current filter
168
+ * Fix: Reset button doesn't works fine on product category page
169
+ * Fix: Support to visibility taxonomy in WooCommerce 3.0.x
170
+
171
  = 3.3.1 - Released: 20 MArch, 2017 =
172
 
173
  * Fix: Filter by color lost current filter
assets/css/frontend.css CHANGED
@@ -192,42 +192,6 @@
192
  padding-left: 90px;
193
  }
194
 
195
- /* widget dropdown */
196
- .widget h1.with-dropdown,
197
- .widget h2.with-dropdown,
198
- .widget h3.with-dropdown,
199
- .widget h4.with-dropdown,
200
- .widget h5.with-dropdown,
201
- .widget h6.with-dropdown {
202
- position: relative;
203
- cursor: pointer;
204
- }
205
-
206
- .widget h1.with-dropdown .widget-dropdown,
207
- .widget h2.with-dropdown .widget-dropdown,
208
- .widget h3.with-dropdown .widget-dropdown,
209
- .widget h4.with-dropdown .widget-dropdown,
210
- .widget h5.with-dropdown .widget-dropdown,
211
- .widget h6.with-dropdown .widget-dropdown {
212
- border-width: 0;
213
- width: 22px;
214
- height: 22px;
215
- background: url(../images/select-arrow.png) top 0px right no-repeat;
216
- background-size: 95% !important;
217
- position: absolute;
218
- top: 0;
219
- right: 0;
220
- }
221
-
222
- .widget h1.with-dropdown.open .widget-dropdown,
223
- .widget h2.with-dropdown.open .widget-dropdown,
224
- .widget h3.with-dropdown.open .widget-dropdown,
225
- .widget h4.with-dropdown.open .widget-dropdown,
226
- .widget h5.with-dropdown.open .widget-dropdown,
227
- .widget h6.with-dropdown.open .widget-dropdown {
228
- background-position: bottom 15px right;
229
- }
230
-
231
  /* === Sort By === */
232
 
233
  .yith-wcan-sort-by ul.orderby {
192
  padding-left: 90px;
193
  }
194
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  /* === Sort By === */
196
 
197
  .yith-wcan-sort-by ul.orderby {
includes/class.yith-wcan-frontend.php CHANGED
@@ -277,8 +277,6 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
277
  'post_type' => 'product',
278
  'numberposts' => -1,
279
  'post_status' => 'publish',
280
- 'meta_key' => '_visibility',
281
- 'meta_value' => 'visible',
282
  'fields' => 'ids',
283
  'no_found_rows' => true,
284
  'suppress_filters' => true,
@@ -291,6 +289,7 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
291
  )
292
  );
293
 
 
294
 
295
  if( $is_product_taxonomy ){
296
  $args['tax_query'][] = $is_product_taxonomy;
@@ -351,19 +350,18 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
351
  'post_type' => 'product',
352
  'numberposts' => - 1,
353
  'post_status' => 'publish',
354
- 'meta_key' => '_visibility',
355
- 'meta_value' => 'visible',
356
  'fields' => 'ids',
357
  'no_found_rows' => true,
358
  'suppress_filters' => true,
359
  'tax_query' => array()
360
  );
361
 
362
-
363
  if( $is_product_taxonomy ){
364
  $args['tax_query'][] = $is_product_taxonomy;
365
  }
366
 
 
 
367
  $queried_object = is_object( get_queried_object() ) ? get_queried_object() : false;
368
 
369
  $taxonomy = $queried_object && property_exists( $queried_object, 'taxonomy' ) ? $queried_object->taxonomy : false;
277
  'post_type' => 'product',
278
  'numberposts' => -1,
279
  'post_status' => 'publish',
 
 
280
  'fields' => 'ids',
281
  'no_found_rows' => true,
282
  'suppress_filters' => true,
289
  )
290
  );
291
 
292
+ $args = yit_product_visibility_meta( $args );
293
 
294
  if( $is_product_taxonomy ){
295
  $args['tax_query'][] = $is_product_taxonomy;
350
  'post_type' => 'product',
351
  'numberposts' => - 1,
352
  'post_status' => 'publish',
 
 
353
  'fields' => 'ids',
354
  'no_found_rows' => true,
355
  'suppress_filters' => true,
356
  'tax_query' => array()
357
  );
358
 
 
359
  if( $is_product_taxonomy ){
360
  $args['tax_query'][] = $is_product_taxonomy;
361
  }
362
 
363
+ $args = yit_product_visibility_meta( $args );
364
+
365
  $queried_object = is_object( get_queried_object() ) ? get_queried_object() : false;
366
 
367
  $taxonomy = $queried_object && property_exists( $queried_object, 'taxonomy' ) ? $queried_object->taxonomy : false;
init.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: YITH WooCommerce Ajax Product Filter
4
  * Plugin URI: http://yithemes.com/
5
  * Description: YITH WooCommerce Ajax Product Filter offers the perfect way to filter all the products of your shop.
6
- * Version: 3.3.1
7
  * Author: YITHEMES
8
  * Author URI: http://yithemes.com/
9
  * Text Domain: yith-woocommerce-ajax-navigation
@@ -64,7 +64,7 @@ load_plugin_textdomain( 'yith-woocommerce-ajax-navigation', false, dirname( plug
64
  ! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
65
  ! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
66
  ! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
67
- ! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '3.3.1' );
68
  ! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
69
  ! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
70
 
3
  * Plugin Name: YITH WooCommerce Ajax Product Filter
4
  * Plugin URI: http://yithemes.com/
5
  * Description: YITH WooCommerce Ajax Product Filter offers the perfect way to filter all the products of your shop.
6
+ * Version: 3.3.2
7
  * Author: YITHEMES
8
  * Author URI: http://yithemes.com/
9
  * Text Domain: yith-woocommerce-ajax-navigation
64
  ! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
65
  ! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
66
  ! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
67
+ ! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '3.3.2' );
68
  ! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
69
  ! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
70
 
plugin-fw/init.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
- * Version: 2.9.57
5
  * Author: Yithemes
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
+ * Version: 2.9.64
5
  * Author: Yithemes
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
plugin-fw/lib/yit-plugin-panel.php CHANGED
@@ -114,7 +114,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
114
  if( ! isset( $admin_page_hooks['yit_plugin_panel'] ) ){
115
  $position = apply_filters( 'yit_plugins_menu_item_position', '62.32' );
116
  // YITH Plugins text must not be translated
117
- current_user_can( 'manage_options' ) && add_menu_page( 'yit_plugin_panel', 'YITH Plugins', 'manage_options', 'yit_plugin_panel', NULL, YIT_CORE_PLUGIN_URL . '/assets/images/yithemes-icon.png', $position );
118
  }
119
  }
120
 
114
  if( ! isset( $admin_page_hooks['yit_plugin_panel'] ) ){
115
  $position = apply_filters( 'yit_plugins_menu_item_position', '62.32' );
116
  // YITH Plugins text must not be translated
117
+ apply_filters('yit_plugin_panel_menu_page_capability', current_user_can( 'manage_options' )) && add_menu_page( 'yit_plugin_panel', 'YITH Plugins', 'manage_options', 'yit_plugin_panel', NULL, YIT_CORE_PLUGIN_URL . '/assets/images/yithemes-icon.png', $position );
118
  }
119
  }
120
 
plugin-fw/yit-plugin.php CHANGED
@@ -42,12 +42,15 @@ load_textdomain( 'yith-plugin-fw', get_template_directory() . '/core/plugin-fw/y
42
  // ...or from plugin folder
43
  || load_textdomain( 'yith-plugin-fw', dirname(__FILE__) . '/languages/yith-plugin-fw-' . apply_filters( 'plugin_locale', get_locale(), 'yith-plugin-fw' ) . '.mo' );
44
 
45
- if( apply_filters( 'yit_fw_wc_update_message_hook', true )
 
 
46
  &&
47
  ( function_exists( 'WC' ) && ! version_compare( WC()->version, '2.7', '>=' ) )
48
  && ! isset( $_COOKIE['yith_wc_2_7_notice'] )
49
  ){
50
  add_action( 'admin_notices', 'yit_fw_wc_update_message', 15 );
 
51
 
52
  if( ! function_exists( 'yit_fw_wc_update_message' ) ){
53
  function yit_fw_wc_update_message(){
@@ -61,8 +64,6 @@ if( apply_filters( 'yit_fw_wc_update_message_hook', true )
61
  }
62
  }
63
 
64
- add_action( 'admin_enqueue_scripts', 'yit_plugin_fw_dismissable_notice', 20 );
65
-
66
  if( ! function_exists( 'yit_plugin_fw_dismissable_notice' ) ){
67
  function yit_plugin_fw_dismissable_notice(){
68
  $assets_path = str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/';
@@ -76,4 +77,6 @@ if( apply_filters( 'yit_fw_wc_update_message_hook', true )
76
  wp_add_inline_script( 'jquery-cookie', $js );
77
  }
78
  }
79
- }
 
 
42
  // ...or from plugin folder
43
  || load_textdomain( 'yith-plugin-fw', dirname(__FILE__) . '/languages/yith-plugin-fw-' . apply_filters( 'plugin_locale', get_locale(), 'yith-plugin-fw' ) . '.mo' );
44
 
45
+ /* === WooCommerce Update Message === */
46
+
47
+ /*if( apply_filters( 'yit_fw_wc_update_message_hook', true )
48
  &&
49
  ( function_exists( 'WC' ) && ! version_compare( WC()->version, '2.7', '>=' ) )
50
  && ! isset( $_COOKIE['yith_wc_2_7_notice'] )
51
  ){
52
  add_action( 'admin_notices', 'yit_fw_wc_update_message', 15 );
53
+ add_action( 'admin_enqueue_scripts', 'yit_plugin_fw_dismissable_notice', 20 );
54
 
55
  if( ! function_exists( 'yit_fw_wc_update_message' ) ){
56
  function yit_fw_wc_update_message(){
64
  }
65
  }
66
 
 
 
67
  if( ! function_exists( 'yit_plugin_fw_dismissable_notice' ) ){
68
  function yit_plugin_fw_dismissable_notice(){
69
  $assets_path = str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/';
77
  wp_add_inline_script( 'jquery-cookie', $js );
78
  }
79
  }
80
+ }*/
81
+
82
+ /* ========================== */
plugin-fw/yit-woocommerce-compatibility.php CHANGED
@@ -166,26 +166,36 @@ if ( !function_exists( 'yit_delete_prop' ) ) {
166
  if ( !function_exists( 'yit_return_new_attribute_map' ) ) {
167
  function yit_return_new_attribute_map() {
168
  return array(
169
- 'post_parent' => 'parent_id',
170
- 'post_title' => 'name',
171
- 'post_status' => 'status',
172
- 'post_content' => 'description',
173
- 'post_excerpt' => 'short_description',
174
  /* Orders */
175
- 'paid_date' => 'date_paid',
176
- '_paid_date' => '_date_paid',
177
- 'completed_date' => 'date_completed',
178
- '_completed_date' => '_date_completed',
179
- '_order_date' => '_date_created',
180
- 'order_date' => 'date_created',
181
- 'order_total' => 'total',
 
 
182
  /* Products */
183
- 'visibility' => 'catalog_visibility',
184
- '_visibility' => '_catalog_visibility',
185
- 'sale_price_dates_from' => 'date_on_sale_from',
186
- '_sale_price_dates_from' => '_date_on_sale_from',
187
- 'sale_price_dates_to' => 'date_on_sale_to',
188
- '_sale_price_dates_to' => '_date_on_sale_to',
 
 
 
 
 
 
 
 
189
  );
190
  }
191
  }
@@ -245,7 +255,7 @@ if ( !function_exists( 'yit_get_orders' ) ) {
245
  *
246
  */
247
  function yit_get_orders( $args ) {
248
- if ( version_compare( WC()->version, '2.6', '<' ) ) {
249
  $args[ 'fields' ] = 'objects';
250
  $posts = get_posts( $args );
251
 
@@ -261,7 +271,7 @@ if ( !function_exists( 'yit_get_products' ) ) {
261
  *
262
  */
263
  function yit_get_products( $args ) {
264
- if ( version_compare( WC()->version, '2.6', '<' ) ) {
265
  $args[ 'fields' ] = 'objects';
266
  $posts = get_posts( $args );
267
 
@@ -311,6 +321,7 @@ if ( !function_exists( 'yit_wc_deprecated_filters' ) ) {
311
  'woocommerce_product_weight' => 'woocommerce_product_get_weight',
312
  'woocommerce_get_sku' => 'woocommerce_product_get_sku',
313
  'woocommerce_get_price' => 'woocommerce_product_get_price',
 
314
  'woocommerce_get_regular_price' => 'woocommerce_product_get_regular_price',
315
  'woocommerce_get_sale_price' => 'woocommerce_product_get_sale_price',
316
  'woocommerce_product_tax_class' => 'woocommerce_product_get_tax_class',
@@ -548,7 +559,7 @@ if ( !function_exists( 'yit_get_product_image_id' ) ) {
548
 
549
  if ( !function_exists( 'yit_get_refund_amount' ) ) {
550
  /**
551
- * @param $refund \WC_Order_Refund
552
  * @param $context string
553
  *
554
  * @return float
@@ -630,7 +641,7 @@ if ( !function_exists( 'yit_add_select2_fields' ) ) {
630
  <?php
631
  else :
632
  if ( $args[ 'data-multiple' ] === false && is_array( $args[ 'data-selected' ] ) ) {
633
- $args[ 'data-selected' ] = current($args[ 'data-selected' ]);
634
  }
635
 
636
  ?>
@@ -680,7 +691,7 @@ if ( !function_exists( 'yit_datetime_to_timestamp' ) ) {
680
  */
681
  function yit_datetime_to_timestamp( $date ) {
682
 
683
- if ( version_compare( WC()->version, '2.7.0', '<' ) ) {
684
  $date = strtotime( $date );
685
  }
686
 
166
  if ( !function_exists( 'yit_return_new_attribute_map' ) ) {
167
  function yit_return_new_attribute_map() {
168
  return array(
169
+ 'post_parent' => 'parent_id',
170
+ 'post_title' => 'name',
171
+ 'post_status' => 'status',
172
+ 'post_content' => 'description',
173
+ 'post_excerpt' => 'short_description',
174
  /* Orders */
175
+ 'paid_date' => 'date_paid',
176
+ '_paid_date' => '_date_paid',
177
+ 'completed_date' => 'date_completed',
178
+ '_completed_date' => '_date_completed',
179
+ '_order_date' => '_date_created',
180
+ 'order_date' => 'date_created',
181
+ 'order_total' => 'total',
182
+ 'customer_user' => 'customer_id',
183
+ '_customer_user' => 'customer_id',
184
  /* Products */
185
+ 'visibility' => 'catalog_visibility',
186
+ '_visibility' => '_catalog_visibility',
187
+ 'sale_price_dates_from' => 'date_on_sale_from',
188
+ '_sale_price_dates_from' => '_date_on_sale_from',
189
+ 'sale_price_dates_to' => 'date_on_sale_to',
190
+ '_sale_price_dates_to' => '_date_on_sale_to',
191
+ 'product_attributes' => 'attributes',
192
+ '_product_attributes' => '_attributes',
193
+ /*Coupons*/
194
+ 'coupon_amount' => 'amount',
195
+ 'exclude_product_ids' => 'excluded_product_ids',
196
+ 'exclude_product_categories' => 'excluded_product_categories',
197
+ 'customer_email' => 'email_restrictions',
198
+ 'expiry_date' => 'date_expires',
199
  );
200
  }
201
  }
255
  *
256
  */
257
  function yit_get_orders( $args ) {
258
+ if ( version_compare( WC()->version, '2.7', '<' ) ) {
259
  $args[ 'fields' ] = 'objects';
260
  $posts = get_posts( $args );
261
 
271
  *
272
  */
273
  function yit_get_products( $args ) {
274
+ if ( version_compare( WC()->version, '2.7', '<' ) ) {
275
  $args[ 'fields' ] = 'objects';
276
  $posts = get_posts( $args );
277
 
321
  'woocommerce_product_weight' => 'woocommerce_product_get_weight',
322
  'woocommerce_get_sku' => 'woocommerce_product_get_sku',
323
  'woocommerce_get_price' => 'woocommerce_product_get_price',
324
+ 'woocommerce_get_price' => 'woocommerce_product_variation_get_price',
325
  'woocommerce_get_regular_price' => 'woocommerce_product_get_regular_price',
326
  'woocommerce_get_sale_price' => 'woocommerce_product_get_sale_price',
327
  'woocommerce_product_tax_class' => 'woocommerce_product_get_tax_class',
559
 
560
  if ( !function_exists( 'yit_get_refund_amount' ) ) {
561
  /**
562
+ * @param $refund \WC_Order_Refund
563
  * @param $context string
564
  *
565
  * @return float
641
  <?php
642
  else :
643
  if ( $args[ 'data-multiple' ] === false && is_array( $args[ 'data-selected' ] ) ) {
644
+ $args[ 'data-selected' ] = current( $args[ 'data-selected' ] );
645
  }
646
 
647
  ?>
691
  */
692
  function yit_datetime_to_timestamp( $date ) {
693
 
694
+ if ( !is_int( $date ) ) {
695
  $date = strtotime( $date );
696
  }
697
 
widgets/class.yith-wcan-navigation-widget.php CHANGED
@@ -230,7 +230,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
230
  if ( $name !== $taxonomy ) {
231
 
232
  // Exclude query arg for current term archive term
233
- while ( $in_array_function( $current_term, $data['terms'] ) ) {
234
  $key = array_search( $current_term, $data );
235
  unset( $data['terms'][$key] );
236
  }
@@ -633,7 +633,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
633
  if ( $name !== $taxonomy ) {
634
 
635
  // Exclude query arg for current term archive term
636
- while ( $in_array_function( $current_term, $data['terms'] ) ) {
637
  $key = array_search( $current_term, $data );
638
  unset( $data['terms'][$key] );
639
  }
@@ -980,7 +980,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
980
  if( $echo ) {
981
 
982
  // Get count based on current view - uses transients
983
- $transient_name = 'wc_ln_count_' . md5(sanitize_key($taxonomy) . sanitize_key($term->term_id));
984
 
985
  //if ( false === ( $_products_in_term = get_transient( $transient_name ) ) ) {
986
 
230
  if ( $name !== $taxonomy ) {
231
 
232
  // Exclude query arg for current term archive term
233
+ while ( $in_array_function( $term->slug, $data['terms'] ) ) {
234
  $key = array_search( $current_term, $data );
235
  unset( $data['terms'][$key] );
236
  }
633
  if ( $name !== $taxonomy ) {
634
 
635
  // Exclude query arg for current term archive term
636
+ while ( $in_array_function( $term->slug, $data['terms'] ) ) {
637
  $key = array_search( $current_term, $data );
638
  unset( $data['terms'][$key] );
639
  }
980
  if( $echo ) {
981
 
982
  // Get count based on current view - uses transients
983
+ //$transient_name = 'wc_ln_count_' . md5(sanitize_key($taxonomy) . sanitize_key($term->term_id));
984
 
985
  //if ( false === ( $_products_in_term = get_transient( $transient_name ) ) ) {
986
 
widgets/class.yith-wcan-reset-navigation-widget.php CHANGED
@@ -55,7 +55,17 @@ if ( ! class_exists( 'YITH_WCAN_Reset_Navigation_Widget' ) ) {
55
  //clean the url
56
  if( ! isset( $_GET['source_id'] ) ){
57
  //$link = yit_curPageURL();
58
- $link = get_post_type_archive_link( 'product' );//yit_get_woocommerce_layered_nav_link();
 
 
 
 
 
 
 
 
 
 
59
  foreach ( (array) $_chosen_attributes as $taxonomy => $data ) {
60
  $taxonomy_filter = str_replace( 'pa_', '', $taxonomy );
61
  $link = remove_query_arg( 'filter_' . $taxonomy_filter, $link );
@@ -66,8 +76,12 @@ if ( ! class_exists( 'YITH_WCAN_Reset_Navigation_Widget' ) ) {
66
 
67
  else{
68
  //Start filter from Product category Page
69
- $term = get_term_by( 'id', $_GET['source_id'], $_GET['source_tax'] );
70
- $link = get_term_link( $term, $term->taxonomy );
 
 
 
 
71
  }
72
 
73
 
55
  //clean the url
56
  if( ! isset( $_GET['source_id'] ) ){
57
  //$link = yit_curPageURL();
58
+ if( is_product_taxonomy() ){
59
+ $queried_object = get_queried_object();
60
+ $slug = $queried_object->slug;
61
+ $taxonomy = $queried_object->taxonomy;
62
+ $link = get_term_link( $slug, $taxonomy );
63
+ }
64
+
65
+ else {
66
+ $link = get_post_type_archive_link( 'product' );//yit_get_woocommerce_layered_nav_link();
67
+ }
68
+
69
  foreach ( (array) $_chosen_attributes as $taxonomy => $data ) {
70
  $taxonomy_filter = str_replace( 'pa_', '', $taxonomy );
71
  $link = remove_query_arg( 'filter_' . $taxonomy_filter, $link );
76
 
77
  else{
78
  //Start filter from Product category Page
79
+ $field = $_GET['source_tax'] != 'product_tag' ? 'id' : 'slug';
80
+ $term = get_term_by( $field, $_GET['source_id'], $_GET['source_tax'] );
81
+
82
+ if( $term instanceof WP_Term ){
83
+ $link = get_term_link( $term, $term->taxonomy );
84
+ }
85
  }
86
 
87