YITH WooCommerce Ajax Product Filter - Version 2.7.0

Version Description

  • Fixed: Click on row to filter in dropdown style
  • Removed: var_dump() in product filter widget
Download this release

Release Info

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

Code changes from version 2.6.0 to 2.7.0

Files changed (48) hide show
  1. README.txt +7 -2
  2. assets/css/admin.css +209 -205
  3. assets/css/frontend.css +279 -269
  4. assets/images/06.png +0 -0
  5. assets/images/07.png +0 -0
  6. assets/images/08-bg.png +0 -0
  7. assets/images/08-icon.png +0 -0
  8. assets/images/08.png +0 -0
  9. assets/js/yith-wcan-admin.js +117 -117
  10. assets/js/yith-wcan-frontend.js +321 -312
  11. assets/js/yith-wcan-frontend.min.js +11 -11
  12. includes/class.yith-wcan-admin.php +275 -275
  13. includes/class.yith-wcan-frontend.php +138 -138
  14. includes/class.yith-wcan-helper.php +65 -65
  15. includes/class.yith-wcan.php +173 -173
  16. includes/functions.yith-wcan.php +502 -502
  17. init.php +2 -2
  18. languages/yith-woocommerce-ajax-navigation-it_IT.mo +0 -0
  19. languages/yith-woocommerce-ajax-navigation-it_IT.po +2 -2
  20. languages/yith-woocommerce-ajax-navigation-tr_TR.mo +0 -0
  21. languages/yith-woocommerce-ajax-navigation-tr_TR.po +2 -2
  22. languages/yith-woocommerce-ajax-navigation.pot +1 -1
  23. plugin-fw/assets/css/metaboxes.css +21 -0
  24. plugin-fw/assets/css/yit-plugin-panel.css +4 -0
  25. plugin-fw/assets/js/yit-plugin-panel.js +10 -0
  26. plugin-fw/assets/js/yit-plugin-panel.min.js +10 -1
  27. plugin-fw/init.php +13 -15
  28. plugin-fw/languages/yith-plugin-fw-it_IT.mo +0 -0
  29. plugin-fw/languages/yith-plugin-fw-it_IT.po +223 -133
  30. plugin-fw/languages/yith-plugin-fw.pot +148 -108
  31. plugin-fw/lib/yit-plugin-panel-wc.php +8 -3
  32. plugin-fw/lib/yit-plugin-panel.php +23 -14
  33. plugin-fw/lib/yit-plugin-subpanel.php +12 -9
  34. plugin-fw/lib/yit-upgrade.php +9 -25
  35. plugin-fw/licence/assets/css/yit-licence.css +112 -23
  36. plugin-fw/licence/assets/js/yit-licence.js +82 -25
  37. plugin-fw/licence/lib/yit-licence.php +201 -54
  38. plugin-fw/licence/lib/yit-plugin-licence.php +17 -15
  39. plugin-fw/licence/lib/yit-theme-licence.php +61 -24
  40. plugin-fw/licence/templates/panel/activation/activation-panel.php +127 -54
  41. plugin-fw/templates/metaboxes/types/number.php +14 -1
  42. plugin-fw/templates/panel/types/upload.php +2 -1
  43. plugin-fw/yit-functions.php +261 -236
  44. settings/custom-style-options.php +39 -39
  45. settings/frontend-options.php +60 -60
  46. templates/admin/premium.php +17 -1
  47. widgets/class.yith-wcan-navigation-widget.php +947 -912
  48. widgets/class.yith-wcan-reset-navigation-widget.php +111 -111
