Version Description
- Fixed: 'Language warning' appears when editing product translations using the native WooCommerce editor
- Fixed: Variation cannot be added to an existing order
- Fixed: Media Attachment controls for products missing
- Prevented disabling of option to use slugs in different language for products
- Fixed: Slashes not stripped correctly in product translation editor
- Fixed: 'Copy content' button not working on product translations
- Disable admin language switcher on the Product => Attributes screen
- Allow 'woocommerce_price_display_suffix' to be translated with String Translation
- Allow 'woocommerce_email_from_name' and 'woocommerce_email_from_address' to be translated with String Translation
- Fixed: Menu order is not synced when using "drag and drop" in Products => Sort Products
- Fixed: One WooCommerce attribute field won't translate
- Fixed: Variations not showing in the correct language in some circumstances
- Optimizations for the WooCommerce Multilingual products admin page - faster when a large number of products exist
- Duplicate translations too when duplicating a WooCommerce product
- Fixed: WC Price Filter showing the wrong currency
- Ability to use any currency when creating an order in the backend.
Download this release
Release Info
Developer | mihaimihai |
Plugin | WooCommerce Multilingual – run WooCommerce with WPML |
Version | 3.3.2 |
Comparing to | |
See all releases |
Code changes from version 3.3.1 to 3.3.2
- assets/css/management.css +20 -13
- assets/js/lock_fields.js +4 -4
- assets/js/scripts.js +106 -40
- assets/js/wpml_tm.js +8 -0
- compatibility/gravityforms.class.php +24 -0
- compatibility/wc_product_addons.class.php +14 -5
- compatibility/wc_product_bundles.class.php +149 -113
- compatibility/wc_sensei.class.php +217 -0
- compatibility/wc_tab_manager.class.php +150 -107
- inc/compatibility.class.php +13 -1
- inc/emails.class.php +10 -1
- inc/endpoints.class.php +123 -0
- inc/multi-currency-support.class.php +81 -11
- inc/multi-currency.class.php +246 -17
- inc/products.class.php +156 -57
- inc/reports.class.php +7 -5
- inc/store-pages.class.php +68 -20
- inc/terms.class.php +9 -10
- inc/wc-strings.class.php +1 -1
- menu/sub/product-data.php +271 -0
- menu/sub/products.php +144 -372
- menu/sub/settings.php +1 -1
- menu/sub/troubleshooting.php +13 -9
- readme.txt +20 -2
- woocommerce_wpml.class.php +67 -132
- wpml-config.xml +5 -5
- wpml-woocommerce.php +3 -2
assets/css/management.css
CHANGED
@@ -167,9 +167,6 @@
|
|
167 |
margin: 0;
|
168 |
margin-right: 5px;
|
169 |
}
|
170 |
-
.wcml_products th:first-child{
|
171 |
-
display: inline-table;
|
172 |
-
}
|
173 |
.wcml_products_translation{
|
174 |
table-layout: fixed;
|
175 |
width: auto;
|
@@ -260,10 +257,17 @@
|
|
260 |
vertical-align: middle;
|
261 |
line-height: 20px;
|
262 |
}
|
|
|
263 |
.wcml_spinner{
|
264 |
margin: 0;
|
265 |
float: none;
|
266 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
.wcml_cat_block{
|
268 |
display: none;
|
269 |
}
|
@@ -304,7 +308,7 @@
|
|
304 |
left: 30px;
|
305 |
right: 30px;
|
306 |
bottom: 30px;
|
307 |
-
z-index:
|
308 |
background-color: #f1f1f1;
|
309 |
padding: 10px;
|
310 |
padding-top: 35px;
|
@@ -322,7 +326,7 @@
|
|
322 |
min-height: 360px;
|
323 |
background: #000;
|
324 |
opacity: .7;
|
325 |
-
z-index:
|
326 |
}
|
327 |
.wp-editor-container{
|
328 |
background-color: #fff;
|
@@ -760,19 +764,19 @@ table.widefat.currency_table{
|
|
760 |
.wcml_duplicate_product_notice td{border-bottom: none !important;}
|
761 |
|
762 |
/* Icons */
|
763 |
-
[class^="icon-woo"] {
|
764 |
width: 24px;
|
765 |
height: 24px;
|
766 |
background-position: center center;
|
767 |
display: inline-block;
|
768 |
}
|
769 |
-
.icon-woo-simple { background-image: url('../images/icon-woo-simple.png'); }
|
770 |
-
.icon-woo-downloadable { background-image: url('../images/icon-woo-downloadable.png'); }
|
771 |
-
.icon-woo-external { background-image: url('../images/icon-woo-external.png'); }
|
772 |
-
.icon-woo-grouped { background-image: url('../images/icon-woo-grouped.png'); }
|
773 |
-
.icon-woo-variable { background-image: url('../images/icon-woo-variable.png'); }
|
774 |
-
.icon-woo-virtual { background-image: url('../images/icon-woo-virtual.png'); }
|
775 |
-
.children_icon{ margin-left: 20px }
|
776 |
/* Icons END */
|
777 |
|
778 |
.wcml_product_status_text,.prod_parent_text {
|
@@ -965,3 +969,6 @@ input[name="wcml_curr_template"]{
|
|
965 |
.wcml_prod_filters{
|
966 |
float: left;
|
967 |
}
|
|
|
|
|
|
167 |
margin: 0;
|
168 |
margin-right: 5px;
|
169 |
}
|
|
|
|
|
|
|
170 |
.wcml_products_translation{
|
171 |
table-layout: fixed;
|
172 |
width: auto;
|
257 |
vertical-align: middle;
|
258 |
line-height: 20px;
|
259 |
}
|
260 |
+
.trbl_variables_products .spinner,
|
261 |
.wcml_spinner{
|
262 |
margin: 0;
|
263 |
float: none;
|
264 |
}
|
265 |
+
.wcml_products .spinner{
|
266 |
+
display: block;
|
267 |
+
float: left;
|
268 |
+
margin: 0 5px;
|
269 |
+
display: none;
|
270 |
+
}
|
271 |
.wcml_cat_block{
|
272 |
display: none;
|
273 |
}
|
308 |
left: 30px;
|
309 |
right: 30px;
|
310 |
bottom: 30px;
|
311 |
+
z-index: 10000;
|
312 |
background-color: #f1f1f1;
|
313 |
padding: 10px;
|
314 |
padding-top: 35px;
|
326 |
min-height: 360px;
|
327 |
background: #000;
|
328 |
opacity: .7;
|
329 |
+
z-index: 9999;
|
330 |
}
|
331 |
.wp-editor-container{
|
332 |
background-color: #fff;
|
764 |
.wcml_duplicate_product_notice td{border-bottom: none !important;}
|
765 |
|
766 |
/* Icons */
|
767 |
+
.wcml_products [class^="icon-woo"] {
|
768 |
width: 24px;
|
769 |
height: 24px;
|
770 |
background-position: center center;
|
771 |
display: inline-block;
|
772 |
}
|
773 |
+
.wcml_products .icon-woo-simple { background-image: url('../images/icon-woo-simple.png'); }
|
774 |
+
.wcml_products .icon-woo-downloadable { background-image: url('../images/icon-woo-downloadable.png'); }
|
775 |
+
.wcml_products .icon-woo-external { background-image: url('../images/icon-woo-external.png'); }
|
776 |
+
.wcml_products .icon-woo-grouped { background-image: url('../images/icon-woo-grouped.png'); }
|
777 |
+
.wcml_products .icon-woo-variable { background-image: url('../images/icon-woo-variable.png'); }
|
778 |
+
.wcml_products .icon-woo-virtual { background-image: url('../images/icon-woo-virtual.png'); }
|
779 |
+
.wcml_products .children_icon{ margin-left: 20px }
|
780 |
/* Icons END */
|
781 |
|
782 |
.wcml_product_status_text,.prod_parent_text {
|
969 |
.wcml_prod_filters{
|
970 |
float: left;
|
971 |
}
|
972 |
+
.wcml_content_tr{
|
973 |
+
width: 100%;
|
974 |
+
}
|
assets/js/lock_fields.js
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
jQuery(document).ready(function($){
|
2 |
var i;
|
3 |
-
var ids = ['_sku','_virtual','_downloadable','product-type','_stock_status','_backorders','_manage_stock','_stock','_sold_individually','_length','_weight','product_length','_regular_price','_sale_price','_sale_price_dates_from','_sale_price_dates_to','menu_order','comment_status','_tax_status','_tax_class'];
|
4 |
|
5 |
for (i = 0; i < ids.length; i++) {
|
6 |
$('#'+ids[i]).attr('disabled','disabled');
|
7 |
$('#'+ids[i]).after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show());
|
8 |
}
|
9 |
|
10 |
-
var buttons = ['add_variation','link_all_variations'];
|
11 |
for (i = 0; i < buttons.length; i++) {
|
12 |
$('.'+buttons[i]).attr('disabled','disabled');
|
13 |
$('.'+buttons[i]).after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show().css('float','right'));
|
@@ -24,12 +24,12 @@ jQuery(document).ready(function($){
|
|
24 |
$('input[name="'+inpt_names[i]+'"]').after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show());
|
25 |
}
|
26 |
|
27 |
-
$('.woocommerce_variation input[type="text"],.woocommerce_variation input[type="number"]').each(function(){
|
28 |
$(this).attr('readonly','readonly');
|
29 |
$(this).after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show());
|
30 |
});
|
31 |
|
32 |
-
$('.woocommerce_variation select,#variable_product_options .toolbar select').each(function(){
|
33 |
$(this).attr('disabled','disabled');
|
34 |
$(this).after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show());
|
35 |
});
|
1 |
jQuery(document).ready(function($){
|
2 |
var i;
|
3 |
+
var ids = ['_sku','_virtual','_downloadable','product-type','_stock_status','_backorders','_manage_stock','_stock','_sold_individually','_length','_weight','product_length','_regular_price','_sale_price','_sale_price_dates_from','_sale_price_dates_to','menu_order','comment_status','_tax_status','_tax_class','parent_id','crosssell_ids','upsell_ids'];
|
4 |
|
5 |
for (i = 0; i < ids.length; i++) {
|
6 |
$('#'+ids[i]).attr('disabled','disabled');
|
7 |
$('#'+ids[i]).after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show());
|
8 |
}
|
9 |
|
10 |
+
var buttons = ['add_variation','link_all_variations','attribute_taxonomy','save_attributes','add_new_attribute','remove_row','add_attribute','select_all_attributes','select_no_attributes'];
|
11 |
for (i = 0; i < buttons.length; i++) {
|
12 |
$('.'+buttons[i]).attr('disabled','disabled');
|
13 |
$('.'+buttons[i]).after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show().css('float','right'));
|
24 |
$('input[name="'+inpt_names[i]+'"]').after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show());
|
25 |
}
|
26 |
|
27 |
+
$('.woocommerce_variation input[type="text"],.woocommerce_variation input[type="checkbox"],.woocommerce_variation input[type="number"],.woocommerce_attribute_data input[type="checkbox"]').each(function(){
|
28 |
$(this).attr('readonly','readonly');
|
29 |
$(this).after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show());
|
30 |
});
|
31 |
|
32 |
+
$('.woocommerce_variation select,#variable_product_options .toolbar select,.attribute_values').each(function(){
|
33 |
$(this).attr('disabled','disabled');
|
34 |
$(this).after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show());
|
35 |
});
|
assets/js/scripts.js
CHANGED
@@ -55,29 +55,62 @@ jQuery(document).ready(function($){
|
|
55 |
|
56 |
$('.wcml_details').click(function(e){
|
57 |
e.preventDefault();
|
58 |
-
var
|
59 |
-
|
60 |
-
|
|
|
|
|
61 |
|
62 |
if ( $table.is(':visible') ){
|
63 |
$table.find('input').each(function(){
|
64 |
-
|
65 |
});
|
66 |
$table.closest('.outer').hide();
|
67 |
-
|
68 |
-
}
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
}
|
77 |
return false;
|
78 |
});
|
79 |
|
80 |
-
|
81 |
var $outer = $(this).closest('.outer');
|
82 |
|
83 |
$outer.find('input').each(function(){
|
@@ -90,16 +123,14 @@ jQuery(document).ready(function($){
|
|
90 |
$closeButton.text( $closeButton.data('text-closed') );
|
91 |
});
|
92 |
|
93 |
-
});
|
94 |
-
|
95 |
-
|
96 |
-
$('button[name="cancel"]').click(function(){
|
97 |
$(this).parent().find('input').each(function(){
|
98 |
$(this).val($(this).data('def'));
|
99 |
});
|
100 |
$(this).closest('.outer').slideUp('3000');
|
|
|
101 |
});
|
102 |
-
|
|
|
103 |
var field = $(this);
|
104 |
|
105 |
var spl = $(this).attr('name').split('#');
|
@@ -108,10 +139,10 @@ jQuery(document).ready(function($){
|
|
108 |
var language = spl[2];
|
109 |
|
110 |
var records = '';
|
111 |
-
field.closest('
|
112 |
records += $(this).serialize()+"&";
|
113 |
});
|
114 |
-
field.closest('
|
115 |
records += $(this).serialize()+"&";
|
116 |
});
|
117 |
field.hide();
|
@@ -359,7 +390,7 @@ jQuery(document).ready(function($){
|
|
359 |
|
360 |
})
|
361 |
|
362 |
-
|
363 |
$(".wcml_fade").show();
|
364 |
$(this).parent().find('.wcml_editor').show();
|
365 |
$(this).parent().find('.wcml_editor table.mceLayout').css('height','auto');
|
@@ -373,35 +404,65 @@ jQuery(document).ready(function($){
|
|
373 |
});
|
374 |
$(this).parent().find('.wcml_original_content').cleditor()[0].disable(true);
|
375 |
|
376 |
-
$(document).on('click','.cleditorButton',function(){
|
377 |
-
if($(this).closest('.cleditorMain').find('textarea').is(':visible')){
|
378 |
-
$(this).closest('.cleditorMain').find('textarea').hide();
|
379 |
-
$(this).closest('.cleditorMain').find('iframe').show();
|
380 |
-
}else{
|
381 |
-
$(this).closest('.cleditorMain').find('textarea').show();
|
382 |
-
$(this).closest('.cleditorMain').find('iframe').hide();
|
383 |
-
}
|
384 |
-
});
|
385 |
-
});
|
386 |
|
387 |
-
|
388 |
-
$(
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
$(this).closest('.wcml_editor').css('display','none');
|
395 |
$(this).closest('.wcml_editor').find('.wcml_editor_translation textarea').val($(this).closest('.wcml_editor').find('.wcml_editor_translation textarea').data('def'));
|
396 |
});
|
397 |
|
398 |
-
$(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
399 |
$(".wcml_fade").hide();
|
400 |
$(this).closest('.wcml_editor').css('display','none');
|
401 |
});
|
402 |
|
403 |
|
404 |
-
$(
|
405 |
var text_area = $(this).closest('.wcml_editor').find('.wcml_editor_translation textarea');
|
406 |
$(".wcml_fade").hide();
|
407 |
|
@@ -428,6 +489,7 @@ jQuery(document).ready(function($){
|
|
428 |
|
429 |
});
|
430 |
|
|
|
431 |
//wc 2.0.*
|
432 |
if($('.wcml_file_paths').size()>0){
|
433 |
// Uploading files
|
@@ -1153,6 +1215,7 @@ jQuery(document).ready(function($){
|
|
1153 |
$('input[name="general_options"]').attr('disabled','disabled');
|
1154 |
var lang = elem.data('language');
|
1155 |
var code = elem.data('currency');
|
|
|
1156 |
$.ajax({
|
1157 |
type: 'post',
|
1158 |
url: ajaxurl,
|
@@ -1170,6 +1233,7 @@ jQuery(document).ready(function($){
|
|
1170 |
},
|
1171 |
complete: function() {
|
1172 |
$('input[name="general_options"]').removeAttr('disabled');
|
|
|
1173 |
}
|
1174 |
});
|
1175 |
}
|
@@ -1179,6 +1243,7 @@ jQuery(document).ready(function($){
|
|
1179 |
});
|
1180 |
|
1181 |
function update_default_currency(lang,code){
|
|
|
1182 |
$.ajax({
|
1183 |
type: 'post',
|
1184 |
url: ajaxurl,
|
@@ -1188,7 +1253,8 @@ jQuery(document).ready(function($){
|
|
1188 |
code: code,
|
1189 |
wcml_nonce: $('#wcml_update_default_currency_nonce').val()
|
1190 |
},
|
1191 |
-
|
|
|
1192 |
}
|
1193 |
});
|
1194 |
}
|
55 |
|
56 |
$('.wcml_details').click(function(e){
|
57 |
e.preventDefault();
|
58 |
+
var element = $(this),
|
59 |
+
textClosed = element.data('text-closed'),
|
60 |
+
textOpened = element.data('text-opened'),
|
61 |
+
$table = $(element.attr('href')),
|
62 |
+
parent = element.closest('tr');
|
63 |
|
64 |
if ( $table.is(':visible') ){
|
65 |
$table.find('input').each(function(){
|
66 |
+
element.val(element.data('def'));
|
67 |
});
|
68 |
$table.closest('.outer').hide();
|
69 |
+
element.text(textClosed);
|
70 |
+
}else {
|
71 |
+
if($table.size() > 0){
|
72 |
+
//set def data
|
73 |
+
$table.find('input').each(function(){
|
74 |
+
element.data('def',element.val());
|
75 |
+
});
|
76 |
+
$table.closest('.outer').show();
|
77 |
+
element.text(textOpened);
|
78 |
+
}else{
|
79 |
+
//load product data
|
80 |
+
var id = $(this).attr('href').replace(/#prid_/, '');
|
81 |
+
element.parent().find('.spinner').show();
|
82 |
+
$.ajax({
|
83 |
+
type : "post",
|
84 |
+
url : ajaxurl,
|
85 |
+
dataType: 'json',
|
86 |
+
data : {
|
87 |
+
action: "wcml_product_data",
|
88 |
+
product_id : id,
|
89 |
+
wcml_nonce: $('#get_product_data_nonce').val()
|
90 |
+
},
|
91 |
+
success: function(response) {
|
92 |
+
if(typeof response.error !== "undefined"){
|
93 |
+
alert(response.error);
|
94 |
+
}else{
|
95 |
+
//update status block
|
96 |
+
$(response.html).insertAfter(parent).css('display','inline-block');
|
97 |
+
|
98 |
+
//set def data
|
99 |
+
$table.find('input').each(function(){
|
100 |
+
element.data('def',element.val());
|
101 |
+
});
|
102 |
+
element.text(textOpened);
|
103 |
+
element.parent().find('.spinner').hide();
|
104 |
+
}
|
105 |
+
}
|
106 |
+
});
|
107 |
+
}
|
108 |
+
|
109 |
}
|
110 |
return false;
|
111 |
});
|
112 |
|
113 |
+
$(document).on('click', 'button[name="cancel"]', function(){
|
114 |
var $outer = $(this).closest('.outer');
|
115 |
|
116 |
$outer.find('input').each(function(){
|
123 |
$closeButton.text( $closeButton.data('text-closed') );
|
124 |
});
|
125 |
|
|
|
|
|
|
|
|
|
126 |
$(this).parent().find('input').each(function(){
|
127 |
$(this).val($(this).data('def'));
|
128 |
});
|
129 |
$(this).closest('.outer').slideUp('3000');
|
130 |
+
|
131 |
});
|
132 |
+
|
133 |
+
$(document).on('click','.wcml_update', function() {
|
134 |
var field = $(this);
|
135 |
|
136 |
var spl = $(this).attr('name').split('#');
|
139 |
var language = spl[2];
|
140 |
|
141 |
var records = '';
|
142 |
+
field.closest('tr').find("input").each(function(){
|
143 |
records += $(this).serialize()+"&";
|
144 |
});
|
145 |
+
field.closest('tr').find("textarea").each(function(){
|
146 |
records += $(this).serialize()+"&";
|
147 |
});
|
148 |
field.hide();
|
390 |
|
391 |
})
|
392 |
|
393 |
+
$(document).on('click','.wcml_edit_conten',function(){
|
394 |
$(".wcml_fade").show();
|
395 |
$(this).parent().find('.wcml_editor').show();
|
396 |
$(this).parent().find('.wcml_editor table.mceLayout').css('height','auto');
|
404 |
});
|
405 |
$(this).parent().find('.wcml_original_content').cleditor()[0].disable(true);
|
406 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
|
408 |
+
var id = $(this).parent().find('.switch-tmce').attr('id').replace(/-tmce/, '');
|
409 |
+
$(this).parent().find('.wp-editor-wrap').removeClass('html-active').addClass('tmce-active');
|
410 |
+
|
411 |
+
if( window.parent.tinyMCE.get(id) == null ){
|
412 |
+
tinymce.execCommand( 'mceAddEditor', false, id);
|
413 |
}
|
414 |
+
|
415 |
+
});
|
416 |
+
|
417 |
+
$(document).on('click','.cleditorButton',function(){
|
418 |
+
if($(this).closest('.cleditorMain').find('textarea').is(':visible')){
|
419 |
+
$(this).closest('.cleditorMain').find('textarea').hide();
|
420 |
+
$(this).closest('.cleditorMain').find('iframe').show();
|
421 |
+
}else{
|
422 |
+
$(this).closest('.cleditorMain').find('textarea').show();
|
423 |
+
$(this).closest('.cleditorMain').find('iframe').hide();
|
424 |
}
|
425 |
+
});
|
426 |
+
|
427 |
+
$(document).on('click','.wcml_close_cross,.wcml_popup_cancel',function(){
|
428 |
+
$(".wcml_fade").hide();
|
429 |
+
// if(tinyMCE.activeEditor != null){
|
430 |
+
// if($(this).closest('.wcml_editor').find('textarea.wcml_content_tr').size() >0){
|
431 |
+
// tinyMCE.activeEditor.setContent($(this).closest('.wcml_editor').find('.wcml_editor_translation textarea').data('def'));
|
432 |
+
// }
|
433 |
+
// }
|
434 |
$(this).closest('.wcml_editor').css('display','none');
|
435 |
$(this).closest('.wcml_editor').find('.wcml_editor_translation textarea').val($(this).closest('.wcml_editor').find('.wcml_editor_translation textarea').data('def'));
|
436 |
});
|
437 |
|
438 |
+
$(document).on('click','.switch-tmce',function(){
|
439 |
+
var id = $(this).attr('id').replace(/-tmce/, '');
|
440 |
+
$(this).closest('.wp-editor-wrap').removeClass('html-active').addClass('tmce-active');
|
441 |
+
$(this).closest('.wp-editor-wrap').find('textarea.wcml_content_tr').hide();
|
442 |
+
if( window.parent.tinyMCE.get(id) == null ){
|
443 |
+
tinymce.execCommand( 'mceAddEditor', false, id);
|
444 |
+
}else{
|
445 |
+
$(this).closest('.wp-editor-wrap').find('.mce-tinymce').show();
|
446 |
+
}
|
447 |
+
});
|
448 |
+
|
449 |
+
$(document).on('click','.switch-html',function(){
|
450 |
+
var id = $(this).attr('id').replace(/-html/, '');
|
451 |
+
$(this).closest('.wp-editor-wrap').removeClass('tmce-active').addClass('html-active');
|
452 |
+
$('#qt_'+id+'_toolbar').remove();
|
453 |
+
QTags(id);
|
454 |
+
QTags._buttonsInit();
|
455 |
+
$(this).closest('.wp-editor-wrap').find('.mce-tinymce').hide();
|
456 |
+
$(this).closest('.wp-editor-wrap').find('textarea.wcml_content_tr').show();
|
457 |
+
});
|
458 |
+
|
459 |
+
$(document).on('click','.wcml_popup_close',function(){
|
460 |
$(".wcml_fade").hide();
|
461 |
$(this).closest('.wcml_editor').css('display','none');
|
462 |
});
|
463 |
|
464 |
|
465 |
+
$(document).on('click','.wcml_popup_ok',function(){
|
466 |
var text_area = $(this).closest('.wcml_editor').find('.wcml_editor_translation textarea');
|
467 |
$(".wcml_fade").hide();
|
468 |
|
489 |
|
490 |
});
|
491 |
|
492 |
+
|
493 |
//wc 2.0.*
|
494 |
if($('.wcml_file_paths').size()>0){
|
495 |
// Uploading files
|
1215 |
$('input[name="general_options"]').attr('disabled','disabled');
|
1216 |
var lang = elem.data('language');
|
1217 |
var code = elem.data('currency');
|
1218 |
+
discard = true;
|
1219 |
$.ajax({
|
1220 |
type: 'post',
|
1221 |
url: ajaxurl,
|
1233 |
},
|
1234 |
complete: function() {
|
1235 |
$('input[name="general_options"]').removeAttr('disabled');
|
1236 |
+
discard = false;
|
1237 |
}
|
1238 |
});
|
1239 |
}
|
1243 |
});
|
1244 |
|
1245 |
function update_default_currency(lang,code){
|
1246 |
+
discard = true;
|
1247 |
$.ajax({
|
1248 |
type: 'post',
|
1249 |
url: ajaxurl,
|
1253 |
code: code,
|
1254 |
wcml_nonce: $('#wcml_update_default_currency_nonce').val()
|
1255 |
},
|
1256 |
+
complete: function(){
|
1257 |
+
discard = false;
|
1258 |
}
|
1259 |
});
|
1260 |
}
|
assets/js/wpml_tm.js
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function($){
|
2 |
+
var slug_checkbox = $('input[name="translate_slugs[product][on]"]');
|
3 |
+
$('#icl_custom_posts_sync_options table').before( slug_checkbox.clone().attr('type','hidden') );
|
4 |
+
|
5 |
+
slug_checkbox.attr('name','disabled');
|
6 |
+
slug_checkbox.attr('disabled','disabled');
|
7 |
+
});
|
8 |
+
|
compatibility/gravityforms.class.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WCML_gravityforms{
|
4 |
+
|
5 |
+
function __construct(){
|
6 |
+
add_filter('gform_formatted_money',array($this,'wcml_convert_price'),10,2);
|
7 |
+
add_filter('wcml_multi_currency_is_ajax',array($this,'add_ajax_action'));
|
8 |
+
}
|
9 |
+
|
10 |
+
function wcml_convert_price($formatted, $unformatted){
|
11 |
+
if ( ! is_admin() ) {
|
12 |
+
$currency = apply_filters('wcml_price_currency', get_woocommerce_currency());
|
13 |
+
$formatted = strip_tags(woocommerce_price(apply_filters('wcml_raw_price_amount', $unformatted), array('currency'=>$currency)));
|
14 |
+
}
|
15 |
+
return $formatted;
|
16 |
+
}
|
17 |
+
|
18 |
+
|
19 |
+
function add_ajax_action($actions){
|
20 |
+
$actions[] = 'get_updated_price';
|
21 |
+
return $actions;
|
22 |
+
}
|
23 |
+
|
24 |
+
}
|
compatibility/wc_product_addons.class.php
CHANGED
@@ -4,10 +4,10 @@ class WCML_Product_Addons{
|
|
4 |
|
5 |
function __construct(){
|
6 |
|
7 |
-
add_filter('
|
8 |
-
add_filter('
|
9 |
-
|
10 |
-
add_action('
|
11 |
|
12 |
global $pagenow;
|
13 |
if($pagenow == 'edit.php' && isset($_GET['post_type']) && $_GET['post_type']=='product' && isset($_GET['page']) && $_GET['page']=='global_addons' && !isset($_GET['edit'])){
|
@@ -17,7 +17,10 @@ class WCML_Product_Addons{
|
|
17 |
add_action( 'addons_panel_start', array( $this, 'inf_translate_strings' ) );
|
18 |
}
|
19 |
|
20 |
-
function register_addons_strings($id
|
|
|
|
|
|
|
21 |
foreach($addons as $addon){
|
22 |
//register name
|
23 |
icl_register_string('wc_product_addons_strings', $id.'_addon_'.$addon['type'].'_'.$addon['position'].'_name', $addon['name']);
|
@@ -31,6 +34,12 @@ class WCML_Product_Addons{
|
|
31 |
}
|
32 |
|
33 |
function product_addons_filter($addons, $object_id){
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
foreach($addons as $add_id => $addon){
|
35 |
$addons[$add_id]['name'] = icl_t('wc_product_addons_strings', $object_id.'_addon_'.$addon['type'].'_'.$addon['position'].'_name', $addon['name']);
|
36 |
$addons[$add_id]['description'] = icl_t('wc_product_addons_strings', $object_id.'_addon_'.$addon['type'].'_'.$addon['position'].'_description', $addon['description']);
|
4 |
|
5 |
function __construct(){
|
6 |
|
7 |
+
add_filter('get_product_addons_product_terms',array($this,'addons_product_terms'));
|
8 |
+
add_filter('get_product_addons_fields',array($this,'product_addons_filter'),10,2);
|
9 |
+
|
10 |
+
add_action('updated_post_meta',array($this,'register_addons_strings'),10,4);
|
11 |
|
12 |
global $pagenow;
|
13 |
if($pagenow == 'edit.php' && isset($_GET['post_type']) && $_GET['post_type']=='product' && isset($_GET['page']) && $_GET['page']=='global_addons' && !isset($_GET['edit'])){
|
17 |
add_action( 'addons_panel_start', array( $this, 'inf_translate_strings' ) );
|
18 |
}
|
19 |
|
20 |
+
function register_addons_strings( $meta_id, $id, $meta_key, $addons){
|
21 |
+
if( $meta_key != '_product_addons' )
|
22 |
+
return false;
|
23 |
+
|
24 |
foreach($addons as $addon){
|
25 |
//register name
|
26 |
icl_register_string('wc_product_addons_strings', $id.'_addon_'.$addon['type'].'_'.$addon['position'].'_name', $addon['name']);
|
34 |
}
|
35 |
|
36 |
function product_addons_filter($addons, $object_id){
|
37 |
+
global $sitepress;
|
38 |
+
|
39 |
+
$addon_type = get_post_type($object_id);
|
40 |
+
if( $addon_type != 'global_product_addon' )
|
41 |
+
$object_id = $sitepress->get_original_element_id( $object_id , 'post_'.$addon_type );
|
42 |
+
|
43 |
foreach($addons as $add_id => $addon){
|
44 |
$addons[$add_id]['name'] = icl_t('wc_product_addons_strings', $object_id.'_addon_'.$addon['type'].'_'.$addon['position'].'_name', $addon['name']);
|
45 |
$addons[$add_id]['description'] = icl_t('wc_product_addons_strings', $object_id.'_addon_'.$addon['type'].'_'.$addon['position'].'_description', $addon['description']);
|
compatibility/wc_product_bundles.class.php
CHANGED
@@ -3,167 +3,199 @@
|
|
3 |
class WCML_Product_Bundles{
|
4 |
|
5 |
function __construct(){
|
6 |
-
add_action('init', array($this, 'init'),
|
7 |
-
|
8 |
|
|
|
|
|
|
|
9 |
add_action('wcml_after_duplicate_product_post_meta',array($this,'sync_bundled_ids'),10,3);
|
10 |
add_action('wcml_extra_titles',array($this,'product_bundles_title'),10,1);
|
11 |
add_action('wcml_update_extra_fields',array($this,'bundle_update'),10,2);
|
12 |
-
|
13 |
add_filter('wcml_cart_contents', array($this, 'cart_bundle_update_lang_switch'), 10, 4);
|
14 |
add_filter('wcml_update_cart_contents_lang_switch', array($this, 'cart_contents_bundle_update_lang_switch'), 10, 4);
|
|
|
15 |
}
|
16 |
|
17 |
-
|
18 |
-
// Sync Bundled product meta with translated values
|
19 |
function sync_bundled_ids($original_product_id, $trnsl_product_id, $data = false){
|
20 |
global $sitepress, $wpdb;
|
21 |
-
|
22 |
$custom_fields = get_post_custom($original_product_id);
|
23 |
-
$atts = maybe_unserialize(get_post_meta($original_product_id, '
|
24 |
$lang = $sitepress->get_language_for_element($trnsl_product_id,'post_product');
|
25 |
$tr_ids = array();
|
26 |
|
27 |
-
foreach($atts as $
|
28 |
$tr_id = icl_object_id($id,'product',true,$lang);
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
if(is_array($allowed_variations)){
|
85 |
-
foreach($allowed_variations as $prod_id => $allowed_ids){
|
86 |
-
$trans_prod_id = icl_object_id($prod_id, 'product', false, $lang);
|
87 |
-
foreach($allowed_ids as $key => $var_id){
|
88 |
-
$trans_id = icl_object_id($var_id, 'product_variation', false, $lang);
|
89 |
-
$tr_allowed_variations[$trans_prod_id][] = $trans_id;
|
90 |
-
}
|
91 |
}
|
92 |
-
update_post_meta($trnsl_product_id,'_allowed_variations',$tr_allowed_variations);
|
93 |
-
}
|
94 |
-
|
95 |
-
|
96 |
|
97 |
-
|
98 |
-
$tr_bundle_defaults = array();
|
99 |
-
$bundle_defaults = maybe_unserialize(get_post_meta($original_product_id, '_bundle_defaults', true));
|
100 |
-
if(is_array($bundle_defaults)){
|
101 |
-
foreach($bundle_defaults as $prod_id => $allowed_ids){
|
102 |
-
$trans_prod_id = icl_object_id($prod_id, 'product', false, $lang);
|
103 |
-
$tr_bundle_defaults[$trans_prod_id]=array();
|
104 |
-
foreach($allowed_ids as $key => $var_id){
|
105 |
-
$trans_id = icl_object_id($var_id, 'product_variation', false, $lang);
|
106 |
-
$tr_bundle_defaults[$trans_prod_id][] = $trans_id;
|
107 |
-
}
|
108 |
-
}
|
109 |
-
update_post_meta($trnsl_product_id,'_bundle_defaults',$tr_bundle_defaults);
|
110 |
-
}
|
111 |
}
|
112 |
|
113 |
-
// Update
|
114 |
function bundle_update($tr_id, $data){
|
|
|
|
|
|
|
|
|
|
|
115 |
if(!empty($data['bundles'])){
|
116 |
foreach($data['bundles'] as $bundle_id => $bundle_data){
|
117 |
-
|
118 |
-
|
|
|
|
|
119 |
}
|
|
|
|
|
120 |
}
|
121 |
-
|
122 |
}
|
123 |
|
124 |
// Add 'Product Bundles' title to the WCML Product GUI if the current product is a bundled product
|
125 |
function product_bundles_title($product_id){
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
<?php }
|
130 |
}
|
131 |
|
132 |
// Add Bundles Box to WCML Translation GUI
|
133 |
function product_bundles_box($product_id,$lang, $is_duplicate_product = false ) {
|
134 |
global $sitepress;
|
|
|
|
|
|
|
|
|
135 |
$default_language = $sitepress->get_default_language();
|
|
|
|
|
136 |
if($default_language != $lang){
|
137 |
-
$
|
|
|
|
|
|
|
|
|
|
|
138 |
}
|
139 |
-
|
140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
if($default_language == $lang){
|
142 |
$template_data['original'] = true;
|
143 |
}else{
|
144 |
$template_data['original'] = false;
|
145 |
}
|
146 |
-
|
147 |
-
if (
|
148 |
-
|
149 |
-
$template_data['product_bundles'] =
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
$template_data['empty_bundles'] = true;
|
|
|
152 |
} else {
|
153 |
if ($default_language == $lang) {
|
154 |
-
$template_data['product_bundles'] = $
|
155 |
}
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
$bundles_texts = array();
|
160 |
$bundle_name = get_the_title($bundle_id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
$template_data['bundles_data'][$bundle_name]['bundle_title'] = $bundle_title;
|
162 |
$template_data['bundles_data'][$bundle_name]['bundle_desc'] = $bundle_desc;
|
163 |
}
|
|
|
164 |
}
|
165 |
-
} else {
|
166 |
-
$template_data['empty_translation'] = true;
|
167 |
}
|
168 |
include WCML_PLUGIN_PATH . '/compatibility/templates/bundles_box.php';
|
169 |
}
|
@@ -218,7 +250,6 @@ class WCML_Product_Bundles{
|
|
218 |
|
219 |
$cart_contents[$key]['stamp'] = $new_stamp;
|
220 |
}
|
221 |
-
|
222 |
return $cart_contents;
|
223 |
}
|
224 |
|
@@ -239,9 +270,14 @@ class WCML_Product_Bundles{
|
|
239 |
unset($new_cart_data[$new_key]);
|
240 |
$new_cart_data[$key_item] = $buff;
|
241 |
}
|
242 |
-
|
243 |
return $new_cart_data;
|
244 |
}
|
245 |
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
}
|
247 |
|
3 |
class WCML_Product_Bundles{
|
4 |
|
5 |
function __construct(){
|
6 |
+
add_action('init', array($this, 'init'),10);
|
7 |
+
}
|
8 |
|
9 |
+
function init(){
|
10 |
+
global $sitepress;
|
11 |
+
add_action('wcml_gui_additional_box',array($this,'product_bundles_box'),10,3);
|
12 |
add_action('wcml_after_duplicate_product_post_meta',array($this,'sync_bundled_ids'),10,3);
|
13 |
add_action('wcml_extra_titles',array($this,'product_bundles_title'),10,1);
|
14 |
add_action('wcml_update_extra_fields',array($this,'bundle_update'),10,2);
|
|
|
15 |
add_filter('wcml_cart_contents', array($this, 'cart_bundle_update_lang_switch'), 10, 4);
|
16 |
add_filter('wcml_update_cart_contents_lang_switch', array($this, 'cart_contents_bundle_update_lang_switch'), 10, 4);
|
17 |
+
add_filter('wcml_filter_cart_item_data', array($this, 'filter_cart_item_data') );
|
18 |
}
|
19 |
|
20 |
+
// Sync Bundled product '_bundle_data' with translated values when the product is duplicated
|
|
|
21 |
function sync_bundled_ids($original_product_id, $trnsl_product_id, $data = false){
|
22 |
global $sitepress, $wpdb;
|
|
|
23 |
$custom_fields = get_post_custom($original_product_id);
|
24 |
+
$atts = maybe_unserialize(get_post_meta($original_product_id, '_bundle_data', true));
|
25 |
$lang = $sitepress->get_language_for_element($trnsl_product_id,'post_product');
|
26 |
$tr_ids = array();
|
27 |
|
28 |
+
foreach($atts as $id=>$bundle_data){
|
29 |
$tr_id = icl_object_id($id,'product',true,$lang);
|
30 |
+
|
31 |
+
$tr_bundle[$tr_id] = $bundle_data;
|
32 |
+
|
33 |
+
$tr_bundle[$tr_id]['product_id'] = $tr_id;
|
34 |
+
|
35 |
+
if(isset($bundle_data['product_title'])){
|
36 |
+
if($bundle_data['override_title']=='yes'){
|
37 |
+
$tr_bundle[$tr_id]['product_title'] = '';
|
38 |
+
}else{
|
39 |
+
$tr_title= get_the_title($tr_id);
|
40 |
+
$tr_bundle[$tr_id]['product_title'] = $tr_title;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
if(isset($bundle_data['product_description'])){
|
45 |
+
if($bundle_data['override_description']=='yes'){
|
46 |
+
$tr_bundle[$tr_id]['product_description'] = '';
|
47 |
+
}else{
|
48 |
+
$tr_prod = get_post($tr_id);
|
49 |
+
$tr_desc = $tr_prod->post_excerpt;
|
50 |
+
$tr_bundle[$tr_id]['product_description'] = $tr_desc;
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
if(isset($bundle_data['filter_variations']) && $bundle_data['filter_variations']=='yes'){
|
55 |
+
$allowed_var = $bundle_data['allowed_variations'];
|
56 |
+
foreach($allowed_var as $key=>$var_id){
|
57 |
+
$tr_var_id = icl_object_id($var_id,'product_variation',true,$lang);
|
58 |
+
$tr_bundle[$tr_id]['allowed_variations'][$key] = $tr_var_id;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
if(isset($bundle_data['bundle_defaults']) && !empty($bundle_data['bundle_defaults'])){
|
63 |
+
foreach($bundle_data['bundle_defaults'] as $tax=>$term_slug){
|
64 |
+
$term = get_term_by('slug',$term_slug, $tax);
|
65 |
+
if($term!=false){
|
66 |
+
// Global Attribute
|
67 |
+
$tr_def_id = icl_object_id($term->term_id,$tax,true,$lang);
|
68 |
+
$tr_term = get_term( $tr_def_id, $tax );
|
69 |
+
$tr_bundle[$tr_id]['bundle_defaults'][$tax] = $tr_term->slug;
|
70 |
+
}else{
|
71 |
+
// Custom Attribute
|
72 |
+
$args = array( 'post_type' => 'product_variation', 'meta_key' => 'attribute_'.$tax, 'meta_value' => $term_slug, 'meta_compare' => '=');
|
73 |
+
$variationloop = new WP_Query( $args );
|
74 |
+
while ( $variationloop->have_posts() ) : $variationloop->the_post();
|
75 |
+
$tr_var_id = icl_object_id(get_the_ID(),'product_variation',true,$lang);
|
76 |
+
$tr_meta = get_post_meta($tr_var_id, 'attribute_'.$tax , true);
|
77 |
+
$tr_bundle[$tr_id]['bundle_defaults'][$tax] = $tr_meta;
|
78 |
+
endwhile;
|
79 |
+
}
|
80 |
+
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
}
|
|
|
|
|
|
|
|
|
86 |
|
87 |
+
update_post_meta($trnsl_product_id,'_bundle_data',$tr_bundle);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
}
|
89 |
|
90 |
+
// Update Bundled products title and descritpion after saving the translation
|
91 |
function bundle_update($tr_id, $data){
|
92 |
+
|
93 |
+
global $sitepress;
|
94 |
+
$tr_bundle_data = array();
|
95 |
+
$tr_bundle_data = maybe_unserialize(get_post_meta($tr_id,'_bundle_data', true));
|
96 |
+
|
97 |
if(!empty($data['bundles'])){
|
98 |
foreach($data['bundles'] as $bundle_id => $bundle_data){
|
99 |
+
if(isset($tr_bundle_data[$bundle_id])){
|
100 |
+
$tr_bundle_data[$bundle_id]['product_title'] = $bundle_data['bundle_title'];
|
101 |
+
$tr_bundle_data[$bundle_id]['product_description'] = $bundle_data['bundle_desc'];
|
102 |
+
}
|
103 |
}
|
104 |
+
update_post_meta( $tr_id, '_bundle_data', $tr_bundle_data );
|
105 |
+
$tr_bundle_data = array();
|
106 |
}
|
107 |
+
|
108 |
}
|
109 |
|
110 |
// Add 'Product Bundles' title to the WCML Product GUI if the current product is a bundled product
|
111 |
function product_bundles_title($product_id){
|
112 |
+
$bundle_data = maybe_unserialize(get_post_meta($product_id,'_bundle_data', true));
|
113 |
+
if(!empty($bundle_data) && $bundle_data!=false){ ?>
|
114 |
+
<th scope="col"><?php _e('Product Bundles', 'wcml_product_bundles'); ?></th>
|
115 |
+
<?php }
|
116 |
}
|
117 |
|
118 |
// Add Bundles Box to WCML Translation GUI
|
119 |
function product_bundles_box($product_id,$lang, $is_duplicate_product = false ) {
|
120 |
global $sitepress;
|
121 |
+
$isbundle = true;
|
122 |
+
$translated = true;
|
123 |
+
$template_data = array();
|
124 |
+
|
125 |
$default_language = $sitepress->get_default_language();
|
126 |
+
|
127 |
+
|
128 |
if($default_language != $lang){
|
129 |
+
$tr_product_id = icl_object_id($product_id, 'product', true, $lang);
|
130 |
+
if($tr_product_id == $product_id){
|
131 |
+
$translated = false;
|
132 |
+
}else{
|
133 |
+
$product_id = $tr_product_id;
|
134 |
+
}
|
135 |
}
|
136 |
+
|
137 |
+
$bundle_data = maybe_unserialize(get_post_meta($product_id,'_bundle_data', true));
|
138 |
+
|
139 |
+
if(empty($bundle_data) || $bundle_data==false){
|
140 |
+
$isbundle = false;
|
141 |
+
}
|
142 |
+
|
143 |
+
if(!$isbundle){
|
144 |
+
return;
|
145 |
+
}
|
146 |
+
|
147 |
if($default_language == $lang){
|
148 |
$template_data['original'] = true;
|
149 |
}else{
|
150 |
$template_data['original'] = false;
|
151 |
}
|
152 |
+
|
153 |
+
if (!$translated ) {
|
154 |
+
$template_data['empty_translation'] = true;
|
155 |
+
$template_data['product_bundles'] = array();
|
156 |
+
}else{
|
157 |
+
$product_bundles = array_keys($bundle_data);
|
158 |
+
$k = 0;
|
159 |
+
foreach($product_bundles as $original_id){
|
160 |
+
$tr_bundles_ids[$k] = icl_object_id($original_id,'product',false,$lang);
|
161 |
+
$k++;
|
162 |
+
}
|
163 |
+
|
164 |
+
$template_data['product_bundles'] = $tr_bundles_ids;
|
165 |
+
$tr_bundles_ids = $template_data['product_bundles'];
|
166 |
+
|
167 |
+
if (empty($tr_bundles_ids)) {
|
168 |
$template_data['empty_bundles'] = true;
|
169 |
+
$template_data['product_bundles'] = array();
|
170 |
} else {
|
171 |
if ($default_language == $lang) {
|
172 |
+
$template_data['product_bundles'] = $tr_bundles_ids;
|
173 |
}
|
174 |
+
|
175 |
+
foreach ($product_bundles as $bundle_id) {
|
176 |
+
$bundles_texts = array();
|
|
|
177 |
$bundle_name = get_the_title($bundle_id);
|
178 |
+
|
179 |
+
if(isset($bundle_data[$bundle_id]['override_title']) && $bundle_data[$bundle_id]['override_title']=='yes'){
|
180 |
+
$bundle_title = $bundle_data[$bundle_id]['product_title'];
|
181 |
+
$template_data['bundles_data'][$bundle_name]['override_bundle_title'] = 'yes';
|
182 |
+
}else{
|
183 |
+
$bundle_title = get_the_title($bundle_id);
|
184 |
+
}
|
185 |
+
|
186 |
+
if(isset($bundle_data[$bundle_id]['override_description']) && $bundle_data[$bundle_id]['override_description']=='yes'){
|
187 |
+
$bundle_desc = $bundle_data[$bundle_id]['product_description'];
|
188 |
+
$template_data['bundles_data'][$bundle_name]['override_bundle_desc'] = 'yes';
|
189 |
+
}else{
|
190 |
+
$bundle_prod = get_post($bundle_id);
|
191 |
+
$bundle_desc = $bundle_prod->post_excerpt;
|
192 |
+
}
|
193 |
+
|
194 |
$template_data['bundles_data'][$bundle_name]['bundle_title'] = $bundle_title;
|
195 |
$template_data['bundles_data'][$bundle_name]['bundle_desc'] = $bundle_desc;
|
196 |
}
|
197 |
+
|
198 |
}
|
|
|
|
|
199 |
}
|
200 |
include WCML_PLUGIN_PATH . '/compatibility/templates/bundles_box.php';
|
201 |
}
|
250 |
|
251 |
$cart_contents[$key]['stamp'] = $new_stamp;
|
252 |
}
|
|
|
253 |
return $cart_contents;
|
254 |
}
|
255 |
|
270 |
unset($new_cart_data[$new_key]);
|
271 |
$new_cart_data[$key_item] = $buff;
|
272 |
}
|
|
|
273 |
return $new_cart_data;
|
274 |
}
|
275 |
|
276 |
+
function filter_cart_item_data ( $cart_contents ){
|
277 |
+
unset( $cart_contents['bundled_items'] );
|
278 |
+
|
279 |
+
return $cart_contents;
|
280 |
+
}
|
281 |
+
|
282 |
}
|
283 |
|
compatibility/wc_sensei.class.php
ADDED
@@ -0,0 +1,217 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WCML_sensei{
|
4 |
+
|
5 |
+
function __construct(){
|
6 |
+
global $sitepress;
|
7 |
+
add_action( 'manage_edit-lesson_columns', array( $sitepress, 'add_posts_management_column' ) );
|
8 |
+
add_action( 'manage_edit-course_columns', array( $sitepress, 'add_posts_management_column' ) );
|
9 |
+
|
10 |
+
add_action( 'save_post', array( $this, 'save_post_actions' ), 100, 2 );
|
11 |
+
add_action( 'sensei_log_activity_after', array( $this, 'log_activity_after' ), 10, 3 );
|
12 |
+
add_filter( 'sensei_bought_product_id', array( $this, 'filter_bought_product_id' ), 10, 2 );
|
13 |
+
add_action( 'delete_comment', array( $this, 'delete_user_activity' ) );
|
14 |
+
|
15 |
+
add_action( 'pre_get_comments', array( $this, 'pre_get_comments') );
|
16 |
+
}
|
17 |
+
|
18 |
+
function save_post_actions( $post_id, $post ){
|
19 |
+
global $sitepress;
|
20 |
+
|
21 |
+
// skip not related post types
|
22 |
+
if ( !in_array( $post->post_type , array( 'lesson', 'course', 'quiz' ) ) ) {
|
23 |
+
return;
|
24 |
+
}
|
25 |
+
// skip auto-drafts
|
26 |
+
if ( $post->post_status == 'auto-draft' ) {
|
27 |
+
return;
|
28 |
+
}
|
29 |
+
// skip autosave
|
30 |
+
if ( isset( $_POST[ 'autosave' ] ) ) {
|
31 |
+
return;
|
32 |
+
}
|
33 |
+
|
34 |
+
if( $post->post_type == 'quiz' && isset( $_POST[ 'ID' ] ) ){
|
35 |
+
$this->save_post_actions( $_POST[ 'ID' ], get_post( $_POST[ 'ID' ] ) );
|
36 |
+
}
|
37 |
+
|
38 |
+
|
39 |
+
// sync fields from original
|
40 |
+
$trid = $sitepress->get_element_trid( $post_id, 'post_' . $post->post_type );
|
41 |
+
$translations = $sitepress->get_element_translations( $trid, 'post_' . $post->post_type );
|
42 |
+
|
43 |
+
if ( !empty( $translations ) ) {
|
44 |
+
$original_post_id = false;
|
45 |
+
foreach ( $translations as $t ) {
|
46 |
+
if ( $t->original ) {
|
47 |
+
$original_post_id = $t->element_id;
|
48 |
+
break;
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
if ( $post_id != $original_post_id ) {
|
53 |
+
$this->sync_custom_fields( $original_post_id, $post_id, $post->post_type );
|
54 |
+
} else {
|
55 |
+
foreach ( $translations as $t ) {
|
56 |
+
if ( $original_post_id != $t->element_id ) {
|
57 |
+
$this->sync_custom_fields( $original_post_id, $t->element_id, $post->post_type );
|
58 |
+
}
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
function sync_custom_fields ( $original_post_id, $post_id, $post_type ){
|
67 |
+
global $sitepress;
|
68 |
+
|
69 |
+
$language = $sitepress->get_language_for_element( $post_id, 'post_'.$post_type );
|
70 |
+
if( $post_type == 'quiz' ){
|
71 |
+
|
72 |
+
//sync quiz lesson
|
73 |
+
$lesson_id = get_post_meta( $original_post_id, '_quiz_lesson', true );
|
74 |
+
|
75 |
+
if( $lesson_id ){
|
76 |
+
$tr_lesson_id = icl_object_id( $lesson_id, 'post_lesson', false, $language );
|
77 |
+
|
78 |
+
if( !is_null( $tr_lesson_id ) ){
|
79 |
+
update_post_meta( $post_id, '_quiz_lesson', $tr_lesson_id );
|
80 |
+
}
|
81 |
+
}else{
|
82 |
+
delete_post_meta( $post_id, '_quiz_lesson' );
|
83 |
+
}
|
84 |
+
|
85 |
+
} elseif( $post_type == 'lesson' ){
|
86 |
+
//sync lesson course
|
87 |
+
$course_id = get_post_meta( $original_post_id, '_lesson_course', true );
|
88 |
+
|
89 |
+
if( $course_id ){
|
90 |
+
$tr_course_id = icl_object_id( $course_id, 'post_course', false, $language );
|
91 |
+
|
92 |
+
if( !is_null( $tr_course_id ) ){
|
93 |
+
update_post_meta( $post_id, '_lesson_course', $tr_course_id );
|
94 |
+
}
|
95 |
+
}else{
|
96 |
+
delete_post_meta( $post_id, '_lesson_course' );
|
97 |
+
}
|
98 |
+
|
99 |
+
//sync lesson prerequisite
|
100 |
+
$lesson_id = get_post_meta( $original_post_id, '_lesson_prerequisite', true );
|
101 |
+
|
102 |
+
if( $lesson_id ){
|
103 |
+
$tr_lesson_id = icl_object_id( $lesson_id, 'post_lesson', false, $language );
|
104 |
+
|
105 |
+
if( !is_null( $tr_lesson_id ) ){
|
106 |
+
update_post_meta( $post_id, '_lesson_prerequisite', $tr_lesson_id );
|
107 |
+
}
|
108 |
+
}else{
|
109 |
+
delete_post_meta( $post_id, '_lesson_prerequisite' );
|
110 |
+
}
|
111 |
+
|
112 |
+
}else{
|
113 |
+
//sync course woocommerce_product
|
114 |
+
$product_id = get_post_meta( $original_post_id, '_course_woocommerce_product', true );
|
115 |
+
|
116 |
+
if( $product_id ){
|
117 |
+
$tr_product_id = icl_object_id( $product_id, 'post_product', false, $language );
|
118 |
+
|
119 |
+
if( !is_null( $tr_product_id ) ){
|
120 |
+
update_post_meta( $post_id, '_course_woocommerce_product', $tr_product_id );
|
121 |
+
}
|
122 |
+
}else{
|
123 |
+
delete_post_meta( $post_id, '_course_woocommerce_product' );
|
124 |
+
}
|
125 |
+
|
126 |
+
//sync course prerequisite
|
127 |
+
$course_id = get_post_meta( $original_post_id, '_course_prerequisite', true );
|
128 |
+
|
129 |
+
if( $course_id ){
|
130 |
+
$tr_course_id = icl_object_id( $course_id, 'post_course', false, $language );
|
131 |
+
|
132 |
+
if( !is_null( $tr_course_id ) ){
|
133 |
+
update_post_meta( $post_id, '_course_prerequisite', $tr_course_id );
|
134 |
+
}
|
135 |
+
}else{
|
136 |
+
delete_post_meta( $post_id, '_course_prerequisite' );
|
137 |
+
}
|
138 |
+
|
139 |
+
}
|
140 |
+
|
141 |
+
}
|
142 |
+
|
143 |
+
function log_activity_after ( $args, $data, $comment_id ){
|
144 |
+
global $sitepress;
|
145 |
+
|
146 |
+
$comment_post_id = $data['comment_post_ID'];
|
147 |
+
$trid = $sitepress->get_element_trid( $comment_post_id, 'post_'.get_post_type( $comment_post_id ) );
|
148 |
+
$translations = $sitepress->get_element_translations( $trid, 'post_'.get_post_type( $comment_post_id ) );
|
149 |
+
|
150 |
+
foreach($translations as $translation){
|
151 |
+
|
152 |
+
if( $comment_post_id != $translation->element_id ){
|
153 |
+
$data['comment_post_ID'] = $translation->element_id;
|
154 |
+
|
155 |
+
$trid = $sitepress->get_element_trid( $comment_id, 'comment' );
|
156 |
+
|
157 |
+
$tr_comment_id = icl_object_id( $comment_id, 'comment', false, $translation->language_code );
|
158 |
+
if ( isset( $args['action'] ) && 'update' == $args['action'] && !is_null( $tr_comment_id ) && get_comment( $tr_comment_id ) ) {
|
159 |
+
$data['comment_ID'] = $tr_comment_id;
|
160 |
+
$tr_comment_id = wp_update_comment( $data );
|
161 |
+
}else{
|
162 |
+
$tr_comment_id = wp_insert_comment( $data );
|
163 |
+
$sitepress->set_element_language_details( $tr_comment_id, 'comment', $trid, $translation->language_code );
|
164 |
+
}
|
165 |
+
}
|
166 |
+
|
167 |
+
}
|
168 |
+
|
169 |
+
}
|
170 |
+
|
171 |
+
function filter_bought_product_id( $product_id, $order ){
|
172 |
+
|
173 |
+
$order_language = get_post_meta( $order->id, 'wpml_language', true );
|
174 |
+
|
175 |
+
$tr_product_id = icl_object_id( $product_id, 'post_'.get_post_type( $product_id ), false, $order_language );
|
176 |
+
|
177 |
+
if( !is_null( $tr_product_id ) ){
|
178 |
+
return $tr_product_id;
|
179 |
+
}else{
|
180 |
+
return $product_id;
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
function delete_user_activity ( $comment_id ){
|
185 |
+
global $sitepress;
|
186 |
+
|
187 |
+
$comment_type = get_comment_type( $comment_id );
|
188 |
+
|
189 |
+
if( strstr( $comment_type, "sensei" ) ){
|
190 |
+
|
191 |
+
$trid = $sitepress->get_element_trid( $comment_id, 'comment' );
|
192 |
+
$translations = $sitepress->get_element_translations( $trid, 'comment' );
|
193 |
+
|
194 |
+
remove_action( 'delete_comment', array ( $this, 'delete_user_activity' ) );
|
195 |
+
foreach ( $translations as $translation ){
|
196 |
+
if( $comment_id != $translation->element_id ){
|
197 |
+
wp_delete_comment( $translation->element_id, true );
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
}
|
202 |
+
|
203 |
+
|
204 |
+
}
|
205 |
+
|
206 |
+
function pre_get_comments($obj){
|
207 |
+
global $sitepress;
|
208 |
+
|
209 |
+
if( $obj->query_vars[ 'type' ] == 'sensei_course_start' ){
|
210 |
+
|
211 |
+
remove_filter( 'comments_clauses', array( $sitepress, 'comments_clauses' ), 10, 2 );
|
212 |
+
|
213 |
+
}
|
214 |
+
|
215 |
+
}
|
216 |
+
|
217 |
+
}
|
compatibility/wc_tab_manager.class.php
CHANGED
@@ -3,141 +3,179 @@
|
|
3 |
class WCML_Tab_Manager{
|
4 |
|
5 |
function __construct(){
|
6 |
-
add_action('wcml_after_duplicate_product_post_meta',array($this,'sync_tabs'),10,3);
|
7 |
-
add_filter('wcml_product_content_exception',array($this,'is_have_custom_product_tab'),10,2);
|
8 |
-
add_filter('wcml_custom_box_html',array($this,'custom_box_html'),10,3);
|
|
|
9 |
}
|
10 |
|
11 |
-
function sync_tabs($original_product_id, $trnsl_product_id, $data = false){
|
12 |
-
global $wc_tab_manager
|
13 |
|
14 |
-
$lang = $sitepress->get_language_for_element($trnsl_product_id,'post_product');
|
15 |
-
|
16 |
-
|
|
|
|
|
17 |
}
|
18 |
|
19 |
-
$
|
|
|
|
|
20 |
|
|
|
21 |
|
22 |
-
if($orig_prod_tabs){
|
23 |
$trnsl_product_tabs = array();
|
24 |
$i = 0;
|
25 |
-
foreach($orig_prod_tabs as $key
|
26 |
-
|
27 |
-
if($prod_tab_id == $orig_prod_tab['id']){
|
28 |
-
$tab_position_id = $tab_key;
|
29 |
-
}
|
30 |
-
}
|
31 |
-
switch($orig_prod_tab['type']){
|
32 |
case 'core':
|
33 |
$default_language = $sitepress->get_default_language();
|
34 |
$current_language = $sitepress->get_current_language();
|
35 |
-
$trnsl_product_tabs[$key] = $orig_prod_tabs[$key];
|
36 |
-
if(isset($data['_product_tabs_'.$lang])){
|
37 |
-
$title = $data['_product_tabs_'.$lang]['core_title'][$orig_prod_tab['id']];
|
38 |
-
$heading = $data['_product_tabs_'.$lang]['core_heading'][$orig_prod_tab['id']];
|
39 |
-
}else if(isset($_POST['product_tab_title'][$tab_position_id])){
|
40 |
-
$title = $_POST['product_tab_title'][$tab_position_id];
|
41 |
-
}else if(isset($_POST['product_tab_heading'][$tab_position_id])){
|
42 |
-
$heading = $_POST['product_tab_heading'][$tab_position_id];
|
43 |
}
|
44 |
|
45 |
-
if($default_language != $lang){
|
46 |
-
|
47 |
-
|
48 |
-
$woocommerce->load_plugin_textdomain();
|
49 |
-
if(!$title) $title = $orig_prod_tabs[$key]['title'];
|
50 |
$title = __( $title, 'woocommerce' );
|
51 |
-
if(
|
|
|
|
|
|
|
|
|
52 |
$heading = __( $heading, 'woocommerce' );
|
53 |
-
|
54 |
-
$sitepress->switch_lang($current_language);
|
55 |
-
$woocommerce->load_plugin_textdomain();
|
56 |
}
|
57 |
|
58 |
-
$trnsl_product_tabs[$key]['title'] = $title;
|
59 |
-
$trnsl_product_tabs[$key]['heading'] = $heading;
|
60 |
break;
|
61 |
case 'global':
|
62 |
-
$
|
63 |
-
$trnsl_product_tabs[$orig_prod_tab['type'].'_tab_'.$tr_tab_id] = array(
|
64 |
-
'position' => $orig_prod_tab['position'],
|
65 |
-
'type' => $orig_prod_tab['type'],
|
66 |
-
'id' => $tr_tab_id,
|
67 |
-
'name' => get_post($tr_tab_id)->post_name
|
68 |
-
);
|
69 |
break;
|
70 |
case 'product':
|
71 |
-
|
72 |
-
$tr_tab_id = icl_object_id($orig_prod_tab['id'],'wc_product_tab',false,$lang);
|
73 |
$tab_id = false;
|
74 |
-
if(
|
75 |
-
$
|
76 |
-
|
77 |
-
if(isset($data['_product_tabs_'.$lang]['id'][$i])){
|
78 |
-
if(get_post_type($data['_product_tabs_'.$lang]['id'][$i]) == 'wc_product_tab'){
|
79 |
-
$tab_id = $data['_product_tabs_'.$lang]['id'][$i];
|
80 |
-
}
|
81 |
-
$title = $data['_product_tabs_'.$lang]['title'][$i];
|
82 |
-
$content = $data['_product_tabs_'.$lang]['content'][$i];
|
83 |
-
}else{
|
84 |
-
// if($_POST['product_tab_id'][$orig_prod_tab['position']]){
|
85 |
-
// $tab_id = $_POST['product_tab_id'][$orig_prod_tab['position']];
|
86 |
-
// }
|
87 |
-
|
88 |
-
if(isset($_POST['product_tab_title'][$tab_position_id])){
|
89 |
-
$title = $_POST['product_tab_title'][$tab_position_id];
|
90 |
-
}else{
|
91 |
-
$title = '';
|
92 |
-
}
|
93 |
-
|
94 |
-
if(isset($_POST['product_tab_content'][$tab_position_id])){
|
95 |
-
$content = $_POST['product_tab_content'][$tab_position_id];
|
96 |
-
}else{
|
97 |
-
$content = '';
|
98 |
}
|
|
|
|
|
99 |
}
|
100 |
|
101 |
-
|
102 |
-
//update existing tab
|
103 |
-
$args = array();
|
104 |
-
$args['post_title'] = $title;
|
105 |
-
$args['post_content'] = $content;
|
106 |
-
$wpdb->update( $wpdb->posts, $args, array( 'ID' => $tab_id ) );
|
107 |
-
}else{
|
108 |
-
//tab not exist creating new
|
109 |
-
$args = array();
|
110 |
-
$args['post_title'] = $title;
|
111 |
-
$args['post_content'] = $content;
|
112 |
-
$args['post_author'] = get_current_user_id();
|
113 |
-
$args['post_name'] = sanitize_title($title);
|
114 |
-
$args['post_type'] = 'wc_product_tab';
|
115 |
-
$args['post_parent'] = $trnsl_product_id;
|
116 |
-
$args['post_status'] = 'publish';
|
117 |
-
$wpdb->insert( $wpdb->posts, $args );
|
118 |
-
|
119 |
-
$tab_id = $wpdb->insert_id;
|
120 |
-
$tab_trid = $sitepress->get_element_trid($orig_prod_tab['id'], 'post_wc_product_tab');
|
121 |
-
if(!$tab_trid){
|
122 |
-
$sitepress->set_element_language_details($orig_prod_tab['id'], 'post_wc_product_tab', false,$sitepress->get_default_language());
|
123 |
-
$tab_trid = $sitepress->get_element_trid($orig_prod_tab['id'], 'post_wc_product_tab');
|
124 |
-
}
|
125 |
-
$sitepress->set_element_language_details($tab_id, 'post_wc_product_tab', $tab_trid, $lang);
|
126 |
-
}
|
127 |
|
128 |
-
$trnsl_product_tabs[$orig_prod_tab['type'].'_tab_'.$tab_id] = array(
|
129 |
-
'position' => $orig_prod_tab['position'],
|
130 |
-
'type' => $orig_prod_tab['type'],
|
131 |
-
'id' => $tab_id,
|
132 |
-
'name' => get_post($tab_id)->post_name
|
133 |
-
);
|
134 |
$i++;
|
135 |
break;
|
136 |
}
|
137 |
}
|
|
|
|
|
|
|
138 |
|
139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
}
|
142 |
|
143 |
function is_have_custom_product_tab($exception,$product_id){
|
@@ -157,7 +195,7 @@ class WCML_Tab_Manager{
|
|
157 |
if($template_data['product_content'] == '_product_tabs'){
|
158 |
global $wc_tab_manager;
|
159 |
$orig_prod_tabs = $wc_tab_manager->get_product_tabs($template_data['product_id']);
|
160 |
-
|
161 |
if($template_data['tr_product_id']){
|
162 |
$tr_prod_tabs = $wc_tab_manager->get_product_tabs($template_data['tr_product_id']);
|
163 |
|
@@ -171,7 +209,7 @@ class WCML_Tab_Manager{
|
|
171 |
$template_data['tr_tabs'][$prod_tab['id']]['id'] = $prod_tab['id'];
|
172 |
$template_data['tr_tabs'][$prod_tab['id']]['type'] = $prod_tab['type'];
|
173 |
$template_data['tr_tabs'][$prod_tab['id']]['title'] = $prod_tab['title'];
|
174 |
-
$template_data['tr_tabs'][$prod_tab['id']]['heading'] = $prod_tab['heading'];
|
175 |
}else{
|
176 |
$template_data['tr_tabs'][$prod_tab['position']]['id'] = $prod_tab['id'];
|
177 |
$template_data['tr_tabs'][$prod_tab['position']]['type'] = $prod_tab['type'];
|
@@ -192,10 +230,15 @@ class WCML_Tab_Manager{
|
|
192 |
|
193 |
}
|
194 |
|
195 |
-
|
196 |
-
|
197 |
-
|
|
|
|
|
|
|
|
|
198 |
}
|
|
|
199 |
unload_textdomain('woocommerce');
|
200 |
$sitepress->switch_lang($current_language);
|
201 |
$woocommerce->load_plugin_textdomain();
|
3 |
class WCML_Tab_Manager{
|
4 |
|
5 |
function __construct(){
|
6 |
+
add_action( 'wcml_after_duplicate_product_post_meta', array( $this, 'sync_tabs' ), 10, 3 );
|
7 |
+
add_filter( 'wcml_product_content_exception', array( $this, 'is_have_custom_product_tab' ), 10, 2 );
|
8 |
+
add_filter( 'wcml_custom_box_html', array( $this, 'custom_box_html'), 10, 3 );
|
9 |
+
add_filter( 'wpml_duplicate_custom_fields_exceptions', array( $this, 'duplicate_custom_fields_exceptions' ) );
|
10 |
}
|
11 |
|
12 |
+
function sync_tabs( $original_product_id, $trnsl_product_id, $data = false ){
|
13 |
+
global $wc_tab_manager, $sitepress, $wpdb, $woocommerce;
|
14 |
|
15 |
+
$lang = $sitepress->get_language_for_element( $trnsl_product_id, 'post_product' );
|
16 |
+
|
17 |
+
//check if "duplicate" product
|
18 |
+
if( ( isset( $_POST['icl_ajx_action'] ) && ( $_POST['icl_ajx_action'] == 'make_duplicates' ) ) || ( get_post_meta( $trnsl_product_id , '_icl_lang_duplicate_of', true ) ) ){
|
19 |
+
$this->duplicate_tabs( $original_product_id, $trnsl_product_id, $lang );
|
20 |
}
|
21 |
|
22 |
+
if( !isset( $data[ '_product_tabs_'.$lang ] ) ){
|
23 |
+
return;
|
24 |
+
}
|
25 |
|
26 |
+
$orig_prod_tabs = $wc_tab_manager->get_product_tabs( $original_product_id );
|
27 |
|
28 |
+
if( $orig_prod_tabs ){
|
29 |
$trnsl_product_tabs = array();
|
30 |
$i = 0;
|
31 |
+
foreach( $orig_prod_tabs as $key => $orig_prod_tab ){
|
32 |
+
switch( $orig_prod_tab[ 'type' ] ){
|
|
|
|
|
|
|
|
|
|
|
33 |
case 'core':
|
34 |
$default_language = $sitepress->get_default_language();
|
35 |
$current_language = $sitepress->get_current_language();
|
36 |
+
$trnsl_product_tabs[ $key ] = $orig_prod_tabs[ $key ];
|
37 |
+
if( isset( $data[ '_product_tabs_'.$lang ] ) ){
|
38 |
+
$title = $data[ '_product_tabs_'.$lang ][ 'core_title' ][ $orig_prod_tab[ 'id' ] ];
|
39 |
+
$heading = $data[ '_product_tabs_'.$lang ][ 'core_heading' ][ $orig_prod_tab[ 'id' ] ];
|
|
|
|
|
|
|
|
|
40 |
}
|
41 |
|
42 |
+
if( $default_language != $lang ){
|
43 |
+
$this->refresh_text_domain( $lang );
|
44 |
+
if( !$title ) $title = $orig_prod_tabs[ $key ][ 'title' ];
|
|
|
|
|
45 |
$title = __( $title, 'woocommerce' );
|
46 |
+
if( !isset( $heading ) ){
|
47 |
+
$heading = '';
|
48 |
+
}elseif( !$heading && isset( $orig_prod_tabs[ $key ][ 'heading' ] ) ){
|
49 |
+
$heading = $orig_prod_tabs[ $key ][ 'heading' ];
|
50 |
+
}
|
51 |
$heading = __( $heading, 'woocommerce' );
|
52 |
+
$this->refresh_text_domain( $current_language );
|
|
|
|
|
53 |
}
|
54 |
|
55 |
+
$trnsl_product_tabs[ $key ][ 'title' ] = $title;
|
56 |
+
$trnsl_product_tabs[ $key ][ 'heading' ] = $heading;
|
57 |
break;
|
58 |
case 'global':
|
59 |
+
$trnsl_product_tabs = $this->set_global_tab( $orig_prod_tab, $trnsl_product_tabs, $lang );
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
break;
|
61 |
case 'product':
|
|
|
|
|
62 |
$tab_id = false;
|
63 |
+
if( isset( $data[ '_product_tabs_'.$lang ][ 'id' ][ $i ] ) ){
|
64 |
+
if( get_post_type( $data[ '_product_tabs_'.$lang ][ 'id' ][ $i ] ) == 'wc_product_tab' ){
|
65 |
+
$tab_id = $data[ '_product_tabs_'.$lang ][ 'id' ][ $i ];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
}
|
67 |
+
$title = $data[ '_product_tabs_'.$lang ][ 'title' ][ $i ];
|
68 |
+
$content = $data[ '_product_tabs_'.$lang ][ 'content' ][ $i ];
|
69 |
}
|
70 |
|
71 |
+
$trnsl_product_tabs = $this->set_product_tab( $orig_prod_tab, $trnsl_product_tabs, $lang, $trnsl_product_id, $tab_id, $title, $content );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
$i++;
|
74 |
break;
|
75 |
}
|
76 |
}
|
77 |
+
update_post_meta( $trnsl_product_id, '_product_tabs', $trnsl_product_tabs );
|
78 |
+
}
|
79 |
+
}
|
80 |
|
81 |
+
function duplicate_tabs( $original_product_id, $trnsl_product_id, $lang ){
|
82 |
+
global $sitepress;
|
83 |
+
$orig_prod_tabs = maybe_unserialize( get_post_meta( $original_product_id, '_product_tabs', true ) );
|
84 |
+
$prod_tabs = array();
|
85 |
+
foreach( $orig_prod_tabs as $key => $orig_prod_tab ){
|
86 |
+
switch( $orig_prod_tab[ 'type' ] ){
|
87 |
+
case 'core':
|
88 |
+
$prod_tabs[ $key ] = $orig_prod_tab;
|
89 |
+
$this->refresh_text_domain( $lang );
|
90 |
+
$prod_tabs[ $key ][ 'title' ] = __( $orig_prod_tab[ 'title' ], 'woocommerce' );
|
91 |
+
if( isset( $orig_prod_tab[ 'heading' ] ) )
|
92 |
+
$prod_tabs[ $key ][ 'heading' ] = __( $orig_prod_tab[ 'heading' ], 'woocommerce' );
|
93 |
+
$orig_lang = $sitepress->get_language_for_element( $original_product_id, 'post_product' );
|
94 |
+
$this->refresh_text_domain( $orig_lang );
|
95 |
+
break;
|
96 |
+
case 'global':
|
97 |
+
$prod_tabs = $this->set_global_tab( $orig_prod_tab, $prod_tabs, $lang );
|
98 |
+
break;
|
99 |
+
case 'product':
|
100 |
+
$original_tab = get_post( $orig_prod_tab[ 'id' ] );
|
101 |
+
$prod_tabs = $this->set_product_tab( $orig_prod_tab, $prod_tabs, $lang, $trnsl_product_id, false, $original_tab->post_title , $original_tab->post_content );
|
102 |
+
break;
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
update_post_meta( $trnsl_product_id, '_product_tabs', $prod_tabs );
|
107 |
+
}
|
108 |
+
|
109 |
+
function refresh_text_domain( $lang ){
|
110 |
+
global $sitepress, $woocommerce;
|
111 |
+
|
112 |
+
unload_textdomain( 'woocommerce' );
|
113 |
+
$sitepress->switch_lang( $lang );
|
114 |
+
$woocommerce->load_plugin_textdomain();
|
115 |
+
}
|
116 |
+
|
117 |
+
function set_global_tab( $orig_prod_tab, $trnsl_product_tabs, $lang ){
|
118 |
+
$tr_tab_id = icl_object_id( $orig_prod_tab[ 'id' ], 'wc_product_tab', true, $lang );
|
119 |
+
$trnsl_product_tabs[ $orig_prod_tab[ 'type' ].'_tab_'.$tr_tab_id ] = array(
|
120 |
+
'position' => $orig_prod_tab[ 'position' ],
|
121 |
+
'type' => $orig_prod_tab[ 'type' ],
|
122 |
+
'id' => $tr_tab_id,
|
123 |
+
'name' => get_post( $tr_tab_id )->post_name
|
124 |
+
);
|
125 |
+
return $trnsl_product_tabs;
|
126 |
+
}
|
127 |
+
|
128 |
+
function set_product_tab( $orig_prod_tab, $trnsl_product_tabs, $lang, $trnsl_product_id, $tab_id, $title, $content ){
|
129 |
+
global $wpdb, $sitepress;
|
130 |
+
|
131 |
+
if( !$tab_id ){
|
132 |
+
$tr_tab_id = icl_object_id( $orig_prod_tab[ 'id' ], 'wc_product_tab', false, $lang );
|
133 |
+
|
134 |
+
if( !is_null( $tr_tab_id ) ){
|
135 |
+
$tab_id = $tr_tab_id;
|
136 |
+
}
|
137 |
}
|
138 |
+
|
139 |
+
if( $tab_id ){
|
140 |
+
//update existing tab
|
141 |
+
$args = array();
|
142 |
+
$args[ 'post_title' ] = $title;
|
143 |
+
$args[ 'post_content' ] = $content;
|
144 |
+
$wpdb->update( $wpdb->posts, $args, array( 'ID' => $tab_id ) );
|
145 |
+
}else{
|
146 |
+
//tab not exist creating new
|
147 |
+
$args = array();
|
148 |
+
$args[ 'post_title' ] = $title;
|
149 |
+
$args[ 'post_content' ] = $content;
|
150 |
+
$args[ 'post_author' ] = get_current_user_id();
|
151 |
+
$args[ 'post_name' ] = sanitize_title( $title );
|
152 |
+
$args[ 'post_type' ] = 'wc_product_tab';
|
153 |
+
$args[ 'post_parent' ] = $trnsl_product_id;
|
154 |
+
$args[ 'post_status' ] = 'publish';
|
155 |
+
$wpdb->insert( $wpdb->posts, $args );
|
156 |
+
|
157 |
+
$tab_id = $wpdb->insert_id;
|
158 |
+
$tab_trid = $sitepress->get_element_trid( $orig_prod_tab[ 'id' ], 'post_wc_product_tab' );
|
159 |
+
if( !$tab_trid ){
|
160 |
+
$sitepress->set_element_language_details( $orig_prod_tab[ 'id' ], 'post_wc_product_tab', false, $sitepress->get_default_language() );
|
161 |
+
$tab_trid = $sitepress->get_element_trid( $orig_prod_tab[ 'id' ], 'post_wc_product_tab' );
|
162 |
+
}
|
163 |
+
$sitepress->set_element_language_details( $tab_id, 'post_wc_product_tab', $tab_trid, $lang );
|
164 |
+
}
|
165 |
+
|
166 |
+
$trnsl_product_tabs[ $orig_prod_tab[ 'type' ].'_tab_'.$tab_id ] = array(
|
167 |
+
'position' => $orig_prod_tab[ 'position' ],
|
168 |
+
'type' => $orig_prod_tab[ 'type' ],
|
169 |
+
'id' => $tab_id,
|
170 |
+
'name' => get_post( $tab_id )->post_name
|
171 |
+
);
|
172 |
+
|
173 |
+
return $trnsl_product_tabs;
|
174 |
+
}
|
175 |
+
|
176 |
+
function duplicate_custom_fields_exceptions( $exceptions ){
|
177 |
+
$exceptions[] = '_product_tabs';
|
178 |
+
return $exceptions;
|
179 |
}
|
180 |
|
181 |
function is_have_custom_product_tab($exception,$product_id){
|
195 |
if($template_data['product_content'] == '_product_tabs'){
|
196 |
global $wc_tab_manager;
|
197 |
$orig_prod_tabs = $wc_tab_manager->get_product_tabs($template_data['product_id']);
|
198 |
+
if(!$orig_prod_tabs) return '';
|
199 |
if($template_data['tr_product_id']){
|
200 |
$tr_prod_tabs = $wc_tab_manager->get_product_tabs($template_data['tr_product_id']);
|
201 |
|
209 |
$template_data['tr_tabs'][$prod_tab['id']]['id'] = $prod_tab['id'];
|
210 |
$template_data['tr_tabs'][$prod_tab['id']]['type'] = $prod_tab['type'];
|
211 |
$template_data['tr_tabs'][$prod_tab['id']]['title'] = $prod_tab['title'];
|
212 |
+
$template_data['tr_tabs'][$prod_tab['id']]['heading'] = isset ($prod_tab['heading']) ? $prod_tab['heading'] : '';
|
213 |
}else{
|
214 |
$template_data['tr_tabs'][$prod_tab['position']]['id'] = $prod_tab['id'];
|
215 |
$template_data['tr_tabs'][$prod_tab['position']]['type'] = $prod_tab['type'];
|
230 |
|
231 |
}
|
232 |
|
233 |
+
if(!isset($prod_tab['heading'])){
|
234 |
+
$template_data['tr_tabs'][$prod_tab['id']]['heading'] = '';
|
235 |
+
}else{
|
236 |
+
$heading = __( $prod_tab['heading'], 'woocommerce' );
|
237 |
+
if($prod_tab['heading'] != $heading){
|
238 |
+
$template_data['tr_tabs'][$prod_tab['id']]['heading'] = $heading;
|
239 |
+
}
|
240 |
}
|
241 |
+
|
242 |
unload_textdomain('woocommerce');
|
243 |
$sitepress->switch_lang($current_language);
|
244 |
$woocommerce->load_plugin_textdomain();
|
inc/compatibility.class.php
CHANGED
@@ -4,7 +4,7 @@ class WCML_Compatibility {
|
|
4 |
|
5 |
function __construct(){
|
6 |
|
7 |
-
add_action('init', array($this, 'init'),
|
8 |
|
9 |
|
10 |
// Dynamic Pricing
|
@@ -64,6 +64,18 @@ class WCML_Compatibility {
|
|
64 |
$this->wc_exporter = new WCML_wcExporter();
|
65 |
}
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
}
|
68 |
|
69 |
}
|
4 |
|
5 |
function __construct(){
|
6 |
|
7 |
+
add_action('init', array($this, 'init'),4);
|
8 |
|
9 |
|
10 |
// Dynamic Pricing
|
64 |
$this->wc_exporter = new WCML_wcExporter();
|
65 |
}
|
66 |
|
67 |
+
//Gravity Forms
|
68 |
+
if(class_exists('GFForms')){
|
69 |
+
require_once WCML_PLUGIN_PATH . '/compatibility/gravityforms.class.php';
|
70 |
+
$this->gravityforms = new WCML_gravityforms();
|
71 |
+
}
|
72 |
+
|
73 |
+
//Sensei WooThemes
|
74 |
+
if(class_exists('WooThemes_Sensei')){
|
75 |
+
require_once WCML_PLUGIN_PATH . '/compatibility/wc_sensei.class.php';
|
76 |
+
$this->sensei = new WCML_sensei();
|
77 |
+
}
|
78 |
+
|
79 |
}
|
80 |
|
81 |
}
|
inc/emails.class.php
CHANGED
@@ -41,7 +41,9 @@ class WCML_Emails{
|
|
41 |
add_action( 'woocommerce_order_status_failed_to_processing_notification', array( $this, 'admin_email' ), 9 );
|
42 |
add_action( 'woocommerce_order_status_failed_to_completed_notification', array( $this, 'admin_email' ), 9 );
|
43 |
add_action( 'woocommerce_order_status_failed_to_on-hold_notification', array( $this, 'admin_email' ), 9 );
|
44 |
-
|
|
|
|
|
45 |
|
46 |
/**
|
47 |
* Translate WooCommerce emails.
|
@@ -227,4 +229,11 @@ class WCML_Emails{
|
|
227 |
$woocommerce_wpml->strings->translate_payment_instructions($order->payment_method);
|
228 |
}
|
229 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
}
|
41 |
add_action( 'woocommerce_order_status_failed_to_processing_notification', array( $this, 'admin_email' ), 9 );
|
42 |
add_action( 'woocommerce_order_status_failed_to_completed_notification', array( $this, 'admin_email' ), 9 );
|
43 |
add_action( 'woocommerce_order_status_failed_to_on-hold_notification', array( $this, 'admin_email' ), 9 );
|
44 |
+
|
45 |
+
add_filter( 'icl_st_admin_string_return_cached', array( $this, 'admin_string_return_cached' ), 10, 2 );
|
46 |
+
}
|
47 |
|
48 |
/**
|
49 |
* Translate WooCommerce emails.
|
229 |
$woocommerce_wpml->strings->translate_payment_instructions($order->payment_method);
|
230 |
}
|
231 |
|
232 |
+
function admin_string_return_cached( $value, $option ){
|
233 |
+
if( in_array( $option, array ( 'woocommerce_email_from_address', 'woocommerce_email_from_name' ) ) )
|
234 |
+
return false;
|
235 |
+
|
236 |
+
return $value;
|
237 |
+
}
|
238 |
+
|
239 |
}
|
inc/endpoints.class.php
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WCML_Endpoints{
|
4 |
+
|
5 |
+
var $endpoints_strings = array();
|
6 |
+
|
7 |
+
function __construct(){
|
8 |
+
|
9 |
+
//endpoints hooks
|
10 |
+
add_action( 'plugins_loaded', array( $this, 'register_endpoints_translations' ), 2 );
|
11 |
+
add_action( 'icl_ajx_custom_call', array( $this, 'rewrite_rule_endpoints' ), 11, 2 );
|
12 |
+
add_action( 'woocommerce_settings_saved', array( $this, 'update_endpoints_rules' ) );
|
13 |
+
|
14 |
+
add_filter( 'page_link', array( $this, 'endpoint_permalink_filter' ), 10, 2 ); //after WPML
|
15 |
+
|
16 |
+
}
|
17 |
+
|
18 |
+
function register_endpoints_translations(){
|
19 |
+
if( !class_exists( 'woocommerce' ) || !defined( 'ICL_SITEPRESS_VERSION' ) || ICL_PLUGIN_INACTIVE ) return false;
|
20 |
+
|
21 |
+
$wc_vars = WC()->query->query_vars;
|
22 |
+
|
23 |
+
$query_vars = array(
|
24 |
+
// Checkout actions
|
25 |
+
'order-pay' => $this->get_endpoint_translation( $wc_vars['order-pay'] ),
|
26 |
+
'order-received' => $this->get_endpoint_translation( $wc_vars['order-received'] ),
|
27 |
+
|
28 |
+
// My account actions
|
29 |
+
'view-order' => $this->get_endpoint_translation( $wc_vars['view-order'] ),
|
30 |
+
'edit-account' => $this->get_endpoint_translation( $wc_vars['edit-account'] ),
|
31 |
+
'edit-address' => $this->get_endpoint_translation( $wc_vars['edit-address'] ),
|
32 |
+
'lost-password' => $this->get_endpoint_translation( $wc_vars['lost-password'] ),
|
33 |
+
'customer-logout' => $this->get_endpoint_translation( $wc_vars['customer-logout'] ),
|
34 |
+
'add-payment-method' => $this->get_endpoint_translation( $wc_vars['add-payment-method'] ),
|
35 |
+
);
|
36 |
+
|
37 |
+
WC()->query->query_vars = $query_vars;
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
function get_endpoint_translation( $endpoint ){
|
42 |
+
global $wpdb;
|
43 |
+
|
44 |
+
$string = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}icl_strings WHERE name = %s AND value = %s ", 'Endpoint slug: ' . $endpoint, $endpoint ) );
|
45 |
+
|
46 |
+
if( !$string && function_exists( 'icl_register_string' ) ){
|
47 |
+
icl_register_string( 'WordPress', 'Endpoint slug: ' . $endpoint, $endpoint );
|
48 |
+
}else{
|
49 |
+
$this->endpoints_strings[] = $string;
|
50 |
+
}
|
51 |
+
|
52 |
+
if( function_exists('icl_t') ){
|
53 |
+
return icl_t( 'WordPress', 'Endpoint slug: '. $endpoint, $endpoint );
|
54 |
+
}else{
|
55 |
+
return $endpoint;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
function rewrite_rule_endpoints( $call, $data ){
|
60 |
+
if( $call == 'icl_st_save_translation' && in_array( $data['icl_st_string_id'], $this->endpoints_strings ) ){
|
61 |
+
$this->add_endpoints();
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
function update_endpoints_rules(){
|
66 |
+
$this->add_endpoints();
|
67 |
+
}
|
68 |
+
|
69 |
+
function add_endpoints(){
|
70 |
+
global $wpdb;
|
71 |
+
//add endpoints and flush rules
|
72 |
+
foreach( $this->endpoints_strings as $string_id ){
|
73 |
+
$strings = $wpdb->get_results( $wpdb->prepare( "SELECT value FROM {$wpdb->prefix}icl_string_translations WHERE string_id = %s AND status = 1", $string_id ) );
|
74 |
+
foreach( $strings as $string ){
|
75 |
+
add_rewrite_endpoint( $string->value, EP_PAGES );
|
76 |
+
}
|
77 |
+
}
|
78 |
+
flush_rewrite_rules();
|
79 |
+
}
|
80 |
+
|
81 |
+
function endpoint_permalink_filter( $p, $pid ){
|
82 |
+
global $wp,$sitepress,$post;
|
83 |
+
|
84 |
+
if( isset($post->ID) && !is_admin() ){
|
85 |
+
$current_lang = $sitepress->get_current_language();
|
86 |
+
$page_lang = $sitepress->get_language_for_element( $post->ID, 'post_page');
|
87 |
+
if( $current_lang != $page_lang && icl_object_id( $pid, 'page', false, $page_lang ) == $post->ID ){
|
88 |
+
|
89 |
+
$endpoints = WC()->query->get_query_vars();
|
90 |
+
|
91 |
+
foreach( $endpoints as $key => $endpoint ){
|
92 |
+
if( isset($wp->query_vars[$key]) ){
|
93 |
+
if( in_array( $key, array( 'pay', 'order-received' ) ) ){
|
94 |
+
$endpoint = get_option( 'woocommerce_checkout_'.str_replace( '-','_',$key).'_endpoint' );
|
95 |
+
}else{
|
96 |
+
$endpoint = get_option( 'woocommerce_myaccount_'.str_replace( '-','_',$key).'_endpoint' );
|
97 |
+
}
|
98 |
+
$p = $this->get_endpoint_url($this->get_endpoint_translation( $endpoint ),$wp->query_vars[ $key ],$p);
|
99 |
+
}
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
return $p;
|
105 |
+
}
|
106 |
+
|
107 |
+
function get_endpoint_url($endpoint, $value = '', $permalink = ''){
|
108 |
+
if ( get_option( 'permalink_structure' ) ) {
|
109 |
+
if ( strstr( $permalink, '?' ) ) {
|
110 |
+
$query_string = '?' . parse_url( $permalink, PHP_URL_QUERY );
|
111 |
+
$permalink = current( explode( '?', $permalink ) );
|
112 |
+
} else {
|
113 |
+
$query_string = '';
|
114 |
+
}
|
115 |
+
$url = trailingslashit( $permalink ) . $endpoint . '/' . $value . $query_string;
|
116 |
+
} else {
|
117 |
+
$url = add_query_arg( $endpoint, $value, $permalink );
|
118 |
+
}
|
119 |
+
return $url;
|
120 |
+
}
|
121 |
+
|
122 |
+
|
123 |
+
}
|
inc/multi-currency-support.class.php
CHANGED
@@ -50,7 +50,7 @@ class WCML_Multi_Currency_Support{
|
|
50 |
}else{
|
51 |
if(is_ajax() && $this->get_client_currency() != get_option('woocommerce_currency')){
|
52 |
if(isset($_REQUEST['action'])){
|
53 |
-
$ajax_actions = array('woocommerce_get_refreshed_fragments', 'woocommerce_update_order_review', 'woocommerce-checkout', 'woocommerce_checkout', 'woocommerce_add_to_cart');
|
54 |
if(version_compare($GLOBALS['woocommerce']->version, '2.1', '>=')){
|
55 |
$ajax_actions[] = 'woocommerce_update_shipping_method';
|
56 |
}
|
@@ -87,14 +87,22 @@ class WCML_Multi_Currency_Support{
|
|
87 |
add_filter('woocommerce_table_rate_query_rates', array($this, 'table_rate_shipping_rates'));
|
88 |
add_filter('woocommerce_table_rate_instance_settings', array($this, 'table_rate_instance_settings'));
|
89 |
}
|
90 |
-
|
91 |
-
|
92 |
add_filter('option_woocommerce_price_thousand_sep', array($this, 'filter_currency_thousand_sep_option'));
|
93 |
add_filter('option_woocommerce_price_decimal_sep', array($this, 'filter_currency_decimal_sep_option'));
|
94 |
add_filter('option_woocommerce_price_num_decimals', array($this, 'filter_currency_num_decimals_option'));
|
95 |
-
|
|
|
|
|
|
|
|
|
96 |
}
|
97 |
-
|
|
|
|
|
|
|
|
|
98 |
add_action('currency_switcher', array($this, 'currency_switcher'));
|
99 |
add_shortcode('currency_switcher', array($this, 'currency_switcher_shortcode'));
|
100 |
|
@@ -498,12 +506,35 @@ class WCML_Multi_Currency_Support{
|
|
498 |
}
|
499 |
|
500 |
function filter_currency_position_option($value){
|
501 |
-
if(isset($
|
502 |
-
|
503 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
504 |
}
|
505 |
return $value;
|
506 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
507 |
|
508 |
function filter_currency_thousand_sep_option($value){
|
509 |
if(isset($this->currencies[$this->client_currency]['thousand_sep']) ){
|
@@ -1083,7 +1114,9 @@ class WCML_Multi_Currency_Support{
|
|
1083 |
|
1084 |
function currency_switcher($args = array()){
|
1085 |
global $sitepress, $woocommerce_wpml;
|
1086 |
-
|
|
|
|
|
1087 |
$settings = $woocommerce_wpml->get_settings();
|
1088 |
if(!isset($args['switcher_style'])){
|
1089 |
$args['switcher_style'] = isset($settings['currency_switcher_style'])?$settings['currency_switcher_style']:'dropdown';
|
@@ -1114,7 +1147,7 @@ class WCML_Multi_Currency_Support{
|
|
1114 |
}
|
1115 |
foreach($currencies as $currency){
|
1116 |
if($woocommerce_wpml->settings['currency_options'][$currency]['languages'][$sitepress->get_current_language()] == 1 ){
|
1117 |
-
$selected = $currency == $this->get_client_currency() ? ' selected="
|
1118 |
|
1119 |
$currency_format = preg_replace(array('#%name%#', '#%symbol%#', '#%code%#'),
|
1120 |
array($wc_currencies[$currency], get_woocommerce_currency_symbol($currency), $currency), $args['format']);
|
@@ -1135,7 +1168,44 @@ class WCML_Multi_Currency_Support{
|
|
1135 |
function register_styles(){
|
1136 |
wp_register_style('currency-switcher', WCML_PLUGIN_URL . '/assets/css/currency-switcher.css', null, WCML_VERSION);
|
1137 |
wp_enqueue_style('currency-switcher');
|
1138 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1139 |
|
1140 |
}
|
1141 |
|
50 |
}else{
|
51 |
if(is_ajax() && $this->get_client_currency() != get_option('woocommerce_currency')){
|
52 |
if(isset($_REQUEST['action'])){
|
53 |
+
$ajax_actions = apply_filters('wcml_multi_currency_is_ajax', array('woocommerce_get_refreshed_fragments', 'woocommerce_update_order_review', 'woocommerce-checkout', 'woocommerce_checkout', 'woocommerce_add_to_cart'));
|
54 |
if(version_compare($GLOBALS['woocommerce']->version, '2.1', '>=')){
|
55 |
$ajax_actions[] = 'woocommerce_update_shipping_method';
|
56 |
}
|
87 |
add_filter('woocommerce_table_rate_query_rates', array($this, 'table_rate_shipping_rates'));
|
88 |
add_filter('woocommerce_table_rate_instance_settings', array($this, 'table_rate_instance_settings'));
|
89 |
}
|
90 |
+
|
91 |
+
|
92 |
add_filter('option_woocommerce_price_thousand_sep', array($this, 'filter_currency_thousand_sep_option'));
|
93 |
add_filter('option_woocommerce_price_decimal_sep', array($this, 'filter_currency_decimal_sep_option'));
|
94 |
add_filter('option_woocommerce_price_num_decimals', array($this, 'filter_currency_num_decimals_option'));
|
95 |
+
|
96 |
+
//filters for wc-widget-price-filter
|
97 |
+
add_filter( 'woocommerce_price_filter_results', array( $this, 'filter_price_filter_results' ), 10, 3 );
|
98 |
+
add_filter( 'woocommerce_price_filter_widget_amount', array( $this, 'filter_price_filter_widget_amount' ) );
|
99 |
+
|
100 |
}
|
101 |
+
|
102 |
+
add_filter( 'option_woocommerce_currency_pos', array( $this, 'filter_currency_position_option' ) );
|
103 |
+
add_filter( 'woocommerce_get_formatted_order_total', array( $this, 'filter_get_formatted_order_total' ), 10, 2 );
|
104 |
+
add_action( 'woocommerce_view_order', array( $this, 'filter_view_order' ), 9 );
|
105 |
+
|
106 |
add_action('currency_switcher', array($this, 'currency_switcher'));
|
107 |
add_shortcode('currency_switcher', array($this, 'currency_switcher_shortcode'));
|
108 |
|
506 |
}
|
507 |
|
508 |
function filter_currency_position_option($value){
|
509 |
+
if( is_ajax() && isset( $_COOKIE[ '_wcml_order_currency' ] ) ){
|
510 |
+
$currency_code = $_COOKIE[ '_wcml_order_currency' ];
|
511 |
+
}else{
|
512 |
+
$currency_code = $this->client_currency;
|
513 |
+
}
|
514 |
+
|
515 |
+
if(isset($this->currencies[$currency_code]['position']) &&
|
516 |
+
in_array($this->currencies[$currency_code]['position'], array('left', 'right', 'left_space', 'right_space'))){
|
517 |
+
$value = $this->currencies[$currency_code]['position'];
|
518 |
}
|
519 |
return $value;
|
520 |
}
|
521 |
+
|
522 |
+
function filter_get_formatted_order_total($formatted_total, $object ){
|
523 |
+
$client_currency_buff = $this->client_currency;
|
524 |
+
$this->client_currency = $object->get_order_currency();
|
525 |
+
|
526 |
+
$formatted_total = wc_price( $object->order_total , array('currency' => $object->get_order_currency()));
|
527 |
+
|
528 |
+
$this->client_currency = $client_currency_buff;
|
529 |
+
|
530 |
+
return $formatted_total;
|
531 |
+
}
|
532 |
+
|
533 |
+
function filter_view_order( $order_id ){
|
534 |
+
$currency_code = get_post_meta( $order_id, '_order_currency', true );
|
535 |
+
|
536 |
+
$this->client_currency = $currency_code;
|
537 |
+
}
|
538 |
|
539 |
function filter_currency_thousand_sep_option($value){
|
540 |
if(isset($this->currencies[$this->client_currency]['thousand_sep']) ){
|
1114 |
|
1115 |
function currency_switcher($args = array()){
|
1116 |
global $sitepress, $woocommerce_wpml;
|
1117 |
+
if ( is_page( get_option( 'woocommerce_myaccount_page_id' ) ) ) {
|
1118 |
+
return '';
|
1119 |
+
}
|
1120 |
$settings = $woocommerce_wpml->get_settings();
|
1121 |
if(!isset($args['switcher_style'])){
|
1122 |
$args['switcher_style'] = isset($settings['currency_switcher_style'])?$settings['currency_switcher_style']:'dropdown';
|
1147 |
}
|
1148 |
foreach($currencies as $currency){
|
1149 |
if($woocommerce_wpml->settings['currency_options'][$currency]['languages'][$sitepress->get_current_language()] == 1 ){
|
1150 |
+
$selected = $currency == $this->get_client_currency() ? ' selected="selected"' : '';
|
1151 |
|
1152 |
$currency_format = preg_replace(array('#%name%#', '#%symbol%#', '#%code%#'),
|
1153 |
array($wc_currencies[$currency], get_woocommerce_currency_symbol($currency), $currency), $args['format']);
|
1168 |
function register_styles(){
|
1169 |
wp_register_style('currency-switcher', WCML_PLUGIN_URL . '/assets/css/currency-switcher.css', null, WCML_VERSION);
|
1170 |
wp_enqueue_style('currency-switcher');
|
1171 |
+
}
|
1172 |
+
|
1173 |
+
|
1174 |
+
function filter_price_filter_results( $matched_products, $min, $max ){
|
1175 |
+
global $woocommerce_wpml,$wpdb;
|
1176 |
+
|
1177 |
+
$current_currency = $this->get_client_currency();
|
1178 |
+
if( $current_currency != get_option('woocommerce_currency') ){
|
1179 |
+
$filtered_min = $woocommerce_wpml->multi_currency->unconvert_price_amount( $min, $current_currency );
|
1180 |
+
$filtered_max = $woocommerce_wpml->multi_currency->unconvert_price_amount( $max, $current_currency );
|
1181 |
+
|
1182 |
+
$matched_products = $wpdb->get_results( $wpdb->prepare("
|
1183 |
+
SELECT DISTINCT ID, post_parent, post_type FROM $wpdb->posts
|
1184 |
+
INNER JOIN $wpdb->postmeta ON ID = post_id
|
1185 |
+
WHERE post_type IN ( 'product', 'product_variation' ) AND post_status = 'publish' AND meta_key = %s AND meta_value BETWEEN %d AND %d
|
1186 |
+
", '_price', $filtered_min, $filtered_max ), OBJECT_K );
|
1187 |
+
|
1188 |
+
foreach( $matched_products as $key => $matched_product ){
|
1189 |
+
$custom_price = get_post_meta( $matched_product->ID, '_price_'.$current_currency, true );
|
1190 |
+
if( $custom_price && ( $custom_price < $min || $custom_price > $max ) ){
|
1191 |
+
unset( $matched_products[$key] );
|
1192 |
+
}
|
1193 |
+
}
|
1194 |
+
}
|
1195 |
+
|
1196 |
+
return $matched_products;
|
1197 |
+
}
|
1198 |
+
|
1199 |
+
function filter_price_filter_widget_amount( $amount ){
|
1200 |
+
|
1201 |
+
$current_currency = $this->get_client_currency();
|
1202 |
+
if( $current_currency != get_option('woocommerce_currency') ){
|
1203 |
+
$amount = apply_filters('wcml_raw_price_amount', $amount );
|
1204 |
+
}
|
1205 |
+
|
1206 |
+
return $amount;
|
1207 |
+
|
1208 |
+
}
|
1209 |
|
1210 |
}
|
1211 |
|
inc/multi-currency.class.php
CHANGED
@@ -57,7 +57,17 @@ class WCML_WC_MultiCurrency{
|
|
57 |
|
58 |
// use correct order currency on order detail page
|
59 |
add_filter('woocommerce_currency_symbol', array($this, '_use_order_currency_symbol'));
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
|
63 |
// reports
|
@@ -104,10 +114,11 @@ class WCML_WC_MultiCurrency{
|
|
104 |
|
105 |
}
|
106 |
|
107 |
-
function apply_rounding_rules($price){
|
108 |
global $woocommerce_wpml;
|
109 |
-
|
110 |
-
|
|
|
111 |
$currency_options = $woocommerce_wpml->settings['currency_options'][$currency];
|
112 |
|
113 |
if($currency_options['rounding'] != 'disabled'){
|
@@ -153,6 +164,28 @@ class WCML_WC_MultiCurrency{
|
|
153 |
return $price;
|
154 |
|
155 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
|
157 |
function shipping_price_filter($price) {
|
158 |
|
@@ -407,26 +440,30 @@ class WCML_WC_MultiCurrency{
|
|
407 |
}
|
408 |
|
409 |
function _use_order_currency_symbol($currency){
|
410 |
-
|
411 |
-
|
412 |
if(!function_exists('get_current_screen')){
|
413 |
return $currency;
|
414 |
}
|
415 |
|
416 |
$current_screen = get_current_screen();
|
417 |
-
|
|
|
418 |
if(!empty($current_screen) && $current_screen->id == 'shop_order'){
|
419 |
|
420 |
$the_order = new WC_Order( get_the_ID() );
|
421 |
if($the_order && method_exists($the_order, 'get_order_currency')){
|
422 |
-
remove_filter('woocommerce_currency_symbol', array($this, '_use_order_currency_symbol'));
|
423 |
|
424 |
-
$currency = get_woocommerce_currency_symbol($the_order->get_order_currency());
|
425 |
-
|
426 |
-
add_filter('woocommerce_currency_symbol', array($this, '_use_order_currency_symbol'));
|
427 |
}
|
428 |
|
|
|
|
|
|
|
|
|
429 |
}
|
|
|
|
|
430 |
|
431 |
return $currency;
|
432 |
}
|
@@ -542,7 +579,7 @@ class WCML_WC_MultiCurrency{
|
|
542 |
|
543 |
}
|
544 |
}
|
545 |
-
|
546 |
function admin_reports_query_filter($query){
|
547 |
global $wpdb;
|
548 |
|
@@ -562,9 +599,9 @@ class WCML_WC_MultiCurrency{
|
|
562 |
}
|
563 |
|
564 |
function reports_currency_dropdown(){
|
565 |
-
|
566 |
$orders_currencies = $this->get_orders_currencies();
|
567 |
-
$currencies = get_woocommerce_currencies();
|
568 |
|
569 |
// remove temporary
|
570 |
remove_filter('woocommerce_currency_symbol', array($this, '_set_reports_currency_symbol'));
|
@@ -573,10 +610,10 @@ class WCML_WC_MultiCurrency{
|
|
573 |
|
574 |
<select id="dropdown_shop_report_currency">
|
575 |
<?php if(empty($orders_currencies)): ?>
|
576 |
-
<option value=""><?php _e('
|
577 |
-
<?php else: ?>
|
578 |
<?php foreach($orders_currencies as $currency => $count): ?>
|
579 |
-
<option value="<?php echo $currency ?>" <?php selected( $currency, $this->reports_currency ); ?>><?php
|
580 |
printf("%s (%s)", $currencies[$currency], get_woocommerce_currency_symbol($currency)) ?></option>
|
581 |
<?php endforeach; ?>
|
582 |
<?php endif; ?>
|
@@ -589,6 +626,198 @@ class WCML_WC_MultiCurrency{
|
|
589 |
add_filter('woocommerce_currency_symbol', array($this, '_set_reports_currency_symbol'));
|
590 |
|
591 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
592 |
|
593 |
function _set_reports_currency_symbol($currency){
|
594 |
static $no_recur = false;
|
57 |
|
58 |
// use correct order currency on order detail page
|
59 |
add_filter('woocommerce_currency_symbol', array($this, '_use_order_currency_symbol'));
|
60 |
+
|
61 |
+
|
62 |
+
//new order currency/language switchers
|
63 |
+
add_action( 'woocommerce_process_shop_order_meta', array( $this, 'process_shop_order_meta'), 10, 2 );
|
64 |
+
add_action( 'woocommerce_order_actions_start', array( $this, 'order_currency_dropdown' ) );
|
65 |
+
|
66 |
+
add_filter( 'woocommerce_ajax_order_item', array( $this, 'filter_ajax_order_item' ), 10, 2 );
|
67 |
+
|
68 |
+
add_action( 'wp_ajax_wcml_order_set_currency', array( $this, 'set_order_currency' ) );
|
69 |
+
add_action( 'wp_ajax_wcml_order_delete_items', array( $this, 'order_delete_items' ) );
|
70 |
+
|
71 |
}
|
72 |
|
73 |
// reports
|
114 |
|
115 |
}
|
116 |
|
117 |
+
function apply_rounding_rules($price, $currency = false ){
|
118 |
global $woocommerce_wpml;
|
119 |
+
|
120 |
+
if( !$currency )
|
121 |
+
$currency = $this->get_client_currency();
|
122 |
$currency_options = $woocommerce_wpml->settings['currency_options'][$currency];
|
123 |
|
124 |
if($currency_options['rounding'] != 'disabled'){
|
164 |
return $price;
|
165 |
|
166 |
}
|
167 |
+
|
168 |
+
function apply_currency_position( $price, $currency_code ){
|
169 |
+
global $woocommerce_wpml;
|
170 |
+
$currencies = $woocommerce_wpml->multi_currency_support->get_currencies();
|
171 |
+
|
172 |
+
if( isset( $currencies[$currency_code]['position'] ) ){
|
173 |
+
$position = $currencies[$currency_code]['position'];
|
174 |
+
}else{
|
175 |
+
remove_filter( 'option_woocommerce_currency_pos', array( $woocommerce_wpml->multi_currency_support, 'filter_currency_position_option' ) );
|
176 |
+
$position = get_option('woocommerce_currency_pos');
|
177 |
+
add_filter( 'option_woocommerce_currency_pos', array( $woocommerce_wpml->multi_currency_support, 'filter_currency_position_option' ) );
|
178 |
+
}
|
179 |
+
|
180 |
+
switch( $position ){
|
181 |
+
case 'left': $price = sprintf( '%s%s', get_woocommerce_currency_symbol( $currency_code ), $price ); break;
|
182 |
+
case 'right': $price = sprintf( '%s%s', $price, get_woocommerce_currency_symbol( $currency_code ) ); break;
|
183 |
+
case 'left_space': $price = sprintf( '%s %s', get_woocommerce_currency_symbol( $currency_code ), $price ); break;
|
184 |
+
case 'right_space': $price = sprintf( '%s %s', $price, get_woocommerce_currency_symbol( $currency_code ) ); break;
|
185 |
+
}
|
186 |
+
|
187 |
+
return $price;
|
188 |
+
}
|
189 |
|
190 |
function shipping_price_filter($price) {
|
191 |
|
440 |
}
|
441 |
|
442 |
function _use_order_currency_symbol($currency){
|
443 |
+
|
|
|
444 |
if(!function_exists('get_current_screen')){
|
445 |
return $currency;
|
446 |
}
|
447 |
|
448 |
$current_screen = get_current_screen();
|
449 |
+
|
450 |
+
remove_filter('woocommerce_currency_symbol', array($this, '_use_order_currency_symbol'));
|
451 |
if(!empty($current_screen) && $current_screen->id == 'shop_order'){
|
452 |
|
453 |
$the_order = new WC_Order( get_the_ID() );
|
454 |
if($the_order && method_exists($the_order, 'get_order_currency')){
|
|
|
455 |
|
456 |
+
$currency = get_woocommerce_currency_symbol($the_order->get_order_currency());
|
457 |
+
|
|
|
458 |
}
|
459 |
|
460 |
+
}elseif( isset( $_POST['action'] ) && $_POST['action'] == 'woocommerce_add_order_item' && isset( $_COOKIE[ '_wcml_order_currency' ] ) ){
|
461 |
+
|
462 |
+
$currency = get_woocommerce_currency_symbol($_COOKIE[ '_wcml_order_currency' ]);
|
463 |
+
|
464 |
}
|
465 |
+
|
466 |
+
add_filter('woocommerce_currency_symbol', array($this, '_use_order_currency_symbol'));
|
467 |
|
468 |
return $currency;
|
469 |
}
|
579 |
|
580 |
}
|
581 |
}
|
582 |
+
|
583 |
function admin_reports_query_filter($query){
|
584 |
global $wpdb;
|
585 |
|
599 |
}
|
600 |
|
601 |
function reports_currency_dropdown(){
|
602 |
+
|
603 |
$orders_currencies = $this->get_orders_currencies();
|
604 |
+
$currencies = get_woocommerce_currencies();
|
605 |
|
606 |
// remove temporary
|
607 |
remove_filter('woocommerce_currency_symbol', array($this, '_set_reports_currency_symbol'));
|
610 |
|
611 |
<select id="dropdown_shop_report_currency">
|
612 |
<?php if(empty($orders_currencies)): ?>
|
613 |
+
<option value=""><?php _e('Currency - no orders found', 'wpml-wcml') ?></option>
|
614 |
+
<?php else: ?>
|
615 |
<?php foreach($orders_currencies as $currency => $count): ?>
|
616 |
+
<option value="<?php echo $currency ?>" <?php selected( $currency, $this->reports_currency ); ?>><?php
|
617 |
printf("%s (%s)", $currencies[$currency], get_woocommerce_currency_symbol($currency)) ?></option>
|
618 |
<?php endforeach; ?>
|
619 |
<?php endif; ?>
|
626 |
add_filter('woocommerce_currency_symbol', array($this, '_set_reports_currency_symbol'));
|
627 |
|
628 |
}
|
629 |
+
|
630 |
+
function order_currency_dropdown($order_id){
|
631 |
+
if( !get_post_meta( $order_id, '_order_currency') ){
|
632 |
+
global $woocommerce_wpml, $sitepress;
|
633 |
+
|
634 |
+
$current_order_currency = $this->get_cookie_order_currency();
|
635 |
+
|
636 |
+
$wc_currencies = get_woocommerce_currencies();
|
637 |
+
$currencies = $woocommerce_wpml->multi_currency_support->get_currency_codes();
|
638 |
+
$languages = icl_get_languages('skip_missing=0&orderby=code');
|
639 |
+
?>
|
640 |
+
<li class="wide">
|
641 |
+
<label><?php _e('Order currency:'); ?></label>
|
642 |
+
<select id="dropdown_shop_order_currency" name="wcml_shop_order_currency">
|
643 |
+
|
644 |
+
<?php foreach($currencies as $currency): ?>
|
645 |
+
|
646 |
+
<option value="<?php echo $currency ?>" <?php echo $current_order_currency == $currency ? 'selected="selected"':''; ?>><?php echo $wc_currencies[$currency]; ?></option>
|
647 |
+
|
648 |
+
<?php endforeach; ?>
|
649 |
+
|
650 |
+
</select>
|
651 |
+
</li>
|
652 |
+
<li class="wide">
|
653 |
+
<label><?php _e('Order language:'); ?></label>
|
654 |
+
<select id="dropdown_shop_order_language" name="wcml_shop_order_language">
|
655 |
+
<?php if(!empty($languages)): ?>
|
656 |
+
|
657 |
+
<?php foreach($languages as $l): ?>
|
658 |
+
|
659 |
+
<option value="<?php echo $l['language_code'] ?>" <?php echo $sitepress->get_default_language() == $l['language_code'] ? 'selected="selected"':''; ?>><?php echo $l['translated_name']; ?></option>
|
660 |
+
|
661 |
+
<?php endforeach; ?>
|
662 |
+
|
663 |
+
<?php endif; ?>
|
664 |
+
</select>
|
665 |
+
</li>
|
666 |
+
<?php
|
667 |
+
$wcml_order_set_currency_nonce = wp_create_nonce( 'set_order_currency' );
|
668 |
+
$wcml_order_delete_items_nonce = wp_create_nonce( 'order_delete_items' );
|
669 |
+
wc_enqueue_js( "
|
670 |
+
jQuery('#dropdown_shop_order_currency').on('change', function(){
|
671 |
+
jQuery.ajax({
|
672 |
+
url: ajaxurl,
|
673 |
+
type: 'post',
|
674 |
+
dataType: 'json',
|
675 |
+
data: {action: 'wcml_order_set_currency', order_id: woocommerce_admin_meta_boxes.post_id, currency: jQuery('#dropdown_shop_order_currency').val(), prev_currency: getCookie('_wcml_order_currency'),wcml_nonce: '".$wcml_order_set_currency_nonce."' },
|
676 |
+
success: function( response ){
|
677 |
+
if(typeof response.error !== 'undefined'){
|
678 |
+
alert(response.error);
|
679 |
+
}else{
|
680 |
+
jQuery.each(response, function(index, value) {
|
681 |
+
var item = jQuery('tr[data-order_item_id = '+index+']');
|
682 |
+
item.attr('data-unit_subtotal',value.line_subtotal);
|
683 |
+
item.attr('data-unit_total',value.line_total);
|
684 |
+
item.find('.view .amount').html(value.display_total);
|
685 |
+
item.find('.line_cost .edit .line_subtotal').val(value.line_subtotal);
|
686 |
+
item.find('.line_cost .edit .line_total').val(value.line_total);
|
687 |
+
});
|
688 |
+
}
|
689 |
+
}
|
690 |
+
})
|
691 |
+
});
|
692 |
+
|
693 |
+
|
694 |
+
jQuery('#dropdown_shop_order_language').on('change', function(){
|
695 |
+
jQuery.ajax({
|
696 |
+
url: ajaxurl,
|
697 |
+
type: 'post',
|
698 |
+
dataType: 'json',
|
699 |
+
data: {action: 'wcml_order_delete_items', order_id: woocommerce_admin_meta_boxes.post_id, wcml_nonce: '".$wcml_order_delete_items_nonce."' },
|
700 |
+
success: function( response ){
|
701 |
+
if(typeof response.error !== 'undefined'){
|
702 |
+
alert(response.error);
|
703 |
+
}else{
|
704 |
+
jQuery('#order_items_list tr.item').each(function(){
|
705 |
+
jQuery(this).remove();
|
706 |
+
});
|
707 |
+
}
|
708 |
+
}
|
709 |
+
})
|
710 |
+
});
|
711 |
+
|
712 |
+
function getCookie(name){
|
713 |
+
var pattern = RegExp(name + '=.[^;]*');
|
714 |
+
matched = document.cookie.match(pattern);
|
715 |
+
if(matched){
|
716 |
+
var cookie = matched[0].split('=');
|
717 |
+
return cookie[1];
|
718 |
+
}
|
719 |
+
return false;
|
720 |
+
}
|
721 |
+
");
|
722 |
+
|
723 |
+
}
|
724 |
+
|
725 |
+
}
|
726 |
+
|
727 |
+
function set_order_currency(){
|
728 |
+
if(!wp_verify_nonce($_REQUEST['wcml_nonce'], 'set_order_currency')){
|
729 |
+
echo json_encode(array('error' => __('Invalid nonce', 'wpml-wcml')));
|
730 |
+
die();
|
731 |
+
}
|
732 |
+
|
733 |
+
setcookie('_wcml_order_currency', $_POST['currency'], time() + 86400, COOKIEPATH, COOKIE_DOMAIN);
|
734 |
+
|
735 |
+
//update order items price
|
736 |
+
if( isset ( $_POST[ 'order_id' ] ) ){
|
737 |
+
global $wpdb;
|
738 |
+
|
739 |
+
$items = $wpdb->get_results( $wpdb->prepare( "SELECT order_item_id FROM {$wpdb->prefix}woocommerce_order_items WHERE order_id = '%d'" , $_POST[ 'order_id' ] ) );
|
740 |
+
|
741 |
+
$return = array();
|
742 |
+
|
743 |
+
foreach($items as $item){
|
744 |
+
$line_subtotal = $this->unconvert_price_amount( wc_get_order_item_meta( $item->order_item_id, '_line_subtotal', true ), $_POST[ 'prev_currency' ]) ;
|
745 |
+
$line_subtotal_tax = $this->unconvert_price_amount( wc_get_order_item_meta( $item->order_item_id, '_line_subtotal_tax', true ), $_POST[ 'prev_currency' ]);
|
746 |
+
$line_total = $this->unconvert_price_amount( wc_get_order_item_meta( $item->order_item_id, '_line_total', true ), $_POST[ 'prev_currency' ]);
|
747 |
+
$line_tax = $this->unconvert_price_amount( wc_get_order_item_meta( $item->order_item_id, '_line_tax', true ), $_POST[ 'prev_currency' ]);
|
748 |
+
|
749 |
+
$line_subtotal = $this->apply_rounding_rules( $this->convert_price_amount( $line_subtotal, $_POST[ 'currency' ] ), $_POST[ 'currency' ] );
|
750 |
+
wc_update_order_item_meta( $item->order_item_id, '_line_subtotal', $line_subtotal );
|
751 |
+
wc_update_order_item_meta( $item->order_item_id, '_line_subtotal_tax', $this->convert_price_amount( $line_subtotal_tax, $_POST[ 'currency' ] ) );
|
752 |
+
$line_total = $this->apply_rounding_rules( $this->convert_price_amount( $line_total, $_POST[ 'currency' ] ), $_POST[ 'currency' ] );
|
753 |
+
wc_update_order_item_meta( $item->order_item_id, '_line_total', $line_total );
|
754 |
+
wc_update_order_item_meta( $item->order_item_id, '_line_tax', $this->convert_price_amount( $line_tax, $_POST[ 'currency' ] ) );
|
755 |
+
|
756 |
+
$return[$item->order_item_id]['line_subtotal'] = $line_subtotal;
|
757 |
+
$return[$item->order_item_id]['line_total'] = $line_total;
|
758 |
+
$return[$item->order_item_id]['display_total'] = $this->apply_currency_position( $line_total, $_POST[ 'currency' ] );
|
759 |
+
|
760 |
+
}
|
761 |
+
|
762 |
+
echo json_encode($return);
|
763 |
+
|
764 |
+
}
|
765 |
+
|
766 |
+
die();
|
767 |
+
}
|
768 |
+
|
769 |
+
function order_delete_items(){
|
770 |
+
if(!wp_verify_nonce($_REQUEST['wcml_nonce'], 'order_delete_items')){
|
771 |
+
echo json_encode(array('error' => __('Invalid nonce', 'wpml-wcml')));
|
772 |
+
die();
|
773 |
+
}
|
774 |
+
|
775 |
+
if( isset ( $_POST[ 'order_id' ] ) ){
|
776 |
+
global $wpdb;
|
777 |
+
|
778 |
+
$items = $wpdb->get_results( $wpdb->prepare( "SELECT order_item_id FROM {$wpdb->prefix}woocommerce_order_items WHERE order_id = '%d'" , $_POST[ 'order_id' ] ) );
|
779 |
+
foreach($items as $item){
|
780 |
+
wc_delete_order_item( absint( $item->order_item_id ) );
|
781 |
+
}
|
782 |
+
}
|
783 |
+
}
|
784 |
+
|
785 |
+
function get_cookie_order_currency(){
|
786 |
+
|
787 |
+
if( isset( $_COOKIE[ '_wcml_order_currency' ] ) ){
|
788 |
+
return $_COOKIE['_wcml_order_currency'] ;
|
789 |
+
}else{
|
790 |
+
return get_option('woocommerce_currency');
|
791 |
+
}
|
792 |
+
|
793 |
+
}
|
794 |
+
|
795 |
+
function process_shop_order_meta( $post_id, $post ){
|
796 |
+
|
797 |
+
if( isset( $_POST['wcml_shop_order_currency'] ) ){
|
798 |
+
update_post_meta( $post_id, '_order_currency', $_POST['wcml_shop_order_currency'] );
|
799 |
+
}
|
800 |
+
|
801 |
+
if( isset( $_POST['wcml_shop_order_language'] ) ){
|
802 |
+
update_post_meta( $post_id, 'wpml_language', $_POST['wcml_shop_order_language'] );
|
803 |
+
}
|
804 |
+
|
805 |
+
}
|
806 |
+
|
807 |
+
function filter_ajax_order_item( $item, $item_id ){
|
808 |
+
if( !get_post_meta( $_POST['order_id'], '_order_currency') ){
|
809 |
+
$item['line_subtotal'] = $this->apply_rounding_rules( $this->convert_price_amount( $item['line_subtotal'], $this->get_cookie_order_currency() ), $this->get_cookie_order_currency() );
|
810 |
+
wc_update_order_item_meta( $item_id, '_line_subtotal', $item['line_subtotal'] );
|
811 |
+
$item['line_subtotal_tax'] = $this->convert_price_amount( $item['line_subtotal_tax'], $this->get_cookie_order_currency() );
|
812 |
+
wc_update_order_item_meta( $item_id, '_line_subtotal_tax', $item['line_subtotal_tax'] );
|
813 |
+
$item['line_total'] = $this->apply_rounding_rules( $this->convert_price_amount( $item['line_total'], $this->get_cookie_order_currency() ), $this->get_cookie_order_currency() );
|
814 |
+
wc_update_order_item_meta( $item_id, '_line_total', $item['line_total'] );
|
815 |
+
$item['line_tax'] = $this->convert_price_amount( $item['line_tax'], $this->get_cookie_order_currency() );
|
816 |
+
wc_update_order_item_meta( $item_id, '_line_tax', $item['line_tax'] );
|
817 |
+
}
|
818 |
+
|
819 |
+
return $item;
|
820 |
+
}
|
821 |
|
822 |
function _set_reports_currency_symbol($currency){
|
823 |
static $no_recur = false;
|
inc/products.class.php
CHANGED
@@ -20,6 +20,7 @@ class WCML_Products{
|
|
20 |
|
21 |
if(is_admin()){
|
22 |
add_action('wp_ajax_wcml_update_product', array($this,'update_product_actions'));
|
|
|
23 |
$this->check_currency_ajax_actions();
|
24 |
|
25 |
add_filter('wpml_post_edit_page_link_to_translation',array($this,'_filter_link_to_translation'));
|
@@ -48,7 +49,7 @@ class WCML_Products{
|
|
48 |
add_action('admin_head', array($this, 'hide_multilingual_content_setup_box'));
|
49 |
|
50 |
add_action('woocommerce_duplicate_product',array($this,'woocommerce_duplicate_product'),10,2);
|
51 |
-
|
52 |
}else{
|
53 |
add_filter('woocommerce_json_search_found_products', array($this, 'filter_found_products_by_language'));
|
54 |
}
|
@@ -111,6 +112,11 @@ class WCML_Products{
|
|
111 |
// Override cached widget id
|
112 |
add_filter('woocommerce_cached_widget_id', array($this, 'override_cached_widget_id'));
|
113 |
|
|
|
|
|
|
|
|
|
|
|
114 |
}
|
115 |
|
116 |
function hide_multilingual_content_setup_box(){
|
@@ -473,6 +479,14 @@ class WCML_Products{
|
|
473 |
$product_trid = $sitepress->get_element_trid($original_product_id, 'post_' . $orig_product->post_type);
|
474 |
$tr_product_id = icl_object_id($original_product_id, 'product', false, $language);
|
475 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
476 |
if (is_null($tr_product_id)) {
|
477 |
|
478 |
//insert new post
|
@@ -549,7 +563,7 @@ class WCML_Products{
|
|
549 |
// synchronize post variations
|
550 |
$this->sync_product_variations($original_product_id, $tr_product_id, $language, $data);
|
551 |
|
552 |
-
$this->
|
553 |
|
554 |
//save images texts
|
555 |
if(isset($data['images'])){
|
@@ -622,7 +636,7 @@ class WCML_Products{
|
|
622 |
//duplicate variations
|
623 |
$this->sync_product_variations($original_product_id,$tr_product_id,$lang);
|
624 |
|
625 |
-
$this->
|
626 |
}
|
627 |
|
628 |
|
@@ -1118,8 +1132,29 @@ class WCML_Products{
|
|
1118 |
}
|
1119 |
}
|
1120 |
|
1121 |
-
function
|
1122 |
global $wpdb;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1123 |
$parent_id = wp_get_post_parent_id($product_id);
|
1124 |
if($this->is_grouped_product($product_id)){
|
1125 |
$grouped_ids = get_posts( 'post_parent=' . $product_id . '&post_type=product&orderby=menu_order&order=ASC&fields=ids&post_status=publish&numberposts=-1' );
|
@@ -1142,7 +1177,7 @@ class WCML_Products{
|
|
1142 |
$tr_parent_id = icl_object_id($parent_id,'product',false,$lang);
|
1143 |
if(!is_null($tr_parent_id)){
|
1144 |
$grouped_ids = maybe_unserialize(get_option('_transient_wc_product_children_ids_'.$tr_parent_id));
|
1145 |
-
if(!in_array($tr_product_id,$grouped_ids)){
|
1146 |
$grouped_ids[] = $tr_product_id;
|
1147 |
update_option('_transient_wc_product_children_ids_'.$tr_parent_id,$grouped_ids);
|
1148 |
}
|
@@ -1189,7 +1224,7 @@ class WCML_Products{
|
|
1189 |
|
1190 |
$default_lang = $sitepress->get_default_language();
|
1191 |
$current_lang = $sitepress->get_current_language();
|
1192 |
-
if($pagenow == 'post-new.php' && isset($_GET['post_type']) && $_GET['post_type']=='product' && $default_lang!=$current_lang){
|
1193 |
add_action('admin_notices', array($this, 'warn_creating_product_in_non_default_lang'));
|
1194 |
}
|
1195 |
|
@@ -1198,7 +1233,7 @@ class WCML_Products{
|
|
1198 |
$prod_lang = $sitepress->get_language_for_element($_GET['post'],'post_product');
|
1199 |
}
|
1200 |
|
1201 |
-
if(!$woocommerce_wpml->settings['trnsl_interface'] && $pagenow == 'post.php' && isset($_GET['post']) && $default_lang
|
1202 |
add_action('admin_notices', array($this, 'inf_editing_product_in_non_default_lang'));
|
1203 |
}
|
1204 |
|
@@ -1522,48 +1557,8 @@ class WCML_Products{
|
|
1522 |
array( 'id' => $post_id )
|
1523 |
);
|
1524 |
|
1525 |
-
|
1526 |
-
$original_product_upsell_ids = get_post_meta($duplicated_post_id, '_upsell_ids', TRUE);
|
1527 |
-
if(!empty($original_product_upsell_ids)){
|
1528 |
-
$unserialized_upsell_ids = maybe_unserialize($original_product_upsell_ids);
|
1529 |
-
|
1530 |
-
foreach($unserialized_upsell_ids as $k => $product_id){
|
1531 |
-
// get the correct language
|
1532 |
-
$upsell_product_translation_id = icl_object_id($product_id, 'product', false, $lang);
|
1533 |
-
|
1534 |
-
if($upsell_product_translation_id){
|
1535 |
-
$unserialized_upsell_ids[$k] = $upsell_product_translation_id;
|
1536 |
-
// if it isn't translated - unset it
|
1537 |
-
} else {
|
1538 |
-
unset($unserialized_upsell_ids[$k]);
|
1539 |
-
}
|
1540 |
-
}
|
1541 |
-
|
1542 |
-
$data = array('meta_value' => maybe_serialize($unserialized_upsell_ids));
|
1543 |
-
$where = array('post_id' => $post_id, 'meta_key' => '_upsell_ids');
|
1544 |
-
$wpdb->update($wpdb->postmeta, $data, $where);
|
1545 |
-
}
|
1546 |
|
1547 |
-
$original_product_crosssell_ids = get_post_meta($duplicated_post_id, '_crosssell_ids', TRUE);
|
1548 |
-
if(!empty($original_product_crosssell_ids)){
|
1549 |
-
$unserialized_crosssell_ids = maybe_unserialize($original_product_crosssell_ids);
|
1550 |
|
1551 |
-
foreach($unserialized_crosssell_ids as $k => $product_id){
|
1552 |
-
// get the correct language
|
1553 |
-
$crosssell_product_translation_id = icl_object_id($product_id, 'product', false, $lang);
|
1554 |
-
|
1555 |
-
if($crosssell_product_translation_id){
|
1556 |
-
$unserialized_crosssell_ids[$k] = $crosssell_product_translation_id;
|
1557 |
-
// if it isn't translated - unset it
|
1558 |
-
} else {
|
1559 |
-
unset($unserialized_crosssell_ids[$k]);
|
1560 |
-
}
|
1561 |
-
}
|
1562 |
-
|
1563 |
-
$data = array('meta_value' => maybe_serialize($unserialized_crosssell_ids));
|
1564 |
-
$where = array('post_id' => $post_id, 'meta_key' => '_crosssell_ids');
|
1565 |
-
$wpdb->update($wpdb->postmeta, $data, $where);
|
1566 |
-
}
|
1567 |
|
1568 |
$this->sync_product_taxonomies($duplicated_post_id,$post_id,$lang);
|
1569 |
|
@@ -1585,8 +1580,8 @@ class WCML_Products{
|
|
1585 |
|
1586 |
|
1587 |
// synchronize post variations
|
1588 |
-
|
1589 |
-
$this->
|
1590 |
}
|
1591 |
|
1592 |
$this->sync_product_variations_custom_prices($duplicated_post_id);
|
@@ -2353,6 +2348,9 @@ class WCML_Products{
|
|
2353 |
* @return type
|
2354 |
*/
|
2355 |
function translate_variation_term_name($term){
|
|
|
|
|
|
|
2356 |
return icl_t('woocommerce', $term .'_attribute_name', $term);
|
2357 |
}
|
2358 |
|
@@ -2386,13 +2384,17 @@ class WCML_Products{
|
|
2386 |
|
2387 |
function remove_language_options(){
|
2388 |
global $WPML_media,$typenow;
|
2389 |
-
if(defined('WPML_MEDIA_VERSION') && $typenow == 'product'){
|
2390 |
-
remove_action('icl_post_languages_options_after',array($WPML_media,'language_options'));
|
2391 |
-
|
2392 |
-
echo '<input name="icl_duplicate_featured_image" type="hidden" value="1" />';
|
2393 |
}
|
2394 |
}
|
2395 |
|
|
|
|
|
|
|
|
|
|
|
2396 |
function icl_pro_translation_completed($tr_product_id) {
|
2397 |
global $sitepress;
|
2398 |
$default_language = $sitepress->get_default_language();
|
@@ -2456,7 +2458,7 @@ class WCML_Products{
|
|
2456 |
|
2457 |
$new_found_products = array();
|
2458 |
foreach($found_products as $post => $formatted_product_name) {
|
2459 |
-
$product_language = $sitepress->get_language_for_element($post, '
|
2460 |
if($product_language == $sitepress->get_default_language()) {
|
2461 |
$new_found_products[$post] = $formatted_product_name;
|
2462 |
}
|
@@ -2601,7 +2603,7 @@ function get_cart_attribute_translation($taxonomy,$attribute,$product_id,$tr_pro
|
|
2601 |
unset($cart_contents['quantity']);
|
2602 |
unset($cart_contents['data']);
|
2603 |
|
2604 |
-
return $cart_contents;
|
2605 |
}
|
2606 |
|
2607 |
function wcml_coupon_loaded($coupons_data){
|
@@ -2719,8 +2721,34 @@ function get_cart_attribute_translation($taxonomy,$attribute,$product_id,$tr_pro
|
|
2719 |
|
2720 |
|
2721 |
function woocommerce_duplicate_product($new_id, $post){
|
2722 |
-
global $sitepress;
|
2723 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2724 |
}
|
2725 |
|
2726 |
function check_currency_ajax_actions(){
|
@@ -2809,4 +2837,75 @@ function get_cart_attribute_translation($taxonomy,$attribute,$product_id,$tr_pro
|
|
2809 |
return $widget_id;
|
2810 |
}
|
2811 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2812 |
}
|
20 |
|
21 |
if(is_admin()){
|
22 |
add_action('wp_ajax_wcml_update_product', array($this,'update_product_actions'));
|
23 |
+
add_action( 'wp_ajax_wcml_product_data', array( $this, 'product_data_html' ) );
|
24 |
$this->check_currency_ajax_actions();
|
25 |
|
26 |
add_filter('wpml_post_edit_page_link_to_translation',array($this,'_filter_link_to_translation'));
|
49 |
add_action('admin_head', array($this, 'hide_multilingual_content_setup_box'));
|
50 |
|
51 |
add_action('woocommerce_duplicate_product',array($this,'woocommerce_duplicate_product'),10,2);
|
52 |
+
|
53 |
}else{
|
54 |
add_filter('woocommerce_json_search_found_products', array($this, 'filter_found_products_by_language'));
|
55 |
}
|
112 |
// Override cached widget id
|
113 |
add_filter('woocommerce_cached_widget_id', array($this, 'override_cached_widget_id'));
|
114 |
|
115 |
+
//update menu_order fro translations after ordering original products
|
116 |
+
add_action('woocommerce_after_product_ordering',array($this,'update_translations_product_ordering'));
|
117 |
+
|
118 |
+
//filter to copy excerpt value
|
119 |
+
add_filter( 'wpml_copy_from_original_custom_fields', array( $this, 'filter_excerpt_field_content_copy' ) );
|
120 |
}
|
121 |
|
122 |
function hide_multilingual_content_setup_box(){
|
479 |
$product_trid = $sitepress->get_element_trid($original_product_id, 'post_' . $orig_product->post_type);
|
480 |
$tr_product_id = icl_object_id($original_product_id, 'product', false, $language);
|
481 |
|
482 |
+
if( get_magic_quotes_gpc() ){
|
483 |
+
foreach( $data as $key => $data_item ){
|
484 |
+
if( !is_array( $data_item ) ){
|
485 |
+
$data[ $key ] = stripslashes( $data_item );
|
486 |
+
}
|
487 |
+
}
|
488 |
+
}
|
489 |
+
|
490 |
if (is_null($tr_product_id)) {
|
491 |
|
492 |
//insert new post
|
563 |
// synchronize post variations
|
564 |
$this->sync_product_variations($original_product_id, $tr_product_id, $language, $data);
|
565 |
|
566 |
+
$this->sync_linked_products($original_product_id, $tr_product_id, $language);
|
567 |
|
568 |
//save images texts
|
569 |
if(isset($data['images'])){
|
636 |
//duplicate variations
|
637 |
$this->sync_product_variations($original_product_id,$tr_product_id,$lang);
|
638 |
|
639 |
+
$this->sync_linked_products($original_product_id,$tr_product_id,$lang);
|
640 |
}
|
641 |
|
642 |
|
1132 |
}
|
1133 |
}
|
1134 |
|
1135 |
+
function sync_linked_products($product_id,$tr_product_id,$lang){
|
1136 |
global $wpdb;
|
1137 |
+
|
1138 |
+
//sync up-sells
|
1139 |
+
$original_up_sells = maybe_unserialize( get_post_meta( $product_id, '_upsell_ids', true ) );
|
1140 |
+
$trnsl_up_sells = array();
|
1141 |
+
if($original_up_sells)
|
1142 |
+
foreach( $original_up_sells as $original_up_sell_product ){
|
1143 |
+
$trnsl_up_sells[] = icl_object_id( $original_up_sell_product, 'post_'.get_post_type( $original_up_sell_product ), false, $lang );
|
1144 |
+
}
|
1145 |
+
|
1146 |
+
update_post_meta( $tr_product_id, '_upsell_ids', $trnsl_up_sells );
|
1147 |
+
|
1148 |
+
//sync cross-sells
|
1149 |
+
$original_cross_sells = maybe_unserialize( get_post_meta( $product_id, '_crosssell_ids', true ) );
|
1150 |
+
$trnsl_cross_sells = array();
|
1151 |
+
if( $original_cross_sells )
|
1152 |
+
foreach( $original_cross_sells as $original_cross_sell_product ){
|
1153 |
+
$trnsl_cross_sells[] = icl_object_id( $original_cross_sell_product, 'post_'.get_post_type( $original_cross_sell_product ), false, $lang );
|
1154 |
+
}
|
1155 |
+
update_post_meta( $tr_product_id, '_crosssell_ids', $trnsl_cross_sells );
|
1156 |
+
|
1157 |
+
//sync grouped products
|
1158 |
$parent_id = wp_get_post_parent_id($product_id);
|
1159 |
if($this->is_grouped_product($product_id)){
|
1160 |
$grouped_ids = get_posts( 'post_parent=' . $product_id . '&post_type=product&orderby=menu_order&order=ASC&fields=ids&post_status=publish&numberposts=-1' );
|
1177 |
$tr_parent_id = icl_object_id($parent_id,'product',false,$lang);
|
1178 |
if(!is_null($tr_parent_id)){
|
1179 |
$grouped_ids = maybe_unserialize(get_option('_transient_wc_product_children_ids_'.$tr_parent_id));
|
1180 |
+
if($grouped_ids && !in_array($tr_product_id,$grouped_ids)){
|
1181 |
$grouped_ids[] = $tr_product_id;
|
1182 |
update_option('_transient_wc_product_children_ids_'.$tr_parent_id,$grouped_ids);
|
1183 |
}
|
1224 |
|
1225 |
$default_lang = $sitepress->get_default_language();
|
1226 |
$current_lang = $sitepress->get_current_language();
|
1227 |
+
if($pagenow == 'post-new.php' && isset($_GET['post_type']) && !isset($_GET['trid']) && $_GET['post_type']=='product' && $default_lang!=$current_lang){
|
1228 |
add_action('admin_notices', array($this, 'warn_creating_product_in_non_default_lang'));
|
1229 |
}
|
1230 |
|
1233 |
$prod_lang = $sitepress->get_language_for_element($_GET['post'],'post_product');
|
1234 |
}
|
1235 |
|
1236 |
+
if(!$woocommerce_wpml->settings['trnsl_interface'] && $pagenow == 'post.php' && isset($_GET['post']) && $default_lang != $prod_lang && get_post_type($_GET['post'])=='product'){
|
1237 |
add_action('admin_notices', array($this, 'inf_editing_product_in_non_default_lang'));
|
1238 |
}
|
1239 |
|
1557 |
array( 'id' => $post_id )
|
1558 |
);
|
1559 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1560 |
|
|
|
|
|
|
|
1561 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1562 |
|
1563 |
$this->sync_product_taxonomies($duplicated_post_id,$post_id,$lang);
|
1564 |
|
1580 |
|
1581 |
|
1582 |
// synchronize post variations
|
1583 |
+
$this->sync_product_variations($duplicated_post_id,$post_id,$lang);
|
1584 |
+
$this->sync_linked_products($duplicated_post_id,$post_id,$lang);
|
1585 |
}
|
1586 |
|
1587 |
$this->sync_product_variations_custom_prices($duplicated_post_id);
|
2348 |
* @return type
|
2349 |
*/
|
2350 |
function translate_variation_term_name($term){
|
2351 |
+
if( term_exists( $term ) ){
|
2352 |
+
return $term;
|
2353 |
+
}
|
2354 |
return icl_t('woocommerce', $term .'_attribute_name', $term);
|
2355 |
}
|
2356 |
|
2384 |
|
2385 |
function remove_language_options(){
|
2386 |
global $WPML_media,$typenow;
|
2387 |
+
if( defined('WPML_MEDIA_VERSION') && $typenow == 'product' ){
|
2388 |
+
remove_action( 'icl_post_languages_options_after', array( $WPML_media, 'language_options' ) );
|
2389 |
+
add_action( 'icl_post_languages_options_after', array( $this, 'media_inputs' ) );
|
|
|
2390 |
}
|
2391 |
}
|
2392 |
|
2393 |
+
function media_inputs(){
|
2394 |
+
echo '<input name="icl_duplicate_attachments" type="hidden" value="1" />';
|
2395 |
+
echo '<input name="icl_duplicate_featured_image" type="hidden" value="1" />';
|
2396 |
+
}
|
2397 |
+
|
2398 |
function icl_pro_translation_completed($tr_product_id) {
|
2399 |
global $sitepress;
|
2400 |
$default_language = $sitepress->get_default_language();
|
2458 |
|
2459 |
$new_found_products = array();
|
2460 |
foreach($found_products as $post => $formatted_product_name) {
|
2461 |
+
$product_language = $sitepress->get_language_for_element($post, 'post_'.get_post_type($post));
|
2462 |
if($product_language == $sitepress->get_default_language()) {
|
2463 |
$new_found_products[$post] = $formatted_product_name;
|
2464 |
}
|
2603 |
unset($cart_contents['quantity']);
|
2604 |
unset($cart_contents['data']);
|
2605 |
|
2606 |
+
return apply_filters( 'wcml_filter_cart_item_data', $cart_contents );
|
2607 |
}
|
2608 |
|
2609 |
function wcml_coupon_loaded($coupons_data){
|
2721 |
|
2722 |
|
2723 |
function woocommerce_duplicate_product($new_id, $post){
|
2724 |
+
global $sitepress,$wpdb;
|
2725 |
+
|
2726 |
+
$sitepress->set_element_language_details( $new_id, 'post_' . $post->post_type, false, $sitepress->get_current_language() );
|
2727 |
+
$new_trid = $sitepress->get_element_trid( $new_id, 'post_' . $post->post_type );
|
2728 |
+
|
2729 |
+
|
2730 |
+
$trid = $sitepress->get_element_trid( $post->ID, 'post_' . $post->post_type );
|
2731 |
+
$translations = $sitepress->get_element_translations( $trid, 'post_' . $post->post_type );
|
2732 |
+
|
2733 |
+
|
2734 |
+
if($translations){
|
2735 |
+
$wc_admin = new WC_Admin_Duplicate_Product();
|
2736 |
+
|
2737 |
+
foreach($translations as $translation){
|
2738 |
+
if($translation->element_id != $post->ID){
|
2739 |
+
$post_to_duplicate = $wpdb->get_row( "SELECT * FROM $wpdb->posts WHERE ID=$translation->element_id" );
|
2740 |
+
|
2741 |
+
if ( ! empty( $post_to_duplicate ) ) {
|
2742 |
+
$new_id = $wc_admin->duplicate_product( $post_to_duplicate );
|
2743 |
+
|
2744 |
+
$sitepress->set_element_language_details( $new_id, 'post_' . $post->post_type, $new_trid, $translation->language_code );
|
2745 |
+
}
|
2746 |
+
}
|
2747 |
+
}
|
2748 |
+
|
2749 |
+
}
|
2750 |
+
|
2751 |
+
|
2752 |
}
|
2753 |
|
2754 |
function check_currency_ajax_actions(){
|
2837 |
return $widget_id;
|
2838 |
}
|
2839 |
|
2840 |
+
|
2841 |
+
//update menu_order fro translations after ordering original products
|
2842 |
+
function update_translations_product_ordering(){
|
2843 |
+
global $wpdb, $sitepress;
|
2844 |
+
|
2845 |
+
$current_language = $sitepress->get_current_language();
|
2846 |
+
|
2847 |
+
if( $current_language == $sitepress->get_default_language() ){
|
2848 |
+
$products = $wpdb->get_results( $wpdb->prepare( "SELECT p.ID, p.menu_order FROM $wpdb->posts AS p LEFT JOIN {$wpdb->prefix}icl_translations AS icl ON icl.element_id = p.id WHERE p.post_type = 'product' AND p.post_status IN ( 'publish', 'future', 'draft', 'pending', 'private' ) AND icl.element_type= 'post_product' AND icl.language_code = %s", $current_language ) );
|
2849 |
+
|
2850 |
+
foreach( $products as $product ){
|
2851 |
+
|
2852 |
+
$trid = $sitepress->get_element_trid ($product->ID, 'post_product' );
|
2853 |
+
$translations = $sitepress->get_element_translations( $trid, 'post_product' );
|
2854 |
+
|
2855 |
+
foreach( $translations as $translation ){
|
2856 |
+
|
2857 |
+
if( $translation->element_id != $product->ID ){
|
2858 |
+
$wpdb->update( $wpdb->posts, array( 'menu_order' => $product->menu_order ), array( 'ID' => $translation->element_id ) );
|
2859 |
+
}
|
2860 |
+
}
|
2861 |
+
|
2862 |
+
}
|
2863 |
+
|
2864 |
+
}
|
2865 |
+
|
2866 |
+
}
|
2867 |
+
|
2868 |
+
|
2869 |
+
function filter_excerpt_field_content_copy( $elements ) {
|
2870 |
+
|
2871 |
+
if ( $elements[ 'post_type' ] == 'product' ) {
|
2872 |
+
$elements[ 'excerpt' ] ['editor_type'] = 'editor';
|
2873 |
+
}
|
2874 |
+
|
2875 |
+
if($_POST[ 'excerpt_type'] == 'rich'){
|
2876 |
+
$elements[ 'excerpt' ] ['value'] = htmlspecialchars_decode(wp_richedit_pre($elements[ 'excerpt' ] ['value']));
|
2877 |
+
}else{
|
2878 |
+
$elements[ 'excerpt' ] ['value'] = htmlspecialchars_decode(wp_htmledit_pre($elements[ 'excerpt' ] ['value']));
|
2879 |
+
}
|
2880 |
+
|
2881 |
+
return $elements;
|
2882 |
+
}
|
2883 |
+
|
2884 |
+
|
2885 |
+
function product_data_html(){
|
2886 |
+
if(!wp_verify_nonce($_REQUEST['wcml_nonce'], 'wcml_product_data')){
|
2887 |
+
echo json_encode(array('error' => __('Invalid nonce', 'wpml-wcml')));
|
2888 |
+
die();
|
2889 |
+
}
|
2890 |
+
global $woocommerce_wpml,$sitepress,$wpdb;
|
2891 |
+
|
2892 |
+
$product = get_post( $_POST['product_id'] );
|
2893 |
+
$default_language = $sitepress->get_default_language();
|
2894 |
+
$active_languages = $sitepress->get_active_languages();
|
2895 |
+
|
2896 |
+
if(ob_get_length()){
|
2897 |
+
ob_clean();
|
2898 |
+
}
|
2899 |
+
ob_start();
|
2900 |
+
$return = array();
|
2901 |
+
|
2902 |
+
include WCML_PLUGIN_PATH . '/menu/sub/product-data.php';
|
2903 |
+
|
2904 |
+
$return['html'] = ob_get_clean();
|
2905 |
+
|
2906 |
+
echo json_encode($return);
|
2907 |
+
|
2908 |
+
die();
|
2909 |
+
}
|
2910 |
+
|
2911 |
}
|
inc/reports.class.php
CHANGED
@@ -49,7 +49,7 @@ class WCML_Reports{
|
|
49 |
$query[ 'where' ] .= " AND order_language.meta_key = 'wpml_language' ";
|
50 |
|
51 |
$query[ 'join' ] .= " LEFT JOIN {$wpdb->prefix}icl_translations translations ON translations.element_id = order_item_meta__product_id.meta_value";
|
52 |
-
$query[ 'where' ] .= " AND translations.element_type
|
53 |
|
54 |
if(!$sparkline_query){
|
55 |
$limit = str_replace('LIMIT ', '', trim($query[ 'limit' ]));
|
@@ -60,8 +60,9 @@ class WCML_Reports{
|
|
60 |
if($sparkline_query){
|
61 |
preg_match("#order_item_meta__product_id\.meta_value = '([0-9]+)'#", $query[ 'where' ], $matches);
|
62 |
$product_id = $matches[1];
|
63 |
-
$
|
64 |
-
$
|
|
|
65 |
$product_ids = array();
|
66 |
foreach($translations as $translation){
|
67 |
$product_ids[] = $translation->element_id;
|
@@ -88,8 +89,9 @@ class WCML_Reports{
|
|
88 |
}
|
89 |
$all_product_ids = array();
|
90 |
foreach($product_ids as $product_id){
|
91 |
-
$
|
92 |
-
$
|
|
|
93 |
foreach($translations as $translation){
|
94 |
$all_product_ids[] = $translation->element_id;
|
95 |
}
|
49 |
$query[ 'where' ] .= " AND order_language.meta_key = 'wpml_language' ";
|
50 |
|
51 |
$query[ 'join' ] .= " LEFT JOIN {$wpdb->prefix}icl_translations translations ON translations.element_id = order_item_meta__product_id.meta_value";
|
52 |
+
$query[ 'where' ] .= " AND translations.element_type IN ('post_product','post_product_variation') ";
|
53 |
|
54 |
if(!$sparkline_query){
|
55 |
$limit = str_replace('LIMIT ', '', trim($query[ 'limit' ]));
|
60 |
if($sparkline_query){
|
61 |
preg_match("#order_item_meta__product_id\.meta_value = '([0-9]+)'#", $query[ 'where' ], $matches);
|
62 |
$product_id = $matches[1];
|
63 |
+
$post_type = get_post_type($product_id);
|
64 |
+
$trid = $sitepress->get_element_trid($product_id, 'post_'.$post_type);
|
65 |
+
$translations = $sitepress->get_element_translations($trid, 'post_'.$post_type, true);
|
66 |
$product_ids = array();
|
67 |
foreach($translations as $translation){
|
68 |
$product_ids[] = $translation->element_id;
|
89 |
}
|
90 |
$all_product_ids = array();
|
91 |
foreach($product_ids as $product_id){
|
92 |
+
$post_type = get_post_type($product_id);
|
93 |
+
$trid = $sitepress->get_element_trid($product_id, 'post_'.$post_type);
|
94 |
+
$translations = $sitepress->get_element_translations($trid, 'post_'.$post_type, true);
|
95 |
foreach($translations as $translation){
|
96 |
$all_product_ids[] = $translation->element_id;
|
97 |
}
|
inc/store-pages.class.php
CHANGED
@@ -5,6 +5,8 @@ class WCML_Store_Pages{
|
|
5 |
function __construct(){
|
6 |
|
7 |
add_action('init', array($this, 'init'));
|
|
|
|
|
8 |
// Translate shop page ids
|
9 |
$this->add_filter_to_get_shop_translated_page_id();
|
10 |
}
|
@@ -16,7 +18,9 @@ class WCML_Store_Pages{
|
|
16 |
add_filter('icl_ls_languages', array($this, 'translate_ls_shop_url'));
|
17 |
add_filter('parse_request', array($this, 'adjust_shop_page'));
|
18 |
}
|
19 |
-
|
|
|
|
|
20 |
if (isset($_POST['create_pages']) && wp_verify_nonce($_POST['wcml_nonce'], 'create_pages')) {
|
21 |
$this->create_missing_store_pages();
|
22 |
}
|
@@ -33,7 +37,51 @@ class WCML_Store_Pages{
|
|
33 |
|
34 |
$this->localize_flat_rates_shipping_classes();
|
35 |
|
36 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
function add_filter_to_get_shop_translated_page_id(){
|
39 |
$woo_pages = array(
|
@@ -155,7 +203,7 @@ class WCML_Store_Pages{
|
|
155 |
* create missing pages
|
156 |
*/
|
157 |
function create_missing_store_pages() {
|
158 |
-
global $sitepress,$wp_rewrite,$woocommerce_wpml;
|
159 |
$miss_lang = $this->get_missing_store_pages();
|
160 |
|
161 |
//dummy array for names
|
@@ -171,36 +219,37 @@ class WCML_Store_Pages{
|
|
171 |
__('View Order','wpml-wcml'),
|
172 |
__('Shop','wpml-wcml'));
|
173 |
|
174 |
-
if ($miss_lang) {
|
175 |
$wp_rewrite = new WP_Rewrite();
|
176 |
$current_language = $sitepress->get_current_language();
|
177 |
-
|
178 |
$check_pages = apply_filters('wcml_wc_installed_pages', array(
|
179 |
'woocommerce_shop_page_id',
|
180 |
'woocommerce_cart_page_id',
|
181 |
'woocommerce_checkout_page_id',
|
182 |
'woocommerce_myaccount_page_id'
|
183 |
));
|
184 |
-
|
185 |
if(in_array($sitepress->get_default_language(), $miss_lang['codes'])){
|
186 |
-
$miss_lang['codes'] = array_merge(array($sitepress->get_default_language()), array_diff($miss_lang['codes'], array($sitepress->get_default_language())));
|
187 |
-
}
|
188 |
-
|
189 |
foreach ($miss_lang['codes'] as $mis_lang) {
|
190 |
$args = array();
|
191 |
|
192 |
foreach ($check_pages as $page) {
|
193 |
-
|
194 |
-
|
195 |
$orig_id = get_option($page);
|
196 |
$trnsl_id = icl_object_id($orig_id, 'page', false, $mis_lang);
|
197 |
|
198 |
if ($orig_id && (is_null($trnsl_id) || get_post_status($trnsl_id) != 'publish')) {
|
199 |
$orig_page = get_post($orig_id);
|
200 |
-
unload_textdomain('
|
201 |
$sitepress->switch_lang($mis_lang);
|
202 |
-
$
|
203 |
-
|
|
|
204 |
$args['post_type'] = $orig_page->post_type;
|
205 |
$args['post_content'] = $orig_page->post_content;
|
206 |
$args['post_excerpt'] = $orig_page->post_excerpt;
|
@@ -215,7 +264,7 @@ class WCML_Store_Pages{
|
|
215 |
if(get_post_status($trnsl_id) == 'trash' && $mis_lang == $sitepress->get_default_language()){
|
216 |
update_option($page, $new_page_id);
|
217 |
}
|
218 |
-
|
219 |
$trid = $sitepress->get_element_trid($orig_id, 'post_' . $orig_page->post_type);
|
220 |
$sitepress->set_element_language_details($new_page_id, 'post_' . $orig_page->post_type, $trid, $mis_lang);
|
221 |
if(!is_null($trnsl_id)){
|
@@ -224,11 +273,11 @@ class WCML_Store_Pages{
|
|
224 |
$sitepress->switch_lang($current_language);
|
225 |
}
|
226 |
}
|
|
|
|
|
|
|
227 |
}
|
228 |
-
|
229 |
-
unload_textdomain('wpml-wcml');
|
230 |
-
$sitepress->switch_lang($current_language);
|
231 |
-
$woocommerce_wpml->load_locale();
|
232 |
wp_redirect(admin_url('admin.php?page=wpml-wcml')); exit;
|
233 |
}
|
234 |
}
|
@@ -330,6 +379,5 @@ class WCML_Store_Pages{
|
|
330 |
}
|
331 |
return $rates;
|
332 |
}
|
333 |
-
|
334 |
|
335 |
}
|
5 |
function __construct(){
|
6 |
|
7 |
add_action('init', array($this, 'init'));
|
8 |
+
add_filter( 'woocommerce_create_pages', array( $this, 'switch_pages_language' ), 9 );
|
9 |
+
add_filter( 'woocommerce_create_pages', array( $this, 'install_pages_action' ), 11 );
|
10 |
// Translate shop page ids
|
11 |
$this->add_filter_to_get_shop_translated_page_id();
|
12 |
}
|
18 |
add_filter('icl_ls_languages', array($this, 'translate_ls_shop_url'));
|
19 |
add_filter('parse_request', array($this, 'adjust_shop_page'));
|
20 |
}
|
21 |
+
|
22 |
+
add_filter( 'woocommerce_create_page_id', array( $this, 'check_store_page_id'), 10 ,3 );
|
23 |
+
|
24 |
if (isset($_POST['create_pages']) && wp_verify_nonce($_POST['wcml_nonce'], 'create_pages')) {
|
25 |
$this->create_missing_store_pages();
|
26 |
}
|
37 |
|
38 |
$this->localize_flat_rates_shipping_classes();
|
39 |
|
40 |
+
}
|
41 |
+
|
42 |
+
function switch_pages_language( $pages ){
|
43 |
+
global $sitepress,$wpdb;
|
44 |
+
|
45 |
+
$sitepress->switch_lang($sitepress->get_default_language());
|
46 |
+
|
47 |
+
return $pages;
|
48 |
+
}
|
49 |
+
|
50 |
+
function install_pages_action( $pages ){
|
51 |
+
global $sitepress,$wpdb;
|
52 |
+
|
53 |
+
foreach( $pages as $key => $page){
|
54 |
+
|
55 |
+
if ( strlen( $page[ 'content' ] ) > 0 ) {
|
56 |
+
// Search for an existing page with the specified page content (typically a shortcode)
|
57 |
+
$page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->posts . " as p LEFT JOIN {$wpdb->prefix}icl_translations AS icl ON icl.element_id = p.id WHERE post_type='page' AND post_content LIKE %s AND icl.element_type = 'post_page' AND icl.language_code = %s LIMIT 1;", "%{$page[ 'content' ]}%", $sitepress->get_default_language() ) );
|
58 |
+
} else {
|
59 |
+
// Search for an existing page with the specified page slug
|
60 |
+
$page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->posts . " as p LEFT JOIN {$wpdb->prefix}icl_translations AS icl ON icl.element_id = p.id WHERE post_type='page' AND post_name = %s AND icl.element_type = 'post_page' AND icl.language_code = %s LIMIT 1;", esc_sql( $page['name'] ), $sitepress->get_default_language() ) );
|
61 |
+
}
|
62 |
+
|
63 |
+
if( !$page_found ){
|
64 |
+
$page_data = array(
|
65 |
+
'post_status' => 'publish',
|
66 |
+
'post_type' => 'page',
|
67 |
+
'post_author' => 1,
|
68 |
+
'post_name' => esc_sql( $page['name'] ),
|
69 |
+
'post_title' => $page['title'],
|
70 |
+
'post_content' => $page['content'],
|
71 |
+
'post_parent' => ! empty( $page['parent'] ) ? wc_get_page_id( $page['parent'] ) : '',
|
72 |
+
'comment_status' => 'closed'
|
73 |
+
);
|
74 |
+
$page_id = wp_insert_post( $page_data );
|
75 |
+
|
76 |
+
if ( 'woocommerce_' . $key . '_page_id' )
|
77 |
+
update_option( 'woocommerce_' . $key . '_page_id', $page_id );
|
78 |
+
}
|
79 |
+
|
80 |
+
unset( $pages[ $key ] );
|
81 |
+
}
|
82 |
+
|
83 |
+
return $pages;
|
84 |
+
}
|
85 |
|
86 |
function add_filter_to_get_shop_translated_page_id(){
|
87 |
$woo_pages = array(
|
203 |
* create missing pages
|
204 |
*/
|
205 |
function create_missing_store_pages() {
|
206 |
+
global $sitepress,$wp_rewrite,$woocommerce_wpml,$woocommerce;
|
207 |
$miss_lang = $this->get_missing_store_pages();
|
208 |
|
209 |
//dummy array for names
|
219 |
__('View Order','wpml-wcml'),
|
220 |
__('Shop','wpml-wcml'));
|
221 |
|
222 |
+
if ($miss_lang) {
|
223 |
$wp_rewrite = new WP_Rewrite();
|
224 |
$current_language = $sitepress->get_current_language();
|
225 |
+
|
226 |
$check_pages = apply_filters('wcml_wc_installed_pages', array(
|
227 |
'woocommerce_shop_page_id',
|
228 |
'woocommerce_cart_page_id',
|
229 |
'woocommerce_checkout_page_id',
|
230 |
'woocommerce_myaccount_page_id'
|
231 |
));
|
232 |
+
|
233 |
if(in_array($sitepress->get_default_language(), $miss_lang['codes'])){
|
234 |
+
$miss_lang['codes'] = array_merge(array($sitepress->get_default_language()), array_diff($miss_lang['codes'], array($sitepress->get_default_language())));
|
235 |
+
}
|
236 |
+
|
237 |
foreach ($miss_lang['codes'] as $mis_lang) {
|
238 |
$args = array();
|
239 |
|
240 |
foreach ($check_pages as $page) {
|
241 |
+
|
242 |
+
|
243 |
$orig_id = get_option($page);
|
244 |
$trnsl_id = icl_object_id($orig_id, 'page', false, $mis_lang);
|
245 |
|
246 |
if ($orig_id && (is_null($trnsl_id) || get_post_status($trnsl_id) != 'publish')) {
|
247 |
$orig_page = get_post($orig_id);
|
248 |
+
unload_textdomain('woocommerce');
|
249 |
$sitepress->switch_lang($mis_lang);
|
250 |
+
$woocommerce->load_plugin_textdomain();
|
251 |
+
|
252 |
+
$args['post_title'] = __($orig_page->post_title, 'woocommerce');
|
253 |
$args['post_type'] = $orig_page->post_type;
|
254 |
$args['post_content'] = $orig_page->post_content;
|
255 |
$args['post_excerpt'] = $orig_page->post_excerpt;
|
264 |
if(get_post_status($trnsl_id) == 'trash' && $mis_lang == $sitepress->get_default_language()){
|
265 |
update_option($page, $new_page_id);
|
266 |
}
|
267 |
+
|
268 |
$trid = $sitepress->get_element_trid($orig_id, 'post_' . $orig_page->post_type);
|
269 |
$sitepress->set_element_language_details($new_page_id, 'post_' . $orig_page->post_type, $trid, $mis_lang);
|
270 |
if(!is_null($trnsl_id)){
|
273 |
$sitepress->switch_lang($current_language);
|
274 |
}
|
275 |
}
|
276 |
+
unload_textdomain('woocommerce');
|
277 |
+
$sitepress->switch_lang($mis_lang);
|
278 |
+
$woocommerce->load_plugin_textdomain();
|
279 |
}
|
280 |
+
|
|
|
|
|
|
|
281 |
wp_redirect(admin_url('admin.php?page=wpml-wcml')); exit;
|
282 |
}
|
283 |
}
|
379 |
}
|
380 |
return $rates;
|
381 |
}
|
|
|
382 |
|
383 |
}
|
inc/terms.class.php
CHANGED
@@ -82,10 +82,10 @@ class WCML_Terms{
|
|
82 |
// force saving in strings language
|
83 |
// covers the case os using the default product category and tag bases and a default language that's not English
|
84 |
$strings_language = $sitepress_settings['st']['strings_language'];
|
85 |
-
if($sitepress->get_current_language() != $strings_language){
|
86 |
-
|
87 |
$permalinks = get_option( 'woocommerce_permalinks' );
|
88 |
-
if(empty($permalinks['category_base'])){
|
89 |
remove_filter('gettext_with_context', array($woocommerce_wpml->strings, 'category_base_in_strings_language'), 99, 3);
|
90 |
$base_translated = _x( 'product-category', 'slug', 'woocommerce' );
|
91 |
add_filter('gettext_with_context', array($woocommerce_wpml->strings, 'category_base_in_strings_language'), 99, 3);
|
@@ -97,7 +97,7 @@ class WCML_Terms{
|
|
97 |
$value = $new_value;
|
98 |
unset($new_value);
|
99 |
}
|
100 |
-
if(empty($permalinks['tag_base'])){
|
101 |
remove_filter('gettext_with_context', array($woocommerce_wpml->strings, 'category_base_in_strings_language'), 99, 3);
|
102 |
$base_translated = _x( 'product-tag', 'slug', 'woocommerce' );
|
103 |
add_filter('gettext_with_context', array($woocommerce_wpml->strings, 'category_base_in_strings_language'), 99, 3);
|
@@ -253,6 +253,9 @@ class WCML_Terms{
|
|
253 |
$current_shop_id = woocommerce_get_page_id( 'shop' );
|
254 |
$default_shop_id = icl_object_id( $current_shop_id, 'page', true, $sitepress->get_default_language() );
|
255 |
|
|
|
|
|
|
|
256 |
$current_slug = get_post( $current_shop_id )->post_name;
|
257 |
$default_slug = get_post( $default_shop_id )->post_name;
|
258 |
|
@@ -262,7 +265,7 @@ class WCML_Terms{
|
|
262 |
foreach( (array) $value as $k => $v ){
|
263 |
|
264 |
if( $current_slug != $default_slug && preg_match( '#^[^/]*/?' . $default_slug . '/page/#', $k ) ){
|
265 |
-
|
266 |
$k = preg_replace( '#^([^/]*)(/?)' . $default_slug . '/#', '$1$2' . $current_slug . '/' , $k );
|
267 |
}
|
268 |
|
@@ -357,7 +360,7 @@ class WCML_Terms{
|
|
357 |
}
|
358 |
|
359 |
if(!empty($base_translated) && $base_translated != $base){
|
360 |
-
|
361 |
$buff = $wp_rewrite->extra_permastructs[$taxonomy]['struct'];
|
362 |
$wp_rewrite->extra_permastructs[$taxonomy]['struct'] = str_replace($base, $base_translated, $wp_rewrite->extra_permastructs[$taxonomy]['struct']);
|
363 |
$no_recursion_flag = true;
|
@@ -457,11 +460,9 @@ class WCML_Terms{
|
|
457 |
if ($terms)foreach ($terms as $term) {
|
458 |
$term_order = get_woocommerce_term_meta($term->term_id,$meta_key);
|
459 |
$trid = $sitepress->get_element_trid($term->term_taxonomy_id,'tax_'.$tax);
|
460 |
-
error_log("trid $trid tt_id {$term->term_taxonomy_id}");
|
461 |
$translations = $sitepress->get_element_translations($trid,'tax_' . $tax);
|
462 |
if ($translations) foreach ($translations as $trans) {
|
463 |
if ($trans->language_code != $lang) {
|
464 |
-
error_log("Updating {$trans->term_id} {$trans->language_code} to $term_order" );
|
465 |
update_woocommerce_term_meta( $trans->term_id, $meta_key, $term_order);
|
466 |
}
|
467 |
}
|
@@ -473,11 +474,9 @@ class WCML_Terms{
|
|
473 |
if ($terms) foreach($terms as $term) {
|
474 |
$term_order = get_woocommerce_term_meta($term->term_id,'order');
|
475 |
$trid = $sitepress->get_element_trid($term->term_taxonomy_id,'tax_product_cat');
|
476 |
-
//error_log("product_cat: trid $trid tt_id {$term->term_taxonomy_id}");
|
477 |
$translations = $sitepress->get_element_translations($trid,'tax_product_cat');
|
478 |
if ($translations) foreach ($translations as $trans) {
|
479 |
if ($trans->language_code != $lang) {
|
480 |
-
error_log("Updating {$trans->term_id} {$trans->language_code} to $term_order" );
|
481 |
update_woocommerce_term_meta( $trans->term_id, 'order', $term_order);
|
482 |
}
|
483 |
}
|
82 |
// force saving in strings language
|
83 |
// covers the case os using the default product category and tag bases and a default language that's not English
|
84 |
$strings_language = $sitepress_settings['st']['strings_language'];
|
85 |
+
if($sitepress->get_current_language() != $strings_language && is_array( $value ) ){
|
86 |
+
|
87 |
$permalinks = get_option( 'woocommerce_permalinks' );
|
88 |
+
if(empty($permalinks['category_base']) && $value){
|
89 |
remove_filter('gettext_with_context', array($woocommerce_wpml->strings, 'category_base_in_strings_language'), 99, 3);
|
90 |
$base_translated = _x( 'product-category', 'slug', 'woocommerce' );
|
91 |
add_filter('gettext_with_context', array($woocommerce_wpml->strings, 'category_base_in_strings_language'), 99, 3);
|
97 |
$value = $new_value;
|
98 |
unset($new_value);
|
99 |
}
|
100 |
+
if(empty($permalinks['tag_base']) && $value){
|
101 |
remove_filter('gettext_with_context', array($woocommerce_wpml->strings, 'category_base_in_strings_language'), 99, 3);
|
102 |
$base_translated = _x( 'product-tag', 'slug', 'woocommerce' );
|
103 |
add_filter('gettext_with_context', array($woocommerce_wpml->strings, 'category_base_in_strings_language'), 99, 3);
|
253 |
$current_shop_id = woocommerce_get_page_id( 'shop' );
|
254 |
$default_shop_id = icl_object_id( $current_shop_id, 'page', true, $sitepress->get_default_language() );
|
255 |
|
256 |
+
if ( is_null( get_post( $current_shop_id ) ) || is_null( get_post( $default_shop_id ) ) )
|
257 |
+
return $value;
|
258 |
+
|
259 |
$current_slug = get_post( $current_shop_id )->post_name;
|
260 |
$default_slug = get_post( $default_shop_id )->post_name;
|
261 |
|
265 |
foreach( (array) $value as $k => $v ){
|
266 |
|
267 |
if( $current_slug != $default_slug && preg_match( '#^[^/]*/?' . $default_slug . '/page/#', $k ) ){
|
268 |
+
|
269 |
$k = preg_replace( '#^([^/]*)(/?)' . $default_slug . '/#', '$1$2' . $current_slug . '/' , $k );
|
270 |
}
|
271 |
|
360 |
}
|
361 |
|
362 |
if(!empty($base_translated) && $base_translated != $base){
|
363 |
+
|
364 |
$buff = $wp_rewrite->extra_permastructs[$taxonomy]['struct'];
|
365 |
$wp_rewrite->extra_permastructs[$taxonomy]['struct'] = str_replace($base, $base_translated, $wp_rewrite->extra_permastructs[$taxonomy]['struct']);
|
366 |
$no_recursion_flag = true;
|
460 |
if ($terms)foreach ($terms as $term) {
|
461 |
$term_order = get_woocommerce_term_meta($term->term_id,$meta_key);
|
462 |
$trid = $sitepress->get_element_trid($term->term_taxonomy_id,'tax_'.$tax);
|
|
|
463 |
$translations = $sitepress->get_element_translations($trid,'tax_' . $tax);
|
464 |
if ($translations) foreach ($translations as $trans) {
|
465 |
if ($trans->language_code != $lang) {
|
|
|
466 |
update_woocommerce_term_meta( $trans->term_id, $meta_key, $term_order);
|
467 |
}
|
468 |
}
|
474 |
if ($terms) foreach($terms as $term) {
|
475 |
$term_order = get_woocommerce_term_meta($term->term_id,'order');
|
476 |
$trid = $sitepress->get_element_trid($term->term_taxonomy_id,'tax_product_cat');
|
|
|
477 |
$translations = $sitepress->get_element_translations($trid,'tax_product_cat');
|
478 |
if ($translations) foreach ($translations as $trans) {
|
479 |
if ($trans->language_code != $lang) {
|
|
|
480 |
update_woocommerce_term_meta( $trans->term_id, 'order', $term_order);
|
481 |
}
|
482 |
}
|
inc/wc-strings.class.php
CHANGED
@@ -65,7 +65,7 @@ class WCML_WC_Strings{
|
|
65 |
}
|
66 |
}
|
67 |
}
|
68 |
-
$name =
|
69 |
$lang = $sitepress->get_current_language();
|
70 |
$trnsl_labels = get_option('wcml_custom_attr_translations');
|
71 |
|
65 |
}
|
66 |
}
|
67 |
}
|
68 |
+
$name = sanitize_title($name);
|
69 |
$lang = $sitepress->get_current_language();
|
70 |
$trnsl_labels = get_option('wcml_custom_attr_translations');
|
71 |
|
menu/sub/product-data.php
ADDED
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$product_id = icl_object_id($product->ID,'product',true,$default_language);
|
3 |
+
$product_images = $woocommerce_wpml->products->product_images_ids($product->ID);
|
4 |
+
$product_contents = $woocommerce_wpml->products->get_product_contents($product_id);
|
5 |
+
$trid = $sitepress->get_element_trid($product_id,'post_'.$product->post_type);
|
6 |
+
$product_translations = $sitepress->get_element_translations($trid,'post_'.$product->post_type,true,true);
|
7 |
+
|
8 |
+
$lang_codes = array();
|
9 |
+
foreach ($active_languages as $language) {
|
10 |
+
if($default_language == $language['code'] || current_user_can('wpml_manage_woocommerce_multilingual') || (wpml_check_user_is_translator($default_language,$language['code']) && !current_user_can('wpml_manage_woocommerce_multilingual')) ){
|
11 |
+
if(!isset($_GET['slang']) || (isset($_GET['slang']) && ($_GET['slang'] == $language['code'] || $default_language == $language['code'] || $_GET['slang'] == 'all')))
|
12 |
+
$lang_codes[$language['code']] = $language['display_name'];
|
13 |
+
}
|
14 |
+
}
|
15 |
+
$default_language_display_name = $lang_codes[$default_language];
|
16 |
+
unset($lang_codes[$default_language]);
|
17 |
+
$lang_codes = array($default_language => $default_language_display_name)+$lang_codes;
|
18 |
+
|
19 |
+
$button_labels = array(
|
20 |
+
'save' => esc_attr__('Save', 'wpml-wcml'),
|
21 |
+
'update' => esc_attr__('Update', 'wpml-wcml'),
|
22 |
+
);
|
23 |
+
?>
|
24 |
+
<tr class="outer" data-prid="<?php echo $product->ID; ?>">
|
25 |
+
<td colspan="3">
|
26 |
+
<div class="wcml_product_row" id="prid_<?php echo $product->ID; ?>" <?php echo isset($pr_edit) ? 'style="display:block;"':''; ?>>
|
27 |
+
<div class="inner">
|
28 |
+
<table class="fixed wcml_products_translation">
|
29 |
+
<thead>
|
30 |
+
<tr>
|
31 |
+
<th scope="col"><?php _e('Language', 'wpml-wcml') ?></th>
|
32 |
+
<?php $product_contents_labels = $woocommerce_wpml->products->get_product_contents_labels($product_id); ?>
|
33 |
+
<?php foreach ($product_contents_labels as $product_content) : ?>
|
34 |
+
<th scope="col"><?php echo $product_content; ?></th>
|
35 |
+
<?php endforeach; ?>
|
36 |
+
<?php
|
37 |
+
$attributes = $woocommerce_wpml->products->get_product_atributes($product_id);
|
38 |
+
foreach($attributes as $key=>$attribute): ?>
|
39 |
+
<?php if(!$attribute['is_taxonomy']): ?>
|
40 |
+
<th scope="col"><?php echo $attribute['name']; ?></th>
|
41 |
+
<?php else: ?>
|
42 |
+
<?php unset($attributes[$key]); ?>
|
43 |
+
<?php endif; ?>
|
44 |
+
<?php endforeach; ?>
|
45 |
+
<?php
|
46 |
+
do_action('wcml_extra_titles',$product_id);
|
47 |
+
?>
|
48 |
+
</tr>
|
49 |
+
</thead>
|
50 |
+
<tbody>
|
51 |
+
<?php foreach ($lang_codes as $key=>$lang) : ?>
|
52 |
+
<?php if($key != $default_language && isset($product_translations[$key])
|
53 |
+
&& get_post_meta($product_translations[$key]->element_id, '_icl_lang_duplicate_of', true) == $product->ID):
|
54 |
+
$is_duplicate_product = true; ?>
|
55 |
+
<tr class="wcml_duplicate_product_notice">
|
56 |
+
<td> </td>
|
57 |
+
<td colspan="<?php echo count($product_contents); ?>">
|
58 |
+
<span class="js-wcml_duplicate_product_notice_<?php echo $key ?>" >
|
59 |
+
<?php printf(__('This product is an exact duplicate of the %s product.', 'wcml-wpml'),
|
60 |
+
$lang_codes[$sitepress->get_default_language()]); ?>
|
61 |
+
<a href="#edit-<?php echo $product_id ?>_<?php echo $key ?>"><?php _e('Edit independently.', 'wpml-wcml') ?></a>
|
62 |
+
</span>
|
63 |
+
<span class="js-wcml_duplicate_product_undo_<?php echo $key ?>" style="display: none;" >
|
64 |
+
<a href="#undo-<?php echo $product_id ?>_<?php echo $key ?>"><?php _e('Undo (keep this product as a duplicate)', 'wpml-wcml') ?></a>
|
65 |
+
</span>
|
66 |
+
</td>
|
67 |
+
</tr>
|
68 |
+
<?php else: $is_duplicate_product = false; ?>
|
69 |
+
<?php endif; ?>
|
70 |
+
<tr rel="<?php echo $key; ?>">
|
71 |
+
<td>
|
72 |
+
<?php echo $lang; ?>
|
73 |
+
<?php if($default_language == $key){ ?>
|
74 |
+
<a class="edit-translation-link" title="<?php __("edit product", "wpml-wcml") ?>" href="<?php echo get_edit_post_link($product_id); ?>"><i class="icon-edit"></i></a>
|
75 |
+
<?php }else{ ?>
|
76 |
+
<input type="hidden" class="icl_language" value="<?php echo $key ?>" />
|
77 |
+
<input type="hidden" name="end_duplication[<?php echo $product_id ?>][<?php echo $key ?>]" value="<?php echo !intval($is_duplicate_product) ?>" />
|
78 |
+
<?php $button_label = isset($product_translations[$key]) ? $button_labels['update'] : $button_labels['save'] ;?>
|
79 |
+
<input type="submit" name="product#<?php echo $product_id ?>#<?php echo $key ?>" disabled value="<?php echo $button_label ?>" class="button-secondary wcml_update">
|
80 |
+
<span class="wcml_spinner spinner"></span>
|
81 |
+
<?php } ?>
|
82 |
+
</td>
|
83 |
+
<?php
|
84 |
+
if(isset($product_translations[$key])){
|
85 |
+
$tr_status = $wpdb->get_row($wpdb->prepare("SELECT status,translator_id FROM ". $wpdb->prefix ."icl_translation_status WHERE translation_id = %d",$product_translations[$key]->translation_id));
|
86 |
+
if(!is_null($tr_status) && get_current_user_id() != $tr_status->translator_id){
|
87 |
+
if($tr_status->status == ICL_TM_IN_PROGRESS){ ?>
|
88 |
+
<td><?php _e('Translation in progress', 'wpml-wcml'); ?><br> </td>
|
89 |
+
<?php continue;
|
90 |
+
}elseif($tr_status->status == ICL_TM_WAITING_FOR_TRANSLATOR){ ?>
|
91 |
+
<td><?php _e('Waiting for translator', 'wpml-wcml'); ?><br> </td>
|
92 |
+
<?php continue;
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
foreach ($product_contents as $product_content) : ?>
|
98 |
+
<td>
|
99 |
+
<?php
|
100 |
+
|
101 |
+
$trn_contents = $woocommerce_wpml->products->get_product_content_translation($product_id,$product_content,$key);
|
102 |
+
|
103 |
+
$missing_translation = false;
|
104 |
+
if($default_language == $key){
|
105 |
+
$product_fields_values[$product_content] = $trn_contents;
|
106 |
+
}else{
|
107 |
+
if(isset($product_fields_values[$product_content]) &&
|
108 |
+
!empty($product_fields_values[$product_content]) &&
|
109 |
+
empty($trn_contents)
|
110 |
+
){
|
111 |
+
$missing_translation = true;
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
if(!$woocommerce_wpml->products->check_custom_field_is_single_value($product_id,$product_content)){
|
116 |
+
echo $woocommerce_wpml->products->custom_box($product_id,$product_content,$trn_contents,$key,$lang,$is_duplicate_product);
|
117 |
+
}else if(is_array($trn_contents)): ?>
|
118 |
+
<?php if(in_array($product_content, array('_file_paths'))): ?>
|
119 |
+
<?php
|
120 |
+
$file_paths = '';
|
121 |
+
foreach($trn_contents as $trn_content){
|
122 |
+
$file_paths = $file_paths ? $file_paths . "\n" .$trn_content : $trn_content;
|
123 |
+
} ?>
|
124 |
+
<?php if($default_language == $key): ?>
|
125 |
+
<textarea value="<?php echo $file_paths; ?>" disabled="disabled"><?php echo $file_paths; ?></textarea>
|
126 |
+
<?php else: ?>
|
127 |
+
<textarea value="<?php echo $file_paths; ?>" name='<?php echo $product_content.'_'.$key ?>' class="wcml_file_paths_textarea<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>><?php echo $file_paths; ?></textarea>
|
128 |
+
<button type="button" class="button-secondary wcml_file_paths<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>><?php _e('Choose a file', 'wpml-wcml') ?></button>
|
129 |
+
<?php endif;?>
|
130 |
+
<?php else: ?>
|
131 |
+
<?php foreach ($trn_contents as $tax_key=>$trn_content) : ?>
|
132 |
+
<?php if($default_language == $key): ?>
|
133 |
+
<textarea rows="1" disabled="disabled"><?php echo $trn_content; ?></textarea>
|
134 |
+
<?php else: ?>
|
135 |
+
<input class="<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" type="text" name="<?php echo $product_content.'_'.$key.'['.$tax_key.']'; ?>" value="<?php echo $trn_content ?>" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> /><br>
|
136 |
+
<?php endif;?>
|
137 |
+
<?php endforeach; ?>
|
138 |
+
<?php endif; ?>
|
139 |
+
<?php elseif(in_array($product_content,array('content','excerpt'))): ?>
|
140 |
+
<?php if($default_language == $key): ?>
|
141 |
+
<button type="button" class="button-secondary wcml_edit_conten"><?php _e('Show content', 'wpml-wcml') ?></button>
|
142 |
+
<?php else: ?>
|
143 |
+
<button type="button" class="button-secondary wcml_edit_conten<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>><?php _e('Edit translation', 'wpml-wcml') ?></button>
|
144 |
+
<?php if($missing_translation): ?>
|
145 |
+
<span class="wcml_field_translation_<?php echo $product_content ?>_<?php echo $key ?>">
|
146 |
+
<p class="missing-translation">
|
147 |
+
<i class="icon-warning-sign"></i>
|
148 |
+
<?php _e('Translation missing', 'wpml-wcml'); ?>
|
149 |
+
</p>
|
150 |
+
</span>
|
151 |
+
<?php endif; ?>
|
152 |
+
<?php endif;?>
|
153 |
+
<div class="wcml_editor">
|
154 |
+
<a class="media-modal-close wcml_close_cross" href="javascript:void(0);" title="<?php esc_attr_e('Close', 'wpml-wcml') ?>"><span class="media-modal-icon"></span></a>
|
155 |
+
<div class="wcml_editor_original">
|
156 |
+
<h3><?php _e('Original content:', 'wpml-wcml') ?></h3>
|
157 |
+
<?php
|
158 |
+
if($product_content == 'content'){
|
159 |
+
$original_content = apply_filters('the_content', $product->post_content);
|
160 |
+
}else{
|
161 |
+
$original_content = apply_filters('the_content', $product->post_excerpt);
|
162 |
+
}
|
163 |
+
?>
|
164 |
+
<textarea class="wcml_original_content"><?php echo $original_content; ?></textarea>
|
165 |
+
|
166 |
+
</div>
|
167 |
+
<div class="wcml_line"></div>
|
168 |
+
<div class="wcml_editor_translation">
|
169 |
+
<?php if($default_language != $key): ?>
|
170 |
+
<?php
|
171 |
+
$tr_id = icl_object_id($product_id, 'product', true, $key);
|
172 |
+
if(!$woocommerce_wpml->settings['first_editor_call']):
|
173 |
+
wp_editor($trn_contents, 'wcmleditor'.$product_content.$tr_id.$key, array('textarea_name'=>$product_content .'_'.$key,'textarea_rows'=>20,'editor_class'=>'wcml_content_tr')); ?>
|
174 |
+
<?php else: ?>
|
175 |
+
<div id="wp-wcmleditor<?php echo $product_content.$tr_id.$key ?>-wrap" class="wp-core-ui wp-editor-wrap">
|
176 |
+
<div id="wp-wcml<?php echo $product_content.$tr_id.$key ?>-editor-tools" class="wp-editor-tools hide-if-no-js">
|
177 |
+
<div id="wp-wcmleditor<?php echo $product_content.$tr_id.$key ?>-media-buttons" class="wp-media-buttons">
|
178 |
+
<a href="#" id="insert-media-button" class="button insert-media add_media" data-editor="wcmleditor<?php echo $product_content.$tr_id.$key ?>" title="<?php _e('Add Media'); ?>">
|
179 |
+
<span class="wp-media-buttons-icon"></span>
|
180 |
+
<?php _e('Add Media'); ?>
|
181 |
+
</a>
|
182 |
+
</div>
|
183 |
+
<div class="wp-editor-tabs">
|
184 |
+
<a id="wcmleditor<?php echo $product_content.$tr_id.$key ?>-html" class="wp-switch-editor switch-html" ><?php _e('Text'); ?></a>
|
185 |
+
<a id="wcmleditor<?php echo $product_content.$tr_id.$key ?>-tmce" class="wp-switch-editor switch-tmce" ><?php _e('Visual'); ?></a>
|
186 |
+
</div>
|
187 |
+
</div>
|
188 |
+
<div id="wp-wcmleditor<?php echo $product_content.$tr_id.$key ?>-editor-container" class="wp-editor-container">
|
189 |
+
<textarea class="wcml_content_tr wp-editor-area" rows="20" autocomplete="off" cols="40" name="<?php echo $product_content .'_'.$key; ?>" id="wcmleditor<?php echo $product_content.$tr_id.$key ?>" aria-hidden="true"><?php echo $trn_contents ?></textarea>
|
190 |
+
</div>
|
191 |
+
</div>
|
192 |
+
<?php endif; ?>
|
193 |
+
|
194 |
+
<?php endif; ?>
|
195 |
+
</div>
|
196 |
+
<div class="wcml_editor_buttons">
|
197 |
+
<?php if($default_language == $key): ?>
|
198 |
+
<button type="button" class="button-secondary wcml_popup_close"><?php _e('Close', 'wpml-wcml') ?></button>
|
199 |
+
<?php else: ?>
|
200 |
+
<h3><?php printf(__('%s translation', 'wpml-wcml'),$lang); ?></h3>
|
201 |
+
<button type="button" class="button-secondary wcml_popup_cancel"><?php _e('Cancel', 'wpml-wcml') ?></button>
|
202 |
+
<button type="button" class="button-secondary wcml_popup_ok"><?php _e('Ok', 'wpml-wcml') ?></button>
|
203 |
+
<?php endif; ?>
|
204 |
+
</div>
|
205 |
+
</div>
|
206 |
+
<?php elseif(in_array($product_content,array('images'))):
|
207 |
+
echo $woocommerce_wpml->products->product_images_box($product_id,$key,$is_duplicate_product); ?>
|
208 |
+
<?php elseif(in_array($product_content,array('variations'))):
|
209 |
+
echo $woocommerce_wpml->products->product_variations_box($product_id,$key,$is_duplicate_product); ?>
|
210 |
+
<?php elseif($product_content == '_file_paths'): ?>
|
211 |
+
<textarea placeholder="<?php esc_attr_e('Upload file', 'wpml-wcml') ?>" value="" name='<?php echo $product_content.'_'.$key ?>' class="wcml_file_paths_textarea<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>></textarea>
|
212 |
+
<button type="button" class="button-secondary wcml_file_paths<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>><?php _e('Choose a file', 'wpml-wcml') ?></button>
|
213 |
+
<?php else: ?>
|
214 |
+
<?php if($default_language == $key): ?>
|
215 |
+
<textarea rows="1" disabled="disabled"><?php echo $trn_contents; ?></textarea><br>
|
216 |
+
<?php elseif(in_array($product_content,array('_purchase_note'))): ?>
|
217 |
+
<textarea class="<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" name="<?php echo $product_content.'_'.$key; ?>" rows="2" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> ><?php echo $trn_contents; ?></textarea>
|
218 |
+
<?php else: ?>
|
219 |
+
<input class="<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" type="text" name="<?php echo $product_content.'_'.$key; ?>" value="<?php echo $trn_contents; ?>" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> /><br>
|
220 |
+
<?php endif;?>
|
221 |
+
<?php endif; ?>
|
222 |
+
</td>
|
223 |
+
<?php endforeach; ?>
|
224 |
+
<?php do_action('wcml_gui_additional_box',$product_id,$key,$is_duplicate_product); ?>
|
225 |
+
<?php
|
226 |
+
foreach ($attributes as $attr_key=>$attribute): ?>
|
227 |
+
<td>
|
228 |
+
<?php $trn_attribute = $woocommerce_wpml->products->get_custom_attribute_translation($product_id, $attr_key, $attribute, $key); ?>
|
229 |
+
<label class="custom_attr_label"><?php _e('name','wpml-wcml'); ?></label>
|
230 |
+
<br>
|
231 |
+
<?php if (!$trn_attribute): ?>
|
232 |
+
<input type="text" name="<?php echo $attr_key . '_name_' . $key ; ?>" value="" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> />
|
233 |
+
<?php else: ?>
|
234 |
+
<?php if($default_language == $key): ?>
|
235 |
+
<textarea rows="1" disabled="disabled"><?php echo $trn_attribute['name']; ?></textarea>
|
236 |
+
<?php else: ?>
|
237 |
+
<input class="<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" type="text" name="<?php echo $attr_key . '_name_' . $key; ?>" value="<?php echo $trn_attribute['name']; ?>" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>" <?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> />
|
238 |
+
<?php endif;?>
|
239 |
+
<?php endif;?>
|
240 |
+
<br>
|
241 |
+
<label class="custom_attr_label"><?php _e('values','wpml-wcml'); ?></label>
|
242 |
+
<br>
|
243 |
+
<?php if (!$trn_attribute): ?>
|
244 |
+
<input class="<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" type="text" name="<?php echo $attr_key . '_' . $key ; ?>" value="" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>" <?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>/>
|
245 |
+
<?php else: ?>
|
246 |
+
<?php if($default_language == $key): ?>
|
247 |
+
<textarea rows="1" disabled="disabled"><?php echo $trn_attribute['value']; ?></textarea>
|
248 |
+
<?php else: ?>
|
249 |
+
<input class="<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" type="text" name="<?php echo $attr_key . '_' . $key; ?>" value="<?php echo $trn_attribute['value']; ?>" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>" <?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> />
|
250 |
+
<?php endif; ?>
|
251 |
+
<?php endif; ?>
|
252 |
+
</td>
|
253 |
+
<?php endforeach; ?>
|
254 |
+
</tr>
|
255 |
+
<?php endforeach; ?>
|
256 |
+
</tbody>
|
257 |
+
</table>
|
258 |
+
</div>
|
259 |
+
</div>
|
260 |
+
</td>
|
261 |
+
<?php
|
262 |
+
|
263 |
+
if(!$woocommerce_wpml->settings['first_editor_call']){
|
264 |
+
//load editor js
|
265 |
+
_WP_Editors::editor_js();
|
266 |
+
$woocommerce_wpml->settings['first_editor_call'] = true;
|
267 |
+
$woocommerce_wpml->update_settings();
|
268 |
+
}
|
269 |
+
|
270 |
+
?>
|
271 |
+
</tr>
|
menu/sub/products.php
CHANGED
@@ -33,386 +33,158 @@ $button_labels = array(
|
|
33 |
'save' => esc_attr__('Save', 'wpml-wcml'),
|
34 |
'update' => esc_attr__('Update', 'wpml-wcml'),
|
35 |
);
|
|
|
|
|
|
|
36 |
?>
|
37 |
<h3><?php _e('WooCommerce Products','wpml-wcml'); ?></h3>
|
38 |
<span style="display:none" id="wcml_product_update_button_label"><?php echo $button_labels['update'] ?></span>
|
39 |
<form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
<?php
|
44 |
-
$product_categories = get_terms('product_cat',array('hide_empty' => 0));
|
45 |
-
foreach ($product_categories as $category) {
|
46 |
-
$selected = (isset($_GET['cat']) && $_GET['cat'] == $category->term_taxonomy_id)?'selected="selected"':'';
|
47 |
-
echo '<option value="'.$category->term_taxonomy_id.'" '.$selected.'>'.$category->name.'</option>';
|
48 |
-
}
|
49 |
-
?>
|
50 |
-
</select>
|
51 |
-
<select class="wcml_translation_status">
|
52 |
-
<option value="all"><?php _e('All products', 'wpml-wcml'); ?></option>
|
53 |
-
<option value="not" <?php echo (isset($_GET['trst']) && $_GET['trst']=='not')?'selected="selected"':''; ?>><?php _e('Not translated or needs updating', 'wpml-wcml'); ?></option>
|
54 |
-
<option value="need_update" <?php echo (isset($_GET['trst']) && $_GET['trst']=='need_update')?'selected="selected"':''; ?>><?php _e('Needs updating', 'wpml-wcml'); ?></option>
|
55 |
-
<option value="in_progress" <?php echo (isset($_GET['trst']) && $_GET['trst']=='in_progress')?'selected="selected"':''; ?>><?php _e('Translation in progress', 'wpml-wcml'); ?></option>
|
56 |
-
<option value="complete" <?php echo (isset($_GET['trst']) && $_GET['trst']=='complete')?'selected="selected"':''; ?>><?php _e('Translation complete', 'wpml-wcml'); ?></option>
|
57 |
-
</select>
|
58 |
-
|
59 |
<?php
|
60 |
-
$
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
?>
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
<
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
<div class="wcml_product_pagination">
|
95 |
-
<span class="displaying-num"><?php printf(__('%d products', 'wpml-wcml'), $products_count); ?></span>
|
96 |
-
<?php if(!isset($_GET['prid']) && isset($last) && $last > 1): ?>
|
97 |
-
<a class="first-page <?php echo $pn==1?'disabled':''; ?>" href="<?php echo $pagination_url; ?>1" title="<?php _e('Go to the first page', 'wpml-wcml'); ?>">«</a>
|
98 |
-
<a class="prev-page <?php echo $pn==1?'disabled':''; ?>" href="<?php echo $pagination_url.((int)$pn > 1?$pn - 1:$pn); ?>" title="<?php _e('Go to the previous page', 'wpml-wcml'); ?>">‹</a>
|
99 |
-
<input type="text" class="current-page wcml_pagin" value="<?php echo $pn;?>" size="1"/> <span><?php _e('of', 'wpml-wcml'); ?> <?php echo $last; ?><span>
|
100 |
-
<a class="next-page <?php echo $pn==$last?'disabled':''; ?>" href="<?php echo $pagination_url.((int)$pn<$last?$pn + 1:$last); ?>" title="<?php _e('Go to the next page', 'wpml-wcml'); ?>">›</a>
|
101 |
-
<a class="last-page <?php echo $pn==$last?'disabled':''; ?>" href="<?php echo $pagination_url.$last; ?>" title="<?php _e('Go to the last page', 'wpml-wcml'); ?>">»</a>
|
102 |
-
<?php endif; ?>
|
103 |
-
<?php if(isset($_GET['prid']) || ($lm && isset($last)) && $last > 1): ?>
|
104 |
-
<a href="<?php echo $pagination_url; ?>1"><?php _e('Show all products', 'wpml-wcml'); ?></a>
|
105 |
-
<?php endif; ?>
|
106 |
-
</div>
|
107 |
<?php endif; ?>
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
}
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
$
|
137 |
-
|
138 |
-
|
139 |
-
$
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
$icon_class_sufix = $prod->product_type;
|
150 |
-
if ( $prod -> is_virtual() ) {
|
151 |
-
$icon_class_sufix = 'virtual';
|
152 |
-
}
|
153 |
-
else if ( $prod -> is_downloadable() ) {
|
154 |
-
$icon_class_sufix = 'downloadable';
|
155 |
-
}
|
156 |
-
?>
|
157 |
-
<i class="icon-woo-<?php echo $icon_class_sufix; ?><?php echo ($product->post_parent != 0 && !$search) ? ' children_icon' : ''; ?>" title="<?php echo $icon_class_sufix; ?>"></i>
|
158 |
-
</td>
|
159 |
-
<td>
|
160 |
-
<?php echo $product->post_parent != 0 ? '— ' : ''; ?>
|
161 |
-
<?php echo $product->post_title;
|
162 |
-
if($product->post_status == 'draft' && ((isset($_GET['st']) && $_GET['st'] != 'draft') || !isset($_GET['st']))): ?>
|
163 |
-
<span class="wcml_product_status_text"><?php _e(' (draft)','wpml-wcml'); ?></span>
|
164 |
-
<?php endif; ?>
|
165 |
-
<?php if ($search && $product->post_parent != 0): ?>
|
166 |
-
<span class="prod_parent_text"><?php printf(__(' | Parent product: %s','wpml-wcml'),get_the_title($product->post_parent)); ?><span>
|
167 |
-
<?php endif; ?>
|
168 |
-
</td>
|
169 |
-
<td>
|
170 |
-
<div class="translations_statuses prid_<?php echo $product->ID; ?>">
|
171 |
-
<?php echo $woocommerce_wpml->products->get_translation_statuses($product_translations,$active_languages,$default_language,isset($_GET['slang']) && $_GET['slang'] != "all" ?$_GET['slang']:false); ?>
|
172 |
-
</div>
|
173 |
-
<a href="#prid_<?php echo $product->ID; ?>" id="wcml_details_<?php echo $product->ID; ?>" class="wcml_details" data-text-opened="<?php _e('Close', 'wpml-wcml') ?>" data-text-closed="<?php _e('Edit translation', 'wpml-wcml') ?>"><?php _e('Edit translation', 'wpml-wcml') ?></a>
|
174 |
-
</td>
|
175 |
-
</tr>
|
176 |
-
<tr class="outer" data-prid="<?php echo $product->ID; ?>">
|
177 |
-
<td colspan="4">
|
178 |
-
<div class="wcml_product_row" id="prid_<?php echo $product->ID; ?>" <?php echo isset($pr_edit) ? 'style="display:block;"':''; ?>>
|
179 |
-
<div class="inner">
|
180 |
-
<table class="fixed wcml_products_translation">
|
181 |
-
<thead>
|
182 |
-
<tr>
|
183 |
-
<th scope="col"><?php _e('Language', 'wpml-wcml') ?></th>
|
184 |
-
<?php $product_contents_labels = $woocommerce_wpml->products->get_product_contents_labels($product_id); ?>
|
185 |
-
<?php foreach ($product_contents_labels as $product_content) : ?>
|
186 |
-
<th scope="col"><?php echo $product_content; ?></th>
|
187 |
-
<?php endforeach; ?>
|
188 |
-
<?php
|
189 |
-
$attributes = $woocommerce_wpml->products->get_product_atributes($product_id);
|
190 |
-
foreach($attributes as $key=>$attribute): ?>
|
191 |
-
<?php if(!$attribute['is_taxonomy']): ?>
|
192 |
-
<th scope="col"><?php echo $attribute['name']; ?></th>
|
193 |
-
<?php else: ?>
|
194 |
-
<?php unset($attributes[$key]); ?>
|
195 |
-
<?php endif; ?>
|
196 |
-
<?php endforeach; ?>
|
197 |
-
<?php
|
198 |
-
do_action('wcml_extra_titles',$product_id);
|
199 |
-
?>
|
200 |
-
</tr>
|
201 |
-
</thead>
|
202 |
-
<tbody>
|
203 |
-
<?php foreach ($lang_codes as $key=>$lang) : ?>
|
204 |
-
<?php if($key != $default_language && isset($product_translations[$key])
|
205 |
-
&& get_post_meta($product_translations[$key]->element_id, '_icl_lang_duplicate_of', true) == $product->ID):
|
206 |
-
$is_duplicate_product = true; ?>
|
207 |
-
<tr class="wcml_duplicate_product_notice">
|
208 |
-
<td> </td>
|
209 |
-
<td colspan="<?php echo count($product_contents); ?>">
|
210 |
-
<span class="js-wcml_duplicate_product_notice_<?php echo $key ?>" >
|
211 |
-
<?php printf(__('This product is an exact duplicate of the %s product.', 'wcml-wpml'),
|
212 |
-
$lang_codes[$sitepress->get_default_language()]); ?>
|
213 |
-
<a href="#edit-<?php echo $product_id ?>_<?php echo $key ?>"><?php _e('Edit independently.', 'wpml-wcml') ?></a>
|
214 |
-
</span>
|
215 |
-
<span class="js-wcml_duplicate_product_undo_<?php echo $key ?>" style="display: none;" >
|
216 |
-
<a href="#undo-<?php echo $product_id ?>_<?php echo $key ?>"><?php _e('Undo (keep this product as a duplicate)', 'wpml-wcml') ?></a>
|
217 |
-
</span>
|
218 |
-
</td>
|
219 |
-
</tr>
|
220 |
-
<?php else: $is_duplicate_product = false; ?>
|
221 |
-
<?php endif; ?>
|
222 |
-
<tr rel="<?php echo $key; ?>">
|
223 |
-
<td>
|
224 |
-
<?php echo $lang; ?>
|
225 |
-
<?php if($default_language == $key){ ?>
|
226 |
-
<a class="edit-translation-link" title="<?php __("edit product", "wpml-wcml") ?>" href="<?php echo get_edit_post_link($product_id); ?>"><i class="icon-edit"></i></a>
|
227 |
-
<?php }else{ ?>
|
228 |
-
<input type="hidden" class="icl_language" value="<?php echo $key ?>" />
|
229 |
-
<input type="hidden" name="end_duplication[<?php echo $product_id ?>][<?php echo $key ?>]" value="<?php echo !intval($is_duplicate_product) ?>" />
|
230 |
-
<?php $button_label = isset($product_translations[$key]) ? $button_labels['update'] : $button_labels['save'] ;?>
|
231 |
-
<input type="submit" name="product#<?php echo $product_id ?>#<?php echo $key ?>" disabled value="<?php echo $button_label ?>" class="button-secondary wcml_update">
|
232 |
-
<span class="wcml_spinner spinner"></span>
|
233 |
-
<?php } ?>
|
234 |
-
</td>
|
235 |
-
<?php
|
236 |
-
if(isset($product_translations[$key])){
|
237 |
-
$tr_status = $wpdb->get_row($wpdb->prepare("SELECT status,translator_id FROM ". $wpdb->prefix ."icl_translation_status WHERE translation_id = %d",$product_translations[$key]->translation_id));
|
238 |
-
if(!is_null($tr_status) && get_current_user_id() != $tr_status->translator_id){
|
239 |
-
if($tr_status->status == ICL_TM_IN_PROGRESS){ ?>
|
240 |
-
<td><?php _e('Translation in progress', 'wpml-wcml'); ?><br> </td>
|
241 |
-
<?php continue;
|
242 |
-
}elseif($tr_status->status == ICL_TM_WAITING_FOR_TRANSLATOR){ ?>
|
243 |
-
<td><?php _e('Waiting for translator', 'wpml-wcml'); ?><br> </td>
|
244 |
-
<?php continue;
|
245 |
-
}
|
246 |
-
}
|
247 |
-
}
|
248 |
-
|
249 |
-
foreach ($product_contents as $product_content) : ?>
|
250 |
-
<td>
|
251 |
-
<?php
|
252 |
-
|
253 |
-
$trn_contents = $woocommerce_wpml->products->get_product_content_translation($product_id,$product_content,$key);
|
254 |
-
|
255 |
-
$missing_translation = false;
|
256 |
-
if($default_language == $key){
|
257 |
-
$product_fields_values[$product_content] = $trn_contents;
|
258 |
-
}else{
|
259 |
-
if(isset($product_fields_values[$product_content]) &&
|
260 |
-
!empty($product_fields_values[$product_content]) &&
|
261 |
-
empty($trn_contents)
|
262 |
-
){
|
263 |
-
$missing_translation = true;
|
264 |
-
}
|
265 |
-
}
|
266 |
-
|
267 |
-
if(!$woocommerce_wpml->products->check_custom_field_is_single_value($product_id,$product_content)){
|
268 |
-
echo $woocommerce_wpml->products->custom_box($product_id,$product_content,$trn_contents,$key,$lang,$is_duplicate_product);
|
269 |
-
}else if(is_array($trn_contents)): ?>
|
270 |
-
<?php if(in_array($product_content, array('_file_paths'))): ?>
|
271 |
-
<?php
|
272 |
-
$file_paths = '';
|
273 |
-
foreach($trn_contents as $trn_content){
|
274 |
-
$file_paths = $file_paths ? $file_paths . "\n" .$trn_content : $trn_content;
|
275 |
-
} ?>
|
276 |
-
<?php if($default_language == $key): ?>
|
277 |
-
<textarea value="<?php echo $file_paths; ?>" disabled="disabled"><?php echo $file_paths; ?></textarea>
|
278 |
-
<?php else: ?>
|
279 |
-
<textarea value="<?php echo $file_paths; ?>" name='<?php echo $product_content.'_'.$key ?>' class="wcml_file_paths_textarea<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>><?php echo $file_paths; ?></textarea>
|
280 |
-
<button type="button" class="button-secondary wcml_file_paths<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>><?php _e('Choose a file', 'wpml-wcml') ?></button>
|
281 |
-
<?php endif;?>
|
282 |
-
<?php else: ?>
|
283 |
-
<?php foreach ($trn_contents as $tax_key=>$trn_content) : ?>
|
284 |
-
<?php if($default_language == $key): ?>
|
285 |
-
<textarea rows="1" disabled="disabled"><?php echo $trn_content; ?></textarea>
|
286 |
-
<?php else: ?>
|
287 |
-
<input class="<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" type="text" name="<?php echo $product_content.'_'.$key.'['.$tax_key.']'; ?>" value="<?php echo $trn_content ?>" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> /><br>
|
288 |
-
<?php endif;?>
|
289 |
-
<?php endforeach; ?>
|
290 |
-
<?php endif; ?>
|
291 |
-
<?php elseif(in_array($product_content,array('content','excerpt'))): ?>
|
292 |
-
<?php if($default_language == $key): ?>
|
293 |
-
<button type="button" class="button-secondary wcml_edit_conten"><?php _e('Show content', 'wpml-wcml') ?></button>
|
294 |
-
<?php else: ?>
|
295 |
-
<button type="button" class="button-secondary wcml_edit_conten<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>><?php _e('Edit translation', 'wpml-wcml') ?></button>
|
296 |
-
<?php if($missing_translation): ?>
|
297 |
-
<span class="wcml_field_translation_<?php echo $product_content ?>_<?php echo $key ?>">
|
298 |
-
<p class="missing-translation">
|
299 |
-
<i class="icon-warning-sign"></i>
|
300 |
-
<?php _e('Translation missing', 'wpml-wcml'); ?>
|
301 |
-
</p>
|
302 |
-
</span>
|
303 |
-
<?php endif; ?>
|
304 |
-
<?php endif;?>
|
305 |
-
<div class="wcml_editor">
|
306 |
-
<a class="media-modal-close wcml_close_cross" href="javascript:void(0);" title="<?php esc_attr_e('Close', 'wpml-wcml') ?>"><span class="media-modal-icon"></span></a>
|
307 |
-
<div class="wcml_editor_original">
|
308 |
-
<h3><?php _e('Original content:', 'wpml-wcml') ?></h3>
|
309 |
-
<?php
|
310 |
-
if($product_content == 'content'){
|
311 |
-
$original_content = apply_filters('the_content', $product->post_content);
|
312 |
-
}else{
|
313 |
-
$original_content = apply_filters('the_content', $product->post_excerpt);
|
314 |
-
}
|
315 |
-
?>
|
316 |
-
<textarea class="wcml_original_content"><?php echo $original_content; ?></textarea>
|
317 |
-
|
318 |
-
</div>
|
319 |
-
<div class="wcml_line"></div>
|
320 |
-
<div class="wcml_editor_translation">
|
321 |
-
<?php if($default_language != $key): ?>
|
322 |
-
<?php
|
323 |
-
$tr_id = icl_object_id($product_id, 'product', true, $key);
|
324 |
-
wp_editor($trn_contents, 'wcmleditor'.$product_content.$tr_id.$key, array('textarea_name'=>$product_content .
|
325 |
-
'_'.$key,'textarea_rows'=>20,'editor_class'=>'wcml_content_tr')); ?>
|
326 |
-
<?php endif; ?>
|
327 |
-
</div>
|
328 |
-
<div class="wcml_editor_buttons">
|
329 |
-
<?php if($default_language == $key): ?>
|
330 |
-
<button type="button" class="button-secondary wcml_popup_close"><?php _e('Close', 'wpml-wcml') ?></button>
|
331 |
-
<?php else: ?>
|
332 |
-
<h3><?php printf(__('%s translation', 'wpml-wcml'),$lang); ?></h3>
|
333 |
-
<button type="button" class="button-secondary wcml_popup_cancel"><?php _e('Cancel', 'wpml-wcml') ?></button>
|
334 |
-
<button type="button" class="button-secondary wcml_popup_ok"><?php _e('Ok', 'wpml-wcml') ?></button>
|
335 |
-
<?php endif; ?>
|
336 |
-
</div>
|
337 |
-
</div>
|
338 |
-
<?php elseif(in_array($product_content,array('images'))):
|
339 |
-
echo $woocommerce_wpml->products->product_images_box($product_id,$key,$is_duplicate_product); ?>
|
340 |
-
<?php elseif(in_array($product_content,array('variations'))):
|
341 |
-
echo $woocommerce_wpml->products->product_variations_box($product_id,$key,$is_duplicate_product); ?>
|
342 |
-
<?php elseif($product_content == '_file_paths'): ?>
|
343 |
-
<textarea placeholder="<?php esc_attr_e('Upload file', 'wpml-wcml') ?>" value="" name='<?php echo $product_content.'_'.$key ?>' class="wcml_file_paths_textarea<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>></textarea>
|
344 |
-
<button type="button" class="button-secondary wcml_file_paths<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>><?php _e('Choose a file', 'wpml-wcml') ?></button>
|
345 |
-
<?php else: ?>
|
346 |
-
<?php if($default_language == $key): ?>
|
347 |
-
<textarea rows="1" disabled="disabled"><?php echo $trn_contents; ?></textarea><br>
|
348 |
-
<?php elseif(in_array($product_content,array('_purchase_note'))): ?>
|
349 |
-
<textarea class="<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" name="<?php echo $product_content.'_'.$key; ?>" rows="2" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> ><?php echo $trn_contents; ?></textarea>
|
350 |
-
<?php else: ?>
|
351 |
-
<input class="<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" type="text" name="<?php echo $product_content.'_'.$key; ?>" value="<?php echo $trn_contents; ?>" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> /><br>
|
352 |
-
<?php endif;?>
|
353 |
-
<?php endif; ?>
|
354 |
-
</td>
|
355 |
-
<?php endforeach; ?>
|
356 |
-
<?php do_action('wcml_gui_additional_box',$product_id,$key,$is_duplicate_product); ?>
|
357 |
-
<?php
|
358 |
-
foreach ($attributes as $attr_key=>$attribute): ?>
|
359 |
-
<td>
|
360 |
-
<?php $trn_attribute = $woocommerce_wpml->products->get_custom_attribute_translation($product_id, $attr_key, $attribute, $key); ?>
|
361 |
-
<label class="custom_attr_label"><?php _e('name','wpml-wcml'); ?></label>
|
362 |
-
<br>
|
363 |
-
<?php if (!$trn_attribute): ?>
|
364 |
-
<input type="text" name="<?php echo $attr_key . '_name_' . $key ; ?>" value="" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> />
|
365 |
-
<?php else: ?>
|
366 |
-
<?php if($default_language == $key): ?>
|
367 |
-
<textarea rows="1" disabled="disabled"><?php echo $trn_attribute['name']; ?></textarea>
|
368 |
-
<?php else: ?>
|
369 |
-
<input class="<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" type="text" name="<?php echo $attr_key . '_name_' . $key; ?>" value="<?php echo $trn_attribute['name']; ?>" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>" <?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> />
|
370 |
-
<?php endif;?>
|
371 |
-
<?php endif;?>
|
372 |
-
<br>
|
373 |
-
<label class="custom_attr_label"><?php _e('values','wpml-wcml'); ?></label>
|
374 |
-
<br>
|
375 |
-
<?php if (!$trn_attribute): ?>
|
376 |
-
<input class="<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" type="text" name="<?php echo $attr_key . '_' . $key ; ?>" value="" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>" <?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>/>
|
377 |
-
<?php else: ?>
|
378 |
-
<?php if($default_language == $key): ?>
|
379 |
-
<textarea rows="1" disabled="disabled"><?php echo $trn_attribute['value']; ?></textarea>
|
380 |
-
<?php else: ?>
|
381 |
-
<input class="<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" type="text" name="<?php echo $attr_key . '_' . $key; ?>" value="<?php echo $trn_attribute['value']; ?>" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>" <?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> />
|
382 |
-
<?php endif; ?>
|
383 |
-
<?php endif; ?>
|
384 |
-
</td>
|
385 |
-
<?php endforeach; ?>
|
386 |
-
</tr>
|
387 |
-
<?php endforeach; ?>
|
388 |
-
</tbody>
|
389 |
-
</table>
|
390 |
-
</div>
|
391 |
-
</div>
|
392 |
-
</td>
|
393 |
-
</tr>
|
394 |
-
<?php endforeach; ?>
|
395 |
-
<?php endif; ?>
|
396 |
-
</tbody>
|
397 |
-
</table>
|
398 |
|
399 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
|
401 |
-
|
402 |
-
<div class="wcml_product_pagination">
|
403 |
-
<span class="displaying-num"><?php printf(__('%d products', 'wpml-wcml'), $products_count); ?></span>
|
404 |
-
<?php if(!isset($_GET['prid']) && isset($last) && $last > 1): ?>
|
405 |
-
<a class="first-page <?php echo $pn==1?'disabled':''; ?>" href="<?php echo $pagination_url; ?>1" title="<?php _e('Go to the first page', 'wpml-wcml'); ?>">«</a>
|
406 |
-
<a class="prev-page <?php echo $pn==1?'disabled':''; ?>" href="<?php echo $pagination_url.((int)$pn > 1?$pn - 1:$pn); ?>" title="<?php _e('Go to the previous page', 'wpml-wcml'); ?>">‹</a>
|
407 |
-
<span><?php echo $pn;?> <?php _e('of', 'wpml-wcml'); ?> <?php echo $last; ?><span>
|
408 |
-
<a class="next-page <?php echo $pn==$last?'disabled':''; ?>" href="<?php echo $pagination_url.((int)$pn<$last?$pn + 1:$last); ?>" title="<?php _e('Go to the next page', 'wpml-wcml'); ?>">›</a>
|
409 |
-
<a class="last-page <?php echo $pn==$last?'disabled':''; ?>" href="<?php echo $pagination_url.$last; ?>" title="<?php _e('Go to the last page', 'wpml-wcml'); ?>">»</a>
|
410 |
-
<?php endif; ?>
|
411 |
-
<?php if(isset($_GET['prid']) || ($lm && isset($last)) && $last > 1): ?>
|
412 |
-
<a href="<?php echo $pagination_url; ?>1"><?php _e('Show all products', 'wpml-wcml'); ?></a>
|
413 |
-
<?php endif; ?>
|
414 |
-
</div>
|
415 |
-
<div class="clr"></div>
|
416 |
-
<?php endif;?>
|
417 |
|
418 |
-
</form>
|
33 |
'save' => esc_attr__('Save', 'wpml-wcml'),
|
34 |
'update' => esc_attr__('Update', 'wpml-wcml'),
|
35 |
);
|
36 |
+
|
37 |
+
$woocommerce_wpml->settings['first_editor_call'] = false;
|
38 |
+
$woocommerce_wpml->update_settings();
|
39 |
?>
|
40 |
<h3><?php _e('WooCommerce Products','wpml-wcml'); ?></h3>
|
41 |
<span style="display:none" id="wcml_product_update_button_label"><?php echo $button_labels['update'] ?></span>
|
42 |
<form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">
|
43 |
+
<div class="wcml_prod_filters">
|
44 |
+
<select class="wcml_product_category">
|
45 |
+
<option value="0"><?php _e('Any category', 'wpml-wcml'); ?></option>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
<?php
|
47 |
+
$product_categories = get_terms('product_cat',array('hide_empty' => 0));
|
48 |
+
foreach ($product_categories as $category) {
|
49 |
+
$selected = (isset($_GET['cat']) && $_GET['cat'] == $category->term_taxonomy_id)?'selected="selected"':'';
|
50 |
+
echo '<option value="'.$category->term_taxonomy_id.'" '.$selected.'>'.$category->name.'</option>';
|
51 |
+
}
|
52 |
?>
|
53 |
+
</select>
|
54 |
+
<select class="wcml_translation_status">
|
55 |
+
<option value="all"><?php _e('All products', 'wpml-wcml'); ?></option>
|
56 |
+
<option value="not" <?php echo (isset($_GET['trst']) && $_GET['trst']=='not')?'selected="selected"':''; ?>><?php _e('Not translated or needs updating', 'wpml-wcml'); ?></option>
|
57 |
+
<option value="need_update" <?php echo (isset($_GET['trst']) && $_GET['trst']=='need_update')?'selected="selected"':''; ?>><?php _e('Needs updating', 'wpml-wcml'); ?></option>
|
58 |
+
<option value="in_progress" <?php echo (isset($_GET['trst']) && $_GET['trst']=='in_progress')?'selected="selected"':''; ?>><?php _e('Translation in progress', 'wpml-wcml'); ?></option>
|
59 |
+
<option value="complete" <?php echo (isset($_GET['trst']) && $_GET['trst']=='complete')?'selected="selected"':''; ?>><?php _e('Translation complete', 'wpml-wcml'); ?></option>
|
60 |
+
</select>
|
61 |
+
|
62 |
+
<?php
|
63 |
+
$all_statuses = get_post_stati();
|
64 |
+
//unset unnecessary statuses
|
65 |
+
unset($all_statuses['trash']);
|
66 |
+
unset($all_statuses['auto-draft']);
|
67 |
+
unset($all_statuses['inherit']);
|
68 |
+
?>
|
69 |
+
<select class="wcml_product_status">
|
70 |
+
<option value="all"><?php _e('All statuses', 'wpml-wcml'); ?></option>
|
71 |
+
<?php foreach($all_statuses as $key=>$status): ?>
|
72 |
+
<option value="<?php echo $key; ?>" <?php echo (isset($_GET['st']) && $_GET['st']==$key)?'selected="selected"':''; ?> ><?php echo ucfirst($status); ?></option>
|
73 |
+
<?php endforeach; ?>
|
74 |
+
</select>
|
75 |
+
|
76 |
+
<select class="wcml_translation_status_lang">
|
77 |
+
<option value="all"><?php _e('All languages', 'wpml-wcml') ?></option>
|
78 |
+
<?php foreach($active_languages as $lang): ?>
|
79 |
+
<?php if($default_language != $lang['code']): ?>
|
80 |
+
<option value="<?php echo $lang['code'] ?>" <?php echo (isset($_GET['slang']) && $_GET['slang']==$lang['code'])?'selected="selected"':''; ?> ><?php echo $lang['display_name'] ?></option>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
<?php endif; ?>
|
82 |
+
<?php endforeach; ?>
|
83 |
+
</select>
|
84 |
+
</div>
|
85 |
+
<div>
|
86 |
+
<input type="text" class="wcml_product_name" placeholder="<?php _e('Search', 'wpml-wcml'); ?>" value="<?php echo isset($_GET['s'])?$_GET['s']:''; ?>"/>
|
87 |
+
<input type="hidden" value="<?php echo admin_url('admin.php?page=wpml-wcml&tab=products'); ?>" class="wcml_products_admin_url" />
|
88 |
+
<input type="hidden" value="<?php echo $pagination_url; ?>" class="wcml_pagination_url" />
|
89 |
+
|
90 |
+
<button type="button" value="search" class="wcml_search button-secondary"><?php _e('Search', 'wpml-wcml'); ?></button>
|
91 |
+
<?php if($search): ?>
|
92 |
+
<button type="button" value="reset" class="button-secondary wcml_reset_search"><?php _e('Reset', 'wpml-wcml'); ?></button>
|
93 |
+
<?php endif;?>
|
94 |
+
</div>
|
95 |
+
|
96 |
+
<?php if($products): ?>
|
97 |
+
<div class="wcml_product_pagination">
|
98 |
+
<span class="displaying-num"><?php printf(__('%d products', 'wpml-wcml'), $products_count); ?></span>
|
99 |
+
<?php if(!isset($_GET['prid']) && isset($last) && $last > 1): ?>
|
100 |
+
<a class="first-page <?php echo $pn==1?'disabled':''; ?>" href="<?php echo $pagination_url; ?>1" title="<?php _e('Go to the first page', 'wpml-wcml'); ?>">«</a>
|
101 |
+
<a class="prev-page <?php echo $pn==1?'disabled':''; ?>" href="<?php echo $pagination_url.((int)$pn > 1?$pn - 1:$pn); ?>" title="<?php _e('Go to the previous page', 'wpml-wcml'); ?>">‹</a>
|
102 |
+
<input type="text" class="current-page wcml_pagin" value="<?php echo $pn;?>" size="1"/> <span><?php _e('of', 'wpml-wcml'); ?> <?php echo $last; ?><span>
|
103 |
+
<a class="next-page <?php echo $pn==$last?'disabled':''; ?>" href="<?php echo $pagination_url.((int)$pn<$last?$pn + 1:$last); ?>" title="<?php _e('Go to the next page', 'wpml-wcml'); ?>">›</a>
|
104 |
+
<a class="last-page <?php echo $pn==$last?'disabled':''; ?>" href="<?php echo $pagination_url.$last; ?>" title="<?php _e('Go to the last page', 'wpml-wcml'); ?>">»</a>
|
105 |
+
<?php endif; ?>
|
106 |
+
<?php if(isset($_GET['prid']) || ($lm && isset($last)) && $last > 1): ?>
|
107 |
+
<a href="<?php echo $pagination_url; ?>1"><?php _e('Show all products', 'wpml-wcml'); ?></a>
|
108 |
+
<?php endif; ?>
|
109 |
+
</div>
|
110 |
+
<?php endif; ?>
|
111 |
+
<input type="hidden" class="icl_def_language" value="<?php echo $default_language ?>" />
|
112 |
+
<input type="hidden" id="upd_product_nonce" value="<?php echo wp_create_nonce('update_product_actions'); ?>" />
|
113 |
+
<input type="hidden" id="get_product_data_nonce" value="<?php echo wp_create_nonce('wcml_product_data'); ?>" />
|
114 |
+
|
115 |
+
<table class="widefat fixed wcml_products" cellspacing="0">
|
116 |
+
<thead>
|
117 |
+
<tr>
|
118 |
+
<th scope="col" width="5%"><?php _e('Type', 'wpml-wcml') ?></th>
|
119 |
+
<th scope="col" width="20%"><?php _e('Product', 'wpml-wcml') ?></th>
|
120 |
+
<th scope="col" width="75%"><?php echo $woocommerce_wpml->products->get_translation_flags($active_languages,$default_language,isset($_GET['slang']) && $_GET['slang'] != "all"?$_GET['slang']:false); ?></th>
|
121 |
+
</tr>
|
122 |
+
</thead>
|
123 |
+
<tbody>
|
124 |
+
<?php if(empty($products)): ?>
|
125 |
+
<tr><td colspan="4"><h3 class="wcml_no_found_text"><?php _e('No products found','wpml-wcml'); ?></h3></td></tr>
|
126 |
+
<?php else: ?>
|
127 |
+
<?php foreach ($products as $product) :
|
128 |
+
$product_id = icl_object_id($product->ID,'product',true,$default_language);
|
129 |
+
$trid = $sitepress->get_element_trid($product_id,'post_'.$product->post_type);
|
130 |
+
$product_translations = $sitepress->get_element_translations($trid,'post_'.$product->post_type,true,true);
|
131 |
+
?>
|
132 |
+
<tr>
|
133 |
+
<td>
|
134 |
+
<?php
|
135 |
+
$prod = get_product( $product->ID );
|
136 |
+
$icon_class_sufix = $prod->product_type;
|
137 |
+
if ( $prod -> is_virtual() ) {
|
138 |
+
$icon_class_sufix = 'virtual';
|
139 |
}
|
140 |
+
else if ( $prod -> is_downloadable() ) {
|
141 |
+
$icon_class_sufix = 'downloadable';
|
142 |
+
}
|
143 |
+
?>
|
144 |
+
<i class="icon-woo-<?php echo $icon_class_sufix; ?><?php echo ($product->post_parent != 0 && !$search) ? ' children_icon' : ''; ?>" title="<?php echo $icon_class_sufix; ?>"></i>
|
145 |
+
</td>
|
146 |
+
<td>
|
147 |
+
<?php echo $product->post_parent != 0 ? '— ' : ''; ?>
|
148 |
+
<?php echo $product->post_title;
|
149 |
+
if($product->post_status == 'draft' && ((isset($_GET['st']) && $_GET['st'] != 'draft') || !isset($_GET['st']))): ?>
|
150 |
+
<span class="wcml_product_status_text"><?php _e(' (draft)','wpml-wcml'); ?></span>
|
151 |
+
<?php endif; ?>
|
152 |
+
<?php if ($search && $product->post_parent != 0): ?>
|
153 |
+
<span class="prod_parent_text"><?php printf(__(' | Parent product: %s','wpml-wcml'),get_the_title($product->post_parent)); ?><span>
|
154 |
+
<?php endif; ?>
|
155 |
+
</td>
|
156 |
+
<td>
|
157 |
+
<div class="translations_statuses prid_<?php echo $product->ID; ?>">
|
158 |
+
<?php echo $woocommerce_wpml->products->get_translation_statuses($product_translations,$active_languages,$default_language,isset($_GET['slang']) && $_GET['slang'] != "all" ?$_GET['slang']:false); ?>
|
159 |
+
</div>
|
160 |
+
<span class="spinner"></span>
|
161 |
+
<a href="#prid_<?php echo $product->ID; ?>" id="wcml_details_<?php echo $product->ID; ?>" class="wcml_details" data-text-opened="<?php _e('Close', 'wpml-wcml') ?>" data-text-closed="<?php _e('Edit translation', 'wpml-wcml') ?>"><?php _e('Edit translation', 'wpml-wcml') ?></a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
|
163 |
+
</td>
|
164 |
+
</tr>
|
165 |
+
<?php endforeach; ?>
|
166 |
+
<?php endif; ?>
|
167 |
+
</tbody>
|
168 |
+
</table>
|
169 |
+
|
170 |
+
<div class="wcml_fade"></div>
|
171 |
+
|
172 |
+
<?php if($products): ?>
|
173 |
+
<div class="wcml_product_pagination">
|
174 |
+
<span class="displaying-num"><?php printf(__('%d products', 'wpml-wcml'), $products_count); ?></span>
|
175 |
+
<?php if(!isset($_GET['prid']) && isset($last) && $last > 1): ?>
|
176 |
+
<a class="first-page <?php echo $pn==1?'disabled':''; ?>" href="<?php echo $pagination_url; ?>1" title="<?php _e('Go to the first page', 'wpml-wcml'); ?>">«</a>
|
177 |
+
<a class="prev-page <?php echo $pn==1?'disabled':''; ?>" href="<?php echo $pagination_url.((int)$pn > 1?$pn - 1:$pn); ?>" title="<?php _e('Go to the previous page', 'wpml-wcml'); ?>">‹</a>
|
178 |
+
<span><?php echo $pn;?> <?php _e('of', 'wpml-wcml'); ?> <?php echo $last; ?><span>
|
179 |
+
<a class="next-page <?php echo $pn==$last?'disabled':''; ?>" href="<?php echo $pagination_url.((int)$pn<$last?$pn + 1:$last); ?>" title="<?php _e('Go to the next page', 'wpml-wcml'); ?>">›</a>
|
180 |
+
<a class="last-page <?php echo $pn==$last?'disabled':''; ?>" href="<?php echo $pagination_url.$last; ?>" title="<?php _e('Go to the last page', 'wpml-wcml'); ?>">»</a>
|
181 |
+
<?php endif; ?>
|
182 |
+
<?php if(isset($_GET['prid']) || ($lm && isset($last)) && $last > 1): ?>
|
183 |
+
<a href="<?php echo $pagination_url; ?>1"><?php _e('Show all products', 'wpml-wcml'); ?></a>
|
184 |
+
<?php endif; ?>
|
185 |
+
</div>
|
186 |
+
<div class="clr"></div>
|
187 |
+
<?php endif;?>
|
188 |
|
189 |
+
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
|
|
menu/sub/settings.php
CHANGED
@@ -83,7 +83,7 @@
|
|
83 |
<strong><?php _e('Some settings from the WooCommerce Multilingual wpml-config.xml file have been overwritten.', 'wpml-wcml'); ?></strong>
|
84 |
</p>
|
85 |
<p><?php printf(__('You should check WPML configuration files added by other plugins or manual settings on the %sMultilingual Content Setup%s section.', 'wpml-wcml'),
|
86 |
-
'<a href="' . admin_url('?page=' . WPML_TM_FOLDER . '/menu/main.php&sm=mcsetup') . '">' , '</a>') ?>
|
87 |
</p>
|
88 |
<ul>
|
89 |
<?php foreach($woocommerce_wpml->dependencies->xml_config_errors as $error): ?>
|
83 |
<strong><?php _e('Some settings from the WooCommerce Multilingual wpml-config.xml file have been overwritten.', 'wpml-wcml'); ?></strong>
|
84 |
</p>
|
85 |
<p><?php printf(__('You should check WPML configuration files added by other plugins or manual settings on the %sMultilingual Content Setup%s section.', 'wpml-wcml'),
|
86 |
+
'<a href="' . admin_url('admin.php?page=' . WPML_TM_FOLDER . '/menu/main.php&sm=mcsetup') . '">' , '</a>') ?>
|
87 |
</p>
|
88 |
<ul>
|
89 |
<?php foreach($woocommerce_wpml->dependencies->xml_config_errors as $error): ?>
|
menu/sub/troubleshooting.php
CHANGED
@@ -9,6 +9,7 @@ $prod_count = $woocommerce_wpml->troubleshooting->wcml_count_products_for_galler
|
|
9 |
$prod_categories_count = $woocommerce_wpml->troubleshooting->wcml_count_product_categories();
|
10 |
|
11 |
$all_products_taxonomies = get_taxonomies(array('object_type'=>array('product')),'objects');
|
|
|
12 |
?>
|
13 |
<div class="wrap wcml_trblsh">
|
14 |
<div id="icon-wpml" class="icon32"><br /></div>
|
@@ -54,13 +55,16 @@ $all_products_taxonomies = get_taxonomies(array('object_type'=>array('product'))
|
|
54 |
|
55 |
<li>
|
56 |
<label>
|
57 |
-
<input type="checkbox" id="wcml_duplicate_terms" />
|
58 |
<?php _e('Duplicate terms ( please select attribute ):', 'wpml-wcml') ?>
|
59 |
-
<select id="attr_to_duplicate"
|
60 |
<?php
|
|
|
61 |
$terms_count = false;
|
|
|
|
|
|
|
62 |
foreach($all_products_taxonomies as $tax_key => $tax):
|
63 |
-
if(in_array($tax_key, array('product_type','product_cat','product_tag'))) continue;
|
64 |
if(!$terms_count) $terms_count = wp_count_terms($tax_key); ?>
|
65 |
<option value="<?php echo $tax_key; ?>" rel="<?php echo wp_count_terms($tax_key); ?>"><?php echo ucfirst($tax->labels->name); ?></option>
|
66 |
<?php endforeach; ?>
|
@@ -77,7 +81,7 @@ $all_products_taxonomies = get_taxonomies(array('object_type'=>array('product'))
|
|
77 |
<input id="count_terms" type="hidden" value="<?php echo $terms_count; ?>"/>
|
78 |
<input id="sync_galerry_page" type="hidden" value="0"/>
|
79 |
<input id="sync_category_page" type="hidden" value="0"/>
|
80 |
-
<span class="
|
81 |
</li>
|
82 |
</ul>
|
83 |
</div>
|
@@ -89,7 +93,7 @@ $all_products_taxonomies = get_taxonomies(array('object_type'=>array('product'))
|
|
89 |
jQuery('#wcml_trbl').on('click',function(){
|
90 |
var field = jQuery(this);
|
91 |
field.attr('disabled', 'disabled');
|
92 |
-
jQuery('.
|
93 |
|
94 |
if(jQuery('#wcml_sync_update_product_count').is(':checked')){
|
95 |
update_product_count();
|
@@ -158,7 +162,7 @@ $all_products_taxonomies = get_taxonomies(array('object_type'=>array('product'))
|
|
158 |
duplicate_terms();
|
159 |
}else{
|
160 |
jQuery('#wcml_trbl').removeAttr('disabled');
|
161 |
-
jQuery('.
|
162 |
jQuery('#wcml_trbl').next().fadeOut();
|
163 |
}
|
164 |
|
@@ -194,7 +198,7 @@ $all_products_taxonomies = get_taxonomies(array('object_type'=>array('product'))
|
|
194 |
duplicate_terms();
|
195 |
}else{
|
196 |
jQuery('#wcml_trbl').removeAttr('disabled');
|
197 |
-
jQuery('.
|
198 |
jQuery('#wcml_trbl').next().fadeOut();
|
199 |
}
|
200 |
jQuery('.gallery_status').html(0);
|
@@ -228,7 +232,7 @@ $all_products_taxonomies = get_taxonomies(array('object_type'=>array('product'))
|
|
228 |
duplicate_terms();
|
229 |
}else{
|
230 |
jQuery('#wcml_trbl').removeAttr('disabled');
|
231 |
-
jQuery('.
|
232 |
jQuery('#wcml_trbl').next().fadeOut();
|
233 |
}
|
234 |
jQuery('.cat_status').html(0);
|
@@ -259,7 +263,7 @@ $all_products_taxonomies = get_taxonomies(array('object_type'=>array('product'))
|
|
259 |
success: function(response) {
|
260 |
if(jQuery('#count_terms').val() == 0){
|
261 |
jQuery('#wcml_trbl').removeAttr('disabled');
|
262 |
-
jQuery('.
|
263 |
jQuery('#wcml_trbl').next().fadeOut();
|
264 |
jQuery('.attr_status').html(0);
|
265 |
}else{
|
9 |
$prod_categories_count = $woocommerce_wpml->troubleshooting->wcml_count_product_categories();
|
10 |
|
11 |
$all_products_taxonomies = get_taxonomies(array('object_type'=>array('product')),'objects');
|
12 |
+
unset($all_products_taxonomies['product_type'],$all_products_taxonomies['product_cat'],$all_products_taxonomies['product_tag']);
|
13 |
?>
|
14 |
<div class="wrap wcml_trblsh">
|
15 |
<div id="icon-wpml" class="icon32"><br /></div>
|
55 |
|
56 |
<li>
|
57 |
<label>
|
58 |
+
<input type="checkbox" id="wcml_duplicate_terms" <?php echo !count($all_products_taxonomies)?'disabled="disabled"':''; ?> />
|
59 |
<?php _e('Duplicate terms ( please select attribute ):', 'wpml-wcml') ?>
|
60 |
+
<select id="attr_to_duplicate" <?php echo !count($all_products_taxonomies)?'disabled="disabled"':''; ?>>
|
61 |
<?php
|
62 |
+
var_dump(count($all_products_taxonomies));
|
63 |
$terms_count = false;
|
64 |
+
if(!count($all_products_taxonomies)){ ?>
|
65 |
+
<option value="0" ><?php _e('none', 'wpml-wcml'); ?></option>
|
66 |
+
<?php }
|
67 |
foreach($all_products_taxonomies as $tax_key => $tax):
|
|
|
68 |
if(!$terms_count) $terms_count = wp_count_terms($tax_key); ?>
|
69 |
<option value="<?php echo $tax_key; ?>" rel="<?php echo wp_count_terms($tax_key); ?>"><?php echo ucfirst($tax->labels->name); ?></option>
|
70 |
<?php endforeach; ?>
|
81 |
<input id="count_terms" type="hidden" value="<?php echo $terms_count; ?>"/>
|
82 |
<input id="sync_galerry_page" type="hidden" value="0"/>
|
83 |
<input id="sync_category_page" type="hidden" value="0"/>
|
84 |
+
<span class="spinner"></span>
|
85 |
</li>
|
86 |
</ul>
|
87 |
</div>
|
93 |
jQuery('#wcml_trbl').on('click',function(){
|
94 |
var field = jQuery(this);
|
95 |
field.attr('disabled', 'disabled');
|
96 |
+
jQuery('.spinner').css('display','inline-block');
|
97 |
|
98 |
if(jQuery('#wcml_sync_update_product_count').is(':checked')){
|
99 |
update_product_count();
|
162 |
duplicate_terms();
|
163 |
}else{
|
164 |
jQuery('#wcml_trbl').removeAttr('disabled');
|
165 |
+
jQuery('.spinner').hide();
|
166 |
jQuery('#wcml_trbl').next().fadeOut();
|
167 |
}
|
168 |
|
198 |
duplicate_terms();
|
199 |
}else{
|
200 |
jQuery('#wcml_trbl').removeAttr('disabled');
|
201 |
+
jQuery('.spinner').hide();
|
202 |
jQuery('#wcml_trbl').next().fadeOut();
|
203 |
}
|
204 |
jQuery('.gallery_status').html(0);
|
232 |
duplicate_terms();
|
233 |
}else{
|
234 |
jQuery('#wcml_trbl').removeAttr('disabled');
|
235 |
+
jQuery('.spinner').hide();
|
236 |
jQuery('#wcml_trbl').next().fadeOut();
|
237 |
}
|
238 |
jQuery('.cat_status').html(0);
|
263 |
success: function(response) {
|
264 |
if(jQuery('#count_terms').val() == 0){
|
265 |
jQuery('#wcml_trbl').removeAttr('disabled');
|
266 |
+
jQuery('.spinner').hide();
|
267 |
jQuery('#wcml_trbl').next().fadeOut();
|
268 |
jQuery('.attr_status').html(0);
|
269 |
}else{
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Donate link: http://wpml.org/documentation/related-projects/woocommerce-multilin
|
|
4 |
Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multilingual, e-shop, shop
|
5 |
License: GPLv2
|
6 |
Requires at least: 3.0
|
7 |
-
Tested up to:
|
8 |
-
Stable tag: 3.3.
|
9 |
|
10 |
Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
|
11 |
|
@@ -77,6 +77,24 @@ In order for the checkout and store pages to appear translated, you need to crea
|
|
77 |
|
78 |
== Changelog ==
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
= 3.3.1 =
|
81 |
* Some strings were showing in the wrong language on the cart and checkout page.
|
82 |
* Product category urls - in some cases the product category urls didn�t work on sites with the default language different than English.
|
4 |
Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multilingual, e-shop, shop
|
5 |
License: GPLv2
|
6 |
Requires at least: 3.0
|
7 |
+
Tested up to: 4.0
|
8 |
+
Stable tag: 3.3.2
|
9 |
|
10 |
Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
|
11 |
|
77 |
|
78 |
== Changelog ==
|
79 |
|
80 |
+
= 3.3.2 =
|
81 |
+
* Fixed: 'Language warning' appears when editing product translations using the native WooCommerce editor
|
82 |
+
* Fixed: Variation cannot be added to an existing order
|
83 |
+
* Fixed: Media Attachment controls for products missing
|
84 |
+
* Prevented disabling of option to use slugs in different language for products
|
85 |
+
* Fixed: Slashes not stripped correctly in product translation editor
|
86 |
+
* Fixed: 'Copy content' button not working on product translations
|
87 |
+
* Disable admin language switcher on the Product => Attributes screen
|
88 |
+
* Allow 'woocommerce_price_display_suffix' to be translated with String Translation
|
89 |
+
* Allow 'woocommerce_email_from_name' and 'woocommerce_email_from_address' to be translated with String Translation
|
90 |
+
* Fixed: Menu order is not synced when using "drag and drop" in Products => Sort Products
|
91 |
+
* Fixed: One WooCommerce attribute field won't translate
|
92 |
+
* Fixed: Variations not showing in the correct language in some circumstances
|
93 |
+
* Optimizations for the WooCommerce Multilingual products admin page - faster when a large number of products exist
|
94 |
+
* Duplicate translations too when duplicating a WooCommerce product
|
95 |
+
* Fixed: WC Price Filter showing the wrong currency
|
96 |
+
* Ability to use any currency when creating an order in the backend.
|
97 |
+
|
98 |
= 3.3.1 =
|
99 |
* Some strings were showing in the wrong language on the cart and checkout page.
|
100 |
* Product category urls - in some cases the product category urls didn�t work on sites with the default language different than English.
|
woocommerce_wpml.class.php
CHANGED
@@ -9,20 +9,12 @@ class woocommerce_wpml {
|
|
9 |
var $emails;
|
10 |
var $terms;
|
11 |
var $orders;
|
12 |
-
|
13 |
var $missing;
|
14 |
|
15 |
-
var $endpoints_strings;
|
16 |
-
|
17 |
function __construct(){
|
18 |
add_action('plugins_loaded', array($this, 'init'), 2);
|
19 |
|
20 |
-
|
21 |
-
//endpoints hooks
|
22 |
-
add_action( 'plugins_loaded', array( $this, 'register_endpoints_translations' ), 2 );
|
23 |
-
add_action('icl_ajx_custom_call',array($this,'rewrite_rule_endpoints'), 11, 2);
|
24 |
-
add_action('woocommerce_settings_saved',array($this,'update_endpoints_rules'));
|
25 |
-
}
|
26 |
}
|
27 |
|
28 |
function init(){
|
@@ -60,7 +52,7 @@ class woocommerce_wpml {
|
|
60 |
$this->troubleshooting = new WCML_Troubleshooting();
|
61 |
$this->compatibility = new WCML_Compatibility();
|
62 |
$this->strings = new WCML_WC_Strings;
|
63 |
-
|
64 |
|
65 |
if(isset($_GET['page']) && $_GET['page'] == 'wc-reports'){
|
66 |
require_once WCML_PLUGIN_PATH . '/inc/reports.class.php';
|
@@ -100,10 +92,10 @@ class woocommerce_wpml {
|
|
100 |
(isset($_GET['page']) && $_GET['page'] == 'wpml-wcml') ||
|
101 |
(($pagenow == 'edit.php' || $pagenow == 'post-new.php') && isset($_GET['post_type']) && ($_GET['post_type'] == 'shop_coupon' || $_GET['post_type'] == 'shop_order')) ||
|
102 |
($pagenow == 'post.php' && isset($_GET['post']) && (get_post_type($_GET['post']) == 'shop_coupon' || get_post_type($_GET['post']) == 'shop_order')) ||
|
103 |
-
(isset($_GET['page']) && $_GET['page'] == 'shipping_zones')
|
104 |
)
|
105 |
){
|
106 |
-
remove_action( 'wp_before_admin_bar_render', array($sitepress, 'admin_language_switcher') );
|
107 |
}
|
108 |
|
109 |
if((($pagenow == 'post.php' && isset($_GET['post']) && get_post_type($_GET['post']) == 'product') || (($pagenow == 'post-new.php' || $pagenow == 'edit.php') && isset($_GET['post_type']) && $_GET['post_type'] == 'product'))
|
@@ -126,7 +118,7 @@ class woocommerce_wpml {
|
|
126 |
$slug = get_option('woocommerce_product_slug') != false ? get_option('woocommerce_product_slug') : 'product';
|
127 |
|
128 |
$string = $wpdb->get_row($wpdb->prepare("SELECT id,status FROM {$wpdb->prefix}icl_strings WHERE name = %s AND value = %s ", 'URL slug: ' . $slug, $slug));
|
129 |
-
|
130 |
if(!$string){
|
131 |
icl_register_string('WordPress', 'URL slug: ' . $slug, $slug);
|
132 |
$string = $wpdb->get_row($wpdb->prepare("SELECT id,status FROM {$wpdb->prefix}icl_strings WHERE name = %s AND value = %s ", 'URL slug: ' . $slug, $slug));
|
@@ -141,33 +133,29 @@ class woocommerce_wpml {
|
|
141 |
$sitepress->save_settings($iclsettings);
|
142 |
}
|
143 |
|
144 |
-
|
145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
}
|
|
|
147 |
|
148 |
-
|
149 |
-
if($string->status != ICL_STRING_TRANSLATION_COMPLETE){
|
150 |
-
//get translations from .mo files
|
151 |
-
$current_language = $sitepress->get_current_language();
|
152 |
-
$default_language = $sitepress->get_default_language();
|
153 |
-
$active_languages = $sitepress->get_active_languages();
|
154 |
-
$string_id = $string->id;
|
155 |
-
if(empty($string_id)){
|
156 |
-
$string_id = icl_register_string('WordPress', 'URL slug: ' . $slug, $slug);
|
157 |
-
}
|
158 |
-
foreach($active_languages as $language){
|
159 |
-
if(isset($sitepress_settings['st']) && $language['code'] != $sitepress_settings['st']['strings_language']){
|
160 |
-
$sitepress->switch_lang($language['code']);
|
161 |
-
$context = 'slug';
|
162 |
-
$domain = 'woocommerce';
|
163 |
-
$woocommerce->load_plugin_textdomain();
|
164 |
-
$string_text = _x( $slug, $context, $domain );
|
165 |
-
unload_textdomain($domain);
|
166 |
-
icl_add_string_translation($string_id,$language['code'],$string_text,ICL_STRING_TRANSLATION_COMPLETE,null);
|
167 |
-
$sitepress->switch_lang($current_language);
|
168 |
-
}
|
169 |
-
}
|
170 |
-
$woocommerce->load_plugin_textdomain();
|
171 |
$wpdb->update(
|
172 |
$wpdb->prefix.'icl_strings',
|
173 |
array(
|
@@ -179,7 +167,7 @@ class woocommerce_wpml {
|
|
179 |
|
180 |
$iclsettings['posts_slug_translation']['on'] = 1;
|
181 |
$iclsettings['posts_slug_translation']['types'][$slug] = 1;
|
182 |
-
$sitepress->save_settings($iclsettings);
|
183 |
}
|
184 |
|
185 |
function get_settings(){
|
@@ -383,37 +371,49 @@ class woocommerce_wpml {
|
|
383 |
}
|
384 |
|
385 |
function load_css_and_js() {
|
386 |
-
if(isset($_GET['page'])
|
387 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
388 |
|
389 |
-
if ( !wp_style_is( 'toolset-font-awesome', 'registered' ) ) { // check if style are already registered
|
390 |
-
wp_register_style('toolset-font-awesome', WCML_PLUGIN_URL . '/assets/css/font-awesome.min.css', null, WCML_VERSION); // register if not
|
391 |
-
}
|
392 |
-
wp_register_style('wpml-wcml', WCML_PLUGIN_URL . '/assets/css/management.css', array('toolset-font-awesome'), WCML_VERSION);
|
393 |
-
wp_register_style('cleditor', WCML_PLUGIN_URL . '/assets/css/jquery.cleditor.css', null, WCML_VERSION);
|
394 |
-
wp_register_script('wcml-tm-scripts', WCML_PLUGIN_URL . '/assets/js/scripts.js', array('jquery', 'jquery-ui-resizable'), WCML_VERSION);
|
395 |
-
wp_register_script('jquery-cookie', WCML_PLUGIN_URL . '/assets/js/jquery.cookie.js', array('jquery'), WCML_VERSION);
|
396 |
-
wp_register_script('cleditor', WCML_PLUGIN_URL . '/assets/js/jquery.cleditor.min.js', array('jquery'), WCML_VERSION);
|
397 |
-
|
398 |
-
wp_enqueue_style('toolset-font-awesome'); // enqueue styles
|
399 |
-
wp_enqueue_style('wpml-wcml');
|
400 |
-
wp_enqueue_style('cleditor');
|
401 |
-
wp_enqueue_style('wp-pointer');
|
402 |
-
|
403 |
-
wp_enqueue_media();
|
404 |
-
wp_enqueue_script('wcml-tm-scripts');
|
405 |
-
wp_enqueue_script('jquery-cookie');
|
406 |
-
wp_enqueue_script('cleditor');
|
407 |
-
wp_enqueue_script('suggest');
|
408 |
-
wp_enqueue_script('wp-pointer');
|
409 |
-
|
410 |
-
|
411 |
-
wp_localize_script('wcml-tm-scripts', 'wcml_settings',
|
412 |
-
array(
|
413 |
-
'nonce' => wp_create_nonce( 'woocommerce_multilingual' )
|
414 |
-
)
|
415 |
-
);
|
416 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
}
|
418 |
}
|
419 |
|
@@ -566,69 +566,4 @@ class woocommerce_wpml {
|
|
566 |
}
|
567 |
}
|
568 |
|
569 |
-
function register_endpoints_translations(){
|
570 |
-
$wc_vars = WC()->query->query_vars;
|
571 |
-
|
572 |
-
$query_vars = array(
|
573 |
-
// Checkout actions
|
574 |
-
'order-pay' => $this->get_endpoint_translation($wc_vars['order-pay']),
|
575 |
-
'order-received' => $this->get_endpoint_translation($wc_vars['order-received']),
|
576 |
-
|
577 |
-
// My account actions
|
578 |
-
'view-order' => $this->get_endpoint_translation($wc_vars['view-order']),
|
579 |
-
'edit-account' => $this->get_endpoint_translation($wc_vars['edit-account']),
|
580 |
-
'edit-address' => $this->get_endpoint_translation($wc_vars['edit-address']),
|
581 |
-
'lost-password' => $this->get_endpoint_translation($wc_vars['lost-password']),
|
582 |
-
'customer-logout' => $this->get_endpoint_translation($wc_vars['customer-logout']),
|
583 |
-
'add-payment-method' => $this->get_endpoint_translation($wc_vars['add-payment-method']),
|
584 |
-
);
|
585 |
-
|
586 |
-
WC()->query->query_vars = $query_vars;
|
587 |
-
|
588 |
-
}
|
589 |
-
|
590 |
-
function get_endpoint_translation($endpoint){
|
591 |
-
global $wpdb;
|
592 |
-
|
593 |
-
$string = $wpdb->get_var($wpdb->prepare("SELECT id FROM {$wpdb->prefix}icl_strings WHERE name = %s AND value = %s ", 'Endpoint slug: ' . $endpoint, $endpoint));
|
594 |
-
|
595 |
-
if(!$string && function_exists('icl_register_string')){
|
596 |
-
icl_register_string('WordPress', 'Endpoint slug: ' . $endpoint, $endpoint);
|
597 |
-
}else{
|
598 |
-
$this->endpoints_strings[] = $string;
|
599 |
-
}
|
600 |
-
|
601 |
-
if(function_exists('icl_t')){
|
602 |
-
return icl_t('WordPress','Endpoint slug: '. $endpoint, $endpoint);
|
603 |
-
}else{
|
604 |
-
return $endpoint;
|
605 |
-
}
|
606 |
-
|
607 |
-
|
608 |
-
}
|
609 |
-
|
610 |
-
function rewrite_rule_endpoints($call, $data){
|
611 |
-
if($call == 'icl_st_save_translation' && in_array($data['icl_st_string_id'],$this->endpoints_strings)){
|
612 |
-
$this->add_endpoints();
|
613 |
-
}
|
614 |
-
}
|
615 |
-
|
616 |
-
function update_endpoints_rules(){
|
617 |
-
$this->add_endpoints();
|
618 |
-
}
|
619 |
-
|
620 |
-
function add_endpoints(){
|
621 |
-
global $wpdb;
|
622 |
-
//add endpoints and flush rules
|
623 |
-
foreach($this->endpoints_strings as $string_id){
|
624 |
-
$strings = $wpdb->get_results($wpdb->prepare("SELECT value FROM {$wpdb->prefix}icl_string_translations WHERE string_id = %s AND status = 1", $string_id));
|
625 |
-
foreach($strings as $string){
|
626 |
-
add_rewrite_endpoint( $string->value, EP_PAGES );
|
627 |
-
}
|
628 |
-
}
|
629 |
-
flush_rewrite_rules();
|
630 |
-
}
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
}
|
9 |
var $emails;
|
10 |
var $terms;
|
11 |
var $orders;
|
|
|
12 |
var $missing;
|
13 |
|
|
|
|
|
14 |
function __construct(){
|
15 |
add_action('plugins_loaded', array($this, 'init'), 2);
|
16 |
|
17 |
+
$this->endpoints = new WCML_Endpoints;
|
|
|
|
|
|
|
|
|
|
|
18 |
}
|
19 |
|
20 |
function init(){
|
52 |
$this->troubleshooting = new WCML_Troubleshooting();
|
53 |
$this->compatibility = new WCML_Compatibility();
|
54 |
$this->strings = new WCML_WC_Strings;
|
55 |
+
|
56 |
|
57 |
if(isset($_GET['page']) && $_GET['page'] == 'wc-reports'){
|
58 |
require_once WCML_PLUGIN_PATH . '/inc/reports.class.php';
|
92 |
(isset($_GET['page']) && $_GET['page'] == 'wpml-wcml') ||
|
93 |
(($pagenow == 'edit.php' || $pagenow == 'post-new.php') && isset($_GET['post_type']) && ($_GET['post_type'] == 'shop_coupon' || $_GET['post_type'] == 'shop_order')) ||
|
94 |
($pagenow == 'post.php' && isset($_GET['post']) && (get_post_type($_GET['post']) == 'shop_coupon' || get_post_type($_GET['post']) == 'shop_order')) ||
|
95 |
+
(isset($_GET['page']) && $_GET['page'] == 'shipping_zones') || ( isset($_GET['page']) && $_GET['page'] == 'product_attributes')
|
96 |
)
|
97 |
){
|
98 |
+
remove_action( 'wp_before_admin_bar_render', array( $sitepress, 'admin_language_switcher' ) );
|
99 |
}
|
100 |
|
101 |
if((($pagenow == 'post.php' && isset($_GET['post']) && get_post_type($_GET['post']) == 'product') || (($pagenow == 'post-new.php' || $pagenow == 'edit.php') && isset($_GET['post_type']) && $_GET['post_type'] == 'product'))
|
118 |
$slug = get_option('woocommerce_product_slug') != false ? get_option('woocommerce_product_slug') : 'product';
|
119 |
|
120 |
$string = $wpdb->get_row($wpdb->prepare("SELECT id,status FROM {$wpdb->prefix}icl_strings WHERE name = %s AND value = %s ", 'URL slug: ' . $slug, $slug));
|
121 |
+
|
122 |
if(!$string){
|
123 |
icl_register_string('WordPress', 'URL slug: ' . $slug, $slug);
|
124 |
$string = $wpdb->get_row($wpdb->prepare("SELECT id,status FROM {$wpdb->prefix}icl_strings WHERE name = %s AND value = %s ", 'URL slug: ' . $slug, $slug));
|
133 |
$sitepress->save_settings($iclsettings);
|
134 |
}
|
135 |
|
136 |
+
$string_id = $string->id;
|
137 |
+
$translations = icl_get_string_translations_by_id( $string_id );
|
138 |
+
|
139 |
+
//get translations from .mo files
|
140 |
+
$current_language = $sitepress->get_current_language();
|
141 |
+
$default_language = $sitepress->get_default_language();
|
142 |
+
$active_languages = $sitepress->get_active_languages();
|
143 |
+
|
144 |
+
foreach( $active_languages as $language ){
|
145 |
+
if( !isset( $translations[ $language['code'] ] ) && isset($sitepress_settings['st'] ) && $language['code'] != $sitepress_settings['st']['strings_language'] ){
|
146 |
+
$sitepress->switch_lang($language['code']);
|
147 |
+
$context = 'slug';
|
148 |
+
$domain = 'woocommerce';
|
149 |
+
$woocommerce->load_plugin_textdomain();
|
150 |
+
$string_text = _x( $slug, $context, $domain );
|
151 |
+
unload_textdomain($domain);
|
152 |
+
icl_add_string_translation($string_id,$language['code'],$string_text,ICL_STRING_TRANSLATION_COMPLETE,null);
|
153 |
+
$sitepress->switch_lang($current_language);
|
154 |
+
}
|
155 |
}
|
156 |
+
$woocommerce->load_plugin_textdomain();
|
157 |
|
158 |
+
if( $string->status != ICL_STRING_TRANSLATION_COMPLETE ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
$wpdb->update(
|
160 |
$wpdb->prefix.'icl_strings',
|
161 |
array(
|
167 |
|
168 |
$iclsettings['posts_slug_translation']['on'] = 1;
|
169 |
$iclsettings['posts_slug_translation']['types'][$slug] = 1;
|
170 |
+
$sitepress->save_settings( $iclsettings );
|
171 |
}
|
172 |
|
173 |
function get_settings(){
|
371 |
}
|
372 |
|
373 |
function load_css_and_js() {
|
374 |
+
if(isset($_GET['page'])){
|
375 |
|
376 |
+
if( in_array($_GET['page'], array('wpml-wcml',basename(WCML_PLUGIN_PATH).'/menu/sub/troubleshooting.php',basename(WCML_PLUGIN_PATH).'/menu/plugins.php'))) {
|
377 |
+
|
378 |
+
|
379 |
+
if ( !wp_style_is( 'toolset-font-awesome', 'registered' ) ) { // check if style are already registered
|
380 |
+
wp_register_style('toolset-font-awesome', WCML_PLUGIN_URL . '/assets/css/font-awesome.min.css', null, WCML_VERSION); // register if not
|
381 |
+
}
|
382 |
+
wp_register_style('wpml-wcml', WCML_PLUGIN_URL . '/assets/css/management.css', array('toolset-font-awesome'), WCML_VERSION);
|
383 |
+
wp_register_style('cleditor', WCML_PLUGIN_URL . '/assets/css/jquery.cleditor.css', null, WCML_VERSION);
|
384 |
+
wp_register_script('wcml-tm-scripts', WCML_PLUGIN_URL . '/assets/js/scripts.js', array('jquery', 'jquery-ui-resizable'), WCML_VERSION);
|
385 |
+
wp_register_script('jquery-cookie', WCML_PLUGIN_URL . '/assets/js/jquery.cookie.js', array('jquery'), WCML_VERSION);
|
386 |
+
wp_register_script('cleditor', WCML_PLUGIN_URL . '/assets/js/jquery.cleditor.min.js', array('jquery'), WCML_VERSION);
|
387 |
+
|
388 |
+
wp_enqueue_style('toolset-font-awesome'); // enqueue styles
|
389 |
+
wp_enqueue_style('wpml-wcml');
|
390 |
+
wp_enqueue_style('cleditor');
|
391 |
+
wp_enqueue_style('wp-pointer');
|
392 |
+
|
393 |
+
wp_enqueue_media();
|
394 |
+
wp_enqueue_script('wcml-tm-scripts');
|
395 |
+
wp_enqueue_script('jquery-cookie');
|
396 |
+
wp_enqueue_script('cleditor');
|
397 |
+
wp_enqueue_script('suggest');
|
398 |
+
wp_enqueue_script('wp-pointer');
|
399 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
|
401 |
+
wp_localize_script('wcml-tm-scripts', 'wcml_settings',
|
402 |
+
array(
|
403 |
+
'nonce' => wp_create_nonce( 'woocommerce_multilingual' )
|
404 |
+
)
|
405 |
+
);
|
406 |
+
|
407 |
+
//load wp-editor srcipts
|
408 |
+
wp_enqueue_script('word-count');
|
409 |
+
wp_enqueue_script('editor');
|
410 |
+
wp_enqueue_script( 'quicktags' );
|
411 |
+
wp_enqueue_style( 'buttons' );
|
412 |
+
|
413 |
+
}elseif( $_GET['page'] == 'wpml-translation-management/menu/main.php' ){
|
414 |
+
wp_register_script('wpml_tm', WCML_PLUGIN_URL . '/assets/js/wpml_tm.js', array('jquery'), WCML_VERSION);
|
415 |
+
wp_enqueue_script('wpml_tm');
|
416 |
+
}
|
417 |
}
|
418 |
}
|
419 |
|
566 |
}
|
567 |
}
|
568 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
569 |
}
|
wpml-config.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<wpml-config>
|
2 |
<custom-fields>
|
3 |
<custom-field action="copy">_backorders</custom-field>
|
4 |
-
<custom-field action="
|
5 |
<custom-field action="copy">_default_attributes</custom-field>
|
6 |
<custom-field action="copy">_download_limit</custom-field>
|
7 |
<custom-field action="copy">_downloadable</custom-field>
|
@@ -22,7 +22,7 @@
|
|
22 |
<custom-field action="copy">_subscription_trial_period</custom-field>
|
23 |
<custom-field action="copy">_tax_class</custom-field>
|
24 |
<custom-field action="copy">_tax_status</custom-field>
|
25 |
-
<custom-field action="
|
26 |
<custom-field action="copy">_virtual</custom-field>
|
27 |
<custom-field action="copy">_visibility</custom-field>
|
28 |
<custom-field action="copy">_weight</custom-field>
|
@@ -38,8 +38,6 @@
|
|
38 |
<custom-field action="translate">_product_tabs</custom-field>
|
39 |
<custom-field action="ignore">_wcml_custom_prices_status</custom-field>
|
40 |
<custom-field action="copy">_per_product_pricing_active</custom-field>
|
41 |
-
<custom-field action="copy">_product_addons</custom-field>
|
42 |
-
<custom-field action="copy">_product_addons_exclude_global</custom-field>
|
43 |
<custom-field action="copy">_pricing_rules</custom-field>
|
44 |
</custom-fields>
|
45 |
<custom-types>
|
@@ -48,7 +46,6 @@
|
|
48 |
<custom-type translate="0">shop_coupon</custom-type>
|
49 |
<custom-type translate="0">shop_order</custom-type>
|
50 |
<custom-type translate="1">wc_product_tab</custom-type>
|
51 |
-
<custom-type translate="0">global_product_addon</custom-type>
|
52 |
</custom-types>
|
53 |
<taxonomies>
|
54 |
<taxonomy translate="1">product_cat</taxonomy>
|
@@ -95,5 +92,8 @@
|
|
95 |
<key name="woocommerce_demo_store_notice"/>
|
96 |
<key name="woocommerce_price_thousand_sep"/>
|
97 |
<key name="woocommerce_price_decimal_sep"/>
|
|
|
|
|
|
|
98 |
</admin-texts>
|
99 |
</wpml-config>
|
1 |
<wpml-config>
|
2 |
<custom-fields>
|
3 |
<custom-field action="copy">_backorders</custom-field>
|
4 |
+
<custom-field action="translate">_crosssell_ids</custom-field>
|
5 |
<custom-field action="copy">_default_attributes</custom-field>
|
6 |
<custom-field action="copy">_download_limit</custom-field>
|
7 |
<custom-field action="copy">_downloadable</custom-field>
|
22 |
<custom-field action="copy">_subscription_trial_period</custom-field>
|
23 |
<custom-field action="copy">_tax_class</custom-field>
|
24 |
<custom-field action="copy">_tax_status</custom-field>
|
25 |
+
<custom-field action="translate">_upsell_ids</custom-field>
|
26 |
<custom-field action="copy">_virtual</custom-field>
|
27 |
<custom-field action="copy">_visibility</custom-field>
|
28 |
<custom-field action="copy">_weight</custom-field>
|
38 |
<custom-field action="translate">_product_tabs</custom-field>
|
39 |
<custom-field action="ignore">_wcml_custom_prices_status</custom-field>
|
40 |
<custom-field action="copy">_per_product_pricing_active</custom-field>
|
|
|
|
|
41 |
<custom-field action="copy">_pricing_rules</custom-field>
|
42 |
</custom-fields>
|
43 |
<custom-types>
|
46 |
<custom-type translate="0">shop_coupon</custom-type>
|
47 |
<custom-type translate="0">shop_order</custom-type>
|
48 |
<custom-type translate="1">wc_product_tab</custom-type>
|
|
|
49 |
</custom-types>
|
50 |
<taxonomies>
|
51 |
<taxonomy translate="1">product_cat</taxonomy>
|
92 |
<key name="woocommerce_demo_store_notice"/>
|
93 |
<key name="woocommerce_price_thousand_sep"/>
|
94 |
<key name="woocommerce_price_decimal_sep"/>
|
95 |
+
<key name="woocommerce_price_display_suffix" />
|
96 |
+
<key name="woocommerce_email_from_name"/>
|
97 |
+
<key name="woocommerce_email_from_address" />
|
98 |
</admin-texts>
|
99 |
</wpml-config>
|
wpml-woocommerce.php
CHANGED
@@ -5,12 +5,12 @@
|
|
5 |
Description: Allows running fully multilingual e-Commerce sites with WooCommerce and WPML. <a href="http://wpml.org/documentation/related-projects/woocommerce-multilingual/">Documentation</a>.
|
6 |
Author: ICanLocalize
|
7 |
Author URI: http://wpml.org/
|
8 |
-
Version: 3.3.
|
9 |
*/
|
10 |
|
11 |
|
12 |
if(defined('WCML_VERSION')) return;
|
13 |
-
define('WCML_VERSION', '3.3');
|
14 |
define('WCML_PLUGIN_PATH', dirname(__FILE__));
|
15 |
define('WCML_PLUGIN_FOLDER', basename(WCML_PLUGIN_PATH));
|
16 |
define('WCML_PLUGIN_URL', plugins_url() . '/' . WCML_PLUGIN_FOLDER);
|
@@ -35,6 +35,7 @@ require WCML_PLUGIN_PATH . '/inc/orders.class.php';
|
|
35 |
require WCML_PLUGIN_PATH . '/inc/requests.class.php';
|
36 |
require WCML_PLUGIN_PATH . '/inc/functions-troubleshooting.class.php';
|
37 |
require WCML_PLUGIN_PATH . '/inc/compatibility.class.php';
|
|
|
38 |
|
39 |
require WCML_PLUGIN_PATH . '/woocommerce_wpml.class.php';
|
40 |
$woocommerce_wpml = new woocommerce_wpml();
|
5 |
Description: Allows running fully multilingual e-Commerce sites with WooCommerce and WPML. <a href="http://wpml.org/documentation/related-projects/woocommerce-multilingual/">Documentation</a>.
|
6 |
Author: ICanLocalize
|
7 |
Author URI: http://wpml.org/
|
8 |
+
Version: 3.3.2
|
9 |
*/
|
10 |
|
11 |
|
12 |
if(defined('WCML_VERSION')) return;
|
13 |
+
define('WCML_VERSION', '3.3.2');
|
14 |
define('WCML_PLUGIN_PATH', dirname(__FILE__));
|
15 |
define('WCML_PLUGIN_FOLDER', basename(WCML_PLUGIN_PATH));
|
16 |
define('WCML_PLUGIN_URL', plugins_url() . '/' . WCML_PLUGIN_FOLDER);
|
35 |
require WCML_PLUGIN_PATH . '/inc/requests.class.php';
|
36 |
require WCML_PLUGIN_PATH . '/inc/functions-troubleshooting.class.php';
|
37 |
require WCML_PLUGIN_PATH . '/inc/compatibility.class.php';
|
38 |
+
require WCML_PLUGIN_PATH . '/inc/endpoints.class.php';
|
39 |
|
40 |
require WCML_PLUGIN_PATH . '/woocommerce_wpml.class.php';
|
41 |
$woocommerce_wpml = new woocommerce_wpml();
|