YITH WooCommerce Ajax Product Filter - Version 2.0.0

Version Description

  • Tweak: Plugin core framework
  • Updated: Languages file
  • Fixed: Prevent warning issue with no set color/label
  • Fixed: Textdomain conflict
  • Fixed: Filter doesn't work if shop page is on front
  • Removed: old default.po catalog language file
Download this release

Release Info

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

Code changes from version 1.4.1 to 2.0.0

Files changed (197) hide show
  1. README.txt +53 -44
  2. assets/css/admin.css +87 -2
  3. assets/css/frontend.css +79 -0
  4. assets/images/01-bg.png +0 -0
  5. assets/images/01-icon.png +0 -0
  6. assets/images/01.png +0 -0
  7. assets/images/02-bg.png +0 -0
  8. assets/images/02-icon.png +0 -0
  9. assets/images/02.png +0 -0
  10. assets/images/03-bg.png +0 -0
  11. assets/images/03-icon.png +0 -0
  12. assets/images/03.png +0 -0
  13. assets/images/04-bg.png +0 -0
  14. assets/images/04-icon.png +0 -0
  15. assets/images/04.png +0 -0
  16. assets/images/05-bg.png +0 -0
  17. assets/images/05-icon.png +0 -0
  18. assets/images/05.png +0 -0
  19. assets/images/06-bg.png +0 -0
  20. assets/images/06-icon.png +0 -0
  21. assets/images/06.png +0 -0
  22. assets/images/upgrade.png +0 -0
  23. assets/js/yith-wcan-admin.js +57 -8
  24. assets/js/yith-wcan-frontend.js +180 -57
  25. assets/js/yith-wcan-frontend.min.js +12 -11
  26. class.yith-wcan-admin.php +0 -105
  27. class.yith-wcan.php +0 -83
  28. includes/class.yith-wcan-admin.php +271 -0
  29. class.yith-wcan-frontend.php → includes/class.yith-wcan-frontend.php +8 -14
  30. class.yith-wcan-helper.php → includes/class.yith-wcan-helper.php +0 -0
  31. includes/class.yith-wcan.php +155 -0
  32. functions.yith-wcan.php → includes/functions.yith-wcan.php +148 -6
  33. init.php +67 -31
  34. languages/default.po +0 -202
  35. languages/yit-it_IT.mo +0 -0
  36. languages/yit-it_IT.po +0 -204
  37. languages/yit-tr_TR.mo +0 -0
  38. languages/yit-tr_TR.po +0 -205
  39. languages/yit.pot +0 -186
  40. languages/yith_wc_ajxnav-it_IT.mo +0 -0
  41. languages/yith_wc_ajxnav-it_IT.po +235 -0
  42. languages/yith_wc_ajxnav-tr_TR.mo +0 -0
  43. languages/yith_wc_ajxnav-tr_TR.po +197 -0
  44. languages/yith_wc_ajxnav.pot +134 -0
  45. plugin-fw/assets/css/chosen/chosen.css +435 -0
  46. plugin-fw/assets/css/codemirror/codemirror.css +260 -0
  47. plugin-fw/assets/css/metaboxes.css +609 -0
  48. plugin-fw/assets/css/overcast/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  49. plugin-fw/assets/css/overcast/images/ui-bg_flat_0_eeeeee_40x100.png +0 -0
  50. plugin-fw/assets/css/overcast/images/ui-bg_flat_55_c0402a_40x100.png +0 -0
  51. plugin-fw/assets/css/overcast/images/ui-bg_flat_55_eeeeee_40x100.png +0 -0
  52. plugin-fw/assets/css/overcast/images/ui-bg_glass_100_f8f8f8_1x400.png +0 -0
  53. plugin-fw/assets/css/overcast/images/ui-bg_glass_35_dddddd_1x400.png +0 -0
  54. plugin-fw/assets/css/overcast/images/ui-bg_glass_60_eeeeee_1x400.png +0 -0
  55. plugin-fw/assets/css/overcast/images/ui-bg_inset-hard_75_999999_1x100.png +0 -0
  56. plugin-fw/assets/css/overcast/images/ui-bg_inset-soft_50_c9c9c9_1x100.png +0 -0
  57. plugin-fw/assets/css/overcast/images/ui-icons_3383bb_256x240.png +0 -0
  58. plugin-fw/assets/css/overcast/images/ui-icons_454545_256x240.png +0 -0
  59. plugin-fw/assets/css/overcast/images/ui-icons_70b2e1_256x240.png +0 -0
  60. plugin-fw/assets/css/overcast/images/ui-icons_999999_256x240.png +0 -0
  61. plugin-fw/assets/css/overcast/images/ui-icons_fbc856_256x240.png +0 -0
  62. plugin-fw/assets/css/overcast/jquery-ui-1.8.9.custom.css +322 -0
  63. plugin-fw/assets/css/yit-plugin-panel.css +648 -0
  64. plugin-fw/assets/css/yit-upgrader.css +14 -0
  65. plugin-fw/assets/images/chosen/chosen-sprite.png +0 -0
  66. plugin-fw/assets/images/chosen/chosen-sprite@2x.png +0 -0
  67. plugin-fw/assets/images/double-sidebar.png +0 -0
  68. plugin-fw/assets/images/licence-error.png +0 -0
  69. plugin-fw/assets/images/no-sidebar.png +0 -0
  70. plugin-fw/assets/images/off.png +0 -0
  71. plugin-fw/assets/images/on.png +0 -0
  72. plugin-fw/assets/images/select.png +0 -0
  73. plugin-fw/assets/images/sidebar-left.png +0 -0
  74. plugin-fw/assets/images/sidebar-right.png +0 -0
  75. plugin-fw/assets/images/sleep.png +0 -0
  76. plugin-fw/assets/images/slider/grey.gif +0 -0
  77. plugin-fw/assets/images/slider/handle.png +0 -0
  78. plugin-fw/assets/images/slider/orange.gif +0 -0
  79. plugin-fw/assets/images/slider/tooltip.png +0 -0
  80. plugin-fw/assets/images/spinner.png +0 -0
  81. plugin-fw/assets/images/ui-icons_222222_256x240.png +0 -0
  82. plugin-fw/assets/images/ui-icons_2e83ff_256x240.png +0 -0
  83. plugin-fw/assets/images/ui-icons_454545_256x240.png +0 -0
  84. plugin-fw/assets/images/ui-icons_888888_256x240.png +0 -0
  85. plugin-fw/assets/images/x.png +0 -0
  86. plugin-fw/assets/images/yithemes-icon.png +0 -0
  87. plugin-fw/assets/js/chosen/ajax-chosen.jquery.js +81 -0
  88. plugin-fw/assets/js/chosen/ajax-chosen.jquery.min.js +2 -0
  89. plugin-fw/assets/js/chosen/chosen.jquery.js +1211 -0
  90. plugin-fw/assets/js/codemirror/codemirror.js +5799 -0
  91. plugin-fw/assets/js/codemirror/javascript.js +630 -0
  92. plugin-fw/assets/js/metabox.js +354 -0
  93. plugin-fw/assets/js/metabox.min.js +11 -0
  94. plugin-fw/assets/js/multisite-updater.js +216 -0
  95. plugin-fw/assets/js/multisite-updater.min.js +4 -0
  96. plugin-fw/assets/js/panel.spinner.js +139 -0
  97. plugin-fw/assets/js/panel.spinner.min.js +3 -0
  98. plugin-fw/assets/js/yit-cpt-unlimited.js +79 -0
  99. plugin-fw/assets/js/yit-cpt-unlimited.min.js +2 -0
  100. plugin-fw/assets/js/yit-cptu-sortable-posts.js +32 -0
  101. plugin-fw/assets/js/yit-plugin-panel.js +313 -0
  102. plugin-fw/assets/js/yit-plugin-panel.min.js +10 -0
  103. plugin-fw/assets/js/yit-wp-pointer.js +84 -0
  104. plugin-fw/assets/js/yit-wp-pointer.min.js +3 -0
  105. plugin-fw/languages/yith-plugin-fw-it_IT.mo +0 -0
  106. plugin-fw/languages/yith-plugin-fw-it_IT.po +988 -0
  107. plugin-fw/languages/yith-plugin-fw.pot +920 -0
  108. plugin-fw/lib/yit-cpt-unlimited.php +1775 -0
  109. plugin-fw/lib/yit-metabox.php +537 -0
  110. plugin-fw/lib/yit-plugin-common.php +1260 -0
  111. plugin-fw/lib/yit-plugin-gradients.php +536 -0
  112. plugin-fw/lib/yit-plugin-panel-wc.php +333 -0
  113. plugin-fw/lib/yit-plugin-panel.php +798 -0
  114. plugin-fw/lib/yit-plugin-subpanel.php +161 -0
  115. plugin-fw/lib/yit-pointers.php +390 -0
  116. plugin-fw/lib/yit-upgrade.php +543 -0
  117. plugin-fw/lib/yit-video.php +192 -0
  118. plugin-fw/licence/assets/css/yit-licence.css +350 -0
  119. plugin-fw/licence/assets/images/licence-error.png +0 -0
  120. plugin-fw/licence/assets/js/yit-licence.js +139 -0
  121. plugin-fw/licence/assets/js/yit-licence.min.js +4 -0
  122. plugin-fw/licence/lib/yit-licence.php +562 -0
  123. plugin-fw/licence/lib/yit-plugin-licence.php +161 -0
  124. plugin-fw/licence/lib/yit-theme-licence.php +156 -0
  125. plugin-fw/licence/templates/panel/activation/activation-panel.php +167 -0
  126. plugin-fw/templates/metaboxes/tab.php +73 -0
  127. plugin-fw/templates/metaboxes/types/ajax-products.php +63 -0
  128. plugin-fw/templates/metaboxes/types/categories.php +88 -0
  129. plugin-fw/templates/metaboxes/types/checkbox.php +23 -0
  130. plugin-fw/templates/metaboxes/types/chosen.php +32 -0
  131. plugin-fw/templates/metaboxes/types/colorpicker.php +22 -0
  132. plugin-fw/templates/metaboxes/types/contactform.php +557 -0
  133. plugin-fw/templates/metaboxes/types/customtabs.php +152 -0
  134. plugin-fw/templates/metaboxes/types/datepicker.php +21 -0
  135. plugin-fw/templates/metaboxes/types/hidden.php +18 -0
  136. plugin-fw/templates/metaboxes/types/icon-list.php +135 -0
  137. plugin-fw/templates/metaboxes/types/image-gallery.php +48 -0
  138. plugin-fw/templates/metaboxes/types/images.php +90 -0
  139. plugin-fw/templates/metaboxes/types/number.php +37 -0
  140. plugin-fw/templates/metaboxes/types/onoff.php +47 -0
  141. plugin-fw/templates/metaboxes/types/preview.php +19 -0
  142. plugin-fw/templates/metaboxes/types/responsivesliders.php +31 -0
  143. plugin-fw/templates/metaboxes/types/select-icon.php +72 -0
  144. plugin-fw/templates/metaboxes/types/select-mailchimp.php +32 -0
  145. plugin-fw/templates/metaboxes/types/select.php +32 -0
  146. plugin-fw/templates/metaboxes/types/sep.php +18 -0
  147. plugin-fw/templates/metaboxes/types/sidebar-layout.php +61 -0
  148. plugin-fw/templates/metaboxes/types/sidebarlist.php +29 -0
  149. plugin-fw/templates/metaboxes/types/sidebars.php +124 -0
  150. plugin-fw/templates/metaboxes/types/simple-text.php +20 -0
  151. plugin-fw/templates/metaboxes/types/slider.php +35 -0
  152. plugin-fw/templates/metaboxes/types/text-array.php +30 -0
  153. plugin-fw/templates/metaboxes/types/text.php +24 -0
  154. plugin-fw/templates/metaboxes/types/textarea-editor.php +42 -0
  155. plugin-fw/templates/metaboxes/types/textarea.php +25 -0
  156. plugin-fw/templates/metaboxes/types/title.php +18 -0
  157. plugin-fw/templates/metaboxes/types/typography.php +255 -0
  158. plugin-fw/templates/metaboxes/types/upload.php +24 -0
  159. plugin-fw/templates/panel/infobox.php +36 -0
  160. plugin-fw/templates/panel/types/chosen.php +36 -0
  161. plugin-fw/templates/panel/types/connected-list.php +27 -0
  162. plugin-fw/templates/panel/types/layout-panel.php +0 -0
  163. plugin-fw/templates/panel/types/on-off.php +34 -0
  164. plugin-fw/templates/panel/types/select-mailchimp.php +36 -0
  165. plugin-fw/templates/panel/types/select.php +41 -0
  166. plugin-fw/templates/panel/types/slider.php +40 -0
  167. plugin-fw/templates/panel/types/text-button.php +36 -0
  168. plugin-fw/templates/panel/types/text.php +35 -0
  169. plugin-fw/templates/panel/types/textarea-codemirror.php +40 -0
  170. plugin-fw/templates/panel/types/textarea.php +35 -0
  171. plugin-fw/templates/panel/types/upload.php +45 -0
  172. plugin-fw/templates/panel/videobox.php +83 -0
  173. plugin-fw/templates/panel/woocommerce/woocommerce-form.php +12 -0
  174. plugin-fw/templates/panel/woocommerce/woocommerce-panel.php +12 -0
  175. plugin-fw/templates/panel/woocommerce/woocommerce-upload.php +52 -0
  176. plugin-fw/yit-deactive-plugin.php +35 -0
  177. plugin-fw/yit-functions.php +821 -0
  178. plugin-fw/yit-plugin-registration-hook.php +23 -0
  179. plugin-fw/yit-plugin.php +52 -0
  180. screenshot-1.png +0 -0
  181. screenshot-2.png +0 -0
  182. screenshot-3.png +0 -0
  183. screenshot-4.png +0 -0
  184. screenshot-5.png +0 -0
  185. screenshot-6.png +0 -0
  186. screenshot-7.png +0 -0
  187. screenshot-8.png +0 -0
  188. settings/premium-options.php +23 -0
  189. templates/admin/premium.php +333 -0
  190. widgets/class.yith-wcan-navigation-widget.php +147 -121
  191. widgets/class.yith-wcan-reset-navigation-widget.php +13 -17
  192. yit-common/assets/css/yith-panel.css +0 -87
  193. yit-common/assets/js/google_fonts.json +0 -1
  194. yit-common/assets/js/yith-panel.js +0 -309
  195. yit-common/google_fonts.php +0 -76
  196. yit-common/yit-functions.php +0 -250
  197. yit-common/yith-panel.php +0 -536