README.txt CHANGED
@@ -3,8 +3,8 @@
3
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.3.1
7
- Stable tag: 2.6.0
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -159,6 +159,11 @@ If you want to see a demonstration version of the premium plugin, you can see it
159
160
== Changelog ==
161
162
= 2.6.0 =
163
164
* Added: yith_wcan_show_widget hook to manage the widgets display condition
3
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.4
7
+ Stable tag: 2.7.0
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
159
160
== Changelog ==
161
162
+ = 2.7.0 =
163
+
164
+ * Fixed: Click on row to filter in dropdown style
165
+ * Removed: var_dump() in product filter widget
166
+
167
= 2.6.0 =
168
169
* Added: yith_wcan_show_widget hook to manage the widgets display condition
assets/css/admin.css CHANGED
@@ -1,206 +1,210 @@
1
- /* widget area */
2
- .yith_wcan_placeholder + .spinner {
3
- background-position: center;
4
- float: left;
5
- margin: 10px 0;
6
- width: 100%;
7
- }
8
-
9
- .yith_wcan_placeholder table {
10
- width: 100%;
11
- }
12
-
13
- .yith_wcan_placeholder th {
14
- text-align: left;
15
- }
16
-
17
- .yith_wcan_placeholder td {
18
- vertical-align: middle;
19
- }
20
-
21
- p.yit-wcan-display-label,
22
- p.yit-wcan-display-color,
23
- p#yit-wcan-style,
24
- p#yit-wcan-show-count,
25
- p.yit-wcan-display-tags,
26
- div.yit-wcan-widget-tag-list {
27
- display: none;
28
- }
29
-
30
- div.yit-wcan-widget-tag-list.tags{
31
- display: block;
32
- }
33
-
34
- p#yit-wcan-style.yit-wcan-style-color,
35
- p#yit-wcan-style.yit-wcan-style-multicolor,
36
- p#yit-wcan-show-count.yit-wcan-show-count-list,
37
- p#yit-wcan-show-count.yit-wcan-show-count-brands,
38
- p#yit-wcan-show-count.yit-wcan-show-count-tags{
39
- display: block;
40
- }
41
-
42
- label.yith-wcan-reset-table{
43
- width: 50%;
44
- display: inline-block;
45
- vertical-align: top;
46
- }
47
-
48
- /* Options Panel Customizzation */
49
-
50
- .plugin-option .form-table tr {
51
- background-color: #ffffff;
52
- border: none;
53
- }
54
-
55
- .plugin-option .form-table tr th {
56
- padding: 20px 10px 20px 20px;
57
- }
58
-
59
- .yith_wcan_placeholder .wp-picker-holder {
60
- position: absolute;
61
- z-index: 999;
62
- }
63
-
64
- .yith-wcan-multicolor .wp-picker-container .wp-picker-clear {
65
- display: none;
66
- }
67
-
68
- /* == Panel Customization === */
69
-
70
- .yit-plugins_page_yith_wcan_panel .plugin-option{
71
- margin-right: 15px;
72
- }
73
-
74
- .yit-plugins_page_yith_wcan_panel .plugin-option .yit-options .option, .plugin-option .yit_options .option {
75
- width: 270px;
76
- }
77
-
78
- .yit-plugins_page_yith_wcan_panel .plugin-option .yit-options .option, .plugin-option .yit_options.on_off_container .option {
79
- width: 100px;
80
- }
81
-
82
- .yit-plugins_page_yith_wcan_panel .plugin-option .yit-options .option, .plugin-option .yit_options.on_off_container .description {
83
- line-height: 38px;
84
- }
85
-
86
- .yit-plugins_page_yith_wcan_panel .plugin-option .form-table tr th {
87
- width: 240px;
88
- }
89
-
90
- div#yit_wcan_options_yith_wcan_dropdown_style-container .select_wrapper,
91
- div#yit_wcan_options_yith_wcan_tag_query_option-container .select_wrapper {
92
- width: 220px;
93
- }
94
-
95
- input.yith-wcan-price-filter-input.widefat {
96
- width: 30%;
97
- display: inline-block;
98
- margin-bottom: 10px;
99
- margin-right: 15px;
100
- }
101
-
102
- .yith-wcan-price-filter label {
103
- display: block;
104
- margin-bottom: 15px;
105
- }
106
-
107
- .yith-add-new-range-button {
108
- margin-bottom: 15px;
109
- }
110
-
111
- .plugin-option .form-table td .yith_wcan_select_tag tbody td,
112
- .plugin-option .form-table td .yith_wcan_select_tag thead td{
113
- padding: 5px 5px 5px 0;
114
- line-height: 0;
115
- }
116
-
117
- .plugin-option .form-table td .yith_wcan_select_tag tbody td.term_count{
118
- text-align: center;
119
- }
120
-
121
- .plugin-option .form-table td .yith_wcan_select_tag thead {
122
- margin-bottom: 15px;
123
- }
124
-
125
- .plugin-option .form-table td .yith_wcan_select_tag thead td{
126
- font-weight: bold;
127
- text-transform: uppercase;
128
- padding-bottom: 25px;
129
- }
130
-
131
- .yith_wcan_select_tag_wrapper {
132
- max-height: 150px;
133
- overflow-y: scroll;
134
- overflow-x: hidden;
135
- }
136
-
137
- .yith_wcan_select_tag_wrapper .term_count{
138
- text-align: center;
139
- }
140
-
141
- .yith_wcan_tags_query_type{
142
- margin-bottom: 15px;
143
- }
144
-
145
- .yith-wcan-select-option .select-all {
146
- margin-right: 15px;
147
- }
148
- .yith-wcan-select-option .select-all,
149
- .yith-wcan-select-option .unselect-all {
150
- text-decoration: none;
151
- font-size: 12px;
152
- font-weight: bold;
153
- text-transform: uppercase;
154
- margin-bottom: 5px;
155
- display: inline-block;
156
- }
157
-
158
- .yith-wcan-select-option a.select-all:focus,
159
- .yith-wcan-select-option a.unselect-all:focus{
160
- -webkit-box-shadow: none;
161
- box-shadow: none;
162
- }
163
-
164
- .yith-wcan-admin-note {
165
- display: block;
166
- font-style: italic;
167
- }
168
-
169
- .yith-wcan-admin-note-star {
170
- font-size: 8px;
171
- }
172
-
173
- #yith-wcan-tag-list-messages {
174
- display: none;
175
- background-color: #FAFAFA ;
176
- border: 1px solid #e5e5e5;
177
- -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.04);
178
- box-shadow: 0 1px 1px rgba(0,0,0,.04);
179
- padding: 5px;
180
- border-radius: 5px;
181
- font-size: 12px;
182
- }
183
-
184
- input#yit_wcan_options_yith_wcan_ajax_shop_pagination,
185
- input#yit_wcan_options_yith_wcan_ajax_shop_container,
186
- input#yit_wcan_options_yith_wcan_ajax_shop_result_container,
187
- input#yit_wcan_options_yith_wcan_ajax_widget_title_class,
188
- input#yit_wcan_options_yith_wcan_ajax_widget_title_tag {
189
- width: 230px;
190
- }
191
-
192
- div#yit_wcan_options_yith_wcan_custom_style-container .option {
193
- width: 85%;
194
- }
195
-
196
- textarea#yit_wcan_options_yith_wcan_custom_style {
197
- min-height: 300px;
198
- padding: 8px;
199
- resize: none;
200
- }
201
-
202
- div#yit_wcan_options_yith_wcan_seo_value-container .option,
203
- div#yit_wcan_options_yith_wcan_seo_value-container .option .select_wrapper,
204
- #yit_wcan_options_yith_wcan_seo_option-container .select_wrapper {
205
- width: auto;
206
}
1
+ /* widget area */
2
+ .yith_wcan_placeholder + .spinner {
3
+ background-position: center;
4
+ float: left;
5
+ margin: 10px 0;
6
+ width: 100%;
7
+ }
8
+
9
+ .yith_wcan_placeholder table {
10
+ width: 100%;
11
+ }
12
+
13
+ .yith_wcan_placeholder th {
14
+ text-align: left;
15
+ }
16
+
17
+ .yith_wcan_placeholder td {
18
+ vertical-align: middle;
19
+ }
20
+
21
+ p.yit-wcan-display-label,
22
+ p.yit-wcan-display-color,
23
+ p#yit-wcan-style,
24
+ p#yit-wcan-show-count,
25
+ p.yit-wcan-display-tags,
26
+ div.yit-wcan-widget-tag-list {
27
+ display: none;
28
+ }
29
+
30
+ div.yit-wcan-widget-tag-list.tags{
31
+ display: block;
32
+ }
33
+
34
+ p#yit-wcan-style.yit-wcan-style-color,
35
+ p#yit-wcan-style.yit-wcan-style-multicolor,
36
+ p#yit-wcan-show-count.yit-wcan-show-count-list,
37
+ p#yit-wcan-show-count.yit-wcan-show-count-brands,
38
+ p#yit-wcan-show-count.yit-wcan-show-count-tags{
39
+ display: block;
40
+ }
41
+
42
+ label.yith-wcan-reset-table{
43
+ width: 50%;
44
+ display: inline-block;
45
+ vertical-align: top;
46
+ }
47
+
48
+ /* Options Panel Customizzation */
49
+
50
+ .plugin-option .form-table tr {
51
+ background-color: #ffffff;
52
+ border: none;
53
+ }
54
+
55
+ .plugin-option .form-table tr th {
56
+ padding: 20px 10px 20px 20px;
57
+ }
58
+
59
+ .yith_wcan_placeholder .wp-picker-holder {
60
+ position: absolute;
61
+ z-index: 999;
62
+ }
63
+
64
+ .yith-wcan-multicolor .wp-picker-container .wp-picker-clear {
65
+ display: none;
66
+ }
67
+
68
+ /* == Panel Customization === */
69
+
70
+ .yit-plugins_page_yith_wcan_panel .plugin-option{
71
+ margin-right: 15px;
72
+ }
73
+
74
+ .yit-plugins_page_yith_wcan_panel .plugin-option .yit-options .option, .plugin-option .yit_options .option {
75
+ width: 270px;
76
+ }
77
+
78
+ .yit-plugins_page_yith_wcan_panel .plugin-option .yit-options .option, .plugin-option .yit_options .option.yit-upload {
79
+ width: 350px;
80
+ }
81
+
82
+ .yit-plugins_page_yith_wcan_panel .plugin-option .yit-options .option, .plugin-option .yit_options.on_off_container .option {
83
+ width: 100px;
84
+ }
85
+
86
+ .yit-plugins_page_yith_wcan_panel .plugin-option .yit-options .option, .plugin-option .yit_options.on_off_container .description {
87
+ line-height: 38px;
88
+ }
89
+
90
+ .yit-plugins_page_yith_wcan_panel .plugin-option .form-table tr th {
91
+ width: 240px;
92
+ }
93
+
94
+ div#yit_wcan_options_yith_wcan_dropdown_style-container .select_wrapper,
95
+ div#yit_wcan_options_yith_wcan_tag_query_option-container .select_wrapper {
96
+ width: 220px;
97
+ }
98
+
99
+ input.yith-wcan-price-filter-input.widefat {
100
+ width: 30%;
101
+ display: inline-block;
102
+ margin-bottom: 10px;
103
+ margin-right: 15px;
104
+ }
105
+
106
+ .yith-wcan-price-filter label {
107
+ display: block;
108
+ margin-bottom: 15px;
109
+ }
110
+
111
+ .yith-add-new-range-button {
112
+ margin-bottom: 15px;
113
+ }
114
+
115
+ .plugin-option .form-table td .yith_wcan_select_tag tbody td,
116
+ .plugin-option .form-table td .yith_wcan_select_tag thead td{
117
+ padding: 5px 5px 5px 0;
118
+ line-height: 0;
119
+ }
120
+
121
+ .plugin-option .form-table td .yith_wcan_select_tag tbody td.term_count{
122
+ text-align: center;
123
+ }
124
+
125
+ .plugin-option .form-table td .yith_wcan_select_tag thead {
126
+ margin-bottom: 15px;
127
+ }
128
+
129
+ .plugin-option .form-table td .yith_wcan_select_tag thead td{
130
+ font-weight: bold;
131
+ text-transform: uppercase;
132
+ padding-bottom: 25px;
133
+ }
134
+
135
+ .yith_wcan_select_tag_wrapper {
136
+ max-height: 150px;
137
+ overflow-y: scroll;
138
+ overflow-x: hidden;
139
+ }
140
+
141
+ .yith_wcan_select_tag_wrapper .term_count{
142
+ text-align: center;
143
+ }
144
+
145
+ .yith_wcan_tags_query_type{
146
+ margin-bottom: 15px;
147
+ }
148
+
149
+ .yith-wcan-select-option .select-all {
150
+ margin-right: 15px;
151
+ }
152
+ .yith-wcan-select-option .select-all,
153
+ .yith-wcan-select-option .unselect-all {
154
+ text-decoration: none;
155
+ font-size: 12px;
156
+ font-weight: bold;
157
+ text-transform: uppercase;
158
+ margin-bottom: 5px;
159
+ display: inline-block;
160
+ }
161
+
162
+ .yith-wcan-select-option a.select-all:focus,
163
+ .yith-wcan-select-option a.unselect-all:focus{
164
+ -webkit-box-shadow: none;
165
+ box-shadow: none;
166
+ }
167
+
168
+ .yith-wcan-admin-note {
169
+ display: block;
170
+ font-style: italic;
171
+ }
172
+
173
+ .yith-wcan-admin-note-star {
174
+ font-size: 8px;
175
+ }
176
+
177
+ #yith-wcan-tag-list-messages {
178
+ display: none;
179
+ background-color: #FAFAFA ;
180
+ border: 1px solid #e5e5e5;
181
+ -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.04);
182
+ box-shadow: 0 1px 1px rgba(0,0,0,.04);
183
+ padding: 5px;
184
+ border-radius: 5px;
185
+ font-size: 12px;
186
+ }
187
+
188
+ input#yit_wcan_options_yith_wcan_ajax_shop_pagination,
189
+ input#yit_wcan_options_yith_wcan_ajax_shop_container,
190
+ input#yit_wcan_options_yith_wcan_ajax_shop_result_container,
191
+ input#yit_wcan_options_yith_wcan_ajax_widget_title_class,
192
+ input#yit_wcan_options_yith_wcan_ajax_widget_title_tag {
193
+ width: 230px;
194
+ }
195
+
196
+ div#yit_wcan_options_yith_wcan_custom_style-container .option {
197
+ width: 85%;
198
+ }
199
+
200
+ textarea#yit_wcan_options_yith_wcan_custom_style {
201
+ min-height: 300px;
202
+ padding: 8px;
203
+ resize: none;
204
+ }
205
+
206
+ div#yit_wcan_options_yith_wcan_seo_value-container .option,
207
+ div#yit_wcan_options_yith_wcan_seo_value-container .option .select_wrapper,
208
+ #yit_wcan_options_yith_wcan_seo_option-container .select_wrapper {
209
+ width: auto;
210
}
assets/css/frontend.css CHANGED
@@ -1,269 +1,279 @@
1
- .yith-wcan-group:after {
2
- content: "";
3
- display: table;
4
- clear: both;
5
- }
6
-
7
- .yith-wcan-loading {
8
- background: url('../images/ajax-loader.gif') no-repeat center;
9
- height: 100px;
10
- }
11
-
12
- .woocommerce .widget_layered_nav ul.yith-wcan li span,
13
- .woocommerce-page .widget_layered_nav ul.yith-wcan li span {
14
- cursor: not-allowed;
15
- }
16
-
17
- /* Colors Type */
18
- .yith-wcan-color li {
19
- float: left;
20
- }
21
-
22
- .woocommerce .widget_layered_nav ul.yith-wcan-color li a,
23
- .woocommerce-page .widget_layered_nav ul.yith-wcan-color li a,
24
- .woocommerce .widget_layered_nav ul.yith-wcan-color li span,
25
- .woocommerce-page .widget_layered_nav ul.yith-wcan-color li span {
26
- border: 1px solid #ddd;
27
- display: block;
28
- height: 20px;
29
- margin: 5px 5px 5px 0;
30
- padding: 0;
31
- width: 20px;
32
- overflow: hidden;
33
- text-indent: 100%;
34
- white-space: nowrap;
35
- box-sizing: content-box;
36
- }
37
-
38
- .woocommerce .widget_layered_nav ul.yith-wcan-color li a:hover,
39
- .woocommerce-page .widget_layered_nav ul.yith-wcan-color li a:hover,
40
- .woocommerce .widget_layered_nav ul.yith-wcan-color li.chosen a,
41
- .woocommerce-page .widget_layered_nav ul.yith-wcan-color li.chosen a,
42
- .woocommerce .widget_layered_nav ul.yith-wcan-color li span:hover,
43
- .woocommerce-page .widget_layered_nav ul.yith-wcan-color li span:hover,
44
- .woocommerce .widget_layered_nav ul.yith-wcan-color li.chosen span,
45
- .woocommerce-page .widget_layered_nav ul.yith-wcan-color li.chosen span {
46
- border: 1px solid #444;
47
- background-image: none;
48
- -webkit-border-radius: 0;
49
- -moz-border-radius: 0;
50
- border-radius: 0;
51
- }
52
-
53
- /* Labels Type */
54
- .yith-wcan-label li {
55
- float: left;
56
- }
57
-
58
- .woocommerce .widget_layered_nav ul.yith-wcan-label li a,
59
- .woocommerce-page .widget_layered_nav ul.yith-wcan-label li a,
60
- .woocommerce .widget_layered_nav ul.yith-wcan-label li span,
61
- .woocommerce-page .widget_layered_nav ul.yith-wcan-label li span {
62
- background: #efefef;
63
- border: 1px solid #ddd;
64
- display: block;
65
- margin: 5px 5px 5px 0;
66
- padding: 2px;
67
- overflow: hidden;
68
- text-decoration: none;
69
- }
70
-
71
- .woocommerce .widget_layered_nav ul.yith-wcan-label li a:hover,
72
- .woocommerce-page .widget_layered_nav ul.yith-wcan-label li a:hover,
73
- .woocommerce .widget_layered_nav ul.yith-wcan-label li.chosen a,
74
- .woocommerce-page .widget_layered_nav ul.yith-wcan-label li.chosen a {
75
- border: 1px solid #444;
76
- background-image: none;
77
- background-color: #ad74a2;
78
- color: #fff;
79
-
80
- -webkit-border-radius: 0;
81
- -moz-border-radius: 0;
82
- border-radius: 0;
83
- }
84
-
85
- /* DROPDOWN STYLE */
86
-
87
- .yit-wcan-select-open {
88
- background: transparent url(../images/select-arrow.png) top 15px right no-repeat;
89
- border: 1px solid #cecece;
90
- color: #838383;
91
- display: block;
92
- line-height: 16px;
93
- margin-bottom: 15px;
94
- margin-top: 15px;
95
- overflow: hidden;
96
- padding: 10px 30px 10px 10px;
97
- }
98
-
99
- .yit-wcan-select-open.active {
100
- background: transparent url(../images/select-arrow.png) bottom 15px right no-repeat;
101
- }
102
-
103
- .yith-wcan-select-wrapper {
104
- background: #ffffff;
105
- margin: 0 4px 4px 0;
106
- max-height: 240px;
107
- padding-bottom: 30px;
108
- position: absolute;
109
- overflow-x: hidden;
110
- overflow-y: auto;
111
- max-width: 268px;
112
- width: 100%;
113
- z-index: -1;
114
- border: 1px solid #cecece;
115
- padding: 10px 0px;
116
- margin-top: -16px;
117
- }
118
-
119
- .widget-area .yith-wcan-select-wrapper {
120
- max-width: 260px;
121
- }
122
-
123
- .yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li {
124
- padding: 5px 8px;
125
- border-bottom: 1px solid transparent;
126
- border-top: 1px solid transparent;
127
- }
128
-
129
- .yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li:hover,
130
- .woocommerce-page .widget_layered_nav .yith-wcan-select-wrapper ul li.chosen {
131
- -webkit-box-shadow: 0px 3px 0px #F2F2F2 inset, 0px -3px 0px #F2F2F2 inset;
132
- -moz-box-shadow: 0px 3px 0px #f2f2f2 inset, 0px -3px 0px #f2f2f2 inset;
133
- box-shadow: 0px 3px 0px #F2F2F2 inset, 0px -3px 0px #F2F2F2 inset;
134
- border-bottom: 1px solid #cecece;
135
- border-top: 1px solid #cecece;
136
- }
137
-
138
- .yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li a, .widget .yit-wcan-select-open {
139
- width: 100%;
140
- color: #838383;
141
- box-sizing: border-box;
142
- -moz-box-sizing: border-box; /* Firefox */
143
- }
144
-
145
- .yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li a, .widget .yit-wcan-select-open {
146
- width: auto;
147
- }
148
-
149
- .yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li a:hover, .widget .yit-wcan-select-open:hover {
150
- text-decoration: none;
151
- color: #838383;
152
- }
153
-
154
- .woocommerce-page .widget_layered_nav .yith-wcan-select-wrapper ul li.chosen a, .woocommerce-page .widget_layered_nav .yith-wcan-select-wrapper ul li.chosen a {
155
- background: transparent url(../images/cross.png) bottom 6px left no-repeat;
156
- border: none;
157
- }
158
-
159
- /* WooCommerce 2.1.X Fix */
160
- .woocommerce .widget_layered_nav ul.yith-wcan-select li.chosen a:before,
161
- .woocommerce-page .widget_layered_nav ul.yith-wcan-select li.chosen a:before {
162
- content: "";
163
- }
164
-
165
- /* Hierarchical Order */
166
- .widget.widget_layered_nav li.yit-wcan-child-terms {
167
- padding-left: 30px;
168
- }
169
-
170
- .yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li.yit-wcan-child-terms {
171
- padding-left: 30px;
172
- }
173
-
174
- /* widget dropdown */
175
- .widget h1.with-dropdown,
176
- .widget h2.with-dropdown,
177
- .widget h3.with-dropdown,
178
- .widget h4.with-dropdown,
179
- .widget h5.with-dropdown,
180
- .widget h6.with-dropdown {
181
- position: relative;
182
- cursor: pointer;
183
- }
184
-
185
- .widget h1.with-dropdown .widget-dropdown,
186
- .widget h2.with-dropdown .widget-dropdown,
187
- .widget h3.with-dropdown .widget-dropdown,
188
- .widget h4.with-dropdown .widget-dropdown,
189
- .widget h5.with-dropdown .widget-dropdown,
190
- .widget h6.with-dropdown .widget-dropdown {
191
- border-width: 0;
192
- width: 22px;
193
- height: 22px;
194
- background: url(../images/select-arrow.png) top 0px right no-repeat;
195
- background-size: 95% !important;
196
- position: absolute;
197
- top: 0;
198
- right: 0;
199
- }
200
-
201
- .widget h1.with-dropdown.open .widget-dropdown,
202
- .widget h2.with-dropdown.open .widget-dropdown,
203
- .widget h3.with-dropdown.open .widget-dropdown,
204
- .widget h4.with-dropdown.open .widget-dropdown,
205
- .widget h5.with-dropdown.open .widget-dropdown,
206
- .widget h6.with-dropdown.open .widget-dropdown {
207
- background-position: bottom 15px right;
208
- }
209
-
210
- /* === Sort By === */
211
-
212
- .yith-wcan-sort-by ul.orderby {
213
- list-style: none;
214
- padding: 0;
215
- }
216
-
217
- .yith-wcan-sort-by ul.orderby li.orderby-wrapper {
218
- margin-bottom: 5px;
219
- }
220
-
221
- .yith-wcan-sort-by ul.orderby li.orderby-wrapper a.active:before,
222
- a.yith-wcan-onsale-button.active:before,
223
- a.yith-wcan-instock-button.active:before,
224
- a.yith-wcan-price-link.active:before {
225
- font-family: WooCommerce;
226
- speak: none;
227
- font-variant: normal;
228
- text-transform: none;
229
- -webkit-font-smoothing: antialiased;
230
- text-decoration: none;
231
- font-weight: 400;
232
- line-height: 1;
233
- content:"";
234
- color: #a00;
235
- margin-right: .618em;
236
- }
237
-
238
- .woocommerce .widget_layered_nav ul.yith-wcan-color li a.multicolor {
239
- position: relative;
240
- }
241
-
242
- .woocommerce .widget_layered_nav ul.yith-wcan-color li a span.multicolor {
243
- width: 0;
244
- height: 0;
245
- border-style: solid;
246
- position: absolute;
247
- top: 0;
248
- left: 0;
249
- margin: 0;
250
- cursor: pointer;
251
- }
252
-
253
- .woocommerce .widget_layered_nav ul.yith-wcan-color li a span.multicolor.color-1{
254
- border-width: 20px 20px 0 0;
255
- }
256
-
257
- .woocommerce .widget_layered_nav ul.yith-wcan-color li a span.multicolor.color-2{
258
- border-width: 0 0 20px 20px;
259
- }
260
-
261
- .woocommerce .widget_layered_nav ul.yith-wcan-color li a.multicolor.round {
262
- border-radius: 50%;
263
- }
264
- .woocommerce .widget_price_filter .price_slider_amount #min_price.yith_wcan_no_slider,
265
- .woocommerce .widget_price_filter .price_slider_amount #max_price.yith_wcan_no_slider {
266
- margin-bottom: 10px;
267
- }
268
-
269
-
1
+ .yith-wcan-group:after {
2
+ content: "";
3
+ display: table;
4
+ clear: both;
5
+ }
6
+
7
+ .yith-wcan-loading {
8
+ background: url('../images/ajax-loader.gif') no-repeat center;
9
+ height: 100px;
10
+ }
11
+
12
+ .woocommerce .widget_layered_nav ul.yith-wcan li span,
13
+ .woocommerce-page .widget_layered_nav ul.yith-wcan li span {
14
+ cursor: not-allowed;
15
+ }
16
+
17
+ /* Colors Type */
18
+ .yith-wcan-color li {
19
+ float: left;
20
+ }
21
+
22
+ .woocommerce .widget_layered_nav ul.yith-wcan-color li a,
23
+ .woocommerce-page .widget_layered_nav ul.yith-wcan-color li a,
24
+ .woocommerce .widget_layered_nav ul.yith-wcan-color li span,
25
+ .woocommerce-page .widget_layered_nav ul.yith-wcan-color li span {
26
+ border: 1px solid #ddd;
27
+ display: block;
28
+ height: 20px;
29
+ margin: 5px 5px 5px 0;
30
+ padding: 0;
31
+ width: 20px;
32
+ overflow: hidden;
33
+ text-indent: 100%;
34
+ white-space: nowrap;
35
+ box-sizing: content-box;
36
+ }
37
+
38
+ .woocommerce .widget_layered_nav ul.yith-wcan-color li a:hover,
39
+ .woocommerce-page .widget_layered_nav ul.yith-wcan-color li a:hover,
40
+ .woocommerce .widget_layered_nav ul.yith-wcan-color li.chosen a,
41
+ .woocommerce-page .widget_layered_nav ul.yith-wcan-color li.chosen a,
42
+ .woocommerce .widget_layered_nav ul.yith-wcan-color li span:hover,
43
+ .woocommerce-page .widget_layered_nav ul.yith-wcan-color li span:hover,
44
+ .woocommerce .widget_layered_nav ul.yith-wcan-color li.chosen span,
45
+ .woocommerce-page .widget_layered_nav ul.yith-wcan-color li.chosen span {
46
+ border: 1px solid #444;
47
+ background-image: none;
48
+ -webkit-border-radius: 0;
49
+ -moz-border-radius: 0;
50
+ border-radius: 0;
51
+ }
52
+
53
+ /* Labels Type */
54
+ .yith-wcan-label li {
55
+ float: left;
56
+ }
57
+
58
+ .woocommerce .widget_layered_nav ul.yith-wcan-label li a,
59
+ .woocommerce-page .widget_layered_nav ul.yith-wcan-label li a,
60
+ .woocommerce .widget_layered_nav ul.yith-wcan-label li span,
61
+ .woocommerce-page .widget_layered_nav ul.yith-wcan-label li span {
62
+ background: #efefef;
63
+ border: 1px solid #ddd;
64
+ display: block;
65
+ margin: 5px 5px 5px 0;
66
+ padding: 2px;
67
+ overflow: hidden;
68
+ text-decoration: none;
69
+ }
70
+
71
+ .woocommerce .widget_layered_nav ul.yith-wcan-label li a:hover,
72
+ .woocommerce-page .widget_layered_nav ul.yith-wcan-label li a:hover,
73
+ .woocommerce .widget_layered_nav ul.yith-wcan-label li.chosen a,
74
+ .woocommerce-page .widget_layered_nav ul.yith-wcan-label li.chosen a {
75
+ border: 1px solid #444;
76
+ background-image: none;
77
+ background-color: #ad74a2;
78
+ color: #fff;
79
+
80
+ -webkit-border-radius: 0;
81
+ -moz-border-radius: 0;
82
+ border-radius: 0;
83
+ }
84
+
85
+ /* DROPDOWN STYLE */
86
+
87
+ .yit-wcan-select-open {
88
+ background: transparent url(../images/select-arrow.png) top 15px right no-repeat;
89
+ border: 1px solid #cecece;
90
+ color: #838383;
91
+ display: block;
92
+ line-height: 16px;
93
+ margin-bottom: 15px;
94
+ margin-top: 15px;
95
+ overflow: hidden;
96
+ padding: 10px 30px 10px 10px;
97
+ }
98
+
99
+ .yit-wcan-select-open.active {
100
+ background: transparent url(../images/select-arrow.png) bottom 15px right no-repeat;
101
+ }
102
+
103
+ .yith-wcan-select-wrapper {
104
+ background: #ffffff;
105
+ margin: 0 4px 4px 0;
106
+ max-height: 240px;
107
+ padding-bottom: 30px;
108
+ position: absolute;
109
+ overflow-x: hidden;
110
+ overflow-y: auto;
111
+ max-width: 268px;
112
+ width: 100%;
113
+ z-index: -1;
114
+ border: 1px solid #cecece;
115
+ padding: 10px 0px;
116
+ margin-top: -16px;
117
+ }
118
+
119
+ .widget-area .yith-wcan-select-wrapper {
120
+ max-width: 260px;
121
+ }
122
+
123
+ .yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li {
124
+ padding: 5px 8px;
125
+ border-bottom: 1px solid transparent;
126
+ border-top: 1px solid transparent;
127
+ }
128
+
129
+ .yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li:hover,
130
+ .woocommerce-page .widget_layered_nav .yith-wcan-select-wrapper ul li.chosen {
131
+ -webkit-box-shadow: 0px 3px 0px #F2F2F2 inset, 0px -3px 0px #F2F2F2 inset;
132
+ -moz-box-shadow: 0px 3px 0px #f2f2f2 inset, 0px -3px 0px #f2f2f2 inset;
133
+ box-shadow: 0px 3px 0px #F2F2F2 inset, 0px -3px 0px #F2F2F2 inset;
134
+ border-bottom: 1px solid #cecece;
135
+ border-top: 1px solid #cecece;
136
+ }
137
+
138
+ .yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li a, .widget .yit-wcan-select-open {
139
+ width: 100%;
140
+ color: #838383;
141
+ box-sizing: border-box;
142
+ -moz-box-sizing: border-box; /* Firefox */
143
+ }
144
+
145
+ .yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li a, .widget .yit-wcan-select-open {
146
+ width: auto;
147
+ display: block;
148
+ }
149
+
150
+ .yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li.chosen a{
151
+ padding: 0;
152
+ }
153
+
154
+ .yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li a:hover, .widget .yit-wcan-select-open:hover {
155
+ text-decoration: none;
156
+ color: #838383;
157
+ }
158
+
159
+ .woocommerce-page .widget_layered_nav .yith-wcan-select-wrapper ul li.chosen a, .woocommerce-page .widget_layered_nav .yith-wcan-select-wrapper ul li.chosen a {
160
+ background: transparent url(../images/cross.png) bottom 6px left no-repeat;
161
+ border: none;
162
+ }
163
+
164
+ /* WooCommerce 2.1.X Fix */
165
+ .woocommerce .widget_layered_nav ul.yith-wcan-select li.chosen a:before,
166
+ .woocommerce-page .widget_layered_nav ul.yith-wcan-select li.chosen a:before {
167
+ content: "";
168
+ }
169
+
170
+ /* Hierarchical Order */
171
+ .widget.widget_layered_nav li.yit-wcan-child-terms {
172
+ padding-left: 30px;
173
+ }
174
+
175
+ .yith-wcan-select-wrapper ul.yith-wcan-select.yith-wcan li.yit-wcan-child-terms {
176
+ padding-left: 30px;
177
+ }
178
+
179
+ /* widget dropdown */
180
+ .widget h1.with-dropdown,
181
+ .widget h2.with-dropdown,
182
+ .widget h3.with-dropdown,
183
+ .widget h4.with-dropdown,
184
+ .widget h5.with-dropdown,
185
+ .widget h6.with-dropdown {
186
+ position: relative;
187
+ cursor: pointer;
188
+ }
189
+
190
+ .widget h1.with-dropdown .widget-dropdown,
191
+ .widget h2.with-dropdown .widget-dropdown,
192
+ .widget h3.with-dropdown .widget-dropdown,
193
+ .widget h4.with-dropdown .widget-dropdown,
194
+ .widget h5.with-dropdown .widget-dropdown,
195
+ .widget h6.with-dropdown .widget-dropdown {
196
+ border-width: 0;
197
+ width: 22px;
198
+ height: 22px;
199
+ background: url(../images/select-arrow.png) top 0px right no-repeat;
200
+ background-size: 95% !important;
201
+ position: absolute;
202
+ top: 0;
203
+ right: 0;
204
+ }
205
+
206
+ .widget h1.with-dropdown.open .widget-dropdown,
207
+ .widget h2.with-dropdown.open .widget-dropdown,
208
+ .widget h3.with-dropdown.open .widget-dropdown,
209
+ .widget h4.with-dropdown.open .widget-dropdown,
210
+ .widget h5.with-dropdown.open .widget-dropdown,
211
+ .widget h6.with-dropdown.open .widget-dropdown {
212
+ background-position: bottom 15px right;
213
+ }
214
+
215
+ /* === Sort By === */
216
+
217
+ .yith-wcan-sort-by ul.orderby {
218
+ list-style: none;
219
+ padding: 0;
220
+ }
221
+
222
+ .yith-wcan-sort-by ul.orderby li.orderby-wrapper {
223
+ margin-bottom: 5px;
224
+ }
225
+
226
+ .yith-wcan-sort-by ul.orderby li.orderby-wrapper a.active:before,
227
+ a.yith-wcan-onsale-button.active:before,
228
+ a.yith-wcan-instock-button.active:before,
229
+ a.yith-wcan-price-link.active:before {
230
+ font-family: WooCommerce;
231
+ speak: none;
232
+ font-variant: normal;
233
+ text-transform: none;
234
+ -webkit-font-smoothing: antialiased;
235
+ text-decoration: none;
236
+ font-weight: 400;
237
+ line-height: 1;
238
+ content:"";
239
+ color: #a00;
240
+ margin-right: .618em;
241
+ }
242
+
243
+ .woocommerce .widget_layered_nav ul.yith-wcan-color li a.multicolor {
244
+ position: relative;
245
+ }
246
+
247
+ .woocommerce .widget_layered_nav ul.yith-wcan-color li a span.multicolor {
248
+ width: 0;
249
+ height: 0;
250
+ border-style: solid;
251
+ position: absolute;
252
+ top: 0;
253
+ left: 0;
254
+ margin: 0;
255
+ cursor: pointer;
256
+ }
257
+
258
+ .woocommerce .widget_layered_nav ul.yith-wcan-color li a span.multicolor.color-1{
259
+ border-width: 20px 20px 0 0;
260
+ }
261
+
262
+ .woocommerce .widget_layered_nav ul.yith-wcan-color li a span.multicolor.color-2{
263
+ border-width: 0 0 20px 20px;
264
+ }
265
+
266
+ .woocommerce .widget_layered_nav ul.yith-wcan-color li a.multicolor.round {
267
+ border-radius: 50%;
268
+ }
269
+
270
+ .woocommerce .widget_price_filter .price_slider_amount button {
271
+ display: none;
272
+ }
273
+
274
+ .woocommerce .widget_price_filter .price_slider_amount #min_price.yith_wcan_no_slider,
275
+ .woocommerce .widget_price_filter .price_slider_amount #max_price.yith_wcan_no_slider {
276
+ margin-bottom: 10px;
277
+ }
278
+
279
+
assets/images/06.png CHANGED
Binary file
assets/images/07.png CHANGED
Binary file
assets/images/08-bg.png ADDED
Binary file
assets/images/08-icon.png ADDED
Binary file
assets/images/08.png ADDED
Binary file
assets/js/yith-wcan-admin.js CHANGED
@@ -1,118 +1,118 @@
1
- /**
2
- * Admin
3
- *
4
- * @author Your Inspiration Themes
5
- * @package YITH WooCommerce Ajax Navigation
6
- * @version 1.3.2
7
- */
8
- jQuery(function ($) {
9
- $.add_new_range = function () {
10
- var range_filter = $('#widgets-right').find('.range-filter'),
11
- input_field = range_filter.find('input:last-child'),
12
- field_name = range_filter.data('field_name'),
13
- position = parseInt(input_field.data('position')) + 1,
14
- html = '<input type="text" placeholder="min" name="' + field_name + '[' + position + '][min]" value="" class="yith-wcan-price-filter-input widefat" data-position="' + position + '"/>' +
15
- '<input type="text" placeholder="max" name="' + field_name + '[' + position + '][max]" value="" class="yith-wcan-price-filter-input widefat" data-position="' + position + '"/>';
16
-
17
- range_filter.append(html);
18
- };
19
-
20
- $.select_dropdown = function( elem ) { console.log( elem );
21
- var t = elem,
22
- select = t.parents('p').next('p');
23
-
24
- t.is(':checked') ? select.fadeIn('slow') : select.fadeOut('slow');
25
- }
26
-
27
- $(document).on('change', '.yith_wcan_type, .yith_wcan_attributes', function (e) {
28
- var t = this,
29
- container = $(this).parents('.widget-content').find('.yith_wcan_placeholder').html(''),
30
- spinner = container.next('.spinner').show(),
31
- display = $(this).parents('.widget-content').find('#yit-wcan-display'),
32
- style = $(this).parents('.widget-content').find('#yit-wcan-style'),
33
- show_count = $(this).parents('.widget-content').find('#yit-wcan-show-count'),
34
- attributes = $(this).parents('.widget-content').find('.yith-wcan-attribute-list'),
35
- tag_list = $(this).parents('.widget-content').find('.yit-wcan-widget-tag-list');
36
-
37
- var data = {
38
- action : 'yith_wcan_select_type',
39
- id : $('input[name=widget_id]', $(t).parents('.widget-content')).val(),
40
- name : $('input[name=widget_name]', $(t).parents('.widget-content')).val(),
41
- attribute: $('.yith_wcan_attributes', $(t).parents('.widget-content')).val(),
42
- value : $('.yith_wcan_type', $(t).parents('.widget-content')).val()
43
- };
44
-
45
- /* Hierarchical hide/show */
46
- if (data.value == 'list' || data.value == 'select' || data.value == 'brands' || data.value == 'tags' ) {
47
- display.show();
48
- style.hide();
49
- } else if (data.value == 'label' || data.value == 'color' || data.value == 'multicolor' ) {
50
- display.hide();
51
- }
52
-
53
- if( data.value == 'color' || data.value == 'multicolor' ){
54
- style.show();
55
- } else {
56
- style.hide();
57
- }
58
-
59
- if( data.value == 'list' || data.value == 'tags' || data.value == 'brands' ){
60
- show_count.show();
61
- } else {
62
- show_count.hide();
63
- }
64
-
65
- if( data.value == 'tags' || data.value == 'brands' ){
66
- attributes.hide();
67
- } else {
68
- attributes.show();
69
- }
70
-
71
- if( data.value == 'tags' ){
72
- tag_list.show();
73
- } else {
74
- tag_list.hide();
75
- }
76
-
77
- $.post(ajaxurl, data, function (response) {
78
- spinner.hide();
79
- container.html(response.content);
80
- $(document).trigger('yith_colorpicker');
81
- }, 'json');
82
- });
83
-
84
- //color-picker
85
- $(document).on('yith_colorpicker',function () {
86
- $('.yith-colorpicker').each(function () {
87
- $(this).wpColorPicker();
88
- });
89
- }).trigger('yith_colorpicker');
90
-
91
- $(document).on('change', '.yith-wcan-enable-custom-style', function(){
92
- var t = $(this),
93
- enable_custom_style = t.parents('.widget-content').find('.yith-wcan-reset-custom-style'),
94
- checked = t.find('.yith-wcan-enable-custom-style-check').is(':checked');
95
-
96
- checked ? enable_custom_style.fadeIn('slow') : enable_custom_style.fadeOut('slow');
97
- });
98
-
99
- $(document).on('change', '.yith-wcan-dropdown-check', function(){
100
- $.select_dropdown( $(this) );
101
- });
102
-
103
- //Filter By Tag tab
104
- var select_all = $('.yith-wcan-select-option .select-all'),
105
- unselect_all = $('.yith-wcan-select-option .unselect-all'),
106
- checklist = $('.yith_wcan_select_tag'),
107
- widget_select = $('#yith-wcan-tag-widget-select');
108
-
109
- select_all.on('click', function(e){
110
- e.preventDefault();
111
- $(this).parents( '.yith-wcan-select-option').next('.yith_wcan_select_tag').find('.yith_wcan_tag_list_checkbox').attr( 'checked', true );
112
- });
113
-
114
- unselect_all.on('click', function(e){
115
- e.preventDefault();
116
- $(this).parents( '.yith-wcan-select-option').next('.yith_wcan_select_tag').find('.yith_wcan_tag_list_checkbox').attr( 'checked', false );
117
- });
118
});
1
+ /**
2
+ * Admin
3
+ *
4
+ * @author Your Inspiration Themes
5
+ * @package YITH WooCommerce Ajax Navigation
6
+ * @version 1.3.2
7
+ */
8
+ jQuery(function ($) {
9
+ $.add_new_range = function () {
10
+ var range_filter = $('#widgets-right').find('.range-filter'),
11
+ input_field = range_filter.find('input:last-child'),
12
+ field_name = range_filter.data('field_name'),
13
+ position = parseInt(input_field.data('position')) + 1,
14
+ html = '<input type="text" placeholder="min" name="' + field_name + '[' + position + '][min]" value="" class="yith-wcan-price-filter-input widefat" data-position="' + position + '"/>' +
15
+ '<input type="text" placeholder="max" name="' + field_name + '[' + position + '][max]" value="" class="yith-wcan-price-filter-input widefat" data-position="' + position + '"/>';
16
+
17
+ range_filter.append(html);
18
+ };
19
+
20
+ $.select_dropdown = function( elem ) { console.log( elem );
21
+ var t = elem,
22
+ select = t.parents('p').next('p');
23
+
24
+ t.is(':checked') ? select.fadeIn('slow') : select.fadeOut('slow');
25
+ }
26
+
27
+ $(document).on('change', '.yith_wcan_type, .yith_wcan_attributes', function (e) {
28
+ var t = this,
29
+ container = $(this).parents('.widget-content').find('.yith_wcan_placeholder').html(''),
30
+ spinner = container.next('.spinner').show(),
31
+ display = $(this).parents('.widget-content').find('#yit-wcan-display'),
32
+ style = $(this).parents('.widget-content').find('#yit-wcan-style'),
33
+ show_count = $(this).parents('.widget-content').find('#yit-wcan-show-count'),
34
+ attributes = $(this).parents('.widget-content').find('.yith-wcan-attribute-list'),
35
+ tag_list = $(this).parents('.widget-content').find('.yit-wcan-widget-tag-list');
36
+
37
+ var data = {
38
+ action : 'yith_wcan_select_type',
39
+ id : $('input[name=widget_id]', $(t).parents('.widget-content')).val(),
40
+ name : $('input[name=widget_name]', $(t).parents('.widget-content')).val(),
41
+ attribute: $('.yith_wcan_attributes', $(t).parents('.widget-content')).val(),
42
+ value : $('.yith_wcan_type', $(t).parents('.widget-content')).val()
43
+ };
44
+
45
+ /* Hierarchical hide/show */
46
+ if (data.value == 'list' || data.value == 'select' || data.value == 'brands' || data.value == 'tags' ) {
47
+ display.show();
48
+ style.hide();
49
+ } else if (data.value == 'label' || data.value == 'color' || data.value == 'multicolor' ) {
50
+ display.hide();
51
+ }
52
+
53
+ if( data.value == 'color' || data.value == 'multicolor' ){
54
+ style.show();
55
+ } else {
56
+ style.hide();
57
+ }
58
+
59
+ if( data.value == 'list' || data.value == 'tags' || data.value == 'brands' ){
60
+ show_count.show();
61
+ } else {
62
+ show_count.hide();
63
+ }
64
+
65
+ if( data.value == 'tags' || data.value == 'brands' || data.value == 'categories' ){
66
+ attributes.hide();
67
+ } else {
68
+ attributes.show();
69
+ }
70
+
71
+ if( data.value == 'tags' ){
72
+ tag_list.show();
73
+ } else {
74
+ tag_list.hide();
75
+ }
76
+
77
+ $.post(ajaxurl, data, function (response) {
78
+ spinner.hide();
79
+ container.html(response.content);
80
+ $(document).trigger('yith_colorpicker');
81
+ }, 'json');
82
+ });
83
+
84
+ //color-picker
85
+ $(document).on('yith_colorpicker',function () {
86
+ $('.yith-colorpicker').each(function () {
87
+ $(this).wpColorPicker();
88
+ });
89
+ }).trigger('yith_colorpicker');
90
+
91
+ $(document).on('change', '.yith-wcan-enable-custom-style', function(){
92
+ var t = $(this),
93
+ enable_custom_style = t.parents('.widget-content').find('.yith-wcan-reset-custom-style'),
94
+ checked = t.find('.yith-wcan-enable-custom-style-check').is(':checked');
95
+
96
+ checked ? enable_custom_style.fadeIn('slow') : enable_custom_style.fadeOut('slow');
97
+ });
98
+
99
+ $(document).on('change', '.yith-wcan-dropdown-check', function(){
100
+ $.select_dropdown( $(this) );
101
+ });
102
+
103
+ //Filter By Tag tab
104
+ var select_all = $('.yith-wcan-select-option .select-all'),
105
+ unselect_all = $('.yith-wcan-select-option .unselect-all'),
106
+ checklist = $('.yith_wcan_select_tag'),
107
+ widget_select = $('#yith-wcan-tag-widget-select');
108
+
109
+ select_all.on('click', function(e){
110
+ e.preventDefault();
111
+ $(this).parents( '.yith-wcan-select-option').next('.yith_wcan_select_tag').find('.yith_wcan_tag_list_checkbox').attr( 'checked', true );
112
+ });
113
+
114
+ unselect_all.on('click', function(e){
115
+ e.preventDefault();
116
+ $(this).parents( '.yith-wcan-select-option').next('.yith_wcan_select_tag').find('.yith_wcan_tag_list_checkbox').attr( 'checked', false );
117
+ });
118
});
assets/js/yith-wcan-frontend.js CHANGED
@@ -1,312 +1,321 @@
1
- /**
2
- * Frontend
3
- *
4
- * @author Your Inspiration Themes
5
- * @package YITH WooCommerce Ajax Navigation
6
- * @version 1.3.2
7
- */
8
- jQuery(function ($) {
9
- /**
10
- Copyright (c) 2010, All Right Reserved, Wong Shek Hei @ shekhei@gmail.com
11
- License: GNU Lesser General Public License (http://www.gnu.org/licenses/lgpl.html)
12
- **/
13
- var expr = /[.#\w].([\S]*)/g, classexpr = /(?!(\[))(\.)[^.#[]*/g, idexpr = /(#)[^.#[]*/, tagexpr = /^[\w]+/, varexpr = /(\w+?)=(['"])([^\2$]*?)\2/, simpleselector = /^[\w]+#x2F;, parseSelector = function (d) {
14
- for (var c = {sel: [], val: []}, a = [], j = !1, h = "", e = [], f = 0, m = d.length; f < m; f++) {
15
- var g = d.charAt(f);
16
- if (j)if ("\\" === g && f + 1 < d.length)e.push(d.charAt(++f)); else if (h === g)h = "", e.push(g); else if (("'" === g || '"' === g) && "" === h)h = g, e.push(g); else if ("]" === g && "" === h)c.val.push(e.join("")), e = [], j = !1; else {
17
- if ("]" !== g || "" !== h)"" === h && "," === g ? (c.val.push(e.join("")),
18
- e = []) : e.push(g)
19
- } else"\\" === g && f + 1 < d.length ? j && e.push(d.charAt(++f)) : "[" === g && "" === h ? j = !0 : " " === g || "+" === g ? (c.sel = c.sel.join(""), a.push(c), "+" === g && a.push({sel: "+", val: ""}), c = {sel: [], val: []}) : " " !== g && "]" !== g && c.sel.push(g)
20
- }
21
- if (0 != c.sel.length || 0 != c.val.length)c.sel = c.sel.join(""), a.push(c);
22
- for (f = 0; f < a.length; f++) {
23
- c = a[f].sel;
24
- if ("+" === c)b.tag = c; else {
25
- var b = [];
26
- b.tag = tagexpr.exec(c);
27
- b.id = idexpr.exec(c);
28
- b.id && $.isArray(b.id) && (b.id = b.id[0].substr(1));
29
- b.tag || (b.tag = "div");
30
- b.vars = [];
31
- for (d = 0; d < a[f].val.length; d++)h =
32
- a[f].val[d].indexOf("="), j = a[f].val[d].substr(0, h), h = a[f].val[d].substr(h + 1), h = h.replace(/^[\s]*[\"\']*|[\"\']*[\s]*#x2F;g, ""), "text" === j ? b.text = h : b.vars.push([j, h]);
33
- c = c.match(classexpr);
34
- j = [];
35
- if (c) {
36
- for (d = 0; d < c.length; d++)j.push(c[d].substr(1));
37
- b.className = j.join(" ")
38
- }
39
- }
40
- a[f] = b
41
- }
42
- return a
43
- }, rmFromParent = function (d) {
44
- var c = d.parentNode, a = d.nextSibling;
45
- c.removeChild(d);
46
- return a ? function () {
47
- c.insertBefore(d, a)
48
- } : function () {
49
- c.appendChild(d)
50
- }
51
- }, nonArrVer = function (d, c) {
52
- var a = [], a = simpleselector.test(d) ? [
53
- {tag: d}
54
- ] : parseSelector(d),
55
- j = [];
56
- "undefined" === typeof c && (c = 1);
57
- for (var h = [], e = [], f = [], m = document.createElement("div"), g = 0, b = 0; b < a.length; b++) {
58
- if ("+" == a[b].tag)e = f.slice(), --g; else {
59
- for (var l = 0; l < c; l++)if ("input" == a[b].tag) {
60
- var k = [];
61
- k.push("<" + a[b].tag);
62
- a[b].id && k.push("id='" + a[b].id + "'");
63
- a[b].className && (k.push("class='" + a[b].className), b + 1 === a.length && k.push(lastClass), k.push("'"));
64
- if (a[b].vars)for (var n = 0; n < a[b].vars.length; n++)k.push(a[b].vars[n][0] + "='" + a[b].vars[n][1] + "'");
65
- a[b].text && k.push("value='" + a[b].text + "'");
66
- k.push("/>");
67
- f[l] = e[l];
68
- e[l] ? (e[l].innerHTML += k.join(" "), e[l] = e[l].lastChild) : (m.innerHTML = k.join(" "), e[l] = m.removeChild(m.firstChild))
69
- } else {
70
- k = document.createElement(a[b].tag);
71
- if (a[b].vars)for (n = 0; n < a[b].vars.length; n++)console.log(a[b].tag, a[b].vars[n]), k.setAttribute(a[b].vars[n][0], a[b].vars[n][1]);
72
- a[b].id && (k.id = a[b].id);
73
- a[b].className && (k.className = a[b].className);
74
- a[b].text && k.appendChild(document.createTextNode(a[b].text));
75
- f[l] = e[l];
76
- e[l] = e[l] ? e[l].appendChild(k) : k
77
- }
78
- g++ || Array.prototype.push.apply(h, e)
79
- }
80
- j =
81
- $.merge(j, e)
82
- }
83
- return $(h)
84
- }, arrVer = function (d, c, a) {
85
- for (var j = d.match(/%[^%]*%/g) || [], h = [], e = 0; e < c.length; e++) {
86
- for (var f = d, m = 0; m < j.length; m++)var g = j[m].substr(1, j[m].length - 2), f = f.replace(j[m], c[e][g]);
87
- h = $.merge(h, nonArrVer(f, a))
88
- }
89
- return $(h)
90
- };
91
- $.jseldom = function (d) {
92
- if (2 == arguments.length && $.isPlainObject(arguments[1]))return arrVer.apply(this, [arguments[0], [arguments[1]]]);
93
- if (1 == arguments.length || 2 == arguments.length && !$.isArray(arguments[1]))return nonArrVer.apply(this, arguments);
94
- if (2 == arguments.length)return arrVer.apply(this, arguments)
95
- };
96
-
97
- $.fn.yith_wcan_ajax_filters = function (e, obj) {
98
- e.preventDefault();
99
- var href = obj.href,
100
- t = $(obj);
101
-
102
- if (typeof href == 'undefined' && t.parents().hasClass('price_slider_wrapper')) {
103
- var form = t.parents('form'),
104
- l = window.location,
105
- shop_uri = l.origin + l.pathname,
106
- is_filtered = shop_uri != l.href,
107
- search = l.search,
108
- min_price = $('.price_slider_amount #min_price').val(),
109
- max_price = $('.price_slider_amount #max_price').val(),
110
- regex_min = new RegExp('^min_price', 'i'),
111
- regex_max = new RegExp('^max_price', 'i');
112
-
113
- href = l.href;
114
-
115
- if (is_filtered == true) {
116
- href = RemoveParameterFromUrl(href, 'min_price');
117
- href = RemoveParameterFromUrl(href, 'max_price');
118
- }
119
-
120
- var concat = shop_uri == href ? '?' : '&';
121
-
122
- href = href + concat + $.param(
123
- {
124
- min_price: min_price,
125
- max_price: max_price
126
- }
127
- );
128
- }
129
-
130
- if (t.data('type') == 'select') {
131
-
132
- t.parents('div.yith-woo-ajax-navigation').find('a.yit-wcan-select-open').removeClass('active');
133
-
134
- t.parent().find('div.yith-wcan-select-wrapper').animate({
135
-
136
- visibility: "hidden",
137
- opacity : 0
138
-
139
- }, 300);
140
- }
141
-
142
- //loading
143
- $(yith_wcan.container).html('').addClass('yith-wcan-loading');
144
- $(document).trigger("yith-wcan-ajax-loading");
145
-
146
- if (typeof yith_wcan_frontend != 'undefined') {
147
- $(yith_wcan.container).css('backgroundImage', 'url(' + yith_wcan_frontend.loader_url + ')');
148
- }
149
-
150
- $(yith_wcan.pagination).hide();
151
- $(yith_wcan.result_count).hide();
152
-
153
- $.ajax({
154
- url : href,
155
- success: function (response) {
156
- $(yith_wcan.container).removeClass('yith-wcan-loading');
157
-
158
- //container
159
- if ($(response).find(yith_wcan.container).length > 0) {
160
- $('.yit-wcan-container').html($(response).find(yith_wcan.container));
161
- } else {
162
- $('.yit-wcan-container').html($(response).find('.woocommerce-info'));
163
- }
164
-
165
- //pagination
166
- if ($(response).find(yith_wcan.pagination).length > 0) {
167
- //se non esiste lo creo
168
- if ($(yith_wcan.pagination).length == 0) {
169
- $.jseldom(yith_wcan.pagination).insertAfter($(yith_wcan.container));
170
- }
171
-
172
- $(yith_wcan.pagination)
173
- .html($(response).find(yith_wcan.pagination).html())
174
- .show();
175
- }
176
-
177
- else {
178
- $(yith_wcan.pagination).empty();
179
- }
180
-
181
- //result count
182
- if ($(response).find(yith_wcan.result_count).length > 0) {
183
- $(yith_wcan.result_count).html($(response).find(yith_wcan.result_count).html()).show();
184
- }
185
-
186
-
187
- var widget_reload = function (t) {
188
- var id = t.attr('id');
189
- t.html($(response).find('#' + id).html());
190
-
191
- if (t.text() == '') {
192
- t.hide();
193
- } else {
194
- t.show();
195
- }
196
- };
197
-
198
- //load new widgets
199
- $('.yith-woo-ajax-navigation').add('.yith-wcan-sort-by').add('.yith-wcan-stock-on-sale').add('.yith-wcan-list-price-filter').each(function () {
200
- var t = $(this);
201
- widget_reload(t)
202
- });
203
-
204
- //update browser history (IE doesn't support it)
205
- if (!navigator.userAgent.match(/msie/i)) {
206
- window.history.pushState({"pageTitle": response.pageTitle}, "", href);
207
- }
208
-
209
- //trigger ready event
210
- $(document).trigger("ready");
211
- $(document).trigger("yith-wcan-ajax-filtered");
212
- }
213
- });
214
- };
215
-
216
- //wrap the container
217
- $(yith_wcan.container).wrap('<div class="yit-wcan-container"></div>');
218
- $('.woocommerce-info').wrap('<div class="yit-wcan-container"></div>');
219
-
220
- $(document).on('click', '.yith-wcan a', function (e) {
221
- $(this).yith_wcan_ajax_filters(e, this);
222
- });
223
-
224
-
225
- /*AJAX NAVIGATION DROPDOWN STYLE*/
226
-
227
- function yit_open_select_dropdown(element) {
228
-
229
- $(element).parent().find('div.yith-wcan-select-wrapper').css("z-index", "1").animate({
230
-
231
- visibility: "visible",
232
- opacity : 1
233
-
234
-
235
- }, 300);
236
-
237
- $(element).parent().find('a.yit-wcan-select-open').addClass('active');
238
- }
239
-
240
- function yit_close_select_dropdown(element) {
241
-
242
- $(element).parent().find('div.yith-wcan-select-wrapper').css("z-index", "-1").animate({
243
-
244
- visibility: "hidden",
245
- opacity : 0
246
-
247
- }, 300);
248
-
249
- $(element).parent().find('a.yit-wcan-select-open').removeClass('active');
250
- }
251
-
252
- var yit_hidden_filters_wrapper = function () {
253
-
254
- $('div.yith-wcan-select-wrapper').animate({
255
-
256
- visibility: "hidden",
257
- opacity : 0
258
-
259
- }, 0);
260
-
261
- $('a.yit-wcan-select-open').removeClass('active');
262
- }
263
-
264
- var yit_active_filter = function () {
265
-
266
- var filter_number = $('div.yith-wcan-select-wrapper ul.yith-wcan-select li.chosen').length;
267
-
268
- yit_hidden_filters_wrapper();
269
-
270
- $('div.yith-wcan-select-wrapper').each(function () {
271
-
272
- var filter_name = "";
273
- var chosen = $(this).find('ul.yith-wcan-select li.chosen').each(function () {
274
- filter_name += $(this).text() + ', ';
275
- });
276
-
277
- filter_name = filter_name.substring(0, filter_name.length - 2);
278
-
279
- if (filter_name != "") {
280
- $(this).parent().find('a.yit-wcan-select-open').text(filter_name);
281
- }
282
- })
283
- }
284
-
285
- $(document).on('click', 'a.yit-wcan-select-open.active', function (e) {
286
- e.preventDefault();
287
- yit_close_select_dropdown(this);
288
- });
289
-
290
- $(document).on('click', 'a.yit-wcan-select-open:not(.active)', function (e) {
291
- e.preventDefault();
292
- yit_open_select_dropdown(this);
293
- });
294
-
295
- $(document).on('ready yith-wcan-ajax-filtered', yit_active_filter);
296
-
297
- $(document).on('ready', yit_hidden_filters_wrapper);
298
-
299
- $('body').on('click', function (e) {
300
-
301
- if (!$(e.target).hasClass('yit-wcan-select-open')) {
302
- yit_hidden_filters_wrapper();
303
- }
304
-
305
- });
306
-
307
- function RemoveParameterFromUrl(url, parameter) {
308
- return url
309
- .replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?#x27;), '$1')
310
- .replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
311
- }
312
- });
1
+ /**
2
+ * Frontend
3
+ *
4
+ * @author Your Inspiration Themes
5
+ * @package YITH WooCommerce Ajax Navigation
6
+ * @version 1.3.2
7
+ */
8
+ jQuery(function ($) {
9
+ /**
10
+ Copyright (c) 2010, All Right Reserved, Wong Shek Hei @ shekhei@gmail.com
11
+ License: GNU Lesser General Public License (http://www.gnu.org/licenses/lgpl.html)
12
+ **/
13
+ var expr = /[.#\w].([\S]*)/g, classexpr = /(?!(\[))(\.)[^.#[]*/g, idexpr = /(#)[^.#[]*/, tagexpr = /^[\w]+/, varexpr = /(\w+?)=(['"])([^\2$]*?)\2/, simpleselector = /^[\w]+#x2F;, parseSelector = function (d) {
14
+ for (var c = {sel: [], val: []}, a = [], j = !1, h = "", e = [], f = 0, m = d.length; f < m; f++) {
15
+ var g = d.charAt(f);
16
+ if (j)if ("\\" === g && f + 1 < d.length)e.push(d.charAt(++f)); else if (h === g)h = "", e.push(g); else if (("'" === g || '"' === g) && "" === h)h = g, e.push(g); else if ("]" === g && "" === h)c.val.push(e.join("")), e = [], j = !1; else {
17
+ if ("]" !== g || "" !== h)"" === h && "," === g ? (c.val.push(e.join("")),
18
+ e = []) : e.push(g)
19
+ } else"\\" === g && f + 1 < d.length ? j && e.push(d.charAt(++f)) : "[" === g && "" === h ? j = !0 : " " === g || "+" === g ? (c.sel = c.sel.join(""), a.push(c), "+" === g && a.push({sel: "+", val: ""}), c = {sel: [], val: []}) : " " !== g && "]" !== g && c.sel.push(g)
20
+ }
21
+ if (0 != c.sel.length || 0 != c.val.length)c.sel = c.sel.join(""), a.push(c);
22
+ for (f = 0; f < a.length; f++) {
23
+ c = a[f].sel;
24
+ if ("+" === c)b.tag = c; else {
25
+ var b = [];
26
+ b.tag = tagexpr.exec(c);
27
+ b.id = idexpr.exec(c);
28
+ b.id && $.isArray(b.id) && (b.id = b.id[0].substr(1));
29
+ b.tag || (b.tag = "div");
30
+ b.vars = [];
31
+ for (d = 0; d < a[f].val.length; d++)h =
32
+ a[f].val[d].indexOf("="), j = a[f].val[d].substr(0, h), h = a[f].val[d].substr(h + 1), h = h.replace(/^[\s]*[\"\']*|[\"\']*[\s]*#x2F;g, ""), "text" === j ? b.text = h : b.vars.push([j, h]);
33
+ c = c.match(classexpr);
34
+ j = [];
35
+ if (c) {
36
+ for (d = 0; d < c.length; d++)j.push(c[d].substr(1));
37
+ b.className = j.join(" ")
38
+ }
39
+ }
40
+ a[f] = b
41
+ }
42
+ return a
43
+ }, rmFromParent = function (d) {
44
+ var c = d.parentNode, a = d.nextSibling;
45
+ c.removeChild(d);
46
+ return a ? function () {
47
+ c.insertBefore(d, a)
48
+ } : function () {
49
+ c.appendChild(d)
50
+ }
51
+ }, nonArrVer = function (d, c) {
52
+ var a = [], a = simpleselector.test(d) ? [
53
+ {tag: d}
54
+ ] : parseSelector(d),
55
+ j = [];
56
+ "undefined" === typeof c && (c = 1);
57
+ for (var h = [], e = [], f = [], m = document.createElement("div"), g = 0, b = 0; b < a.length; b++) {
58
+ if ("+" == a[b].tag)e = f.slice(), --g; else {
59
+ for (var l = 0; l < c; l++)if ("input" == a[b].tag) {
60
+ var k = [];
61
+ k.push("<" + a[b].tag);
62
+ a[b].id && k.push("id='" + a[b].id + "'");
63
+ a[b].className && (k.push("class='" + a[b].className), b + 1 === a.length && k.push(lastClass), k.push("'"));
64
+ if (a[b].vars)for (var n = 0; n < a[b].vars.length; n++)k.push(a[b].vars[n][0] + "='" + a[b].vars[n][1] + "'");
65
+ a[b].text && k.push("value='" + a[b].text + "'");
66
+ k.push("/>");
67
+ f[l] = e[l];
68
+ e[l] ? (e[l].innerHTML += k.join(" "), e[l] = e[l].lastChild) : (m.innerHTML = k.join(" "), e[l] = m.removeChild(m.firstChild))
69
+ } else {
70
+ k = document.createElement(a[b].tag);
71
+ if (a[b].vars)for (n = 0; n < a[b].vars.length; n++)console.log(a[b].tag, a[b].vars[n]), k.setAttribute(a[b].vars[n][0], a[b].vars[n][1]);
72
+ a[b].id && (k.id = a[b].id);
73
+ a[b].className && (k.className = a[b].className);
74
+ a[b].text && k.appendChild(document.createTextNode(a[b].text));
75
+ f[l] = e[l];
76
+ e[l] = e[l] ? e[l].appendChild(k) : k
77
+ }
78
+ g++ || Array.prototype.push.apply(h, e)
79
+ }
80
+ j =
81
+ $.merge(j, e)
82
+ }
83
+ return $(h)
84
+ }, arrVer = function (d, c, a) {
85
+ for (var j = d.match(/%[^%]*%/g) || [], h = [], e = 0; e < c.length; e++) {
86
+ for (var f = d, m = 0; m < j.length; m++)var g = j[m].substr(1, j[m].length - 2), f = f.replace(j[m], c[e][g]);
87
+ h = $.merge(h, nonArrVer(f, a))
88
+ }
89
+ return $(h)
90
+ };
91
+ $.jseldom = function (d) {
92
+ if (2 == arguments.length && $.isPlainObject(arguments[1]))return arrVer.apply(this, [arguments[0], [arguments[1]]]);
93
+ if (1 == arguments.length || 2 == arguments.length && !$.isArray(arguments[1]))return nonArrVer.apply(this, arguments);
94
+ if (2 == arguments.length)return arrVer.apply(this, arguments)
95
+ };
96
+
97
+ var ajax_call = false;
98
+
99
+ $.fn.yith_wcan_ajax_filters = function (e, obj) {
100
+ e.preventDefault();
101
+ var href = obj.href,
102
+ t = $(obj);
103
+
104
+ if (typeof href == 'undefined' && t.parents().hasClass('price_slider_wrapper')) {
105
+ var form = t.parents('form'),
106
+ l = window.location,
107
+ shop_uri = l.origin + l.pathname,
108
+ is_filtered = shop_uri != l.href,
109
+ search = l.search,
110
+ min_price = $('.price_slider_amount #min_price').val(),
111
+ max_price = $('.price_slider_amount #max_price').val(),
112
+ regex_min = new RegExp('^min_price', 'i'),
113
+ regex_max = new RegExp('^max_price', 'i');
114
+
115
+ href = l.href;
116
+
117
+ if (is_filtered == true) {
118
+ href = RemoveParameterFromUrl(href, 'min_price');
119
+ href = RemoveParameterFromUrl(href, 'max_price');
120
+ }
121
+
122
+ var concat = shop_uri == href ? '?' : '&';
123
+
124
+ href = href + concat + $.param(
125
+ {
126
+ min_price: min_price,
127
+ max_price: max_price
128
+ }
129
+ );
130
+ }
131
+
132
+ if (t.data('type') == 'select') {
133
+
134
+ t.parents('div.yith-woo-ajax-navigation').find('a.yit-wcan-select-open').removeClass('active');
135
+
136
+ t.parent().find('div.yith-wcan-select-wrapper').animate({
137
+
138
+ visibility: "hidden",
139
+ opacity : 0
140
+
141
+ }, 300);
142
+ }
143
+
144
+ //loading
145
+ $(yith_wcan.container).html('').addClass('yith-wcan-loading');
146
+ $(document).trigger("yith-wcan-ajax-loading");
147
+
148
+ if (typeof yith_wcan_frontend != 'undefined') {
149
+ $(yith_wcan.container).css('backgroundImage', 'url(' + yith_wcan_frontend.loader_url + ')');
150
+ }
151
+
152
+ $(yith_wcan.pagination).hide();
153
+ $(yith_wcan.result_count).hide();
154
+
155
+ if( ajax_call != false ){
156
+ ajax_call.abort();
157
+ ajax_call = false;
158
+ console.log( 'here' );
159
+ }
160
+
161
+ ajax_call = $.ajax({
162
+ url : href,
163
+ success: function (response) {
164
+ ajax_call = false;
165
+ $(yith_wcan.container).removeClass('yith-wcan-loading');
166
+
167
+ //container
168
+ if ($(response).find(yith_wcan.container).length > 0) {
169
+ $('.yit-wcan-container').html($(response).find(yith_wcan.container));
170
+ } else {
171
+ $('.yit-wcan-container').html($(response).find('.woocommerce-info'));
172
+ }
173
+
174
+ //pagination
175
+ if ($(response).find(yith_wcan.pagination).length > 0) {
176
+ //se non esiste lo creo
177
+ if ($(yith_wcan.pagination).length == 0) {
178
+ $.jseldom(yith_wcan.pagination).insertAfter($(yith_wcan.container));
179
+ }
180
+
181
+ $(yith_wcan.pagination)
182
+ .html($(response).find(yith_wcan.pagination).html())
183
+ .show();
184
+ }
185
+
186
+ else {
187
+ $(yith_wcan.pagination).empty();
188
+ }
189
+
190
+ //result count
191
+ if ($(response).find(yith_wcan.result_count).length > 0) {
192
+ $(yith_wcan.result_count).html($(response).find(yith_wcan.result_count).html()).show();
193
+ }
194
+
195
+
196
+ var widget_reload = function (t) {
197
+ var id = t.attr('id');
198
+ t.html($(response).find('#' + id).html());
199
+
200
+ if (t.text() == '') {
201
+ t.hide();
202
+ } else {
203
+ t.show();
204
+ }
205
+ };
206
+
207
+ //load new widgets
208
+ $('.yith-woo-ajax-navigation').add('.yith-wcan-sort-by').add('.yith-wcan-stock-on-sale').add('.yith-wcan-list-price-filter').each(function () {
209
+ var t = $(this);
210
+ widget_reload(t)
211
+ });
212
+
213
+ //update browser history (IE doesn't support it)
214
+ if (!navigator.userAgent.match(/msie/i)) {
215
+ window.history.pushState({"pageTitle": response.pageTitle}, "", href);
216
+ }
217
+
218
+ //trigger ready event
219
+ $(document).trigger("ready");
220
+ $(document).trigger("yith-wcan-ajax-filtered");
221
+ }
222
+ });
223
+ };
224
+
225
+ //wrap the container
226
+ $(yith_wcan.container).wrap('<div class="yit-wcan-container"></div>');
227
+ $('.woocommerce-info').wrap('<div class="yit-wcan-container"></div>');
228
+
229
+ $(document).on('click', '.yith-wcan a', function (e) {
230
+ $(this).yith_wcan_ajax_filters(e, this);
231
+ });
232
+
233
+
234
+ /*AJAX NAVIGATION DROPDOWN STYLE*/
235
+
236
+ function yit_open_select_dropdown(element) {
237
+
238
+ $(element).parent().find('div.yith-wcan-select-wrapper').css("z-index", "1").animate({
239
+
240
+ visibility: "visible",
241
+ opacity : 1
242
+
243
+
244
+ }, 300);
245
+
246
+ $(element).parent().find('a.yit-wcan-select-open').addClass('active');
247
+ }
248
+
249
+ function yit_close_select_dropdown(element) {
250
+
251
+ $(element).parent().find('div.yith-wcan-select-wrapper').css("z-index", "-1").animate({
252
+
253
+ visibility: "hidden",
254
+ opacity : 0
255
+
256
+ }, 300);
257
+
258
+ $(element).parent().find('a.yit-wcan-select-open').removeClass('active');
259
+ }
260
+
261
+ var yit_hidden_filters_wrapper = function () {
262
+
263
+ $('div.yith-wcan-select-wrapper').animate({
264
+
265
+ visibility: "hidden",
266
+ opacity : 0
267
+
268
+ }, 0);
269
+
270
+ $('a.yit-wcan-select-open').removeClass('active');
271
+ }
272
+
273
+ var yit_active_filter = function () {
274
+
275
+ var filter_number = $('div.yith-wcan-select-wrapper ul.yith-wcan-select li.chosen').length;
276
+
277
+ yit_hidden_filters_wrapper();
278
+
279
+ $('div.yith-wcan-select-wrapper').each(function () {
280
+
281
+ var filter_name = "";
282
+ var chosen = $(this).find('ul.yith-wcan-select li.chosen').each(function () {
283
+ filter_name += $(this).text() + ', ';
284
+ });
285
+
286
+ filter_name = filter_name.substring(0, filter_name.length - 2);
287
+
288
+ if (filter_name != "") {
289
+ $(this).parent().find('a.yit-wcan-select-open').text(filter_name);
290
+ }
291
+ })
292
+ }
293
+
294
+ $(document).on('click', 'a.yit-wcan-select-open.active', function (e) {
295
+ e.preventDefault();
296
+ yit_close_select_dropdown(this);
297
+ });
298
+
299
+ $(document).on('click', 'a.yit-wcan-select-open:not(.active)', function (e) {
300
+ e.preventDefault();
301
+ yit_open_select_dropdown(this);
302
+ });
303
+
304
+ $(document).on('ready yith-wcan-ajax-filtered', yit_active_filter);
305
+
306
+ $(document).on('ready', yit_hidden_filters_wrapper);
307
+
308
+ $('body').on('click', function (e) {
309
+
310
+ if (!$(e.target).hasClass('yit-wcan-select-open')) {
311
+ yit_hidden_filters_wrapper();
312
+ }
313
+
314
+ });
315
+
316
+ function RemoveParameterFromUrl(url, parameter) {
317
+ return url
318
+ .replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?#x27;), '$1')
319
+ .replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
320
+ }
321
+ });
assets/js/yith-wcan-frontend.min.js CHANGED
@@ -1,13 +1,13 @@
1
- jQuery(function(b){function t(b,p){return b.replace(new RegExp("[?&]"+p+"=[^&#]*(#.*)?quot;),"$1").replace(new RegExp("([?&])"+p+"=[^&]*&"),"$1")}var w=/(?!(\[))(\.)[^.#[]*/g,x=/(#)[^.#[]*/,y=/^[\w]+/,z=/^[\w]+#x2F;,u=function(h,p){var a=[];if(z.test(h))a=[{tag:h}];else{for(var a=h,d={sel:[],val:[]},f=[],k=!1,g="",l=[],c=0,m=a.length;c<m;c++){var e=a.charAt(c);if(k)if("\\"===e&&c+1<a.length)l.push(a.charAt(++c));else if(g===e)g="",l.push(e);else if(("'"===e||'"'===e)&&""===g)g=e,l.push(e);else if("]"===
2
- e&&""===g)d.val.push(l.join("")),l=[],k=!1;else{if("]"!==e||""!==g)""===g&&","===e?(d.val.push(l.join("")),l=[]):l.push(e)}else"\\"===e&&c+1<a.length?k&&l.push(a.charAt(++c)):"["===e&&""===g?k=!0:" "===e||"+"===e?(d.sel=d.sel.join(""),f.push(d),"+"===e&&f.push({sel:"+",val:""}),d={sel:[],val:[]}):" "!==e&&"]"!==e&&d.sel.push(e)}if(0!=d.sel.length||0!=d.val.length)d.sel=d.sel.join(""),f.push(d);for(c=0;c<f.length;c++){d=f[c].sel;if("+"===d)n.tag=d;else{var n=[];n.tag=y.exec(d);n.id=x.exec(d);n.id&&
3
- b.isArray(n.id)&&(n.id=n.id[0].substr(1));n.tag||(n.tag="div");n.vars=[];for(a=0;a<f[c].val.length;a++)g=f[c].val[a].indexOf("="),k=f[c].val[a].substr(0,g),g=f[c].val[a].substr(g+1),g=g.replace(/^[\s]*[\"\']*|[\"\']*[\s]*#x2F;g,""),"text"===k?n.text=g:n.vars.push([k,g]);d=d.match(w);k=[];if(d){for(a=0;a<d.length;a++)k.push(d[a].substr(1));n.className=k.join(" ")}}f[c]=n}a=f}n=[];"undefined"===typeof p&&(p=1);d=[];f=[];k=[];g=document.createElement("div");for(c=l=0;c<a.length;c++){if("+"==a[c].tag)f=
4
k.slice(),--l;else{for(m=0;m<p;m++)if("input"==a[c].tag){e=[];e.push("<"+a[c].tag);a[c].id&&e.push("id='"+a[c].id+"'");a[c].className&&(e.push("class='"+a[c].className),c+1===a.length&&e.push(lastClass),e.push("'"));if(a[c].vars)for(var q=0;q<a[c].vars.length;q++)e.push(a[c].vars[q][0]+"='"+a[c].vars[q][1]+"'");a[c].text&&e.push("value='"+a[c].text+"'");e.push("/>");k[m]=f[m];f[m]?(f[m].innerHTML+=e.join(" "),f[m]=f[m].lastChild):(g.innerHTML=e.join(" "),f[m]=g.removeChild(g.firstChild))}else{e=document.createElement(a[c].tag);
5
- if(a[c].vars)for(q=0;q<a[c].vars.length;q++)console.log(a[c].tag,a[c].vars[q]),e.setAttribute(a[c].vars[q][0],a[c].vars[q][1]);a[c].id&&(e.id=a[c].id);a[c].className&&(e.className=a[c].className);a[c].text&&e.appendChild(document.createTextNode(a[c].text));k[m]=f[m];f[m]=f[m]?f[m].appendChild(e):e}l++||Array.prototype.push.apply(d,f)}n=b.merge(n,f)}return b(d)},v=function(h,p,a){for(var d=h.match(/%[^%]*%/g)||[],f=[],k=0;k<p.length;k++){for(var g=h,l=0;l<d.length;l++)var c=d[l].substr(1,d[l].length-
6
- 2),g=g.replace(d[l],p[k][c]);f=b.merge(f,u(g,a))}return b(f)};b.jseldom=function(h){if(2==arguments.length&&b.isPlainObject(arguments[1]))return v.apply(this,[arguments[0],[arguments[1]]]);if(1==arguments.length||2==arguments.length&&!b.isArray(arguments[1]))return u.apply(this,arguments);if(2==arguments.length)return v.apply(this,arguments)};b.fn.yith_wcan_ajax_filters=function(h,p){h.preventDefault();var a=p.href,d=b(p);if("undefined"==typeof a&&d.parents().hasClass("price_slider_wrapper")){d.parents("form");
7
- var f=window.location,k=f.origin+f.pathname,g=k!=f.href,l=b(".price_slider_amount #min_price").val(),c=b(".price_slider_amount #max_price").val(),a=f.href;1==g&&(a=t(a,"min_price"),a=t(a,"max_price"));a=a+(k==a?"?":"&")+b.param({min_price:l,max_price:c})}"select"==d.data("type")&&(d.parents("div.yith-woo-ajax-navigation").find("a.yit-wcan-select-open").removeClass("active"),d.parent().find("div.yith-wcan-select-wrapper").animate({visibility:"hidden",opacity:0},300));b(yith_wcan.container).html("").addClass("yith-wcan-loading");
8
- b(document).trigger("yith-wcan-ajax-loading");"undefined"!=typeof yith_wcan_frontend&&b(yith_wcan.container).css("backgroundImage","url("+yith_wcan_frontend.loader_url+")");b(yith_wcan.pagination).hide();b(yith_wcan.result_count).hide();b.ajax({url:a,success:function(c){b(yith_wcan.container).removeClass("yith-wcan-loading");0<b(c).find(yith_wcan.container).length?b(".yit-wcan-container").html(b(c).find(yith_wcan.container)):b(".yit-wcan-container").html(b(c).find(".woocommerce-info"));0<b(c).find(yith_wcan.pagination).length?
9
- (0==b(yith_wcan.pagination).length&&b.jseldom(yith_wcan.pagination).insertAfter(b(yith_wcan.container)),b(yith_wcan.pagination).html(b(c).find(yith_wcan.pagination).html()).show()):b(yith_wcan.pagination).empty();0<b(c).find(yith_wcan.result_count).length&&b(yith_wcan.result_count).html(b(c).find(yith_wcan.result_count).html()).show();b(".yith-woo-ajax-navigation").add(".yith-wcan-sort-by").add(".yith-wcan-stock-on-sale").add(".yith-wcan-list-price-filter").each(function(){var a=b(this),d=a.attr("id");
10
- a.html(b(c).find("#"+d).html());""==a.text()?a.hide():a.show()});navigator.userAgent.match(/msie/i)||window.history.pushState({pageTitle:c.pageTitle},"",a);b(document).trigger("ready");b(document).trigger("yith-wcan-ajax-filtered")}})};b(yith_wcan.container).wrap('<div class="yit-wcan-container"></div>');b(".woocommerce-info").wrap('<div class="yit-wcan-container"></div>');b(document).on("click",".yith-wcan a",function(h){b(this).yith_wcan_ajax_filters(h,this)});var r=function(){b("div.yith-wcan-select-wrapper").animate({visibility:"hidden",
11
opacity:0},0);b("a.yit-wcan-select-open").removeClass("active")};b(document).on("click","a.yit-wcan-select-open.active",function(h){h.preventDefault();b(this).parent().find("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},300);b(this).parent().find("a.yit-wcan-select-open").removeClass("active")});b(document).on("click","a.yit-wcan-select-open:not(.active)",function(h){h.preventDefault();b(this).parent().find("div.yith-wcan-select-wrapper").css("z-index",
12
- "1").animate({visibility:"visible",opacity:1},300);b(this).parent().find("a.yit-wcan-select-open").addClass("active")});b(document).on("ready yith-wcan-ajax-filtered",function(){b("div.yith-wcan-select-wrapper ul.yith-wcan-select li.chosen");r();b("div.yith-wcan-select-wrapper").each(function(){var h="";b(this).find("ul.yith-wcan-select li.chosen").each(function(){h+=b(this).text()+", "});h=h.substring(0,h.length-2);""!=h&&b(this).parent().find("a.yit-wcan-select-open").text(h)})});b(document).on("ready",
13
- r);b("body").on("click",function(h){b(h.target).hasClass("yit-wcan-select-open")||r()})});
1
+ jQuery(function(b){function u(b,p){return b.replace(new RegExp("[?&]"+p+"=[^&#]*(#.*)?quot;),"$1").replace(new RegExp("([?&])"+p+"=[^&]*&"),"$1")}var x=/(?!(\[))(\.)[^.#[]*/g,y=/(#)[^.#[]*/,z=/^[\w]+/,A=/^[\w]+#x2F;,v=function(h,p){var a=[];if(A.test(h))a=[{tag:h}];else{for(var a=h,d={sel:[],val:[]},f=[],k=!1,g="",l=[],c=0,m=a.length;c<m;c++){var e=a.charAt(c);if(k)if("\\"===e&&c+1<a.length)l.push(a.charAt(++c));else if(g===e)g="",l.push(e);else if(("'"===e||'"'===e)&&""===g)g=e,l.push(e);else if("]"===
2
+ e&&""===g)d.val.push(l.join("")),l=[],k=!1;else{if("]"!==e||""!==g)""===g&&","===e?(d.val.push(l.join("")),l=[]):l.push(e)}else"\\"===e&&c+1<a.length?k&&l.push(a.charAt(++c)):"["===e&&""===g?k=!0:" "===e||"+"===e?(d.sel=d.sel.join(""),f.push(d),"+"===e&&f.push({sel:"+",val:""}),d={sel:[],val:[]}):" "!==e&&"]"!==e&&d.sel.push(e)}if(0!=d.sel.length||0!=d.val.length)d.sel=d.sel.join(""),f.push(d);for(c=0;c<f.length;c++){d=f[c].sel;if("+"===d)n.tag=d;else{var n=[];n.tag=z.exec(d);n.id=y.exec(d);n.id&&
3
+ b.isArray(n.id)&&(n.id=n.id[0].substr(1));n.tag||(n.tag="div");n.vars=[];for(a=0;a<f[c].val.length;a++)g=f[c].val[a].indexOf("="),k=f[c].val[a].substr(0,g),g=f[c].val[a].substr(g+1),g=g.replace(/^[\s]*[\"\']*|[\"\']*[\s]*#x2F;g,""),"text"===k?n.text=g:n.vars.push([k,g]);d=d.match(x);k=[];if(d){for(a=0;a<d.length;a++)k.push(d[a].substr(1));n.className=k.join(" ")}}f[c]=n}a=f}n=[];"undefined"===typeof p&&(p=1);d=[];f=[];k=[];g=document.createElement("div");for(c=l=0;c<a.length;c++){if("+"==a[c].tag)f=
4
k.slice(),--l;else{for(m=0;m<p;m++)if("input"==a[c].tag){e=[];e.push("<"+a[c].tag);a[c].id&&e.push("id='"+a[c].id+"'");a[c].className&&(e.push("class='"+a[c].className),c+1===a.length&&e.push(lastClass),e.push("'"));if(a[c].vars)for(var q=0;q<a[c].vars.length;q++)e.push(a[c].vars[q][0]+"='"+a[c].vars[q][1]+"'");a[c].text&&e.push("value='"+a[c].text+"'");e.push("/>");k[m]=f[m];f[m]?(f[m].innerHTML+=e.join(" "),f[m]=f[m].lastChild):(g.innerHTML=e.join(" "),f[m]=g.removeChild(g.firstChild))}else{e=document.createElement(a[c].tag);
5
+ if(a[c].vars)for(q=0;q<a[c].vars.length;q++)console.log(a[c].tag,a[c].vars[q]),e.setAttribute(a[c].vars[q][0],a[c].vars[q][1]);a[c].id&&(e.id=a[c].id);a[c].className&&(e.className=a[c].className);a[c].text&&e.appendChild(document.createTextNode(a[c].text));k[m]=f[m];f[m]=f[m]?f[m].appendChild(e):e}l++||Array.prototype.push.apply(d,f)}n=b.merge(n,f)}return b(d)},w=function(h,p,a){for(var d=h.match(/%[^%]*%/g)||[],f=[],k=0;k<p.length;k++){for(var g=h,l=0;l<d.length;l++)var c=d[l].substr(1,d[l].length-
6
+ 2),g=g.replace(d[l],p[k][c]);f=b.merge(f,v(g,a))}return b(f)};b.jseldom=function(h){if(2==arguments.length&&b.isPlainObject(arguments[1]))return w.apply(this,[arguments[0],[arguments[1]]]);if(1==arguments.length||2==arguments.length&&!b.isArray(arguments[1]))return v.apply(this,arguments);if(2==arguments.length)return w.apply(this,arguments)};var r=!1;b.fn.yith_wcan_ajax_filters=function(h,p){h.preventDefault();var a=p.href,d=b(p);if("undefined"==typeof a&&d.parents().hasClass("price_slider_wrapper")){d.parents("form");
7
+ var f=window.location,k=f.origin+f.pathname,g=k!=f.href,l=b(".price_slider_amount #min_price").val(),c=b(".price_slider_amount #max_price").val(),a=f.href;1==g&&(a=u(a,"min_price"),a=u(a,"max_price"));a=a+(k==a?"?":"&")+b.param({min_price:l,max_price:c})}"select"==d.data("type")&&(d.parents("div.yith-woo-ajax-navigation").find("a.yit-wcan-select-open").removeClass("active"),d.parent().find("div.yith-wcan-select-wrapper").animate({visibility:"hidden",opacity:0},300));b(yith_wcan.container).html("").addClass("yith-wcan-loading");
8
+ b(document).trigger("yith-wcan-ajax-loading");"undefined"!=typeof yith_wcan_frontend&&b(yith_wcan.container).css("backgroundImage","url("+yith_wcan_frontend.loader_url+")");b(yith_wcan.pagination).hide();b(yith_wcan.result_count).hide();0!=r&&(r.abort(),r=!1,console.log("here"));r=b.ajax({url:a,success:function(c){r=!1;b(yith_wcan.container).removeClass("yith-wcan-loading");0<b(c).find(yith_wcan.container).length?b(".yit-wcan-container").html(b(c).find(yith_wcan.container)):b(".yit-wcan-container").html(b(c).find(".woocommerce-info"));
9
+ 0<b(c).find(yith_wcan.pagination).length?(0==b(yith_wcan.pagination).length&&b.jseldom(yith_wcan.pagination).insertAfter(b(yith_wcan.container)),b(yith_wcan.pagination).html(b(c).find(yith_wcan.pagination).html()).show()):b(yith_wcan.pagination).empty();0<b(c).find(yith_wcan.result_count).length&&b(yith_wcan.result_count).html(b(c).find(yith_wcan.result_count).html()).show();b(".yith-woo-ajax-navigation").add(".yith-wcan-sort-by").add(".yith-wcan-stock-on-sale").add(".yith-wcan-list-price-filter").each(function(){var a=
10
+ b(this),d=a.attr("id");a.html(b(c).find("#"+d).html());""==a.text()?a.hide():a.show()});navigator.userAgent.match(/msie/i)||window.history.pushState({pageTitle:c.pageTitle},"",a);b(document).trigger("ready");b(document).trigger("yith-wcan-ajax-filtered")}})};b(yith_wcan.container).wrap('<div class="yit-wcan-container"></div>');b(".woocommerce-info").wrap('<div class="yit-wcan-container"></div>');b(document).on("click",".yith-wcan a",function(h){b(this).yith_wcan_ajax_filters(h,this)});var t=function(){b("div.yith-wcan-select-wrapper").animate({visibility:"hidden",
11
opacity:0},0);b("a.yit-wcan-select-open").removeClass("active")};b(document).on("click","a.yit-wcan-select-open.active",function(h){h.preventDefault();b(this).parent().find("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},300);b(this).parent().find("a.yit-wcan-select-open").removeClass("active")});b(document).on("click","a.yit-wcan-select-open:not(.active)",function(h){h.preventDefault();b(this).parent().find("div.yith-wcan-select-wrapper").css("z-index",
12
+ "1").animate({visibility:"visible",opacity:1},300);b(this).parent().find("a.yit-wcan-select-open").addClass("active")});b(document).on("ready yith-wcan-ajax-filtered",function(){b("div.yith-wcan-select-wrapper ul.yith-wcan-select li.chosen");t();b("div.yith-wcan-select-wrapper").each(function(){var h="";b(this).find("ul.yith-wcan-select li.chosen").each(function(){h+=b(this).text()+", "});h=h.substring(0,h.length-2);""!=h&&b(this).parent().find("a.yit-wcan-select-open").text(h)})});b(document).on("ready",
13
+ t);b("body").on("click",function(h){b(h.target).hasClass("yit-wcan-select-open")||t()})});
includes/class.yith-wcan-admin.php CHANGED
@@ -1,275 +1,275 @@
1
- <?php
2
- /**
3
- * Admin class
4
- *
5
- * @author Your Inspiration Themes
6
- * @package YITH WooCommerce Ajax Navigation
7
- * @version 1.3.2
8
- */
9
-
10
- if ( ! defined( 'YITH_WCAN' ) ) {
11
- exit;
12
- } // Exit if accessed directly
13
-
14
- if ( ! class_exists( 'YITH_WCAN_Admin' ) ) {
15
- /**
16
- * Admin class.
17
- * The class manage all the admin behaviors.
18
- *
19
- * @since 1.0.0
20
- */
21
- class YITH_WCAN_Admin {
22
- /**
23
- * Plugin version
24
- *
25
- * @var string
26
- * @since 1.0.0
27
- */
28
- public $version;
29
-
30
- /* @var YIT_Plugin_Panel_WooCommerce */
31
- protected $_panel;
32
-
33
- /**
34
- * @var string Main Panel Option
35
- */
36
- protected $_main_panel_option;
37
-
38
- /**
39
- * @var string The panel page
40
- */
41
- protected $_panel_page = 'yith_wcan_panel';
42
-
43
- /**
44
- * @var string Official plugin documentation
45
- */
46
- protected $_official_documentation = 'https://yithemes.com/docs-plugins/yith-woocommerce-ajax-product-filter';
47
-
48
- /**
49
- * @var string Official plugin landing page
50
- */
51
- protected $_premium_landing = 'https://yithemes.com/themes/plugins/yith-woocommerce-ajax-product-filter';
52
-
53
- /**
54
- * @var string Official plugin landing page
55
- */
56
- protected $_premium_live = 'http://plugins.yithemes.com/yith-woocommerce-ajax-product-filter/shop/';
57
-
58
- /**
59
- * Constructor
60
- *
61
- * @access public
62
- * @since 1.0.0
63
- */
64
- public function __construct( $version ) {
65
- $this->version = $version;
66
-
67
- //Actions
68
- add_action( 'init', array( $this, 'init' ) );
69
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) );
70
-
71
- /* Plugin Option Panel */
72
- add_action( 'admin_menu', array( $this, 'register_panel' ), 5 );
73
- add_action( 'yit_panel_wcan_description', array( $this, 'frontend_description_option' ), 10, 3 );
74
- add_action( 'yith_wcan_premium_tab', array( $this, 'premium_tab' ) );
75
- add_action( 'yith_wcan_custom_style_tab', array( $this, 'custom_style_tab' ) );
76
-
77
- /* Plugin Informations */
78
- add_filter( 'plugin_action_links_' . plugin_basename( YITH_WCAN_DIR . '/' . basename( YITH_WCAN_FILE ) ), array( $this, 'action_links' ) );
79
- add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 4 );
80
-
81
- // YITH WCAN Loaded
82
- do_action( 'yith_wcan_loaded' );
83
- }
84
-
85
-
86
- /**
87
- * Init method:
88
- * - default options
89
- *
90
- * @access public
91
- * @since 1.0.0
92
- */
93
- public function init() {
94
- }
95
-
96
-
97
- /**
98
- * Enqueue admin styles and scripts
99
- *
100
- * @access public
101
- * @return void
102
- * @since 1.0.0
103
- */
104
- public function enqueue_styles_scripts() {
105
- global $pagenow;
106
-
107
- if ( 'widgets.php' == $pagenow || 'admin.php' == $pagenow ) {
108
- wp_enqueue_style( 'wp-color-picker' );
109
- wp_enqueue_style( 'yith_wcan_admin', YITH_WCAN_URL . 'assets/css/admin.css', array( 'yit-plugin-style' ), $this->version );
110
-
111
- wp_enqueue_script( 'wp-color-picker' );
112
- wp_enqueue_script( 'yith_wcan_admin', YITH_WCAN_URL . 'assets/js/yith-wcan-admin.js', array( 'jquery', 'wp-color-picker' ), $this->version, true );
113
- }
114
-
115
- if( 'admin.php' == $pagenow && isset( $_GET['page'] ) && 'yith_wcan_panel' == $_GET['page'] && isset( $_GET['tab'] ) && 'custom-style' == $_GET['tab'] ){
116
- wp_enqueue_style( 'codemirror-style', YITH_WCAN_URL . 'assets/3rd-party/codemirror/lib/codemirror.css', array( 'yit-plugin-style' ) );
117
- wp_enqueue_script( 'codemirror-script', YITH_WCAN_URL . 'assets/3rd-party/codemirror/lib/codemirror.js', array( 'jquery' ), false, true );
118
- wp_enqueue_script( 'codemirror-script-css', YITH_WCAN_URL . 'assets/3rd-party/codemirror/mode/css/css.js', array( 'codemirror-script' ), false, true );
119
- wp_enqueue_script( 'yith-wcan-codemirror-init', YITH_WCAN_URL . 'assets/js/yith-wcan-editor.js', array( 'jquery' ), $this->version, true );
120
- }
121
- }
122
-
123
- /**
124
- * Add a panel under YITH Plugins tab
125
- *
126
- * @return void
127
- * @since 1.0
128
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
129
- * @use /Yit_Plugin_Panel class
130
- * @see plugin-fw/lib/yit-plugin-panel.php
131
- */
132
- public function register_panel() {
133
-
134
- if ( ! empty( $this->_panel ) ) {
135
- return;
136
- }
137
-
138
- $admin_tabs = array(
139
- 'frontend' => __( 'Front end', 'yith-woocommerce-ajax-navigation' ),
140
- 'custom-style' => __( 'Custom Style', 'yith-woocommerce-ajax-navigation' ),
141
- 'premium' => __( 'Premium Version', 'yith-woocommerce-ajax-navigation' )
142
- );
143
-
144
- $args = array(
145
- 'create_menu_page' => true,
146
- 'parent_slug' => '',
147
- 'page_title' => __( 'Ajax Product Filter', 'yith-woocommerce-ajax-navigation' ),
148
- 'menu_title' => __( 'Ajax Product Filter', 'yith-woocommerce-ajax-navigation' ),
149
- 'capability' => 'manage_options',
150
- 'parent' => 'wcan',
151
- 'parent_page' => 'yit_plugin_panel',
152
- 'page' => $this->_panel_page,
153
- 'admin-tabs' => apply_filters( 'yith_wcan_settings_tabs', $admin_tabs ),
154
- 'options-path' => YITH_WCAN_DIR . '/settings',
155
- 'plugin-url' => YITH_WCAN_URL
156
- );
157
-
158
- /* === Fixed: not updated theme === */
159
- if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
160
- require_once( 'plugin-fw/lib/yit-plugin-panel-wc.php' );
161
- }
162
-
163
- $this->_panel = new YIT_Plugin_Panel( $args );
164
- $this->_main_panel_option = "yit_{$args['parent']}_options";
165
-
166
- $this->save_default_options();
167
-
168
- do_action( 'yith_wcan_after_option_panel', $args );
169
- }
170
-
171
- /**
172
- * Add default option to panel
173
- *
174
- * @return void
175
- * @since 1.0
176
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
177
- * @use /Yit_Plugin_Panel class
178
- * @see plugin-fw/lib/yit-plugin-panel.php
179
- */
180
- public function save_default_options(){
181
- $options = get_option( $this->_main_panel_option );
182
- if( $options === false ){
183
- add_option( $this->_main_panel_option, $this->_panel->get_default_options());
184
- }
185
- }
186
-
187
-
188
- /**
189
- * Premium Tab
190
- */
191
- public function premium_tab() {
192
- require_once( YITH_WCAN_DIR . 'templates/admin/premium.php' );
193
- }
194
-
195
- /**
196
- * Action Links
197
- *
198
- * add the action links to plugin admin page
199
- *
200
- * @param $links | links plugin array
201
- *
202
- * @return mixed Array
203
- * @since 1.0
204
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
205
- * @return mixed
206
- * @use plugin_action_links_{$plugin_file_name}
207
- */
208
- public function action_links( $links ) {
209
- $premium_live_text = defined( 'YITH_WCAN_FREE_INIT' ) ? __( 'Premium live demo', 'yith-woocommerce-ajax-navigation' ) : __( 'Live demo', 'yith-woocommerce-ajax-navigation' );
210
- $links[] = '<a href="' . $this->_premium_live . '" target="_blank">' . $premium_live_text . '</a>';
211
-
212
- if ( defined( 'YITH_WCAN_FREE_INIT' ) ) {
213
- $links[] = '<a href="' . $this->get_premium_landing_uri() . '" target="_blank">' . __( 'Premium Version', 'yith-woocommerce-ajax-navigation' ) . '</a>';
214
- }
215
-
216
- return $links;
217
- }
218
-
219
- /**
220
- * plugin_row_meta
221
- *
222
- * add the action links to plugin admin page
223
- *
224
- * @param $plugin_meta
225
- * @param $plugin_file
226
- * @param $plugin_data
227
- * @param $status
228
- *
229
- * @return Array
230
- * @since 1.0
231
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
232
- * @use plugin_row_meta
233
- */
234
- public function plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) {
235
-
236
- if ( ( defined( 'YITH_WCAN_INIT' ) && YITH_WCAN_INIT == $plugin_file ) || ( defined( 'YITH_WCAN_FREE_INIT' ) && YITH_WCAN_FREE_INIT == $plugin_file ) ) {
237
- $plugin_meta[] = '<a href="' . $this->_official_documentation . '" target="_blank">' . __( 'Plugin Documentation', 'yith-woocommerce-ajax-navigation' ) . '</a>';
238
- }
239
- return $plugin_meta;
240
- }
241
-
242
- /**
243
- * Get the premium landing uri
244
- *
245
- * @since 1.0.0
246
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
247
- * @return string The premium landing link
248
- */
249
- public function get_premium_landing_uri() {
250
- return defined( 'YITH_REFER_ID' ) ? $this->_premium_landing . '?refer_id=' . YITH_REFER_ID : $this->_premium_landing . '?refer_id=1030585';
251
- }
252
-
253
- /**
254
- * Add the frontend tab description
255
- *
256
- * @param $option
257
- * @param $db_value
258
- * @param $custom_attributes
259
- *
260
- * @return string The description text
261
- * @since 2.0.0
262
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
263
- */
264
- public function frontend_description_option( $option, $db_value, $custom_attributes ){
265
- echo "<p>{$option['desc']}</p>";
266
- }
267
-
268
- /**
269
- * Custom Style tab
270
- */
271
- public function custom_style_tab(){
272
- require_once( YITH_WCAN_DIR . 'templates/admin/editor.php' );
273
- }
274
- }
275
- }
1
+ <?php
2
+ /**
3
+ * Admin class
4
+ *
5
+ * @author Your Inspiration Themes
6
+ * @package YITH WooCommerce Ajax Navigation
7
+ * @version 1.3.2
8
+ */
9
+
10
+ if ( ! defined( 'YITH_WCAN' ) ) {
11
+ exit;
12
+ } // Exit if accessed directly
13
+
14
+ if ( ! class_exists( 'YITH_WCAN_Admin' ) ) {
15
+ /**
16
+ * Admin class.
17
+ * The class manage all the admin behaviors.
18
+ *
19
+ * @since 1.0.0
20
+ */
21
+ class YITH_WCAN_Admin {
22
+ /**
23
+ * Plugin version
24
+ *
25
+ * @var string
26
+ * @since 1.0.0
27
+ */
28
+ public $version;
29
+
30
+ /* @var YIT_Plugin_Panel_WooCommerce */
31
+ protected $_panel;
32
+
33
+ /**
34
+ * @var string Main Panel Option
35
+ */
36
+ protected $_main_panel_option;
37
+
38
+ /**
39
+ * @var string The panel page
40
+ */
41
+ protected $_panel_page = 'yith_wcan_panel';
42
+
43
+ /**
44
+ * @var string Official plugin documentation
45
+ */
46
+ protected $_official_documentation = 'https://yithemes.com/docs-plugins/yith-woocommerce-ajax-product-filter';
47
+
48
+ /**
49
+ * @var string Official plugin landing page
50
+ */
51
+ protected $_premium_landing = 'https://yithemes.com/themes/plugins/yith-woocommerce-ajax-product-filter';
52
+
53
+ /**
54
+ * @var string Official plugin landing page
55
+ */
56
+ protected $_premium_live = 'http://plugins.yithemes.com/yith-woocommerce-ajax-product-filter/shop/';
57
+
58
+ /**
59
+ * Constructor
60
+ *
61
+ * @access public
62
+ * @since 1.0.0
63
+ */
64
+ public function __construct( $version ) {
65
+ $this->version = $version;
66
+
67
+ //Actions
68
+ add_action( 'init', array( $this, 'init' ) );
69
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) );
70
+
71
+ /* Plugin Option Panel */
72
+ add_action( 'admin_menu', array( $this, 'register_panel' ), 5 );
73
+ add_action( 'yit_panel_wcan_description', array( $this, 'frontend_description_option' ), 10, 3 );
74
+ add_action( 'yith_wcan_premium_tab', array( $this, 'premium_tab' ) );
75
+ add_action( 'yith_wcan_custom_style_tab', array( $this, 'custom_style_tab' ) );
76
+
77
+ /* Plugin Informations */
78
+ add_filter( 'plugin_action_links_' . plugin_basename( YITH_WCAN_DIR . '/' . basename( YITH_WCAN_FILE ) ), array( $this, 'action_links' ) );
79
+ add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 4 );
80
+
81
+ // YITH WCAN Loaded
82
+ do_action( 'yith_wcan_loaded' );
83
+ }
84
+
85
+
86
+ /**
87
+ * Init method:
88
+ * - default options
89
+ *
90
+ * @access public
91
+ * @since 1.0.0
92
+ */
93
+ public function init() {
94
+ }
95
+
96
+
97
+ /**
98
+ * Enqueue admin styles and scripts
99
+ *
100
+ * @access public
101
+ * @return void
102
+ * @since 1.0.0
103
+ */
104
+ public function enqueue_styles_scripts() {
105
+ global $pagenow;
106
+
107
+ if ( 'widgets.php' == $pagenow || 'admin.php' == $pagenow ) {
108
+ wp_enqueue_style( 'wp-color-picker' );
109
+ wp_enqueue_style( 'yith_wcan_admin', YITH_WCAN_URL . 'assets/css/admin.css', array( 'yit-plugin-style' ), $this->version );
110
+
111
+ wp_enqueue_script( 'wp-color-picker' );
112
+ wp_enqueue_script( 'yith_wcan_admin', YITH_WCAN_URL . 'assets/js/yith-wcan-admin.js', array( 'jquery', 'wp-color-picker' ), $this->version, true );
113
+ }
114
+
115
+ if( 'admin.php' == $pagenow && isset( $_GET['page'] ) && 'yith_wcan_panel' == $_GET['page'] && isset( $_GET['tab'] ) && 'custom-style' == $_GET['tab'] ){
116
+ wp_enqueue_style( 'codemirror-style', YITH_WCAN_URL . 'assets/3rd-party/codemirror/lib/codemirror.css', array( 'yit-plugin-style' ) );
117
+ wp_enqueue_script( 'codemirror-script', YITH_WCAN_URL . 'assets/3rd-party/codemirror/lib/codemirror.js', array( 'jquery' ), false, true );
118
+ wp_enqueue_script( 'codemirror-script-css', YITH_WCAN_URL . 'assets/3rd-party/codemirror/mode/css/css.js', array( 'codemirror-script' ), false, true );
119
+ wp_enqueue_script( 'yith-wcan-codemirror-init', YITH_WCAN_URL . 'assets/js/yith-wcan-editor.js', array( 'jquery' ), $this->version, true );
120
+ }
121
+ }
122
+
123
+ /**
124
+ * Add a panel under YITH Plugins tab
125
+ *
126
+ * @return void
127
+ * @since 1.0
128
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
129
+ * @use /Yit_Plugin_Panel class
130
+ * @see plugin-fw/lib/yit-plugin-panel.php
131
+ */
132
+ public function register_panel() {
133
+
134
+ if ( ! empty( $this->_panel ) ) {
135
+ return;
136
+ }
137
+
138
+ $admin_tabs = array(
139
+ 'frontend' => __( 'Front end', 'yith-woocommerce-ajax-navigation' ),
140
+ 'custom-style' => __( 'Custom Style', 'yith-woocommerce-ajax-navigation' ),
141
+ 'premium' => __( 'Premium Version', 'yith-woocommerce-ajax-navigation' )
142
+ );
143
+
144
+ $args = array(
145
+ 'create_menu_page' => true,
146
+ 'parent_slug' => '',
147
+ 'page_title' => __( 'Ajax Product Filter', 'yith-woocommerce-ajax-navigation' ),
148
+ 'menu_title' => __( 'Ajax Product Filter', 'yith-woocommerce-ajax-navigation' ),
149
+ 'capability' => 'manage_options',
150
+ 'parent' => 'wcan',
151
+ 'parent_page' => 'yit_plugin_panel',
152
+ 'page' => $this->_panel_page,
153
+ 'admin-tabs' => apply_filters( 'yith_wcan_settings_tabs', $admin_tabs ),
154
+ 'options-path' => YITH_WCAN_DIR . '/settings',
155
+ 'plugin-url' => YITH_WCAN_URL
156
+ );
157
+
158
+ /* === Fixed: not updated theme === */
159
+ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
160
+ require_once( 'plugin-fw/lib/yit-plugin-panel-wc.php' );
161
+ }
162
+
163
+ $this->_panel = new YIT_Plugin_Panel( $args );
164
+ $this->_main_panel_option = "yit_{$args['parent']}_options";
165
+
166
+ $this->save_default_options();
167
+
168
+ do_action( 'yith_wcan_after_option_panel', $args );
169
+ }
170
+
171
+ /**
172
+ * Add default option to panel
173
+ *
174
+ * @return void
175
+ * @since 1.0
176
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
177
+ * @use /Yit_Plugin_Panel class
178
+ * @see plugin-fw/lib/yit-plugin-panel.php
179
+ */
180
+ public function save_default_options(){
181
+ $options = get_option( $this->_main_panel_option );
182
+ if( $options === false ){
183
+ add_option( $this->_main_panel_option, $this->_panel->get_default_options());
184
+ }
185
+ }
186
+
187
+
188
+ /**
189
+ * Premium Tab
190
+ */
191
+ public function premium_tab() {
192
+ require_once( YITH_WCAN_DIR . 'templates/admin/premium.php' );
193
+ }
194
+
195
+ /**
196
+ * Action Links
197
+ *
198
+ * add the action links to plugin admin page
199
+ *
200
+ * @param $links | links plugin array
201
+ *
202
+ * @return mixed Array
203
+ * @since 1.0
204
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
205
+ * @return mixed
206
+ * @use plugin_action_links_{$plugin_file_name}
207
+ */
208
+ public function action_links( $links ) {
209
+ $premium_live_text = defined( 'YITH_WCAN_FREE_INIT' ) ? __( 'Premium live demo', 'yith-woocommerce-ajax-navigation' ) : __( 'Live demo', 'yith-woocommerce-ajax-navigation' );
210
+ $links[] = '<a href="' . $this->_premium_live . '" target="_blank">' . $premium_live_text . '</a>';
211
+
212
+ if ( defined( 'YITH_WCAN_FREE_INIT' ) ) {
213
+ $links[] = '<a href="' . $this->get_premium_landing_uri() . '" target="_blank">' . __( 'Premium Version', 'yith-woocommerce-ajax-navigation' ) . '</a>';
214
+ }
215
+
216
+ return $links;
217
+ }
218
+
219
+ /**
220
+ * plugin_row_meta
221
+ *
222
+ * add the action links to plugin admin page
223
+ *
224
+ * @param $plugin_meta
225
+ * @param $plugin_file
226
+ * @param $plugin_data
227
+ * @param $status
228
+ *
229
+ * @return Array
230
+ * @since 1.0
231
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
232
+ * @use plugin_row_meta
233
+ */
234
+ public function plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) {
235
+
236
+ if ( ( defined( 'YITH_WCAN_INIT' ) && YITH_WCAN_INIT == $plugin_file ) || ( defined( 'YITH_WCAN_FREE_INIT' ) && YITH_WCAN_FREE_INIT == $plugin_file ) ) {
237
+ $plugin_meta[] = '<a href="' . $this->_official_documentation . '" target="_blank">' . __( 'Plugin Documentation', 'yith-woocommerce-ajax-navigation' ) . '</a>';
238
+ }
239
+ return $plugin_meta;
240
+ }
241
+
242
+ /**
243
+ * Get the premium landing uri
244
+ *
245
+ * @since 1.0.0
246
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
247
+ * @return string The premium landing link
248
+ */
249
+ public function get_premium_landing_uri() {
250
+ return defined( 'YITH_REFER_ID' ) ? $this->_premium_landing . '?refer_id=' . YITH_REFER_ID : $this->_premium_landing . '?refer_id=1030585';
251
+ }
252
+
253
+ /**
254
+ * Add the frontend tab description
255
+ *
256
+ * @param $option
257
+ * @param $db_value
258
+ * @param $custom_attributes
259
+ *
260
+ * @return string The description text
261
+ * @since 2.0.0
262
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
263
+ */
264
+ public function frontend_description_option( $option, $db_value, $custom_attributes ){
265
+ echo "<p>{$option['desc']}</p>";
266
+ }
267
+
268
+ /**
269
+ * Custom Style tab
270
+ */
271
+ public function custom_style_tab(){
272
+ require_once( YITH_WCAN_DIR . 'templates/admin/editor.php' );
273
+ }
274
+ }
275
+ }
includes/class.yith-wcan-frontend.php CHANGED
@@ -1,138 +1,138 @@
1
- <?php
2
- /**
3
- * Frontend class
4
- *
5
- * @author Your Inspiration Themes
6
- * @package YITH WooCommerce Ajax Navigation
7
- * @version 1.3.2
8
- */
9
-
10
- if ( ! defined( 'YITH_WCAN' ) ) {
11
- exit;
12
- } // Exit if accessed directly
13
-
14
- if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
15
- /**
16
- * Frontend class.
17
- * The class manage all the frontend behaviors.
18
- *
19
- * @since 1.0.0
20
- */
21
- class YITH_WCAN_Frontend {
22
- /**
23
- * Plugin version
24
- *
25
- * @var string
26
- * @since 1.0.0
27
- */
28
- public $version;
29
-
30
- /**
31
- * Constructor
32
- *
33
- * @access public
34
- * @since 1.0.0
35
- */
36
- public function __construct( $version ) {
37
- $this->version = $version;
38
-
39
- //Actions
40
- add_action( 'init', array( $this, 'woocommerce_layered_nav_init' ), 99 );
41
-
42
- add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) );
43
-
44
- // YITH WCAN Loaded
45
- do_action( 'yith_wcan_loaded' );
46
- }
47
-
48
- /**
49
- * Enqueue frontend styles and scripts
50
- *
51
- * @access public
52
- * @return void
53
- * @since 1.0.0
54
- */
55
- public function enqueue_styles_scripts() {
56
- if ( yith_wcan_can_be_displayed() ) {
57
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
58
-
59
- wp_enqueue_style( 'yith-wcan-frontend', YITH_WCAN_URL . 'assets/css/frontend.css', false, $this->version );
60
- wp_enqueue_script( 'yith-wcan-script', YITH_WCAN_URL . 'assets/js/yith-wcan-frontend' . $suffix . '.js', array( 'jquery' ), $this->version, true );
61
-
62
- $custom_style = yith_wcan_get_option( 'yith_wcan_custom_style', '' );
63
-
64
- ! empty( $custom_style ) && wp_add_inline_style( 'yith-wcan-frontend', sanitize_text_field( $custom_style ) );
65
-
66
- $args = apply_filters( 'yith_wcan_ajax_frontend_classes', array(
67
- 'container' => yith_wcan_get_option( 'yith_wcan_ajax_shop_container', '.products' ),
68
- 'pagination' => yith_wcan_get_option( 'yith_wcan_ajax_shop_pagination', 'nav.woocommerce-pagination' ),
69
- 'result_count' => yith_wcan_get_option( 'yith_wcan_ajax_shop_result_container', '.woocommerce-result-count' ),
70
- )
71
- );
72
-
73
- wp_localize_script( 'yith-wcan-script', 'yith_wcan', apply_filters( 'yith-wcan-frontend-args', $args ) );
74
- }
75
- }
76
-
77
-
78
- /**
79
- * Layered Nav Init
80
- *
81
- * @package WooCommerce/Widgets
82
- * @access public
83
- * @return void
84
- */
85
- public function woocommerce_layered_nav_init() {
86
-
87
- if ( is_active_widget( false, false, 'yith-woo-ajax-navigation', true ) && ! is_admin() ) {
88
-
89
- global $_chosen_attributes, $woocommerce;
90
-
91
- $_chosen_attributes = array();
92
-
93
- /* FIX TO WOOCOMMERCE 2.1 */
94
- $attibute_taxonomies = function_exists( 'wc_get_attribute_taxonomies' ) ? $attribute_taxonomies = wc_get_attribute_taxonomies() : $attribute_taxonomies = $woocommerce->get_attribute_taxonomies();
95
-
96
- if ( $attribute_taxonomies ) {
97
- foreach ( $attribute_taxonomies as $tax ) {
98
-
99
- $attribute = wc_sanitize_taxonomy_name( $tax->attribute_name );
100
-
101
- /* FIX TO WOOCOMMERCE 2.1 */
102
- if ( function_exists( 'wc_attribute_taxonomy_name' ) ) {
103
- $taxonomy = wc_attribute_taxonomy_name( $attribute );
104
- }
105
- else {
106
- $taxonomy = $woocommerce->attribute_taxonomy_name( $attribute );
107
- }
108
-
109
- $name = 'filter_' . $attribute;
110
- $query_type_name = 'query_type_' . $attribute;
111
-
112
- if ( ! empty( $_GET[$name] ) && taxonomy_exists( $taxonomy ) ) {
113
-
114
- $_chosen_attributes[ $taxonomy ]['terms'] = explode( ',', $_GET[ $name ] );
115
-
116
- if ( empty( $_GET[ $query_type_name ] ) || ! in_array( strtolower( $_GET[ $query_type_name ] ), array( 'and', 'or' ) ) )
117
- $_chosen_attributes[ $taxonomy ]['query_type'] = apply_filters( 'woocommerce_layered_nav_default_query_type', 'and' );
118
- else
119
- $_chosen_attributes[ $taxonomy ]['query_type'] = strtolower( $_GET[ $query_type_name ] );
120
-
121
- }
122
- }
123
- }
124
-
125
- if ( version_compare( preg_replace( '/-beta-([0-9]+)/', '', $woocommerce->version ), '2.1', '<' ) ) {
126
- add_filter( 'loop_shop_post_in', 'woocommerce_layered_nav_query' );
127
- }
128
- else {
129
- add_filter( 'loop_shop_post_in', array( WC()->query, 'layered_nav_query' ) );
130
- }
131
-
132
-
133
- }
134
- }
135
-
136
-
137
- }
138
- }
1
+ <?php
2
+ /**
3
+ * Frontend class
4
+ *
5
+ * @author Your Inspiration Themes
6
+ * @package YITH WooCommerce Ajax Navigation
7
+ * @version 1.3.2
8
+ */
9
+
10
+ if ( ! defined( 'YITH_WCAN' ) ) {
11
+ exit;
12
+ } // Exit if accessed directly
13
+
14
+ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
15
+ /**
16
+ * Frontend class.
17
+ * The class manage all the frontend behaviors.
18
+ *
19
+ * @since 1.0.0
20
+ */
21
+ class YITH_WCAN_Frontend {
22
+ /**
23
+ * Plugin version
24
+ *
25
+ * @var string
26
+ * @since 1.0.0
27
+ */
28
+ public $version;
29
+
30
+ /**
31
+ * Constructor
32
+ *
33
+ * @access public
34
+ * @since 1.0.0
35
+ */
36
+ public function __construct( $version ) {
37
+ $this->version = $version;
38
+
39
+ //Actions
40
+ add_action( 'init', array( $this, 'woocommerce_layered_nav_init' ), 99 );
41
+
42
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) );
43
+
44
+ // YITH WCAN Loaded
45
+ do_action( 'yith_wcan_loaded' );
46
+ }
47
+
48
+ /**
49
+ * Enqueue frontend styles and scripts
50
+ *
51
+ * @access public
52
+ * @return void
53
+ * @since 1.0.0
54
+ */
55
+ public function enqueue_styles_scripts() {
56
+ if ( yith_wcan_can_be_displayed() ) {
57
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
58
+
59
+ wp_enqueue_style( 'yith-wcan-frontend', YITH_WCAN_URL . 'assets/css/frontend.css', false, $this->version );
60
+ wp_enqueue_script( 'yith-wcan-script', YITH_WCAN_URL . 'assets/js/yith-wcan-frontend' . $suffix . '.js', array( 'jquery' ), $this->version, true );
61
+
62
+ $custom_style = yith_wcan_get_option( 'yith_wcan_custom_style', '' );
63
+
64
+ ! empty( $custom_style ) && wp_add_inline_style( 'yith-wcan-frontend', sanitize_text_field( $custom_style ) );
65
+
66
+ $args = apply_filters( 'yith_wcan_ajax_frontend_classes', array(
67
+ 'container' => yith_wcan_get_option( 'yith_wcan_ajax_shop_container', '.products' ),
68
+ 'pagination' => yith_wcan_get_option( 'yith_wcan_ajax_shop_pagination', 'nav.woocommerce-pagination' ),
69
+ 'result_count' => yith_wcan_get_option( 'yith_wcan_ajax_shop_result_container', '.woocommerce-result-count' ),
70
+ )
71
+ );
72
+
73
+ wp_localize_script( 'yith-wcan-script', 'yith_wcan', apply_filters( 'yith-wcan-frontend-args', $args ) );
74
+ }
75
+ }
76
+
77
+
78
+ /**
79
+ * Layered Nav Init
80
+ *
81
+ * @package WooCommerce/Widgets
82
+ * @access public
83
+ * @return void
84
+ */
85
+ public function woocommerce_layered_nav_init() {
86
+
87
+ if ( is_active_widget( false, false, 'yith-woo-ajax-navigation', true ) && ! is_admin() ) {
88
+
89
+ global $_chosen_attributes, $woocommerce;
90
+
91
+ $_chosen_attributes = array();
92
+
93
+ /* FIX TO WOOCOMMERCE 2.1 */
94
+ $attibute_taxonomies = function_exists( 'wc_get_attribute_taxonomies' ) ? $attribute_taxonomies = wc_get_attribute_taxonomies() : $attribute_taxonomies = $woocommerce->get_attribute_taxonomies();
95
+
96
+ if ( $attribute_taxonomies ) {
97
+ foreach ( $attribute_taxonomies as $tax ) {
98
+
99
+ $attribute = wc_sanitize_taxonomy_name( $tax->attribute_name );
100
+
101
+ /* FIX TO WOOCOMMERCE 2.1 */
102
+ if ( function_exists( 'wc_attribute_taxonomy_name' ) ) {
103
+ $taxonomy = wc_attribute_taxonomy_name( $attribute );
104
+ }
105
+ else {
106
+ $taxonomy = $woocommerce->attribute_taxonomy_name( $attribute );
107
+ }
108
+
109
+ $name = 'filter_' . $attribute;
110
+ $query_type_name = 'query_type_' . $attribute;
111
+
112
+ if ( ! empty( $_GET[$name] ) && taxonomy_exists( $taxonomy ) ) {
113
+
114
+ $_chosen_attributes[ $taxonomy ]['terms'] = explode( ',', $_GET[ $name ] );
115
+
116
+ if ( empty( $_GET[ $query_type_name ] ) || ! in_array( strtolower( $_GET[ $query_type_name ] ), array( 'and', 'or' ) ) )
117
+ $_chosen_attributes[ $taxonomy ]['query_type'] = apply_filters( 'woocommerce_layered_nav_default_query_type', 'and' );
118
+ else
119
+ $_chosen_attributes[ $taxonomy ]['query_type'] = strtolower( $_GET[ $query_type_name ] );
120
+
121
+ }
122
+ }
123
+ }
124
+
125
+ if ( version_compare( preg_replace( '/-beta-([0-9]+)/', '', $woocommerce->version ), '2.1', '<' ) ) {
126
+ add_filter( 'loop_shop_post_in', 'woocommerce_layered_nav_query' );
127
+ }
128
+ else {
129
+ add_filter( 'loop_shop_post_in', array( WC()->query, 'layered_nav_query' ) );
130
+ }
131
+
132
+
133
+ }
134
+ }
135
+
136
+
137
+ }
138
+ }
includes/class.yith-wcan-helper.php CHANGED
@@ -1,66 +1,66 @@
1
- <?php
2
- /**
3
- * Main class
4
- *
5
- * @author Your Inspiration Themes
6
- * @package YITH WooCommerce Ajax Navigation
7
- * @version 1.3.2
8
- */
9
-
10
- if ( ! defined( 'YITH_WCAN' ) ) {
11
- exit;
12
- } // Exit if accessed directly
13
-
14
- if ( ! class_exists( 'YITH_WCAN_Helper' ) ) {
15
- /**
16
- * YITH WooCommerce Ajax Navigation Helper
17
- *
18
- * @since 1.0.0
19
- */
20
- class YITH_WCAN_Helper {
21
-
22
- /*
23
- * Get Woocommerce Attribute Taxonomies
24
- *
25
- * @since 1.0.0
26
- * @access public
27
- */
28
- public static function attribute_taxonomies() {
29
- global $woocommerce;
30
-
31
- if ( ! isset( $woocommerce ) ) {
32
- return array();
33
- }
34
-
35
- $attributes = array();
36
- if ( function_exists( 'wc_get_attribute_taxonomies' ) ) {
37
- $attribute_taxonomies = wc_get_attribute_taxonomies();
38
- }
39
- else {
40
- $attribute_taxonomies = $woocommerce->get_attribute_taxonomies();
41
- }
42
-
43
- if ( empty( $attribute_taxonomies ) ) {
44
- return array();
45
- }
46
- foreach ( $attribute_taxonomies as $attribute ) {
47
-
48
- /* FIX TO WOOCOMMERCE 2.1 */
49
- if ( function_exists( 'wc_attribute_taxonomy_name' ) ) {
50
- $taxonomy = wc_attribute_taxonomy_name( $attribute->attribute_name );
51
- }
52
- else {
53
- $taxonomy = $woocommerce->attribute_taxonomy_name( $attribute->attribute_name );
54
- }
55
-
56
-
57
- if ( taxonomy_exists( $taxonomy ) ) {
58
- $attributes[] = $attribute->attribute_name;
59
- }
60
- }
61
-
62
- return $attributes;
63
- }
64
-
65
- }
66
}
1
+ <?php
2
+ /**
3
+ * Main class
4
+ *
5
+ * @author Your Inspiration Themes
6
+ * @package YITH WooCommerce Ajax Navigation
7
+ * @version 1.3.2
8
+ */
9
+
10
+ if ( ! defined( 'YITH_WCAN' ) ) {
11
+ exit;
12
+ } // Exit if accessed directly
13
+
14
+ if ( ! class_exists( 'YITH_WCAN_Helper' ) ) {
15
+ /**
16
+ * YITH WooCommerce Ajax Navigation Helper
17
+ *
18
+ * @since 1.0.0
19
+ */
20
+ class YITH_WCAN_Helper {
21
+
22
+ /*
23
+ * Get Woocommerce Attribute Taxonomies
24
+ *
25
+ * @since 1.0.0
26
+ * @access public
27
+ */
28
+ public static function attribute_taxonomies() {
29
+ global $woocommerce;
30
+
31
+ if ( ! isset( $woocommerce ) ) {
32
+ return array();
33
+ }
34
+
35
+ $attributes = array();
36
+ if ( function_exists( 'wc_get_attribute_taxonomies' ) ) {
37
+ $attribute_taxonomies = wc_get_attribute_taxonomies();
38
+ }
39
+ else {
40
+ $attribute_taxonomies = $woocommerce->get_attribute_taxonomies();
41
+ }
42
+
43
+ if ( empty( $attribute_taxonomies ) ) {
44
+ return array();
45
+ }
46
+ foreach ( $attribute_taxonomies as $attribute ) {
47
+
48
+ /* FIX TO WOOCOMMERCE 2.1 */
49
+ if ( function_exists( 'wc_attribute_taxonomy_name' ) ) {
50
+ $taxonomy = wc_attribute_taxonomy_name( $attribute->attribute_name );
51
+ }
52
+ else {
53
+ $taxonomy = $woocommerce->attribute_taxonomy_name( $attribute->attribute_name );
54
+ }
55
+
56
+
57
+ if ( taxonomy_exists( $taxonomy ) ) {
58
+ $attributes[] = $attribute->attribute_name;
59
+ }
60
+ }
61
+
62
+ return $attributes;
63
+ }
64
+
65
+ }
66
}
includes/class.yith-wcan.php CHANGED
@@ -1,174 +1,174 @@
1
- <?php
2
- /**
3
- * Main class
4
- *
5
- * @author Your Inspiration Themes
6
- * @package YITH WooCommerce Ajax Navigation
7
- * @version 1.3.2
8
- */
9
-
10
- if ( ! defined( 'YITH_WCAN' ) ) {
11
- exit;
12
- } // Exit if accessed directly
13
-
14
- if ( ! class_exists( 'YITH_WCAN' ) ) {
15
- /**
16
- * YITH WooCommerce Ajax Navigation
17
- *
18
- * @since 1.0.0
19
- */
20
- class YITH_WCAN {
21
- /**
22
- * Plugin version
23
- *
24
- * @var string
25
- * @since 1.0.0
26
- */
27
- public $version;
28
-
29
- /**
30
- * Frontend object
31
- *
32
- * @var string
33
- * @since 1.0.0
34
- */
35
- public $frontend = null;
36
-
37
-
38
- /**
39
- * Admin object
40
- *
41
- * @var string
42
- * @since 1.0.0
43
- */
44
- public $admin = null;
45
-
46
-
47
- /**
48
- * Main instance
49
- *
50
- * @var string
51
- * @since 1.4.0
52
- */
53
- protected static $_instance = null;
54
-
55
- /**
56
- * Constructor
57
- *
58
- * @return mixed|YITH_WCAN_Admin|YITH_WCAN_Frontend
59
- * @since 1.0.0
60
- */
61
- public function __construct() {
62
-
63
- $this->version = YITH_WCAN_VERSION;
64
-
65
- /* Load Plugin Framework */
66
- add_action( 'plugins_loaded', array( $this, 'plugin_fw_loader' ) );
67
-
68
- /* Register Widget */
69
- add_action( 'widgets_init', array( $this, 'registerWidgets' ) );
70
-
71
- $this->required();
72
-
73
- $this->init();
74
- }
75
-
76
- /**
77
- * Load and register widgets
78
- *
79
- * @access public
80
- * @since 1.0.0
81
- */