YITH WooCommerce Ajax Product Filter - Version 1.3.1

Version Description

  • Added: Attribute order (All, Hieralchical or Only Parent style)
  • Fixed: Dropdown Style on Firefox
  • Fixed: Blank box on attribute without label (Label Style)
  • Fixed: Blank box on attribute without color (Color Stle)
Download this release

Release Info

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

Code changes from version 1.3.0 to 1.3.1

README.txt CHANGED
@@ -3,12 +3,12 @@
3
  Contributors: yithemes
4
  Tags: woocommerce, widget, ajax, ajax filtered nav, ajax navigation, ajax filtered navigation
5
  Requires at least: 3.5.1
6
- Tested up to: 3.8
7
- Stable tag: 1.3.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- YITH WooCommerce Ajax Navigation allows you to filter the products in the Shop page without reloading the page.
12
  WooCommerce Compatible up to 2.1.x
13
 
14
 
@@ -66,6 +66,13 @@ In order to display the widget you need to assign it to the sidebar in the Shop
66
 
67
  == Changelog ==
68
 
 
 
 
 
 
 
 
69
  = 1.3.0 =
70
 
71
  * Added: Support to WooCommerce 2.1.X
3
  Contributors: yithemes
4
  Tags: woocommerce, widget, ajax, ajax filtered nav, ajax navigation, ajax filtered navigation
5
  Requires at least: 3.5.1
6
+ Tested up to: 3.8.1
7
+ Stable tag: 1.3.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ YITH WooCommerce Ajax Navigation allows you to filter the products in the Shop page without reloading the page.
12
  WooCommerce Compatible up to 2.1.x
13
 
14
 
66
 
67
  == Changelog ==
68
 
69
+ = 1.3.1 =
70
+
71
+ * Added: Attribute order (All, Hieralchical or Only Parent style)
72
+ * Fixed: Dropdown Style on Firefox
73
+ * Fixed: Blank box on attribute without label (Label Style)
74
+ * Fixed: Blank box on attribute without color (Color Stle)
75
+
76
  = 1.3.0 =
77
 
78
  * Added: Support to WooCommerce 2.1.X
assets/css/admin.css CHANGED
@@ -18,9 +18,6 @@
18
  vertical-align: top;
19
  }
20
 
21
- /*
22
- .yith_wcan_placeholder .wp-color-result:after,
23
- .yith_wcan_placeholder .wp-color-result.wp-picker-open:after{
24
- content: "";
25
  }
26
- */
18
  vertical-align: top;
19
  }
20
 
21
+ p.yit-wcan-display-label, p.yit-wcan-display-color {
22
+ display: none;
 
 
23
  }
 
assets/css/frontend.css CHANGED
@@ -135,7 +135,13 @@
135
  width: 100%;
136
  color: #838383;
137
  box-sizing: border-box;
 
138
  }
 
 
 
 
 
139
  .yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li a:hover, .widget .yit-wcan-select-open:hover {
140
  text-decoration: none;
141
  color: #838383;
@@ -152,4 +158,13 @@
152
  content: "";
153
  }
154
 
 
 
 
 
 
 
 
 
 
155
 
135
  width: 100%;
136
  color: #838383;
137
  box-sizing: border-box;
138
+ -moz-box-sizing:border-box; /* Firefox */
139
  }
140
+
141
+ .yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li a, .widget .yit-wcan-select-open {
142
+ width: auto;
143
+ }
144
+
145
  .yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li a:hover, .widget .yit-wcan-select-open:hover {
146
  text-decoration: none;
147
  color: #838383;
158
  content: "";
159
  }
160
 
161
+ /* Hierarchical Order */
162
+ .widget.widget_layered_nav li.yit-wcan-child-terms {
163
+ padding-left: 30px;
164
+ }
165
+
166
+ .yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li.yit-wcan-child-terms {
167
+ padding-left: 30px;
168
+ }
169
+
170
 
assets/js/yith-wcan-admin.js CHANGED
@@ -3,7 +3,7 @@
3
  *
4
  * @author Your Inspiration Themes
5
  * @package YITH WooCommerce Ajax Navigation
6
- * @version 1.3.0
7
  */