README.txt CHANGED
@@ -1,71 +1,80 @@
1
- === YITH WooCommerce Ajax Navigation ===
2
3
Contributors: yithemes
4
- Tags: woocommerce, widget, ajax, ajax filtered nav, ajax navigation, ajax filtered navigation
5
- Requires at least: 3.5.1
6
- Tested up to: 4.1
7
- Stable tag: 1.4.1
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
11
- YITH WooCommerce Ajax Navigation allows you to filter the products in the Shop page without reloading the page.
12
- WooCommerce Compatible up to 2.2.x
13
-
14
15
== Description ==
16
17
- YITH WooCommerce Ajax Navigation allows you to filter the products in the Shop page without reloading the page. The plugin also includes four new types of Product Attributes visualizations: Color, Label, List and Dropdown.
18
- With Color display type you're able to assign a color (selected from a Color Picker) to each Product Attributes. With Label Color display you're able to assign a label (3 chars max) to your Product Attributes. With List display your products attributes in a list. With Dropdown you're able to display your products attributes like a select.
19
-
20
- Working demos are available here:
21
- **[LIVE DEMO 1](http://preview.yithemes.com/room09/shop/)** - **[LIVE DEMO 2](http://preview.yithemes.com/bazar/shop/)**
22
-
23
- Full documentation is available [here](http://yithemes.com/docs-plugins/yith_woocommerce_ajax_navigation/).
24
-
25
-
26
- = Installation =
27
-
28
- Once you have installed the plugin, you just need to activate the plugin in order to enable it.
29
-
30
- = Configuration =
31
32
- The widget works with Product Attributes. This means you need to create the Attributes and to assign them to your products. Once you have customized your products with Product Attributes you're able to use the Widget.
33
34
- = Developer =
35
36
- Are you a developer? Want to customize the templates or the style of the plugin? Read on the [documentation](http://yithemes.com/docs-plugins/yith_woocommerce_ajax_navigation/) and discover how to do that.
37
-
38
- = Support =
39
40
- Hi there, we have good news here: all our plugins are released for free. Wow!
41
- Already knew it, right?! Great, but maybe you do not know that: if you're looking for how to install the plugins or how to use them within your Wordpress installations, which is the right way to ask support?
42
- That's the way:
43
44
- * Register on http://yithemes.com
45
- * Go to Support > Get Support
46
47
- Here we provide support, not on wordpress.org were, usually we do not read topics. It's better to follow us or write on our forum!
48
49
== Installation ==
50
51
1. Unzip the downloaded zip file.
52
2. Upload the plugin folder into the `wp-content/plugins/` directory of your WordPress site.
53
- 3. Activate `YITH WooCommerce Ajax Navigation` from Plugins page
54
55
== Frequently Asked Questions ==
56
57
- = The widget is not displayed in my sidebar. Why? =
58
- In order to display the widget you need to assign it to the sidebar in the Shop page and you need to add Product Attributes to your product. Read the Getting Started section to learn how to add them.
59
60
== Screenshots ==
61
62
- 1. The widget in action with "Color" type selected
63
- 2. The widget in action with "Label" type selected
64
- 3. The widget in action with "Dropdown" type selected
65
- 4. The final result
66
67
== Changelog ==
68
69
= 1.4.1 =
70
71
* Fixed: Wrong attribute show with WooCommerce 2.2
@@ -122,10 +131,6 @@ In order to display the widget you need to assign it to the sidebar in the Shop
122
123
* Initial release
124
125
- == Suggestions ==
126
-
127
- If you have suggestions about how to improve YITH WooCommerce Ajax Navigation, you can [write us](mailto:plugins@yithemes.com "Your Inspiration Themes") so we can bundle them into YITH WooCommerce Ajax Navigation.
128
-
129
== Translators ==
130
131
= Available Languages =
@@ -141,6 +146,10 @@ Full documentation is available [here](http://yithemes.com/docs-plugins/yith_woo
141
142
== Upgrade notice ==
143
144
= 1.0.0 =
145
146
Initial release
1
+ === YITH WooCommerce Ajax Product Filter ===
2
3
Contributors: yithemes
4
+ Tags: 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.2.2
7
+ Stable tag: 2.0.0
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
11
+ YITH WooCommerce Ajax Product Filter offers the perfect way to search among all the products of your shop.
12
13
== Description ==
14
15
+ = Search for the exact product you are looking for =
16
17
+ A powerful plugin: YITH WooCommerce Ajax Product Filter lets you apply the filters you need to display the correct variations of the products you are looking for.
18
+ Choose among color, label, list and dropdown and your research will display those precise products that suit perfectly your needs.
19
+ An extremely helpful plugin to help customers find what they really want.
20
21
22
+ Working demos are available here:
23
+ **[LIVE DEMO 1](http://preview.yithemes.com/room09/shop/)** - **[LIVE DEMO 2](http://preview.yithemes.com/bazar/shop/)**
24
25
+ Full documentation is available [here](http://yithemes.com/docs-plugins/yith-woocommerce-ajax-product-filter/).
26
27
+ **Main Features:**
28
29
+ * Filter products with the YITH WooCommerce Ajax Product Filter widget (4 layouts)
30
+ * List
31
+ * Dropdown
32
+ * Color
33
+ * Label
34
+ * Reset all the applied filters with TITH WooCommerce Ajax Reset Filter widget
35
36
== Installation ==
37
38
1. Unzip the downloaded zip file.
39
2. Upload the plugin folder into the `wp-content/plugins/` directory of your WordPress site.
40
+ 3. Activate `YITH WooCommerce Ajax Product Filter` from Plugins page
41
42
== Frequently Asked Questions ==
43
44
+ = Why isn't the widget displayed in my sidebar? =
45
+ In order to display the widget, you need to assign it to the sidebar in the Shop page, and you also need to add Product Attributes to your product. Read the Getting Started section to learn how to add them.
46
+
47
+ = Translation issue with the latest version =
48
+ Dear users,
49
+ we would like to inform you that the YITH WooCommerce Ajax Navigation plugin will change its name in YITH WooCommerce Ajax Product Filter from the next update.
50
+ In addition to the name, with the new release the plugin textdomain will change too from "yit" to "yith_wc_ajxnav".
51
+ This modification solves the issues about textdomain conflicts generated by some translation/multilanguage plugins you have identified in the past weeks.
52
+ It may be possible that, updating the plugin, some language files will not be recognized by WordPress. In this case, you will just have to rename the language files in the correct format, changing the old textdomain with the new one.
53
+ For example, if your language files were named yit-en_GB.po and yit-en_GB.mo, you will just have to rename them respectively in yith_wc_ajxnav-en_GB.po and yith_wc_ajxnav-en_GB.mo.
54
+ After renaming the files, you can update/translate the .po file following the classic procedure for translations.
55
56
== Screenshots ==
57
58
+ 1. Admin - Appearance -> Widget: Filter Widget List Style
59
+ 2. Admin - Appearance -> Widget: Filter Widget Color Style
60
+ 3. Admin - Appearance -> Widget: Filter Widget Label Style
61
+ 4. Admin - Appearance -> Widget: Filter Widget Dropdown Style
62
+ 5. Admin - Appearance -> Widget: Filter Reset Button
63
+ 6. Frontend: Widget in sidebar
64
+ 7. Frontend: Dropdown style
65
+ 8. Frontend: Reset button and active filters
66
67
== Changelog ==
68
69
+ = 2.0.0 =
70
+
71
+ * Tweak: Plugin core framework
72
+ * Updated: Languages file
73
+ * Fixed: Prevent warning issue with no set color/label
74
+ * Fixed: Textdomain conflict
75
+ * Fixed: Filter doesn't work if shop page is on front
76
+ * Removed: old default.po catalog language file
77
+
78
= 1.4.1 =
79
80
* Fixed: Wrong attribute show with WooCommerce 2.2
131
132
* Initial release
133
134
== Translators ==
135
136
= Available Languages =
146
147
== Upgrade notice ==
148
149
+ = 2.0.0 =
150
+
151
+ New plugin core added.
152
+
153
= 1.0.0 =
154
155
Initial release
assets/css/admin.css CHANGED
@@ -15,9 +15,94 @@
15
}
16
17
.yith_wcan_placeholder td {
18
- vertical-align: top;
19
}
20
21
- p.yit-wcan-display-label, p.yit-wcan-display-color {
22
display: none;
23
}
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
+ p.yit-wcan-display-brands {
27
display: none;
28
}
29
+
30
+ p#yit-wcan-style.yit-wcan-style-color,
31
+ p#yit-wcan-style.yit-wcan-style-multicolor,
32
+ p#yit-wcan-show-count.yit-wcan-show-count-list,
33
+ p#yit-wcan-show-count.yit-wcan-show-count-brands,
34
+ p#yit-wcan-show-count.yit-wcan-show-count-tags{
35
+ display: block;
36
+ }
37
+
38
+ label.yith-wcan-reset-table{
39
+ width: 50%;
40
+ display: inline-block;
41
+ vertical-align: top;
42
+ }
43
+
44
+ /* Options Panel Customizzation */
45
+
46
+ .plugin-option .form-table tr {
47
+ background-color: #ffffff;
48
+ border: none;
49
+ }
50
+
51
+ .plugin-option .form-table tr th {
52
+ padding: 20px 10px 20px 20px;
53
+ }
54
+
55
+ .yith_wcan_placeholder .wp-picker-holder {
56
+ position: absolute;
57
+ z-index: 999;
58
+ }
59
+
60
+ .yith-wcan-multicolor .wp-picker-container .wp-picker-clear {
61
+ display: none;
62
+ }
63
+
64
+ /* == Panel Customization === */
65
+
66
+ .yit-plugins_page_yith_wcan_panel .plugin-option{
67
+ margin-right: 15px;
68
+ }
69
+
70
+ .yit-plugins_page_yith_wcan_panel .plugin-option .yit-options .option, .plugin-option .yit_options .option {
71
+ width: 270px;
72
+ }
73
+
74
+ .yit-plugins_page_yith_wcan_panel .plugin-option .yit-options .option, .plugin-option .yit_options.on_off_container .option {
75
+ width: 100px;
76
+ }
77
+
78
+ .yit-plugins_page_yith_wcan_panel .plugin-option .yit-options .option, .plugin-option .yit_options.on_off_container .description {
79
+ line-height: 38px;
80
+ }
81
+
82
+ .yit-plugins_page_yith_wcan_panel .plugin-option .form-table tr th {
83
+ width: 240px;
84
+ }
85
+
86
+ .yit-plugins_page_yith_wcan_panel .plugin-option .form-table tr th label {
87
+ line-height: 45px;
88
+ }
89
+
90
+ div#yit_wcan_options_yith_wcan_dropdown_style-container .select_wrapper {
91
+ width: 220px;
92
+ }
93
+
94
+ input.yith-wcan-price-filter-input.widefat {
95
+ width: 30%;
96
+ display: inline-block;
97
+ margin-bottom: 10px;
98
+ margin-right: 15px;
99
+ }
100
+
101
+ .yith-wcan-price-filter label {
102
+ display: block;
103
+ margin-bottom: 15px;
104
+ }
105
+
106
+ .yith-add-new-range-button {
107
+ margin-bottom: 15px;
108
+ }
assets/css/frontend.css CHANGED
@@ -32,6 +32,7 @@
32
overflow: hidden;
33
text-indent: 100%;
34
white-space: nowrap;
35
}
36
37
.woocommerce .widget_layered_nav ul.yith-wcan-color li a:hover,
@@ -170,4 +171,82 @@
170
padding-left: 30px;
171
}
172
173
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,
171
padding-left: 30px;
172
}
173
174
+ /* widget dropdown */
175
+ .widget h3.with-dropdown {
176
+ position: relative;
177
+ cursor: pointer;
178
+ }
179
+ .widget h3.with-dropdown .widget-dropdown {
180
+ border: none;
181
+ width: 22px;
182
+ height: 22px;
183
+ background: url(../images/select-arrow.png) top 0px right no-repeat;
184
+ background-size: 95% !important;
185
+ position: absolute;
186
+ top: 0;
187
+ right: 0;
188
+ }
189
+ .widget h3.with-dropdown.open .widget-dropdown {
190
+ background-position: bottom 15px right;
191
+ }
192
+
193
+ /* === Sort By === */
194
+
195
+ .yith-wcan-sort-by ul.orderby {
196
+ list-style: none;
197
+ padding: 0;
198
+ }
199
+
200
+ .yith-wcan-sort-by ul.orderby li.orderby-wrapper {
201
+ margin-bottom: 5px;
202
+ }
203
+
204
+ .yith-wcan-sort-by ul.orderby li.orderby-wrapper a.active:before,
205
+ a.yith-wcan-onsale-button.active:before,
206
+ a.yith-wcan-instock-button.active:before,
207
+ a.yith-wcan-price-link.active:before {
208
+ font-family: WooCommerce;
209
+ speak: none;
210
+ font-variant: normal;
211
+ text-transform: none;
212
+ -webkit-font-smoothing: antialiased;
213
+ text-decoration: none;
214
+ font-weight: 400;
215
+ line-height: 1;
216
+ content:"";
217
+ color: #a00;
218
+ margin-right: .618em;
219
+ }
220
+
221
+ .woocommerce .widget_layered_nav ul.yith-wcan-color li a.multicolor {
222
+ position: relative;
223
+ }
224
+
225
+ .woocommerce .widget_layered_nav ul.yith-wcan-color li a span.multicolor {
226
+ width: 0;
227
+ height: 0;
228
+ border-style: solid;
229
+ position: absolute;
230
+ top: 0;
231
+ left: 0;
232
+ margin: 0;
233
+ cursor: pointer;
234
+ }
235
+
236
+ .woocommerce .widget_layered_nav ul.yith-wcan-color li a span.multicolor.color-1{
237
+ border-width: 20px 20px 0 0;
238
+ }
239
+
240
+ .woocommerce .widget_layered_nav ul.yith-wcan-color li a span.multicolor.color-2{
241
+ border-width: 0 0 20px 20px;
242
+ }
243
+
244
+ .woocommerce .widget_layered_nav ul.yith-wcan-color li a.multicolor.round {
245
+ border-radius: 50%;
246
+ }
247
+ .woocommerce .widget_price_filter .price_slider_amount #min_price.yith_wcan_no_slider,
248
+ .woocommerce .widget_price_filter .price_slider_amount #max_price.yith_wcan_no_slider {
249
+ margin-bottom: 10px;
250
+ }
251
+
252
assets/images/01-bg.png ADDED
Binary file
assets/images/01-icon.png ADDED
Binary file
assets/images/01.png ADDED
Binary file
assets/images/02-bg.png ADDED
Binary file
assets/images/02-icon.png ADDED
Binary file
assets/images/02.png ADDED
Binary file
assets/images/03-bg.png ADDED
Binary file
assets/images/03-icon.png ADDED
Binary file
assets/images/03.png ADDED
Binary file
assets/images/04-bg.png ADDED
Binary file
assets/images/04-icon.png ADDED
Binary file
assets/images/04.png ADDED
Binary file
assets/images/05-bg.png ADDED
Binary file
assets/images/05-icon.png ADDED
Binary file
assets/images/05.png ADDED
Binary file
assets/images/06-bg.png ADDED
Binary file
assets/images/06-icon.png ADDED
Binary file
assets/images/06.png ADDED
Binary file
assets/images/upgrade.png ADDED
Binary file
assets/js/yith-wcan-admin.js CHANGED
@@ -6,30 +6,67 @@
6
* @version 1.3.2
7
*/
8
jQuery(function ($) {
9
10
- $(document).on('change', '.yith_wcan_type, .yith_wcan_attributes', function (e) {
11
- var t = this,
12
- container = $(this).parents('.widget-content').find('.yith_wcan_placeholder').html(''),
13
- spinner = container.next('.spinner').show();
14
15
16
- var display = $(this).parents('.widget-content').find('#yit-wcan-display');
17
18
var data = {
19
action : 'yith_wcan_select_type',
20
id : $('input[name=widget_id]', $(t).parents('.widget-content')).val(),
21
name : $('input[name=widget_name]', $(t).parents('.widget-content')).val(),
22
attribute: $('.yith_wcan_attributes', $(t).parents('.widget-content')).val(),
23
- value : $('.yith_wcan_type', $(t).parents('.widget-content')).val(),
24
};
25
26
/* Hierarchical hide/show */
27
- if (data.value == 'list' || data.value == 'select') {
28
display.show();
29
- } else if (data.value == 'label' || data.value == 'color') {
30
display.hide();
31
}
32
33
$.post(ajaxurl, data, function (response) {
34
spinner.hide();
35
container.html(response.content);
@@ -43,4 +80,16 @@ jQuery(function ($) {
43
$(this).wpColorPicker();
44
});
45
}).trigger('yith_colorpicker');
46
});
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
36
var data = {
37
action : 'yith_wcan_select_type',
38
id : $('input[name=widget_id]', $(t).parents('.widget-content')).val(),
39
name : $('input[name=widget_name]', $(t).parents('.widget-content')).val(),
40
attribute: $('.yith_wcan_attributes', $(t).parents('.widget-content')).val(),
41
+ value : $('.yith_wcan_type', $(t).parents('.widget-content')).val()
42
};
43
44
/* Hierarchical hide/show */
45
+ if (data.value == 'list' || data.value == 'select' || data.value == 'brands' || data.value == 'tags' ) {
46
display.show();
47
+ style.hide();
48
+ } else if (data.value == 'label' || data.value == 'color' || data.value == 'multicolor' ) {
49
display.hide();
50
}
51
52
+ if( data.value == 'color' || data.value == 'multicolor' ){
53
+ style.show();
54
+ } else {
55
+ style.hide();
56
+ }
57
+
58
+ if( data.value == 'list' || data.value == 'tags' || data.value == 'brands' ){
59
+ show_count.show();
60
+ } else {
61
+ show_count.hide();
62
+ }
63
+
64
+ if( data.value == 'tags' || data.value == 'brands' ){
65
+ attributes.hide();
66
+ } else {
67
+ attributes.show();
68
+ }
69
+
70
$.post(ajaxurl, data, function (response) {
71
spinner.hide();
72
container.html(response.content);
80
$(this).wpColorPicker();
81
});
82
}).trigger('yith_colorpicker');
83
+
84
+ $(document).on('change', '.yith-wcan-enable-custom-style', function(){
85
+ var t = $(this),
86
+ enable_custom_style = t.parents('.widget-content').find('.yith-wcan-reset-custom-style'),
87
+ checked = t.find('.yith-wcan-enable-custom-style-check').is(':checked');
88
+
89
+ checked ? enable_custom_style.fadeIn('slow') : enable_custom_style.fadeOut('slow');
90
+ });
91
+
92
+ $(document).on('change', '.yith-wcan-dropdown-check', function(){
93
+ $.select_dropdown( $(this) );
94
+ });
95
});
assets/js/yith-wcan-frontend.js CHANGED
@@ -5,109 +5,227 @@
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){for(var c={sel:[],val:[]},a=[],j=!1,h="",e=[],f=0,m=d.length;f<m;f++){var g=d.charAt(f);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{if("]"!==g||""!==h)""===h&&","===g?(c.val.push(e.join("")),
14
- e=[]):e.push(g)}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)}if(0!=c.sel.length||0!=c.val.length)c.sel=c.sel.join(""),a.push(c);for(f=0;f<a.length;f++){c=a[f].sel;if("+"===c)b.tag=c;else{var b=[];b.tag=tagexpr.exec(c);b.id=idexpr.exec(c);b.id&&$.isArray(b.id)&&(b.id=b.id[0].substr(1));b.tag||(b.tag="div");b.vars=[];for(d=0;d<a[f].val.length;d++)h=
15
- 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]);c=c.match(classexpr);j=[];if(c){for(d=0;d<c.length;d++)j.push(c[d].substr(1));b.className=j.join(" ")}}a[f]=b}return a},rmFromParent=function(d){var c=d.parentNode,a=d.nextSibling;c.removeChild(d);return a?function(){c.insertBefore(d,a)}:function(){c.appendChild(d)}},nonArrVer=function(d,c){var a=[],a=simpleselector.test(d)?[{tag:d}]:parseSelector(d),
16
- j=[];"undefined"===typeof c&&(c=1);for(var h=[],e=[],f=[],m=document.createElement("div"),g=0,b=0;b<a.length;b++){if("+"==a[b].tag)e=f.slice(),--g;else{for(var l=0;l<c;l++)if("input"==a[b].tag){var k=[];k.push("<"+a[b].tag);a[b].id&&k.push("id='"+a[b].id+"'");a[b].className&&(k.push("class='"+a[b].className),b+1===a.length&&k.push(lastClass),k.push("'"));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]+"'");a[b].text&&k.push("value='"+a[b].text+"'");k.push("/>");
17
- f[l]=e[l];e[l]?(e[l].innerHTML+=k.join(" "),e[l]=e[l].lastChild):(m.innerHTML=k.join(" "),e[l]=m.removeChild(m.firstChild))}else{k=document.createElement(a[b].tag);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]);a[b].id&&(k.id=a[b].id);a[b].className&&(k.className=a[b].className);a[b].text&&k.appendChild(document.createTextNode(a[b].text));f[l]=e[l];e[l]=e[l]?e[l].appendChild(k):k}g++||Array.prototype.push.apply(h,e)}j=
18
- $.merge(j,e)}return $(h)},arrVer=function(d,c,a){for(var j=d.match(/%[^%]*%/g)||[],h=[],e=0;e<c.length;e++){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]);h=$.merge(h,nonArrVer(f,a))}return $(h)};
19
- $.jseldom=function(d){if(2==arguments.length&&$.isPlainObject(arguments[1]))return arrVer.apply(this,[arguments[0],[arguments[1]]]);if(1==arguments.length||2==arguments.length&&!$.isArray(arguments[1]))return nonArrVer.apply(this,arguments);if(2==arguments.length)return arrVer.apply(this,arguments)};
20
-
21
- //wrap the container
22
- $(yith_wcan.container).wrap('<div class="yit-wcan-container"></div>');
23
- $('.woocommerce-info').wrap('<div class="yit-wcan-container"></div>');
24
25
- $(document).on('click', '.yith-wcan a', function(e){
26
27
- e.preventDefault();
28
- var href = this.href;
29
30
- if( $(this).data('type') == 'select' ) {
31
32
- $(this).parents('div.yith-woo-ajax-navigation').find('a.yit-wcan-select-open').removeClass('active');
33
34
- $(this).parent().find('div.yith-wcan-select-wrapper').animate({
35
36
visibility: "hidden",
37
- opacity: 0
38
39
}, 300);
40
- }
41
42
//loading
43
$(yith_wcan.container).html('').addClass('yith-wcan-loading');
44
$(yith_wcan.pagination).hide();
45
$(yith_wcan.result_count).hide();
46
47
$.ajax({
48
- url: href,
49
- success: function( response ){
50
$(yith_wcan.container).removeClass('yith-wcan-loading');
51
52
//container
53
- if( $(response).find(yith_wcan.container).length > 0 ) {
54
- $('.yit-wcan-container').html( $(response).find(yith_wcan.container) );
55
} else {
56
- $('.yit-wcan-container').html( $(response).find('.woocommerce-info') );
57
}
58
59
60
//pagination
61
- if( $(response).find(yith_wcan.pagination).length > 0 ) {
62
//se non esiste lo creo
63
- if( $(yith_wcan.pagination).length == 0 ) {
64
- $.jseldom( yith_wcan.pagination ).insertAfter( $(yith_wcan.container) );
65
}
66
67
$(yith_wcan.pagination)
68
- .html( $(response).find(yith_wcan.pagination).html())
69
.show();
70
}
71
72
//result count
73
- if( $(response).find(yith_wcan.result_count).length > 0 ) {
74
- $(yith_wcan.result_count).html( $(response).find(yith_wcan.result_count).html()).show();
75
}
76
77
78
- //load new widgets
79
- $('.yith-woo-ajax-navigation').each(function(){
80
- var id = $(this).attr('id');
81
- $(this).html( $(response).find('#'+id).html() );
82
83
- if( $(this).text() == '' ) {
84
- $(this).hide();
85
} else {
86
- $(this).show();
87
}
88
});
89
90
//update browser history (IE doesn't support it)
91
- if ( !navigator.userAgent.match(/msie/i) ) {
92
- window.history.pushState({"pageTitle":response.pageTitle},"", href);
93
}
94
95
//trigger ready event
96
$(document).trigger("ready");
97
$(document).trigger("yith-wcan-ajax-filtered");
98
}
99
-
100
});
101
});
102
103
/*AJAX NAVIGATION DROPDOWN STYLE*/
104
105
- function yit_open_select_dropdown(element){
106
107
$(element).parent().find('div.yith-wcan-select-wrapper').css("z-index", "1").animate({
108
109
visibility: "visible",
110
- opacity: 1
111
112
113
}, 300);
@@ -115,12 +233,12 @@ jQuery(function($){
115
$(element).parent().find('a.yit-wcan-select-open').addClass('active');
116
}
117
118
- function yit_close_select_dropdown(element){
119
120
$(element).parent().find('div.yith-wcan-select-wrapper').css("z-index", "-1").animate({
121
122
visibility: "hidden",
123
- opacity: 0
124
125
}, 300);
126
@@ -132,54 +250,59 @@ jQuery(function($){
132
$('div.yith-wcan-select-wrapper').animate({
133
134
visibility: "hidden",
135
- opacity: 0
136
137
}, 0);
138
139
$('a.yit-wcan-select-open').removeClass('active');
140
}
141
142
- var yit_active_filter = function() {
143
144
var filter_number = $('div.yith-wcan-select-wrapper ul.yith-wcan-select li.chosen').length;
145
146
yit_hidden_filters_wrapper();
147
148
- $('div.yith-wcan-select-wrapper').each(function() {
149
150
- var filter_name="";
151
- var chosen = $(this).find('ul.yith-wcan-select li.chosen').each(function(){
152
filter_name += $(this).text() + ', ';
153
});
154
155
filter_name = filter_name.substring(0, filter_name.length - 2);
156
157
- if(filter_name != "") {
158
$(this).parent().find('a.yit-wcan-select-open').text(filter_name);
159
}
160
- })
161
}
162
163
- $(document).on('click' , 'a.yit-wcan-select-open.active' , function(e) {
164
e.preventDefault();
165
yit_close_select_dropdown(this);
166
});
167
168
- $(document).on('click' , 'a.yit-wcan-select-open:not(.active)' , function(e) {
169
e.preventDefault();
170
yit_open_select_dropdown(this);
171
});
172
173
$(document).on('ready yith-wcan-ajax-filtered', yit_active_filter);
174
175
- $(document).on('ready', yit_hidden_filters_wrapper );
176
177
- $('body').on('click', function(e){
178
179
- if( !$(e.target).hasClass('yit-wcan-select-open') ) {
180
yit_hidden_filters_wrapper();
181
}
182
183
});
184
185
});
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
+
145
+ if (typeof yith_wcan_frontend != 'undefined') {
146
+ $(yith_wcan.container).css('backgroundImage', 'url(' + yith_wcan_frontend.loader_url + ')');
147
+ }
148
+
149
$(yith_wcan.pagination).hide();
150
$(yith_wcan.result_count).hide();
151
152
$.ajax({
153
+ url : href,
154
+ success: function (response) {
155
$(yith_wcan.container).removeClass('yith-wcan-loading');
156
157
//container
158
+ if ($(response).find(yith_wcan.container).length > 0) {
159
+ $('.yit-wcan-container').html($(response).find(yith_wcan.container));
160
} else {
161
+ $('.yit-wcan-container').html($(response).find('.woocommerce-info'));
162
}
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
//result count
178
+ if ($(response).find(yith_wcan.result_count).length > 0) {
179
+ $(yith_wcan.result_count).html($(response).find(yith_wcan.result_count).html()).show();
180
}
181
182
183
+ var widget_reload = function (t) {
184
+ var id = t.attr('id');
185
+ t.html($(response).find('#' + id).html());
186
187
+ if (t.text() == '') {
188
+ t.hide();
189
} else {
190
+ t.show();
191
}
192
+ };
193
+
194
+ //load new widgets
195
+ $('.yith-woo-ajax-navigation').add('.yith-wcan-sort-by').add('.yith-wcan-stock-on-sale').add('.yith-wcan-list-price-filter').each(function () {
196
+ var t = $(this);
197
+ widget_reload(t)
198
});
199
200
//update browser history (IE doesn't support it)
201
+ if (!navigator.userAgent.match(/msie/i)) {
202
+ window.history.pushState({"pageTitle": response.pageTitle}, "", href);
203
}
204
205
//trigger ready event
206
$(document).trigger("ready");
207
$(document).trigger("yith-wcan-ajax-filtered");
208
}
209
});
210
+ };
211
+
212
+ //wrap the container
213
+ $(yith_wcan.container).wrap('<div class="yit-wcan-container"></div>');
214
+ $('.woocommerce-info').wrap('<div class="yit-wcan-container"></div>');
215
+
216
+ $(document).on('click', '.yith-wcan a', function (e) {
217
+ $(this).yith_wcan_ajax_filters(e, this);
218
});
219
220
+
221
/*AJAX NAVIGATION DROPDOWN STYLE*/
222
223
+ function yit_open_select_dropdown(element) {
224
225
$(element).parent().find('div.yith-wcan-select-wrapper').css("z-index", "1").animate({
226
227
visibility: "visible",
228
+ opacity : 1
229
230
231
}, 300);
233
$(element).parent().find('a.yit-wcan-select-open').addClass('active');
234
}
235
236
+ function yit_close_select_dropdown(element) {
237
238
$(element).parent().find('div.yith-wcan-select-wrapper').css("z-index", "-1").animate({
239
240
visibility: "hidden",
241
+ opacity : 0
242
243
}, 300);
244
250
$('div.yith-wcan-select-wrapper').animate({
251
252
visibility: "hidden",
253
+ opacity : 0
254
255
}, 0);
256
257
$('a.yit-wcan-select-open').removeClass('active');
258
}
259
260
+ var yit_active_filter = function () {
261
262
var filter_number = $('div.yith-wcan-select-wrapper ul.yith-wcan-select li.chosen').length;
263
264
yit_hidden_filters_wrapper();
265
266
+ $('div.yith-wcan-select-wrapper').each(function () {
267
268
+ var filter_name = "";
269
+ var chosen = $(this).find('ul.yith-wcan-select li.chosen').each(function () {
270
filter_name += $(this).text() + ', ';
271
});
272
273
filter_name = filter_name.substring(0, filter_name.length - 2);
274
275
+ if (filter_name != "") {
276
$(this).parent().find('a.yit-wcan-select-open').text(filter_name);
277
}
278
+ })
279
}
280
281
+ $(document).on('click', 'a.yit-wcan-select-open.active', function (e) {
282
e.preventDefault();
283
yit_close_select_dropdown(this);
284
});
285
286
+ $(document).on('click', 'a.yit-wcan-select-open:not(.active)', function (e) {
287
e.preventDefault();
288
yit_open_select_dropdown(this);
289
});
290
291
$(document).on('ready yith-wcan-ajax-filtered', yit_active_filter);
292
293
+ $(document).on('ready', yit_hidden_filters_wrapper);
294
295
+ $('body').on('click', function (e) {
296
297
+ if (!$(e.target).hasClass('yit-wcan-select-open')) {
298
yit_hidden_filters_wrapper();
299
}
300
301
});
302
303
+ function RemoveParameterFromUrl(url, parameter) {
304
+ return url
305
+ .replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?#x27;), '$1')
306
+ .replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
307
+ }
308
});
assets/js/yith-wcan-frontend.min.js CHANGED
@@ -1,11 +1,12 @@
1
- jQuery(function(a){var u=/(?!(\[))(\.)[^.#[]*/g,v=/(#)[^.#[]*/,w=/^[\w]+/,x=/^[\w]+#x2F;,s=function(h,q){var b=[];if(x.test(h))b=[{tag:h}];else{for(var b=h,e={sel:[],val:[]},f=[],k=!1,g="",l=[],c=0,m=b.length;c<m;c++){var d=b.charAt(c);if(k)if("\\"===d&&c+1<b.length)l.push(b.charAt(++c));else if(g===d)g="",l.push(d);else if(("'"===d||'"'===d)&&""===g)g=d,l.push(d);else if("]"===d&&""===g)e.val.push(l.join("")),l=[],k=!1;else{if("]"!==d||""!==g)""===g&&","===d?(e.val.push(l.join("")),l=[]):l.push(d)}else"\\"===
2
- d&&c+1<b.length?k&&l.push(b.charAt(++c)):"["===d&&""===g?k=!0:" "===d||"+"===d?(e.sel=e.sel.join(""),f.push(e),"+"===d&&f.push({sel:"+",val:""}),e={sel:[],val:[]}):" "!==d&&"]"!==d&&e.sel.push(d)}if(0!=e.sel.length||0!=e.val.length)e.sel=e.sel.join(""),f.push(e);for(c=0;c<f.length;c++){e=f[c].sel;if("+"===e)n.tag=e;else{var n=[];n.tag=w.exec(e);n.id=v.exec(e);n.id&&a.isArray(n.id)&&(n.id=n.id[0].substr(1));n.tag||(n.tag="div");n.vars=[];for(b=0;b<f[c].val.length;b++)g=f[c].val[b].indexOf("="),k=f[c].val[b].substr(0,
3
- g),g=f[c].val[b].substr(g+1),g=g.replace(/^[\s]*[\"\']*|[\"\']*[\s]*#x2F;g,""),"text"===k?n.text=g:n.vars.push([k,g]);e=e.match(u);k=[];if(e){for(b=0;b<e.length;b++)k.push(e[b].substr(1));n.className=k.join(" ")}}f[c]=n}b=f}n=[];"undefined"===typeof q&&(q=1);e=[];f=[];k=[];g=document.createElement("div");for(c=l=0;c<b.length;c++){if("+"==b[c].tag)f=k.slice(),--l;else{for(m=0;m<q;m++)if("input"==b[c].tag){d=[];d.push("<"+b[c].tag);b[c].id&&d.push("id='"+b[c].id+"'");b[c].className&&(d.push("class='"+
4
- b[c].className),c+1===b.length&&d.push(lastClass),d.push("'"));if(b[c].vars)for(var p=0;p<b[c].vars.length;p++)d.push(b[c].vars[p][0]+"='"+b[c].vars[p][1]+"'");b[c].text&&d.push("value='"+b[c].text+"'");d.push("/>");k[m]=f[m];f[m]?(f[m].innerHTML+=d.join(" "),f[m]=f[m].lastChild):(g.innerHTML=d.join(" "),f[m]=g.removeChild(g.firstChild))}else{d=document.createElement(b[c].tag);if(b[c].vars)for(p=0;p<b[c].vars.length;p++)console.log(b[c].tag,b[c].vars[p]),d.setAttribute(b[c].vars[p][0],b[c].vars[p][1]);
5
- b[c].id&&(d.id=b[c].id);b[c].className&&(d.className=b[c].className);b[c].text&&d.appendChild(document.createTextNode(b[c].text));k[m]=f[m];f[m]=f[m]?f[m].appendChild(d):d}l++||Array.prototype.push.apply(e,f)}n=a.merge(n,f)}return a(e)},t=function(h,q,b){for(var e=h.match(/%[^%]*%/g)||[],f=[],k=0;k<q.length;k++){for(var g=h,l=0;l<e.length;l++)var c=e[l].substr(1,e[l].length-2),g=g.replace(e[l],q[k][c]);f=a.merge(f,s(g,b))}return a(f)};a.jseldom=function(h){if(2==arguments.length&&a.isPlainObject(arguments[1]))return t.apply(this,
6
- [arguments[0],[arguments[1]]]);if(1==arguments.length||2==arguments.length&&!a.isArray(arguments[1]))return s.apply(this,arguments);if(2==arguments.length)return t.apply(this,arguments)};a(yith_wcan.container).wrap('<div class="yit-wcan-container"></div>');a(".woocommerce-info").wrap('<div class="yit-wcan-container"></div>');a(document).on("click",".yith-wcan a",function(h){h.preventDefault();var q=this.href;"select"==a(this).data("type")&&(a(this).parents("div.yith-woo-ajax-navigation").find("a.yit-wcan-select-open").removeClass("active"),
7
- a(this).parent().find("div.yith-wcan-select-wrapper").animate({visibility:"hidden",opacity:0},300));a(yith_wcan.container).html("").addClass("yith-wcan-loading");a(yith_wcan.pagination).hide();a(yith_wcan.result_count).hide();a.ajax({url:q,success:function(b){a(yith_wcan.container).removeClass("yith-wcan-loading");0<a(b).find(yith_wcan.container).length?a(".yit-wcan-container").html(a(b).find(yith_wcan.container)):a(".yit-wcan-container").html(a(b).find(".woocommerce-info"));0<a(b).find(yith_wcan.pagination).length&&
8
- (0==a(yith_wcan.pagination).length&&a.jseldom(yith_wcan.pagination).insertAfter(a(yith_wcan.container)),a(yith_wcan.pagination).html(a(b).find(yith_wcan.pagination).html()).show());0<a(b).find(yith_wcan.result_count).length&&a(yith_wcan.result_count).html(a(b).find(yith_wcan.result_count).html()).show();a(".yith-woo-ajax-navigation").each(function(){var e=a(this).attr("id");a(this).html(a(b).find("#"+e).html());""==a(this).text()?a(this).hide():a(this).show()});navigator.userAgent.match(/msie/i)||
9
- window.history.pushState({pageTitle:b.pageTitle},"",q);a(document).trigger("ready");a(document).trigger("yith-wcan-ajax-filtered")}})});var r=function(){a("div.yith-wcan-select-wrapper").animate({visibility:"hidden",opacity:0},0);a("a.yit-wcan-select-open").removeClass("active")};a(document).on("click","a.yit-wcan-select-open.active",function(h){h.preventDefault();a(this).parent().find("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},300);a(this).parent().find("a.yit-wcan-select-open").removeClass("active")});
10
- a(document).on("click","a.yit-wcan-select-open:not(.active)",function(h){h.preventDefault();a(this).parent().find("div.yith-wcan-select-wrapper").css("z-index","1").animate({visibility:"visible",opacity:1},300);a(this).parent().find("a.yit-wcan-select-open").addClass("active")});a(document).on("ready yith-wcan-ajax-filtered",function(){a("div.yith-wcan-select-wrapper ul.yith-wcan-select li.chosen");r();a("div.yith-wcan-select-wrapper").each(function(){var h="";a(this).find("ul.yith-wcan-select li.chosen").each(function(){h+=
11
- a(this).text()+", "});h=h.substring(0,h.length-2);""!=h&&a(this).parent().find("a.yit-wcan-select-open").text(h)})});a(document).on("ready",r);a("body").on("click",function(h){a(h.target).hasClass("yit-wcan-select-open")||r()})});
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
+ "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&&(0==b(yith_wcan.pagination).length&&
9
+ b.jseldom(yith_wcan.pagination).insertAfter(b(yith_wcan.container)),b(yith_wcan.pagination).html(b(c).find(yith_wcan.pagination).html()).show());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");a.html(b(c).find("#"+d).html());""==a.text()?a.hide():a.show()});
10
+ 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",opacity:0},0);b("a.yit-wcan-select-open").removeClass("active")};
11
+ 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","1").animate({visibility:"visible",opacity:1},300);b(this).parent().find("a.yit-wcan-select-open").addClass("active")});
12
+ 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",r);b("body").on("click",function(h){b(h.target).hasClass("yit-wcan-select-open")||r()})});
class.yith-wcan-admin.php DELETED
@@ -1,105 +0,0 @@
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' ) ) { exit; } // Exit if accessed directly
11
-
12
- if( !class_exists( 'YITH_WCAN_Admin' ) ) {
13
- /**
14
- * Admin class.
15
- * The class manage all the admin behaviors.
16
- *
17
- * @since 1.0.0
18
- */
19
- class YITH_WCAN_Admin {
20
- /**
21
- * Plugin version
22
- *
23
- * @var string
24
- * @since 1.0.0
25
- */
26
- public $version;
27
-
28
- /**
29
- * Constructor
30
- *
31
- * @access public
32
- * @since 1.0.0
33
- */
34
- public function __construct( $version ) {
35
- $this->version = $version;
36
-
37
- //Actions
38
- add_action( 'init', array( $this, 'init' ) );
39
- add_action('wp_ajax_yith_wcan_select_type', array( $this, 'ajax_print_terms') );
40
-
41
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) );
42
-
43
- // YITH WCAN Loaded
44
- do_action( 'yith_wcan_loaded' );
45
- }
46
-
47
-
48
- /**
49
- * Init method:
50
- * - default options
51
- *
52
- * @access public
53
- * @since 1.0.0
54
- */
55
- public function init() {}
56
-
57
-
58
- /**
59
- * Enqueue admin styles and scripts
60
- *
61
- * @access public
62
- * @return void
63
- * @since 1.0.0
64
- */
65
- public function enqueue_styles_scripts() {
66
- global $pagenow;
67
-
68
- if( 'widgets.php' == $pagenow ) {
69
- wp_enqueue_style( 'wp-color-picker' );
70
- wp_enqueue_style( 'yith_wcan_admin', YITH_WCAN_URL . 'assets/css/admin.css', false, $this->version );
71
-
72
- wp_enqueue_script( 'wp-color-picker' );
73
- wp_enqueue_script( 'yith_wcan_admin', YITH_WCAN_URL . 'assets/js/yith-wcan-admin.js', array('jquery', 'wp-color-picker'), $this->version, true );
74
- }
75
- }
76
-
77
- /**
78
- * Print terms for the element selected
79
- *
80
- * @access public
81
- * @return void
82
- * @since 1.0.0
83
- */
84
- public function ajax_print_terms() {
85
- $type = $_POST['value'];
86
- $attribute = $_POST['attribute'];
87
- $return = array('message' => '', 'content' => $_POST);
88
-
89
- $terms = get_terms( 'pa_' . $attribute, array('hide_empty'=>'0') );
90
-
91
- $return['content'] = yith_wcan_attributes_table(
92
- $type,
93
- $attribute,
94
- $_POST['id'],
95
- $_POST['name'],
96
- json_decode($_POST['value']),
97
- false
98
- );
99
-
100
- echo json_encode($return);
101
- die();
102
- }
103
-
104
- }
105
- }
class.yith-wcan.php DELETED
@@ -1,83 +0,0 @@
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 = '1.4.0';
28
-
29
- /**
30
- * Plugin object
31
- *
32
- * @var string
33
- * @since 1.0.0
34
- */
35
- public $obj = null;
36
-
37
- /**
38
- * Constructor
39
- *
40
- * @return mixed|YITH_WCAN_Admin|YITH_WCAN_Frontend
41
- * @since 1.0.0
42
- */
43
- public function __construct() {
44
-
45
- // actions
46
- add_action( 'init', array( $this, 'init' ) );
47
- add_action( 'widgets_init', array( $this, 'registerWidgets' ) );
48
-
49
-
50
- if ( is_admin() ) {
51
- $this->obj = new YITH_WCAN_Admin( $this->version );
52
- }
53
- else {
54
- $this->obj = new YITH_WCAN_Frontend( $this->version );
55
- }
56
-
57
- return $this->obj;
58
- }
59
-
60
-
61
- /**
62
- * Init method
63
- *
64
- * @access public
65
- * @since 1.0.0
66
- */
67
- public function init() {
68
- }
69
-
70
-
71
- /**
72
- * Load and register widgets
73
- *
74
- * @access public
75
- * @since 1.0.0
76
- */
77
- public function registerWidgets() {
78
- register_widget( 'YITH_WCAN_Navigation_Widget' );
79
- register_widget( 'YITH_WCAN_Reset_Navigation_Widget' );
80
- }
81
-
82
- }
83
- }
includes/class.yith-wcan-admin.php ADDED
@@ -0,0 +1,271 @@
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' ) ) { exit; } // Exit if accessed directly
11
+
12
+ if( !class_exists( 'YITH_WCAN_Admin' ) ) {
13
+ /**
14
+ * Admin class.
15
+ * The class manage all the admin behaviors.
16
+ *
17
+ * @since 1.0.0
18
+ */
19
+ class YITH_WCAN_Admin {
20
+ /**
21
+ * Plugin version
22
+ *
23
+ * @var string
24
+ * @since 1.0.0
25
+ */
26
+ public $version;
27
+
28
+ /* @var YIT_Plugin_Panel_WooCommerce */
29
+ protected $_panel;
30
+
31
+ /**
32
+ * @var string The panel page
33
+ */
34
+ protected $_panel_page = 'yith_wcan_panel';
35
+
36
+ /**
37
+ * @var string Official plugin documentation
38
+ */
39
+ protected $_official_documentation = 'https://yithemes.com/docs-plugins/yith-woocommerce-ajax-product-filter' ;
40
+
41
+ /**
42
+ * @var string Official plugin landing page
43
+ */
44
+ protected $_premium_landing = 'https://yithemes.com/themes/plugins/yith-woocommerce-ajax-product-filter' ;
45
+
46
+ /**
47
+ * @var string Official plugin landing page
48
+ */
49
+ protected $_premium_live = 'http://plugins.yithemes.com/yith-woocommerce-ajax-product-filter/shop/' ;
50
+
51
+ /**
52
+ * Constructor
53
+ *
54
+ * @access public
55
+ * @since 1.0.0
56
+ */
57
+ public function __construct( $version ) {
58
+ $this->version = $version;
59
+
60
+ //Actions
61
+ add_action( 'init', array( $this, 'init' ) );
62
+ add_action('wp_ajax_yith_wcan_select_type', array( $this, 'ajax_print_terms') );
63
+
64
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) );
65
+ add_action( 'admin_menu', array( $this, 'register_panel' ), 5 );
66
+
67
+ add_action( 'yith_wcan_premium_tab', array( $this, 'premium_tab' ) );
68
+
69
+ /* Plugin Informations */
70
+ add_filter( 'plugin_action_links_' . plugin_basename( YITH_WCAN_DIR . '/' . basename( YITH_WCAN_FILE ) ), array( $this, 'action_links' ) );
71
+ add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 4 );
72
+
73
+ /* Add WordPress Pointer */
74
+ add_action( 'admin_init', array( $this, 'register_pointer' ) );
75
+
76
+
77
+ // YITH WCAN Loaded
78
+ do_action( 'yith_wcan_loaded' );
79
+ }
80
+
81
+
82
+ /**
83
+ * Init method:
84
+ * - default options
85
+ *
86
+ * @access public
87
+ * @since 1.0.0
88
+ */
89
+ public function init() {}
90
+
91
+
92
+ /**
93
+ * Enqueue admin styles and scripts
94
+ *
95
+ * @access public
96
+ * @return void
97
+ * @since 1.0.0
98
+ */
99
+ public function enqueue_styles_scripts() {
100
+ global $pagenow;
101
+
102
+ if( 'widgets.php' == $pagenow || 'admin.php' == $pagenow ) {
103
+ wp_enqueue_style( 'wp-color-picker' );
104
+ wp_enqueue_style( 'yith_wcan_admin', YITH_WCAN_URL . 'assets/css/admin.css', array( 'yit-plugin-style' ), $this->version );
105
+
106
+ wp_enqueue_script( 'wp-color-picker' );
107
+ wp_enqueue_script( 'yith_wcan_admin', YITH_WCAN_URL . 'assets/js/yith-wcan-admin.js', array('jquery', 'wp-color-picker'), $this->version, true );
108
+ }
109
+ }
110
+
111
+ /**
112
+ * Print terms for the element selected
113
+ *
114
+ * @access public
115
+ * @return void
116
+ * @since 1.0.0
117
+ */
118
+ public function ajax_print_terms() {
119
+ $type = $_POST['value'];
120
+ $attribute = $_POST['attribute'];
121
+ $return = array('message' => '', 'content' => $_POST);
122
+
123
+ $terms = get_terms( 'pa_' . $attribute, array('hide_empty'=>'0') );
124
+
125
+ $return['content'] = yith_wcan_attributes_table(
126
+ $type,
127
+ $attribute,
128
+ $_POST['id'],
129
+ $_POST['name'],
130
+ json_decode($_POST['value']),
131
+ false
132
+ );
133
+
134
+ echo json_encode($return);
135
+ die();
136
+ }
137
+ /**
138
+ * Add a panel under YITH Plugins tab
139
+ *
140
+ * @return void
141
+ * @since 1.0
142
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
143
+ * @use /Yit_Plugin_Panel class
144
+ * @see plugin-fw/lib/yit-plugin-panel.php
145
+ */
146
+ public function register_panel() {
147
+
148
+ if ( ! empty( $this->_panel ) ) {
149
+ return;
150
+ }
151
+
152
+ $admin_tabs = array(
153
+ 'premium' => __( 'Premium Version', 'yith_wc_ajxnav' )
154
+ );
155
+
156
+ $args = array(
157
+ 'create_menu_page' => true,
158
+ 'parent_slug' => '',
159
+ 'page_title' => __( 'Ajax Product Filter', 'yith_wc_ajxnav' ),
160
+ 'menu_title' => __( 'Ajax Product Filter', 'yith_wc_ajxnav' ),
161
+ 'capability' => 'manage_options',
162
+ 'parent' => 'wcan',
163
+ 'parent_page' => 'yit_plugin_panel',
164
+ 'page' => $this->_panel_page,
165
+ 'admin-tabs' => apply_filters( 'yith_wcan_settings_tabs', $admin_tabs ),
166
+ 'options-path' => YITH_WCAN_DIR . '/settings',
167
+ 'plugin-url' => YITH_WCAN_URL
168
+ );
169
+
170
+ /* === Fixed: not updated theme === */
171
+ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
172
+ require_once( 'plugin-fw/lib/yit-plugin-panel-wc.php' );
173
+ }
174
+
175
+ $this->_panel = new YIT_Plugin_Panel( $args );
176
+ }
177
+
178
+ public function premium_tab(){
179
+ require_once( YITH_WCAN_DIR . 'templates/admin/premium.php' );
180
+ }
181
+
182
+ /**
183
+ * Action Links
184
+ *
185
+ * add the action links to plugin admin page
186
+ *
187
+ * @param $links | links plugin array
188
+ *
189
+ * @return mixed Array
190
+ * @since 1.0
191
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
192
+ * @return mixed
193
+ * @use plugin_action_links_{$plugin_file_name}
194
+ */
195
+ public function action_links( $links ) {
196
+ $premium_live_text = defined( 'YITH_WCAN_FREE_INIT' ) ? __( 'Premium live demo', 'yith_wc_product_vendors' ) : __( 'Live demo', 'yith_wc_product_vendors' );
197
+ $links[] = '<a href="' . $this->_premium_live . '" target="_blank">' . $premium_live_text . '</a>';
198
+
199
+ if ( defined( 'YITH_WCAN_FREE_INIT' ) ) {
200
+ $links[] = '<a href="' . $this->get_premium_landing_uri() . '" target="_blank">' . __( 'Premium Version', 'yith_wc_product_vendors' ) . '</a>';
201
+ }
202
+
203
+ return $links;
204
+ }
205
+
206
+ /**
207
+ * plugin_row_meta
208
+ *
209
+ * add the action links to plugin admin page
210
+ *
211
+ * @param $plugin_meta
212
+ * @param $plugin_file
213
+ * @param $plugin_data
214
+ * @param $status
215
+ *
216
+ * @return Array
217
+ * @since 1.0
218
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
219
+ * @use plugin_row_meta
220
+ */
221
+ public function plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) {
222
+
223
+ if( ( defined( 'YITH_WCAN_INIT' ) && YITH_WCAN_INIT == $plugin_file ) || ( defined( 'YITH_WCAN_FREE_INIT' ) && YITH_WCAN_FREE_INIT == $plugin_file ) ){
224
+ $plugin_meta[] = '<a href="' . $this->_official_documentation . '" target="_blank">' . __( 'Plugin Documentation', 'yith_wc_product_vendors' ) . '</a>';
225
+ }
226
+ return $plugin_meta;
227
+ }
228
+
229
+ /**
230
+ * Get the premium landing uri
231
+ *
232
+ * @since 1.0.0
233
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
234
+ * @return string The premium landing link
235
+ */
236
+ public function get_premium_landing_uri() {
237
+ return defined( 'YITH_REFER_ID' ) ? $this->_premium_landing . '?refer_id=' . YITH_REFER_ID : $this->_premium_landing . '?refer_id=1030585';
238
+ }
239
+
240
+ public function register_pointer() {
241
+
242
+ if ( ! class_exists( 'YIT_Pointers' ) ) {
243
+ include_once( 'plugin-fw/lib/yit-pointers.php' );
244
+ }
245
+
246
+ $message = __( 'Dear users,
247
+ we would like to inform you that the YITH WooCommerce Ajax Navigation plugin will change its name in YITH WooCommerce Ajax Product Filter from the next update. Also, the plugin textdomain will change too from "yit" to "yith_wc_ajxnav".
248
+ This modification solves the issues about textdomain conflicts generated by some translation/multilanguage plugins you have identified in the past weeks.
249
+ If updating the plugin some language files are no more recognized by WordPress, you will just have to rename the language files in the correct format. After renaming the files, you can update/translate the .po file following the classic procedure for translations.', 'yith_wc_ajxnav' );
250
+
251
+ $plugin_name = __( 'YITH WooCommerce Ajax Product Filter', 'yith_wc_ajxnav' );
252
+
253
+ $args = array();
254
+ foreach ( array( 'plugins', 'update' ) as $screen ) {
255
+ $args[] = array(
256
+ 'screen_id' => $screen,
257
+ 'pointer_id' => 'yith_wcan_panel',
258
+ 'target' => '#toplevel_page_yit_plugin_panel',
259
+ 'content' => sprintf( '<h3> %s </h3> <p> %s </p>',
260
+ $plugin_name,
261
+ $message
262
+ ),
263
+ 'position' => array( 'edge' => 'left', 'align' => 'center' ),
264
+ 'init' => YITH_WCAN_FREE_INIT
265
+ );
266
+ }
267
+
268
+ YIT_Pointers()->register( $args );
269
+ }
270
+ }
271
+ }
class.yith-wcan-frontend.php → includes/class.yith-wcan-frontend.php RENAMED
@@ -94,9 +94,9 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
94
95
if ( is_active_widget( false, false, 'yith-woo-ajax-navigation', true ) && ! is_admin() ) {
96
97
- global $_chosen_attributes, $woocommerce, $_attributes_array;
98
99
- $_chosen_attributes = $_attributes_array = array();
100
101
/* FIX TO WOOCOMMERCE 2.1 */
102
if ( function_exists( 'wc_get_attribute_taxonomies' ) ) {
@@ -110,7 +110,7 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
110
if ( $attribute_taxonomies ) {
111
foreach ( $attribute_taxonomies as $tax ) {
112
113
- $attribute = sanitize_title( $tax->attribute_name );
114
115
/* FIX TO WOOCOMMERCE 2.1 */
116
if ( function_exists( 'wc_attribute_taxonomy_name' ) ) {
@@ -120,23 +120,17 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
120
$taxonomy = $woocommerce->attribute_taxonomy_name( $attribute );
121
}
122
123
-
124
- // create an array of product attribute taxonomies
125
- $_attributes_array[] = $taxonomy;
126
-
127
$name = 'filter_' . $attribute;
128
$query_type_name = 'query_type_' . $attribute;
129
130
if ( ! empty( $_GET[$name] ) && taxonomy_exists( $taxonomy ) ) {
131
132
- $_chosen_attributes[$taxonomy]['terms'] = explode( ',', $_GET[$name] );
133
134
- if ( empty( $_GET[$query_type_name] ) || ! in_array( strtolower( $_GET[$query_type_name] ), array( 'and', 'or' ) ) ) {
135
- $_chosen_attributes[$taxonomy]['query_type'] = apply_filters( 'woocommerce_layered_nav_default_query_type', 'and' );
136
- }
137
- else {
138
- $_chosen_attributes[$taxonomy]['query_type'] = strtolower( $_GET[$query_type_name] );
139
- }
140
141
}
142
}
94
95
if ( is_active_widget( false, false, 'yith-woo-ajax-navigation', true ) && ! is_admin() ) {
96
97
+ global $_chosen_attributes, $woocommerce;
98
99
+ $_chosen_attributes = array();
100
101
/* FIX TO WOOCOMMERCE 2.1 */
102
if ( function_exists( 'wc_get_attribute_taxonomies' ) ) {
110
if ( $attribute_taxonomies ) {
111
foreach ( $attribute_taxonomies as $tax ) {
112
113
+ $attribute = wc_sanitize_taxonomy_name( $tax->attribute_name );
114
115
/* FIX TO WOOCOMMERCE 2.1 */
116
if ( function_exists( 'wc_attribute_taxonomy_name' ) ) {
120
$taxonomy = $woocommerce->attribute_taxonomy_name( $attribute );
121
}
122
123
$name = 'filter_' . $attribute;
124
$query_type_name = 'query_type_' . $attribute;
125
126
if ( ! empty( $_GET[$name] ) && taxonomy_exists( $taxonomy ) ) {
127
128
+ $_chosen_attributes[ $taxonomy ]['terms'] = explode( ',', $_GET[ $name ] );
129
130
+ if ( empty( $_GET[ $query_type_name ] ) || ! in_array( strtolower( $_GET[ $query_type_name ] ), array( 'and', 'or' ) ) )
131
+ $_chosen_attributes[ $taxonomy ]['query_type'] = apply_filters( 'woocommerce_layered_nav_default_query_type', 'and' );
132
+ else
133
+ $_chosen_attributes[ $taxonomy ]['query_type'] = strtolower( $_GET[ $query_type_name ] );
134
135
}
136
}
class.yith-wcan-helper.php → includes/class.yith-wcan-helper.php RENAMED
File without changes
includes/class.yith-wcan.php ADDED
@@ -0,0 +1,155 @@
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( 'after_setup_theme', array( $this, 'plugin_fw_loader' ), 1 );
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
+ */
82
+ public function registerWidgets() {
83
+ $widgets = apply_filters( 'yith_wcan_widgets', array(
84
+ 'YITH_WCAN_Navigation_Widget',
85
+ 'YITH_WCAN_Reset_Navigation_Widget',
86
+ )
87
+ );
88
+
89
+ foreach( $widgets as $widget ){
90
+ register_widget( $widget );
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Load plugin framework
96
+ *
97
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
98
+ * @since 1.0
99
+ * @return void
100
+ */
101
+ public function plugin_fw_loader() {
102
+ if ( ! defined( 'YIT' ) || ! defined( 'YIT_CORE_PLUGIN' ) ) {
103
+ require_once( YITH_WCAN_DIR . 'plugin-fw/yit-plugin.php' );
104
+ }
105
+ }
106
+
107
+ /**
108
+ * Main plugin Instance
109
+ *
110
+ * @return YITH_Vendors Main instance
111
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
112
+ */
113
+ public static function instance() {
114
+ if ( is_null( self::$_instance ) ) {
115
+ self::$_instance = new self();
116
+ }
117
+
118
+ return self::$_instance;
119
+ }
120
+
121
+
122
+ /**
123
+ * Load required files
124
+ *
125
+ * @since 1.4
126
+ * @return void
127
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
128
+ */
129
+ public function required(){
130
+ $required = apply_filters( 'yith_wcan_required_files', array(
131
+ 'includes/functions.yith-wcan.php',
132
+ 'includes/class.yith-wcan-admin.php',
133
+ 'includes/class.yith-wcan-frontend.php',
134
+ 'includes/class.yith-wcan-helper.php',
135
+ 'widgets/class.yith-wcan-navigation-widget.php',
136
+ 'widgets/class.yith-wcan-reset-navigation-widget.php',
137
+ )
138
+ );
139
+
140
+ foreach( $required as $file ){
141
+ file_exists( YITH_WCAN_DIR . $file ) && require_once( YITH_WCAN_DIR . $file );
142
+ }
143
+ }
144
+
145
+ public function init() {
146
+ if ( is_admin() ) {
147
+ $this->admin = new YITH_WCAN_Admin( $this->version );
148
+ }
149
+ else {
150
+ $this->frontend = new YITH_WCAN_Frontend( $this->version );
151
+ }
152
+ }
153
+
154
+ }
155
+ }
functions.yith-wcan.php → includes/functions.yith-wcan.php RENAMED
@@ -51,9 +51,10 @@ function yith_wcan_attributes_table( $type, $attribute, $id, $name, $values = ar
51
if ( 'list' == $type ) {
52
$return = '<input type="hidden" name="' . $name . '[colors]" value="" /><input type="hidden" name="' . $name . '[labels]" value="" />';
53
}
54
elseif ( 'color' == $type ) {
55
if ( ! empty( $terms ) ) {
56
- $return = sprintf( '<table><tr><th>%s</th><th>%s</th></tr>', __( 'Term', 'yit' ), __( 'Color', 'yit' ) );
57
58
foreach ( $terms as $term ) {
59
$return .= "<tr><td><label for='{$id}{$term->term_id}'>{$term->name}</label></td><td><input type='text' id='{$id}{$term->term_id}' name='{$name}[colors][{$term->term_id}]' value='" . ( isset( $values[$term->term_id] ) ? $values[$term->term_id] : '' ) . "' size='3' class='yith-colorpicker' /></td></tr>";
@@ -64,9 +65,32 @@ function yith_wcan_attributes_table( $type, $attribute, $id, $name, $values = ar
64
65
$return .= '<input type="hidden" name="' . $name . '[labels]" value="" />';
66
}
67
elseif ( 'label' == $type ) {
68
if ( ! empty( $terms ) ) {
69
- $return = sprintf( '<table><tr><th>%s</th><th>%s</th></tr>', __( 'Term', 'yit' ), __( 'Labels', 'yit' ) );
70
71
foreach ( $terms as $term ) {
72
$return .= "<tr><td><label for='{$id}{$term->term_id}'>{$term->name}</label></td><td><input type='text' id='{$id}{$term->term_id}' name='{$name}[labels][{$term->term_id}]' value='" . ( isset( $values[$term->term_id] ) ? $values[$term->term_id] : '' ) . "' size='3' /></td></tr>";
@@ -144,8 +168,9 @@ if ( ! function_exists( 'yit_reorder_terms_by_parent' ) ) {
144
function yit_reorder_terms_by_parent( $terms ) {
145
146
/* Extract Child Terms */
147
- $child_terms = array();
148
- $terms_count = 0;
149
150
foreach ( $terms as $array_key => $term ) {
151
@@ -198,7 +223,7 @@ if ( ! function_exists( 'yit_get_terms' ) ) {
198
*
199
* @since 1.3.1
200
*/
201
- function yit_get_terms( $case, $taxonomy ) {
202
203
$exclude = apply_filters( 'yith_wcan_exclude_terms', array() );
204
@@ -217,7 +242,16 @@ if ( ! function_exists( 'yit_get_terms' ) ) {
217
break;
218
219
default:
220
- $terms = get_terms( $taxonomy, array( 'hide_empty' => true, 'exclude' => $exclude ) );
221
break;
222
}
223
@@ -280,4 +314,112 @@ if ( ! function_exists( 'yit_term_has_child' ) ) {
280
281
return empty( $count ) ? false : true;
282
}
283
}
51
if ( 'list' == $type ) {
52
$return = '<input type="hidden" name="' . $name . '[colors]" value="" /><input type="hidden" name="' . $name . '[labels]" value="" />';
53
}
54
+
55
elseif ( 'color' == $type ) {
56
if ( ! empty( $terms ) ) {
57
+ $return = sprintf( '<table><tr><th>%s</th><th>%s</th></tr>', __( 'Term', 'yith_wc_ajxnav' ), __( 'Color', 'yith_wc_ajxnav' ) );
58
59
foreach ( $terms as $term ) {
60
$return .= "<tr><td><label for='{$id}{$term->term_id}'>{$term->name}</label></td><td><input type='text' id='{$id}{$term->term_id}' name='{$name}[colors][{$term->term_id}]' value='" . ( isset( $values[$term->term_id] ) ? $values[$term->term_id] : '' ) . "' size='3' class='yith-colorpicker' /></td></tr>";
65
66
$return .= '<input type="hidden" name="' . $name . '[labels]" value="" />';
67
}
68
+
69
+ elseif ( 'multicolor' == $type ) {
70
+ if ( ! empty( $terms ) ) {
71
+ $return = sprintf( '<table class="yith-wcan-multicolor"><tr><th>%s</th><th>%s</th><th>%s</th></tr>', __( 'Term', 'yith_wc_ajxnav' ), _x( 'Color 1', 'For multicolor: I.E. white and red T-Shirt', 'yith_wc_ajxnav' ), _x( 'Color 2', 'For multicolor: I.E. white and red T-Shirt', 'yith_wc_ajxnav' ) );
72
+
73
+ foreach ( $terms as $term ) {
74
+
75
+ $return .= "<tr>";
76
+
77
+ $return .= "<td><label for='{$id}{$term->term_id}'>{$term->name}</label></td>";
78
+
79
+ $return .= "<td><input type='text' id='{$id}{$term->term_id}_1' name='{$name}[multicolor][{$term->term_id}][]' value='" . ( isset( $values[$term->term_id][0] ) ? $values[$term->term_id][0] : '' ) . "' size='3' class='yith-colorpicker multicolor' /></td>";
80
+ $return .= "<td><input type='text' id='{$id}{$term->term_id}_2' name='{$name}[multicolor][{$term->term_id}][]' value='" . ( isset( $values[$term->term_id][1] ) ? $values[$term->term_id][1] : '' ) . "' size='3' class='yith-colorpicker multicolor' /></td>";
81
+
82
+ $return .= '</tr>';
83
+ }
84
+
85
+ $return .= '</table>';
86
+ }
87
+
88
+ $return .= '<input type="hidden" name="' . $name . '[labels]" value="" />';
89
+ }
90
+
91
elseif ( 'label' == $type ) {
92
if ( ! empty( $terms ) ) {
93
+ $return = sprintf( '<table><tr><th>%s</th><th>%s</th></tr>', __( 'Term', 'yith_wc_ajxnav' ), __( 'Labels', 'yith_wc_ajxnav' ) );
94
95
foreach ( $terms as $term ) {
96
$return .= "<tr><td><label for='{$id}{$term->term_id}'>{$term->name}</label></td><td><input type='text' id='{$id}{$term->term_id}' name='{$name}[labels][{$term->term_id}]' value='" . ( isset( $values[$term->term_id] ) ? $values[$term->term_id] : '' ) . "' size='3' /></td></tr>";
168
function yit_reorder_terms_by_parent( $terms ) {
169
170
/* Extract Child Terms */
171
+ $child_terms = array();
172
+ $terms_count = 0;
173
+ $parent_terms = array();
174
175
foreach ( $terms as $array_key => $term ) {
176
223
*
224
* @since 1.3.1
225
*/
226
+ function yit_get_terms( $case, $taxonomy, $instance = false ) {
227
228
$exclude = apply_filters( 'yith_wcan_exclude_terms', array() );
229
242
break;
243
244
default:
245
+ $args = array( 'hide_empty' => true, 'exclude' => $exclude );
246
+ if ( 'parent' == $instance['display'] ) {
247
+ $args['parent'] = false;
248
+ }
249
+
250
+ $terms = get_terms( $taxonomy, $args );
251
+
252
+ if ( 'hierarchical' == $instance['display'] ) {
253
+ $terms = yit_reorder_terms_by_parent( $terms );
254
+ }
255
break;
256
}
257
314
315
return empty( $count ) ? false : true;
316
}
317
+ }
318
+
319
+ if ( ! function_exists( 'yith_wcan_get_option' ) ) {
320
+ /**
321
+ * Retreive the plugin option
322
+ *
323
+ * @param mixed|bool $option_name The option name. If false return alla options array
324
+ *
325
+ *
326
+ * @return mixed|array|string The option(s)
327
+ *
328
+ * @since 1.3.1
329
+ */
330
+ function yith_wcan_get_option( $option_name = false, $default = false ) {
331
+ $options = get_option( 'yit_wcan_options' );
332
+
333
+ if ( ! $option_name ) {
334
+ return $options;
335
+ }
336
+
337
+ return isset( $options[$option_name] ) ? $options[$option_name] : $default;
338
+ }
339
+ }
340
+
341
+ if ( ! function_exists( 'yit_get_filter_args' ) ) {
342
+ /**
343
+ * Retreive the filter query args option
344
+ *
345
+ * @return array The option(s)
346
+ *
347
+ * @since 1.4
348
+ */
349
+ function yit_get_filter_args( $check_price_filter = true ) {
350
+ $filter_value = array();
351
+ $regexs = array( '/^filter_[a-zA-Z0-9]/', '/^query_type_[a-zA-Z0-9]/', '/product_tag/' );
352
+
353
+ /* Support to YITH WooCommerce Brands */
354
+ if ( defined( 'YITH_WCBR_PREMIUM_INIT' ) && YITH_WCBR_PREMIUM_INIT ) {
355
+ $brands_taxonomy = YITH_WCBR::$brands_taxonomy;
356
+ $regexs[] = "/{$brands_taxonomy}/";
357
+ }
358
+
359
+ if ( ! empty( $_GET ) ) {
360
+ foreach ( $regexs as $regex ) {
361
+ foreach ( $_GET as $query_var => $value ) {
362
+ if ( preg_match( $regex, $query_var ) ) {
363
+ $filter_value[$query_var] = $value;
364
+ }
365
+ }
366
+ }
367
+ }
368
+
369
+ if ( $check_price_filter ) {
370
+ // WooCommerce Price Filter
371
+ if ( isset( $_GET['min_price'] ) ) {
372
+ $link = $filter_value['min_price'] = $_GET['min_price'];
373
+ }