Version Description
- Support for multi-currency (independent of language) BETA
- Support for translating products via ICanLocalize (professional translation)
- Option to synchronize product translation dates
- Compatibility with Table Rate Shipping and other extensions
- Better handling for couponse
- Fixed bug: product attributes not saved on orders
- Fixed bug: Can't get to the cart & checkout pages if they are set as child pages
- Fixed bug: Style conflicts in Dashboard for Arabic
- Fixed various issues with notification emails
- Fixed bug: Variable products default selection is not copied to translations.
- Fixed bug: Product Table is not showing Product Draft count
Download this release
Release Info
Developer | mihaimihai |
Plugin | WooCommerce Multilingual – run WooCommerce with WPML |
Version | 3.1 |
Comparing to | |
See all releases |
Code changes from version 3.0.1 to 3.1
- assets/css/management.css +21 -2
- assets/js/scripts.js +110 -23
- inc/dependencies.class.php +116 -2
- inc/emails.class.php +24 -2
- inc/functions-troubleshooting.class.php +29 -0
- inc/missing-php-functions.php +21 -0
- inc/multi-currency-support.class.php +345 -0
- inc/multi-currency.class.php +329 -0
- inc/orders.class.php +12 -1
- inc/products.class.php +302 -103
- inc/requests.class.php +7 -18
- inc/store-pages.class.php +19 -3
- inc/terms.class.php +79 -4
- inc/upgrade.class.php +93 -2
- inc/wc-strings.class.php +9 -1
- menu/sub/products.php +347 -322
- menu/sub/settings.php +194 -50
- menu/sub/troubleshooting.php +60 -8
- menu/sub/variations_box.php +1 -1
- readme.txt +15 -2
- woocommerce_wpml.class.php +33 -19
- wpml-config.xml +3 -1
- wpml-woocommerce.php +7 -3
assets/css/management.css
CHANGED
@@ -313,7 +313,16 @@
|
|
313 |
.wp-editor-container{
|
314 |
background-color: #fff;
|
315 |
}
|
316 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
/* Woocommerce styles*/
|
318 |
.inside {
|
319 |
margin: 0;
|
@@ -462,6 +471,7 @@
|
|
462 |
}
|
463 |
.wcml_editor_translation{
|
464 |
overflow: hidden;
|
|
|
465 |
}
|
466 |
.wcml_line{
|
467 |
border-bottom: 1px solid #555;
|
@@ -688,4 +698,13 @@ textarea[disabled] {
|
|
688 |
.icon-woo-grouped { background-image: url('../images/icon-woo-grouped.png'); }
|
689 |
.icon-woo-variable { background-image: url('../images/icon-woo-variable.png'); }
|
690 |
.icon-woo-virtual { background-image: url('../images/icon-woo-virtual.png'); }
|
691 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
313 |
.wp-editor-container{
|
314 |
background-color: #fff;
|
315 |
}
|
316 |
+
.wcml_editor_buttons{
|
317 |
+
float: left;
|
318 |
+
width: 100%;
|
319 |
+
}
|
320 |
+
.wcml_editor_buttons h3{
|
321 |
+
float: left;
|
322 |
+
}
|
323 |
+
.wcml_editor_buttons .button-secondary{
|
324 |
+
margin-top: 15px;
|
325 |
+
}
|
326 |
/* Woocommerce styles*/
|
327 |
.inside {
|
328 |
margin: 0;
|
471 |
}
|
472 |
.wcml_editor_translation{
|
473 |
overflow: hidden;
|
474 |
+
margin-top: 15px;
|
475 |
}
|
476 |
.wcml_line{
|
477 |
border-bottom: 1px solid #555;
|
698 |
.icon-woo-grouped { background-image: url('../images/icon-woo-grouped.png'); }
|
699 |
.icon-woo-variable { background-image: url('../images/icon-woo-variable.png'); }
|
700 |
.icon-woo-virtual { background-image: url('../images/icon-woo-virtual.png'); }
|
701 |
+
.children_icon{ margin-left: 20px }
|
702 |
+
/* Icons END */
|
703 |
+
|
704 |
+
.wcml_product_status_text,.prod_parent_text {
|
705 |
+
font-style: italic;
|
706 |
+
color: #9A9A9A;
|
707 |
+
}
|
708 |
+
.wcml_no_found_text{
|
709 |
+
text-align: center;
|
710 |
+
}
|
assets/js/scripts.js
CHANGED
@@ -22,7 +22,7 @@ jQuery(document).ready(function($){
|
|
22 |
});
|
23 |
|
24 |
jQuery('.wcml_search').click(function(){
|
25 |
-
window.location = jQuery('.wcml_products_admin_url').val()+'&s='+jQuery('.wcml_product_name').val()+'&cat='+jQuery('.wcml_product_category').val()+'&
|
26 |
});
|
27 |
|
28 |
jQuery('.wcml_reset_search').click(function(){
|
@@ -141,6 +141,7 @@ jQuery(document).ready(function($){
|
|
141 |
product_id : product_id,
|
142 |
language : language,
|
143 |
records : records,
|
|
|
144 |
wcml_nonce: jQuery('#upd_product_nonce').val()
|
145 |
},
|
146 |
success: function(response) {
|
@@ -402,27 +403,27 @@ jQuery(document).ready(function($){
|
|
402 |
jQuery(".wcml_fade").hide();
|
403 |
if(tinyMCE.activeEditor != null){
|
404 |
if(jQuery('textarea.wcml_content_tr')>0){
|
405 |
-
tinyMCE.activeEditor.setContent(jQuery(this).
|
406 |
}
|
407 |
}
|
408 |
-
jQuery(this).
|
409 |
-
jQuery(this).
|
410 |
});
|
411 |
|
412 |
jQuery(".wcml_popup_close").click(function(){
|
413 |
jQuery(".wcml_fade").hide();
|
414 |
-
jQuery(this).
|
415 |
});
|
416 |
|
417 |
|
418 |
jQuery(".wcml_popup_ok").click(function(){
|
419 |
-
var text_area = jQuery(this).
|
420 |
jQuery(".wcml_fade").hide();
|
421 |
|
422 |
if(text_area.size()>0 && !text_area.is(':visible')){
|
423 |
text_area.val(window.parent.tinyMCE.get(text_area.attr('id')).getContent());
|
424 |
}
|
425 |
-
jQuery(this).
|
426 |
|
427 |
|
428 |
var row_lang = jQuery(this).closest('tr[rel]').attr('rel');
|
@@ -543,6 +544,104 @@ jQuery(document).ready(function($){
|
|
543 |
});
|
544 |
}
|
545 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
546 |
jQuery(document).on('click','.edit_currency',function(){
|
547 |
var $tableRow = jQuery(this).closest('tr');
|
548 |
$tableRow.addClass('edit-mode');
|
@@ -593,6 +692,7 @@ jQuery(document).ready(function($){
|
|
593 |
$this.prop('disabled',true);
|
594 |
|
595 |
var parent = jQuery(this).closest('tr');
|
|
|
596 |
if(parent.find('.currency_id').val() > 0){
|
597 |
var currency_id = parent.find('.currency_id').val();
|
598 |
}else{
|
@@ -605,7 +705,7 @@ jQuery(document).ready(function($){
|
|
605 |
var currency_code = $currencyCodeWraper.find('input').val();
|
606 |
var currency_value = $currencyValueWraper.find('input').val();
|
607 |
var flag = false;
|
608 |
-
|
609 |
if(currency_code == ''){
|
610 |
if(parent.find('.currency_code .wcml-error').size() == 0){
|
611 |
parent.find('.currency_code').append( $messageContainer );
|
@@ -694,7 +794,7 @@ jQuery(document).ready(function($){
|
|
694 |
parent.find('.save_currency').hide();
|
695 |
parent.find('.cancel_currency').hide();
|
696 |
$this.closest('.edit-mode').removeClass('edit-mode');
|
697 |
-
|
698 |
},
|
699 |
complete: function() {
|
700 |
$ajaxLoader.remove();
|
@@ -726,7 +826,6 @@ jQuery(document).ready(function($){
|
|
726 |
},
|
727 |
success: function(response) {
|
728 |
parent.remove();
|
729 |
-
update_languages_curencies();
|
730 |
},
|
731 |
done: function() {
|
732 |
$ajaxLoader.remove();
|
@@ -806,21 +905,9 @@ jQuery(document).ready(function($){
|
|
806 |
}
|
807 |
}).pointer('open');
|
808 |
});
|
|
|
809 |
|
810 |
|
811 |
-
function update_languages_curencies(){
|
812 |
-
jQuery.ajax({
|
813 |
-
type : "post",
|
814 |
-
url : ajaxurl,
|
815 |
-
data : {
|
816 |
-
action: "wcml_update_languages_curencies",
|
817 |
-
id: '1'
|
818 |
-
},
|
819 |
-
success: function(response) {
|
820 |
-
jQuery('.wcml_languages_currency tbody').html(response);
|
821 |
-
}
|
822 |
-
})
|
823 |
-
}
|
824 |
|
825 |
function isNumber(n) {
|
826 |
return !isNaN(parseFloat(n)) && isFinite(n);
|
22 |
});
|
23 |
|
24 |
jQuery('.wcml_search').click(function(){
|
25 |
+
window.location = jQuery('.wcml_products_admin_url').val()+'&s='+jQuery('.wcml_product_name').val()+'&cat='+jQuery('.wcml_product_category').val()+'&trst='+jQuery('.wcml_translation_status').val()+'&st='+jQuery('.wcml_product_status').val()+'&slang='+jQuery('.wcml_translation_status_lang').val();
|
26 |
});
|
27 |
|
28 |
jQuery('.wcml_reset_search').click(function(){
|
141 |
product_id : product_id,
|
142 |
language : language,
|
143 |
records : records,
|
144 |
+
slang : jQuery('.wcml_translation_status_lang').val(),
|
145 |
wcml_nonce: jQuery('#upd_product_nonce').val()
|
146 |
},
|
147 |
success: function(response) {
|
403 |
jQuery(".wcml_fade").hide();
|
404 |
if(tinyMCE.activeEditor != null){
|
405 |
if(jQuery('textarea.wcml_content_tr')>0){
|
406 |
+
tinyMCE.activeEditor.setContent(jQuery(this).closest('.wcml_editor').find('.wcml_editor_translation textarea').data('def'));
|
407 |
}
|
408 |
}
|
409 |
+
jQuery(this).closest('.wcml_editor').css('display','none');
|
410 |
+
jQuery(this).closest('.wcml_editor').find('.wcml_editor_translation textarea').val(jQuery(this).closest('.wcml_editor').find('.wcml_editor_translation textarea').data('def'));
|
411 |
});
|
412 |
|
413 |
jQuery(".wcml_popup_close").click(function(){
|
414 |
jQuery(".wcml_fade").hide();
|
415 |
+
jQuery(this).closest('.wcml_editor').css('display','none');
|
416 |
});
|
417 |
|
418 |
|
419 |
jQuery(".wcml_popup_ok").click(function(){
|
420 |
+
var text_area = jQuery(this).closest('.wcml_editor').find('.wcml_editor_translation textarea');
|
421 |
jQuery(".wcml_fade").hide();
|
422 |
|
423 |
if(text_area.size()>0 && !text_area.is(':visible')){
|
424 |
text_area.val(window.parent.tinyMCE.get(text_area.attr('id')).getContent());
|
425 |
}
|
426 |
+
jQuery(this).closest('.wcml_editor').css('display','none');
|
427 |
|
428 |
|
429 |
var row_lang = jQuery(this).closest('tr[rel]').attr('rel');
|
544 |
});
|
545 |
}
|
546 |
|
547 |
+
jQuery('#multi_currency_option_select input[name=multi_currency]').change(function(){
|
548 |
+
|
549 |
+
if(jQuery(this).attr('id') != 'multi_currency_independent'){
|
550 |
+
jQuery('#multi-currency-per-language-details').fadeOut();
|
551 |
+
}else{
|
552 |
+
jQuery('#multi-currency-per-language-details').fadeIn();
|
553 |
+
}
|
554 |
+
|
555 |
+
})
|
556 |
+
|
557 |
+
jQuery('#wcml_custom_exchange_rates').submit(function(){
|
558 |
+
|
559 |
+
var thisf = jQuery(this);
|
560 |
+
|
561 |
+
thisf.find(':submit').parent().prepend(icl_ajxloaderimg + ' ')
|
562 |
+
thisf.find(':submit').prop('disabled', true);
|
563 |
+
|
564 |
+
jQuery.ajax({
|
565 |
+
|
566 |
+
type: 'post',
|
567 |
+
dataType: 'json',
|
568 |
+
url: ajaxurl,
|
569 |
+
data: thisf.serialize(),
|
570 |
+
success: function(){
|
571 |
+
thisf.find(':submit').prev().remove();
|
572 |
+
thisf.find(':submit').prop('disabled', false);
|
573 |
+
}
|
574 |
+
|
575 |
+
})
|
576 |
+
|
577 |
+
return false;
|
578 |
+
})
|
579 |
+
|
580 |
+
function wcml_remove_custom_rates(post_id){
|
581 |
+
|
582 |
+
var thisa = jQuery(this);
|
583 |
+
|
584 |
+
jQuery.ajax({
|
585 |
+
|
586 |
+
type: 'post',
|
587 |
+
dataType: 'json',
|
588 |
+
url: ajaxurl,
|
589 |
+
data: {action: 'wcml_remove_custom_rates', 'post_id': post_id},
|
590 |
+
success: function(){
|
591 |
+
thisa.parent().parent().parent().fadeOut(function(){ jQuery(this).remove()});
|
592 |
+
}
|
593 |
+
|
594 |
+
})
|
595 |
+
|
596 |
+
return false;
|
597 |
+
|
598 |
+
}
|
599 |
+
|
600 |
+
jQuery(document).on('click', '#wcml_fix_strings_language', function(){
|
601 |
+
|
602 |
+
var thisb = jQuery(this);
|
603 |
+
thisb.prop('disabled', true);
|
604 |
+
var $ajaxLoader = $('<span> </span>' + icl_ajxloaderimg);
|
605 |
+
$ajaxLoader.insertAfter(thisb).show();
|
606 |
+
|
607 |
+
jQuery.ajax({
|
608 |
+
|
609 |
+
type : "post",
|
610 |
+
dataType:'json',
|
611 |
+
url : ajaxurl,
|
612 |
+
data : {
|
613 |
+
action: "wcml_fix_strings_language",
|
614 |
+
wcml_nonce: jQuery('#wcml_fix_strings_language_nonce').val()
|
615 |
+
},
|
616 |
+
error: function(respnse) {
|
617 |
+
thisb.prop('disabled', false);
|
618 |
+
},
|
619 |
+
success: function(response) {
|
620 |
+
|
621 |
+
var sucess_1 = response.success_1;
|
622 |
+
|
623 |
+
jQuery.ajax({
|
624 |
+
type : "post",
|
625 |
+
dataType:'json',
|
626 |
+
url : icl_ajx_url,
|
627 |
+
data : {
|
628 |
+
iclt_st_sw_save: 1,
|
629 |
+
icl_st_sw: {strings_language: 'en'},
|
630 |
+
_wpnonce: response._wpnonce
|
631 |
+
},
|
632 |
+
complete: function(response){
|
633 |
+
//thisb.prop('disabled',false);
|
634 |
+
$ajaxLoader.remove();
|
635 |
+
thisb.after(sucess_1);
|
636 |
+
}
|
637 |
+
});
|
638 |
+
|
639 |
+
|
640 |
+
}
|
641 |
+
})
|
642 |
+
|
643 |
+
});
|
644 |
+
|
645 |
jQuery(document).on('click','.edit_currency',function(){
|
646 |
var $tableRow = jQuery(this).closest('tr');
|
647 |
$tableRow.addClass('edit-mode');
|
692 |
$this.prop('disabled',true);
|
693 |
|
694 |
var parent = jQuery(this).closest('tr');
|
695 |
+
|
696 |
if(parent.find('.currency_id').val() > 0){
|
697 |
var currency_id = parent.find('.currency_id').val();
|
698 |
}else{
|
705 |
var currency_code = $currencyCodeWraper.find('input').val();
|
706 |
var currency_value = $currencyValueWraper.find('input').val();
|
707 |
var flag = false;
|
708 |
+
|
709 |
if(currency_code == ''){
|
710 |
if(parent.find('.currency_code .wcml-error').size() == 0){
|
711 |
parent.find('.currency_code').append( $messageContainer );
|
794 |
parent.find('.save_currency').hide();
|
795 |
parent.find('.cancel_currency').hide();
|
796 |
$this.closest('.edit-mode').removeClass('edit-mode');
|
797 |
+
|
798 |
},
|
799 |
complete: function() {
|
800 |
$ajaxLoader.remove();
|
826 |
},
|
827 |
success: function(response) {
|
828 |
parent.remove();
|
|
|
829 |
},
|
830 |
done: function() {
|
831 |
$ajaxLoader.remove();
|
905 |
}
|
906 |
}).pointer('open');
|
907 |
});
|
908 |
+
|
909 |
|
910 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
911 |
|
912 |
function isNumber(n) {
|
913 |
return !isNaN(parseFloat(n)) && isFinite(n);
|
inc/dependencies.class.php
CHANGED
@@ -6,7 +6,16 @@ class WCML_Dependencies{
|
|
6 |
private $missing = array();
|
7 |
private $err_message = '';
|
8 |
|
9 |
-
function __construct(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
function check(){
|
12 |
|
@@ -43,7 +52,7 @@ class WCML_Dependencies{
|
|
43 |
$allok = false;
|
44 |
}
|
45 |
|
46 |
-
if(
|
47 |
$this->missing['WPML Media'] = 'http://wpml.org';
|
48 |
$allok = false;
|
49 |
}elseif(version_compare(WPML_MEDIA_VERSION, '2.1', '<')){
|
@@ -194,5 +203,110 @@ class WCML_Dependencies{
|
|
194 |
function plugin_notice_message(){
|
195 |
echo $this->err_message;
|
196 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
}
|
198 |
|
6 |
private $missing = array();
|
7 |
private $err_message = '';
|
8 |
|
9 |
+
function __construct(){
|
10 |
+
|
11 |
+
if(is_admin()){
|
12 |
+
add_action('wp_ajax_wcml_fix_strings_language', array($this, 'fix_strings_language'));
|
13 |
+
|
14 |
+
add_action('init', array($this, 'check_wpml_config'), 100);
|
15 |
+
}
|
16 |
+
|
17 |
+
|
18 |
+
}
|
19 |
|
20 |
function check(){
|
21 |
|
52 |
$allok = false;
|
53 |
}
|
54 |
|
55 |
+
if(!defined('WPML_MEDIA_VERSION')){
|
56 |
$this->missing['WPML Media'] = 'http://wpml.org';
|
57 |
$allok = false;
|
58 |
}elseif(version_compare(WPML_MEDIA_VERSION, '2.1', '<')){
|
203 |
function plugin_notice_message(){
|
204 |
echo $this->err_message;
|
205 |
}
|
206 |
+
|
207 |
+
function fix_strings_language(){
|
208 |
+
|
209 |
+
$ret = array();
|
210 |
+
|
211 |
+
if(wp_create_nonce($_POST['action']) == $_POST['wcml_nonce']){
|
212 |
+
|
213 |
+
$ret['_wpnonce'] = wp_create_nonce('icl_sw_form');
|
214 |
+
|
215 |
+
$ret['success_1'] = ' ' . sprintf(__('Finished! You can visit the %sstrings translation%s screen to translate the strings now.', 'wpml-wcml'), '<a href="' . admin_url('admin.php?page=' . WPML_ST_FOLDER . '/menu/string-translation.php') . '">', '</a>');
|
216 |
+
}
|
217 |
+
|
218 |
+
echo json_encode($ret);
|
219 |
+
|
220 |
+
exit;
|
221 |
+
|
222 |
+
}
|
223 |
+
|
224 |
+
function check_wpml_config(){
|
225 |
+
global $sitepress_settings;
|
226 |
+
|
227 |
+
if(empty($sitepress_settings)) return;
|
228 |
+
|
229 |
+
$file = realpath(WCML_PLUGIN_PATH . '/wpml-config.xml');
|
230 |
+
if(!file_exists($file)){
|
231 |
+
$this->xml_config_errors[] = __('wpml-config.xml file missing form WooCommerce Multilingual folder.', 'wpml-wcml');
|
232 |
+
}else{
|
233 |
+
$config = icl_xml2array(file_get_contents($file));
|
234 |
+
|
235 |
+
if(isset($config['wpml-config'])){
|
236 |
+
|
237 |
+
//custom-fields
|
238 |
+
if(isset($config['wpml-config']['custom-fields'])){
|
239 |
+
if(isset($config['wpml-config']['custom-fields']['custom-field']['value'])){ //single
|
240 |
+
$cfs[] = $config['wpml-config']['custom-fields']['custom-field'];
|
241 |
+
}else{
|
242 |
+
foreach($config['wpml-config']['custom-fields']['custom-field'] as $cf){
|
243 |
+
$cfs[] = $cf;
|
244 |
+
}
|
245 |
+
}
|
246 |
+
|
247 |
+
if($cfs)
|
248 |
+
foreach($cfs as $cf){
|
249 |
+
if(!isset($sitepress_settings['translation-management']['custom_fields_translation'][$cf['value']])) continue;
|
250 |
+
|
251 |
+
$effective_config_value = $sitepress_settings['translation-management']['custom_fields_translation'][$cf['value']];
|
252 |
+
$correct_config_value = $cf['attr']['action'] == 'copy' ? 1 : ($cf['attr']['action'] == 'translate' ? 2: 0);
|
253 |
+
|
254 |
+
if($effective_config_value != $correct_config_value){
|
255 |
+
$this->xml_config_errors[] = sprintf(__('Custom field %s configuration from wpml-config.xml file was altered!', 'wpml-wcml'), '<i>' . $cf['value'] . '</i>');
|
256 |
+
}
|
257 |
+
}
|
258 |
+
|
259 |
+
}
|
260 |
+
|
261 |
+
//custom-types
|
262 |
+
if(isset($config['wpml-config']['custom-types'])){
|
263 |
+
if(isset($config['wpml-config']['custom-types']['custom-type']['value'])){ //single
|
264 |
+
$cts[] = $config['wpml-config']['custom-types']['custom-type'];
|
265 |
+
}else{
|
266 |
+
foreach($config['wpml-config']['custom-types']['custom-type'] as $cf){
|
267 |
+
$cts[] = $cf;
|
268 |
+
}
|
269 |
+
}
|
270 |
+
|
271 |
+
if($cts)
|
272 |
+
foreach($cts as $ct){
|
273 |
+
if(!isset($sitepress_settings['custom_posts_sync_option'][$ct['value']])) continue;
|
274 |
+
$effective_config_value = $sitepress_settings['custom_posts_sync_option'][$ct['value']];
|
275 |
+
$correct_config_value = $ct['attr']['translate'];
|
276 |
+
|
277 |
+
if($effective_config_value != $correct_config_value){
|
278 |
+
$this->xml_config_errors[] = sprintf(__('Custom type %s configuration from wpml-config.xml file was altered!', 'wpml-wcml'), '<i>' . $ct['value'] . '</i>');
|
279 |
+
}
|
280 |
+
}
|
281 |
+
|
282 |
+
}
|
283 |
+
|
284 |
+
//taxonomies
|
285 |
+
if(isset($config['wpml-config']['taxonomies'])){
|
286 |
+
if(isset($config['wpml-config']['taxonomies']['taxonomy']['value'])){ //single
|
287 |
+
$txs[] = $config['wpml-config']['taxonomies']['taxonomy'];
|
288 |
+
}else{
|
289 |
+
foreach($config['wpml-config']['taxonomies']['taxonomy'] as $cf){
|
290 |
+
$txs[] = $cf;
|
291 |
+
}
|
292 |
+
}
|
293 |
+
|
294 |
+
if($txs)
|
295 |
+
foreach($txs as $tx){
|
296 |
+
if(!isset($sitepress_settings['taxonomies_sync_option'][$tx['value']])) continue;
|
297 |
+
$effective_config_value = $sitepress_settings['taxonomies_sync_option'][$tx['value']];
|
298 |
+
$correct_config_value = $tx['attr']['translate'];
|
299 |
+
|
300 |
+
if($effective_config_value != $correct_config_value){
|
301 |
+
$this->xml_config_errors[] = sprintf(__('Custom taxonomy %s configuration from wpml-config.xml file was altered!', 'wpml-wcml'), '<i>' . $tx['value'] . '</i>');
|
302 |
+
}
|
303 |
+
}
|
304 |
+
|
305 |
+
}
|
306 |
+
}
|
307 |
+
}
|
308 |
+
|
309 |
+
}
|
310 |
+
|
311 |
}
|
312 |
|
inc/emails.class.php
CHANGED
@@ -18,6 +18,11 @@ class WCML_Emails{
|
|
18 |
|
19 |
//WPML job link
|
20 |
add_filter('icl_job_edit_url',array($this,'icl_job_edit_url'),10 ,2);
|
|
|
|
|
|
|
|
|
|
|
21 |
}
|
22 |
|
23 |
/**
|
@@ -28,7 +33,7 @@ class WCML_Emails{
|
|
28 |
* @return type
|
29 |
*/
|
30 |
function email_header($order) {
|
31 |
-
|
32 |
|
33 |
if (is_array($order)) {
|
34 |
$order = $order['order_id'];
|
@@ -36,7 +41,24 @@ class WCML_Emails{
|
|
36 |
$order = $order->id;
|
37 |
}
|
38 |
|
39 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
if(!empty($lang)){
|
41 |
$sitepress->switch_lang($lang, true);
|
42 |
$domain = 'woocommerce';
|
18 |
|
19 |
//WPML job link
|
20 |
add_filter('icl_job_edit_url',array($this,'icl_job_edit_url'),10 ,2);
|
21 |
+
|
22 |
+
//change order status
|
23 |
+
add_action('woocommerce_order_status_completed',array($this,'refresh_email_lang'),9);
|
24 |
+
add_action('woocommerce_order_status_processing',array($this,'refresh_email_lang'),9);
|
25 |
+
add_action('woocommerce_new_customer_note',array($this,'refresh_email_lang'),9);
|
26 |
}
|
27 |
|
28 |
/**
|
33 |
* @return type
|
34 |
*/
|
35 |
function email_header($order) {
|
36 |
+
|
37 |
|
38 |
if (is_array($order)) {
|
39 |
$order = $order['order_id'];
|
41 |
$order = $order->id;
|
42 |
}
|
43 |
|
44 |
+
$this->refresh_email_lang($order);
|
45 |
+
|
46 |
+
}
|
47 |
+
|
48 |
+
|
49 |
+
function refresh_email_lang($order_id){
|
50 |
+
global $sitepress,$woocommerce;
|
51 |
+
|
52 |
+
if(is_array($order_id)){
|
53 |
+
if(isset($order_id['order_id'])){
|
54 |
+
$order_id = $order_id['order_id'];
|
55 |
+
}else{
|
56 |
+
return;
|
57 |
+
}
|
58 |
+
|
59 |
+
}
|
60 |
+
|
61 |
+
$lang = get_post_meta($order_id, 'wpml_language', TRUE);
|
62 |
if(!empty($lang)){
|
63 |
$sitepress->switch_lang($lang, true);
|
64 |
$domain = 'woocommerce';
|
inc/functions-troubleshooting.class.php
CHANGED
@@ -11,6 +11,7 @@ class WCML_Troubleshooting{
|
|
11 |
function init(){
|
12 |
|
13 |
add_action('wp_ajax_trbl_sync_variations', array($this,'trbl_sync_variations'));
|
|
|
14 |
add_action('wp_ajax_trbl_update_count', array($this,'trbl_update_count'));
|
15 |
|
16 |
}
|
@@ -42,6 +43,13 @@ class WCML_Troubleshooting{
|
|
42 |
update_option('wcml_products_to_sync',$get_variables_products);
|
43 |
}
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
function trbl_sync_variations(){
|
46 |
|
47 |
if(!wp_verify_nonce($_REQUEST['wcml_nonce'], 'trbl_sync_variations')){
|
@@ -92,4 +100,25 @@ class WCML_Troubleshooting{
|
|
92 |
die();
|
93 |
}
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
}
|
11 |
function init(){
|
12 |
|
13 |
add_action('wp_ajax_trbl_sync_variations', array($this,'trbl_sync_variations'));
|
14 |
+
add_action('wp_ajax_trbl_gallery_images', array($this,'trbl_gallery_images'));
|
15 |
add_action('wp_ajax_trbl_update_count', array($this,'trbl_update_count'));
|
16 |
|
17 |
}
|
43 |
update_option('wcml_products_to_sync',$get_variables_products);
|
44 |
}
|
45 |
|
46 |
+
function wcml_count_products(){
|
47 |
+
global $wpdb;
|
48 |
+
$get_products_count = $wpdb->get_var("SELECT count(ID) FROM $wpdb->posts AS p LEFT JOIN {$wpdb->prefix}icl_translations AS tr ON tr.element_id = p.ID WHERE p.post_status = 'publish' AND p.post_type = 'product' AND tr.source_language_code is NULL");
|
49 |
+
return $get_products_count;
|
50 |
+
}
|
51 |
+
|
52 |
+
|
53 |
function trbl_sync_variations(){
|
54 |
|
55 |
if(!wp_verify_nonce($_REQUEST['wcml_nonce'], 'trbl_sync_variations')){
|
100 |
die();
|
101 |
}
|
102 |
|
103 |
+
function trbl_gallery_images(){
|
104 |
+
if(!wp_verify_nonce($_REQUEST['wcml_nonce'], 'trbl_gallery_images')){
|
105 |
+
die('Invalid nonce');
|
106 |
+
}
|
107 |
+
|
108 |
+
$page = isset($_POST['page'])?$_POST['page']:0;
|
109 |
+
|
110 |
+
global $woocommerce_wpml,$wpdb;
|
111 |
+
|
112 |
+
$all_products = $wpdb->get_results($wpdb->prepare("SELECT p.* FROM $wpdb->posts AS p LEFT JOIN {$wpdb->prefix}icl_translations AS tr ON tr.element_id = p.ID WHERE p.post_status = 'publish' AND p.post_type = 'product' AND tr.source_language_code is NULL ORDER BY p.ID LIMIT %d,5",$page*5));
|
113 |
+
|
114 |
+
foreach($all_products as $product){
|
115 |
+
$woocommerce_wpml->products->sync_product_gallery($product->ID);
|
116 |
+
}
|
117 |
+
|
118 |
+
echo 1;
|
119 |
+
|
120 |
+
die();
|
121 |
+
|
122 |
+
}
|
123 |
+
|
124 |
}
|
inc/missing-php-functions.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/* PHP 5.3 - start */
|
4 |
+
|
5 |
+
if(false === function_exists('lcfirst'))
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Make a string's first character lowercase
|
9 |
+
*
|
10 |
+
* @param string $str
|
11 |
+
* @return string the resulting string.
|
12 |
+
*/
|
13 |
+
function lcfirst( $str ) {
|
14 |
+
$str[0] = strtolower($str[0]);
|
15 |
+
return (string)$str;
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
/* PHP 5.3 - end */
|
20 |
+
|
21 |
+
?>
|
inc/multi-currency-support.class.php
ADDED
@@ -0,0 +1,345 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WCML_Multi_Currency_Support{
|
4 |
+
|
5 |
+
private $client_currency;
|
6 |
+
private $exchange_rates = array();
|
7 |
+
|
8 |
+
|
9 |
+
function __construct(){
|
10 |
+
|
11 |
+
add_action('init', array($this, 'init'), 5);
|
12 |
+
|
13 |
+
if(is_ajax()){
|
14 |
+
add_action('wp_ajax_nopriv_wcml_switch_currency', array($this, 'switch_currency'));
|
15 |
+
add_action('wp_ajax_wcml_switch_currency', array($this, 'switch_currency'));
|
16 |
+
|
17 |
+
add_action('wp_ajax_legacy_update_custom_rates', array($this, 'legacy_update_custom_rates'));
|
18 |
+
add_action('wp_ajax_legacy_remove_custom_rates', array($this, 'legacy_remove_custom_rates'));
|
19 |
+
}
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
+
}
|
24 |
+
|
25 |
+
function _load_filters(){
|
26 |
+
$load = false;
|
27 |
+
|
28 |
+
if(!is_admin() && $this->get_client_currency() != get_option('woocommerce_currency')){
|
29 |
+
$load = true;
|
30 |
+
}else{
|
31 |
+
if(is_ajax() && $this->get_client_currency() != get_option('woocommerce_currency')){
|
32 |
+
if(isset($_REQUEST['action'])){
|
33 |
+
if(in_array($_REQUEST['action'], array('woocommerce_get_refreshed_fragments', 'woocommerce_update_order_review', 'woocommerce_update_shipping_method', 'woocommerce-checkout'))){
|
34 |
+
$load = true;
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
return $load;
|
41 |
+
}
|
42 |
+
|
43 |
+
function init(){
|
44 |
+
|
45 |
+
if($this->_load_filters()){
|
46 |
+
|
47 |
+
add_filter('woocommerce_currency', array($this, 'currency_filter'));
|
48 |
+
//add_filter('option_woocommerce_currency', array($this, 'currency_filter'));
|
49 |
+
|
50 |
+
add_filter('get_post_metadata', array($this, 'product_price_filter'), 10, 4);
|
51 |
+
add_filter('get_post_metadata', array($this, 'variation_prices_filter'), 12, 4); // second
|
52 |
+
|
53 |
+
add_filter('woocommerce_available_shipping_methods', array($this, 'shipping_taxes_filter'));
|
54 |
+
|
55 |
+
add_action('woocommerce_coupon_loaded', array($this, 'filter_coupon_data'));
|
56 |
+
|
57 |
+
add_filter('option_woocommerce_free_shipping_settings', array($this, 'adjust_min_amount_required'));
|
58 |
+
|
59 |
+
// table rate shipping support
|
60 |
+
if(defined('TABLE_RATE_SHIPPING_VERSION')){
|
61 |
+
add_filter('woocommerce_table_rate_query_rates', array($this, 'table_rate_shipping_rates'));
|
62 |
+
add_filter('woocommerce_table_rate_instance_settings', array($this, 'table_rate_instance_settings'));
|
63 |
+
}
|
64 |
+
|
65 |
+
}
|
66 |
+
|
67 |
+
add_shortcode('currency_switcher', array($this, 'currency_switcher'));
|
68 |
+
|
69 |
+
$this->load_inline_js();
|
70 |
+
|
71 |
+
}
|
72 |
+
|
73 |
+
function load_inline_js(){
|
74 |
+
global $woocommerce;
|
75 |
+
|
76 |
+
$woocommerce->add_inline_js( "
|
77 |
+
jQuery('.wcml_currency_switcher').on('change', function(){
|
78 |
+
var currency = jQuery(this).val();
|
79 |
+
jQuery('.wcml_currency_switcher').attr('disabled', 'disabled');
|
80 |
+
jQuery('.wcml_currency_switcher').val(currency);
|
81 |
+
var data = {action: 'wcml_switch_currency', currency: currency}
|
82 |
+
jQuery.post(woocommerce_params.ajax_url, data, function(){
|
83 |
+
jQuery('.wcml_currency_switcher').removeAttr('disabled');
|
84 |
+
location.reload();
|
85 |
+
});
|
86 |
+
});
|
87 |
+
" );
|
88 |
+
}
|
89 |
+
|
90 |
+
function product_price_filter($null, $object_id, $meta_key, $single){
|
91 |
+
global $sitepress;
|
92 |
+
|
93 |
+
static $no_filter = false;
|
94 |
+
|
95 |
+
if(empty($no_filter) && in_array(get_post_type($object_id), array('product', 'product_variation'))){
|
96 |
+
|
97 |
+
$price_keys = array(
|
98 |
+
'_price', '_regular_price', '_sale_price',
|
99 |
+
'_min_variation_price', '_max_variation_price',
|
100 |
+
'_min_variation_regular_price', '_max_variation_regular_price',
|
101 |
+
'_min_variation_sale_price', '_max_variation_sale_price');
|
102 |
+
|
103 |
+
if(in_array($meta_key, $price_keys)){
|
104 |
+
$no_filter = true;
|
105 |
+
|
106 |
+
// exception for products migrated from before WCML 3.1 with independent prices
|
107 |
+
// legacy prior 3.1
|
108 |
+
$original_object_id = icl_object_id($object_id, get_post_type($object_id), false, $sitepress->get_default_language());
|
109 |
+
$ccr = get_post_meta($original_object_id, '_custom_conversion_rate', true);
|
110 |
+
if(in_array($meta_key, array('_price', '_regular_price', '_sale_price')) && isset($ccr[$meta_key][$this->get_client_currency()])){
|
111 |
+
$price_original = get_post_meta($original_object_id, $meta_key, $single);
|
112 |
+
$price = $price_original * $ccr[$meta_key][$this->get_client_currency()];
|
113 |
+
|
114 |
+
}else{
|
115 |
+
|
116 |
+
// normal filtering
|
117 |
+
$price = get_post_meta($object_id, $meta_key, $single);
|
118 |
+
$price = apply_filters('wcml_raw_price_amount', $price, $object_id);
|
119 |
+
|
120 |
+
}
|
121 |
+
|
122 |
+
|
123 |
+
$no_filter = false;
|
124 |
+
}
|
125 |
+
|
126 |
+
}
|
127 |
+
|
128 |
+
return !empty($price) ? $price : null;
|
129 |
+
}
|
130 |
+
|
131 |
+
function variation_prices_filter($null, $object_id, $meta_key, $single){
|
132 |
+
|
133 |
+
if(empty($meta_key) && get_post_type($object_id) == 'product_variation'){
|
134 |
+
static $no_filter = false;
|
135 |
+
|
136 |
+
if(empty($no_filter)){
|
137 |
+
$no_filter = true;
|
138 |
+
|
139 |
+
$variation_fields = get_post_meta($object_id);
|
140 |
+
|
141 |
+
foreach($variation_fields as $k => $v){
|
142 |
+
|
143 |
+
if(in_array($k, array('_price', '_regular_price', '_sale_price'))){
|
144 |
+
|
145 |
+
foreach($v as $j => $amount){
|
146 |
+
|
147 |
+
$variation_fields[$k][$j] = apply_filters('wcml_raw_price_amount', $amount, $object_id);
|
148 |
+
|
149 |
+
}
|
150 |
+
|
151 |
+
}
|
152 |
+
|
153 |
+
}
|
154 |
+
|
155 |
+
$no_filter = false;
|
156 |
+
}
|
157 |
+
|
158 |
+
}
|
159 |
+
|
160 |
+
return !empty($variation_fields) ? $variation_fields : null;
|
161 |
+
|
162 |
+
}
|
163 |
+
|
164 |
+
function currency_filter($currency){
|
165 |
+
|
166 |
+
$currency = apply_filters('wcml_price_currency', $currency);
|
167 |
+
|
168 |
+
return $currency;
|
169 |
+
}
|
170 |
+
|
171 |
+
function shipping_taxes_filter($methods){
|
172 |
+
static $filtered_once = false;
|
173 |
+
|
174 |
+
if(empty($filtered_once)){
|
175 |
+
|
176 |
+
global $woocommerce;
|
177 |
+
$woocommerce->shipping->load_shipping_methods();
|
178 |
+
$shipping_methods = $woocommerce->shipping->get_shipping_methods();
|
179 |
+
|
180 |
+
foreach($methods as $k => $method){
|
181 |
+
|
182 |
+
// exceptions
|
183 |
+
if(
|
184 |
+
isset($shipping_methods[$method->id]) && isset($shipping_methods[$method->id]->settings['type']) && $shipping_methods[$method->id]->settings['type'] == 'percent'
|
185 |
+
|| preg_match('/^table_rate-[0-9]+ : [0-9]$/', $k)
|
186 |
+
){
|
187 |
+
continue;
|
188 |
+
}
|
189 |
+
|
190 |
+
|
191 |
+
foreach($method->taxes as $j => $tax){
|
192 |
+
|
193 |
+
$methods[$k]->taxes[$j] = apply_filters('wcml_shipping_price_amount', $methods[$k]->taxes[$j]);
|
194 |
+
|
195 |
+
}
|
196 |
+
|
197 |
+
if($methods[$k]->cost){
|
198 |
+
$methods[$k]->cost = apply_filters('wcml_shipping_price_amount', $methods[$k]->cost);
|
199 |
+
}
|
200 |
+
|
201 |
+
}
|
202 |
+
|
203 |
+
$filtered_once = true;
|
204 |
+
}
|
205 |
+
|
206 |
+
return $methods;
|
207 |
+
}
|
208 |
+
|
209 |
+
function table_rate_shipping_rates($rates){
|
210 |
+
|
211 |
+
foreach($rates as $k => $rate){
|
212 |
+
|
213 |
+
$rates[$k]->rate_cost = apply_filters('wcml_shipping_price_amount', $rates[$k]->rate_cost);
|
214 |
+
$rates[$k]->rate_cost_per_item = apply_filters('wcml_shipping_price_amount', $rates[$k]->rate_cost_per_item);
|
215 |
+
$rates[$k]->rate_cost_per_weight_unit = apply_filters('wcml_shipping_price_amount', $rates[$k]->rate_cost_per_weight_unit);
|
216 |
+
|
217 |
+
}
|
218 |
+
|
219 |
+
return $rates;
|
220 |
+
}
|
221 |
+
|
222 |
+
function table_rate_instance_settings($settings){
|
223 |
+
|
224 |
+
if(is_numeric($settings['handling_fee'])){
|
225 |
+
$settings['handling_fee'] = apply_filters('wcml_shipping_price_amount', $settings['handling_fee']);
|
226 |
+
}
|
227 |
+
$settings['min_cost'] = apply_filters('wcml_shipping_price_amount', $settings['min_cost']);
|
228 |
+
|
229 |
+
return $settings;
|
230 |
+
}
|
231 |
+
|
232 |
+
function adjust_min_amount_required($options){
|
233 |
+
|
234 |
+
if(!empty($options['min_amount'])){
|
235 |
+
|
236 |
+
$options['min_amount'] = apply_filters('wcml_shipping_free_min_amount', $options['min_amount']);
|
237 |
+
|
238 |
+
}
|
239 |
+
|
240 |
+
return $options;
|
241 |
+
}
|
242 |
+
|
243 |
+
function filter_coupon_data($coupon){
|
244 |
+
|
245 |
+
if($coupon->type == 'fixed_cart' || $coupon->type == 'fixed_product'){
|
246 |
+
$coupon->amount = apply_filters('wcml_raw_price_amount', $coupon->amount);
|
247 |
+
}
|
248 |
+
|
249 |
+
|
250 |
+
}
|
251 |
+
|
252 |
+
function get_client_currency(){
|
253 |
+
global $woocommerce;
|
254 |
+
|
255 |
+
if(!empty($woocommerce->session)){
|
256 |
+
$this->client_currency = $woocommerce->session->get('client_currency');
|
257 |
+
if(is_null($this->client_currency)){
|
258 |
+
$this->client_currency = get_option('woocommerce_currency');
|
259 |
+
$woocommerce->session->set('client_currency', $this->client_currency);
|
260 |
+
}
|
261 |
+
}else{
|
262 |
+
$this->client_currency = get_option('woocommerce_currency');
|
263 |
+
}
|
264 |
+
|
265 |
+
return apply_filters('wcml_client_currency', $this->client_currency);
|
266 |
+
}
|
267 |
+
|
268 |
+
function set_client_currency($currency){
|
269 |
+
global $woocommerce;
|
270 |
+
$woocommerce->session->set('client_currency', $currency);
|
271 |
+
do_action('wcml_set_client_currency', $currency);
|
272 |
+
|
273 |
+
}
|
274 |
+
|
275 |
+
function get_exchange_rates(){
|
276 |
+
|
277 |
+
$exchange_rates = apply_filters('wcml_exchange_rates', $this->exchange_rates);
|
278 |
+
|
279 |
+
return $exchange_rates;
|
280 |
+
|
281 |
+
}
|
282 |
+
|
283 |
+
function legacy_update_custom_rates(){
|
284 |
+
|
285 |
+
foreach($_POST['posts'] as $post_id => $rates){
|
286 |
+
|
287 |
+
update_post_meta($post_id, '_custom_conversion_rate', $rates);
|
288 |
+
|
289 |
+
}
|
290 |
+
|
291 |
+
echo json_encode(array());
|
292 |
+
|
293 |
+
exit;
|
294 |
+
}
|
295 |
+
|
296 |
+
function legacy_remove_custom_rates(){
|
297 |
+
|
298 |
+
delete_post_meta($_POST['post_id'], '_custom_conversion_rate');
|
299 |
+
echo json_encode(array());
|
300 |
+
|
301 |
+
exit;
|
302 |
+
}
|
303 |
+
|
304 |
+
|
305 |
+
function currency_switcher( $atts ){
|
306 |
+
|
307 |
+
// format tags
|
308 |
+
// Name - %name
|
309 |
+
// Symbol - %symbol
|
310 |
+
// Code - $code
|
311 |
+
|
312 |
+
extract( shortcode_atts( array(
|
313 |
+
'format' => '%name (%symbol)',
|
314 |
+
), $atts ) );
|
315 |
+
|
316 |
+
$wc_currencies = get_woocommerce_currencies();
|
317 |
+
|
318 |
+
$exchange_rates = $this->get_exchange_rates();
|
319 |
+
|
320 |
+
echo '<select class="wcml_currency_switcher">';
|
321 |
+
foreach($exchange_rates as $currency => $rate){
|
322 |
+
$selected = $currency == $this->get_client_currency() ? ' selected="selcted"' : '';
|
323 |
+
|
324 |
+
$currency_format = preg_replace(array('#%name#', '#%symbol#', '#%code#'),
|
325 |
+
array($wc_currencies[$currency], get_woocommerce_currency_symbol($currency), $currency), $format);
|
326 |
+
|
327 |
+
echo '<option value="' . $currency . '"' . $selected . '>' . $currency_format . '</option>';
|
328 |
+
}
|
329 |
+
echo '</select>';
|
330 |
+
|
331 |
+
}
|
332 |
+
|
333 |
+
function switch_currency(){
|
334 |
+
|
335 |
+
$this->set_client_currency($_POST['currency']);
|
336 |
+
|
337 |
+
do_action('wcml_switch_currency', $_POST['currency']);
|
338 |
+
|
339 |
+
exit;
|
340 |
+
|
341 |
+
}
|
342 |
+
|
343 |
+
|
344 |
+
|
345 |
+
}
|
inc/multi-currency.class.php
ADDED
@@ -0,0 +1,329 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// Our case:
|
4 |
+
// Muli-currency can be enabled by an option in wp_options - wcml_multi_currency_enabled
|
5 |
+
// User currency will be set in the woocommerce session as 'client_currency'
|
6 |
+
//
|
7 |
+
|
8 |
+
class WCML_WC_MultiCurrency{
|
9 |
+
|
10 |
+
private $client_currency;
|
11 |
+
|
12 |
+
private $exchange_rates = array();
|
13 |
+
|
14 |
+
function __construct(){
|
15 |
+
|
16 |
+
add_filter('init', array($this, 'init'), 5);
|
17 |
+
|
18 |
+
}
|
19 |
+
|
20 |
+
function init(){
|
21 |
+
|
22 |
+
add_filter('wcml_price_currency', array($this, 'price_currency_filter'));
|
23 |
+
|
24 |
+
add_filter('wcml_raw_price_amount', array($this, 'raw_price_filter'), 10, 2);
|
25 |
+
|
26 |
+
add_filter('wcml_shipping_price_amount', array($this, 'shipping_price_filter'));
|
27 |
+
add_filter('wcml_shipping_free_min_amount', array($this, 'shipping_free_min_amount'));
|
28 |
+
add_action('woocommerce_product_meta_start', array($this, 'currency_switcher'));
|
29 |
+
|
30 |
+
add_filter('wcml_exchange_rates', array($this, 'get_exchange_rates'));
|
31 |
+
|
32 |
+
// exchange rate GUI and logic
|
33 |
+
if(is_admin()){
|
34 |
+
add_action('wp_ajax_wcml_update_currency', array($this,'update_currency_exchange_rate'));
|
35 |
+
add_action('wp_ajax_wcml_delete_currency', array($this,'delete_currency_exchange_rate'));
|
36 |
+
}
|
37 |
+
|
38 |
+
if(defined('W3TC')){
|
39 |
+
|
40 |
+
$WCML_WC_MultiCurrency_W3TC = new WCML_WC_MultiCurrency_W3TC;
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
add_action('woocommerce_email_before_order_table', array($this, 'fix_currency_before_order_email'));
|
45 |
+
add_action('woocommerce_email_after_order_table', array($this, 'fix_currency_after_order_email'));
|
46 |
+
|
47 |
+
// orders
|
48 |
+
if(is_admin()){
|
49 |
+
global $wp;
|
50 |
+
add_action( 'restrict_manage_posts', array($this, 'filter_orders_by_currency_dropdown'));
|
51 |
+
$wp->add_query_var('_order_currency');
|
52 |
+
|
53 |
+
add_filter('posts_join', array($this, 'filter_orders_by_currency_join'));
|
54 |
+
add_filter('posts_where', array($this, 'filter_orders_by_currency_where'));
|
55 |
+
|
56 |
+
// use correct order currency on order detail page
|
57 |
+
add_filter('woocommerce_currency_symbol', array($this, '_use_order_currency_symbol'));
|
58 |
+
|
59 |
+
}
|
60 |
+
|
61 |
+
}
|
62 |
+
|
63 |
+
static function install(){
|
64 |
+
global $wpdb;
|
65 |
+
|
66 |
+
$sql = "CREATE TABLE IF NOT EXISTS `". $wpdb->prefix ."icl_currencies` (
|
67 |
+
`id` int(11) NOT NULL AUTO_INCREMENT,
|
68 |
+
`code` varchar(7) COLLATE utf8_unicode_ci NOT NULL,
|
69 |
+
`value` varchar(7) COLLATE utf8_unicode_ci DEFAULT NULL,
|
70 |
+
`changed` datetime DEFAULT NULL,
|
71 |
+
PRIMARY KEY (`id`)
|
72 |
+
)";
|
73 |
+
$wpdb->query($sql);
|
74 |
+
|
75 |
+
return;
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
function raw_price_filter($price, $product_id = false) {
|
80 |
+
|
81 |
+
$price = $this->convert_price_amount($price, $this->get_client_currency());
|
82 |
+
|
83 |
+
return $price;
|
84 |
+
|
85 |
+
}
|
86 |
+
|
87 |
+
function shipping_price_filter($price) {
|
88 |
+
|
89 |
+
$price = $this->convert_price_amount($price, $this->get_client_currency());
|
90 |
+
|
91 |
+
return $price;
|
92 |
+
|
93 |
+
}
|
94 |
+
|
95 |
+
function shipping_free_min_amount($price) {
|
96 |
+
|
97 |
+
$price = $this->convert_price_amount($price, $this->get_client_currency());
|
98 |
+
|
99 |
+
return $price;
|
100 |
+
|
101 |
+
}
|
102 |
+
|
103 |
+
function convert_price_amount($amount, $currency = false){
|
104 |
+
|
105 |
+
if(empty($currency)){
|
106 |
+
$currency = $this->get_client_currency();
|
107 |
+
}
|
108 |
+
|
109 |
+
$exchange_rates = $this->get_exchange_rates();
|
110 |
+
|
111 |
+
if(isset($exchange_rates[$currency]) && is_numeric($amount)){
|
112 |
+
$amount = $amount * $exchange_rates[$currency];
|
113 |
+
}else{
|
114 |
+
$amount = 0;
|
115 |
+
}
|
116 |
+
|
117 |
+
return $amount;
|
118 |
+
|
119 |
+
}
|
120 |
+
|
121 |
+
function price_currency_filter($currency){
|
122 |
+
|
123 |
+
if(isset($this->order_currency)){
|
124 |
+
$currency = $this->order_currency;
|
125 |
+
}else{
|
126 |
+
$currency = $this->get_client_currency();
|
127 |
+
}
|
128 |
+
|
129 |
+
return $currency;
|
130 |
+
}
|
131 |
+
|
132 |
+
function get_exchange_rates(){
|
133 |
+
|
134 |
+
if(empty($this->exchange_rates)){
|
135 |
+
global $wpdb;
|
136 |
+
|
137 |
+
$this->exchange_rates = array(get_option('woocommerce_currency') => 1);
|
138 |
+
|
139 |
+
$currencies = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "icl_currencies ORDER BY `id` DESC", OBJECT);
|
140 |
+
|
141 |
+
$woo_currencies = get_woocommerce_currencies();
|
142 |
+
|
143 |
+
foreach($currencies as $currency){
|
144 |
+
if(!empty($woo_currencies[$currency->code])){
|
145 |
+
$this->exchange_rates[$currency->code] = $currency->value;
|
146 |
+
}
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
return $this->exchange_rates;
|
151 |
+
}
|
152 |
+
|
153 |
+
function update_currency_exchange_rate(){
|
154 |
+
if(!wp_verify_nonce($_REQUEST['wcml_nonce'], 'wcml_update_currency')){
|
155 |
+
die('Invalid nonce');
|
156 |
+
}
|
157 |
+
|
158 |
+
global $wpdb;
|
159 |
+
if($_POST['currency_id'] == 0){
|
160 |
+
$wpdb->insert($wpdb->prefix .'icl_currencies', array(
|
161 |
+
'code' => $_POST['currency_code'],
|
162 |
+
'value' => (double) $_POST['currency_value'],
|
163 |
+
'changed' => date('Y-m-d H:i:s')
|
164 |
+
)
|
165 |
+
);
|
166 |
+
|
167 |
+
echo $wpdb->insert_id;
|
168 |
+
} else {
|
169 |
+
$wpdb->update(
|
170 |
+
$wpdb->prefix .'icl_currencies',
|
171 |
+
array(
|
172 |
+
'code' => $_POST['currency_code'],
|
173 |
+
'value' => (double) $_POST['currency_value'],
|
174 |
+
'changed' => date('Y-m-d H:i:s')
|
175 |
+
),
|
176 |
+
array( 'id' => $_POST['currency_id'] )
|
177 |
+
);
|
178 |
+
}
|
179 |
+
die();
|
180 |
+
}
|
181 |
+
|
182 |
+
function delete_currency_exchange_rate(){
|
183 |
+
if(!wp_verify_nonce($_REQUEST['wcml_nonce'], 'wcml_delete_currency')){
|
184 |
+
die('Invalid nonce');
|
185 |
+
}
|
186 |
+
global $wpdb;
|
187 |
+
$wpdb->query($wpdb->prepare("DELETE FROM ". $wpdb->prefix ."icl_currencies WHERE id = %d", $_POST['currency_id']));
|
188 |
+
die();
|
189 |
+
}
|
190 |
+
|
191 |
+
function currency_switcher(){
|
192 |
+
echo(do_shortcode('[currency_switcher]'));
|
193 |
+
}
|
194 |
+
|
195 |
+
function get_client_currency(){
|
196 |
+
global $woocommerce;
|
197 |
+
return $woocommerce->session->get('client_currency');
|
198 |
+
|
199 |
+
}
|
200 |
+
|
201 |
+
function woocommerce_currency_hijack($currency){
|
202 |
+
if(isset($this->order_currency)){
|
203 |
+
$currency = $this->order_currency;
|
204 |
+
}
|
205 |
+
return $currency;
|
206 |
+
}
|
207 |
+
|
208 |
+
// handle currency in order emails before handled in woocommerce
|
209 |
+
function fix_currency_before_order_email($order){
|
210 |
+
|
211 |
+
// backwards comp
|
212 |
+
if(!method_exists($order, 'get_order_currency')) return;
|
213 |
+
|
214 |
+
$this->order_currency = $order->get_order_currency();
|
215 |
+
add_filter('woocommerce_currency', array($this, 'woocommerce_currency_hijack'));
|
216 |
+
}
|
217 |
+
|
218 |
+
function fix_currency_after_order_email($order){
|
219 |
+
unset($this->order_currency);
|
220 |
+
remove_filter('woocommerce_currency', array($this, 'woocommerce_currency_hijack'));
|
221 |
+
}
|
222 |
+
|
223 |
+
function filter_orders_by_currency_join($join){
|
224 |
+
global $wp_query, $typenow, $wpdb;
|
225 |
+
|
226 |
+
if($typenow == 'shop_order' &&!empty($wp_query->query['_order_currency'])){
|
227 |
+
$join .= " JOIN {$wpdb->postmeta} wcml_pm ON {$wpdb->posts}.ID = wcml_pm.post_id AND wcml_pm.meta_key='_order_currency'";
|
228 |
+
}
|
229 |
+
|
230 |
+
return $join;
|
231 |
+
}
|
232 |
+
|
233 |
+
function filter_orders_by_currency_where($where){
|
234 |
+
global $wp_query, $typenow;
|
235 |
+
|
236 |
+
if($typenow == 'shop_order' &&!empty($wp_query->query['_order_currency'])){
|
237 |
+
$where .= " AND wcml_pm.meta_value = '" . esc_sql($wp_query->query['_order_currency']) . "'";
|
238 |
+
}
|
239 |
+
|
240 |
+
return $where;
|
241 |
+
}
|
242 |
+
|
243 |
+
function filter_orders_by_currency_dropdown(){
|
244 |
+
global $woocommerce, $wp_query, $typenow;
|
245 |
+
|
246 |
+
if($typenow != 'shop_order') return false;
|
247 |
+
|
248 |
+
$order_currencies = $this->get_orders_currencies();
|
249 |
+
$currencies = get_woocommerce_currencies();
|
250 |
+
?>
|
251 |
+
<select id="dropdown_shop_order_currency" name="_order_currency">
|
252 |
+
<option value=""><?php _e( 'Show all currencies', 'wpml-wcml' ) ?></option>
|
253 |
+
<?php foreach($order_currencies as $currency => $count): ?>
|
254 |
+
<option value="<?php echo $currency ?>" <?php
|
255 |
+
if ( isset( $wp_query->query['_order_currency'] ) ) selected( $currency, $wp_query->query['_order_currency'] );
|
256 |
+
?> ><?php printf("%s (%s) (%d)", $currencies[$currency], get_woocommerce_currency_symbol($currency), $count) ?></option>
|
257 |
+
<?php endforeach; ?>
|
258 |
+
</select>
|
259 |
+
<?php
|
260 |
+
$woocommerce->add_inline_js( "jQuery('select#dropdown_shop_order_currency, select[name=m]').css('width', '180px').chosen();");
|
261 |
+
|
262 |
+
$this->get_orders_currencies();
|
263 |
+
|
264 |
+
}
|
265 |
+
|
266 |
+
function get_orders_currencies(){
|
267 |
+
global $wpdb;
|
268 |
+
|
269 |
+
$currencies = array();
|
270 |
+
|
271 |
+
$results = $wpdb->get_results("
|
272 |
+
SELECT m.meta_value AS currency, COUNT(m.post_id) AS c
|
273 |
+
FROM {$wpdb->posts} p JOIN {$wpdb->postmeta} m ON p.ID = m.post_id
|
274 |
+
WHERE meta_key='_order_currency' AND p.post_type='shop_order'
|
275 |
+
GROUP BY meta_value
|
276 |
+
");
|
277 |
+
|
278 |
+
foreach($results as $row){
|
279 |
+
$currencies[$row->currency] = $row->c;
|
280 |
+
}
|
281 |
+
|
282 |
+
return $currencies;
|
283 |
+
|
284 |
+
|
285 |
+
}
|
286 |
+
|
287 |
+
function _use_order_currency_symbol($currency){
|
288 |
+
global $wp_query, $typenow, $woocommerce;
|
289 |
+
remove_filter('woocommerce_currency_symbol', array($this, '_use_order_currency_symbol'));
|
290 |
+
|
291 |
+
$current_screen = get_current_screen();
|
292 |
+
|
293 |
+
if($current_screen->id == 'shop_order'){
|
294 |
+
|
295 |
+
$the_order = new WC_Order( get_the_ID() );
|
296 |
+
if($the_order && method_exists($the_order, 'get_order_currency')){
|
297 |
+
$currency = get_woocommerce_currency_symbol($the_order->get_order_currency());
|
298 |
+
}
|
299 |
+
}
|
300 |
+
|
301 |
+
return $currency;
|
302 |
+
}
|
303 |
+
|
304 |
+
|
305 |
+
|
306 |
+
}
|
307 |
+
|
308 |
+
//@todo Move to separate file
|
309 |
+
class WCML_WC_MultiCurrency_W3TC{
|
310 |
+
|
311 |
+
function __construct(){
|
312 |
+
|
313 |
+
add_filter('init', array($this, 'init'), 15);
|
314 |
+
|
315 |
+
}
|
316 |
+
|
317 |
+
function init(){
|
318 |
+
|
319 |
+
add_action('wcml_switch_currency', array($this, 'flush_page_cache'));
|
320 |
+
|
321 |
+
}
|
322 |
+
|
323 |
+
function flush_page_cache(){
|
324 |
+
w3_require_once(W3TC_LIB_W3_DIR . '/AdminActions/FlushActionsAdmin.php');
|
325 |
+
$flush = new W3_AdminActions_FlushActionsAdmin();
|
326 |
+
$flush->flush_pgcache();
|
327 |
+
}
|
328 |
+
|
329 |
+
}
|
inc/orders.class.php
CHANGED
@@ -5,13 +5,14 @@ class WCML_Orders{
|
|
5 |
|
6 |
add_action('init', array($this, 'init'));
|
7 |
|
8 |
-
|
9 |
}
|
10 |
|
11 |
function init(){
|
12 |
|
13 |
add_action('woocommerce_shipping_update_ajax', array($this, 'fix_shipping_update'));
|
14 |
add_action('woocommerce_checkout_update_order_meta', array($this, 'set_order_language'));
|
|
|
|
|
15 |
|
16 |
}
|
17 |
|
@@ -45,5 +46,15 @@ class WCML_Orders{
|
|
45 |
update_post_meta($order_id, 'wpml_language', $language);
|
46 |
}
|
47 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
}
|
5 |
|
6 |
add_action('init', array($this, 'init'));
|
7 |
|
|
|
8 |
}
|
9 |
|
10 |
function init(){
|
11 |
|
12 |
add_action('woocommerce_shipping_update_ajax', array($this, 'fix_shipping_update'));
|
13 |
add_action('woocommerce_checkout_update_order_meta', array($this, 'set_order_language'));
|
14 |
+
|
15 |
+
add_filter('icl_lang_sel_copy_parameters', array($this, 'append_query_parameters'));
|
16 |
|
17 |
}
|
18 |
|
46 |
update_post_meta($order_id, 'wpml_language', $language);
|
47 |
}
|
48 |
}
|
49 |
+
|
50 |
+
function append_query_parameters($parameters){
|
51 |
+
|
52 |
+
if(is_order_received_page() || is_checkout()){
|
53 |
+
if(!in_array('order', $parameters)) $parameters[] = 'order';
|
54 |
+
if(!in_array('key', $parameters)) $parameters[] = 'key';
|
55 |
+
}
|
56 |
+
|
57 |
+
return $parameters;
|
58 |
+
}
|
59 |
|
60 |
}
|
inc/products.class.php
CHANGED
@@ -10,6 +10,7 @@ class WCML_Products{
|
|
10 |
|
11 |
add_action('init', array($this, 'init'));
|
12 |
add_action('init', array($this, 'wc_cart_widget_actions'));
|
|
|
13 |
|
14 |
}
|
15 |
|
@@ -40,11 +41,17 @@ class WCML_Products{
|
|
40 |
|
41 |
add_filter('woocommerce_json_search_found_products', array($this, 'woocommerce_json_search_found_products'));
|
42 |
add_filter('tiny_mce_before_init', array($this, '_mce_set_plugins'), 9);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
add_action('woocommerce_email',array($this,'wcml_refresh_text_domain'));
|
45 |
add_filter('wpml_link_to_translation',array($this,'_filter_link_to_translation'));
|
46 |
-
|
47 |
-
add_filter('woocommerce_json_search_found_products', array($this, 'filter_found_products_by_language'));
|
48 |
add_filter('woocommerce_upsell_crosssell_search_products', array($this, 'filter_woocommerce_upsell_crosssell_posts_by_language'));
|
49 |
|
50 |
add_filter('icl_post_alternative_languages', array($this, 'hide_post_translation_links'));
|
@@ -80,9 +87,13 @@ class WCML_Products{
|
|
80 |
add_filter('woocommerce_checkout_product_title',array($this,'translated_checkout_product_title'),10,2);
|
81 |
|
82 |
|
|
|
|
|
|
|
83 |
// cart functions
|
84 |
add_action('woocommerce_get_cart_item_from_session', array($this, 'translate_cart_contents'), 10, 3);
|
85 |
add_action('woocommerce_cart_loaded_from_session', array($this, 'translate_cart_subtotal'));
|
|
|
86 |
|
87 |
if(isset($_POST['action'])){
|
88 |
if(isset($_POST['product']) && $_POST['action'] == 'apply' && wp_verify_nonce($_POST['wcml_nonce'], 'wcml_test_actions')){
|
@@ -99,13 +110,18 @@ class WCML_Products{
|
|
99 |
}
|
100 |
}
|
101 |
}
|
102 |
-
|
103 |
if(defined('WPSEO_VERSION') && defined('WPSEO_PATH') && isset($_GET['tab']) && $_GET['tab'] == 'products'){
|
104 |
require WPSEO_PATH . 'admin/class-metabox.php';
|
105 |
}
|
106 |
|
107 |
}
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
109 |
function wc_cart_widget_actions(){
|
110 |
add_action('wp_ajax_woocommerce_get_refreshed_fragments',array($this,'wcml_refresh_fragments'),9);
|
111 |
add_action('wp_ajax_nopriv_woocommerce_get_refreshed_fragments',array($this,'wcml_refresh_fragments'),9);
|
@@ -133,22 +149,67 @@ class WCML_Products{
|
|
133 |
function get_product_list($page = 1,$limit = 20){
|
134 |
$args = array();
|
135 |
$args['post_type'] = 'product';
|
136 |
-
$args['post_status'] = 'publish';
|
137 |
$args['suppress_filters'] = false;
|
138 |
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
}
|
144 |
|
145 |
-
|
146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
}
|
148 |
|
149 |
-
return
|
150 |
}
|
151 |
|
|
|
|
|
152 |
function preselect_product_type_in_admin_screen(){
|
153 |
global $pagenow, $wpdb, $sitepress;
|
154 |
if('post-new.php' == $pagenow){
|
@@ -182,7 +243,7 @@ class WCML_Products{
|
|
182 |
*/
|
183 |
function get_products_count(){
|
184 |
global $sitepress,$wpdb;
|
185 |
-
$count = $wpdb->get_var($wpdb->prepare("SELECT count(p.id) 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
|
186 |
return (int)$count;
|
187 |
}
|
188 |
|
@@ -288,10 +349,14 @@ class WCML_Products{
|
|
288 |
* $title - product name
|
289 |
* $category - product category
|
290 |
*/
|
291 |
-
function get_products_from_filter($title,$category,$translation_status,$translation_status_lang,$page,$limit){
|
292 |
global $wpdb,$sitepress;
|
293 |
|
294 |
$current_language = $sitepress->get_current_language();
|
|
|
|
|
|
|
|
|
295 |
$sql = "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->posts AS p";
|
296 |
|
297 |
if($category){
|
@@ -317,10 +382,18 @@ class WCML_Products{
|
|
317 |
}
|
318 |
}
|
319 |
|
320 |
-
$sql .= " WHERE p.post_title LIKE '%s' AND p.post_type = 'product' AND
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
|
322 |
if($category){
|
323 |
$sql .= " AND tx.term_taxonomy_id = %d ";
|
|
|
324 |
}
|
325 |
|
326 |
if(in_array($translation_status,array('not','need_update','in_progress','complete'))){
|
@@ -381,7 +454,8 @@ class WCML_Products{
|
|
381 |
|
382 |
|
383 |
$data = array();
|
384 |
-
|
|
|
385 |
$data['count'] = $wpdb->get_var("SELECT FOUND_ROWS()");
|
386 |
|
387 |
return $data;
|
@@ -430,6 +504,11 @@ class WCML_Products{
|
|
430 |
$product_parent = icl_object_id($orig_product->post_parent, 'product', false, $language);
|
431 |
$args['post_parent'] = is_null($product_parent) ? 0 : $product_parent;
|
432 |
$_POST['to_lang'] = $language;
|
|
|
|
|
|
|
|
|
|
|
433 |
$tr_product_id = wp_insert_post($args);
|
434 |
|
435 |
$sitepress->set_element_language_details($tr_product_id, 'post_' . $orig_product->post_type, $product_trid, $language);
|
@@ -445,6 +524,8 @@ class WCML_Products{
|
|
445 |
$args['post_title'] = $data['title_' . $language];
|
446 |
$args['post_content'] = $data['content_' . $language];
|
447 |
$args['post_excerpt'] = $data['excerpt_' . $language];
|
|
|
|
|
448 |
$_POST['to_lang'] = $language;
|
449 |
wp_update_post($args);
|
450 |
|
@@ -484,7 +565,7 @@ class WCML_Products{
|
|
484 |
|
485 |
|
486 |
//save prices
|
487 |
-
if($woocommerce_wpml->settings['enable_multi_currency'] ==
|
488 |
foreach(wp_get_post_terms($tr_product_id, 'product_type', array("fields" => "names")) as $type){
|
489 |
$product_type = $type;
|
490 |
}
|
@@ -523,7 +604,7 @@ class WCML_Products{
|
|
523 |
ob_start();
|
524 |
$return = array();
|
525 |
|
526 |
-
$this->get_translation_statuses($translations,$languages,$default_language);
|
527 |
$return['status'] = ob_get_clean();
|
528 |
|
529 |
|
@@ -535,7 +616,7 @@ class WCML_Products{
|
|
535 |
$is_variable_product = $this->is_variable_product($original_product_id);
|
536 |
|
537 |
if($is_variable_product){
|
538 |
-
if($woocommerce_wpml->settings['enable_multi_currency'] ==
|
539 |
ob_start();
|
540 |
$this->product_variations_box($tr_product_id,$language);
|
541 |
$return['variations'][$language] = ob_get_clean();
|
@@ -726,20 +807,20 @@ class WCML_Products{
|
|
726 |
}
|
727 |
}
|
728 |
|
729 |
-
function get_translation_flags($active_languages,$default_language){
|
730 |
foreach($active_languages as $language){
|
731 |
-
if ($default_language != $language['code'] && (current_user_can('manage_options') || wpml_check_user_is_translator($default_language,$language['code'])) && (!isset($_POST['translation_status_lang']) || (isset($_POST['translation_status_lang']) && ($_POST['translation_status_lang'] == $language['code']) || $_POST['translation_status_lang']==''))){
|
732 |
echo '<img src="'. ICL_PLUGIN_URL .'/res/flags/'. $language['code'] .'.png" width="18" height="12" class="flag_img" />';
|
733 |
}
|
734 |
}
|
735 |
}
|
736 |
|
737 |
|
738 |
-
function get_translation_statuses($product_translations,$active_languages,$default_language){
|
739 |
global $wpdb;
|
740 |
|
741 |
foreach ($active_languages as $language) {
|
742 |
-
if ($default_language != $language['code'] && (current_user_can('manage_options') || wpml_check_user_is_translator($default_language,$language['code'])) && (!isset($_POST['translation_status_lang']) || (isset($_POST['translation_status_lang']) && ($_POST['translation_status_lang'] == $language['code']) || $_POST['translation_status_lang']==''))) {
|
743 |
if (isset($product_translations[$language['code']])) {
|
744 |
$tr_status = $wpdb->get_row($wpdb->prepare("SELECT status,needs_update FROM " . $wpdb->prefix . "icl_translation_status WHERE translation_id = %d", $product_translations[$language['code']]->translation_id));
|
745 |
if(!$tr_status){
|
@@ -863,6 +944,9 @@ class WCML_Products{
|
|
863 |
$file_paths_array[md5($file_path)] = $file_path;
|
864 |
}
|
865 |
update_post_meta($variation_id,'_file_paths',$file_paths_array);
|
|
|
|
|
|
|
866 |
}
|
867 |
|
868 |
}
|
@@ -958,35 +1042,8 @@ class WCML_Products{
|
|
958 |
}
|
959 |
|
960 |
//sync variation prices
|
961 |
-
if(($woocommerce_wpml->settings['enable_multi_currency'] ==
|
962 |
-
|
963 |
-
$meta_value = get_post_meta($current_post_variation_ids[$dp_key],$meta_key,true);
|
964 |
-
switch ($meta_key){
|
965 |
-
case '_sale_price':
|
966 |
-
if(isset($data['sale_price_'.$lang][$current_post_variation_ids[$dp_key]])){
|
967 |
-
$meta_value = $data['sale_price_'.$lang][$current_post_variation_ids[$dp_key]];
|
968 |
-
}
|
969 |
-
break;
|
970 |
-
case '_regular_price':
|
971 |
-
if(isset($data['regular_price_'.$lang][$current_post_variation_ids[$dp_key]])){
|
972 |
-
$meta_value = $data['regular_price_'.$lang][$current_post_variation_ids[$dp_key]];
|
973 |
-
}
|
974 |
-
break;
|
975 |
-
default:
|
976 |
-
if(isset($data['sale_price_'.$lang][$current_post_variation_ids[$dp_key]]) && !empty($data['sale_price_'.$lang][$current_post_variation_ids[$dp_key]]) && $data['sale_price_'.$lang][$current_post_variation_ids[$dp_key]]<$data['regular_price_'.$lang][$current_post_variation_ids[$dp_key]]){
|
977 |
-
$meta_value = $data['sale_price_'.$lang][$current_post_variation_ids[$dp_key]];
|
978 |
-
}elseif(isset($data['regular_price_'.$lang][$current_post_variation_ids[$dp_key]])){
|
979 |
-
|
980 |
-
$meta_value = $data['regular_price_'.$lang][$current_post_variation_ids[$dp_key]];
|
981 |
-
}
|
982 |
-
|
983 |
-
break;
|
984 |
-
}
|
985 |
-
|
986 |
-
}else{
|
987 |
-
$meta_value = get_post_meta($duplicated_post_variation_ids[$dp_key],$meta_key,true);
|
988 |
-
}
|
989 |
-
|
990 |
update_post_meta($current_post_variation_ids[$dp_key], $meta_key, $meta_value);
|
991 |
}
|
992 |
}
|
@@ -1165,6 +1222,10 @@ class WCML_Products{
|
|
1165 |
function hide_post_translation_links($output){
|
1166 |
global $post;
|
1167 |
|
|
|
|
|
|
|
|
|
1168 |
$post_type = get_post_type($post->ID);
|
1169 |
$checkout_page_id = get_option('woocommerce_checkout_page_id');
|
1170 |
|
@@ -1204,7 +1265,7 @@ class WCML_Products{
|
|
1204 |
|
1205 |
$_product = get_product($translation->element_id);
|
1206 |
// Out of stock attribute
|
1207 |
-
if ($_product->managing_stock() && !$_product->backorders_allowed() && $_product->get_total_stock()<=0){
|
1208 |
$outofstock = 'outofstock';
|
1209 |
}else{
|
1210 |
$outofstock = false;
|
@@ -1442,7 +1503,7 @@ class WCML_Products{
|
|
1442 |
}
|
1443 |
}
|
1444 |
|
1445 |
-
/*
|
1446 |
* get attribute translation
|
1447 |
*/
|
1448 |
function get_custom_attribute_translation($product_id, $attribute_key, $attribute, $lang_code) {
|
@@ -1481,7 +1542,7 @@ class WCML_Products{
|
|
1481 |
$contents[] = 'content';
|
1482 |
$contents[] = 'excerpt';
|
1483 |
$contents[] = 'images';
|
1484 |
-
if($woocommerce_wpml->settings['enable_multi_currency'] ==
|
1485 |
if(!isset($product_type)){
|
1486 |
foreach(wp_get_post_terms($product_id, 'product_type', array("fields" => "names")) as $type){
|
1487 |
$product_type = $type;
|
@@ -1521,7 +1582,7 @@ class WCML_Products{
|
|
1521 |
$contents[] = __('Content','wpml-wcml');
|
1522 |
$contents[] = __('Excerpt','wpml-wcml');
|
1523 |
$contents[] = __('Images','wpml-wcml');
|
1524 |
-
if($woocommerce_wpml->settings['enable_multi_currency'] ==
|
1525 |
foreach(wp_get_post_terms($product_id, 'product_type', array("fields" => "names")) as $type){
|
1526 |
$product_type = $type;
|
1527 |
}
|
@@ -1694,17 +1755,7 @@ class WCML_Products{
|
|
1694 |
}
|
1695 |
|
1696 |
if($product_type == 'simple' || $product_type == 'external'){
|
1697 |
-
|
1698 |
-
$currency_rate = $wpdb->get_var("SELECT c.value FROM ". $wpdb->prefix ."icl_currencies as c LEFT JOIN ". $wpdb->prefix ."icl_languages_currencies as lc ON c.id=lc.currency_id WHERE lc.language_code = '". $lang_code ."'");
|
1699 |
-
if(is_null($currency_rate)){
|
1700 |
-
return get_post_meta($product_id,$var_key,true);
|
1701 |
-
}else{
|
1702 |
-
return round($currency_rate*get_post_meta($product_id,$var_key,true), (int) get_option( 'woocommerce_price_num_decimals' ));
|
1703 |
-
}
|
1704 |
-
|
1705 |
-
}else{
|
1706 |
-
return get_post_meta($tr_post_id,$var_key,true);
|
1707 |
-
}
|
1708 |
}
|
1709 |
|
1710 |
if($product_type == 'variable'){
|
@@ -1726,41 +1777,30 @@ class WCML_Products{
|
|
1726 |
$variables['variation'] = $variation->ID;
|
1727 |
foreach($variation_values as $variation_value){
|
1728 |
if($variation_value->meta_key == $var_key){
|
1729 |
-
if($sitepress->get_default_language() != $lang_code && $woocommerce_wpml->settings['currency_converting_option'] == '1' && in_array($var_key,array('_regular_price','_sale_price'))){
|
1730 |
-
$currency_rate = $wpdb->get_var("SELECT c.value FROM ". $wpdb->prefix ."icl_currencies as c LEFT JOIN ". $wpdb->prefix ."icl_languages_currencies as lc ON c.id=lc.currency_id WHERE lc.language_code = '". $lang_code ."'");
|
1731 |
-
$original_variation_id = icl_object_id($variation->ID,'product_variation',true,$sitepress->get_default_language());
|
1732 |
-
$original_price = get_post_meta($original_variation_id,$var_key,true);
|
1733 |
-
if(is_null($currency_rate)){
|
1734 |
-
$variables['value'] = $original_price;
|
1735 |
-
}else{
|
1736 |
-
$variables['value'] = round($currency_rate*$original_price, (int) get_option( 'woocommerce_price_num_decimals' ));
|
1737 |
-
}
|
1738 |
-
}else{
|
1739 |
$variables['value'] = $variation_value->meta_value;
|
1740 |
-
}
|
1741 |
}else{
|
1742 |
-
|
1743 |
-
|
1744 |
-
$tr_product_attr = get_post_meta($tr_post_id,'_product_attributes',true);
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
}
|
1762 |
}
|
1763 |
-
|
|
|
1764 |
}
|
1765 |
}
|
1766 |
|
@@ -2017,8 +2057,33 @@ class WCML_Products{
|
|
2017 |
}
|
2018 |
}
|
2019 |
|
2020 |
-
function icl_pro_translation_completed($
|
2021 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022 |
}
|
2023 |
|
2024 |
function translate_cart_contents($item, $values, $key) {
|
@@ -2037,7 +2102,7 @@ class WCML_Products{
|
|
2037 |
$item['data']->post->post_title = get_the_title($item['product_id']);
|
2038 |
return $item;
|
2039 |
}
|
2040 |
-
|
2041 |
function translate_cart_subtotal($cart) {
|
2042 |
$cart->calculate_totals();
|
2043 |
}
|
@@ -2103,7 +2168,7 @@ class WCML_Products{
|
|
2103 |
$new_found_products = array();
|
2104 |
foreach($found_products as $post => $formatted_product_name) {
|
2105 |
$product_language = $sitepress->get_language_for_element($post, 'post_product');
|
2106 |
-
if($product_language == $sitepress->
|
2107 |
$new_found_products[$post] = $formatted_product_name;
|
2108 |
}
|
2109 |
}
|
@@ -2113,7 +2178,7 @@ class WCML_Products{
|
|
2113 |
|
2114 |
function wcml_refresh_fragments(){
|
2115 |
global $woocommerce,$woocommerce_wpml;
|
2116 |
-
|
2117 |
$woocommerce->cart->calculate_totals();
|
2118 |
$this->wcml_refresh_text_domain();
|
2119 |
}
|
@@ -2136,4 +2201,138 @@ class WCML_Products{
|
|
2136 |
}
|
2137 |
return $settings;
|
2138 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2139 |
}
|
10 |
|
11 |
add_action('init', array($this, 'init'));
|
12 |
add_action('init', array($this, 'wc_cart_widget_actions'));
|
13 |
+
add_action('init', array($this, 'set_price_config'), 16); // After TM parses wpml-config.xml
|
14 |
|
15 |
}
|
16 |
|
41 |
|
42 |
add_filter('woocommerce_json_search_found_products', array($this, 'woocommerce_json_search_found_products'));
|
43 |
add_filter('tiny_mce_before_init', array($this, '_mce_set_plugins'), 9);
|
44 |
+
|
45 |
+
add_action('admin_head', array($this, 'hide_multilingual_content_setup_box'));
|
46 |
+
|
47 |
+
add_action('woocommerce_duplicate_product',array($this,'woocommerce_duplicate_product'),10,2);
|
48 |
+
|
49 |
+
}else{
|
50 |
+
add_filter('woocommerce_json_search_found_products', array($this, 'filter_found_products_by_language'));
|
51 |
}
|
52 |
add_action('woocommerce_email',array($this,'wcml_refresh_text_domain'));
|
53 |
add_filter('wpml_link_to_translation',array($this,'_filter_link_to_translation'));
|
54 |
+
|
|
|
55 |
add_filter('woocommerce_upsell_crosssell_search_products', array($this, 'filter_woocommerce_upsell_crosssell_posts_by_language'));
|
56 |
|
57 |
add_filter('icl_post_alternative_languages', array($this, 'hide_post_translation_links'));
|
87 |
add_filter('woocommerce_checkout_product_title',array($this,'translated_checkout_product_title'),10,2);
|
88 |
|
89 |
|
90 |
+
//WooCommerce subscription
|
91 |
+
add_filter('woocommerce_users_subscriptions',array($this, 'woocommerce_users_subscriptions'),10,2);
|
92 |
+
|
93 |
// cart functions
|
94 |
add_action('woocommerce_get_cart_item_from_session', array($this, 'translate_cart_contents'), 10, 3);
|
95 |
add_action('woocommerce_cart_loaded_from_session', array($this, 'translate_cart_subtotal'));
|
96 |
+
add_action('woocommerce_before_calculate_totals',array($this,'woocommerce_calculate_totals'));
|
97 |
|
98 |
if(isset($_POST['action'])){
|
99 |
if(isset($_POST['product']) && $_POST['action'] == 'apply' && wp_verify_nonce($_POST['wcml_nonce'], 'wcml_test_actions')){
|
110 |
}
|
111 |
}
|
112 |
}
|
113 |
+
|
114 |
if(defined('WPSEO_VERSION') && defined('WPSEO_PATH') && isset($_GET['tab']) && $_GET['tab'] == 'products'){
|
115 |
require WPSEO_PATH . 'admin/class-metabox.php';
|
116 |
}
|
117 |
|
118 |
}
|
119 |
+
|
120 |
+
function hide_multilingual_content_setup_box(){
|
121 |
+
remove_meta_box('icl_div_config', convert_to_screen('shop_order'), 'normal');
|
122 |
+
remove_meta_box('icl_div_config', convert_to_screen('shop_coupon'), 'normal');
|
123 |
+
}
|
124 |
+
|
125 |
function wc_cart_widget_actions(){
|
126 |
add_action('wp_ajax_woocommerce_get_refreshed_fragments',array($this,'wcml_refresh_fragments'),9);
|
127 |
add_action('wp_ajax_nopriv_woocommerce_get_refreshed_fragments',array($this,'wcml_refresh_fragments'),9);
|
149 |
function get_product_list($page = 1,$limit = 20){
|
150 |
$args = array();
|
151 |
$args['post_type'] = 'product';
|
152 |
+
$args['post_status'] = array('publish','future','draft','pending','private');
|
153 |
$args['suppress_filters'] = false;
|
154 |
|
155 |
+
$args['posts_per_page'] = -1;
|
156 |
+
|
157 |
+
return $this->display_hierarchical(get_posts($args),$page,$limit);
|
158 |
+
}
|
159 |
+
|
160 |
+
function display_hierarchical($products, $pagenum, $per_page){
|
161 |
+
global $wpdb;
|
162 |
+
|
163 |
+
if (!$products ){
|
164 |
+
return false;
|
165 |
+
}
|
166 |
+
|
167 |
+
$output_products = array();
|
168 |
+
$top_level_products = array();
|
169 |
+
$children_products = array();
|
170 |
+
|
171 |
+
foreach ( $products as $product ) {
|
172 |
+
// catch and repair bad products
|
173 |
+
if ( $product->post_parent == $product->ID ) {
|
174 |
+
$product->post_parent = 0;
|
175 |
+
$wpdb->update( $wpdb->posts, array( 'post_parent' => 0 ), array( 'ID' => $product->ID ) );
|
176 |
+
}
|
177 |
+
|
178 |
+
if ( 0 == $product->post_parent ){
|
179 |
+
$top_level_products[] = $product;
|
180 |
+
}else{
|
181 |
+
$children_products[$product->post_parent][] = $product;
|
182 |
+
}
|
183 |
}
|
184 |
|
185 |
+
$count = 0;
|
186 |
+
$start = ( $pagenum - 1 ) * $per_page;
|
187 |
+
$end = $start + $per_page;
|
188 |
+
|
189 |
+
foreach ( $top_level_products as $product ) {
|
190 |
+
if ( $count >= $end )
|
191 |
+
break;
|
192 |
+
|
193 |
+
if ( $count >= $start ) {
|
194 |
+
$output_products[] = $product;
|
195 |
+
|
196 |
+
if ( isset( $children_products[$product->ID] ) ){
|
197 |
+
foreach($children_products[$product->ID] as $children){
|
198 |
+
$output_products[] = $children;
|
199 |
+
$count++;
|
200 |
+
}
|
201 |
+
unset($children_products[$product->ID]);
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
$count++;
|
206 |
}
|
207 |
|
208 |
+
return $output_products;
|
209 |
}
|
210 |
|
211 |
+
|
212 |
+
|
213 |
function preselect_product_type_in_admin_screen(){
|
214 |
global $pagenow, $wpdb, $sitepress;
|
215 |
if('post-new.php' == $pagenow){
|
243 |
*/
|
244 |
function get_products_count(){
|
245 |
global $sitepress,$wpdb;
|
246 |
+
$count = $wpdb->get_var($wpdb->prepare("SELECT count(p.id) 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",$sitepress->get_current_language()));
|
247 |
return (int)$count;
|
248 |
}
|
249 |
|
349 |
* $title - product name
|
350 |
* $category - product category
|
351 |
*/
|
352 |
+
function get_products_from_filter($title,$category,$translation_status,$product_status,$translation_status_lang,$page,$limit){
|
353 |
global $wpdb,$sitepress;
|
354 |
|
355 |
$current_language = $sitepress->get_current_language();
|
356 |
+
$prepare_arg = array();
|
357 |
+
$prepare_arg[] = '%'.$title.'%';
|
358 |
+
$prepare_arg[] = $current_language;
|
359 |
+
|
360 |
$sql = "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->posts AS p";
|
361 |
|
362 |
if($category){
|
382 |
}
|
383 |
}
|
384 |
|
385 |
+
$sql .= " WHERE p.post_title LIKE '%s' AND p.post_type = 'product' AND t.element_type = 'post_product' AND t.language_code = %s";
|
386 |
+
|
387 |
+
if($product_status != 'all'){
|
388 |
+
$sql .= " AND p.post_status = %s ";
|
389 |
+
$prepare_arg[] = $product_status;
|
390 |
+
}else{
|
391 |
+
$sql .= " AND p.post_status NOT IN ('trash','auto-draft','inherit') ";
|
392 |
+
}
|
393 |
|
394 |
if($category){
|
395 |
$sql .= " AND tx.term_taxonomy_id = %d ";
|
396 |
+
$prepare_arg[] = $category;
|
397 |
}
|
398 |
|
399 |
if(in_array($translation_status,array('not','need_update','in_progress','complete'))){
|
454 |
|
455 |
|
456 |
$data = array();
|
457 |
+
|
458 |
+
$data['products'] = $wpdb->get_results($wpdb->prepare($sql,$prepare_arg));
|
459 |
$data['count'] = $wpdb->get_var("SELECT FOUND_ROWS()");
|
460 |
|
461 |
return $data;
|
504 |
$product_parent = icl_object_id($orig_product->post_parent, 'product', false, $language);
|
505 |
$args['post_parent'] = is_null($product_parent) ? 0 : $product_parent;
|
506 |
$_POST['to_lang'] = $language;
|
507 |
+
|
508 |
+
if($woocommerce_wpml->settings['products_sync_date']){
|
509 |
+
$args['post_date'] = $orig_product->post_date;
|
510 |
+
}
|
511 |
+
|
512 |
$tr_product_id = wp_insert_post($args);
|
513 |
|
514 |
$sitepress->set_element_language_details($tr_product_id, 'post_' . $orig_product->post_type, $product_trid, $language);
|
524 |
$args['post_title'] = $data['title_' . $language];
|
525 |
$args['post_content'] = $data['content_' . $language];
|
526 |
$args['post_excerpt'] = $data['excerpt_' . $language];
|
527 |
+
$product_parent = icl_object_id($orig_product->post_parent, 'product', false, $language);
|
528 |
+
$args['post_parent'] = is_null($product_parent) ? 0 : $product_parent;
|
529 |
$_POST['to_lang'] = $language;
|
530 |
wp_update_post($args);
|
531 |
|
565 |
|
566 |
|
567 |
//save prices
|
568 |
+
if($woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT){
|
569 |
foreach(wp_get_post_terms($tr_product_id, 'product_type', array("fields" => "names")) as $type){
|
570 |
$product_type = $type;
|
571 |
}
|
604 |
ob_start();
|
605 |
$return = array();
|
606 |
|
607 |
+
$this->get_translation_statuses($translations,$languages,$default_language,$_POST['slang'] != 'all'?$_POST['slang']:false);
|
608 |
$return['status'] = ob_get_clean();
|
609 |
|
610 |
|
616 |
$is_variable_product = $this->is_variable_product($original_product_id);
|
617 |
|
618 |
if($is_variable_product){
|
619 |
+
if($woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT){
|
620 |
ob_start();
|
621 |
$this->product_variations_box($tr_product_id,$language);
|
622 |
$return['variations'][$language] = ob_get_clean();
|
807 |
}
|
808 |
}
|
809 |
|
810 |
+
function get_translation_flags($active_languages,$default_language,$slang = false){
|
811 |
foreach($active_languages as $language){
|
812 |
+
if ($default_language != $language['code'] && (($slang && $slang == $language['code']) || !$slang) && (current_user_can('manage_options') || wpml_check_user_is_translator($default_language,$language['code'])) && (!isset($_POST['translation_status_lang']) || (isset($_POST['translation_status_lang']) && ($_POST['translation_status_lang'] == $language['code']) || $_POST['translation_status_lang']==''))){
|
813 |
echo '<img src="'. ICL_PLUGIN_URL .'/res/flags/'. $language['code'] .'.png" width="18" height="12" class="flag_img" />';
|
814 |
}
|
815 |
}
|
816 |
}
|
817 |
|
818 |
|
819 |
+
function get_translation_statuses($product_translations,$active_languages,$default_language,$slang = false){
|
820 |
global $wpdb;
|
821 |
|
822 |
foreach ($active_languages as $language) {
|
823 |
+
if ($default_language != $language['code'] && (($slang && $slang == $language['code']) || !$slang) && (current_user_can('manage_options') || wpml_check_user_is_translator($default_language,$language['code'])) && (!isset($_POST['translation_status_lang']) || (isset($_POST['translation_status_lang']) && ($_POST['translation_status_lang'] == $language['code']) || $_POST['translation_status_lang']==''))) {
|
824 |
if (isset($product_translations[$language['code']])) {
|
825 |
$tr_status = $wpdb->get_row($wpdb->prepare("SELECT status,needs_update FROM " . $wpdb->prefix . "icl_translation_status WHERE translation_id = %d", $product_translations[$language['code']]->translation_id));
|
826 |
if(!$tr_status){
|
944 |
$file_paths_array[md5($file_path)] = $file_path;
|
945 |
}
|
946 |
update_post_meta($variation_id,'_file_paths',$file_paths_array);
|
947 |
+
}else{
|
948 |
+
$orig_file_path = maybe_unserialize(get_post_meta($post_data->ID,'_file_paths',true));
|
949 |
+
update_post_meta($variation_id,'_file_paths',$orig_file_path);
|
950 |
}
|
951 |
|
952 |
}
|
1042 |
}
|
1043 |
|
1044 |
//sync variation prices
|
1045 |
+
if(($woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT || $trbl) && in_array($meta_key,array('_sale_price','_regular_price','_price'))){
|
1046 |
+
$meta_value = get_post_meta($duplicated_post_variation_ids[$dp_key],$meta_key,true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1047 |
update_post_meta($current_post_variation_ids[$dp_key], $meta_key, $meta_value);
|
1048 |
}
|
1049 |
}
|
1222 |
function hide_post_translation_links($output){
|
1223 |
global $post;
|
1224 |
|
1225 |
+
if(is_null($post)){
|
1226 |
+
return $output;
|
1227 |
+
}
|
1228 |
+
|
1229 |
$post_type = get_post_type($post->ID);
|
1230 |
$checkout_page_id = get_option('woocommerce_checkout_page_id');
|
1231 |
|
1265 |
|
1266 |
$_product = get_product($translation->element_id);
|
1267 |
// Out of stock attribute
|
1268 |
+
if ($_product && $_product->exists() && $_product->managing_stock() && !$_product->backorders_allowed() && $_product->get_total_stock()<=0){
|
1269 |
$outofstock = 'outofstock';
|
1270 |
}else{
|
1271 |
$outofstock = false;
|
1503 |
}
|
1504 |
}
|
1505 |
|
1506 |
+
/*
|
1507 |
* get attribute translation
|
1508 |
*/
|
1509 |
function get_custom_attribute_translation($product_id, $attribute_key, $attribute, $lang_code) {
|
1542 |
$contents[] = 'content';
|
1543 |
$contents[] = 'excerpt';
|
1544 |
$contents[] = 'images';
|
1545 |
+
if($woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT){
|
1546 |
if(!isset($product_type)){
|
1547 |
foreach(wp_get_post_terms($product_id, 'product_type', array("fields" => "names")) as $type){
|
1548 |
$product_type = $type;
|
1582 |
$contents[] = __('Content','wpml-wcml');
|
1583 |
$contents[] = __('Excerpt','wpml-wcml');
|
1584 |
$contents[] = __('Images','wpml-wcml');
|
1585 |
+
if($woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT){
|
1586 |
foreach(wp_get_post_terms($product_id, 'product_type', array("fields" => "names")) as $type){
|
1587 |
$product_type = $type;
|
1588 |
}
|
1755 |
}
|
1756 |
|
1757 |
if($product_type == 'simple' || $product_type == 'external'){
|
1758 |
+
return get_post_meta($tr_post_id, $var_key, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1759 |
}
|
1760 |
|
1761 |
if($product_type == 'variable'){
|
1777 |
$variables['variation'] = $variation->ID;
|
1778 |
foreach($variation_values as $variation_value){
|
1779 |
if($variation_value->meta_key == $var_key){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1780 |
$variables['value'] = $variation_value->meta_value;
|
|
|
1781 |
}else{
|
1782 |
+
//get attribute name
|
1783 |
+
$attribute = str_replace('attribute_','',$variation_value->meta_key);
|
1784 |
+
$tr_product_attr = maybe_unserialize(get_post_meta($tr_post_id,'_product_attributes',true));
|
1785 |
+
$term_name = get_term_by('slug',$variation_value->meta_value,$tr_product_attr[$attribute]['name']);
|
1786 |
+
|
1787 |
+
if($term_name){
|
1788 |
+
//if attribute is taxonomy
|
1789 |
+
$term_name = $term_name->name;
|
1790 |
+
}else{
|
1791 |
+
//if attribute isn't taxonomy
|
1792 |
+
if(isset($tr_product_attr[$attribute]) && !$tr_product_attr[$attribute]['is_taxonomy']){
|
1793 |
+
$term_name = $variation_value->meta_value;
|
1794 |
+
}
|
1795 |
|
1796 |
+
if(!$term_name){
|
1797 |
+
$label = __('Please translate all attributes','wpml-wcml');
|
1798 |
+
$variables['label'] .= $label.' & ';
|
1799 |
+
$variables['not_translated'] = true;
|
1800 |
+
continue;
|
|
|
1801 |
}
|
1802 |
+
}
|
1803 |
+
$variables['label'] .= urldecode($term_name).' & ';
|
1804 |
}
|
1805 |
}
|
1806 |
|
2057 |
}
|
2058 |
}
|
2059 |
|
2060 |
+
function icl_pro_translation_completed($tr_product_id) {
|
2061 |
+
global $sitepress;
|
2062 |
+
$default_language = $sitepress->get_default_language();
|
2063 |
+
|
2064 |
+
$original_product_id = icl_object_id($tr_product_id, 'product', false, $default_language);
|
2065 |
+
if(is_null($original_product_id)){
|
2066 |
+
return;
|
2067 |
+
}
|
2068 |
+
|
2069 |
+
$lang = $sitepress->get_language_for_element($tr_product_id,'post_product');
|
2070 |
+
$this->duplicate_product_post_meta($original_product_id,$tr_product_id);
|
2071 |
+
|
2072 |
+
//duplicate product attrs
|
2073 |
+
$orig_product_attrs = $this->get_product_atributes($original_product_id);
|
2074 |
+
add_post_meta($tr_product_id,'_product_attributes',$orig_product_attrs);
|
2075 |
+
|
2076 |
+
$this->sync_default_product_attr($original_product_id, $tr_product_id, $lang);
|
2077 |
+
//sync media
|
2078 |
+
$this->sync_thumbnail_id($original_product_id, $tr_product_id,$lang);
|
2079 |
+
$this->sync_product_gallery($original_product_id);
|
2080 |
+
|
2081 |
+
//sync taxonomies
|
2082 |
+
$this->sync_product_taxonomies($original_product_id,$tr_product_id,$lang);
|
2083 |
+
|
2084 |
+
//duplicate variations
|
2085 |
+
$this->sync_product_variations($original_product_id,$tr_product_id,$lang);
|
2086 |
+
|
2087 |
}
|
2088 |
|
2089 |
function translate_cart_contents($item, $values, $key) {
|
2102 |
$item['data']->post->post_title = get_the_title($item['product_id']);
|
2103 |
return $item;
|
2104 |
}
|
2105 |
+
|
2106 |
function translate_cart_subtotal($cart) {
|
2107 |
$cart->calculate_totals();
|
2108 |
}
|
2168 |
$new_found_products = array();
|
2169 |
foreach($found_products as $post => $formatted_product_name) {
|
2170 |
$product_language = $sitepress->get_language_for_element($post, 'post_product');
|
2171 |
+
if($product_language == $sitepress->get_default_language()) {
|
2172 |
$new_found_products[$post] = $formatted_product_name;
|
2173 |
}
|
2174 |
}
|
2178 |
|
2179 |
function wcml_refresh_fragments(){
|
2180 |
global $woocommerce,$woocommerce_wpml;
|
2181 |
+
|
2182 |
$woocommerce->cart->calculate_totals();
|
2183 |
$this->wcml_refresh_text_domain();
|
2184 |
}
|
2201 |
}
|
2202 |
return $settings;
|
2203 |
}
|
2204 |
+
|
2205 |
+
|
2206 |
+
/*
|
2207 |
+
* Filter for WooCommerce subscriptions
|
2208 |
+
*/
|
2209 |
+
function woocommerce_users_subscriptions($subscriptions, $user_id){
|
2210 |
+
global $sitepress;
|
2211 |
+
|
2212 |
+
foreach($subscriptions as $key=>$subscription){
|
2213 |
+
$subscriptions[$key]['product_id'] = icl_object_id($subscriptions[$key]['product_id'],get_post_type($subscriptions[$key]['product_id']),true,$sitepress->get_current_language());
|
2214 |
+
}
|
2215 |
+
|
2216 |
+
return $subscriptions;
|
2217 |
+
}
|
2218 |
+
|
2219 |
+
/*
|
2220 |
+
* Update cart and cart session when switch language
|
2221 |
+
*/
|
2222 |
+
function woocommerce_calculate_totals($cart){
|
2223 |
+
global $sitepress, $woocommerce;
|
2224 |
+
$current_language = $sitepress->get_current_language();
|
2225 |
+
$new_cart_data = array();
|
2226 |
+
|
2227 |
+
foreach($cart->cart_contents as $key=>$cart_item){
|
2228 |
+
$tr_product_id = icl_object_id($cart_item['product_id'],'product',false,$current_language);
|
2229 |
+
if(isset($cart->cart_contents[$key]['variation_id']) && $cart->cart_contents[$key]['variation_id']){
|
2230 |
+
$tr_variation_id = icl_object_id($cart_item['variation_id'],'product_variation',false,$current_language);
|
2231 |
+
if(!is_null($tr_variation_id)){
|
2232 |
+
$price = get_post_meta($tr_variation_id,'_price',true);
|
2233 |
+
$cart->cart_contents[$key]['product_id'] = $tr_product_id;
|
2234 |
+
$cart->cart_contents[$key]['variation_id'] = $tr_variation_id;
|
2235 |
+
$cart->cart_contents[$key]['data'] = get_product( $tr_variation_id );
|
2236 |
+
if($cart_item['variation']){
|
2237 |
+
|
2238 |
+
foreach($cart_item['variation'] as $attr_key=>$attribute){
|
2239 |
+
if(taxonomy_exists($attr_key)){
|
2240 |
+
$term = get_term_by('slug',$attribute,$attr_key);
|
2241 |
+
$trnsl_term_id = icl_object_id($term->term_id,$attr_key,true,$current_language);
|
2242 |
+
|
2243 |
+
$cart->cart_contents[$key]['variation'][$attr_key] = get_term($trnsl_term_id,$attr_key)->slug;
|
2244 |
+
}else{
|
2245 |
+
$orig_product_attributes = get_post_meta($cart_item['product_id'], '_product_attributes', true);
|
2246 |
+
$unserialized_orig_product_attributes = maybe_unserialize($orig_product_attributes);
|
2247 |
+
foreach($unserialized_orig_product_attributes as $orig_attr_key => $orig_product_attribute){
|
2248 |
+
if($attr_key == $orig_attr_key){
|
2249 |
+
$values = explode('|',$orig_product_attribute['value']);
|
2250 |
+
foreach($values as $key_id => $value){
|
2251 |
+
if($value == $attribute){
|
2252 |
+
$attr_key_id = $key_id;
|
2253 |
+
}
|
2254 |
+
}
|
2255 |
+
}
|
2256 |
+
}
|
2257 |
+
|
2258 |
+
$trnsl_product_attributes = get_post_meta($tr_product_id, '_product_attributes', true);
|
2259 |
+
$unserialized_trnsl_product_attributes = maybe_unserialize($trnsl_product_attributes);
|
2260 |
+
|
2261 |
+
$trnsl_attr_values = explode('|',$unserialized_trnsl_product_attributes[$attr_key]['value']);
|
2262 |
+
if(isset($trnsl_attr_values[$attr_key_id])){
|
2263 |
+
$cart->cart_contents[$key]['variation'][$attr_key] = $trnsl_attr_values[$attr_key_id];
|
2264 |
+
}
|
2265 |
+
}
|
2266 |
+
}
|
2267 |
+
}
|
2268 |
+
}
|
2269 |
+
}else{
|
2270 |
+
if(!is_null($tr_product_id)){
|
2271 |
+
$price = get_post_meta($tr_product_id,'_price',true);
|
2272 |
+
$cart->cart_contents[$key]['product_id'] = $tr_product_id;
|
2273 |
+
$cart->cart_contents[$key]['data'] = get_product( $tr_product_id );
|
2274 |
+
}
|
2275 |
+
}
|
2276 |
+
|
2277 |
+
if(!is_null($tr_product_id)){
|
2278 |
+
$new_key = $woocommerce->cart->generate_cart_id( $cart->cart_contents[$key]['product_id'], $cart->cart_contents[$key]['variation_id'], $cart->cart_contents[$key]['variation'], $cart->cart_contents[$key]['data'] );
|
2279 |
+
$new_cart_data[$new_key] = $cart->cart_contents[$key];
|
2280 |
+
}
|
2281 |
+
|
2282 |
+
}
|
2283 |
+
$cart->cart_contents = $new_cart_data;
|
2284 |
+
|
2285 |
+
$woocommerce->session->cart = $cart;
|
2286 |
+
|
2287 |
+
return $cart;
|
2288 |
+
}
|
2289 |
+
|
2290 |
+
|
2291 |
+
function set_price_config() {
|
2292 |
+
global $sitepress, $iclTranslationManagement,$sitepress_settings;
|
2293 |
+
|
2294 |
+
$all_products_taxonomies = get_taxonomies(array('object_type'=>array('product')),'objects');
|
2295 |
+
foreach($all_products_taxonomies as $tax_key => $tax){
|
2296 |
+
if($tax_key == 'product_type') continue;
|
2297 |
+
$sitepress_settings["translation-management"]["taxonomies_readonly_config"][$tax_key] = 1;
|
2298 |
+
$sitepress_settings["taxonomies_sync_option"][$tax_key] = 1;
|
2299 |
+
}
|
2300 |
+
$sitepress->save_settings($sitepress_settings);
|
2301 |
+
|
2302 |
+
$wpml_settings = $sitepress->get_settings();
|
2303 |
+
if (!isset($wpml_settings['translation-management'])) {
|
2304 |
+
return;
|
2305 |
+
}
|
2306 |
+
|
2307 |
+
$keys = array(
|
2308 |
+
'_regular_price',
|
2309 |
+
'_sale_price',
|
2310 |
+
'_price',
|
2311 |
+
'_min_variation_regular_price',
|
2312 |
+
'_min_variation_sale_price',
|
2313 |
+
'_min_variation_price',
|
2314 |
+
'_max_variation_regular_price',
|
2315 |
+
'_max_variation_sale_price',
|
2316 |
+
'_max_variation_price'
|
2317 |
+
);
|
2318 |
+
$save = false;
|
2319 |
+
foreach ($keys as $key) {
|
2320 |
+
$iclTranslationManagement->settings['custom_fields_readonly_config'][] = $key;
|
2321 |
+
if (!isset($sitepress_settings['translation-management']['custom_fields_translation'][$key]) ||
|
2322 |
+
$wpml_settings['translation-management']['custom_fields_translation'][$key] != 1) {
|
2323 |
+
$wpml_settings['translation-management']['custom_fields_translation'][$key] = 1;
|
2324 |
+
$save = true;
|
2325 |
+
}
|
2326 |
+
}
|
2327 |
+
if ($save) {
|
2328 |
+
$sitepress->save_settings($wpml_settings);
|
2329 |
+
}
|
2330 |
+
}
|
2331 |
+
|
2332 |
+
|
2333 |
+
function woocommerce_duplicate_product($new_id, $post){
|
2334 |
+
global $sitepress;
|
2335 |
+
$sitepress->set_element_language_details($new_id, 'post_' . $post->post_type, false, $sitepress->get_current_language());
|
2336 |
+
}
|
2337 |
+
|
2338 |
}
|
inc/requests.class.php
CHANGED
@@ -12,24 +12,8 @@ class WCML_Requests{
|
|
12 |
global $woocommerce_wpml;
|
13 |
|
14 |
if(isset($_POST['general_options']) && check_admin_referer('general_options', 'general_options_nonce') && wp_verify_nonce($_POST['wcml_nonce'], 'general_options')){
|
15 |
-
$enable_multi_currency = (isset($_POST['multi_currency'])) ? trim($_POST['multi_currency']) : null;
|
16 |
-
$currency_converting_option = isset($_POST['currency_converting_option'])?$_POST['currency_converting_option']:null;
|
17 |
|
18 |
-
|
19 |
-
$woocommerce_wpml->currencies->set_auto_currency_to_all_products_and_variations();
|
20 |
-
}
|
21 |
-
|
22 |
-
if($currency_converting_option[0] == '1'){
|
23 |
-
$woocommerce_wpml->settings['currency_converting_option'] = 1;
|
24 |
-
} else if($currency_converting_option[0] == '2'){
|
25 |
-
$woocommerce_wpml->settings['currency_converting_option'] = 2;
|
26 |
-
}
|
27 |
-
|
28 |
-
if($enable_multi_currency == 'on'){
|
29 |
-
$woocommerce_wpml->settings['enable_multi_currency'] = 'yes';
|
30 |
-
} else {
|
31 |
-
$woocommerce_wpml->settings['enable_multi_currency'] = 'no';
|
32 |
-
}
|
33 |
|
34 |
$woocommerce_wpml->update_settings();
|
35 |
|
@@ -75,11 +59,16 @@ class WCML_Requests{
|
|
75 |
$sitepress_settings['translation-management']['custom_fields_translation']['_file_paths'] = $new_value;
|
76 |
$sitepress->save_settings($sitepress_settings);
|
77 |
}
|
78 |
-
|
79 |
if(isset($_POST['wcml_trsl_interface_table']) && wp_verify_nonce($_POST['wcml_nonce'], 'wcml_trsl_interface_table')){
|
80 |
$woocommerce_wpml->settings['trnsl_interface'] = $_POST['trnsl_interface'];
|
81 |
$woocommerce_wpml->update_settings();
|
82 |
}
|
|
|
|
|
|
|
|
|
|
|
83 |
|
84 |
if(isset($_GET['wcml_action']) && $_GET['wcml_action'] = 'dismiss'){
|
85 |
$woocommerce_wpml->settings['dismiss_doc_main'] = 'yes';
|
12 |
global $woocommerce_wpml;
|
13 |
|
14 |
if(isset($_POST['general_options']) && check_admin_referer('general_options', 'general_options_nonce') && wp_verify_nonce($_POST['wcml_nonce'], 'general_options')){
|
|
|
|
|
15 |
|
16 |
+
$woocommerce_wpml->settings['enable_multi_currency'] = $_POST['multi_currency'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
$woocommerce_wpml->update_settings();
|
19 |
|
59 |
$sitepress_settings['translation-management']['custom_fields_translation']['_file_paths'] = $new_value;
|
60 |
$sitepress->save_settings($sitepress_settings);
|
61 |
}
|
62 |
+
|
63 |
if(isset($_POST['wcml_trsl_interface_table']) && wp_verify_nonce($_POST['wcml_nonce'], 'wcml_trsl_interface_table')){
|
64 |
$woocommerce_wpml->settings['trnsl_interface'] = $_POST['trnsl_interface'];
|
65 |
$woocommerce_wpml->update_settings();
|
66 |
}
|
67 |
+
|
68 |
+
if(isset($_POST['wcml_products_sync_prop']) && wp_verify_nonce($_POST['wcml_nonce'], 'wcml_products_sync_prop')){
|
69 |
+
$woocommerce_wpml->settings['products_sync_date'] = empty($_POST['products_sync_date']) ? 0 : 1;
|
70 |
+
$woocommerce_wpml->update_settings();
|
71 |
+
}
|
72 |
|
73 |
if(isset($_GET['wcml_action']) && $_GET['wcml_action'] = 'dismiss'){
|
74 |
$woocommerce_wpml->settings['dismiss_doc_main'] = 'yes';
|
inc/store-pages.class.php
CHANGED
@@ -20,6 +20,11 @@ class WCML_Store_Pages{
|
|
20 |
$this->create_missing_store_pages();
|
21 |
}
|
22 |
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
}
|
25 |
|
@@ -53,6 +58,17 @@ class WCML_Store_Pages{
|
|
53 |
return icl_object_id($id, 'page', true);
|
54 |
}
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
/**
|
57 |
* Filters WooCommerce query for translated shop page
|
58 |
*
|
@@ -122,7 +138,7 @@ class WCML_Store_Pages{
|
|
122 |
$shop_page = get_post( woocommerce_get_page_id('shop') );
|
123 |
// we should explode by / for children page
|
124 |
$query_var_page = explode('/',$q->query_vars['pagename']);
|
125 |
-
if (
|
126 |
unset($q->query_vars['page']);
|
127 |
unset($q->query_vars['pagename']);
|
128 |
$q->query_vars['post_type'] = 'product';
|
@@ -197,7 +213,7 @@ class WCML_Store_Pages{
|
|
197 |
if(!is_null($trnsl_id)){
|
198 |
$sitepress->set_element_language_details($trnsl_id, 'post_' . $orig_page->post_type, false, $mis_lang);
|
199 |
}
|
200 |
-
|
201 |
}
|
202 |
}
|
203 |
}
|
@@ -248,7 +264,7 @@ class WCML_Store_Pages{
|
|
248 |
foreach ($check_pages as $page) {
|
249 |
$store_page_id = get_option($page);
|
250 |
$trnsl_page_id = icl_object_id($store_page_id, 'page', false, $language['code']);
|
251 |
-
if ($store_page_id &&
|
252 |
if (!empty($missing_lang)) {
|
253 |
$missing_lang .= ', ' . $language['display_name'];
|
254 |
} else {
|
20 |
$this->create_missing_store_pages();
|
21 |
}
|
22 |
|
23 |
+
// table rate shipping support
|
24 |
+
if(defined('TABLE_RATE_SHIPPING_VERSION')){
|
25 |
+
add_filter('woocommerce_table_rate_query_rates_args', array($this, 'default_shipping_class_id'));
|
26 |
+
}
|
27 |
+
|
28 |
|
29 |
}
|
30 |
|
58 |
return icl_object_id($id, 'page', true);
|
59 |
}
|
60 |
|
61 |
+
function default_shipping_class_id($args){
|
62 |
+
global $sitepress;
|
63 |
+
if($sitepress->get_current_language() != $sitepress->get_default_language() && !empty($args['shipping_class_id'])){
|
64 |
+
|
65 |
+
$args['shipping_class_id'] = icl_object_id($args['shipping_class_id'], 'product_shipping_class', false, $sitepress->get_default_language());
|
66 |
+
|
67 |
+
}
|
68 |
+
|
69 |
+
return $args;
|
70 |
+
}
|
71 |
+
|
72 |
/**
|
73 |
* Filters WooCommerce query for translated shop page
|
74 |
*
|
138 |
$shop_page = get_post( woocommerce_get_page_id('shop') );
|
139 |
// we should explode by / for children page
|
140 |
$query_var_page = explode('/',$q->query_vars['pagename']);
|
141 |
+
if ($shop_page->post_name == $query_var_page[count($query_var_page)-1]) {
|
142 |
unset($q->query_vars['page']);
|
143 |
unset($q->query_vars['pagename']);
|
144 |
$q->query_vars['post_type'] = 'product';
|
213 |
if(!is_null($trnsl_id)){
|
214 |
$sitepress->set_element_language_details($trnsl_id, 'post_' . $orig_page->post_type, false, $mis_lang);
|
215 |
}
|
216 |
+
$sitepress->switch_lang($current_language);
|
217 |
}
|
218 |
}
|
219 |
}
|
264 |
foreach ($check_pages as $page) {
|
265 |
$store_page_id = get_option($page);
|
266 |
$trnsl_page_id = icl_object_id($store_page_id, 'page', false, $language['code']);
|
267 |
+
if ($store_page_id && (is_null($trnsl_page_id) || get_post_status($trnsl_page_id)!='publish')) {
|
268 |
if (!empty($missing_lang)) {
|
269 |
$missing_lang .= ', ' . $language['display_name'];
|
270 |
} else {
|
inc/terms.class.php
CHANGED
@@ -30,6 +30,7 @@ class WCML_Terms{
|
|
30 |
add_action('icl_save_term_translation', array($this,'save_wc_term_meta'), 100,4);
|
31 |
|
32 |
add_action('created_term', array('WCML_Terms', 'translated_terms_status_update'), 10,3);
|
|
|
33 |
add_action('wp_ajax_wcml_update_term_translated_warnings', array('WCML_Terms', 'wcml_update_term_translated_warnings'));
|
34 |
add_action('wp_ajax_wcml_ingore_taxonomy_translation', array('WCML_Terms', 'wcml_ingore_taxonomy_translation'));
|
35 |
add_action('wp_ajax_wcml_uningore_taxonomy_translation', array('WCML_Terms', 'wcml_uningore_taxonomy_translation'));
|
@@ -45,7 +46,10 @@ class WCML_Terms{
|
|
45 |
add_action('admin_menu', array($this, 'admin_menu_setup'));
|
46 |
}
|
47 |
|
48 |
-
|
|
|
|
|
|
|
49 |
}
|
50 |
|
51 |
function admin_menu_setup(){
|
@@ -68,7 +72,7 @@ class WCML_Terms{
|
|
68 |
}
|
69 |
|
70 |
function rewrite_rules_filter($value){
|
71 |
-
global $sitepress, $sitepress_settings, $wpdb, $wp_taxonomies;
|
72 |
|
73 |
$strings_language = $sitepress_settings['st']['strings_language'];
|
74 |
|
@@ -101,9 +105,9 @@ class WCML_Terms{
|
|
101 |
if(!$slug_translation){
|
102 |
// handle exception - default woocommerce category and tag bases used
|
103 |
// get translation from WooCommerce mo files?
|
104 |
-
|
|
|
105 |
$slug_translation = _x($slug, 'slug', 'woocommerce');
|
106 |
-
$sitepress->switch_lang();
|
107 |
|
108 |
$slug = $taxonomy == 'product_tag' ? 'product-tag' : 'product-category'; // strings language
|
109 |
|
@@ -738,5 +742,76 @@ class WCML_Terms{
|
|
738 |
|
739 |
}
|
740 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
741 |
|
742 |
}
|
30 |
add_action('icl_save_term_translation', array($this,'save_wc_term_meta'), 100,4);
|
31 |
|
32 |
add_action('created_term', array('WCML_Terms', 'translated_terms_status_update'), 10,3);
|
33 |
+
add_action('edit_term', array('WCML_Terms', 'translated_terms_status_update'), 10,3);
|
34 |
add_action('wp_ajax_wcml_update_term_translated_warnings', array('WCML_Terms', 'wcml_update_term_translated_warnings'));
|
35 |
add_action('wp_ajax_wcml_ingore_taxonomy_translation', array('WCML_Terms', 'wcml_ingore_taxonomy_translation'));
|
36 |
add_action('wp_ajax_wcml_uningore_taxonomy_translation', array('WCML_Terms', 'wcml_uningore_taxonomy_translation'));
|
46 |
add_action('admin_menu', array($this, 'admin_menu_setup'));
|
47 |
}
|
48 |
|
49 |
+
add_filter('get_the_terms',array($this,'shipping_terms'),10,3);
|
50 |
+
//filter coupons terms in admin
|
51 |
+
add_filter('get_terms',array($this,'filter_coupons_terms'),10,3);
|
52 |
+
add_action('woocommerce_coupon_loaded',array($this,'woocommerce_coupon_loaded'));
|
53 |
}
|
54 |
|
55 |
function admin_menu_setup(){
|
72 |
}
|
73 |
|
74 |
function rewrite_rules_filter($value){
|
75 |
+
global $sitepress, $sitepress_settings, $wpdb, $wp_taxonomies,$woocommerce;
|
76 |
|
77 |
$strings_language = $sitepress_settings['st']['strings_language'];
|
78 |
|
105 |
if(!$slug_translation){
|
106 |
// handle exception - default woocommerce category and tag bases used
|
107 |
// get translation from WooCommerce mo files?
|
108 |
+
unload_textdomain('woocommerce');
|
109 |
+
$woocommerce->load_plugin_textdomain();
|
110 |
$slug_translation = _x($slug, 'slug', 'woocommerce');
|
|
|
111 |
|
112 |
$slug = $taxonomy == 'product_tag' ? 'product-tag' : 'product-category'; // strings language
|
113 |
|
742 |
|
743 |
}
|
744 |
|
745 |
+
function shipping_terms($terms, $post_id, $taxonomy){
|
746 |
+
if(!is_admin() && get_post_type($post_id) == 'product' && $taxonomy == 'product_shipping_class'){
|
747 |
+
global $sitepress;
|
748 |
+
remove_filter('get_the_terms',array($this,'shipping_terms'));
|
749 |
+
return get_the_terms(icl_object_id($post_id,'product',true,$sitepress->get_default_language()),'product_shipping_class');
|
750 |
+
}
|
751 |
+
|
752 |
+
return $terms;
|
753 |
+
}
|
754 |
+
|
755 |
+
function filter_coupons_terms($terms, $taxonomies, $args){
|
756 |
+
global $sitepress,$pagenow;
|
757 |
+
|
758 |
+
if(is_admin() && (($pagenow == 'post-new.php' && isset($_GET['post_type']) && $_GET['post_type'] == 'shop_coupon') || ($pagenow == 'post.php' && isset($_GET['post']) && get_post_type($_GET['post']) == 'shop_coupon')) && in_array('product_cat',$taxonomies)){
|
759 |
+
remove_filter('get_terms',array($this,'filter_coupons_terms'));
|
760 |
+
$current_language = $sitepress->get_current_language();
|
761 |
+
$sitepress->switch_lang($sitepress->get_default_language());
|
762 |
+
$terms = get_terms( 'product_cat', 'orderby=name&hide_empty=0');
|
763 |
+
add_filter('get_terms',array($this,'filter_coupons_terms'),10,3);
|
764 |
+
$sitepress->switch_lang($current_language);
|
765 |
+
}
|
766 |
+
return $terms;
|
767 |
+
}
|
768 |
+
|
769 |
+
function woocommerce_coupon_loaded($coupons_data){
|
770 |
+
global $sitepress;
|
771 |
+
$default_language = $sitepress->get_default_language();
|
772 |
+
$current_language = $sitepress->get_current_language();
|
773 |
+
|
774 |
+
if($default_language != $current_language){
|
775 |
+
$product_ids = array();
|
776 |
+
$exclude_product_ids = array();
|
777 |
+
$product_categories_ids = array();
|
778 |
+
$exclude_product_categories_ids = array();
|
779 |
+
|
780 |
+
foreach($coupons_data->product_ids as $prod_id){
|
781 |
+
$trnsl_id = icl_object_id($prod_id,'product',false,$current_language);
|
782 |
+
if(!is_null($trnsl_id)){
|
783 |
+
$product_ids[] = $trnsl_id;
|
784 |
+
}
|
785 |
+
}
|
786 |
+
|
787 |
+
foreach($coupons_data->exclude_product_ids as $prod_id){
|
788 |
+
$trnsl_id = icl_object_id($prod_id,'product',false,$current_language);
|
789 |
+
if(!is_null($trnsl_id)){
|
790 |
+
$exclude_product_ids[] = $trnsl_id;
|
791 |
+
}
|
792 |
+
}
|
793 |
+
|
794 |
+
foreach($coupons_data->product_categories as $cat_id){
|
795 |
+
$trnsl_id = icl_object_id($cat_id,'product_cat',false,$current_language);
|
796 |
+
if(!is_null($trnsl_id)){
|
797 |
+
$product_categories_ids[] = $trnsl_id;
|
798 |
+
}
|
799 |
+
}
|
800 |
+
|
801 |
+
foreach($coupons_data->exclude_product_categories as $cat_id){
|
802 |
+
$trnsl_id = icl_object_id($cat_id,'product_cat',false,$current_language);
|
803 |
+
if(!is_null($trnsl_id)){
|
804 |
+
$exclude_product_categories_ids[] = $trnsl_id;
|
805 |
+
}
|
806 |
+
}
|
807 |
+
|
808 |
+
$coupons_data->product_ids = $product_ids;
|
809 |
+
$coupons_data->exclude_product_ids = $exclude_product_ids;
|
810 |
+
$coupons_data->product_categories = $product_categories_ids;
|
811 |
+
$coupons_data->exclude_product_categories = $exclude_product_categories_ids;
|
812 |
+
}
|
813 |
+
|
814 |
+
return $coupons_data;
|
815 |
+
}
|
816 |
|
817 |
}
|
inc/upgrade.class.php
CHANGED
@@ -4,7 +4,8 @@ class WCML_Upgrade{
|
|
4 |
|
5 |
private $versions = array(
|
6 |
|
7 |
-
'2.9.9.1'
|
|
|
8 |
|
9 |
);
|
10 |
|
@@ -80,7 +81,7 @@ class WCML_Upgrade{
|
|
80 |
$version_in_db = '2.3.2';
|
81 |
//delete_option('icl_is_wcml_installed');
|
82 |
}
|
83 |
-
|
84 |
$migration_ran = false;
|
85 |
|
86 |
if($version_in_db && version_compare($version_in_db, WCML_VERSION, '<')){
|
@@ -151,6 +152,96 @@ class WCML_Upgrade{
|
|
151 |
|
152 |
}
|
153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
|
156 |
|
4 |
|
5 |
private $versions = array(
|
6 |
|
7 |
+
'2.9.9.1',
|
8 |
+
'3.1'
|
9 |
|
10 |
);
|
11 |
|
81 |
$version_in_db = '2.3.2';
|
82 |
//delete_option('icl_is_wcml_installed');
|
83 |
}
|
84 |
+
|
85 |
$migration_ran = false;
|
86 |
|
87 |
if($version_in_db && version_compare($version_in_db, WCML_VERSION, '<')){
|
152 |
|
153 |
}
|
154 |
|
155 |
+
function upgrade_3_1(){
|
156 |
+
|
157 |
+
$wcml_settings = get_option('_wcml_settings');
|
158 |
+
|
159 |
+
if(isset($wcml_settings['enable_multi_currency']) && $wcml_settings['enable_multi_currency'] == 'yes'){
|
160 |
+
$wcml_settings['enable_multi_currency'] = WCML_MULTI_CURRENCIES_INDEPENDENT;
|
161 |
+
}else{
|
162 |
+
$wcml_settings['enable_multi_currency'] = WCML_MULTI_CURRENCIES_DISABLED;
|
163 |
+
}
|
164 |
+
|
165 |
+
$wcml_settings['products_sync_date'] = 1;
|
166 |
+
|
167 |
+
|
168 |
+
update_option('_wcml_settings', $wcml_settings);
|
169 |
+
|
170 |
+
// multi-currency migration
|
171 |
+
if($wcml_settings['enable_multi_currency'] == 'yes' && $wcml_settings['currency_converting_option'] == 2){
|
172 |
+
|
173 |
+
// get currencies exchange rates
|
174 |
+
$results = $wpdb->get_results("SELECT code, value FROM {$wpdb->prefix}icl_currencies");
|
175 |
+
foreach($results as $row){
|
176 |
+
$exchange_rates[$row->code] = $row->value;
|
177 |
+
}
|
178 |
+
|
179 |
+
// get languages currencies map
|
180 |
+
$results = $wpdb->get_results("SELECT l.language_code, c.code FROM {$wpdb->prefix}icl_languages_currencies l JOIN {$wpdb->prefix}icl_currencies c ON l.currency_id = c.id");
|
181 |
+
foreach($results as $row){
|
182 |
+
$language_currencies[$row->language_code] = $row->code;
|
183 |
+
}
|
184 |
+
|
185 |
+
|
186 |
+
$results = $wpdb->get_results($wpdb->prepare("
|
187 |
+
SELECT p.ID, t.trid, t.element_type
|
188 |
+
FROM {$wpdb->posts} p JOIN {$wpdb->prefix}icl_translations t ON t.element_id = p.ID AND t.element_type IN ('post_product', 'post_product_variation')
|
189 |
+
WHERE
|
190 |
+
p.post_type in ('product', 'product_variation') AND t.language_code = %s
|
191 |
+
|
192 |
+
", $sitepress->get_default_language()));
|
193 |
+
|
194 |
+
// set custom conversion rates
|
195 |
+
foreach($results as $row){
|
196 |
+
$translations = $sitepress->get_element_translations($row->trid, $row->element_type);
|
197 |
+
$meta = get_post_meta($row->ID);
|
198 |
+
$original_prices['_price'] = !empty($meta['_price']) ? $meta['_price'][0] : 0;
|
199 |
+
$original_prices['_regular_price'] = !empty($meta['_regular_price']) ? $meta['_regular_price'][0] : 0;
|
200 |
+
$original_prices['_sale_price'] = !empty($meta['_sale_price']) ? $meta['_sale_price'][0] : 0;
|
201 |
+
|
202 |
+
|
203 |
+
$ccr = array();
|
204 |
+
|
205 |
+
foreach($translations as $translation){
|
206 |
+
if($translation->element_id != $row->ID){
|
207 |
+
|
208 |
+
$meta = get_post_meta($translation->element_id);
|
209 |
+
$translated_prices['_price'] = $meta['_price'][0];
|
210 |
+
$translated_prices['_regular_price'] = $meta['_regular_price'][0];
|
211 |
+
$translated_prices['_sale_price'] = $meta['_sale_price'][0];
|
212 |
+
|
213 |
+
if(!empty($translated_prices['_price']) && !empty($original_prices['_price']) && $translated_prices['_price'] != $original_prices['_price']){
|
214 |
+
|
215 |
+
$ccr['_price'][$language_currencies[$translation->language_code]] = $translated_prices['_price'] / $original_prices['_price'];
|
216 |
+
|
217 |
+
}
|
218 |
+
if(!empty($translated_prices['_regular_price']) && !empty($original_prices['_regular_price']) && $translated_prices['_regular_price'] != $original_prices['_regular_price']){
|
219 |
+
|
220 |
+
$ccr['_regular_price'][$language_currencies[$translation->language_code]] = $translated_prices['_regular_price'] / $original_prices['_regular_price'];
|
221 |
+
|
222 |
+
}
|
223 |
+
if(!empty($translated_prices['_sale_price']) && !empty($original_prices['_sale_price']) && $translated_prices['_sale_price'] != $original_prices['_sale_price']){
|
224 |
+
|
225 |
+
$ccr['_sale_price'][$language_currencies[$translation->language_code]] = $translated_prices['_sale_price'] / $original_prices['_sale_price'] ;
|
226 |
+
|
227 |
+
}
|
228 |
+
|
229 |
+
|
230 |
+
}
|
231 |
+
}
|
232 |
+
|
233 |
+
if($ccr){
|
234 |
+
update_post_meta($row->ID, '_custom_conversion_rate', $ccr);
|
235 |
+
}
|
236 |
+
|
237 |
+
|
238 |
+
}
|
239 |
+
|
240 |
+
|
241 |
+
}
|
242 |
+
|
243 |
+
}
|
244 |
+
|
245 |
|
246 |
|
247 |
|
inc/wc-strings.class.php
CHANGED
@@ -35,7 +35,7 @@ class WCML_WC_Strings{
|
|
35 |
add_action('admin_footer', array($this, 'show_attribute_label_language_warning'));
|
36 |
}
|
37 |
|
38 |
-
|
39 |
|
40 |
|
41 |
}
|
@@ -185,4 +185,12 @@ class WCML_WC_Strings{
|
|
185 |
}
|
186 |
|
187 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
}
|
35 |
add_action('admin_footer', array($this, 'show_attribute_label_language_warning'));
|
36 |
}
|
37 |
|
38 |
+
add_filter('woocommerce_rate_label',array($this,'translate_woocommerce_rate_label'));
|
39 |
|
40 |
|
41 |
}
|
185 |
}
|
186 |
|
187 |
|
188 |
+
function translate_woocommerce_rate_label($label){
|
189 |
+
if (function_exists('icl_translate')) {
|
190 |
+
$label = icl_translate('woocommerce taxes', $label , $label);
|
191 |
+
}
|
192 |
+
return $label;
|
193 |
+
}
|
194 |
+
|
195 |
+
|
196 |
}
|
menu/sub/products.php
CHANGED
@@ -1,24 +1,24 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
|
5 |
$search = false;
|
6 |
$pagination_url = 'admin.php?page=wpml-wcml&tab=products&pn=';
|
7 |
-
if(isset($_GET['s']) && isset($_GET['cat']) && isset($_GET['
|
8 |
-
$products_data = $this->products->get_products_from_filter($_GET['s'],$_GET['cat'],$_GET['
|
9 |
$products = $products_data['products'];
|
10 |
$products_count = $products_data['count'];
|
11 |
$search = true;
|
12 |
-
$pagination_url = 'admin.php?page=wpml-wcml&tab=products&s='.$_GET['s'].'&cat='.$_GET['cat'].'&
|
13 |
}
|
14 |
|
15 |
if(isset($_GET['prid'])){
|
16 |
$products[] = get_post($_GET['prid']);
|
17 |
$products_count = 1;
|
18 |
$pr_edit = true;
|
19 |
-
|
20 |
|
21 |
-
|
22 |
|
23 |
if(!isset($products)){
|
24 |
$products = $woocommerce_wpml->products->get_product_list($pn, $lm);
|
@@ -29,40 +29,55 @@ if($lm){
|
|
29 |
$last = $woocommerce_wpml->products->get_product_last_page($products_count,$lm);
|
30 |
}
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
<select class="wcml_product_category">
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
<select class="wcml_translation_status">
|
52 |
-
|
53 |
-
<option value="not" <?php echo (isset($_GET['
|
54 |
-
<option value="need_update" <?php echo (isset($_GET['
|
55 |
-
<option value="in_progress" <?php echo (isset($_GET['
|
56 |
-
<option value="complete" <?php echo (isset($_GET['
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
<select class="wcml_translation_status_lang">
|
59 |
<option value="all"><?php _e('All languages', 'wpml-wcml') ?></option>
|
60 |
-
|
61 |
-
|
62 |
<option value="<?php echo $lang['code'] ?>" <?php echo (isset($_GET['slang']) && $_GET['slang']==$lang['code'])?'selected="selected"':''; ?> ><?php echo $lang['display_name'] ?></option>
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
<input type="text" class="wcml_product_name" placeholder="<?php _e('Search', 'wpml-wcml'); ?>" value="<?php echo isset($_GET['s'])?$_GET['s']:''; ?>"/>
|
67 |
<input type="hidden" value="<?php echo admin_url('admin.php?page=wpml-wcml&tab=products'); ?>" class="wcml_products_admin_url" />
|
68 |
<input type="hidden" value="<?php echo $pagination_url; ?>" class="wcml_pagination_url" />
|
@@ -70,311 +85,321 @@ if($lm){
|
|
70 |
<button type="button" value="search" class="wcml_search button-secondary"><?php _e('Search', 'wpml-wcml'); ?></button>
|
71 |
<?php if($search): ?>
|
72 |
<button type="button" value="reset" class="button-secondary wcml_reset_search"><?php _e('Reset', 'wpml-wcml'); ?></button>
|
73 |
-
|
|
|
|
|
|
|
74 |
<p>
|
75 |
-
|
76 |
-
|
77 |
-
<
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
</p>
|
85 |
-
</div>
|
86 |
-
<?php endif; ?>
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
}
|
123 |
}
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
<?php
|
134 |
-
$
|
135 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
?>
|
137 |
-
<
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
<
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
<
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
<
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
$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));
|
223 |
-
if(!is_null($tr_status) && get_current_user_id() != $tr_status->translator_id){
|
224 |
-
if($tr_status->status == ICL_TM_IN_PROGRESS){ ?>
|
225 |
-
<td><?php _e('Translation in progress', 'wpml-wcml'); ?><br> </td>
|
226 |
-
<?php continue;
|
227 |
-
}elseif($tr_status->status == ICL_TM_WAITING_FOR_TRANSLATOR){ ?>
|
228 |
-
<td><?php _e('Waiting for translator', 'wpml-wcml'); ?><br> </td>
|
229 |
-
<?php continue;
|
230 |
-
}
|
231 |
-
}
|
232 |
}
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
|
|
|
|
237 |
|
238 |
-
|
239 |
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
}
|
250 |
}
|
|
|
251 |
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
<?php if($default_language == $key): ?>
|
260 |
-
<textarea value="<?php echo $file_paths; ?>" disabled="disabled"><?php echo $file_paths; ?></textarea>
|
261 |
-
<?php else: ?>
|
262 |
-
<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>
|
263 |
-
<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>
|
264 |
-
<?php endif;?>
|
265 |
-
<?php else: ?>
|
266 |
-
<?php foreach ($trn_contents as $tax_key=>$trn_content) : ?>
|
267 |
-
<?php if($default_language == $key): ?>
|
268 |
-
<textarea rows="1" disabled="disabled"><?php echo $trn_content; ?></textarea>
|
269 |
-
<?php else: ?>
|
270 |
-
<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>
|
271 |
-
<?php endif;?>
|
272 |
-
<?php endforeach; ?>
|
273 |
-
<?php endif; ?>
|
274 |
-
<?php elseif(in_array($product_content,array('content','excerpt'))): ?>
|
275 |
<?php if($default_language == $key): ?>
|
276 |
-
<
|
277 |
<?php else: ?>
|
278 |
-
<
|
279 |
-
<?php if($
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
<?php _e('Translation missing', 'wpml-wcml'); ?>
|
284 |
-
</p>
|
285 |
-
</span>
|
286 |
-
<?php endif; ?>
|
287 |
-
<?php endif;?>
|
288 |
-
<div class="wcml_editor">
|
289 |
-
<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>
|
290 |
-
<div class="wcml_editor_original">
|
291 |
-
<h3><?php _e('Original content:', 'wpml-wcml') ?></h3>
|
292 |
-
<?php
|
293 |
-
if($product_content == 'content'){
|
294 |
-
$original_content = $product->post_content;
|
295 |
-
}else{
|
296 |
-
$original_content = $product->post_excerpt;
|
297 |
-
}
|
298 |
-
?>
|
299 |
-
<textarea class="wcml_original_content"><?php echo $original_content; ?></textarea>
|
300 |
-
|
301 |
-
</div>
|
302 |
-
<div class="wcml_line"></div>
|
303 |
-
<div class="wcml_editor_translation">
|
304 |
-
<?php if($default_language != $key): ?>
|
305 |
-
<h3><?php _e('Please enter translation:', 'wpml-wcml') ?></h3>
|
306 |
-
<?php
|
307 |
-
$tr_id = icl_object_id($product_id, 'product', true, $key);
|
308 |
-
wp_editor($trn_contents, 'wcmleditor'.$product_content.$tr_id.$key, array('textarea_name'=>$product_content .
|
309 |
-
'_'.$key,'textarea_rows'=>20,'editor_class'=>'wcml_content_tr')); ?>
|
310 |
-
<?php endif; ?>
|
311 |
-
</div>
|
312 |
-
|
313 |
-
<?php if($default_language == $key): ?>
|
314 |
-
<button type="button" class="button-secondary wcml_popup_close"><?php _e('Close', 'wpml-wcml') ?></button>
|
315 |
-
<?php else: ?>
|
316 |
-
<button type="button" class="button-secondary wcml_popup_cancel"><?php _e('Cancel', 'wpml-wcml') ?></button>
|
317 |
-
<button type="button" class="button-secondary wcml_popup_ok"><?php _e('Ok', 'wpml-wcml') ?></button>
|
318 |
-
<?php endif; ?>
|
319 |
-
</div>
|
320 |
-
<?php elseif(in_array($product_content,array('images'))):
|
321 |
-
echo $woocommerce_wpml->products->product_images_box($product_id,$key,$is_duplicate_product); ?>
|
322 |
-
<?php elseif(in_array($product_content,array('variations'))):
|
323 |
-
echo $woocommerce_wpml->products->product_variations_box($product_id,$key,$is_duplicate_product); ?>
|
324 |
-
<?php elseif($product_content == '_file_paths'): ?>
|
325 |
-
<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>
|
326 |
-
<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>
|
327 |
-
<?php else: ?>
|
328 |
<?php if($default_language == $key): ?>
|
329 |
-
<textarea rows="1" disabled="disabled"><?php echo $
|
330 |
-
<?php elseif(in_array($product_content,array('regular_price','sale_price'))): ?>
|
331 |
-
<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 echo $woocommerce_wpml->settings['currency_converting_option'] == '1'?'readonly="readonly"':''; ?><?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> />
|
332 |
<?php else: ?>
|
333 |
-
<input class="<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" type="text" name="<?php echo $product_content.'_'.$key; ?>" value="<?php echo $
|
334 |
<?php endif;?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
<?php endif; ?>
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
346 |
<?php else: ?>
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
359 |
<?php if($default_language == $key): ?>
|
360 |
-
|
361 |
<?php else: ?>
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
<?php endforeach; ?>
|
369 |
-
</
|
370 |
-
|
371 |
-
</
|
372 |
-
</
|
373 |
-
</
|
374 |
-
</
|
375 |
-
|
376 |
-
</
|
377 |
-
|
|
|
|
|
|
|
378 |
|
379 |
<div class="wcml_fade"></div>
|
380 |
|
1 |
+
<?php
|
2 |
+
$pn = isset($_GET['pn'])?$_GET['pn']:1;
|
3 |
+
$lm = isset($_GET['lm'])?$_GET['lm']:20;
|
4 |
|
5 |
$search = false;
|
6 |
$pagination_url = 'admin.php?page=wpml-wcml&tab=products&pn=';
|
7 |
+
if(isset($_GET['s']) && isset($_GET['cat']) && isset($_GET['trst']) && isset($_GET['st']) && isset($_GET['slang'])){
|
8 |
+
$products_data = $this->products->get_products_from_filter($_GET['s'],$_GET['cat'],$_GET['trst'],$_GET['st'],$_GET['slang'],$pn,$lm);
|
9 |
$products = $products_data['products'];
|
10 |
$products_count = $products_data['count'];
|
11 |
$search = true;
|
12 |
+
$pagination_url = 'admin.php?page=wpml-wcml&tab=products&s='.$_GET['s'].'&cat='.$_GET['cat'].'&trst='.$_GET['trst'].'&st='.$_GET['st'].'&slang='.$_GET['slang'].'&pn=';
|
13 |
}
|
14 |
|
15 |
if(isset($_GET['prid'])){
|
16 |
$products[] = get_post($_GET['prid']);
|
17 |
$products_count = 1;
|
18 |
$pr_edit = true;
|
19 |
+
}
|
20 |
|
21 |
+
$current_language = $sitepress->get_current_language();
|
22 |
|
23 |
if(!isset($products)){
|
24 |
$products = $woocommerce_wpml->products->get_product_list($pn, $lm);
|
29 |
$last = $woocommerce_wpml->products->get_product_last_page($products_count,$lm);
|
30 |
}
|
31 |
|
32 |
+
$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 |
+
<p>
|
41 |
<select class="wcml_product_category">
|
42 |
+
<option value="0"><?php _e('Any category', 'wpml-wcml'); ?></option>
|
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 |
+
$all_statuses = get_post_stati();
|
61 |
+
//unset unnecessary statuses
|
62 |
+
unset($all_statuses['trash']);
|
63 |
+
unset($all_statuses['auto-draft']);
|
64 |
+
unset($all_statuses['inherit']);
|
65 |
+
?>
|
66 |
+
<select class="wcml_product_status">
|
67 |
+
<option value="all"><?php _e('All statuses', 'wpml-wcml'); ?></option>
|
68 |
+
<?php foreach($all_statuses as $key=>$status): ?>
|
69 |
+
<option value="<?php echo $key; ?>" <?php echo (isset($_GET['st']) && $_GET['st']==$key)?'selected="selected"':''; ?> ><?php echo ucfirst($status); ?></option>
|
70 |
+
<?php endforeach; ?>
|
71 |
+
</select>
|
72 |
+
|
73 |
<select class="wcml_translation_status_lang">
|
74 |
<option value="all"><?php _e('All languages', 'wpml-wcml') ?></option>
|
75 |
+
<?php foreach($active_languages as $lang): ?>
|
76 |
+
<?php if($default_language != $lang['code']): ?>
|
77 |
<option value="<?php echo $lang['code'] ?>" <?php echo (isset($_GET['slang']) && $_GET['slang']==$lang['code'])?'selected="selected"':''; ?> ><?php echo $lang['display_name'] ?></option>
|
78 |
+
<?php endif; ?>
|
79 |
+
<?php endforeach; ?>
|
80 |
+
</select>
|
81 |
<input type="text" class="wcml_product_name" placeholder="<?php _e('Search', 'wpml-wcml'); ?>" value="<?php echo isset($_GET['s'])?$_GET['s']:''; ?>"/>
|
82 |
<input type="hidden" value="<?php echo admin_url('admin.php?page=wpml-wcml&tab=products'); ?>" class="wcml_products_admin_url" />
|
83 |
<input type="hidden" value="<?php echo $pagination_url; ?>" class="wcml_pagination_url" />
|
85 |
<button type="button" value="search" class="wcml_search button-secondary"><?php _e('Search', 'wpml-wcml'); ?></button>
|
86 |
<?php if($search): ?>
|
87 |
<button type="button" value="reset" class="button-secondary wcml_reset_search"><?php _e('Reset', 'wpml-wcml'); ?></button>
|
88 |
+
<?php endif;?>
|
89 |
+
<p>
|
90 |
+
<?php if(current_user_can('manage_options')): ?>
|
91 |
+
<div class="wcml_product_actions">
|
92 |
<p>
|
93 |
+
<select name="test_action">
|
94 |
+
<?php /* <option value="duplicate"><?php _e('Duplicate for testing', 'wpml-wcml'); ?></option> */ ?>
|
95 |
+
<option value="clean"><?php _e('Cleanup test content', 'wpml-wcml'); ?></option>
|
96 |
+
<option value="to_translation"><?php _e('Send to translation', 'wpml-wcml'); ?></option>
|
97 |
+
</select>
|
98 |
+
<button type="submit" name="action" value="apply" class="button-secondary wcml_action_top"><?php _e('Apply', 'wpml-wcml'); ?></button>
|
99 |
+
</p>
|
100 |
+
</div>
|
101 |
+
<?php endif; ?>
|
|
|
|
|
|
|
102 |
|
103 |
+
<?php if($products): ?>
|
104 |
+
<div class="wcml_product_pagination">
|
105 |
+
<span class="displaying-num"><?php printf(__('%d products', 'wpml-wcml'), $products_count); ?></span>
|
106 |
+
<?php if(!isset($_GET['prid']) && isset($last) && $last > 1): ?>
|
107 |
+
<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>
|
108 |
+
<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>
|
109 |
+
<input type="text" class="current-page wcml_pagin" value="<?php echo $pn;?>" size="1"/> <span><?php _e('of', 'wpml-wcml'); ?> <?php echo $last; ?><span>
|
110 |
+
<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>
|
111 |
+
<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>
|
112 |
+
<?php endif; ?>
|
113 |
+
<?php if(isset($_GET['prid']) || ($lm && isset($last)) && $last > 1): ?>
|
114 |
+
<a href="<?php echo $pagination_url; ?>0&lm=0"><?php _e('Show all products', 'wpml-wcml'); ?></a>
|
115 |
+
<?php endif; ?>
|
116 |
+
</div>
|
117 |
+
<?php endif; ?>
|
118 |
+
<input type="hidden" class="icl_def_language" value="<?php echo $default_language ?>" />
|
119 |
+
<input type="hidden" id="upd_product_nonce" value="<?php echo wp_create_nonce('update_product_actions'); ?>" />
|
120 |
+
<?php wp_nonce_field('wcml_test_actions', 'wcml_nonce'); ?>
|
121 |
+
<table class="widefat fixed wcml_products" cellspacing="0">
|
122 |
+
<thead>
|
123 |
+
<tr>
|
124 |
+
<th scope="col"><input type="checkbox" value="" class="wcml_check_all"/></th>
|
125 |
+
<th scope="col" width="5%"><?php _e('Type', 'wpml-wcml') ?></th>
|
126 |
+
<th scope="col" width="20%"><?php _e('Product', 'wpml-wcml') ?></th>
|
127 |
+
<th scope="col" width="73%"><?php echo $woocommerce_wpml->products->get_translation_flags($active_languages,$default_language,isset($_GET['slang']) && $_GET['slang'] != "all"?$_GET['slang']:false); ?></th>
|
128 |
+
</tr>
|
129 |
+
</thead>
|
130 |
+
<tbody>
|
131 |
+
<?php
|
132 |
+
$lang_codes = array();
|
133 |
+
foreach ($active_languages as $language) {
|
134 |
+
if($default_language == $language['code'] || current_user_can('manage_options') || (wpml_check_user_is_translator($default_language,$language['code']) && !current_user_can('manage_options')) ){
|
135 |
+
if(!isset($_GET['slang']) || (isset($_GET['slang']) && ($_GET['slang'] == $language['code'] || $default_language == $language['code'] || $_GET['slang'] == 'all')))
|
136 |
+
$lang_codes[$language['code']] = $language['display_name'];
|
|
|
137 |
}
|
138 |
+
}
|
139 |
+
$default_language_display_name = $lang_codes[$default_language];
|
140 |
+
unset($lang_codes[$default_language]);
|
141 |
+
$lang_codes = array($default_language => $default_language_display_name)+$lang_codes;
|
142 |
+
?>
|
143 |
+
<?php if(empty($products)): ?>
|
144 |
+
<tr><td colspan="4"><h3 class="wcml_no_found_text"><?php _e('No products found','wpml-wcml'); ?></h3></td></tr>
|
145 |
+
<?php else: ?>
|
146 |
+
<?php foreach ($products as $product) :
|
147 |
+
$product_id = icl_object_id($product->ID,'product',true,$default_language);
|
148 |
+
$product_images = $woocommerce_wpml->products->product_images_ids($product->ID);
|
149 |
+
$product_contents = $woocommerce_wpml->products->get_product_contents($product_id);
|
150 |
+
$trid = $sitepress->get_element_trid($product_id,'post_'.$product->post_type);
|
151 |
+
$product_translations = $sitepress->get_element_translations($trid,'post_'.$product->post_type,true,true);
|
152 |
+
?>
|
153 |
+
<tr>
|
154 |
+
<td>
|
155 |
+
<input type="checkbox" name="product[]" value="<?php echo $product_id ?>" />
|
156 |
+
</td>
|
157 |
+
<td>
|
158 |
<?php
|
159 |
+
$prod = get_product( $product->ID );
|
160 |
+
$icon_class_sufix = $prod->product_type;
|
161 |
+
if ( $prod -> is_virtual() ) {
|
162 |
+
$icon_class_sufix = 'virtual';
|
163 |
+
}
|
164 |
+
else if ( $prod -> is_downloadable() ) {
|
165 |
+
$icon_class_sufix = 'downloadable';
|
166 |
+
}
|
167 |
?>
|
168 |
+
<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>
|
169 |
+
</td>
|
170 |
+
<td>
|
171 |
+
<?php echo $product->post_parent != 0 ? '— ' : ''; ?>
|
172 |
+
<?php echo $product->post_title;
|
173 |
+
if($product->post_status == 'draft' && ((isset($_GET['st']) && $_GET['st'] != 'draft') || !isset($_GET['st']))): ?>
|
174 |
+
<span class="wcml_product_status_text"><?php _e(' (draft)','wpml-wcml'); ?></span>
|
175 |
+
<?php endif; ?>
|
176 |
+
<?php if ($search && $product->post_parent != 0): ?>
|
177 |
+
<span class="prod_parent_text"><?php printf(__(' | Parent product: %s','wpml-wcml'),get_the_title($product->post_parent)); ?><span>
|
178 |
+
<?php endif; ?>
|
179 |
+
</td>
|
180 |
+
<td>
|
181 |
+
<div class="translations_statuses prid_<?php echo $product->ID; ?>">
|
182 |
+
<?php echo $woocommerce_wpml->products->get_translation_statuses($product_translations,$active_languages,$default_language,isset($_GET['slang']) && $_GET['slang'] != "all" ?$_GET['slang']:false); ?>
|
183 |
+
</div>
|
184 |
+
<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>
|
185 |
+
</td>
|
186 |
+
</tr>
|
187 |
+
<tr class="outer" data-prid="<?php echo $product->ID; ?>">
|
188 |
+
<td colspan="4">
|
189 |
+
<div class="wcml_product_row" id="prid_<?php echo $product->ID; ?>" <?php echo isset($pr_edit) ? 'style="display:block;"':''; ?>>
|
190 |
+
<div class="inner">
|
191 |
+
<table class="fixed wcml_products_translation">
|
192 |
+
<thead>
|
193 |
+
<tr>
|
194 |
+
<th scope="col"><?php _e('Language', 'wpml-wcml') ?></th>
|
195 |
+
<?php $product_contents_labels = $woocommerce_wpml->products->get_product_contents_labels($product_id); ?>
|
196 |
+
<?php foreach ($product_contents_labels as $product_content) : ?>
|
197 |
+
<th scope="col"><?php echo $product_content; ?></th>
|
198 |
+
<?php endforeach; ?>
|
199 |
+
<?php
|
200 |
+
$attributes = $woocommerce_wpml->products->get_product_atributes($product_id);
|
201 |
+
foreach($attributes as $key=>$attribute): ?>
|
202 |
+
<?php if(!$attribute['is_taxonomy']): ?>
|
203 |
+
<th scope="col"><?php echo $attribute['name']; ?></th>
|
204 |
+
<?php else: ?>
|
205 |
+
<?php unset($attributes[$key]); ?>
|
206 |
+
<?php endif; ?>
|
207 |
+
<?php endforeach; ?>
|
208 |
+
</tr>
|
209 |
+
</thead>
|
210 |
+
<tbody>
|
211 |
+
<?php foreach ($lang_codes as $key=>$lang) : ?>
|
212 |
+
<?php if($key != $default_language && isset($product_translations[$key])
|
213 |
+
&& get_post_meta($product_translations[$key]->element_id, '_icl_lang_duplicate_of', true) == $product->ID):
|
214 |
+
$is_duplicate_product = true; ?>
|
215 |
+
<tr class="wcml_duplicate_product_notice">
|
216 |
+
<td> </td>
|
217 |
+
<td colspan="<?php echo count($product_contents); ?>">
|
218 |
+
<span class="js-wcml_duplicate_product_notice_<?php echo $key ?>" >
|
219 |
+
<?php printf(__('This product is an exact duplicate of the %s product.', 'wcml-wpml'),
|
220 |
+
$lang_codes[$sitepress->get_default_language()]); ?>
|
221 |
+
<a href="#edit-<?php echo $product_id ?>_<?php echo $key ?>"><?php _e('Edit independently.', 'wpml-wcml') ?></a>
|
222 |
+
</span>
|
223 |
+
<span class="js-wcml_duplicate_product_undo_<?php echo $key ?>" style="display: none;" >
|
224 |
+
<a href="#undo-<?php echo $product_id ?>_<?php echo $key ?>"><?php _e('Undo (keep this product as a duplicate)', 'wpml-wcml') ?></a>
|
225 |
+
</span>
|
226 |
+
</td>
|
227 |
+
</tr>
|
228 |
+
<?php else: $is_duplicate_product = false; ?>
|
229 |
+
<?php endif; ?>
|
230 |
+
<tr rel="<?php echo $key; ?>">
|
231 |
+
<td>
|
232 |
+
<?php echo $lang; ?>
|
233 |
+
<?php if($default_language == $key){ ?>
|
234 |
+
<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>
|
235 |
+
<?php }else{ ?>
|
236 |
+
<input type="hidden" class="icl_language" value="<?php echo $key ?>" />
|
237 |
+
<input type="hidden" name="end_duplication[<?php echo $product_id ?>][<?php echo $key ?>]" value="<?php echo !intval($is_duplicate_product) ?>" />
|
238 |
+
<?php $button_label = isset($product_translations[$key]) ? $button_labels['update'] : $button_labels['save'] ;?>
|
239 |
+
<input type="submit" name="product#<?php echo $product_id ?>#<?php echo $key ?>" disabled value="<?php echo $button_label ?>" class="button-secondary wcml_update">
|
240 |
+
<span class="wcml_spinner spinner"></span>
|
241 |
+
<?php } ?>
|
242 |
+
</td>
|
243 |
+
<?php
|
244 |
+
if(isset($product_translations[$key])){
|
245 |
+
$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));
|
246 |
+
if(!is_null($tr_status) && get_current_user_id() != $tr_status->translator_id){
|
247 |
+
if($tr_status->status == ICL_TM_IN_PROGRESS){ ?>
|
248 |
+
<td><?php _e('Translation in progress', 'wpml-wcml'); ?><br> </td>
|
249 |
+
<?php continue;
|
250 |
+
}elseif($tr_status->status == ICL_TM_WAITING_FOR_TRANSLATOR){ ?>
|
251 |
+
<td><?php _e('Waiting for translator', 'wpml-wcml'); ?><br> </td>
|
252 |
+
<?php continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
}
|
254 |
+
}
|
255 |
+
}
|
256 |
+
|
257 |
+
foreach ($product_contents as $product_content) : ?>
|
258 |
+
<td>
|
259 |
+
<?php
|
260 |
|
261 |
+
$trn_contents = $woocommerce_wpml->products->get_product_content_translation($product_id,$product_content,$key);
|
262 |
|
263 |
+
$missing_translation = false;
|
264 |
+
if($default_language == $key){
|
265 |
+
$product_fields_values[$product_content] = $trn_contents;
|
266 |
+
}else{
|
267 |
+
if(isset($product_fields_values[$product_content]) &&
|
268 |
+
!empty($product_fields_values[$product_content]) &&
|
269 |
+
empty($trn_contents)
|
270 |
+
){
|
271 |
+
$missing_translation = true;
|
|
|
272 |
}
|
273 |
+
}
|
274 |
|
275 |
+
if(is_array($trn_contents)): ?>
|
276 |
+
<?php if(in_array($product_content, array('_file_paths'))): ?>
|
277 |
+
<?php
|
278 |
+
$file_paths = '';
|
279 |
+
foreach($trn_contents as $trn_content){
|
280 |
+
$file_paths = $file_paths ? $file_paths . "\n" .$trn_content : $trn_content;
|
281 |
+
} ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
<?php if($default_language == $key): ?>
|
283 |
+
<textarea value="<?php echo $file_paths; ?>" disabled="disabled"><?php echo $file_paths; ?></textarea>
|
284 |
<?php else: ?>
|
285 |
+
<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>
|
286 |
+
<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>
|
287 |
+
<?php endif;?>
|
288 |
+
<?php else: ?>
|
289 |
+
<?php foreach ($trn_contents as $tax_key=>$trn_content) : ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
<?php if($default_language == $key): ?>
|
291 |
+
<textarea rows="1" disabled="disabled"><?php echo $trn_content; ?></textarea>
|
|
|
|
|
292 |
<?php else: ?>
|
293 |
+
<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>
|
294 |
<?php endif;?>
|
295 |
+
<?php endforeach; ?>
|
296 |
+
<?php endif; ?>
|
297 |
+
<?php elseif(in_array($product_content,array('content','excerpt'))): ?>
|
298 |
+
<?php if($default_language == $key): ?>
|
299 |
+
<button type="button" class="button-secondary wcml_edit_conten"><?php _e('Show content', 'wpml-wcml') ?></button>
|
300 |
+
<?php else: ?>
|
301 |
+
<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>
|
302 |
+
<?php if($missing_translation): ?>
|
303 |
+
<span class="wcml_field_translation_<?php echo $product_content ?>_<?php echo $key ?>">
|
304 |
+
<p class="missing-translation">
|
305 |
+
<i class="icon-warning-sign"></i>
|
306 |
+
<?php _e('Translation missing', 'wpml-wcml'); ?>
|
307 |
+
</p>
|
308 |
+
</span>
|
309 |
<?php endif; ?>
|
310 |
+
<?php endif;?>
|
311 |
+
<div class="wcml_editor">
|
312 |
+
<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>
|
313 |
+
<div class="wcml_editor_original">
|
314 |
+
<h3><?php _e('Original content:', 'wpml-wcml') ?></h3>
|
315 |
+
<?php
|
316 |
+
if($product_content == 'content'){
|
317 |
+
$original_content = $product->post_content;
|
318 |
+
}else{
|
319 |
+
$original_content = $product->post_excerpt;
|
320 |
+
}
|
321 |
+
?>
|
322 |
+
<textarea class="wcml_original_content"><?php echo $original_content; ?></textarea>
|
323 |
+
|
324 |
+
</div>
|
325 |
+
<div class="wcml_line"></div>
|
326 |
+
<div class="wcml_editor_translation">
|
327 |
+
<?php if($default_language != $key): ?>
|
328 |
+
<?php
|
329 |
+
$tr_id = icl_object_id($product_id, 'product', true, $key);
|
330 |
+
wp_editor($trn_contents, 'wcmleditor'.$product_content.$tr_id.$key, array('textarea_name'=>$product_content .
|
331 |
+
'_'.$key,'textarea_rows'=>20,'editor_class'=>'wcml_content_tr')); ?>
|
332 |
+
<?php endif; ?>
|
333 |
+
</div>
|
334 |
+
<div class="wcml_editor_buttons">
|
335 |
+
<?php if($default_language == $key): ?>
|
336 |
+
<button type="button" class="button-secondary wcml_popup_close"><?php _e('Close', 'wpml-wcml') ?></button>
|
337 |
<?php else: ?>
|
338 |
+
<h3><?php printf(__('%s translation', 'wpml-wcml'),$lang); ?></h3>
|
339 |
+
<button type="button" class="button-secondary wcml_popup_cancel"><?php _e('Cancel', 'wpml-wcml') ?></button>
|
340 |
+
<button type="button" class="button-secondary wcml_popup_ok"><?php _e('Ok', 'wpml-wcml') ?></button>
|
341 |
+
<?php endif; ?>
|
342 |
+
</div>
|
343 |
+
</div>
|
344 |
+
<?php elseif(in_array($product_content,array('images'))):
|
345 |
+
echo $woocommerce_wpml->products->product_images_box($product_id,$key,$is_duplicate_product); ?>
|
346 |
+
<?php elseif(in_array($product_content,array('variations'))):
|
347 |
+
echo $woocommerce_wpml->products->product_variations_box($product_id,$key,$is_duplicate_product); ?>
|
348 |
+
<?php elseif($product_content == '_file_paths'): ?>
|
349 |
+
<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>
|
350 |
+
<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>
|
351 |
+
<?php else: ?>
|
352 |
+
<?php if($default_language == $key): ?>
|
353 |
+
<textarea rows="1" disabled="disabled"><?php echo $trn_contents; ?></textarea><br>
|
354 |
+
<?php elseif(in_array($product_content,array('regular_price','sale_price'))): ?>
|
355 |
+
<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;?> />
|
356 |
+
<?php else: ?>
|
357 |
+
<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>
|
358 |
+
<?php endif;?>
|
359 |
+
<?php endif; ?>
|
360 |
+
</td>
|
361 |
+
<?php endforeach; ?>
|
362 |
+
<?php
|
363 |
+
foreach ($attributes as $attr_key=>$attribute): ?>
|
364 |
+
<td>
|
365 |
+
<?php $trn_attribute = $woocommerce_wpml->products->get_custom_attribute_translation($product_id, $attr_key, $attribute, $key); ?>
|
366 |
+
<label class="custom_attr_label"><?php _e('name','wpml-wcml'); ?></label>
|
367 |
+
<br>
|
368 |
+
<?php if (!$trn_attribute): ?>
|
369 |
+
<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;?> />
|
370 |
+
<?php else: ?>
|
371 |
<?php if($default_language == $key): ?>
|
372 |
+
<textarea rows="1" disabled="disabled"><?php echo $trn_attribute['name']; ?></textarea>
|
373 |
<?php else: ?>
|
374 |
+
<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;?> />
|
375 |
+
<?php endif;?>
|
376 |
+
<?php endif;?>
|
377 |
+
<br>
|
378 |
+
<label class="custom_attr_label"><?php _e('values','wpml-wcml'); ?></label>
|
379 |
+
<br>
|
380 |
+
<?php if (!$trn_attribute): ?>
|
381 |
+
<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;?>/>
|
382 |
+
<?php else: ?>
|
383 |
+
<?php if($default_language == $key): ?>
|
384 |
+
<textarea rows="1" disabled="disabled"><?php echo $trn_attribute['value']; ?></textarea>
|
385 |
+
<?php else: ?>
|
386 |
+
<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;?> />
|
387 |
+
<?php endif; ?>
|
388 |
+
<?php endif; ?>
|
389 |
+
</td>
|
390 |
<?php endforeach; ?>
|
391 |
+
</tr>
|
392 |
+
<?php endforeach; ?>
|
393 |
+
</tbody>
|
394 |
+
</table>
|
395 |
+
</div>
|
396 |
+
</div>
|
397 |
+
</td>
|
398 |
+
</tr>
|
399 |
+
<?php endforeach; ?>
|
400 |
+
<?php endif; ?>
|
401 |
+
</tbody>
|
402 |
+
</table>
|
403 |
|
404 |
<div class="wcml_fade"></div>
|
405 |
|
menu/sub/settings.php
CHANGED
@@ -43,6 +43,49 @@
|
|
43 |
</div> <!-- .wcml-section-content -->
|
44 |
|
45 |
</div> <!-- .wcml-section -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
<div class="wcml-section">
|
48 |
|
@@ -178,6 +221,32 @@
|
|
178 |
|
179 |
</div> <!-- .wcml-section -->
|
180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
|
182 |
<div class="wcml-section">
|
183 |
|
@@ -216,7 +285,7 @@
|
|
216 |
<div class="wcml-section-header">
|
217 |
<h3>
|
218 |
<?php _e('Manage Currencies', 'wpml-wcml'); ?>
|
219 |
-
<i class="icon-question-sign js-display-tooltip" data-header="<?php _e('Currency management', 'wpml-wcml') ?>" data-content="<?php _e('
|
220 |
</h3>
|
221 |
</div>
|
222 |
|
@@ -224,32 +293,41 @@
|
|
224 |
|
225 |
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>" id="general_options">
|
226 |
<?php wp_nonce_field('general_options', 'wcml_nonce'); ?>
|
|
|
227 |
<ul id="general_options">
|
228 |
-
|
229 |
-
<input type="checkbox" name="multi_currency" id="multi_currency" <?php echo $woocommerce_wpml->settings['enable_multi_currency'] == 'yes'?'checked':''; ?> />
|
230 |
-
<label for="multi_currency"><?php _e("Enable multi-currency",'wpml-wcml'); ?></label>
|
231 |
-
</p>
|
232 |
-
<?php if($woocommerce_wpml->settings['enable_multi_currency'] == 'yes'): ?>
|
233 |
<li>
|
234 |
-
<
|
235 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
</li>
|
237 |
-
<li>
|
238 |
-
<input type="radio" name="currency_converting_option[]" id="currency_converting_option_2" value="2" <?php echo $woocommerce_wpml->settings['currency_converting_option'] == '2'?'checked':''; ?>>
|
239 |
-
<label for="currency_converting_option_2"><?php _e('I will manage the pricing in each currency myself', 'wpml-wcml'); ?></label>
|
240 |
-
</li>
|
241 |
-
<?php endif; ?>
|
242 |
</ul>
|
|
|
243 |
<p class="button-wrap">
|
244 |
<input type='submit' name="general_options" value='<?php _e('Save', 'wpml-wcml'); ?>' class='button-secondary' />
|
245 |
<?php wp_nonce_field('general_options', 'general_options_nonce'); ?>
|
246 |
</p>
|
|
|
|
|
247 |
</form>
|
248 |
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
<p>
|
254 |
<?php printf(__('Your store\'s base currency is %s. To change it, go to the %s page.', 'wpml-wcml'),get_option('woocommerce_currency'),'<a href="'. admin_url('admin.php?page=woocommerce_settings&tab=general') .'">WooCommerce settings</a>'); ?>
|
255 |
</p>
|
@@ -258,7 +336,7 @@
|
|
258 |
<thead>
|
259 |
<tr>
|
260 |
<th><?php _e('Currency code', 'wpml-wcml'); ?></th>
|
261 |
-
<th><?php printf(__('Exchange rate to %s', 'wpml-wcml'),get_option('woocommerce_currency')
|
262 |
<th><?php _e('Changed', 'wpml-wcml'); ?></th>
|
263 |
<th></th>
|
264 |
</tr>
|
@@ -266,7 +344,7 @@
|
|
266 |
<tfoot>
|
267 |
<tr>
|
268 |
<th><?php _e('Currency code', 'wpml-wcml'); ?></th>
|
269 |
-
<th><?php printf(__('Exchange rate to %s', 'wpml-wcml'),get_option('woocommerce_currency')
|
270 |
<th><?php _e('Changed', 'wpml-wcml'); ?></th>
|
271 |
<th></th>
|
272 |
</tr>
|
@@ -274,11 +352,9 @@
|
|
274 |
<tbody>
|
275 |
<?php
|
276 |
$currencies = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "icl_currencies ORDER BY `id` DESC", OBJECT);
|
277 |
-
|
278 |
foreach ($currencies as $key => $currency) : ?>
|
279 |
-
<tr>
|
280 |
-
<
|
281 |
-
<td class="currency_code" data-message="<?php _e( 'Please fill field', 'wpml-wcml' ); ?>">
|
282 |
<span><?php echo $currency->code; ?></span>
|
283 |
<input type="text" value="<?php echo $currency->code; ?>"/>
|
284 |
</td>
|
@@ -288,6 +364,7 @@
|
|
288 |
</td>
|
289 |
<td class="currency_changed">
|
290 |
<span><?php echo date('d/m/Y',strtotime($currency->changed)); ?></span>
|
|
|
291 |
</td>
|
292 |
<td class="currency-actions">
|
293 |
<div class="currency_action_update">
|
@@ -311,9 +388,8 @@
|
|
311 |
|
312 |
<?php // this is a template for scripts.js : jQuery('.wcml_add_currency button').click(function(); ?>
|
313 |
<table class="hidden js-table-row-wrapper">
|
314 |
-
<tr class="edit-mode js-table-row">
|
315 |
-
<
|
316 |
-
<td class="currency_code" data-message="<?php _e( 'Please fill field', 'wpml-wcml' ); ?>">
|
317 |
<span></span>
|
318 |
<input type="text" value="" style="display:block">
|
319 |
</td>
|
@@ -323,19 +399,20 @@
|
|
323 |
</td>
|
324 |
<td class="currency_changed">
|
325 |
<span></span>
|
|
|
326 |
</td>
|
327 |
<td class="currency-actions">
|
328 |
<div class="currency_action_update">
|
329 |
<a href="javascript:void(0);" title="Edit" class="edit_currency" style="display:none">
|
330 |
<i class="icon-edit" title="Edit"></i>
|
331 |
</a>
|
332 |
-
<button type="button" class="button-secondary cancel_currency" style="display:inline-block"
|
333 |
</div>
|
334 |
<div class="currency_action_delete">
|
335 |
<a href="javascript:void(0);" title="Delete" class="delete_currency" style="display:none">
|
336 |
<i class="icon-trash" alt="Delete"></i>
|
337 |
</a>
|
338 |
-
<button type="button" class="button-secondary save_currency" style="display:inline-block"
|
339 |
</div>
|
340 |
</td>
|
341 |
</tr>
|
@@ -344,9 +421,6 @@
|
|
344 |
<input type="hidden" value="<?php echo WCML_PLUGIN_URL; ?>" class="wcml_plugin_url" />
|
345 |
<input type="hidden" id="upd_currency_nonce" value="<?php echo wp_create_nonce('wcml_update_currency'); ?>" />
|
346 |
<input type="hidden" id="del_currency_nonce" value="<?php echo wp_create_nonce('wcml_delete_currency'); ?>" />
|
347 |
-
<?php if($auto_currency ==2): ?>
|
348 |
-
<p><?php _e('(*) This exchange rate is not applied automatically because you chose to set pricing manually in different currencies.','wpml-wcml'); ?></p>
|
349 |
-
<?php endif; ?>
|
350 |
|
351 |
<p class="wcml_add_currency button-wrap">
|
352 |
<button type="button" class="button-secondary">
|
@@ -355,25 +429,95 @@
|
|
355 |
</button>
|
356 |
</p>
|
357 |
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
|
378 |
</div> <!-- .wcml-section-content -->
|
379 |
|
43 |
</div> <!-- .wcml-section-content -->
|
44 |
|
45 |
</div> <!-- .wcml-section -->
|
46 |
+
<?php global $sitepress_settings; ?>
|
47 |
+
<?php if($sitepress->get_default_language() != 'en' && $sitepress_settings['st']['strings_language'] != 'en' || !empty($woocommerce_wpml->dependencies->xml_config_errors)): ?>
|
48 |
+
<div class="wcml-section">
|
49 |
+
<div class="wcml-section-header">
|
50 |
+
<h3>
|
51 |
+
<?php _e('Configuration warnings','wpml-wcml'); ?>
|
52 |
+
<i class="icon-question-sign js-display-tooltip" data-header="<?php _e('Configuration warnings', 'wpml-wcml') ?>" data-content="<?php _e('Reporting miscelaneous configuration issues that can make WooCommerce Multilingual not run normally', 'wpml-wcml') ?>"></i>
|
53 |
+
</h3>
|
54 |
+
</div>
|
55 |
+
|
56 |
+
<div class="wcml-section-content">
|
57 |
+
<?php if($sitepress->get_default_language() != 'en' && $sitepress_settings['st']['strings_language'] != 'en'): ?>
|
58 |
+
<p><i class="icon-warning-sign"></i><strong><?php _e('Attention required: probable problem with URLs in different languages', 'wpml-wcml') ?></strong></p>
|
59 |
+
|
60 |
+
<p><?php _e("Your site's default language is not English and the strings language is also not English. This may lead to problems with your site's URLs in different languages.", 'wpml-wcml') ?></p>
|
61 |
+
|
62 |
+
<ul>
|
63 |
+
<li>» <?php _e('Change the strings language to English', 'wpml-wcml') ?></li>
|
64 |
+
<li>» <?php _e('Re-scan strings', 'wpml-wcml') ?></li>
|
65 |
+
</ul>
|
66 |
+
|
67 |
+
<p class="submit">
|
68 |
+
<input type="hidden" id="wcml_fix_strings_language_nonce" value="<?php echo wp_create_nonce('wcml_fix_strings_language') ?>" />
|
69 |
+
<input id="wcml_fix_strings_language" type="button" class="button-primary" value="<?php esc_attr_e('Run fix', 'wpml-wcml') ?>" />
|
70 |
+
</p>
|
71 |
+
<?php endif; ?>
|
72 |
+
|
73 |
+
<?php if(!empty($woocommerce_wpml->dependencies->xml_config_errors)): ?>
|
74 |
+
<p><i class="icon-warning-sign"></i><strong><?php _e('Some settings from the WooCommerce Multilingual wpml-config.xml file have been overwritten', 'wpml-wcml') ?></strong></p>
|
75 |
+
<ul>
|
76 |
+
<?php foreach($woocommerce_wpml->dependencies->xml_config_errors as $error): ?>
|
77 |
+
<li><?php echo $error ?></li>
|
78 |
+
<?php endforeach; ?>
|
79 |
+
</ul>
|
80 |
+
|
81 |
+
|
82 |
+
<?php endif; ?>
|
83 |
+
|
84 |
+
</div>
|
85 |
+
|
86 |
+
</div>
|
87 |
+
<?php endif; ?>
|
88 |
+
|
89 |
|
90 |
<div class="wcml-section">
|
91 |
|
221 |
|
222 |
</div> <!-- .wcml-section -->
|
223 |
|
224 |
+
<div class="wcml-section">
|
225 |
+
|
226 |
+
<div class="wcml-section-header">
|
227 |
+
<h3>
|
228 |
+
<?php _e('Products synchronization', 'wpml-wcml'); ?>
|
229 |
+
<i class="icon-question-sign js-display-tooltip" data-header="<?php _e('Products synchronization', 'wpml-wcml') ?>" data-content="<?php _e('Configure specific product properties that should be synced to translations.', 'wpml-wcml') ?>"></i>
|
230 |
+
</h3>
|
231 |
+
</div>
|
232 |
+
|
233 |
+
<div class="wcml-section-content">
|
234 |
+
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
235 |
+
<?php wp_nonce_field('wcml_products_sync_prop', 'wcml_nonce'); ?>
|
236 |
+
<ul>
|
237 |
+
<li>
|
238 |
+
<input type="checkbox" name="products_sync_date" value="1" <?php echo checked(1, $woocommerce_wpml->settings['products_sync_date']) ?> id="wcml_products_sync_date" />
|
239 |
+
<label for="wcml_products_sync_date"><?php _e('Sync publishing date for translated products.', 'wpml-wcml'); ?></label>
|
240 |
+
</li>
|
241 |
+
</ul>
|
242 |
+
<p class="button-wrap">
|
243 |
+
<input type='submit' name="wcml_products_sync_prop" value='<?php esc_attr(_e('Save', 'wpml-wcml')); ?>' class='button-secondary' />
|
244 |
+
</p>
|
245 |
+
</form>
|
246 |
+
</div>
|
247 |
+
|
248 |
+
</div>
|
249 |
+
|
250 |
|
251 |
<div class="wcml-section">
|
252 |
|
285 |
<div class="wcml-section-header">
|
286 |
<h3>
|
287 |
<?php _e('Manage Currencies', 'wpml-wcml'); ?>
|
288 |
+
<i class="icon-question-sign js-display-tooltip" data-header="<?php _e('Currency management', 'wpml-wcml') ?>" data-content="<?php _e('This will let you enable the multi-currency mode where users can see prices according to their currency preference and configured exchange rate.', 'wpml-wcml') ?>"></i>
|
289 |
</h3>
|
290 |
</div>
|
291 |
|
293 |
|
294 |
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>" id="general_options">
|
295 |
<?php wp_nonce_field('general_options', 'wcml_nonce'); ?>
|
296 |
+
|
297 |
<ul id="general_options">
|
298 |
+
|
|
|
|
|
|
|
|
|
299 |
<li>
|
300 |
+
<ul id="multi_currency_option_select">
|
301 |
+
<li>
|
302 |
+
<input type="radio" name="multi_currency" id="multi_currency_disabled" value="<?php echo WCML_MULTI_CURRENCIES_DISABLED ?>" <?php
|
303 |
+
echo checked($woocommerce_wpml->settings['enable_multi_currency'], WCML_MULTI_CURRENCIES_DISABLED) ?> />
|
304 |
+
<label for="multi_currency_disabled"><?php _e("No multi-currency",'wpml-wcml'); ?></label>
|
305 |
+
</li>
|
306 |
+
<li>
|
307 |
+
<input type="radio" name="multi_currency" id="multi_currency_independent" value="<?php echo WCML_MULTI_CURRENCIES_INDEPENDENT ?>" <?php
|
308 |
+
echo checked($woocommerce_wpml->settings['enable_multi_currency'], WCML_MULTI_CURRENCIES_INDEPENDENT) ?> />
|
309 |
+
<label for="multi_currency_independent">
|
310 |
+
<?php _e("Multiple currencies, independent of languages",'wpml-wcml'); ?>
|
311 |
+
<strong>[<?php _e('BETA', 'wpl-wcml') ?>]</strong>
|
312 |
+
<a href="http://wpml.org/?p=290080"><?php _e('Learn more', 'wpl-wcml') ?></a>.
|
313 |
+
</label>
|
314 |
+
</li>
|
315 |
+
</ul>
|
316 |
</li>
|
|
|
|
|
|
|
|
|
|
|
317 |
</ul>
|
318 |
+
|
319 |
<p class="button-wrap">
|
320 |
<input type='submit' name="general_options" value='<?php _e('Save', 'wpml-wcml'); ?>' class='button-secondary' />
|
321 |
<?php wp_nonce_field('general_options', 'general_options_nonce'); ?>
|
322 |
</p>
|
323 |
+
|
324 |
+
|
325 |
</form>
|
326 |
|
327 |
+
|
328 |
+
|
329 |
+
<div id="multi-currency-per-language-details" <?php if ( $woocommerce_wpml->settings['enable_multi_currency'] != WCML_MULTI_CURRENCIES_INDEPENDENT ):?>style="display:none"<?php endif;?>>
|
330 |
+
|
331 |
<p>
|
332 |
<?php printf(__('Your store\'s base currency is %s. To change it, go to the %s page.', 'wpml-wcml'),get_option('woocommerce_currency'),'<a href="'. admin_url('admin.php?page=woocommerce_settings&tab=general') .'">WooCommerce settings</a>'); ?>
|
333 |
</p>
|
336 |
<thead>
|
337 |
<tr>
|
338 |
<th><?php _e('Currency code', 'wpml-wcml'); ?></th>
|
339 |
+
<th><?php printf(__('Exchange rate to %s', 'wpml-wcml'),get_option('woocommerce_currency')); ?></th>
|
340 |
<th><?php _e('Changed', 'wpml-wcml'); ?></th>
|
341 |
<th></th>
|
342 |
</tr>
|
344 |
<tfoot>
|
345 |
<tr>
|
346 |
<th><?php _e('Currency code', 'wpml-wcml'); ?></th>
|
347 |
+
<th><?php printf(__('Exchange rate to %s', 'wpml-wcml'),get_option('woocommerce_currency')); ?></th>
|
348 |
<th><?php _e('Changed', 'wpml-wcml'); ?></th>
|
349 |
<th></th>
|
350 |
</tr>
|
352 |
<tbody>
|
353 |
<?php
|
354 |
$currencies = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "icl_currencies ORDER BY `id` DESC", OBJECT);
|
|
|
355 |
foreach ($currencies as $key => $currency) : ?>
|
356 |
+
<tr>
|
357 |
+
<td class="currency_code" data-message="<?php _e( 'Please fill field', 'wpml-wcml' ); ?>">
|
|
|
358 |
<span><?php echo $currency->code; ?></span>
|
359 |
<input type="text" value="<?php echo $currency->code; ?>"/>
|
360 |
</td>
|
364 |
</td>
|
365 |
<td class="currency_changed">
|
366 |
<span><?php echo date('d/m/Y',strtotime($currency->changed)); ?></span>
|
367 |
+
<input type="hidden" value="<?php echo $currency->id; ?>" class="currency_id" />
|
368 |
</td>
|
369 |
<td class="currency-actions">
|
370 |
<div class="currency_action_update">
|
388 |
|
389 |
<?php // this is a template for scripts.js : jQuery('.wcml_add_currency button').click(function(); ?>
|
390 |
<table class="hidden js-table-row-wrapper">
|
391 |
+
<tr class="edit-mode js-table-row">
|
392 |
+
<td class="currency_code" data-message="<?php _e( 'Please fill field', 'wpml-wcml' ); ?>">
|
|
|
393 |
<span></span>
|
394 |
<input type="text" value="" style="display:block">
|
395 |
</td>
|
399 |
</td>
|
400 |
<td class="currency_changed">
|
401 |
<span></span>
|
402 |
+
<input type="hidden" value="" class="currency_id" />
|
403 |
</td>
|
404 |
<td class="currency-actions">
|
405 |
<div class="currency_action_update">
|
406 |
<a href="javascript:void(0);" title="Edit" class="edit_currency" style="display:none">
|
407 |
<i class="icon-edit" title="Edit"></i>
|
408 |
</a>
|
409 |
+
<button type="button" class="button-secondary cancel_currency" style="display:inline-block"><?php _e('Cancel', 'wpml-wcml') ?></button>
|
410 |
</div>
|
411 |
<div class="currency_action_delete">
|
412 |
<a href="javascript:void(0);" title="Delete" class="delete_currency" style="display:none">
|
413 |
<i class="icon-trash" alt="Delete"></i>
|
414 |
</a>
|
415 |
+
<button type="button" class="button-secondary save_currency" style="display:inline-block"><?php _e('Save', 'wpml-wcml') ?></button>
|
416 |
</div>
|
417 |
</td>
|
418 |
</tr>
|
421 |
<input type="hidden" value="<?php echo WCML_PLUGIN_URL; ?>" class="wcml_plugin_url" />
|
422 |
<input type="hidden" id="upd_currency_nonce" value="<?php echo wp_create_nonce('wcml_update_currency'); ?>" />
|
423 |
<input type="hidden" id="del_currency_nonce" value="<?php echo wp_create_nonce('wcml_delete_currency'); ?>" />
|
|
|
|
|
|
|
424 |
|
425 |
<p class="wcml_add_currency button-wrap">
|
426 |
<button type="button" class="button-secondary">
|
429 |
</button>
|
430 |
</p>
|
431 |
|
432 |
+
<?php // backward compatibility ?>
|
433 |
+
<?php
|
434 |
+
$posts = $wpdb->get_results($wpdb->prepare("
|
435 |
+
SELECT m.post_id, m.meta_value, p.post_title
|
436 |
+
FROM {$wpdb->postmeta} m
|
437 |
+
JOIN {$wpdb->posts} p ON p.ID = m.post_id
|
438 |
+
JOIN {$wpdb->prefix}icl_translations t ON t.element_id = p.ID AND t.element_type IN ('post_product', 'post_product_variation')
|
439 |
+
WHERE m.meta_key='_custom_conversion_rate' AND t.language_code = %s
|
440 |
+
ORDER BY m.post_id desc
|
441 |
+
", $sitepress->get_default_language()));
|
442 |
+
|
443 |
+
if($posts){
|
444 |
+
echo "<script>
|
445 |
+
function wcml_remove_custom_rates(post_id, el){
|
446 |
+
jQuery.ajax({
|
447 |
+
type: 'post',
|
448 |
+
dataType: 'json',
|
449 |
+
url: ajaxurl,
|
450 |
+
data: {action: 'legacy_remove_custom_rates', 'post_id': post_id},
|
451 |
+
success: function(){
|
452 |
+
el.parent().parent().fadeOut(function(){ jQuery(this).remove()});
|
453 |
+
}
|
454 |
+
})
|
455 |
+
return false;
|
456 |
+
}";
|
457 |
+
echo '</script>';
|
458 |
+
echo '<p>' . __('Products using custom currency rates as they were migrated from the previous versions - option to support different prices per language', 'wpml-wcml') . '</p>';
|
459 |
+
echo '<form method="post" id="wcml_custom_exchange_rates">';
|
460 |
+
echo '<input type="hidden" name="action" value="legacy_update_custom_rates">';
|
461 |
+
echo '<table class="widefat currency_table" >';
|
462 |
+
echo '<thead>';
|
463 |
+
echo '<tr>';
|
464 |
+
echo '<th rowspan="2">' . __('Product', 'wpml-wcml') . '</th>';
|
465 |
+
echo '<th colspan="' . count($currencies) . '">_price</th>';
|
466 |
+
echo '<th colspan="' . count($currencies) . '">_sale_price</th>';
|
467 |
+
echo '<th rowspan="2"> </th>';
|
468 |
+
echo '</tr>';
|
469 |
+
echo '<tr>';
|
470 |
+
foreach($currencies as $currency){
|
471 |
+
echo '<th>' . $currency->code . '</th>';
|
472 |
+
}
|
473 |
+
foreach($currencies as $currency){
|
474 |
+
echo '<th>' . $currency->code . '</th>';
|
475 |
+
}
|
476 |
+
echo '</tr>';
|
477 |
+
echo '</thead>';
|
478 |
+
echo '<tbody>';
|
479 |
+
foreach($posts as $post){
|
480 |
+
$rates = unserialize($post->meta_value);
|
481 |
+
echo '<tr>';
|
482 |
+
echo '<td><a href="' . get_edit_post_link($post->post_id) . '">' . apply_filters('the_title', $post->post_title) . '</a></td>';
|
483 |
+
|
484 |
+
foreach($currencies as $currency){
|
485 |
+
echo '<td>';
|
486 |
+
if(isset($rates['_price'][$currency->code])){
|
487 |
+
echo '<input name="posts[' . $post->post_id . '][_price][' . $currency->code . ']" size="3" value="' . round($rates['_price'][$currency->code],3) . '">';
|
488 |
+
}else{
|
489 |
+
_e('n/a', 'wpml-wcml');
|
490 |
+
}
|
491 |
+
echo '</td>';
|
492 |
+
}
|
493 |
+
|
494 |
+
foreach($currencies as $currency){
|
495 |
+
echo '<td>';
|
496 |
+
if(isset($rates['_sale_price'][$currency->code])){
|
497 |
+
echo '<input name="posts[' . $post->post_id . '][_sale_price][' . $currency->code . ']" size="3" value="' . round($rates['_sale_price'][$currency->code],3) . '">';
|
498 |
+
}else{
|
499 |
+
_e('n/a', 'wpml-wcml');
|
500 |
+
}
|
501 |
+
echo '</td>';
|
502 |
+
}
|
503 |
+
|
504 |
+
echo '<td align="right"><a href="#" onclick=" if(confirm(\'' . esc_js(__('Are you sure?', 'wpml-wcml') ) . '\')) wcml_remove_custom_rates(' . $post->post_id . ', jQuery(this));return false;"><i class="icon-trash" title="' . __('Delete', 'wpml-wcml') . '"></i></a></td>';
|
505 |
+
echo '<tr>';
|
506 |
+
|
507 |
+
}
|
508 |
+
echo '</tbody>';
|
509 |
+
echo '</table>';
|
510 |
+
echo '<p class="button-wrap"><input class="button-secondary" type="submit" value="' . esc_attr__('Update', 'wpml-wcml') . '" /></p>';
|
511 |
+
echo '</form>';
|
512 |
+
|
513 |
+
|
514 |
+
}
|
515 |
+
?>
|
516 |
+
|
517 |
+
|
518 |
+
|
519 |
+
|
520 |
+
</div>
|
521 |
|
522 |
</div> <!-- .wcml-section-content -->
|
523 |
|
menu/sub/troubleshooting.php
CHANGED
@@ -5,13 +5,13 @@ if(get_option('wcml_products_to_sync') === false ){
|
|
5 |
}
|
6 |
|
7 |
$prod_with_variations = $woocommerce_wpml->troubleshooting->wcml_count_products_with_variations();
|
8 |
-
|
9 |
?>
|
10 |
<div class="wrap wcml_trblsh">
|
11 |
<div id="icon-wpml" class="icon32"><br /></div>
|
12 |
<h2><?php _e('Troubleshooting', 'wpml-wcml') ?></h2>
|
13 |
<div class="wcml_trbl_warning">
|
14 |
-
<h3><?php _e('Please make backup of your database before start synchronization', 'wpml-wcml') ?></h3>
|
15 |
</div>
|
16 |
<div class="trbl_variables_products">
|
17 |
<h3><?php _e('Sync variables products', 'wpml-wcml') ?></h3>
|
@@ -31,9 +31,20 @@ $prod_with_variations = $woocommerce_wpml->troubleshooting->wcml_count_products_
|
|
31 |
</label>
|
32 |
|
33 |
</li>
|
|
|
34 |
<li>
|
35 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
<input id="count_prod_variat" type="hidden" value="<?php echo $prod_with_variations; ?>"/>
|
|
|
|
|
37 |
<span class="wcml_spinner"></span>
|
38 |
</li>
|
39 |
</ul>
|
@@ -43,15 +54,17 @@ $prod_with_variations = $woocommerce_wpml->troubleshooting->wcml_count_products_
|
|
43 |
<script type="text/javascript">
|
44 |
jQuery(document).ready(function(){
|
45 |
//troubleshooting page
|
46 |
-
jQuery('#
|
47 |
var field = jQuery(this);
|
48 |
field.attr('disabled', 'disabled');
|
49 |
jQuery('.wcml_spinner').css('display','inline-block');
|
50 |
|
51 |
if(jQuery('#wcml_sync_update_product_count').is(':checked')){
|
52 |
update_product_count();
|
53 |
-
}else{
|
54 |
sync_variations();
|
|
|
|
|
55 |
}
|
56 |
});
|
57 |
});
|
@@ -69,7 +82,11 @@ $prod_with_variations = $woocommerce_wpml->troubleshooting->wcml_count_products_
|
|
69 |
jQuery(this).html(response);
|
70 |
})
|
71 |
jQuery('#count_prod_variat').val(response);
|
|
|
72 |
sync_variations();
|
|
|
|
|
|
|
73 |
}
|
74 |
});
|
75 |
}
|
@@ -84,12 +101,17 @@ $prod_with_variations = $woocommerce_wpml->troubleshooting->wcml_count_products_
|
|
84 |
},
|
85 |
success: function(response) {
|
86 |
if(jQuery('#count_prod_variat').val() == 0){
|
87 |
-
jQuery('#wcml_sync_variations').removeAttr('disabled');
|
88 |
-
jQuery('.wcml_spinner').hide();
|
89 |
-
jQuery('#wcml_sync_variations').next().fadeOut();
|
90 |
jQuery('.var_status').each(function(){
|
91 |
jQuery(this).html(0);
|
92 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
}else{
|
94 |
var left = jQuery('#count_prod_variat').val()-3;
|
95 |
if(left < 0 ){
|
@@ -104,4 +126,34 @@ $prod_with_variations = $woocommerce_wpml->troubleshooting->wcml_count_products_
|
|
104 |
}
|
105 |
});
|
106 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
</script>
|
5 |
}
|
6 |
|
7 |
$prod_with_variations = $woocommerce_wpml->troubleshooting->wcml_count_products_with_variations();
|
8 |
+
$prod_count = $woocommerce_wpml->troubleshooting->wcml_count_products();
|
9 |
?>
|
10 |
<div class="wrap wcml_trblsh">
|
11 |
<div id="icon-wpml" class="icon32"><br /></div>
|
12 |
<h2><?php _e('Troubleshooting', 'wpml-wcml') ?></h2>
|
13 |
<div class="wcml_trbl_warning">
|
14 |
+
<h3><?php _e('Please make a backup of your database before you start the synchronization', 'wpml-wcml') ?></h3>
|
15 |
</div>
|
16 |
<div class="trbl_variables_products">
|
17 |
<h3><?php _e('Sync variables products', 'wpml-wcml') ?></h3>
|
31 |
</label>
|
32 |
|
33 |
</li>
|
34 |
+
<?php if(defined('WPML_MEDIA_VERSION')): ?>
|
35 |
<li>
|
36 |
+
<label>
|
37 |
+
<input type="checkbox" id="wcml_sync_gallery_images" />
|
38 |
+
<?php _e('Sync products "gallery images"', 'wpml-wcml') ?>
|
39 |
+
<span class="gallery_status"><?php echo $prod_count; ?></span> <span><?php _e('left', 'wpml-wcml') ?></span>
|
40 |
+
</label>
|
41 |
+
</li>
|
42 |
+
<?php endif; ?>
|
43 |
+
<li>
|
44 |
+
<button type="button" class="button-secondary" id="wcml_trbl"><?php _e('Start', 'wpml-wcml') ?></button>
|
45 |
<input id="count_prod_variat" type="hidden" value="<?php echo $prod_with_variations; ?>"/>
|
46 |
+
<input id="count_prod" type="hidden" value="<?php echo $prod_count; ?>"/>
|
47 |
+
<input id="sync_galerry_page" type="hidden" value="0"/>
|
48 |
<span class="wcml_spinner"></span>
|
49 |
</li>
|
50 |
</ul>
|
54 |
<script type="text/javascript">
|
55 |
jQuery(document).ready(function(){
|
56 |
//troubleshooting page
|
57 |
+
jQuery('#wcml_trbl').on('click',function(){
|
58 |
var field = jQuery(this);
|
59 |
field.attr('disabled', 'disabled');
|
60 |
jQuery('.wcml_spinner').css('display','inline-block');
|
61 |
|
62 |
if(jQuery('#wcml_sync_update_product_count').is(':checked')){
|
63 |
update_product_count();
|
64 |
+
}else if(jQuery('#wcml_sync_product_variations').is(':checked')){
|
65 |
sync_variations();
|
66 |
+
}else if(jQuery('#wcml_sync_gallery_images').is(':checked')){
|
67 |
+
sync_product_gallery();
|
68 |
}
|
69 |
});
|
70 |
});
|
82 |
jQuery(this).html(response);
|
83 |
})
|
84 |
jQuery('#count_prod_variat').val(response);
|
85 |
+
if(jQuery('#wcml_sync_product_variations').is(':checked')){
|
86 |
sync_variations();
|
87 |
+
}else if(jQuery('#wcml_sync_gallery_images').is(':checked')){
|
88 |
+
sync_product_gallery();
|
89 |
+
}
|
90 |
}
|
91 |
});
|
92 |
}
|
101 |
},
|
102 |
success: function(response) {
|
103 |
if(jQuery('#count_prod_variat').val() == 0){
|
|
|
|
|
|
|
104 |
jQuery('.var_status').each(function(){
|
105 |
jQuery(this).html(0);
|
106 |
});
|
107 |
+
if(jQuery('#wcml_sync_gallery_images').is(':checked')){
|
108 |
+
sync_product_gallery();
|
109 |
+
}else{
|
110 |
+
jQuery('#wcml_trbl').removeAttr('disabled');
|
111 |
+
jQuery('.wcml_spinner').hide();
|
112 |
+
jQuery('#wcml_trbl').next().fadeOut();
|
113 |
+
}
|
114 |
+
|
115 |
}else{
|
116 |
var left = jQuery('#count_prod_variat').val()-3;
|
117 |
if(left < 0 ){
|
126 |
}
|
127 |
});
|
128 |
}
|
129 |
+
|
130 |
+
function sync_product_gallery(){
|
131 |
+
jQuery.ajax({
|
132 |
+
type : "post",
|
133 |
+
url : ajaxurl,
|
134 |
+
data : {
|
135 |
+
action: "trbl_gallery_images",
|
136 |
+
wcml_nonce: "<?php echo wp_create_nonce('trbl_gallery_images'); ?>",
|
137 |
+
page: jQuery('#sync_galerry_page').val()
|
138 |
+
},
|
139 |
+
success: function(response) {
|
140 |
+
if(jQuery('#count_prod').val() == 0){
|
141 |
+
jQuery('#wcml_trbl').removeAttr('disabled');
|
142 |
+
jQuery('.wcml_spinner').hide();
|
143 |
+
jQuery('#wcml_trbl').next().fadeOut();
|
144 |
+
jQuery('.gallery_status').html(0);
|
145 |
+
}else{
|
146 |
+
var left = jQuery('#count_prod').val()-5;
|
147 |
+
if(left < 0 ){
|
148 |
+
left = 0;
|
149 |
+
}else{
|
150 |
+
jQuery('#sync_galerry_page').val(parseInt(jQuery('#sync_galerry_page').val())+1)
|
151 |
+
}
|
152 |
+
jQuery('.gallery_status').html(left);
|
153 |
+
jQuery('#count_prod').val(left);
|
154 |
+
sync_product_gallery();
|
155 |
+
}
|
156 |
+
}
|
157 |
+
});
|
158 |
+
}
|
159 |
</script>
|
menu/sub/variations_box.php
CHANGED
@@ -44,7 +44,7 @@
|
|
44 |
<?php if($template_data['original']): ?>
|
45 |
<td><input class="wcml_price" type="text" value="<?php echo $template_data[$text][$variation_id]['value']?>" readonly="readonly" /></td>
|
46 |
<?php else: ?>
|
47 |
-
<td><input class="wcml_price" type="text" name="<?php echo $text; ?>_<?php echo $lang ?>[<?php echo $variation_id ?>]" value="<?php echo $template_data[$text][$variation_id]['value']?>" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"
|
48 |
<?php endif; ?>
|
49 |
<?php endif; ?>
|
50 |
<?php endforeach; ?>
|
44 |
<?php if($template_data['original']): ?>
|
45 |
<td><input class="wcml_price" type="text" value="<?php echo $template_data[$text][$variation_id]['value']?>" readonly="readonly" /></td>
|
46 |
<?php else: ?>
|
47 |
+
<td><input class="wcml_price" type="text" name="<?php echo $text; ?>_<?php echo $lang ?>[<?php echo $variation_id ?>]" value="<?php echo $template_data[$text][$variation_id]['value']?>" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"/></td>
|
48 |
<?php endif; ?>
|
49 |
<?php endif; ?>
|
50 |
<?php endforeach; ?>
|
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: 3.
|
8 |
-
Stable tag: 3.
|
9 |
|
10 |
Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
|
11 |
|
@@ -77,6 +77,19 @@ In order for the checkout and store pages to appear translated, you need to crea
|
|
77 |
|
78 |
== Changelog ==
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
= 3.0.1 =
|
81 |
* Replaced deprecated jQuery function live()
|
82 |
* Fixed bug: language names not localized on products editor page
|
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: 3.8
|
8 |
+
Stable tag: 3.1
|
9 |
|
10 |
Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
|
11 |
|
77 |
|
78 |
== Changelog ==
|
79 |
|
80 |
+
= 3.1 =
|
81 |
+
* Support for multi-currency (independent of language) BETA
|
82 |
+
* Support for translating products via ICanLocalize (professional translation)
|
83 |
+
* Option to synchronize product translation dates
|
84 |
+
* Compatibility with Table Rate Shipping and other extensions
|
85 |
+
* Better handling for couponse
|
86 |
+
* Fixed bug: product attributes not saved on orders
|
87 |
+
* Fixed bug: Can't get to the cart & checkout pages if they are set as child pages
|
88 |
+
* Fixed bug: Style conflicts in Dashboard for Arabic
|
89 |
+
* Fixed various issues with notification emails
|
90 |
+
* Fixed bug: Variable products default selection is not copied to translations.
|
91 |
+
* Fixed bug: Product Table is not showing Product Draft count
|
92 |
+
|
93 |
= 3.0.1 =
|
94 |
* Replaced deprecated jQuery function live()
|
95 |
* Fixed bug: language names not localized on products editor page
|
woocommerce_wpml.class.php
CHANGED
@@ -18,18 +18,24 @@ class woocommerce_wpml {
|
|
18 |
}
|
19 |
|
20 |
function init(){
|
21 |
-
global $sitepress;
|
22 |
|
23 |
new WCML_Upgrade;
|
24 |
|
25 |
$this->settings = $this->get_settings();
|
26 |
|
27 |
-
$
|
28 |
-
if(!$
|
29 |
return false;
|
30 |
}
|
31 |
|
32 |
-
$this->
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
$this->products = new WCML_Products;
|
34 |
$this->store = new WCML_Store_Pages;
|
35 |
$this->emails = new WCML_Emails;
|
@@ -68,14 +74,16 @@ class woocommerce_wpml {
|
|
68 |
//set translate product by default
|
69 |
$this->translate_product_slug();
|
70 |
|
71 |
-
if(is_admin() && isset($_GET['page']) && $_GET['page'] == 'wpml-wcml')
|
|
|
|
|
72 |
remove_action( 'wp_before_admin_bar_render', array($sitepress, 'admin_language_switcher') );
|
73 |
}
|
74 |
}
|
75 |
|
76 |
function translate_product_slug(){
|
77 |
global $sitepress, $wpdb,$woocommerce, $sitepress_settings;
|
78 |
-
|
79 |
if(!defined('WOOCOMMERCE_VERSION') || (!isset($GLOBALS['ICL_Pro_Translation']) || is_null($GLOBALS['ICL_Pro_Translation']))){
|
80 |
return;
|
81 |
}
|
@@ -83,9 +91,14 @@ class woocommerce_wpml {
|
|
83 |
$slug = get_option('woocommerce_product_slug') != false ? get_option('woocommerce_product_slug') : 'product';
|
84 |
|
85 |
$string = $wpdb->get_row($wpdb->prepare("SELECT id,status FROM {$wpdb->prefix}icl_strings WHERE name = %s AND value = %s ", 'URL slug: ' . $slug, $slug));
|
86 |
-
|
87 |
if(!$string){
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
89 |
}
|
90 |
|
91 |
if(!empty($permalinks['product_base']) && isset($sitepress_settings['posts_slug_translation']['types'][$slug])){
|
@@ -140,10 +153,9 @@ class woocommerce_wpml {
|
|
140 |
$defaults = array(
|
141 |
'file_path_sync' => 1,
|
142 |
'is_term_order_synced' => 0,
|
143 |
-
'enable_multi_currency' =>
|
144 |
-
'currency_converting_option' => 1,
|
145 |
'dismiss_doc_main' => 0,
|
146 |
-
'trnsl_interface'
|
147 |
);
|
148 |
|
149 |
if(empty($this->settings)){
|
@@ -182,23 +194,25 @@ class woocommerce_wpml {
|
|
182 |
add_option('wcml_custom_attr_translations',array());
|
183 |
}
|
184 |
|
185 |
-
$version_in_db = get_option('_wcml_version');
|
186 |
-
if(!get_option('icl_is_created_languages_currencies') || ($version_in_db && version_compare($version_in_db, WCML_VERSION, '<'))){
|
187 |
-
$this->currencies->install();
|
188 |
-
|
189 |
-
update_option('icl_is_wcml_installed', 'yes');
|
190 |
-
}
|
191 |
-
|
192 |
if(!isset($this->settings['wc_admin_options_saved'])){
|
193 |
$this->handle_admin_texts();
|
194 |
$this->settings['wc_admin_options_saved'] = 1;
|
195 |
$this->update_settings();
|
196 |
}
|
197 |
|
198 |
-
if(
|
199 |
$this->settings['trnsl_interface'] = 1;
|
200 |
$this->update_settings();
|
201 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
}
|
203 |
|
204 |
function menu(){
|
18 |
}
|
19 |
|
20 |
function init(){
|
21 |
+
global $sitepress,$pagenow;
|
22 |
|
23 |
new WCML_Upgrade;
|
24 |
|
25 |
$this->settings = $this->get_settings();
|
26 |
|
27 |
+
$this->dependencies = new WCML_Dependencies;
|
28 |
+
if(!$this->dependencies->check()){
|
29 |
return false;
|
30 |
}
|
31 |
|
32 |
+
if($this->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT){
|
33 |
+
require WCML_PLUGIN_PATH . '/inc/multi-currency-support.class.php';
|
34 |
+
$WCML_Multi_Currency_Support = new WCML_Multi_Currency_Support;
|
35 |
+
require_once WCML_PLUGIN_PATH . '/inc/multi-currency.class.php';
|
36 |
+
$WCML_WC_MultiCurrency = new WCML_WC_MultiCurrency;
|
37 |
+
}
|
38 |
+
|
39 |
$this->products = new WCML_Products;
|
40 |
$this->store = new WCML_Store_Pages;
|
41 |
$this->emails = new WCML_Emails;
|
74 |
//set translate product by default
|
75 |
$this->translate_product_slug();
|
76 |
|
77 |
+
if(is_admin() && ((isset($_GET['page']) && $_GET['page'] == 'wpml-wcml')
|
78 |
+
|| (($pagenow == 'edit.php' || $pagenow == 'post-new.php') && isset($_GET['post_type']) && $_GET['post_type'] == 'shop_coupon')
|
79 |
+
|| ($pagenow == 'post.php' && isset($_GET['post']) && get_post_type($_GET['post']) == 'shop_coupon'))){
|
80 |
remove_action( 'wp_before_admin_bar_render', array($sitepress, 'admin_language_switcher') );
|
81 |
}
|
82 |
}
|
83 |
|
84 |
function translate_product_slug(){
|
85 |
global $sitepress, $wpdb,$woocommerce, $sitepress_settings;
|
86 |
+
|
87 |
if(!defined('WOOCOMMERCE_VERSION') || (!isset($GLOBALS['ICL_Pro_Translation']) || is_null($GLOBALS['ICL_Pro_Translation']))){
|
88 |
return;
|
89 |
}
|
91 |
$slug = get_option('woocommerce_product_slug') != false ? get_option('woocommerce_product_slug') : 'product';
|
92 |
|
93 |
$string = $wpdb->get_row($wpdb->prepare("SELECT id,status FROM {$wpdb->prefix}icl_strings WHERE name = %s AND value = %s ", 'URL slug: ' . $slug, $slug));
|
94 |
+
|
95 |
if(!$string){
|
96 |
+
icl_register_string('WordPress', 'URL slug: ' . $slug, $slug);
|
97 |
+
$string = $wpdb->get_row($wpdb->prepare("SELECT id,status FROM {$wpdb->prefix}icl_strings WHERE name = %s AND value = %s ", 'URL slug: ' . $slug, $slug));
|
98 |
+
}
|
99 |
+
|
100 |
+
if(isset($sitepress_settings['posts_slug_translation']['types'])){
|
101 |
+
$iclsettings['posts_slug_translation']['types'] = $sitepress_settings['posts_slug_translation']['types'];
|
102 |
}
|
103 |
|
104 |
if(!empty($permalinks['product_base']) && isset($sitepress_settings['posts_slug_translation']['types'][$slug])){
|
153 |
$defaults = array(
|
154 |
'file_path_sync' => 1,
|
155 |
'is_term_order_synced' => 0,
|
156 |
+
'enable_multi_currency' => WCML_MULTI_CURRENCIES_DISABLED,
|
|
|
157 |
'dismiss_doc_main' => 0,
|
158 |
+
'trnsl_interface' => 1
|
159 |
);
|
160 |
|
161 |
if(empty($this->settings)){
|
194 |
add_option('wcml_custom_attr_translations',array());
|
195 |
}
|
196 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
if(!isset($this->settings['wc_admin_options_saved'])){
|
198 |
$this->handle_admin_texts();
|
199 |
$this->settings['wc_admin_options_saved'] = 1;
|
200 |
$this->update_settings();
|
201 |
}
|
202 |
|
203 |
+
if(!isset($this->settings['trnsl_interface'])){
|
204 |
$this->settings['trnsl_interface'] = 1;
|
205 |
$this->update_settings();
|
206 |
}
|
207 |
+
|
208 |
+
if(!isset($this->settings['products_sync_date'])){
|
209 |
+
$this->settings['products_sync_date'] = 1;
|
210 |
+
$this->update_settings();
|
211 |
+
}
|
212 |
+
|
213 |
+
require_once WCML_PLUGIN_PATH . '/inc/multi-currency.class.php';
|
214 |
+
WCML_WC_MultiCurrency::install();
|
215 |
+
|
216 |
}
|
217 |
|
218 |
function menu(){
|
wpml-config.xml
CHANGED
@@ -33,11 +33,13 @@
|
|
33 |
<custom-field action="copy">total_sales</custom-field>
|
34 |
<custom-field action="translate">_product_url</custom-field>
|
35 |
<custom-field action="translate">_button_text</custom-field>
|
36 |
-
|
37 |
</custom-fields>
|
38 |
<custom-types>
|
39 |
<custom-type translate="1">product</custom-type>
|
40 |
<custom-type translate="0">product_variation</custom-type>
|
|
|
|
|
41 |
</custom-types>
|
42 |
<taxonomies>
|
43 |
<taxonomy translate="1">product_cat</taxonomy>
|
33 |
<custom-field action="copy">total_sales</custom-field>
|
34 |
<custom-field action="translate">_product_url</custom-field>
|
35 |
<custom-field action="translate">_button_text</custom-field>
|
36 |
+
<custom-field action="translate">_purchase_note</custom-field>
|
37 |
</custom-fields>
|
38 |
<custom-types>
|
39 |
<custom-type translate="1">product</custom-type>
|
40 |
<custom-type translate="0">product_variation</custom-type>
|
41 |
+
<custom-type translate="0">shop_coupon</custom-type>
|
42 |
+
<custom-type translate="0">shop_order</custom-type>
|
43 |
</custom-types>
|
44 |
<taxonomies>
|
45 |
<taxonomy translate="1">product_cat</taxonomy>
|
wpml-woocommerce.php
CHANGED
@@ -5,20 +5,24 @@
|
|
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.
|
9 |
*/
|
10 |
|
11 |
if(defined('WCML_VERSION')) return;
|
12 |
-
define('WCML_VERSION', '3.
|
13 |
define('WCML_PLUGIN_PATH', dirname(__FILE__));
|
14 |
define('WCML_PLUGIN_FOLDER', basename(WCML_PLUGIN_PATH));
|
15 |
define('WCML_PLUGIN_URL', plugins_url() . '/' . WCML_PLUGIN_FOLDER);
|
16 |
define('WCML_LOCALE_PATH',WCML_PLUGIN_FOLDER.'/locale');
|
17 |
define('WPML_LOAD_API_SUPPORT',true);
|
18 |
|
|
|
|
|
|
|
19 |
|
|
|
|
|
20 |
require WCML_PLUGIN_PATH . '/inc/dependencies.class.php';
|
21 |
-
require WCML_PLUGIN_PATH . '/inc/currencies.class.php';
|
22 |
require WCML_PLUGIN_PATH . '/inc/store-pages.class.php';
|
23 |
require WCML_PLUGIN_PATH . '/inc/products.class.php';
|
24 |
require WCML_PLUGIN_PATH . '/inc/emails.class.php';
|
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.1
|
9 |
*/
|
10 |
|
11 |
if(defined('WCML_VERSION')) return;
|
12 |
+
define('WCML_VERSION', '3.1');
|
13 |
define('WCML_PLUGIN_PATH', dirname(__FILE__));
|
14 |
define('WCML_PLUGIN_FOLDER', basename(WCML_PLUGIN_PATH));
|
15 |
define('WCML_PLUGIN_URL', plugins_url() . '/' . WCML_PLUGIN_FOLDER);
|
16 |
define('WCML_LOCALE_PATH',WCML_PLUGIN_FOLDER.'/locale');
|
17 |
define('WPML_LOAD_API_SUPPORT',true);
|
18 |
|
19 |
+
define('WCML_MULTI_CURRENCIES_DISABLED', 0);
|
20 |
+
define('WCML_MULTI_CURRENCIES_PER_LANGUAGE', 1); //obsolete - migrate to 2
|
21 |
+
define('WCML_MULTI_CURRENCIES_INDEPENDENT', 2);
|
22 |
|
23 |
+
|
24 |
+
require WCML_PLUGIN_PATH . '/inc/missing-php-functions.php';
|
25 |
require WCML_PLUGIN_PATH . '/inc/dependencies.class.php';
|
|
|
26 |
require WCML_PLUGIN_PATH . '/inc/store-pages.class.php';
|
27 |
require WCML_PLUGIN_PATH . '/inc/products.class.php';
|
28 |
require WCML_PLUGIN_PATH . '/inc/emails.class.php';
|