8
  jQuery(function($){
9
 
@@ -12,18 +12,27 @@ jQuery(function($){
12
  container = $(this).parents('.widget-content').find('.yith_wcan_placeholder').html(''),
13
  spinner = container.next('.spinner').show();
14
 
 
 
 
 
15
  var data = {
16
  action: 'yith_wcan_select_type',
17
  id: $('input[name=widget_id]', $(t).parents('.widget-content')).val(),
18
  name: $('input[name=widget_name]', $(t).parents('.widget-content')).val(),
19
  attribute: $('.yith_wcan_attributes', $(t).parents('.widget-content')).val(),
20
- value: $('.yith_wcan_type', $(t).parents('.widget-content')).val()
21
  };
22
 
 
 
 
 
 
 
23
 
24
  $.post(ajaxurl, data, function(response) {
25
  spinner.hide();
26
-
27
  container.html( response.content );
28
  $(document).trigger('yith_colorpicker');
29
  }, 'json');
3
  *
4
  * @author Your Inspiration Themes
5
  * @package YITH WooCommerce Ajax Navigation
6
+ * @version 1.3.1
7
  */
8
  jQuery(function($){
9
 
12
  container = $(this).parents('.widget-content').find('.yith_wcan_placeholder').html(''),
13
  spinner = container.next('.spinner').show();
14
 
15
+
16
+
17
+ var display = $(this).parents('.widget-content').find('#yit-wcan-display');
18
+
19
  var data = {
20
  action: 'yith_wcan_select_type',
21
  id: $('input[name=widget_id]', $(t).parents('.widget-content')).val(),
22
  name: $('input[name=widget_name]', $(t).parents('.widget-content')).val(),
23
  attribute: $('.yith_wcan_attributes', $(t).parents('.widget-content')).val(),
24
+ value: $('.yith_wcan_type', $(t).parents('.widget-content')).val(),
25
  };
26
 
27
+ /* Hierarchical hide/show */
28
+ if( data.value == 'list' || data.value == 'select' ) {
29
+ display.show();
30
+ }else if( data.value == 'label' || data.value == 'color' ){ console.log(data.value);
31
+ display.hide();
32
+ }
33
 
34
  $.post(ajaxurl, data, function(response) {
35
  spinner.hide();
 
36
  container.html( response.content );
37
  $(document).trigger('yith_colorpicker');
38
  }, 'json');
assets/js/yith-wcan-frontend.js CHANGED
@@ -3,7 +3,7 @@
3
  *
4
  * @author Your Inspiration Themes
5
  * @package YITH WooCommerce Ajax Navigation
6
- * @version 1.3.0
7
  */
8
  jQuery(function($){
9
  /**
3
  *
4
  * @author Your Inspiration Themes
5
  * @package YITH WooCommerce Ajax Navigation
6
+ * @version 1.3.1
7
  */
8
  jQuery(function($){
9
  /**
class.yith-wcan-admin.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Ajax Navigation
7
- * @version 1.3.0
8
  */
9
 
10
  if ( !defined( 'YITH_WCAN' ) ) { exit; } // Exit if accessed directly
@@ -88,13 +88,12 @@ if( !class_exists( 'YITH_WCAN_Admin' ) ) {
88
 
89
  $terms = get_terms( 'pa_' . $attribute, array('hide_empty'=>'0') );
90
 
91
-
92
  $return['content'] = yith_wcan_attributes_table(
93
  $type,
94
  $attribute,
95
  $_POST['id'],
96
  $_POST['name'],
97
- array(),
98
  false
99
  );
100
 
4
  *
5
  * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Ajax Navigation
7
+ * @version 1.3.1
8
  */
9
 
10
  if ( !defined( 'YITH_WCAN' ) ) { exit; } // Exit if accessed directly
88
 
89
  $terms = get_terms( 'pa_' . $attribute, array('hide_empty'=>'0') );
90
 
 
91
  $return['content'] = yith_wcan_attributes_table(
92
  $type,
93
  $attribute,
94
  $_POST['id'],
95
  $_POST['name'],
96
+ json_decode($_POST['type']),
97
  false
98
  );
99
 
class.yith-wcan-frontend.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Ajax Navigation
7
- * @version 1.3.0
8
  */
9
 
10
  if ( !defined( 'YITH_WCAN' ) ) { exit; } // Exit if accessed directly
4
  *
5
  * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Ajax Navigation
7
+ * @version 1.3.1
8
  */
9
 
10
  if ( !defined( 'YITH_WCAN' ) ) { exit; } // Exit if accessed directly
class.yith-wcan-helper.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Ajax Navigation
7
- * @version 1.3.0
8
  */
9
 
10
  if ( !defined( 'YITH_WCAN' ) ) { exit; } // Exit if accessed directly
4
  *
5
  * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Ajax Navigation
7
+ * @version 1.3.1
8
  */
9
 
10
  if ( !defined( 'YITH_WCAN' ) ) { exit; } // Exit if accessed directly
class.yith-wcan.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Ajax Navigation
7
- * @version 1.3.0
8
  */
9
 
10
  if ( !defined( 'YITH_WCAN' ) ) { exit; } // Exit if accessed directly
@@ -22,7 +22,7 @@ if( !class_exists( 'YITH_WCAN' ) ) {
22
  * @var string
23
  * @since 1.0.0
24
  */
25
- public $version = '1.3.0';
26
 
27
  /**
28
  * Plugin object
4
  *
5
  * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Ajax Navigation
7
+ * @version 1.3.1
8
  */
9
 
10
  if ( !defined( 'YITH_WCAN' ) ) { exit; } // Exit if accessed directly
22
  * @var string
23
  * @since 1.0.0
24
  */
25
+ public $version = '1.3.1';
26
 
27
  /**
28
  * Plugin object
functions.yith-wcan.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Ajax Navigation
7
- * @version 1.3.0
8
  */
9
 
10
  if ( !defined( 'YITH_WCAN' ) ) { exit; } // Exit if accessed directly
@@ -121,4 +121,145 @@ if( !function_exists('yit_curPageURL') ) {
121
 
122
  return $pageURL;
123
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  }
4
  *
5
  * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Ajax Navigation
7
+ * @version 1.3.1
8
  */
9
 
10
  if ( !defined( 'YITH_WCAN' ) ) { exit; } // Exit if accessed directly
121
 
122
  return $pageURL;
123
  }
124
+ }
125
+
126
+ if( !function_exists('yit_reorder_terms_by_parent') ) {
127
+ /**
128
+ * Sort the array of terms associating the child to the parent terms
129
+ *
130
+ * @param $terms mixed|array
131
+ * @return mixed!array
132
+ * @since 1.3.1
133
+ */
134
+ function yit_reorder_terms_by_parent( $terms ) {
135
+
136
+ /* Extract Child Terms */
137
+ $child_terms = array();
138
+ $terms_count = 0;
139
+
140
+ foreach( $terms as $array_key => $term ) {
141
+
142
+ if( $term->parent != 0 ) {
143
+
144
+ if( isset( $child_terms[ $term->parent ] ) && $child_terms[ $term->parent ] != null ) {
145
+ $child_terms[ $term->parent ] = array_merge( $child_terms[ $term->parent ], array( $term ) );
146
+ }else {
147
+ $child_terms[ $term->parent ] = array( $term );
148
+ }
149
+
150
+ } else {
151
+ $parent_terms[ $terms_count ] = $term;
152
+ }
153
+ $terms_count++;
154
+ }
155
+
156
+ /* Reorder Therms */
157
+ $terms_count = 0;
158
+ $terms = array();
159
+
160
+ foreach( $parent_terms as $term ) {
161
+
162
+ $terms[ $terms_count ] = $term;
163
+
164
+ /* The term as child */
165
+ if( array_key_exists( $term->term_id, $child_terms ) ){
166
+
167
+ foreach ( $child_terms[ $term->term_id ] as $child_term ) {
168
+ $terms_count++;
169
+ $terms[ $terms_count ] = $child_term;
170
+ }
171
+ }
172
+ $terms_count++;
173
+ }
174
+
175
+ return $terms;
176
+ }
177
+ }
178
+
179
+ if( !function_exists('yit_get_terms') ) {
180
+ /**
181
+ * Get the array of objects terms
182
+ *
183
+ * @param $type A type of term to display
184
+ * @return $terms mixed|array
185
+ *
186
+ * @since 1.3.1
187
+ */
188
+ function yit_get_terms( $case, $taxonomy ) {
189
+
190
+ switch ( $case ) {
191
+
192
+ case 'all':
193
+ $terms = get_terms( $taxonomy, array( 'hide_empty' => true ) );
194
+ break;
195
+
196
+ case 'hierarchical':
197
+ $terms = yit_reorder_terms_by_parent( get_terms( $taxonomy, array( 'hide_empty' => true ) ) );
198
+ break;
199
+
200
+ case 'parent' :
201
+ $terms = get_terms( $taxonomy, array( 'hide_empty' => true, 'parent' => false ) );
202
+ break;
203
+
204
+ default:
205
+ $terms = get_terms( $taxonomy, array( 'hide_empty' => true ) );
206
+ break;
207
+ }
208
+
209
+ return $terms;
210
+ }
211
+ }
212
+
213
+ if( !function_exists('yit_term_is_child') ) {
214
+ /**
215
+ * Return true if the term is a child, false otherwise
216
+ *
217
+ * @param $term The term object
218
+ * @return bool
219
+ *
220
+ * @since 1.3.1
221
+ */
222
+ function yit_term_is_child( $term ) {
223
+
224
+ return ( isset( $term->parent ) && $term->parent != 0 ) ? true : false;
225
+ }
226
+ }
227
+
228
+ if( !function_exists('yit_term_is_parent') ) {
229
+ /**
230
+ * Return true if the term is a parent, false otherwise
231
+ *
232
+ * @param $term The term object
233
+ * @return bool
234
+ *
235
+ * @since 1.3.1
236
+ */
237
+ function yit_term_is_parent( $term ) {
238
+
239
+ return ( isset( $term->parent ) && $term->parent == 0 ) ? true : false;
240
+ }
241
+ }
242
+
243
+ if( !function_exists('yit_term_has_child') ) {
244
+ /**
245
+ * Return true if the term has a child, false otherwise
246
+ *
247
+ * @param $term The term object
248
+ * @param $taxonomy the taxonomy to search
249
+ * @return bool
250
+ *
251
+ * @since 1.3.1
252
+ */
253
+ function yit_term_has_child( $term, $taxonomy ) {
254
+ global $woocommerce;
255
+
256
+ $count = 0;
257
+ $child_terms = get_terms( $taxonomy, array( 'child_of' => $term->term_id ) );
258
+ foreach ( $child_terms as $term ) {
259
+ $_products_in_term = get_objects_in_term( $term->term_id, $taxonomy );
260
+ $count += sizeof( array_intersect( $_products_in_term, $woocommerce->query->filtered_product_ids ) );
261
+ }
262
+
263
+ return empty( $count ) ? false : true;
264
+ }
265
  }
init.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: YITH WooCommerce Ajax Navigation
4
  * Plugin URI: http://yithemes.com/
5
  * Description: YITH WooCommerce Ajax Navigation allows user to filter products in Shop page without reloading the page.
6
- * Version: 1.3.0
7
  * Author: Your Inspiration Themes
8
  * Author URI: http://yithemes.com/
9
  * Text Domain: yit
@@ -11,7 +11,7 @@
11
  *
12
  * @author Your Inspiration Themes
13
  * @package YITH WooCommerce Ajax Navigation
14
- * @version 1.3.0
15
  */
16
  /* Copyright 2013 Your Inspiration Themes (email : plugins@yithemes.com)
17
 
@@ -46,7 +46,7 @@ function yith_wcan_constructor() {
46
  define( 'YITH_WCAN', true );
47
  define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
48
  define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
49
- define( 'YITH_WCAN_VERSION', '1.3.0' );
50
 
51
  // Load required classes and functions
52
  require_once('functions.yith-wcan.php');
3
  * Plugin Name: YITH WooCommerce Ajax Navigation
4
  * Plugin URI: http://yithemes.com/
5
  * Description: YITH WooCommerce Ajax Navigation allows user to filter products in Shop page without reloading the page.
6
+ * Version: 1.3.1
7
  * Author: Your Inspiration Themes
8
  * Author URI: http://yithemes.com/
9
  * Text Domain: yit
11
  *
12
  * @author Your Inspiration Themes
13
  * @package YITH WooCommerce Ajax Navigation
14
+ * @version 1.3.1
15
  */
16
  /* Copyright 2013 Your Inspiration Themes (email : plugins@yithemes.com)
17
 
46
  define( 'YITH_WCAN', true );
47
  define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
48
  define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
49
+ define( 'YITH_WCAN_VERSION', '1.3.1' );
50
 
51
  // Load required classes and functions
52
  require_once('functions.yith-wcan.php');
languages/default.po CHANGED
@@ -1,9 +1,9 @@
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: YITH WooCommerce Ajax Navigation v1.3.0\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2014-01-10 10:28+0100\n"
6
- "PO-Revision-Date: 2014-02-12 15:59+0100\n"
7
  "Last-Translator: Your Inspiration Themes <plugins@yithemes.com>\n"
8
  "Language-Team: \n"
9
  "Language: en_US\n"
@@ -26,7 +26,7 @@ msgstr ""
26
 
27
  # @ yit
28
  #: functions.yith-wcan.php:52
29
- #: widgets/class.yith-wcan-navigation-widget.php:695
30
  msgid "Color"
31
  msgstr ""
32
 
@@ -45,55 +45,71 @@ msgstr ""
45
  msgid "YITH WooCommerce Ajax Navigation"
46
  msgstr ""
47
 
48
- #: widgets/class.yith-wcan-navigation-widget.php:215
49
  msgid "Filters List:"
50
  msgstr ""
51
 
52
  # @ yit
53
- #: widgets/class.yith-wcan-navigation-widget.php:676
54
  #: widgets/class.yith-wcan-reset-navigation-widget.php:85
55
  msgid "Title"
56
  msgstr ""
57
 
58
  # @ yit
59
- #: widgets/class.yith-wcan-navigation-widget.php:681
60
  msgid "Attribute:"
61
  msgstr ""
62
 
63
  # @ yit
64
- #: widgets/class.yith-wcan-navigation-widget.php:686
65
  msgid "Query Type:"
66
  msgstr ""
67
 
68
  # @ yit
69
- #: widgets/class.yith-wcan-navigation-widget.php:688
70
  msgid "AND"
71
  msgstr ""
72
 
73
  # @ yit
74
- #: widgets/class.yith-wcan-navigation-widget.php:689
75
  msgid "OR"
76
  msgstr ""
77
 
78
  # @ yit
79
- #: widgets/class.yith-wcan-navigation-widget.php:692
80
  msgid "Type:"
81
  msgstr ""
82
 
83
  # @ yit
84
- #: widgets/class.yith-wcan-navigation-widget.php:694
85
  msgid "List"
86
  msgstr ""
87
 
88
  # @ yit
89
- #: widgets/class.yith-wcan-navigation-widget.php:696
90
  msgid "Label"
91
  msgstr ""
92
 
93
- #: widgets/class.yith-wcan-navigation-widget.php:697
94
  msgid "Dropdown"
95
  msgstr ""
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  #: widgets/class.yith-wcan-reset-navigation-widget.php:21
98
  msgid "Reset all filters setted by YITH WooCommerce Ajax Navigation"
99
  msgstr ""
1
  msgid ""
2
  msgstr ""
3
+ "Project-Id-Version: YITH WooCommerce Ajax Navigation v1.3.1\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2014-03-03 12:55+0100\n"
6
+ "PO-Revision-Date: 2014-03-03 12:55+0100\n"
7
  "Last-Translator: Your Inspiration Themes <plugins@yithemes.com>\n"
8
  "Language-Team: \n"
9
  "Language: en_US\n"
26
 
27
  # @ yit
28
  #: functions.yith-wcan.php:52
29
+ #: widgets/class.yith-wcan-navigation-widget.php:702
30
  msgid "Color"
31
  msgstr ""
32
 
45
  msgid "YITH WooCommerce Ajax Navigation"
46
  msgstr ""
47
 
48
+ #: widgets/class.yith-wcan-navigation-widget.php:220
49
  msgid "Filters List:"
50
  msgstr ""
51
 
52
  # @ yit
53
+ #: widgets/class.yith-wcan-navigation-widget.php:683
54
  #: widgets/class.yith-wcan-reset-navigation-widget.php:85
55
  msgid "Title"
56
  msgstr ""
57
 
58
  # @ yit
59
+ #: widgets/class.yith-wcan-navigation-widget.php:688
60
  msgid "Attribute:"
61
  msgstr ""
62
 
63
  # @ yit
64
+ #: widgets/class.yith-wcan-navigation-widget.php:693
65
  msgid "Query Type:"
66
  msgstr ""
67
 
68
  # @ yit
69
+ #: widgets/class.yith-wcan-navigation-widget.php:695
70
  msgid "AND"
71
  msgstr ""
72
 
73
  # @ yit
74
+ #: widgets/class.yith-wcan-navigation-widget.php:696
75
  msgid "OR"
76
  msgstr ""
77
 
78
  # @ yit
79
+ #: widgets/class.yith-wcan-navigation-widget.php:699
80
  msgid "Type:"
81
  msgstr ""
82
 
83
  # @ yit
84
+ #: widgets/class.yith-wcan-navigation-widget.php:701
85
  msgid "List"
86
  msgstr ""
87
 
88
  # @ yit
89
+ #: widgets/class.yith-wcan-navigation-widget.php:703
90
  msgid "Label"
91
  msgstr ""
92
 
93
+ #: widgets/class.yith-wcan-navigation-widget.php:704
94
  msgid "Dropdown"
95
  msgstr ""
96
 
97
+ #: widgets/class.yith-wcan-navigation-widget.php:709
98
+ msgid "Display (default All):"
99
+ msgstr ""
100
+
101
+ #: widgets/class.yith-wcan-navigation-widget.php:711
102
+ msgid "All (no hierarchical)"
103
+ msgstr ""
104
+
105
+ #: widgets/class.yith-wcan-navigation-widget.php:712
106
+ msgid "All Hierarchical"
107
+ msgstr ""
108
+
109
+ #: widgets/class.yith-wcan-navigation-widget.php:713
110
+ msgid "Only Parent"
111
+ msgstr ""
112
+
113
  #: widgets/class.yith-wcan-reset-navigation-widget.php:21
114
  msgid "Reset all filters setted by YITH WooCommerce Ajax Navigation"
115
  msgstr ""
languages/yit-it_IT.mo CHANGED
Binary file
languages/yit-it_IT.po CHANGED
@@ -1,9 +1,9 @@
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: YITH WooCommerce Ajax Navigation v1.3.0\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2014-01-10 10:28+0100\n"
6
- "PO-Revision-Date: 2014-02-12 15:59+0100\n"
7
  "Last-Translator: Your Inspiration Themes <plugins@yithemes.com>\n"
8
  "Language-Team: \n"
9
  "Language: it_IT\n"
@@ -26,7 +26,7 @@ msgstr "Proprietà"
26
 
27
  # @ yit
28
  #: functions.yith-wcan.php:52
29
- #: widgets/class.yith-wcan-navigation-widget.php:695
30
  msgid "Color"
31
  msgstr "Colore"
32
 
@@ -45,55 +45,71 @@ msgstr "Filtra la lista dei prodotti senza ricaricare la pagina"
45
  msgid "YITH WooCommerce Ajax Navigation"
46
  msgstr "YITH WooCommerce Ajax Navigation"
47
 
48
- #: widgets/class.yith-wcan-navigation-widget.php:215
49
  msgid "Filters List:"
50
  msgstr "Lista Filtri:"
51
 
52
  # @ yit
53
- #: widgets/class.yith-wcan-navigation-widget.php:676
54
  #: widgets/class.yith-wcan-reset-navigation-widget.php:85
55
  msgid "Title"
56
  msgstr "Titolo"
57
 
58
  # @ yit
59
- #: widgets/class.yith-wcan-navigation-widget.php:681
60
  msgid "Attribute:"
61
  msgstr "Attributo:"
62
 
63
  # @ yit
64
- #: widgets/class.yith-wcan-navigation-widget.php:686
65
  msgid "Query Type:"
66
  msgstr "Tipo Query:"
67
 
68
  # @ yit
69
- #: widgets/class.yith-wcan-navigation-widget.php:688
70
  msgid "AND"
71
  msgstr "AND"
72
 
73
  # @ yit
74
- #: widgets/class.yith-wcan-navigation-widget.php:689
75
  msgid "OR"
76
  msgstr "OR"
77
 
78
  # @ yit
79
- #: widgets/class.yith-wcan-navigation-widget.php:692
80
  msgid "Type:"
81
  msgstr "Tipo:"
82
 
83
  # @ yit
84
- #: widgets/class.yith-wcan-navigation-widget.php:694
85
  msgid "List"
86
  msgstr "Lista"
87
 
88
  # @ yit
89
- #: widgets/class.yith-wcan-navigation-widget.php:696
90
  msgid "Label"
91
  msgstr "Label"
92
 
93
- #: widgets/class.yith-wcan-navigation-widget.php:697
94
  msgid "Dropdown"
95
  msgstr "Dropdown"
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  # @ yit
98
  #: widgets/class.yith-wcan-reset-navigation-widget.php:21
99
  msgid "Reset all filters setted by YITH WooCommerce Ajax Navigation"
1
  msgid ""
2
  msgstr ""
3
+ "Project-Id-Version: YITH WooCommerce Ajax Navigation v1.3.1\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2014-03-03 12:55+0100\n"
6
+ "PO-Revision-Date: 2014-03-03 12:56+0100\n"
7
  "Last-Translator: Your Inspiration Themes <plugins@yithemes.com>\n"
8
  "Language-Team: \n"
9
  "Language: it_IT\n"
26
 
27
  # @ yit
28
  #: functions.yith-wcan.php:52
29
+ #: widgets/class.yith-wcan-navigation-widget.php:702
30
  msgid "Color"
31
  msgstr "Colore"
32
 
45
  msgid "YITH WooCommerce Ajax Navigation"
46
  msgstr "YITH WooCommerce Ajax Navigation"
47
 
48
+ #: widgets/class.yith-wcan-navigation-widget.php:220
49
  msgid "Filters List:"
50
  msgstr "Lista Filtri:"
51
 
52
  # @ yit
53
+ #: widgets/class.yith-wcan-navigation-widget.php:683
54
  #: widgets/class.yith-wcan-reset-navigation-widget.php:85
55
  msgid "Title"
56
  msgstr "Titolo"
57
 
58
  # @ yit
59
+ #: widgets/class.yith-wcan-navigation-widget.php:688
60
  msgid "Attribute:"
61
  msgstr "Attributo:"
62
 
63
  # @ yit
64
+ #: widgets/class.yith-wcan-navigation-widget.php:693
65
  msgid "Query Type:"
66
  msgstr "Tipo Query:"
67
 
68
  # @ yit
69
+ #: widgets/class.yith-wcan-navigation-widget.php:695
70
  msgid "AND"
71
  msgstr "AND"
72
 
73
  # @ yit
74
+ #: widgets/class.yith-wcan-navigation-widget.php:696
75
  msgid "OR"
76
  msgstr "OR"
77
 
78
  # @ yit
79
+ #: widgets/class.yith-wcan-navigation-widget.php:699
80
  msgid "Type:"
81
  msgstr "Tipo:"
82
 
83
  # @ yit
84
+ #: widgets/class.yith-wcan-navigation-widget.php:701
85
  msgid "List"
86
  msgstr "Lista"
87
 
88
  # @ yit
89
+ #: widgets/class.yith-wcan-navigation-widget.php:703
90
  msgid "Label"
91
  msgstr "Label"
92
 
93
+ #: widgets/class.yith-wcan-navigation-widget.php:704
94
  msgid "Dropdown"
95
  msgstr "Dropdown"
96
 
97
+ #: widgets/class.yith-wcan-navigation-widget.php:709
98
+ msgid "Display (default All):"
99
+ msgstr "Visualizzazione (default Tutti)"
100
+
101
+ #: widgets/class.yith-wcan-navigation-widget.php:711
102
+ msgid "All (no hierarchical)"
103
+ msgstr "Tutti (no gerarchica)"
104
+
105
+ #: widgets/class.yith-wcan-navigation-widget.php:712
106
+ msgid "All Hierarchical"
107
+ msgstr "Tutti Gerarchica"
108
+
109
+ #: widgets/class.yith-wcan-navigation-widget.php:713
110
+ msgid "Only Parent"
111
+ msgstr "Solo Principali"
112
+
113
  # @ yit
114
  #: widgets/class.yith-wcan-reset-navigation-widget.php:21
115
  msgid "Reset all filters setted by YITH WooCommerce Ajax Navigation"
languages/yit.pot CHANGED
@@ -1,6 +1,6 @@
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: YITH WooCommerce Ajax Navigation v1.3.0\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: 2014-01-10 10:28+0100\n"
6
  "PO-Revision-Date: 2014-02-12 15:59+0100\n"
1
  msgid ""
2
  msgstr ""
3
+ "Project-Id-Version: YITH WooCommerce Ajax Navigation v1.3.1\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: 2014-01-10 10:28+0100\n"
6
  "PO-Revision-Date: 2014-02-12 15:59+0100\n"
widgets/class.yith-wcan-navigation-widget.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Ajax Navigation
7
- * @version 1.3.0
8
  */
9
 
10
  if ( !defined( 'YITH_WCAN' ) ) { exit; } // Exit if accessed directly
@@ -32,10 +32,14 @@ if( !class_exists( 'YITH_WCAN' ) ) {
32
  if ( ! is_post_type_archive( 'product' ) && ! is_tax( array_merge( $_attributes_array, array( 'product_cat', 'product_tag' ) ) ) )
33
  return;
34
 
35
- $current_term = $_attributes_array && is_tax( $_attributes_array ) ? get_queried_object()->term_id : '';
36
- $current_tax = $_attributes_array && is_tax( $_attributes_array ) ? get_queried_object()->taxonomy : '';
37
-
38
- $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
 
 
 
 
39
 
40
  /* FIX TO WOOCOMMERCE 2.1 */
41
  if ( function_exists( 'wc_attribute_taxonomy_name' ) ) {
@@ -44,16 +48,10 @@ if( !class_exists( 'YITH_WCAN' ) ) {
44
  $taxonomy = $woocommerce->attribute_taxonomy_name($instance['attribute'] );
45
  }
46
 
47
-
48
-
49
-
50
- $query_type = isset( $instance['query_type'] ) ? $instance['query_type'] : 'and';
51
- $display_type = isset( $instance['type'] ) ? $instance['type'] : 'list';
52
-
53
  if ( ! taxonomy_exists( $taxonomy ) )
54
  return;
55
 
56
- $terms = get_terms( $taxonomy, array( 'hide_empty' => '1' ) );
57
 
58
  if ( count( $terms ) > 0 ) {
59
 
@@ -98,8 +96,9 @@ if( !class_exists( 'YITH_WCAN' ) ) {
98
  if ( $count > 0 && $current_term !== $term->term_id )
99
  $found = true;
100
 
101
- if ( $count == 0 && ! $option_is_set )
102
  continue;
 
103
 
104
  // If this is an OR query, show all options so search can be expanded
105
  } else {
@@ -169,7 +168,7 @@ if( !class_exists( 'YITH_WCAN' ) ) {
169
  // Current Filter = this widget
170
  if ( isset( $_chosen_attributes[ $taxonomy ] ) && is_array( $_chosen_attributes[ $taxonomy ]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) ) {
171
 
172
- $class = 'class="chosen"';
173
 
174
  // Remove this term is $current_filter has more than 1 term filtered
175
  if ( sizeof( $current_filter ) > 1 ) {
@@ -179,7 +178,8 @@ if( !class_exists( 'YITH_WCAN' ) ) {
179
 
180
  } else {
181
 
182
- $class = '';
 
183
  $link = add_query_arg( $arg, implode( ',', $current_filter ), $link );
184
 
185
  }
@@ -196,6 +196,8 @@ if( !class_exists( 'YITH_WCAN' ) ) {
196
  if ( $query_type == 'or' && ! ( sizeof( $current_filter ) == 1 && isset( $_chosen_attributes[ $taxonomy ]['terms'] ) && is_array( $_chosen_attributes[ $taxonomy ]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) ) )
197
  $link = add_query_arg( 'query_type_' . sanitize_title( $instance['attribute'] ), 'or', $link );
198
 
 
 
199
  echo '<li ' . $class . '>';
200
 
201
  echo ( $count > 0 || $option_is_set ) ? '<a href="' . esc_url( apply_filters( 'woocommerce_layered_nav_link', $link ) ) . '">' : '<span>';
@@ -204,7 +206,9 @@ if( !class_exists( 'YITH_WCAN' ) ) {
204
 
205
  echo ( $count > 0 || $option_is_set ) ? '</a>' : '</span>';
206
 
207
- echo ' <small class="count">' . $count . '</small></li>';
 
 
208
 
209
  }
210
 
@@ -246,8 +250,9 @@ if( !class_exists( 'YITH_WCAN' ) ) {
246
  if ( $count > 0 && $current_term !== $term->term_id )
247
  $found = true;
248
 
249
- if ( $count == 0 && ! $option_is_set )
250
- continue;
 
251
 
252
  // If this is an OR query, show all options so search can be expanded
253
  } else {
@@ -317,7 +322,7 @@ if( !class_exists( 'YITH_WCAN' ) ) {
317
  // Current Filter = this widget
318
  if ( isset( $_chosen_attributes[ $taxonomy ] ) && is_array( $_chosen_attributes[ $taxonomy ]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) ) {
319
 
320
- $class = 'class="chosen"';
321
 
322
  // Remove this term is $current_filter has more than 1 term filtered
323
  if ( sizeof( $current_filter ) > 1 ) {
@@ -327,7 +332,7 @@ if( !class_exists( 'YITH_WCAN' ) ) {
327
 
328
  } else {
329
 
330
- $class = '';
331
  $link = add_query_arg( $arg, implode( ',', $current_filter ), $link );
332
 
333
  }
@@ -461,7 +466,7 @@ if( !class_exists( 'YITH_WCAN' ) ) {
461
  // Current Filter = this widget
462
  if ( isset( $_chosen_attributes[ $taxonomy ] ) && is_array( $_chosen_attributes[ $taxonomy ]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) ) {
463
 
464
- $class = 'class="chosen"';
465
 
466
  // Remove this term is $current_filter has more than 1 term filtered
467
  if ( sizeof( $current_filter ) > 1 ) {
@@ -471,7 +476,7 @@ if( !class_exists( 'YITH_WCAN' ) ) {
471
 
472
  } else {
473
 
474
- $class = '';
475
  $link = add_query_arg( $arg, implode( ',', $current_filter ), $link );
476
 
477
  }
@@ -488,16 +493,15 @@ if( !class_exists( 'YITH_WCAN' ) ) {
488
  if ( $query_type == 'or' && ! ( sizeof( $current_filter ) == 1 && isset( $_chosen_attributes[ $taxonomy ]['terms'] ) && is_array( $_chosen_attributes[ $taxonomy ]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) ) )
489
  $link = add_query_arg( 'query_type_' . sanitize_title( $instance['attribute'] ), 'or', $link );
490
 
491
- echo '<li ' . $class . '>';
492
-
493
- echo ( $count > 0 || $option_is_set ) ? '<a style="background-color:' . $instance['colors'][$term->term_id] . ';" href="' . esc_url( apply_filters( 'woocommerce_layered_nav_link', $link ) ) . '" title="' . $term->name . '" >' : '<span style="background-color:' . $instance['colors'][$term->term_id] . ';" >';
494
 
495
- echo $term->name;
496
 
497
- echo ( $count > 0 || $option_is_set ) ? '</a>' : '</span>';
498
-
499
- //echo ' <small class="count">' . $count . '</small></li>';
500
 
 
 
501
  }
502
 
503
  echo "</ul>";
@@ -603,7 +607,7 @@ if( !class_exists( 'YITH_WCAN' ) ) {
603
  // Current Filter = this widget
604
  if ( isset( $_chosen_attributes[ $taxonomy ] ) && is_array( $_chosen_attributes[ $taxonomy ]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) ) {
605
 
606
- $class = 'class="chosen"';
607
 
608
  // Remove this term is $current_filter has more than 1 term filtered
609
  if ( sizeof( $current_filter ) > 1 ) {
@@ -613,7 +617,7 @@ if( !class_exists( 'YITH_WCAN' ) ) {
613
 
614
  } else {
615
 
616
- $class = '';
617
  $link = add_query_arg( $arg, implode( ',', $current_filter ), $link );
618
 
619
  }
@@ -630,16 +634,16 @@ if( !class_exists( 'YITH_WCAN' ) ) {
630
  if ( $query_type == 'or' && ! ( sizeof( $current_filter ) == 1 && isset( $_chosen_attributes[ $taxonomy ]['terms'] ) && is_array( $_chosen_attributes[ $taxonomy ]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) ) )
631
  $link = add_query_arg( 'query_type_' . sanitize_title( $instance['attribute'] ), 'or', $link );
632
 
633
- echo '<li ' . $class . '>';
634
-
635
- echo ( $count > 0 || $option_is_set ) ? '<a title="' . $term->name . '" href="' . esc_url( apply_filters( 'woocommerce_layered_nav_link', $link ) ) . '">' : '<span>';
636
 
637
- echo $instance['labels'][$term->term_id];
638
 
639
- echo ( $count > 0 || $option_is_set ) ? '</a>' : '</span>';
640
 
641
- //echo ' <small class="count">' . $count . '</small></li>';
642
 
 
 
643
  }
644
  echo "</ul>";
645
 
@@ -661,12 +665,13 @@ if( !class_exists( 'YITH_WCAN' ) ) {
661
  global $woocommerce;
662
 
663
  $defaults = array(
664
- 'title' => '',
665
- 'attribute' => '',
666
  'query_type' => 'and',
667
- 'type' => 'list',
668
- 'colors' => '',
669
- 'labels' => ''
 
670
  );
671
 
672
  $instance = wp_parse_args( (array) $instance, $defaults ); ?>
@@ -695,7 +700,17 @@ if( !class_exists( 'YITH_WCAN' ) ) {
695
  <option value="color" <?php selected( 'color', $instance['type'] ) ?>><?php _e( 'Color', 'yit' ) ?></option>
696
  <option value="label" <?php selected( 'label', $instance['type'] ) ?>><?php _e( 'Label', 'yit' ) ?></option>
697
  <option value="select" <?php selected( 'select', $instance['type'] ) ?>><?php _e( 'Dropdown', 'yit' ) ?></option>
698
- </select></p>
 
 
 
 
 
 
 
 
 
 
699
 
700
  <div class="yith_wcan_placeholder">
701
  <?php yith_wcan_attributes_table(
@@ -703,7 +718,8 @@ if( !class_exists( 'YITH_WCAN' ) ) {
703
  $instance['attribute'],
704
  'widget-' . $this->id . '-',
705
  'widget-' . $this->id_base . '[' . $this->number . ']',
706
- $instance['type'] == 'color' ? $instance['colors'] : ( $instance['type'] == 'label' ? $instance['labels'] : array() )
 
707
  );
708
  ?>
709
  </div>
@@ -731,6 +747,7 @@ if( !class_exists( 'YITH_WCAN' ) ) {
731
  $instance['type'] = stripslashes( $new_instance['type'] );
732
  $instance['colors'] = $new_instance['colors'];
733
  $instance['labels'] = $new_instance['labels'];
 
734
 
735
  return $instance;
736
  }
4
  *
5
  * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Ajax Navigation
7
+ * @version 1.3.1
8
  */
9
 
10
  if ( !defined( 'YITH_WCAN' ) ) { exit; } // Exit if accessed directly
32
  if ( ! is_post_type_archive( 'product' ) && ! is_tax( array_merge( $_attributes_array, array( 'product_cat', 'product_tag' ) ) ) )
33
  return;
34
 
35
+ $current_term = $_attributes_array && is_tax( $_attributes_array ) ? get_queried_object()->term_id : '';
36
+ $current_tax = $_attributes_array && is_tax( $_attributes_array ) ? get_queried_object()->taxonomy : '';
37
+ $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
38
+ $query_type = isset( $instance['query_type'] ) ? $instance['query_type'] : 'and';
39
+ $display_type = isset( $instance['type'] ) ? $instance['type'] : 'list';
40
+ $is_child_class = 'yit-wcan-child-terms';
41
+ $is_chosen_class = 'chosen';
42
+ $terms_type_list = ( isset( $instance['display'] ) && ( $display_type == 'list' || $display_type == 'select' ) ) ? $instance['display'] : 'all';
43
 
44
  /* FIX TO WOOCOMMERCE 2.1 */
45
  if ( function_exists( 'wc_attribute_taxonomy_name' ) ) {
48
  $taxonomy = $woocommerce->attribute_taxonomy_name($instance['attribute'] );
49
  }
50
 
 
 
 
 
 
 
51
  if ( ! taxonomy_exists( $taxonomy ) )
52
  return;
53
 
54
+ $terms = yit_get_terms( $terms_type_list, $taxonomy );
55
 
56
  if ( count( $terms ) > 0 ) {
57
 
96
  if ( $count > 0 && $current_term !== $term->term_id )
97
  $found = true;
98
 
99
+ if ( ( $terms_type_list != 'hierarchical' || ! yit_term_has_child($term, $taxonomy) ) && $count == 0 && ! $option_is_set ){
100
  continue;
101
+ }
102
 
103
  // If this is an OR query, show all options so search can be expanded
104
  } else {
168
  // Current Filter = this widget
169
  if ( isset( $_chosen_attributes[ $taxonomy ] ) && is_array( $_chosen_attributes[ $taxonomy ]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) ) {
170
 
171
+ $class = ( $terms_type_list == 'hierarchical' && yit_term_is_child( $term ) ) ? "class='{$is_chosen_class} {$is_child_class}'" : "class='{$is_chosen_class}'";
172
 
173
  // Remove this term is $current_filter has more than 1 term filtered
174
  if ( sizeof( $current_filter ) > 1 ) {
178
 
179
  } else {
180
 
181
+ $class = ($terms_type_list == 'hierarchical' && yit_term_is_child( $term ) ) ? "class='{$is_child_class}'" : '';
182
+
183
  $link = add_query_arg( $arg, implode( ',', $current_filter ), $link );
184
 
185
  }
196
  if ( $query_type == 'or' && ! ( sizeof( $current_filter ) == 1 && isset( $_chosen_attributes[ $taxonomy ]['terms'] ) && is_array( $_chosen_attributes[ $taxonomy ]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) ) )
197
  $link = add_query_arg( 'query_type_' . sanitize_title( $instance['attribute'] ), 'or', $link );
198
 
199
+
200
+
201
  echo '<li ' . $class . '>';
202
 
203
  echo ( $count > 0 || $option_is_set ) ? '<a href="' . esc_url( apply_filters( 'woocommerce_layered_nav_link', $link ) ) . '">' : '<span>';
206
 
207
  echo ( $count > 0 || $option_is_set ) ? '</a>' : '</span>';
208
 
209
+ if( $count != 0 ) {
210
+ echo ' <small class="count">' . $count . '</small></li>';
211
+ }
212
 
213
  }
214
 
250
  if ( $count > 0 && $current_term !== $term->term_id )
251
  $found = true;
252
 
253
+ if ( ( $terms_type_list != 'hierarchical' || ! yit_term_has_child($term, $taxonomy) ) && $count == 0 && ! $option_is_set ){
254
+ continue;
255
+ }
256
 
257
  // If this is an OR query, show all options so search can be expanded
258
  } else {
322
  // Current Filter = this widget
323
  if ( isset( $_chosen_attributes[ $taxonomy ] ) && is_array( $_chosen_attributes[ $taxonomy ]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) ) {
324
 
325
+ $class = ( $terms_type_list == 'hierarchical' && yit_term_is_child( $term ) ) ? "class='{$is_chosen_class} {$is_child_class}'" : "class='{$is_chosen_class}'";
326
 
327
  // Remove this term is $current_filter has more than 1 term filtered
328
  if ( sizeof( $current_filter ) > 1 ) {
332
 
333
  } else {
334
 
335
+ $class = ($terms_type_list == 'hierarchical' && yit_term_is_child( $term ) ) ? "class='{$is_child_class}'" : '';
336
  $link = add_query_arg( $arg, implode( ',', $current_filter ), $link );
337
 
338
  }
466
  // Current Filter = this widget
467
  if ( isset( $_chosen_attributes[ $taxonomy ] ) && is_array( $_chosen_attributes[ $taxonomy ]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) ) {
468
 
469
+ $class = ( $terms_type_list == 'hierarchical' && yit_term_is_child( $term ) ) ? "class='{$is_chosen_class} {$is_child_class}'" : "class='{$is_chosen_class}'";
470
 
471
  // Remove this term is $current_filter has more than 1 term filtered
472
  if ( sizeof( $current_filter ) > 1 ) {
476
 
477
  } else {
478
 
479
+ $class = ($terms_type_list == 'hierarchical' && yit_term_is_child( $term ) ) ? "class='{$is_child_class}'" : '';
480
  $link = add_query_arg( $arg, implode( ',', $current_filter ), $link );
481
 
482
  }
493
  if ( $query_type == 'or' && ! ( sizeof( $current_filter ) == 1 && isset( $_chosen_attributes[ $taxonomy ]['terms'] ) && is_array( $_chosen_attributes[ $taxonomy ]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) ) )
494
  $link = add_query_arg( 'query_type_' . sanitize_title( $instance['attribute'] ), 'or', $link );
495
 
496
+ if( $instance['colors'][$term->term_id] != '' ) {
497
+ echo '<li ' . $class . '>';
 
498
 
499
+ echo ( $count > 0 || $option_is_set ) ? '<a style="background-color:' . $instance['colors'][$term->term_id] . ';" href="' . esc_url( apply_filters( 'woocommerce_layered_nav_link', $link ) ) . '" title="' . $term->name . '" >' : '<span style="background-color:' . $instance['colors'][$term->term_id] . ';" >';
500
 
501
+ echo $term->name;
 
 
502
 
503
+ echo ( $count > 0 || $option_is_set ) ? '</a>' : '</span>';
504
+ }
505
  }
506
 
507
  echo "</ul>";
607
  // Current Filter = this widget
608
  if ( isset( $_chosen_attributes[ $taxonomy ] ) && is_array( $_chosen_attributes[ $taxonomy ]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) ) {
609
 
610
+ $class = ( $terms_type_list == 'hierarchical' && yit_term_is_child( $term ) ) ? "class='{$is_chosen_class} {$is_child_class}'" : "class='{$is_chosen_class}'";
611
 
612
  // Remove this term is $current_filter has more than 1 term filtered
613
  if ( sizeof( $current_filter ) > 1 ) {
617
 
618
  } else {
619
 
620
+ $class = ($terms_type_list == 'hierarchical' && yit_term_is_child( $term ) ) ? "class='{$is_child_class}'" : '';
621
  $link = add_query_arg( $arg, implode( ',', $current_filter ), $link );
622
 
623
  }
634
  if ( $query_type == 'or' && ! ( sizeof( $current_filter ) == 1 && isset( $_chosen_attributes[ $taxonomy ]['terms'] ) && is_array( $_chosen_attributes[ $taxonomy ]['terms'] ) && in_array( $term->term_id, $_chosen_attributes[ $taxonomy ]['terms'] ) ) )
635
  $link = add_query_arg( 'query_type_' . sanitize_title( $instance['attribute'] ), 'or', $link );
636
 
637
+ if($instance['labels'][$term->term_id] != '' ){
 
 
638
 
639
+ echo '<li ' . $class . '>';
640
 
641
+ echo ( $count > 0 || $option_is_set ) ? '<a title="' . $term->name . '" href="' . esc_url( apply_filters( 'woocommerce_layered_nav_link', $link ) ) . '">' : '<span>';
642
 
643
+ echo $instance['labels'][$term->term_id];
644
 
645
+ echo ( $count > 0 || $option_is_set ) ? '</a>' : '</span>';
646
+ }
647
  }
648
  echo "</ul>";
649
 
665
  global $woocommerce;
666
 
667
  $defaults = array(
668
+ 'title' => '',
669
+ 'attribute' => '',
670
  'query_type' => 'and',
671
+ 'type' => 'list',
672
+ 'colors' => '',
673
+ 'labels' => '',
674
+ 'display' => 'all'
675
  );
676
 
677
  $instance = wp_parse_args( (array) $instance, $defaults ); ?>
700
  <option value="color" <?php selected( 'color', $instance['type'] ) ?>><?php _e( 'Color', 'yit' ) ?></option>
701
  <option value="label" <?php selected( 'label', $instance['type'] ) ?>><?php _e( 'Label', 'yit' ) ?></option>
702
  <option value="select" <?php selected( 'select', $instance['type'] ) ?>><?php _e( 'Dropdown', 'yit' ) ?></option>
703
+ </select>
704
+ </p>
705
+
706
+ <p id="yit-wcan-display" class="yit-wcan-display-<?php echo $instance['type'] ?>">
707
+ <label for="<?php echo $this->get_field_id('display'); ?>"><strong><?php _e('Display (default All):', 'yit') ?></strong></label>
708
+ <select class="yith_wcan_type widefat" id="<?php echo esc_attr( $this->get_field_id('display') ); ?>" name="<?php echo esc_attr( $this->get_field_name('display') ); ?>">
709
+ <option value="all" <?php selected( 'all', $instance['display'] ) ?>> <?php _e( 'All (no hierarchical)', 'yit' ) ?></option>
710
+ <option value="hierarchical" <?php selected( 'hierarchical', $instance['display'] ) ?>> <?php _e( 'All Hierarchical', 'yit' ) ?> </option>
711
+ <option value="parent" <?php selected( 'parent', $instance['display'] ) ?>> <?php _e( 'Only Parent', 'yit' ) ?> </option>
712
+ </select>
713
+ </p>
714
 
715
  <div class="yith_wcan_placeholder">
716
  <?php yith_wcan_attributes_table(
718
  $instance['attribute'],
719
  'widget-' . $this->id . '-',
720
  'widget-' . $this->id_base . '[' . $this->number . ']',
721
+ $instance['type'] == 'color' ? $instance['colors'] : ( $instance['type'] == 'label' ? $instance['labels'] : array() ),
722
+ $instance['display']
723
  );
724
  ?>
725
  </div>
747
  $instance['type'] = stripslashes( $new_instance['type'] );
748
  $instance['colors'] = $new_instance['colors'];
749
  $instance['labels'] = $new_instance['labels'];
750
+ $instance['display'] = $new_instance['display'];
751
 
752
  return $instance;
753
  }
widgets/class.yith-wcan-reset-navigation-widget.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Ajax Navigation
7
- * @version 1.3.0
8
  */
9
 
10
  if ( !defined( 'YITH_WCAN' ) ) { exit; } // Exit if accessed directly
4
  *
5
  * @author Your Inspiration Themes
6
  * @package YITH WooCommerce Ajax Navigation
7
+ * @version 1.3.1
8
  */
9
 
10
  if ( !defined( 'YITH_WCAN' ) ) { exit; } // Exit if accessed directly