Version Description
Released on Oct 23, 2018
- New: Support to WooCommerce 3.5.0.
- Update: Plugin Core.
- Fix: Product placeholder image and image size.
Download this release
Release Info
Developer | yithemes |
Plugin | YITH WooCommerce Compare |
Version | 2.3.5 |
Comparing to | |
See all releases |
Code changes from version 2.3.4 to 2.3.5
- README.txt +314 -307
- assets/css/admin.css +28 -28
- assets/css/style.css +218 -218
- assets/css/widget.css +64 -64
- assets/js/woocompare-admin.js +18 -18
- includes/class.yith-woocompare-admin.php +476 -476
- includes/class.yith-woocompare-frontend.php +818 -818
- includes/class.yith-woocompare-helper.php +104 -104
- includes/class.yith-woocompare.php +144 -122
- init.php +121 -121
- plugin-fw/assets/css/admin.css +8 -0
- plugin-fw/assets/css/metaboxes.css +3 -0
- plugin-fw/assets/js/yith-promo.js +20 -0
- plugin-fw/assets/js/yith-promo.min.js +1 -0
- plugin-fw/init.php +2 -2
- plugin-fw/lib/promo/yith-promo.php +130 -0
- plugin-fw/lib/yit-ajax.php +1 -1
- plugin-fw/lib/yit-assets.php +1 -1
- plugin-fw/lib/yit-cpt-unlimited.php +1 -1
- plugin-fw/lib/yit-debug.php +1 -1
- plugin-fw/lib/yit-icons.php +1 -1
- plugin-fw/lib/yit-metabox.php +1 -1
- plugin-fw/lib/yit-plugin-panel-wc.php +1 -1
- plugin-fw/lib/yit-plugin-panel.php +1 -1
- plugin-fw/lib/yit-plugin-subpanel.php +1 -1
- plugin-fw/lib/yit-pointers.php +4 -4
- plugin-fw/lib/yit-upgrade.php +8 -6
- plugin-fw/lib/yit-video.php +1 -1
- plugin-fw/licence/lib/yit-licence.php +1 -1
- plugin-fw/licence/lib/yit-plugin-licence.php +1 -1
- plugin-fw/licence/lib/yit-theme-licence.php +1 -1
- plugin-fw/licence/templates/panel/activation/activation-panel.php +1 -1
- plugin-fw/templates/metaboxes/types/icon-list.php +1 -1
- plugin-fw/templates/panel/panel-field-container.php +1 -1
- plugin-fw/templates/panel/woocommerce/woocommerce-upload.php +1 -1
- plugin-fw/templates/privacy/html-policy-content.php +36 -36
- plugin-fw/yit-plugin.php +2 -1
- plugin-options/general-options.php +145 -145
- plugin-options/premium-options.php +23 -23
- templates/admin/premium.php +454 -454
- templates/compare.php +284 -284
- widgets/class.yith-woocompare-widget.php +83 -83
- wpml-config.xml +5 -5
README.txt
CHANGED
@@ -1,307 +1,314 @@
|
|
1 |
-
=== YITH WooCommerce Compare ===
|
2 |
-
|
3 |
-
Contributors: yithemes
|
4 |
-
Tags: woocommerce compare, compare products, product compare, product comparison
|
5 |
-
Requires at least: 3.5.1
|
6 |
-
Tested up to: 4.9
|
7 |
-
Stable tag: 2.3.
|
8 |
-
License: GPLv2 or later
|
9 |
-
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
-
|
11 |
-
YITH WooCommerce Compare allows you to compare more products of your shop in one complete table.
|
12 |
-
WooCommerce Compatible up to 3.
|
13 |
-
|
14 |
-
== Description ==
|
15 |
-
|
16 |
-
YITH WooCommerce Compare plugin is an extension of WooCommerce plugin that allow your users to compare some products of your shop.
|
17 |
-
All products are saved in one complete table where the user can see the difference between the products. Each product features can be
|
18 |
-
set with the woocommerce attributes in the product configuration.
|
19 |
-
You can also add a simple widget with the list of products the users have added, where you can manage them.
|
20 |
-
Also you can simply customize the compare table with your style, by editing the specific template.
|
21 |
-
|
22 |
-
Full documentation is available [here](http://yithemes.com/docs-plugins/yith-woocommerce-compare).
|
23 |
-
|
24 |
-
This plugin is 100% compatible with [WPML](http://wpml.org/?aid=24889&affiliate_key=Qn1wDeBNTcZV)
|
25 |
-
|
26 |
-
|
27 |
-
= Installation =
|
28 |
-
|
29 |
-
1. Unzip the downloaded zip file.
|
30 |
-
2. Upload the plugin folder into the `wp-content/plugins/` directory of your WordPress site.
|
31 |
-
3. Activate `YITH WooCommerce Compare` from Plugins page
|
32 |
-
|
33 |
-
= Configuration =
|
34 |
-
|
35 |
-
1. Add the features in each product by setting the attributes in prouct configuration;
|
36 |
-
2. Configure the options in YIT Plugin -> Compare;
|
37 |
-
3. The user of your shop will click in the "Compare" button located in the single product page;
|
38 |
-
4. Will be open a popup with the compare table inside.
|
39 |
-
|
40 |
-
You can also add the widget with the product list of compare table, in Appearance -> Widgets and adding the widget "YITH WooCommerce Compare Widget".
|
41 |
-
|
42 |
-
== Frequently Asked Questions ==
|
43 |
-
|
44 |
-
= Can I customize the compare table? =
|
45 |
-
Yes, you can copy the template from the plugin folder and paste it inside the folder "woocommerce" of your theme folder.
|
46 |
-
|
47 |
-
= Can I select what fields show inside the compare table? =
|
48 |
-
Yes, you can choose what fields to show in the compare table. You can do it in YIT Plugins -> Compare.
|
49 |
-
|
50 |
-
= Can I order the fields in the compare table? =
|
51 |
-
Yes, you can sort the fields in the compare table. You can do it in YIT Plugins -> Compare.
|
52 |
-
|
53 |
-
= What are the main changes in plugin translation? =
|
54 |
-
Recently YITH WooCommerce Compare has been selected to be included in the "translate.wordpress.org" translate programme.
|
55 |
-
In order to import correctly the plugin strings in the new system, we had to change the text domain form 'yit' to 'yith-woocommerce-compare'.
|
56 |
-
Once the plugin will be imported in the translate.wordpress.org system, the translations of other languages will be downloaded directly from WordPress, without using any .po and .mo files. Moreover, users will be able to participate in a more direct way to plugin translations, suggesting texts in their languages in the dedicated tab on translate.wordpress.org.
|
57 |
-
During this transition step, .po and .mo files will be used as always, but in order to be recognized by WordPress, they will need to have a new nomenclature, renaming them in:
|
58 |
-
yith-woocommerce-compare-<WORDPRESS LOCALE>.po
|
59 |
-
yith-woocommerce-compare-<WORDPRESS LOCALE >.mo
|
60 |
-
|
61 |
-
== Screenshots ==
|
62 |
-
|
63 |
-
1. The popup with compare table.
|
64 |
-
2. The button compare.
|
65 |
-
3. The settings of plugin
|
66 |
-
|
67 |
-
== Changelog ==
|
68 |
-
|
69 |
-
= 2.3.
|
70 |
-
|
71 |
-
* New: Support to WooCommerce 3.5.0
|
72 |
-
* Update: Plugin Core.
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
*
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
*
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
*
|
91 |
-
*
|
92 |
-
*
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
* New: Support to
|
98 |
-
*
|
99 |
-
*
|
100 |
-
|
101 |
-
= 2.
|
102 |
-
|
103 |
-
* New: Support to WooCommerce 3.
|
104 |
-
* New: Support to WordPress 4.9.
|
105 |
-
*
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
*
|
113 |
-
*
|
114 |
-
*
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
* New: Support to
|
120 |
-
*
|
121 |
-
*
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
*
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
*
|
130 |
-
*
|
131 |
-
*
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
* New: Support to
|
137 |
-
*
|
138 |
-
*
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
*
|
143 |
-
*
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
*
|
148 |
-
*
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
*
|
154 |
-
*
|
155 |
-
|
156 |
-
= 2.0.
|
157 |
-
|
158 |
-
*
|
159 |
-
* Update: Plugin Core.
|
160 |
-
*
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
*
|
168 |
-
*
|
169 |
-
*
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
* Update:
|
175 |
-
*
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
* Update: Plugin Core
|
181 |
-
* Fix:
|
182 |
-
|
183 |
-
= 2.0.
|
184 |
-
|
185 |
-
*
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
*
|
196 |
-
*
|
197 |
-
|
198 |
-
= 2.0.
|
199 |
-
|
200 |
-
*
|
201 |
-
*
|
202 |
-
*
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
*
|
210 |
-
*
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
*
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
* Update:
|
231 |
-
* Fix:
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
* New:
|
254 |
-
* New:
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
*
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
*
|
263 |
-
* Fix:
|
264 |
-
*
|
265 |
-
|
266 |
-
= 1.0.
|
267 |
-
|
268 |
-
*
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
*
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
*
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== YITH WooCommerce Compare ===
|
2 |
+
|
3 |
+
Contributors: yithemes
|
4 |
+
Tags: yith, woocommerce compare, compare products, product compare, product comparison
|
5 |
+
Requires at least: 3.5.1
|
6 |
+
Tested up to: 4.9
|
7 |
+
Stable tag: 2.3.5
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
YITH WooCommerce Compare allows you to compare more products of your shop in one complete table.
|
12 |
+
WooCommerce Compatible up to 3.5
|
13 |
+
|
14 |
+
== Description ==
|
15 |
+
|
16 |
+
YITH WooCommerce Compare plugin is an extension of WooCommerce plugin that allow your users to compare some products of your shop.
|
17 |
+
All products are saved in one complete table where the user can see the difference between the products. Each product features can be
|
18 |
+
set with the woocommerce attributes in the product configuration.
|
19 |
+
You can also add a simple widget with the list of products the users have added, where you can manage them.
|
20 |
+
Also you can simply customize the compare table with your style, by editing the specific template.
|
21 |
+
|
22 |
+
Full documentation is available [here](http://yithemes.com/docs-plugins/yith-woocommerce-compare).
|
23 |
+
|
24 |
+
This plugin is 100% compatible with [WPML](http://wpml.org/?aid=24889&affiliate_key=Qn1wDeBNTcZV)
|
25 |
+
|
26 |
+
|
27 |
+
= Installation =
|
28 |
+
|
29 |
+
1. Unzip the downloaded zip file.
|
30 |
+
2. Upload the plugin folder into the `wp-content/plugins/` directory of your WordPress site.
|
31 |
+
3. Activate `YITH WooCommerce Compare` from Plugins page
|
32 |
+
|
33 |
+
= Configuration =
|
34 |
+
|
35 |
+
1. Add the features in each product by setting the attributes in prouct configuration;
|
36 |
+
2. Configure the options in YIT Plugin -> Compare;
|
37 |
+
3. The user of your shop will click in the "Compare" button located in the single product page;
|
38 |
+
4. Will be open a popup with the compare table inside.
|
39 |
+
|
40 |
+
You can also add the widget with the product list of compare table, in Appearance -> Widgets and adding the widget "YITH WooCommerce Compare Widget".
|
41 |
+
|
42 |
+
== Frequently Asked Questions ==
|
43 |
+
|
44 |
+
= Can I customize the compare table? =
|
45 |
+
Yes, you can copy the template from the plugin folder and paste it inside the folder "woocommerce" of your theme folder.
|
46 |
+
|
47 |
+
= Can I select what fields show inside the compare table? =
|
48 |
+
Yes, you can choose what fields to show in the compare table. You can do it in YIT Plugins -> Compare.
|
49 |
+
|
50 |
+
= Can I order the fields in the compare table? =
|
51 |
+
Yes, you can sort the fields in the compare table. You can do it in YIT Plugins -> Compare.
|
52 |
+
|
53 |
+
= What are the main changes in plugin translation? =
|
54 |
+
Recently YITH WooCommerce Compare has been selected to be included in the "translate.wordpress.org" translate programme.
|
55 |
+
In order to import correctly the plugin strings in the new system, we had to change the text domain form 'yit' to 'yith-woocommerce-compare'.
|
56 |
+
Once the plugin will be imported in the translate.wordpress.org system, the translations of other languages will be downloaded directly from WordPress, without using any .po and .mo files. Moreover, users will be able to participate in a more direct way to plugin translations, suggesting texts in their languages in the dedicated tab on translate.wordpress.org.
|
57 |
+
During this transition step, .po and .mo files will be used as always, but in order to be recognized by WordPress, they will need to have a new nomenclature, renaming them in:
|
58 |
+
yith-woocommerce-compare-<WORDPRESS LOCALE>.po
|
59 |
+
yith-woocommerce-compare-<WORDPRESS LOCALE >.mo
|
60 |
+
|
61 |
+
== Screenshots ==
|
62 |
+
|
63 |
+
1. The popup with compare table.
|
64 |
+
2. The button compare.
|
65 |
+
3. The settings of plugin
|
66 |
+
|
67 |
+
== Changelog ==
|
68 |
+
|
69 |
+
= 2.3.5 = Released on Oct 23, 2018
|
70 |
+
|
71 |
+
* New: Support to WooCommerce 3.5.0.
|
72 |
+
* Update: Plugin Core.
|
73 |
+
* Fix: Product placeholder image and image size.
|
74 |
+
|
75 |
+
= 2.3.4 = Released on Oct 01, 2018
|
76 |
+
|
77 |
+
* New: Support to WooCommerce 3.5.0 RC1.
|
78 |
+
* Update: Plugin Core.
|
79 |
+
|
80 |
+
= 2.3.3 = Released on Sep 20, 2018
|
81 |
+
|
82 |
+
* Fix: Compatibility issue with WPML and RTL languages.
|
83 |
+
|
84 |
+
= 2.3.2 = Released on Sep 10, 2018
|
85 |
+
|
86 |
+
* New: Support to WooCommerce 3.4.5.
|
87 |
+
* New: Support to WordPress 4.9.8.
|
88 |
+
* Update: Plugin Core.
|
89 |
+
* Update: All external scripts to latest available version.
|
90 |
+
* Update: Compare table template (compare.php) to version 2.3.2.
|
91 |
+
* Update: Compare table style.
|
92 |
+
* Fix: Check product status before add it to compare list.
|
93 |
+
|
94 |
+
= 2.3.1 = Released on Jun 5, 2018
|
95 |
+
|
96 |
+
* New: Support to WooCommerce 3.4.1.
|
97 |
+
* New: Support to WordPress 4.9.6.
|
98 |
+
* Update: Plugin Core.
|
99 |
+
* Fix: WPML table fields translation.
|
100 |
+
|
101 |
+
= 2.3.0 = Released on Feb 2, 2018
|
102 |
+
|
103 |
+
* New: Support to WooCommerce 3.3.0.
|
104 |
+
* New: Support to WordPress 4.9.2.
|
105 |
+
* Update: Plugin Core.
|
106 |
+
|
107 |
+
= 2.2.3 = Released on Dec 21, 2017
|
108 |
+
|
109 |
+
* New: Support to WooCommerce 3.2.6.
|
110 |
+
* New: Support to WordPress 4.9.1.
|
111 |
+
* New: Product SKU field in compare table.
|
112 |
+
* Update: Plugin Core.
|
113 |
+
* Update: Language Files.
|
114 |
+
* Dev: New filter yith_woocompare_standard_fields_array to filter standard compare fields.
|
115 |
+
|
116 |
+
= 2.2.2 = Released on Oct 24, 2017
|
117 |
+
|
118 |
+
* New: Support to WooCommerce 3.2.1.
|
119 |
+
* New: Support to WordPress 4.8.2.
|
120 |
+
* Update: Plugin Core.
|
121 |
+
* Update: Language Files.
|
122 |
+
|
123 |
+
= 2.2.1 = Released on Jul 05, 2017
|
124 |
+
|
125 |
+
* New: Support to WooCommerce 3.1.
|
126 |
+
* New: Support to WordPress 4.8.
|
127 |
+
* New: Russian Translation.
|
128 |
+
* New: Slovenian Translation.
|
129 |
+
* Update: Plugin Core.
|
130 |
+
* Update: Language Files.
|
131 |
+
* Fix: WPML and Add to cart action from popup.
|
132 |
+
|
133 |
+
= 2.2.0 = Released on Mar 29, 2017
|
134 |
+
|
135 |
+
* New: Support to WooCommerce 3.0.0 RC2.
|
136 |
+
* New: Support to WordPress 4.7.3
|
137 |
+
* Update: Plugin Core.
|
138 |
+
* Update: Language Files.
|
139 |
+
|
140 |
+
= 2.1.0 = Released on Oct 19, 2016
|
141 |
+
|
142 |
+
* New: Support to WooCommerce 2.6.4
|
143 |
+
* New: Support to WordPress 4.6
|
144 |
+
* New: Auto remove from compare list for products that are private or were cancelled.
|
145 |
+
* New: Add as default fields Weight and Dimensions.
|
146 |
+
* Update: Plugin Core.
|
147 |
+
* Update: Language Files.
|
148 |
+
* Fix: Uncaught ReferenceError "redirect_to_cart is not defined" error on "add to cart" action.
|
149 |
+
* Fix: Compatibility issue with NextGen Gallery plugin.
|
150 |
+
|
151 |
+
= 2.0.9 = Released on Jun 13, 2016
|
152 |
+
|
153 |
+
* New: Support to WooCommerce 2.6 RC1
|
154 |
+
* Update: Plugin Core.
|
155 |
+
|
156 |
+
= 2.0.8 = Released on Apr 19, 2016
|
157 |
+
|
158 |
+
* New: Compatibility with WordPress 4.5
|
159 |
+
* Update: Plugin Core.
|
160 |
+
* Fix: Fatal error call to undefined method WC_AJAX::get_endpoint() for WooCommerce version older then 2.4
|
161 |
+
|
162 |
+
= 2.0.7 = Released on Apr 01, 2016
|
163 |
+
|
164 |
+
* Update: Plugin template compare.php
|
165 |
+
* Update: Plugin Core.
|
166 |
+
* Update: Language file.
|
167 |
+
* Fix: Product status now updates automatically when the product is removed from the compare widget.
|
168 |
+
* Fix: Redirect correctly to cart page after "Add to cart" is clicked if "Redirect to the cart page after successful addition" option is enabled.
|
169 |
+
* Fix: Redirect correctly to product page after "Add to cart" is clicked when "Enable AJAX add to cart buttons on archives" option is disabled.
|
170 |
+
|
171 |
+
= 2.0.6 = Released on Jan 11, 2016
|
172 |
+
|
173 |
+
* New: Compatibility with WooCommerce 2.5 RC
|
174 |
+
* Update: Change ajax call fron admin-ajax to wc-ajax
|
175 |
+
* Update: Plugin template compare.php
|
176 |
+
* Update: Plugin Core
|
177 |
+
|
178 |
+
= 2.0.5 = Released on Oct 30, 2015
|
179 |
+
|
180 |
+
* Update: Plugin Core
|
181 |
+
* Fix: After you remove product from compare, you can re-add it without reload page
|
182 |
+
|
183 |
+
= 2.0.4 = Released on Sep 22, 2015
|
184 |
+
|
185 |
+
* Update: Changed Text Domain from 'yith-wcmp' to 'yith-woocommerce-compare'
|
186 |
+
* Update: Plugin Core Framework
|
187 |
+
* Fix: JS error when loading compare window
|
188 |
+
|
189 |
+
= 2.0.3 = Released on Aug 21, 2015
|
190 |
+
|
191 |
+
* New: Compatibility with WooPress 4.3
|
192 |
+
|
193 |
+
= 2.0.2 = Released on Aug 12, 2015
|
194 |
+
|
195 |
+
* New: Compatibility with WooCommerce 2.4
|
196 |
+
* Update: Core plugin
|
197 |
+
|
198 |
+
= 2.0.1 = Released on Aug 10, 2015
|
199 |
+
|
200 |
+
* Update: Core plugin
|
201 |
+
* Fix: Compare table layout
|
202 |
+
* Fix: undefined function unblock() in main js
|
203 |
+
|
204 |
+
= 2.0.0 = Released on Jul 15, 2015
|
205 |
+
|
206 |
+
* New: New plugin core
|
207 |
+
* Update: Language files
|
208 |
+
* Removed: old default.po catalog language file
|
209 |
+
* Fix: Error in class yith-woocompare-fontend
|
210 |
+
* Fix: Lightbox doesn't close after click view cart
|
211 |
+
* Fix: minor bug fix
|
212 |
+
|
213 |
+
= 1.2.3 = Released on Feb 13, 2015
|
214 |
+
|
215 |
+
* New: Bulgarian Translation by Joanna Mikova
|
216 |
+
* New: Spanish Translation by Rodoslav Angelov and Mariano Rivas
|
217 |
+
|
218 |
+
= 1.2.2 = Released on Dec 03, 2014
|
219 |
+
|
220 |
+
* Fix: Shortcode compare
|
221 |
+
|
222 |
+
= 1.2.1 = Released on Sep 17, 2014
|
223 |
+
|
224 |
+
* New: Support to WC 2.2.3
|
225 |
+
|
226 |
+
= 1.2.0 = Released on Sep 16, 2014
|
227 |
+
|
228 |
+
* New: Support to WC 2.2.2
|
229 |
+
* Update: Compare Template
|
230 |
+
* Update: Plugin Core Framework
|
231 |
+
* Fix: Fields orders
|
232 |
+
* Tweek: WPML Support improved
|
233 |
+
|
234 |
+
= 1.1.4 = Released on Jun 30, 2014
|
235 |
+
|
236 |
+
* Update: Colorbox Library Version 1.5.10
|
237 |
+
* Fix: Horizontal scroll bar issue: show at the end of iframe
|
238 |
+
|
239 |
+
= 1.1.3 = Released on Jun 05, 2014
|
240 |
+
|
241 |
+
* New: RTL Support
|
242 |
+
|
243 |
+
= 1.1.2 = Released on Mar 21, 2014
|
244 |
+
|
245 |
+
* Fix: WPML Support on Compare Widget
|
246 |
+
|
247 |
+
= 1.1.1 = Released on Feb 19, 2014
|
248 |
+
|
249 |
+
* Fix: Add to cart Button on Compare page
|
250 |
+
|
251 |
+
= 1.1.0 = Released on Feb 13, 2014
|
252 |
+
|
253 |
+
* New: Support to WooCommerce 2.1.X
|
254 |
+
* New: French translation by Paumo
|
255 |
+
|
256 |
+
= 1.0.5 = Released on Oct 14, 2013
|
257 |
+
|
258 |
+
* New: Persian translation by Khalil Delavaran
|
259 |
+
* New: Compare table title option
|
260 |
+
* New: Compatibility with WPML plugin
|
261 |
+
* New: Brazilian Portuguese translation by hotelwww
|
262 |
+
* Fix: Responsive features
|
263 |
+
* Fix: Dequeued wrong JS scripts
|
264 |
+
* Update: Dutch translation by Frans Pronk
|
265 |
+
|
266 |
+
= 1.0.4 = Released on Sep 04, 2013
|
267 |
+
|
268 |
+
* New: complete Dutch translation. Thanks to Frans Pronk
|
269 |
+
* Fix: Sortable scripts included only in the plugin admin page
|
270 |
+
* Fix: products list in popup don't update after have added a product
|
271 |
+
|
272 |
+
= 1.0.3 = Released on Jul 31, 2013
|
273 |
+
|
274 |
+
* Minor bugs fixes
|
275 |
+
|
276 |
+
= 1.0.2 = Released on Jul 20, 2013
|
277 |
+
|
278 |
+
* Tweak: trigger in javascript file for add to compare event
|
279 |
+
|
280 |
+
= 1.0.1 = Released on Jun 27, 2013
|
281 |
+
|
282 |
+
* New: Link/Button text option in plugin options
|
283 |
+
* New: ability to add a link in the menu top open the popup
|
284 |
+
* Fix: bug with attributes added after installation
|
285 |
+
* Fix: bug with plugin activated but not working for multisites
|
286 |
+
|
287 |
+
= 1.0.0 = Released on Jun 24, 2013
|
288 |
+
|
289 |
+
* Initial release
|
290 |
+
|
291 |
+
== Suggestions ==
|
292 |
+
|
293 |
+
If you have suggestions about how to improve YITH WooCommerce Compare, you can [write us](mailto:plugins@yithemes.com "Your Inspiration Themes") so we can bundle them into YITH WooCommerce Compare.
|
294 |
+
|
295 |
+
== Translators ==
|
296 |
+
|
297 |
+
= Available Languages =
|
298 |
+
* English (Default)
|
299 |
+
* Italiano
|
300 |
+
|
301 |
+
If you can't find this plugin in your language and want to translate it, use the dedicated tool at [Translating WordPress](https://translate.wordpress.org/locale/it/default/wp-plugins/yith-woocommerce-compare "Translating WordPress").
|
302 |
+
Or, if you have created your own language pack, or have an update for an existing one, you can send it as an email attachment from our [Contacts page](http://yithemes.com/contact/ "Your Inspiration Themes") and we will bundle into YITH WooCommerce Compare.
|
303 |
+
|
304 |
+
== Documentation ==
|
305 |
+
|
306 |
+
Full documentation is available [here](http://yithemes.com/docs-plugins/yith-woocommerce-compare).
|
307 |
+
|
308 |
+
== Upgrade notice ==
|
309 |
+
|
310 |
+
= 2.3.5 = Released on Oct 23, 2018
|
311 |
+
|
312 |
+
* New: Support to WooCommerce 3.5.0.
|
313 |
+
* Update: Plugin Core.
|
314 |
+
* Fix: Product placeholder image and image size.
|
assets/css/admin.css
CHANGED
@@ -1,28 +1,28 @@
|
|
1 |
-
.yith_woocommerce_slider {
|
2 |
-
width: 300px;
|
3 |
-
float: left
|
4 |
-
}
|
5 |
-
.yith_woocommerce_slider_value {
|
6 |
-
margin-top: -5px;
|
7 |
-
margin-left: 10px;
|
8 |
-
width: 50px;
|
9 |
-
float: left;
|
10 |
-
text-align: center;
|
11 |
-
font-weight: bold;
|
12 |
-
}
|
13 |
-
|
14 |
-
.attributes li {
|
15 |
-
margin-bottom: 0;
|
16 |
-
}
|
17 |
-
|
18 |
-
.attributes .ui-sortable-placeholder {
|
19 |
-
background: #f9f9f9;
|
20 |
-
border: 1px dashed #d4d4d4;
|
21 |
-
-webkit-border-radius: 3px;
|
22 |
-
-moz-border-radius: 3px;
|
23 |
-
border-radius: 3px;
|
24 |
-
visibility: visible !important;
|
25 |
-
box-sizing: border-box;
|
26 |
-
-moz-box-sizing: border-box;
|
27 |
-
margin-bottom: -2px;
|
28 |
-
}
|
1 |
+
.yith_woocommerce_slider {
|
2 |
+
width: 300px;
|
3 |
+
float: left
|
4 |
+
}
|
5 |
+
.yith_woocommerce_slider_value {
|
6 |
+
margin-top: -5px;
|
7 |
+
margin-left: 10px;
|
8 |
+
width: 50px;
|
9 |
+
float: left;
|
10 |
+
text-align: center;
|
11 |
+
font-weight: bold;
|
12 |
+
}
|
13 |
+
|
14 |
+
.attributes li {
|
15 |
+
margin-bottom: 0;
|
16 |
+
}
|
17 |
+
|
18 |
+
.attributes .ui-sortable-placeholder {
|
19 |
+
background: #f9f9f9;
|
20 |
+
border: 1px dashed #d4d4d4;
|
21 |
+
-webkit-border-radius: 3px;
|
22 |
+
-moz-border-radius: 3px;
|
23 |
+
border-radius: 3px;
|
24 |
+
visibility: visible !important;
|
25 |
+
box-sizing: border-box;
|
26 |
+
-moz-box-sizing: border-box;
|
27 |
+
margin-bottom: -2px;
|
28 |
+
}
|
assets/css/style.css
CHANGED
@@ -1,219 +1,219 @@
|
|
1 |
-
/**
|
2 |
-
* The style of the woocommerce compare products
|
3 |
-
*/
|
4 |
-
|
5 |
-
/* ###############
|
6 |
-
FIXED COLUMNS
|
7 |
-
##############*/
|
8 |
-
|
9 |
-
table.DTFC_Cloned thead, table.DTFC_Cloned tfoot{
|
10 |
-
background-color:white;
|
11 |
-
}
|
12 |
-
div.DTFC_Blocker{
|
13 |
-
background-color:white;
|
14 |
-
}
|
15 |
-
div.DTFC_LeftWrapper table.dataTable,
|
16 |
-
div.DTFC_RightWrapper table.dataTable{
|
17 |
-
margin-bottom:0;
|
18 |
-
z-index:2;
|
19 |
-
}
|
20 |
-
div.DTFC_LeftWrapper table.dataTable.no-footer,
|
21 |
-
div.DTFC_RightWrapper table.dataTable.no-footer{
|
22 |
-
border-bottom:none;
|
23 |
-
}
|
24 |
-
|
25 |
-
/*############################
|
26 |
-
* COMPARE
|
27 |
-
#############################*/
|
28 |
-
|
29 |
-
body {
|
30 |
-
font-family: 'Open Sans', san-serif;
|
31 |
-
font-size: 13px;
|
32 |
-
line-height: 1.51em;
|
33 |
-
color: #747373;
|
34 |
-
background: none !important;
|
35 |
-
margin: 0;
|
36 |
-
}
|
37 |
-
|
38 |
-
body h1 {
|
39 |
-
background: #4F4F4F;
|
40 |
-
color: #fff;
|
41 |
-
font-weight: 800;
|
42 |
-
padding: 10px;
|
43 |
-
border-bottom: 2px solid #fff;
|
44 |
-
display: block;
|
45 |
-
text-transform: uppercase;
|
46 |
-
font-size: 1.076em;
|
47 |
-
margin: 0;
|
48 |
-
text-align: center;
|
49 |
-
}
|
50 |
-
|
51 |
-
body #yith-woocompare {
|
52 |
-
padding: 10px;
|
53 |
-
}
|
54 |
-
|
55 |
-
table.dataTable.compare-list thead th,
|
56 |
-
table.dataTable.compare-list thead td,
|
57 |
-
table.dataTable.compare-list tfoot td,
|
58 |
-
table.dataTable.compare-list tfoot th {
|
59 |
-
border: 0;
|
60 |
-
vertical-align: middle;
|
61 |
-
}
|
62 |
-
.DTFC_LeftFootWrapper table.compare-list,
|
63 |
-
.DTFC_LeftHeadWrapper table.compare-list {
|
64 |
-
border: 0;
|
65 |
-
}
|
66 |
-
|
67 |
-
table.compare-list td {
|
68 |
-
width: 220px;
|
69 |
-
max-width: 220px;
|
70 |
-
min-width: 220px;
|
71 |
-
text-align: center;
|
72 |
-
vertical-align: middle;
|
73 |
-
}
|
74 |
-
|
75 |
-
table.compare-list {
|
76 |
-
width: 100%;
|
77 |
-
border-bottom: 0;
|
78 |
-
border-top: 0;
|
79 |
-
margin: 0;
|
80 |
-
table-layout: auto;
|
81 |
-
}
|
82 |
-
|
83 |
-
table.compare-list tbody th {
|
84 |
-
width: 150px;
|
85 |
-
max-width: 150px;
|
86 |
-
min-width: 150px;
|
87 |
-
overflow: hidden;
|
88 |
-
text-align: left;
|
89 |
-
color: #333333;
|
90 |
-
background-color: #f2f2f2;
|
91 |
-
text-transform: uppercase;
|
92 |
-
font-weight: 700;
|
93 |
-
font-size: 14px;
|
94 |
-
}
|
95 |
-
|
96 |
-
.rtl table.compare-list tbody th {
|
97 |
-
text-align: right;
|
98 |
-
}
|
99 |
-
|
100 |
-
table.dataTable.compare-list tbody th,
|
101 |
-
table.dataTable.compare-list tbody td {
|
102 |
-
border-right: 1px solid #e7e7e7;
|
103 |
-
border-top: 1px solid #e7e7e7;
|
104 |
-
border-bottom: none;
|
105 |
-
border-left: none;
|
106 |
-
padding: 10px;
|
107 |
-
vertical-align: middle;
|
108 |
-
}
|
109 |
-
table.dataTable.compare-list tbody tr:last-child th,
|
110 |
-
table.dataTable.compare-list tbody tr:last-child td {
|
111 |
-
border-bottom: 1px solid #e7e7e7;
|
112 |
-
}
|
113 |
-
|
114 |
-
table.compare-list tbody td.last-column {
|
115 |
-
width: auto;
|
116 |
-
border-right: 0;
|
117 |
-
}
|
118 |
-
|
119 |
-
table.compare-list tr.image td,
|
120 |
-
table.compare-list tr.image th {
|
121 |
-
border-top: 0;
|
122 |
-
}
|
123 |
-
|
124 |
-
#yith-woocompare-table_wrapper {
|
125 |
-
margin: 10px 0;
|
126 |
-
}
|
127 |
-
|
128 |
-
table.dataTable.compare-list tbody .product_info td {
|
129 |
-
vertical-align: top;
|
130 |
-
}
|
131 |
-
|
132 |
-
table.compare-list thead th a.close, h1 a.close {
|
133 |
-
float: right;
|
134 |
-
margin-right: 10px;
|
135 |
-
font-weight: 600;
|
136 |
-
font-size: 0.9em;
|
137 |
-
color: #fff;
|
138 |
-
text-decoration: none;
|
139 |
-
}
|
140 |
-
|
141 |
-
table.compare-list .remove td a {
|
142 |
-
color: #747373;
|
143 |
-
text-decoration: none;
|
144 |
-
}
|
145 |
-
|
146 |
-
table.compare-list .remove td a:hover {
|
147 |
-
color: #333333;
|
148 |
-
}
|
149 |
-
|
150 |
-
table.compare-list .remove td a .remove {
|
151 |
-
border-radius: 100% 100% 100% 100%;
|
152 |
-
color: red;
|
153 |
-
display: inline-block;
|
154 |
-
font-size: 1em;
|
155 |
-
font-weight: 600;
|
156 |
-
height: 1em;
|
157 |
-
line-height: 0.81em;
|
158 |
-
text-align: center;
|
159 |
-
text-decoration: none;
|
160 |
-
width: 1em;
|
161 |
-
}
|
162 |
-
|
163 |
-
.yith-woocompare-widget ul.products-list a.remove {
|
164 |
-
float: left;
|
165 |
-
}
|
166 |
-
|
167 |
-
table.compare-list .remove td a:hover .remove {
|
168 |
-
background-color: red;
|
169 |
-
color: #ffffff;
|
170 |
-
}
|
171 |
-
|
172 |
-
table.compare-list .add-to-cart td a {
|
173 |
-
display: inline-block;
|
174 |
-
margin: 10px 0;
|
175 |
-
background-color: #4F4F4F;
|
176 |
-
border: 0 none;
|
177 |
-
color: #FFFFFF;
|
178 |
-
font-weight: normal;
|
179 |
-
line-height: normal;
|
180 |
-
padding: 5px 20px;
|
181 |
-
text-decoration: none;
|
182 |
-
text-transform: uppercase;
|
183 |
-
cursor: pointer;
|
184 |
-
}
|
185 |
-
|
186 |
-
table.compare-list .add-to-cart td a:hover {
|
187 |
-
background: #868686;
|
188 |
-
color: #fff;
|
189 |
-
}
|
190 |
-
|
191 |
-
table.compare-list .stock td span {
|
192 |
-
color: #009900;
|
193 |
-
}
|
194 |
-
|
195 |
-
table.compare-list .stock td span.out-of-stock {
|
196 |
-
color: #990000;
|
197 |
-
}
|
198 |
-
|
199 |
-
table.compare-list .price td {
|
200 |
-
text-decoration: underline;
|
201 |
-
}
|
202 |
-
|
203 |
-
table.compare-list td.odd {
|
204 |
-
background: #F7F7F7;
|
205 |
-
}
|
206 |
-
|
207 |
-
table.compare-list td.even {
|
208 |
-
background: #fff;
|
209 |
-
}
|
210 |
-
|
211 |
-
table.compare-list td img {
|
212 |
-
background: none repeat scroll 0 0 #FFFFFF;
|
213 |
-
border: 1px solid #DADADA;
|
214 |
-
height: auto;
|
215 |
-
max-width: 100%;
|
216 |
-
padding: 3px;
|
217 |
-
margin-bottom: 20px;
|
218 |
-
max-width: none;
|
219 |
}
|
1 |
+
/**
|
2 |
+
* The style of the woocommerce compare products
|
3 |
+
*/
|
4 |
+
|
5 |
+
/* ###############
|
6 |
+
FIXED COLUMNS
|
7 |
+
##############*/
|
8 |
+
|
9 |
+
table.DTFC_Cloned thead, table.DTFC_Cloned tfoot{
|
10 |
+
background-color:white;
|
11 |
+
}
|
12 |
+
div.DTFC_Blocker{
|
13 |
+
background-color:white;
|
14 |
+
}
|
15 |
+
div.DTFC_LeftWrapper table.dataTable,
|
16 |
+
div.DTFC_RightWrapper table.dataTable{
|
17 |
+
margin-bottom:0;
|
18 |
+
z-index:2;
|
19 |
+
}
|
20 |
+
div.DTFC_LeftWrapper table.dataTable.no-footer,
|
21 |
+
div.DTFC_RightWrapper table.dataTable.no-footer{
|
22 |
+
border-bottom:none;
|
23 |
+
}
|
24 |
+
|
25 |
+
/*############################
|
26 |
+
* COMPARE
|
27 |
+
#############################*/
|
28 |
+
|
29 |
+
body {
|
30 |
+
font-family: 'Open Sans', san-serif;
|
31 |
+
font-size: 13px;
|
32 |
+
line-height: 1.51em;
|
33 |
+
color: #747373;
|
34 |
+
background: none !important;
|
35 |
+
margin: 0;
|
36 |
+
}
|
37 |
+
|
38 |
+
body h1 {
|
39 |
+
background: #4F4F4F;
|
40 |
+
color: #fff;
|
41 |
+
font-weight: 800;
|
42 |
+
padding: 10px;
|
43 |
+
border-bottom: 2px solid #fff;
|
44 |
+
display: block;
|
45 |
+
text-transform: uppercase;
|
46 |
+
font-size: 1.076em;
|
47 |
+
margin: 0;
|
48 |
+
text-align: center;
|
49 |
+
}
|
50 |
+
|
51 |
+
body #yith-woocompare {
|
52 |
+
padding: 10px;
|
53 |
+
}
|
54 |
+
|
55 |
+
table.dataTable.compare-list thead th,
|
56 |
+
table.dataTable.compare-list thead td,
|
57 |
+
table.dataTable.compare-list tfoot td,
|
58 |
+
table.dataTable.compare-list tfoot th {
|
59 |
+
border: 0;
|
60 |
+
vertical-align: middle;
|
61 |
+
}
|
62 |
+
.DTFC_LeftFootWrapper table.compare-list,
|
63 |
+
.DTFC_LeftHeadWrapper table.compare-list {
|
64 |
+
border: 0;
|
65 |
+
}
|
66 |
+
|
67 |
+
table.compare-list td {
|
68 |
+
width: 220px;
|
69 |
+
max-width: 220px;
|
70 |
+
min-width: 220px;
|
71 |
+
text-align: center;
|
72 |
+
vertical-align: middle;
|
73 |
+
}
|
74 |
+
|
75 |
+
table.compare-list {
|
76 |
+
width: 100%;
|
77 |
+
border-bottom: 0;
|
78 |
+
border-top: 0;
|
79 |
+
margin: 0;
|
80 |
+
table-layout: auto;
|
81 |
+
}
|
82 |
+
|
83 |
+
table.compare-list tbody th {
|
84 |
+
width: 150px;
|
85 |
+
max-width: 150px;
|
86 |
+
min-width: 150px;
|
87 |
+
overflow: hidden;
|
88 |
+
text-align: left;
|
89 |
+
color: #333333;
|
90 |
+
background-color: #f2f2f2;
|
91 |
+
text-transform: uppercase;
|
92 |
+
font-weight: 700;
|
93 |
+
font-size: 14px;
|
94 |
+
}
|
95 |
+
|
96 |
+
.rtl table.compare-list tbody th {
|
97 |
+
text-align: right;
|
98 |
+
}
|
99 |
+
|
100 |
+
table.dataTable.compare-list tbody th,
|
101 |
+
table.dataTable.compare-list tbody td {
|
102 |
+
border-right: 1px solid #e7e7e7;
|
103 |
+
border-top: 1px solid #e7e7e7;
|
104 |
+
border-bottom: none;
|
105 |
+
border-left: none;
|
106 |
+
padding: 10px;
|
107 |
+
vertical-align: middle;
|
108 |
+
}
|
109 |
+
table.dataTable.compare-list tbody tr:last-child th,
|
110 |
+
table.dataTable.compare-list tbody tr:last-child td {
|
111 |
+
border-bottom: 1px solid #e7e7e7;
|
112 |
+
}
|
113 |
+
|
114 |
+
table.compare-list tbody td.last-column {
|
115 |
+
width: auto;
|
116 |
+
border-right: 0;
|
117 |
+
}
|
118 |
+
|
119 |
+
table.compare-list tr.image td,
|
120 |
+
table.compare-list tr.image th {
|
121 |
+
border-top: 0;
|
122 |
+
}
|
123 |
+
|
124 |
+
#yith-woocompare-table_wrapper {
|
125 |
+
margin: 10px 0;
|
126 |
+
}
|
127 |
+
|
128 |
+
table.dataTable.compare-list tbody .product_info td {
|
129 |
+
vertical-align: top;
|
130 |
+
}
|
131 |
+
|
132 |
+
table.compare-list thead th a.close, h1 a.close {
|
133 |
+
float: right;
|
134 |
+
margin-right: 10px;
|
135 |
+
font-weight: 600;
|
136 |
+
font-size: 0.9em;
|
137 |
+
color: #fff;
|
138 |
+
text-decoration: none;
|
139 |
+
}
|
140 |
+
|
141 |
+
table.compare-list .remove td a {
|
142 |
+
color: #747373;
|
143 |
+
text-decoration: none;
|
144 |
+
}
|
145 |
+
|
146 |
+
table.compare-list .remove td a:hover {
|
147 |
+
color: #333333;
|
148 |
+
}
|
149 |
+
|
150 |
+
table.compare-list .remove td a .remove {
|
151 |
+
border-radius: 100% 100% 100% 100%;
|
152 |
+
color: red;
|
153 |
+
display: inline-block;
|
154 |
+
font-size: 1em;
|
155 |
+
font-weight: 600;
|
156 |
+
height: 1em;
|
157 |
+
line-height: 0.81em;
|
158 |
+
text-align: center;
|
159 |
+
text-decoration: none;
|
160 |
+
width: 1em;
|
161 |
+
}
|
162 |
+
|
163 |
+
.yith-woocompare-widget ul.products-list a.remove {
|
164 |
+
float: left;
|
165 |
+
}
|
166 |
+
|
167 |
+
table.compare-list .remove td a:hover .remove {
|
168 |
+
background-color: red;
|
169 |
+
color: #ffffff;
|
170 |
+
}
|
171 |
+
|
172 |
+
table.compare-list .add-to-cart td a {
|
173 |
+
display: inline-block;
|
174 |
+
margin: 10px 0;
|
175 |
+
background-color: #4F4F4F;
|
176 |
+
border: 0 none;
|
177 |
+
color: #FFFFFF;
|
178 |
+
font-weight: normal;
|
179 |
+
line-height: normal;
|
180 |
+
padding: 5px 20px;
|
181 |
+
text-decoration: none;
|
182 |
+
text-transform: uppercase;
|
183 |
+
cursor: pointer;
|
184 |
+
}
|
185 |
+
|
186 |
+
table.compare-list .add-to-cart td a:hover {
|
187 |
+
background: #868686;
|
188 |
+
color: #fff;
|
189 |
+
}
|
190 |
+
|
191 |
+
table.compare-list .stock td span {
|
192 |
+
color: #009900;
|
193 |
+
}
|
194 |
+
|
195 |
+
table.compare-list .stock td span.out-of-stock {
|
196 |
+
color: #990000;
|
197 |
+
}
|
198 |
+
|
199 |
+
table.compare-list .price td {
|
200 |
+
text-decoration: underline;
|
201 |
+
}
|
202 |
+
|
203 |
+
table.compare-list td.odd {
|
204 |
+
background: #F7F7F7;
|
205 |
+
}
|
206 |
+
|
207 |
+
table.compare-list td.even {
|
208 |
+
background: #fff;
|
209 |
+
}
|
210 |
+
|
211 |
+
table.compare-list td img {
|
212 |
+
background: none repeat scroll 0 0 #FFFFFF;
|
213 |
+
border: 1px solid #DADADA;
|
214 |
+
height: auto;
|
215 |
+
max-width: 100%;
|
216 |
+
padding: 3px;
|
217 |
+
margin-bottom: 20px;
|
218 |
+
max-width: none;
|
219 |
}
|
assets/css/widget.css
CHANGED
@@ -1,65 +1,65 @@
|
|
1 |
-
.yith-woocompare-widget ul.products-list {
|
2 |
-
list-style: none;
|
3 |
-
margin: 0 0 15px;
|
4 |
-
}
|
5 |
-
|
6 |
-
.yith-woocompare-widget ul.products-list li:not( .list_empty ) {
|
7 |
-
position: relative;
|
8 |
-
padding: 5px 0 5px 30px;
|
9 |
-
border-bottom: 1px solid #dfdfdf;
|
10 |
-
}
|
11 |
-
|
12 |
-
.yith-woocompare-widget ul.products-list li .remove {
|
13 |
-
position: absolute;
|
14 |
-
left: 3px;
|
15 |
-
color: #ff0000;
|
16 |
-
font-weight: 400;
|
17 |
-
font-size: 1.2em;
|
18 |
-
line-height: 1.2;
|
19 |
-
height: 1.2em;
|
20 |
-
width: 1.2em;
|
21 |
-
border-radius: 50%;
|
22 |
-
text-align: center;
|
23 |
-
cursor: pointer;
|
24 |
-
outline: none;
|
25 |
-
}
|
26 |
-
|
27 |
-
.yith-woocompare-widget ul.products-list li .remove:hover {
|
28 |
-
background-color: #ff0000;
|
29 |
-
color: #ffffff;
|
30 |
-
}
|
31 |
-
|
32 |
-
.yith-woocompare-widget ul.products-list li .title {
|
33 |
-
cursor: pointer;
|
34 |
-
text-transform: uppercase;
|
35 |
-
font-size: 12px;
|
36 |
-
font-weight: 400;
|
37 |
-
display: block;
|
38 |
-
outline: none;
|
39 |
-
}
|
40 |
-
|
41 |
-
.yith-woocompare-widget a.compare {
|
42 |
-
float: right;
|
43 |
-
float: right;
|
44 |
-
line-height: 1;
|
45 |
-
cursor: pointer;
|
46 |
-
padding: 8px 10px;
|
47 |
-
font-size: 13px;
|
48 |
-
text-transform: uppercase;
|
49 |
-
font-weight: 700;
|
50 |
-
border-radius: 3px;
|
51 |
-
border: 0;
|
52 |
-
white-space: nowrap;
|
53 |
-
display: inline-block;
|
54 |
-
color: #ffffff;
|
55 |
-
background-color: #b2b2b2;
|
56 |
-
}
|
57 |
-
|
58 |
-
.yith-woocompare-widget a.compare:hover {
|
59 |
-
background-color: #303030;
|
60 |
-
}
|
61 |
-
|
62 |
-
.yith-woocompare-widget a.clear-all {
|
63 |
-
outline: none;
|
64 |
-
font-size: 12px;
|
65 |
}
|
1 |
+
.yith-woocompare-widget ul.products-list {
|
2 |
+
list-style: none;
|
3 |
+
margin: 0 0 15px;
|
4 |
+
}
|
5 |
+
|
6 |
+
.yith-woocompare-widget ul.products-list li:not( .list_empty ) {
|
7 |
+
position: relative;
|
8 |
+
padding: 5px 0 5px 30px;
|
9 |
+
border-bottom: 1px solid #dfdfdf;
|
10 |
+
}
|
11 |
+
|
12 |
+
.yith-woocompare-widget ul.products-list li .remove {
|
13 |
+
position: absolute;
|
14 |
+
left: 3px;
|
15 |
+
color: #ff0000;
|
16 |
+
font-weight: 400;
|
17 |
+
font-size: 1.2em;
|
18 |
+
line-height: 1.2;
|
19 |
+
height: 1.2em;
|
20 |
+
width: 1.2em;
|
21 |
+
border-radius: 50%;
|
22 |
+
text-align: center;
|
23 |
+
cursor: pointer;
|
24 |
+
outline: none;
|
25 |
+
}
|
26 |
+
|
27 |
+
.yith-woocompare-widget ul.products-list li .remove:hover {
|
28 |
+
background-color: #ff0000;
|
29 |
+
color: #ffffff;
|
30 |
+
}
|
31 |
+
|
32 |
+
.yith-woocompare-widget ul.products-list li .title {
|
33 |
+
cursor: pointer;
|
34 |
+
text-transform: uppercase;
|
35 |
+
font-size: 12px;
|
36 |
+
font-weight: 400;
|
37 |
+
display: block;
|
38 |
+
outline: none;
|
39 |
+
}
|
40 |
+
|
41 |
+
.yith-woocompare-widget a.compare {
|
42 |
+
float: right;
|
43 |
+
float: right;
|
44 |
+
line-height: 1;
|
45 |
+
cursor: pointer;
|
46 |
+
padding: 8px 10px;
|
47 |
+
font-size: 13px;
|
48 |
+
text-transform: uppercase;
|
49 |
+
font-weight: 700;
|
50 |
+
border-radius: 3px;
|
51 |
+
border: 0;
|
52 |
+
white-space: nowrap;
|
53 |
+
display: inline-block;
|
54 |
+
color: #ffffff;
|
55 |
+
background-color: #b2b2b2;
|
56 |
+
}
|
57 |
+
|
58 |
+
.yith-woocompare-widget a.compare:hover {
|
59 |
+
background-color: #303030;
|
60 |
+
}
|
61 |
+
|
62 |
+
.yith-woocompare-widget a.clear-all {
|
63 |
+
outline: none;
|
64 |
+
font-size: 12px;
|
65 |
}
|
assets/js/woocompare-admin.js
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
-
jQuery(document).ready(function($) {
|
2 |
-
|
3 |
-
$( ".attributes .fields" ).sortable({
|
4 |
-
cursor: "move",
|
5 |
-
scrollSensitivity: 10,
|
6 |
-
tolerance: "pointer",
|
7 |
-
axis: "y",
|
8 |
-
stop: function(event, ui) {
|
9 |
-
var list = ui.item.parents('.fields'),
|
10 |
-
fields = new Array();
|
11 |
-
$('input[type="checkbox"]', list).each(function(i){
|
12 |
-
fields[i] = $(this).val();
|
13 |
-
});
|
14 |
-
|
15 |
-
list.next().val( fields.join(',') );
|
16 |
-
}
|
17 |
-
});
|
18 |
-
|
19 |
});
|
1 |
+
jQuery(document).ready(function($) {
|
2 |
+
|
3 |
+
$( ".attributes .fields" ).sortable({
|
4 |
+
cursor: "move",
|
5 |
+
scrollSensitivity: 10,
|
6 |
+
tolerance: "pointer",
|
7 |
+
axis: "y",
|
8 |
+
stop: function(event, ui) {
|
9 |
+
var list = ui.item.parents('.fields'),
|
10 |
+
fields = new Array();
|
11 |
+
$('input[type="checkbox"]', list).each(function(i){
|
12 |
+
fields[i] = $(this).val();
|
13 |
+
});
|
14 |
+
|
15 |
+
list.next().val( fields.join(',') );
|
16 |
+
}
|
17 |
+
});
|
18 |
+
|
19 |
});
|
includes/class.yith-woocompare-admin.php
CHANGED
@@ -1,476 +1,476 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Admin class
|
4 |
-
*
|
5 |
-
* @author YITH
|
6 |
-
* @package YITH WooCommerce Compare
|
7 |
-
* @version 2.0.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
if ( ! defined( 'YITH_WOOCOMPARE' ) ) {
|
11 |
-
exit;
|
12 |
-
} // Exit if accessed directly
|
13 |
-
|
14 |
-
if ( ! class_exists( 'YITH_Woocompare_Admin' ) ) {
|
15 |
-
/**
|
16 |
-
* Admin class.
|
17 |
-
* The class manage all the admin behaviors.
|
18 |
-
*
|
19 |
-
* @since 1.0.0
|
20 |
-
*/
|
21 |
-
class YITH_Woocompare_Admin {
|
22 |
-
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Plugin options
|
26 |
-
*
|
27 |
-
* @var array
|
28 |
-
* @access public
|
29 |
-
* @since 1.0.0
|
30 |
-
*/
|
31 |
-
public $options = array();
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Plugin version
|
35 |
-
*
|
36 |
-
* @var string
|
37 |
-
* @since 1.0.0
|
38 |
-
*/
|
39 |
-
public $version = YITH_WOOCOMPARE_VERSION;
|
40 |
-
|
41 |
-
/**
|
42 |
-
* @var $_panel Panel Object
|
43 |
-
*/
|
44 |
-
protected $_panel;
|
45 |
-
|
46 |
-
/**
|
47 |
-
* @var $_premium string Premium tab template file name
|
48 |
-
*/
|
49 |
-
protected $_premium = 'premium.php';
|
50 |
-
|
51 |
-
/**
|
52 |
-
* @var string Premium version landing link
|
53 |
-
*/
|
54 |
-
protected $_premium_landing = 'https://yithemes.com/themes/plugins/yith-woocommerce-compare';
|
55 |
-
|
56 |
-
/**
|
57 |
-
* @var string Compare panel page
|
58 |
-
*/
|
59 |
-
protected $_panel_page = 'yith_woocompare_panel';
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Various links
|
63 |
-
*
|
64 |
-
* @var string
|
65 |
-
* @access public
|
66 |
-
* @since 1.0.0
|
67 |
-
*/
|
68 |
-
public $doc_url = 'http://yithemes.com/docs-plugins/yith-woocommerce-compare/';
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Constructor
|
72 |
-
*
|
73 |
-
* @access public
|
74 |
-
* @since 1.0.0
|
75 |
-
*/
|
76 |
-
public function __construct() {
|
77 |
-
|
78 |
-
add_action( 'admin_menu', array( $this, 'register_panel' ), 5) ;
|
79 |
-
|
80 |
-
//Add action links
|
81 |
-
add_filter( 'plugin_action_links_' . plugin_basename( YITH_WOOCOMPARE_DIR . '/' . basename( YITH_WOOCOMPARE_FILE ) ), array( $this, 'action_links' ) );
|
82 |
-
add_filter( 'yith_show_plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 5 );
|
83 |
-
|
84 |
-
add_action( 'yith_woocompare_premium', array( $this, 'premium_tab' ) );
|
85 |
-
|
86 |
-
add_action( 'admin_init', array( $this, 'register_pointer' ) );
|
87 |
-
add_action( 'admin_init', array( $this, 'default_options'), 99 );
|
88 |
-
|
89 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ), 20 );
|
90 |
-
|
91 |
-
add_action( 'woocommerce_admin_field_woocompare_image_width', array( $this, 'admin_fields_woocompare_image_width' ) );
|
92 |
-
add_action( 'woocommerce_admin_field_woocompare_attributes', array( $this, 'admin_fields_attributes' ), 10, 1 );
|
93 |
-
if( version_compare( preg_replace( '/-beta-([0-9]+)/', '', WC()->version ), '2.4', '<' ) ) {
|
94 |
-
add_action( 'woocommerce_update_option_woocompare_attributes', array( $this, 'admin_update_custom_option_pre_24' ), 10, 1 );
|
95 |
-
}
|
96 |
-
else {
|
97 |
-
add_filter( 'woocommerce_admin_settings_sanitize_option_yith_woocompare_fields_attrs', array( $this, 'admin_update_custom_option' ), 10, 3 );
|
98 |
-
}
|
99 |
-
|
100 |
-
// YITH WCWL Loaded
|
101 |
-
do_action( 'yith_woocompare_loaded' );
|
102 |
-
}
|
103 |
-
|
104 |
-
/**
|
105 |
-
* Action Links
|
106 |
-
*
|
107 |
-
* add the action links to plugin admin page
|
108 |
-
*
|
109 |
-
* @param $links | links plugin array
|
110 |
-
*
|
111 |
-
* @return mixed Array
|
112 |
-
* @since 1.0
|
113 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
114 |
-
* @return mixed
|
115 |
-
* @use plugin_action_links_{$plugin_file_name}
|
116 |
-
*/
|
117 |
-
public function action_links( $links ) {
|
118 |
-
|
119 |
-
$links[] = '<a href="' . admin_url( "admin.php?page={$this->_panel_page}" ) . '">' . __( 'Settings', 'yith-woocommerce-compare' ) . '</a>';
|
120 |
-
if ( defined( 'YITH_WOOCOMPARE_PREMIUM' ) && YITH_WOOCOMPARE_PREMIUM ) {
|
121 |
-
$links[] = '<a href="' . YIT_Plugin_Licence()->get_license_activation_url() . '" target="_blank">' . __( 'License', 'yith-woocommerce-compare' ) . '</a>';
|
122 |
-
}
|
123 |
-
|
124 |
-
return $links;
|
125 |
-
}
|
126 |
-
|
127 |
-
/**
|
128 |
-
* Add a panel under YITH Plugins tab
|
129 |
-
*
|
130 |
-
* @return void
|
131 |
-
* @since 1.0
|
132 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
133 |
-
* @use /Yit_Plugin_Panel class
|
134 |
-
* @see plugin-fw/lib/yit-plugin-panel.php
|
135 |
-
*/
|
136 |
-
public function register_panel() {
|
137 |
-
|
138 |
-
if ( ! empty( $this->_panel ) ) {
|
139 |
-
return;
|
140 |
-
}
|
141 |
-
|
142 |
-
$admin_tabs = array(
|
143 |
-
'general' => __( 'Settings', 'yith-woocommerce-compare' ),
|
144 |
-
);
|
145 |
-
|
146 |
-
if ( ! ( defined( 'YITH_WOOCOMPARE_PREMIUM' ) && YITH_WOOCOMPARE_PREMIUM ) ) {
|
147 |
-
$admin_tabs['premium'] = __( 'Premium Version', 'yith-woocommerce-compare' );
|
148 |
-
}
|
149 |
-
|
150 |
-
$args = array(
|
151 |
-
'create_menu_page' => true,
|
152 |
-
'parent_slug' => '',
|
153 |
-
'page_title' => _x( 'Compare', 'Admin Plugin Name', 'yith-woocommerce-compare' ),
|
154 |
-
'menu_title' => _x( 'Compare', 'Admin Plugin Name', 'yith-woocommerce-compare' ),
|
155 |
-
'capability' => 'manage_options',
|
156 |
-
'parent' => '',
|
157 |
-
'parent_page' => 'yith_plugin_panel',
|
158 |
-
'page' => $this->_panel_page,
|
159 |
-
'admin-tabs' => apply_filters( 'yith_woocompare_admin_tabs', $admin_tabs ),
|
160 |
-
'options-path' => YITH_WOOCOMPARE_DIR . '/plugin-options'
|
161 |
-
);
|
162 |
-
|
163 |
-
|
164 |
-
/* === Fixed: not updated theme === */
|
165 |
-
if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
166 |
-
require_once( YITH_WOOCOMPARE_DIR . 'plugin-fw/lib/yit-plugin-panel-wc.php' );
|
167 |
-
}
|
168 |
-
|
169 |
-
$this->_panel = new YIT_Plugin_Panel_WooCommerce( $args );
|
170 |
-
$this->options = $this->_panel->get_main_array_options();
|
171 |
-
}
|
172 |
-
|
173 |
-
/**
|
174 |
-
* Set default custom options
|
175 |
-
*
|
176 |
-
*/
|
177 |
-
public function default_options() {
|
178 |
-
$this->_default_options();
|
179 |
-
}
|
180 |
-
|
181 |
-
/**
|
182 |
-
* Premium Tab Template
|
183 |
-
*
|
184 |
-
* Load the premium tab template on admin page
|
185 |
-
*
|
186 |
-
* @return void
|
187 |
-
* @since 1.0
|
188 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
189 |
-
* @return void
|
190 |
-
*/
|
191 |
-
public function premium_tab() {
|
192 |
-
$premium_tab_template = YITH_WOOCOMPARE_TEMPLATE_PATH . '/admin/' . $this->_premium;
|
193 |
-
if ( file_exists( $premium_tab_template ) ) {
|
194 |
-
include_once( $premium_tab_template );
|
195 |
-
}
|
196 |
-
|
197 |
-
}
|
198 |
-
|
199 |
-
/**
|
200 |
-
* plugin_row_meta
|
201 |
-
*
|
202 |
-
* add the action links to plugin admin page
|
203 |
-
*
|
204 |
-
* @param $plugin_meta
|
205 |
-
* @param $plugin_file
|
206 |
-
* @param $plugin_data
|
207 |
-
* @param $status
|
208 |
-
*
|
209 |
-
* @return Array
|
210 |
-
* @since 1.0
|
211 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
212 |
-
* @use plugin_row_meta
|
213 |
-
*/
|
214 |
-
public function plugin_row_meta( $new_row_meta_args, $plugin_meta, $plugin_file, $plugin_data, $status ) {
|
215 |
-
|
216 |
-
if ( defined( 'YITH_WOOCOMPARE_INIT' ) && YITH_WOOCOMPARE_INIT == $plugin_file ) {
|
217 |
-
$new_row_meta_args['slug'] = YITH_WOOCOMPARE_SLUG;
|
218 |
-
|
219 |
-
if( defined( 'YITH_WOOCOMPARE_PREMIUM' ) ){
|
220 |
-
$new_row_meta_args['is_premium'] = true;
|
221 |
-
}
|
222 |
-
}
|
223 |
-
|
224 |
-
return $new_row_meta_args;
|
225 |
-
}
|
226 |
-
|
227 |
-
/**
|
228 |
-
* Register Pointer
|
229 |
-
*/
|
230 |
-
public function register_pointer(){
|
231 |
-
|
232 |
-
if( ! class_exists( 'YIT_Pointers' ) ){
|
233 |
-
include_once( 'plugin-fw/lib/yit-pointers.php' );
|
234 |
-
}
|
235 |
-
|
236 |
-
$args[] = array(
|
237 |
-
'screen_id' => 'plugins',
|
238 |
-
'pointer_id' => 'yith_woocompare_panel',
|
239 |
-
'target' => '#toplevel_page_yit_plugin_panel',
|
240 |
-
'content' => sprintf( '<h3> %s </h3> <p> %s </p>',
|
241 |
-
__( 'YITH WooCommerce Compare Activated', 'yith-woocommerce-compare' ),
|
242 |
-
apply_filters( 'yith_woocompare_activated_pointer_content', sprintf( __( 'In the YIT Plugin tab you can find the YITH WooCommerce Compare options. With this menu, you can access to all the settings of our plugins that you have activated. YITH WooCommerce Compare is available in an outstanding PREMIUM version with many new options, <a href="%s">discover it now</a>.', 'yith-woocommerce-compare' ), $this->get_premium_landing_uri() ) )
|
243 |
-
),
|
244 |
-
'position' => array( 'edge' => 'left', 'align' => 'center' ),
|
245 |
-
'init' => YITH_WOOCOMPARE_INIT
|
246 |
-
);
|
247 |
-
|
248 |
-
$args[] = array(
|
249 |
-
'screen_id' => 'update',
|
250 |
-
'pointer_id' => 'yith_woocompare_panel',
|
251 |
-
'target' => '#toplevel_page_yit_plugin_panel',
|
252 |
-
'content' => sprintf( '<h3> %s </h3> <p> %s </p>',
|
253 |
-
__( 'YITH WooCommerce Compare Updated', 'yith-woocommerce-compare' ),
|
254 |
-
apply_filters( 'yith_woocompare_updated_pointer_content', sprintf( __( 'From now on, you can find all the options of YITH WooCommerce Compare under YIT Plugin -> Compare instead of WooCommerce -> Settings -> Compare, as in the previous version. When one of our plugins is updated, a new voice will be added to this menu. YITH WooCommerce Compare has been updated with new available options, <a href="%s">discover the PREMIUM version.</a>', 'yith-woocommerce-compare' ), $this->get_premium_landing_uri() ) )
|
255 |
-
),
|
256 |
-
'position' => array( 'edge' => 'left', 'align' => 'center' ),
|
257 |
-
'init' => YITH_WOOCOMPARE_INIT
|
258 |
-
);
|
259 |
-
|
260 |
-
YIT_Pointers()->register( $args );
|
261 |
-
}
|
262 |
-
|
263 |
-
/**
|
264 |
-
* Get the premium landing uri
|
265 |
-
*
|
266 |
-
* @since 1.0.0
|
267 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
268 |
-
* @return string The premium landing link
|
269 |
-
*/
|
270 |
-
public function get_premium_landing_uri() {
|
271 |
-
return defined( 'YITH_REFER_ID' ) ? $this->_premium_landing . '?refer_id=' . YITH_REFER_ID : $this->_premium_landing.'?refer_id=1030585';
|
272 |
-
}
|
273 |
-
|
274 |
-
/**
|
275 |
-
* Default options
|
276 |
-
*
|
277 |
-
* Sets up the default options used on the settings page
|
278 |
-
*
|
279 |
-
* @access protected
|
280 |
-
* @return void
|
281 |
-
* @since 1.0.0
|
282 |
-
*/
|
283 |
-
protected function _default_options() {
|
284 |
-
|
285 |
-
foreach ( $this->options as $section ) {
|
286 |
-
|
287 |
-
foreach ( $section as $value ) {
|
288 |
-
|
289 |
-
if ( isset( $value['std'] ) && isset( $value['id'] ) ) {
|
290 |
-
|
291 |
-
if ( $value['type'] == 'image_width' ) {
|
292 |
-
add_option( $value['id'], $value['std'] );
|
293 |
-
} elseif ( $value['type'] == 'woocompare_attributes' ) {
|
294 |
-
|
295 |
-
$value_id = str_replace( '_attrs', '', $value['id'] );
|
296 |
-
|
297 |
-
$in_db = get_option( $value_id );
|
298 |
-
$in_db_original = get_option( $value['id'] );
|
299 |
-
|
300 |
-
// if options is already in db and not reset defaults continue
|
301 |
-
if ( $in_db && $in_db_original != 'all' ) {
|
302 |
-
continue;
|
303 |
-
}
|
304 |
-
|
305 |
-
if ( $value['default'] == 'all' ) {
|
306 |
-
$fields = YITH_Woocompare_Helper::standard_fields();
|
307 |
-
$all = array();
|
308 |
-
|
309 |
-
foreach ( array_keys( $fields ) as $field ) {
|
310 |
-
$all[ $field ] = true;
|
311 |
-
}
|
312 |
-
|
313 |
-
update_option( $value_id, $all );
|
314 |
-
} else {
|
315 |
-
update_option( $value_id, $value['std'] );
|
316 |
-
}
|
317 |
-
}
|
318 |
-
}
|
319 |
-
}
|
320 |
-
}
|
321 |
-
}
|
322 |
-
|
323 |
-
/**
|
324 |
-
* Create new Woocommerce admin field: checkboxes
|
325 |
-
*
|
326 |
-
* @access public
|
327 |
-
* @param array $value
|
328 |
-
* @return void
|
329 |
-
* @since 1.0.0
|
330 |
-
*/
|
331 |
-
public function admin_fields_attributes( $value ) {
|
332 |
-
$fields = YITH_Woocompare_Helper::standard_fields();
|
333 |
-
$all = array();
|
334 |
-
$checked = get_option( str_replace( '_attrs', '', $value['id'] ), $value['default'] == 'all' ? $all : array() );
|
335 |
-
|
336 |
-
foreach ( array_keys( $fields ) as $field ) {
|
337 |
-
$all[ $field ] = true;
|
338 |
-
}
|
339 |
-
// then add fields that are not still saved
|
340 |
-
foreach ( $checked as $k => $v ) {
|
341 |
-
unset( $all[ $k ] );
|
342 |
-
}
|
343 |
-
$checkboxes = array_merge( $checked, $all );
|
344 |
-
|
345 |
-
|
346 |
-
?>
|
347 |
-
<tr valign="top">
|
348 |
-
<th scope="row" class="titledesc">
|
349 |
-
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo $value['name']; ?></label>
|
350 |
-
</th>
|
351 |
-
|
352 |
-
<td class="forminp attributes">
|
353 |
-
<p class="description"><?php echo $value['desc'] ?></p>
|
354 |
-
<ul class="fields">
|
355 |
-
<?php foreach ( $checkboxes as $slug => $checked ) :
|
356 |
-
if( ! isset( $fields[ $slug ] ) )
|
357 |
-
continue;
|
358 |
-
?>
|
359 |
-
<li>
|
360 |
-
<label>
|
361 |
-
<input type="checkbox" name="<?php echo $value['id'] ?>[]" id="<?php echo $value['id'] ?>_<?php echo $slug ?>" value="<?php echo $slug ?>"<?php checked( $checked ) ?> /> <?php echo $fields[ $slug ] ?>
|
362 |
-
</label>
|
363 |
-
</li>
|
364 |
-
<?php
|
365 |
-
endforeach;
|
366 |
-
?>
|
367 |
-
</ul>
|
368 |
-
<input type="hidden" name="<?php echo $value['id'] ?>_positions" value="<?php echo implode( ',', array_keys( $checkboxes ) ) ?>" />
|
369 |
-
</td>
|
370 |
-
</tr>
|
371 |
-
<?php
|
372 |
-
}
|
373 |
-
|
374 |
-
/**
|
375 |
-
* Create new Woocommerce admin field: yit_wc_image_width
|
376 |
-
*
|
377 |
-
* @access public
|
378 |
-
* @param array $value
|
379 |
-
* @return void
|
380 |
-
* @since 1.0.0
|
381 |
-
*/
|
382 |
-
public function admin_fields_woocompare_image_width( $value ) {
|
383 |
-
|
384 |
-
$width = WC_Admin_Settings::get_option( $value['id'] . '[width]', $value['default']['width'] );
|
385 |
-
$height = WC_Admin_Settings::get_option( $value['id'] . '[height]', $value['default']['height'] );
|
386 |
-
$crop = WC_Admin_Settings::get_option( $value['id'] . '[crop]' );
|
387 |
-
$crop = ( $crop == 'on' || $crop == '1' ) ? 1 : 0;
|
388 |
-
$crop = checked( 1, $crop, false );
|
389 |
-
|
390 |
-
?>
|
391 |
-
<tr valign="top">
|
392 |
-
<th scope="row" class="titledesc"><?php echo esc_html( $value['title'] ) ?></th>
|
393 |
-
<td class="forminp image_width_settings">
|
394 |
-
|
395 |
-
<input name="<?php echo esc_attr( $value['id'] ); ?>[width]" id="<?php echo esc_attr( $value['id'] ); ?>-width" type="text" size="3" value="<?php echo $width; ?>" /> ×
|
396 |
-
<input name="<?php echo esc_attr( $value['id'] ); ?>[height]" id="<?php echo esc_attr( $value['id'] ); ?>-height" type="text" size="3" value="<?php echo $height; ?>" />px
|
397 |
-
|
398 |
-
<label><input name="<?php echo esc_attr( $value['id'] ); ?>[crop]" id="<?php echo esc_attr( $value['id'] ); ?>-crop" type="checkbox" <?php echo $crop; ?> /> <?php _e( 'Do you want to hard crop the image?', 'yith-woocommerce-compare' ); ?>
|
399 |
-
</label>
|
400 |
-
<p class="description"><?php echo $value['desc'] ?></p>
|
401 |
-
|
402 |
-
</td>
|
403 |
-
</tr><?php
|
404 |
-
|
405 |
-
}
|
406 |
-
|
407 |
-
/**
|
408 |
-
* Save the admin field: slider
|
409 |
-
*
|
410 |
-
* @access public
|
411 |
-
* @param mixed $value
|
412 |
-
* @param mixed $option
|
413 |
-
* @param mixed $raw_value
|
414 |
-
* @return mixed
|
415 |
-
* @since 1.0.0
|
416 |
-
*/
|
417 |
-
public function admin_update_custom_option( $value, $option, $raw_value ) {
|
418 |
-
|
419 |
-
$val = array();
|
420 |
-
$checked_fields = isset( $_POST[ $option['id'] ] ) ? maybe_unserialize( $_POST[ $option['id'] ] ) : array();
|
421 |
-
$fields = array_map( 'trim', explode( ',', $_POST[ $option['id'] . '_positions' ] ) );
|
422 |
-
|
423 |
-
foreach ( $fields as $field ) {
|
424 |
-
$val[ $field ] = in_array( $field, $checked_fields );
|
425 |
-
}
|
426 |
-
|
427 |
-
update_option( str_replace( '_attrs', '', $option['id'] ), $val );
|
428 |
-
|
429 |
-
return $value;
|
430 |
-
}
|
431 |
-
|
432 |
-
/**
|
433 |
-
* Save the admin field: slider
|
434 |
-
*
|
435 |
-
* @access public
|
436 |
-
* @param mixed $value
|
437 |
-
* @return void
|
438 |
-
* @since 1.0.0
|
439 |
-
*/
|
440 |
-
public function admin_update_custom_option_pre_24( $value ) {
|
441 |
-
|
442 |
-
$val = array();
|
443 |
-
$checked_fields = isset( $_POST[ $value['id'] ] ) ? $_POST[ $value['id'] ] : array();
|
444 |
-
$fields = array_map( 'trim', explode( ',', $_POST[ $value['id'] . '_positions' ] ) );
|
445 |
-
|
446 |
-
foreach ( $fields as $field ) {
|
447 |
-
$val[ $field ] = in_array( $field, $checked_fields );
|
448 |
-
}
|
449 |
-
|
450 |
-
update_option( str_replace( '_attrs', '', $value['id'] ), $val );
|
451 |
-
}
|
452 |
-
|
453 |
-
/**
|
454 |
-
* Enqueue admin styles and scripts
|
455 |
-
*
|
456 |
-
* @access public
|
457 |
-
* @return void
|
458 |
-
* @since 1.0.0
|
459 |
-
*/
|
460 |
-
public function enqueue_styles_scripts() {
|
461 |
-
|
462 |
-
if ( isset( $_GET['page'] ) && $_GET['page'] == 'yith_woocompare_panel' ) {
|
463 |
-
wp_enqueue_script( 'jquery-ui' );
|
464 |
-
wp_enqueue_script( 'jquery-ui-core' );
|
465 |
-
wp_enqueue_script( 'jquery-ui-mouse' );
|
466 |
-
wp_enqueue_script( 'jquery-ui-slider' );
|
467 |
-
wp_enqueue_script( 'jquery-ui-sortable' );
|
468 |
-
|
469 |
-
wp_enqueue_style( 'yith_woocompare_admin', YITH_WOOCOMPARE_URL . 'assets/css/admin.css' );
|
470 |
-
wp_enqueue_script( 'yith_woocompare', YITH_WOOCOMPARE_URL . 'assets/js/woocompare-admin.js', array( 'jquery', 'jquery-ui-sortable' ) );
|
471 |
-
}
|
472 |
-
|
473 |
-
do_action( 'yith_woocompare_enqueue_styles_scripts' );
|
474 |
-
}
|
475 |
-
}
|
476 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Admin class
|
4 |
+
*
|
5 |
+
* @author YITH
|
6 |
+
* @package YITH WooCommerce Compare
|
7 |
+
* @version 2.0.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'YITH_WOOCOMPARE' ) ) {
|
11 |
+
exit;
|
12 |
+
} // Exit if accessed directly
|
13 |
+
|
14 |
+
if ( ! class_exists( 'YITH_Woocompare_Admin' ) ) {
|
15 |
+
/**
|
16 |
+
* Admin class.
|
17 |
+
* The class manage all the admin behaviors.
|
18 |
+
*
|
19 |
+
* @since 1.0.0
|
20 |
+
*/
|
21 |
+
class YITH_Woocompare_Admin {
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Plugin options
|
26 |
+
*
|
27 |
+
* @var array
|
28 |
+
* @access public
|
29 |
+
* @since 1.0.0
|
30 |
+
*/
|
31 |
+
public $options = array();
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Plugin version
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
* @since 1.0.0
|
38 |
+
*/
|
39 |
+
public $version = YITH_WOOCOMPARE_VERSION;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @var $_panel Panel Object
|
43 |
+
*/
|
44 |
+
protected $_panel;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @var $_premium string Premium tab template file name
|
48 |
+
*/
|
49 |
+
protected $_premium = 'premium.php';
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @var string Premium version landing link
|
53 |
+
*/
|
54 |
+
protected $_premium_landing = 'https://yithemes.com/themes/plugins/yith-woocommerce-compare';
|
55 |
+
|
56 |
+
/**
|
57 |
+
* @var string Compare panel page
|
58 |
+
*/
|
59 |
+
protected $_panel_page = 'yith_woocompare_panel';
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Various links
|
63 |
+
*
|
64 |
+
* @var string
|
65 |
+
* @access public
|
66 |
+
* @since 1.0.0
|
67 |
+
*/
|
68 |
+
public $doc_url = 'http://yithemes.com/docs-plugins/yith-woocommerce-compare/';
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Constructor
|
72 |
+
*
|
73 |
+
* @access public
|
74 |
+
* @since 1.0.0
|
75 |
+
*/
|
76 |
+
public function __construct() {
|
77 |
+
|
78 |
+
add_action( 'admin_menu', array( $this, 'register_panel' ), 5) ;
|
79 |
+
|
80 |
+
//Add action links
|
81 |
+
add_filter( 'plugin_action_links_' . plugin_basename( YITH_WOOCOMPARE_DIR . '/' . basename( YITH_WOOCOMPARE_FILE ) ), array( $this, 'action_links' ) );
|
82 |
+
add_filter( 'yith_show_plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 5 );
|
83 |
+
|
84 |
+
add_action( 'yith_woocompare_premium', array( $this, 'premium_tab' ) );
|
85 |
+
|
86 |
+
add_action( 'admin_init', array( $this, 'register_pointer' ) );
|
87 |
+
add_action( 'admin_init', array( $this, 'default_options'), 99 );
|
88 |
+
|
89 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ), 20 );
|
90 |
+
|
91 |
+
add_action( 'woocommerce_admin_field_woocompare_image_width', array( $this, 'admin_fields_woocompare_image_width' ) );
|
92 |
+
add_action( 'woocommerce_admin_field_woocompare_attributes', array( $this, 'admin_fields_attributes' ), 10, 1 );
|
93 |
+
if( version_compare( preg_replace( '/-beta-([0-9]+)/', '', WC()->version ), '2.4', '<' ) ) {
|
94 |
+
add_action( 'woocommerce_update_option_woocompare_attributes', array( $this, 'admin_update_custom_option_pre_24' ), 10, 1 );
|
95 |
+
}
|
96 |
+
else {
|
97 |
+
add_filter( 'woocommerce_admin_settings_sanitize_option_yith_woocompare_fields_attrs', array( $this, 'admin_update_custom_option' ), 10, 3 );
|
98 |
+
}
|
99 |
+
|
100 |
+
// YITH WCWL Loaded
|
101 |
+
do_action( 'yith_woocompare_loaded' );
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Action Links
|
106 |
+
*
|
107 |
+
* add the action links to plugin admin page
|
108 |
+
*
|
109 |
+
* @param $links | links plugin array
|
110 |
+
*
|
111 |
+
* @return mixed Array
|
112 |
+
* @since 1.0
|
113 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
114 |
+
* @return mixed
|
115 |
+
* @use plugin_action_links_{$plugin_file_name}
|
116 |
+
*/
|
117 |
+
public function action_links( $links ) {
|
118 |
+
|
119 |
+
$links[] = '<a href="' . admin_url( "admin.php?page={$this->_panel_page}" ) . '">' . __( 'Settings', 'yith-woocommerce-compare' ) . '</a>';
|
120 |
+
if ( defined( 'YITH_WOOCOMPARE_PREMIUM' ) && YITH_WOOCOMPARE_PREMIUM ) {
|
121 |
+
$links[] = '<a href="' . YIT_Plugin_Licence()->get_license_activation_url() . '" target="_blank">' . __( 'License', 'yith-woocommerce-compare' ) . '</a>';
|
122 |
+
}
|
123 |
+
|
124 |
+
return $links;
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Add a panel under YITH Plugins tab
|
129 |
+
*
|
130 |
+
* @return void
|
131 |
+
* @since 1.0
|
132 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
133 |
+
* @use /Yit_Plugin_Panel class
|
134 |
+
* @see plugin-fw/lib/yit-plugin-panel.php
|
135 |
+
*/
|
136 |
+
public function register_panel() {
|
137 |
+
|
138 |
+
if ( ! empty( $this->_panel ) ) {
|
139 |
+
return;
|
140 |
+
}
|
141 |
+
|
142 |
+
$admin_tabs = array(
|
143 |
+
'general' => __( 'Settings', 'yith-woocommerce-compare' ),
|
144 |
+
);
|
145 |
+
|
146 |
+
if ( ! ( defined( 'YITH_WOOCOMPARE_PREMIUM' ) && YITH_WOOCOMPARE_PREMIUM ) ) {
|
147 |
+
$admin_tabs['premium'] = __( 'Premium Version', 'yith-woocommerce-compare' );
|
148 |
+
}
|
149 |
+
|
150 |
+
$args = array(
|
151 |
+
'create_menu_page' => true,
|
152 |
+
'parent_slug' => '',
|
153 |
+
'page_title' => _x( 'Compare', 'Admin Plugin Name', 'yith-woocommerce-compare' ),
|
154 |
+
'menu_title' => _x( 'Compare', 'Admin Plugin Name', 'yith-woocommerce-compare' ),
|
155 |
+
'capability' => 'manage_options',
|
156 |
+
'parent' => '',
|
157 |
+
'parent_page' => 'yith_plugin_panel',
|
158 |
+
'page' => $this->_panel_page,
|
159 |
+
'admin-tabs' => apply_filters( 'yith_woocompare_admin_tabs', $admin_tabs ),
|
160 |
+
'options-path' => YITH_WOOCOMPARE_DIR . '/plugin-options'
|
161 |
+
);
|
162 |
+
|
163 |
+
|
164 |
+
/* === Fixed: not updated theme === */
|
165 |
+
if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
166 |
+
require_once( YITH_WOOCOMPARE_DIR . 'plugin-fw/lib/yit-plugin-panel-wc.php' );
|
167 |
+
}
|
168 |
+
|
169 |
+
$this->_panel = new YIT_Plugin_Panel_WooCommerce( $args );
|
170 |
+
$this->options = $this->_panel->get_main_array_options();
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Set default custom options
|
175 |
+
*
|
176 |
+
*/
|
177 |
+
public function default_options() {
|
178 |
+
$this->_default_options();
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Premium Tab Template
|
183 |
+
*
|
184 |
+
* Load the premium tab template on admin page
|
185 |
+
*
|
186 |
+
* @return void
|
187 |
+
* @since 1.0
|
188 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
189 |
+
* @return void
|
190 |
+
*/
|
191 |
+
public function premium_tab() {
|
192 |
+
$premium_tab_template = YITH_WOOCOMPARE_TEMPLATE_PATH . '/admin/' . $this->_premium;
|
193 |
+
if ( file_exists( $premium_tab_template ) ) {
|
194 |
+
include_once( $premium_tab_template );
|
195 |
+
}
|
196 |
+
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* plugin_row_meta
|
201 |
+
*
|
202 |
+
* add the action links to plugin admin page
|
203 |
+
*
|
204 |
+
* @param $plugin_meta
|
205 |
+
* @param $plugin_file
|
206 |
+
* @param $plugin_data
|
207 |
+
* @param $status
|
208 |
+
*
|
209 |
+
* @return Array
|
210 |
+
* @since 1.0
|
211 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
212 |
+
* @use plugin_row_meta
|
213 |
+
*/
|
214 |
+
public function plugin_row_meta( $new_row_meta_args, $plugin_meta, $plugin_file, $plugin_data, $status ) {
|
215 |
+
|
216 |
+
if ( defined( 'YITH_WOOCOMPARE_INIT' ) && YITH_WOOCOMPARE_INIT == $plugin_file ) {
|
217 |
+
$new_row_meta_args['slug'] = YITH_WOOCOMPARE_SLUG;
|
218 |
+
|
219 |
+
if( defined( 'YITH_WOOCOMPARE_PREMIUM' ) ){
|
220 |
+
$new_row_meta_args['is_premium'] = true;
|
221 |
+
}
|
222 |
+
}
|
223 |
+
|
224 |
+
return $new_row_meta_args;
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Register Pointer
|
229 |
+
*/
|
230 |
+
public function register_pointer(){
|
231 |
+
|
232 |
+
if( ! class_exists( 'YIT_Pointers' ) ){
|
233 |
+
include_once( 'plugin-fw/lib/yit-pointers.php' );
|
234 |
+
}
|
235 |
+
|
236 |
+
$args[] = array(
|
237 |
+
'screen_id' => 'plugins',
|
238 |
+
'pointer_id' => 'yith_woocompare_panel',
|
239 |
+
'target' => '#toplevel_page_yit_plugin_panel',
|
240 |
+
'content' => sprintf( '<h3> %s </h3> <p> %s </p>',
|
241 |
+
__( 'YITH WooCommerce Compare Activated', 'yith-woocommerce-compare' ),
|
242 |
+
apply_filters( 'yith_woocompare_activated_pointer_content', sprintf( __( 'In the YIT Plugin tab you can find the YITH WooCommerce Compare options. With this menu, you can access to all the settings of our plugins that you have activated. YITH WooCommerce Compare is available in an outstanding PREMIUM version with many new options, <a href="%s">discover it now</a>.', 'yith-woocommerce-compare' ), $this->get_premium_landing_uri() ) )
|
243 |
+
),
|
244 |
+
'position' => array( 'edge' => 'left', 'align' => 'center' ),
|
245 |
+
'init' => YITH_WOOCOMPARE_INIT
|
246 |
+
);
|
247 |
+
|
248 |
+
$args[] = array(
|
249 |
+
'screen_id' => 'update',
|
250 |
+
'pointer_id' => 'yith_woocompare_panel',
|
251 |
+
'target' => '#toplevel_page_yit_plugin_panel',
|
252 |
+
'content' => sprintf( '<h3> %s </h3> <p> %s </p>',
|
253 |
+
__( 'YITH WooCommerce Compare Updated', 'yith-woocommerce-compare' ),
|
254 |
+
apply_filters( 'yith_woocompare_updated_pointer_content', sprintf( __( 'From now on, you can find all the options of YITH WooCommerce Compare under YIT Plugin -> Compare instead of WooCommerce -> Settings -> Compare, as in the previous version. When one of our plugins is updated, a new voice will be added to this menu. YITH WooCommerce Compare has been updated with new available options, <a href="%s">discover the PREMIUM version.</a>', 'yith-woocommerce-compare' ), $this->get_premium_landing_uri() ) )
|
255 |
+
),
|
256 |
+
'position' => array( 'edge' => 'left', 'align' => 'center' ),
|
257 |
+
'init' => YITH_WOOCOMPARE_INIT
|
258 |
+
);
|
259 |
+
|
260 |
+
YIT_Pointers()->register( $args );
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Get the premium landing uri
|
265 |
+
*
|
266 |
+
* @since 1.0.0
|
267 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
268 |
+
* @return string The premium landing link
|
269 |
+
*/
|
270 |
+
public function get_premium_landing_uri() {
|
271 |
+
return defined( 'YITH_REFER_ID' ) ? $this->_premium_landing . '?refer_id=' . YITH_REFER_ID : $this->_premium_landing.'?refer_id=1030585';
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Default options
|
276 |
+
*
|
277 |
+
* Sets up the default options used on the settings page
|
278 |
+
*
|
279 |
+
* @access protected
|
280 |
+
* @return void
|
281 |
+
* @since 1.0.0
|
282 |
+
*/
|
283 |
+
protected function _default_options() {
|
284 |
+
|
285 |
+
foreach ( $this->options as $section ) {
|
286 |
+
|
287 |
+
foreach ( $section as $value ) {
|
288 |
+
|
289 |
+
if ( isset( $value['std'] ) && isset( $value['id'] ) ) {
|
290 |
+
|
291 |
+
if ( $value['type'] == 'image_width' ) {
|
292 |
+
add_option( $value['id'], $value['std'] );
|
293 |
+
} elseif ( $value['type'] == 'woocompare_attributes' ) {
|
294 |
+
|
295 |
+
$value_id = str_replace( '_attrs', '', $value['id'] );
|
296 |
+
|
297 |
+
$in_db = get_option( $value_id );
|
298 |
+
$in_db_original = get_option( $value['id'] );
|
299 |
+
|
300 |
+
// if options is already in db and not reset defaults continue
|
301 |
+
if ( $in_db && $in_db_original != 'all' ) {
|
302 |
+
continue;
|
303 |
+
}
|
304 |
+
|
305 |
+
if ( $value['default'] == 'all' ) {
|
306 |
+
$fields = YITH_Woocompare_Helper::standard_fields();
|
307 |
+
$all = array();
|
308 |
+
|
309 |
+
foreach ( array_keys( $fields ) as $field ) {
|
310 |
+
$all[ $field ] = true;
|
311 |
+
}
|
312 |
+
|
313 |
+
update_option( $value_id, $all );
|
314 |
+
} else {
|
315 |
+
update_option( $value_id, $value['std'] );
|
316 |
+
}
|
317 |
+
}
|
318 |
+
}
|
319 |
+
}
|
320 |
+
}
|
321 |
+
}
|
322 |
+
|
323 |
+
/**
|
324 |
+
* Create new Woocommerce admin field: checkboxes
|
325 |
+
*
|
326 |
+
* @access public
|
327 |
+
* @param array $value
|
328 |
+
* @return void
|
329 |
+
* @since 1.0.0
|
330 |
+
*/
|
331 |
+
public function admin_fields_attributes( $value ) {
|
332 |
+
$fields = YITH_Woocompare_Helper::standard_fields();
|
333 |
+
$all = array();
|
334 |
+
$checked = get_option( str_replace( '_attrs', '', $value['id'] ), $value['default'] == 'all' ? $all : array() );
|
335 |
+
|
336 |
+
foreach ( array_keys( $fields ) as $field ) {
|
337 |
+
$all[ $field ] = true;
|
338 |
+
}
|
339 |
+
// then add fields that are not still saved
|
340 |
+
foreach ( $checked as $k => $v ) {
|
341 |
+
unset( $all[ $k ] );
|
342 |
+
}
|
343 |
+
$checkboxes = array_merge( $checked, $all );
|
344 |
+
|
345 |
+
|
346 |
+
?>
|
347 |
+
<tr valign="top">
|
348 |
+
<th scope="row" class="titledesc">
|
349 |
+
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo $value['name']; ?></label>
|
350 |
+
</th>
|
351 |
+
|
352 |
+
<td class="forminp attributes">
|
353 |
+
<p class="description"><?php echo $value['desc'] ?></p>
|
354 |
+
<ul class="fields">
|
355 |
+
<?php foreach ( $checkboxes as $slug => $checked ) :
|
356 |
+
if( ! isset( $fields[ $slug ] ) )
|
357 |
+
continue;
|
358 |
+
?>
|
359 |
+
<li>
|
360 |
+
<label>
|
361 |
+
<input type="checkbox" name="<?php echo $value['id'] ?>[]" id="<?php echo $value['id'] ?>_<?php echo $slug ?>" value="<?php echo $slug ?>"<?php checked( $checked ) ?> /> <?php echo $fields[ $slug ] ?>
|
362 |
+
</label>
|
363 |
+
</li>
|
364 |
+
<?php
|
365 |
+
endforeach;
|
366 |
+
?>
|
367 |
+
</ul>
|
368 |
+
<input type="hidden" name="<?php echo $value['id'] ?>_positions" value="<?php echo implode( ',', array_keys( $checkboxes ) ) ?>" />
|
369 |
+
</td>
|
370 |
+
</tr>
|
371 |
+
<?php
|
372 |
+
}
|
373 |
+
|
374 |
+
/**
|
375 |
+
* Create new Woocommerce admin field: yit_wc_image_width
|
376 |
+
*
|
377 |
+
* @access public
|
378 |
+
* @param array $value
|
379 |
+
* @return void
|
380 |
+
* @since 1.0.0
|
381 |
+
*/
|
382 |
+
public function admin_fields_woocompare_image_width( $value ) {
|
383 |
+
|
384 |
+
$width = WC_Admin_Settings::get_option( $value['id'] . '[width]', $value['default']['width'] );
|
385 |
+
$height = WC_Admin_Settings::get_option( $value['id'] . '[height]', $value['default']['height'] );
|
386 |
+
$crop = WC_Admin_Settings::get_option( $value['id'] . '[crop]' );
|
387 |
+
$crop = ( $crop == 'on' || $crop == '1' ) ? 1 : 0;
|
388 |
+
$crop = checked( 1, $crop, false );
|
389 |
+
|
390 |
+
?>
|
391 |
+
<tr valign="top">
|
392 |
+
<th scope="row" class="titledesc"><?php echo esc_html( $value['title'] ) ?></th>
|
393 |
+
<td class="forminp image_width_settings">
|
394 |
+
|
395 |
+
<input name="<?php echo esc_attr( $value['id'] ); ?>[width]" id="<?php echo esc_attr( $value['id'] ); ?>-width" type="text" size="3" value="<?php echo $width; ?>" /> ×
|
396 |
+
<input name="<?php echo esc_attr( $value['id'] ); ?>[height]" id="<?php echo esc_attr( $value['id'] ); ?>-height" type="text" size="3" value="<?php echo $height; ?>" />px
|
397 |
+
|
398 |
+
<label><input name="<?php echo esc_attr( $value['id'] ); ?>[crop]" id="<?php echo esc_attr( $value['id'] ); ?>-crop" type="checkbox" <?php echo $crop; ?> /> <?php _e( 'Do you want to hard crop the image?', 'yith-woocommerce-compare' ); ?>
|
399 |
+
</label>
|
400 |
+
<p class="description"><?php echo $value['desc'] ?></p>
|
401 |
+
|
402 |
+
</td>
|
403 |
+
</tr><?php
|
404 |
+
|
405 |
+
}
|
406 |
+
|
407 |
+
/**
|
408 |
+
* Save the admin field: slider
|
409 |
+
*
|
410 |
+
* @access public
|
411 |
+
* @param mixed $value
|
412 |
+
* @param mixed $option
|
413 |
+
* @param mixed $raw_value
|
414 |
+
* @return mixed
|
415 |
+
* @since 1.0.0
|
416 |
+
*/
|
417 |
+
public function admin_update_custom_option( $value, $option, $raw_value ) {
|
418 |
+
|
419 |
+
$val = array();
|
420 |
+
$checked_fields = isset( $_POST[ $option['id'] ] ) ? maybe_unserialize( $_POST[ $option['id'] ] ) : array();
|
421 |
+
$fields = array_map( 'trim', explode( ',', $_POST[ $option['id'] . '_positions' ] ) );
|
422 |
+
|
423 |
+
foreach ( $fields as $field ) {
|
424 |
+
$val[ $field ] = in_array( $field, $checked_fields );
|
425 |
+
}
|
426 |
+
|
427 |
+
update_option( str_replace( '_attrs', '', $option['id'] ), $val );
|
428 |
+
|
429 |
+
return $value;
|
430 |
+
}
|
431 |
+
|
432 |
+
/**
|
433 |
+
* Save the admin field: slider
|
434 |
+
*
|
435 |
+
* @access public
|
436 |
+
* @param mixed $value
|
437 |
+
* @return void
|
438 |
+
* @since 1.0.0
|
439 |
+
*/
|
440 |
+
public function admin_update_custom_option_pre_24( $value ) {
|
441 |
+
|
442 |
+
$val = array();
|
443 |
+
$checked_fields = isset( $_POST[ $value['id'] ] ) ? $_POST[ $value['id'] ] : array();
|
444 |
+
$fields = array_map( 'trim', explode( ',', $_POST[ $value['id'] . '_positions' ] ) );
|
445 |
+
|
446 |
+
foreach ( $fields as $field ) {
|
447 |
+
$val[ $field ] = in_array( $field, $checked_fields );
|
448 |
+
}
|
449 |
+
|
450 |
+
update_option( str_replace( '_attrs', '', $value['id'] ), $val );
|
451 |
+
}
|
452 |
+
|
453 |
+
/**
|
454 |
+
* Enqueue admin styles and scripts
|
455 |
+
*
|
456 |
+
* @access public
|
457 |
+
* @return void
|
458 |
+
* @since 1.0.0
|
459 |
+
*/
|
460 |
+
public function enqueue_styles_scripts() {
|
461 |
+
|
462 |
+
if ( isset( $_GET['page'] ) && $_GET['page'] == 'yith_woocompare_panel' ) {
|
463 |
+
wp_enqueue_script( 'jquery-ui' );
|
464 |
+
wp_enqueue_script( 'jquery-ui-core' );
|
465 |
+
wp_enqueue_script( 'jquery-ui-mouse' );
|
466 |
+
wp_enqueue_script( 'jquery-ui-slider' );
|
467 |
+
wp_enqueue_script( 'jquery-ui-sortable' );
|
468 |
+
|
469 |
+
wp_enqueue_style( 'yith_woocompare_admin', YITH_WOOCOMPARE_URL . 'assets/css/admin.css' );
|
470 |
+
wp_enqueue_script( 'yith_woocompare', YITH_WOOCOMPARE_URL . 'assets/js/woocompare-admin.js', array( 'jquery', 'jquery-ui-sortable' ) );
|
471 |
+
}
|
472 |
+
|
473 |
+
do_action( 'yith_woocompare_enqueue_styles_scripts' );
|
474 |
+
}
|
475 |
+
}
|
476 |
+
}
|
includes/class.yith-woocompare-frontend.php
CHANGED
@@ -1,819 +1,819 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Main class
|
4 |
-
*
|
5 |
-
* @author YITH
|
6 |
-
* @package YITH Woocommerce Compare
|
7 |
-
* @version 1.1.4
|
8 |
-
*/
|
9 |
-
|
10 |
-
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|
11 |
-
|
12 |
-
if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
13 |
-
/**
|
14 |
-
* YITH Custom Login Frontend
|
15 |
-
*
|
16 |
-
* @since 1.0.0
|
17 |
-
*/
|
18 |
-
class YITH_Woocompare_Frontend {
|
19 |
-
/**
|
20 |
-
* Plugin version
|
21 |
-
*
|
22 |
-
* @var string
|
23 |
-
* @since 1.0.0
|
24 |
-
*/
|
25 |
-
public $version = YITH_WOOCOMPARE_VERSION;
|
26 |
-
|
27 |
-
/**
|
28 |
-
* The list of products inside the comparison table
|
29 |
-
*
|
30 |
-
* @var array
|
31 |
-
* @since 1.0.0
|
32 |
-
*/
|
33 |
-
public $products_list = array();
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Plugin version
|
37 |
-
*
|
38 |
-
* @var string
|
39 |
-
* @since 1.0.0
|
40 |
-
*/
|
41 |
-
public $template_file = 'compare.php';
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Stylesheet file
|
45 |
-
*
|
46 |
-
* @var string
|
47 |
-
* @since 2.1.0
|
48 |
-
*/
|
49 |
-
public $stylesheet_file = 'compare.css';
|
50 |
-
|
51 |
-
/**
|
52 |
-
* The name of cookie name
|
53 |
-
*
|
54 |
-
* @var string
|
55 |
-
* @since 1.0.0
|
56 |
-
*/
|
57 |
-
public $cookie_name = 'yith_woocompare_list';
|
58 |
-
|
59 |
-
/**
|
60 |
-
* The action used to view the table comparison
|
61 |
-
*
|
62 |
-
* @var string
|
63 |
-
* @since 1.0.0
|
64 |
-
*/
|
65 |
-
public $action_view = 'yith-woocompare-view-table';
|
66 |
-
|
67 |
-
/**
|
68 |
-
* The action used to add the product to compare list
|
69 |
-
*
|
70 |
-
* @var string
|
71 |
-
* @since 1.0.0
|
72 |
-
*/
|
73 |
-
public $action_add = 'yith-woocompare-add-product';
|
74 |
-
|
75 |
-
/**
|
76 |
-
* The action used to add the product to compare list
|
77 |
-
*
|
78 |
-
* @var string
|
79 |
-
* @since 1.0.0
|
80 |
-
*/
|
81 |
-
public $action_remove = 'yith-woocompare-remove-product';
|
82 |
-
|
83 |
-
/**
|
84 |
-
* The action used to reload the compare list widget
|
85 |
-
*
|
86 |
-
* @var string
|
87 |
-
* @since 1.0.0
|
88 |
-
*/
|
89 |
-
public $action_reload = 'yith-woocompare-reload-product';
|
90 |
-
|
91 |
-
/**
|
92 |
-
* The standard fields
|
93 |
-
*
|
94 |
-
* @var array
|
95 |
-
* @since 1.0.0
|
96 |
-
*/
|
97 |
-
public $default_fields = array();
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Constructor
|
101 |
-
*
|
102 |
-
* @return YITH_Woocompare_Frontend
|
103 |
-
* @since 1.0.0
|
104 |
-
*/
|
105 |
-
public function __construct() {
|
106 |
-
|
107 |
-
|
108 |
-
add_action( 'init', array( $this, 'init_variables' ), 1 );
|
109 |
-
add_action( 'init', array( $this, 'populate_products_list' ), 10 );
|
110 |
-
|
111 |
-
// Add link or button in the products list or
|
112 |
-
if ( get_option('yith_woocompare_compare_button_in_product_page') == 'yes' ) add_action( 'woocommerce_single_product_summary', array( $this, 'add_compare_link' ), 35 );
|
113 |
-
if ( get_option('yith_woocompare_compare_button_in_products_list') == 'yes' ) add_action( 'woocommerce_after_shop_loop_item', array( $this, 'add_compare_link' ), 20 );
|
114 |
-
add_action( 'init', array( $this, 'add_product_to_compare_action' ), 15 );
|
115 |
-
add_action( 'init', array( $this, 'remove_product_from_compare_action' ), 15 );
|
116 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
117 |
-
add_action( 'template_redirect', array( $this, 'compare_table_html' ) );
|
118 |
-
|
119 |
-
// add the shortcode
|
120 |
-
add_shortcode( 'yith_compare_button', array( $this, 'compare_button_sc' ) );
|
121 |
-
|
122 |
-
// AJAX
|
123 |
-
if( version_compare( WC()->version, '2.4', '>=' ) ){
|
124 |
-
add_action( 'wc_ajax_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
|
125 |
-
add_action( 'wc_ajax_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
|
126 |
-
add_action( 'wc_ajax_' . $this->action_reload, array( $this, 'reload_widget_list_ajax' ) );
|
127 |
-
}
|
128 |
-
else {
|
129 |
-
add_action( 'wp_ajax_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
|
130 |
-
add_action( 'wp_ajax_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
|
131 |
-
add_action( 'wp_ajax_' . $this->action_reload, array( $this, 'reload_widget_list_ajax' ) );
|
132 |
-
}
|
133 |
-
// no priv
|
134 |
-
add_action( 'wp_ajax_nopriv_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
|
135 |
-
add_action( 'wp_ajax_nopriv_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
|
136 |
-
add_action( 'wp_ajax_nopriv_' . $this->action_reload, array( $this, 'reload_widget_list_ajax' ) );
|
137 |
-
|
138 |
-
return $this;
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Init class variables
|
143 |
-
*
|
144 |
-
* @since 2.3.4
|
145 |
-
* @author Francesco Licandro
|
146 |
-
*/
|
147 |
-
public function init_variables(){
|
148 |
-
global $sitepress;
|
149 |
-
|
150 |
-
$lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
|
151 |
-
|
152 |
-
if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress ) ) {
|
153 |
-
$sitepress->switch_lang( $lang, true );
|
154 |
-
}
|
155 |
-
|
156 |
-
// set coookiename
|
157 |
-
if ( is_multisite() ) $this->cookie_name .= '_' . get_current_blog_id();
|
158 |
-
|
159 |
-
// populate default fields for the comparison table
|
160 |
-
$this->default_fields = YITH_Woocompare_Helper::standard_fields();
|
161 |
-
}
|
162 |
-
|
163 |
-
/**
|
164 |
-
* Populate the compare product list
|
165 |
-
*/
|
166 |
-
public function populate_products_list(){
|
167 |
-
|
168 |
-
global $sitepress;
|
169 |
-
|
170 |
-
/**
|
171 |
-
* WPML Support
|
172 |
-
*/
|
173 |
-
$lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
|
174 |
-
|
175 |
-
// get cookie val
|
176 |
-
$the_list = isset( $_COOKIE[ $this->cookie_name ] ) ? json_decode( $_COOKIE[ $this->cookie_name ] ) : array();
|
177 |
-
|
178 |
-
// switch lang for WPML
|
179 |
-
if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress ) ) {
|
180 |
-
$sitepress->switch_lang( $lang, true );
|
181 |
-
}
|
182 |
-
|
183 |
-
foreach( $the_list as $product_id ) {
|
184 |
-
if( function_exists( 'wpml_object_id_filter' ) ) {
|
185 |
-
$product_id_translated = wpml_object_id_filter( $product_id, 'product', false );
|
186 |
-
// get all product of current lang
|
187 |
-
if ( $product_id_translated !== $product_id ) {
|
188 |
-
continue;
|
189 |
-
}
|
190 |
-
}
|
191 |
-
|
192 |
-
// check for deleted|private products
|
193 |
-
$product = wc_get_product( $product_id );
|
194 |
-
if( ! $product || yit_get_prop( $product, 'post_status' ) !== 'publish' ) {
|
195 |
-
continue;
|
196 |
-
}
|
197 |
-
|
198 |
-
$this->products_list[] = $product_id;
|
199 |
-
}
|
200 |
-
|
201 |
-
do_action( 'yith_woocompare_after_populate_product_list', $this->products_list );
|
202 |
-
}
|
203 |
-
|
204 |
-
/**
|
205 |
-
* Enqueue the scripts and styles in the page
|
206 |
-
*/
|
207 |
-
public function enqueue_scripts() {
|
208 |
-
|
209 |
-
// scripts
|
210 |
-
$min = ! ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.min' : '';
|
211 |
-
wp_register_script( 'yith-woocompare-main', YITH_WOOCOMPARE_ASSETS_URL . '/js/woocompare' . $min .'.js', array('jquery'), $this->version, true );
|
212 |
-
|
213 |
-
// enqueue and add localize
|
214 |
-
wp_enqueue_script( 'yith-woocompare-main' );
|
215 |
-
|
216 |
-
// localize script args
|
217 |
-
$args = apply_filters( 'yith_woocompare_main_script_localize_array', array(
|
218 |
-
'ajaxurl' => version_compare( WC()->version, '2.4', '>=' ) ? WC_AJAX::get_endpoint( "%%endpoint%%" ) : admin_url( 'admin-ajax.php', 'relative' ),
|
219 |
-
'actionadd' => $this->action_add,
|
220 |
-
'actionremove' => $this->action_remove,
|
221 |
-
'actionview' => $this->action_view,
|
222 |
-
'actionreload' => $this->action_reload,
|
223 |
-
'added_label' => apply_filters( 'yith_woocompare_compare_added_label', __( 'Added', 'yith-woocommerce-compare' ) ),
|
224 |
-
'table_title' => apply_filters( 'yith_woocompare_compare_table_title',__( 'Product Comparison', 'yith-woocommerce-compare' ) ),
|
225 |
-
'auto_open' => get_option( 'yith_woocompare_auto_open', 'yes' ),
|
226 |
-
'loader' => YITH_WOOCOMPARE_ASSETS_URL . '/images/loader.gif',
|
227 |
-
'button_text' => get_option('yith_woocompare_button_text'),
|
228 |
-
'cookie_name' => $this->cookie_name,
|
229 |
-
'close_label' => _x( 'Close', 'Label for popup close icon', 'yith-woocommerce-compare' )
|
230 |
-
));
|
231 |
-
|
232 |
-
wp_localize_script( 'yith-woocompare-main', 'yith_woocompare', $args );
|
233 |
-
|
234 |
-
// colorbox
|
235 |
-
wp_enqueue_style( 'jquery-colorbox', YITH_WOOCOMPARE_ASSETS_URL . '/css/colorbox.css' );
|
236 |
-
wp_enqueue_script( 'jquery-colorbox', YITH_WOOCOMPARE_ASSETS_URL . '/js/jquery.colorbox-min.js', array('jquery'), '1.4.21', true );
|
237 |
-
|
238 |
-
// widget
|
239 |
-
if ( is_active_widget( false, false, 'yith-woocompare-widget', true ) && ! is_admin() ) {
|
240 |
-
wp_enqueue_style( 'yith-woocompare-widget', YITH_WOOCOMPARE_ASSETS_URL . '/css/widget.css' );
|
241 |
-
}
|
242 |
-
}
|
243 |
-
|
244 |
-
/**
|
245 |
-
* The fields to show in the table
|
246 |
-
*
|
247 |
-
* @param array $products
|
248 |
-
* @return mixed|void
|
249 |
-
* @since 1.0.0
|
250 |
-
*/
|
251 |
-
public function fields( $products = array() ) {
|
252 |
-
|
253 |
-
$fields = get_option( 'yith_woocompare_fields', array() );
|
254 |
-
|
255 |
-
foreach ( $fields as $field => $show ) {
|
256 |
-
if ( $show ) {
|
257 |
-
if ( isset( $this->default_fields[$field] ) ) {
|
258 |
-
$fields[$field] = $this->default_fields[$field];
|
259 |
-
}
|
260 |
-
else {
|
261 |
-
if ( taxonomy_exists( $field ) ) {
|
262 |
-
$fields[$field] = wc_attribute_label( $field );
|
263 |
-
}
|
264 |
-
}
|
265 |
-
}
|
266 |
-
else {
|
267 |
-
unset( $fields[$field] );
|
268 |
-
}
|
269 |
-
}
|
270 |
-
|
271 |
-
return apply_filters( 'yith_woocompare_filter_table_fields', $fields, $products );
|
272 |
-
}
|
273 |
-
|
274 |
-
/**
|
275 |
-
* Render the maintenance page
|
276 |
-
*
|
277 |
-
*/
|
278 |
-
public function compare_table_html() {
|
279 |
-
|
280 |
-
if ( ( ! defined('DOING_AJAX') || ! DOING_AJAX ) && ( ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_view ) ) return;
|
281 |
-
|
282 |
-
// check if is add to cart
|
283 |
-
if( isset( $_REQUEST['add-to-cart'] ) ) {
|
284 |
-
$product_id = intval( $_REQUEST['add-to-cart'] );
|
285 |
-
|
286 |
-
wp_redirect( get_permalink( $product_id ) );
|
287 |
-
exit;
|
288 |
-
}
|
289 |
-
|
290 |
-
global $woocommerce, $sitepress;
|
291 |
-
|
292 |
-
/**
|
293 |
-
* WPML Suppot: Localize Ajax Call
|
294 |
-
*/
|
295 |
-
$lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
|
296 |
-
|
297 |
-
if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress ) ) {
|
298 |
-
$sitepress->switch_lang( $lang, true );
|
299 |
-
}
|
300 |
-
|
301 |
-
$args = $this->_vars();
|
302 |
-
$args['fixed'] = false;
|
303 |
-
$args['iframe'] = 'yes';
|
304 |
-
|
305 |
-
//extract args
|
306 |
-
extract( $args );
|
307 |
-
|
308 |
-
// remove all styles from compare template
|
309 |
-
add_action('wp_print_styles', array( $this, 'remove_all_styles' ), 100);
|
310 |
-
|
311 |
-
// remove admin bar
|
312 |
-
remove_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
|
313 |
-
remove_action( 'wp_head', '_admin_bar_bump_cb' );
|
314 |
-
|
315 |
-
// remove filters before render compare popup
|
316 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'actions_before_load_popup' ), 99 );
|
317 |
-
|
318 |
-
$plugin_path = YITH_WOOCOMPARE_TEMPLATE_PATH . '/' . $this->template_file;
|
319 |
-
|
320 |
-
if ( defined('WC_TEMPLATE_PATH') ) {
|
321 |
-
|
322 |
-
$template_path = get_template_directory() . '/' . WC_TEMPLATE_PATH . $this->template_file;
|
323 |
-
$child_path = get_stylesheet_directory() . '/' . WC_TEMPLATE_PATH . $this->template_file;
|
324 |
-
}
|
325 |
-
else {
|
326 |
-
$template_path = get_template_directory() . '/' . $woocommerce->template_url . $this->template_file;
|
327 |
-
$child_path = get_stylesheet_directory() . '/' . $woocommerce->template_url . $this->template_file;
|
328 |
-
}
|
329 |
-
|
330 |
-
foreach ( array( 'child_path', 'template_path', 'plugin_path' ) as $var ) {
|
331 |
-
if ( file_exists( ${$var} ) ) {
|
332 |
-
include ${$var};
|
333 |
-
exit();
|
334 |
-
}
|
335 |
-
}
|
336 |
-
}
|
337 |
-
|
338 |
-
/**
|
339 |
-
* Return the array with all products and all attributes values
|
340 |
-
*
|
341 |
-
* @param mixed $products
|
342 |
-
* @return array The complete list of products with all attributes value
|
343 |
-
*/
|
344 |
-
public function get_products_list( $products = array() ) {
|
345 |
-
$list = array();
|
346 |
-
|
347 |
-
empty( $products ) && $products = $this->products_list;
|
348 |
-
$products = apply_filters( 'yith_woocompare_exclude_products_from_list', $products );
|
349 |
-
|
350 |
-
$fields = $this->fields( $products );
|
351 |
-
|
352 |
-
foreach ( $products as $product_id ) {
|
353 |
-
|
354 |
-
/**
|
355 |
-
* @type object $product /WC_Product
|
356 |
-
*/
|
357 |
-
$product = $this->wc_get_product( $product_id );
|
358 |
-
|
359 |
-
if ( ! $product )
|
360 |
-
continue;
|
361 |
-
|
362 |
-
$product->fields = array();
|
363 |
-
|
364 |
-
// custom attributes
|
365 |
-
foreach ( $fields as $field => $name ) {
|
366 |
-
|
367 |
-
switch( $field ) {
|
368 |
-
case 'title':
|
369 |
-
$product->fields[$field] = $product->get_title();
|
370 |
-
break;
|
371 |
-
case 'price':
|
372 |
-
$product->fields[$field] = $product->get_price_html();
|
373 |
-
break;
|
374 |
-
case 'image':
|
375 |
-
$product->fields[$field] = intval( get_post_thumbnail_id( $product_id ) );
|
376 |
-
break;
|
377 |
-
case 'description':
|
378 |
-
$description = apply_filters( 'woocommerce_short_description', yit_get_prop( $product, 'post_excerpt' ) );
|
379 |
-
$product->fields[$field] = apply_filters( 'yith_woocompare_products_description', $description );
|
380 |
-
break;
|
381 |
-
case 'stock':
|
382 |
-
$availability = $product->get_availability();
|
383 |
-
if ( empty( $availability['availability'] ) ) {
|
384 |
-
$availability['availability'] = __( 'In stock', 'yith-woocommerce-compare' );
|
385 |
-
}
|
386 |
-
$product->fields[$field] = sprintf( '<span>%s</span>', esc_html( $availability['availability'] ) );
|
387 |
-
break;
|
388 |
-
case 'sku':
|
389 |
-
$sku = $product->get_sku();
|
390 |
-
! $sku && $sku = '-';
|
391 |
-
$product->fields[$field] = $sku;
|
392 |
-
break;
|
393 |
-
case 'weight':
|
394 |
-
if( $weight = $product->get_weight() ){
|
395 |
-
$weight = wc_format_localized_decimal( $weight ) . ' ' . esc_attr( get_option( 'woocommerce_weight_unit' ) );
|
396 |
-
}
|
397 |
-
else {
|
398 |
-
$weight = '-';
|
399 |
-
}
|
400 |
-
$product->fields[$field] = sprintf( '<span>%s</span>', esc_html( $weight ) );
|
401 |
-
break;
|
402 |
-
case 'dimensions':
|
403 |
-
$dimensions = function_exists( 'wc_format_dimensions' ) ? wc_format_dimensions( $product->get_dimensions(false) ) : $product->get_dimensions();
|
404 |
-
! $dimensions && $dimensions = '-';
|
405 |
-
|
406 |
-
$product->fields[$field] = sprintf( '<span>%s</span>', esc_html( $dimensions ) );
|
407 |
-
break;
|
408 |
-
default:
|
409 |
-
if ( taxonomy_exists( $field ) ) {
|
410 |
-
$product->fields[$field] = array();
|
411 |
-
$terms = get_the_terms( $product_id, $field );
|
412 |
-
if ( ! empty( $terms ) ) {
|
413 |
-
foreach ( $terms as $term ) {
|
414 |
-
$term = sanitize_term( $term, $field );
|
415 |
-
$product->fields[$field][] = $term->name;
|
416 |
-
}
|
417 |
-
}
|
418 |
-
$product->fields[$field] = implode( ', ', $product->fields[$field] );
|
419 |
-
}
|
420 |
-
else {
|
421 |
-
do_action_ref_array( 'yith_woocompare_field_' . $field, array( $product, &$product->fields ) );
|
422 |
-
}
|
423 |
-
break;
|
424 |
-
}
|
425 |
-
}
|
426 |
-
|
427 |
-
$list[ $product_id ] = $product;
|
428 |
-
}
|
429 |
-
|
430 |
-
return $list;
|
431 |
-
}
|
432 |
-
|
433 |
-
/**
|
434 |
-
* The URL of product comparison table
|
435 |
-
*
|
436 |
-
* @param bool | int $product_id
|
437 |
-
* @return string The url to add the product in the comparison table
|
438 |
-
*/
|
439 |
-
public function view_table_url( $product_id = false ) {
|
440 |
-
$url_args = array(
|
441 |
-
'action' => $this->action_view,
|
442 |
-
'iframe' => 'yes'
|
443 |
-
);
|
444 |
-
|
445 |
-
$lang = defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : false;
|
446 |
-
if( $lang ) {
|
447 |
-
$url_args['lang'] = $lang;
|
448 |
-
}
|
449 |
-
// fix by WPML
|
450 |
-
return apply_filters( 'yith_woocompare_view_table_url', esc_url_raw( add_query_arg( $url_args, remove_query_arg( 'wc-ajax' ) ) ), $product_id );
|
451 |
-
}
|
452 |
-
|
453 |
-
/**
|
454 |
-
* The URL to add the product into the comparison table
|
455 |
-
*
|
456 |
-
* @param int $product_id ID of the product to add
|
457 |
-
* @return string The url to add the product in the comparison table
|
458 |
-
*/
|
459 |
-
public function add_product_url( $product_id ) {
|
460 |
-
$url_args = array(
|
461 |
-
'action' => $this->action_add,
|
462 |
-
'id' => $product_id
|
463 |
-
);
|
464 |
-
|
465 |
-
$lang = defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : false;
|
466 |
-
if( $lang ) {
|
467 |
-
$url_args['lang'] = $lang;
|
468 |
-
}
|
469 |
-
|
470 |
-
return apply_filters( 'yith_woocompare_add_product_url', esc_url_raw( add_query_arg( $url_args, site_url() ) ), $this->action_add );
|
471 |
-
}
|
472 |
-
|
473 |
-
/**
|
474 |
-
* The URL to remove the product into the comparison table
|
475 |
-
*
|
476 |
-
* @param string $product_id The ID of the product to remove
|
477 |
-
* @return string The url to remove the product in the comparison table
|
478 |
-
*/
|
479 |
-
public function remove_product_url( $product_id ) {
|
480 |
-
$url_args = array(
|
481 |
-
'action' => $this->action_remove,
|
482 |
-
'id' => $product_id
|
483 |
-
);
|
484 |
-
return apply_filters( 'yith_woocompare_remove_product_url', esc_url_raw( add_query_arg( $url_args, site_url() ) ), $this->action_remove );
|
485 |
-
}
|
486 |
-
|
487 |
-
/**
|
488 |
-
* Add the link to compare
|
489 |
-
*/
|
490 |
-
public function add_compare_link( $product_id = false, $args = array() ) {
|
491 |
-
extract( $args );
|
492 |
-
|
493 |
-
if ( ! $product_id ) {
|
494 |
-
global $product;
|
495 |
-
$product_id = ! is_null( $product ) ? yit_get_prop( $product, 'id', true ) : 0;
|
496 |
-
}
|
497 |
-
|
498 |
-
// return if product doesn't exist
|
499 |
-
if ( empty( $product_id ) || apply_filters( 'yith_woocompare_remove_compare_link_by_cat', false, $product_id ) )
|
500 |
-
return;
|
501 |
-
|
502 |
-
$is_button = ! isset( $button_or_link ) || ! $button_or_link ? get_option( 'yith_woocompare_is_button' ) : $button_or_link;
|
503 |
-
|
504 |
-
if ( ! isset( $button_text ) || $button_text == 'default' ) {
|
505 |
-
$button_text = get_option( 'yith_woocompare_button_text', __( 'Compare', 'yith-woocommerce-compare' ) );
|
506 |
-
do_action ( 'wpml_register_single_string', 'Plugins', 'plugin_yit_compare_button_text', $button_text );
|
507 |
-
$button_text = apply_filters( 'wpml_translate_single_string', $button_text, 'Plugins', 'plugin_yit_compare_button_text' );
|
508 |
-
}
|
509 |
-
|
510 |
-
printf( '<a href="%s" class="%s" data-product_id="%d" rel="nofollow">%s</a>', $this->add_product_url( $product_id ), 'compare' . ( $is_button == 'button' ? ' button' : '' ), $product_id, $button_text );
|
511 |
-
}
|
512 |
-
|
513 |
-
/**
|
514 |
-
* Return the url of stylesheet position
|
515 |
-
*/
|
516 |
-
public function stylesheet_url() {
|
517 |
-
global $woocommerce;
|
518 |
-
|
519 |
-
$filename = $this->stylesheet_file;
|
520 |
-
|
521 |
-
$plugin_path = array( 'path' => YITH_WOOCOMPARE_DIR . '/assets/css/style.css', 'url' => YITH_WOOCOMPARE_ASSETS_URL . '/css/style.css' );
|
522 |
-
|
523 |
-
if ( defined('WC_TEMPLATE_PATH') ) {
|
524 |
-
$template_path = array( 'path' => get_template_directory() . '/' . WC_TEMPLATE_PATH . $filename, 'url' => get_template_directory_uri() . '/' . WC_TEMPLATE_PATH . $filename );
|
525 |
-
$child_path = array( 'path' => get_stylesheet_directory() . '/' . WC_TEMPLATE_PATH . $filename, 'url' => get_stylesheet_directory_uri() . '/' . WC_TEMPLATE_PATH . $filename );
|
526 |
-
}
|
527 |
-
else {
|
528 |
-
$template_path = array( 'path' => get_template_directory() . '/' . $woocommerce->template_url . $filename, 'url' => get_template_directory_uri() . '/' . $woocommerce->template_url . $filename );
|
529 |
-
$child_path = array( 'path' => get_stylesheet_directory() . '/' . $woocommerce->template_url . $filename, 'url' => get_stylesheet_directory_uri() . '/' . $woocommerce->template_url . $filename );
|
530 |
-
}
|
531 |
-
|
532 |
-
foreach ( array( 'child_path', 'template_path', 'plugin_path' ) as $var ) {
|
533 |
-
if ( file_exists( ${$var}['path'] ) ) {
|
534 |
-
return ${$var}['url'];
|
535 |
-
}
|
536 |
-
}
|
537 |
-
}
|
538 |
-
|
539 |
-
|
540 |
-
/**
|
541 |
-
* Generate template vars
|
542 |
-
*
|
543 |
-
* @return array
|
544 |
-
* @since 1.0.0
|
545 |
-
* @access protected
|
546 |
-
*/
|
547 |
-
protected function _vars() {
|
548 |
-
$vars = array(
|
549 |
-
'products' => $this->get_products_list(),
|
550 |
-
'fields' => $this->fields(),
|
551 |
-
'repeat_price' => get_option( 'yith_woocompare_price_end' ),
|
552 |
-
'repeat_add_to_cart' => get_option( 'yith_woocompare_add_to_cart_end' ),
|
553 |
-
);
|
554 |
-
|
555 |
-
return $vars;
|
556 |
-
}
|
557 |
-
|
558 |
-
/**
|
559 |
-
* The action called by the query string
|
560 |
-
*/
|
561 |
-
public function add_product_to_compare_action() {
|
562 |
-
if ( defined( 'DOING_AJAX' ) && DOING_AJAX || ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_add ) {
|
563 |
-
return;
|
564 |
-
}
|
565 |
-
|
566 |
-
$product_id = intval( $_REQUEST['id'] );
|
567 |
-
$product = $this->wc_get_product( $product_id );
|
568 |
-
|
569 |
-
// don't add the product if doesn't exist
|
570 |
-
if ( isset( $product->id ) && ! in_array( $product_id, $this->products_list ) ) {
|
571 |
-
$this->add_product_to_compare( $product_id );
|
572 |
-
}
|
573 |
-
|
574 |
-
wp_redirect( esc_url( remove_query_arg( array( 'id', 'action' ) ) ) );
|
575 |
-
exit();
|
576 |
-
}
|
577 |
-
|
578 |
-
/**
|
579 |
-
* The action called by AJAX
|
580 |
-
*/
|
581 |
-
public function add_product_to_compare_ajax() {
|
582 |
-
|
583 |
-
if( ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_add ){
|
584 |
-
die();
|
585 |
-
}
|
586 |
-
|
587 |
-
$product_id = intval( $_REQUEST['id'] );
|
588 |
-
$product = $this->wc_get_product( $product_id );
|
589 |
-
|
590 |
-
// don't add the product if doesn't exist
|
591 |
-
if ( isset( $product->id ) && ! in_array( $product_id, $this->products_list ) ) {
|
592 |
-
$this->add_product_to_compare( $product_id );
|
593 |
-
}
|
594 |
-
|
595 |
-
do_action( 'yith_woocompare_add_product_action_ajax' );
|
596 |
-
|
597 |
-
$json = apply_filters( 'yith_woocompare_add_product_action_json', array(
|
598 |
-
'table_url' => $this->view_table_url( $product_id ),
|
599 |
-
'widget_table' => $this->list_products_html(),
|
600 |
-
) );
|
601 |
-
|
602 |
-
echo json_encode( $json );
|
603 |
-
die();
|
604 |
-
}
|
605 |
-
|
606 |
-
/**
|
607 |
-
* Add a product in the products comparison table
|
608 |
-
*
|
609 |
-
* @param int $product_id product ID to add in the comparison table
|
610 |
-
*/
|
611 |
-
public function add_product_to_compare( $product_id ) {
|
612 |
-
|
613 |
-
$this->products_list[] = $product_id;
|
614 |
-
setcookie( $this->cookie_name, json_encode( $this->products_list ), 0, COOKIEPATH, COOKIE_DOMAIN, false, false );
|
615 |
-
|
616 |
-
do_action( 'yith_woocompare_after_add_product', $product_id );
|
617 |
-
}
|
618 |
-
|
619 |
-
/**
|
620 |
-
* The action called by the query string
|
621 |
-
*/
|
622 |
-
public function remove_product_from_compare_action() {
|
623 |
-
if ( defined( 'DOING_AJAX' ) && DOING_AJAX || ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_remove ) {
|
624 |
-
return;
|
625 |
-
}
|
626 |
-
|
627 |
-
$this->remove_product_from_compare( $_REQUEST['id'] );
|
628 |
-
|
629 |
-
// redirect
|
630 |
-
$redirect = esc_url( remove_query_arg( array( 'id', 'action' ) ) );
|
631 |
-
|
632 |
-
if ( isset( $_REQUEST['redirect'] ) && $_REQUEST['redirect'] == 'view' )
|
633 |
-
$redirect = esc_url( remove_query_arg( 'redirect', add_query_arg( 'action', $this->action_view, $redirect ) ) );
|
634 |
-
|
635 |
-
wp_redirect( $redirect );
|
636 |
-
exit();
|
637 |
-
}
|
638 |
-
|
639 |
-
/**
|
640 |
-
* The action called by AJAX
|
641 |
-
*/
|
642 |
-
public function remove_product_from_compare_ajax() {
|
643 |
-
|
644 |
-
if ( ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_remove ){
|
645 |
-
die();
|
646 |
-
}
|
647 |
-
|
648 |
-
$lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
|
649 |
-
|
650 |
-
$this->remove_product_from_compare( $_REQUEST['id'] );
|
651 |
-
|
652 |
-
do_action( 'yith_woocompare_remove_product_action_ajax' );
|
653 |
-
|
654 |
-
header('Content-Type: text/html; charset=utf-8');
|
655 |
-
|
656 |
-
if ( isset( $_REQUEST['responseType'] ) && $_REQUEST['responseType'] == 'product_list' ) {
|
657 |
-
echo $this->list_products_html( $lang );
|
658 |
-
} else {
|
659 |
-
$this->compare_table_html();
|
660 |
-
}
|
661 |
-
|
662 |
-
die();
|
663 |
-
}
|
664 |
-
|
665 |
-
/**
|
666 |
-
* Return the list of widget table, used in AJAX
|
667 |
-
*/
|
668 |
-
public function reload_widget_list_ajax() {
|
669 |
-
|
670 |
-
if ( ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_reload ){
|
671 |
-
die();
|
672 |
-
}
|
673 |
-
|
674 |
-
$lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
|
675 |
-
|
676 |
-
echo $this->list_products_html( $lang );
|
677 |
-
die();
|
678 |
-
}
|
679 |
-
|
680 |
-
/**
|
681 |
-
* The list of products as HTML list
|
682 |
-
*/
|
683 |
-
public function list_products_html( $lang = false ) {
|
684 |
-
ob_start();
|
685 |
-
|
686 |
-
/**
|
687 |
-
* WPML Suppot: Localize Ajax Call
|
688 |
-
*/
|
689 |
-
global $sitepress;
|
690 |
-
|
691 |
-
if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress )) {
|
692 |
-
$sitepress->switch_lang( $lang, true );
|
693 |
-
}
|
694 |
-
|
695 |
-
if ( empty( $this->products_list ) ) {
|
696 |
-
echo '<li class="list_empty">' . __( 'No products to compare', 'yith-woocommerce-compare' ) . '</li>';
|
697 |
-
return ob_get_clean();
|
698 |
-
}
|
699 |
-
|
700 |
-
foreach ( $this->products_list as $product_id ) {
|
701 |
-
/**
|
702 |
-
* @type object $product /WC_Product
|
703 |
-
*/
|
704 |
-
$product = $this->wc_get_product( $product_id );
|
705 |
-
if ( ! $product )
|
706 |
-
continue;
|
707 |
-
?>
|
708 |
-
<li>
|
709 |
-
<a href="<?php echo $this->remove_product_url( $product_id ) ?>" data-product_id="<?php echo $product_id; ?>" class="remove" title="<?php _e( 'Remove', 'yith-woocommerce-compare' ) ?>">x</a>
|
710 |
-
<a class="title" href="<?php echo get_permalink( $product_id ) ?>"><?php echo $product->get_title() ?></a>
|
711 |
-
</li>
|
712 |
-
<?php
|
713 |
-
}
|
714 |
-
|
715 |
-
$return = ob_get_clean();
|
716 |
-
|
717 |
-
return apply_filters( 'yith_woocompare_widget_products_html', $return, $this->products_list, $this );
|
718 |
-
}
|
719 |
-
|
720 |
-
/**
|
721 |
-
* Remove a product from the comparison table
|
722 |
-
*
|
723 |
-
* @param $product_id The product ID to remove from the comparison table
|
724 |
-
*/
|
725 |
-
public function remove_product_from_compare( $product_id ) {
|
726 |
-
|
727 |
-
if( $product_id == 'all' ) {
|
728 |
-
$this->products_list = array();
|
729 |
-
}
|
730 |
-
else {
|
731 |
-
foreach ( $this->products_list as $k => $id ) {
|
732 |
-
if ( intval( $product_id ) == $id ) {
|
733 |
-
unset( $this->products_list[ $k ] );
|
734 |
-
}
|
735 |
-
}
|
736 |
-
}
|
737 |
-
|
738 |
-
setcookie( $this->cookie_name, json_encode( array_values( $this->products_list ) ), 0, COOKIEPATH, COOKIE_DOMAIN, false, false );
|
739 |
-
|
740 |
-
do_action( 'yith_woocompare_after_remove_product', $product_id );
|
741 |
-
}
|
742 |
-
|
743 |
-
/**
|
744 |
-
* Remove all styles from the compare template
|
745 |
-
*/
|
746 |
-
public function remove_all_styles() {
|
747 |
-
global $wp_styles;
|
748 |
-
$wp_styles->queue = array();
|
749 |
-
}
|
750 |
-
|
751 |
-
/**
|
752 |
-
* Show the html for the shortcode
|
753 |
-
*/
|
754 |
-
public function compare_button_sc( $atts, $content = null ) {
|
755 |
-
$atts = shortcode_atts(array(
|
756 |
-
'product' => false,
|
757 |
-
'type' => 'default',
|
758 |
-
'container' => 'yes'
|
759 |
-
), $atts);
|
760 |
-
|
761 |
-
$product_id = 0;
|
762 |
-
|
763 |
-
/**
|
764 |
-
* Retrieve the product ID in these steps:
|
765 |
-
* - If "product" attribute is not set, get the product ID of current product loop
|
766 |
-
* - If "product" contains ID, post slug or post title
|
767 |
-
*/
|
768 |
-
if ( ! $atts['product'] ) {
|
769 |
-
global $product;
|
770 |
-
$product_id = ! is_null( $product ) ? yit_get_prop( $product, 'id', true ) : 0;
|
771 |
-
} else {
|
772 |
-
global $wpdb;
|
773 |
-
$product = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE ID = %d OR post_name = %s OR post_title = %s LIMIT 1", $atts['product'], $atts['product'], $atts['product'] ) );
|
774 |
-
if ( ! empty( $product ) ) {
|
775 |
-
$product_id = $product->ID;
|
776 |
-
}
|
777 |
-
}
|
778 |
-
|
779 |
-
// make sure to get always the product id of current language
|
780 |
-
if( function_exists( 'wpml_object_id_filter' ) ) {
|
781 |
-
$product_id = wpml_object_id_filter( $product_id, 'product', false );
|
782 |
-
}
|
783 |
-
|
784 |
-
// if product ID is 0, maybe the product doesn't exists or is wrong.. in this case, doesn't show the button
|
785 |
-
if ( empty( $product_id ) )
|
786 |
-
return '';
|
787 |
-
|
788 |
-
ob_start();
|
789 |
-
if ( $atts['container'] == 'yes' ) echo '<div class="woocommerce product compare-button">';
|
790 |
-
$this->add_compare_link( $product_id, array(
|
791 |
-
'button_or_link' => ( $atts['type'] == 'default' ? false : $atts['type'] ),
|
792 |
-
'button_text' => empty( $content ) ? 'default' : $content
|
793 |
-
) );
|
794 |
-
if ( $atts['container'] == 'yes' ) echo '</div>';
|
795 |
-
return ob_get_clean();
|
796 |
-
}
|
797 |
-
|
798 |
-
public function wc_get_product( $product_id ){
|
799 |
-
$wc_get_product = function_exists( 'wc_get_product' ) ? 'wc_get_product' : 'get_product';
|
800 |
-
return $wc_get_product( $product_id );
|
801 |
-
}
|
802 |
-
|
803 |
-
|
804 |
-
/**
|
805 |
-
* Do action before loads compare popup
|
806 |
-
*
|
807 |
-
* @since 2.1.1
|
808 |
-
* @author Francesco Licandro
|
809 |
-
*/
|
810 |
-
public function actions_before_load_popup(){
|
811 |
-
// removes WooCommerce Product Filter scripts
|
812 |
-
wp_dequeue_script( 'prdctfltr-main-js' );
|
813 |
-
wp_dequeue_script( 'prdctfltr-history' );
|
814 |
-
wp_dequeue_script( 'prdctfltr-ionrange-js' );
|
815 |
-
wp_dequeue_script( 'prdctfltr-isotope-js' );
|
816 |
-
wp_dequeue_script( 'prdctfltr-scrollbar-js' );
|
817 |
-
}
|
818 |
-
}
|
819 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Main class
|
4 |
+
*
|
5 |
+
* @author YITH
|
6 |
+
* @package YITH Woocommerce Compare
|
7 |
+
* @version 1.1.4
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|
11 |
+
|
12 |
+
if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
13 |
+
/**
|
14 |
+
* YITH Custom Login Frontend
|
15 |
+
*
|
16 |
+
* @since 1.0.0
|
17 |
+
*/
|
18 |
+
class YITH_Woocompare_Frontend {
|
19 |
+
/**
|
20 |
+
* Plugin version
|
21 |
+
*
|
22 |
+
* @var string
|
23 |
+
* @since 1.0.0
|
24 |
+
*/
|
25 |
+
public $version = YITH_WOOCOMPARE_VERSION;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* The list of products inside the comparison table
|
29 |
+
*
|
30 |
+
* @var array
|
31 |
+
* @since 1.0.0
|
32 |
+
*/
|
33 |
+
public $products_list = array();
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Plugin version
|
37 |
+
*
|
38 |
+
* @var string
|
39 |
+
* @since 1.0.0
|
40 |
+
*/
|
41 |
+
public $template_file = 'compare.php';
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Stylesheet file
|
45 |
+
*
|
46 |
+
* @var string
|
47 |
+
* @since 2.1.0
|
48 |
+
*/
|
49 |
+
public $stylesheet_file = 'compare.css';
|
50 |
+
|
51 |
+
/**
|
52 |
+
* The name of cookie name
|
53 |
+
*
|
54 |
+
* @var string
|
55 |
+
* @since 1.0.0
|
56 |
+
*/
|
57 |
+
public $cookie_name = 'yith_woocompare_list';
|
58 |
+
|
59 |
+
/**
|
60 |
+
* The action used to view the table comparison
|
61 |
+
*
|
62 |
+
* @var string
|
63 |
+
* @since 1.0.0
|
64 |
+
*/
|
65 |
+
public $action_view = 'yith-woocompare-view-table';
|
66 |
+
|
67 |
+
/**
|
68 |
+
* The action used to add the product to compare list
|
69 |
+
*
|
70 |
+
* @var string
|
71 |
+
* @since 1.0.0
|
72 |
+
*/
|
73 |
+
public $action_add = 'yith-woocompare-add-product';
|
74 |
+
|
75 |
+
/**
|
76 |
+
* The action used to add the product to compare list
|
77 |
+
*
|
78 |
+
* @var string
|
79 |
+
* @since 1.0.0
|
80 |
+
*/
|
81 |
+
public $action_remove = 'yith-woocompare-remove-product';
|
82 |
+
|
83 |
+
/**
|
84 |
+
* The action used to reload the compare list widget
|
85 |
+
*
|
86 |
+
* @var string
|
87 |
+
* @since 1.0.0
|
88 |
+
*/
|
89 |
+
public $action_reload = 'yith-woocompare-reload-product';
|
90 |
+
|
91 |
+
/**
|
92 |
+
* The standard fields
|
93 |
+
*
|
94 |
+
* @var array
|
95 |
+
* @since 1.0.0
|
96 |
+
*/
|
97 |
+
public $default_fields = array();
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Constructor
|
101 |
+
*
|
102 |
+
* @return YITH_Woocompare_Frontend
|
103 |
+
* @since 1.0.0
|
104 |
+
*/
|
105 |
+
public function __construct() {
|
106 |
+
|
107 |
+
|
108 |
+
add_action( 'init', array( $this, 'init_variables' ), 1 );
|
109 |
+
add_action( 'init', array( $this, 'populate_products_list' ), 10 );
|
110 |
+
|
111 |
+
// Add link or button in the products list or
|
112 |
+
if ( get_option('yith_woocompare_compare_button_in_product_page') == 'yes' ) add_action( 'woocommerce_single_product_summary', array( $this, 'add_compare_link' ), 35 );
|
113 |
+
if ( get_option('yith_woocompare_compare_button_in_products_list') == 'yes' ) add_action( 'woocommerce_after_shop_loop_item', array( $this, 'add_compare_link' ), 20 );
|
114 |
+
add_action( 'init', array( $this, 'add_product_to_compare_action' ), 15 );
|
115 |
+
add_action( 'init', array( $this, 'remove_product_from_compare_action' ), 15 );
|
116 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
117 |
+
add_action( 'template_redirect', array( $this, 'compare_table_html' ) );
|
118 |
+
|
119 |
+
// add the shortcode
|
120 |
+
add_shortcode( 'yith_compare_button', array( $this, 'compare_button_sc' ) );
|
121 |
+
|
122 |
+
// AJAX
|
123 |
+
if( version_compare( WC()->version, '2.4', '>=' ) ){
|
124 |
+
add_action( 'wc_ajax_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
|
125 |
+
add_action( 'wc_ajax_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
|
126 |
+
add_action( 'wc_ajax_' . $this->action_reload, array( $this, 'reload_widget_list_ajax' ) );
|
127 |
+
}
|
128 |
+
else {
|
129 |
+
add_action( 'wp_ajax_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
|
130 |
+
add_action( 'wp_ajax_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
|
131 |
+
add_action( 'wp_ajax_' . $this->action_reload, array( $this, 'reload_widget_list_ajax' ) );
|
132 |
+
}
|
133 |
+
// no priv
|
134 |
+
add_action( 'wp_ajax_nopriv_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
|
135 |
+
add_action( 'wp_ajax_nopriv_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
|
136 |
+
add_action( 'wp_ajax_nopriv_' . $this->action_reload, array( $this, 'reload_widget_list_ajax' ) );
|
137 |
+
|
138 |
+
return $this;
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Init class variables
|
143 |
+
*
|
144 |
+
* @since 2.3.4
|
145 |
+
* @author Francesco Licandro
|
146 |
+
*/
|
147 |
+
public function init_variables(){
|
148 |
+
global $sitepress;
|
149 |
+
|
150 |
+
$lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
|
151 |
+
|
152 |
+
if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress ) ) {
|
153 |
+
$sitepress->switch_lang( $lang, true );
|
154 |
+
}
|
155 |
+
|
156 |
+
// set coookiename
|
157 |
+
if ( is_multisite() ) $this->cookie_name .= '_' . get_current_blog_id();
|
158 |
+
|
159 |
+
// populate default fields for the comparison table
|
160 |
+
$this->default_fields = YITH_Woocompare_Helper::standard_fields();
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Populate the compare product list
|
165 |
+
*/
|
166 |
+
public function populate_products_list(){
|
167 |
+
|
168 |
+
global $sitepress;
|
169 |
+
|
170 |
+
/**
|
171 |
+
* WPML Support
|
172 |
+
*/
|
173 |
+
$lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
|
174 |
+
|
175 |
+
// get cookie val
|
176 |
+
$the_list = isset( $_COOKIE[ $this->cookie_name ] ) ? json_decode( $_COOKIE[ $this->cookie_name ] ) : array();
|
177 |
+
|
178 |
+
// switch lang for WPML
|
179 |
+
if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress ) ) {
|
180 |
+
$sitepress->switch_lang( $lang, true );
|
181 |
+
}
|
182 |
+
|
183 |
+
foreach( $the_list as $product_id ) {
|
184 |
+
if( function_exists( 'wpml_object_id_filter' ) ) {
|
185 |
+
$product_id_translated = wpml_object_id_filter( $product_id, 'product', false );
|
186 |
+
// get all product of current lang
|
187 |
+
if ( $product_id_translated !== $product_id ) {
|
188 |
+
continue;
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
// check for deleted|private products
|
193 |
+
$product = wc_get_product( $product_id );
|
194 |
+
if( ! $product || yit_get_prop( $product, 'post_status' ) !== 'publish' ) {
|
195 |
+
continue;
|
196 |
+
}
|
197 |
+
|
198 |
+
$this->products_list[] = $product_id;
|
199 |
+
}
|
200 |
+
|
201 |
+
do_action( 'yith_woocompare_after_populate_product_list', $this->products_list );
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Enqueue the scripts and styles in the page
|
206 |
+
*/
|
207 |
+
public function enqueue_scripts() {
|
208 |
+
|
209 |
+
// scripts
|
210 |
+
$min = ! ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '.min' : '';
|
211 |
+
wp_register_script( 'yith-woocompare-main', YITH_WOOCOMPARE_ASSETS_URL . '/js/woocompare' . $min .'.js', array('jquery'), $this->version, true );
|
212 |
+
|
213 |
+
// enqueue and add localize
|
214 |
+
wp_enqueue_script( 'yith-woocompare-main' );
|
215 |
+
|
216 |
+
// localize script args
|
217 |
+
$args = apply_filters( 'yith_woocompare_main_script_localize_array', array(
|
218 |
+
'ajaxurl' => version_compare( WC()->version, '2.4', '>=' ) ? WC_AJAX::get_endpoint( "%%endpoint%%" ) : admin_url( 'admin-ajax.php', 'relative' ),
|
219 |
+
'actionadd' => $this->action_add,
|
220 |
+
'actionremove' => $this->action_remove,
|
221 |
+
'actionview' => $this->action_view,
|
222 |
+
'actionreload' => $this->action_reload,
|
223 |
+
'added_label' => apply_filters( 'yith_woocompare_compare_added_label', __( 'Added', 'yith-woocommerce-compare' ) ),
|
224 |
+
'table_title' => apply_filters( 'yith_woocompare_compare_table_title',__( 'Product Comparison', 'yith-woocommerce-compare' ) ),
|
225 |
+
'auto_open' => get_option( 'yith_woocompare_auto_open', 'yes' ),
|
226 |
+
'loader' => YITH_WOOCOMPARE_ASSETS_URL . '/images/loader.gif',
|
227 |
+
'button_text' => get_option('yith_woocompare_button_text'),
|
228 |
+
'cookie_name' => $this->cookie_name,
|
229 |
+
'close_label' => _x( 'Close', 'Label for popup close icon', 'yith-woocommerce-compare' )
|
230 |
+
));
|
231 |
+
|
232 |
+
wp_localize_script( 'yith-woocompare-main', 'yith_woocompare', $args );
|
233 |
+
|
234 |
+
// colorbox
|
235 |
+
wp_enqueue_style( 'jquery-colorbox', YITH_WOOCOMPARE_ASSETS_URL . '/css/colorbox.css' );
|
236 |
+
wp_enqueue_script( 'jquery-colorbox', YITH_WOOCOMPARE_ASSETS_URL . '/js/jquery.colorbox-min.js', array('jquery'), '1.4.21', true );
|
237 |
+
|
238 |
+
// widget
|
239 |
+
if ( is_active_widget( false, false, 'yith-woocompare-widget', true ) && ! is_admin() ) {
|
240 |
+
wp_enqueue_style( 'yith-woocompare-widget', YITH_WOOCOMPARE_ASSETS_URL . '/css/widget.css' );
|
241 |
+
}
|
242 |
+
}
|
243 |
+
|
244 |
+
/**
|
245 |
+
* The fields to show in the table
|
246 |
+
*
|
247 |
+
* @param array $products
|
248 |
+
* @return mixed|void
|
249 |
+
* @since 1.0.0
|
250 |
+
*/
|
251 |
+
public function fields( $products = array() ) {
|
252 |
+
|
253 |
+
$fields = get_option( 'yith_woocompare_fields', array() );
|
254 |
+
|
255 |
+
foreach ( $fields as $field => $show ) {
|
256 |
+
if ( $show ) {
|
257 |
+
if ( isset( $this->default_fields[$field] ) ) {
|
258 |
+
$fields[$field] = $this->default_fields[$field];
|
259 |
+
}
|
260 |
+
else {
|
261 |
+
if ( taxonomy_exists( $field ) ) {
|
262 |
+
$fields[$field] = wc_attribute_label( $field );
|
263 |
+
}
|
264 |
+
}
|
265 |
+
}
|
266 |
+
else {
|
267 |
+
unset( $fields[$field] );
|
268 |
+
}
|
269 |
+
}
|
270 |
+
|
271 |
+
return apply_filters( 'yith_woocompare_filter_table_fields', $fields, $products );
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Render the maintenance page
|
276 |
+
*
|
277 |
+
*/
|
278 |
+
public function compare_table_html() {
|
279 |
+
|
280 |
+
if ( ( ! defined('DOING_AJAX') || ! DOING_AJAX ) && ( ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_view ) ) return;
|
281 |
+
|
282 |
+
// check if is add to cart
|
283 |
+
if( isset( $_REQUEST['add-to-cart'] ) ) {
|
284 |
+
$product_id = intval( $_REQUEST['add-to-cart'] );
|
285 |
+
|
286 |
+
wp_redirect( get_permalink( $product_id ) );
|
287 |
+
exit;
|
288 |
+
}
|
289 |
+
|
290 |
+
global $woocommerce, $sitepress;
|
291 |
+
|
292 |
+
/**
|
293 |
+
* WPML Suppot: Localize Ajax Call
|
294 |
+
*/
|
295 |
+
$lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
|
296 |
+
|
297 |
+
if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress ) ) {
|
298 |
+
$sitepress->switch_lang( $lang, true );
|
299 |
+
}
|
300 |
+
|
301 |
+
$args = $this->_vars();
|
302 |
+
$args['fixed'] = false;
|
303 |
+
$args['iframe'] = 'yes';
|
304 |
+
|
305 |
+
//extract args
|
306 |
+
extract( $args );
|
307 |
+
|
308 |
+
// remove all styles from compare template
|
309 |
+
add_action('wp_print_styles', array( $this, 'remove_all_styles' ), 100);
|
310 |
+
|
311 |
+
// remove admin bar
|
312 |
+
remove_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
|
313 |
+
remove_action( 'wp_head', '_admin_bar_bump_cb' );
|
314 |
+
|
315 |
+
// remove filters before render compare popup
|
316 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'actions_before_load_popup' ), 99 );
|
317 |
+
|
318 |
+
$plugin_path = YITH_WOOCOMPARE_TEMPLATE_PATH . '/' . $this->template_file;
|
319 |
+
|
320 |
+
if ( defined('WC_TEMPLATE_PATH') ) {
|
321 |
+
|
322 |
+
$template_path = get_template_directory() . '/' . WC_TEMPLATE_PATH . $this->template_file;
|
323 |
+
$child_path = get_stylesheet_directory() . '/' . WC_TEMPLATE_PATH . $this->template_file;
|
324 |
+
}
|
325 |
+
else {
|
326 |
+
$template_path = get_template_directory() . '/' . $woocommerce->template_url . $this->template_file;
|
327 |
+
$child_path = get_stylesheet_directory() . '/' . $woocommerce->template_url . $this->template_file;
|
328 |
+
}
|
329 |
+
|
330 |
+
foreach ( array( 'child_path', 'template_path', 'plugin_path' ) as $var ) {
|
331 |
+
if ( file_exists( ${$var} ) ) {
|
332 |
+
include ${$var};
|
333 |
+
exit();
|
334 |
+
}
|
335 |
+
}
|
336 |
+
}
|
337 |
+
|
338 |
+
/**
|
339 |
+
* Return the array with all products and all attributes values
|
340 |
+
*
|
341 |
+
* @param mixed $products
|
342 |
+
* @return array The complete list of products with all attributes value
|
343 |
+
*/
|
344 |
+
public function get_products_list( $products = array() ) {
|
345 |
+
$list = array();
|
346 |
+
|
347 |
+
empty( $products ) && $products = $this->products_list;
|
348 |
+
$products = apply_filters( 'yith_woocompare_exclude_products_from_list', $products );
|
349 |
+
|
350 |
+
$fields = $this->fields( $products );
|
351 |
+
|
352 |
+
foreach ( $products as $product_id ) {
|
353 |
+
|
354 |
+
/**
|
355 |
+
* @type object $product /WC_Product
|
356 |
+
*/
|
357 |
+
$product = $this->wc_get_product( $product_id );
|
358 |
+
|
359 |
+
if ( ! $product )
|
360 |
+
continue;
|
361 |
+
|
362 |
+
$product->fields = array();
|
363 |
+
|
364 |
+
// custom attributes
|
365 |
+
foreach ( $fields as $field => $name ) {
|
366 |
+
|
367 |
+
switch( $field ) {
|
368 |
+
case 'title':
|
369 |
+
$product->fields[$field] = $product->get_title();
|
370 |
+
break;
|
371 |
+
case 'price':
|
372 |
+
$product->fields[$field] = $product->get_price_html();
|
373 |
+
break;
|
374 |
+
case 'image':
|
375 |
+
$product->fields[$field] = intval( get_post_thumbnail_id( $product_id ) );
|
376 |
+
break;
|
377 |
+
case 'description':
|
378 |
+
$description = apply_filters( 'woocommerce_short_description', yit_get_prop( $product, 'post_excerpt' ) );
|
379 |
+
$product->fields[$field] = apply_filters( 'yith_woocompare_products_description', $description );
|
380 |
+
break;
|
381 |
+
case 'stock':
|
382 |
+
$availability = $product->get_availability();
|
383 |
+
if ( empty( $availability['availability'] ) ) {
|
384 |
+
$availability['availability'] = __( 'In stock', 'yith-woocommerce-compare' );
|
385 |
+
}
|
386 |
+
$product->fields[$field] = sprintf( '<span>%s</span>', esc_html( $availability['availability'] ) );
|
387 |
+
break;
|
388 |
+
case 'sku':
|
389 |
+
$sku = $product->get_sku();
|
390 |
+
! $sku && $sku = '-';
|
391 |
+
$product->fields[$field] = $sku;
|
392 |
+
break;
|
393 |
+
case 'weight':
|
394 |
+
if( $weight = $product->get_weight() ){
|
395 |
+
$weight = wc_format_localized_decimal( $weight ) . ' ' . esc_attr( get_option( 'woocommerce_weight_unit' ) );
|
396 |
+
}
|
397 |
+
else {
|
398 |
+
$weight = '-';
|
399 |
+
}
|
400 |
+
$product->fields[$field] = sprintf( '<span>%s</span>', esc_html( $weight ) );
|
401 |
+
break;
|
402 |
+
case 'dimensions':
|
403 |
+
$dimensions = function_exists( 'wc_format_dimensions' ) ? wc_format_dimensions( $product->get_dimensions(false) ) : $product->get_dimensions();
|
404 |
+
! $dimensions && $dimensions = '-';
|
405 |
+
|
406 |
+
$product->fields[$field] = sprintf( '<span>%s</span>', esc_html( $dimensions ) );
|
407 |
+
break;
|
408 |
+
default:
|
409 |
+
if ( taxonomy_exists( $field ) ) {
|
410 |
+
$product->fields[$field] = array();
|
411 |
+
$terms = get_the_terms( $product_id, $field );
|
412 |
+
if ( ! empty( $terms ) ) {
|
413 |
+
foreach ( $terms as $term ) {
|
414 |
+
$term = sanitize_term( $term, $field );
|
415 |
+
$product->fields[$field][] = $term->name;
|
416 |
+
}
|
417 |
+
}
|
418 |
+
$product->fields[$field] = implode( ', ', $product->fields[$field] );
|
419 |
+
}
|
420 |
+
else {
|
421 |
+
do_action_ref_array( 'yith_woocompare_field_' . $field, array( $product, &$product->fields ) );
|
422 |
+
}
|
423 |
+
break;
|
424 |
+
}
|
425 |
+
}
|
426 |
+
|
427 |
+
$list[ $product_id ] = $product;
|
428 |
+
}
|
429 |
+
|
430 |
+
return $list;
|
431 |
+
}
|
432 |
+
|
433 |
+
/**
|
434 |
+
* The URL of product comparison table
|
435 |
+
*
|
436 |
+
* @param bool | int $product_id
|
437 |
+
* @return string The url to add the product in the comparison table
|
438 |
+
*/
|
439 |
+
public function view_table_url( $product_id = false ) {
|
440 |
+
$url_args = array(
|
441 |
+
'action' => $this->action_view,
|
442 |
+
'iframe' => 'yes'
|
443 |
+
);
|
444 |
+
|
445 |
+
$lang = defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : false;
|
446 |
+
if( $lang ) {
|
447 |
+
$url_args['lang'] = $lang;
|
448 |
+
}
|
449 |
+
// fix by WPML
|
450 |
+
return apply_filters( 'yith_woocompare_view_table_url', esc_url_raw( add_query_arg( $url_args, remove_query_arg( 'wc-ajax' ) ) ), $product_id );
|
451 |
+
}
|
452 |
+
|
453 |
+
/**
|
454 |
+
* The URL to add the product into the comparison table
|
455 |
+
*
|
456 |
+
* @param int $product_id ID of the product to add
|
457 |
+
* @return string The url to add the product in the comparison table
|
458 |
+
*/
|
459 |
+
public function add_product_url( $product_id ) {
|
460 |
+
$url_args = array(
|
461 |
+
'action' => $this->action_add,
|
462 |
+
'id' => $product_id
|
463 |
+
);
|
464 |
+
|
465 |
+
$lang = defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : false;
|
466 |
+
if( $lang ) {
|
467 |
+
$url_args['lang'] = $lang;
|
468 |
+
}
|
469 |
+
|
470 |
+
return apply_filters( 'yith_woocompare_add_product_url', esc_url_raw( add_query_arg( $url_args, site_url() ) ), $this->action_add );
|
471 |
+
}
|
472 |
+
|
473 |
+
/**
|
474 |
+
* The URL to remove the product into the comparison table
|
475 |
+
*
|
476 |
+
* @param string $product_id The ID of the product to remove
|
477 |
+
* @return string The url to remove the product in the comparison table
|
478 |
+
*/
|
479 |
+
public function remove_product_url( $product_id ) {
|
480 |
+
$url_args = array(
|
481 |
+
'action' => $this->action_remove,
|
482 |
+
'id' => $product_id
|
483 |
+
);
|
484 |
+
return apply_filters( 'yith_woocompare_remove_product_url', esc_url_raw( add_query_arg( $url_args, site_url() ) ), $this->action_remove );
|
485 |
+
}
|
486 |
+
|
487 |
+
/**
|
488 |
+
* Add the link to compare
|
489 |
+
*/
|
490 |
+
public function add_compare_link( $product_id = false, $args = array() ) {
|
491 |
+
extract( $args );
|
492 |
+
|
493 |
+
if ( ! $product_id ) {
|
494 |
+
global $product;
|
495 |
+
$product_id = ! is_null( $product ) ? yit_get_prop( $product, 'id', true ) : 0;
|
496 |
+
}
|
497 |
+
|
498 |
+
// return if product doesn't exist
|
499 |
+
if ( empty( $product_id ) || apply_filters( 'yith_woocompare_remove_compare_link_by_cat', false, $product_id ) )
|
500 |
+
return;
|
501 |
+
|
502 |
+
$is_button = ! isset( $button_or_link ) || ! $button_or_link ? get_option( 'yith_woocompare_is_button' ) : $button_or_link;
|
503 |
+
|
504 |
+
if ( ! isset( $button_text ) || $button_text == 'default' ) {
|
505 |
+
$button_text = get_option( 'yith_woocompare_button_text', __( 'Compare', 'yith-woocommerce-compare' ) );
|
506 |
+
do_action ( 'wpml_register_single_string', 'Plugins', 'plugin_yit_compare_button_text', $button_text );
|
507 |
+
$button_text = apply_filters( 'wpml_translate_single_string', $button_text, 'Plugins', 'plugin_yit_compare_button_text' );
|
508 |
+
}
|
509 |
+
|
510 |
+
printf( '<a href="%s" class="%s" data-product_id="%d" rel="nofollow">%s</a>', $this->add_product_url( $product_id ), 'compare' . ( $is_button == 'button' ? ' button' : '' ), $product_id, $button_text );
|
511 |
+
}
|
512 |
+
|
513 |
+
/**
|
514 |
+
* Return the url of stylesheet position
|
515 |
+
*/
|
516 |
+
public function stylesheet_url() {
|
517 |
+
global $woocommerce;
|
518 |
+
|
519 |
+
$filename = $this->stylesheet_file;
|
520 |
+
|
521 |
+
$plugin_path = array( 'path' => YITH_WOOCOMPARE_DIR . '/assets/css/style.css', 'url' => YITH_WOOCOMPARE_ASSETS_URL . '/css/style.css' );
|
522 |
+
|
523 |
+
if ( defined('WC_TEMPLATE_PATH') ) {
|
524 |
+
$template_path = array( 'path' => get_template_directory() . '/' . WC_TEMPLATE_PATH . $filename, 'url' => get_template_directory_uri() . '/' . WC_TEMPLATE_PATH . $filename );
|
525 |
+
$child_path = array( 'path' => get_stylesheet_directory() . '/' . WC_TEMPLATE_PATH . $filename, 'url' => get_stylesheet_directory_uri() . '/' . WC_TEMPLATE_PATH . $filename );
|
526 |
+
}
|
527 |
+
else {
|
528 |
+
$template_path = array( 'path' => get_template_directory() . '/' . $woocommerce->template_url . $filename, 'url' => get_template_directory_uri() . '/' . $woocommerce->template_url . $filename );
|
529 |
+
$child_path = array( 'path' => get_stylesheet_directory() . '/' . $woocommerce->template_url . $filename, 'url' => get_stylesheet_directory_uri() . '/' . $woocommerce->template_url . $filename );
|
530 |
+
}
|
531 |
+
|
532 |
+
foreach ( array( 'child_path', 'template_path', 'plugin_path' ) as $var ) {
|
533 |
+
if ( file_exists( ${$var}['path'] ) ) {
|
534 |
+
return ${$var}['url'];
|
535 |
+
}
|
536 |
+
}
|
537 |
+
}
|
538 |
+
|
539 |
+
|
540 |
+
/**
|
541 |
+
* Generate template vars
|
542 |
+
*
|
543 |
+
* @return array
|
544 |
+
* @since 1.0.0
|
545 |
+
* @access protected
|
546 |
+
*/
|
547 |
+
protected function _vars() {
|
548 |
+
$vars = array(
|
549 |
+
'products' => $this->get_products_list(),
|
550 |
+
'fields' => $this->fields(),
|
551 |
+
'repeat_price' => get_option( 'yith_woocompare_price_end' ),
|
552 |
+
'repeat_add_to_cart' => get_option( 'yith_woocompare_add_to_cart_end' ),
|
553 |
+
);
|
554 |
+
|
555 |
+
return $vars;
|
556 |
+
}
|
557 |
+
|
558 |
+
/**
|
559 |
+
* The action called by the query string
|
560 |
+
*/
|
561 |
+
public function add_product_to_compare_action() {
|
562 |
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX || ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_add ) {
|
563 |
+
return;
|
564 |
+
}
|
565 |
+
|
566 |
+
$product_id = intval( $_REQUEST['id'] );
|
567 |
+
$product = $this->wc_get_product( $product_id );
|
568 |
+
|
569 |
+
// don't add the product if doesn't exist
|
570 |
+
if ( isset( $product->id ) && ! in_array( $product_id, $this->products_list ) ) {
|
571 |
+
$this->add_product_to_compare( $product_id );
|
572 |
+
}
|
573 |
+
|
574 |
+
wp_redirect( esc_url( remove_query_arg( array( 'id', 'action' ) ) ) );
|
575 |
+
exit();
|
576 |
+
}
|
577 |
+
|
578 |
+
/**
|
579 |
+
* The action called by AJAX
|
580 |
+
*/
|
581 |
+
public function add_product_to_compare_ajax() {
|
582 |
+
|
583 |
+
if( ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_add ){
|
584 |
+
die();
|
585 |
+
}
|
586 |
+
|
587 |
+
$product_id = intval( $_REQUEST['id'] );
|
588 |
+
$product = $this->wc_get_product( $product_id );
|
589 |
+
|
590 |
+
// don't add the product if doesn't exist
|
591 |
+
if ( isset( $product->id ) && ! in_array( $product_id, $this->products_list ) ) {
|
592 |
+
$this->add_product_to_compare( $product_id );
|
593 |
+
}
|
594 |
+
|
595 |
+
do_action( 'yith_woocompare_add_product_action_ajax' );
|
596 |
+
|
597 |
+
$json = apply_filters( 'yith_woocompare_add_product_action_json', array(
|
598 |
+
'table_url' => $this->view_table_url( $product_id ),
|
599 |
+
'widget_table' => $this->list_products_html(),
|
600 |
+
) );
|
601 |
+
|
602 |
+
echo json_encode( $json );
|
603 |
+
die();
|
604 |
+
}
|
605 |
+
|
606 |
+
/**
|
607 |
+
* Add a product in the products comparison table
|
608 |
+
*
|
609 |
+
* @param int $product_id product ID to add in the comparison table
|
610 |
+
*/
|
611 |
+
public function add_product_to_compare( $product_id ) {
|
612 |
+
|
613 |
+
$this->products_list[] = $product_id;
|
614 |
+
setcookie( $this->cookie_name, json_encode( $this->products_list ), 0, COOKIEPATH, COOKIE_DOMAIN, false, false );
|
615 |
+
|
616 |
+
do_action( 'yith_woocompare_after_add_product', $product_id );
|
617 |
+
}
|
618 |
+
|
619 |
+
/**
|
620 |
+
* The action called by the query string
|
621 |
+
*/
|
622 |
+
public function remove_product_from_compare_action() {
|
623 |
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX || ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_remove ) {
|
624 |
+
return;
|
625 |
+
}
|
626 |
+
|
627 |
+
$this->remove_product_from_compare( $_REQUEST['id'] );
|
628 |
+
|
629 |
+
// redirect
|
630 |
+
$redirect = esc_url( remove_query_arg( array( 'id', 'action' ) ) );
|
631 |
+
|
632 |
+
if ( isset( $_REQUEST['redirect'] ) && $_REQUEST['redirect'] == 'view' )
|
633 |
+
$redirect = esc_url( remove_query_arg( 'redirect', add_query_arg( 'action', $this->action_view, $redirect ) ) );
|
634 |
+
|
635 |
+
wp_redirect( $redirect );
|
636 |
+
exit();
|
637 |
+
}
|
638 |
+
|
639 |
+
/**
|
640 |
+
* The action called by AJAX
|
641 |
+
*/
|
642 |
+
public function remove_product_from_compare_ajax() {
|
643 |
+
|
644 |
+
if ( ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_remove ){
|
645 |
+
die();
|
646 |
+
}
|
647 |
+
|
648 |
+
$lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
|
649 |
+
|
650 |
+
$this->remove_product_from_compare( $_REQUEST['id'] );
|
651 |
+
|
652 |
+
do_action( 'yith_woocompare_remove_product_action_ajax' );
|
653 |
+
|
654 |
+
header('Content-Type: text/html; charset=utf-8');
|
655 |
+
|
656 |
+
if ( isset( $_REQUEST['responseType'] ) && $_REQUEST['responseType'] == 'product_list' ) {
|
657 |
+
echo $this->list_products_html( $lang );
|
658 |
+
} else {
|
659 |
+
$this->compare_table_html();
|
660 |
+
}
|
661 |
+
|
662 |
+
die();
|
663 |
+
}
|
664 |
+
|
665 |
+
/**
|
666 |
+
* Return the list of widget table, used in AJAX
|
667 |
+
*/
|
668 |
+
public function reload_widget_list_ajax() {
|
669 |
+
|
670 |
+
if ( ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_reload ){
|
671 |
+
die();
|
672 |
+
}
|
673 |
+
|
674 |
+
$lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
|
675 |
+
|
676 |
+
echo $this->list_products_html( $lang );
|
677 |
+
die();
|
678 |
+
}
|
679 |
+
|
680 |
+
/**
|
681 |
+
* The list of products as HTML list
|
682 |
+
*/
|
683 |
+
public function list_products_html( $lang = false ) {
|
684 |
+
ob_start();
|
685 |
+
|
686 |
+
/**
|
687 |
+
* WPML Suppot: Localize Ajax Call
|
688 |
+
*/
|
689 |
+
global $sitepress;
|
690 |
+
|
691 |
+
if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress )) {
|
692 |
+
$sitepress->switch_lang( $lang, true );
|
693 |
+
}
|
694 |
+
|
695 |
+
if ( empty( $this->products_list ) ) {
|
696 |
+
echo '<li class="list_empty">' . __( 'No products to compare', 'yith-woocommerce-compare' ) . '</li>';
|
697 |
+
return ob_get_clean();
|
698 |
+
}
|
699 |
+
|
700 |
+
foreach ( $this->products_list as $product_id ) {
|
701 |
+
/**
|
702 |
+
* @type object $product /WC_Product
|
703 |
+
*/
|
704 |
+
$product = $this->wc_get_product( $product_id );
|
705 |
+
if ( ! $product )
|
706 |
+
continue;
|
707 |
+
?>
|
708 |
+
<li>
|
709 |
+
<a href="<?php echo $this->remove_product_url( $product_id ) ?>" data-product_id="<?php echo $product_id; ?>" class="remove" title="<?php _e( 'Remove', 'yith-woocommerce-compare' ) ?>">x</a>
|
710 |
+
<a class="title" href="<?php echo get_permalink( $product_id ) ?>"><?php echo $product->get_title() ?></a>
|
711 |
+
</li>
|
712 |
+
<?php
|
713 |
+
}
|
714 |
+
|
715 |
+
$return = ob_get_clean();
|
716 |
+
|
717 |
+
return apply_filters( 'yith_woocompare_widget_products_html', $return, $this->products_list, $this );
|
718 |
+
}
|
719 |
+
|
720 |
+
/**
|
721 |
+
* Remove a product from the comparison table
|
722 |
+
*
|
723 |
+
* @param $product_id The product ID to remove from the comparison table
|
724 |
+
*/
|
725 |
+
public function remove_product_from_compare( $product_id ) {
|
726 |
+
|
727 |
+
if( $product_id == 'all' ) {
|
728 |
+
$this->products_list = array();
|
729 |
+
}
|
730 |
+
else {
|
731 |
+
foreach ( $this->products_list as $k => $id ) {
|
732 |
+
if ( intval( $product_id ) == $id ) {
|
733 |
+
unset( $this->products_list[ $k ] );
|
734 |
+
}
|
735 |
+
}
|
736 |
+
}
|
737 |
+
|
738 |
+
setcookie( $this->cookie_name, json_encode( array_values( $this->products_list ) ), 0, COOKIEPATH, COOKIE_DOMAIN, false, false );
|
739 |
+
|
740 |
+
do_action( 'yith_woocompare_after_remove_product', $product_id );
|
741 |
+
}
|
742 |
+
|
743 |
+
/**
|
744 |
+
* Remove all styles from the compare template
|
745 |
+
*/
|
746 |
+
public function remove_all_styles() {
|
747 |
+
global $wp_styles;
|
748 |
+
$wp_styles->queue = array();
|
749 |
+
}
|
750 |
+
|
751 |
+
/**
|
752 |
+
* Show the html for the shortcode
|
753 |
+
*/
|
754 |
+
public function compare_button_sc( $atts, $content = null ) {
|
755 |
+
$atts = shortcode_atts(array(
|
756 |
+
'product' => false,
|
757 |
+
'type' => 'default',
|
758 |
+
'container' => 'yes'
|
759 |
+
), $atts);
|
760 |
+
|
761 |
+
$product_id = 0;
|
762 |
+
|
763 |
+
/**
|
764 |
+
* Retrieve the product ID in these steps:
|
765 |
+
* - If "product" attribute is not set, get the product ID of current product loop
|
766 |
+
* - If "product" contains ID, post slug or post title
|
767 |
+
*/
|
768 |
+
if ( ! $atts['product'] ) {
|
769 |
+
global $product;
|
770 |
+
$product_id = ! is_null( $product ) ? yit_get_prop( $product, 'id', true ) : 0;
|
771 |
+
} else {
|
772 |
+
global $wpdb;
|
773 |
+
$product = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE ID = %d OR post_name = %s OR post_title = %s LIMIT 1", $atts['product'], $atts['product'], $atts['product'] ) );
|
774 |
+
if ( ! empty( $product ) ) {
|
775 |
+
$product_id = $product->ID;
|
776 |
+
}
|
777 |
+
}
|
778 |
+
|
779 |
+
// make sure to get always the product id of current language
|
780 |
+
if( function_exists( 'wpml_object_id_filter' ) ) {
|
781 |
+
$product_id = wpml_object_id_filter( $product_id, 'product', false );
|
782 |
+
}
|
783 |
+
|
784 |
+
// if product ID is 0, maybe the product doesn't exists or is wrong.. in this case, doesn't show the button
|
785 |
+
if ( empty( $product_id ) )
|
786 |
+
return '';
|
787 |
+
|
788 |
+
ob_start();
|
789 |
+
if ( $atts['container'] == 'yes' ) echo '<div class="woocommerce product compare-button">';
|
790 |
+
$this->add_compare_link( $product_id, array(
|
791 |
+
'button_or_link' => ( $atts['type'] == 'default' ? false : $atts['type'] ),
|
792 |
+
'button_text' => empty( $content ) ? 'default' : $content
|
793 |
+
) );
|
794 |
+
if ( $atts['container'] == 'yes' ) echo '</div>';
|
795 |
+
return ob_get_clean();
|
796 |
+
}
|
797 |
+
|
798 |
+
public function wc_get_product( $product_id ){
|
799 |
+
$wc_get_product = function_exists( 'wc_get_product' ) ? 'wc_get_product' : 'get_product';
|
800 |
+
return $wc_get_product( $product_id );
|
801 |
+
}
|
802 |
+
|
803 |
+
|
804 |
+
/**
|
805 |
+
* Do action before loads compare popup
|
806 |
+
*
|
807 |
+
* @since 2.1.1
|
808 |
+
* @author Francesco Licandro
|
809 |
+
*/
|
810 |
+
public function actions_before_load_popup(){
|
811 |
+
// removes WooCommerce Product Filter scripts
|
812 |
+
wp_dequeue_script( 'prdctfltr-main-js' );
|
813 |
+
wp_dequeue_script( 'prdctfltr-history' );
|
814 |
+
wp_dequeue_script( 'prdctfltr-ionrange-js' );
|
815 |
+
wp_dequeue_script( 'prdctfltr-isotope-js' );
|
816 |
+
wp_dequeue_script( 'prdctfltr-scrollbar-js' );
|
817 |
+
}
|
818 |
+
}
|
819 |
}
|
includes/class.yith-woocompare-helper.php
CHANGED
@@ -1,105 +1,105 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Main class
|
4 |
-
*
|
5 |
-
* @author YITH
|
6 |
-
* @package YITH WooCommerce Compare
|
7 |
-
* @version 1.1.4
|
8 |
-
*/
|
9 |
-
|
10 |
-
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|
11 |
-
|
12 |
-
if( !class_exists( 'YITH_Woocompare_Helper' ) ) {
|
13 |
-
/**
|
14 |
-
* YITH Woocommerce Compare helper
|
15 |
-
*
|
16 |
-
* @since 1.0.0
|
17 |
-
*/
|
18 |
-
class YITH_Woocompare_Helper {
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Set the image size used in the comparison table
|
22 |
-
*
|
23 |
-
* @since 1.0.0
|
24 |
-
*/
|
25 |
-
public static function set_image_size() {
|
26 |
-
$size = get_option( 'yith_woocompare_image_size' );
|
27 |
-
|
28 |
-
if( ! $size ) {
|
29 |
-
return;
|
30 |
-
}
|
31 |
-
|
32 |
-
$size['crop'] = isset( $size['crop'] ) ? true : false;
|
33 |
-
add_image_size( 'yith-woocompare-image', $size['width'], $size['height'], $size['crop'] );
|
34 |
-
}
|
35 |
-
|
36 |
-
/*
|
37 |
-
* The list of standard fields
|
38 |
-
*
|
39 |
-
* @since 1.0.0
|
40 |
-
* @access public
|
41 |
-
* @param Boolean $with_attr
|
42 |
-
*/
|
43 |
-
public static function standard_fields( $with_attr = true ) {
|
44 |
-
|
45 |
-
$fields = array(
|
46 |
-
'image' => __( 'Image', 'yith-woocommerce-compare' ),
|
47 |
-
'title' => __( 'Title', 'yith-woocommerce-compare' ),
|
48 |
-
'price' => __( 'Price', 'yith-woocommerce-compare' ),
|
49 |
-
'add-to-cart' => __( 'Add to cart', 'yith-woocommerce-compare' ),
|
50 |
-
'description' => __( 'Description', 'yith-woocommerce-compare' ),
|
51 |
-
'sku' => __( 'Sku', 'yith-woocommerce-compare' ),
|
52 |
-
'stock' => __( 'Availability', 'yith-woocommerce-compare' ),
|
53 |
-
'weight' => __( 'Weight', 'yith-woocommerce-compare' ),
|
54 |
-
'dimensions' => __( 'Dimensions', 'yith-woocommerce-compare' )
|
55 |
-
);
|
56 |
-
|
57 |
-
if( $with_attr )
|
58 |
-
$fields = array_merge( $fields, YITH_Woocompare_Helper::attribute_taxonomies() );
|
59 |
-
|
60 |
-
return apply_filters( 'yith_woocompare_standard_fields_array', $fields );
|
61 |
-
}
|
62 |
-
|
63 |
-
/*
|
64 |
-
* Get Woocommerce Attribute Taxonomies
|
65 |
-
*
|
66 |
-
* @since 1.0.0
|
67 |
-
* @access public
|
68 |
-
*/
|
69 |
-
public static function attribute_taxonomies() {
|
70 |
-
global $woocommerce;
|
71 |
-
|
72 |
-
if ( ! isset( $woocommerce ) ) return array();
|
73 |
-
|
74 |
-
$attributes = array();
|
75 |
-
|
76 |
-
if( function_exists( 'wc_get_attribute_taxonomies' ) && function_exists( 'wc_attribute_taxonomy_name' ) ) {
|
77 |
-
$attribute_taxonomies = wc_get_attribute_taxonomies();
|
78 |
-
if( empty( $attribute_taxonomies ) )
|
79 |
-
return array();
|
80 |
-
foreach( $attribute_taxonomies as $attribute ) {
|
81 |
-
$tax = wc_attribute_taxonomy_name( $attribute->attribute_name );
|
82 |
-
if ( taxonomy_exists( $tax ) ) {
|
83 |
-
$attributes[$tax] = ucfirst( $attribute->attribute_name );
|
84 |
-
}
|
85 |
-
}
|
86 |
-
}
|
87 |
-
else{
|
88 |
-
$attribute_taxonomies = $woocommerce->get_attribute_taxonomies();
|
89 |
-
if( empty( $attribute_taxonomies ) )
|
90 |
-
return array();
|
91 |
-
foreach( $attribute_taxonomies as $attribute ) {
|
92 |
-
$tax = $woocommerce->attribute_taxonomy_name( $attribute->attribute_name );
|
93 |
-
if ( taxonomy_exists( $tax ) ) {
|
94 |
-
$attributes[$tax] = ucfirst( $attribute->attribute_name );
|
95 |
-
}
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
|
100 |
-
return $attributes;
|
101 |
-
}
|
102 |
-
|
103 |
-
|
104 |
-
}
|
105 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Main class
|
4 |
+
*
|
5 |
+
* @author YITH
|
6 |
+
* @package YITH WooCommerce Compare
|
7 |
+
* @version 1.1.4
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|
11 |
+
|
12 |
+
if( !class_exists( 'YITH_Woocompare_Helper' ) ) {
|
13 |
+
/**
|
14 |
+
* YITH Woocommerce Compare helper
|
15 |
+
*
|
16 |
+
* @since 1.0.0
|
17 |
+
*/
|
18 |
+
class YITH_Woocompare_Helper {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Set the image size used in the comparison table
|
22 |
+
*
|
23 |
+
* @since 1.0.0
|
24 |
+
*/
|
25 |
+
public static function set_image_size() {
|
26 |
+
$size = get_option( 'yith_woocompare_image_size' );
|
27 |
+
|
28 |
+
if( ! $size ) {
|
29 |
+
return;
|
30 |
+
}
|
31 |
+
|
32 |
+
$size['crop'] = isset( $size['crop'] ) ? true : false;
|
33 |
+
add_image_size( 'yith-woocompare-image', $size['width'], $size['height'], $size['crop'] );
|
34 |
+
}
|
35 |
+
|
36 |
+
/*
|
37 |
+
* The list of standard fields
|
38 |
+
*
|
39 |
+
* @since 1.0.0
|
40 |
+
* @access public
|
41 |
+
* @param Boolean $with_attr
|
42 |
+
*/
|
43 |
+
public static function standard_fields( $with_attr = true ) {
|
44 |
+
|
45 |
+
$fields = array(
|
46 |
+
'image' => __( 'Image', 'yith-woocommerce-compare' ),
|
47 |
+
'title' => __( 'Title', 'yith-woocommerce-compare' ),
|
48 |
+
'price' => __( 'Price', 'yith-woocommerce-compare' ),
|
49 |
+
'add-to-cart' => __( 'Add to cart', 'yith-woocommerce-compare' ),
|
50 |
+
'description' => __( 'Description', 'yith-woocommerce-compare' ),
|
51 |
+
'sku' => __( 'Sku', 'yith-woocommerce-compare' ),
|
52 |
+
'stock' => __( 'Availability', 'yith-woocommerce-compare' ),
|
53 |
+
'weight' => __( 'Weight', 'yith-woocommerce-compare' ),
|
54 |
+
'dimensions' => __( 'Dimensions', 'yith-woocommerce-compare' )
|
55 |
+
);
|
56 |
+
|
57 |
+
if( $with_attr )
|
58 |
+
$fields = array_merge( $fields, YITH_Woocompare_Helper::attribute_taxonomies() );
|
59 |
+
|
60 |
+
return apply_filters( 'yith_woocompare_standard_fields_array', $fields );
|
61 |
+
}
|
62 |
+
|
63 |
+
/*
|
64 |
+
* Get Woocommerce Attribute Taxonomies
|
65 |
+
*
|
66 |
+
* @since 1.0.0
|
67 |
+
* @access public
|
68 |
+
*/
|
69 |
+
public static function attribute_taxonomies() {
|
70 |
+
global $woocommerce;
|
71 |
+
|
72 |
+
if ( ! isset( $woocommerce ) ) return array();
|
73 |
+
|
74 |
+
$attributes = array();
|
75 |
+
|
76 |
+
if( function_exists( 'wc_get_attribute_taxonomies' ) && function_exists( 'wc_attribute_taxonomy_name' ) ) {
|
77 |
+
$attribute_taxonomies = wc_get_attribute_taxonomies();
|
78 |
+
if( empty( $attribute_taxonomies ) )
|
79 |
+
return array();
|
80 |
+
foreach( $attribute_taxonomies as $attribute ) {
|
81 |
+
$tax = wc_attribute_taxonomy_name( $attribute->attribute_name );
|
82 |
+
if ( taxonomy_exists( $tax ) ) {
|
83 |
+
$attributes[$tax] = ucfirst( $attribute->attribute_name );
|
84 |
+
}
|
85 |
+
}
|
86 |
+
}
|
87 |
+
else{
|
88 |
+
$attribute_taxonomies = $woocommerce->get_attribute_taxonomies();
|
89 |
+
if( empty( $attribute_taxonomies ) )
|
90 |
+
return array();
|
91 |
+
foreach( $attribute_taxonomies as $attribute ) {
|
92 |
+
$tax = $woocommerce->attribute_taxonomy_name( $attribute->attribute_name );
|
93 |
+
if ( taxonomy_exists( $tax ) ) {
|
94 |
+
$attributes[$tax] = ucfirst( $attribute->attribute_name );
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
|
100 |
+
return $attributes;
|
101 |
+
}
|
102 |
+
|
103 |
+
|
104 |
+
}
|
105 |
}
|
includes/class.yith-woocompare.php
CHANGED
@@ -1,123 +1,145 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Main class
|
4 |
-
*
|
5 |
-
* @author YITH
|
6 |
-
* @package YITH Woocommerce Compare
|
7 |
-
* @version 1.1.4
|
8 |
-
*/
|
9 |
-
|
10 |
-
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|
11 |
-
|
12 |
-
if( !class_exists( 'YITH_Woocompare' ) ) {
|
13 |
-
/**
|
14 |
-
* YITH Woocommerce Compare
|
15 |
-
*
|
16 |
-
* @since 1.0.0
|
17 |
-
*/
|
18 |
-
class YITH_Woocompare {
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Plugin object
|
22 |
-
*
|
23 |
-
* @var string
|
24 |
-
* @since 1.0.0
|
25 |
-
*/
|
26 |
-
public $obj = null;
|
27 |
-
|
28 |
-
/**
|
29 |
-
* AJAX Helper
|
30 |
-
*
|
31 |
-
* @var string
|
32 |
-
* @since 1.0.0
|
33 |
-
*/
|
34 |
-
public $ajax = null;
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Constructor
|
38 |
-
*
|
39 |
-
* @return mixed|YITH_Woocompare_Admin|YITH_Woocompare_Frontend
|
40 |
-
* @since 1.0.0
|
41 |
-
*/
|
42 |
-
public function __construct() {
|
43 |
-
|
44 |
-
add_action( 'widgets_init', array( $this, 'registerWidgets' ) );
|
45 |
-
|
46 |
-
// Load Plugin Framework
|
47 |
-
add_action( 'after_setup_theme', array( $this, 'plugin_fw_loader' ), 1 );
|
48 |
-
|
49 |
-
if( $this->is_frontend() ) {
|
50 |
-
|
51 |
-
// require frontend class
|
52 |
-
require_once('class.yith-woocompare-frontend.php');
|
53 |
-
|
54 |
-
$this->obj = new YITH_Woocompare_Frontend();
|
55 |
-
}
|
56 |
-
elseif( $this->is_admin() ) {
|
57 |
-
|
58 |
-
// requires admin classes
|
59 |
-
require_once('class.yith-woocompare-admin.php');
|
60 |
-
|
61 |
-
$this->obj = new YITH_Woocompare_Admin();
|
62 |
-
}
|
63 |
-
|
64 |
-
// add image size
|
65 |
-
YITH_Woocompare_Helper::set_image_size();
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
*
|
98 |
-
*
|
99 |
-
* @
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
*
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Main class
|
4 |
+
*
|
5 |
+
* @author YITH
|
6 |
+
* @package YITH Woocommerce Compare
|
7 |
+
* @version 1.1.4
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|
11 |
+
|
12 |
+
if( !class_exists( 'YITH_Woocompare' ) ) {
|
13 |
+
/**
|
14 |
+
* YITH Woocommerce Compare
|
15 |
+
*
|
16 |
+
* @since 1.0.0
|
17 |
+
*/
|
18 |
+
class YITH_Woocompare {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Plugin object
|
22 |
+
*
|
23 |
+
* @var string
|
24 |
+
* @since 1.0.0
|
25 |
+
*/
|
26 |
+
public $obj = null;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* AJAX Helper
|
30 |
+
*
|
31 |
+
* @var string
|
32 |
+
* @since 1.0.0
|
33 |
+
*/
|
34 |
+
public $ajax = null;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Constructor
|
38 |
+
*
|
39 |
+
* @return mixed|YITH_Woocompare_Admin|YITH_Woocompare_Frontend
|
40 |
+
* @since 1.0.0
|
41 |
+
*/
|
42 |
+
public function __construct() {
|
43 |
+
|
44 |
+
add_action( 'widgets_init', array( $this, 'registerWidgets' ) );
|
45 |
+
|
46 |
+
// Load Plugin Framework
|
47 |
+
add_action( 'after_setup_theme', array( $this, 'plugin_fw_loader' ), 1 );
|
48 |
+
|
49 |
+
if( $this->is_frontend() ) {
|
50 |
+
|
51 |
+
// require frontend class
|
52 |
+
require_once('class.yith-woocompare-frontend.php');
|
53 |
+
|
54 |
+
$this->obj = new YITH_Woocompare_Frontend();
|
55 |
+
}
|
56 |
+
elseif( $this->is_admin() ) {
|
57 |
+
|
58 |
+
// requires admin classes
|
59 |
+
require_once('class.yith-woocompare-admin.php');
|
60 |
+
|
61 |
+
$this->obj = new YITH_Woocompare_Admin();
|
62 |
+
}
|
63 |
+
|
64 |
+
// add image size
|
65 |
+
YITH_Woocompare_Helper::set_image_size();
|
66 |
+
|
67 |
+
// let's filter the woocommerce image size
|
68 |
+
add_filter( 'woocommerce_get_image_size_yith-woocompare-image', array( $this, 'filter_wc_image_size' ), 10, 1 );
|
69 |
+
|
70 |
+
return $this->obj;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Detect if is frontend
|
75 |
+
* @return bool
|
76 |
+
*/
|
77 |
+
public function is_frontend() {
|
78 |
+
$is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
|
79 |
+
$context_check = isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'frontend';
|
80 |
+
$actions_to_check = apply_filters( 'yith_woocompare_actions_to_check_frontend', array( 'woof_draw_products' ) );
|
81 |
+
$action_check = isset( $_REQUEST['action'] ) && in_array( $_REQUEST['action'], $actions_to_check );
|
82 |
+
|
83 |
+
return (bool) ( ! is_admin() || ( $is_ajax && ( $context_check || $action_check ) ) );
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Detect if is admin
|
88 |
+
* @return bool
|
89 |
+
*/
|
90 |
+
public function is_admin() {
|
91 |
+
$is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
|
92 |
+
$is_admin = ( is_admin() || $is_ajax && isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'admin' );
|
93 |
+
return apply_filters( 'yith_woocompare_check_is_admin', (bool) $is_admin );
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Load Plugin Framework
|
98 |
+
*
|
99 |
+
* @since 1.0
|
100 |
+
* @access public
|
101 |
+
* @return void
|
102 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
103 |
+
*/
|
104 |
+
public function plugin_fw_loader() {
|
105 |
+
|
106 |
+
if ( ! defined( 'YIT_CORE_PLUGIN' ) ) {
|
107 |
+
global $plugin_fw_data;
|
108 |
+
if( ! empty( $plugin_fw_data ) ){
|
109 |
+
$plugin_fw_file = array_shift( $plugin_fw_data );
|
110 |
+
require_once( $plugin_fw_file );
|
111 |
+
}
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Load and register widgets
|
117 |
+
*
|
118 |
+
* @access public
|
119 |
+
* @since 1.0.0
|
120 |
+
*/
|
121 |
+
public function registerWidgets() {
|
122 |
+
register_widget( 'YITH_Woocompare_Widget' );
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Filter WooCommerce image size attr
|
127 |
+
*
|
128 |
+
* @since 2.3.5
|
129 |
+
* @author Francesco Licandro
|
130 |
+
* @param array $size
|
131 |
+
* @return array
|
132 |
+
*/
|
133 |
+
public function filter_wc_image_size( $size ) {
|
134 |
+
|
135 |
+
$size_opt = get_option( 'yith_woocompare_image_size' );
|
136 |
+
|
137 |
+
return array(
|
138 |
+
'width' => isset( $size_opt['width'] ) ? absint( $size_opt['width'] ) : 600,
|
139 |
+
'height' => isset( $size_opt['height'] ) ? absint( $size_opt['height'] ) : 600,
|
140 |
+
'crop' => isset( $size_opt['crop'] ) ? 1 : 0,
|
141 |
+
);
|
142 |
+
}
|
143 |
+
|
144 |
+
}
|
145 |
}
|
init.php
CHANGED
@@ -1,121 +1,121 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Plugin Name: YITH WooCommerce Compare
|
4 |
-
* Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-compare/
|
5 |
-
* Description: The <code><strong>YITH WooCommerce Compare</strong></code> plugin
|
6 |
-
* Version: 2.3.
|
7 |
-
* Author: YITH
|
8 |
-
* Author URI: https://yithemes.com/
|
9 |
-
* Text Domain: yith-woocommerce-compare
|
10 |
-
* Domain Path: /languages/
|
11 |
-
* WC requires at least: 2.5.0
|
12 |
-
* WC tested up to: 3.
|
13 |
-
*
|
14 |
-
* @author YITH
|
15 |
-
* @package YITH WooCommerce Compare
|
16 |
-
* @version 2.3.
|
17 |
-
*/
|
18 |
-
/* Copyright
|
19 |
-
|
20 |
-
This program is free software; you can redistribute it and/or modify
|
21 |
-
it under the terms of the GNU General Public License, version 2, as
|
22 |
-
published by the Free Software Foundation.
|
23 |
-
|
24 |
-
This program is distributed in the hope that it will be useful,
|
25 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
26 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
27 |
-
GNU General Public License for more details.
|
28 |
-
|
29 |
-
You should have received a copy of the GNU General Public License
|
30 |
-
along with this program; if not, write to the Free Software
|
31 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
32 |
-
*/
|
33 |
-
if ( !defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly
|
34 |
-
|
35 |
-
if ( ! function_exists( 'is_plugin_active' ) ) {
|
36 |
-
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
37 |
-
}
|
38 |
-
|
39 |
-
function yith_woocompare_install_woocommerce_admin_notice() {
|
40 |
-
?>
|
41 |
-
<div class="error">
|
42 |
-
<p><?php _e( 'YITH WooCommerce Compare is enabled but not effective. It requires WooCommerce in order to work.', 'yith-woocommerce-compare' ); ?></p>
|
43 |
-
</div>
|
44 |
-
<?php
|
45 |
-
}
|
46 |
-
|
47 |
-
function yith_woocompare_install_free_admin_notice() {
|
48 |
-
?>
|
49 |
-
<div class="error">
|
50 |
-
<p><?php _e( 'You can\'t activate the free version of YITH WooCommerce Compare while you are using the premium one.', 'yith-woocommerce-compare' ); ?></p>
|
51 |
-
</div>
|
52 |
-
<?php
|
53 |
-
}
|
54 |
-
|
55 |
-
if ( ! function_exists( 'yith_plugin_registration_hook' ) ) {
|
56 |
-
require_once 'plugin-fw/yit-plugin-registration-hook.php';
|
57 |
-
}
|
58 |
-
register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
|
59 |
-
|
60 |
-
if ( ! defined( 'YITH_WOOCOMPARE_VERSION' ) ){
|
61 |
-
define( 'YITH_WOOCOMPARE_VERSION', '2.3.
|
62 |
-
}
|
63 |
-
if ( ! defined( 'YITH_WOOCOMPARE_FREE_INIT' ) ) {
|
64 |
-
define( 'YITH_WOOCOMPARE_FREE_INIT', plugin_basename( __FILE__ ) );
|
65 |
-
}
|
66 |
-
if ( ! defined( 'YITH_WOOCOMPARE_INIT' ) ) {
|
67 |
-
define( 'YITH_WOOCOMPARE_INIT', plugin_basename( __FILE__ ) );
|
68 |
-
}
|
69 |
-
if ( ! defined( 'YITH_WOOCOMPARE' ) ) {
|
70 |
-
define( 'YITH_WOOCOMPARE', true );
|
71 |
-
}
|
72 |
-
if ( ! defined( 'YITH_WOOCOMPARE_FILE' ) ) {
|
73 |
-
define( 'YITH_WOOCOMPARE_FILE', __FILE__ );
|
74 |
-
}
|
75 |
-
if ( ! defined( 'YITH_WOOCOMPARE_URL' ) ) {
|
76 |
-
define( 'YITH_WOOCOMPARE_URL', plugin_dir_url( __FILE__ ) );
|
77 |
-
}
|
78 |
-
if ( ! defined( 'YITH_WOOCOMPARE_DIR' ) ) {
|
79 |
-
define( 'YITH_WOOCOMPARE_DIR', plugin_dir_path( __FILE__ ) );
|
80 |
-
}
|
81 |
-
if ( ! defined( 'YITH_WOOCOMPARE_TEMPLATE_PATH' ) ) {
|
82 |
-
define( 'YITH_WOOCOMPARE_TEMPLATE_PATH', YITH_WOOCOMPARE_DIR . 'templates' );
|
83 |
-
}
|
84 |
-
if ( ! defined( 'YITH_WOOCOMPARE_ASSETS_URL' ) ) {
|
85 |
-
define( 'YITH_WOOCOMPARE_ASSETS_URL', YITH_WOOCOMPARE_URL . 'assets' );
|
86 |
-
}
|
87 |
-
if ( ! defined( 'YITH_WOOCOMPARE_SLUG' ) ) {
|
88 |
-
define( 'YITH_WOOCOMPARE_SLUG', 'yith-woocommerce-compare' );
|
89 |
-
}
|
90 |
-
/* Plugin Framework Version Check */
|
91 |
-
if( ! function_exists( 'yit_maybe_plugin_fw_loader' ) && file_exists( YITH_WOOCOMPARE_DIR . 'plugin-fw/init.php' ) ) {
|
92 |
-
require_once( YITH_WOOCOMPARE_DIR . 'plugin-fw/init.php' );
|
93 |
-
}
|
94 |
-
yit_maybe_plugin_fw_loader( YITH_WOOCOMPARE_DIR );
|
95 |
-
|
96 |
-
function yith_woocompare_constructor() {
|
97 |
-
|
98 |
-
global $woocommerce;
|
99 |
-
|
100 |
-
if ( ! isset( $woocommerce ) || ! function_exists( 'WC' ) ) {
|
101 |
-
add_action( 'admin_notices', 'yith_woocompare_install_woocommerce_admin_notice' );
|
102 |
-
return;
|
103 |
-
}
|
104 |
-
elseif ( defined( 'YITH_WOOCOMPARE_PREMIUM' ) ) {
|
105 |
-
add_action( 'admin_notices', 'yith_woocompare_install_free_admin_notice' );
|
106 |
-
deactivate_plugins( plugin_basename( __FILE__ ) );
|
107 |
-
return;
|
108 |
-
}
|
109 |
-
|
110 |
-
load_plugin_textdomain( 'yith-woocommerce-compare', false, dirname( plugin_basename( __FILE__ ) ). '/languages/' );
|
111 |
-
|
112 |
-
// Load required classes and functions
|
113 |
-
require_once('includes/class.yith-woocompare-helper.php');
|
114 |
-
require_once('widgets/class.yith-woocompare-widget.php');
|
115 |
-
require_once('includes/class.yith-woocompare.php');
|
116 |
-
|
117 |
-
// Let's start the game!
|
118 |
-
global $yith_woocompare;
|
119 |
-
$yith_woocompare = new YITH_Woocompare();
|
120 |
-
}
|
121 |
-
add_action( 'plugins_loaded', 'yith_woocompare_constructor', 11 );
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: YITH WooCommerce Compare
|
4 |
+
* Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-compare/
|
5 |
+
* Description: The <code><strong>YITH WooCommerce Compare</strong></code> plugin allow you to compare in a simple and efficient way products on sale in your shop and analyze their main features in a single table. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
|
6 |
+
* Version: 2.3.5
|
7 |
+
* Author: YITH
|
8 |
+
* Author URI: https://yithemes.com/
|
9 |
+
* Text Domain: yith-woocommerce-compare
|
10 |
+
* Domain Path: /languages/
|
11 |
+
* WC requires at least: 2.5.0
|
12 |
+
* WC tested up to: 3.5.0
|
13 |
+
*
|
14 |
+
* @author YITH
|
15 |
+
* @package YITH WooCommerce Compare
|
16 |
+
* @version 2.3.5
|
17 |
+
*/
|
18 |
+
/* Copyright 2015 Your Inspiration Themes (email : plugins@yithemes.com)
|
19 |
+
|
20 |
+
This program is free software; you can redistribute it and/or modify
|
21 |
+
it under the terms of the GNU General Public License, version 2, as
|
22 |
+
published by the Free Software Foundation.
|
23 |
+
|
24 |
+
This program is distributed in the hope that it will be useful,
|
25 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
26 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
27 |
+
GNU General Public License for more details.
|
28 |
+
|
29 |
+
You should have received a copy of the GNU General Public License
|
30 |
+
along with this program; if not, write to the Free Software
|
31 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
32 |
+
*/
|
33 |
+
if ( !defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly
|
34 |
+
|
35 |
+
if ( ! function_exists( 'is_plugin_active' ) ) {
|
36 |
+
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
37 |
+
}
|
38 |
+
|
39 |
+
function yith_woocompare_install_woocommerce_admin_notice() {
|
40 |
+
?>
|
41 |
+
<div class="error">
|
42 |
+
<p><?php _e( 'YITH WooCommerce Compare is enabled but not effective. It requires WooCommerce in order to work.', 'yith-woocommerce-compare' ); ?></p>
|
43 |
+
</div>
|
44 |
+
<?php
|
45 |
+
}
|
46 |
+
|
47 |
+
function yith_woocompare_install_free_admin_notice() {
|
48 |
+
?>
|
49 |
+
<div class="error">
|
50 |
+
<p><?php _e( 'You can\'t activate the free version of YITH WooCommerce Compare while you are using the premium one.', 'yith-woocommerce-compare' ); ?></p>
|
51 |
+
</div>
|
52 |
+
<?php
|
53 |
+
}
|
54 |
+
|
55 |
+
if ( ! function_exists( 'yith_plugin_registration_hook' ) ) {
|
56 |
+
require_once 'plugin-fw/yit-plugin-registration-hook.php';
|
57 |
+
}
|
58 |
+
register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
|
59 |
+
|
60 |
+
if ( ! defined( 'YITH_WOOCOMPARE_VERSION' ) ){
|
61 |
+
define( 'YITH_WOOCOMPARE_VERSION', '2.3.5' );
|
62 |
+
}
|
63 |
+
if ( ! defined( 'YITH_WOOCOMPARE_FREE_INIT' ) ) {
|
64 |
+
define( 'YITH_WOOCOMPARE_FREE_INIT', plugin_basename( __FILE__ ) );
|
65 |
+
}
|
66 |
+
if ( ! defined( 'YITH_WOOCOMPARE_INIT' ) ) {
|
67 |
+
define( 'YITH_WOOCOMPARE_INIT', plugin_basename( __FILE__ ) );
|
68 |
+
}
|
69 |
+
if ( ! defined( 'YITH_WOOCOMPARE' ) ) {
|
70 |
+
define( 'YITH_WOOCOMPARE', true );
|
71 |
+
}
|
72 |
+
if ( ! defined( 'YITH_WOOCOMPARE_FILE' ) ) {
|
73 |
+
define( 'YITH_WOOCOMPARE_FILE', __FILE__ );
|
74 |
+
}
|
75 |
+
if ( ! defined( 'YITH_WOOCOMPARE_URL' ) ) {
|
76 |
+
define( 'YITH_WOOCOMPARE_URL', plugin_dir_url( __FILE__ ) );
|
77 |
+
}
|
78 |
+
if ( ! defined( 'YITH_WOOCOMPARE_DIR' ) ) {
|
79 |
+
define( 'YITH_WOOCOMPARE_DIR', plugin_dir_path( __FILE__ ) );
|
80 |
+
}
|
81 |
+
if ( ! defined( 'YITH_WOOCOMPARE_TEMPLATE_PATH' ) ) {
|
82 |
+
define( 'YITH_WOOCOMPARE_TEMPLATE_PATH', YITH_WOOCOMPARE_DIR . 'templates' );
|
83 |
+
}
|
84 |
+
if ( ! defined( 'YITH_WOOCOMPARE_ASSETS_URL' ) ) {
|
85 |
+
define( 'YITH_WOOCOMPARE_ASSETS_URL', YITH_WOOCOMPARE_URL . 'assets' );
|
86 |
+
}
|
87 |
+
if ( ! defined( 'YITH_WOOCOMPARE_SLUG' ) ) {
|
88 |
+
define( 'YITH_WOOCOMPARE_SLUG', 'yith-woocommerce-compare' );
|
89 |
+
}
|
90 |
+
/* Plugin Framework Version Check */
|
91 |
+
if( ! function_exists( 'yit_maybe_plugin_fw_loader' ) && file_exists( YITH_WOOCOMPARE_DIR . 'plugin-fw/init.php' ) ) {
|
92 |
+
require_once( YITH_WOOCOMPARE_DIR . 'plugin-fw/init.php' );
|
93 |
+
}
|
94 |
+
yit_maybe_plugin_fw_loader( YITH_WOOCOMPARE_DIR );
|
95 |
+
|
96 |
+
function yith_woocompare_constructor() {
|
97 |
+
|
98 |
+
global $woocommerce;
|
99 |
+
|
100 |
+
if ( ! isset( $woocommerce ) || ! function_exists( 'WC' ) ) {
|
101 |
+
add_action( 'admin_notices', 'yith_woocompare_install_woocommerce_admin_notice' );
|
102 |
+
return;
|
103 |
+
}
|
104 |
+
elseif ( defined( 'YITH_WOOCOMPARE_PREMIUM' ) ) {
|
105 |
+
add_action( 'admin_notices', 'yith_woocompare_install_free_admin_notice' );
|
106 |
+
deactivate_plugins( plugin_basename( __FILE__ ) );
|
107 |
+
return;
|
108 |
+
}
|
109 |
+
|
110 |
+
load_plugin_textdomain( 'yith-woocommerce-compare', false, dirname( plugin_basename( __FILE__ ) ). '/languages/' );
|
111 |
+
|
112 |
+
// Load required classes and functions
|
113 |
+
require_once('includes/class.yith-woocompare-helper.php');
|
114 |
+
require_once('widgets/class.yith-woocompare-widget.php');
|
115 |
+
require_once('includes/class.yith-woocompare.php');
|
116 |
+
|
117 |
+
// Let's start the game!
|
118 |
+
global $yith_woocompare;
|
119 |
+
$yith_woocompare = new YITH_Woocompare();
|
120 |
+
}
|
121 |
+
add_action( 'plugins_loaded', 'yith_woocompare_constructor', 11 );
|
plugin-fw/assets/css/admin.css
CHANGED
@@ -33,6 +33,14 @@
|
|
33 |
line-height : 1.5em;
|
34 |
}
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
/*-----------------------
|
37 |
YITH Plugins Columns
|
38 |
------------------------*/
|
33 |
line-height : 1.5em;
|
34 |
}
|
35 |
|
36 |
+
.notice-yith{
|
37 |
+
border-left-color: #acc327;
|
38 |
+
}
|
39 |
+
|
40 |
+
.notice-yith.notice-alt{
|
41 |
+
background-color: #ecf7ed;
|
42 |
+
}
|
43 |
+
|
44 |
/*-----------------------
|
45 |
YITH Plugins Columns
|
46 |
------------------------*/
|
plugin-fw/assets/css/metaboxes.css
CHANGED
@@ -631,4 +631,7 @@
|
|
631 |
float : right;
|
632 |
margin-right : 20px;
|
633 |
margin-top : 5px;
|
|
|
|
|
|
|
634 |
}
|
631 |
float : right;
|
632 |
margin-right : 20px;
|
633 |
margin-top : 5px;
|
634 |
+
z-index: 9999 !important;
|
635 |
+
position: absolute;
|
636 |
+
right: 0;
|
637 |
}
|
plugin-fw/assets/js/yith-promo.js
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function ($) {
|
2 |
+
$(document).on('click', '.notice-dismiss', function () {
|
3 |
+
var t = $(this),
|
4 |
+
promo_wrapper = t.parent('div.yith-notice-is-dismissible'),
|
5 |
+
promo_id = promo_wrapper.attr('id');
|
6 |
+
|
7 |
+
if (typeof promo_id != 'undefined') {
|
8 |
+
var cname = 'hide_' + promo_id,
|
9 |
+
cvalue = 'yes',
|
10 |
+
expiry = promo_wrapper.data('expiry'),
|
11 |
+
expiry_date = new Date(expiry);
|
12 |
+
|
13 |
+
expiry_date.setUTCHours( 23 );
|
14 |
+
expiry_date.setUTCMinutes( 59 );
|
15 |
+
expiry_date.setUTCSeconds( 59 );
|
16 |
+
|
17 |
+
document.cookie = cname + "=" + cvalue + ";" + 'expires=' + expiry_date.toUTCString() + ";path=/";
|
18 |
+
}
|
19 |
+
});
|
20 |
+
})(jQuery);
|
plugin-fw/assets/js/yith-promo.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
(function(c){c(document).on("click",".notice-dismiss",function(){var a=c(this).parent("div.yith-notice-is-dismissible"),b=a.attr("id");"undefined"!=typeof b&&(b="hide_"+b,a=a.data("expiry"),a=new Date(a),a.setUTCHours(23),a.setUTCMinutes(59),a.setUTCSeconds(59),document.cookie=b+"=yes;expires="+a.toUTCString()+";path=/")})})(jQuery);
|
plugin-fw/init.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Framework Name: YIT Plugin Framework
|
4 |
-
* Version: 3.0.
|
5 |
* Author: YITHEMES
|
6 |
* Text Domain: yith-plugin-fw
|
7 |
* Domain Path: /languages/
|
8 |
*
|
9 |
* @author Your Inspiration Themes
|
10 |
-
* @version 3.0.
|
11 |
*/
|
12 |
/**
|
13 |
* This file belongs to the YIT Plugin Framework.
|
1 |
<?php
|
2 |
/**
|
3 |
* Framework Name: YIT Plugin Framework
|
4 |
+
* Version: 3.0.27
|
5 |
* Author: YITHEMES
|
6 |
* Text Domain: yith-plugin-fw
|
7 |
* Domain Path: /languages/
|
8 |
*
|
9 |
* @author Your Inspiration Themes
|
10 |
+
* @version 3.0.24
|
11 |
*/
|
12 |
/**
|
13 |
* This file belongs to the YIT Plugin Framework.
|
plugin-fw/lib/promo/yith-promo.php
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file belongs to the YIT Plugin Framework.
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
|
6 |
+
* that is bundled with this package in the file LICENSE.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.txt
|
9 |
+
*/
|
10 |
+
|
11 |
+
if( apply_filters( 'yith_plugin_fw_notice', true ) ){
|
12 |
+
add_action( 'admin_notices', 'yith_plugin_fw_promo_notices', 15 );
|
13 |
+
add_action( 'admin_enqueue_scripts', 'yith_plugin_fw_notice_dismiss', 20 );
|
14 |
+
|
15 |
+
if( ! function_exists( 'yith_plugin_fw_promo_notices' ) ){
|
16 |
+
function yith_plugin_fw_promo_notices(){
|
17 |
+
$xml = apply_filters( 'yith_plugin_fw_promo_xml_url', 'https://update.yithemes.com/promo/yith-promo.xml' );
|
18 |
+
$transient = "yith_promo_message";
|
19 |
+
$remote_data = get_site_transient( $transient );
|
20 |
+
$regenerate_promo_transient = isset( $_GET['yith_regenerate_promo_transient'] ) && 'yes' == $_GET['yith_regenerate_promo_transient'] ? $_GET['yith_regenerate_promo_transient'] : '';
|
21 |
+
$promo_data = false;
|
22 |
+
$create_transient = false;
|
23 |
+
|
24 |
+
if( false === $remote_data || apply_filters( 'yith_plugin_fw_force_regenerate_promo_transient', false ) || 'yes' == $regenerate_promo_transient ){
|
25 |
+
$remote_data = wp_remote_get( $xml );
|
26 |
+
$create_transient = true;
|
27 |
+
}
|
28 |
+
|
29 |
+
if ( ! is_wp_error( $remote_data ) && isset( $remote_data['response']['code'] ) && '200' == $remote_data['response']['code'] ) {
|
30 |
+
$promo_data = @simplexml_load_string( $remote_data['body'] );
|
31 |
+
|
32 |
+
if( true === $create_transient ){
|
33 |
+
$xml_expiry_date = ! empty( $promo_data->expiry_date ) ? $promo_data->expiry_date : '';
|
34 |
+
//Set Site Transient
|
35 |
+
set_site_transient( $transient, $remote_data, yith_plugin_fw_get_promo_transient_expiry_date( $xml_expiry_date ) );
|
36 |
+
}
|
37 |
+
|
38 |
+
if ( $promo_data && ! empty( $promo_data->promo ) ) {
|
39 |
+
$now = strtotime( current_time( 'Y-m-d' ), 1 );
|
40 |
+
foreach ($promo_data as $promo ){
|
41 |
+
$start_date = isset( $promo->start_date ) ? $promo->start_date : '';
|
42 |
+
$end_date = isset( $promo->end_date ) ? $promo->end_date : '';
|
43 |
+
|
44 |
+
if( ! empty( $start_date ) && ! empty( $end_date ) ){
|
45 |
+
$start_date = strtotime( $start_date );
|
46 |
+
$end_date = strtotime( $end_date );
|
47 |
+
|
48 |
+
if( $end_date >= $start_date && $now >= $start_date && $now <= $end_date ){
|
49 |
+
//is valid promo
|
50 |
+
$title = isset( $promo->title ) ? $promo->title : '';
|
51 |
+
$description = isset( $promo->description ) ? $promo->description : '';
|
52 |
+
$url = isset( $promo->link->url ) ? $promo->link->url : '';
|
53 |
+
$url_label = isset( $promo->link->label ) ? $promo->link->label : '';
|
54 |
+
$border_color = isset( $promo->style->border_color ) ? $promo->style->border_color : '';
|
55 |
+
$background_color = isset( $promo->style->background_color ) ? $promo->style->background_color : '';
|
56 |
+
$promo_id = isset( $promo->promo_id ) ? $promo->promo_id : '';
|
57 |
+
$style = $link = '';
|
58 |
+
$show_notice = false;
|
59 |
+
|
60 |
+
if( ! empty( $border_color ) ){
|
61 |
+
$style .= "border-left-color: {$border_color};";
|
62 |
+
}
|
63 |
+
|
64 |
+
if( ! empty( $background_color ) ){
|
65 |
+
$style .= "background-color: {$background_color};";
|
66 |
+
}
|
67 |
+
|
68 |
+
if( ! empty( $title ) ) {
|
69 |
+
$promo_id .= $title;
|
70 |
+
$title = sprintf( '<strong>%s</strong>: ', $title );
|
71 |
+
$show_notice = true;
|
72 |
+
}
|
73 |
+
|
74 |
+
if( ! empty( $description ) ) {
|
75 |
+
$promo_id .= $description;
|
76 |
+
$description = sprintf( '%s', $description );
|
77 |
+
$show_notice = true;
|
78 |
+
}
|
79 |
+
|
80 |
+
if( ! empty( $url ) && ! empty( $url_label )) {
|
81 |
+
$promo_id .= $url . $url_label;
|
82 |
+
$link = sprintf( '<a href="%s" target="_blank">%s</a>', $url, $url_label );
|
83 |
+
$show_notice = true;
|
84 |
+
}
|
85 |
+
|
86 |
+
$unique_promo_id = "yith-notice-" . md5 ( $promo_id );
|
87 |
+
|
88 |
+
if( ! empty( $_COOKIE[ 'hide_' . $unique_promo_id ] ) && 'yes' == $_COOKIE[ 'hide_' . $unique_promo_id ] ){
|
89 |
+
$show_notice = false;
|
90 |
+
}
|
91 |
+
|
92 |
+
if( true === $show_notice ) :
|
93 |
+
?>
|
94 |
+
<div id="<?php echo $unique_promo_id; ?>" class="yith-notice-is-dismissible notice notice-yith notice-alt is-dismissible" style="<?php echo $style; ?>" data-expiry = <?php echo $promo->end_date; ?>>
|
95 |
+
<p>
|
96 |
+
<?php printf( "%s %s %s", $title, $description, $link ); ?>
|
97 |
+
</p>
|
98 |
+
</div>
|
99 |
+
<?php endif;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
if( ! function_exists( 'yith_plugin_fw_notice_dismiss' ) ){
|
109 |
+
function yith_plugin_fw_notice_dismiss(){
|
110 |
+
$script_path = defined( 'YIT_CORE_PLUGIN_URL' ) ? YIT_CORE_PLUGIN_URL : get_template_directory_uri() . '/core/plugin-fw';
|
111 |
+
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
112 |
+
wp_register_script( 'yith-promo', $script_path . '/assets/js/yith-promo' . $suffix . '.js', array( 'jquery' ), '1.0.0', true );
|
113 |
+
wp_enqueue_script( 'yith-promo' );
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
if( ! function_exists( 'yith_plugin_fw_get_promo_transient_expiry_date' ) ){
|
118 |
+
function yith_plugin_fw_get_promo_transient_expiry_date( $expiry_date ) {
|
119 |
+
$xml_expiry_date = ! empty( $expiry_date ) ? $expiry_date : '+6 hours';
|
120 |
+
$current = strtotime( current_time( 'Y-m-d H:i:s', 1 ) );
|
121 |
+
$expiry_date = strtotime( $xml_expiry_date, $current );
|
122 |
+
|
123 |
+
if( $expiry_date <= $current ){
|
124 |
+
$expiry_date = strtotime( '+24 hours', $current );
|
125 |
+
}
|
126 |
+
|
127 |
+
return $expiry_date;
|
128 |
+
}
|
129 |
+
}
|
130 |
+
}
|
plugin-fw/lib/yit-ajax.php
CHANGED
@@ -17,7 +17,7 @@ if ( !class_exists( 'YIT_Ajax' ) ) {
|
|
17 |
* YIT Ajax
|
18 |
*
|
19 |
* @class YIT_Ajax
|
20 |
-
* @package
|
21 |
* @since 1.0
|
22 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
23 |
*/
|
17 |
* YIT Ajax
|
18 |
*
|
19 |
* @class YIT_Ajax
|
20 |
+
* @package YITH
|
21 |
* @since 1.0
|
22 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
23 |
*/
|
plugin-fw/lib/yit-assets.php
CHANGED
@@ -15,7 +15,7 @@ if ( !class_exists( 'YIT_Assets' ) ) {
|
|
15 |
* YIT Assets
|
16 |
*
|
17 |
* @class YIT_Assets
|
18 |
-
* @package
|
19 |
* @since 3.0.0
|
20 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
21 |
*/
|
15 |
* YIT Assets
|
16 |
*
|
17 |
* @class YIT_Assets
|
18 |
+
* @package YITH
|
19 |
* @since 3.0.0
|
20 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
21 |
*/
|
plugin-fw/lib/yit-cpt-unlimited.php
CHANGED
@@ -14,7 +14,7 @@ if (!defined('ABSPATH')) {exit('Direct access forbidden.');
|
|
14 |
* Manage the custom post types as Portfolio, Contact Forms and similar (called CPTU)
|
15 |
*
|
16 |
* @class YIT_CPT_Unlimited
|
17 |
-
* @package
|
18 |
* @since 2.0.0
|
19 |
* @author Your Inspiration Themes
|
20 |
*
|
14 |
* Manage the custom post types as Portfolio, Contact Forms and similar (called CPTU)
|
15 |
*
|
16 |
* @class YIT_CPT_Unlimited
|
17 |
+
* @package YITH
|
18 |
* @since 2.0.0
|
19 |
* @author Your Inspiration Themes
|
20 |
*
|
plugin-fw/lib/yit-debug.php
CHANGED
@@ -17,7 +17,7 @@ if ( !class_exists( 'YITH_Debug' ) ) {
|
|
17 |
* manages debug
|
18 |
*
|
19 |
* @class YITH_Debug
|
20 |
-
* @package
|
21 |
* @since 1.0.0
|
22 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
23 |
*
|
17 |
* manages debug
|
18 |
*
|
19 |
* @class YITH_Debug
|
20 |
+
* @package YITH
|
21 |
* @since 1.0.0
|
22 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
23 |
*
|
plugin-fw/lib/yit-icons.php
CHANGED
@@ -20,7 +20,7 @@ if ( !class_exists( 'YIT_Icons' ) ) {
|
|
20 |
* Class to manage icons
|
21 |
*
|
22 |
* @class YIT_Icons
|
23 |
-
* @package
|
24 |
* @since 1.0.0
|
25 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
26 |
*
|
20 |
* Class to manage icons
|
21 |
*
|
22 |
* @class YIT_Icons
|
23 |
+
* @package YITH
|
24 |
* @since 1.0.0
|
25 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
26 |
*
|
plugin-fw/lib/yit-metabox.php
CHANGED
@@ -43,7 +43,7 @@ if ( !class_exists( 'YIT_Metabox' ) ) {
|
|
43 |
* </code>
|
44 |
*
|
45 |
* @class YIT_Metaboxes
|
46 |
-
* @package
|
47 |
* @since 1.0.0
|
48 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.com>
|
49 |
*
|
43 |
* </code>
|
44 |
*
|
45 |
* @class YIT_Metaboxes
|
46 |
+
* @package YITH
|
47 |
* @since 1.0.0
|
48 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.com>
|
49 |
*
|
plugin-fw/lib/yit-plugin-panel-wc.php
CHANGED
@@ -19,7 +19,7 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
19 |
* Setting Page to Manage Plugins
|
20 |
*
|
21 |
* @class YIT_Plugin_Panel
|
22 |
-
* @package
|
23 |
* @since 1.0
|
24 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
25 |
* @author Antonio La Rocca <antonio.larocca@yithemes.com>
|
19 |
* Setting Page to Manage Plugins
|
20 |
*
|
21 |
* @class YIT_Plugin_Panel
|
22 |
+
* @package YITH
|
23 |
* @since 1.0
|
24 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
25 |
* @author Antonio La Rocca <antonio.larocca@yithemes.com>
|
plugin-fw/lib/yit-plugin-panel.php
CHANGED
@@ -19,7 +19,7 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
19 |
* Setting Page to Manage Plugins
|
20 |
*
|
21 |
* @class YIT_Plugin_Panel
|
22 |
-
* @package
|
23 |
* @since 1.0
|
24 |
* @author Your Inspiration Themes
|
25 |
*/
|
19 |
* Setting Page to Manage Plugins
|
20 |
*
|
21 |
* @class YIT_Plugin_Panel
|
22 |
+
* @package YITH
|
23 |
* @since 1.0
|
24 |
* @author Your Inspiration Themes
|
25 |
*/
|
plugin-fw/lib/yit-plugin-subpanel.php
CHANGED
@@ -19,7 +19,7 @@ if ( !class_exists( 'YIT_Plugin_SubPanel' ) ) {
|
|
19 |
* Setting Page to Manage Plugins
|
20 |
*
|
21 |
* @class YIT_Plugin_Panel
|
22 |
-
* @package
|
23 |
* @since 1.0
|
24 |
* @author Your Inspiration Themes
|
25 |
*/
|
19 |
* Setting Page to Manage Plugins
|
20 |
*
|
21 |
* @class YIT_Plugin_Panel
|
22 |
+
* @package YITH
|
23 |
* @since 1.0
|
24 |
* @author Your Inspiration Themes
|
25 |
*/
|
plugin-fw/lib/yit-pointers.php
CHANGED
@@ -15,7 +15,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
15 |
*
|
16 |
*
|
17 |
* @class yit-pointers
|
18 |
-
* @package
|
19 |
* @since Version 2.0.0
|
20 |
* @author Your Inspiration Themes
|
21 |
*
|
@@ -27,7 +27,7 @@ if ( ! class_exists( 'YIT_Pointers' ) ) {
|
|
27 |
* Initializes the new feature pointers.
|
28 |
*
|
29 |
* @class YIT_Pointers
|
30 |
-
* @package
|
31 |
* @since 1.0
|
32 |
* @author Your Inspiration Themes
|
33 |
* @see WP_Internal_Pointers
|
@@ -65,7 +65,7 @@ if ( ! class_exists( 'YIT_Pointers' ) ) {
|
|
65 |
$this->_default_pointer['plugins'] = array(
|
66 |
'screen_id' => 'plugins',
|
67 |
'options' => array(
|
68 |
-
'content' => sprintf( '<h3> %s </h3> <p> %s </p> <p> %s <a href="http://yithemes.com/product-category/plugins/" target="_blank">
|
69 |
<a href="https://profiles.wordpress.org/yithemes/" target="_blank">Wordpress.org</a></p>',
|
70 |
__( 'Plugins Activated', 'yith-plugin-fw' ),
|
71 |
__( 'From now on, you can find all plugin options in YITH Plugins menu.
|
@@ -79,7 +79,7 @@ if ( ! class_exists( 'YIT_Pointers' ) ) {
|
|
79 |
$this->_default_pointer['update'] = array(
|
80 |
'screen_id' => 'update',
|
81 |
'options' => array(
|
82 |
-
'content' => sprintf( '<h3> %s </h3> <p> %s </p> <p> %s <a href="http://yithemes.com/product-category/plugins/" target="_blank">
|
83 |
<a href="https://profiles.wordpress.org/yithemes/" target="_blank">Wordpress.org</a></p>',
|
84 |
__( 'Plugins Upgraded', 'yith-plugin-fw' ),
|
85 |
__( 'From now on, you can find the option panel of YITH plugins in YITH Plugins menu.
|
15 |
*
|
16 |
*
|
17 |
* @class yit-pointers
|
18 |
+
* @package YITH
|
19 |
* @since Version 2.0.0
|
20 |
* @author Your Inspiration Themes
|
21 |
*
|
27 |
* Initializes the new feature pointers.
|
28 |
*
|
29 |
* @class YIT_Pointers
|
30 |
+
* @package YITH
|
31 |
* @since 1.0
|
32 |
* @author Your Inspiration Themes
|
33 |
* @see WP_Internal_Pointers
|
65 |
$this->_default_pointer['plugins'] = array(
|
66 |
'screen_id' => 'plugins',
|
67 |
'options' => array(
|
68 |
+
'content' => sprintf( '<h3> %s </h3> <p> %s </p> <p> %s <a href="http://yithemes.com/product-category/plugins/" target="_blank">yithemes.com</a> %s
|
69 |
<a href="https://profiles.wordpress.org/yithemes/" target="_blank">Wordpress.org</a></p>',
|
70 |
__( 'Plugins Activated', 'yith-plugin-fw' ),
|
71 |
__( 'From now on, you can find all plugin options in YITH Plugins menu.
|
79 |
$this->_default_pointer['update'] = array(
|
80 |
'screen_id' => 'update',
|
81 |
'options' => array(
|
82 |
+
'content' => sprintf( '<h3> %s </h3> <p> %s </p> <p> %s <a href="http://yithemes.com/product-category/plugins/" target="_blank">yithemes.com</a> %s
|
83 |
<a href="https://profiles.wordpress.org/yithemes/" target="_blank">Wordpress.org</a></p>',
|
84 |
__( 'Plugins Upgraded', 'yith-plugin-fw' ),
|
85 |
__( 'From now on, you can find the option panel of YITH plugins in YITH Plugins menu.
|
plugin-fw/lib/yit-upgrade.php
CHANGED
@@ -18,7 +18,7 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
18 |
* Notify and Update plugin
|
19 |
*
|
20 |
* @class YIT_Upgrade
|
21 |
-
* @package
|
22 |
* @since 1.0
|
23 |
* @author Your Inspiration Themes
|
24 |
* @see WP_Updater Class
|
@@ -620,12 +620,14 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
620 |
//Get license for YITH Plugins
|
621 |
$enabled_license = YIT_Plugin_Licence()->get_licence();
|
622 |
|
623 |
-
if( isset( $enabled_license[ $slug ]['
|
624 |
-
|
625 |
-
|
|
|
626 |
|
627 |
-
|
628 |
-
|
|
|
629 |
}
|
630 |
}
|
631 |
|
18 |
* Notify and Update plugin
|
19 |
*
|
20 |
* @class YIT_Upgrade
|
21 |
+
* @package YITH
|
22 |
* @since 1.0
|
23 |
* @author Your Inspiration Themes
|
24 |
* @see WP_Updater Class
|
620 |
//Get license for YITH Plugins
|
621 |
$enabled_license = YIT_Plugin_Licence()->get_licence();
|
622 |
|
623 |
+
if( isset( $enabled_license[ $slug ]['activated'] ) && false !== $enabled_license[ $slug ]['activated'] ){
|
624 |
+
if( isset( $enabled_license[ $slug ]['licence_key'] ) ){
|
625 |
+
$license = $enabled_license[ $slug ]['licence_key'];
|
626 |
+
}
|
627 |
|
628 |
+
if( isset( $enabled_license[ $slug ]['is_membership'] ) ){
|
629 |
+
$is_membership_license = $enabled_license[ $slug ]['is_membership'];
|
630 |
+
}
|
631 |
}
|
632 |
}
|
633 |
|
plugin-fw/lib/yit-video.php
CHANGED
@@ -20,7 +20,7 @@ if ( ! class_exists( 'YIT_Video' ) ) {
|
|
20 |
* Class to manage the video from youtube and vimeo or other services
|
21 |
*
|
22 |
* @class YIT_Video
|
23 |
-
* @package
|
24 |
* @since 1.0.0
|
25 |
* @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
|
26 |
*
|
20 |
* Class to manage the video from youtube and vimeo or other services
|
21 |
*
|
22 |
* @class YIT_Video
|
23 |
+
* @package YITH
|
24 |
* @since 1.0.0
|
25 |
* @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
|
26 |
*
|
plugin-fw/licence/lib/yit-licence.php
CHANGED
@@ -19,7 +19,7 @@ if ( !class_exists( 'YIT_Licence' ) ) {
|
|
19 |
* Setting Page to Manage Products
|
20 |
*
|
21 |
* @class YIT_Licence
|
22 |
-
* @package
|
23 |
* @since 1.0
|
24 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
25 |
*/
|
19 |
* Setting Page to Manage Products
|
20 |
*
|
21 |
* @class YIT_Licence
|
22 |
+
* @package YITH
|
23 |
* @since 1.0
|
24 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
25 |
*/
|
plugin-fw/licence/lib/yit-plugin-licence.php
CHANGED
@@ -19,7 +19,7 @@ if ( !class_exists( 'YIT_Plugin_Licence' ) ) {
|
|
19 |
* Setting Page to Manage Plugins
|
20 |
*
|
21 |
* @class YIT_Plugin_Licence
|
22 |
-
* @package
|
23 |
* @since 1.0
|
24 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
25 |
*/
|
19 |
* Setting Page to Manage Plugins
|
20 |
*
|
21 |
* @class YIT_Plugin_Licence
|
22 |
+
* @package YITH
|
23 |
* @since 1.0
|
24 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
25 |
*/
|
plugin-fw/licence/lib/yit-theme-licence.php
CHANGED
@@ -19,7 +19,7 @@ if ( !class_exists( 'YIT_Theme_Licence' ) ) {
|
|
19 |
* Setting Page to Manage Plugins
|
20 |
*
|
21 |
* @class YIT_Theme_Licence
|
22 |
-
* @package
|
23 |
* @since 1.0
|
24 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
25 |
*/
|
19 |
* Setting Page to Manage Plugins
|
20 |
*
|
21 |
* @class YIT_Theme_Licence
|
22 |
+
* @package YITH
|
23 |
* @since 1.0
|
24 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
25 |
*/
|
plugin-fw/licence/templates/panel/activation/activation-panel.php
CHANGED
@@ -56,7 +56,7 @@ $debug = isset( $_REQUEST[ 'yith-license-debug' ] ) ? $_
|
|
56 |
<?php echo $this->display_product_name( $info[ 'Name' ] ) ?>
|
57 |
</td>
|
58 |
<td>
|
59 |
-
<input type="email" name="email" placeholder="Your email on
|
60 |
</td>
|
61 |
<td>
|
62 |
<input type="text" name="licence_key" placeholder="License Key" value="" class="licence-key"/>
|
56 |
<?php echo $this->display_product_name( $info[ 'Name' ] ) ?>
|
57 |
</td>
|
58 |
<td>
|
59 |
+
<input type="email" name="email" placeholder="Your email on yithemes.com" value="" class="user-email"/>
|
60 |
</td>
|
61 |
<td>
|
62 |
<input type="text" name="licence_key" placeholder="License Key" value="" class="licence-key"/>
|
plugin-fw/templates/metaboxes/types/icon-list.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
/**
|
12 |
* Awesome Icon Admin View
|
13 |
*
|
14 |
-
* @package
|
15 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.com>
|
16 |
* @since 1.0.0
|
17 |
*/
|
11 |
/**
|
12 |
* Awesome Icon Admin View
|
13 |
*
|
14 |
+
* @package YITH
|
15 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.com>
|
16 |
* @since 1.0.0
|
17 |
*/
|
plugin-fw/templates/panel/panel-field-container.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
/**
|
12 |
* Field Container for YIT Panel
|
13 |
*
|
14 |
-
* @package
|
15 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
16 |
* @since 3.0.0
|
17 |
*/
|
11 |
/**
|
12 |
* Field Container for YIT Panel
|
13 |
*
|
14 |
+
* @package YITH
|
15 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
16 |
* @since 3.0.0
|
17 |
*/
|
plugin-fw/templates/panel/woocommerce/woocommerce-upload.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
/**
|
12 |
* Upload Plugin Admin View
|
13 |
*
|
14 |
-
* @package
|
15 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
16 |
* @since 1.0.0
|
17 |
*/
|
11 |
/**
|
12 |
* Upload Plugin Admin View
|
13 |
*
|
14 |
+
* @package YITH
|
15 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
16 |
* @since 1.0.0
|
17 |
*/
|
plugin-fw/templates/privacy/html-policy-content.php
CHANGED
@@ -1,37 +1,37 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @var array $sections
|
4 |
-
*/
|
5 |
-
?>
|
6 |
-
<div class="wp-suggested-text">
|
7 |
-
<?php do_action( 'yith_plugin_fw_privacy_guide_content_before' ); ?>
|
8 |
-
|
9 |
-
<?php
|
10 |
-
foreach ( $sections as $key => $section ) {
|
11 |
-
$action = "yith_plugin_fw_privacy_guide_content_{$key}";
|
12 |
-
$content = apply_filters( 'yith_plugin_fw_privacy_guide_content', '', $key );
|
13 |
-
|
14 |
-
if ( has_action( $action ) || !empty( $section[ 'tutorial' ] ) || !empty( $section[ 'description' ] ) || $content ) {
|
15 |
-
if ( !empty( $section[ 'title' ] ) ) {
|
16 |
-
echo "<h2>{$section['title']}</h2>";
|
17 |
-
}
|
18 |
-
|
19 |
-
if ( !empty( $section[ 'tutorial' ] ) ) {
|
20 |
-
echo "<p class='privacy-policy-tutorial'>{$section['tutorial']}</p>";
|
21 |
-
}
|
22 |
-
|
23 |
-
if ( !empty( $section[ 'description' ] ) ) {
|
24 |
-
echo "<p>{$section['description']}</p>";
|
25 |
-
}
|
26 |
-
|
27 |
-
if ( !empty( $content ) ) {
|
28 |
-
echo $content;
|
29 |
-
}
|
30 |
-
}
|
31 |
-
|
32 |
-
do_action( $action );
|
33 |
-
}
|
34 |
-
?>
|
35 |
-
|
36 |
-
<?php do_action( 'yith_plugin_fw_privacy_guide_content_after' ); ?>
|
37 |
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @var array $sections
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
<div class="wp-suggested-text">
|
7 |
+
<?php do_action( 'yith_plugin_fw_privacy_guide_content_before' ); ?>
|
8 |
+
|
9 |
+
<?php
|
10 |
+
foreach ( $sections as $key => $section ) {
|
11 |
+
$action = "yith_plugin_fw_privacy_guide_content_{$key}";
|
12 |
+
$content = apply_filters( 'yith_plugin_fw_privacy_guide_content', '', $key );
|
13 |
+
|
14 |
+
if ( has_action( $action ) || !empty( $section[ 'tutorial' ] ) || !empty( $section[ 'description' ] ) || $content ) {
|
15 |
+
if ( !empty( $section[ 'title' ] ) ) {
|
16 |
+
echo "<h2>{$section['title']}</h2>";
|
17 |
+
}
|
18 |
+
|
19 |
+
if ( !empty( $section[ 'tutorial' ] ) ) {
|
20 |
+
echo "<p class='privacy-policy-tutorial'>{$section['tutorial']}</p>";
|
21 |
+
}
|
22 |
+
|
23 |
+
if ( !empty( $section[ 'description' ] ) ) {
|
24 |
+
echo "<p>{$section['description']}</p>";
|
25 |
+
}
|
26 |
+
|
27 |
+
if ( !empty( $content ) ) {
|
28 |
+
echo $content;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
do_action( $action );
|
33 |
+
}
|
34 |
+
?>
|
35 |
+
|
36 |
+
<?php do_action( 'yith_plugin_fw_privacy_guide_content_after' ); ?>
|
37 |
</div>
|
plugin-fw/yit-plugin.php
CHANGED
@@ -39,6 +39,7 @@ include_once( 'lib/yit-assets.php');
|
|
39 |
include_once( 'lib/yit-debug.php');
|
40 |
include_once( 'lib/privacy/yit-privacy.php' );
|
41 |
include_once( 'lib/privacy/yit-privacy-plugin-abstract.php' );
|
|
|
42 |
|
43 |
// load from theme folder...
|
44 |
load_textdomain( 'yith-plugin-fw', get_template_directory() . '/core/plugin-fw/yith-plugin-fw-' . apply_filters( 'plugin_locale', get_locale(), 'yith-plugin-fw' ) . '.mo' )
|
@@ -144,7 +145,7 @@ if( ! function_exists( 'yit_plugin_fw_row_meta' ) ){
|
|
144 |
|
145 |
else{
|
146 |
if( isset( $base_uri[ $field ] ) ) {
|
147 |
-
$url = $base_uri[ $field ] . $slug;
|
148 |
}
|
149 |
}
|
150 |
}
|
39 |
include_once( 'lib/yit-debug.php');
|
40 |
include_once( 'lib/privacy/yit-privacy.php' );
|
41 |
include_once( 'lib/privacy/yit-privacy-plugin-abstract.php' );
|
42 |
+
include_once ( 'lib/promo/yith-promo.php' );
|
43 |
|
44 |
// load from theme folder...
|
45 |
load_textdomain( 'yith-plugin-fw', get_template_directory() . '/core/plugin-fw/yith-plugin-fw-' . apply_filters( 'plugin_locale', get_locale(), 'yith-plugin-fw' ) . '.mo' )
|
145 |
|
146 |
else{
|
147 |
if( isset( $base_uri[ $field ] ) ) {
|
148 |
+
$url = apply_filters( "yith_plugin_row_meta_{$field}_url", $base_uri[ $field ] . $slug, $field, $slug, $base_uri );
|
149 |
}
|
150 |
}
|
151 |
}
|
plugin-options/general-options.php
CHANGED
@@ -1,145 +1,145 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Main admin class
|
4 |
-
*
|
5 |
-
* @author YITH
|
6 |
-
* @package YITH Woocommerce Compare
|
7 |
-
* @version 1.1.1
|
8 |
-
*/
|
9 |
-
|
10 |
-
if ( ! defined( 'YITH_WOOCOMPARE' ) ) {
|
11 |
-
exit;
|
12 |
-
} // Exit if accessed directly
|
13 |
-
|
14 |
-
$options = array(
|
15 |
-
'general' => array(
|
16 |
-
array(
|
17 |
-
'name' => __( 'General Settings', 'yith-woocommerce-compare' ),
|
18 |
-
'type' => 'title',
|
19 |
-
'desc' => '',
|
20 |
-
'id' => 'yith_woocompare_general'
|
21 |
-
),
|
22 |
-
|
23 |
-
array(
|
24 |
-
'name' => __( 'Link or Button', 'yith-woocommerce-compare' ),
|
25 |
-
'desc_tip' => __( 'Choose if you want to use a link or a button for the comepare actions.', 'yith-woocommerce-compare' ),
|
26 |
-
'id' => 'yith_woocompare_is_button',
|
27 |
-
'std' => 'button',
|
28 |
-
'default' => 'button',
|
29 |
-
'type' => 'select',
|
30 |
-
'class' => 'wc-enhanced-select',
|
31 |
-
'options' => array(
|
32 |
-
'link' => __( 'Link', 'yith-woocommerce-compare' ),
|
33 |
-
'button' => __( 'Button', 'yith-woocommerce-compare' )
|
34 |
-
)
|
35 |
-
),
|
36 |
-
|
37 |
-
array(
|
38 |
-
'name' => __( 'Link/Button text', 'yith-woocommerce-compare' ),
|
39 |
-
'desc' => __( 'Type the text to use for the button or the link of the compare.', 'yith-woocommerce-compare' ),
|
40 |
-
'id' => 'yith_woocompare_button_text',
|
41 |
-
'std' => __( 'Compare', 'yith-woocommerce-compare' ),
|
42 |
-
'default' => __( 'Compare', 'yith-woocommerce-compare' ),
|
43 |
-
'type' => 'text'
|
44 |
-
),
|
45 |
-
|
46 |
-
array(
|
47 |
-
'name' => __( 'Show button in single product page', 'yith-woocommerce-compare' ),
|
48 |
-
'desc' => __( 'Say if you want to show the button in the single product page.', 'yith-woocommerce-compare' ),
|
49 |
-
'id' => 'yith_woocompare_compare_button_in_product_page',
|
50 |
-
'std' => 'yes',
|
51 |
-
'default' => 'yes',
|
52 |
-
'type' => 'checkbox'
|
53 |
-
),
|
54 |
-
|
55 |
-
array(
|
56 |
-
'name' => __( 'Show button in products list', 'yith-woocommerce-compare' ),
|
57 |
-
'desc' => __( 'Say if you want to show the button in the products list.', 'yith-woocommerce-compare' ),
|
58 |
-
'id' => 'yith_woocompare_compare_button_in_products_list',
|
59 |
-
'std' => 'no',
|
60 |
-
'default' => 'no',
|
61 |
-
'type' => 'checkbox'
|
62 |
-
),
|
63 |
-
|
64 |
-
array(
|
65 |
-
'name' => __( 'Open automatically lightbox', 'yith-woocommerce-compare' ),
|
66 |
-
'desc' => __( 'Open link after click into "Compare" button".', 'yith-woocommerce-compare' ),
|
67 |
-
'id' => 'yith_woocompare_auto_open',
|
68 |
-
'std' => 'yes',
|
69 |
-
'default' => 'yes',
|
70 |
-
'type' => 'checkbox'
|
71 |
-
),
|
72 |
-
|
73 |
-
array(
|
74 |
-
'type' => 'sectionend',
|
75 |
-
'id' => 'yith_woocompare_general_end'
|
76 |
-
),
|
77 |
-
|
78 |
-
array(
|
79 |
-
'name' => __( 'Table Settings', 'yith-woocommerce-compare' ),
|
80 |
-
'type' => 'title',
|
81 |
-
'desc' => '',
|
82 |
-
'id' => 'yith_woocompare_table'
|
83 |
-
),
|
84 |
-
|
85 |
-
array(
|
86 |
-
'name' => __( 'Table title', 'yith-woocommerce-compare' ),
|
87 |
-
'desc' => __( 'Type the text to use for the table title.', 'yith-woocommerce-compare' ),
|
88 |
-
'id' => 'yith_woocompare_table_text',
|
89 |
-
'std' => __( 'Compare products', 'yith-woocommerce-compare' ),
|
90 |
-
'default' => __( 'Compare products', 'yith-woocommerce-compare' ),
|
91 |
-
'type' => 'text'
|
92 |
-
),
|
93 |
-
|
94 |
-
array(
|
95 |
-
'name' => __( 'Fields to show', 'yith-woocommerce-compare' ),
|
96 |
-
'desc' => __( 'Select the fields to show in the comparison table and order them by drag&drop (are included also the woocommerce attributes)', 'yith-woocommerce-compare' ),
|
97 |
-
'id' => 'yith_woocompare_fields_attrs',
|
98 |
-
'std' => 'all',
|
99 |
-
'default' => 'all',
|
100 |
-
'type' => 'woocompare_attributes'
|
101 |
-
),
|
102 |
-
|
103 |
-
array(
|
104 |
-
'name' => __( 'Repeat "Price" field', 'yith-woocommerce-compare' ),
|
105 |
-
'desc' => __( 'Repeat the "Price" field at the end of the table', 'yith-woocommerce-compare' ),
|
106 |
-
'id' => 'yith_woocompare_price_end',
|
107 |
-
'std' => 'yes',
|
108 |
-
'default' => 'yes',
|
109 |
-
'type' => 'checkbox'
|
110 |
-
),
|
111 |
-
|
112 |
-
array(
|
113 |
-
'name' => __( 'Repeat "Add to cart" field', 'yith-woocommerce-compare' ),
|
114 |
-
'desc' => __( 'Repeat the "Add to cart" field at the end of the table', 'yith-woocommerce-compare' ),
|
115 |
-
'id' => 'yith_woocompare_add_to_cart_end',
|
116 |
-
'std' => 'no',
|
117 |
-
'default' => 'no',
|
118 |
-
'type' => 'checkbox'
|
119 |
-
),
|
120 |
-
|
121 |
-
array(
|
122 |
-
'name' => __( 'Image size', 'yith-woocommerce-compare' ),
|
123 |
-
'desc' => __( 'Set the size for the images', 'yith-woocommerce-compare' ),
|
124 |
-
'id' => 'yith_woocompare_image_size',
|
125 |
-
'type' => 'woocompare_image_width',
|
126 |
-
'default' => array(
|
127 |
-
'width' => 220,
|
128 |
-
'height' => 154,
|
129 |
-
'crop' => 1
|
130 |
-
),
|
131 |
-
'std' => array(
|
132 |
-
'width' => 220,
|
133 |
-
'height' => 154,
|
134 |
-
'crop' => 1
|
135 |
-
)
|
136 |
-
),
|
137 |
-
|
138 |
-
array(
|
139 |
-
'type' => 'sectionend',
|
140 |
-
'id' => 'yith_woocompare_table_end'
|
141 |
-
)
|
142 |
-
)
|
143 |
-
);
|
144 |
-
|
145 |
-
return apply_filters( 'yith_woocompare_general_settings', $options );
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Main admin class
|
4 |
+
*
|
5 |
+
* @author YITH
|
6 |
+
* @package YITH Woocommerce Compare
|
7 |
+
* @version 1.1.1
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'YITH_WOOCOMPARE' ) ) {
|
11 |
+
exit;
|
12 |
+
} // Exit if accessed directly
|
13 |
+
|
14 |
+
$options = array(
|
15 |
+
'general' => array(
|
16 |
+
array(
|
17 |
+
'name' => __( 'General Settings', 'yith-woocommerce-compare' ),
|
18 |
+
'type' => 'title',
|
19 |
+
'desc' => '',
|
20 |
+
'id' => 'yith_woocompare_general'
|
21 |
+
),
|
22 |
+
|
23 |
+
array(
|
24 |
+
'name' => __( 'Link or Button', 'yith-woocommerce-compare' ),
|
25 |
+
'desc_tip' => __( 'Choose if you want to use a link or a button for the comepare actions.', 'yith-woocommerce-compare' ),
|
26 |
+
'id' => 'yith_woocompare_is_button',
|
27 |
+
'std' => 'button',
|
28 |
+
'default' => 'button',
|
29 |
+
'type' => 'select',
|
30 |
+
'class' => 'wc-enhanced-select',
|
31 |
+
'options' => array(
|
32 |
+
'link' => __( 'Link', 'yith-woocommerce-compare' ),
|
33 |
+
'button' => __( 'Button', 'yith-woocommerce-compare' )
|
34 |
+
)
|
35 |
+
),
|
36 |
+
|
37 |
+
array(
|
38 |
+
'name' => __( 'Link/Button text', 'yith-woocommerce-compare' ),
|
39 |
+
'desc' => __( 'Type the text to use for the button or the link of the compare.', 'yith-woocommerce-compare' ),
|
40 |
+
'id' => 'yith_woocompare_button_text',
|
41 |
+
'std' => __( 'Compare', 'yith-woocommerce-compare' ),
|
42 |
+
'default' => __( 'Compare', 'yith-woocommerce-compare' ),
|
43 |
+
'type' => 'text'
|
44 |
+
),
|
45 |
+
|
46 |
+
array(
|
47 |
+
'name' => __( 'Show button in single product page', 'yith-woocommerce-compare' ),
|
48 |
+
'desc' => __( 'Say if you want to show the button in the single product page.', 'yith-woocommerce-compare' ),
|
49 |
+
'id' => 'yith_woocompare_compare_button_in_product_page',
|
50 |
+
'std' => 'yes',
|
51 |
+
'default' => 'yes',
|
52 |
+
'type' => 'checkbox'
|
53 |
+
),
|
54 |
+
|
55 |
+
array(
|
56 |
+
'name' => __( 'Show button in products list', 'yith-woocommerce-compare' ),
|
57 |
+
'desc' => __( 'Say if you want to show the button in the products list.', 'yith-woocommerce-compare' ),
|
58 |
+
'id' => 'yith_woocompare_compare_button_in_products_list',
|
59 |
+
'std' => 'no',
|
60 |
+
'default' => 'no',
|
61 |
+
'type' => 'checkbox'
|
62 |
+
),
|
63 |
+
|
64 |
+
array(
|
65 |
+
'name' => __( 'Open automatically lightbox', 'yith-woocommerce-compare' ),
|
66 |
+
'desc' => __( 'Open link after click into "Compare" button".', 'yith-woocommerce-compare' ),
|
67 |
+
'id' => 'yith_woocompare_auto_open',
|
68 |
+
'std' => 'yes',
|
69 |
+
'default' => 'yes',
|
70 |
+
'type' => 'checkbox'
|
71 |
+
),
|
72 |
+
|
73 |
+
array(
|
74 |
+
'type' => 'sectionend',
|
75 |
+
'id' => 'yith_woocompare_general_end'
|
76 |
+
),
|
77 |
+
|
78 |
+
array(
|
79 |
+
'name' => __( 'Table Settings', 'yith-woocommerce-compare' ),
|
80 |
+
'type' => 'title',
|
81 |
+
'desc' => '',
|
82 |
+
'id' => 'yith_woocompare_table'
|
83 |
+
),
|
84 |
+
|
85 |
+
array(
|
86 |
+
'name' => __( 'Table title', 'yith-woocommerce-compare' ),
|
87 |
+
'desc' => __( 'Type the text to use for the table title.', 'yith-woocommerce-compare' ),
|
88 |
+
'id' => 'yith_woocompare_table_text',
|
89 |
+
'std' => __( 'Compare products', 'yith-woocommerce-compare' ),
|
90 |
+
'default' => __( 'Compare products', 'yith-woocommerce-compare' ),
|
91 |
+
'type' => 'text'
|
92 |
+
),
|
93 |
+
|
94 |
+
array(
|
95 |
+
'name' => __( 'Fields to show', 'yith-woocommerce-compare' ),
|
96 |
+
'desc' => __( 'Select the fields to show in the comparison table and order them by drag&drop (are included also the woocommerce attributes)', 'yith-woocommerce-compare' ),
|
97 |
+
'id' => 'yith_woocompare_fields_attrs',
|
98 |
+
'std' => 'all',
|
99 |
+
'default' => 'all',
|
100 |
+
'type' => 'woocompare_attributes'
|
101 |
+
),
|
102 |
+
|
103 |
+
array(
|
104 |
+
'name' => __( 'Repeat "Price" field', 'yith-woocommerce-compare' ),
|
105 |
+
'desc' => __( 'Repeat the "Price" field at the end of the table', 'yith-woocommerce-compare' ),
|
106 |
+
'id' => 'yith_woocompare_price_end',
|
107 |
+
'std' => 'yes',
|
108 |
+
'default' => 'yes',
|
109 |
+
'type' => 'checkbox'
|
110 |
+
),
|
111 |
+
|
112 |
+
array(
|
113 |
+
'name' => __( 'Repeat "Add to cart" field', 'yith-woocommerce-compare' ),
|
114 |
+
'desc' => __( 'Repeat the "Add to cart" field at the end of the table', 'yith-woocommerce-compare' ),
|
115 |
+
'id' => 'yith_woocompare_add_to_cart_end',
|
116 |
+
'std' => 'no',
|
117 |
+
'default' => 'no',
|
118 |
+
'type' => 'checkbox'
|
119 |
+
),
|
120 |
+
|
121 |
+
array(
|
122 |
+
'name' => __( 'Image size', 'yith-woocommerce-compare' ),
|
123 |
+
'desc' => __( 'Set the size for the images', 'yith-woocommerce-compare' ),
|
124 |
+
'id' => 'yith_woocompare_image_size',
|
125 |
+
'type' => 'woocompare_image_width',
|
126 |
+
'default' => array(
|
127 |
+
'width' => 220,
|
128 |
+
'height' => 154,
|
129 |
+
'crop' => 1
|
130 |
+
),
|
131 |
+
'std' => array(
|
132 |
+
'width' => 220,
|
133 |
+
'height' => 154,
|
134 |
+
'crop' => 1
|
135 |
+
)
|
136 |
+
),
|
137 |
+
|
138 |
+
array(
|
139 |
+
'type' => 'sectionend',
|
140 |
+
'id' => 'yith_woocompare_table_end'
|
141 |
+
)
|
142 |
+
)
|
143 |
+
);
|
144 |
+
|
145 |
+
return apply_filters( 'yith_woocompare_general_settings', $options );
|
plugin-options/premium-options.php
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Main admin class
|
4 |
-
*
|
5 |
-
* @author YITH
|
6 |
-
* @package YITH Woocommerce Compare
|
7 |
-
* @version 1.1.1
|
8 |
-
*/
|
9 |
-
|
10 |
-
if ( ! defined( 'YITH_WOOCOMPARE' ) ) {
|
11 |
-
exit;
|
12 |
-
} // Exit if accessed directly
|
13 |
-
|
14 |
-
$options = array(
|
15 |
-
'premium' => array(
|
16 |
-
'landing' => array(
|
17 |
-
'type' => 'custom_tab',
|
18 |
-
'action' => 'yith_woocompare_premium'
|
19 |
-
)
|
20 |
-
)
|
21 |
-
);
|
22 |
-
|
23 |
-
return $options;
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Main admin class
|
4 |
+
*
|
5 |
+
* @author YITH
|
6 |
+
* @package YITH Woocommerce Compare
|
7 |
+
* @version 1.1.1
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'YITH_WOOCOMPARE' ) ) {
|
11 |
+
exit;
|
12 |
+
} // Exit if accessed directly
|
13 |
+
|
14 |
+
$options = array(
|
15 |
+
'premium' => array(
|
16 |
+
'landing' => array(
|
17 |
+
'type' => 'custom_tab',
|
18 |
+
'action' => 'yith_woocompare_premium'
|
19 |
+
)
|
20 |
+
)
|
21 |
+
);
|
22 |
+
|
23 |
+
return $options;
|
templates/admin/premium.php
CHANGED
@@ -1,455 +1,455 @@
|
|
1 |
-
<style>
|
2 |
-
.section{
|
3 |
-
margin-left: -20px;
|
4 |
-
margin-right: -20px;
|
5 |
-
font-family: "Raleway",san-serif;
|
6 |
-
}
|
7 |
-
.section h1{
|
8 |
-
text-align: center;
|
9 |
-
text-transform: uppercase;
|
10 |
-
color: #808a97;
|
11 |
-
font-size: 35px;
|
12 |
-
font-weight: 700;
|
13 |
-
line-height: normal;
|
14 |
-
display: inline-block;
|
15 |
-
width: 100%;
|
16 |
-
margin: 50px 0 0;
|
17 |
-
}
|
18 |
-
.section ul{
|
19 |
-
list-style-type: disc;
|
20 |
-
padding-left: 15px;
|
21 |
-
}
|
22 |
-
.section:nth-child(even){
|
23 |
-
background-color: #fff;
|
24 |
-
}
|
25 |
-
.section:nth-child(odd){
|
26 |
-
background-color: #f1f1f1;
|
27 |
-
}
|
28 |
-
.section .section-title img{
|
29 |
-
display: table-cell;
|
30 |
-
vertical-align: middle;
|
31 |
-
width: auto;
|
32 |
-
margin-right: 15px;
|
33 |
-
}
|
34 |
-
.section h2,
|
35 |
-
.section h3 {
|
36 |
-
display: inline-block;
|
37 |
-
vertical-align: middle;
|
38 |
-
padding: 0;
|
39 |
-
font-size: 24px;
|
40 |
-
font-weight: 700;
|
41 |
-
color: #808a97;
|
42 |
-
text-transform: uppercase;
|
43 |
-
}
|
44 |
-
|
45 |
-
.section .section-title h2{
|
46 |
-
display: table-cell;
|
47 |
-
vertical-align: middle;
|
48 |
-
line-height: 25px;
|
49 |
-
}
|
50 |
-
|
51 |
-
.section-title{
|
52 |
-
display: table;
|
53 |
-
}
|
54 |
-
|
55 |
-
.section h3 {
|
56 |
-
font-size: 14px;
|
57 |
-
line-height: 28px;
|
58 |
-
margin-bottom: 0;
|
59 |
-
display: block;
|
60 |
-
}
|
61 |
-
|
62 |
-
.section p{
|
63 |
-
font-size: 13px;
|
64 |
-
margin: 25px 0;
|
65 |
-
}
|
66 |
-
.section ul li{
|
67 |
-
margin-bottom: 4px;
|
68 |
-
}
|
69 |
-
.landing-container{
|
70 |
-
max-width: 750px;
|
71 |
-
margin-left: auto;
|
72 |
-
margin-right: auto;
|
73 |
-
padding: 50px 0 30px;
|
74 |
-
}
|
75 |
-
.landing-container:after{
|
76 |
-
display: block;
|
77 |
-
clear: both;
|
78 |
-
content: '';
|
79 |
-
}
|
80 |
-
.landing-container .col-1,
|
81 |
-
.landing-container .col-2{
|
82 |
-
float: left;
|
83 |
-
box-sizing: border-box;
|
84 |
-
padding: 0 15px;
|
85 |
-
}
|
86 |
-
.landing-container .col-1 img{
|
87 |
-
width: 100%;
|
88 |
-
}
|
89 |
-
.landing-container .col-1{
|
90 |
-
width: 55%;
|
91 |
-
}
|
92 |
-
.landing-container .col-2{
|
93 |
-
width: 45%;
|
94 |
-
}
|
95 |
-
.premium-cta{
|
96 |
-
background-color: #808a97;
|
97 |
-
color: #fff;
|
98 |
-
border-radius: 6px;
|
99 |
-
padding: 20px 15px;
|
100 |
-
}
|
101 |
-
.premium-cta:after{
|
102 |
-
content: '';
|
103 |
-
display: block;
|
104 |
-
clear: both;
|
105 |
-
}
|
106 |
-
.premium-cta p{
|
107 |
-
margin: 7px 0;
|
108 |
-
font-size: 14px;
|
109 |
-
font-weight: 500;
|
110 |
-
display: inline-block;
|
111 |
-
width: 60%;
|
112 |
-
}
|
113 |
-
.premium-cta a.button{
|
114 |
-
border-radius: 6px;
|
115 |
-
height: 60px;
|
116 |
-
float: right;
|
117 |
-
background: url(<?php echo YITH_WOOCOMPARE_URL?>assets/images/upgrade.png) #ff643f no-repeat 13px 13px;
|
118 |
-
border-color: #ff643f;
|
119 |
-
box-shadow: none;
|
120 |
-
outline: none;
|
121 |
-
color: #fff;
|
122 |
-
position: relative;
|
123 |
-
padding: 9px 50px 9px 70px;
|
124 |
-
}
|
125 |
-
.premium-cta a.button:hover,
|
126 |
-
.premium-cta a.button:active,
|
127 |
-
.premium-cta a.button:focus{
|
128 |
-
color: #fff;
|
129 |
-
background: url(<?php echo YITH_WOOCOMPARE_URL?>assets/images/upgrade.png) #971d00 no-repeat 13px 13px;
|
130 |
-
border-color: #971d00;
|
131 |
-
box-shadow: none;
|
132 |
-
outline: none;
|
133 |
-
}
|
134 |
-
.premium-cta a.button:focus{
|
135 |
-
top: 1px;
|
136 |
-
}
|
137 |
-
.premium-cta a.button span{
|
138 |
-
line-height: 13px;
|
139 |
-
}
|
140 |
-
.premium-cta a.button .highlight{
|
141 |
-
display: block;
|
142 |
-
font-size: 20px;
|
143 |
-
font-weight: 700;
|
144 |
-
line-height: 20px;
|
145 |
-
}
|
146 |
-
.premium-cta .highlight{
|
147 |
-
text-transform: uppercase;
|
148 |
-
background: none;
|
149 |
-
font-weight: 800;
|
150 |
-
color: #fff;
|
151 |
-
}
|
152 |
-
|
153 |
-
.section.one{
|
154 |
-
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/01-bg.png) no-repeat #fff; background-position: 85% 75%
|
155 |
-
}
|
156 |
-
.section.two{
|
157 |
-
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/02-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
|
158 |
-
}
|
159 |
-
.section.three{
|
160 |
-
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/03-bg.png) no-repeat #fff; background-position: 85% 75%
|
161 |
-
}
|
162 |
-
.section.four{
|
163 |
-
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/04-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
|
164 |
-
}
|
165 |
-
.section.five{
|
166 |
-
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/05-bg.png) no-repeat #fff; background-position: 85% 75%
|
167 |
-
}
|
168 |
-
.section.six{
|
169 |
-
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/06-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
|
170 |
-
}
|
171 |
-
.section.seven{
|
172 |
-
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/07-bg.png) no-repeat #fff; background-position: 85% 75%
|
173 |
-
}
|
174 |
-
.section.eight{
|
175 |
-
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/08-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
|
176 |
-
}
|
177 |
-
.section.nine{
|
178 |
-
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/09-bg.png) no-repeat #fff; background-position: 15% 75%
|
179 |
-
}
|
180 |
-
.section.ten{
|
181 |
-
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/10-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
|
182 |
-
}
|
183 |
-
.section.eleven{
|
184 |
-
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/11-bg.png) no-repeat #fff; background-position: 85% 75%
|
185 |
-
}
|
186 |
-
.section.twelve{
|
187 |
-
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/12-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
|
188 |
-
}
|
189 |
-
|
190 |
-
@media (max-width: 768px) {
|
191 |
-
.section{margin: 0}
|
192 |
-
.premium-cta p{
|
193 |
-
width: 100%;
|
194 |
-
}
|
195 |
-
.premium-cta{
|
196 |
-
text-align: center;
|
197 |
-
}
|
198 |
-
.premium-cta a.button{
|
199 |
-
float: none;
|
200 |
-
}
|
201 |
-
}
|
202 |
-
|
203 |
-
@media (max-width: 480px){
|
204 |
-
.wrap{
|
205 |
-
margin-right: 0;
|
206 |
-
}
|
207 |
-
.section{
|
208 |
-
margin: 0;
|
209 |
-
}
|
210 |
-
.landing-container .col-1,
|
211 |
-
.landing-container .col-2{
|
212 |
-
width: 100%;
|
213 |
-
padding: 0 15px;
|
214 |
-
}
|
215 |
-
.section-odd .col-1 {
|
216 |
-
float: left;
|
217 |
-
margin-right: -100%;
|
218 |
-
}
|
219 |
-
.section-odd .col-2 {
|
220 |
-
float: right;
|
221 |
-
margin-top: 65%;
|
222 |
-
}
|
223 |
-
}
|
224 |
-
|
225 |
-
@media (max-width: 320px){
|
226 |
-
.premium-cta a.button{
|
227 |
-
padding: 9px 20px 9px 70px;
|
228 |
-
}
|
229 |
-
|
230 |
-
.section .section-title img{
|
231 |
-
display: none;
|
232 |
-
}
|
233 |
-
}
|
234 |
-
</style>
|
235 |
-
<div class="landing">
|
236 |
-
<div class="section section-cta section-odd">
|
237 |
-
<div class="landing-container">
|
238 |
-
<div class="premium-cta">
|
239 |
-
<p>
|
240 |
-
<?php echo sprintf( __('Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Compare%2$s to benefit from all features!','yith-woocommerce-compare' ),'<span class="highlight">','</span>' );?>
|
241 |
-
</p>
|
242 |
-
<a href="<?php echo $this->get_premium_landing_uri() ?>" target="_blank" class="premium-cta-button button btn">
|
243 |
-
<span class="highlight"><?php _e('UPGRADE','yith-woocommerce-compare' ); ?></span>
|
244 |
-
<span><?php _e('to the premium version','yith-woocommerce-compare' ); ?></span>
|
245 |
-
</a>
|
246 |
-
</div>
|
247 |
-
</div>
|
248 |
-
</div>
|
249 |
-
<div class="one section section-even clear">
|
250 |
-
<h1><?php _e('Premium Features','yith-woocommerce-compare');?></h1>
|
251 |
-
<div class="landing-container">
|
252 |
-
<div class="col-1">
|
253 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/01.png" alt="Dedicated Page" />
|
254 |
-
</div>
|
255 |
-
<div class="col-2">
|
256 |
-
<div class="section-title">
|
257 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/01-icon.png" alt="icon 01"/>
|
258 |
-
<h2><?php _e('A DEDICATED PAGE','yith-woocommerce-compare' ); ?></h2>
|
259 |
-
</div>
|
260 |
-
<p>
|
261 |
-
<?php echo sprintf(__('Don\'t you want to compare your products in a modal window anymore?%3$sWith the premium version of %1$sYITH WooCommerce Compare%2$s, a new page will be created automatically in your site and, adding it among the menu entries, you will be able to give to your users the chance to access it easily whenever they want.', 'yith-woocommerce-compare'), '<b>', '</b>','<br>');?>
|
262 |
-
</p>
|
263 |
-
</div>
|
264 |
-
</div>
|
265 |
-
</div>
|
266 |
-
<div class="two section section-odd clear">
|
267 |
-
<div class="landing-container">
|
268 |
-
<div class="col-2">
|
269 |
-
<div class="section-title">
|
270 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/02-icon.png" alt="icon 02" />
|
271 |
-
<h2><?php _e('CATEGORY COMPARATION','yith-woocommerce-compare');?></h2>
|
272 |
-
</div>
|
273 |
-
<p>
|
274 |
-
<?php echo sprintf( __( 'People are often confused by finding products of different categories in the comparison table, creating difficulties in comparing the products they are interested into.The %1$s"Compare by category"%2$s option exists for this need: you will be able to separate the products in the table by category affinity.', 'yith-woocommerce-compare'), '<b>', '</b>');?>
|
275 |
-
</p>
|
276 |
-
</div>
|
277 |
-
<div class="col-1">
|
278 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/02.png" alt="CATEGORY COMPARATION" />
|
279 |
-
</div>
|
280 |
-
</div>
|
281 |
-
</div>
|
282 |
-
<div class="three section section-even clear">
|
283 |
-
<div class="landing-container">
|
284 |
-
<div class="col-1">
|
285 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/03.png" alt="Category esclusion" />
|
286 |
-
</div>
|
287 |
-
<div class="col-2">
|
288 |
-
<div class="section-title">
|
289 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/03-icon.png" alt="icon 03" />
|
290 |
-
<h2><?php _e( 'CATEGORY EXCLUSION ','yith-woocommerce-compare');?></h2>
|
291 |
-
</div>
|
292 |
-
<p>
|
293 |
-
<?php echo sprintf(__('In your shop there may be product categories you don\'t want to be affected by the plugin features, deleting the comparison button for them. The premium version of the plugin offers this too.%3$sAnd there\'s more! Activating the %1$s"Reverse exclusion list"%2$s option, you can also invert the behavior of the feature, allowing the comparison only to those products of the selected categories.', 'yith-woocommerce-compare' ), '<b>', '</b>','<br>');?>
|
294 |
-
</p>
|
295 |
-
</div>
|
296 |
-
</div>
|
297 |
-
</div>
|
298 |
-
<div class="four section section-odd clear">
|
299 |
-
<div class="landing-container">
|
300 |
-
<div class="col-2">
|
301 |
-
<div class="section-title">
|
302 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/04-icon.png" alt="icon 04" />
|
303 |
-
<h2><?php _e('TABLE IMAGE','yith-woocommerce-compare');?></h2>
|
304 |
-
</div>
|
305 |
-
<p>
|
306 |
-
<?php echo sprintf(__('Give a personal touch to the %1$scomparison table%2$s your users will see. Select an image, upload it from the option panel and show it ahead of the table to your users. ', 'yith-woocommerce-compare'), '<b>', '</b>');?>
|
307 |
-
</p>
|
308 |
-
</div>
|
309 |
-
<div class="col-1">
|
310 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/04.png" alt="Shortcode" />
|
311 |
-
</div>
|
312 |
-
</div>
|
313 |
-
</div>
|
314 |
-
<div class="five section section-even clear">
|
315 |
-
<div class="landing-container">
|
316 |
-
<div class="col-1">
|
317 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/05.png" alt="Dynamic fields" />
|
318 |
-
</div>
|
319 |
-
<div class="col-2">
|
320 |
-
<div class="section-title">
|
321 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL?>assets/images/05-icon.png" alt="icon 05" />
|
322 |
-
<h2><?php _e('DYNAMIC FIELDS','yith-woocommerce-compare');?></h2>
|
323 |
-
</div>
|
324 |
-
<p>
|
325 |
-
<?php echo sprintf( __('With this precious feature, you will be able to show in the table only the fields that have information in at least one of the selected products.%3$sActivate the %1$s"Dynamic Attribute fields"%2$s option and there will be no more empty lines in your comparison table.','yith-woocommerce-compare'),'<b>','</b>','<br>'); ?>
|
326 |
-
</p>
|
327 |
-
</div>
|
328 |
-
</div>
|
329 |
-
</div>
|
330 |
-
<div class="six section section-odd clear">
|
331 |
-
<div class="landing-container">
|
332 |
-
<div class="col-2">
|
333 |
-
<div class="section-title">
|
334 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/06-icon.png" alt="icon 06" />
|
335 |
-
<h2><?php _e('SOCIAL NETWORK SHARING','yith-woocommerce-compare');?></h2>
|
336 |
-
</div>
|
337 |
-
<p>
|
338 |
-
<?php echo sprintf( __( 'One of the most appealing features of the premium version of the plugin.Four social network sites for your users (Facebook, Twitter, Google + and Pinterest) and the email system %1$sto share%2$s the comparison table of the products they have selected.','yith-woocommerce-compare' ),'<b>','</b>' ) ?>
|
339 |
-
</p>
|
340 |
-
</div>
|
341 |
-
<div class="col-1">
|
342 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/06.png" alt="Social networks" />
|
343 |
-
</div>
|
344 |
-
</div>
|
345 |
-
</div>
|
346 |
-
<div class="seven section section-even clear">
|
347 |
-
<div class="landing-container">
|
348 |
-
<div class="col-1">
|
349 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/07.png" alt="Related products" />
|
350 |
-
</div>
|
351 |
-
<div class="col-2">
|
352 |
-
<div class="section-title">
|
353 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL?>assets/images/07-icon.png" alt="icon 05" />
|
354 |
-
<h2><?php _e('RELATED PRODUCTS','yith-woocommerce-compare');?></h2>
|
355 |
-
</div>
|
356 |
-
<p>
|
357 |
-
<?php echo sprintf( __('All the products that have common categories and/or tags with those in the comparison table will be showed in a slider, right under the comparison table.%3$sA completely %1$s"touch friendly"%2$s slider to encourage your users to discover the shop products of the shop related to those they are interested into.','yith-woocommerce-compare'),'<b>','</b>','<br>'); ?>
|
358 |
-
</p>
|
359 |
-
</div>
|
360 |
-
</div>
|
361 |
-
</div>
|
362 |
-
<div class="eight section section-odd clear">
|
363 |
-
<div class="landing-container">
|
364 |
-
<div class="col-2">
|
365 |
-
<div class="section-title">
|
366 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/08-icon.png" alt="icon 06" />
|
367 |
-
<h2><?php _e('CUSTOMIZABLE STYLE','yith-woocommerce-compare');?></h2>
|
368 |
-
</div>
|
369 |
-
<p>
|
370 |
-
<?php echo sprintf( __( 'An advanced option panel that let you change all the colors of the plugin, so that you can adapt stylistically all its elements %1$sto the layout%2$s of your shop.We know it, looks also count... and we give you the right tools to get to the best result.','yith-woocommerce-compare' ),'<b>','</b>' ) ?>
|
371 |
-
</p>
|
372 |
-
</div>
|
373 |
-
<div class="col-1">
|
374 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/08.png" alt="Social networks" />
|
375 |
-
</div>
|
376 |
-
</div>
|
377 |
-
</div>
|
378 |
-
<div class="nine section section-even clear">
|
379 |
-
<div class="landing-container">
|
380 |
-
<div class="col-1">
|
381 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/09.png" alt="Related products" />
|
382 |
-
</div>
|
383 |
-
<div class="col-2">
|
384 |
-
<div class="section-title">
|
385 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL?>assets/images/09-icon.png" alt="icon 09" />
|
386 |
-
<h2><?php _e('CUSTOMIZED ATTRIBUTES','yith-woocommerce-compare');?></h2>
|
387 |
-
</div>
|
388 |
-
<p>
|
389 |
-
<?php echo sprintf( __('Let you users compare products following every feature, and considering also all those %1$sattributes%2$s that can be manually created in within the product detail page. Every single detail will be included.','yith-woocommerce-compare'),'<b>','</b>'); ?>
|
390 |
-
</p>
|
391 |
-
</div>
|
392 |
-
</div>
|
393 |
-
</div>
|
394 |
-
<div class="ten section section-odd clear">
|
395 |
-
<div class="landing-container">
|
396 |
-
<div class="col-2">
|
397 |
-
<div class="section-title">
|
398 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/10-icon.png" alt="icon 10" />
|
399 |
-
<h2><?php _e('A TAILORED TABLE','yith-woocommerce-compare');?></h2>
|
400 |
-
</div>
|
401 |
-
<p>
|
402 |
-
<?php echo sprintf( __( 'Select the products you want to compare and the system will offer you the %1$sshortcode%2$s to generate a comparing table. Simple, rapid and useful.','yith-woocommerce-compare' ),'<b>','</b>' ) ?>
|
403 |
-
</p>
|
404 |
-
</div>
|
405 |
-
<div class="col-1">
|
406 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/10.png" alt="Social networks" />
|
407 |
-
</div>
|
408 |
-
</div>
|
409 |
-
</div>
|
410 |
-
<div class="eleven section section-even clear">
|
411 |
-
<div class="landing-container">
|
412 |
-
<div class="col-1">
|
413 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/11.png" alt="Widget" />
|
414 |
-
</div>
|
415 |
-
<div class="col-2">
|
416 |
-
<div class="section-title">
|
417 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL?>assets/images/11-icon.png" alt="icon 11" />
|
418 |
-
<h2><?php _e('Compare list - widget','yith-woocommerce-compare');?></h2>
|
419 |
-
</div>
|
420 |
-
<p>
|
421 |
-
<?php echo sprintf( __('Thanks to YITH WooCommerce Comapre Widget users could verify at any time the complete list of products added to the compare tab and avoid to open the popup to check its existence. ','yith-woocommerce-compare'),'<b>','</b>'); ?>
|
422 |
-
</p>
|
423 |
-
</div>
|
424 |
-
</div>
|
425 |
-
</div>
|
426 |
-
<div class="twelve section section-odd clear">
|
427 |
-
<div class="landing-container">
|
428 |
-
<div class="col-2">
|
429 |
-
<div class="section-title">
|
430 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/12-icon.png" alt="icon 12" />
|
431 |
-
<h2><?php _e('Compare counter - widget and shortcode','yith-woocommerce-compare');?></h2>
|
432 |
-
</div>
|
433 |
-
<p>
|
434 |
-
<?php echo sprintf( __( 'Moreover, if you want to give your users the chance to see in a glance how many products they have added to the Compare list, feel free to use the widget or the shortcode included. And their Compare list is always no more than one click away.','yith-woocommerce-compare' ),'<b>','</b>' ) ?>
|
435 |
-
</p>
|
436 |
-
</div>
|
437 |
-
<div class="col-1">
|
438 |
-
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/12.png" alt="Social networks" />
|
439 |
-
</div>
|
440 |
-
</div>
|
441 |
-
</div>
|
442 |
-
<div class="section section-cta section-odd">
|
443 |
-
<div class="landing-container">
|
444 |
-
<div class="premium-cta">
|
445 |
-
<p>
|
446 |
-
<?php echo sprintf( __('Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Compare%2$s to benefit from all features!','yith-woocommerce-compare'),'<span class="highlight">','</span>' );?>
|
447 |
-
</p>
|
448 |
-
<a href="<?php echo $this->get_premium_landing_uri() ?>" target="_blank" class="premium-cta-button button btn">
|
449 |
-
<span class="highlight"><?php _e('UPGRADE','yith-woocommerce-compare');?></span>
|
450 |
-
<span><?php _e('to the premium version','yith-woocommerce-compare');?></span>
|
451 |
-
</a>
|
452 |
-
</div>
|
453 |
-
</div>
|
454 |
-
</div>
|
455 |
</div>
|
1 |
+
<style>
|
2 |
+
.section{
|
3 |
+
margin-left: -20px;
|
4 |
+
margin-right: -20px;
|
5 |
+
font-family: "Raleway",san-serif;
|
6 |
+
}
|
7 |
+
.section h1{
|
8 |
+
text-align: center;
|
9 |
+
text-transform: uppercase;
|
10 |
+
color: #808a97;
|
11 |
+
font-size: 35px;
|
12 |
+
font-weight: 700;
|
13 |
+
line-height: normal;
|
14 |
+
display: inline-block;
|
15 |
+
width: 100%;
|
16 |
+
margin: 50px 0 0;
|
17 |
+
}
|
18 |
+
.section ul{
|
19 |
+
list-style-type: disc;
|
20 |
+
padding-left: 15px;
|
21 |
+
}
|
22 |
+
.section:nth-child(even){
|
23 |
+
background-color: #fff;
|
24 |
+
}
|
25 |
+
.section:nth-child(odd){
|
26 |
+
background-color: #f1f1f1;
|
27 |
+
}
|
28 |
+
.section .section-title img{
|
29 |
+
display: table-cell;
|
30 |
+
vertical-align: middle;
|
31 |
+
width: auto;
|
32 |
+
margin-right: 15px;
|
33 |
+
}
|
34 |
+
.section h2,
|
35 |
+
.section h3 {
|
36 |
+
display: inline-block;
|
37 |
+
vertical-align: middle;
|
38 |
+
padding: 0;
|
39 |
+
font-size: 24px;
|
40 |
+
font-weight: 700;
|
41 |
+
color: #808a97;
|
42 |
+
text-transform: uppercase;
|
43 |
+
}
|
44 |
+
|
45 |
+
.section .section-title h2{
|
46 |
+
display: table-cell;
|
47 |
+
vertical-align: middle;
|
48 |
+
line-height: 25px;
|
49 |
+
}
|
50 |
+
|
51 |
+
.section-title{
|
52 |
+
display: table;
|
53 |
+
}
|
54 |
+
|
55 |
+
.section h3 {
|
56 |
+
font-size: 14px;
|
57 |
+
line-height: 28px;
|
58 |
+
margin-bottom: 0;
|
59 |
+
display: block;
|
60 |
+
}
|
61 |
+
|
62 |
+
.section p{
|
63 |
+
font-size: 13px;
|
64 |
+
margin: 25px 0;
|
65 |
+
}
|
66 |
+
.section ul li{
|
67 |
+
margin-bottom: 4px;
|
68 |
+
}
|
69 |
+
.landing-container{
|
70 |
+
max-width: 750px;
|
71 |
+
margin-left: auto;
|
72 |
+
margin-right: auto;
|
73 |
+
padding: 50px 0 30px;
|
74 |
+
}
|
75 |
+
.landing-container:after{
|
76 |
+
display: block;
|
77 |
+
clear: both;
|
78 |
+
content: '';
|
79 |
+
}
|
80 |
+
.landing-container .col-1,
|
81 |
+
.landing-container .col-2{
|
82 |
+
float: left;
|
83 |
+
box-sizing: border-box;
|
84 |
+
padding: 0 15px;
|
85 |
+
}
|
86 |
+
.landing-container .col-1 img{
|
87 |
+
width: 100%;
|
88 |
+
}
|
89 |
+
.landing-container .col-1{
|
90 |
+
width: 55%;
|
91 |
+
}
|
92 |
+
.landing-container .col-2{
|
93 |
+
width: 45%;
|
94 |
+
}
|
95 |
+
.premium-cta{
|
96 |
+
background-color: #808a97;
|
97 |
+
color: #fff;
|
98 |
+
border-radius: 6px;
|
99 |
+
padding: 20px 15px;
|
100 |
+
}
|
101 |
+
.premium-cta:after{
|
102 |
+
content: '';
|
103 |
+
display: block;
|
104 |
+
clear: both;
|
105 |
+
}
|
106 |
+
.premium-cta p{
|
107 |
+
margin: 7px 0;
|
108 |
+
font-size: 14px;
|
109 |
+
font-weight: 500;
|
110 |
+
display: inline-block;
|
111 |
+
width: 60%;
|
112 |
+
}
|
113 |
+
.premium-cta a.button{
|
114 |
+
border-radius: 6px;
|
115 |
+
height: 60px;
|
116 |
+
float: right;
|
117 |
+
background: url(<?php echo YITH_WOOCOMPARE_URL?>assets/images/upgrade.png) #ff643f no-repeat 13px 13px;
|
118 |
+
border-color: #ff643f;
|
119 |
+
box-shadow: none;
|
120 |
+
outline: none;
|
121 |
+
color: #fff;
|
122 |
+
position: relative;
|
123 |
+
padding: 9px 50px 9px 70px;
|
124 |
+
}
|
125 |
+
.premium-cta a.button:hover,
|
126 |
+
.premium-cta a.button:active,
|
127 |
+
.premium-cta a.button:focus{
|
128 |
+
color: #fff;
|
129 |
+
background: url(<?php echo YITH_WOOCOMPARE_URL?>assets/images/upgrade.png) #971d00 no-repeat 13px 13px;
|
130 |
+
border-color: #971d00;
|
131 |
+
box-shadow: none;
|
132 |
+
outline: none;
|
133 |
+
}
|
134 |
+
.premium-cta a.button:focus{
|
135 |
+
top: 1px;
|
136 |
+
}
|
137 |
+
.premium-cta a.button span{
|
138 |
+
line-height: 13px;
|
139 |
+
}
|
140 |
+
.premium-cta a.button .highlight{
|
141 |
+
display: block;
|
142 |
+
font-size: 20px;
|
143 |
+
font-weight: 700;
|
144 |
+
line-height: 20px;
|
145 |
+
}
|
146 |
+
.premium-cta .highlight{
|
147 |
+
text-transform: uppercase;
|
148 |
+
background: none;
|
149 |
+
font-weight: 800;
|
150 |
+
color: #fff;
|
151 |
+
}
|
152 |
+
|
153 |
+
.section.one{
|
154 |
+
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/01-bg.png) no-repeat #fff; background-position: 85% 75%
|
155 |
+
}
|
156 |
+
.section.two{
|
157 |
+
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/02-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
|
158 |
+
}
|
159 |
+
.section.three{
|
160 |
+
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/03-bg.png) no-repeat #fff; background-position: 85% 75%
|
161 |
+
}
|
162 |
+
.section.four{
|
163 |
+
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/04-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
|
164 |
+
}
|
165 |
+
.section.five{
|
166 |
+
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/05-bg.png) no-repeat #fff; background-position: 85% 75%
|
167 |
+
}
|
168 |
+
.section.six{
|
169 |
+
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/06-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
|
170 |
+
}
|
171 |
+
.section.seven{
|
172 |
+
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/07-bg.png) no-repeat #fff; background-position: 85% 75%
|
173 |
+
}
|
174 |
+
.section.eight{
|
175 |
+
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/08-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
|
176 |
+
}
|
177 |
+
.section.nine{
|
178 |
+
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/09-bg.png) no-repeat #fff; background-position: 15% 75%
|
179 |
+
}
|
180 |
+
.section.ten{
|
181 |
+
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/10-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
|
182 |
+
}
|
183 |
+
.section.eleven{
|
184 |
+
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/11-bg.png) no-repeat #fff; background-position: 85% 75%
|
185 |
+
}
|
186 |
+
.section.twelve{
|
187 |
+
background: url(<?php echo YITH_WOOCOMPARE_URL ?>assets/images/12-bg.png) no-repeat #f1f1f1; background-position: 15% 75%
|
188 |
+
}
|
189 |
+
|
190 |
+
@media (max-width: 768px) {
|
191 |
+
.section{margin: 0}
|
192 |
+
.premium-cta p{
|
193 |
+
width: 100%;
|
194 |
+
}
|
195 |
+
.premium-cta{
|
196 |
+
text-align: center;
|
197 |
+
}
|
198 |
+
.premium-cta a.button{
|
199 |
+
float: none;
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
@media (max-width: 480px){
|
204 |
+
.wrap{
|
205 |
+
margin-right: 0;
|
206 |
+
}
|
207 |
+
.section{
|
208 |
+
margin: 0;
|
209 |
+
}
|
210 |
+
.landing-container .col-1,
|
211 |
+
.landing-container .col-2{
|
212 |
+
width: 100%;
|
213 |
+
padding: 0 15px;
|
214 |
+
}
|
215 |
+
.section-odd .col-1 {
|
216 |
+
float: left;
|
217 |
+
margin-right: -100%;
|
218 |
+
}
|
219 |
+
.section-odd .col-2 {
|
220 |
+
float: right;
|
221 |
+
margin-top: 65%;
|
222 |
+
}
|
223 |
+
}
|
224 |
+
|
225 |
+
@media (max-width: 320px){
|
226 |
+
.premium-cta a.button{
|
227 |
+
padding: 9px 20px 9px 70px;
|
228 |
+
}
|
229 |
+
|
230 |
+
.section .section-title img{
|
231 |
+
display: none;
|
232 |
+
}
|
233 |
+
}
|
234 |
+
</style>
|
235 |
+
<div class="landing">
|
236 |
+
<div class="section section-cta section-odd">
|
237 |
+
<div class="landing-container">
|
238 |
+
<div class="premium-cta">
|
239 |
+
<p>
|
240 |
+
<?php echo sprintf( __('Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Compare%2$s to benefit from all features!','yith-woocommerce-compare' ),'<span class="highlight">','</span>' );?>
|
241 |
+
</p>
|
242 |
+
<a href="<?php echo $this->get_premium_landing_uri() ?>" target="_blank" class="premium-cta-button button btn">
|
243 |
+
<span class="highlight"><?php _e('UPGRADE','yith-woocommerce-compare' ); ?></span>
|
244 |
+
<span><?php _e('to the premium version','yith-woocommerce-compare' ); ?></span>
|
245 |
+
</a>
|
246 |
+
</div>
|
247 |
+
</div>
|
248 |
+
</div>
|
249 |
+
<div class="one section section-even clear">
|
250 |
+
<h1><?php _e('Premium Features','yith-woocommerce-compare');?></h1>
|
251 |
+
<div class="landing-container">
|
252 |
+
<div class="col-1">
|
253 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/01.png" alt="Dedicated Page" />
|
254 |
+
</div>
|
255 |
+
<div class="col-2">
|
256 |
+
<div class="section-title">
|
257 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/01-icon.png" alt="icon 01"/>
|
258 |
+
<h2><?php _e('A DEDICATED PAGE','yith-woocommerce-compare' ); ?></h2>
|
259 |
+
</div>
|
260 |
+
<p>
|
261 |
+
<?php echo sprintf(__('Don\'t you want to compare your products in a modal window anymore?%3$sWith the premium version of %1$sYITH WooCommerce Compare%2$s, a new page will be created automatically in your site and, adding it among the menu entries, you will be able to give to your users the chance to access it easily whenever they want.', 'yith-woocommerce-compare'), '<b>', '</b>','<br>');?>
|
262 |
+
</p>
|
263 |
+
</div>
|
264 |
+
</div>
|
265 |
+
</div>
|
266 |
+
<div class="two section section-odd clear">
|
267 |
+
<div class="landing-container">
|
268 |
+
<div class="col-2">
|
269 |
+
<div class="section-title">
|
270 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/02-icon.png" alt="icon 02" />
|
271 |
+
<h2><?php _e('CATEGORY COMPARATION','yith-woocommerce-compare');?></h2>
|
272 |
+
</div>
|
273 |
+
<p>
|
274 |
+
<?php echo sprintf( __( 'People are often confused by finding products of different categories in the comparison table, creating difficulties in comparing the products they are interested into.The %1$s"Compare by category"%2$s option exists for this need: you will be able to separate the products in the table by category affinity.', 'yith-woocommerce-compare'), '<b>', '</b>');?>
|
275 |
+
</p>
|
276 |
+
</div>
|
277 |
+
<div class="col-1">
|
278 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/02.png" alt="CATEGORY COMPARATION" />
|
279 |
+
</div>
|
280 |
+
</div>
|
281 |
+
</div>
|
282 |
+
<div class="three section section-even clear">
|
283 |
+
<div class="landing-container">
|
284 |
+
<div class="col-1">
|
285 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/03.png" alt="Category esclusion" />
|
286 |
+
</div>
|
287 |
+
<div class="col-2">
|
288 |
+
<div class="section-title">
|
289 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/03-icon.png" alt="icon 03" />
|
290 |
+
<h2><?php _e( 'CATEGORY EXCLUSION ','yith-woocommerce-compare');?></h2>
|
291 |
+
</div>
|
292 |
+
<p>
|
293 |
+
<?php echo sprintf(__('In your shop there may be product categories you don\'t want to be affected by the plugin features, deleting the comparison button for them. The premium version of the plugin offers this too.%3$sAnd there\'s more! Activating the %1$s"Reverse exclusion list"%2$s option, you can also invert the behavior of the feature, allowing the comparison only to those products of the selected categories.', 'yith-woocommerce-compare' ), '<b>', '</b>','<br>');?>
|
294 |
+
</p>
|
295 |
+
</div>
|
296 |
+
</div>
|
297 |
+
</div>
|
298 |
+
<div class="four section section-odd clear">
|
299 |
+
<div class="landing-container">
|
300 |
+
<div class="col-2">
|
301 |
+
<div class="section-title">
|
302 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/04-icon.png" alt="icon 04" />
|
303 |
+
<h2><?php _e('TABLE IMAGE','yith-woocommerce-compare');?></h2>
|
304 |
+
</div>
|
305 |
+
<p>
|
306 |
+
<?php echo sprintf(__('Give a personal touch to the %1$scomparison table%2$s your users will see. Select an image, upload it from the option panel and show it ahead of the table to your users. ', 'yith-woocommerce-compare'), '<b>', '</b>');?>
|
307 |
+
</p>
|
308 |
+
</div>
|
309 |
+
<div class="col-1">
|
310 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/04.png" alt="Shortcode" />
|
311 |
+
</div>
|
312 |
+
</div>
|
313 |
+
</div>
|
314 |
+
<div class="five section section-even clear">
|
315 |
+
<div class="landing-container">
|
316 |
+
<div class="col-1">
|
317 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/05.png" alt="Dynamic fields" />
|
318 |
+
</div>
|
319 |
+
<div class="col-2">
|
320 |
+
<div class="section-title">
|
321 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL?>assets/images/05-icon.png" alt="icon 05" />
|
322 |
+
<h2><?php _e('DYNAMIC FIELDS','yith-woocommerce-compare');?></h2>
|
323 |
+
</div>
|
324 |
+
<p>
|
325 |
+
<?php echo sprintf( __('With this precious feature, you will be able to show in the table only the fields that have information in at least one of the selected products.%3$sActivate the %1$s"Dynamic Attribute fields"%2$s option and there will be no more empty lines in your comparison table.','yith-woocommerce-compare'),'<b>','</b>','<br>'); ?>
|
326 |
+
</p>
|
327 |
+
</div>
|
328 |
+
</div>
|
329 |
+
</div>
|
330 |
+
<div class="six section section-odd clear">
|
331 |
+
<div class="landing-container">
|
332 |
+
<div class="col-2">
|
333 |
+
<div class="section-title">
|
334 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/06-icon.png" alt="icon 06" />
|
335 |
+
<h2><?php _e('SOCIAL NETWORK SHARING','yith-woocommerce-compare');?></h2>
|
336 |
+
</div>
|
337 |
+
<p>
|
338 |
+
<?php echo sprintf( __( 'One of the most appealing features of the premium version of the plugin.Four social network sites for your users (Facebook, Twitter, Google + and Pinterest) and the email system %1$sto share%2$s the comparison table of the products they have selected.','yith-woocommerce-compare' ),'<b>','</b>' ) ?>
|
339 |
+
</p>
|
340 |
+
</div>
|
341 |
+
<div class="col-1">
|
342 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/06.png" alt="Social networks" />
|
343 |
+
</div>
|
344 |
+
</div>
|
345 |
+
</div>
|
346 |
+
<div class="seven section section-even clear">
|
347 |
+
<div class="landing-container">
|
348 |
+
<div class="col-1">
|
349 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/07.png" alt="Related products" />
|
350 |
+
</div>
|
351 |
+
<div class="col-2">
|
352 |
+
<div class="section-title">
|
353 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL?>assets/images/07-icon.png" alt="icon 05" />
|
354 |
+
<h2><?php _e('RELATED PRODUCTS','yith-woocommerce-compare');?></h2>
|
355 |
+
</div>
|
356 |
+
<p>
|
357 |
+
<?php echo sprintf( __('All the products that have common categories and/or tags with those in the comparison table will be showed in a slider, right under the comparison table.%3$sA completely %1$s"touch friendly"%2$s slider to encourage your users to discover the shop products of the shop related to those they are interested into.','yith-woocommerce-compare'),'<b>','</b>','<br>'); ?>
|
358 |
+
</p>
|
359 |
+
</div>
|
360 |
+
</div>
|
361 |
+
</div>
|
362 |
+
<div class="eight section section-odd clear">
|
363 |
+
<div class="landing-container">
|
364 |
+
<div class="col-2">
|
365 |
+
<div class="section-title">
|
366 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/08-icon.png" alt="icon 06" />
|
367 |
+
<h2><?php _e('CUSTOMIZABLE STYLE','yith-woocommerce-compare');?></h2>
|
368 |
+
</div>
|
369 |
+
<p>
|
370 |
+
<?php echo sprintf( __( 'An advanced option panel that let you change all the colors of the plugin, so that you can adapt stylistically all its elements %1$sto the layout%2$s of your shop.We know it, looks also count... and we give you the right tools to get to the best result.','yith-woocommerce-compare' ),'<b>','</b>' ) ?>
|
371 |
+
</p>
|
372 |
+
</div>
|
373 |
+
<div class="col-1">
|
374 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/08.png" alt="Social networks" />
|
375 |
+
</div>
|
376 |
+
</div>
|
377 |
+
</div>
|
378 |
+
<div class="nine section section-even clear">
|
379 |
+
<div class="landing-container">
|
380 |
+
<div class="col-1">
|
381 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/09.png" alt="Related products" />
|
382 |
+
</div>
|
383 |
+
<div class="col-2">
|
384 |
+
<div class="section-title">
|
385 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL?>assets/images/09-icon.png" alt="icon 09" />
|
386 |
+
<h2><?php _e('CUSTOMIZED ATTRIBUTES','yith-woocommerce-compare');?></h2>
|
387 |
+
</div>
|
388 |
+
<p>
|
389 |
+
<?php echo sprintf( __('Let you users compare products following every feature, and considering also all those %1$sattributes%2$s that can be manually created in within the product detail page. Every single detail will be included.','yith-woocommerce-compare'),'<b>','</b>'); ?>
|
390 |
+
</p>
|
391 |
+
</div>
|
392 |
+
</div>
|
393 |
+
</div>
|
394 |
+
<div class="ten section section-odd clear">
|
395 |
+
<div class="landing-container">
|
396 |
+
<div class="col-2">
|
397 |
+
<div class="section-title">
|
398 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/10-icon.png" alt="icon 10" />
|
399 |
+
<h2><?php _e('A TAILORED TABLE','yith-woocommerce-compare');?></h2>
|
400 |
+
</div>
|
401 |
+
<p>
|
402 |
+
<?php echo sprintf( __( 'Select the products you want to compare and the system will offer you the %1$sshortcode%2$s to generate a comparing table. Simple, rapid and useful.','yith-woocommerce-compare' ),'<b>','</b>' ) ?>
|
403 |
+
</p>
|
404 |
+
</div>
|
405 |
+
<div class="col-1">
|
406 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/10.png" alt="Social networks" />
|
407 |
+
</div>
|
408 |
+
</div>
|
409 |
+
</div>
|
410 |
+
<div class="eleven section section-even clear">
|
411 |
+
<div class="landing-container">
|
412 |
+
<div class="col-1">
|
413 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/11.png" alt="Widget" />
|
414 |
+
</div>
|
415 |
+
<div class="col-2">
|
416 |
+
<div class="section-title">
|
417 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL?>assets/images/11-icon.png" alt="icon 11" />
|
418 |
+
<h2><?php _e('Compare list - widget','yith-woocommerce-compare');?></h2>
|
419 |
+
</div>
|
420 |
+
<p>
|
421 |
+
<?php echo sprintf( __('Thanks to YITH WooCommerce Comapre Widget users could verify at any time the complete list of products added to the compare tab and avoid to open the popup to check its existence. ','yith-woocommerce-compare'),'<b>','</b>'); ?>
|
422 |
+
</p>
|
423 |
+
</div>
|
424 |
+
</div>
|
425 |
+
</div>
|
426 |
+
<div class="twelve section section-odd clear">
|
427 |
+
<div class="landing-container">
|
428 |
+
<div class="col-2">
|
429 |
+
<div class="section-title">
|
430 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/12-icon.png" alt="icon 12" />
|
431 |
+
<h2><?php _e('Compare counter - widget and shortcode','yith-woocommerce-compare');?></h2>
|
432 |
+
</div>
|
433 |
+
<p>
|
434 |
+
<?php echo sprintf( __( 'Moreover, if you want to give your users the chance to see in a glance how many products they have added to the Compare list, feel free to use the widget or the shortcode included. And their Compare list is always no more than one click away.','yith-woocommerce-compare' ),'<b>','</b>' ) ?>
|
435 |
+
</p>
|
436 |
+
</div>
|
437 |
+
<div class="col-1">
|
438 |
+
<img src="<?php echo YITH_WOOCOMPARE_URL ?>assets/images/12.png" alt="Social networks" />
|
439 |
+
</div>
|
440 |
+
</div>
|
441 |
+
</div>
|
442 |
+
<div class="section section-cta section-odd">
|
443 |
+
<div class="landing-container">
|
444 |
+
<div class="premium-cta">
|
445 |
+
<p>
|
446 |
+
<?php echo sprintf( __('Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Compare%2$s to benefit from all features!','yith-woocommerce-compare'),'<span class="highlight">','</span>' );?>
|
447 |
+
</p>
|
448 |
+
<a href="<?php echo $this->get_premium_landing_uri() ?>" target="_blank" class="premium-cta-button button btn">
|
449 |
+
<span class="highlight"><?php _e('UPGRADE','yith-woocommerce-compare');?></span>
|
450 |
+
<span><?php _e('to the premium version','yith-woocommerce-compare');?></span>
|
451 |
+
</a>
|
452 |
+
</div>
|
453 |
+
</div>
|
454 |
+
</div>
|
455 |
</div>
|
templates/compare.php
CHANGED
@@ -1,285 +1,285 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Woocommerce Compare page
|
4 |
-
*
|
5 |
-
* @author YITH
|
6 |
-
* @package YITH Woocommerce Compare
|
7 |
-
* @version 2.3.2
|
8 |
-
*/
|
9 |
-
|
10 |
-
// remove the style of woocommerce
|
11 |
-
if( defined('WOOCOMMERCE_USE_CSS') && WOOCOMMERCE_USE_CSS ) wp_dequeue_style('woocommerce_frontend_styles');
|
12 |
-
|
13 |
-
$is_iframe = (bool)( isset( $_REQUEST['iframe'] ) && $_REQUEST['iframe'] );
|
14 |
-
|
15 |
-
wp_enqueue_script( 'jquery-imagesloaded', YITH_WOOCOMPARE_ASSETS_URL . '/js/imagesloaded.pkgd.min.js', array('jquery'), '3.1.8', true );
|
16 |
-
wp_enqueue_script( 'jquery-fixedheadertable', YITH_WOOCOMPARE_ASSETS_URL . '/js/jquery.dataTables.min.js', array('jquery'), '1.10.19', true );
|
17 |
-
wp_enqueue_script( 'jquery-fixedcolumns', YITH_WOOCOMPARE_ASSETS_URL . '/js/FixedColumns.min.js', array('jquery', 'jquery-fixedheadertable'), '3.2.6', true );
|
18 |
-
|
19 |
-
$widths = array();
|
20 |
-
foreach( $products as $product ) $widths[] = '{ "sWidth": "205px", resizeable:true }';
|
21 |
-
|
22 |
-
$table_text = get_option( 'yith_woocompare_table_text' );
|
23 |
-
do_action ( 'wpml_register_single_string', 'Plugins', 'plugin_yit_compare_table_text', $table_text );
|
24 |
-
$localized_table_text = apply_filters ( 'wpml_translate_single_string', $table_text, 'Plugins', 'plugin_yit_compare_table_text' );
|
25 |
-
|
26 |
-
?><!DOCTYPE html>
|
27 |
-
<!--[if IE 6]>
|
28 |
-
<html id="ie6" class="ie"<?php language_attributes() ?>>
|
29 |
-
<![endif]-->
|
30 |
-
<!--[if IE 7]>
|
31 |
-
<html id="ie7" class="ie"<?php language_attributes() ?>>
|
32 |
-
<![endif]-->
|
33 |
-
<!--[if IE 8]>
|
34 |
-
<html id="ie8" class="ie"<?php language_attributes() ?>>
|
35 |
-
<![endif]-->
|
36 |
-
<!--[if IE 9]>
|
37 |
-
<html id="ie9" class="ie"<?php language_attributes() ?>>
|
38 |
-
<![endif]-->
|
39 |
-
<!--[if gt IE 9]>
|
40 |
-
<html class="ie"<?php language_attributes() ?>>
|
41 |
-
<![endif]-->
|
42 |
-
<!--[if !IE]>
|
43 |
-
<html <?php language_attributes() ?>>
|
44 |
-
<![endif]-->
|
45 |
-
|
46 |
-
<!-- START HEAD -->
|
47 |
-
<head>
|
48 |
-
<meta charset="<?php bloginfo( 'charset' ); ?>" />
|
49 |
-
<meta name="viewport" content="width=device-width" />
|
50 |
-
<title><?php _e( 'Product Comparison', 'yith-woocommerce-compare' ) ?></title>
|
51 |
-
<link rel="profile" href="http://gmpg.org/xfn/11" />
|
52 |
-
|
53 |
-
<?php wp_head() ?>
|
54 |
-
|
55 |
-
<?php do_action( 'yith_woocompare_popup_head' ) ?>
|
56 |
-
|
57 |
-
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800" />
|
58 |
-
<link rel="stylesheet" href="<?php echo YITH_WOOCOMPARE_URL ?>assets/css/colorbox.css"/>
|
59 |
-
<link rel="stylesheet" href="<?php echo YITH_WOOCOMPARE_URL ?>assets/css/jquery.dataTables.css"/>
|
60 |
-
<link rel="stylesheet" href="<?php echo $this->stylesheet_url() ?>" type="text/css" />
|
61 |
-
|
62 |
-
<style type="text/css">
|
63 |
-
body.loading {
|
64 |
-
background: url("<?php echo YITH_WOOCOMPARE_URL ?>assets/images/colorbox/loading.gif") no-repeat scroll center center transparent;
|
65 |
-
}
|
66 |
-
</style>
|
67 |
-
</head>
|
68 |
-
<!-- END HEAD -->
|
69 |
-
|
70 |
-
<?php global $product; ?>
|
71 |
-
|
72 |
-
<!-- START BODY -->
|
73 |
-
<body <?php body_class('woocommerce') ?>>
|
74 |
-
|
75 |
-
<h1>
|
76 |
-
<?php echo $localized_table_text ?>
|
77 |
-
<?php if ( ! $is_iframe ) : ?><a class="close" href="#"><?php _e( 'Close window [X]', 'yith-woocommerce-compare' ) ?></a><?php endif; ?>
|
78 |
-
</h1>
|
79 |
-
|
80 |
-
<div id="yith-woocompare" class="woocommerce">
|
81 |
-
|
82 |
-
<?php do_action( 'yith_woocompare_before_main_table' ); ?>
|
83 |
-
|
84 |
-
<table class="compare-list" cellpadding="0" cellspacing="0"<?php if ( empty( $products ) ) echo ' style="width:100%"' ?>>
|
85 |
-
<thead>
|
86 |
-
<tr>
|
87 |
-
<th> </th>
|
88 |
-
<?php foreach( $products as $product_id => $product ) : ?>
|
89 |
-
<td></td>
|
90 |
-
<?php endforeach; ?>
|
91 |
-
</tr>
|
92 |
-
</thead>
|
93 |
-
<tfoot>
|
94 |
-
<tr>
|
95 |
-
<th> </th>
|
96 |
-
<?php foreach( $products as $product_id => $product ) : ?>
|
97 |
-
<td></td>
|
98 |
-
<?php endforeach; ?>
|
99 |
-
</tr>
|
100 |
-
</tfoot>
|
101 |
-
<tbody>
|
102 |
-
|
103 |
-
<?php if ( empty( $products ) ) : ?>
|
104 |
-
|
105 |
-
<tr class="no-products">
|
106 |
-
<td><?php _e( 'No products added in the compare table.', 'yith-woocommerce-compare' ) ?></td>
|
107 |
-
</tr>
|
108 |
-
|
109 |
-
<?php else : ?>
|
110 |
-
<tr class="remove">
|
111 |
-
<th> </th>
|
112 |
-
<?php
|
113 |
-
$index = 0;
|
114 |
-
foreach( $products as $product_id => $product ) :
|
115 |
-
$product_class = ( $index % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product_id ?>
|
116 |
-
<td class="<?php echo $product_class; ?>">
|
117 |
-
<a href="<?php echo add_query_arg( 'redirect', 'view', $this->remove_product_url( $product_id ) ) ?>" data-product_id="<?php echo $product_id; ?>"><?php _e( 'Remove', 'yith-woocommerce-compare' ) ?> <span class="remove">x</span></a>
|
118 |
-
</td>
|
119 |
-
<?php
|
120 |
-
++$index;
|
121 |
-
endforeach;
|
122 |
-
?>
|
123 |
-
</tr>
|
124 |
-
|
125 |
-
<?php foreach ( $fields as $field => $name ) : ?>
|
126 |
-
|
127 |
-
<tr class="<?php echo $field ?>">
|
128 |
-
|
129 |
-
<th>
|
130 |
-
<?php if ( $field != 'image' ) echo $name ?>
|
131 |
-
</th>
|
132 |
-
|
133 |
-
<?php
|
134 |
-
$index = 0;
|
135 |
-
foreach( $products as $product_id => $product ) :
|
136 |
-
$product_class = ( $index % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product_id; ?>
|
137 |
-
<td class="<?php echo $product_class; ?>"><?php
|
138 |
-
switch( $field ) {
|
139 |
-
|
140 |
-
case 'image':
|
141 |
-
echo '<div class="image-wrap">' .
|
142 |
-
break;
|
143 |
-
|
144 |
-
case 'add-to-cart':
|
145 |
-
woocommerce_template_loop_add_to_cart();
|
146 |
-
break;
|
147 |
-
|
148 |
-
default:
|
149 |
-
echo empty( $product->fields[$field] ) ? ' ' : $product->fields[$field];
|
150 |
-
break;
|
151 |
-
}
|
152 |
-
?>
|
153 |
-
</td>
|
154 |
-
<?php
|
155 |
-
++$index;
|
156 |
-
endforeach; ?>
|
157 |
-
|
158 |
-
</tr>
|
159 |
-
|
160 |
-
<?php endforeach; ?>
|
161 |
-
|
162 |
-
<?php if ( $repeat_price == 'yes' && isset( $fields['price'] ) ) : ?>
|
163 |
-
<tr class="price repeated">
|
164 |
-
<th><?php echo $fields['price'] ?></th>
|
165 |
-
|
166 |
-
<?php
|
167 |
-
$index = 0;
|
168 |
-
foreach( $products as $product_id => $product ) :
|
169 |
-
$product_class = ( $index % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product_id ?>
|
170 |
-
<td class="<?php echo $product_class ?>"><?php echo $product->fields['price'] ?></td>
|
171 |
-
<?php
|
172 |
-
++$index;
|
173 |
-
endforeach; ?>
|
174 |
-
|
175 |
-
</tr>
|
176 |
-
<?php endif; ?>
|
177 |
-
|
178 |
-
<?php if ( $repeat_add_to_cart == 'yes' && isset( $fields['add-to-cart'] ) ) : ?>
|
179 |
-
<tr class="add-to-cart repeated">
|
180 |
-
<th><?php echo $fields['add-to-cart'] ?></th>
|
181 |
-
|
182 |
-
<?php
|
183 |
-
$index = 0;
|
184 |
-
foreach( $products as $product_id => $product ) :
|
185 |
-
$product_class = ( $index % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product_id ?>
|
186 |
-
<td class="<?php echo $product_class ?>">
|
187 |
-
<?php woocommerce_template_loop_add_to_cart(); ?>
|
188 |
-
</td>
|
189 |
-
<?php
|
190 |
-
++$index;
|
191 |
-
endforeach; ?>
|
192 |
-
|
193 |
-
</tr>
|
194 |
-
<?php endif; ?>
|
195 |
-
|
196 |
-
<?php endif; ?>
|
197 |
-
|
198 |
-
</tbody>
|
199 |
-
</table>
|
200 |
-
|
201 |
-
<?php do_action( 'yith_woocompare_after_main_table' ); ?>
|
202 |
-
|
203 |
-
</div>
|
204 |
-
|
205 |
-
<?php if( wp_script_is( 'responsive-theme', 'enqueued' ) ) wp_dequeue_script( 'responsive-theme' ) ?><?php if( wp_script_is( 'responsive-theme', 'enqueued' ) ) wp_dequeue_script( 'responsive-theme' ) ?>
|
206 |
-
<?php print_footer_scripts(); ?>
|
207 |
-
|
208 |
-
<script type="text/javascript">
|
209 |
-
|
210 |
-
jQuery(document).ready(function($){
|
211 |
-
$('a').attr('target', '_parent');
|
212 |
-
|
213 |
-
var oTable;
|
214 |
-
$('body').on( 'yith_woocompare_render_table', function(){
|
215 |
-
|
216 |
-
var t = $('table.compare-list');
|
217 |
-
|
218 |
-
if( typeof $.fn.DataTable != 'undefined' && typeof $.fn.imagesLoaded != 'undefined' && $(window).width() > 767 ) {
|
219 |
-
t.imagesLoaded( function(){
|
220 |
-
oTable = t.DataTable( {
|
221 |
-
'info': false,
|
222 |
-
'scrollX': true,
|
223 |
-
'scrollCollapse': true,
|
224 |
-
'paging': false,
|
225 |
-
'ordering': false,
|
226 |
-
'searching': false,
|
227 |
-
'autoWidth': false,
|
228 |
-
'destroy': true,
|
229 |
-
'fixedColumns': true
|
230 |
-
});
|
231 |
-
});
|
232 |
-
}
|
233 |
-
}).trigger('yith_woocompare_render_table');
|
234 |
-
|
235 |
-
// add to cart
|
236 |
-
var redirect_to_cart = false,
|
237 |
-
body = $('body');
|
238 |
-
|
239 |
-
// close colorbox if redirect to cart is active after add to cart
|
240 |
-
body.on( 'adding_to_cart', function ( $thisbutton, data ) {
|
241 |
-
if( wc_add_to_cart_params.cart_redirect_after_add == 'yes' ) {
|
242 |
-
wc_add_to_cart_params.cart_redirect_after_add = 'no';
|
243 |
-
redirect_to_cart = true;
|
244 |
-
}
|
245 |
-
});
|
246 |
-
|
247 |
-
body.on('wc_cart_button_updated', function( ev, button ){
|
248 |
-
$('a.added_to_cart').attr('target', '_parent');
|
249 |
-
});
|
250 |
-
|
251 |
-
// remove add to cart button after added
|
252 |
-
body.on('added_to_cart', function( ev, fragments, cart_hash, button ){
|
253 |
-
|
254 |
-
$('a').attr('target', '_parent');
|
255 |
-
|
256 |
-
if( redirect_to_cart == true ) {
|
257 |
-
// redirect
|
258 |
-
parent.window.location = wc_add_to_cart_params.cart_url;
|
259 |
-
return;
|
260 |
-
}
|
261 |
-
|
262 |
-
// Replace fragments
|
263 |
-
if ( fragments ) {
|
264 |
-
$.each(fragments, function(key, value) {
|
265 |
-
$(key, window.parent.document).replaceWith(value);
|
266 |
-
});
|
267 |
-
}
|
268 |
-
});
|
269 |
-
|
270 |
-
// close window
|
271 |
-
$(document).on( 'click', 'a.close', function(e){
|
272 |
-
e.preventDefault();
|
273 |
-
window.close();
|
274 |
-
});
|
275 |
-
|
276 |
-
$(window).on( 'resize yith_woocompare_product_removed', function(){
|
277 |
-
$('body').trigger('yith_woocompare_render_table');
|
278 |
-
});
|
279 |
-
|
280 |
-
});
|
281 |
-
|
282 |
-
</script>
|
283 |
-
|
284 |
-
</body>
|
285 |
</html>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Woocommerce Compare page
|
4 |
+
*
|
5 |
+
* @author YITH
|
6 |
+
* @package YITH Woocommerce Compare
|
7 |
+
* @version 2.3.2
|
8 |
+
*/
|
9 |
+
|
10 |
+
// remove the style of woocommerce
|
11 |
+
if( defined('WOOCOMMERCE_USE_CSS') && WOOCOMMERCE_USE_CSS ) wp_dequeue_style('woocommerce_frontend_styles');
|
12 |
+
|
13 |
+
$is_iframe = (bool)( isset( $_REQUEST['iframe'] ) && $_REQUEST['iframe'] );
|
14 |
+
|
15 |
+
wp_enqueue_script( 'jquery-imagesloaded', YITH_WOOCOMPARE_ASSETS_URL . '/js/imagesloaded.pkgd.min.js', array('jquery'), '3.1.8', true );
|
16 |
+
wp_enqueue_script( 'jquery-fixedheadertable', YITH_WOOCOMPARE_ASSETS_URL . '/js/jquery.dataTables.min.js', array('jquery'), '1.10.19', true );
|
17 |
+
wp_enqueue_script( 'jquery-fixedcolumns', YITH_WOOCOMPARE_ASSETS_URL . '/js/FixedColumns.min.js', array('jquery', 'jquery-fixedheadertable'), '3.2.6', true );
|
18 |
+
|
19 |
+
$widths = array();
|
20 |
+
foreach( $products as $product ) $widths[] = '{ "sWidth": "205px", resizeable:true }';
|
21 |
+
|
22 |
+
$table_text = get_option( 'yith_woocompare_table_text' );
|
23 |
+
do_action ( 'wpml_register_single_string', 'Plugins', 'plugin_yit_compare_table_text', $table_text );
|
24 |
+
$localized_table_text = apply_filters ( 'wpml_translate_single_string', $table_text, 'Plugins', 'plugin_yit_compare_table_text' );
|
25 |
+
|
26 |
+
?><!DOCTYPE html>
|
27 |
+
<!--[if IE 6]>
|
28 |
+
<html id="ie6" class="ie"<?php language_attributes() ?>>
|
29 |
+
<![endif]-->
|
30 |
+
<!--[if IE 7]>
|
31 |
+
<html id="ie7" class="ie"<?php language_attributes() ?>>
|
32 |
+
<![endif]-->
|
33 |
+
<!--[if IE 8]>
|
34 |
+
<html id="ie8" class="ie"<?php language_attributes() ?>>
|
35 |
+
<![endif]-->
|
36 |
+
<!--[if IE 9]>
|
37 |
+
<html id="ie9" class="ie"<?php language_attributes() ?>>
|
38 |
+
<![endif]-->
|
39 |
+
<!--[if gt IE 9]>
|
40 |
+
<html class="ie"<?php language_attributes() ?>>
|
41 |
+
<![endif]-->
|
42 |
+
<!--[if !IE]>
|
43 |
+
<html <?php language_attributes() ?>>
|
44 |
+
<![endif]-->
|
45 |
+
|
46 |
+
<!-- START HEAD -->
|
47 |
+
<head>
|
48 |
+
<meta charset="<?php bloginfo( 'charset' ); ?>" />
|
49 |
+
<meta name="viewport" content="width=device-width" />
|
50 |
+
<title><?php _e( 'Product Comparison', 'yith-woocommerce-compare' ) ?></title>
|
51 |
+
<link rel="profile" href="http://gmpg.org/xfn/11" />
|
52 |
+
|
53 |
+
<?php wp_head() ?>
|
54 |
+
|
55 |
+
<?php do_action( 'yith_woocompare_popup_head' ) ?>
|
56 |
+
|
57 |
+
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800" />
|
58 |
+
<link rel="stylesheet" href="<?php echo YITH_WOOCOMPARE_URL ?>assets/css/colorbox.css"/>
|
59 |
+
<link rel="stylesheet" href="<?php echo YITH_WOOCOMPARE_URL ?>assets/css/jquery.dataTables.css"/>
|
60 |
+
<link rel="stylesheet" href="<?php echo $this->stylesheet_url() ?>" type="text/css" />
|
61 |
+
|
62 |
+
<style type="text/css">
|
63 |
+
body.loading {
|
64 |
+
background: url("<?php echo YITH_WOOCOMPARE_URL ?>assets/images/colorbox/loading.gif") no-repeat scroll center center transparent;
|
65 |
+
}
|
66 |
+
</style>
|
67 |
+
</head>
|
68 |
+
<!-- END HEAD -->
|
69 |
+
|
70 |
+
<?php global $product; ?>
|
71 |
+
|
72 |
+
<!-- START BODY -->
|
73 |
+
<body <?php body_class('woocommerce') ?>>
|
74 |
+
|
75 |
+
<h1>
|
76 |
+
<?php echo $localized_table_text ?>
|
77 |
+
<?php if ( ! $is_iframe ) : ?><a class="close" href="#"><?php _e( 'Close window [X]', 'yith-woocommerce-compare' ) ?></a><?php endif; ?>
|
78 |
+
</h1>
|
79 |
+
|
80 |
+
<div id="yith-woocompare" class="woocommerce">
|
81 |
+
|
82 |
+
<?php do_action( 'yith_woocompare_before_main_table' ); ?>
|
83 |
+
|
84 |
+
<table class="compare-list" cellpadding="0" cellspacing="0"<?php if ( empty( $products ) ) echo ' style="width:100%"' ?>>
|
85 |
+
<thead>
|
86 |
+
<tr>
|
87 |
+
<th> </th>
|
88 |
+
<?php foreach( $products as $product_id => $product ) : ?>
|
89 |
+
<td></td>
|
90 |
+
<?php endforeach; ?>
|
91 |
+
</tr>
|
92 |
+
</thead>
|
93 |
+
<tfoot>
|
94 |
+
<tr>
|
95 |
+
<th> </th>
|
96 |
+
<?php foreach( $products as $product_id => $product ) : ?>
|
97 |
+
<td></td>
|
98 |
+
<?php endforeach; ?>
|
99 |
+
</tr>
|
100 |
+
</tfoot>
|
101 |
+
<tbody>
|
102 |
+
|
103 |
+
<?php if ( empty( $products ) ) : ?>
|
104 |
+
|
105 |
+
<tr class="no-products">
|
106 |
+
<td><?php _e( 'No products added in the compare table.', 'yith-woocommerce-compare' ) ?></td>
|
107 |
+
</tr>
|
108 |
+
|
109 |
+
<?php else : ?>
|
110 |
+
<tr class="remove">
|
111 |
+
<th> </th>
|
112 |
+
<?php
|
113 |
+
$index = 0;
|
114 |
+
foreach( $products as $product_id => $product ) :
|
115 |
+
$product_class = ( $index % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product_id ?>
|
116 |
+
<td class="<?php echo $product_class; ?>">
|
117 |
+
<a href="<?php echo add_query_arg( 'redirect', 'view', $this->remove_product_url( $product_id ) ) ?>" data-product_id="<?php echo $product_id; ?>"><?php _e( 'Remove', 'yith-woocommerce-compare' ) ?> <span class="remove">x</span></a>
|
118 |
+
</td>
|
119 |
+
<?php
|
120 |
+
++$index;
|
121 |
+
endforeach;
|
122 |
+
?>
|
123 |
+
</tr>
|
124 |
+
|
125 |
+
<?php foreach ( $fields as $field => $name ) : ?>
|
126 |
+
|
127 |
+
<tr class="<?php echo $field ?>">
|
128 |
+
|
129 |
+
<th>
|
130 |
+
<?php if ( $field != 'image' ) echo $name ?>
|
131 |
+
</th>
|
132 |
+
|
133 |
+
<?php
|
134 |
+
$index = 0;
|
135 |
+
foreach( $products as $product_id => $product ) :
|
136 |
+
$product_class = ( $index % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product_id; ?>
|
137 |
+
<td class="<?php echo $product_class; ?>"><?php
|
138 |
+
switch( $field ) {
|
139 |
+
|
140 |
+
case 'image':
|
141 |
+
echo '<div class="image-wrap">' . $product->get_image( 'yith-woocompare-image' ) . '</div>';
|
142 |
+
break;
|
143 |
+
|
144 |
+
case 'add-to-cart':
|
145 |
+
woocommerce_template_loop_add_to_cart();
|
146 |
+
break;
|
147 |
+
|
148 |
+
default:
|
149 |
+
echo empty( $product->fields[$field] ) ? ' ' : $product->fields[$field];
|
150 |
+
break;
|
151 |
+
}
|
152 |
+
?>
|
153 |
+
</td>
|
154 |
+
<?php
|
155 |
+
++$index;
|
156 |
+
endforeach; ?>
|
157 |
+
|
158 |
+
</tr>
|
159 |
+
|
160 |
+
<?php endforeach; ?>
|
161 |
+
|
162 |
+
<?php if ( $repeat_price == 'yes' && isset( $fields['price'] ) ) : ?>
|
163 |
+
<tr class="price repeated">
|
164 |
+
<th><?php echo $fields['price'] ?></th>
|
165 |
+
|
166 |
+
<?php
|
167 |
+
$index = 0;
|
168 |
+
foreach( $products as $product_id => $product ) :
|
169 |
+
$product_class = ( $index % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product_id ?>
|
170 |
+
<td class="<?php echo $product_class ?>"><?php echo $product->fields['price'] ?></td>
|
171 |
+
<?php
|
172 |
+
++$index;
|
173 |
+
endforeach; ?>
|
174 |
+
|
175 |
+
</tr>
|
176 |
+
<?php endif; ?>
|
177 |
+
|
178 |
+
<?php if ( $repeat_add_to_cart == 'yes' && isset( $fields['add-to-cart'] ) ) : ?>
|
179 |
+
<tr class="add-to-cart repeated">
|
180 |
+
<th><?php echo $fields['add-to-cart'] ?></th>
|
181 |
+
|
182 |
+
<?php
|
183 |
+
$index = 0;
|
184 |
+
foreach( $products as $product_id => $product ) :
|
185 |
+
$product_class = ( $index % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product_id ?>
|
186 |
+
<td class="<?php echo $product_class ?>">
|
187 |
+
<?php woocommerce_template_loop_add_to_cart(); ?>
|
188 |
+
</td>
|
189 |
+
<?php
|
190 |
+
++$index;
|
191 |
+
endforeach; ?>
|
192 |
+
|
193 |
+
</tr>
|
194 |
+
<?php endif; ?>
|
195 |
+
|
196 |
+
<?php endif; ?>
|
197 |
+
|
198 |
+
</tbody>
|
199 |
+
</table>
|
200 |
+
|
201 |
+
<?php do_action( 'yith_woocompare_after_main_table' ); ?>
|
202 |
+
|
203 |
+
</div>
|
204 |
+
|
205 |
+
<?php if( wp_script_is( 'responsive-theme', 'enqueued' ) ) wp_dequeue_script( 'responsive-theme' ) ?><?php if( wp_script_is( 'responsive-theme', 'enqueued' ) ) wp_dequeue_script( 'responsive-theme' ) ?>
|
206 |
+
<?php print_footer_scripts(); ?>
|
207 |
+
|
208 |
+
<script type="text/javascript">
|
209 |
+
|
210 |
+
jQuery(document).ready(function($){
|
211 |
+
$('a').attr('target', '_parent');
|
212 |
+
|
213 |
+
var oTable;
|
214 |
+
$('body').on( 'yith_woocompare_render_table', function(){
|
215 |
+
|
216 |
+
var t = $('table.compare-list');
|
217 |
+
|
218 |
+
if( typeof $.fn.DataTable != 'undefined' && typeof $.fn.imagesLoaded != 'undefined' && $(window).width() > 767 ) {
|
219 |
+
t.imagesLoaded( function(){
|
220 |
+
oTable = t.DataTable( {
|
221 |
+
'info': false,
|
222 |
+
'scrollX': true,
|
223 |
+
'scrollCollapse': true,
|
224 |
+
'paging': false,
|
225 |
+
'ordering': false,
|
226 |
+
'searching': false,
|
227 |
+
'autoWidth': false,
|
228 |
+
'destroy': true,
|
229 |
+
'fixedColumns': true
|
230 |
+
});
|
231 |
+
});
|
232 |
+
}
|
233 |
+
}).trigger('yith_woocompare_render_table');
|
234 |
+
|
235 |
+
// add to cart
|
236 |
+
var redirect_to_cart = false,
|
237 |
+
body = $('body');
|
238 |
+
|
239 |
+
// close colorbox if redirect to cart is active after add to cart
|
240 |
+
body.on( 'adding_to_cart', function ( $thisbutton, data ) {
|
241 |
+
if( wc_add_to_cart_params.cart_redirect_after_add == 'yes' ) {
|
242 |
+
wc_add_to_cart_params.cart_redirect_after_add = 'no';
|
243 |
+
redirect_to_cart = true;
|
244 |
+
}
|
245 |
+
});
|
246 |
+
|
247 |
+
body.on('wc_cart_button_updated', function( ev, button ){
|
248 |
+
$('a.added_to_cart').attr('target', '_parent');
|
249 |
+
});
|
250 |
+
|
251 |
+
// remove add to cart button after added
|
252 |
+
body.on('added_to_cart', function( ev, fragments, cart_hash, button ){
|
253 |
+
|
254 |
+
$('a').attr('target', '_parent');
|
255 |
+
|
256 |
+
if( redirect_to_cart == true ) {
|
257 |
+
// redirect
|
258 |
+
parent.window.location = wc_add_to_cart_params.cart_url;
|
259 |
+
return;
|
260 |
+
}
|
261 |
+
|
262 |
+
// Replace fragments
|
263 |
+
if ( fragments ) {
|
264 |
+
$.each(fragments, function(key, value) {
|
265 |
+
$(key, window.parent.document).replaceWith(value);
|
266 |
+
});
|
267 |
+
}
|
268 |
+
});
|
269 |
+
|
270 |
+
// close window
|
271 |
+
$(document).on( 'click', 'a.close', function(e){
|
272 |
+
e.preventDefault();
|
273 |
+
window.close();
|
274 |
+
});
|
275 |
+
|
276 |
+
$(window).on( 'resize yith_woocompare_product_removed', function(){
|
277 |
+
$('body').trigger('yith_woocompare_render_table');
|
278 |
+
});
|
279 |
+
|
280 |
+
});
|
281 |
+
|
282 |
+
</script>
|
283 |
+
|
284 |
+
</body>
|
285 |
</html>
|
widgets/class.yith-woocompare-widget.php
CHANGED
@@ -1,84 +1,84 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Main class
|
4 |
-
*
|
5 |
-
* @author YITH
|
6 |
-
* @package YITH WooCommerce Ajax Navigation
|
7 |
-
* @version 1.1.4
|
8 |
-
*/
|
9 |
-
|
10 |
-
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|
11 |
-
|
12 |
-
if( !class_exists( 'YITH_WOOCOMPARE' ) ) {
|
13 |
-
/**
|
14 |
-
* YITH WooCommerce Ajax Navigation Widget
|
15 |
-
*
|
16 |
-
* @since 1.0.0
|
17 |
-
*/
|
18 |
-
class YITH_Woocompare_Widget extends WP_Widget {
|
19 |
-
|
20 |
-
function __construct() {
|
21 |
-
$widget_ops = array (
|
22 |
-
'classname' => 'yith-woocompare-widget',
|
23 |
-
'description' => __( 'The widget shows the list of products added in the comparison table.', 'yith-woocommerce-compare'
|
24 |
-
)
|
25 |
-
);
|
26 |
-
|
27 |
-
parent::__construct( 'yith-woocompare-widget', __( 'YITH WooCommerce Compare Widget', 'yith-woocommerce-compare' ), $widget_ops );
|
28 |
-
}
|
29 |
-
|
30 |
-
|
31 |
-
function widget( $args, $instance ) {
|
32 |
-
global $yith_woocompare;
|
33 |
-
|
34 |
-
/**
|
35 |
-
* WPML Support
|
36 |
-
*/
|
37 |
-
$lang = defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : false;
|
38 |
-
|
39 |
-
extract( $args );
|
40 |
-
|
41 |
-
do_action ( 'wpml_register_single_string', 'Widget', 'widget_yit_compare_title_text', $instance['title'] );
|
42 |
-
$localized_widget_title = apply_filters ( 'wpml_translate_single_string', $instance['title'], 'Widget', 'widget_yit_compare_title_text' );
|
43 |
-
|
44 |
-
echo $before_widget . $before_title . $localized_widget_title . $after_title; ?>
|
45 |
-
|
46 |
-
<ul class="products-list" data-lang="<?php echo $lang ?>">
|
47 |
-
<?php echo $yith_woocompare->obj->list_products_html(); ?>
|
48 |
-
</ul>
|
49 |
-
|
50 |
-
<a href="<?php echo $yith_woocompare->obj->remove_product_url('all') ?>" data-product_id="all" class="clear-all" rel="nofollow"><?php _e( 'Clear all', 'yith-woocommerce-compare' ) ?></a>
|
51 |
-
<a href="<?php echo $yith_woocompare->obj->view_table_url() ?>" class="compare added button" rel="nofollow"><?php _e( 'Compare', 'yith-woocommerce-compare' ) ?></a>
|
52 |
-
|
53 |
-
<?php echo $after_widget;
|
54 |
-
}
|
55 |
-
|
56 |
-
|
57 |
-
function form( $instance ) {
|
58 |
-
global $woocommerce;
|
59 |
-
|
60 |
-
$defaults = array(
|
61 |
-
'title' => '',
|
62 |
-
);
|
63 |
-
|
64 |
-
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
|
65 |
-
|
66 |
-
<p>
|
67 |
-
<label>
|
68 |
-
<?php _e( 'Title', 'yith-woocommerce-compare' ) ?>:<br />
|
69 |
-
<input class="widefat" type="text" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" />
|
70 |
-
</label>
|
71 |
-
</p>
|
72 |
-
<?php
|
73 |
-
}
|
74 |
-
|
75 |
-
function update( $new_instance, $old_instance ) {
|
76 |
-
$instance = $old_instance;
|
77 |
-
|
78 |
-
$instance['title'] = strip_tags( $new_instance['title'] );
|
79 |
-
|
80 |
-
return $instance;
|
81 |
-
}
|
82 |
-
|
83 |
-
}
|
84 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Main class
|
4 |
+
*
|
5 |
+
* @author YITH
|
6 |
+
* @package YITH WooCommerce Ajax Navigation
|
7 |
+
* @version 1.1.4
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
|
11 |
+
|
12 |
+
if( !class_exists( 'YITH_WOOCOMPARE' ) ) {
|
13 |
+
/**
|
14 |
+
* YITH WooCommerce Ajax Navigation Widget
|
15 |
+
*
|
16 |
+
* @since 1.0.0
|
17 |
+
*/
|
18 |
+
class YITH_Woocompare_Widget extends WP_Widget {
|
19 |
+
|
20 |
+
function __construct() {
|
21 |
+
$widget_ops = array (
|
22 |
+
'classname' => 'yith-woocompare-widget',
|
23 |
+
'description' => __( 'The widget shows the list of products added in the comparison table.', 'yith-woocommerce-compare'
|
24 |
+
)
|
25 |
+
);
|
26 |
+
|
27 |
+
parent::__construct( 'yith-woocompare-widget', __( 'YITH WooCommerce Compare Widget', 'yith-woocommerce-compare' ), $widget_ops );
|
28 |
+
}
|
29 |
+
|
30 |
+
|
31 |
+
function widget( $args, $instance ) {
|
32 |
+
global $yith_woocompare;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* WPML Support
|
36 |
+
*/
|
37 |
+
$lang = defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : false;
|
38 |
+
|
39 |
+
extract( $args );
|
40 |
+
|
41 |
+
do_action ( 'wpml_register_single_string', 'Widget', 'widget_yit_compare_title_text', $instance['title'] );
|
42 |
+
$localized_widget_title = apply_filters ( 'wpml_translate_single_string', $instance['title'], 'Widget', 'widget_yit_compare_title_text' );
|
43 |
+
|
44 |
+
echo $before_widget . $before_title . $localized_widget_title . $after_title; ?>
|
45 |
+
|
46 |
+
<ul class="products-list" data-lang="<?php echo $lang ?>">
|
47 |
+
<?php echo $yith_woocompare->obj->list_products_html(); ?>
|
48 |
+
</ul>
|
49 |
+
|
50 |
+
<a href="<?php echo $yith_woocompare->obj->remove_product_url('all') ?>" data-product_id="all" class="clear-all" rel="nofollow"><?php _e( 'Clear all', 'yith-woocommerce-compare' ) ?></a>
|
51 |
+
<a href="<?php echo $yith_woocompare->obj->view_table_url() ?>" class="compare added button" rel="nofollow"><?php _e( 'Compare', 'yith-woocommerce-compare' ) ?></a>
|
52 |
+
|
53 |
+
<?php echo $after_widget;
|
54 |
+
}
|
55 |
+
|
56 |
+
|
57 |
+
function form( $instance ) {
|
58 |
+
global $woocommerce;
|
59 |
+
|
60 |
+
$defaults = array(
|
61 |
+
'title' => '',
|
62 |
+
);
|
63 |
+
|
64 |
+
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
|
65 |
+
|
66 |
+
<p>
|
67 |
+
<label>
|
68 |
+
<?php _e( 'Title', 'yith-woocommerce-compare' ) ?>:<br />
|
69 |
+
<input class="widefat" type="text" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" />
|
70 |
+
</label>
|
71 |
+
</p>
|
72 |
+
<?php
|
73 |
+
}
|
74 |
+
|
75 |
+
function update( $new_instance, $old_instance ) {
|
76 |
+
$instance = $old_instance;
|
77 |
+
|
78 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
79 |
+
|
80 |
+
return $instance;
|
81 |
+
}
|
82 |
+
|
83 |
+
}
|
84 |
}
|
wpml-config.xml
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
<wpml-config>
|
2 |
-
<admin-texts>
|
3 |
-
<key name="yith_woocompare_button_text" />
|
4 |
-
<key name="yith_woocompare_table_text" />
|
5 |
-
</admin-texts>
|
6 |
</wpml-config>
|
1 |
+
<wpml-config>
|
2 |
+
<admin-texts>
|
3 |
+
<key name="yith_woocompare_button_text" />
|
4 |
+
<key name="yith_woocompare_table_text" />
|
5 |
+
</admin-texts>
|
6 |
</wpml-config>
|