YITH WooCommerce Compare - Version 1.2.0

Version Description

  • Added: Support to WC 2.2.2
  • Update: Compare Template
  • Updated: Plugin Core Framework
  • Tweek: WPML Support improved
  • Fixed: Fields orders
Download this release

Release Info

Developer yithemes
Plugin Icon 128x128 YITH WooCommerce Compare
Version 1.2.0
Comparing to
See all releases

Code changes from version 1.1.4 to 1.2.0

README.txt CHANGED
@@ -3,13 +3,13 @@
3
Contributors: yithemes
4
Tags: woocommerce, compare, compare products, product compare, widget
5
Requires at least: 3.5.1
6
- Tested up to: 3.9.1
7
- Stable tag: 1.1.4
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 2.1.x
13
14
15
== Description ==
@@ -83,10 +83,18 @@ Yes, you can sort the fields in the compare table. You can do it in Woocommerce
83
84
== Changelog ==
85
86
= 1.1.4 =
87
88
- * Fixed: Horizontal scroll bar issue: show at the end of iframe
89
* Updated: Colorbox Library Version 1.5.10
90
91
= 1.1.3 =
92
@@ -118,7 +126,7 @@ Yes, you can sort the fields in the compare table. You can do it in Woocommerce
118
= 1.0.4 =
119
120
* Added: complete Dutch translation. Thanks to Frans Pronk
121
- * Sortable scripts included only in the plugin admin page
122
* Fixed: products list in popup don't update after have added a product
123
124
= 1.0.3 =
@@ -127,7 +135,7 @@ Yes, you can sort the fields in the compare table. You can do it in Woocommerce
127
128
= 1.0.2 =
129
130
- * Improved: trigger in javascript file for add to compare event
131
132
= 1.0.1 =
133
3
Contributors: yithemes
4
Tags: woocommerce, compare, compare products, product compare, widget
5
Requires at least: 3.5.1
6
+ Tested up to: 4.0
7
+ Stable tag: 1.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 2.2.x
13
14
15
== Description ==
83
84
== Changelog ==
85
86
+ = 1.2.0 =
87
+
88
+ * Added: Support to WC 2.2.2
89
+ * Update: Compare Template
90
+ * Updated: Plugin Core Framework
91
+ * Tweek: WPML Support improved
92
+ * Fixed: Fields orders
93
+
94
= 1.1.4 =
95
96
* Updated: Colorbox Library Version 1.5.10
97
+ * Fixed: Horizontal scroll bar issue: show at the end of iframe
98
99
= 1.1.3 =
100
126
= 1.0.4 =
127
128
* Added: complete Dutch translation. Thanks to Frans Pronk
129
+ * Fixed: Sortable scripts included only in the plugin admin page
130
* Fixed: products list in popup don't update after have added a product
131
132
= 1.0.3 =
135
136
= 1.0.2 =
137
138
+ * Tweak: trigger in javascript file for add to compare event
139
140
= 1.0.1 =
141
assets/js/unminified/woocompare.js ADDED
@@ -0,0 +1,195 @@
1
+ jQuery(document).ready(function($) {
2
+
3
+ // add into table
4
+ $(document).on( 'click', '.product a.compare', function(e){
5
+ e.preventDefault();
6
+
7
+ var button = $(this),
8
+ data = {
9
+ _yitnonce_ajax: yith_woocompare.nonceadd,
10
+ action: yith_woocompare.actionadd,
11
+ id: button.data('product_id'),
12
+ context: 'frontend'
13
+ },
14
+ widget_list = $('.yith-woocompare-widget ul.products-list');
15
+
16
+ // add ajax loader
17
+ button.block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
18
+ widget_list.block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
19
+
20
+ $.ajax({
21
+ type: 'post',
22
+ url: yith_woocompare.ajaxurl,
23
+ data: data,
24
+ dataType: 'json',
25
+ success: function(response){
26
+ button.unblock().addClass('added').text( yith_woocompare.added_label );
27
+
28
+ // add the product in the widget
29
+ widget_list.unblock().html( response.widget_table );
30
+
31
+ if (yith_woocompare.auto_open == 'yes') $('body').trigger( 'yith_woocompare_open_popup', { response: response.table_url, button: button } );
32
+ }
33
+ });
34
+ });
35
+
36
+ // open popup
37
+ $('body').on( 'yith_woocompare_open_popup', function( e, data ) {
38
+ var response = data.response;
39
+
40
+ if ($(window).width() >= 768) {
41
+ $.colorbox({
42
+ href: response,
43
+ iframe: true,
44
+ width: '90%',
45
+ height: '90%',
46
+ onClosed: function(){
47
+ var widget_list = $('.yith-woocompare-widget ul.products-list'),
48
+ data = {
49
+ action: yith_woocompare.actionview,
50
+ context: 'frontend'
51
+ };
52
+
53
+ widget_list.block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
54
+
55
+ $.ajax({
56
+ type: 'post',
57
+ url: yith_woocompare.ajaxurl,
58
+ data: data,
59
+ success: function(response){
60
+ // add the product in the widget
61
+ widget_list.unblock().html( response );
62
+ }
63
+ });
64
+ }
65
+ });
66
+
67
+ $(window).resize(function () {
68
+ $.colorbox.resize({
69
+ width: '90%',
70
+ height: '90%'
71
+ });
72
+ });
73
+
74
+ } else {
75
+ var urlparts = response.split('?');
76
+ var parameter = 'iframe';
77
+ if (urlparts.length >= 2) {
78
+ var prefix = encodeURIComponent(parameter) + '=';
79
+ var pars = urlparts[1].split(/[&;]/g);
80
+ for (var i = pars.length; i-- > 0;) {
81
+ if (pars[i].lastIndexOf(prefix, 0) !== -1) {
82
+ pars.splice(i, 1);
83
+ }
84
+ }
85
+ response = urlparts[0] + '?' + pars.join('&');
86
+ }
87
+
88
+ window.open( response, yith_woocompare.table_title);
89
+ }
90
+ });
91
+
92
+ // remove from table
93
+ $(document).on( 'click', '.remove a', function(e){
94
+ e.preventDefault();
95
+
96
+ var button = $(this),
97
+ data = {
98
+ _yitnonce_ajax: yith_woocompare.nonceremove,
99
+ action: yith_woocompare.actionremove,
100
+ id: button.data('product_id'),
101
+ context: 'frontend'
102
+ },
103
+ product_cell = $( 'td.product_' + data.id + ', th.product_' + data.id );
104
+
105
+ // add ajax loader
106
+ button.block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
107
+
108
+ $.ajax({
109
+ type: 'post',
110
+ url: yith_woocompare.ajaxurl,
111
+ data: data,
112
+ dataType:'html',
113
+ success: function(response){
114
+ button.unblock();
115
+
116
+ // in compare table
117
+ var table = $(response).filter('table.compare-list');
118
+ $('body > table.compare-list').replaceWith( table );
119
+
120
+ // removed trigger
121
+ $(window).trigger('yith_woocompare_product_removed');
122
+ }
123
+ });
124
+ });
125
+
126
+
127
+ // General link to open the compare table
128
+ $('.yith-woocompare-open a, a.yith-woocompare-open').on('click', function(e){
129
+ e.preventDefault();
130
+ $('body').trigger('yith_woocompare_open_popup', { response: yith_add_query_arg('action', yith_woocompare.actionview) + '&iframe=true' });
131
+ });
132
+
133
+
134
+
135
+ // ##### WIDGET ######
136
+
137
+ $('.yith-woocompare-widget')
138
+
139
+ // view table (click on compare
140
+ .on('click', 'a.compare', function (e) {
141
+ e.preventDefault();
142
+ $('body').trigger('yith_woocompare_open_popup', { response: $(this).attr('href') });
143
+ })
144
+
145
+ // remove product & clear all
146
+ .on('click', 'li a.remove, a.clear-all', function (e) {
147
+ e.preventDefault();
148
+
149
+ var lang = $( '.yith-woocompare-widget .products-list').data('lang');
150
+
151
+ var button = $(this),
152
+ data = {
153
+ _yitnonce_ajax: yith_woocompare.nonceremove,
154
+ action: yith_woocompare.actionremove,
155
+ id: button.data('product_id'),
156
+ context: 'frontend',
157
+ responseType: 'product_list',
158
+ lang: lang
159
+ },
160
+ product_list = button.parents('.yith-woocompare-widget').find('ul.products-list');
161
+
162
+ // add ajax loader
163
+ product_list.block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
164
+
165
+ $.ajax({
166
+ type: 'post',
167
+ url: yith_woocompare.ajaxurl,
168
+ data: data,
169
+ dataType: 'html',
170
+ success: function (response) {
171
+ product_list.html(response);
172
+ product_list.unblock();
173
+ }
174
+ });
175
+ });
176
+
177
+
178
+ function yith_add_query_arg(key, value)
179
+ {
180
+ key = escape(key); value = escape(value);
181
+
182
+ var s = document.location.search;
183
+ var kvp = key+"="+value;
184
+
185
+ var r = new RegExp("(&|\\?)"+key+"=[^\&]*");
186
+
187
+ s = s.replace(r,"$1"+kvp);
188
+
189
+ if(!RegExp.$1) {s += (s.length>0 ? '&' : '?') + kvp;};
190
+
191
+ //again, do what you will here
192
+ return s;
193
+ }
194
+
195
+ });
assets/js/woocompare.js CHANGED
@@ -1,195 +1 @@
1
- jQuery(document).ready(function($) {
2
-
3
- // add into table
4
- $(document).on( 'click', '.product a.compare', function(e){
5
- e.preventDefault();
6
-
7
- var button = $(this),
8
- data = {
9
- _yitnonce_ajax: yith_woocompare.nonceadd,
10
- action: yith_woocompare.actionadd,
11
- id: button.data('product_id'),
12
- context: 'frontend'
13
- },
14
- widget_list = $('.yith-woocompare-widget ul.products-list');
15
-
16
- // add ajax loader
17
- button.block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
18
- widget_list.block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
19
-
20
- $.ajax({
21
- type: 'post',
22
- url: yith_woocompare.ajaxurl,
23
- data: data,
24
- dataType: 'json',
25
- success: function(response){
26
- button.unblock().addClass('added').text( yith_woocompare.added_label );
27
-
28
- // add the product in the widget
29
- widget_list.unblock().html( response.widget_table );
30
-
31
- if (yith_woocompare.auto_open == 'yes') $('body').trigger( 'yith_woocompare_open_popup', { response: response.table_url, button: button } );
32
- }
33
- });
34
- });
35
-
36
- // open popup
37
- $('body').on( 'yith_woocompare_open_popup', function( e, data ) {
38
- var response = data.response;
39
-
40
- if ($(window).width() >= 768) {
41
- $.colorbox({
42
- href: response,
43
- iframe: true,
44
- width: '90%',
45
- height: '90%',
46
- onClosed: function(){
47
- var widget_list = $('.yith-woocompare-widget ul.products-list'),
48
- data = {
49
- action: yith_woocompare.actionview,
50
- context: 'frontend'
51
- };
52
-
53
- widget_list.block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
54
-
55
- $.ajax({
56
- type: 'post',
57
- url: yith_woocompare.ajaxurl,
58
- data: data,
59
- success: function(response){
60
- // add the product in the widget
61
- widget_list.unblock().html( response );
62
- }
63
- });
64
- }
65
- });
66
-
67
- $(window).resize(function () {
68
- $.colorbox.resize({
69
- width: '90%',
70
- height: '90%'
71
- });
72
- });
73
-
74
- } else {
75
- var urlparts = response.split('?');
76
- var parameter = 'iframe';
77
- if (urlparts.length >= 2) {
78
- var prefix = encodeURIComponent(parameter) + '=';
79
- var pars = urlparts[1].split(/[&;]/g);
80
- for (var i = pars.length; i-- > 0;) {
81
- if (pars[i].lastIndexOf(prefix, 0) !== -1) {
82
- pars.splice(i, 1);
83
- }
84
- }
85
- response = urlparts[0] + '?' + pars.join('&');
86
- }
87
-
88
- window.open( response, yith_woocompare.table_title);
89
- }
90
- });
91
-
92
- // remove from table
93
- $(document).on( 'click', '.remove a', function(e){
94
- e.preventDefault();
95
-
96
- var button = $(this),
97
- data = {
98
- _yitnonce_ajax: yith_woocompare.nonceremove,
99
- action: yith_woocompare.actionremove,
100
- id: button.data('product_id'),
101
- context: 'frontend'
102
- },
103
- product_cell = $( 'td.product_' + data.id + ', th.product_' + data.id );
104
-
105
- // add ajax loader
106
- button.block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
107
-
108
- $.ajax({
109
- type: 'post',
110
- url: yith_woocompare.ajaxurl,
111
- data: data,
112
- dataType:'html',
113
- success: function(response){
114
- button.unblock();
115
-
116
- // in compare table
117
- var table = $(response).filter('table.compare-list');
118
- $('body > table.compare-list').replaceWith( table );
119
-
120
- // removed trigger
121
- $(window).trigger('yith_woocompare_product_removed');
122
- }
123
- });
124
- });
125
-
126
-
127
- // General link to open the compare table
128
- $('.yith-woocompare-open a, a.yith-woocompare-open').on('click', function(e){
129
- e.preventDefault();
130
- $('body').trigger('yith_woocompare_open_popup', { response: yith_add_query_arg('action', yith_woocompare.actionview) + '&iframe=true' });
131
- });
132
-
133
-
134
-
135
- // ##### WIDGET ######
136
-
137
- $('.yith-woocompare-widget')
138
-
139
- // view table (click on compare
140
- .on('click', 'a.compare', function (e) {
141
- e.preventDefault();
142
- $('body').trigger('yith_woocompare_open_popup', { response: $(this).attr('href') });
143
- })
144
-
145
- // remove product & clear all
146
- .on('click', 'li a.remove, a.clear-all', function (e) {
147
- e.preventDefault();
148
-
149
- var lang = $( '.yith-woocompare-widget .products-list').data('lang');
150
-
151
- var button = $(this),
152
- data = {
153
- _yitnonce_ajax: yith_woocompare.nonceremove,
154
- action: yith_woocompare.actionremove,
155
- id: button.data('product_id'),
156
- context: 'frontend',
157
- responseType: 'product_list',
158
- lang: lang
159
- },
160
- product_list = button.parents('.yith-woocompare-widget').find('ul.products-list');
161
-
162
- // add ajax loader
163
- product_list.block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
164
-
165
- $.ajax({
166
- type: 'post',
167
- url: yith_woocompare.ajaxurl,
168
- data: data,
169
- dataType: 'html',
170
- success: function (response) {
171
- product_list.html(response);
172
- product_list.unblock();
173
- }
174
- });
175
- });
176
-
177
-
178
- function yith_add_query_arg(key, value)
179
- {
180
- key = escape(key); value = escape(value);
181
-
182
- var s = document.location.search;
183
- var kvp = key+"="+value;
184
-
185
- var r = new RegExp("(&|\\?)"+key+"=[^\&]*");
186
-
187
- s = s.replace(r,"$1"+kvp);
188
-
189
- if(!RegExp.$1) {s += (s.length>0 ? '&' : '?') + kvp;};
190
-
191
- //again, do what you will here
192
- return s;
193
- }
194
-
195
- });
1
+ jQuery(document).ready(function(a){function h(a,d){a=escape(a);d=escape(d);var b=document.location.search,e=a+"="+d,b=b.replace(new RegExp("(&|\\?)"+a+"=[^&]*"),"$1"+e);RegExp.$1||(b+=(0<b.length?"&":"?")+e);return b}a(document).on("click",".product a.compare",function(c){c.preventDefault();var d=a(this);c={_yitnonce_ajax:yith_woocompare.nonceadd,action:yith_woocompare.actionadd,id:d.data("product_id"),context:"frontend"};var b=a(".yith-woocompare-widget ul.products-list");d.block({message:null,overlayCSS:{background:"#fff url("+woocommerce_params.ajax_loader_url+") no-repeat center",backgroundSize:"16px 16px",opacity:.6}});b.block({message:null,overlayCSS:{background:"#fff url("+woocommerce_params.ajax_loader_url+") no-repeat center",backgroundSize:"16px 16px",opacity:.6}});a.ajax({type:"post",url:yith_woocompare.ajaxurl,data:c,dataType:"json",success:function(c){d.unblock().addClass("added").text(yith_woocompare.added_label);b.unblock().html(c.widget_table);"yes"==yith_woocompare.auto_open&&a("body").trigger("yith_woocompare_open_popup",{response:c.table_url,button:d})}})});a("body").on("yith_woocompare_open_popup",function(c,d){var b=d.response;if(768<=a(window).width())a.colorbox({href:b,iframe:!0,width:"90%",height:"90%",onClosed:function(){var b=a(".yith-woocompare-widget ul.products-list"),c={action:yith_woocompare.actionview,context:"frontend"};b.block({message:null,overlayCSS:{background:"#fff url("+woocommerce_params.ajax_loader_url+") no-repeat center",backgroundSize:"16px 16px",opacity:.6}});a.ajax({type:"post",url:yith_woocompare.ajaxurl,data:c,success:function(a){b.unblock().html(a)}})}}),a(window).resize(function(){a.colorbox.resize({width:"90%",height:"90%"})});else{var e=b.split("?");if(2<=e.length){for(var b=encodeURIComponent("iframe")+"=",f=e[1].split(/[&;]/g),g=f.length;0<g--;)-1!==f[g].lastIndexOf(b,0)&&f.splice(g,1);b=e[0]+"?"+f.join("&")}window.open(b,yith_woocompare.table_title)}});a(document).on("click",".remove a",function(c){c.preventDefault();var d=a(this);c={_yitnonce_ajax:yith_woocompare.nonceremove,action:yith_woocompare.actionremove,id:d.data("product_id"),context:"frontend"};a("td.product_"+c.id+", th.product_"+c.id);d.block({message:null,overlayCSS:{background:"#fff url("+woocommerce_params.ajax_loader_url+") no-repeat center",backgroundSize:"16px 16px",opacity:.6}});a.ajax({type:"post",url:yith_woocompare.ajaxurl,data:c,dataType:"html",success:function(b){d.unblock();b=a(b).filter("table.compare-list");a("body > table.compare-list").replaceWith(b);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:h("action",yith_woocompare.actionview)+"&iframe=true"})});a(".yith-woocompare-widget").on("click","a.compare",function(c){c.preventDefault();a("body").trigger("yith_woocompare_open_popup",{response:a(this).attr("href")})}).on("click","li a.remove, a.clear-all",function(c){c.preventDefault();var d=a(".yith-woocompare-widget .products-list").data("lang");c=a(this);var d={_yitnonce_ajax:yith_woocompare.nonceremove,action:yith_woocompare.actionremove,id:c.data("product_id"),context:"frontend",responseType:"product_list",lang:d},b=c.parents(".yith-woocompare-widget").find("ul.products-list");b.block({message:null,overlayCSS:{background:"#fff url("+woocommerce_params.ajax_loader_url+") no-repeat center",backgroundSize:"16px 16px",opacity:.6}});a.ajax({type:"post",url:yith_woocompare.ajaxurl,data:d,dataType:"html",success:function(a){b.html(a);b.unblock()}})})});
class.yith-woocompare-admin.php CHANGED
@@ -77,6 +77,7 @@ class YITH_Woocompare_Admin {
77
if ( !has_action('woocommerce_admin_field_slider')) add_action( 'woocommerce_admin_field_slider', array( $this, 'admin_fields_slider' ) );
78
if ( !has_action('woocommerce_admin_field_picker')) add_action( 'woocommerce_admin_field_picker', array( $this, 'admin_fields_picker' ) );
79
if ( !has_action('woocommerce_admin_field_attributes')) add_action( 'woocommerce_admin_field_attributes', array( $this, 'admin_fields_attributes' ) );
80
add_action( 'admin_print_footer_scripts', array( $this, 'admin_fields_image_deps' ) );
81
82
add_action( 'woocommerce_update_option_slider', array( $this, 'admin_update_option' ) );
@@ -111,8 +112,8 @@ class YITH_Woocompare_Admin {
111
* @since 1.0.0
112
*/
113
public function update_options() {
114
- foreach( $this->options as $option ) {
115
- woocommerce_update_options( $option );
116
}
117
}
118
@@ -187,13 +188,14 @@ class YITH_Woocompare_Admin {
187
if ( $value['type'] == 'image_width' ) {
188
add_option($value['id'], $value['std']);
189
} elseif ( $value['type'] == 'attributes' ) {
190
if ( $value['default'] == 'all' ) {
191
$fields = array_merge( $this->default_fields, YITH_Woocompare_Helper::attribute_taxonomies() );
192
$all = array();
193
foreach ( array_keys( $fields ) as $field ) $all[$field] = true;
194
- add_option( $value['id'], $all );
195
} else {
196
- add_option( $value['id'], $value['std'] );
197
}
198
} else {
199
add_option($value['id'], $value['std']);
@@ -284,12 +286,18 @@ class YITH_Woocompare_Admin {
284
public function admin_fields_attributes( $value ) {
285
$fields = array_merge( $this->default_fields, YITH_Woocompare_Helper::attribute_taxonomies() );
286
$all = array();
287
- foreach ( array_keys( $fields ) as $field ) $all[$field] = true;
288
- $checkboxes = get_option( $value['id'], $value['default'] == 'all' ? $all : array() );
289
290
// add fields that are not still saved
291
- $checkboxes = wp_parse_args( $checkboxes, $all );
292
- //$checkboxes = array_merge( $checkboxes, array_diff_assoc( $checkboxes, $all ) );
293
?>
294
<tr valign="top">
295
<th scope="row" class="titledesc">
@@ -329,20 +337,47 @@ class YITH_Woocompare_Admin {
329
}
330
331
if ( $value['type'] == 'attributes' ) {
332
- //$fields = array_merge( $this->default_fields, YITH_Woocompare_Helper::attribute_taxonomies() );
333
$val = array();
334
$checked_fields = isset( $_POST[$value['id']] ) ? $_POST[$value['id']] : array();
335
$fields = array_map( 'trim', explode( ',', $_POST[ $value['id'] . '_positions' ] ) );
336
foreach ( $fields as $field ) {
337
$val[$field] = in_array( $field, $checked_fields );
338
}
339
- //yith_debug($val);die;
340
- update_option( $value['id'], $val );
341
- } else {
342
- update_option( $value['id'], $wc_clean($_POST[$value['id']]) );
343
}
344
}
345
346
/**
347
* Create new Woocommerce admin field: image deps
348
*
77
if ( !has_action('woocommerce_admin_field_slider')) add_action( 'woocommerce_admin_field_slider', array( $this, 'admin_fields_slider' ) );
78
if ( !has_action('woocommerce_admin_field_picker')) add_action( 'woocommerce_admin_field_picker', array( $this, 'admin_fields_picker' ) );
79
if ( !has_action('woocommerce_admin_field_attributes')) add_action( 'woocommerce_admin_field_attributes', array( $this, 'admin_fields_attributes' ) );
80
+ if ( !has_action('woocommerce_admin_field_yit_wc_image_width')) add_action( 'woocommerce_admin_field_yit_wc_image_width', array( $this, 'admin_fields_yit_wc_image_width' ) );
81
add_action( 'admin_print_footer_scripts', array( $this, 'admin_fields_image_deps' ) );
82
83
add_action( 'woocommerce_update_option_slider', array( $this, 'admin_update_option' ) );
112
* @since 1.0.0
113
*/
114
public function update_options() {
115
+ foreach( $this->options as $section_options ) {
116
+ woocommerce_update_options( $section_options );
117
}
118
}
119
188
if ( $value['type'] == 'image_width' ) {
189
add_option($value['id'], $value['std']);
190
} elseif ( $value['type'] == 'attributes' ) {
191
+ $value_id = str_replace( '_attrs', '', $value['id'] );
192
if ( $value['default'] == 'all' ) {
193
$fields = array_merge( $this->default_fields, YITH_Woocompare_Helper::attribute_taxonomies() );
194
$all = array();
195
foreach ( array_keys( $fields ) as $field ) $all[$field] = true;
196
+ add_option( $value_id, $all );
197
} else {
198
+ add_option( $value_id, $value['std'] );
199
}
200
} else {
201
add_option($value['id'], $value['std']);
286
public function admin_fields_attributes( $value ) {
287
$fields = array_merge( $this->default_fields, YITH_Woocompare_Helper::attribute_taxonomies() );
288
$all = array();
289
+
290
+ foreach ( array_keys( $fields ) as $field ) {
291
+ $all[$field] = true;
292
+ }
293
+
294
+ $checkboxes = get_option( str_replace( '_attrs', '', $value['id'] ), $value['default'] == 'all' ? $all : array() );
295
296
// add fields that are not still saved
297
+ foreach ( $checkboxes as $k => $v ) {
298
+ unset( $all[ $k ] );
299
+ }
300
+ $checkboxes = array_merge( $checkboxes, $all );
301
?>
302
<tr valign="top">
303
<th scope="row" class="titledesc">
337
}
338
339
if ( $value['type'] == 'attributes' ) {
340
$val = array();
341
$checked_fields = isset( $_POST[$value['id']] ) ? $_POST[$value['id']] : array();
342
$fields = array_map( 'trim', explode( ',', $_POST[ $value['id'] . '_positions' ] ) );
343
foreach ( $fields as $field ) {
344
$val[$field] = in_array( $field, $checked_fields );
345
}
346
+ update_option( str_replace( '_attrs', '', $value['id'] ), $val );
347
+ } else{
348
+ update_option( str_replace( '_attrs', '', $value['id'] ), $wc_clean($_POST[$value['id']]) );
349
}
350
}
351
352
+ /**
353
+ * Create new Woocommerce admin field: yit_wc_image_width
354
+ *
355
+ * @access public
356
+ * @param array $value
357
+ * @return void
358
+ * @since 1.0.0
359
+ */
360
+ public function admin_fields_yit_wc_image_width( $value ){
361
+
362
+ $width = WC_Admin_Settings::get_option( $value['id'] . '[width]', $value['default']['width'] );
363
+ $height = WC_Admin_Settings::get_option( $value['id'] . '[height]', $value['default']['height'] );
364
+ $crop = WC_Admin_Settings::get_option( $value['id'] . '[crop]', $value['default']['crop'] );
365
+ $crop = $crop == 'on' ? 1 : 0;
366
+ $crop = checked( 1, $crop, false );
367
+
368
+ ?><tr valign="top">
369
+ <th scope="row" class="titledesc"><?php echo esc_html( $value['title'] ) ?> <?php echo $value['desc'] ?></th>
370
+ <td class="forminp image_width_settings">
371
+
372
+ <input name="<?php echo esc_attr( $value['id'] ); ?>[width]" id="<?php echo esc_attr( $value['id'] ); ?>-width" type="text" size="3" value="<?php echo $width; ?>" /> &times; <input name="<?php echo esc_attr( $value['id'] ); ?>[height]" id="<?php echo esc_attr( $value['id'] ); ?>-height" type="text" size="3" value="<?php echo $height; ?>" />px
373
+
374
+ <label><input name="<?php echo esc_attr( $value['id'] ); ?>[crop]" id="<?php echo esc_attr( $value['id'] ); ?>-crop" type="checkbox" <?php echo $crop; ?> /> <?php _e( 'Hard Crop?', 'woocommerce' ); ?></label>
375
+
376
+ </td>
377
+ </tr><?php
378
+
379
+ }
380
+
381
/**
382
* Create new Woocommerce admin field: image deps
383
*
class.yith-woocompare-frontend.php CHANGED
@@ -227,7 +227,7 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
227
$fields = $this->fields();
228
229
foreach ( $products as $product_id ) {
230
- $product = get_product( $product_id );
231
if ( ! $product ) continue;
232
233
$product->fields = array();
@@ -334,7 +334,10 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
334
335
$is_button = !isset( $button_or_link ) || !$button_or_link ? get_option( 'yith_woocompare_is_button' ) : $button_or_link;
336
337
- printf( '<a href="%s" class="%s" data-product_id="%d">%s</a>', $this->add_product_url( $product_id ), 'compare' . ( $is_button == 'button' ? ' button' : '' ), $product_id, ( isset( $button_text ) && $button_text != 'default' ? $button_text : get_option( 'yith_woocompare_button_text', __( 'Compare', 'yit' ) ) ) );
338
}
339
340
/**
@@ -423,7 +426,7 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
423
* @param $product_id The product ID to add in the comparison table
424
*/
425
public function add_product_to_compare( $product_id ) {
426
- $product = get_product( $product_id );
427
428
// don't add the product if doesn't exist
429
if ( !$product->exists() || in_array( $product_id, $this->products_list ) ) return;
@@ -509,7 +512,7 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
509
}
510
511
foreach ( $this->products_list as $product_id ) {
512
- $product = get_product( $product_id );
513
if ( ! $product ) continue;
514
?>
515
<li>
@@ -528,7 +531,7 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
528
* @param $product_id The product ID to remove from the comparison table
529
*/
530
public function remove_product_from_compare( $product_id ) {
531
- $product = get_product( $product_id );
532
if ( ! $product ) return;
533
534
// don't add the product if doesn't exist
@@ -589,5 +592,10 @@ if( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
589
return ob_get_clean();
590
}
591
592
}
593
}
227
$fields = $this->fields();
228
229
foreach ( $products as $product_id ) {
230
+ $product = $this->wc_get_product( $product_id );
231
if ( ! $product ) continue;
232
233
$product->fields = array();
334
335
$is_button = !isset( $button_or_link ) || !$button_or_link ? get_option( 'yith_woocompare_is_button' ) : $button_or_link;
336
337
+ $button_text = get_option( 'yith_woocompare_button_text', __( 'Compare', 'yit' ) );
338
+ $localized_button_text = function_exists( 'icl_translate' ) ? icl_translate( 'Plugins', 'plugin_yit_compare_button_text', $button_text ) : $button_text;
339
+
340
+ printf( '<a href="%s" class="%s" data-product_id="%d">%s</a>', $this->add_product_url( $product_id ), 'compare' . ( $is_button == 'button' ? ' button' : '' ), $product_id, ( isset( $button_text ) && $button_text != 'default' ? $button_text : $localized_button_text ) );
341
}
342
343
/**
426
* @param $product_id The product ID to add in the comparison table
427
*/
428
public function add_product_to_compare( $product_id ) {
429
+ $product = $this->wc_get_product( $product_id );
430
431
// don't add the product if doesn't exist
432
if ( !$product->exists() || in_array( $product_id, $this->products_list ) ) return;
512
}
513
514
foreach ( $this->products_list as $product_id ) {
515
+ $product = $this->wc_get_product( $product_id );
516
if ( ! $product ) continue;
517
?>
518
<li>
531
* @param $product_id The product ID to remove from the comparison table
532
*/
533
public function remove_product_from_compare( $product_id ) {
534
+ $product = $this->wc_get_product( $product_id );
535
if ( ! $product ) return;
536
537
// don't add the product if doesn't exist
592
return ob_get_clean();
593
}
594
595
+ public function wc_get_product( $product_id ){
596
+ $wc_get_product = function_exists( 'wc_get_product' ) ? 'wc_get_product' : 'get_product';
597
+ return $wc_get_product( $product_id );
598
+ }
599
+
600
}
601
}
class.yith-woocompare-helper.php CHANGED
@@ -24,6 +24,7 @@ if( !class_exists( 'YITH_Woocompare_Helper' ) ) {
24
*/
25
public static function set_image_size() {
26
$size = get_option( 'yith_woocompare_image_size' );
27
add_image_size( 'yith-woocompare-image', $size['width'], $size['height'], $size['crop'] );
28
}
29
24
*/
25
public static function set_image_size() {
26
$size = get_option( 'yith_woocompare_image_size' );
27
+ $size['crop'] = isset( $size['crop'] ) ? true : false;
28
add_image_size( 'yith-woocompare-image', $size['width'], $size['height'], $size['crop'] );
29
}
30
init.php CHANGED
@@ -3,7 +3,7 @@
3
* Plugin Name: YITH Woocommerce Compare
4
* Plugin URI: http://yithemes.com/
5
* Description: YITH Woocommerce Compare allows you to compare more products with woocommerce plugin, through product attributes.
6
- * Version: 1.1.4
7
* Author: Your Inspiration Themes
8
* Author URI: http://yithemes.com/
9
* Text Domain: yit
@@ -32,9 +32,7 @@ if ( !defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly
32
33
/* Include common functions */
34
if( !defined('YITH_FUNCTIONS') ) {
35
- require_once( 'yit-common/google_fonts.php' );
36
require_once( 'yit-common/yit-functions.php' );
37
- require_once( 'yit-common/yith-panel.php' );
38
}
39
40
function yith_woocompare_constructor() {
@@ -44,7 +42,7 @@ function yith_woocompare_constructor() {
44
load_plugin_textdomain( 'yit', false, dirname( plugin_basename( __FILE__ ) ). '/languages/' );
45
46
define( 'YITH_WOOCOMPARE', true );
47
- define( 'YITH_WOOCOMPARE_VERSION', '1.1.2' );
48
define( 'YITH_WOOCOMPARE_URL', plugin_dir_url( __FILE__ ) );
49
define( 'YITH_WOOCOMPARE_DIR', plugin_dir_path( __FILE__ ) );
50
3
* Plugin Name: YITH Woocommerce Compare
4
* Plugin URI: http://yithemes.com/
5
* Description: YITH Woocommerce Compare allows you to compare more products with woocommerce plugin, through product attributes.
6
+ * Version: 1.2.0
7
* Author: Your Inspiration Themes
8
* Author URI: http://yithemes.com/
9
* Text Domain: yit
32
33
/* Include common functions */
34
if( !defined('YITH_FUNCTIONS') ) {
35
require_once( 'yit-common/yit-functions.php' );
36
}
37
38
function yith_woocompare_constructor() {
42
load_plugin_textdomain( 'yit', false, dirname( plugin_basename( __FILE__ ) ). '/languages/' );
43
44
define( 'YITH_WOOCOMPARE', true );
45
+ define( 'YITH_WOOCOMPARE_VERSION', '1.2.0' );
46
define( 'YITH_WOOCOMPARE_URL', plugin_dir_url( __FILE__ ) );
47
define( 'YITH_WOOCOMPARE_DIR', plugin_dir_path( __FILE__ ) );
48
languages/yit-tr_TR.mo ADDED
Binary file
languages/yit-tr_TR.po ADDED
@@ -0,0 +1,248 @@
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: YITH Woocommerce Compare\n"
4
+ "POT-Creation-Date: 2014-02-13 09:30+0100\n"
5
+ "PO-Revision-Date: 2014-07-22 00:03+0200\n"
6
+ "Last-Translator: Caner Öncel <caneroncel@gmail.com>\n"
7
+ "Language-Team: Caner Öncel <caneroncel@gmail.com>\n"
8
+ "Language: tr\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.6.6\n"
13
+ "X-Poedit-KeywordsList: __;_e;_x\n"
14
+ "X-Poedit-Basepath: ./\n"
15
+ "Plural-Forms: nplurals=1; plural=0;\n"
16
+ "X-Poedit-SearchPath-0: ..\n"
17
+
18
+ #: ../class.yith-woocompare-admin.php:129
19
+ msgid "Products Compare"
20
+ msgstr "Ürün Karşılaştırma"
21
+
22
+ #: ../class.yith-woocompare-admin.php:143 ../yith-woocompare-options.php:15
23
+ msgid "General Settings"
24
+ msgstr "Genel Ayarlar"
25
+
26
+ #: ../class.yith-woocompare-frontend.php:142
27
+ msgid "Added"
28
+ msgstr "Eklendi"
29
+
30
+ #: ../class.yith-woocompare-frontend.php:143 ../templates/compare.php:50
31
+ msgid "Product Comparison"
32
+ msgstr "Ürün Karşılaştırma"
33
+
34
+ #: ../class.yith-woocompare-frontend.php:254
35
+ msgid "In stock"
36
+ msgstr "Stokta"
37
+
38
+ #: ../class.yith-woocompare-frontend.php:337 ../yith-woocompare-options.php:38
39
+ #: ../widgets/class.yith-woocompare-widget.php:38
40
+ msgid "Compare"
41
+ msgstr "Karşılaştır"
42
+
43
+ #: ../class.yith-woocompare-frontend.php:496
44
+ msgid "No products to compare"
45
+ msgstr "Karşılaştırma listeniz boş"
46
+
47
+ #: ../class.yith-woocompare-frontend.php:506 ../templates/compare.php:105
48
+ msgid "Remove"
49
+ msgstr "Kaldır"
50
+
51
+ #: ../class.yith-woocompare-helper.php:38
52
+ msgid "Image"
53
+ msgstr "Resim"
54
+
55
+ #: ../class.yith-woocompare-helper.php:39
56
+ #: ../widgets/class.yith-woocompare-widget.php:55
57
+ msgid "Title"
58
+ msgstr "Başlık"
59
+
60
+ #: ../class.yith-woocompare-helper.php:40
61
+ msgid "Price"
62
+ msgstr "Fiyat"
63
+
64
+ #: ../class.yith-woocompare-helper.php:41
65
+ msgid "Add to cart"
66
+ msgstr "Sepete Ekle"
67
+
68
+ #: ../class.yith-woocompare-helper.php:42
69
+ msgid "Description"
70
+ msgstr "Açıklama"
71
+
72
+ #: ../class.yith-woocompare-helper.php:43
73
+ msgid "Availability"
74
+ msgstr "Durum"
75
+
76
+ #: ../yith-woocompare-options.php:22
77
+ msgid "Link or Button"
78
+ msgstr "Link veya Buton"
79
+
80
+ #: ../yith-woocompare-options.php:23
81
+ msgid "Choose if you want to use a link or a button for the action button."
82
+ msgstr ""
83
+ "Eylem için kullanmak üzere link veya buton seçeneklerinden birini belirleyin."
84
+
85
+ #: ../yith-woocompare-options.php:29
86
+ msgid "Link"
87
+ msgstr "Link"
88
+
89
+ #: ../yith-woocompare-options.php:30
90
+ msgid "Button"
91
+ msgstr "Buton"
92
+
93
+ #: ../yith-woocompare-options.php:35
94
+ msgid "Link/Button text"
95
+ msgstr "Link/Buton Metni"
96
+
97
+ #: ../yith-woocompare-options.php:36
98
+ msgid "Type the text to use for the button or the link of the compare."
99
+ msgstr "Karşılaştırma butonu veya bağlantısı için kullanılacak metni yazın."
100
+
101
+ #: ../yith-woocompare-options.php:43
102
+ msgid "Show button in single product page"
103
+ msgstr "Tekli ürün sayfasında buton göster"
104
+
105
+ #: ../yith-woocompare-options.php:44
106
+ msgid "Say if you want to show the button in the single product page."
107
+ msgstr "Tekli ürün sayfasında buton göstermek isteyip istemediğinizi belirtin."
108
+
109
+ #: ../yith-woocompare-options.php:52
110
+ msgid "Show button in products list"
111
+ msgstr "Ürün listesinde buton göster"
112
+
113
+ #: ../yith-woocompare-options.php:53
114
+ msgid "Say if you want to show the button in the products list."
115
+ msgstr "Ürün listesinde buton göstermek isteyip istemediğinizi belirtin."
116
+
117
+ #: ../yith-woocompare-options.php:61
118
+ msgid "Open automatically lightbox"
119
+ msgstr "Otomatik lightbox aç"
120
+
121
+ #: ../yith-woocompare-options.php:62
122
+ msgid "Open link after click into \"Compare\" button\"."
123
+ msgstr "\"Karşılaştır\" butonuna tıklandıktan sonra bağlantıyı aç."
124
+
125
+ #: ../yith-woocompare-options.php:74
126
+ msgid "Table Settings"
127
+ msgstr "Tablo Ayarları"
128
+
129
+ #: ../yith-woocompare-options.php:81
130
+ msgid "Table title"
131
+ msgstr "Tablo Başlığı"
132
+
133
+ #: ../yith-woocompare-options.php:82
134
+ msgid "Type the text to use for the table title."
135
+ msgstr "Tablo başlığı metnini buraya yazın."
136
+
137
+ #: ../yith-woocompare-options.php:84
138
+ msgid "Compare products"
139
+ msgstr "Ürünleri Karşılaştır"
140
+
141
+ #: ../yith-woocompare-options.php:89
142
+ msgid "Fields to show"
143
+ msgstr "Gösterilecek alanlar"
144
+
145
+ #: ../yith-woocompare-options.php:90 ../yith-woocompare-options.php:99
146
+ #: ../yith-woocompare-options.php:108
147
+ msgid ""
148
+ "Select the fields to show in the comparison table and order them by "
149
+ "drag&drop (are included also the woocommerce attributes)"
150
+ msgstr ""
151
+ "Karşılaştırma tablosunda gösterilecek alanları seçin ve sürükle-bırak "
152
+ "yöntemi ile sıralayın (ayrıca Woocommerce özellikleri dahildir)"
153
+
154
+ #: ../yith-woocompare-options.php:98
155
+ msgid "Repeat \"Price\" field at the end of the table"
156
+ msgstr "\"Ücret\" alanını tablonun sonuna kadar tekrarla"
157
+
158
+ #: ../yith-woocompare-options.php:107
159
+ msgid "Repeat \"Add to cart\" field at the end of the table"
160
+ msgstr "\"Sepete ekle\" alanını tablonun sonuna kadar tekrarla"
161
+
162
+ #: ../yith-woocompare-options.php:116
163
+ msgid "Image size"
164
+ msgstr "Resim Boyutu"
165
+
166
+ #: ../yith-woocompare-options.php:117
167
+ msgid "Set the size for the images"
168
+ msgstr "Resimlerin boyutlarını belirtin"
169
+
170
+ #: ../templates/compare.php:72
171
+ msgid "Close window [X]"
172
+ msgstr "Pencereyi Kapat [X]"
173
+
174
+ #: ../templates/compare.php:97
175
+ msgid "No products added in the compare table."
176
+ msgstr "Karşılaştırma tablosuna herhangi bir ürün eklenmedi."
177
+
178
+ #: ../widgets/class.yith-woocompare-widget.php:21
179
+ msgid "The widget show the list of products added in the compare table."
180
+ msgstr "Widget karşılaştırma tablosuna eklenen ürünlerin listesini gösterir."
181
+
182
+ #: ../widgets/class.yith-woocompare-widget.php:22
183
+ msgid "YITH Woocommerce Compare Widget"
184
+ msgstr "YITH Woocommerce Karşılaştırma Widgetı"
185
+
186
+ #: ../widgets/class.yith-woocompare-widget.php:37
187
+ msgid "Clear all"
188
+ msgstr "Hepsini Kaldır"
189
+
190
+ #: ../yit-common/yith-panel.php:406
191
+ msgid "Select a date"
192
+ msgstr "Bir tarih seçin"
193
+
194
+ #: ../yit-common/yith-panel.php:407
195
+ msgid "Hours"
196
+ msgstr "Saat"
197
+
198
+ #: ../yit-common/yith-panel.php:408 ../yit-common/yith-panel.php:409
199
+ msgid "Minutes"
200
+ msgstr "Dakika"
201
+
202
+ #: ../yit-common/yith-panel.php:417
203
+ msgid "Upload"
204
+ msgstr "Yükle"
205
+
206
+ #: ../yit-common/yith-panel.php:444
207
+ msgid "px"
208
+ msgstr "px"
209
+
210
+ #: ../yit-common/yith-panel.php:445
211
+ msgid "em"
212
+ msgstr "em"
213
+
214
+ #: ../yit-common/yith-panel.php:446
215
+ msgid "pt"
216
+ msgstr "pt"
217
+
218
+ #: ../yit-common/yith-panel.php:447
219
+ msgid "rem"
220
+ msgstr "rem"
221
+
222
+ #: ../yit-common/yith-panel.php:457
223
+ msgid "Select a font family"
224
+ msgstr "Bir font ailesi seçin"
225
+
226
+ #: ../yit-common/yith-panel.php:465
227
+ msgid "Regular"
228
+ msgstr "Normal"
229
+
230
+ #: ../yit-common/yith-panel.php:466
231
+ msgid "Bold"
232
+ msgstr "Kalın"
233
+
234
+ #: ../yit-common/yith-panel.php:467
235
+ msgid "Extra bold"
236
+ msgstr "Ekstra kalın"
237
+
238
+ #: ../yit-common/yith-panel.php:468
239
+ msgid "Italic"
240
+ msgstr "İtalik"
241
+
242
+ #: ../yit-common/yith-panel.php:469
243
+ msgid "Italic bold"
244
+ msgstr "İtalik kalın"
245
+
246
+ #: ../yit-common/yith-panel.php:481
247
+ msgid "Click to preview"
248
+ msgstr "Önizleme için tıklayın"
templates/compare.php CHANGED
@@ -7,8 +7,6 @@
7
* @version 1.1.4
8
*/
9
10
- global $product;
11
-
12
// remove the style of woocommerce
13
if( defined('WOOCOMMERCE_USE_CSS') && WOOCOMMERCE_USE_CSS ) wp_dequeue_style('woocommerce_frontend_styles');
14
@@ -23,6 +21,9 @@ foreach( $products as $product ) $widths[] = '{ "sWidth": "205px", resizeable:tr
23
/** FIX WOO 2.1 */
24
$wc_get_template = function_exists('wc_get_template') ? 'wc_get_template' : 'woocommerce_get_template';
25
26
?><!DOCTYPE html>
27
<!--[if IE 6]>
28
<html id="ie6" class="ie"<?php language_attributes() ?>>
@@ -64,11 +65,14 @@ $wc_get_template = function_exists('wc_get_template') ? 'wc_get_template' : 'woo
64
</style>
65
</head>
66
<!-- END HEAD -->
67
<!-- START BODY -->
68
<body <?php body_class('woocommerce') ?>>
69
70
<h1>
71
- <?php echo get_option( 'yith_woocompare_table_text' ) ?>
72
<?php if ( ! $is_iframe ) : ?><a class="close" href="#"><?php _e( 'Close window [X]', 'yit' ) ?></a><?php endif; ?>
73
</h1>
74
@@ -125,7 +129,7 @@ $wc_get_template = function_exists('wc_get_template') ? 'wc_get_template' : 'woo
125
break;
126
127
case 'add-to-cart':
128
- $wc_get_template( 'loop/add-to-cart.php', array( 'product' => $product ) );
129
break;
130
131
default:
@@ -156,7 +160,7 @@ $wc_get_template = function_exists('wc_get_template') ? 'wc_get_template' : 'woo
156
<th><?php echo $fields['add-to-cart'] ?></th>
157
158
<?php foreach( $products as $i => $product ) : $product_class = ( $i % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product->id ?>
159
- <td class="<?php echo $product_class ?>"><?php $wc_get_template( 'loop/add-to-cart.php', array( 'product' => $product ) ); ?></td>
160
<?php endforeach; ?>
161
162
</tr>
7
* @version 1.1.4
8
*/
9
10
// remove the style of woocommerce
11
if( defined('WOOCOMMERCE_USE_CSS') && WOOCOMMERCE_USE_CSS ) wp_dequeue_style('woocommerce_frontend_styles');
12
21
/** FIX WOO 2.1 */
22
$wc_get_template = function_exists('wc_get_template') ? 'wc_get_template' : 'woocommerce_get_template';
23
24
+ $table_text = get_option( 'yith_woocompare_table_text' );
25
+ $localized_table_text = function_exists( 'icl_translate' ) ? icl_translate( 'Plugins', 'plugin_yit_compare_table_text', $table_text ) : $table_text;
26
+
27
?><!DOCTYPE html>
28
<!--[if IE 6]>
29
<html id="ie6" class="ie"<?php language_attributes() ?>>
65
</style>
66
</head>
67
<!-- END HEAD -->
68
+
69
+ <?php global $product; ?>
70
+
71
<!-- START BODY -->
72
<body <?php body_class('woocommerce') ?>>
73
74
<h1>
75
+ <?php echo $localized_table_text ?>
76
<?php if ( ! $is_iframe ) : ?><a class="close" href="#"><?php _e( 'Close window [X]', 'yit' ) ?></a><?php endif; ?>
77
</h1>
78
129
break;
130
131
case 'add-to-cart':
132
+ $wc_get_template( 'loop/add-to-cart.php' );
133
break;
134
135
default:
160
<th><?php echo $fields['add-to-cart'] ?></th>
161
162
<?php foreach( $products as $i => $product ) : $product_class = ( $i % 2 == 0 ? 'odd' : 'even' ) . ' product_' . $product->id ?>
163
+ <td class="<?php echo $product_class ?>"><?php $wc_get_template( 'loop/add-to-cart.php' ); ?></td>
164
<?php endforeach; ?>
165
166
</tr>
widgets/class.yith-woocompare-widget.php CHANGED
@@ -33,7 +33,9 @@ if( !class_exists( 'YITH_WOOCOMPARE' ) ) {
33
34
extract( $args );
35
36
- echo $before_widget . $before_title . $instance['title'] . $after_title; ?>
37
38
<ul class="products-list" data-lang="<?php echo $lang ?>">
39
<?php echo $yith_woocompare->obj->list_products_html(); ?>
33
34
extract( $args );
35
36
+ $localized_widget_title = function_exists( 'icl_translate' ) ? icl_translate( 'Widget', 'widget_yit_compare_title_text', $instance['title'] ) : $instance['title'];
37
+
38
+ echo $before_widget . $before_title . $localized_widget_title . $after_title; ?>
39
40
<ul class="products-list" data-lang="<?php echo $lang ?>">
41
<?php echo $yith_woocompare->obj->list_products_html(); ?>
wpml-config.xml CHANGED
@@ -1,4 +1,6 @@
1
- <admin-texts>
2
- <key name="yith_woocompare_button_text">
3
- <key name="yith_woocompare_table_text">
4
- </admin-texts>
1
+ <wpml-config>
2
+ <admin-texts>
3
+ <key name="yith_woocompare_button_text" />
4
+ <key name="yith_woocompare_table_text" />
5
+ </admin-texts>
6
+ </wpml-config>
yit-common/yit-functions.php CHANGED
@@ -6,9 +6,11 @@
6
* @version 0.0.1
7
*/
8
9
- if( !defined('YITH_FUNCTIONS')) {
10
- define( 'YITH_FUNCTIONS', true);
11
- }
12
13
if ( ! function_exists( 'yit_is_woocommerce_active' ) ) {
14
/**
6
* @version 0.0.1
7
*/
8
9
+ define( 'YITH_FUNCTIONS', true);
10
+
11
+ /* === Include Common Framework File === */
12
+ require_once( 'google_fonts.php' );
13
+ require_once( 'yith-panel.php' );
14
15
if ( ! function_exists( 'yit_is_woocommerce_active' ) ) {
16
/**
yith-woocompare-options.php CHANGED
@@ -9,6 +9,15 @@
9
10
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
11
12
$options = array(
13
'general' => array(
14
array(
@@ -88,7 +97,7 @@ $options = array(
88
array(
89
'name' => __( 'Fields to show', 'yit' ),
90
'desc' => __( 'Select the fields to show in the comparison table and order them by drag&drop (are included also the woocommerce attributes)', 'yit' ),
91
- 'id' => 'yith_woocompare_fields',
92
'std' => 'all',
93
'default' => 'all',
94
'type' => 'attributes'
@@ -116,7 +125,7 @@ $options = array(
116
'name' => __( 'Image size', 'yit' ),
117
'desc' => __( 'Set the size for the images', 'yit' ),
118
'id' => 'yith_woocompare_image_size',
119
- 'type' => 'image_width',
120
'default' => array(
121
'width' => 220,
122
'height' => 154,
9
10
if ( !defined( 'YITH_WOOCOMPARE' ) ) { exit; } // Exit if accessed directly
11
12
+ global $woocommerce;
13
+
14
+ if ( version_compare( preg_replace( '/-beta-([0-9]+)/', '', $woocommerce->version ), '2.2', '<' ) ) {
15
+ $image_width_type = 'image_width';
16
+ }
17
+ else {
18
+ $image_width_type = 'yit_wc_image_width';
19
+ }
20
+
21
$options = array(
22
'general' => array(
23
array(
97
array(
98
'name' => __( 'Fields to show', 'yit' ),
99
'desc' => __( 'Select the fields to show in the comparison table and order them by drag&drop (are included also the woocommerce attributes)', 'yit' ),
100
+ 'id' => 'yith_woocompare_fields_attrs',
101
'std' => 'all',
102
'default' => 'all',
103
'type' => 'attributes'
125
'name' => __( 'Image size', 'yit' ),
126
'desc' => __( 'Set the size for the images', 'yit' ),
127
'id' => 'yith_woocompare_image_size',
128
+ 'type' => $image_width_type,
129
'default' => array(
130
'width' => 220,
131
'height' => 154,