Version Description
Released on Mar 29, 2017
- New: Support to WooCommerce 3.0.0 RC2.
- New: Support to WordPress 4.7.3
- Update: Plugin Core.
- Update: Language Files.
Download this release
Release Info
Developer | yithemes |
Plugin | YITH WooCommerce Compare |
Version | 2.2.0 |
Comparing to | |
See all releases |
Code changes from version 2.1.0 to 2.2.0
- README.txt +82 -79
- assets/css/colorbox.css +5 -1
- assets/js/woocompare.js +3 -2
- assets/js/woocompare.min.js +1 -1
- includes/class.yith-woocompare-admin.php +2 -6
- includes/class.yith-woocompare-frontend.php +80 -52
- includes/class.yith-woocompare.php +10 -7
- init.php +3 -3
- languages/yith-woocommerce-compare-pt_BR.mo +0 -0
- languages/yith-woocommerce-compare-pt_BR.po +42 -39
- plugin-fw/init.php +3 -3
- plugin-fw/lib/yit-cpt-unlimited.php +2 -2
- plugin-fw/lib/yit-metabox.php +24 -5
- plugin-fw/lib/yit-plugin-panel-wc.php +1 -1
- plugin-fw/lib/yit-plugin-panel.php +2 -2
- plugin-fw/lib/yit-upgrade.php +1 -1
- plugin-fw/licence/lib/yit-licence.php +6 -5
- plugin-fw/licence/lib/yit-plugin-licence.php +3 -3
- plugin-fw/licence/lib/yit-theme-licence.php +3 -3
- plugin-fw/licence/templates/panel/activation/activation-panel.php +3 -3
- plugin-fw/yit-plugin.php +40 -0
- plugin-fw/yit-woocommerce-compatibility.php +700 -0
- plugin-options/general-options.php +3 -2
- templates/compare.php +40 -15
- widgets/class.yith-woocompare-widget.php +2 -2
README.txt
CHANGED
@@ -3,13 +3,13 @@
|
|
3 |
Contributors: yithemes
|
4 |
Tags: wc, shop, woocommerce, compare, compare products, product compare, widget, comparison, product comparison, compare table
|
5 |
Requires at least: 3.5.1
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 2.
|
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
|
13 |
|
14 |
== Description ==
|
15 |
|
@@ -66,137 +66,144 @@ yith-woocommerce-compare-<WORDPRESS LOCALE >.mo
|
|
66 |
|
67 |
== Changelog ==
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
= 2.1.0 = Released on Oct 19, 2016
|
70 |
|
71 |
-
*
|
72 |
-
*
|
73 |
-
*
|
74 |
-
*
|
75 |
-
*
|
76 |
-
*
|
77 |
-
*
|
78 |
-
*
|
79 |
|
80 |
= 2.0.9 = Released on Jun 13, 2016
|
81 |
|
82 |
-
*
|
83 |
-
*
|
84 |
|
85 |
= 2.0.8 = Released on Apr 19, 2016
|
86 |
|
87 |
-
*
|
88 |
-
*
|
89 |
-
*
|
90 |
|
91 |
= 2.0.7 = Released on Apr 01, 2016
|
92 |
|
93 |
-
*
|
94 |
-
*
|
95 |
-
*
|
96 |
-
*
|
97 |
-
*
|
98 |
-
*
|
99 |
|
100 |
= 2.0.6 = Released on Jan 11, 2016
|
101 |
|
102 |
-
*
|
103 |
-
*
|
104 |
-
*
|
105 |
-
*
|
106 |
|
107 |
= 2.0.5 = Released on Oct 30, 2015
|
108 |
|
109 |
-
*
|
110 |
-
*
|
111 |
|
112 |
= 2.0.4 = Released on Sep 22, 2015
|
113 |
|
114 |
-
*
|
115 |
-
*
|
116 |
-
*
|
117 |
|
118 |
= 2.0.3 = Released on Aug 21, 2015
|
119 |
|
120 |
-
*
|
121 |
|
122 |
= 2.0.2 = Released on Aug 12, 2015
|
123 |
|
124 |
-
*
|
125 |
-
*
|
126 |
|
127 |
= 2.0.1 = Released on Aug 10, 2015
|
128 |
|
129 |
-
*
|
130 |
-
*
|
131 |
-
*
|
132 |
|
133 |
= 2.0.0 = Released on Jul 15, 2015
|
134 |
|
135 |
-
*
|
136 |
-
*
|
137 |
-
* Fixed: Lightbox doesn't close after click view cart
|
138 |
-
* Fixed: minor bug fix
|
139 |
-
* Updated: Language files
|
140 |
* Removed: old default.po catalog language file
|
|
|
|
|
|
|
141 |
|
142 |
= 1.2.3 = Released on Feb 13, 2015
|
143 |
|
144 |
-
*
|
145 |
-
*
|
146 |
|
147 |
= 1.2.2 = Released on Dec 03, 2014
|
148 |
|
149 |
-
*
|
150 |
|
151 |
= 1.2.1 = Released on Sep 17, 2014
|
152 |
|
153 |
-
*
|
154 |
|
155 |
= 1.2.0 = Released on Sep 16, 2014
|
156 |
|
157 |
-
*
|
158 |
* Update: Compare Template
|
159 |
-
*
|
|
|
160 |
* Tweek: WPML Support improved
|
161 |
-
* Fixed: Fields orders
|
162 |
|
163 |
= 1.1.4 = Released on Jun 30, 2014
|
164 |
|
165 |
-
*
|
166 |
-
*
|
167 |
|
168 |
= 1.1.3 = Released on Jun 05, 2014
|
169 |
|
170 |
-
*
|
171 |
|
172 |
= 1.1.2 = Released on Mar 21, 2014
|
173 |
|
174 |
-
*
|
175 |
|
176 |
= 1.1.1 = Released on Feb 19, 2014
|
177 |
|
178 |
-
*
|
179 |
|
180 |
= 1.1.0 = Released on Feb 13, 2014
|
181 |
|
182 |
-
*
|
183 |
-
*
|
184 |
|
185 |
= 1.0.5 = Released on Oct 14, 2013
|
186 |
|
187 |
-
*
|
188 |
-
*
|
189 |
-
*
|
190 |
-
*
|
191 |
-
*
|
192 |
-
*
|
193 |
-
*
|
194 |
|
195 |
= 1.0.4 = Released on Sep 04, 2013
|
196 |
|
197 |
-
*
|
198 |
-
*
|
199 |
-
*
|
200 |
|
201 |
= 1.0.3 = Released on Jul 31, 2013
|
202 |
|
@@ -208,10 +215,10 @@ yith-woocommerce-compare-<WORDPRESS LOCALE >.mo
|
|
208 |
|
209 |
= 1.0.1 = Released on Jun 27, 2013
|
210 |
|
211 |
-
*
|
212 |
-
*
|
213 |
-
*
|
214 |
-
*
|
215 |
|
216 |
= 1.0.0 = Released on Jun 24, 2013
|
217 |
|
@@ -236,13 +243,9 @@ Full documentation is available [here](http://yithemes.com/docs-plugins/yith-woo
|
|
236 |
|
237 |
== Upgrade notice ==
|
238 |
|
239 |
-
= 2.
|
240 |
|
241 |
-
*
|
242 |
-
*
|
243 |
-
*
|
244 |
-
*
|
245 |
-
* Fixed: Uncaught ReferenceError "redirect_to_cart is not defined" error on "add to cart" action.
|
246 |
-
* Fixed: Compatibility issue with NextGen Gallery plugin.
|
247 |
-
* Updated: Plugin Core.
|
248 |
-
* Updated: Language Files.
|
3 |
Contributors: yithemes
|
4 |
Tags: wc, shop, woocommerce, compare, compare products, product compare, widget, comparison, product comparison, compare table
|
5 |
Requires at least: 3.5.1
|
6 |
+
Tested up to: 4.7.3
|
7 |
+
Stable tag: 2.2.0
|
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.0.0 RC2
|
13 |
|
14 |
== Description ==
|
15 |
|
66 |
|
67 |
== Changelog ==
|
68 |
|
69 |
+
= 2.2.0 = Released on Mar 29, 2017
|
70 |
+
|
71 |
+
* New: Support to WooCommerce 3.0.0 RC2.
|
72 |
+
* New: Support to WordPress 4.7.3
|
73 |
+
* Update: Plugin Core.
|
74 |
+
* Update: Language Files.
|
75 |
+
|
76 |
= 2.1.0 = Released on Oct 19, 2016
|
77 |
|
78 |
+
* New: Support to WooCommerce 2.6.4
|
79 |
+
* New: Support to WordPress 4.6
|
80 |
+
* New: Auto remove from compare list for products that are private or were cancelled.
|
81 |
+
* New: Add as default fields Weight and Dimensions.
|
82 |
+
* Update: Plugin Core.
|
83 |
+
* Update: Language Files.
|
84 |
+
* Fix: Uncaught ReferenceError "redirect_to_cart is not defined" error on "add to cart" action.
|
85 |
+
* Fix: Compatibility issue with NextGen Gallery plugin.
|
86 |
|
87 |
= 2.0.9 = Released on Jun 13, 2016
|
88 |
|
89 |
+
* New: Support to WooCommerce 2.6 RC1
|
90 |
+
* Update: Plugin Core.
|
91 |
|
92 |
= 2.0.8 = Released on Apr 19, 2016
|
93 |
|
94 |
+
* New: Compatibility with WordPress 4.5
|
95 |
+
* Update: Plugin Core.
|
96 |
+
* Fix: Fatal error call to undefined method WC_AJAX::get_endpoint() for WooCommerce version older then 2.4
|
97 |
|
98 |
= 2.0.7 = Released on Apr 01, 2016
|
99 |
|
100 |
+
* Update: Plugin template compare.php
|
101 |
+
* Update: Plugin Core.
|
102 |
+
* Update: Language file.
|
103 |
+
* Fix: Product status now updates automatically when the product is removed from the compare widget.
|
104 |
+
* Fix: Redirect correctly to cart page after "Add to cart" is clicked if "Redirect to the cart page after successful addition" option is enabled.
|
105 |
+
* Fix: Redirect correctly to product page after "Add to cart" is clicked when "Enable AJAX add to cart buttons on archives" option is disabled.
|
106 |
|
107 |
= 2.0.6 = Released on Jan 11, 2016
|
108 |
|
109 |
+
* New: Compatibility with WooCommerce 2.5 RC
|
110 |
+
* Update: Change ajax call fron admin-ajax to wc-ajax
|
111 |
+
* Update: Plugin template compare.php
|
112 |
+
* Update: Plugin Core
|
113 |
|
114 |
= 2.0.5 = Released on Oct 30, 2015
|
115 |
|
116 |
+
* Update: Plugin Core
|
117 |
+
* Fix: After you remove product from compare, you can re-add it without reload page
|
118 |
|
119 |
= 2.0.4 = Released on Sep 22, 2015
|
120 |
|
121 |
+
* Update: Changed Text Domain from 'yith-wcmp' to 'yith-woocommerce-compare'
|
122 |
+
* Update: Plugin Core Framework
|
123 |
+
* Fix: JS error when loading compare window
|
124 |
|
125 |
= 2.0.3 = Released on Aug 21, 2015
|
126 |
|
127 |
+
* New: Compatibility with WooPress 4.3
|
128 |
|
129 |
= 2.0.2 = Released on Aug 12, 2015
|
130 |
|
131 |
+
* New: Compatibility with WooCommerce 2.4
|
132 |
+
* Update: Core plugin
|
133 |
|
134 |
= 2.0.1 = Released on Aug 10, 2015
|
135 |
|
136 |
+
* Update: Core plugin
|
137 |
+
* Fix: Compare table layout
|
138 |
+
* Fix: undefined function unblock() in main js
|
139 |
|
140 |
= 2.0.0 = Released on Jul 15, 2015
|
141 |
|
142 |
+
* New: New plugin core
|
143 |
+
* Update: Language files
|
|
|
|
|
|
|
144 |
* Removed: old default.po catalog language file
|
145 |
+
* Fix: Error in class yith-woocompare-fontend
|
146 |
+
* Fix: Lightbox doesn't close after click view cart
|
147 |
+
* Fix: minor bug fix
|
148 |
|
149 |
= 1.2.3 = Released on Feb 13, 2015
|
150 |
|
151 |
+
* New: Bulgarian Translation by Joanna Mikova
|
152 |
+
* New: Spanish Translation by Rodoslav Angelov and Mariano Rivas
|
153 |
|
154 |
= 1.2.2 = Released on Dec 03, 2014
|
155 |
|
156 |
+
* Fix: Shortcode compare
|
157 |
|
158 |
= 1.2.1 = Released on Sep 17, 2014
|
159 |
|
160 |
+
* New: Support to WC 2.2.3
|
161 |
|
162 |
= 1.2.0 = Released on Sep 16, 2014
|
163 |
|
164 |
+
* New: Support to WC 2.2.2
|
165 |
* Update: Compare Template
|
166 |
+
* Update: Plugin Core Framework
|
167 |
+
* Fix: Fields orders
|
168 |
* Tweek: WPML Support improved
|
|
|
169 |
|
170 |
= 1.1.4 = Released on Jun 30, 2014
|
171 |
|
172 |
+
* Update: Colorbox Library Version 1.5.10
|
173 |
+
* Fix: Horizontal scroll bar issue: show at the end of iframe
|
174 |
|
175 |
= 1.1.3 = Released on Jun 05, 2014
|
176 |
|
177 |
+
* New: RTL Support
|
178 |
|
179 |
= 1.1.2 = Released on Mar 21, 2014
|
180 |
|
181 |
+
* Fix: WPML Support on Compare Widget
|
182 |
|
183 |
= 1.1.1 = Released on Feb 19, 2014
|
184 |
|
185 |
+
* Fix: Add to cart Button on Compare page
|
186 |
|
187 |
= 1.1.0 = Released on Feb 13, 2014
|
188 |
|
189 |
+
* New: Support to WooCommerce 2.1.X
|
190 |
+
* New: French translation by Paumo
|
191 |
|
192 |
= 1.0.5 = Released on Oct 14, 2013
|
193 |
|
194 |
+
* New: Persian translation by Khalil Delavaran
|
195 |
+
* New: Compare table title option
|
196 |
+
* New: Compatibility with WPML plugin
|
197 |
+
* New: Brazilian Portuguese translation by hotelwww
|
198 |
+
* Fix: Responsive features
|
199 |
+
* Fix: Dequeued wrong JS scripts
|
200 |
+
* Update: Dutch translation by Frans Pronk
|
201 |
|
202 |
= 1.0.4 = Released on Sep 04, 2013
|
203 |
|
204 |
+
* New: complete Dutch translation. Thanks to Frans Pronk
|
205 |
+
* Fix: Sortable scripts included only in the plugin admin page
|
206 |
+
* Fix: products list in popup don't update after have added a product
|
207 |
|
208 |
= 1.0.3 = Released on Jul 31, 2013
|
209 |
|
215 |
|
216 |
= 1.0.1 = Released on Jun 27, 2013
|
217 |
|
218 |
+
* New: Link/Button text option in plugin options
|
219 |
+
* New: ability to add a link in the menu top open the popup
|
220 |
+
* Fix: bug with attributes added after installation
|
221 |
+
* Fix: bug with plugin activated but not working for multisites
|
222 |
|
223 |
= 1.0.0 = Released on Jun 24, 2013
|
224 |
|
243 |
|
244 |
== Upgrade notice ==
|
245 |
|
246 |
+
= 2.2.0 = Released on Mar 29, 2017
|
247 |
|
248 |
+
* New: Support to WooCommerce 3.0.0 RC2.
|
249 |
+
* New: Support to WordPress 4.7.3
|
250 |
+
* Update: Plugin Core.
|
251 |
+
* Update: Language Files.
|
|
|
|
|
|
|
|
assets/css/colorbox.css
CHANGED
@@ -54,4 +54,8 @@
|
|
54 |
.cboxSlideshow_on #cboxSlideshow{background-position:-125px 0px; right:27px;}
|
55 |
.cboxSlideshow_on #cboxSlideshow:hover{background-position:-150px 0px;}
|
56 |
.cboxSlideshow_off #cboxSlideshow{background-position:-150px -25px; right:27px;}
|
57 |
-
.cboxSlideshow_off #cboxSlideshow:hover{background-position:-125px 0px;}
|
|
|
|
|
|
|
|
54 |
.cboxSlideshow_on #cboxSlideshow{background-position:-125px 0px; right:27px;}
|
55 |
.cboxSlideshow_on #cboxSlideshow:hover{background-position:-150px 0px;}
|
56 |
.cboxSlideshow_off #cboxSlideshow{background-position:-150px -25px; right:27px;}
|
57 |
+
.cboxSlideshow_off #cboxSlideshow:hover{background-position:-125px 0px;}
|
58 |
+
|
59 |
+
.yith_woocompare_colorbox #cboxLoadedContent {
|
60 |
+
overflow: hidden !important;
|
61 |
+
}
|
assets/js/woocompare.js
CHANGED
@@ -67,10 +67,11 @@ jQuery(document).ready(function($) {
|
|
67 |
iframe: true,
|
68 |
width: '90%',
|
69 |
height: '90%',
|
|
|
70 |
onClosed: function(){
|
71 |
var widget_list = $('.yith-woocompare-widget ul.products-list'),
|
72 |
data = {
|
73 |
-
action: yith_woocompare.
|
74 |
context: 'frontend'
|
75 |
};
|
76 |
|
@@ -80,7 +81,7 @@ jQuery(document).ready(function($) {
|
|
80 |
|
81 |
$.ajax({
|
82 |
type: 'post',
|
83 |
-
url: yith_woocompare.ajaxurl.toString().replace( '%%endpoint%%', yith_woocompare.
|
84 |
data: data,
|
85 |
success: function(response){
|
86 |
// add the product in the widget
|
67 |
iframe: true,
|
68 |
width: '90%',
|
69 |
height: '90%',
|
70 |
+
className: 'yith_woocompare_colorbox',
|
71 |
onClosed: function(){
|
72 |
var widget_list = $('.yith-woocompare-widget ul.products-list'),
|
73 |
data = {
|
74 |
+
action: yith_woocompare.actionreload,
|
75 |
context: 'frontend'
|
76 |
};
|
77 |
|
81 |
|
82 |
$.ajax({
|
83 |
type: 'post',
|
84 |
+
url: yith_woocompare.ajaxurl.toString().replace( '%%endpoint%%', yith_woocompare.actionreload ),
|
85 |
data: data,
|
86 |
success: function(response){
|
87 |
// add the product in the widget
|
assets/js/woocompare.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(a){function b(a,b){a=escape(a),b=escape(b);var c=document.location.search,d=a+"="+b,e=new RegExp("(&|\\?)"+a+"=[^&]*");return c=c.replace(e,"$1"+d),RegExp.$1||(c+=(c.length>0?"&":"?")+d),c}a(document).on("click",".product a.compare:not(.added)",function(b){b.preventDefault();var c=a(this),d={action:yith_woocompare.actionadd,id:c.data("product_id"),context:"frontend"},e=a(".yith-woocompare-widget ul.products-list");"undefined"!=typeof a.fn.block&&(c.block({message:null,overlayCSS:{background:"#fff url("+yith_woocompare.loader+") no-repeat center",backgroundSize:"16px 16px",opacity:.6}}),e.block({message:null,overlayCSS:{background:"#fff url("+yith_woocompare.loader+") no-repeat center",backgroundSize:"16px 16px",opacity:.6}})),a.ajax({type:"post",url:yith_woocompare.ajaxurl.toString().replace("%%endpoint%%",yith_woocompare.actionadd),data:d,dataType:"json",success:function(b){"undefined"!=typeof a.fn.block&&(c.unblock(),e.unblock()),c.addClass("added").attr("href",b.table_url).text(yith_woocompare.added_label),e.html(b.widget_table),"yes"==yith_woocompare.auto_open&&a("body").trigger("yith_woocompare_open_popup",{response:b.table_url,button:c})}})}),a(document).on("click",".product a.compare.added",function(b){b.preventDefault();var c=this.href;"undefined"!=typeof c&&a("body").trigger("yith_woocompare_open_popup",{response:c,button:a(this)})}),a("body").on("yith_woocompare_open_popup",function(b,c){var d=c.response;if(a(window).width()>=768)a.colorbox({href:d,iframe:!0,width:"90%",height:"90%",onClosed:function(){var b=a(".yith-woocompare-widget ul.products-list"),c={action:yith_woocompare.
|
1 |
+
jQuery(document).ready(function(a){function b(a,b){a=escape(a),b=escape(b);var c=document.location.search,d=a+"="+b,e=new RegExp("(&|\\?)"+a+"=[^&]*");return c=c.replace(e,"$1"+d),RegExp.$1||(c+=(c.length>0?"&":"?")+d),c}a(document).on("click",".product a.compare:not(.added)",function(b){b.preventDefault();var c=a(this),d={action:yith_woocompare.actionadd,id:c.data("product_id"),context:"frontend"},e=a(".yith-woocompare-widget ul.products-list");"undefined"!=typeof a.fn.block&&(c.block({message:null,overlayCSS:{background:"#fff url("+yith_woocompare.loader+") no-repeat center",backgroundSize:"16px 16px",opacity:.6}}),e.block({message:null,overlayCSS:{background:"#fff url("+yith_woocompare.loader+") no-repeat center",backgroundSize:"16px 16px",opacity:.6}})),a.ajax({type:"post",url:yith_woocompare.ajaxurl.toString().replace("%%endpoint%%",yith_woocompare.actionadd),data:d,dataType:"json",success:function(b){"undefined"!=typeof a.fn.block&&(c.unblock(),e.unblock()),c.addClass("added").attr("href",b.table_url).text(yith_woocompare.added_label),e.html(b.widget_table),"yes"==yith_woocompare.auto_open&&a("body").trigger("yith_woocompare_open_popup",{response:b.table_url,button:c})}})}),a(document).on("click",".product a.compare.added",function(b){b.preventDefault();var c=this.href;"undefined"!=typeof c&&a("body").trigger("yith_woocompare_open_popup",{response:c,button:a(this)})}),a("body").on("yith_woocompare_open_popup",function(b,c){var d=c.response;if(a(window).width()>=768)a.colorbox({href:d,iframe:!0,width:"90%",height:"90%",className:"yith_woocompare_colorbox",onClosed:function(){var b=a(".yith-woocompare-widget ul.products-list"),c={action:yith_woocompare.actionreload,context:"frontend"};"undefined"!=typeof a.fn.block&&b.block({message:null,overlayCSS:{background:"#fff url("+yith_woocompare.loader+") no-repeat center",backgroundSize:"16px 16px",opacity:.6}}),a.ajax({type:"post",url:yith_woocompare.ajaxurl.toString().replace("%%endpoint%%",yith_woocompare.actionreload),data:c,success:function(c){"undefined"!=typeof a.fn.block&&b.unblock().html(c),b.html(c)}})}}),a(window).resize(function(){a.colorbox.resize({width:"90%",height:"90%"})});else{var e=d.split("?"),f="iframe";if(e.length>=2){for(var g=encodeURIComponent(f)+"=",h=e[1].split(/[&;]/g),i=h.length;i-- >0;)h[i].lastIndexOf(g,0)!==-1&&h.splice(i,1);d=e[0]+"?"+h.join("&")}window.open(d,yith_woocompare.table_title)}}),a(document).on("click",".remove a",function(b){b.preventDefault();var c=a(this),d={action:yith_woocompare.actionremove,id:c.data("product_id"),context:"frontend"};a("td.product_"+d.id+", th.product_"+d.id);"undefined"!=typeof a.fn.block&&c.block({message:null,overlayCSS:{background:"#fff url("+yith_woocompare.loader+") no-repeat center",backgroundSize:"16px 16px",opacity:.6}}),a.ajax({type:"post",url:yith_woocompare.ajaxurl.toString().replace("%%endpoint%%",yith_woocompare.actionremove),data:d,dataType:"html",success:function(b){var d=a(b).filter("table.compare-list");a("body > table.compare-list").replaceWith(d),a('.compare[data-product_id="'+c.data("product_id")+'"]',window.parent.document).removeClass("added").html(yith_woocompare.button_text),a(window).trigger("yith_woocompare_product_removed")}})}),a(".yith-woocompare-open a, a.yith-woocompare-open").on("click",function(c){c.preventDefault(),a("body").trigger("yith_woocompare_open_popup",{response:b("action",yith_woocompare.actionview)+"&iframe=true"})}),a(".yith-woocompare-widget").on("click","a.compare",function(b){b.preventDefault(),a("body").trigger("yith_woocompare_open_popup",{response:a(this).attr("href")})}).on("click","li a.remove, a.clear-all",function(b){b.preventDefault();var c=a(".yith-woocompare-widget .products-list").data("lang"),d=a(this),e=d.data("product_id"),f={action:yith_woocompare.actionremove,id:e,context:"frontend",responseType:"product_list",lang:c},g=d.parents(".yith-woocompare-widget").find("ul.products-list");"undefined"!=typeof a.fn.block&&g.block({message:null,overlayCSS:{background:"#fff url("+yith_woocompare.loader+") no-repeat center",backgroundSize:"16px 16px",opacity:.6}}),a.ajax({type:"post",url:yith_woocompare.ajaxurl.toString().replace("%%endpoint%%",yith_woocompare.actionremove),data:f,dataType:"html",success:function(b){"all"==e?a(".compare.added").removeClass("added").html(yith_woocompare.button_text):a('.compare[data-product_id="'+e+'"]').removeClass("added").html(yith_woocompare.button_text),g.html(b),"undefined"!=typeof a.fn.block&&g.unblock()}})})});
|
includes/class.yith-woocompare-admin.php
CHANGED
@@ -86,9 +86,6 @@ if ( ! class_exists( 'YITH_Woocompare_Admin' ) ) {
|
|
86 |
add_action( 'admin_init', array( $this, 'register_pointer' ) );
|
87 |
add_action( 'admin_init', array( $this, 'default_options'), 99 );
|
88 |
|
89 |
-
// add image size
|
90 |
-
YITH_Woocompare_Helper::set_image_size();
|
91 |
-
|
92 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ), 20 );
|
93 |
|
94 |
add_action( 'woocommerce_admin_field_woocompare_image_width', array( $this, 'admin_fields_woocompare_image_width' ) );
|
@@ -153,8 +150,8 @@ if ( ! class_exists( 'YITH_Woocompare_Admin' ) ) {
|
|
153 |
$args = array(
|
154 |
'create_menu_page' => true,
|
155 |
'parent_slug' => '',
|
156 |
-
'page_title' =>
|
157 |
-
'menu_title' =>
|
158 |
'capability' => 'manage_options',
|
159 |
'parent' => '',
|
160 |
'parent_page' => 'yit_plugin_panel',
|
@@ -382,7 +379,6 @@ if ( ! class_exists( 'YITH_Woocompare_Admin' ) ) {
|
|
382 |
|
383 |
$width = WC_Admin_Settings::get_option( $value['id'] . '[width]', $value['default']['width'] );
|
384 |
$height = WC_Admin_Settings::get_option( $value['id'] . '[height]', $value['default']['height'] );
|
385 |
-
$crop = WC_Admin_Settings::get_option( $value['id'] . '[crop]', $value['default']['crop'] );
|
386 |
$crop = WC_Admin_Settings::get_option( $value['id'] . '[crop]' );
|
387 |
$crop = ( $crop == 'on' || $crop == '1' ) ? 1 : 0;
|
388 |
$crop = checked( 1, $crop, false );
|
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' ) );
|
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' => 'yit_plugin_panel',
|
379 |
|
380 |
$width = WC_Admin_Settings::get_option( $value['id'] . '[width]', $value['default']['width'] );
|
381 |
$height = WC_Admin_Settings::get_option( $value['id'] . '[height]', $value['default']['height'] );
|
|
|
382 |
$crop = WC_Admin_Settings::get_option( $value['id'] . '[crop]' );
|
383 |
$crop = ( $crop == 'on' || $crop == '1' ) ? 1 : 0;
|
384 |
$crop = checked( 1, $crop, false );
|
includes/class.yith-woocompare-frontend.php
CHANGED
@@ -40,6 +40,14 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
40 |
*/
|
41 |
public $template_file = 'compare.php';
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
/**
|
44 |
* The name of cookie name
|
45 |
*
|
@@ -72,6 +80,14 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
72 |
*/
|
73 |
public $action_remove = 'yith-woocompare-remove-product';
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
/**
|
76 |
* The standard fields
|
77 |
*
|
@@ -96,9 +112,6 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
96 |
// populate default fields for the comparison table
|
97 |
$this->default_fields = YITH_Woocompare_Helper::standard_fields();
|
98 |
|
99 |
-
// add image size
|
100 |
-
YITH_Woocompare_Helper::set_image_size();
|
101 |
-
|
102 |
// Add link or button in the products list or
|
103 |
if ( get_option('yith_woocompare_compare_button_in_product_page') == 'yes' ) add_action( 'woocommerce_single_product_summary', array( $this, 'add_compare_link' ), 35 );
|
104 |
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,16 +127,17 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
114 |
if( version_compare( WC()->version, '2.4', '>=' ) ){
|
115 |
add_action( 'wc_ajax_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
|
116 |
add_action( 'wc_ajax_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
|
117 |
-
add_action( 'wc_ajax_' . $this->
|
118 |
}
|
119 |
else {
|
120 |
add_action( 'wp_ajax_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
|
121 |
-
add_action( 'wp_ajax_nopriv_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
|
122 |
add_action( 'wp_ajax_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
|
123 |
-
add_action( '
|
124 |
-
add_action( 'wp_ajax_' . $this->action_view, array( $this, 'refresh_widget_list_ajax' ) );
|
125 |
-
add_action( 'wp_ajax_nopriv_' . $this->action_view, array( $this, 'refresh_widget_list_ajax' ) );
|
126 |
}
|
|
|
|
|
|
|
|
|
127 |
|
128 |
return $this;
|
129 |
}
|
@@ -159,12 +173,14 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
159 |
|
160 |
// check for deleted|private products
|
161 |
$product = wc_get_product( $product_id );
|
162 |
-
if( ! $product || $product
|
163 |
continue;
|
164 |
}
|
165 |
|
166 |
$this->products_list[] = $product_id;
|
167 |
}
|
|
|
|
|
168 |
}
|
169 |
|
170 |
/**
|
@@ -178,18 +194,24 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
178 |
|
179 |
// enqueue and add localize
|
180 |
wp_enqueue_script( 'yith-woocompare-main' );
|
181 |
-
|
|
|
|
|
182 |
'ajaxurl' => version_compare( WC()->version, '2.4', '>=' ) ? WC_AJAX::get_endpoint( "%%endpoint%%" ) : admin_url( 'admin-ajax.php', 'relative' ),
|
183 |
'actionadd' => $this->action_add,
|
184 |
'actionremove' => $this->action_remove,
|
185 |
'actionview' => $this->action_view,
|
|
|
186 |
'added_label' => apply_filters( 'yith_woocompare_compare_added_label', __( 'Added', 'yith-woocommerce-compare' ) ),
|
187 |
'table_title' => apply_filters( 'yith_woocompare_compare_table_title',__( 'Product Comparison', 'yith-woocommerce-compare' ) ),
|
188 |
'auto_open' => get_option( 'yith_woocompare_auto_open', 'yes' ),
|
189 |
'loader' => YITH_WOOCOMPARE_ASSETS_URL . '/images/loader.gif',
|
190 |
-
'button_text' => get_option('yith_woocompare_button_text')
|
|
|
191 |
));
|
192 |
|
|
|
|
|
193 |
// colorbox
|
194 |
wp_enqueue_style( 'jquery-colorbox', YITH_WOOCOMPARE_ASSETS_URL . '/css/colorbox.css' );
|
195 |
wp_enqueue_script( 'jquery-colorbox', YITH_WOOCOMPARE_ASSETS_URL . '/js/jquery.colorbox-min.js', array('jquery'), '1.4.21', true );
|
@@ -207,7 +229,7 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
207 |
* @return mixed|void
|
208 |
* @since 1.0.0
|
209 |
*/
|
210 |
-
public function fields() {
|
211 |
|
212 |
$fields = get_option( 'yith_woocompare_fields', array() );
|
213 |
|
@@ -227,7 +249,7 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
227 |
}
|
228 |
}
|
229 |
|
230 |
-
return $fields;
|
231 |
}
|
232 |
|
233 |
/**
|
@@ -289,18 +311,22 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
289 |
/**
|
290 |
* Return the array with all products and all attributes values
|
291 |
*
|
|
|
292 |
* @return array The complete list of products with all attributes value
|
293 |
*/
|
294 |
public function get_products_list( $products = array() ) {
|
295 |
$list = array();
|
296 |
|
297 |
-
|
298 |
$products = apply_filters( 'yith_woocompare_exclude_products_from_list', $products );
|
299 |
|
300 |
-
$fields = $this->fields();
|
301 |
|
302 |
foreach ( $products as $product_id ) {
|
303 |
|
|
|
|
|
|
|
304 |
$product = $this->wc_get_product( $product_id );
|
305 |
|
306 |
if ( ! $product )
|
@@ -322,14 +348,15 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
322 |
$product->fields[$field] = intval( get_post_thumbnail_id( $product_id ) );
|
323 |
break;
|
324 |
case 'description':
|
325 |
-
$
|
|
|
326 |
break;
|
327 |
case 'stock':
|
328 |
$availability = $product->get_availability();
|
329 |
if ( empty( $availability['availability'] ) ) {
|
330 |
$availability['availability'] = __( 'In stock', 'yith-woocommerce-compare' );
|
331 |
}
|
332 |
-
$product->fields[$field] = sprintf( '<span
|
333 |
break;
|
334 |
case 'weight':
|
335 |
if( $weight = $product->get_weight() ){
|
@@ -341,9 +368,9 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
341 |
$product->fields[$field] = sprintf( '<span>%s</span>', esc_html( $weight ) );
|
342 |
break;
|
343 |
case 'dimensions':
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
$product->fields[$field] = sprintf( '<span>%s</span>', esc_html( $dimensions ) );
|
348 |
break;
|
349 |
default:
|
@@ -365,7 +392,7 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
365 |
}
|
366 |
}
|
367 |
|
368 |
-
$list[] = $product;
|
369 |
}
|
370 |
|
371 |
return $list;
|
@@ -414,7 +441,7 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
414 |
/**
|
415 |
* The URL to remove the product into the comparison table
|
416 |
*
|
417 |
-
* @param $product_id The ID of the product to remove
|
418 |
* @return string The url to remove the product in the comparison table
|
419 |
*/
|
420 |
public function remove_product_url( $product_id ) {
|
@@ -433,7 +460,7 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
433 |
|
434 |
if ( ! $product_id ) {
|
435 |
global $product;
|
436 |
-
$product_id =
|
437 |
}
|
438 |
|
439 |
// return if product doesn't exist
|
@@ -457,7 +484,7 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
457 |
public function stylesheet_url() {
|
458 |
global $woocommerce;
|
459 |
|
460 |
-
$filename =
|
461 |
|
462 |
$plugin_path = array( 'path' => YITH_WOOCOMPARE_DIR . '/assets/css/style.css', 'url' => YITH_WOOCOMPARE_ASSETS_URL . '/css/style.css' );
|
463 |
|
@@ -535,10 +562,10 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
535 |
|
536 |
do_action( 'yith_woocompare_add_product_action_ajax' );
|
537 |
|
538 |
-
|
539 |
'table_url' => $this->view_table_url( $product_id ),
|
540 |
-
|
541 |
-
|
542 |
|
543 |
echo json_encode( $json );
|
544 |
die();
|
@@ -552,7 +579,7 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
552 |
public function add_product_to_compare( $product_id ) {
|
553 |
|
554 |
$this->products_list[] = $product_id;
|
555 |
-
setcookie( $this->cookie_name, json_encode( $this->products_list ), 0, COOKIEPATH, COOKIE_DOMAIN, false,
|
556 |
|
557 |
do_action( 'yith_woocompare_after_add_product', $product_id );
|
558 |
}
|
@@ -565,14 +592,7 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
565 |
return;
|
566 |
}
|
567 |
|
568 |
-
|
569 |
-
$products = $this->products_list;
|
570 |
-
foreach ( $products as $product_id ) {
|
571 |
-
$this->remove_product_from_compare( intval( $product_id ) );
|
572 |
-
}
|
573 |
-
} else {
|
574 |
-
$this->remove_product_from_compare( intval( $_REQUEST['id'] ) );
|
575 |
-
}
|
576 |
|
577 |
// redirect
|
578 |
$redirect = esc_url( remove_query_arg( array( 'id', 'action' ) ) );
|
@@ -595,14 +615,7 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
595 |
|
596 |
$lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
|
597 |
|
598 |
-
|
599 |
-
$products = $this->products_list;
|
600 |
-
foreach ( $products as $product_id ) {
|
601 |
-
$this->remove_product_from_compare( intval( $product_id ) );
|
602 |
-
}
|
603 |
-
} else {
|
604 |
-
$this->remove_product_from_compare( intval( $_REQUEST['id'] ) );
|
605 |
-
}
|
606 |
|
607 |
do_action( 'yith_woocompare_remove_product_action_ajax' );
|
608 |
|
@@ -620,13 +633,15 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
620 |
/**
|
621 |
* Return the list of widget table, used in AJAX
|
622 |
*/
|
623 |
-
public function
|
624 |
|
625 |
-
if ( ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->
|
626 |
die();
|
627 |
}
|
628 |
|
629 |
-
|
|
|
|
|
630 |
die();
|
631 |
}
|
632 |
|
@@ -651,6 +666,9 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
651 |
}
|
652 |
|
653 |
foreach ( $this->products_list as $product_id ) {
|
|
|
|
|
|
|
654 |
$product = $this->wc_get_product( $product_id );
|
655 |
if ( ! $product )
|
656 |
continue;
|
@@ -673,10 +691,19 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
673 |
* @param $product_id The product ID to remove from the comparison table
|
674 |
*/
|
675 |
public function remove_product_from_compare( $product_id ) {
|
676 |
-
|
677 |
-
|
|
|
678 |
}
|
679 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
680 |
|
681 |
do_action( 'yith_woocompare_after_remove_product', $product_id );
|
682 |
}
|
@@ -708,7 +735,7 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
708 |
*/
|
709 |
if ( ! $atts['product'] ) {
|
710 |
global $product;
|
711 |
-
$product_id =
|
712 |
} else {
|
713 |
global $wpdb;
|
714 |
$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'] ) );
|
@@ -718,7 +745,8 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
|
|
718 |
}
|
719 |
|
720 |
// if product ID is 0, maybe the product doesn't exists or is wrong.. in this case, doesn't show the button
|
721 |
-
if ( empty( $product_id ) )
|
|
|
722 |
|
723 |
ob_start();
|
724 |
if ( $atts['container'] == 'yes' ) echo '<div class="woocommerce product compare-button">';
|
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 |
*
|
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 |
*
|
112 |
// populate default fields for the comparison table
|
113 |
$this->default_fields = YITH_Woocompare_Helper::standard_fields();
|
114 |
|
|
|
|
|
|
|
115 |
// Add link or button in the products list or
|
116 |
if ( get_option('yith_woocompare_compare_button_in_product_page') == 'yes' ) add_action( 'woocommerce_single_product_summary', array( $this, 'add_compare_link' ), 35 );
|
117 |
if ( get_option('yith_woocompare_compare_button_in_products_list') == 'yes' ) add_action( 'woocommerce_after_shop_loop_item', array( $this, 'add_compare_link' ), 20 );
|
127 |
if( version_compare( WC()->version, '2.4', '>=' ) ){
|
128 |
add_action( 'wc_ajax_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
|
129 |
add_action( 'wc_ajax_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
|
130 |
+
add_action( 'wc_ajax_' . $this->action_reload, array( $this, 'reload_widget_list_ajax' ) );
|
131 |
}
|
132 |
else {
|
133 |
add_action( 'wp_ajax_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
|
|
|
134 |
add_action( 'wp_ajax_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
|
135 |
+
add_action( 'wp_ajax_' . $this->action_reload, array( $this, 'reload_widget_list_ajax' ) );
|
|
|
|
|
136 |
}
|
137 |
+
// no priv
|
138 |
+
add_action( 'wp_ajax_nopriv_' . $this->action_add, array( $this, 'add_product_to_compare_ajax' ) );
|
139 |
+
add_action( 'wp_ajax_nopriv_' . $this->action_remove, array( $this, 'remove_product_from_compare_ajax' ) );
|
140 |
+
add_action( 'wp_ajax_nopriv_' . $this->action_reload, array( $this, 'reload_widget_list_ajax' ) );
|
141 |
|
142 |
return $this;
|
143 |
}
|
173 |
|
174 |
// check for deleted|private products
|
175 |
$product = wc_get_product( $product_id );
|
176 |
+
if( ! $product || yit_get_prop( $product, 'post_status' ) !== 'publish' ) {
|
177 |
continue;
|
178 |
}
|
179 |
|
180 |
$this->products_list[] = $product_id;
|
181 |
}
|
182 |
+
|
183 |
+
do_action( 'yith_woocompare_after_populate_product_list', $this->products_list );
|
184 |
}
|
185 |
|
186 |
/**
|
194 |
|
195 |
// enqueue and add localize
|
196 |
wp_enqueue_script( 'yith-woocompare-main' );
|
197 |
+
|
198 |
+
// localize script args
|
199 |
+
$args = apply_filters( 'yith_woocompare_main_script_localize_array', array(
|
200 |
'ajaxurl' => version_compare( WC()->version, '2.4', '>=' ) ? WC_AJAX::get_endpoint( "%%endpoint%%" ) : admin_url( 'admin-ajax.php', 'relative' ),
|
201 |
'actionadd' => $this->action_add,
|
202 |
'actionremove' => $this->action_remove,
|
203 |
'actionview' => $this->action_view,
|
204 |
+
'actionreload' => $this->action_reload,
|
205 |
'added_label' => apply_filters( 'yith_woocompare_compare_added_label', __( 'Added', 'yith-woocommerce-compare' ) ),
|
206 |
'table_title' => apply_filters( 'yith_woocompare_compare_table_title',__( 'Product Comparison', 'yith-woocommerce-compare' ) ),
|
207 |
'auto_open' => get_option( 'yith_woocompare_auto_open', 'yes' ),
|
208 |
'loader' => YITH_WOOCOMPARE_ASSETS_URL . '/images/loader.gif',
|
209 |
+
'button_text' => get_option('yith_woocompare_button_text'),
|
210 |
+
'cookie_name' => $this->cookie_name
|
211 |
));
|
212 |
|
213 |
+
wp_localize_script( 'yith-woocompare-main', 'yith_woocompare', $args );
|
214 |
+
|
215 |
// colorbox
|
216 |
wp_enqueue_style( 'jquery-colorbox', YITH_WOOCOMPARE_ASSETS_URL . '/css/colorbox.css' );
|
217 |
wp_enqueue_script( 'jquery-colorbox', YITH_WOOCOMPARE_ASSETS_URL . '/js/jquery.colorbox-min.js', array('jquery'), '1.4.21', true );
|
229 |
* @return mixed|void
|
230 |
* @since 1.0.0
|
231 |
*/
|
232 |
+
public function fields( $products = array() ) {
|
233 |
|
234 |
$fields = get_option( 'yith_woocompare_fields', array() );
|
235 |
|
249 |
}
|
250 |
}
|
251 |
|
252 |
+
return apply_filters( 'yith_woocompare_filter_table_fields', $fields, $products );
|
253 |
}
|
254 |
|
255 |
/**
|
311 |
/**
|
312 |
* Return the array with all products and all attributes values
|
313 |
*
|
314 |
+
* @param mixed $products
|
315 |
* @return array The complete list of products with all attributes value
|
316 |
*/
|
317 |
public function get_products_list( $products = array() ) {
|
318 |
$list = array();
|
319 |
|
320 |
+
empty( $products ) && $products = $this->products_list;
|
321 |
$products = apply_filters( 'yith_woocompare_exclude_products_from_list', $products );
|
322 |
|
323 |
+
$fields = $this->fields( $products );
|
324 |
|
325 |
foreach ( $products as $product_id ) {
|
326 |
|
327 |
+
/**
|
328 |
+
* @type object $product /WC_Product
|
329 |
+
*/
|
330 |
$product = $this->wc_get_product( $product_id );
|
331 |
|
332 |
if ( ! $product )
|
348 |
$product->fields[$field] = intval( get_post_thumbnail_id( $product_id ) );
|
349 |
break;
|
350 |
case 'description':
|
351 |
+
$description = apply_filters( 'woocommerce_short_description', yit_get_prop( $product, 'post_excerpt' ) );
|
352 |
+
$product->fields[$field] = apply_filters( 'yith_woocompare_products_description', $description );
|
353 |
break;
|
354 |
case 'stock':
|
355 |
$availability = $product->get_availability();
|
356 |
if ( empty( $availability['availability'] ) ) {
|
357 |
$availability['availability'] = __( 'In stock', 'yith-woocommerce-compare' );
|
358 |
}
|
359 |
+
$product->fields[$field] = sprintf( '<span>%s</span>', esc_html( $availability['availability'] ) );
|
360 |
break;
|
361 |
case 'weight':
|
362 |
if( $weight = $product->get_weight() ){
|
368 |
$product->fields[$field] = sprintf( '<span>%s</span>', esc_html( $weight ) );
|
369 |
break;
|
370 |
case 'dimensions':
|
371 |
+
$dimensions = function_exists( 'wc_format_dimensions' ) ? wc_format_dimensions( $product->get_dimensions(false) ) : $product->get_dimensions();
|
372 |
+
! $dimensions && $dimensions = '-';
|
373 |
+
|
374 |
$product->fields[$field] = sprintf( '<span>%s</span>', esc_html( $dimensions ) );
|
375 |
break;
|
376 |
default:
|
392 |
}
|
393 |
}
|
394 |
|
395 |
+
$list[ $product_id ] = $product;
|
396 |
}
|
397 |
|
398 |
return $list;
|
441 |
/**
|
442 |
* The URL to remove the product into the comparison table
|
443 |
*
|
444 |
+
* @param string $product_id The ID of the product to remove
|
445 |
* @return string The url to remove the product in the comparison table
|
446 |
*/
|
447 |
public function remove_product_url( $product_id ) {
|
460 |
|
461 |
if ( ! $product_id ) {
|
462 |
global $product;
|
463 |
+
$product_id = ! is_null( $product ) ? yit_get_prop( $product, 'id', true ) : 0;
|
464 |
}
|
465 |
|
466 |
// return if product doesn't exist
|
484 |
public function stylesheet_url() {
|
485 |
global $woocommerce;
|
486 |
|
487 |
+
$filename = $this->stylesheet_file;
|
488 |
|
489 |
$plugin_path = array( 'path' => YITH_WOOCOMPARE_DIR . '/assets/css/style.css', 'url' => YITH_WOOCOMPARE_ASSETS_URL . '/css/style.css' );
|
490 |
|
562 |
|
563 |
do_action( 'yith_woocompare_add_product_action_ajax' );
|
564 |
|
565 |
+
$json = apply_filters( 'yith_woocompare_add_product_action_json', array(
|
566 |
'table_url' => $this->view_table_url( $product_id ),
|
567 |
+
'widget_table' => $this->list_products_html(),
|
568 |
+
) );
|
569 |
|
570 |
echo json_encode( $json );
|
571 |
die();
|
579 |
public function add_product_to_compare( $product_id ) {
|
580 |
|
581 |
$this->products_list[] = $product_id;
|
582 |
+
setcookie( $this->cookie_name, json_encode( $this->products_list ), 0, COOKIEPATH, COOKIE_DOMAIN, false, false );
|
583 |
|
584 |
do_action( 'yith_woocompare_after_add_product', $product_id );
|
585 |
}
|
592 |
return;
|
593 |
}
|
594 |
|
595 |
+
$this->remove_product_from_compare( $_REQUEST['id'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
596 |
|
597 |
// redirect
|
598 |
$redirect = esc_url( remove_query_arg( array( 'id', 'action' ) ) );
|
615 |
|
616 |
$lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
|
617 |
|
618 |
+
$this->remove_product_from_compare( $_REQUEST['id'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
619 |
|
620 |
do_action( 'yith_woocompare_remove_product_action_ajax' );
|
621 |
|
633 |
/**
|
634 |
* Return the list of widget table, used in AJAX
|
635 |
*/
|
636 |
+
public function reload_widget_list_ajax() {
|
637 |
|
638 |
+
if ( ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] != $this->action_reload ){
|
639 |
die();
|
640 |
}
|
641 |
|
642 |
+
$lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : false;
|
643 |
+
|
644 |
+
echo $this->list_products_html( $lang );
|
645 |
die();
|
646 |
}
|
647 |
|
666 |
}
|
667 |
|
668 |
foreach ( $this->products_list as $product_id ) {
|
669 |
+
/**
|
670 |
+
* @type object $product /WC_Product
|
671 |
+
*/
|
672 |
$product = $this->wc_get_product( $product_id );
|
673 |
if ( ! $product )
|
674 |
continue;
|
691 |
* @param $product_id The product ID to remove from the comparison table
|
692 |
*/
|
693 |
public function remove_product_from_compare( $product_id ) {
|
694 |
+
|
695 |
+
if( $product_id == 'all' ) {
|
696 |
+
$this->products_list = array();
|
697 |
}
|
698 |
+
else {
|
699 |
+
foreach ( $this->products_list as $k => $id ) {
|
700 |
+
if ( intval( $product_id ) == $id ) {
|
701 |
+
unset( $this->products_list[ $k ] );
|
702 |
+
}
|
703 |
+
}
|
704 |
+
}
|
705 |
+
|
706 |
+
setcookie( $this->cookie_name, json_encode( array_values( $this->products_list ) ), 0, COOKIEPATH, COOKIE_DOMAIN, false, false );
|
707 |
|
708 |
do_action( 'yith_woocompare_after_remove_product', $product_id );
|
709 |
}
|
735 |
*/
|
736 |
if ( ! $atts['product'] ) {
|
737 |
global $product;
|
738 |
+
$product_id = ! is_null( $product ) ? yit_get_prop( $product, 'id', true ) : 0;
|
739 |
} else {
|
740 |
global $wpdb;
|
741 |
$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'] ) );
|
745 |
}
|
746 |
|
747 |
// if product ID is 0, maybe the product doesn't exists or is wrong.. in this case, doesn't show the button
|
748 |
+
if ( empty( $product_id ) )
|
749 |
+
return '';
|
750 |
|
751 |
ob_start();
|
752 |
if ( $atts['container'] == 'yes' ) echo '<div class="woocommerce product compare-button">';
|
includes/class.yith-woocompare.php
CHANGED
@@ -41,9 +41,11 @@ if( !class_exists( 'YITH_Woocompare' ) ) {
|
|
41 |
*/
|
42 |
public function __construct() {
|
43 |
|
44 |
-
// init widget
|
45 |
add_action( 'widgets_init', array( $this, 'registerWidgets' ) );
|
46 |
|
|
|
|
|
|
|
47 |
if( $this->is_frontend() ) {
|
48 |
|
49 |
// require frontend class
|
@@ -53,15 +55,15 @@ if( !class_exists( 'YITH_Woocompare' ) ) {
|
|
53 |
}
|
54 |
elseif( $this->is_admin() ) {
|
55 |
|
56 |
-
|
57 |
-
add_action( 'after_setup_theme', array( $this, 'plugin_fw_loader' ), 1 );
|
58 |
-
|
59 |
-
// require admin class
|
60 |
require_once('class.yith-woocompare-admin.php');
|
61 |
|
62 |
$this->obj = new YITH_Woocompare_Admin();
|
63 |
}
|
64 |
|
|
|
|
|
|
|
65 |
return $this->obj;
|
66 |
}
|
67 |
|
@@ -72,7 +74,7 @@ if( !class_exists( 'YITH_Woocompare' ) ) {
|
|
72 |
public function is_frontend() {
|
73 |
$is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
|
74 |
$context_check = isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'frontend';
|
75 |
-
$actions_to_check = array( 'woof_draw_products' );
|
76 |
$action_check = isset( $_REQUEST['action'] ) && in_array( $_REQUEST['action'], $actions_to_check );
|
77 |
|
78 |
return (bool) ( ! is_admin() || ( $is_ajax && ( $context_check || $action_check ) ) );
|
@@ -84,7 +86,8 @@ if( !class_exists( 'YITH_Woocompare' ) ) {
|
|
84 |
*/
|
85 |
public function is_admin() {
|
86 |
$is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
|
87 |
-
|
|
|
88 |
}
|
89 |
|
90 |
/**
|
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
|
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 |
return $this->obj;
|
68 |
}
|
69 |
|
74 |
public function is_frontend() {
|
75 |
$is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
|
76 |
$context_check = isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'frontend';
|
77 |
+
$actions_to_check = apply_filters( 'yith_woocompare_actions_to_check_frontend', array( 'woof_draw_products' ) );
|
78 |
$action_check = isset( $_REQUEST['action'] ) && in_array( $_REQUEST['action'], $actions_to_check );
|
79 |
|
80 |
return (bool) ( ! is_admin() || ( $is_ajax && ( $context_check || $action_check ) ) );
|
86 |
*/
|
87 |
public function is_admin() {
|
88 |
$is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
|
89 |
+
$is_admin = ( is_admin() || $is_ajax && isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'admin' );
|
90 |
+
return apply_filters( 'yith_woocompare_check_is_admin', (bool) $is_admin );
|
91 |
}
|
92 |
|
93 |
/**
|
init.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: YITH WooCommerce Compare
|
4 |
* Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-compare/
|
5 |
* Description: YITH WooCommerce Compare allows you to compare more products with WooCommerce plugin, through product attributes.
|
6 |
-
* Version: 2.
|
7 |
* Author: YITHEMES
|
8 |
* Author URI: https://yithemes.com/
|
9 |
* Text Domain: yith-woocommerce-compare
|
@@ -11,7 +11,7 @@
|
|
11 |
*
|
12 |
* @author Yithemes
|
13 |
* @package YITH WooCommerce Compare
|
14 |
-
* @version 2.
|
15 |
*/
|
16 |
/* Copyright 2013 Your Inspiration Themes (email : plugins@yithemes.com)
|
17 |
|
@@ -56,7 +56,7 @@ if ( ! function_exists( 'yith_plugin_registration_hook' ) ) {
|
|
56 |
register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
|
57 |
|
58 |
if ( ! defined( 'YITH_WOOCOMPARE_VERSION' ) ){
|
59 |
-
define( 'YITH_WOOCOMPARE_VERSION', '2.
|
60 |
}
|
61 |
if ( ! defined( 'YITH_WOOCOMPARE_FREE_INIT' ) ) {
|
62 |
define( 'YITH_WOOCOMPARE_FREE_INIT', plugin_basename( __FILE__ ) );
|
3 |
* Plugin Name: YITH WooCommerce Compare
|
4 |
* Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-compare/
|
5 |
* Description: YITH WooCommerce Compare allows you to compare more products with WooCommerce plugin, through product attributes.
|
6 |
+
* Version: 2.2.0
|
7 |
* Author: YITHEMES
|
8 |
* Author URI: https://yithemes.com/
|
9 |
* Text Domain: yith-woocommerce-compare
|
11 |
*
|
12 |
* @author Yithemes
|
13 |
* @package YITH WooCommerce Compare
|
14 |
+
* @version 2.2.0
|
15 |
*/
|
16 |
/* Copyright 2013 Your Inspiration Themes (email : plugins@yithemes.com)
|
17 |
|
56 |
register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
|
57 |
|
58 |
if ( ! defined( 'YITH_WOOCOMPARE_VERSION' ) ){
|
59 |
+
define( 'YITH_WOOCOMPARE_VERSION', '2.2.0' );
|
60 |
}
|
61 |
if ( ! defined( 'YITH_WOOCOMPARE_FREE_INIT' ) ) {
|
62 |
define( 'YITH_WOOCOMPARE_FREE_INIT', plugin_basename( __FILE__ ) );
|
languages/yith-woocommerce-compare-pt_BR.mo
CHANGED
Binary file
|
languages/yith-woocommerce-compare-pt_BR.po
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: YITH Woocommerce Compare\n"
|
4 |
-
"POT-Creation-Date:
|
5 |
-
"PO-Revision-Date:
|
6 |
"Last-Translator: Nicola Mustone <mail@nicolamustone.it>\n"
|
7 |
"Language-Team: Your Inspiration Themes <support@yithemes.com>\n"
|
8 |
"Language: pt_BR\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Generator: Poedit 1.8.
|
13 |
"X-Poedit-KeywordsList: __;_e;_x\n"
|
14 |
"X-Poedit-Basepath: ..\n"
|
15 |
"X-Poedit-SourceCharset: UTF-8\n"
|
@@ -29,8 +29,8 @@ msgstr ""
|
|
29 |
|
30 |
#: includes/class.yith-woocompare-admin.php:156
|
31 |
#: includes/class.yith-woocompare-admin.php:157
|
32 |
-
#: includes/class.yith-woocompare-frontend.php:
|
33 |
-
#: plugin-options/general-options.php:
|
34 |
#: widgets/class.yith-woocompare-widget.php:51
|
35 |
msgid "Compare"
|
36 |
msgstr "Comparar"
|
@@ -70,23 +70,23 @@ msgstr ""
|
|
70 |
msgid "Do you want to hard crop the image?"
|
71 |
msgstr ""
|
72 |
|
73 |
-
#: includes/class.yith-woocompare-frontend.php:
|
74 |
msgid "Added"
|
75 |
msgstr "Adicionado"
|
76 |
|
77 |
-
#: includes/class.yith-woocompare-frontend.php:
|
78 |
msgid "Product Comparison"
|
79 |
msgstr "Comparação de Produtos"
|
80 |
|
81 |
-
#: includes/class.yith-woocompare-frontend.php:
|
82 |
msgid "In stock"
|
83 |
msgstr "No estoque"
|
84 |
|
85 |
-
#: includes/class.yith-woocompare-frontend.php:
|
86 |
msgid "No products to compare"
|
87 |
msgstr "Não há produtos à comparar"
|
88 |
|
89 |
-
#: includes/class.yith-woocompare-frontend.php:
|
90 |
msgid "Remove"
|
91 |
msgstr "Remover"
|
92 |
|
@@ -117,11 +117,11 @@ msgstr "Disponibilidade"
|
|
117 |
|
118 |
#: includes/class.yith-woocompare-helper.php:51
|
119 |
msgid "Weight"
|
120 |
-
msgstr ""
|
121 |
|
122 |
#: includes/class.yith-woocompare-helper.php:52
|
123 |
msgid "Dimensions"
|
124 |
-
msgstr ""
|
125 |
|
126 |
#: init.php:40
|
127 |
msgid ""
|
@@ -144,70 +144,70 @@ msgid "Link or Button"
|
|
144 |
msgstr "Link ou Botão"
|
145 |
|
146 |
#: plugin-options/general-options.php:25
|
147 |
-
msgid "Choose if you want to use a link or a button for the
|
148 |
-
msgstr "
|
149 |
|
150 |
-
#: plugin-options/general-options.php:
|
151 |
msgid "Link"
|
152 |
msgstr "Link"
|
153 |
|
154 |
-
#: plugin-options/general-options.php:
|
155 |
msgid "Button"
|
156 |
msgstr "Botão"
|
157 |
|
158 |
-
#: plugin-options/general-options.php:
|
159 |
msgid "Link/Button text"
|
160 |
msgstr "Texto Link/Botão"
|
161 |
|
162 |
-
#: plugin-options/general-options.php:
|
163 |
msgid "Type the text to use for the button or the link of the compare."
|
164 |
msgstr "Insira o texto usado no botão de comparação."
|
165 |
|
166 |
-
#: plugin-options/general-options.php:
|
167 |
msgid "Show button in single product page"
|
168 |
msgstr "Mostrar na página de produto único"
|
169 |
|
170 |
-
#: plugin-options/general-options.php:
|
171 |
msgid "Say if you want to show the button in the single product page."
|
172 |
msgstr "Marque para mostrar na página de produto único"
|
173 |
|
174 |
-
#: plugin-options/general-options.php:
|
175 |
msgid "Show button in products list"
|
176 |
msgstr "Mostrar na lista de produtos"
|
177 |
|
178 |
-
#: plugin-options/general-options.php:
|
179 |
msgid "Say if you want to show the button in the products list."
|
180 |
msgstr "Marque para mostrar na lista de produtos"
|
181 |
|
182 |
-
#: plugin-options/general-options.php:
|
183 |
msgid "Open automatically lightbox"
|
184 |
msgstr "Abrir lightbox automaticamente"
|
185 |
|
186 |
-
#: plugin-options/general-options.php:
|
187 |
msgid "Open link after click into \"Compare\" button\"."
|
188 |
msgstr "Abre link após clicar no botão de comparação."
|
189 |
|
190 |
-
#: plugin-options/general-options.php:
|
191 |
msgid "Table Settings"
|
192 |
msgstr "Opções de tabela"
|
193 |
|
194 |
-
#: plugin-options/general-options.php:
|
195 |
msgid "Table title"
|
196 |
-
msgstr ""
|
197 |
|
198 |
-
#: plugin-options/general-options.php:
|
199 |
msgid "Type the text to use for the table title."
|
200 |
-
msgstr ""
|
201 |
|
202 |
-
#: plugin-options/general-options.php:
|
203 |
msgid "Compare products"
|
204 |
msgstr "Comparar produtos"
|
205 |
|
206 |
-
#: plugin-options/general-options.php:
|
207 |
msgid "Fields to show"
|
208 |
msgstr "Campos a mostrar"
|
209 |
|
210 |
-
#: plugin-options/general-options.php:
|
211 |
msgid ""
|
212 |
"Select the fields to show in the comparison table and order them by "
|
213 |
"drag&drop (are included also the woocommerce attributes)"
|
@@ -215,27 +215,27 @@ msgstr ""
|
|
215 |
"Selecione os campos a mostrar na tabela de comparação e organize-os "
|
216 |
"arrastando e soltando (atributos do Woocommerce também são incluídos)"
|
217 |
|
218 |
-
#: plugin-options/general-options.php:
|
219 |
msgid "Repeat \"Price\" field"
|
220 |
msgstr ""
|
221 |
|
222 |
-
#: plugin-options/general-options.php:
|
223 |
msgid "Repeat the \"Price\" field at the end of the table"
|
224 |
msgstr ""
|
225 |
|
226 |
-
#: plugin-options/general-options.php:
|
227 |
msgid "Repeat \"Add to cart\" field"
|
228 |
msgstr ""
|
229 |
|
230 |
-
#: plugin-options/general-options.php:
|
231 |
msgid "Repeat the \"Add to cart\" field at the end of the table"
|
232 |
msgstr ""
|
233 |
|
234 |
-
#: plugin-options/general-options.php:
|
235 |
msgid "Image size"
|
236 |
msgstr "Tamanho da imagem"
|
237 |
|
238 |
-
#: plugin-options/general-options.php:
|
239 |
msgid "Set the size for the images"
|
240 |
msgstr "Especifique um tamanho para as imagens"
|
241 |
|
@@ -248,7 +248,7 @@ msgstr ""
|
|
248 |
|
249 |
#: templates/admin/premium.php:234 templates/admin/premium.php:424
|
250 |
msgid "UPGRADE"
|
251 |
-
msgstr ""
|
252 |
|
253 |
#: templates/admin/premium.php:235 templates/admin/premium.php:425
|
254 |
msgid "to the premium version"
|
@@ -420,6 +420,9 @@ msgstr ""
|
|
420 |
msgid "Clear all"
|
421 |
msgstr "Limpar tudo"
|
422 |
|
|
|
|
|
|
|
423 |
#~ msgid "The widget show the list of products added in the compare table."
|
424 |
#~ msgstr ""
|
425 |
#~ "O widget mostra a lista de produtos adicionados na tabela de comparação."
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: YITH Woocommerce Compare\n"
|
4 |
+
"POT-Creation-Date: 2017-03-22 10:28+0100\n"
|
5 |
+
"PO-Revision-Date: 2017-03-22 10:28+0100\n"
|
6 |
"Last-Translator: Nicola Mustone <mail@nicolamustone.it>\n"
|
7 |
"Language-Team: Your Inspiration Themes <support@yithemes.com>\n"
|
8 |
"Language: pt_BR\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 1.8.7.1\n"
|
13 |
"X-Poedit-KeywordsList: __;_e;_x\n"
|
14 |
"X-Poedit-Basepath: ..\n"
|
15 |
"X-Poedit-SourceCharset: UTF-8\n"
|
29 |
|
30 |
#: includes/class.yith-woocompare-admin.php:156
|
31 |
#: includes/class.yith-woocompare-admin.php:157
|
32 |
+
#: includes/class.yith-woocompare-frontend.php:484
|
33 |
+
#: plugin-options/general-options.php:41 plugin-options/general-options.php:42
|
34 |
#: widgets/class.yith-woocompare-widget.php:51
|
35 |
msgid "Compare"
|
36 |
msgstr "Comparar"
|
70 |
msgid "Do you want to hard crop the image?"
|
71 |
msgstr ""
|
72 |
|
73 |
+
#: includes/class.yith-woocompare-frontend.php:211
|
74 |
msgid "Added"
|
75 |
msgstr "Adicionado"
|
76 |
|
77 |
+
#: includes/class.yith-woocompare-frontend.php:212 templates/compare.php:49
|
78 |
msgid "Product Comparison"
|
79 |
msgstr "Comparação de Produtos"
|
80 |
|
81 |
+
#: includes/class.yith-woocompare-frontend.php:368
|
82 |
msgid "In stock"
|
83 |
msgstr "No estoque"
|
84 |
|
85 |
+
#: includes/class.yith-woocompare-frontend.php:675
|
86 |
msgid "No products to compare"
|
87 |
msgstr "Não há produtos à comparar"
|
88 |
|
89 |
+
#: includes/class.yith-woocompare-frontend.php:688 templates/compare.php:112
|
90 |
msgid "Remove"
|
91 |
msgstr "Remover"
|
92 |
|
117 |
|
118 |
#: includes/class.yith-woocompare-helper.php:51
|
119 |
msgid "Weight"
|
120 |
+
msgstr "Peso"
|
121 |
|
122 |
#: includes/class.yith-woocompare-helper.php:52
|
123 |
msgid "Dimensions"
|
124 |
+
msgstr "Dimensões"
|
125 |
|
126 |
#: init.php:40
|
127 |
msgid ""
|
144 |
msgstr "Link ou Botão"
|
145 |
|
146 |
#: plugin-options/general-options.php:25
|
147 |
+
msgid "Choose if you want to use a link or a button for the comepare actions."
|
148 |
+
msgstr ""
|
149 |
|
150 |
+
#: plugin-options/general-options.php:32
|
151 |
msgid "Link"
|
152 |
msgstr "Link"
|
153 |
|
154 |
+
#: plugin-options/general-options.php:33
|
155 |
msgid "Button"
|
156 |
msgstr "Botão"
|
157 |
|
158 |
+
#: plugin-options/general-options.php:38
|
159 |
msgid "Link/Button text"
|
160 |
msgstr "Texto Link/Botão"
|
161 |
|
162 |
+
#: plugin-options/general-options.php:39
|
163 |
msgid "Type the text to use for the button or the link of the compare."
|
164 |
msgstr "Insira o texto usado no botão de comparação."
|
165 |
|
166 |
+
#: plugin-options/general-options.php:47
|
167 |
msgid "Show button in single product page"
|
168 |
msgstr "Mostrar na página de produto único"
|
169 |
|
170 |
+
#: plugin-options/general-options.php:48
|
171 |
msgid "Say if you want to show the button in the single product page."
|
172 |
msgstr "Marque para mostrar na página de produto único"
|
173 |
|
174 |
+
#: plugin-options/general-options.php:56
|
175 |
msgid "Show button in products list"
|
176 |
msgstr "Mostrar na lista de produtos"
|
177 |
|
178 |
+
#: plugin-options/general-options.php:57
|
179 |
msgid "Say if you want to show the button in the products list."
|
180 |
msgstr "Marque para mostrar na lista de produtos"
|
181 |
|
182 |
+
#: plugin-options/general-options.php:65
|
183 |
msgid "Open automatically lightbox"
|
184 |
msgstr "Abrir lightbox automaticamente"
|
185 |
|
186 |
+
#: plugin-options/general-options.php:66
|
187 |
msgid "Open link after click into \"Compare\" button\"."
|
188 |
msgstr "Abre link após clicar no botão de comparação."
|
189 |
|
190 |
+
#: plugin-options/general-options.php:79
|
191 |
msgid "Table Settings"
|
192 |
msgstr "Opções de tabela"
|
193 |
|
194 |
+
#: plugin-options/general-options.php:86
|
195 |
msgid "Table title"
|
196 |
+
msgstr "Título da tabela"
|
197 |
|
198 |
+
#: plugin-options/general-options.php:87
|
199 |
msgid "Type the text to use for the table title."
|
200 |
+
msgstr "Digite o texto para utilizar na tabela de título"
|
201 |
|
202 |
+
#: plugin-options/general-options.php:89 plugin-options/general-options.php:90
|
203 |
msgid "Compare products"
|
204 |
msgstr "Comparar produtos"
|
205 |
|
206 |
+
#: plugin-options/general-options.php:95
|
207 |
msgid "Fields to show"
|
208 |
msgstr "Campos a mostrar"
|
209 |
|
210 |
+
#: plugin-options/general-options.php:96
|
211 |
msgid ""
|
212 |
"Select the fields to show in the comparison table and order them by "
|
213 |
"drag&drop (are included also the woocommerce attributes)"
|
215 |
"Selecione os campos a mostrar na tabela de comparação e organize-os "
|
216 |
"arrastando e soltando (atributos do Woocommerce também são incluídos)"
|
217 |
|
218 |
+
#: plugin-options/general-options.php:104
|
219 |
msgid "Repeat \"Price\" field"
|
220 |
msgstr ""
|
221 |
|
222 |
+
#: plugin-options/general-options.php:105
|
223 |
msgid "Repeat the \"Price\" field at the end of the table"
|
224 |
msgstr ""
|
225 |
|
226 |
+
#: plugin-options/general-options.php:113
|
227 |
msgid "Repeat \"Add to cart\" field"
|
228 |
msgstr ""
|
229 |
|
230 |
+
#: plugin-options/general-options.php:114
|
231 |
msgid "Repeat the \"Add to cart\" field at the end of the table"
|
232 |
msgstr ""
|
233 |
|
234 |
+
#: plugin-options/general-options.php:122
|
235 |
msgid "Image size"
|
236 |
msgstr "Tamanho da imagem"
|
237 |
|
238 |
+
#: plugin-options/general-options.php:123
|
239 |
msgid "Set the size for the images"
|
240 |
msgstr "Especifique um tamanho para as imagens"
|
241 |
|
248 |
|
249 |
#: templates/admin/premium.php:234 templates/admin/premium.php:424
|
250 |
msgid "UPGRADE"
|
251 |
+
msgstr "ATUALIZAR"
|
252 |
|
253 |
#: templates/admin/premium.php:235 templates/admin/premium.php:425
|
254 |
msgid "to the premium version"
|
420 |
msgid "Clear all"
|
421 |
msgstr "Limpar tudo"
|
422 |
|
423 |
+
#~ msgid "Choose if you want to use a link or a button for the action button."
|
424 |
+
#~ msgstr "Seleciona se deseja usar link ou botão para a ação do botão"
|
425 |
+
|
426 |
#~ msgid "The widget show the list of products added in the compare table."
|
427 |
#~ msgstr ""
|
428 |
#~ "O widget mostra a lista de produtos adicionados na tabela de comparação."
|
plugin-fw/init.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Framework Name: YIT Plugin Framework
|
4 |
-
* Version: 2.9.
|
5 |
* Author: Yithemes
|
6 |
* Text Domain: yith-plugin-fw
|
7 |
* Domain Path: /languages/
|
@@ -19,8 +19,6 @@
|
|
19 |
* http://www.gnu.org/licenses/gpl-3.0.txt
|
20 |
*/
|
21 |
|
22 |
-
// test
|
23 |
-
|
24 |
if ( ! defined ( 'ABSPATH' ) ) {
|
25 |
exit;
|
26 |
} // Exit if accessed directly
|
@@ -56,3 +54,5 @@ if ( ! function_exists ( 'yit_maybe_plugin_fw_loader' ) ) {
|
|
56 |
}
|
57 |
}
|
58 |
}
|
|
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Framework Name: YIT Plugin Framework
|
4 |
+
* Version: 2.9.59
|
5 |
* Author: Yithemes
|
6 |
* Text Domain: yith-plugin-fw
|
7 |
* Domain Path: /languages/
|
19 |
* http://www.gnu.org/licenses/gpl-3.0.txt
|
20 |
*/
|
21 |
|
|
|
|
|
22 |
if ( ! defined ( 'ABSPATH' ) ) {
|
23 |
exit;
|
24 |
} // Exit if accessed directly
|
54 |
}
|
55 |
}
|
56 |
}
|
57 |
+
|
58 |
+
|
plugin-fw/lib/yit-cpt-unlimited.php
CHANGED
@@ -138,8 +138,8 @@ class YIT_CPT_Unlimited {
|
|
138 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_assets' ) );
|
139 |
|
140 |
// metaboxes
|
141 |
-
add_action( '
|
142 |
-
add_action( '
|
143 |
|
144 |
// multiuploader
|
145 |
if ( $this->_args['add_multiuploader'] ) {
|
138 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_assets' ) );
|
139 |
|
140 |
// metaboxes
|
141 |
+
add_action( 'add_meta_boxes', array( $this, 'add_metabox_cptu' ), 2 );
|
142 |
+
add_action( 'add_meta_boxes', array( $this, 'add_metabox_item_fields' ), 2 );
|
143 |
|
144 |
// multiuploader
|
145 |
if ( $this->_args['add_multiuploader'] ) {
|
plugin-fw/lib/yit-metabox.php
CHANGED
@@ -133,7 +133,7 @@ if (!class_exists('YIT_Metabox')) {
|
|
133 |
$this->set_tabs();
|
134 |
|
135 |
|
136 |
-
add_action('add_meta_boxes', array($this, 'register_metabox'));
|
137 |
add_action('save_post', array($this, 'save_postdata'));
|
138 |
add_action('admin_enqueue_scripts', array($this, 'enqueue'), 15);
|
139 |
|
@@ -414,6 +414,7 @@ if (!class_exists('YIT_Metabox')) {
|
|
414 |
*/
|
415 |
public function register_metabox($post_type)
|
416 |
{
|
|
|
417 |
if (in_array($post_type, (array)$this->options['pages'])) {
|
418 |
add_meta_box($this->id, $this->options['label'], array($this, 'show'), $post_type, $this->options['context'], $this->options['priority']);
|
419 |
}
|
@@ -476,12 +477,31 @@ if (!class_exists('YIT_Metabox')) {
|
|
476 |
}
|
477 |
}
|
478 |
|
479 |
-
if (!in_array($post_type, (array)$this->options['pages'])) {
|
480 |
return $post_id;
|
481 |
-
}
|
482 |
|
483 |
$this->reorder_tabs();
|
484 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
485 |
|
486 |
foreach ($this->tabs as $tab) {
|
487 |
|
@@ -501,8 +521,7 @@ if (!class_exists('YIT_Metabox')) {
|
|
501 |
}
|
502 |
}
|
503 |
}
|
504 |
-
|
505 |
-
|
506 |
}
|
507 |
|
508 |
/**
|
133 |
$this->set_tabs();
|
134 |
|
135 |
|
136 |
+
add_action('add_meta_boxes', array($this, 'register_metabox'),99);
|
137 |
add_action('save_post', array($this, 'save_postdata'));
|
138 |
add_action('admin_enqueue_scripts', array($this, 'enqueue'), 15);
|
139 |
|
414 |
*/
|
415 |
public function register_metabox($post_type)
|
416 |
{
|
417 |
+
|
418 |
if (in_array($post_type, (array)$this->options['pages'])) {
|
419 |
add_meta_box($this->id, $this->options['label'], array($this, 'show'), $post_type, $this->options['context'], $this->options['priority']);
|
420 |
}
|
477 |
}
|
478 |
}
|
479 |
|
480 |
+
/*if (!in_array($post_type, (array)$this->options['pages'])) {
|
481 |
return $post_id;
|
482 |
+
}*/
|
483 |
|
484 |
$this->reorder_tabs();
|
485 |
|
486 |
+
if(isset($_POST['yit_metaboxes'])) {
|
487 |
+
$yit_metabox_data = $_POST['yit_metaboxes'];
|
488 |
+
|
489 |
+
if(is_array($yit_metabox_data)) {
|
490 |
+
|
491 |
+
foreach ($yit_metabox_data as $field_name => $field_value) {
|
492 |
+
|
493 |
+
if(! add_post_meta($post_id, $field_name, $field_value, true) )
|
494 |
+
{
|
495 |
+
update_post_meta($post_id, $field_name, $field_value);
|
496 |
+
}
|
497 |
+
|
498 |
+
|
499 |
+
}
|
500 |
+
|
501 |
+
}
|
502 |
+
|
503 |
+
|
504 |
+
}
|
505 |
|
506 |
foreach ($this->tabs as $tab) {
|
507 |
|
521 |
}
|
522 |
}
|
523 |
}
|
524 |
+
|
|
|
525 |
}
|
526 |
|
527 |
/**
|
plugin-fw/lib/yit-plugin-panel-wc.php
CHANGED
@@ -369,7 +369,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
369 |
wp_enqueue_script( 'woocommerce_settings', $woocommerce->plugin_url() . '/assets/js/admin/settings.min.js', $woocommerce_settings_deps, $woocommerce_version, true );
|
370 |
|
371 |
wp_register_script( 'colorbox', YIT_CORE_PLUGIN_URL . '/assets/js/jquery.colorbox.js', array( 'jquery' ), '1.6.3', true );
|
372 |
-
wp_register_script( 'yit-plugin-panel', YIT_CORE_PLUGIN_URL . '/assets/js/yit-plugin-panel.min.js', array( 'jquery', 'jquery-chosen','wp-color-picker' ), $this->version, true );
|
373 |
wp_localize_script( 'woocommerce_settings', 'woocommerce_settings_params', array(
|
374 |
'i18n_nav_warning' => __( 'The changes you have made will be lost if you leave this page.', 'yith-plugin-fw' )
|
375 |
) );
|
369 |
wp_enqueue_script( 'woocommerce_settings', $woocommerce->plugin_url() . '/assets/js/admin/settings.min.js', $woocommerce_settings_deps, $woocommerce_version, true );
|
370 |
|
371 |
wp_register_script( 'colorbox', YIT_CORE_PLUGIN_URL . '/assets/js/jquery.colorbox.js', array( 'jquery' ), '1.6.3', true );
|
372 |
+
wp_register_script( 'yit-plugin-panel', YIT_CORE_PLUGIN_URL . '/assets/js/yit-plugin-panel.min.js', array( 'jquery', 'jquery-chosen','wp-color-picker', 'jquery-ui-dialog' ), $this->version, true );
|
373 |
wp_localize_script( 'woocommerce_settings', 'woocommerce_settings_params', array(
|
374 |
'i18n_nav_warning' => __( 'The changes you have made will be lost if you leave this page.', 'yith-plugin-fw' )
|
375 |
) );
|
plugin-fw/lib/yit-plugin-panel.php
CHANGED
@@ -114,7 +114,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
114 |
if( ! isset( $admin_page_hooks['yit_plugin_panel'] ) ){
|
115 |
$position = apply_filters( 'yit_plugins_menu_item_position', '62.32' );
|
116 |
// YITH Plugins text must not be translated
|
117 |
-
add_menu_page( 'yit_plugin_panel', 'YITH Plugins', 'manage_options', 'yit_plugin_panel', NULL, YIT_CORE_PLUGIN_URL . '/assets/images/yithemes-icon.png', $position );
|
118 |
}
|
119 |
}
|
120 |
|
@@ -324,7 +324,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
324 |
}
|
325 |
?>
|
326 |
<div id="icon-themes" class="icon32"><br /></div>
|
327 |
-
<h2 class="nav-tab-wrapper">
|
328 |
<?php echo $tabs ?>
|
329 |
</h2>
|
330 |
<?php
|
114 |
if( ! isset( $admin_page_hooks['yit_plugin_panel'] ) ){
|
115 |
$position = apply_filters( 'yit_plugins_menu_item_position', '62.32' );
|
116 |
// YITH Plugins text must not be translated
|
117 |
+
current_user_can( 'manage_options' ) && add_menu_page( 'yit_plugin_panel', 'YITH Plugins', 'manage_options', 'yit_plugin_panel', NULL, YIT_CORE_PLUGIN_URL . '/assets/images/yithemes-icon.png', $position );
|
118 |
}
|
119 |
}
|
120 |
|
324 |
}
|
325 |
?>
|
326 |
<div id="icon-themes" class="icon32"><br /></div>
|
327 |
+
<h2 class="yith nav-tab-wrapper">
|
328 |
<?php echo $tabs ?>
|
329 |
</h2>
|
330 |
<?php
|
plugin-fw/lib/yit-upgrade.php
CHANGED
@@ -33,7 +33,7 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
33 |
/**
|
34 |
* @var string api server url
|
35 |
*/
|
36 |
-
protected $_package_url = '
|
37 |
|
38 |
/**
|
39 |
* @var array The registered plugins
|
33 |
/**
|
34 |
* @var string api server url
|
35 |
*/
|
36 |
+
protected $_package_url = 'https://yithemes.com';
|
37 |
|
38 |
/**
|
39 |
* @var array The registered plugins
|
plugin-fw/licence/lib/yit-licence.php
CHANGED
@@ -48,7 +48,7 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
48 |
* @var string The yithemes api uri
|
49 |
* @since 1.0
|
50 |
*/
|
51 |
-
protected $_api_uri = '
|
52 |
|
53 |
/**
|
54 |
* @var string The yithemes api uri query args
|
@@ -95,8 +95,9 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
95 |
}
|
96 |
|
97 |
/* Update Licence Information */
|
98 |
-
|
99 |
-
add_action( '
|
|
|
100 |
|
101 |
}
|
102 |
|
@@ -142,7 +143,7 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
142 |
$home_url = str_replace( $scheme, '', $home_url );
|
143 |
}
|
144 |
|
145 |
-
return $home_url;
|
146 |
}
|
147 |
|
148 |
/**
|
@@ -691,7 +692,7 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
691 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
692 |
*/
|
693 |
public function display_product_name( $product_name ){
|
694 |
-
return str_replace( array( 'for WooCommerce', 'YITH', 'WooCommerce', 'Premium', 'Theme' ), '', $product_name );
|
695 |
}
|
696 |
|
697 |
public function get_number_of_membership_products(){
|
48 |
* @var string The yithemes api uri
|
49 |
* @since 1.0
|
50 |
*/
|
51 |
+
protected $_api_uri = 'https://yithemes.com';
|
52 |
|
53 |
/**
|
54 |
* @var string The yithemes api uri query args
|
95 |
}
|
96 |
|
97 |
/* Update Licence Information */
|
98 |
+
//@TODO: Removed for performance
|
99 |
+
// add_action( 'core_upgrade_preamble', array( $this, 'check_all' ) );
|
100 |
+
// add_action( 'wp_maybe_auto_update', array( $this, 'check_all' ) );
|
101 |
|
102 |
}
|
103 |
|
143 |
$home_url = str_replace( $scheme, '', $home_url );
|
144 |
}
|
145 |
|
146 |
+
return apply_filters('yit_licence_get_home_url', $home_url );
|
147 |
}
|
148 |
|
149 |
/**
|
692 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
693 |
*/
|
694 |
public function display_product_name( $product_name ){
|
695 |
+
return str_replace( array( 'for WooCommerce', 'YITH', 'WooCommerce', 'Premium', 'Theme', 'WordPress' ), '', $product_name );
|
696 |
}
|
697 |
|
698 |
public function get_number_of_membership_products(){
|
plugin-fw/licence/lib/yit-plugin-licence.php
CHANGED
@@ -71,9 +71,9 @@ if ( !class_exists( 'YIT_Plugin_Licence' ) ) {
|
|
71 |
);
|
72 |
|
73 |
add_action( 'admin_menu', array( $this, 'add_submenu_page' ), 99 );
|
74 |
-
add_action( "
|
75 |
-
add_action( "
|
76 |
-
add_action( "
|
77 |
add_action( 'yit_licence_after_check', array( $this, 'licence_after_check' ) );
|
78 |
}
|
79 |
|
71 |
);
|
72 |
|
73 |
add_action( 'admin_menu', array( $this, 'add_submenu_page' ), 99 );
|
74 |
+
add_action( "wp_ajax_yith_activate-{$this->_product_type}", array( $this, 'activate' ) );
|
75 |
+
add_action( "wp_ajax_yith_deactivate-{$this->_product_type}", array( $this, 'deactivate' ) );
|
76 |
+
add_action( "wp_ajax_yith_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
|
77 |
add_action( 'yit_licence_after_check', array( $this, 'licence_after_check' ) );
|
78 |
}
|
79 |
|
plugin-fw/licence/lib/yit-theme-licence.php
CHANGED
@@ -73,9 +73,9 @@ if ( !class_exists( 'YIT_Theme_Licence' ) ) {
|
|
73 |
);
|
74 |
|
75 |
add_action( 'admin_menu', array( $this, 'add_submenu_page' ), 99 );
|
76 |
-
add_action( "
|
77 |
-
add_action( "
|
78 |
-
add_action( "
|
79 |
}
|
80 |
|
81 |
/**
|
73 |
);
|
74 |
|
75 |
add_action( 'admin_menu', array( $this, 'add_submenu_page' ), 99 );
|
76 |
+
add_action( "wp_ajax_yith_activate-{$this->_product_type}", array( $this, 'activate' ) );
|
77 |
+
add_action( "wp_ajax_yith_deactivate-{$this->_product_type}", array( $this, 'deactivate' ) );
|
78 |
+
add_action( "wp_ajax_yith_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
|
79 |
}
|
80 |
|
81 |
/**
|
plugin-fw/licence/templates/panel/activation/activation-panel.php
CHANGED
@@ -25,7 +25,7 @@ $num_members_products_activate = $this->get_number_of_membership_products();
|
|
25 |
<div class="licence-check-section">
|
26 |
<form method="post" id="licence-check-update" action="<?php echo admin_url( 'admin-ajax.php' ) ?>">
|
27 |
<span class="licence-label" style="display: block;"><?php _e( 'Have you updated your licenses? Have you asked for an extension? Update information concerning your products.', 'yith-plugin-fw' ); ?></span>
|
28 |
-
<input type="hidden" name="action" value="
|
29 |
<input type="submit" name="submit" value="<?php _e( 'Update license information', 'yith-plugin-fw' ) ?>" class="button-licence licence-check" />
|
30 |
<div class="spinner"></div>
|
31 |
</form>
|
@@ -61,7 +61,7 @@ $num_members_products_activate = $this->get_number_of_membership_products();
|
|
61 |
<input type="submit" name="submit" value="<?php _e( 'Activate', 'yith-plugin-fw' )?>" class="button-licence licence-activation" data-formid="<?php echo $info['product_id'] ?>"/>
|
62 |
</td>
|
63 |
</tr>
|
64 |
-
<input type="hidden" name="action" value="
|
65 |
<input type="hidden" name="product_init" value="<?php echo $init ?>" />
|
66 |
</tbody>
|
67 |
</table>
|
@@ -138,7 +138,7 @@ $num_members_products_activate = $this->get_number_of_membership_products();
|
|
138 |
data-licence-email="<?php echo $info['licence']['email'] ?>"
|
139 |
data-licence-key="<?php echo $info['licence']['licence_key'] ?>"
|
140 |
data-product-init="<?php echo $init ?>"
|
141 |
-
data-action="
|
142 |
<?php _e( 'Deactivate', 'yith-plugin-fw' ) ?>
|
143 |
</a>
|
144 |
|
25 |
<div class="licence-check-section">
|
26 |
<form method="post" id="licence-check-update" action="<?php echo admin_url( 'admin-ajax.php' ) ?>">
|
27 |
<span class="licence-label" style="display: block;"><?php _e( 'Have you updated your licenses? Have you asked for an extension? Update information concerning your products.', 'yith-plugin-fw' ); ?></span>
|
28 |
+
<input type="hidden" name="action" value="yith_update_licence_information-<?php echo $this->get_product_type(); ?>" />
|
29 |
<input type="submit" name="submit" value="<?php _e( 'Update license information', 'yith-plugin-fw' ) ?>" class="button-licence licence-check" />
|
30 |
<div class="spinner"></div>
|
31 |
</form>
|
61 |
<input type="submit" name="submit" value="<?php _e( 'Activate', 'yith-plugin-fw' )?>" class="button-licence licence-activation" data-formid="<?php echo $info['product_id'] ?>"/>
|
62 |
</td>
|
63 |
</tr>
|
64 |
+
<input type="hidden" name="action" value="yith_activate-<?php echo $this->get_product_type(); ?>" />
|
65 |
<input type="hidden" name="product_init" value="<?php echo $init ?>" />
|
66 |
</tbody>
|
67 |
</table>
|
138 |
data-licence-email="<?php echo $info['licence']['email'] ?>"
|
139 |
data-licence-key="<?php echo $info['licence']['licence_key'] ?>"
|
140 |
data-product-init="<?php echo $init ?>"
|
141 |
+
data-action="yith_deactivate-<?php echo $this->get_product_type(); ?>">
|
142 |
<?php _e( 'Deactivate', 'yith-plugin-fw' ) ?>
|
143 |
</a>
|
144 |
|
plugin-fw/yit-plugin.php
CHANGED
@@ -19,6 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
19 |
! defined( 'YIT_CORE_PLUGIN_TEMPLATE_PATH' ) && define( 'YIT_CORE_PLUGIN_TEMPLATE_PATH', YIT_CORE_PLUGIN_PATH . '/templates' );
|
20 |
|
21 |
include_once( 'yit-functions.php' );
|
|
|
22 |
include_once( 'yit-plugin-registration-hook.php' );
|
23 |
include_once( 'lib/yit-metabox.php' );
|
24 |
include_once( 'lib/yit-plugin-panel.php' );
|
@@ -40,3 +41,42 @@ load_textdomain( 'yith-plugin-fw', get_template_directory() . '/core/plugin-fw/y
|
|
40 |
|
41 |
// ...or from plugin folder
|
42 |
|| load_textdomain( 'yith-plugin-fw', dirname(__FILE__) . '/languages/yith-plugin-fw-' . apply_filters( 'plugin_locale', get_locale(), 'yith-plugin-fw' ) . '.mo' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
! defined( 'YIT_CORE_PLUGIN_TEMPLATE_PATH' ) && define( 'YIT_CORE_PLUGIN_TEMPLATE_PATH', YIT_CORE_PLUGIN_PATH . '/templates' );
|
20 |
|
21 |
include_once( 'yit-functions.php' );
|
22 |
+
include_once( 'yit-woocommerce-compatibility.php' );
|
23 |
include_once( 'yit-plugin-registration-hook.php' );
|
24 |
include_once( 'lib/yit-metabox.php' );
|
25 |
include_once( 'lib/yit-plugin-panel.php' );
|
41 |
|
42 |
// ...or from plugin folder
|
43 |
|| load_textdomain( 'yith-plugin-fw', dirname(__FILE__) . '/languages/yith-plugin-fw-' . apply_filters( 'plugin_locale', get_locale(), 'yith-plugin-fw' ) . '.mo' );
|
44 |
+
|
45 |
+
/* === WooCommerce Update Message === */
|
46 |
+
|
47 |
+
/*if( apply_filters( 'yit_fw_wc_update_message_hook', true )
|
48 |
+
&&
|
49 |
+
( function_exists( 'WC' ) && ! version_compare( WC()->version, '2.7', '>=' ) )
|
50 |
+
&& ! isset( $_COOKIE['yith_wc_2_7_notice'] )
|
51 |
+
){
|
52 |
+
add_action( 'admin_notices', 'yit_fw_wc_update_message', 15 );
|
53 |
+
add_action( 'admin_enqueue_scripts', 'yit_plugin_fw_dismissable_notice', 20 );
|
54 |
+
|
55 |
+
if( ! function_exists( 'yit_fw_wc_update_message' ) ){
|
56 |
+
function yit_fw_wc_update_message(){
|
57 |
+
?>
|
58 |
+
<div id="yith-notice-is-dismissable" class="yith-wc-update-message notice notice-error is-dismissible">
|
59 |
+
<?php $message = 'the new WooCommerce version 2.7 will be soon released. <strong>Before</strong> proceeding with the update, please verify the plugins you are using are already compatible. You can check the compatibility status of YITH products'; ?>
|
60 |
+
<?php $url = 'https://support.yithemes.com/hc/en-us/articles/215945378-Theme-and-Plugin-compatibility-with-WordPress-and-WooCommerce'; ?>
|
61 |
+
<p><?php printf( '<strong>%s</strong> - %s <a href="%s" target="_blank">HERE</a>.', 'Please note', $message, $url ); ?></p>
|
62 |
+
</div>
|
63 |
+
<?php
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
if( ! function_exists( 'yit_plugin_fw_dismissable_notice' ) ){
|
68 |
+
function yit_plugin_fw_dismissable_notice(){
|
69 |
+
$assets_path = str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/';
|
70 |
+
wp_enqueue_script( 'jquery-cookie', $assets_path . 'js/jquery-cookie/jquery.cookie.min.js', array( 'jquery' ), '1.4.1', true);
|
71 |
+
$js = "jQuery( document ).ready( function(){
|
72 |
+
jQuery( '#yith-notice-is-dismissable' ).find('.notice-dismiss').on( 'click', function(){
|
73 |
+
jQuery.cookie('yith_wc_2_7_notice', 'dismiss', { path: '/' });
|
74 |
+
} );
|
75 |
+
} ); ";
|
76 |
+
|
77 |
+
wp_add_inline_script( 'jquery-cookie', $js );
|
78 |
+
}
|
79 |
+
}
|
80 |
+
}*/
|
81 |
+
|
82 |
+
/* ========================== */
|
plugin-fw/yit-woocommerce-compatibility.php
ADDED
@@ -0,0 +1,700 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 ( !defined( 'ABSPATH' ) ) {
|
12 |
+
exit;
|
13 |
+
} // Exit if accessed directly
|
14 |
+
|
15 |
+
if ( !function_exists( 'WC' ) ) {
|
16 |
+
return;
|
17 |
+
}
|
18 |
+
|
19 |
+
$changed_objects = array();
|
20 |
+
|
21 |
+
if ( !function_exists( 'yit_get_prop' ) ) {
|
22 |
+
/**
|
23 |
+
*
|
24 |
+
*/
|
25 |
+
function yit_get_prop( $object, $key, $single = true, $context = 'view' ) {
|
26 |
+
|
27 |
+
$prop_map = yit_return_new_attribute_map();
|
28 |
+
$is_wc_data = $object instanceof WC_Data;
|
29 |
+
|
30 |
+
if ( $is_wc_data ) {
|
31 |
+
$key = ( array_key_exists( $key, $prop_map ) ) ? $prop_map[ $key ] : $key;
|
32 |
+
|
33 |
+
if ( ( $getter = "get{$key}" ) && method_exists( $object, $getter ) ) {
|
34 |
+
return $object->$getter( $context );
|
35 |
+
} elseif ( ( $getter = "get_{$key}" ) && method_exists( $object, $getter ) ) {
|
36 |
+
return $object->$getter( $context );
|
37 |
+
} else {
|
38 |
+
return $object->get_meta( $key, $single );
|
39 |
+
}
|
40 |
+
} else {
|
41 |
+
$key = ( in_array( $key, $prop_map ) ) ? array_search( $key, $prop_map ) : $key;
|
42 |
+
|
43 |
+
if ( isset( $object->$key ) ) {
|
44 |
+
return $object->$key;
|
45 |
+
} elseif ( yit_wc_check_post_columns( $key ) ) {
|
46 |
+
return $object->post->$key;
|
47 |
+
} else {
|
48 |
+
$getter = 'get_user_meta';
|
49 |
+
!$object instanceof WC_Customer && $getter = 'get_post_meta';
|
50 |
+
|
51 |
+
$object_id = is_callable( array( $object, 'get_id' ) ) ? $object->get_id() : $object->id;
|
52 |
+
|
53 |
+
return $getter( $object_id, $key, true );
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
if ( !function_exists( 'yit_set_prop' ) ) {
|
60 |
+
/**
|
61 |
+
*
|
62 |
+
*/
|
63 |
+
function yit_set_prop( $object, $arg1, $arg2 = false ) {
|
64 |
+
|
65 |
+
if ( !is_array( $arg1 ) ) {
|
66 |
+
$arg1 = array(
|
67 |
+
$arg1 => $arg2
|
68 |
+
);
|
69 |
+
}
|
70 |
+
|
71 |
+
$prop_map = yit_return_new_attribute_map();
|
72 |
+
$is_wc_data = $object instanceof WC_Data;
|
73 |
+
|
74 |
+
foreach ( $arg1 as $key => $value ) {
|
75 |
+
if ( $is_wc_data ) {
|
76 |
+
$key = ( array_key_exists( $key, $prop_map ) ) ? $prop_map[ $key ] : $key;
|
77 |
+
|
78 |
+
if ( ( $setter = "set{$key}" ) && method_exists( $object, $setter ) ) {
|
79 |
+
$object->$setter( $value );
|
80 |
+
} elseif ( ( $setter = "set_{$key}" ) && method_exists( $object, $setter ) ) {
|
81 |
+
$object->$setter( $value );
|
82 |
+
} else {
|
83 |
+
$object->update_meta_data( $key, $value );
|
84 |
+
}
|
85 |
+
} else {
|
86 |
+
$key = ( in_array( $key, $prop_map ) ) ? array_search( $key, $prop_map ) : $key;
|
87 |
+
( strpos( $key, '_' ) === 0 ) && $key = substr( $key, 1 );
|
88 |
+
|
89 |
+
if ( yit_wc_check_post_columns( $key ) ) {
|
90 |
+
$object->post->$key = $value;
|
91 |
+
} else {
|
92 |
+
$object->$key = $value;
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
if ( !function_exists( 'yit_save_prop' ) ) {
|
100 |
+
/**
|
101 |
+
*
|
102 |
+
*/
|
103 |
+
function yit_save_prop( $object, $arg1, $arg2 = false, $force_update = false ) {
|
104 |
+
if ( !is_array( $arg1 ) ) {
|
105 |
+
$arg1 = array(
|
106 |
+
$arg1 => $arg2
|
107 |
+
);
|
108 |
+
}
|
109 |
+
|
110 |
+
$is_wc_data = $object instanceof WC_Data;
|
111 |
+
|
112 |
+
foreach ( $arg1 as $key => $value ) {
|
113 |
+
yit_set_prop( $object, $key, $value );
|
114 |
+
|
115 |
+
if ( $is_wc_data ) {
|
116 |
+
if ( $force_update ) {
|
117 |
+
$object->save();
|
118 |
+
} else {
|
119 |
+
yit_store_changes( $object, $key, $value );
|
120 |
+
}
|
121 |
+
} else {
|
122 |
+
if ( yit_wc_check_post_columns( $key ) ) {
|
123 |
+
yit_store_changes( $object->post, $key, $value );
|
124 |
+
} else {
|
125 |
+
$object_id = is_callable( array( $object, 'get_id' ) ) ? $object->get_id() : $object->id;
|
126 |
+
|
127 |
+
update_post_meta( $object_id, $key, $value );
|
128 |
+
}
|
129 |
+
}
|
130 |
+
}
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
if ( !function_exists( 'yit_delete_prop' ) ) {
|
135 |
+
/**
|
136 |
+
*
|
137 |
+
*/
|
138 |
+
function yit_delete_prop( $object, $key, $value = '' ) {
|
139 |
+
$prop_map = yit_return_new_attribute_map();
|
140 |
+
$is_wc_data = $object instanceof WC_Data;
|
141 |
+
|
142 |
+
if ( $is_wc_data ) {
|
143 |
+
$key = ( array_key_exists( $key, $prop_map ) ) ? $prop_map[ $key ] : $key;
|
144 |
+
|
145 |
+
if ( ( $setter = "set{$key}" ) && ( $getter = "get{$key}" ) && method_exists( $object, $setter ) && ( !$value || $object->$getter == $value ) ) {
|
146 |
+
$object->$setter( '' );
|
147 |
+
} elseif ( ( $setter = "set_{$key}" ) && ( $getter = "get_{$key}" ) && method_exists( $object, $setter ) && ( !$value || $object->$getter == $value ) ) {
|
148 |
+
$object->$setter( '' );
|
149 |
+
} elseif ( ( !$value || $object->get_meta( $key ) == $value ) ) {
|
150 |
+
$object->delete_meta_data( $key, $value );
|
151 |
+
}
|
152 |
+
|
153 |
+
yit_store_changes( $object, $key );
|
154 |
+
} else {
|
155 |
+
if ( yit_wc_check_post_columns( $key ) && ( !$value || $object->post->$key == $value ) ) {
|
156 |
+
yit_store_changes( $object->post, $key, '' );
|
157 |
+
} else {
|
158 |
+
$object_id = is_callable( array( $object, 'get_id' ) ) ? $object->get_id() : $object->id;
|
159 |
+
|
160 |
+
delete_post_meta( $object_id, $key, $value );
|
161 |
+
}
|
162 |
+
}
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
if ( !function_exists( 'yit_return_new_attribute_map' ) ) {
|
167 |
+
function yit_return_new_attribute_map() {
|
168 |
+
return array(
|
169 |
+
'post_parent' => 'parent_id',
|
170 |
+
'post_title' => 'name',
|
171 |
+
'post_status' => 'status',
|
172 |
+
'post_content' => 'description',
|
173 |
+
'post_excerpt' => 'short_description',
|
174 |
+
/* Orders */
|
175 |
+
'paid_date' => 'date_paid',
|
176 |
+
'_paid_date' => '_date_paid',
|
177 |
+
'completed_date' => 'date_completed',
|
178 |
+
'_completed_date' => '_date_completed',
|
179 |
+
'_order_date' => '_date_created',
|
180 |
+
'order_date' => 'date_created',
|
181 |
+
'order_total' => 'total',
|
182 |
+
/* Products */
|
183 |
+
'visibility' => 'catalog_visibility',
|
184 |
+
'_visibility' => '_catalog_visibility',
|
185 |
+
'sale_price_dates_from' => 'date_on_sale_from',
|
186 |
+
'_sale_price_dates_from' => '_date_on_sale_from',
|
187 |
+
'sale_price_dates_to' => 'date_on_sale_to',
|
188 |
+
'_sale_price_dates_to' => '_date_on_sale_to',
|
189 |
+
/*Coupons*/
|
190 |
+
'coupon_amount' => 'amount',
|
191 |
+
'exclude_product_ids' => 'excluded_product_ids',
|
192 |
+
'exclude_product_categories' => 'excluded_product_categories',
|
193 |
+
'customer_email' => 'email_restrictions',
|
194 |
+
'expiry_date' => 'date_expires',
|
195 |
+
);
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
if ( !function_exists( 'yit_store_changes' ) ) {
|
200 |
+
function yit_store_changes( $object, $key, $value = false ) {
|
201 |
+
global $changed_objects;
|
202 |
+
|
203 |
+
$is_wc_data = $object instanceof WC_Data;
|
204 |
+
|
205 |
+
if ( $is_wc_data ) {
|
206 |
+
/**
|
207 |
+
* @var $object \WC_Data
|
208 |
+
*/
|
209 |
+
$object_reference = $object->get_id();
|
210 |
+
|
211 |
+
$cache_type = is_a( $object, 'WC_Product' ) ? 'product' : 'order';
|
212 |
+
$cache_key = $cache_type . '-' . $object_reference;
|
213 |
+
$cache_group = $cache_type . 's';
|
214 |
+
|
215 |
+
$changed_objects[ $object_reference ][ 'object' ] = $object;
|
216 |
+
$changed_objects[ $object_reference ][ 'changes' ][ $key ] = $value;
|
217 |
+
|
218 |
+
|
219 |
+
wp_cache_set( $cache_key, $object, $cache_group );
|
220 |
+
} else {
|
221 |
+
$changed_objects[ $object->ID ][ $key ] = $value;
|
222 |
+
}
|
223 |
+
}
|
224 |
+
}
|
225 |
+
|
226 |
+
if ( !function_exists( 'yit_send_changes_to_db' ) ) {
|
227 |
+
function yit_send_changes_to_db() {
|
228 |
+
global $changed_objects;
|
229 |
+
|
230 |
+
if ( !empty( $changed_objects ) ) {
|
231 |
+
foreach ( $changed_objects as $id => $data ) {
|
232 |
+
if ( version_compare( WC()->version, '2.7.0', '>=' ) ) {
|
233 |
+
/**
|
234 |
+
* @var $object \WC_Data
|
235 |
+
*/
|
236 |
+
$object = is_a( $data[ 'object' ], 'WC_Product' ) ? wc_get_product( $id ) : wc_get_order( $id );
|
237 |
+
|
238 |
+
yit_set_prop( $object, $data[ 'changes' ] );
|
239 |
+
$object->save();
|
240 |
+
} else {
|
241 |
+
$data[ 'ID' ] = $id;
|
242 |
+
wp_update_post( $data );
|
243 |
+
}
|
244 |
+
}
|
245 |
+
}
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
+
if ( !function_exists( 'yit_get_orders' ) ) {
|
250 |
+
/**
|
251 |
+
*
|
252 |
+
*/
|
253 |
+
function yit_get_orders( $args ) {
|
254 |
+
if ( version_compare( WC()->version, '2.6', '<' ) ) {
|
255 |
+
$args[ 'fields' ] = 'objects';
|
256 |
+
$posts = get_posts( $args );
|
257 |
+
|
258 |
+
return array_map( 'wc_get_order', $posts );
|
259 |
+
} else {
|
260 |
+
return wc_get_orders( $args );
|
261 |
+
}
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
if ( !function_exists( 'yit_get_products' ) ) {
|
266 |
+
/**
|
267 |
+
*
|
268 |
+
*/
|
269 |
+
function yit_get_products( $args ) {
|
270 |
+
if ( version_compare( WC()->version, '2.6', '<' ) ) {
|
271 |
+
$args[ 'fields' ] = 'objects';
|
272 |
+
$posts = get_posts( $args );
|
273 |
+
|
274 |
+
return array_map( 'wc_get_product', $posts );
|
275 |
+
} else {
|
276 |
+
return wc_get_products( $args );
|
277 |
+
}
|
278 |
+
}
|
279 |
+
}
|
280 |
+
|
281 |
+
if ( !function_exists( 'yit_update_product_stock' ) ) {
|
282 |
+
/**
|
283 |
+
*
|
284 |
+
*/
|
285 |
+
function yit_update_product_stock( $product, $stock_quantity = 1, $operation = 'set' ) {
|
286 |
+
if ( function_exists( 'wc_update_product_stock' ) ) {
|
287 |
+
$stock = wc_update_product_stock( $product, $stock_quantity, $operation );
|
288 |
+
} else {
|
289 |
+
switch ( $operation ) {
|
290 |
+
case 'increase':
|
291 |
+
$stock = $product->increase_stock( $stock_quantity );
|
292 |
+
break;
|
293 |
+
case 'decrease':
|
294 |
+
$stock = $product->reduce_stock( $stock_quantity );
|
295 |
+
break;
|
296 |
+
case 'set':
|
297 |
+
default:
|
298 |
+
$stock = $product->set_stock( $stock_quantity );
|
299 |
+
break;
|
300 |
+
}
|
301 |
+
}
|
302 |
+
|
303 |
+
return $stock;
|
304 |
+
}
|
305 |
+
}
|
306 |
+
|
307 |
+
if ( !function_exists( 'yit_wc_deprecated_filters' ) ) {
|
308 |
+
/**
|
309 |
+
*
|
310 |
+
*/
|
311 |
+
function yit_wc_deprecated_filters() {
|
312 |
+
return apply_filters( 'yit_wc_deprecated_filters', array(
|
313 |
+
'woocommerce_email_order_schema_markup' => 'woocommerce_structured_data_order',
|
314 |
+
'woocommerce_product_width' => 'woocommerce_product_get_width',
|
315 |
+
'woocommerce_product_height' => 'woocommerce_product_get_height',
|
316 |
+
'woocommerce_product_length' => 'woocommerce_product_get_length',
|
317 |
+
'woocommerce_product_weight' => 'woocommerce_product_get_weight',
|
318 |
+
'woocommerce_get_sku' => 'woocommerce_product_get_sku',
|
319 |
+
'woocommerce_get_price' => 'woocommerce_product_get_price',
|
320 |
+
'woocommerce_get_regular_price' => 'woocommerce_product_get_regular_price',
|
321 |
+
'woocommerce_get_sale_price' => 'woocommerce_product_get_sale_price',
|
322 |
+
'woocommerce_product_tax_class' => 'woocommerce_product_get_tax_class',
|
323 |
+
'woocommerce_get_stock_quantity' => 'woocommerce_product_get_stock_quantity',
|
324 |
+
'woocommerce_get_product_attributes' => 'woocommerce_product_get_attributes',
|
325 |
+
'woocommerce_product_gallery_attachment_ids' => 'woocommerce_product_get_gallery_image_ids',
|
326 |
+
'woocommerce_product_review_count' => 'woocommerce_product_get_review_count',
|
327 |
+
'woocommerce_product_files' => 'woocommerce_product_get_downloads',
|
328 |
+
'woocommerce_get_currency' => 'woocommerce_order_get_currency',
|
329 |
+
'woocommerce_order_amount_discount_total' => 'woocommerce_order_get_discount_total',
|
330 |
+
'woocommerce_order_amount_discount_tax' => 'woocommerce_order_get_discount_tax',
|
331 |
+
'woocommerce_order_amount_shipping_total' => 'woocommerce_order_get_shipping_total',
|
332 |
+
'woocommerce_order_amount_shipping_tax' => 'woocommerce_order_get_shipping_tax',
|
333 |
+
'woocommerce_order_amount_cart_tax' => 'woocommerce_order_get_cart_tax',
|
334 |
+
'woocommerce_order_amount_total' => 'woocommerce_order_get_total',
|
335 |
+
'woocommerce_order_amount_total_tax' => 'woocommerce_order_get_total_tax',
|
336 |
+
'woocommerce_order_amount_total_discount' => 'woocommerce_order_get_total_discount',
|
337 |
+
'woocommerce_order_amount_subtotal' => 'woocommerce_order_get_subtotal',
|
338 |
+
'woocommerce_order_tax_totals' => 'woocommerce_order_get_tax_totals',
|
339 |
+
'woocommerce_refund_amount' => 'woocommerce_get_order_refund_get_amount',
|
340 |
+
'woocommerce_refund_reason' => 'woocommerce_get_order_refund_get_reason',
|
341 |
+
'default_checkout_country' => 'default_checkout_billing_country',
|
342 |
+
'default_checkout_state' => 'default_checkout_billing_state',
|
343 |
+
'default_checkout_postcode' => 'default_checkout_billing_postcode',
|
344 |
+
|
345 |
+
) );
|
346 |
+
}
|
347 |
+
}
|
348 |
+
|
349 |
+
if ( !function_exists( 'yit_fix_wc_deprecated_filters' ) ) {
|
350 |
+
/**
|
351 |
+
*
|
352 |
+
*/
|
353 |
+
function yit_fix_wc_deprecated_filters() {
|
354 |
+
|
355 |
+
if ( !version_compare( WC()->version, '2.7.0', '<' ) ) {
|
356 |
+
return;
|
357 |
+
}
|
358 |
+
|
359 |
+
$deprecated_filters = yit_wc_deprecated_filters();
|
360 |
+
foreach ( $deprecated_filters as $old => $new ) {
|
361 |
+
add_filter( $old, 'yit_wc_deprecated_filter_mapping', 10, 100 );
|
362 |
+
}
|
363 |
+
}
|
364 |
+
}
|
365 |
+
|
366 |
+
if ( !function_exists( 'yit_wc_deprecated_filter_mapping' ) ) {
|
367 |
+
/**
|
368 |
+
*
|
369 |
+
*/
|
370 |
+
function yit_wc_deprecated_filter_mapping() {
|
371 |
+
$deprecated_filters = yit_wc_deprecated_filters();
|
372 |
+
|
373 |
+
$filter = current_filter();
|
374 |
+
$args = func_get_args();
|
375 |
+
$data = $args[ 0 ];
|
376 |
+
|
377 |
+
|
378 |
+
if ( isset( $deprecated_filters[ $filter ] ) ) {
|
379 |
+
if ( has_filter( $deprecated_filters[ $filter ] ) ) {
|
380 |
+
$data = apply_filters_ref_array( $deprecated_filters[ $filter ], $args );
|
381 |
+
}
|
382 |
+
}
|
383 |
+
|
384 |
+
return $data;
|
385 |
+
}
|
386 |
+
}
|
387 |
+
|
388 |
+
if ( !function_exists( 'yit_wc_check_post_columns' ) ) {
|
389 |
+
/**
|
390 |
+
*
|
391 |
+
*/
|
392 |
+
function yit_wc_check_post_columns( $key ) {
|
393 |
+
$columns = array(
|
394 |
+
'post_author',
|
395 |
+
'post_date',
|
396 |
+
'post_date_gmt',
|
397 |
+
'post_content',
|
398 |
+
'post_title',
|
399 |
+
'post_excerpt',
|
400 |
+
'post_status',
|
401 |
+
'comment_status',
|
402 |
+
'ping_status',
|
403 |
+
'post_password',
|
404 |
+
'post_name',
|
405 |
+
'to_ping',
|
406 |
+
'pinged',
|
407 |
+
'post_modified',
|
408 |
+
'post_modified_gmt',
|
409 |
+
'post_content_filtered',
|
410 |
+
'post_parent',
|
411 |
+
'guid',
|
412 |
+
'menu_order',
|
413 |
+
'post_type',
|
414 |
+
'post_mime_type',
|
415 |
+
'comment_count',
|
416 |
+
);
|
417 |
+
|
418 |
+
return in_array( $key, $columns );
|
419 |
+
}
|
420 |
+
}
|
421 |
+
|
422 |
+
|
423 |
+
/* Shortcuts for common functions */
|
424 |
+
|
425 |
+
if ( !function_exists( 'yit_get_order_id' ) ) {
|
426 |
+
/**
|
427 |
+
* Retrieve the order id
|
428 |
+
*
|
429 |
+
* @param WC_Order $order
|
430 |
+
*
|
431 |
+
* @return mixed
|
432 |
+
*/
|
433 |
+
function yit_get_order_id( $order ) {
|
434 |
+
return yit_get_prop( $order, 'id' );
|
435 |
+
}
|
436 |
+
}
|
437 |
+
|
438 |
+
if ( !function_exists( 'yit_get_product_id' ) ) {
|
439 |
+
/**
|
440 |
+
* Retrieve the product id
|
441 |
+
*
|
442 |
+
* @param WC_Product $product
|
443 |
+
*
|
444 |
+
* @return mixed
|
445 |
+
*/
|
446 |
+
function yit_get_product_id( $product ) {
|
447 |
+
return yit_get_prop( $product, 'id' );
|
448 |
+
}
|
449 |
+
}
|
450 |
+
|
451 |
+
if ( !function_exists( 'yit_get_base_product_id' ) ) {
|
452 |
+
/**
|
453 |
+
* New way to retrieve the $product->id as it was before WC 2.7.
|
454 |
+
*
|
455 |
+
* Retrieve the parent product id for WC_Product_Variation instances
|
456 |
+
* or the product id in the other cases.
|
457 |
+
*
|
458 |
+
* @param WC_Product $product
|
459 |
+
*
|
460 |
+
* @return mixed
|
461 |
+
*/
|
462 |
+
function yit_get_base_product_id( $product ) {
|
463 |
+
|
464 |
+
return $product instanceof WC_Data && $product->is_type( 'variation' ) ?
|
465 |
+
yit_get_prop( $product, 'parent_id' ) :
|
466 |
+
yit_get_prop( $product, 'id' );
|
467 |
+
}
|
468 |
+
}
|
469 |
+
|
470 |
+
if ( !function_exists( 'yit_get_display_price' ) ) {
|
471 |
+
/**
|
472 |
+
* @param WC_Product $product
|
473 |
+
* @param string $price
|
474 |
+
* @param int $qty
|
475 |
+
*/
|
476 |
+
function yit_get_display_price( $product, $price = '', $qty = 1 ) {
|
477 |
+
|
478 |
+
if ( version_compare( WC()->version, '2.7.0', '>=' ) ) {
|
479 |
+
|
480 |
+
$price = wc_get_price_to_display( $product, array( 'qty' => $qty, 'price' => $price ) );
|
481 |
+
} else {
|
482 |
+
|
483 |
+
$price = $product->get_display_price( $price, $qty );
|
484 |
+
}
|
485 |
+
|
486 |
+
return $price;
|
487 |
+
}
|
488 |
+
}
|
489 |
+
|
490 |
+
if ( !function_exists( 'yit_get_price_excluding_tax' ) ) {
|
491 |
+
/**
|
492 |
+
* @param WC_Product $product
|
493 |
+
* @param int $qty
|
494 |
+
* @param string $price
|
495 |
+
*
|
496 |
+
* @return float|string
|
497 |
+
*/
|
498 |
+
function yit_get_price_excluding_tax( $product, $qty = 1, $price = '' ) {
|
499 |
+
|
500 |
+
if ( version_compare( WC()->version, '2.7.0', '>=' ) ) {
|
501 |
+
|
502 |
+
$price = wc_get_price_excluding_tax( $product, array( 'qty' => $qty, 'price' => $price ) );
|
503 |
+
} else {
|
504 |
+
|
505 |
+
$price = $product->get_price_excluding_tax( $qty, $price );
|
506 |
+
}
|
507 |
+
|
508 |
+
return $price;
|
509 |
+
}
|
510 |
+
}
|
511 |
+
|
512 |
+
if ( !function_exists( 'yit_get_price_including_tax' ) ) {
|
513 |
+
/**
|
514 |
+
* @param WC_Product $product
|
515 |
+
* @param int $qty
|
516 |
+
* @param string $price
|
517 |
+
*
|
518 |
+
* @return float|string
|
519 |
+
*/
|
520 |
+
function yit_get_price_including_tax( $product, $qty = 1, $price = '' ) {
|
521 |
+
|
522 |
+
if ( version_compare( WC()->version, '2.7.0', '>=' ) ) {
|
523 |
+
|
524 |
+
$price = wc_get_price_including_tax( $product, array( 'qty' => $qty, 'price' => $price ) );
|
525 |
+
} else {
|
526 |
+
|
527 |
+
$price = $product->get_price_including_tax( $qty, $price );
|
528 |
+
}
|
529 |
+
|
530 |
+
return $price;
|
531 |
+
}
|
532 |
+
}
|
533 |
+
|
534 |
+
if ( !function_exists( 'yit_get_product_image_id' ) ) {
|
535 |
+
/**
|
536 |
+
* get the attach image id
|
537 |
+
*
|
538 |
+
* @param WC_Product $product
|
539 |
+
* @param string $context ( view/edit )
|
540 |
+
*/
|
541 |
+
function yit_get_product_image_id( $product, $context = 'view' ) {
|
542 |
+
|
543 |
+
if ( version_compare( WC()->version, '2.7.0', '>=' ) ) {
|
544 |
+
|
545 |
+
$image_id = $product->get_image_id( $context );
|
546 |
+
} else {
|
547 |
+
|
548 |
+
$image_id = $product->get_image_id();
|
549 |
+
}
|
550 |
+
|
551 |
+
return $image_id;
|
552 |
+
}
|
553 |
+
}
|
554 |
+
|
555 |
+
if ( !function_exists( 'yit_get_refund_amount' ) ) {
|
556 |
+
/**
|
557 |
+
* @param $refund \WC_Order_Refund
|
558 |
+
* @param $context string
|
559 |
+
*
|
560 |
+
* @return float
|
561 |
+
*/
|
562 |
+
function yit_get_refund_amount( $refund, $context = 'view' ) {
|
563 |
+
$is_wc_data = $refund instanceof WC_Data;
|
564 |
+
|
565 |
+
if ( $is_wc_data ) {
|
566 |
+
return $refund->get_amount( $context );
|
567 |
+
} else {
|
568 |
+
return $refund->get_refund_amount();
|
569 |
+
}
|
570 |
+
}
|
571 |
+
}
|
572 |
+
|
573 |
+
if ( !function_exists( 'yit_add_select2_fields' ) ) {
|
574 |
+
/**
|
575 |
+
* Add select 2
|
576 |
+
*
|
577 |
+
* @param array $args
|
578 |
+
*/
|
579 |
+
function yit_add_select2_fields( $args = array() ) {
|
580 |
+
$default = array(
|
581 |
+
'type' => 'hidden',
|
582 |
+
'class' => '',
|
583 |
+
'id' => '',
|
584 |
+
'name' => '',
|
585 |
+
'data-placeholder' => '',
|
586 |
+
'data-allow_clear' => false,
|
587 |
+
'data-selected' => '',
|
588 |
+
'data-multiple' => false,
|
589 |
+
'data-action' => '',
|
590 |
+
'value' => '',
|
591 |
+
'style' => '',
|
592 |
+
'custom-attributes' => array()
|
593 |
+
);
|
594 |
+
|
595 |
+
$args = wp_parse_args( $args, $default );
|
596 |
+
|
597 |
+
$custom_attributes = array();
|
598 |
+
foreach ( $args[ 'custom-attributes' ] as $attribute => $attribute_value ) {
|
599 |
+
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
|
600 |
+
}
|
601 |
+
$custom_attributes = implode( ' ', $custom_attributes );
|
602 |
+
|
603 |
+
if ( version_compare( WC()->version, '2.7.0', '>=' ) ) :
|
604 |
+
if ( $args[ 'data-multiple' ] === true && substr( $args[ 'name' ], -2 ) != '[]' ) {
|
605 |
+
$args[ 'name' ] = $args[ 'name' ] . '[]';
|
606 |
+
}
|
607 |
+
?>
|
608 |
+
|
609 |
+
<select
|
610 |
+
id="<?php echo $args[ 'id' ] ?>"
|
611 |
+
class="<?php echo $args[ 'class' ] ?>"
|
612 |
+
name="<?php echo $args[ 'name' ] ?>"
|
613 |
+
data-placeholder="<?php echo $args[ 'data-placeholder' ] ?>"
|
614 |
+
data-allow_clear="<?php echo $args[ 'data-allow_clear' ] ?>"
|
615 |
+
<?php echo !empty( $args[ 'data-action' ] ) ? 'data-action="' . $args[ 'data-action' ] . '"' : ''; ?>
|
616 |
+
<?php echo !empty( $args[ 'data-multiple' ] ) ? 'multiple="multiple"' : ''; ?>
|
617 |
+
style="<?php echo $args[ 'style' ] ?>"
|
618 |
+
<?php echo $custom_attributes ?>
|
619 |
+
>
|
620 |
+
|
621 |
+
<?php if ( !empty( $args[ 'value' ] ) ) {
|
622 |
+
$values = $args[ 'value' ];
|
623 |
+
|
624 |
+
if ( !is_array( $values ) ) {
|
625 |
+
$values = explode( ',', $values );
|
626 |
+
}
|
627 |
+
|
628 |
+
foreach ( $values as $value ): ?>
|
629 |
+
<option value="<?php echo $value; ?>" <?php selected( true, true, true ) ?> >
|
630 |
+
<?php echo $args[ 'data-selected' ][ $value ]; ?>
|
631 |
+
</option>
|
632 |
+
<?php endforeach;
|
633 |
+
}
|
634 |
+
?>
|
635 |
+
</select>
|
636 |
+
<?php
|
637 |
+
else :
|
638 |
+
if ( $args[ 'data-multiple' ] === false && is_array( $args[ 'data-selected' ] ) ) {
|
639 |
+
$args[ 'data-selected' ] = current($args[ 'data-selected' ]);
|
640 |
+
}
|
641 |
+
|
642 |
+
?>
|
643 |
+
<input
|
644 |
+
type="hidden"
|
645 |
+
id="<?php echo $args[ 'id' ] ?>"
|
646 |
+
class="<?php echo $args[ 'class' ] ?>"
|
647 |
+
name="<?php echo $args[ 'name' ] ?>"
|
648 |
+
data-placeholder="<?php echo $args[ 'data-placeholder' ] ?>"
|
649 |
+
data-allow_clear="<?php echo $args[ 'data-allow_clear' ] ?>"
|
650 |
+
data-selected="<?php echo is_array( $args[ 'data-selected' ] ) ? esc_attr( json_encode( $args[ 'data-selected' ] ) ) : esc_attr( $args[ 'data-selected' ] ) ?>"
|
651 |
+
data-multiple="<?php echo $args[ 'data-multiple' ] === true ? 'true' : 'false' ?>"
|
652 |
+
<?php echo( !empty( $args[ 'data-action' ] ) ? 'data-action="' . $args[ 'data-action' ] . '"' : '' ) ?>
|
653 |
+
value="<?php echo $args[ 'value' ] ?>"
|
654 |
+
style="<?php echo $args[ 'style' ] ?>"
|
655 |
+
<?php echo $custom_attributes ?>
|
656 |
+
/>
|
657 |
+
<?php
|
658 |
+
endif;
|
659 |
+
}
|
660 |
+
}
|
661 |
+
|
662 |
+
if ( !function_exists( 'yit_product_visibility_meta' ) ) {
|
663 |
+
function yit_product_visibility_meta( $args ) {
|
664 |
+
if ( version_compare( WC()->version, '2.7.0', '<' ) ) {
|
665 |
+
$args[ 'meta_query' ] = isset( $args[ 'meta_query' ] ) ? $args[ 'meta_query' ] : array();
|
666 |
+
$args[ 'meta_query' ][] = WC()->query->visibility_meta_query();
|
667 |
+
} else {
|
668 |
+
$product_visibility_term_ids = wc_get_product_visibility_term_ids();
|
669 |
+
$args[ 'tax_query' ] = isset( $args[ 'tax_query' ] ) ? $args[ 'tax_query' ] : array();
|
670 |
+
$args[ 'tax_query' ][] = array(
|
671 |
+
'taxonomy' => 'product_visibility',
|
672 |
+
'field' => 'term_taxonomy_id',
|
673 |
+
'terms' => is_search() ? $product_visibility_term_ids[ 'exclude-from-search' ] : $product_visibility_term_ids[ 'exclude-from-catalog' ],
|
674 |
+
'operator' => 'NOT IN',
|
675 |
+
);
|
676 |
+
}
|
677 |
+
|
678 |
+
return $args;
|
679 |
+
}
|
680 |
+
}
|
681 |
+
|
682 |
+
if ( !function_exists( 'yit_datetime_to_timestamp' ) ) {
|
683 |
+
|
684 |
+
/**
|
685 |
+
*
|
686 |
+
*/
|
687 |
+
function yit_datetime_to_timestamp( $date ) {
|
688 |
+
|
689 |
+
if ( version_compare( WC()->version, '2.7.0', '<' ) ) {
|
690 |
+
$date = strtotime( $date );
|
691 |
+
}
|
692 |
+
|
693 |
+
return $date;
|
694 |
+
}
|
695 |
+
|
696 |
+
}
|
697 |
+
|
698 |
+
|
699 |
+
yit_fix_wc_deprecated_filters();
|
700 |
+
add_action( 'shutdown', 'yit_send_changes_to_db' );
|
plugin-options/general-options.php
CHANGED
@@ -22,11 +22,12 @@ $options = array(
|
|
22 |
|
23 |
array(
|
24 |
'name' => __( 'Link or Button', 'yith-woocommerce-compare' ),
|
25 |
-
'
|
26 |
'id' => 'yith_woocompare_is_button',
|
27 |
'std' => 'button',
|
28 |
'default' => 'button',
|
29 |
'type' => 'select',
|
|
|
30 |
'options' => array(
|
31 |
'link' => __( 'Link', 'yith-woocommerce-compare' ),
|
32 |
'button' => __( 'Button', 'yith-woocommerce-compare' )
|
@@ -141,4 +142,4 @@ $options = array(
|
|
141 |
)
|
142 |
);
|
143 |
|
144 |
-
return $options;
|
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' )
|
142 |
)
|
143 |
);
|
144 |
|
145 |
+
return apply_filters( 'yith_woocompare_general_settings', $options );
|
templates/compare.php
CHANGED
@@ -49,13 +49,15 @@ $localized_table_text = apply_filters ( 'wpml_translate_single_string', $table_t
|
|
49 |
<title><?php _e( 'Product Comparison', 'yith-woocommerce-compare' ) ?></title>
|
50 |
<link rel="profile" href="http://gmpg.org/xfn/11" />
|
51 |
|
52 |
-
|
|
|
|
|
|
|
|
|
53 |
<link rel="stylesheet" href="<?php echo $this->stylesheet_url() ?>" type="text/css" />
|
54 |
<link rel="stylesheet" href="<?php echo YITH_WOOCOMPARE_URL ?>assets/css/colorbox.css"/>
|
55 |
<link rel="stylesheet" href="<?php echo YITH_WOOCOMPARE_URL ?>assets/css/jquery.dataTables.css"/>
|
56 |
|
57 |
-
<?php wp_head() ?>
|
58 |
-
|
59 |
<style type="text/css">
|
60 |
body.loading {
|
61 |
background: url("<?php echo YITH_WOOCOMPARE_URL ?>assets/images/colorbox/loading.gif") no-repeat scroll center center transparent;
|
@@ -80,7 +82,7 @@ $localized_table_text = apply_filters ( 'wpml_translate_single_string', $table_t
|
|
80 |
<thead>
|
81 |
<tr>
|
82 |
<th> </th>
|
83 |
-
<?php foreach( $products as $
|
84 |
<td></td>
|
85 |
<?php endforeach; ?>
|
86 |
</tr>
|
@@ -88,7 +90,7 @@ $localized_table_text = apply_filters ( 'wpml_translate_single_string', $table_t
|
|
88 |
<tfoot>
|
89 |
<tr>
|
90 |
<th> </th>
|
91 |
-
<?php foreach( $products as $
|
92 |
<td></td>
|
93 |
<?php endforeach; ?>
|
94 |
</tr>
|
@@ -104,11 +106,17 @@ $localized_table_text = apply_filters ( 'wpml_translate_single_string', $table_t
|
|
104 |
<?php else : ?>
|
105 |
<tr class="remove">
|
106 |
<th> </th>
|
107 |
-
<?php
|
|
|
|
|
|
|
108 |
<td class="<?php echo $product_class; ?>">
|
109 |
-
<a href="<?php echo add_query_arg( 'redirect', 'view', $this->remove_product_url( $
|
110 |
</td>
|
111 |
-
|
|
|
|
|
|
|
112 |
</tr>
|
113 |
|
114 |
<?php foreach ( $fields as $field => $name ) : ?>
|
@@ -120,7 +128,10 @@ $localized_table_text = apply_filters ( 'wpml_translate_single_string', $table_t
|
|
120 |
<?php if ( $field == 'image' ) echo '<div class="fixed-th"></div>'; ?>
|
121 |
</th>
|
122 |
|
123 |
-
<?php
|
|
|
|
|
|
|
124 |
<td class="<?php echo $product_class; ?>"><?php
|
125 |
switch( $field ) {
|
126 |
|
@@ -138,7 +149,9 @@ $localized_table_text = apply_filters ( 'wpml_translate_single_string', $table_t
|
|
138 |
}
|
139 |
?>
|
140 |
</td>
|
141 |
-
|
|
|
|
|
142 |
|
143 |
</tr>
|
144 |
|
@@ -148,9 +161,14 @@ $localized_table_text = apply_filters ( 'wpml_translate_single_string', $table_t
|
|
148 |
<tr class="price repeated">
|
149 |
<th><?php echo $fields['price'] ?></th>
|
150 |
|
151 |
-
<?php
|
|
|
|
|
|
|
152 |
<td class="<?php echo $product_class ?>"><?php echo $product->fields['price'] ?></td>
|
153 |
-
|
|
|
|
|
154 |
|
155 |
</tr>
|
156 |
<?php endif; ?>
|
@@ -159,9 +177,16 @@ $localized_table_text = apply_filters ( 'wpml_translate_single_string', $table_t
|
|
159 |
<tr class="add-to-cart repeated">
|
160 |
<th><?php echo $fields['add-to-cart'] ?></th>
|
161 |
|
162 |
-
<?php
|
163 |
-
|
164 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
|
166 |
</tr>
|
167 |
<?php endif; ?>
|
49 |
<title><?php _e( 'Product Comparison', 'yith-woocommerce-compare' ) ?></title>
|
50 |
<link rel="profile" href="http://gmpg.org/xfn/11" />
|
51 |
|
52 |
+
<?php wp_head() ?>
|
53 |
+
|
54 |
+
<?php do_action( 'yith_woocompare_popup_head' ) ?>
|
55 |
+
|
56 |
+
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800" />
|
57 |
<link rel="stylesheet" href="<?php echo $this->stylesheet_url() ?>" type="text/css" />
|
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 |
|
|
|
|
|
61 |
<style type="text/css">
|
62 |
body.loading {
|
63 |
background: url("<?php echo YITH_WOOCOMPARE_URL ?>assets/images/colorbox/loading.gif") no-repeat scroll center center transparent;
|
82 |
<thead>
|
83 |
<tr>
|
84 |
<th> </th>
|
85 |
+
<?php foreach( $products as $product_id => $product ) : ?>
|
86 |
<td></td>
|
87 |
<?php endforeach; ?>
|
88 |
</tr>
|
90 |
<tfoot>
|
91 |
<tr>
|
92 |
<th> </th>
|
93 |
+
<?php foreach( $products as $product_id => $product ) : ?>
|
94 |
<td></td>
|
95 |
<?php endforeach; ?>
|
96 |
</tr>
|
106 |
<?php else : ?>
|
107 |
<tr class="remove">
|
108 |
<th> </th>
|
109 |
+
<?php
|
110 |
+
$index = 0;
|
111 |
+
foreach( $products as $product_id => $product ) :
|
112 |
+
$product_class = ( $index % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product_id ?>
|
113 |
<td class="<?php echo $product_class; ?>">
|
114 |
+
<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>
|
115 |
</td>
|
116 |
+
<?php
|
117 |
+
++$index;
|
118 |
+
endforeach;
|
119 |
+
?>
|
120 |
</tr>
|
121 |
|
122 |
<?php foreach ( $fields as $field => $name ) : ?>
|
128 |
<?php if ( $field == 'image' ) echo '<div class="fixed-th"></div>'; ?>
|
129 |
</th>
|
130 |
|
131 |
+
<?php
|
132 |
+
$index = 0;
|
133 |
+
foreach( $products as $product_id => $product ) :
|
134 |
+
$product_class = ( $index % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product_id; ?>
|
135 |
<td class="<?php echo $product_class; ?>"><?php
|
136 |
switch( $field ) {
|
137 |
|
149 |
}
|
150 |
?>
|
151 |
</td>
|
152 |
+
<?php
|
153 |
+
++$index;
|
154 |
+
endforeach; ?>
|
155 |
|
156 |
</tr>
|
157 |
|
161 |
<tr class="price repeated">
|
162 |
<th><?php echo $fields['price'] ?></th>
|
163 |
|
164 |
+
<?php
|
165 |
+
$index = 0;
|
166 |
+
foreach( $products as $product_id => $product ) :
|
167 |
+
$product_class = ( $index % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product_id ?>
|
168 |
<td class="<?php echo $product_class ?>"><?php echo $product->fields['price'] ?></td>
|
169 |
+
<?php
|
170 |
+
++$index;
|
171 |
+
endforeach; ?>
|
172 |
|
173 |
</tr>
|
174 |
<?php endif; ?>
|
177 |
<tr class="add-to-cart repeated">
|
178 |
<th><?php echo $fields['add-to-cart'] ?></th>
|
179 |
|
180 |
+
<?php
|
181 |
+
$index = 0;
|
182 |
+
foreach( $products as $product_id => $product ) :
|
183 |
+
$product_class = ( $index % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product_id ?>
|
184 |
+
<td class="<?php echo $product_class ?>">
|
185 |
+
<?php woocommerce_template_loop_add_to_cart(); ?>
|
186 |
+
</td>
|
187 |
+
<?php
|
188 |
+
++$index;
|
189 |
+
endforeach; ?>
|
190 |
|
191 |
</tr>
|
192 |
<?php endif; ?>
|
widgets/class.yith-woocompare-widget.php
CHANGED
@@ -47,8 +47,8 @@ if( !class_exists( 'YITH_WOOCOMPARE' ) ) {
|
|
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"><?php _e( 'Clear all', 'yith-woocommerce-compare' ) ?></a>
|
51 |
-
<a href="<?php echo add_query_arg( array( 'iframe' => 'true' ), $yith_woocompare->obj->view_table_url() ) ?>" class="compare button"><?php _e( 'Compare', 'yith-woocommerce-compare' ) ?></a>
|
52 |
|
53 |
<?php echo $after_widget;
|
54 |
}
|
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 add_query_arg( array( 'iframe' => 'true' ), $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 |
}
|