WooCommerce Multilingual – run WooCommerce with WPML - Version 3.7.1

Version Description

  • Compatibility fixes for WooCommerce Bookings and WooCommerce Composite Products
  • Fixed a typo in a function that caused a fatal error
Download this release

Release Info

Developer mihaimihai
Plugin Icon 128x128 WooCommerce Multilingual – run WooCommerce with WPML
Version 3.7.1
Comparing to
See all releases

Code changes from version 3.6.11 to 3.7.1

Files changed (89) hide show
  1. assets/css/options-permalink.css +14 -0
  2. assets/css/wcml-prices.css +1 -1
  3. assets/js/scripts.js +12 -1
  4. assets/js/wcml-multi-currency.js +51 -0
  5. assets/js/wpml_tm.js +1 -1
  6. compatibility/gravityforms.class.php +33 -1
  7. compatibility/templates/bundles_box.php +7 -7
  8. compatibility/templates/wc_tab_manager_custom_box_html.php +8 -8
  9. compatibility/wc_bookings.class.php +115 -12
  10. compatibility/wc_bulk_stock_management.class.php +25 -0
  11. compatibility/wc_composite_products.class.php +5 -2
  12. compatibility/wc_extra_product_options.class.php +1 -1
  13. compatibility/wc_product_addons.class.php +9 -1
  14. compatibility/wc_subscriptions.class.php +1 -0
  15. compatibility/wc_tab_manager.class.php +1 -1
  16. inc/compatibility.class.php +20 -20
  17. inc/currency-switcher-widget.class.php +2 -2
  18. inc/currency-switcher.class.php +1 -1
  19. inc/dependencies.class.php +27 -17
  20. inc/emails.class.php +32 -48
  21. inc/endpoints.class.php +10 -9
  22. inc/missing-php-functions.php +16 -0
  23. inc/multi-currency-support.class.php +31 -54
  24. inc/multi-currency.class.php +35 -44
  25. inc/orders.class.php +15 -23
  26. inc/products.class.php +66 -58
  27. inc/store-pages.class.php +24 -24
  28. inc/terms.class.php +75 -339
  29. inc/upgrade.class.php +70 -3
  30. inc/url-translation.class.php +570 -0
  31. inc/w3tc-compatibility.class.php +24 -0
  32. inc/wc-strings.class.php +264 -89
  33. inc/xdomain-data.class.php +13 -5
  34. locale/woocommerce-multilingual-ar.mo +0 -0
  35. locale/woocommerce-multilingual-de_DE.mo +0 -0
  36. locale/woocommerce-multilingual-el.mo +0 -0
  37. locale/woocommerce-multilingual-es_ES.mo +0 -0
  38. locale/woocommerce-multilingual-fr_FR.mo +0 -0
  39. locale/woocommerce-multilingual-he_IL.mo +0 -0
  40. locale/woocommerce-multilingual-it_IT.mo +0 -0
  41. locale/woocommerce-multilingual-ja.mo +0 -0
  42. locale/woocommerce-multilingual-ko_KR.mo +0 -0
  43. locale/woocommerce-multilingual-nl_NL.mo +0 -0
  44. locale/woocommerce-multilingual-pl_PL.mo +0 -0
  45. locale/woocommerce-multilingual-pt_BR.mo +0 -0
  46. locale/woocommerce-multilingual-pt_PT.mo +0 -0
  47. locale/woocommerce-multilingual-ru_RU.mo +0 -0
  48. locale/woocommerce-multilingual-sv_SE.mo +0 -0
  49. locale/woocommerce-multilingual-uk_UA.mo +0 -0
  50. locale/woocommerce-multilingual-vi.mo +0 -0
  51. locale/woocommerce-multilingual-zh_CN.mo +0 -0
  52. locale/woocommerce-multilingual-zh_TW.mo +0 -0
  53. locale/wpml-wcml-ar.mo +0 -0
  54. locale/wpml-wcml-de_DE.mo +0 -0
  55. locale/wpml-wcml-el.mo +0 -0
  56. locale/wpml-wcml-es_ES.mo +0 -0
  57. locale/wpml-wcml-fr_FR.mo +0 -0
  58. locale/wpml-wcml-he_IL.mo +0 -0
  59. locale/wpml-wcml-it_IT.mo +0 -0
  60. locale/wpml-wcml-ja.mo +0 -0
  61. locale/wpml-wcml-ko_KR.mo +0 -0
  62. locale/wpml-wcml-nl_NL.mo +0 -0
  63. locale/wpml-wcml-pl_PL.mo +0 -0
  64. locale/wpml-wcml-pt_BR.mo +0 -0
  65. locale/wpml-wcml-pt_PT.mo +0 -0
  66. locale/wpml-wcml-ru_RU.mo +0 -0
  67. locale/wpml-wcml-sv_SE.mo +0 -0
  68. locale/wpml-wcml-uk_UA.mo +0 -0
  69. locale/wpml-wcml-vi.mo +0 -0
  70. locale/wpml-wcml-zh_CN.mo +0 -0
  71. locale/wpml-wcml-zh_TW.mo +0 -0
  72. menu/management.php +5 -5
  73. menu/plugins.php +18 -18
  74. menu/sub/currency-switcher-options.php +17 -17
  75. menu/sub/custom-box.php +2 -2
  76. menu/sub/custom-currency-options.php +23 -23
  77. menu/sub/custom-prices.php +26 -26
  78. menu/sub/downloadable-files-box.php +3 -3
  79. menu/sub/images-box.php +8 -8
  80. menu/sub/notice-translation-upgrade.php +4 -4
  81. menu/sub/product-data.php +34 -33
  82. menu/sub/products.php +36 -36
  83. menu/sub/settings.php +97 -97
  84. menu/sub/sync-taxonomy-translations.php +5 -5
  85. menu/sub/troubleshooting.php +15 -15
  86. menu/sub/variations_box.php +12 -12
  87. readme.txt +20 -1
  88. woocommerce_wpml.class.php +29 -89
  89. wpml-woocommerce.php +5 -4
assets/css/options-permalink.css ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .options-permalink-php .translation_controls{
2
+ margin-top:4px;
3
+ width:25em;
4
+ text-align:right;
5
+ }
6
+ .translation_controls .select2-container{
7
+ margin-top:-18px;
8
+ text-align:left;
9
+ max-width: 50%;
10
+ }
11
+
12
+ .options-permalink-php .select2-container .select2-choice .select2-arrow b:after{
13
+ display: none;
14
+ }
assets/css/wcml-prices.css CHANGED
@@ -68,10 +68,10 @@
68
  }
69
 
70
  .wcml_schedule_manually_block_hide,
71
- .block_actions,
72
  .wcml_custom_prices_auto_block_hide{
73
  display: none;
74
  }
 
75
  .wcml_custom_prices_manually_block_show,
76
  .wcml_custom_prices_manually_block_hide{
77
  clear: both;
68
  }
69
 
70
  .wcml_schedule_manually_block_hide,
 
71
  .wcml_custom_prices_auto_block_hide{
72
  display: none;
73
  }
74
+
75
  .wcml_custom_prices_manually_block_show,
76
  .wcml_custom_prices_manually_block_hide{
77
  clear: both;
assets/js/scripts.js CHANGED
@@ -495,6 +495,9 @@ jQuery(document).ready(function($){
495
  if( window.parent.tinyMCE.get(id) == null ){
496
  tinymce.execCommand( 'mceAddEditor', false, id);
497
  }
 
 
 
498
  }
499
 
500
  });
@@ -529,6 +532,9 @@ jQuery(document).ready(function($){
529
  }else{
530
  $(this).closest('.wp-editor-wrap').find('.mce-tinymce').show();
531
  }
 
 
 
532
  });
533
 
534
  $(document).on('click','.switch-html',function(){
@@ -538,6 +544,11 @@ jQuery(document).ready(function($){
538
  QTags(id);
539
  QTags._buttonsInit();
540
  $(this).closest('.wp-editor-wrap').find('.mce-tinymce').hide();
 
 
 
 
 
541
  $(this).closest('.wp-editor-wrap').find('textarea.wcml_content_tr').show();
542
  });
543
 
@@ -555,7 +566,7 @@ jQuery(document).ready(function($){
555
  text_area.val(window.parent.tinyMCE.get(text_area.attr('id')).getContent());
556
  }
557
  $(this).closest('.wcml_editor').css('display','none');
558
-
559
 
560
  var row_lang = $(this).closest('tr[rel]').attr('rel');
561
  var prod_id = $(this).closest('div.wcml_product_row').attr('id');
495
  if( window.parent.tinyMCE.get(id) == null ){
496
  tinymce.execCommand( 'mceAddEditor', false, id);
497
  }
498
+
499
+ $(this).parent().find('.wp-editor-wrap').find('.mce-tinymce').show();
500
+ $(this).parent().find('textarea.wcml_content_tr').hide();
501
  }
502
 
503
  });
532
  }else{
533
  $(this).closest('.wp-editor-wrap').find('.mce-tinymce').show();
534
  }
535
+
536
+ window.parent.tinyMCE.get(id).setContent( $(this).closest('.wp-editor-wrap').find('textarea.wcml_content_tr').val() );
537
+
538
  });
539
 
540
  $(document).on('click','.switch-html',function(){
544
  QTags(id);
545
  QTags._buttonsInit();
546
  $(this).closest('.wp-editor-wrap').find('.mce-tinymce').hide();
547
+
548
+ if( window.parent.tinyMCE.get(id) != null ){
549
+ $(this).closest('.wp-editor-wrap').find('textarea.wcml_content_tr').val( window.parent.tinyMCE.get(id).getContent() );
550
+ }
551
+
552
  $(this).closest('.wp-editor-wrap').find('textarea.wcml_content_tr').show();
553
  });
554
 
566
  text_area.val(window.parent.tinyMCE.get(text_area.attr('id')).getContent());
567
  }
568
  $(this).closest('.wcml_editor').css('display','none');
569
+ window.parent.tinyMCE.get(text_area.attr('id')).setContent( text_area.val() );
570
 
571
  var row_lang = $(this).closest('tr[rel]').attr('rel');
572
  var prod_id = $(this).closest('div.wcml_product_row').attr('id');
assets/js/wcml-multi-currency.js ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function(){
2
+
3
+ jQuery('.wcml_currency_switcher').on('change', function(){
4
+ wcml_load_currency( jQuery(this).val() );
5
+ });
6
+ jQuery('.wcml_currency_switcher li').on('click', function(){
7
+ if(jQuery(this).hasClass('wcml-active-currency')){
8
+ return;
9
+ }
10
+ wcml_load_currency( jQuery(this).attr('rel') );
11
+ });
12
+
13
+ });
14
+
15
+
16
+ function wcml_load_currency(currency){
17
+ var ajax_loader = jQuery('<img style=\"margin-left:10px;\" width=\"16\" heigth=\"16\" src=\"' + wcml_mc_settings.wcml_spinner +'\" />')
18
+ jQuery('.wcml_currency_switcher').attr('disabled', 'disabled');
19
+ jQuery('.wcml_currency_switcher').after();
20
+ ajax_loader.insertAfter(jQuery('.wcml_currency_switcher'));
21
+ jQuery.ajax({
22
+ type : 'post',
23
+ url : woocommerce_params.ajax_url,
24
+ data : {
25
+ action: 'wcml_switch_currency',
26
+ currency : currency,
27
+ wcml_nonce: wcml_mc_settings.wcml_mc_nonce
28
+ },
29
+ success: function(response) {
30
+ if(typeof response.error !== 'undefined'){
31
+ alert(response.error);
32
+ }else{
33
+ jQuery('.wcml_currency_switcher').removeAttr('disabled');
34
+ if(typeof wcml_mc_settings.w3tc != 'undefined '){
35
+ var original_url = window.location.href;
36
+ original_url = original_url.replace(/&wcmlc(\=[^&]*)?(?=&|$)|wcmlc(\=[^&]*)?(&|$)/, '');
37
+ original_url = original_url.replace(/\?$/, '');
38
+
39
+ var url_glue = original_url.indexOf('?') != -1 ? '&' : '?';
40
+ var target_location = original_url + url_glue + 'wcmlc=' + currency;
41
+
42
+ }else{
43
+ var target_location = window.location.href;
44
+ }
45
+
46
+
47
+ window.location = target_location;
48
+ }
49
+ }
50
+ });
51
+ }
assets/js/wpml_tm.js CHANGED
@@ -1,6 +1,6 @@
1
  jQuery(document).ready(function($){
2
  var slug_checkbox = $('input[name="translate_slugs[product][on]"]');
3
- $('#icl_custom_posts_sync_options table').before( slug_checkbox.clone().attr('type','hidden') );
4
 
5
  slug_checkbox.attr('name','disabled');
6
  slug_checkbox.attr('disabled','disabled');
1
  jQuery(document).ready(function($){
2
  var slug_checkbox = $('input[name="translate_slugs[product][on]"]');
3
+ $('#icl_custom_posts_sync_options table').before( slug_checkbox.clone().attr('type','hidden').removeAttr('disabled') );
4
 
5
  slug_checkbox.attr('name','disabled');
6
  slug_checkbox.attr('disabled','disabled');
compatibility/gravityforms.class.php CHANGED
@@ -4,7 +4,11 @@ class WCML_gravityforms{
4
 
5
  function __construct(){
6
  add_filter('gform_formatted_money',array($this,'wcml_convert_price'),10,2);
7
- add_filter('wcml_multi_currency_is_ajax',array($this,'add_ajax_action'));
 
 
 
 
8
  }
9
 
10
  function wcml_convert_price($formatted, $unformatted){
@@ -20,5 +24,33 @@ class WCML_gravityforms{
20
  $actions[] = 'get_updated_price';
21
  return $actions;
22
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  }
4
 
5
  function __construct(){
6
  add_filter('gform_formatted_money',array($this,'wcml_convert_price'),10,2);
7
+ add_filter('wcml_multi_currency_is_ajax',array($this,'add_ajax_action'));
8
+
9
+ add_filter('wcml_exception_duplicate_products_in_cart', array($this, 'addons_duplicate_exception'),10,2);
10
+
11
+ add_action( 'wcml_after_duplicate_product_post_meta', array( $this, 'sync_gf_data'), 10, 3 );
12
  }
13
 
14
  function wcml_convert_price($formatted, $unformatted){
24
  $actions[] = 'get_updated_price';
25
  return $actions;
26
  }
27
+
28
+ function addons_duplicate_exception( $exclude, $cart_item ) {
29
+ if ( isset( $cart_item[ '_gravity_form_data' ] ) ) {
30
+ $exclude = true;
31
+ }
32
+ return $exclude;
33
+ }
34
+
35
+ function sync_gf_data($original_product_id, $trnsl_product_id, $data){
36
+ $orig_gf = maybe_unserialize( get_post_meta( $original_product_id, '_gravity_form_data' , true ) );
37
+ $trnsl_gf = maybe_unserialize( get_post_meta( $trnsl_product_id, '_gravity_form_data' , true ) );
38
+
39
+ if( !$trnsl_gf ){
40
+ update_post_meta( $trnsl_product_id, '_gravity_form_data', $orig_gf );
41
+ }else{
42
+ $trnsl_gf['id'] = $orig_gf['id'];
43
+ $trnsl_gf['display_title'] = $orig_gf['display_title'];
44
+ $trnsl_gf['display_description'] = $orig_gf['display_description'];
45
+ $trnsl_gf['disable_woocommerce_price'] = $orig_gf['disable_woocommerce_price'];
46
+ $trnsl_gf['disable_calculations'] = $orig_gf['disable_calculations'];
47
+ $trnsl_gf['disable_label_subtotal'] = $orig_gf['disable_label_subtotal'];
48
+ $trnsl_gf['disable_label_options'] = $orig_gf['disable_label_options'];
49
+ $trnsl_gf['disable_label_total'] = $orig_gf['disable_label_total'];
50
+ $trnsl_gf['disable_anchor'] = $orig_gf['disable_anchor'];
51
+
52
+ update_post_meta( $trnsl_product_id, '_gravity_form_data', $trnsl_gf );
53
+ }
54
+ }
55
 
56
  }
compatibility/templates/bundles_box.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php if(!isset($template_data['empty_bundles'])){ ?>
2
  <td>
3
- <button id="prod_bundles_link_<?php echo $lang ?>" class="button-secondary js-table-toggle prod_bundles_link<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" data-text-opened="<?php _e('Collapse','wpml-wcml'); ?>" data-text-closed="<?php _e('Expand','wpml-wcml'); ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>>
4
- <span><?php _e('Expand','wpml-wcml'); ?></span>
5
  <i class="icon-caret-down"></i>
6
  </button>
7
  <?php $bundles_ids = $template_data['product_bundles']; ?>
@@ -20,11 +20,11 @@
20
  </tr>
21
  <?php if(isset($template_data['empty_bundles'])): ?>
22
  <tr>
23
- <td><?php _e('Please set bundles for product','wpml-wcml'); ?></td>
24
  </tr>
25
  <?php elseif(isset($template_data['empty_translation'])): ?>
26
  <tr>
27
- <td><?php _e('Please save translation before translate bundles texts','wpml-wcml'); ?></td>
28
  </tr>
29
  <?php else: ?>
30
  <?php $texts = array('bundle_title','bundle_desc'); ?>
@@ -32,9 +32,9 @@
32
  <tr>
33
  <td>
34
  <?php if($text == 'bundle_title'): ?>
35
- <?php _e('Title','wpml-wcml'); ?>
36
  <?php else: ?>
37
- <?php _e('Description','wpml-wcml'); ?>
38
  <?php endif; ?>
39
  </td>
40
  <?php $i = 0; ?>
@@ -44,7 +44,7 @@
44
  <?php if($template_data['original']): ?>
45
  <input type="text" value="<?php echo $bundle_opts[$text]?>" readonly="readonly"/>
46
  <?php else: ?>
47
- <input type="text" name="bundles[<?php echo $bundles_ids[$i] ?>][<?php echo $text; ?>]" value="<?php echo $bundle_opts[$text]?>" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"/>
48
  <?php endif; ?>
49
  </td>
50
 
1
  <?php if(!isset($template_data['empty_bundles'])){ ?>
2
  <td>
3
+ <button id="prod_bundles_link_<?php echo $lang ?>" class="button-secondary js-table-toggle prod_bundles_link<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" data-text-opened="<?php _e('Collapse', 'woocommerce-multilingual'); ?>" data-text-closed="<?php _e('Expand', 'woocommerce-multilingual'); ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>>
4
+ <span><?php _e('Expand', 'woocommerce-multilingual'); ?></span>
5
  <i class="icon-caret-down"></i>
6
  </button>
7
  <?php $bundles_ids = $template_data['product_bundles']; ?>
20
  </tr>
21
  <?php if(isset($template_data['empty_bundles'])): ?>
22
  <tr>
23
+ <td><?php _e('Please set bundles for product', 'woocommerce-multilingual'); ?></td>
24
  </tr>
25
  <?php elseif(isset($template_data['empty_translation'])): ?>
26
  <tr>
27
+ <td><?php _e('Please save translation before translate bundles texts', 'woocommerce-multilingual'); ?></td>
28
  </tr>
29
  <?php else: ?>
30
  <?php $texts = array('bundle_title','bundle_desc'); ?>
32
  <tr>
33
  <td>
34
  <?php if($text == 'bundle_title'): ?>
35
+ <?php _e('Title', 'woocommerce-multilingual'); ?>
36
  <?php else: ?>
37
+ <?php _e('Description', 'woocommerce-multilingual'); ?>
38
  <?php endif; ?>
39
  </td>
40
  <?php $i = 0; ?>
44
  <?php if($template_data['original']): ?>
45
  <input type="text" value="<?php echo $bundle_opts[$text]?>" readonly="readonly"/>
46
  <?php else: ?>
47
+ <input type="text" name="bundles[<?php echo $bundles_ids[$i] ?>][<?php echo $text; ?>]" value="<?php echo $bundle_opts[$text]?>" placeholder="<?php esc_attr_e('Enter translation', 'woocommerce-multilingual') ?>"/>
48
  <?php endif; ?>
49
  </td>
50
 
compatibility/templates/wc_tab_manager_custom_box_html.php CHANGED
@@ -19,14 +19,14 @@
19
  <textarea rows="1" <?php if(!$template_data['original']): ?>name="<?php echo $template_data['product_content'].'_'.$template_data['lang'].'[core_heading]['.$key.']'; ?>"<?php endif;?> <?php if($template_data['original']): ?> disabled="disabled"<?php endif;?>><?php echo $template_data['tr_tabs'][$key]['heading']; ?></textarea>
20
  <?php else: ?>
21
  <?php if($template_data['original']): ?>
22
- <button type="button" class="button-secondary wcml_edit_content origin_content"><?php _e('Show content', 'wpml-wcml') ?></button>
23
  <?php else: ?>
24
- <button type="button" class="button-secondary wcml_edit_content<?php if($template_data['is_duplicate_product']): ?> js-dup-disabled<?php endif;?>"<?php if($template_data['is_duplicate_product']): ?> disabled="disabled"<?php endif;?>><?php _e('Edit translation', 'wpml-wcml') ?></button>
25
  <?php endif;?>
26
  <div class="wcml_editor">
27
- <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>
28
  <div class="wcml_editor_original">
29
- <h3><?php _e('Original content:', 'wpml-wcml') ?></h3>
30
  <textarea class="wcml_original_content"><?php echo get_post($orig_tab_id)->post_content; ?></textarea>
31
  </div>
32
  <div class="wcml_line"></div>
@@ -45,11 +45,11 @@
45
  </div>
46
  <div class="wcml_editor_buttons">
47
  <?php if($template_data['original']): ?>
48
- <button type="button" class="button-secondary wcml_popup_close"><?php _e('Close', 'wpml-wcml') ?></button>
49
  <?php else: ?>
50
- <h3><?php printf(__('%s translation', 'wpml-wcml'),$template_data['lang_name']); ?></h3>
51
- <button type="button" class="button-secondary wcml_popup_cancel"><?php _e('Cancel', 'wpml-wcml') ?></button>
52
- <button type="button" class="button-secondary wcml_popup_ok"><?php _e('Ok', 'wpml-wcml') ?></button>
53
  <?php endif; ?>
54
  </div>
55
  </div>
19
  <textarea rows="1" <?php if(!$template_data['original']): ?>name="<?php echo $template_data['product_content'].'_'.$template_data['lang'].'[core_heading]['.$key.']'; ?>"<?php endif;?> <?php if($template_data['original']): ?> disabled="disabled"<?php endif;?>><?php echo $template_data['tr_tabs'][$key]['heading']; ?></textarea>
20
  <?php else: ?>
21
  <?php if($template_data['original']): ?>
22
+ <button type="button" class="button-secondary wcml_edit_content origin_content"><?php _e('Show content', 'woocommerce-multilingual') ?></button>
23
  <?php else: ?>
24
+ <button type="button" class="button-secondary wcml_edit_content<?php if($template_data['is_duplicate_product']): ?> js-dup-disabled<?php endif;?>"<?php if($template_data['is_duplicate_product']): ?> disabled="disabled"<?php endif;?>><?php _e('Edit translation', 'woocommerce-multilingual') ?></button>
25
  <?php endif;?>
26
  <div class="wcml_editor">
27
+ <a class="media-modal-close wcml_close_cross" href="javascript:void(0);" title="<?php esc_attr_e('Close', 'woocommerce-multilingual') ?>"><span class="media-modal-icon"></span></a>
28
  <div class="wcml_editor_original">
29
+ <h3><?php _e('Original content:', 'woocommerce-multilingual') ?></h3>
30
  <textarea class="wcml_original_content"><?php echo get_post($orig_tab_id)->post_content; ?></textarea>
31
  </div>
32
  <div class="wcml_line"></div>
45
  </div>
46
  <div class="wcml_editor_buttons">
47
  <?php if($template_data['original']): ?>
48
+ <button type="button" class="button-secondary wcml_popup_close"><?php _e('Close', 'woocommerce-multilingual') ?></button>
49
  <?php else: ?>
50
+ <h3><?php printf(__('%s translation', 'woocommerce-multilingual'),$template_data['lang_name']); ?></h3>
51
+ <button type="button" class="button-secondary wcml_popup_cancel"><?php _e('Cancel', 'woocommerce-multilingual') ?></button>
52
+ <button type="button" class="button-secondary wcml_popup_ok"><?php _e('Ok', 'woocommerce-multilingual') ?></button>
53
  <?php endif; ?>
54
  </div>
55
  </div>
compatibility/wc_bookings.class.php CHANGED
@@ -58,6 +58,11 @@ class WCML_Bookings{
58
 
59
  add_filter( 'parse_query', array( $this, 'booking_filters_query' ) );
60
  add_filter('wcml_exception_duplicate_products_in_cart', array($this, 'check_on_bookable_product_in_cart'), 10, 2 );
 
 
 
 
 
61
 
62
  }
63
 
@@ -253,12 +258,12 @@ class WCML_Bookings{
253
  echo '<div class="wcml_custom_costs">';
254
 
255
  echo '<input type="radio" name="_wcml_custom_costs" id="wcml_custom_costs_auto" value="0" class="wcml_custom_costs_input" '. $checked .' />';
256
- echo '<label for="wcml_custom_costs_auto">'. __('Calculate costs in other currencies automatically','wpml-wcml') .'</label>';
257
 
258
  $checked = $custom_costs_status == 1 ? 'checked="checked"' : ' ';
259
 
260
  echo '<input type="radio" name="_wcml_custom_costs" value="1" id="wcml_custom_costs_manually" class="wcml_custom_costs_input" '. $checked .' />';
261
- echo '<label for="wcml_custom_costs_manually">'. __('Set costs in other currencies manually','wpml-wcml') .'</label>';
262
 
263
  wp_nonce_field( 'wcml_save_custom_costs', '_wcml_custom_costs_nonce' );
264
 
@@ -544,9 +549,9 @@ class WCML_Bookings{
544
 
545
  }
546
 
547
- foreach ($trnsl_persons as $trnsl_persons) {
548
 
549
- wp_delete_post( $trnsl_persons );
550
 
551
  }
552
 
@@ -1024,7 +1029,7 @@ class WCML_Bookings{
1024
  $order_currencies = $woocommerce_wpml->multi_currency->get_orders_currencies();
1025
  ?>
1026
  <tr valign="top">
1027
- <th scope="row"><?php _e( 'Booking currency', 'wpml-wcml' ); ?></th>
1028
  <td>
1029
  <select id="dropdown_booking_currency">
1030
 
@@ -1072,7 +1077,7 @@ class WCML_Bookings{
1072
 
1073
  $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
1074
  if(!$nonce || !wp_verify_nonce($nonce, 'booking_set_currency')){
1075
- echo json_encode(array('error' => __('Invalid nonce', 'wpml-wcml')));
1076
  die();
1077
  }
1078
 
@@ -1231,7 +1236,7 @@ class WCML_Bookings{
1231
 
1232
  if( get_post_meta( $product_id, '_resource_base_costs', true ) ){
1233
  if( $data == 'label' ){
1234
- $fields[] = __( 'Resources', 'wpml-wcml' );
1235
  }else{
1236
  $fields[] = 'wc_booking_resources';
1237
  }
@@ -1244,7 +1249,7 @@ class WCML_Bookings{
1244
 
1245
  if( $persons ){
1246
  if( $data == 'label' ){
1247
- $fields[] = __( 'Person types', 'wpml-wcml' );
1248
  }else{
1249
  $fields[] = 'wc_booking_persons';
1250
  }
@@ -1272,7 +1277,7 @@ class WCML_Bookings{
1272
 
1273
  function product_content_resource_label( $meta_key, $product_id ){
1274
  if ($meta_key == '_wc_booking_resouce_label'){
1275
- return __( 'Resources label', 'wpml-wcml' );
1276
  }
1277
  return $meta_key;
1278
  }
@@ -1525,7 +1530,7 @@ class WCML_Bookings{
1525
  function update_status_for_translations( $booking_id ){
1526
  global $wpdb;
1527
 
1528
- $translated_bookings = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_booking_duplicate_of' AND meta_value = %d", $booking_id ) );
1529
 
1530
  foreach( $translated_bookings as $booking ){
1531
 
@@ -1551,18 +1556,26 @@ class WCML_Bookings{
1551
 
1552
  }
1553
 
 
 
 
 
 
 
 
 
1554
 
1555
  public function booking_filters_query( $query ) {
1556
  global $typenow, $sitepress, $wpdb;
1557
 
1558
- if ( $typenow == 'wc_booking' && isset( $_GET['post_type'] ) && $_GET['post_type'] == 'wc_booking' && !isset( $_GET['page'] )) {
1559
 
1560
  $product_ids = $wpdb->get_col( $wpdb->prepare(
1561
  "SELECT element_id
1562
  FROM {$wpdb->prefix}icl_translations
1563
  WHERE language_code = %s AND element_type = 'post_product'", $sitepress->get_current_language() ) );
1564
 
1565
- $query->query_vars[ 'meta_query' ] = array(
1566
  array(
1567
  'key' => '_booking_product_id',
1568
  'value' => $product_ids,
@@ -1581,4 +1594,94 @@ class WCML_Bookings{
1581
  return false;
1582
 
1583
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1584
  }
58
 
59
  add_filter( 'parse_query', array( $this, 'booking_filters_query' ) );
60
  add_filter('wcml_exception_duplicate_products_in_cart', array($this, 'check_on_bookable_product_in_cart'), 10, 2 );
61
+ add_filter('woocommerce_bookings_in_date_range_query', array($this, 'bookings_in_date_range_query'));
62
+ add_action( 'before_delete_post', array( $this, 'delete_bookings' ) );
63
+ add_action( 'wp_trash_post', array( $this, 'trash_bookings' ) );
64
+
65
+ $this->clear_transient_fields();
66
 
67
  }
68
 
258
  echo '<div class="wcml_custom_costs">';
259
 
260
  echo '<input type="radio" name="_wcml_custom_costs" id="wcml_custom_costs_auto" value="0" class="wcml_custom_costs_input" '. $checked .' />';
261
+ echo '<label for="wcml_custom_costs_auto">'. __('Calculate costs in other currencies automatically', 'woocommerce-multilingual') .'</label>';
262
 
263
  $checked = $custom_costs_status == 1 ? 'checked="checked"' : ' ';
264
 
265
  echo '<input type="radio" name="_wcml_custom_costs" value="1" id="wcml_custom_costs_manually" class="wcml_custom_costs_input" '. $checked .' />';
266
+ echo '<label for="wcml_custom_costs_manually">'. __('Set costs in other currencies manually', 'woocommerce-multilingual') .'</label>';
267
 
268
  wp_nonce_field( 'wcml_save_custom_costs', '_wcml_custom_costs_nonce' );
269
 
549
 
550
  }
551
 
552
+ foreach ($trnsl_persons as $trnsl_person) {
553
 
554
+ wp_delete_post( $trnsl_person );
555
 
556
  }
557
 
1029
  $order_currencies = $woocommerce_wpml->multi_currency->get_orders_currencies();
1030
  ?>
1031
  <tr valign="top">
1032
+ <th scope="row"><?php _e( 'Booking currency', 'woocommerce-multilingual' ); ?></th>
1033
  <td>
1034
  <select id="dropdown_booking_currency">
1035
 
1077
 
1078
  $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
1079
  if(!$nonce || !wp_verify_nonce($nonce, 'booking_set_currency')){
1080
+ echo json_encode(array('error' => __('Invalid nonce', 'woocommerce-multilingual')));
1081
  die();
1082
  }
1083
 
1236
 
1237
  if( get_post_meta( $product_id, '_resource_base_costs', true ) ){
1238
  if( $data == 'label' ){
1239
+ $fields[] = __( 'Resources', 'woocommerce-multilingual' );
1240
  }else{
1241
  $fields[] = 'wc_booking_resources';
1242
  }
1249
 
1250
  if( $persons ){
1251
  if( $data == 'label' ){
1252
+ $fields[] = __( 'Person types', 'woocommerce-multilingual' );
1253
  }else{
1254
  $fields[] = 'wc_booking_persons';
1255
  }
1277
 
1278
  function product_content_resource_label( $meta_key, $product_id ){
1279
  if ($meta_key == '_wc_booking_resouce_label'){
1280
+ return __( 'Resources label', 'woocommerce-multilingual' );
1281
  }
1282
  return $meta_key;
1283
  }
1530
  function update_status_for_translations( $booking_id ){
1531
  global $wpdb;
1532
 
1533
+ $translated_bookings = $this->get_translated_bookings( $booking_id );
1534
 
1535
  foreach( $translated_bookings as $booking ){
1536
 
1556
 
1557
  }
1558
 
1559
+ function get_translated_bookings($booking_id){
1560
+ global $wpdb;
1561
+
1562
+ $translated_bookings = $wpdb->get_results( $wpdb->prepare( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_booking_duplicate_of' AND meta_value = %d", $booking_id ) );
1563
+
1564
+ return $translated_bookings;
1565
+ }
1566
+
1567
 
1568
  public function booking_filters_query( $query ) {
1569
  global $typenow, $sitepress, $wpdb;
1570
 
1571
+ if ( ( isset( $query->query_vars['post_type'] ) && $query->query_vars['post_type'] == 'wc_booking' ) || ( $typenow == 'wc_booking' && isset( $_GET['post_type'] ) && $_GET['post_type'] == 'wc_booking' && !isset( $_GET['page'] ) ) ) {
1572
 
1573
  $product_ids = $wpdb->get_col( $wpdb->prepare(
1574
  "SELECT element_id
1575
  FROM {$wpdb->prefix}icl_translations
1576
  WHERE language_code = %s AND element_type = 'post_product'", $sitepress->get_current_language() ) );
1577
 
1578
+ $query->query_vars[ 'meta_query' ][] = array(
1579
  array(
1580
  'key' => '_booking_product_id',
1581
  'value' => $product_ids,
1594
  return false;
1595
 
1596
  }
1597
+
1598
+ function bookings_in_date_range_query($booking_ids){
1599
+ global $sitepress;
1600
+
1601
+ foreach ( $booking_ids as $key => $booking_id ) {
1602
+
1603
+ $language_code = $sitepress->get_language_for_element( get_post_meta( $booking_id, '_booking_product_id', true ) , 'post_product' );
1604
+ $current_language = $sitepress->get_current_language();
1605
+
1606
+ if( $language_code != $current_language ){
1607
+ unset( $booking_ids[$key] );
1608
+ }
1609
+
1610
+ }
1611
+
1612
+ return $booking_ids;
1613
+
1614
+ }
1615
+
1616
+ function clear_transient_fields(){
1617
+
1618
+ if ( isset( $_GET['post_type'] ) && $_GET['post_type'] == 'wc_booking' && isset( $_GET['page'] ) && $_GET['page'] == 'booking_calendar' ) {
1619
+
1620
+ global $wpdb;
1621
+ //delete transient fields
1622
+ $wpdb->query("
1623
+ DELETE FROM $wpdb->options
1624
+ WHERE option_name LIKE '%book_dr_%'
1625
+ ");
1626
+
1627
+ }
1628
+
1629
+ }
1630
+
1631
+ function delete_bookings( $booking_id ){
1632
+
1633
+ if( $booking_id > 0 && get_post_type( $booking_id ) == 'wc_booking' ){
1634
+
1635
+ $translated_bookings = $this->get_translated_bookings( $booking_id );
1636
+
1637
+ remove_action( 'before_delete_post', array( $this, 'delete_bookings' ) );
1638
+
1639
+ foreach( $translated_bookings as $booking ){
1640
+
1641
+ global $wpdb;
1642
+
1643
+ $wpdb->update(
1644
+ $wpdb->posts,
1645
+ array(
1646
+ 'post_parent' => 0
1647
+ ),
1648
+ array(
1649
+ 'ID' => $booking->post_id
1650
+ )
1651
+ );
1652
+
1653
+ wp_delete_post( $booking->post_id );
1654
+
1655
+ }
1656
+
1657
+ add_action( 'before_delete_post', array( $this, 'delete_bookings' ) );
1658
+ }
1659
+
1660
+ }
1661
+
1662
+ function trash_bookings( $booking_id ){
1663
+
1664
+ if( $booking_id > 0 && get_post_type( $booking_id ) == 'wc_booking' ){
1665
+
1666
+ $translated_bookings = $this->get_translated_bookings( $booking_id );
1667
+
1668
+ foreach( $translated_bookings as $booking ){
1669
+ global $wpdb;
1670
+
1671
+ $wpdb->update(
1672
+ $wpdb->posts,
1673
+ array(
1674
+ 'post_status' => 'trash'
1675
+ ),
1676
+ array(
1677
+ 'ID' => $booking->post_id
1678
+ )
1679
+ );
1680
+
1681
+ }
1682
+
1683
+ }
1684
+
1685
+ }
1686
+
1687
  }
compatibility/wc_bulk_stock_management.class.php CHANGED
@@ -11,5 +11,30 @@ class WCML_Bulk_Stock_Management {
11
  global $sitepress;
12
  remove_action('admin_enqueue_scripts', array($sitepress, 'language_filter'));
13
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  }
15
  }
11
  global $sitepress;
12
  remove_action('admin_enqueue_scripts', array($sitepress, 'language_filter'));
13
  }
14
+
15
+ add_action( 'wc_bulk_stock_after_process_qty', array($this, 'wc_bulk_stock_after_process_qty_action'), 10, 1 );
16
+ }
17
+
18
+ function wc_bulk_stock_after_process_qty_action($id) {
19
+ global $sitepress;
20
+
21
+ $new_quantity = get_post_meta($id, '_stock', true);
22
+
23
+ if (is_numeric($new_quantity)) {
24
+ $trid = $sitepress->get_element_trid( $id, 'post_product' );
25
+ if (is_numeric($trid)) {
26
+ $translations = $sitepress->get_element_translations( $trid, 'post_product' );
27
+
28
+ if (is_array($translations)) {
29
+ foreach ($translations as $translation) {
30
+ if ( !isset($translation->element_id) || $translation->element_id == $id) {
31
+ continue;
32
+ }
33
+ update_post_meta($translation->element_id, '_stock', $new_quantity);
34
+ }
35
+ }
36
+ }
37
+ }
38
+
39
  }
40
  }
compatibility/wc_composite_products.class.php CHANGED
@@ -10,8 +10,11 @@ class WCML_Composite_Products {
10
  }
11
 
12
  function woocommerce_composite_component_default_option($selected_value, $component_id, $object) {
13
- $selected_value = apply_filters('wpml_object_id', $selected_value, 'product');
14
-
 
 
 
15
  return $selected_value;
16
  }
17
 
10
  }
11
 
12
  function woocommerce_composite_component_default_option($selected_value, $component_id, $object) {
13
+
14
+ if( !empty( $selected_value ) )
15
+ $selected_value = apply_filters( 'wpml_object_id', $selected_value, 'product', true );
16
+
17
+
18
  return $selected_value;
19
  }
20
 
compatibility/wc_extra_product_options.class.php CHANGED
@@ -114,7 +114,7 @@ class WCML_Extra_Product_Options{
114
 
115
  function inf_message( $text ){
116
  $message = '<div><p class="icl_cyan_box">';
117
- $message .= sprintf(__('To translate Extra Options strings please save %s and go to the <b><a href="%s">String Translation interface</a></b>', 'wpml-wcml'), $text, admin_url('admin.php?page='.WPML_ST_FOLDER.'/menu/string-translation.php&context=wc_extra_product_options'));
118
  $message .= '</p></div>';
119
 
120
  echo $message;
114
 
115
  function inf_message( $text ){
116
  $message = '<div><p class="icl_cyan_box">';
117
+ $message .= sprintf(__('To translate Extra Options strings please save %s and go to the <b><a href="%s">String Translation interface</a></b>', 'woocommerce-multilingual'), $text, admin_url('admin.php?page='.WPML_ST_FOLDER.'/menu/string-translation.php&context=wc_extra_product_options'));
118
  $message .= '</p></div>';
119
 
120
  echo $message;
compatibility/wc_product_addons.class.php CHANGED
@@ -15,6 +15,7 @@ class WCML_Product_Addons{
15
  }
16
 
17
  add_action( 'addons_panel_start', array( $this, 'inf_translate_strings' ) );
 
18
  }
19
 
20
  function register_addons_strings( $meta_id, $id, $meta_key, $addons){
@@ -67,9 +68,16 @@ class WCML_Product_Addons{
67
 
68
  function inf_translate_strings(){
69
  $message = '<div><p class="icl_cyan_box">';
70
- $message .= sprintf(__('To translate Add-ons strings please save Add-ons and go to the <b><a href="%s">String Translation interface</a></b>', 'wpml-wcml'), admin_url('admin.php?page='.WPML_ST_FOLDER.'/menu/string-translation.php&context=wc_product_addons_strings'));
71
  $message .= '</p></div>';
72
 
73
  echo $message;
74
  }
 
 
 
 
 
 
 
75
  }
15
  }
16
 
17
  add_action( 'addons_panel_start', array( $this, 'inf_translate_strings' ) );
18
+ add_filter('wcml_exception_duplicate_products_in_cart', array($this, 'addons_duplicate_exception'),10,2);
19
  }
20
 
21
  function register_addons_strings( $meta_id, $id, $meta_key, $addons){
68
 
69
  function inf_translate_strings(){
70
  $message = '<div><p class="icl_cyan_box">';
71
+ $message .= sprintf(__('To translate Add-ons strings please save Add-ons and go to the <b><a href="%s">String Translation interface</a></b>', 'woocommerce-multilingual'), admin_url('admin.php?page='.WPML_ST_FOLDER.'/menu/string-translation.php&context=wc_product_addons_strings'));
72
  $message .= '</p></div>';
73
 
74
  echo $message;
75
  }
76
+
77
+ function addons_duplicate_exception( $exclude, $cart_item ) {
78
+ if ( isset( $cart_item[ 'addons' ] ) ) {
79
+ $exclude = true;
80
+ }
81
+ return $exclude;
82
+ }
83
  }
compatibility/wc_subscriptions.class.php CHANGED
@@ -6,6 +6,7 @@ class WCML_WC_Subscriptions{
6
 
7
  add_action('init', array($this, 'init'),9);
8
  add_filter('wcml_variation_term_taxonomy_ids',array($this,'wcml_variation_term_taxonomy_ids'));
 
9
  }
10
 
11
  function init(){
6
 
7
  add_action('init', array($this, 'init'),9);
8
  add_filter('wcml_variation_term_taxonomy_ids',array($this,'wcml_variation_term_taxonomy_ids'));
9
+
10
  }
11
 
12
  function init(){
compatibility/wc_tab_manager.class.php CHANGED
@@ -203,7 +203,7 @@ class WCML_Tab_Manager{
203
  $tr_prod_tabs = $wc_tab_manager->get_product_tabs($template_data['tr_product_id']);
204
 
205
  if(!is_array($tr_prod_tabs)){
206
- return __('Please update original product','wpml-wcml');
207
  }
208
 
209
  foreach($tr_prod_tabs as $key=>$prod_tab){
203
  $tr_prod_tabs = $wc_tab_manager->get_product_tabs($template_data['tr_product_id']);
204
 
205
  if(!is_array($tr_prod_tabs)){
206
+ return __('Please update original product', 'woocommerce-multilingual');
207
  }
208
 
209
  foreach($tr_prod_tabs as $key=>$prod_tab){
inc/compatibility.class.php CHANGED
@@ -94,29 +94,29 @@ class WCML_Compatibility {
94
  $this->checkout_field_editor = new WCML_Checkout_Field_Editor();
95
  }
96
 
97
- if (class_exists('WC_Bulk_Stock_Management')) {
98
- require_once WCML_PLUGIN_PATH . '/compatibility/wc_bulk_stock_management.class.php';
99
- $this->wc_bulk_stock_management = new WCML_Bulk_Stock_Management();
100
- }
101
 
102
- // WooCommerce Advanced Ajax Layered Navigation
103
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
104
- if ( is_plugin_active( 'woocommerce-ajax-layered-nav/ajax_layered_nav-widget.php' ) ) {
105
- require_once WCML_PLUGIN_PATH . '/compatibility/wc_ajax_layered_nav_widget.class.php';
106
- $this->wc_ajax_layered_nav_widget = new WCML_Ajax_Layered_Nav_Widget();
107
- }
108
 
109
- // woocommerce composite products
110
- if ( isset( $GLOBALS[ 'woocommerce_composite_products' ] ) ) {
111
- require_once WCML_PLUGIN_PATH . '/compatibility/wc_composite_products.class.php';
112
- $this->wc_composite_products = new WCML_Composite_Products();
113
- }
114
 
115
- // woocommerce checkout addons
116
- if (function_exists('init_woocommerce_checkout_add_ons')) {
117
- require_once WCML_PLUGIN_PATH . '/compatibility/wc_checkout_addons.class.php';
118
- $this->wc_checkout_addons = new WCML_Checkout_Addons();
119
- }
120
 
121
  }
122
 
94
  $this->checkout_field_editor = new WCML_Checkout_Field_Editor();
95
  }
96
 
97
+ if (class_exists('WC_Bulk_Stock_Management')) {
98
+ require_once WCML_PLUGIN_PATH . '/compatibility/wc_bulk_stock_management.class.php';
99
+ $this->wc_bulk_stock_management = new WCML_Bulk_Stock_Management();
100
+ }
101
 
102
+ // WooCommerce Advanced Ajax Layered Navigation
103
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
104
+ if ( is_plugin_active( 'woocommerce-ajax-layered-nav/ajax_layered_nav-widget.php' ) ) {
105
+ require_once WCML_PLUGIN_PATH . '/compatibility/wc_ajax_layered_nav_widget.class.php';
106
+ $this->wc_ajax_layered_nav_widget = new WCML_Ajax_Layered_Nav_Widget();
107
+ }
108
 
109
+ // woocommerce composite products
110
+ if ( isset( $GLOBALS[ 'woocommerce_composite_products' ] ) ) {
111
+ require_once WCML_PLUGIN_PATH . '/compatibility/wc_composite_products.class.php';
112
+ $this->wc_composite_products = new WCML_Composite_Products();
113
+ }
114
 
115
+ // woocommerce checkout addons
116
+ if (function_exists('init_woocommerce_checkout_add_ons')) {
117
+ require_once WCML_PLUGIN_PATH . '/compatibility/wc_checkout_addons.class.php';
118
+ $this->wc_checkout_addons = new WCML_Checkout_Addons();
119
+ }
120
 
121
  }
122
 
inc/currency-switcher-widget.class.php CHANGED
@@ -4,7 +4,7 @@ class WC_Currency_Switcher_Widget extends WP_Widget {
4
 
5
  function __construct() {
6
 
7
- parent::__construct( 'currency_sel_widget', __('Currency switcher', 'wpml-wcml'), __('Currency switcher', 'wpml-wcml'));
8
  }
9
 
10
  function widget($args, $instance) {
@@ -18,7 +18,7 @@ class WC_Currency_Switcher_Widget extends WP_Widget {
18
 
19
  function form( $instance ) {
20
 
21
- printf('<p><a href="%s">%s</a></p>',admin_url('admin.php?page=wpml-wcml#currency-switcher'),__('Configure options','wpml-wcml'));
22
  return;
23
 
24
  }
4
 
5
  function __construct() {
6
 
7
+ parent::__construct( 'currency_sel_widget', __('Currency switcher', 'woocommerce-multilingual'), __('Currency switcher', 'woocommerce-multilingual'));
8
  }
9
 
10
  function widget($args, $instance) {
18
 
19
  function form( $instance ) {
20
 
21
+ printf('<p><a href="%s">%s</a></p>',admin_url('admin.php?page=wpml-wcml#currency-switcher'),__('Configure options', 'woocommerce-multilingual'));
22
  return;
23
 
24
  }
inc/currency-switcher.class.php CHANGED
@@ -27,7 +27,7 @@ class WCML_CurrencySwitcher{
27
 
28
  $woocommerce_wpml->settings['currencies_order'] = explode(';', $_POST['order']);
29
  $woocommerce_wpml->update_settings();
30
- echo json_encode(array('message' => __('Currencies order updated', 'wpml-wcml')));
31
  die;
32
  }
33
 
27
 
28
  $woocommerce_wpml->settings['currencies_order'] = explode(';', $_POST['order']);
29
  $woocommerce_wpml->update_settings();
30
+ echo json_encode(array('message' => __('Currencies order updated', 'woocommerce-multilingual')));
31
  die;
32
  }
33
 
inc/dependencies.class.php CHANGED
@@ -24,9 +24,19 @@ class WCML_Dependencies{
24
  if(!defined('ICL_SITEPRESS_VERSION') || ICL_PLUGIN_INACTIVE || is_null( $sitepress ) || !class_exists('SitePress')){
25
  $this->missing['WPML'] = $woocommerce_wpml->generate_tracking_link('http://wpml.org/');
26
  $allok = false;
27
- } else if(version_compare(ICL_SITEPRESS_VERSION, '3.1.5', '<')){
28
  add_action('admin_notices', array($this, '_old_wpml_warning'));
29
  $allok = false;
 
 
 
 
 
 
 
 
 
 
30
  }
31
 
32
  if(!class_exists('woocommerce')){
@@ -80,25 +90,25 @@ class WCML_Dependencies{
80
  function _old_wpml_warning(){
81
  global $woocommerce_wpml;?>
82
  <div class="message error"><p><?php printf(__('WooCommerce Multilingual is enabled but not effective. It is not compatible with <a href="%s">WPML</a> versions prior %s.',
83
- 'wpml-wcml'), $woocommerce_wpml->generate_tracking_link('http://wpml.org/'), '3.1.5'); ?></p></div>
84
  <?php }
85
 
86
  function _old_wpml_tm_warning(){
87
  global $woocommerce_wpml;?>
88
  <div class="message error"><p><?php printf(__('WooCommerce Multilingual is enabled but not effective. It is not compatible with <a href="%s">WPML Translation Management</a> versions prior %s.',
89
- 'wpml-wcml'), $woocommerce_wpml->generate_tracking_link('http://wpml.org/'), '1.9'); ?></p></div>
90
  <?php }
91
 
92
  function _old_wpml_st_warning(){
93
  global $woocommerce_wpml;?>
94
  <div class="message error"><p><?php printf(__('WooCommerce Multilingual is enabled but not effective. It is not compatible with <a href="%s">WPML String Translation</a> versions prior %s.',
95
- 'wpml-wcml'), $woocommerce_wpml->generate_tracking_link('http://wpml.org/'), '2.0'); ?></p></div>
96
  <?php }
97
 
98
  function _old_wpml_media_warning(){
99
  global $woocommerce_wpml;?>
100
  <div class="message error"><p><?php printf(__('WooCommerce Multilingual is enabled but not effective. It is not compatible with <a href="%s">WPML Media</a> versions prior %s.',
101
- 'wpml-wcml'), $woocommerce_wpml->generate_tracking_link('http://wpml.org/'), '2.1'); ?></p></div>
102
  <?php }
103
 
104
 
@@ -114,14 +124,14 @@ class WCML_Dependencies{
114
  if ($counter == sizeof($this->missing)) {
115
  $sep = '';
116
  } elseif ($counter == sizeof($this->missing) - 1) {
117
- $sep = ' ' . __('and', 'wpml-wcml') . ' ';
118
  } else {
119
  $sep = ', ';
120
  }
121
  $missing .= '<a href="' . $url . '">' . $title . '</a>' . $sep;
122
  } ?>
123
 
124
- <div class="message error"><p><?php printf(__('WooCommerce Multilingual is enabled but not effective. It requires %s in order to work.', 'wpml-wcml'), $missing); ?></p></div>
125
  <?php
126
  }
127
 
@@ -141,13 +151,13 @@ class WCML_Dependencies{
141
  return;
142
  }
143
 
144
- $message = sprintf('Because this site uses the default permalink structure, you cannot use slug translation for product permalinks.', 'wpml-wcml');
145
  $message .= '<br /><br />';
146
- $message .= sprintf('Please choose a different permalink structure or disable slug translation.', 'wpml-wcml');
147
  $message .= '<br /><br />';
148
- $message .= '<a href="' . admin_url('options-permalink.php') . '">' . __('Permalink settings', 'wpml-wcml') . '</a>';
149
  $message .= ' | ';
150
- $message .= '<a href="' . admin_url('admin.php?page=' . WPML_TM_FOLDER . '/menu/main.php&sm=mcsetup#icl_custom_posts_sync_options') . '">' . __('Configure products slug translation', 'wpml-wcml') . '</a>';
151
 
152
 
153
  // Check if translated shop pages have the same slug (only 1.x)
@@ -188,7 +198,7 @@ class WCML_Dependencies{
188
 
189
  // display messages
190
  if (!$allsame) {
191
- $this->err_message = '<div class="message error"><p>'.printf(__('If you want different slugs for shop pages (%s/%s), you need to disable the shop prefix for products in <a href="%s">WooCommerce Settings</a>', 'wpml-wcml'),
192
  $slug, $translated_slug, admin_url("admin.php?page=woocommerce_settings&tab=pages")).'</p></div>';
193
  add_action('admin_notices', array($this,'plugin_notice_message'));
194
  }
@@ -213,7 +223,7 @@ class WCML_Dependencies{
213
 
214
  $ret['_wpnonce'] = wp_create_nonce('icl_sw_form');
215
 
216
- $ret['success_1'] = '&nbsp;' . 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>');
217
 
218
 
219
  echo json_encode($ret);
@@ -229,7 +239,7 @@ class WCML_Dependencies{
229
 
230
  $file = realpath(WCML_PLUGIN_PATH . '/wpml-config.xml');
231
  if(!file_exists($file)){
232
- $this->xml_config_errors[] = __('wpml-config.xml file missing from WooCommerce Multilingual folder.', 'wpml-wcml');
233
  }else{
234
  $config = icl_xml2array(file_get_contents($file));
235
 
@@ -253,7 +263,7 @@ class WCML_Dependencies{
253
  $correct_config_value = $cf['attr']['action'] == 'copy' ? 1 : ($cf['attr']['action'] == 'translate' ? 2: 0);
254
 
255
  if($effective_config_value != $correct_config_value){
256
- $this->xml_config_errors[] = sprintf(__('Custom field %s configuration from wpml-config.xml file was altered!', 'wpml-wcml'), '<i>' . $cf['value'] . '</i>');
257
  }
258
  }
259
 
@@ -276,7 +286,7 @@ class WCML_Dependencies{
276
  $correct_config_value = $ct['attr']['translate'];
277
 
278
  if($effective_config_value != $correct_config_value){
279
- $this->xml_config_errors[] = sprintf(__('Custom type %s configuration from wpml-config.xml file was altered!', 'wpml-wcml'), '<i>' . $ct['value'] . '</i>');
280
  }
281
  }
282
 
@@ -299,7 +309,7 @@ class WCML_Dependencies{
299
  $correct_config_value = $tx['attr']['translate'];
300
 
301
  if($effective_config_value != $correct_config_value){
302
- $this->xml_config_errors[] = sprintf(__('Custom taxonomy %s configuration from wpml-config.xml file was altered!', 'wpml-wcml'), '<i>' . $tx['value'] . '</i>');
303
  }
304
  }
305
 
24
  if(!defined('ICL_SITEPRESS_VERSION') || ICL_PLUGIN_INACTIVE || is_null( $sitepress ) || !class_exists('SitePress')){
25
  $this->missing['WPML'] = $woocommerce_wpml->generate_tracking_link('http://wpml.org/');
26
  $allok = false;
27
+ } elseif(version_compare(ICL_SITEPRESS_VERSION, '3.1.5', '<')){
28
  add_action('admin_notices', array($this, '_old_wpml_warning'));
29
  $allok = false;
30
+ }else{
31
+ if( !defined('WPML_SUPPORT_STRINGS_IN_DIFF_LANG') ){
32
+ if( class_exists('WPML_Language_Of_Domain') ){
33
+ define('WPML_SUPPORT_STRINGS_IN_DIFF_LANG', true );
34
+ }else{
35
+ define('WPML_SUPPORT_STRINGS_IN_DIFF_LANG', false);
36
+ }
37
+ }
38
+
39
+
40
  }
41
 
42
  if(!class_exists('woocommerce')){
90
  function _old_wpml_warning(){
91
  global $woocommerce_wpml;?>
92
  <div class="message error"><p><?php printf(__('WooCommerce Multilingual is enabled but not effective. It is not compatible with <a href="%s">WPML</a> versions prior %s.',
93
+ 'woocommerce-multilingual'), $woocommerce_wpml->generate_tracking_link('http://wpml.org/'), '3.1.5'); ?></p></div>
94
  <?php }
95
 
96
  function _old_wpml_tm_warning(){
97
  global $woocommerce_wpml;?>
98
  <div class="message error"><p><?php printf(__('WooCommerce Multilingual is enabled but not effective. It is not compatible with <a href="%s">WPML Translation Management</a> versions prior %s.',
99
+ 'woocommerce-multilingual'), $woocommerce_wpml->generate_tracking_link('http://wpml.org/'), '1.9'); ?></p></div>
100
  <?php }
101
 
102
  function _old_wpml_st_warning(){
103
  global $woocommerce_wpml;?>
104
  <div class="message error"><p><?php printf(__('WooCommerce Multilingual is enabled but not effective. It is not compatible with <a href="%s">WPML String Translation</a> versions prior %s.',
105
+ 'woocommerce-multilingual'), $woocommerce_wpml->generate_tracking_link('http://wpml.org/'), '2.0'); ?></p></div>
106
  <?php }
107
 
108
  function _old_wpml_media_warning(){
109
  global $woocommerce_wpml;?>
110
  <div class="message error"><p><?php printf(__('WooCommerce Multilingual is enabled but not effective. It is not compatible with <a href="%s">WPML Media</a> versions prior %s.',
111
+ 'woocommerce-multilingual'), $woocommerce_wpml->generate_tracking_link('http://wpml.org/'), '2.1'); ?></p></div>
112
  <?php }
113
 
114
 
124
  if ($counter == sizeof($this->missing)) {
125
  $sep = '';
126
  } elseif ($counter == sizeof($this->missing) - 1) {
127
+ $sep = ' ' . __('and', 'woocommerce-multilingual') . ' ';
128
  } else {
129
  $sep = ', ';
130
  }
131
  $missing .= '<a href="' . $url . '">' . $title . '</a>' . $sep;
132
  } ?>
133
 
134
+ <div class="message error"><p><?php printf(__('WooCommerce Multilingual is enabled but not effective. It requires %s in order to work.', 'woocommerce-multilingual'), $missing); ?></p></div>
135
  <?php
136
  }
137
 
151
  return;
152
  }
153
 
154
+ $message = sprintf('Because this site uses the default permalink structure, you cannot use slug translation for product permalinks.', 'woocommerce-multilingual');
155
  $message .= '<br /><br />';
156
+ $message .= sprintf('Please choose a different permalink structure or disable slug translation.', 'woocommerce-multilingual');
157
  $message .= '<br /><br />';
158
+ $message .= '<a href="' . admin_url('options-permalink.php') . '">' . __('Permalink settings', 'woocommerce-multilingual') . '</a>';
159
  $message .= ' | ';
160
+ $message .= '<a href="' . admin_url('admin.php?page=' . WPML_TM_FOLDER . '/menu/main.php&sm=mcsetup#icl_custom_posts_sync_options') . '">' . __('Configure products slug translation', 'woocommerce-multilingual') . '</a>';
161
 
162
 
163
  // Check if translated shop pages have the same slug (only 1.x)
198
 
199
  // display messages
200
  if (!$allsame) {
201
+ $this->err_message = '<div class="message error"><p>'.printf(__('If you want different slugs for shop pages (%s/%s), you need to disable the shop prefix for products in <a href="%s">WooCommerce Settings</a>', 'woocommerce-multilingual'),
202
  $slug, $translated_slug, admin_url("admin.php?page=woocommerce_settings&tab=pages")).'</p></div>';
203
  add_action('admin_notices', array($this,'plugin_notice_message'));
204
  }
223
 
224
  $ret['_wpnonce'] = wp_create_nonce('icl_sw_form');
225
 
226
+ $ret['success_1'] = '&nbsp;' . sprintf(__('Finished! You can visit the %sstrings translation%s screen to translate the strings now.', 'woocommerce-multilingual'), '<a href="' . admin_url('admin.php?page=' . WPML_ST_FOLDER . '/menu/string-translation.php') . '">', '</a>');
227
 
228
 
229
  echo json_encode($ret);
239
 
240
  $file = realpath(WCML_PLUGIN_PATH . '/wpml-config.xml');
241
  if(!file_exists($file)){
242
+ $this->xml_config_errors[] = __('wpml-config.xml file missing from WooCommerce Multilingual folder.', 'woocommerce-multilingual');
243
  }else{
244
  $config = icl_xml2array(file_get_contents($file));
245
 
263
  $correct_config_value = $cf['attr']['action'] == 'copy' ? 1 : ($cf['attr']['action'] == 'translate' ? 2: 0);
264
 
265
  if($effective_config_value != $correct_config_value){
266
+ $this->xml_config_errors[] = sprintf(__('Custom field %s configuration from wpml-config.xml file was altered!', 'woocommerce-multilingual'), '<i>' . $cf['value'] . '</i>');
267
  }
268
  }
269
 
286
  $correct_config_value = $ct['attr']['translate'];
287
 
288
  if($effective_config_value != $correct_config_value){
289
+ $this->xml_config_errors[] = sprintf(__('Custom type %s configuration from wpml-config.xml file was altered!', 'woocommerce-multilingual'), '<i>' . $ct['value'] . '</i>');
290
  }
291
  }
292
 
309
  $correct_config_value = $tx['attr']['translate'];
310
 
311
  if($effective_config_value != $correct_config_value){
312
+ $this->xml_config_errors[] = sprintf(__('Custom taxonomy %s configuration from wpml-config.xml file was altered!', 'woocommerce-multilingual'), '<i>' . $tx['value'] . '</i>');
313
  }
314
  }
315
 
inc/emails.class.php CHANGED
@@ -113,34 +113,23 @@ class WCML_Emails{
113
  }
114
 
115
  function comments_language(){
116
- global $sitepress_settings;
117
 
118
- if ( WPML_SUPPORT_STRINGS_IN_DIFF_LANG ) {
119
- $context_ob = icl_st_get_context( 'woocommerce' );
120
- if($context_ob){
121
- $this->change_email_language($context_ob->language);
122
- }
123
- }else{
124
- $this->change_email_language($sitepress_settings['st']['strings_language']);
125
- }
126
 
127
  }
128
 
129
  function email_heading_completed( $order_id, $no_checking = false ){
130
  global $woocommerce;
131
  if(class_exists('WC_Email_Customer_Completed_Order') || $no_checking){
132
- $heading = $this->wcml_get_email_string_info( '[woocommerce_customer_completed_order_settings]heading' );
133
- if($heading)
134
- $woocommerce->mailer()->emails['WC_Email_Customer_Completed_Order']->heading = apply_filters( 'wpml_translate_single_string', $heading[0]->value, $heading[0]->context,'[woocommerce_customer_completed_order_settings]heading' );
135
- $subject = $this->wcml_get_email_string_info( '[woocommerce_customer_completed_order_settings]subject' );
136
- if($subject)
137
- $woocommerce->mailer()->emails['WC_Email_Customer_Completed_Order']->subject = apply_filters( 'wpml_translate_single_string', $subject[0]->value, $subject[0]->context,'[woocommerce_customer_completed_order_settings]subject');
138
- $heading_downloadable = $this->wcml_get_email_string_info( '[woocommerce_customer_completed_order_settings]heading_downloadable' );
139
- if($heading_downloadable)
140
- $woocommerce->mailer()->emails['WC_Email_Customer_Completed_Order']->heading_downloadable = apply_filters( 'wpml_translate_single_string', $heading_downloadable[0]->value, $heading_downloadable[0]->context,'[woocommerce_customer_completed_order_settings]heading_downloadable');
141
- $subject_downloadable = $this->wcml_get_email_string_info( '[woocommerce_customer_completed_order_settings]subject_downloadable' );
142
- if($subject_downloadable)
143
- $woocommerce->mailer()->emails['WC_Email_Customer_Completed_Order']->subject_downloadable = apply_filters( 'wpml_translate_single_string', $subject_downloadable[0]->value, $subject_downloadable[0]->context,'[woocommerce_customer_completed_order_settings]subject_downloadable' );
144
 
145
  $enabled = $woocommerce->mailer()->emails['WC_Email_Customer_Completed_Order']->enabled;
146
  $woocommerce->mailer()->emails['WC_Email_Customer_Completed_Order']->enabled = false;
@@ -152,12 +141,10 @@ class WCML_Emails{
152
  function email_heading_processing($order_id){
153
  global $woocommerce;
154
  if(class_exists('WC_Email_Customer_Processing_Order')){
155
- $heading = $this->wcml_get_email_string_info( '[woocommerce_customer_processing_order_settings]heading' );
156
- if($heading)
157
- $woocommerce->mailer()->emails['WC_Email_Customer_Processing_Order']->heading = apply_filters( 'wpml_translate_single_string', $heading[0]->value, $heading[0]->context,'[woocommerce_customer_processing_order_settings]heading' );
158
- $subject = $this->wcml_get_email_string_info( '[woocommerce_customer_processing_order_settings]subject' );
159
- if($subject)
160
- $woocommerce->mailer()->emails['WC_Email_Customer_Processing_Order']->subject = apply_filters( 'wpml_translate_single_string', $subject[0]->value, $subject[0]->context,'[woocommerce_customer_processing_order_settings]subject' );
161
 
162
  $enabled = $woocommerce->mailer()->emails['WC_Email_Customer_Processing_Order']->enabled;
163
  $woocommerce->mailer()->emails['WC_Email_Customer_Processing_Order']->enabled = false;
@@ -170,13 +157,10 @@ class WCML_Emails{
170
  global $woocommerce,$sitepress;
171
 
172
  if(class_exists('WC_Email_Customer_Note')){
173
- $heading = $this->wcml_get_email_string_info( '[woocommerce_customer_note_settings]heading' );
174
- if($heading)
175
- $woocommerce->mailer()->emails['WC_Email_Customer_Note']->heading = apply_filters( 'wpml_translate_single_string', $heading[0]->value, $heading[0]->context,'[woocommerce_customer_note_settings]heading');
176
 
177
- $subject = $this->wcml_get_email_string_info( '[woocommerce_customer_note_settings]subject' );
178
- if($subject)
179
- $woocommerce->mailer()->emails['WC_Email_Customer_Note']->subject = apply_filters( 'wpml_translate_single_string', $subject[0]->value, $subject[0]->context,'[woocommerce_customer_note_settings]subject' );
180
 
181
  $enabled = $woocommerce->mailer()->emails['WC_Email_Customer_Note']->enabled;
182
  $woocommerce->mailer()->emails['WC_Email_Customer_Note']->enabled = false;
@@ -197,13 +181,12 @@ class WCML_Emails{
197
  }else{
198
  $user_lang = get_post_meta($order_id, 'wpml_language', TRUE);
199
  }
 
200
  $this->change_email_language($user_lang);
201
- $heading = $this->wcml_get_email_string_info( '[woocommerce_new_order_settings]heading' );
202
- if($heading)
203
- $woocommerce->mailer()->emails['WC_Email_New_Order']->heading = apply_filters( 'wpml_translate_single_string', $heading[0]->value, $heading[0]->context,'[woocommerce_new_order_settings]heading' );
204
- $subject = $this->wcml_get_email_string_info( '[woocommerce_new_order_settings]subject' );
205
- if($subject)
206
- $woocommerce->mailer()->emails['WC_Email_New_Order']->subject = apply_filters( 'wpml_translate_single_string', $subject[0]->value, $subject[0]->context,'[woocommerce_new_order_settings]subject' );
207
 
208
  $woocommerce->mailer()->emails['WC_Email_New_Order']->recipient = $recipient;
209
 
@@ -274,18 +257,19 @@ class WCML_Emails{
274
  return $value;
275
  }
276
 
277
- function wcml_get_email_string_info( $name ){
278
- global $wpdb;
 
 
279
 
280
- if ( WPML_SUPPORT_STRINGS_IN_DIFF_LANG ) {
281
- $result = $wpdb->get_results( $wpdb->prepare( "SELECT st.value,cn.context FROM {$wpdb->prefix}icl_strings as st LEFT JOIN {$wpdb->prefix}icl_string_contexts as cn ON st.context_id = cn.id WHERE st.name = %s ", $name ) );
 
282
  }else{
283
- global $sitepress_settings;
284
- $language = $sitepress_settings['st']['strings_language'];
285
- $result = $wpdb->get_results( $wpdb->prepare( "SELECT value,context FROM {$wpdb->prefix}icl_strings WHERE language = %s AND name = %s ", $language, $name ) );
286
- }
287
 
288
- return $result;
 
 
289
 
290
  }
291
 
113
  }
114
 
115
  function comments_language(){
116
+ global $woocommerce_wpml;
117
 
118
+ $this->change_email_language( $woocommerce_wpml->strings->get_domain_language( 'woocommerce' ) );
 
 
 
 
 
 
 
119
 
120
  }
121
 
122
  function email_heading_completed( $order_id, $no_checking = false ){
123
  global $woocommerce;
124
  if(class_exists('WC_Email_Customer_Completed_Order') || $no_checking){
125
+
126
+ $woocommerce->mailer()->emails['WC_Email_Customer_Completed_Order']->heading = $this->wcml_get_translated_email_string( 'admin_texts_woocommerce_customer_completed_order_settings', '[woocommerce_customer_completed_order_settings]heading' );
127
+
128
+ $woocommerce->mailer()->emails['WC_Email_Customer_Completed_Order']->subject = $this->wcml_get_translated_email_string( 'admin_texts_woocommerce_customer_completed_order_settings', '[woocommerce_customer_completed_order_settings]subject' );
129
+
130
+ $woocommerce->mailer()->emails['WC_Email_Customer_Completed_Order']->heading_downloadable = $this->wcml_get_translated_email_string( 'admin_texts_woocommerce_customer_completed_order_settings', '[woocommerce_customer_completed_order_settings]heading_downloadable' );
131
+
132
+ $woocommerce->mailer()->emails['WC_Email_Customer_Completed_Order']->subject_downloadable = $this->wcml_get_translated_email_string( 'admin_texts_woocommerce_customer_completed_order_settings', '[woocommerce_customer_completed_order_settings]subject_downloadable' );
 
 
 
 
133
 
134
  $enabled = $woocommerce->mailer()->emails['WC_Email_Customer_Completed_Order']->enabled;
135
  $woocommerce->mailer()->emails['WC_Email_Customer_Completed_Order']->enabled = false;
141
  function email_heading_processing($order_id){
142
  global $woocommerce;
143
  if(class_exists('WC_Email_Customer_Processing_Order')){
144
+
145
+ $woocommerce->mailer()->emails['WC_Email_Customer_Processing_Order']->heading = $this->wcml_get_translated_email_string( 'admin_texts_woocommerce_customer_processing_order_settings', '[woocommerce_customer_processing_order_settings]heading' );
146
+
147
+ $woocommerce->mailer()->emails['WC_Email_Customer_Processing_Order']->subject = $this->wcml_get_translated_email_string( 'admin_texts_woocommerce_customer_processing_order_settings', '[woocommerce_customer_processing_order_settings]subject' );
 
 
148
 
149
  $enabled = $woocommerce->mailer()->emails['WC_Email_Customer_Processing_Order']->enabled;
150
  $woocommerce->mailer()->emails['WC_Email_Customer_Processing_Order']->enabled = false;
157
  global $woocommerce,$sitepress;
158
 
159
  if(class_exists('WC_Email_Customer_Note')){
 
 
 
160
 
161
+ $woocommerce->mailer()->emails['WC_Email_Customer_Note']->heading = $this->wcml_get_translated_email_string( 'admin_texts_woocommerce_customer_note_settings', '[woocommerce_customer_note_settings]heading' );
162
+
163
+ $woocommerce->mailer()->emails['WC_Email_Customer_Note']->subject = $this->wcml_get_translated_email_string( 'admin_texts_woocommerce_customer_note_settings', '[woocommerce_customer_note_settings]subject' );
164
 
165
  $enabled = $woocommerce->mailer()->emails['WC_Email_Customer_Note']->enabled;
166
  $woocommerce->mailer()->emails['WC_Email_Customer_Note']->enabled = false;
181
  }else{
182
  $user_lang = get_post_meta($order_id, 'wpml_language', TRUE);
183
  }
184
+ icl_get_string_translations_by_id(1);
185
  $this->change_email_language($user_lang);
186
+
187
+ $woocommerce->mailer()->emails['WC_Email_New_Order']->heading = $this->wcml_get_translated_email_string( 'admin_texts_woocommerce_new_order_settings', '[woocommerce_new_order_settings]heading' );
188
+
189
+ $woocommerce->mailer()->emails['WC_Email_New_Order']->subject = $this->wcml_get_translated_email_string( 'admin_texts_woocommerce_new_order_settings', '[woocommerce_new_order_settings]subject' );
 
 
190
 
191
  $woocommerce->mailer()->emails['WC_Email_New_Order']->recipient = $recipient;
192
 
257
  return $value;
258
  }
259
 
260
+ function wcml_get_translated_email_string( $context, $name ){
261
+
262
+ if( version_compare(WPML_ST_VERSION, '2.2.6', '<=' ) ){
263
+ global $wpdb;
264
 
265
+ $result = $wpdb->get_var( $wpdb->prepare( "SELECT value FROM {$wpdb->prefix}icl_strings WHERE context = %s AND name = %s ", $context, $name ) );
266
+
267
+ return apply_filters( 'wpml_translate_single_string', $result, $context, $name );
268
  }else{
 
 
 
 
269
 
270
+ return apply_filters( 'wpml_translate_single_string', false, $context, $name );
271
+
272
+ }
273
 
274
  }
275
 
inc/endpoints.class.php CHANGED
@@ -26,6 +26,7 @@ class WCML_Endpoints{
26
 
27
 
28
  function register_endpoints_translations(){
 
29
  if( !class_exists( 'woocommerce' ) || !defined( 'ICL_SITEPRESS_VERSION' ) || ICL_PLUGIN_INACTIVE || version_compare( WOOCOMMERCE_VERSION, '2.2', '<' ) ) return false;
30
 
31
  $wc_vars = WC()->query->query_vars;
@@ -54,16 +55,16 @@ class WCML_Endpoints{
54
  function get_endpoint_translation( $key, $endpoint, $language = null ){
55
  global $wpdb;
56
 
57
- $string = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}icl_strings WHERE name = %s AND value = %s ", 'Endpoint slug: ' . $key, $endpoint ) );
58
 
59
  if( !$string && function_exists( 'icl_register_string' ) ){
60
- do_action('wpml_register_single_string', 'WordPress', 'Endpoint slug: ' . $key, $endpoint );
61
  }else{
62
  $this->endpoints_strings[] = $string;
63
  }
64
 
65
  if( function_exists('icl_t') ){
66
- return apply_filters( 'wpml_translate_single_string', $endpoint, 'WordPress', 'Endpoint slug: '. $key, $language );
67
  }else{
68
  return $endpoint;
69
  }
@@ -104,10 +105,10 @@ class WCML_Endpoints{
104
  //add endpoints and flush rules
105
  foreach( $this->endpoints_strings as $string_id ){
106
 
107
- $strings = $wpdb->get_results( $wpdb->prepare( "SELECT value FROM {$wpdb->prefix}icl_string_translations WHERE string_id = %s AND status = %s", $string_id , ICL_STRING_TRANSLATION_COMPLETE) );
108
 
109
- foreach( $strings as $string ){
110
- add_rewrite_endpoint( $string->value, EP_ROOT | EP_PAGES );
111
  }
112
  }
113
 
@@ -194,7 +195,7 @@ class WCML_Endpoints{
194
  $endpoints['shipping'] = urldecode( $this->get_translated_edit_address_slug( 'shipping' ) );
195
  $endpoints['billing'] = urldecode( $this->get_translated_edit_address_slug( 'billing' ) );
196
 
197
- if( urldecode( $q->query['pagename'] ) != $endpoint_in_url && !in_array( $endpoint_in_url,$endpoints ) && is_numeric( $endpoint_in_url ) && !in_array( urldecode( prev( $uri_vars ) ) ,$endpoints ) ){
198
  $wp_query->set_404();
199
  status_header(404);
200
  include( get_query_template( '404' ) );
@@ -208,7 +209,7 @@ class WCML_Endpoints{
208
  function get_translated_edit_address_slug( $slug, $language = false ){
209
  global $woocommerce_wpml;
210
 
211
- $strings_language = $woocommerce_wpml->strings->get_wc_context_language();
212
 
213
  if( $strings_language == $language ){
214
  return $slug;
@@ -219,7 +220,7 @@ class WCML_Endpoints{
219
  if( $translated_slug == $slug ){
220
 
221
  if( $language ){
222
- $translated_slug = $woocommerce_wpml->terms->get_translation_from_woocommerce_mo_file( 'edit-address-slug'. chr(4) .$slug, $language );
223
  }else{
224
  $translated_slug = _x( $slug, 'edit-address-slug', 'woocommerce' );
225
  }
26
 
27
 
28
  function register_endpoints_translations(){
29
+
30
  if( !class_exists( 'woocommerce' ) || !defined( 'ICL_SITEPRESS_VERSION' ) || ICL_PLUGIN_INACTIVE || version_compare( WOOCOMMERCE_VERSION, '2.2', '<' ) ) return false;
31
 
32
  $wc_vars = WC()->query->query_vars;
55
  function get_endpoint_translation( $key, $endpoint, $language = null ){
56
  global $wpdb;
57
 
58
+ $string = icl_get_string_id( $endpoint, 'WooCommerce Endpoints', $key );
59
 
60
  if( !$string && function_exists( 'icl_register_string' ) ){
61
+ do_action('wpml_register_single_string', 'WooCommerce Endpoints', $key, $endpoint );
62
  }else{
63
  $this->endpoints_strings[] = $string;
64
  }
65
 
66
  if( function_exists('icl_t') ){
67
+ return apply_filters( 'wpml_translate_single_string', $endpoint, 'WooCommerce Endpoints', $key, $language );
68
  }else{
69
  return $endpoint;
70
  }
105
  //add endpoints and flush rules
106
  foreach( $this->endpoints_strings as $string_id ){
107
 
108
+ $string_translations = icl_get_string_translations_by_id( $string_id );
109
 
110
+ foreach( $string_translations as $string ){
111
+ add_rewrite_endpoint( $string['value'], EP_ROOT | EP_PAGES );
112
  }
113
  }
114
 
195
  $endpoints['shipping'] = urldecode( $this->get_translated_edit_address_slug( 'shipping' ) );
196
  $endpoints['billing'] = urldecode( $this->get_translated_edit_address_slug( 'billing' ) );
197
 
198
+ if( urldecode( $q->query['pagename'] ) != $endpoint_in_url && !in_array( $endpoint_in_url,$endpoints ) && is_numeric( $endpoint_in_url ) && !in_array( urldecode( prev( $uri_vars ) ) ,$q->query_vars ) ){
199
  $wp_query->set_404();
200
  status_header(404);
201
  include( get_query_template( '404' ) );
209
  function get_translated_edit_address_slug( $slug, $language = false ){
210
  global $woocommerce_wpml;
211
 
212
+ $strings_language = $woocommerce_wpml->strings->get_string_language( $slug, 'woocommerce', 'edit-address-slug: '.$slug );
213
 
214
  if( $strings_language == $language ){
215
  return $slug;
220
  if( $translated_slug == $slug ){
221
 
222
  if( $language ){
223
+ $translated_slug = $woocommerce_wpml->strings->get_translation_from_woocommerce_mo_file( 'edit-address-slug'. chr(4) .$slug, $language );
224
  }else{
225
  $translated_slug = _x( $slug, 'edit-address-slug', 'woocommerce' );
226
  }
inc/missing-php-functions.php CHANGED
@@ -35,6 +35,22 @@ if (get_magic_quotes_gpc()) {
35
  /* PHP 5.3 - end */
36
 
37
  //WPML
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  add_action('plugins_loaded', 'wcml_check_wpml_functions');
39
 
40
  function wcml_check_wpml_functions(){
35
  /* PHP 5.3 - end */
36
 
37
  //WPML
38
+ if(!function_exists('wpml_filter_include_url')) {
39
+ function wpml_filter_include_url( $result ) {
40
+ if ( isset( $_SERVER[ 'HTTP_HOST' ] ) ) {
41
+ $http_host_parts = explode( ':', $_SERVER[ 'HTTP_HOST' ] );
42
+ unset( $http_host_parts[ 1 ] );
43
+ $http_host_without_port = implode( $http_host_parts );
44
+ $path = str_replace( parse_url( $result, PHP_URL_HOST ), $http_host_without_port, $result );
45
+ } else {
46
+ $path = '';
47
+ }
48
+
49
+ return $path;
50
+ }
51
+ }
52
+
53
+
54
  add_action('plugins_loaded', 'wcml_check_wpml_functions');
55
 
56
  function wcml_check_wpml_functions(){
inc/multi-currency-support.class.php CHANGED
@@ -96,12 +96,13 @@ class WCML_Multi_Currency_Support{
96
  //filters for wc-widget-price-filter
97
  add_filter( 'woocommerce_price_filter_results', array( $this, 'filter_price_filter_results' ), 10, 3 );
98
  add_filter( 'woocommerce_price_filter_widget_amount', array( $this, 'filter_price_filter_widget_amount' ) );
 
 
 
 
99
 
100
  }
101
 
102
- add_filter('option_woocommerce_price_thousand_sep', array($this, 'filter_currency_thousand_sep_option'));
103
- add_filter('option_woocommerce_price_decimal_sep', array($this, 'filter_currency_decimal_sep_option'));
104
- add_filter('option_woocommerce_price_num_decimals', array($this, 'filter_currency_num_decimals_option'));
105
 
106
  add_filter('option_woocommerce_currency_pos', array($this, 'filter_currency_position_option'));
107
  add_filter( 'woocommerce_get_formatted_order_total', array( $this, 'filter_get_formatted_order_total' ), 10, 2 );
@@ -116,6 +117,11 @@ class WCML_Multi_Currency_Support{
116
 
117
  add_filter( 'wc_price_args', array( $this, 'filter_wc_price_args') );
118
 
 
 
 
 
 
119
  if(!is_admin()) $this->load_inline_js();
120
 
121
  }
@@ -457,7 +463,7 @@ class WCML_Multi_Currency_Support{
457
 
458
  }
459
 
460
- $menu = '<p>' . esc_js(__('Select the currency you want to set the options for:', 'wpml-wcml')) . '</p><br />' . join (' | ', $menu);
461
 
462
  $codes = "['" . join("', '", array_keys($this->get_currencies())) . "']";
463
  $symbols = "['" . join("', '", $symbols) . "']";
@@ -667,48 +673,19 @@ class WCML_Multi_Currency_Support{
667
 
668
  function load_inline_js(){
669
 
670
- $wcml_switch_currency_nonce = wp_create_nonce('switch_currency');
671
-
672
- wc_enqueue_js( "
673
- jQuery('.wcml_currency_switcher').on('change', function(){
674
- var currency = jQuery(this).val();
675
- load_currency(currency);
676
- });
677
- jQuery('.wcml_currency_switcher li').on('click', function(){
678
- if(jQuery(this).hasClass('wcml-active-currency')){
679
- return;
680
- }
681
- var currency = jQuery(this).attr('rel');
682
- load_currency(currency);
683
- });
684
-
685
-
686
- function load_currency(currency){
687
- var ajax_loader = jQuery('<img style=\"margin-left:10px;\" width=\"16\" heigth=\"16\" src=\"" . WCML_PLUGIN_URL . "/assets/images/ajax-loader.gif\" />')
688
- jQuery('.wcml_currency_switcher').attr('disabled', 'disabled');
689
- jQuery('.wcml_currency_switcher').after();
690
- ajax_loader.insertAfter(jQuery('.wcml_currency_switcher'));
691
- jQuery.ajax({
692
- type : 'post',
693
- url : woocommerce_params.ajax_url,
694
- data : {
695
- action: 'wcml_switch_currency',
696
- currency : currency,
697
- wcml_nonce: '".$wcml_switch_currency_nonce."'
698
- },
699
- success: function(response) {
700
- if(typeof response.error !== 'undefined'){
701
- alert(response.error);
702
- }else{
703
- jQuery('.wcml_currency_switcher').removeAttr('disabled');
704
- ajax_loader.remove();
705
- window.location = window.location.href;
706
- }
707
- }
708
- });
709
- }
710
- " );
711
-
712
  }
713
 
714
  function product_price_filter($null, $object_id, $meta_key, $single){
@@ -1177,19 +1154,19 @@ class WCML_Multi_Currency_Support{
1177
 
1178
  global $woocommerce,$sitepress;
1179
  $this->client_currency = $currency;
1180
-
1181
- $woocommerce->session->set('client_currency', $currency);
1182
  $woocommerce->session->set('client_currency_language', $sitepress->get_current_language());
1183
-
1184
-
1185
  do_action('wcml_set_client_currency', $currency);
1186
-
1187
  }
1188
 
1189
  function switch_currency(){
1190
  $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
1191
  if(!$nonce || !wp_verify_nonce($nonce, 'switch_currency')){
1192
- echo json_encode(array('error' => __('Invalid nonce', 'wpml-wcml')));
1193
  die();
1194
  }
1195
 
@@ -1202,7 +1179,7 @@ class WCML_Multi_Currency_Support{
1202
  if(empty($woocommerce->session->data) && empty($current_user->ID)){
1203
  $woocommerce->session->set_customer_session_cookie(true);
1204
  }
1205
-
1206
  do_action('wcml_switch_currency', $currency );
1207
 
1208
  exit;
@@ -1276,7 +1253,7 @@ class WCML_Multi_Currency_Support{
1276
 
1277
  $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
1278
  if(!$nonce || !wp_verify_nonce($nonce, 'legacy_remove_custom_rates')){
1279
- echo json_encode(array('error' => __('Invalid nonce', 'wpml-wcml')));
1280
  die();
1281
  }
1282
 
96
  //filters for wc-widget-price-filter
97
  add_filter( 'woocommerce_price_filter_results', array( $this, 'filter_price_filter_results' ), 10, 3 );
98
  add_filter( 'woocommerce_price_filter_widget_amount', array( $this, 'filter_price_filter_widget_amount' ) );
99
+
100
+ add_filter('option_woocommerce_price_thousand_sep', array($this, 'filter_currency_thousand_sep_option'));
101
+ add_filter('option_woocommerce_price_decimal_sep', array($this, 'filter_currency_decimal_sep_option'));
102
+ add_filter('option_woocommerce_price_num_decimals', array($this, 'filter_currency_num_decimals_option'));
103
 
104
  }
105
 
 
 
 
106
 
107
  add_filter('option_woocommerce_currency_pos', array($this, 'filter_currency_position_option'));
108
  add_filter( 'woocommerce_get_formatted_order_total', array( $this, 'filter_get_formatted_order_total' ), 10, 2 );
117
 
118
  add_filter( 'wc_price_args', array( $this, 'filter_wc_price_args') );
119
 
120
+ if(defined('W3TC')){
121
+ require WCML_PLUGIN_PATH . '/inc/w3tc-compatibility.class.php';
122
+ $this->WCML_WC_MultiCurrency_W3TC = new WCML_WC_MultiCurrency_W3TC;
123
+ }
124
+
125
  if(!is_admin()) $this->load_inline_js();
126
 
127
  }
463
 
464
  }
465
 
466
+ $menu = '<p>' . esc_js(__('Select the currency you want to set the options for:', 'woocommerce-multilingual')) . '</p><br />' . join (' | ', $menu);
467
 
468
  $codes = "['" . join("', '", array_keys($this->get_currencies())) . "']";
469
  $symbols = "['" . join("', '", $symbols) . "']";
673
 
674
  function load_inline_js(){
675
 
676
+ wp_register_script('wcml-mc-scripts', WCML_PLUGIN_URL . '/assets/js/wcml-multi-currency.js', array('jquery'), WCML_VERSION, true);
677
+
678
+ wp_enqueue_script('wcml-mc-scripts');
679
+
680
+ $script_vars['wcml_mc_nonce'] = wp_create_nonce( 'switch_currency' );
681
+ $script_vars['wcml_spinner'] = WCML_PLUGIN_URL . '/assets/images/ajax-loader.gif';
682
+
683
+ if(isset($this->WCML_WC_MultiCurrency_W3TC)){
684
+ $script_vars['w3tc'] = 1;
685
+ }
686
+
687
+ wp_localize_script('wcml-mc-scripts', 'wcml_mc_settings', $script_vars );
688
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689
  }
690
 
691
  function product_price_filter($null, $object_id, $meta_key, $single){
1154
 
1155
  global $woocommerce,$sitepress;
1156
  $this->client_currency = $currency;
1157
+
1158
+ $woocommerce->session->set('client_currency', $currency);
1159
  $woocommerce->session->set('client_currency_language', $sitepress->get_current_language());
1160
+
1161
+
1162
  do_action('wcml_set_client_currency', $currency);
1163
+
1164
  }
1165
 
1166
  function switch_currency(){
1167
  $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
1168
  if(!$nonce || !wp_verify_nonce($nonce, 'switch_currency')){
1169
+ echo json_encode(array('error' => __('Invalid nonce', 'woocommerce-multilingual')));
1170
  die();
1171
  }
1172
 
1179
  if(empty($woocommerce->session->data) && empty($current_user->ID)){
1180
  $woocommerce->session->set_customer_session_cookie(true);
1181
  }
1182
+
1183
  do_action('wcml_switch_currency', $currency );
1184
 
1185
  exit;
1253
 
1254
  $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
1255
  if(!$nonce || !wp_verify_nonce($nonce, 'legacy_remove_custom_rates')){
1256
+ echo json_encode(array('error' => __('Invalid nonce', 'woocommerce-multilingual')));
1257
  die();
1258
  }
1259
 
inc/multi-currency.class.php CHANGED
@@ -37,14 +37,6 @@ class WCML_WC_MultiCurrency{
37
  add_filter('wcml_get_client_currency', array($this, 'get_client_currency'));
38
  add_filter('woocommerce_paypal_args', array($this, 'filter_price_woocommerce_paypal_args'));
39
 
40
-
41
- // exchange rate GUI and logic
42
- if(defined('W3TC')){
43
-
44
- $WCML_WC_MultiCurrency_W3TC = new WCML_WC_MultiCurrency_W3TC;
45
-
46
- }
47
-
48
  add_action('woocommerce_email_before_order_table', array($this, 'fix_currency_before_order_email'));
49
  add_action('woocommerce_email_after_order_table', array($this, 'fix_currency_after_order_email'));
50
 
@@ -113,7 +105,7 @@ class WCML_WC_MultiCurrency{
113
  }
114
  $price = $this->convert_price_amount($price, $currency);
115
 
116
- $price = $this->apply_rounding_rules($price);
117
 
118
  return $price;
119
 
@@ -133,12 +125,28 @@ class WCML_WC_MultiCurrency{
133
 
134
  $currency_details = $woocommerce_wpml->multi_currency_support->get_currency_details_by_code( $currency );
135
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  $wc_price_args = array(
137
 
138
  'currency' => $currency,
139
  'decimal_separator' => $currency_details['decimal_sep'],
140
  'thousand_separator' => $currency_details['thousand_sep'],
141
- 'decimals' => $currency_details['num_decimals']
 
142
 
143
 
144
  );
@@ -147,7 +155,7 @@ class WCML_WC_MultiCurrency{
147
 
148
  return $price;
149
  }
150
-
151
  function apply_rounding_rules($price, $currency = false ){
152
  global $woocommerce_wpml;
153
 
@@ -244,7 +252,7 @@ class WCML_WC_MultiCurrency{
244
  }
245
 
246
  $exchange_rates = $this->get_exchange_rates();
247
-
248
  if(isset($exchange_rates[$currency]) && is_numeric($amount)){
249
  $amount = $amount * $exchange_rates[$currency];
250
 
@@ -420,7 +428,7 @@ class WCML_WC_MultiCurrency{
420
  $currencies = get_woocommerce_currencies();
421
  ?>
422
  <select id="dropdown_shop_order_currency" name="_order_currency">
423
- <option value=""><?php _e( 'Show all currencies', 'wpml-wcml' ) ?></option>
424
  <?php foreach($order_currencies as $currency => $count): ?>
425
  <option value="<?php echo $currency ?>" <?php
426
  if ( isset( $wp_query->query['_order_currency'] ) ) selected( $currency, $wp_query->query['_order_currency'] );
@@ -624,7 +632,7 @@ class WCML_WC_MultiCurrency{
624
 
625
  $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
626
  if(!$nonce || !wp_verify_nonce($nonce, 'reports_set_currency')){
627
- echo json_encode( array('error' => __('Invalid nonce', 'wpml-wcml') ) );
628
  die();
629
  }
630
 
@@ -646,7 +654,7 @@ class WCML_WC_MultiCurrency{
646
 
647
  <select id="dropdown_shop_report_currency">
648
  <?php if(empty($orders_currencies)): ?>
649
- <option value=""><?php _e('Currency - no orders found', 'wpml-wcml') ?></option>
650
  <?php else: ?>
651
  <?php foreach($orders_currencies as $currency => $count): ?>
652
  <option value="<?php echo $currency ?>" <?php selected( $currency, $this->reports_currency ); ?>>
@@ -694,7 +702,7 @@ class WCML_WC_MultiCurrency{
694
 
695
  jQuery('#dropdown_shop_order_currency').on('change', function(){
696
 
697
- if(confirm('" . esc_js(__("All the products will be removed from the current order in order to change the currency", 'wpml-wcml')). "')){
698
  jQuery.ajax({
699
  url: ajaxurl,
700
  type: 'post',
@@ -728,7 +736,7 @@ class WCML_WC_MultiCurrency{
728
  function set_order_currency(){
729
  $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
730
  if(!$nonce || !wp_verify_nonce($nonce, 'set_order_currency')){
731
- echo json_encode(array('error' => __('Invalid nonce', 'wpml-wcml')));
732
  die();
733
  }
734
  $currency = filter_input( INPUT_POST, 'currency', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
@@ -872,10 +880,15 @@ class WCML_WC_MultiCurrency{
872
 
873
 
874
  function woocommerce_product_after_variable_attributes_custom_pricing($loop, $variation_data, $variation){
 
 
 
 
 
 
 
875
 
876
- echo '<tr><td>';
877
- $this->custom_pricing_output($variation->ID);
878
- echo '</td></tr>';
879
 
880
  }
881
 
@@ -955,7 +968,7 @@ class WCML_WC_MultiCurrency{
955
 
956
  $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
957
  if(!$nonce || !wp_verify_nonce($nonce, 'dashboard_set_currency')){
958
- echo json_encode(array('error' => __('Invalid nonce', 'wpml-wcml')));
959
  die();
960
  }
961
 
@@ -1074,7 +1087,7 @@ class WCML_WC_MultiCurrency{
1074
 
1075
  $currency_details = $woocommerce_wpml->multi_currency_support->get_currency_details_by_code( $args['currency_code'] );
1076
 
1077
- $args[ $key ] = number_format( $value, $currency_details['num_decimals'], $currency_details['decimal_sep'], $currency_details['thousand_sep'] );
1078
  }
1079
  }
1080
 
@@ -1083,25 +1096,3 @@ class WCML_WC_MultiCurrency{
1083
 
1084
  }
1085
 
1086
- //@todo Move to separate file
1087
- class WCML_WC_MultiCurrency_W3TC{
1088
-
1089
- function __construct(){
1090
-
1091
- add_filter('init', array($this, 'init'), 15);
1092
-
1093
- }
1094
-
1095
- function init(){
1096
-
1097
- add_action('wcml_switch_currency', array($this, 'flush_page_cache'));
1098
-
1099
- }
1100
-
1101
- function flush_page_cache(){
1102
- w3_require_once(W3TC_LIB_W3_DIR . '/AdminActions/FlushActionsAdmin.php');
1103
- $flush = new W3_AdminActions_FlushActionsAdmin();
1104
- $flush->flush_pgcache();
1105
- }
1106
-
1107
- }
37
  add_filter('wcml_get_client_currency', array($this, 'get_client_currency'));
38
  add_filter('woocommerce_paypal_args', array($this, 'filter_price_woocommerce_paypal_args'));
39
 
 
 
 
 
 
 
 
 
40
  add_action('woocommerce_email_before_order_table', array($this, 'fix_currency_before_order_email'));
41
  add_action('woocommerce_email_after_order_table', array($this, 'fix_currency_after_order_email'));
42
 
105
  }
106
  $price = $this->convert_price_amount($price, $currency);
107
 
108
+ $price = $this->apply_rounding_rules($price, $currency);
109
 
110
  return $price;
111
 
125
 
126
  $currency_details = $woocommerce_wpml->multi_currency_support->get_currency_details_by_code( $currency );
127
 
128
+ switch ( $currency_details[ 'position' ] ) {
129
+ case 'left' :
130
+ $format = '%1$s%2$s';
131
+ break;
132
+ case 'right' :
133
+ $format = '%2$s%1$s';
134
+ break;
135
+ case 'left_space' :
136
+ $format = '%1$s&nbsp;%2$s';
137
+ break;
138
+ case 'right_space' :
139
+ $format = '%2$s&nbsp;%1$s';
140
+ break;
141
+ }
142
+
143
  $wc_price_args = array(
144
 
145
  'currency' => $currency,
146
  'decimal_separator' => $currency_details['decimal_sep'],
147
  'thousand_separator' => $currency_details['thousand_sep'],
148
+ 'decimals' => $currency_details['num_decimals'],
149
+ 'price_format' => $format,
150
 
151
 
152
  );
155
 
156
  return $price;
157
  }
158
+
159
  function apply_rounding_rules($price, $currency = false ){
160
  global $woocommerce_wpml;
161
 
252
  }
253
 
254
  $exchange_rates = $this->get_exchange_rates();
255
+
256
  if(isset($exchange_rates[$currency]) && is_numeric($amount)){
257
  $amount = $amount * $exchange_rates[$currency];
258
 
428
  $currencies = get_woocommerce_currencies();
429
  ?>
430
  <select id="dropdown_shop_order_currency" name="_order_currency">
431
+ <option value=""><?php _e( 'Show all currencies', 'woocommerce-multilingual' ) ?></option>
432
  <?php foreach($order_currencies as $currency => $count): ?>
433
  <option value="<?php echo $currency ?>" <?php
434
  if ( isset( $wp_query->query['_order_currency'] ) ) selected( $currency, $wp_query->query['_order_currency'] );
632
 
633
  $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
634
  if(!$nonce || !wp_verify_nonce($nonce, 'reports_set_currency')){
635
+ echo json_encode( array('error' => __('Invalid nonce', 'woocommerce-multilingual') ) );
636
  die();
637
  }
638
 
654
 
655
  <select id="dropdown_shop_report_currency">
656
  <?php if(empty($orders_currencies)): ?>
657
+ <option value=""><?php _e('Currency - no orders found', 'woocommerce-multilingual') ?></option>
658
  <?php else: ?>
659
  <?php foreach($orders_currencies as $currency => $count): ?>
660
  <option value="<?php echo $currency ?>" <?php selected( $currency, $this->reports_currency ); ?>>
702
 
703
  jQuery('#dropdown_shop_order_currency').on('change', function(){
704
 
705
+ if(confirm('" . esc_js(__("All the products will be removed from the current order in order to change the currency", 'woocommerce-multilingual')). "')){
706
  jQuery.ajax({
707
  url: ajaxurl,
708
  type: 'post',
736
  function set_order_currency(){
737
  $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
738
  if(!$nonce || !wp_verify_nonce($nonce, 'set_order_currency')){
739
+ echo json_encode(array('error' => __('Invalid nonce', 'woocommerce-multilingual')));
740
  die();
741
  }
742
  $currency = filter_input( INPUT_POST, 'currency', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
880
 
881
 
882
  function woocommerce_product_after_variable_attributes_custom_pricing($loop, $variation_data, $variation){
883
+ global $woocommerce_wpml;
884
+
885
+ if( $woocommerce_wpml->products->is_original_product( $variation->post_parent ) ) {
886
+
887
+ echo '<tr><td>';
888
+ $this->custom_pricing_output( $variation->ID );
889
+ echo '</td></tr>';
890
 
891
+ }
 
 
892
 
893
  }
894
 
968
 
969
  $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
970
  if(!$nonce || !wp_verify_nonce($nonce, 'dashboard_set_currency')){
971
+ echo json_encode(array('error' => __('Invalid nonce', 'woocommerce-multilingual')));
972
  die();
973
  }
974
 
1087
 
1088
  $currency_details = $woocommerce_wpml->multi_currency_support->get_currency_details_by_code( $args['currency_code'] );
1089
 
1090
+ $args[ $key ] = number_format( $value, $currency_details['num_decimals'], '.', '' );
1091
  }
1092
  }
1093
 
1096
 
1097
  }
1098
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/orders.class.php CHANGED
@@ -37,20 +37,16 @@ class WCML_Orders{
37
 
38
  function filtered_woocommerce_new_order_note_data($translations, $text, $domain ){
39
  if(in_array($text,$this->standart_order_notes)){
40
- global $sitepress_settings,$wpdb;
41
 
42
- if ( WPML_SUPPORT_STRINGS_IN_DIFF_LANG ) {
43
- $string_id = $wpdb->get_var($wpdb->prepare("SELECT st.id FROM {$wpdb->prefix}icl_strings as st LEFT JOIN {$wpdb->prefix}icl_string_contexts as cn ON st.context_id = cn.id WHERE cn.context = %s AND st.value = %s ", $domain, $text ));
44
- $language = icl_st_get_string_language( $string_id );
45
- }else{
46
- $string_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM {$wpdb->prefix}icl_strings WHERE language = %s AND value = %s ", $sitepress_settings['st']['strings_language'], $text));
47
- $language = $sitepress_settings['st']['strings_language'];
48
- }
49
 
50
- if( $string_id && $sitepress_settings['admin_default_language'] != $language ){
51
- $string = $wpdb->get_var($wpdb->prepare("SELECT value FROM {$wpdb->prefix}icl_string_translations WHERE string_id = %s and language = %s", $string_id, $sitepress_settings['admin_default_language']));
52
- if($string){
53
- $translations = $string;
 
 
54
  }
55
  }else{
56
  return $text;
@@ -66,22 +62,18 @@ class WCML_Orders{
66
 
67
  if( $user_id ){
68
 
69
- global $sitepress_settings, $wpdb;
70
 
71
  $user_language = get_user_meta( $user_id, 'icl_admin_language', true );
72
 
73
  foreach($comments as $key=>$comment){
74
 
75
- if ( WPML_SUPPORT_STRINGS_IN_DIFF_LANG ) {
76
- $comment_string_id = $wpdb->get_var($wpdb->prepare("SELECT st.id FROM {$wpdb->prefix}icl_strings as st LEFT JOIN {$wpdb->prefix}icl_string_contexts as cn ON st.context_id = cn.id WHERE st.value = %s ", $comment->comment_content));
77
- }else{
78
- $comment_string_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM {$wpdb->prefix}icl_strings WHERE language = %s AND value = %s ", $sitepress_settings['st']['strings_language'], $comment->comment_content));
79
- }
80
 
81
  if($comment_string_id){
82
- $comment_string = $wpdb->get_var($wpdb->prepare("SELECT value FROM {$wpdb->prefix}icl_string_translations WHERE string_id = %s and language = %s", $comment_string_id, $user_language));
83
- if($comment_string){
84
- $comments[$key]->comment_content = $comment_string;
85
  }
86
  }
87
  }
@@ -203,7 +195,7 @@ class WCML_Orders{
203
  var order_lang_current_value = jQuery('#dropdown_shop_order_language option:selected').val();
204
 
205
  jQuery('#dropdown_shop_order_language').on('change', function(){
206
- if(confirm('" . esc_js(__("All the products will be removed from the current order in order to change the language", 'wpml-wcml')). "')){
207
  var lang = jQuery(this).val();
208
 
209
  jQuery.ajax({
@@ -232,7 +224,7 @@ class WCML_Orders{
232
  function order_delete_items(){
233
  $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
234
  if(!$nonce || !wp_verify_nonce($nonce, 'set_dashboard_order_language')){
235
- echo json_encode(array('error' => __('Invalid nonce', 'wpml-wcml')));
236
  die();
237
  }
238
 
37
 
38
  function filtered_woocommerce_new_order_note_data($translations, $text, $domain ){
39
  if(in_array($text,$this->standart_order_notes)){
40
+ global $sitepress_settings, $wpdb, $woocommerce_wpml;
41
 
42
+ $language = $woocommerce_wpml->strings->get_string_language( $text, 'woocommerce' );
 
 
 
 
 
 
43
 
44
+ if( $sitepress_settings['admin_default_language'] != $language ){
45
+
46
+ $string_id = icl_get_string_id( $text, 'woocommerce');
47
+ $strings = icl_get_string_translations_by_id( $string_id );
48
+ if($strings){
49
+ $translations = $strings[ $sitepress_settings['admin_default_language'] ];
50
  }
51
  }else{
52
  return $text;
62
 
63
  if( $user_id ){
64
 
65
+ global $wpdb, $woocommerce_wpml;
66
 
67
  $user_language = get_user_meta( $user_id, 'icl_admin_language', true );
68
 
69
  foreach($comments as $key=>$comment){
70
 
71
+ $comment_string_id = icl_get_string_id( $comment->comment_content, 'woocommerce');
 
 
 
 
72
 
73
  if($comment_string_id){
74
+ $comment_strings = icl_get_string_translations_by_id( $comment_string_id );
75
+ if($comment_strings){
76
+ $comments[$key]->comment_content = $comment_strings[$user_language]['value'];
77
  }
78
  }
79
  }
195
  var order_lang_current_value = jQuery('#dropdown_shop_order_language option:selected').val();
196
 
197
  jQuery('#dropdown_shop_order_language').on('change', function(){
198
+ if(confirm('" . esc_js(__("All the products will be removed from the current order in order to change the language", 'woocommerce-multilingual')). "')){
199
  var lang = jQuery(this).val();
200
 
201
  jQuery.ajax({
224
  function order_delete_items(){
225
  $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
226
  if(!$nonce || !wp_verify_nonce($nonce, 'set_dashboard_order_language')){
227
+ echo json_encode(array('error' => __('Invalid nonce', 'woocommerce-multilingual')));
228
  die();
229
  }
230
 
inc/products.class.php CHANGED
@@ -52,7 +52,9 @@ class WCML_Products{
52
  add_filter( 'post_row_actions', array( $this, 'filter_product_actions' ), 10, 2 );
53
 
54
  add_filter ( 'locale',array( $this, 'update_product_action_locale_check' ) );
55
-
 
 
56
  }else{
57
  add_filter('woocommerce_json_search_found_products', array($this, 'filter_found_products_by_language'));
58
  add_filter( 'loop_shop_post_in', array( $this, 'filter_products_with_custom_prices' ), 100 );
@@ -93,8 +95,6 @@ class WCML_Products{
93
  add_action( 'wp_ajax_wpml_tt_save_term_translation', array( $this, 'update_taxonomy_in_variations' ), 7 );
94
 
95
  add_action( 'wp_ajax_woocommerce_remove_variation', array( $this, 'remove_variation_ajax' ), 9 );
96
- //WooCommerce subscription
97
- add_filter( 'woocommerce_users_subscriptions', array( $this, 'woocommerce_users_subscriptions' ), 10, 2 );
98
 
99
  // cart functions
100
  add_action( 'woocommerce_get_cart_item_from_session', array( $this, 'translate_cart_contents' ), 10, 3 );
@@ -418,7 +418,7 @@ class WCML_Products{
418
  function update_product_actions() {
419
  $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
420
  if(!$nonce || !wp_verify_nonce($nonce, 'update_product_actions')){
421
- echo json_encode(array('error' => __('Invalid nonce', 'wpml-wcml')));
422
  die();
423
  }
424
 
@@ -435,7 +435,7 @@ class WCML_Products{
435
  $orig_product = get_post($original_product_id);
436
 
437
  if (!$data['title_' . $language]) {
438
- echo json_encode(array('error' => __('Title missing', 'wpml-wcml')));
439
  die();
440
  }
441
 
@@ -920,27 +920,27 @@ class WCML_Products{
920
  if( $job_language && $language['code'] != $job_language ) {
921
  continue;
922
  }elseif(isset($product_translations[$language['code']]) && $product_translations[$language['code']]->original){
923
- $alt = __('Original language','wpml-wcml');
924
  echo '<i title="'. $alt .'" class="stat_img icon-minus"></i>';
925
  }elseif ($slang != $language['code'] && (!isset($_POST['translation_status_lang']) || (isset($_POST['translation_status_lang']) && ($_POST['translation_status_lang'] == $language['code']) || $_POST['translation_status_lang']==''))) {
926
 
927
  if (isset($product_translations[$language['code']])) {
928
  $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));
929
  if(!$tr_status){
930
- $alt = __('Not translated','wpml-wcml');
931
  echo '<i title="'. $alt .'" class="stat_img icon-warning-sign"></i>';
932
  }elseif($tr_status->needs_update){
933
- $alt = __('Not translated - needs update','wpml-wcml');
934
  echo '<i title="'. $alt .'" class="stat_img icon-repeat"></i>';
935
  }elseif($tr_status->status != ICL_TM_COMPLETE && $tr_status->status != ICL_TM_DUPLICATE) {
936
- $alt = __('In progress','wpml-wcml');
937
  echo '<i title="'. $alt .'" class="stat_img icon-spinner"></i>';
938
  }elseif($tr_status->status == ICL_TM_COMPLETE || $tr_status->status == ICL_TM_DUPLICATE){
939
- $alt = __('Complete','wpml-wcml');
940
  echo '<i title="'. $alt .'" class="stat_img icon-ok"></i>';
941
  }
942
  } else {
943
- $alt = __('Not translated','wpml-wcml');
944
  echo '<i title="'. $alt .'" class="stat_img icon-warning-sign"></i>';
945
  }
946
  }
@@ -1338,7 +1338,7 @@ class WCML_Products{
1338
 
1339
  function inf_editing_product_in_non_default_lang(){
1340
  $message = '<div class="message error"><p>';
1341
- $message .= sprintf(__('The recommended way to translate WooCommerce products is using the <b><a href="%s">WooCommerce Multilingual products translation</a></b> page. Please use this page only for translating elements that are not available in the WooCommerce Multilingual products translation table.', 'wpml-wcml'), admin_url('admin.php?page=wpml-wcml&tab=products'));
1342
  $message .= '</p></div>';
1343
 
1344
  echo $message;
@@ -1350,7 +1350,7 @@ class WCML_Products{
1350
  $new_actions = array();
1351
  foreach($actions as $key => $action){
1352
  if($key == 'inline hide-if-no-js'){
1353
- $new_actions['quick_hide'] = '<a href="#TB_inline?width=200&height=150&inlineId=quick_edit_notice" class="thickbox" title="'.__('Edit this item inline','wpml-wcml').'">'.__('Quick Edit','wpml-wcml').'</a>';
1354
  }else{
1355
  $new_actions[$key] = $action;
1356
  }
@@ -1638,6 +1638,8 @@ class WCML_Products{
1638
  foreach ( $translations as $translation ) {
1639
  if ( !$translation->original ) {
1640
  $this->sync_product_variations($product_id, $translation->element_id, $translation->language_code);
 
 
1641
  }
1642
  }
1643
 
@@ -1843,40 +1845,40 @@ class WCML_Products{
1843
  }
1844
 
1845
 
1846
- function sync_default_product_attr($orig_post_id,$transl_post_id,$lang){
1847
  global $wpdb;
1848
- $original_default_attributes = get_post_meta($orig_post_id, '_default_attributes', TRUE);
1849
- if(!empty($original_default_attributes)){
1850
  $unserialized_default_attributes = array();
1851
- foreach(maybe_unserialize($original_default_attributes) as $attribute => $default_term_slug){
1852
  // get the correct language
1853
- if (substr($attribute, 0, 3) == 'pa_') {
1854
  //attr is taxonomy
1855
  $default_term_id = $this->wcml_get_term_id_by_slug( $attribute, $default_term_slug );
1856
- $tr_id = apply_filters( 'translate_object_id',$default_term_id, $attribute, false, $lang);
1857
 
1858
- if($tr_id){
1859
  $translated_term = $this->wcml_get_term_by_id( $tr_id, $attribute );
1860
  $unserialized_default_attributes[$attribute] = $translated_term->slug;
1861
  }
1862
  }else{
1863
  //custom attr
1864
- $orig_product_attributes = get_post_meta($orig_post_id, '_product_attributes', true);
1865
- $unserialized_orig_product_attributes = maybe_unserialize($orig_product_attributes);
1866
- if(isset($unserialized_orig_product_attributes[$attribute])){
1867
- $orig_attr_values = explode('|',$unserialized_orig_product_attributes[$attribute]['value']);
1868
- foreach($orig_attr_values as $key=>$orig_attr_value){
1869
  $orig_attr_value_sanitized = strtolower( sanitize_title ( $orig_attr_value ) );
1870
- if( $orig_attr_value_sanitized == $default_term_slug || trim($orig_attr_value) == trim($default_term_slug) ){
1871
- $tnsl_product_attributes = get_post_meta($transl_post_id, '_product_attributes', true);
1872
- $unserialized_tnsl_product_attributes = maybe_unserialize($tnsl_product_attributes);
1873
- if(isset($unserialized_tnsl_product_attributes[$attribute])){
1874
- $trnsl_attr_values = explode('|',$unserialized_tnsl_product_attributes[$attribute]['value']);
1875
 
1876
  if( $orig_attr_value_sanitized == $default_term_slug ){
1877
  $trnsl_attr_value = strtolower( sanitize_title( trim( $trnsl_attr_values[$key] ) ) );
1878
  }else{
1879
- $trnsl_attr_value = trim($trnsl_attr_values[$key]);
1880
  }
1881
 
1882
  $unserialized_default_attributes[$attribute] = $trnsl_attr_value;
@@ -1887,10 +1889,13 @@ class WCML_Products{
1887
  }
1888
  }
1889
 
1890
- $data = array('meta_value' => maybe_serialize($unserialized_default_attributes));
1891
- $where = array('post_id' => $transl_post_id, 'meta_key' => '_default_attributes');
1892
- $wpdb->update($wpdb->postmeta, $data, $where);
1893
  }
 
 
 
1894
  }
1895
 
1896
  /*
@@ -1969,17 +1974,17 @@ class WCML_Products{
1969
  global $woocommerce_wpml;
1970
 
1971
  $contents = array();
1972
- $contents[] = __('Title','wpml-wcml');
1973
- $contents[] = __('Content / Description','wpml-wcml');
1974
- $contents[] = __('Excerpt','wpml-wcml');
1975
- $contents[] = __('Images','wpml-wcml');
1976
 
1977
  foreach(wp_get_post_terms($product_id, 'product_type', array("fields" => "names")) as $type){
1978
  $product_type = $type;
1979
  }
1980
 
1981
  if(!$woocommerce_wpml->settings['file_path_sync'] && isset($product_type) && $product_type == 'variable'){
1982
- $contents[] = __('Variations','wpml-wcml');
1983
  }
1984
 
1985
  global $sitepress,$wpseo_metabox;
@@ -2119,11 +2124,11 @@ class WCML_Products{
2119
  $attr_name = str_replace('_','',$tr_product_attr[$attribute]['name']);
2120
  }
2121
 
2122
- $label = sprintf(__('Any %s','wpml-wcml'),$attr_name);
2123
  $variables['label'] .= $label.' & ';
2124
  continue;
2125
  }else{
2126
- $label = __('Please translate all attributes','wpml-wcml');
2127
  $variables['label'] .= $label.' & ';
2128
  $variables['not_translated'] = true;
2129
  continue;
@@ -2572,20 +2577,6 @@ class WCML_Products{
2572
  return $settings;
2573
  }
2574
 
2575
-
2576
- /*
2577
- * Filter for WooCommerce subscriptions
2578
- */
2579
- function woocommerce_users_subscriptions($subscriptions, $user_id){
2580
- global $sitepress;
2581
-
2582
- foreach($subscriptions as $key=>$subscription){
2583
- $subscriptions[$key]['product_id'] = apply_filters( 'translate_object_id',$subscriptions[$key]['product_id'],get_post_type($subscriptions[$key]['product_id']),true,$sitepress->get_current_language());
2584
- }
2585
-
2586
- return $subscriptions;
2587
- }
2588
-
2589
  /*
2590
  * Update cart and cart session when switch language
2591
  */
@@ -2897,6 +2888,8 @@ class WCML_Products{
2897
  if( $orig_id == $post->ID ){
2898
  $sitepress->set_element_language_details($new_id, 'post_' . $post->post_type, false, $orig_lang);
2899
  $new_trid = $sitepress->get_element_trid( $new_id, 'post_' . $post->post_type );
 
 
2900
  }else{
2901
  $post_to_duplicate = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID=%d", $orig_id ));
2902
 
@@ -2907,6 +2900,7 @@ class WCML_Products{
2907
 
2908
  $sitepress->set_element_language_details( $new_orig_id, 'post_' . $post->post_type, false, $orig_lang );
2909
  $new_trid = $sitepress->get_element_trid( $new_orig_id, 'post_' . $post->post_type );
 
2910
 
2911
  $sitepress->set_element_language_details( $new_id, 'post_' . $post->post_type, $new_trid, $sitepress->get_current_language() );
2912
  }
@@ -2924,9 +2918,15 @@ class WCML_Products{
2924
  if ( ! empty( $post_to_duplicate ) ) {
2925
  $new_id = $wc_admin->duplicate_product( $post_to_duplicate );
2926
 
 
 
 
 
2927
  do_action( 'wcml_after_duplicate_product' , $new_id, $post_to_duplicate );
2928
 
2929
  $sitepress->set_element_language_details( $new_id, 'post_' . $post->post_type, $new_trid, $translation->language_code );
 
 
2930
  }
2931
  }
2932
  }
@@ -3036,7 +3036,7 @@ class WCML_Products{
3036
  function product_data_html(){
3037
  $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
3038
  if(!$nonce || !wp_verify_nonce($nonce, 'wcml_product_data')){
3039
- echo json_encode(array('error' => __('Invalid nonce', 'wpml-wcml')));
3040
  die();
3041
  }
3042
  global $woocommerce_wpml,$sitepress,$wpdb,$iclTranslationManagement;
@@ -3260,6 +3260,15 @@ class WCML_Products{
3260
  return $args;
3261
  }
3262
 
 
 
 
 
 
 
 
 
 
3263
  /*
3264
  * Use custom query, because get_term_by function return false for terms with "0" slug *
3265
  */
@@ -3275,7 +3284,6 @@ class WCML_Products{
3275
  }
3276
 
3277
  function lock_variable_fields( $loop, $variation_data, $variation ){
3278
- global $woocommerce_wpml;
3279
 
3280
  $product_id = false;
3281
  if( ( isset( $_GET['post'] ) && get_post_type( $_GET['post'] ) == 'product' ) ){
@@ -3286,7 +3294,7 @@ class WCML_Products{
3286
 
3287
  if( !$product_id ){
3288
  return;
3289
- }elseif( !$woocommerce_wpml->products->is_original_product( $product_id ) ){ ?>
3290
  <script type="text/javascript">
3291
  jQuery(document).ready(function() {
3292
  wcml_lock_variation_fields();
52
  add_filter( 'post_row_actions', array( $this, 'filter_product_actions' ), 10, 2 );
53
 
54
  add_filter ( 'locale',array( $this, 'update_product_action_locale_check' ) );
55
+
56
+ add_filter( 'wpml_translation_job_post_meta_value_translated', array($this, 'filter_product_attributes_for_translation'), 10, 2 );
57
+
58
  }else{
59
  add_filter('woocommerce_json_search_found_products', array($this, 'filter_found_products_by_language'));
60
  add_filter( 'loop_shop_post_in', array( $this, 'filter_products_with_custom_prices' ), 100 );
95
  add_action( 'wp_ajax_wpml_tt_save_term_translation', array( $this, 'update_taxonomy_in_variations' ), 7 );
96
 
97
  add_action( 'wp_ajax_woocommerce_remove_variation', array( $this, 'remove_variation_ajax' ), 9 );
 
 
98
 
99
  // cart functions
100
  add_action( 'woocommerce_get_cart_item_from_session', array( $this, 'translate_cart_contents' ), 10, 3 );
418
  function update_product_actions() {
419
  $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
420
  if(!$nonce || !wp_verify_nonce($nonce, 'update_product_actions')){
421
+ echo json_encode(array('error' => __('Invalid nonce', 'woocommerce-multilingual')));
422
  die();
423
  }
424
 
435
  $orig_product = get_post($original_product_id);
436
 
437
  if (!$data['title_' . $language]) {
438
+ echo json_encode(array('error' => __('Title missing', 'woocommerce-multilingual')));
439
  die();
440
  }
441
 
920
  if( $job_language && $language['code'] != $job_language ) {
921
  continue;
922
  }elseif(isset($product_translations[$language['code']]) && $product_translations[$language['code']]->original){
923
+ $alt = __('Original language', 'woocommerce-multilingual');
924
  echo '<i title="'. $alt .'" class="stat_img icon-minus"></i>';
925
  }elseif ($slang != $language['code'] && (!isset($_POST['translation_status_lang']) || (isset($_POST['translation_status_lang']) && ($_POST['translation_status_lang'] == $language['code']) || $_POST['translation_status_lang']==''))) {
926
 
927
  if (isset($product_translations[$language['code']])) {
928
  $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));
929
  if(!$tr_status){
930
+ $alt = __('Not translated', 'woocommerce-multilingual');
931
  echo '<i title="'. $alt .'" class="stat_img icon-warning-sign"></i>';
932
  }elseif($tr_status->needs_update){
933
+ $alt = __('Not translated - needs update', 'woocommerce-multilingual');
934
  echo '<i title="'. $alt .'" class="stat_img icon-repeat"></i>';
935
  }elseif($tr_status->status != ICL_TM_COMPLETE && $tr_status->status != ICL_TM_DUPLICATE) {
936
+ $alt = __('In progress', 'woocommerce-multilingual');
937
  echo '<i title="'. $alt .'" class="stat_img icon-spinner"></i>';
938
  }elseif($tr_status->status == ICL_TM_COMPLETE || $tr_status->status == ICL_TM_DUPLICATE){
939
+ $alt = __('Complete', 'woocommerce-multilingual');
940
  echo '<i title="'. $alt .'" class="stat_img icon-ok"></i>';
941
  }
942
  } else {
943
+ $alt = __('Not translated', 'woocommerce-multilingual');
944
  echo '<i title="'. $alt .'" class="stat_img icon-warning-sign"></i>';
945
  }
946
  }
1338
 
1339
  function inf_editing_product_in_non_default_lang(){
1340
  $message = '<div class="message error"><p>';
1341
+ $message .= sprintf(__('The recommended way to translate WooCommerce products is using the <b><a href="%s">WooCommerce Multilingual products translation</a></b> page. Please use this page only for translating elements that are not available in the WooCommerce Multilingual products translation table.', 'woocommerce-multilingual'), admin_url('admin.php?page=wpml-wcml&tab=products'));
1342
  $message .= '</p></div>';
1343
 
1344
  echo $message;
1350
  $new_actions = array();
1351
  foreach($actions as $key => $action){
1352
  if($key == 'inline hide-if-no-js'){
1353
+ $new_actions['quick_hide'] = '<a href="#TB_inline?width=200&height=150&inlineId=quick_edit_notice" class="thickbox" title="'.__('Edit this item inline', 'woocommerce-multilingual').'">'.__('Quick Edit', 'woocommerce-multilingual').'</a>';
1354
  }else{
1355
  $new_actions[$key] = $action;
1356
  }
1638
  foreach ( $translations as $translation ) {
1639
  if ( !$translation->original ) {
1640
  $this->sync_product_variations($product_id, $translation->element_id, $translation->language_code);
1641
+
1642
+ $this->sync_default_product_attr($product_id, $translation->element_id, $translation->language_code);
1643
  }
1644
  }
1645
 
1845
  }
1846
 
1847
 
1848
+ function sync_default_product_attr( $orig_post_id, $transl_post_id, $lang ){
1849
  global $wpdb;
1850
+ $original_default_attributes = get_post_meta( $orig_post_id, '_default_attributes', true );
1851
+ if( !empty( $original_default_attributes ) ){
1852
  $unserialized_default_attributes = array();
1853
+ foreach(maybe_unserialize( $original_default_attributes ) as $attribute => $default_term_slug ){
1854
  // get the correct language
1855
+ if ( substr( $attribute, 0, 3 ) == 'pa_' ) {
1856
  //attr is taxonomy
1857
  $default_term_id = $this->wcml_get_term_id_by_slug( $attribute, $default_term_slug );
1858
+ $tr_id = apply_filters( 'translate_object_id', $default_term_id, $attribute, false, $lang );
1859
 
1860
+ if( $tr_id ){
1861
  $translated_term = $this->wcml_get_term_by_id( $tr_id, $attribute );
1862
  $unserialized_default_attributes[$attribute] = $translated_term->slug;
1863
  }
1864
  }else{
1865
  //custom attr
1866
+ $orig_product_attributes = get_post_meta( $orig_post_id, '_product_attributes', true );
1867
+ $unserialized_orig_product_attributes = maybe_unserialize( $orig_product_attributes );
1868
+ if( isset( $unserialized_orig_product_attributes[$attribute] ) ){
1869
+ $orig_attr_values = explode( '|', $unserialized_orig_product_attributes[$attribute]['value'] );
1870
+ foreach( $orig_attr_values as $key=>$orig_attr_value ){
1871
  $orig_attr_value_sanitized = strtolower( sanitize_title ( $orig_attr_value ) );
1872
+ if( $orig_attr_value_sanitized == $default_term_slug || trim( $orig_attr_value ) == trim( $default_term_slug ) ){
1873
+ $tnsl_product_attributes = get_post_meta( $transl_post_id, '_product_attributes', true );
1874
+ $unserialized_tnsl_product_attributes = maybe_unserialize( $tnsl_product_attributes );
1875
+ if( isset( $unserialized_tnsl_product_attributes[$attribute] ) ){
1876
+ $trnsl_attr_values = explode( '|', $unserialized_tnsl_product_attributes[$attribute]['value'] );
1877
 
1878
  if( $orig_attr_value_sanitized == $default_term_slug ){
1879
  $trnsl_attr_value = strtolower( sanitize_title( trim( $trnsl_attr_values[$key] ) ) );
1880
  }else{
1881
+ $trnsl_attr_value = trim( $trnsl_attr_values[$key] );
1882
  }
1883
 
1884
  $unserialized_default_attributes[$attribute] = $trnsl_attr_value;
1889
  }
1890
  }
1891
 
1892
+ $data = array( 'meta_value' => maybe_serialize( $unserialized_default_attributes ) );
1893
+ }else{
1894
+ $data = array( 'meta_value' => maybe_serialize( array() ) );
1895
  }
1896
+
1897
+ $where = array( 'post_id' => $transl_post_id, 'meta_key' => '_default_attributes' );
1898
+ $wpdb->update( $wpdb->postmeta, $data, $where );
1899
  }
1900
 
1901
  /*
1974
  global $woocommerce_wpml;
1975
 
1976
  $contents = array();
1977
+ $contents[] = __('Title', 'woocommerce-multilingual');
1978
+ $contents[] = __('Content / Description', 'woocommerce-multilingual');
1979
+ $contents[] = __('Excerpt', 'woocommerce-multilingual');
1980
+ $contents[] = __('Images', 'woocommerce-multilingual');
1981
 
1982
  foreach(wp_get_post_terms($product_id, 'product_type', array("fields" => "names")) as $type){
1983
  $product_type = $type;
1984
  }
1985
 
1986
  if(!$woocommerce_wpml->settings['file_path_sync'] && isset($product_type) && $product_type == 'variable'){
1987
+ $contents[] = __('Variations', 'woocommerce-multilingual');
1988
  }
1989
 
1990
  global $sitepress,$wpseo_metabox;
2124
  $attr_name = str_replace('_','',$tr_product_attr[$attribute]['name']);
2125
  }
2126
 
2127
+ $label = sprintf(__('Any %s', 'woocommerce-multilingual'),$attr_name);
2128
  $variables['label'] .= $label.' & ';
2129
  continue;
2130
  }else{
2131
+ $label = __('Please translate all attributes', 'woocommerce-multilingual');
2132
  $variables['label'] .= $label.' & ';
2133
  $variables['not_translated'] = true;
2134
  continue;
2577
  return $settings;
2578
  }
2579
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2580
  /*
2581
  * Update cart and cart session when switch language
2582
  */
2888
  if( $orig_id == $post->ID ){
2889
  $sitepress->set_element_language_details($new_id, 'post_' . $post->post_type, false, $orig_lang);
2890
  $new_trid = $sitepress->get_element_trid( $new_id, 'post_' . $post->post_type );
2891
+
2892
+ $new_orig_id = $new_id;
2893
  }else{
2894
  $post_to_duplicate = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID=%d", $orig_id ));
2895
 
2900
 
2901
  $sitepress->set_element_language_details( $new_orig_id, 'post_' . $post->post_type, false, $orig_lang );
2902
  $new_trid = $sitepress->get_element_trid( $new_orig_id, 'post_' . $post->post_type );
2903
+ update_post_meta( $new_id, '_icl_lang_duplicate_of', $new_orig_id );
2904
 
2905
  $sitepress->set_element_language_details( $new_id, 'post_' . $post->post_type, $new_trid, $sitepress->get_current_language() );
2906
  }
2918
  if ( ! empty( $post_to_duplicate ) ) {
2919
  $new_id = $wc_admin->duplicate_product( $post_to_duplicate );
2920
 
2921
+ $new_id_obj = get_post( $new_id );
2922
+ $new_slug = wp_unique_post_slug( sanitize_title( $new_id_obj->post_title ), $new_id, $post_to_duplicate->post_status, $post_to_duplicate->post_type, $new_id_obj->post_parent );
2923
+ $wpdb->update( $wpdb->posts, array( 'post_name' => $new_slug ), array( 'ID' => $new_id ) );
2924
+
2925
  do_action( 'wcml_after_duplicate_product' , $new_id, $post_to_duplicate );
2926
 
2927
  $sitepress->set_element_language_details( $new_id, 'post_' . $post->post_type, $new_trid, $translation->language_code );
2928
+
2929
+ update_post_meta( $new_id, '_icl_lang_duplicate_of', $new_orig_id );
2930
  }
2931
  }
2932
  }
3036
  function product_data_html(){
3037
  $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
3038
  if(!$nonce || !wp_verify_nonce($nonce, 'wcml_product_data')){
3039
+ echo json_encode(array('error' => __('Invalid nonce', 'woocommerce-multilingual')));
3040
  die();
3041
  }
3042
  global $woocommerce_wpml,$sitepress,$wpdb,$iclTranslationManagement;
3260
  return $args;
3261
  }
3262
 
3263
+ function filter_product_attributes_for_translation( $translated, $key ){
3264
+
3265
+ $translated = $translated
3266
+ ? preg_match('#^(?!field-_product_attributes-(.+)-(.+)-(?!value|name))#', $key) : 0;
3267
+
3268
+ return $translated;
3269
+
3270
+ }
3271
+
3272
  /*
3273
  * Use custom query, because get_term_by function return false for terms with "0" slug *
3274
  */
3284
  }
3285
 
3286
  function lock_variable_fields( $loop, $variation_data, $variation ){
 
3287
 
3288
  $product_id = false;
3289
  if( ( isset( $_GET['post'] ) && get_post_type( $_GET['post'] ) == 'product' ) ){
3294
 
3295
  if( !$product_id ){
3296
  return;
3297
+ }elseif( !$this->is_original_product( $product_id ) ){ ?>
3298
  <script type="text/javascript">
3299
  jQuery(document).ready(function() {
3300
  wcml_lock_variation_fields();
inc/store-pages.class.php CHANGED
@@ -71,8 +71,8 @@ class WCML_Store_Pages{
71
  }
72
 
73
  if( $sitepress->get_default_language() != 'en' ){
74
- $page['name'] = $woocommerce_wpml->terms->get_translation_from_woocommerce_mo_file( 'Page slug'.$page['name'], $default_language );
75
- $page['title'] = $woocommerce_wpml->terms->get_translation_from_woocommerce_mo_file( 'Page title'.$page['title'], $default_language );
76
  }
77
  }
78
  }
@@ -250,10 +250,10 @@ class WCML_Store_Pages{
250
  global $sitepress;
251
  if ($sitepress->get_default_language() != $sitepress->get_current_language()) {
252
  if (!empty($q->query_vars['pagename'])) {
253
- $shop_page = get_post( woocommerce_get_page_id('shop') );
254
  // we should explode by / for children page
255
  $query_var_page = explode('/',$q->query_vars['pagename']);
256
- if (isset($shop_page->post_name) && $shop_page->post_name == $query_var_page[count($query_var_page)-1]) {
257
  unset($q->query_vars['page']);
258
  unset($q->query_vars['pagename']);
259
  $q->query_vars['post_type'] = 'product';
@@ -270,17 +270,17 @@ class WCML_Store_Pages{
270
  $miss_lang = $this->get_missing_store_pages();
271
 
272
  //dummy array for names
273
- $names = array( __('Cart','wpml-wcml'),
274
- __('Checkout','wpml-wcml'),
275
- __('Checkout &rarr; Pay','wpml-wcml'),
276
- __('Order Received','wpml-wcml'),
277
- __('My Account','wpml-wcml'),
278
- __('Change Password','wpml-wcml'),
279
- __('Edit My Address','wpml-wcml'),
280
- __('Logout','wpml-wcml'),
281
- __('Lost Password','wpml-wcml'),
282
- __('View Order','wpml-wcml'),
283
- __('Shop','wpml-wcml'));
284
 
285
  if (isset($miss_lang['codes'])) {
286
  $wp_rewrite = new WP_Rewrite();
@@ -294,9 +294,9 @@ class WCML_Store_Pages{
294
  foreach ($miss_lang['codes'] as $mis_lang) {
295
  $args = array();
296
 
297
- unload_textdomain('wpml-wcml');
298
  $sitepress->switch_lang($mis_lang);
299
- load_textdomain( 'wpml-wcml', WCML_LOCALE_PATH . '/wpml-wcml-' . $sitepress->get_locale( $mis_lang ) . '.mo' );
300
 
301
  foreach ($check_pages as $page) {
302
  $orig_id = get_option($page);
@@ -308,19 +308,19 @@ class WCML_Store_Pages{
308
 
309
  switch( $page ){
310
  case 'woocommerce_shop_page_id':
311
- $page_title = __( 'Shop', 'wpml-wcml');
312
  break;
313
  case 'woocommerce_cart_page_id':
314
- $page_title = __( 'Cart', 'wpml-wcml');
315
  break;
316
  case 'woocommerce_checkout_page_id':
317
- $page_title = __( 'Checkout', 'wpml-wcml');
318
  break;
319
  case 'woocommerce_myaccount_page_id':
320
- $page_title = __( 'My Account', 'wpml-wcml');
321
  break;
322
  default:
323
- $page_title = __( $orig_page->post_title, 'wpml-wcml');
324
  break;
325
  }
326
 
@@ -350,9 +350,9 @@ class WCML_Store_Pages{
350
 
351
  }
352
  }
353
- unload_textdomain('wpml-wcml');
354
  $sitepress->switch_lang($default_language);
355
- load_textdomain( 'wpml-wcml', WCML_LOCALE_PATH . '/wpml-wcml-' . $sitepress->get_locale( $default_language ) . '.mo' );
356
  }
357
 
358
  wp_redirect(admin_url('admin.php?page=wpml-wcml')); exit;
71
  }
72
 
73
  if( $sitepress->get_default_language() != 'en' ){
74
+ $page['name'] = $woocommerce_wpml->strings->get_translation_from_woocommerce_mo_file( 'Page slug'.$page['name'], $default_language );
75
+ $page['title'] = $woocommerce_wpml->strings->get_translation_from_woocommerce_mo_file( 'Page title'.$page['title'], $default_language );
76
  }
77
  }
78
  }
250
  global $sitepress;
251
  if ($sitepress->get_default_language() != $sitepress->get_current_language()) {
252
  if (!empty($q->query_vars['pagename'])) {
253
+ $shop_page = get_post( wc_get_page_id('shop') );
254
  // we should explode by / for children page
255
  $query_var_page = explode('/',$q->query_vars['pagename']);
256
+ if (isset($shop_page->post_name) && ( ( $shop_page->post_name == $query_var_page[count($query_var_page)-1]) || ( $shop_page->post_name == strtolower($query_var_page[count($query_var_page)-1]) ) ) ) {
257
  unset($q->query_vars['page']);
258
  unset($q->query_vars['pagename']);
259
  $q->query_vars['post_type'] = 'product';
270
  $miss_lang = $this->get_missing_store_pages();
271
 
272
  //dummy array for names
273
+ $names = array( __('Cart', 'woocommerce-multilingual'),
274
+ __('Checkout', 'woocommerce-multilingual'),
275
+ __('Checkout &rarr; Pay', 'woocommerce-multilingual'),
276
+ __('Order Received', 'woocommerce-multilingual'),
277
+ __('My Account', 'woocommerce-multilingual'),
278
+ __('Change Password', 'woocommerce-multilingual'),
279
+ __('Edit My Address', 'woocommerce-multilingual'),
280
+ __('Logout', 'woocommerce-multilingual'),
281
+ __('Lost Password', 'woocommerce-multilingual'),
282
+ __('View Order', 'woocommerce-multilingual'),
283
+ __('Shop', 'woocommerce-multilingual'));
284
 
285
  if (isset($miss_lang['codes'])) {
286
  $wp_rewrite = new WP_Rewrite();
294
  foreach ($miss_lang['codes'] as $mis_lang) {
295
  $args = array();
296
 
297
+ unload_textdomain('woocommerce-multilingual');
298
  $sitepress->switch_lang($mis_lang);
299
+ load_textdomain( 'woocommerce-multilingual', WCML_LOCALE_PATH . '/woocommerce-multilingual-' . $sitepress->get_locale( $mis_lang ) . '.mo' );
300
 
301
  foreach ($check_pages as $page) {
302
  $orig_id = get_option($page);
308
 
309
  switch( $page ){
310
  case 'woocommerce_shop_page_id':
311
+ $page_title = __( 'Shop', 'woocommerce-multilingual');
312
  break;
313
  case 'woocommerce_cart_page_id':
314
+ $page_title = __( 'Cart', 'woocommerce-multilingual');
315
  break;
316
  case 'woocommerce_checkout_page_id':
317
+ $page_title = __( 'Checkout', 'woocommerce-multilingual');
318
  break;
319
  case 'woocommerce_myaccount_page_id':
320
+ $page_title = __( 'My Account', 'woocommerce-multilingual');
321
  break;
322
  default:
323
+ $page_title = __( $orig_page->post_title, 'woocommerce-multilingual');
324
  break;
325
  }
326
 
350
 
351
  }
352
  }
353
+ unload_textdomain('woocommerce-multilingual');
354
  $sitepress->switch_lang($default_language);
355
+ load_textdomain( 'woocommerce-multilingual', WCML_LOCALE_PATH . '/woocommerce-multilingual-' . $sitepress->get_locale( $default_language ) . '.mo' );
356
  }
357
 
358
  wp_redirect(admin_url('admin.php?page=wpml-wcml')); exit;
inc/terms.class.php CHANGED
@@ -7,10 +7,7 @@ class WCML_Terms{
7
  const NEW_TAXONOMY_IGNORED = 2;
8
 
9
  private $_tmp_locale_val = false;
10
-
11
- private $translations_from_mo_file = array();
12
- private $mo_files = array();
13
-
14
  function __construct(){
15
 
16
  add_action('init', array($this, 'init'));
@@ -20,13 +17,7 @@ class WCML_Terms{
20
  global $sitepress;
21
 
22
  add_action('updated_woocommerce_term_meta',array($this,'sync_term_order'), 100,4);
23
-
24
- add_filter('pre_update_option_rewrite_rules', array($this, 'pre_update_rewrite_rules'), 1, 1); // high priority
25
-
26
- remove_filter('option_rewrite_rules', array('WPML_Slug_Translation', 'rewrite_rules_filter'), 1, 1); //remove filter from WPML and use WCML filter first
27
- add_filter('option_rewrite_rules', array($this, 'rewrite_rules_filter'), 3, 1); // high priority
28
- add_filter('term_link', array($this, 'translate_category_base'), 0, 3); // high priority
29
-
30
  add_filter('wp_get_object_terms', array($sitepress, 'get_terms_filter'));
31
 
32
  add_action('icl_save_term_translation', array($this,'save_wc_term_meta'), 100,4);
@@ -63,6 +54,8 @@ class WCML_Terms{
63
 
64
 
65
  add_filter( 'woocommerce_get_product_terms', array( $this, 'get_product_terms_filter' ), 10, 4 );
 
 
66
  }
67
 
68
  function admin_menu_setup(){
@@ -81,255 +74,14 @@ class WCML_Terms{
81
  $wc_original_metavalue = $wc_meta->meta_value;
82
  update_woocommerce_term_meta($result['term_id'], $wc_original_metakey, $wc_original_metavalue);
83
  }
84
- }
85
-
86
- function pre_update_rewrite_rules($value){
87
- global $sitepress, $sitepress_settings, $woocommerce, $woocommerce_wpml;
88
-
89
- // force saving in strings language
90
- $strings_language = $woocommerce_wpml->strings->get_wc_context_language();
91
-
92
- if($sitepress->get_current_language() != $strings_language && is_array( $value ) ){
93
-
94
- $permalinks = get_option( 'woocommerce_permalinks' );
95
- if(empty($permalinks['category_base']) && $value){
96
- remove_filter('gettext_with_context', array($woocommerce_wpml->strings, 'category_base_in_strings_language'), 99, 3);
97
- $base_translated = _x( 'product-category', 'slug', 'woocommerce' );
98
- add_filter('gettext_with_context', array($woocommerce_wpml->strings, 'category_base_in_strings_language'), 99, 3);
99
- $new_value = array();
100
- foreach($value as $k => $v){
101
- $k = preg_replace("#$base_translated/#", _x( 'product-category', 'slug', 'woocommerce' ) . '/', $k);
102
- $new_value[$k] = $v;
103
- }
104
- $value = $new_value;
105
- unset($new_value);
106
- }
107
- if(empty($permalinks['tag_base']) && $value){
108
- remove_filter('gettext_with_context', array($woocommerce_wpml->strings, 'category_base_in_strings_language'), 99, 3);
109
- $base_translated = _x( 'product-tag', 'slug', 'woocommerce' );
110
- add_filter('gettext_with_context', array($woocommerce_wpml->strings, 'category_base_in_strings_language'), 99, 3);
111
- $new_value = array();
112
- foreach($value as $k => $v){
113
- $k = preg_replace("#$base_translated/#", _x( 'product-tag', 'slug', 'woocommerce' ) . '/', $k);
114
- $new_value[$k] = $v;
115
- }
116
- $value = $new_value;
117
- unset($new_value);
118
- }
119
-
120
- }
121
-
122
- return $value;
123
- }
124
-
125
- function rewrite_rules_filter($value){
126
- global $sitepress, $sitepress_settings, $wpdb, $wp_taxonomies,$woocommerce,$woocommerce_wpml;
127
-
128
- if(!empty($sitepress_settings['posts_slug_translation']['on'])){
129
- add_filter('option_rewrite_rules', array('WPML_Slug_Translation', 'rewrite_rules_filter'), 1, 1);
130
- }
131
-
132
- $strings_language = $woocommerce_wpml->strings->get_wc_context_language();
133
-
134
- if($sitepress->get_current_language() != $strings_language){
135
-
136
- $cache_key = 'wcml_rewrite_filters_translate_taxonomies';
137
-
138
- if($val = wp_cache_get($cache_key)){
139
-
140
- $value = $val;
141
-
142
- }else{
143
-
144
- $taxonomies = array('product_cat', 'product_tag');
145
-
146
- foreach($taxonomies as $taxonomy ){
147
- $slug_details = $this->get_translated_tax_slug($taxonomy);
148
-
149
- if($slug_details) {
150
- $buff_value = array();
151
- foreach ((array)$value as $k => $v) {
152
- if ( $slug_details['slug'] != $slug_details['translated_slug'] && preg_match('#^[^/]*/?' . $slug_details['slug'] . '/#', $k)) {
153
- $k = preg_replace('#^([^/]*)(/?)' . $slug_details['slug'] . '/#', '$1$2' . $slug_details['translated_slug'] . '/', $k);
154
- }
155
- $buff_value[$k] = $v;
156
- }
157
- $value = $buff_value;
158
- unset($buff_value);
159
- }
160
-
161
- }
162
-
163
- // handle attributes
164
- $wc_taxonomies = wc_get_attribute_taxonomies();
165
- $wc_taxonomies_wc_format = array();
166
- foreach($wc_taxonomies as $k => $v){
167
- $wc_taxonomies_wc_format[] = 'pa_' . $v->attribute_name;
168
- }
169
-
170
- foreach($wc_taxonomies_wc_format as $taxonomy ){
171
- $taxonomy_obj = get_taxonomy($taxonomy);
172
-
173
- if( isset($taxonomy_obj->rewrite['slug'] ) ){
174
- $exp = explode('/', trim($taxonomy_obj->rewrite['slug'],'/'));
175
- $slug = join('/', array_slice($exp, 0, count($exp) - 1));
176
- }
177
-
178
- if( isset( $slug ) && $sitepress->get_current_language() != $strings_language){
179
-
180
- $slug_translation = $wpdb->get_var($wpdb->prepare("
181
- SELECT t.value
182
- FROM {$wpdb->prefix}icl_string_translations t
183
- JOIN {$wpdb->prefix}icl_strings s ON t.string_id = s.id
184
- WHERE t.language = %s AND t.status = %s AND s.name = %s AND s.value = %s
185
- ", $sitepress->get_current_language(), ICL_STRING_TRANSLATION_COMPLETE, 'URL attribute slug: ' . $slug, $slug));
186
-
187
- if($slug_translation){
188
-
189
- $buff_value = array();
190
- foreach((array)$value as $k=>$v){
191
- if( $slug != $slug_translation && preg_match('#^' . $slug . '/(.*)#', $k) ){
192
- $k = preg_replace('#^' . $slug . '/(.*)#', $slug_translation . '/$1' , $k);
193
- }
194
- $buff_value[$k] = $v;
195
- }
196
-
197
- $value = $buff_value;
198
- unset($buff_value);
199
-
200
- }
201
-
202
- }
203
-
204
- }
205
-
206
- wp_cache_add($cache_key, $value);
207
-
208
- }
209
-
210
- }
211
-
212
- //filter shop page rewrite slug
213
- $cache_key = 'wcml_rewrite_shop_slug';
214
-
215
- if($val = wp_cache_get($cache_key)){
216
-
217
- $value = $val;
218
-
219
- }else{
220
-
221
- $current_shop_id = woocommerce_get_page_id( 'shop' );
222
- $default_shop_id = apply_filters( 'translate_object_id', $current_shop_id, 'page', true, $sitepress->get_default_language() );
223
-
224
- if ( is_null( get_post( $current_shop_id ) ) || is_null( get_post( $default_shop_id ) ) )
225
- return $value;
226
-
227
- $current_slug = get_post( $current_shop_id )->post_name;
228
- $default_slug = get_post( $default_shop_id )->post_name;
229
-
230
-
231
- if( $current_slug != $default_slug ){
232
- $buff_value = array();
233
- foreach( (array) $value as $k => $v ){
234
- if( $current_slug != $default_slug && preg_match( '#^[^/]*/?' . $default_slug . '/page/#', $k ) ){
235
- $k = preg_replace( '#^([^/]*)(/?)' . $default_slug . '/#', '$1$2' . $current_slug . '/' , $k );
236
- }
237
- $buff_value[$k] = $v;
238
- }
239
-
240
- $value = $buff_value;
241
- unset( $buff_value );
242
- }
243
-
244
- wp_cache_add($cache_key, $value);
245
- }
246
-
247
- return $value;
248
- }
249
-
250
-
251
- function get_translated_tax_slug( $taxonomy, $language = false ){
252
- global $sitepress, $woocommerce_wpml, $wpdb;
253
-
254
- $strings_language = $woocommerce_wpml->strings->get_wc_context_language();
255
-
256
- $permalinks = get_option( 'woocommerce_permalinks' );
257
-
258
- switch($taxonomy){
259
- case 'product_tag':
260
- $slug = !empty( $permalinks['tag_base'] ) ? trim($permalinks['tag_base'],'/') : 'product-tag';
261
- break;
262
-
263
- case 'product_cat':
264
- $slug = !empty( $permalinks['category_base'] ) ? trim($permalinks['category_base'],'/') : 'product-category';
265
- break;
266
-
267
- default:
268
- $slug = trim( $permalinks['attribute_base'], '/' );
269
- break;
270
- }
271
-
272
- if( !$language ){
273
- $language = $sitepress->get_current_language();
274
- }
275
-
276
- if($slug && $language != $strings_language) {
277
-
278
- $slug_translation = $wpdb->get_var($wpdb->prepare("
279
- SELECT t.value
280
- FROM {$wpdb->prefix}icl_string_translations t
281
- JOIN {$wpdb->prefix}icl_strings s ON t.string_id = s.id
282
- WHERE t.language = %s AND t.status = %s AND s.name = %s AND s.value = %s
283
- ", $language, ICL_STRING_TRANSLATION_COMPLETE, 'URL ' . $taxonomy . ' slug: ' . $slug, $slug));
284
 
285
- if ( is_null( $slug_translation ) ) {
286
- // handle exception - default woocommerce category and tag bases used
287
- $slug_translation = $this->get_translation_from_woocommerce_mo_file( $slug, $language );
288
 
289
- }
 
290
 
291
- return array( 'slug' => $slug, 'translated_slug' => $slug_translation );
292
  }
293
-
294
- return array( 'slug' => $slug, 'translated_slug' => $slug );
295
-
296
- }
297
-
298
- function get_translation_from_woocommerce_mo_file( $string, $language ){
299
- global $sitepress;
300
-
301
- $original_string = $string;
302
-
303
- if ( ! isset( $this->translations_from_mo_file[ $original_string ][ $language ] ) ) {
304
-
305
- if ( ! isset( $this->translations_from_mo_file[ $original_string ] ) ) {
306
- $this->translations_from_mo_file[ $original_string ] = array();
307
- }
308
-
309
- if ( ! isset( $this->mo_files[ $language ] ) ) {
310
- $mo = new MO();
311
- $mo_file = WP_LANG_DIR . '/plugins/woocommerce-' . $sitepress->get_locale( $language ) . '.mo';
312
- if( !file_exists( $mo_file ) ){
313
- return $string;
314
- }
315
-
316
- $mo->import_from_file( $mo_file );
317
- $this->mo_files[ $language ] = &$mo->entries;
318
- }
319
-
320
- if( in_array( $string, array( 'product','product-category','product-tag' ) ) ){
321
- $string = 'slug'. chr(4) .$string;
322
- }
323
-
324
- if( isset( $this->mo_files[ $language ][$string] ) ){
325
- $this->translations_from_mo_file[ $original_string ][ $language ] = $this->mo_files[ $language ][$string]->translations[0];
326
- } else {
327
- $this->translations_from_mo_file[ $original_string ][ $language ] = $original_string;
328
- }
329
- }
330
-
331
- return $this->translations_from_mo_file[ $original_string ][ $language ];
332
-
333
  }
334
 
335
  function _switch_wc_locale(){
@@ -338,66 +90,6 @@ class WCML_Terms{
338
  return $locale;
339
  }
340
 
341
- function translate_category_base($termlink, $term, $taxonomy){
342
- global $wp_rewrite,$woocommerce_wpml,$wpml_term_translations,$sitepress;
343
- static $no_recursion_flag;
344
-
345
- // handles product categories, product tags and attributes
346
-
347
- $wc_taxonomies = wc_get_attribute_taxonomies();
348
- foreach($wc_taxonomies as $k => $v){
349
- $wc_taxonomies_wc_format[] = 'pa_' . $v->attribute_name;
350
- }
351
-
352
- if(($taxonomy == 'product_cat' || $taxonomy == 'product_tag' || (!empty($wc_taxonomies_wc_format) && in_array($taxonomy, $wc_taxonomies_wc_format))) && !$no_recursion_flag){
353
-
354
- $cache_key = 'termlink#' . $taxonomy .'#' . $term->term_id;
355
- if( false && $link = wp_cache_get($cache_key, 'terms')){
356
- $termlink = $link;
357
-
358
- }else{
359
-
360
- $no_recursion_flag = false;
361
-
362
- if( !is_null( $wpml_term_translations ) ){
363
- $term_language = $term->term_id ? $wpml_term_translations->get_element_lang_code($term->term_taxonomy_id) : false;
364
- }else{
365
- $term_language = $term->term_id ? $sitepress->get_language_for_element( $term->term_taxonomy_id, 'tax_'.$taxonomy ) : false;
366
- }
367
-
368
- if( $term_language ){
369
-
370
- $taxonomy_obj = get_taxonomy( $taxonomy );
371
- $base = isset($taxonomy_obj->rewrite['slug']) ? trim($taxonomy_obj->rewrite['slug'], '/') : false;
372
-
373
- $slug_details = $this->get_translated_tax_slug( $taxonomy, $term_language );
374
- $base_translated = $slug_details['translated_slug'];
375
-
376
- $string_identifier = $taxonomy == 'product_tag' || $taxonomy == 'product_cat' ? $taxonomy : 'attribute';
377
-
378
- if(!empty($base_translated) && $base_translated != $base && isset( $wp_rewrite->extra_permastructs[$taxonomy] ) ){
379
-
380
- $buff = $wp_rewrite->extra_permastructs[$taxonomy]['struct'];
381
- $wp_rewrite->extra_permastructs[$taxonomy]['struct'] = str_replace($base, $base_translated, $wp_rewrite->extra_permastructs[$taxonomy]['struct']);
382
- $no_recursion_flag = true;
383
- $termlink = get_term_link($term, $taxonomy);
384
-
385
- $wp_rewrite->extra_permastructs[$taxonomy]['struct'] = $buff;
386
-
387
- }
388
-
389
- }
390
-
391
- $no_recursion_flag = false;
392
-
393
- wp_cache_add($cache_key, $termlink, 'terms', 0);
394
- }
395
-
396
- }
397
-
398
- return $termlink;
399
- }
400
-
401
  function show_term_translation_screen_notices(){
402
  global $sitepress, $wpdb;
403
  $taxonomies = array_keys(get_taxonomies(array('object_type'=>array('product')),'objects'));
@@ -415,7 +107,7 @@ class WCML_Terms{
415
  $language = $sitepress->get_default_language();
416
  }
417
 
418
- $message = sprintf(__('To translate %s please use the %s translation%s page, inside the %sWooCommerce Multilingual admin%s.', 'wpml-wcml'),
419
  $taxonomy_obj->labels->name,
420
  '<strong><a href="' . admin_url('admin.php?page=wpml-wcml&tab=' . $taxonomy ) . '">' . $taxonomy_obj->labels->singular_name, '</a></strong>',
421
  '<strong><a href="' . admin_url('admin.php?page=wpml-wcml">'), '</a></strong>');
@@ -579,9 +271,9 @@ class WCML_Terms{
579
  $woocommerce_wpml->update_settings($wcml_settings);
580
 
581
  $ret['html'] = '<i class="icon-ok"></i> ';
582
- $ret['html'] .= sprintf(__('%s do not require translation.', 'wpml-wcml'), get_taxonomy($taxonomy)->labels->name);
583
  $ret['html'] .= '<div class="actions">';
584
- $ret['html'] .= '<a href="#unignore-' . $taxonomy . '">' . __('Change', 'wpml-wcml') . '</a>';
585
  $ret['html'] .= '</div>';
586
 
587
  echo json_encode($ret);
@@ -606,10 +298,10 @@ class WCML_Terms{
606
  $wcml_settings['untranstaled_terms'][$taxonomy]['status'] = self::NEW_TAXONOMY_TERMS;
607
 
608
  $ret['html'] = '<i class="icon-warning-sign"></i> ';
609
- $ret['html'] .= sprintf(__('Some %s are missing translations (%d translations missing).', 'wpml-wcml'), get_taxonomy($taxonomy)->labels->name, $wcml_settings['untranstaled_terms'][$taxonomy]['count']);
610
  $ret['html'] .= '<div class="actions">';
611
- $ret['html'] .= '<a href="' . admin_url('admin.php?page=wpml-wcml&tab=' . $taxonomy) . '">' . __('Translate now', 'wpml-wcml') . '</a> | ';
612
- $ret['html'] .= '<a href="#ignore-' . $taxonomy . '">' . __('Change', 'wpml-wcml') . '</a>';
613
  $ret['html'] .= '</div>';
614
 
615
  $ret['warn'] = 1;
@@ -618,7 +310,7 @@ class WCML_Terms{
618
  $wcml_settings['untranstaled_terms'][$taxonomy]['status'] = self::ALL_TAXONOMY_TERMS_TRANSLATED;
619
 
620
  $ret['html'] = '<i class="icon-ok"></i> ';
621
- $ret['html'] .= sprintf(__('All %s are translated.', 'wpml-wcml'), get_taxonomy($taxonomy)->labels->name);
622
 
623
  $ret['warn'] = 0;
624
  }
@@ -776,7 +468,7 @@ class WCML_Terms{
776
  <input type="hidden" name="languages_processed" value="0" />
777
 
778
  <p>
779
- <input class="button-secondary" type="submit" value="<?php esc_attr_e("Synchronize attributes and update product variations", 'wpml-wcml') ?>" />
780
  <img src="<?php echo ICL_PLUGIN_URL . '/res/img/ajax-loader.gif' ?>" alt="loading" height="16" width="16" class="wpml_tt_spinner" />
781
  </p>
782
  <span class="errors icl_error_text"></span>
@@ -786,7 +478,7 @@ class WCML_Terms{
786
 
787
  <p><?php _e('This will automatically generate variations for translated products corresponding to recently translated attributes.'); ?></p>
788
  <?php if(!empty($wcml_settings['variations_needed'][$taxonomy])): ?>
789
- <p><?php printf(__('Currently, there are %s variations that need to be created.', 'wpml-wcml'), '<strong>' . $wcml_settings['variations_needed'][$taxonomy] . '</strong>') ?></p>
790
  <?php endif; ?>
791
 
792
 
@@ -903,7 +595,7 @@ class WCML_Terms{
903
 
904
  }
905
 
906
- $response['progress'] = $response['go'] ? sprintf(__('%d products left', 'wpml-wcml'), count($post_ids) - $posts_processed) : __('Synchronization complete!', 'wpml-wcml');
907
 
908
  if($response['go'] && isset($wcml_settings['variations_needed'][$taxonomy]) && !empty($variations_processed)){
909
  $wcml_settings['variations_needed'][$taxonomy] = max($wcml_settings['variations_needed'][$taxonomy] - $variations_processed, 0);
@@ -939,7 +631,7 @@ class WCML_Terms{
939
  }
940
 
941
  }else{
942
- $errors = sprintf(__('Invalid taxonomy %s', 'wpml-wcml'), $_POST['taxonomy']);
943
  }
944
 
945
 
@@ -961,7 +653,7 @@ class WCML_Terms{
961
  $html .= self::render_assignment_status($_POST['post'], $_POST['taxonomy'], $preview = false);
962
 
963
  }else{
964
- $errors .= sprintf(__('Invalid taxonomy %s', 'wpml-wcml'), $_POST['taxonomy']);
965
  }
966
 
967
 
@@ -1078,16 +770,16 @@ class WCML_Terms{
1078
  $out .= '<input type="hidden" name="post" value="' . $object_type . '" />';
1079
  $out .= wp_nonce_field('wcml_sync_taxonomies_in_content', 'wcml_sync_taxonomies_in_content_nonce',true,false);
1080
  $out .= '<input type="hidden" name="taxonomy" value="' . $taxonomy . '" />';
1081
- $out .= sprintf(__('Some translated %s have different %s assignments.', 'wpml-wcml'),
1082
  '<strong>' . mb_strtolower($wp_post_types[$object_type]->labels->name) . '</strong>',
1083
  '<strong>' . mb_strtolower($wp_taxonomies[$taxonomy]->labels->name) . '</strong>');
1084
- $out .= '&nbsp;<a class="submit button-secondary" href="#">' . sprintf(__('Update %s for all translated %s', 'wpml-wcml'),
1085
  '<strong>' . mb_strtolower($wp_taxonomies[$taxonomy]->labels->name) . '</strong>',
1086
  '<strong>' . mb_strtolower($wp_post_types[$object_type]->labels->name) . '</strong>') . '</a>' .
1087
  '&nbsp;<img src="'. ICL_PLUGIN_URL . '/res/img/ajax-loader.gif" alt="loading" height="16" width="16" class="wpml_tt_spinner" />';
1088
  $out .= "</form>";
1089
  }else{
1090
- $out .= sprintf(__('All %s have the same %s assignments.', 'wpml-wcml'),
1091
  '<strong>' . mb_strtolower($wp_taxonomies[$taxonomy]->labels->name) . '</strong>',
1092
  '<strong>' . mb_strtolower($wp_post_types[$object_type]->labels->name) . '</strong>');
1093
  }
@@ -1095,7 +787,7 @@ class WCML_Terms{
1095
 
1096
  }else{
1097
 
1098
- $out .= sprintf(__('Successfully updated %s for all translated %s.', 'wpml-wcml'), $wp_taxonomies[$taxonomy]->labels->name, $wp_post_types[$object_type]->labels->name);
1099
 
1100
  }
1101
 
@@ -1162,14 +854,58 @@ class WCML_Terms{
1162
 
1163
  function get_product_terms_filter( $terms, $product_id, $taxonomy, $args ){
1164
  global $sitepress;
1165
- remove_filter( 'woocommerce_get_product_terms', array( $this, 'get_product_terms_filter' ), 10, 4 );
1166
- $current_language = $sitepress->get_current_language();
1167
- $sitepress->switch_lang( $sitepress->get_language_for_element( $product_id, 'post_'.get_post_type( $product_id ) ) );
1168
- $terms = wc_get_product_terms( $product_id, $taxonomy, $args );
1169
- $sitepress->switch_lang( $current_language );
1170
- add_filter( 'woocommerce_get_product_terms', array( $this, 'get_product_terms_filter' ), 10, 4 );
1171
 
1172
- return $terms;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1173
  }
1174
 
1175
  }
7
  const NEW_TAXONOMY_IGNORED = 2;
8
 
9
  private $_tmp_locale_val = false;
10
+
 
 
 
11
  function __construct(){
12
 
13
  add_action('init', array($this, 'init'));
17
  global $sitepress;
18
 
19
  add_action('updated_woocommerce_term_meta',array($this,'sync_term_order'), 100,4);
20
+
 
 
 
 
 
 
21
  add_filter('wp_get_object_terms', array($sitepress, 'get_terms_filter'));
22
 
23
  add_action('icl_save_term_translation', array($this,'save_wc_term_meta'), 100,4);
54
 
55
 
56
  add_filter( 'woocommerce_get_product_terms', array( $this, 'get_product_terms_filter' ), 10, 4 );
57
+
58
+ add_filter( 'pre_update_option_woocommerce_flat_rate_settings', array( $this, 'update_woocommerce_flat_rate_settings' ) );
59
  }
60
 
61
  function admin_menu_setup(){
74
  $wc_original_metavalue = $wc_meta->meta_value;
75
  update_woocommerce_term_meta($result['term_id'], $wc_original_metakey, $wc_original_metavalue);
76
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
 
78
+ //update flat rate options for shipping classes
79
+ if( $original_tax->taxonomy == 'product_shipping_class' ){
 
80
 
81
+ $settings = get_option( 'woocommerce_flat_rate_settings' );
82
+ update_option( 'woocommerce_flat_rate_settings', $this->update_woocommerce_flat_rate_settings( $settings ) );
83
 
 
84
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  }
86
 
87
  function _switch_wc_locale(){
90
  return $locale;
91
  }
92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  function show_term_translation_screen_notices(){
94
  global $sitepress, $wpdb;
95
  $taxonomies = array_keys(get_taxonomies(array('object_type'=>array('product')),'objects'));
107
  $language = $sitepress->get_default_language();
108
  }
109
 
110
+ $message = sprintf(__('To translate %s please use the %s translation%s page, inside the %sWooCommerce Multilingual admin%s.', 'woocommerce-multilingual'),
111
  $taxonomy_obj->labels->name,
112
  '<strong><a href="' . admin_url('admin.php?page=wpml-wcml&tab=' . $taxonomy ) . '">' . $taxonomy_obj->labels->singular_name, '</a></strong>',
113
  '<strong><a href="' . admin_url('admin.php?page=wpml-wcml">'), '</a></strong>');
271
  $woocommerce_wpml->update_settings($wcml_settings);
272
 
273
  $ret['html'] = '<i class="icon-ok"></i> ';
274
+ $ret['html'] .= sprintf(__('%s do not require translation.', 'woocommerce-multilingual'), get_taxonomy($taxonomy)->labels->name);
275
  $ret['html'] .= '<div class="actions">';
276
+ $ret['html'] .= '<a href="#unignore-' . $taxonomy . '">' . __('Change', 'woocommerce-multilingual') . '</a>';
277
  $ret['html'] .= '</div>';
278
 
279
  echo json_encode($ret);
298
  $wcml_settings['untranstaled_terms'][$taxonomy]['status'] = self::NEW_TAXONOMY_TERMS;
299
 
300
  $ret['html'] = '<i class="icon-warning-sign"></i> ';
301
+ $ret['html'] .= sprintf(__('Some %s are missing translations (%d translations missing).', 'woocommerce-multilingual'), get_taxonomy($taxonomy)->labels->name, $wcml_settings['untranstaled_terms'][$taxonomy]['count']);
302
  $ret['html'] .= '<div class="actions">';
303
+ $ret['html'] .= '<a href="' . admin_url('admin.php?page=wpml-wcml&tab=' . $taxonomy) . '">' . __('Translate now', 'woocommerce-multilingual') . '</a> | ';
304
+ $ret['html'] .= '<a href="#ignore-' . $taxonomy . '">' . __('Change', 'woocommerce-multilingual') . '</a>';
305
  $ret['html'] .= '</div>';
306
 
307
  $ret['warn'] = 1;
310
  $wcml_settings['untranstaled_terms'][$taxonomy]['status'] = self::ALL_TAXONOMY_TERMS_TRANSLATED;
311
 
312
  $ret['html'] = '<i class="icon-ok"></i> ';
313
+ $ret['html'] .= sprintf(__('All %s are translated.', 'woocommerce-multilingual'), get_taxonomy($taxonomy)->labels->name);
314
 
315
  $ret['warn'] = 0;
316
  }
468
  <input type="hidden" name="languages_processed" value="0" />
469
 
470
  <p>
471
+ <input class="button-secondary" type="submit" value="<?php esc_attr_e("Synchronize attributes and update product variations", 'woocommerce-multilingual') ?>" />
472
  <img src="<?php echo ICL_PLUGIN_URL . '/res/img/ajax-loader.gif' ?>" alt="loading" height="16" width="16" class="wpml_tt_spinner" />
473
  </p>
474
  <span class="errors icl_error_text"></span>
478
 
479
  <p><?php _e('This will automatically generate variations for translated products corresponding to recently translated attributes.'); ?></p>
480
  <?php if(!empty($wcml_settings['variations_needed'][$taxonomy])): ?>
481
+ <p><?php printf(__('Currently, there are %s variations that need to be created.', 'woocommerce-multilingual'), '<strong>' . $wcml_settings['variations_needed'][$taxonomy] . '</strong>') ?></p>
482
  <?php endif; ?>
483
 
484
 
595
 
596
  }
597
 
598
+ $response['progress'] = $response['go'] ? sprintf(__('%d products left', 'woocommerce-multilingual'), count($post_ids) - $posts_processed) : __('Synchronization complete!', 'woocommerce-multilingual');
599
 
600
  if($response['go'] && isset($wcml_settings['variations_needed'][$taxonomy]) && !empty($variations_processed)){
601
  $wcml_settings['variations_needed'][$taxonomy] = max($wcml_settings['variations_needed'][$taxonomy] - $variations_processed, 0);
631
  }
632
 
633
  }else{
634
+ $errors = sprintf(__('Invalid taxonomy %s', 'woocommerce-multilingual'), $_POST['taxonomy']);
635
  }
636
 
637
 
653
  $html .= self::render_assignment_status($_POST['post'], $_POST['taxonomy'], $preview = false);
654
 
655
  }else{
656
+ $errors .= sprintf(__('Invalid taxonomy %s', 'woocommerce-multilingual'), $_POST['taxonomy']);
657
  }
658
 
659
 
770
  $out .= '<input type="hidden" name="post" value="' . $object_type . '" />';
771
  $out .= wp_nonce_field('wcml_sync_taxonomies_in_content', 'wcml_sync_taxonomies_in_content_nonce',true,false);
772
  $out .= '<input type="hidden" name="taxonomy" value="' . $taxonomy . '" />';
773
+ $out .= sprintf(__('Some translated %s have different %s assignments.', 'woocommerce-multilingual'),
774
  '<strong>' . mb_strtolower($wp_post_types[$object_type]->labels->name) . '</strong>',
775
  '<strong>' . mb_strtolower($wp_taxonomies[$taxonomy]->labels->name) . '</strong>');
776
+ $out .= '&nbsp;<a class="submit button-secondary" href="#">' . sprintf(__('Update %s for all translated %s', 'woocommerce-multilingual'),
777
  '<strong>' . mb_strtolower($wp_taxonomies[$taxonomy]->labels->name) . '</strong>',
778
  '<strong>' . mb_strtolower($wp_post_types[$object_type]->labels->name) . '</strong>') . '</a>' .
779
  '&nbsp;<img src="'. ICL_PLUGIN_URL . '/res/img/ajax-loader.gif" alt="loading" height="16" width="16" class="wpml_tt_spinner" />';
780
  $out .= "</form>";
781
  }else{
782
+ $out .= sprintf(__('All %s have the same %s assignments.', 'woocommerce-multilingual'),
783
  '<strong>' . mb_strtolower($wp_taxonomies[$taxonomy]->labels->name) . '</strong>',
784
  '<strong>' . mb_strtolower($wp_post_types[$object_type]->labels->name) . '</strong>');
785
  }
787
 
788
  }else{
789
 
790
+ $out .= sprintf(__('Successfully updated %s for all translated %s.', 'woocommerce-multilingual'), $wp_taxonomies[$taxonomy]->labels->name, $wp_post_types[$object_type]->labels->name);
791
 
792
  }
793
 
854
 
855
  function get_product_terms_filter( $terms, $product_id, $taxonomy, $args ){
856
  global $sitepress;
 
 
 
 
 
 
857
 
858
+ $language = $sitepress->get_language_for_element( $product_id, 'post_'.get_post_type( $product_id ) );
859
+
860
+ $is_objects_array = is_object( current ( $terms ) );
861
+
862
+ $filtered_terms = array();
863
+
864
+ foreach( $terms as $term ){
865
+
866
+ if( !$is_objects_array ){
867
+ $term = get_term_by( 'name', $term, $taxonomy );
868
+ }
869
+
870
+ $trnsl_term_id = apply_filters( 'translate_object_id', $term->term_id, $taxonomy, true, $language );
871
+
872
+ $filtered_terms[] = !$is_objects_array ? get_term( $trnsl_term_id, $taxonomy )->name : get_term( $trnsl_term_id, $taxonomy );
873
+ }
874
+
875
+ return $filtered_terms;
876
+ }
877
+
878
+ function update_woocommerce_flat_rate_settings( $settings ){
879
+
880
+ foreach( $settings as $setting_key => $value ){
881
+
882
+ if( substr($setting_key, 0, 11) == 'class_cost_' ){
883
+
884
+ global $sitepress;
885
+
886
+ $shipp_class = get_term_by( 'slug', substr($setting_key, 11 ), 'product_shipping_class' );
887
+
888
+ $trid = $sitepress->get_element_trid( $shipp_class->term_taxonomy_id, 'tax_product_shipping_class' );
889
+
890
+ $translations = $sitepress->get_element_translations( $trid, 'tax_product_shipping_class' );
891
+
892
+ foreach( $translations as $translation ){
893
+
894
+ if( !$translation->original ){
895
+
896
+ $tr_shipp_class = get_term_by( 'term_taxonomy_id', $translation->element_id, 'product_shipping_class' );
897
+
898
+ $settings[ 'class_cost_'.$tr_shipp_class->slug ] = $value;
899
+
900
+ }
901
+
902
+ }
903
+
904
+ }
905
+
906
+ }
907
+
908
+ return $settings;
909
  }
910
 
911
  }
inc/upgrade.class.php CHANGED
@@ -10,7 +10,8 @@ class WCML_Upgrade{
10
  '3.3',
11
  '3.5',
12
  '3.5.4',
13
- '3.6'
 
14
 
15
  );
16
 
@@ -21,7 +22,7 @@ class WCML_Upgrade{
21
  add_action('admin_notices', array($this, 'show_upgrade_notices'));
22
 
23
  add_action('wp_ajax_wcml_hide_notice', array($this, 'hide_upgrade_notice'));
24
-
25
  }
26
 
27
  function setup_upgrade_notices(){
@@ -302,7 +303,6 @@ class WCML_Upgrade{
302
 
303
  function upgrade_3_6()
304
  {
305
- global $wpdb;
306
  $wcml_settings = get_option('_wcml_settings');
307
 
308
  $wcml_settings['display_custom_prices'] = 0;
@@ -311,4 +311,71 @@ class WCML_Upgrade{
311
  update_option('_wcml_settings', $wcml_settings);
312
  }
313
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
314
  }
10
  '3.3',
11
  '3.5',
12
  '3.5.4',
13
+ '3.6',
14
+ '3.7'
15
 
16
  );
17
 
22
  add_action('admin_notices', array($this, 'show_upgrade_notices'));
23
 
24
  add_action('wp_ajax_wcml_hide_notice', array($this, 'hide_upgrade_notice'));
25
+
26
  }
27
 
28
  function setup_upgrade_notices(){
303
 
304
  function upgrade_3_6()
305
  {
 
306
  $wcml_settings = get_option('_wcml_settings');
307
 
308
  $wcml_settings['display_custom_prices'] = 0;
311
  update_option('_wcml_settings', $wcml_settings);
312
  }
313
 
314
+ function upgrade_3_7(){
315
+ global $wpdb;
316
+
317
+ $woocommerce_permalinks = maybe_unserialize( get_option('woocommerce_permalinks') );
318
+
319
+ foreach($woocommerce_permalinks as $base_key => $base){
320
+
321
+ $base_key = trim($base_key, '/');
322
+
323
+ if($base) {
324
+ $taxonomy = false;
325
+
326
+ switch( $base_key ){
327
+ case 'category_base': $taxonomy = 'product_cat'; break;
328
+ case 'tag_base': $taxonomy = 'product_tag'; break;
329
+ case 'attribute_base':$taxonomy = 'attribute'; break;
330
+ }
331
+
332
+ if($taxonomy) {
333
+ $wpdb->update(
334
+ $wpdb->prefix . 'icl_strings',
335
+ array(
336
+ 'context' => 'WordPress',
337
+ 'name' => sprintf('URL %s tax slug', $taxonomy)
338
+ ),
339
+ array(
340
+ 'context' => sprintf('URL %s slugs - %s', $taxonomy, $base),
341
+ 'name' => sprintf('Url %s slug: %s', $taxonomy, $base)
342
+ )
343
+ );
344
+
345
+ }
346
+ }
347
+
348
+ }
349
+
350
+ $endpoint_keys = array( 'order-pay', 'order-received', 'view-order', 'edit-account', 'edit-address', 'lost-password', 'customer-logout', 'add-payment-method' );
351
+
352
+ foreach( $endpoint_keys as $endpoint_key ){
353
+
354
+ $wpdb->query(
355
+ $wpdb->prepare( "UPDATE {$wpdb->prefix}icl_strings
356
+ SET context = 'WooCommerce Endpoints', name = %s
357
+ WHERE context = 'WordPress' AND name = %s",
358
+ $endpoint_key, 'Endpoint slug: '. $endpoint_key )
359
+ );
360
+
361
+
362
+ if( version_compare(ICL_SITEPRESS_VERSION, '3.2.3', '>=')){
363
+ // update domain_name_context_md5 value
364
+ $string_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}icl_strings WHERE context = 'WooCommerce Endpoints' AND name = %s", $endpoint_key ) );
365
+
366
+ if( $string_id ){
367
+ $wpdb->query(
368
+ $wpdb->prepare( "UPDATE {$wpdb->prefix}icl_strings
369
+ SET domain_name_context_md5 = %s
370
+ WHERE id = %d",
371
+ md5( $endpoint_key,'WooCommerce Endpoints' ), $string_id )
372
+ );
373
+ }
374
+
375
+ }
376
+
377
+ }
378
+
379
+ }
380
+
381
  }
inc/url-translation.class.php ADDED
@@ -0,0 +1,570 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WCML_Url_Translation {
4
+
5
+ public $default_product_base;
6
+ public $default_product_category_base;
7
+ public $default_product_tag_base;
8
+
9
+ function __construct() {
10
+
11
+ $this->default_product_base = 'product';
12
+ $this->default_product_category_base = 'product-category';
13
+ $this->default_product_tag_base = 'product-tag';
14
+
15
+ $this->wc_permalinks = get_option( 'woocommerce_permalinks' );
16
+
17
+ $this->set_up(); //initialization
18
+
19
+ add_filter( 'pre_update_option_woocommerce_permalinks', array( $this, 'register_product_and_taxonomy_bases' ), 10, 2 );
20
+
21
+ add_filter( 'pre_update_option_rewrite_rules', array( $this, 'force_bases_in_strings_languages' ), 1, 1 ); // high priority
22
+
23
+ remove_filter( 'option_rewrite_rules', array( 'WPML_Slug_Translation', 'rewrite_rules_filter' ), 1, 1 ); //remove filter from WPML and use WCML filter first
24
+ add_filter( 'option_rewrite_rules', array( $this, 'translate_bases_in_rewrite_rules' ), 3, 1 ); // high priority
25
+
26
+ add_filter( 'term_link', array( $this, 'translate_taxonomy_base' ), 0, 3 ); // high priority
27
+
28
+ add_action( 'init', array( $this, 'fix_post_object_rewrite_slug' ), 6 ); // handle the particular case of the default product base: wpmlst-540
29
+
30
+ }
31
+
32
+ function set_up() {
33
+ global $woocommerce_wpml;
34
+
35
+ if ( empty( $woocommerce_wpml->settings['url_translation_set_up'] ) ) {
36
+
37
+ $this->clean_up_product_and_taxonomy_bases();
38
+
39
+ //set translate product by default
40
+ $this->translate_product_base();
41
+
42
+ $this->register_product_and_taxonomy_bases();
43
+
44
+ $woocommerce_wpml->settings['url_translation_set_up'] = 1;
45
+ $woocommerce_wpml->update_settings();
46
+ }
47
+
48
+ }
49
+
50
+ function clean_up_product_and_taxonomy_bases(){
51
+ global $wpdb;
52
+
53
+ $base = $this->get_woocommerce_product_base();
54
+
55
+ //delete other old product bases
56
+ $wpdb->query( "DELETE FROM {$wpdb->prefix}icl_strings WHERE context = 'WordPress' AND value != '".trim( $base,'/' )."' AND name LIKE 'URL slug:%' " );
57
+
58
+ //update name for current base
59
+
60
+ $wpdb->update(
61
+ $wpdb->prefix . 'icl_strings',
62
+ array(
63
+ 'context' => 'WordPress',
64
+ 'name' => 'URL slug: product'
65
+ ),
66
+ array(
67
+ 'context' => 'WordPress',
68
+ 'name' => sprintf('Url slug: %s', trim( $base,'/' ))
69
+ )
70
+ );
71
+
72
+ $woocommerce_permalinks = maybe_unserialize( get_option('woocommerce_permalinks') );
73
+
74
+ foreach ( (array) $woocommerce_permalinks as $base_key => $base ) {
75
+
76
+ $base_key = trim($base_key, '/');
77
+
78
+ $taxonomy = false;
79
+
80
+ switch( $base_key ){
81
+ case 'category_base': $taxonomy = 'product_cat'; break;
82
+ case 'tag_base': $taxonomy = 'product_tag'; break;
83
+ case 'attribute_base':$taxonomy = 'attribute'; break;
84
+ }
85
+
86
+ if( $taxonomy ) {
87
+ $wpdb->query( "DELETE FROM {$wpdb->prefix}icl_strings WHERE context LIKE '".sprintf('URL %s slugs - ', $taxonomy)."%'" );
88
+ }
89
+
90
+ }
91
+
92
+ }
93
+
94
+ function fix_post_object_rewrite_slug(){
95
+ global $wp_post_types, $wp_rewrite;
96
+
97
+ if( empty( $this->wc_permalinks['product_base'] ) ){
98
+
99
+ $wp_post_types['product']->rewrite['slug'] = 'product';
100
+ $wp_rewrite->extra_permastructs['product']['struct'] = '/product/%product%';
101
+
102
+ }
103
+
104
+ }
105
+
106
+ function url_strings_context() {
107
+ return 'WordPress';
108
+ }
109
+
110
+ function url_string_name( $type ) {
111
+
112
+ $name = '';
113
+
114
+ switch ( $type ) {
115
+ case 'product':
116
+ $name = sprintf( 'URL slug: %s', $type );
117
+ break;
118
+ case 'product_cat':
119
+ case 'product_tag':
120
+ case 'attribute':
121
+ $name = sprintf( 'URL %s tax slug', $type );
122
+ break;
123
+ }
124
+
125
+ return $name;
126
+ }
127
+
128
+ function translate_product_base() {
129
+
130
+ if ( !defined( 'WOOCOMMERCE_VERSION' ) || ( !isset( $GLOBALS['ICL_Pro_Translation'] ) || is_null( $GLOBALS['ICL_Pro_Translation'] ) ) ) {
131
+ return;
132
+ }
133
+
134
+ $slug = $this->get_woocommerce_product_base();
135
+
136
+ if ( version_compare( WPML_ST_VERSION, '2.2.6', '>' ) ) {
137
+
138
+ // Use new API for WPML ST > 2.2.6
139
+ do_action( 'wpml_activate_slug_translation', 'product', $slug, $this->url_strings_context() );
140
+
141
+ } else {
142
+
143
+ // force_product_slug_translation_on
144
+ global $sitepress;
145
+ $iclsettings = $sitepress->get_settings();
146
+ if ( empty( $iclsettings['posts_slug_translation']['on'] ) || empty( $iclsettings['posts_slug_translation']['types']['product'] ) ) {
147
+ $iclsettings['posts_slug_translation']['on'] = 1;
148
+ $iclsettings['posts_slug_translation']['types']['product'] = 1;
149
+ $sitepress->save_settings( $iclsettings );
150
+ }
151
+
152
+ $string = icl_get_string_id( $slug, $this->url_strings_context(), $this->url_string_name( 'product' ) );
153
+ if ( !$string ) {
154
+ do_action( 'wpml_register_single_string', $this->url_strings_context(), $this->url_string_name( 'product' ), $slug );
155
+ }
156
+
157
+ }
158
+
159
+ }
160
+
161
+ function get_woocommerce_product_base() {
162
+
163
+ if ( isset( $this->wc_permalinks['product_base'] ) && !empty( $this->wc_permalinks['product_base'] ) ) {
164
+ return trim( $this->wc_permalinks['product_base'], '/' );
165
+ } elseif ( get_option( 'woocommerce_product_slug' ) != false ) {
166
+ return trim( get_option( 'woocommerce_product_slug' ), '/' );
167
+ } else {
168
+ return $this->default_product_base; // the default WooCommerce value. Before permalinks options are saved
169
+ }
170
+
171
+ }
172
+
173
+ function register_product_and_taxonomy_bases( $value = false, $old_value = false ) {
174
+ global $woocommerce_wpml;
175
+
176
+ if( empty( $value ) ){
177
+ $permalink_options = $this->wc_permalinks;
178
+ }else{
179
+ $permalink_options = $value;
180
+ }
181
+
182
+ // products
183
+ $product_base = !empty( $permalink_options['product_base'] ) ? trim( $permalink_options['product_base'], '/' ) : $this->default_product_base;
184
+ $name = $this->url_string_name( 'product' );
185
+
186
+ $string_language = $woocommerce_wpml->strings->get_string_language( $product_base, $this->url_strings_context(), $name );
187
+ if( is_null($string_language) ){
188
+ $string_language = '';
189
+ }
190
+ do_action( 'wpml_register_single_string', $this->url_strings_context(), $name, $product_base, false, $string_language );
191
+
192
+ if( isset($_POST['product_base_language'])){
193
+ $woocommerce_wpml->strings->set_string_language( $product_base, $this->url_strings_context(), $name, $_POST['product_base_language']);
194
+ }
195
+
196
+ if ( $product_base == $this->default_product_base ) {
197
+ $this->add_default_slug_translations( $product_base, $name );
198
+ }
199
+
200
+ // categories
201
+ $category_base = !empty( $permalink_options['category_base'] ) ? $permalink_options['category_base'] : $this->default_product_category_base;
202
+ $name = $this->url_string_name( 'product_cat' );
203
+
204
+ $string_language = $woocommerce_wpml->strings->get_string_language( $category_base, $this->url_strings_context(), $name );
205
+ if( is_null($string_language) ){
206
+ $string_language = '';
207
+ }
208
+ do_action( 'wpml_register_single_string', $this->url_strings_context(), $name, $category_base, false, $string_language );
209
+
210
+ if( isset($_POST['category_base_language'])){
211
+ $woocommerce_wpml->strings->set_string_language( $category_base, $this->url_strings_context(), $name, $_POST['category_base_language']);
212
+ }
213
+
214
+ if ( $category_base == $this->default_product_category_base ) {
215
+ $this->add_default_slug_translations( $category_base, $name );
216
+ }
217
+
218
+ // tags
219
+ $tag_base = !empty( $permalink_options['tag_base'] ) ? $permalink_options['tag_base'] : $this->default_product_tag_base;
220
+ $name = $this->url_string_name( 'product_tag' );
221
+
222
+ $string_language = $woocommerce_wpml->strings->get_string_language( $tag_base, $this->url_strings_context(), $name );
223
+ if( is_null($string_language) ){
224
+ $string_language = '';
225
+ }
226
+ do_action( 'wpml_register_single_string', $this->url_strings_context(), $name, $tag_base, false, $string_language );
227
+
228
+ if( isset($_POST['tag_base_language'])){
229
+ $woocommerce_wpml->strings->set_string_language( $tag_base, $this->url_strings_context(), $name, $_POST['tag_base_language']);
230
+ }
231
+
232
+ if ( $tag_base == $this->default_product_tag_base ) {
233
+ $this->add_default_slug_translations( $tag_base, $name );
234
+ }
235
+
236
+
237
+ if ( isset( $permalink_options['attribute_base'] ) && $permalink_options['attribute_base'] ) {
238
+ $attr_base = trim( $permalink_options['attribute_base'], '/' );
239
+
240
+ $string_language = $woocommerce_wpml->strings->get_string_language( $attr_base, $this->url_strings_context(), $name );
241
+ if( is_null($string_language) ){
242
+ $string_language = '';
243
+ }
244
+ do_action( 'wpml_register_single_string', $this->url_strings_context(), $this->url_string_name( 'attribute' ), $attr_base, false, $string_language );
245
+
246
+ if( isset($_POST['attribute_base_language'])){
247
+ $woocommerce_wpml->strings->set_string_language( $attr_base, $this->url_strings_context(), $this->url_string_name( 'attribute' ), $_POST['attribute_base_language']);
248
+ }
249
+ }
250
+
251
+ return $value;
252
+ }
253
+
254
+ function add_default_slug_translations( $slug, $name ) {
255
+ global $woocommerce_wpml, $sitepress, $wpdb;
256
+
257
+ $string_id = icl_get_string_id( $slug, $this->url_strings_context(), $name );
258
+
259
+ if ( WPML_SUPPORT_STRINGS_IN_DIFF_LANG ) {
260
+
261
+ $string_language = $woocommerce_wpml->strings->get_string_language( $slug, $this->url_strings_context(), $name );
262
+
263
+ // will use a filter in the future wpmlst-529
264
+ $string_object = new WPML_ST_String( $string_id, $wpdb );
265
+ $string_translation_statuses = $string_object->get_translation_statuses();
266
+
267
+ } else {
268
+
269
+ $string_language = $wpdb->get_var( $wpdb->prepare( "SELECT language FROM {$wpdb->prefix}icl_strings WHERE id=%d", $string_id ) );
270
+ $string_translation_statuses = $wpdb->get_results( $wpdb->prepare( "SELECT language, status FROM {$wpdb->prefix}icl_string_translations WHERE string_id=%d", $string_id ) );
271
+ }
272
+
273
+ foreach ( $string_translation_statuses as $s ) {
274
+ $string_translations[$s->language] = $s->status;
275
+ }
276
+
277
+ $languages = $sitepress->get_active_languages();
278
+
279
+ foreach ( $languages as $language => $language_info ) {
280
+
281
+ if ( $language != $string_language ) {
282
+
283
+ // check if there's an existing translation
284
+ if ( !isset( $string_translations[$language] ) ) {
285
+
286
+ $slug_translation = $woocommerce_wpml->strings->get_translation_from_woocommerce_mo_file( $slug, $language, false );
287
+
288
+ if ( $slug_translation ) {
289
+ // add string translation
290
+ icl_add_string_translation( $string_id, $language, $slug_translation, ICL_STRING_TRANSLATION_COMPLETE );
291
+ }
292
+
293
+ }
294
+
295
+ }
296
+ }
297
+
298
+ }
299
+
300
+ function force_bases_in_strings_languages( $value ) {
301
+ global $sitepress, $woocommerce_wpml;
302
+
303
+ if( $value && $sitepress->get_current_language() != 'en' ) {
304
+
305
+ remove_filter( 'gettext_with_context', array( $woocommerce_wpml->strings, 'category_base_in_strings_language' ), 99, 3 );
306
+ $taxonomies = array(
307
+ 'product_cat' => array(
308
+ 'base' => 'category_base',
309
+ 'base_translated' => _x( 'product-category', 'slug', 'woocommerce' ),
310
+ 'default' => $this->default_product_category_base
311
+ ),
312
+ 'product_tag' => array(
313
+ 'base' => 'tag_base',
314
+ 'base_translated' => _x( 'product-tag', 'slug', 'woocommerce' ),
315
+ 'default' => $this->default_product_tag_base
316
+ ),
317
+ );
318
+ add_filter( 'gettext_with_context', array( $woocommerce_wpml->strings, 'category_base_in_strings_language' ), 99, 3 );
319
+
320
+ foreach ( $taxonomies as $taxonomy => $taxonomy_details ) {
321
+
322
+ if ( empty( $this->wc_permalinks[$taxonomy_details['base']] ) && $value ) {
323
+
324
+ $new_value = array();
325
+ foreach ( $value as $k => $v ) {
326
+ $k = preg_replace( "#" . $taxonomy_details['base_translated'] . "/#", $taxonomy_details['default'] . '/', $k );
327
+ $new_value[$k] = $v;
328
+ }
329
+ $value = $new_value;
330
+ unset( $new_value );
331
+
332
+ }
333
+
334
+ }
335
+
336
+ }
337
+
338
+ return $value;
339
+
340
+ }
341
+
342
+ function translate_bases_in_rewrite_rules( $value ) {
343
+ global $sitepress, $sitepress_settings, $woocommerce_wpml;
344
+
345
+ if ( !empty( $sitepress_settings['posts_slug_translation']['on'] ) ) {
346
+ add_filter( 'option_rewrite_rules', array( 'WPML_Slug_Translation', 'rewrite_rules_filter' ), 1, 1 );
347
+ }
348
+
349
+ $cache_key = 'wcml_rewrite_filters_translate_taxonomies';
350
+
351
+ if ( $val = wp_cache_get( $cache_key ) ) {
352
+
353
+ $value = $val;
354
+
355
+ } else {
356
+
357
+ $taxonomies = array( 'product_cat', 'product_tag' );
358
+
359
+ foreach ( $taxonomies as $taxonomy ) {
360
+ $slug_details = $this->get_translated_tax_slug( $taxonomy );
361
+ $string_language = $woocommerce_wpml->strings->get_string_language( $slug_details['slug'], $this->url_strings_context(), $this->url_string_name( $taxonomy ) );
362
+ if ( $sitepress->get_current_language() == $string_language ) {
363
+ continue;
364
+ }
365
+
366
+ if ( $slug_details ) {
367
+ $buff_value = array();
368
+ foreach ( (array)$value as $k => $v ) {
369
+ if ( $slug_details['slug'] != $slug_details['translated_slug'] && preg_match( '#^[^/]*/?' . $slug_details['slug'] . '/#', $k ) ) {
370
+ $k = preg_replace( '#^([^/]*)(/?)' . $slug_details['slug'] . '/#', '$1$2' . $slug_details['translated_slug'] . '/', $k );
371
+ }
372
+ $buff_value[$k] = $v;
373
+ }
374
+ $value = $buff_value;
375
+ unset( $buff_value );
376
+ }
377
+
378
+ }
379
+
380
+ // handle attributes
381
+ $wc_taxonomies = wc_get_attribute_taxonomies();
382
+ $wc_taxonomies_wc_format = array();
383
+ foreach ( $wc_taxonomies as $k => $v ) {
384
+ $wc_taxonomies_wc_format[] = 'pa_' . $v->attribute_name;
385
+ }
386
+
387
+ foreach ( $wc_taxonomies_wc_format as $taxonomy ) {
388
+ $taxonomy_obj = get_taxonomy( $taxonomy );
389
+
390
+ if ( isset( $taxonomy_obj->rewrite['slug'] ) ) {
391
+ $exp = explode( '/', trim( $taxonomy_obj->rewrite['slug'], '/' ) );
392
+ $slug = join( '/', array_slice( $exp, 0, count( $exp ) - 1 ) );
393
+ }
394
+
395
+ if ( isset( $slug ) ) {
396
+ $string_language = $woocommerce_wpml->strings->get_string_language($slug, $this->url_strings_context(), $this->url_string_name( 'attribute' ) );
397
+
398
+ if ($sitepress->get_current_language() != $string_language) {
399
+
400
+ $slug_translation = apply_filters('wpml_translate_single_string', $slug, $this->url_strings_context(), $this->url_string_name( 'attribute' ) );
401
+ if ($slug_translation) {
402
+
403
+ $buff_value = array();
404
+ foreach ((array)$value as $k => $v) {
405
+ if ($slug != $slug_translation && preg_match('#^' . $slug . '/(.*)#', $k)) {
406
+ $k = preg_replace('#^' . $slug . '/(.*)#', $slug_translation . '/$1', $k);
407
+ }
408
+ $buff_value[$k] = $v;
409
+ }
410
+
411
+ $value = $buff_value;
412
+ unset($buff_value);
413
+
414
+ }
415
+
416
+ }
417
+ }
418
+
419
+ }
420
+
421
+ wp_cache_add( $cache_key, $value );
422
+
423
+ }
424
+
425
+
426
+ //filter shop page rewrite slug
427
+ $cache_key = 'wcml_rewrite_shop_slug';
428
+
429
+ if ( $val = wp_cache_get( $cache_key ) ) {
430
+
431
+ $value = $val;
432
+
433
+ } else {
434
+
435
+ $current_shop_id = woocommerce_get_page_id( 'shop' );
436
+ $default_shop_id = apply_filters( 'translate_object_id', $current_shop_id, 'page', true, $sitepress->get_default_language() );
437
+
438
+ if ( is_null( get_post( $current_shop_id ) ) || is_null( get_post( $default_shop_id ) ) )
439
+ return $value;
440
+
441
+ $current_slug = get_post( $current_shop_id )->post_name;
442
+ $default_slug = get_post( $default_shop_id )->post_name;
443
+
444
+
445
+ if ( $current_slug != $default_slug ) {
446
+ $buff_value = array();
447
+ foreach ( (array)$value as $k => $v ) {
448
+ if ( $current_slug != $default_slug && preg_match( '#^[^/]*/?' . $default_slug . '/page/#', $k ) ) {
449
+ $k = preg_replace( '#^([^/]*)(/?)' . $default_slug . '/#', '$1$2' . $current_slug . '/', $k );
450
+ }
451
+ $buff_value[$k] = $v;
452
+ }
453
+
454
+ $value = $buff_value;
455
+ unset( $buff_value );
456
+ }
457
+
458
+ wp_cache_add( $cache_key, $value );
459
+ }
460
+
461
+ return $value;
462
+ }
463
+
464
+ function translate_taxonomy_base( $termlink, $term, $taxonomy ) {
465
+ global $wp_rewrite, $wpml_term_translations, $sitepress;
466
+ static $no_recursion_flag;
467
+
468
+ // handles product categories, product tags and attributes
469
+
470
+ $wc_taxonomies = wc_get_attribute_taxonomies();
471
+ foreach ( $wc_taxonomies as $k => $v ) {
472
+ $wc_taxonomies_wc_format[] = 'pa_' . $v->attribute_name;
473
+ }
474
+
475
+ if ( ( $taxonomy == 'product_cat' || $taxonomy == 'product_tag' || ( !empty( $wc_taxonomies_wc_format ) && in_array( $taxonomy, $wc_taxonomies_wc_format ) ) ) && !$no_recursion_flag ) {
476
+
477
+ $cache_key = 'termlink#' . $taxonomy . '#' . $term->term_id;
478
+ if ( false && $link = wp_cache_get( $cache_key, 'terms' ) ) {
479
+ $termlink = $link;
480
+
481
+ } else {
482
+
483
+ $no_recursion_flag = false;
484
+
485
+ if ( !is_null( $wpml_term_translations ) ) {
486
+ $term_language = $term->term_id ? $wpml_term_translations->get_element_lang_code( $term->term_taxonomy_id ) : false;
487
+ } else {
488
+ $term_language = $term->term_id ? $sitepress->get_language_for_element( $term->term_taxonomy_id, 'tax_' . $taxonomy ) : false;
489
+ }
490
+
491
+ if ( $term_language ) {
492
+
493
+ $slug_details = $this->get_translated_tax_slug( $taxonomy, $term_language );
494
+
495
+ $base = $slug_details['slug'];
496
+ $base_translated = $slug_details['translated_slug'];
497
+
498
+ if ( !empty( $base_translated ) && $base_translated != $base && isset( $wp_rewrite->extra_permastructs[$taxonomy] ) ) {
499
+
500
+ $buff = $wp_rewrite->extra_permastructs[$taxonomy]['struct'];
501
+ $wp_rewrite->extra_permastructs[$taxonomy]['struct'] = str_replace( $base, $base_translated, $wp_rewrite->extra_permastructs[$taxonomy]['struct'] );
502
+ $no_recursion_flag = true;
503
+ $termlink = get_term_link( $term, $taxonomy );
504
+
505
+ $wp_rewrite->extra_permastructs[$taxonomy]['struct'] = $buff;
506
+
507
+ }
508
+
509
+ }
510
+
511
+ $no_recursion_flag = false;
512
+
513
+ wp_cache_add( $cache_key, $termlink, 'terms', 0 );
514
+ }
515
+
516
+ }
517
+
518
+ return $termlink;
519
+ }
520
+
521
+ function get_translated_tax_slug( $taxonomy, $language = false ) {
522
+ global $sitepress, $woocommerce_wpml;
523
+
524
+ switch ( $taxonomy ) {
525
+ case 'product_tag':
526
+ $slug = !empty( $this->wc_permalinks['tag_base'] ) ? trim( $this->wc_permalinks['tag_base'], '/' ) : 'product-tag';
527
+
528
+ $string_language = $woocommerce_wpml->strings->get_string_language( $slug, $this->url_strings_context(), $this->url_string_name( $taxonomy ) );
529
+
530
+ break;
531
+
532
+ case 'product_cat':
533
+ $slug = !empty( $this->wc_permalinks['category_base'] ) ? trim( $this->wc_permalinks['category_base'], '/' ) : 'product-category';
534
+
535
+ $string_language = $woocommerce_wpml->strings->get_string_language( $slug, $this->url_strings_context(), $this->url_string_name( $taxonomy ) );
536
+
537
+ break;
538
+
539
+ default:
540
+ $slug = trim( $this->wc_permalinks['attribute_base'], '/' );
541
+
542
+ $string_language = $woocommerce_wpml->strings->get_string_language( $slug, $this->url_strings_context(), $this->url_string_name( 'attribute' ) );
543
+
544
+ $taxonomy = 'attribute';
545
+
546
+ break;
547
+ }
548
+
549
+ if ( !$language ) {
550
+ $language = $sitepress->get_current_language();
551
+ }
552
+
553
+
554
+ if ( $slug && $language != $string_language ) {
555
+
556
+ if ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG ) {
557
+ $slug_translation = apply_filters( 'wpml_translate_single_string', $slug, $this->url_strings_context(), $this->url_string_name( $taxonomy ), $language );
558
+ } else {
559
+ $has_translation = false;
560
+ $slug_translation = apply_filters( 'wpml_translate_single_string', $slug, $this->url_strings_context(), $this->url_string_name( $taxonomy ), $language, $has_translation );
561
+ }
562
+
563
+
564
+ return array( 'slug' => $slug, 'translated_slug' => $slug_translation );
565
+ }
566
+
567
+ return array( 'slug' => $slug, 'translated_slug' => $slug );
568
+
569
+ }
570
+ }
inc/w3tc-compatibility.class.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WCML_WC_MultiCurrency_W3TC{
4
+
5
+ function __construct(){
6
+
7
+ add_filter( 'init' , array( $this, 'init' ), 15 );
8
+
9
+ }
10
+
11
+ function init(){
12
+
13
+ add_action( 'wcml_switch_currency', array( $this, 'flush_page_cache' ) );
14
+
15
+ }
16
+
17
+ function flush_page_cache(){
18
+ w3_require_once( W3TC_LIB_W3_DIR . '/AdminActions/FlushActionsAdmin.php' );
19
+ $flush = new W3_AdminActions_FlushActionsAdmin();
20
+ $flush->flush_pgcache();
21
+ }
22
+
23
+
24
+ }
inc/wc-strings.class.php CHANGED
@@ -1,7 +1,10 @@
1
  <?php
2
 
3
  class WCML_WC_Strings{
4
-
 
 
 
5
  function __construct(){
6
 
7
  add_action('init', array($this, 'init'));
@@ -13,7 +16,10 @@ class WCML_WC_Strings{
13
 
14
  function pre_init(){
15
  // Slug translation
16
- add_filter('gettext_with_context', array($this, 'translate_default_slug'), 2, 4);
 
 
 
17
  }
18
 
19
  function init(){
@@ -34,8 +40,13 @@ class WCML_WC_Strings{
34
  add_filter('woocommerce_countries_tax_or_vat', array($this, 'register_tax_label'));
35
 
36
  if(is_admin() && $pagenow == 'options-permalink.php'){
37
- add_filter('gettext_with_context', array($this, 'category_base_in_strings_language'), 99, 3);
38
- add_action('admin_footer', array($this, 'show_custom_url_base_language_requirement'));
 
 
 
 
 
39
  }
40
 
41
  if(is_admin() && $pagenow == 'admin.php' && isset($_GET['page']) && $_GET['page'] == 'wc-settings'){
@@ -56,7 +67,7 @@ class WCML_WC_Strings{
56
  }
57
 
58
  function translated_attribute_label($label, $name, $product_obj = false){
59
- global $sitepress,$product,$woocommerce;
60
 
61
  $product_id = false;
62
  $lang = $sitepress->get_current_language();
@@ -81,20 +92,15 @@ class WCML_WC_Strings{
81
  }
82
 
83
  if(is_admin() && !wpml_is_ajax()){
84
- global $wpdb,$sitepress_settings;
85
-
86
- $string_id = icl_get_string_id('taxonomy singular name: '.$label,'WordPress');
87
 
88
- if ( WPML_SUPPORT_STRINGS_IN_DIFF_LANG ) {
89
- $strings_language = icl_st_get_string_language( $string_id );
90
- }else{
91
- $strings_language = $sitepress_settings['st']['strings_language'];
92
- }
93
 
94
- if($string_id && $sitepress_settings['admin_default_language'] != $strings_language){
95
- $string = $wpdb->get_var($wpdb->prepare("SELECT value FROM {$wpdb->prefix}icl_string_translations WHERE string_id = %s and language = %s", $string_id, $sitepress_settings['admin_default_language']));
96
- if($string){
97
- return $string;
 
98
  }
99
  }else{
100
  return $label;
@@ -102,7 +108,7 @@ class WCML_WC_Strings{
102
 
103
  }
104
 
105
- $trnsl_label = apply_filters( 'wpml_translate_single_string', $label, 'WordPress','taxonomy singular name: '.$label, $lang );
106
 
107
  if( $label != $trnsl_label ){
108
  return $trnsl_label;
@@ -156,14 +162,13 @@ class WCML_WC_Strings{
156
 
157
 
158
  function translate_query_var_for_product($public_query_vars){
159
- global $wpdb, $sitepress, $sitepress_settings;
160
 
161
- $strings_language = $this->get_wc_context_language();
 
162
 
163
- if($sitepress->get_current_language() != $strings_language){
164
- $product_permalink = $this->product_permalink_slug();
165
-
166
- $translated_slug = $this->get_translated_product_base_by_lang(false,$product_permalink);
167
 
168
  if(isset($_GET[$translated_slug])){
169
  $buff = $_GET[$translated_slug];
@@ -176,29 +181,25 @@ class WCML_WC_Strings{
176
  return $public_query_vars;
177
  }
178
 
179
- function get_translated_product_base_by_lang($language = false, $product_permalink = false){
 
 
180
  if(!$language){
181
  global $sitepress;
182
  $language = $sitepress->get_current_language();
183
 
184
  }
185
 
186
- if(!$product_permalink){
187
- $product_permalink = $this->product_permalink_slug();
188
  }
189
 
190
- global $wpdb;
191
-
192
- // Use new API for WPML >= 3.2.3
193
- if ( apply_filters( 'wpml_slug_translation_available', false) ) {
194
- $translated_slug = apply_filters( 'wpml_get_translated_slug', $product_permalink, $language );
195
  } else {
196
- // Try the old way.
197
- $translated_slug = $wpdb->get_var($wpdb->prepare("
198
- SELECT t.value FROM {$wpdb->prefix}icl_string_translations t
199
- JOIN {$wpdb->prefix}icl_strings s ON t.string_id = s.id
200
- WHERE s.name=%s AND s.value = %s AND t.language = %s AND t.status = %d",
201
- 'URL slug: ' . $product_permalink, $product_permalink, $language, ICL_STRING_TRANSLATION_COMPLETE ));
202
  }
203
 
204
  return $translated_slug;
@@ -206,23 +207,16 @@ class WCML_WC_Strings{
206
 
207
  // Catch the default slugs for translation
208
  function translate_default_slug($translation, $text, $context, $domain) {
209
- global $sitepress_settings, $sitepress, $woocommerce_wpml;
210
 
211
  if ($context == 'slug' || $context == 'default-slug') {
212
- $wc_slug = $woocommerce_wpml->get_woocommerce_product_slug();
213
  if(is_admin()){
214
  $admin_language = $sitepress->get_admin_language();
215
  }
216
  $current_language = $sitepress->get_current_language();
217
- $strings_language = false;
218
- if ( WPML_SUPPORT_STRINGS_IN_DIFF_LANG ) {
219
- $context_ob = icl_st_get_context( 'WordPress' );
220
- if($context_ob){
221
- $strings_language = $context_ob->language;
222
- }
223
- }elseif(isset($sitepress_settings['st'])){
224
- $strings_language = $sitepress_settings['st']['strings_language'];
225
- }
226
 
227
  if ($text == $wc_slug && $domain == 'woocommerce' && $strings_language) {
228
  $sitepress->switch_lang($strings_language);
@@ -306,7 +300,6 @@ class WCML_WC_Strings{
306
  }
307
 
308
  function register_tax_label($label){
309
- global $sitepress;
310
 
311
  do_action('wpml_register_single_string', 'woocommerce', 'VAT_tax_label', $label );
312
  $label = apply_filters( 'wpml_translate_single_string', $label, 'woocommerce', 'VAT_tax_label' );
@@ -316,17 +309,100 @@ class WCML_WC_Strings{
316
 
317
  function show_custom_url_base_language_requirement(){
318
  $this->string_language_notice();
 
319
  ?>
320
  <script>
321
  if(jQuery('#woocommerce_permalink_structure').length){
322
  jQuery('#woocommerce_permalink_structure').parent().append(jQuery('#wpml_wcml_custom_base_req').html());
323
  }
324
- if(jQuery('input[name="woocommerce_product_category_slug"]').length){
325
- jQuery('input[name="woocommerce_product_category_slug"]').parent().append('<br><i><?php _e('Please use a different product category base than "category"', 'wpml-wcml') ?></i>');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
  }
327
  </script>
328
  <?php
329
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
330
  }
331
 
332
  function show_language_notice_for_wc_settings(){
@@ -373,9 +449,9 @@ class WCML_WC_Strings{
373
  echo '<div id="wpml_wcml_custom_base_req" style="display:none"><div><i>';
374
  if( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $sitepress_settings['st']['strings_language'] != $sitepress->get_default_language() ){
375
  $strings_language = $sitepress->get_language_details($sitepress_settings['st']['strings_language']);
376
- echo sprintf(__('Please enter this text in %s', 'wpml-wcml'), '<strong>' . $strings_language['display_name'] . '</strong>');
377
  echo '</i>&nbsp;<i class="icon-question-sign wcml_tootlip_icon" data-tip="';
378
- echo sprintf(__('You have to enter this text in the strings language ( %s ) so you can translate it using the WPML String Translation.', 'wpml-wcml'), $strings_language['display_name'] ).'">';
379
  }
380
  echo '</i></div></div>';
381
 
@@ -389,7 +465,7 @@ class WCML_WC_Strings{
389
  $default_language = $sitepress->get_language_details($sitepress->get_default_language());
390
  $strings_language = $sitepress->get_language_details($sitepress_settings['st']['strings_language']);
391
  echo '<div id="wpml_wcml_attr_language" style="display:none"><div class="icl_cyan_box"><i>';
392
- echo sprintf(__("You need to enter attribute names in %s (even though your site's default language is %s). Then, translate it to %s and the rest of the site's languages using in the %sWooCommerce Multlingual admin%s.", 'wpml-wcml'),
393
  $strings_language['display_name'],
394
  $default_language['display_name'], $default_language['display_name'],
395
  '<strong><a href="' . admin_url('admin.php?page=wpml-wcml') . '">', '</a></strong>');
@@ -435,34 +511,35 @@ class WCML_WC_Strings{
435
  }
436
 
437
 
438
- function get_missed_product_slag_translations_languages(){
439
- global $sitepress,$wpdb,$sitepress_settings;
440
 
441
  $slug = $this->product_permalink_slug();
442
- $default_language = $sitepress->get_default_language();
443
 
444
- if ( apply_filters( 'wpml_slug_translation_available', false) ) {
445
- // Use new API for WPML >= 3.2.3
446
- $slug_translation_languages = apply_filters( 'wpml_get_slug_translation_languages', array(), $slug );
 
 
 
 
 
447
  } else {
448
- $slug_translation_languages = $wpdb->get_col($wpdb->prepare("SELECT tr.language FROM {$wpdb->prefix}icl_strings AS s LEFT JOIN {$wpdb->prefix}icl_string_translations AS tr ON s.id = tr.string_id WHERE s.name = %s AND s.value = %s AND tr.status = %s", 'URL slug: ' . $slug, $slug, ICL_STRING_TRANSLATION_COMPLETE));
 
449
  }
450
- $miss_slug_lang = array();
451
 
452
- if ( WPML_SUPPORT_STRINGS_IN_DIFF_LANG ) {
453
 
454
- $context_ob = icl_st_get_context( 'WordPress' );
455
- if($context_ob){
456
- $strings_language = $context_ob->language;
457
- }else{
458
- $strings_language = false;
459
- }
460
- }else{
461
- $strings_language = $sitepress_settings['st']['strings_language'];
462
- }
463
 
464
  foreach( $sitepress->get_active_languages() as $lang_info ){
465
- if( !in_array( $lang_info['code'], $slug_translation_languages ) && $lang_info['code'] != $strings_language ){
 
 
 
 
 
466
  $miss_slug_lang[] = ucfirst($lang_info['display_name']);
467
  }
468
  }
@@ -478,18 +555,20 @@ class WCML_WC_Strings{
478
  return $slug;
479
  }
480
 
481
- function get_wc_context_language(){
482
 
483
  if ( WPML_SUPPORT_STRINGS_IN_DIFF_LANG ) {
 
484
 
485
- $context_ob = icl_st_get_context( 'woocommerce' );
486
- if($context_ob){
487
- $context_language = $context_ob->language;
 
488
  }else{
489
- $context_language = false;
490
  }
491
 
492
- return $context_language;
493
  }else{
494
  global $sitepress_settings;
495
 
@@ -497,11 +576,63 @@ class WCML_WC_Strings{
497
  return $sitepress_settings['st']['strings_language'];
498
  }
499
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
500
  return false;
501
  }
502
 
503
  }
504
 
 
505
  /*
506
  * Filter breadcrumbs
507
  *
@@ -509,11 +640,12 @@ class WCML_WC_Strings{
509
  function filter_woocommerce_breadcrumbs( $breadcrumbs, $object ){
510
  global $sitepress;
511
 
512
- if( $sitepress->get_current_language() != $this->get_wc_context_language() ){
513
 
514
  $permalinks = get_option( 'woocommerce_permalinks' );
 
515
  $shop_page_id = wc_get_page_id( 'shop' );
516
- $orig_shop_page = get_post( apply_filters( 'translate_object_id', $shop_page_id, 'page', true, $this->get_wc_context_language() ) );
517
 
518
  // If permalinks contain the shop page in the URI prepend the breadcrumb with shop
519
  // Similar to WC_Breadcrumb::prepend_shop_page
@@ -533,8 +665,9 @@ class WCML_WC_Strings{
533
  $i++;
534
  }
535
  $breadcrumbs = $breadcrumbs_buff;
536
- }
537
 
 
 
538
 
539
  }
540
 
@@ -550,20 +683,25 @@ class WCML_WC_Strings{
550
  if( isset( $_GET['post'] ) && $sitepress->get_default_language() != $sitepress->get_current_language() ){
551
  $original_product_id = apply_filters( 'translate_object_id', $_GET['post'], 'product', true, $sitepress->get_default_language() );
552
 
553
- printf( '<p>'.__('In order to edit custom attributes you need to use the <a href="%s">custom product translation editor</a>', 'wpml-wcml').'</p>', admin_url('admin.php?page=wpml-wcml&tab=products&prid='.$original_product_id ) );
554
  }
555
  }
556
 
557
  function translate_attribute_taxonomies_labels( $attribute_taxonomies ){
 
558
 
559
  if( is_admin() && !wpml_is_ajax() ){
560
 
561
- global $wpdb,$sitepress;
562
-
563
  foreach( $attribute_taxonomies as $key => $attribute_taxonomy ){
564
- $string = $wpdb->get_var($wpdb->prepare("SELECT st.value FROM {$wpdb->prefix}icl_string_translations AS st JOIN {$wpdb->prefix}icl_strings AS s ON s.id = st.string_id WHERE s.context = %s AND s.name = %s AND st.language = %s", 'WordPress', 'taxonomy singular name: '.$attribute_taxonomy->attribute_name, $sitepress->get_current_language() ) );
565
- if($string) {
566
- $attribute_taxonomies[$key]->attribute_label = $string;
 
 
 
 
 
 
567
  }
568
  }
569
 
@@ -573,4 +711,41 @@ class WCML_WC_Strings{
573
  return $attribute_taxonomies;
574
  }
575
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
576
  }
1
  <?php
2
 
3
  class WCML_WC_Strings{
4
+
5
+ private $translations_from_mo_file = array();
6
+ private $mo_files = array();
7
+
8
  function __construct(){
9
 
10
  add_action('init', array($this, 'init'));
16
 
17
  function pre_init(){
18
  // Slug translation
19
+ if( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG ){
20
+ add_filter('gettext_with_context', array($this, 'translate_default_slug'), 2, 4);
21
+ }
22
+
23
  }
24
 
25
  function init(){
40
  add_filter('woocommerce_countries_tax_or_vat', array($this, 'register_tax_label'));
41
 
42
  if(is_admin() && $pagenow == 'options-permalink.php'){
43
+ add_filter( 'gettext_with_context', array( $this, 'category_base_in_strings_language' ), 99, 3 );
44
+
45
+ if( WPML_SUPPORT_STRINGS_IN_DIFF_LANG ) {
46
+ add_action( 'admin_footer', array( $this, 'show_custom_url_base_translation_links' ) );
47
+ }
48
+
49
+ add_action('admin_footer', array($this, 'show_custom_url_base_language_requirement'));
50
  }
51
 
52
  if(is_admin() && $pagenow == 'admin.php' && isset($_GET['page']) && $_GET['page'] == 'wc-settings'){
67
  }
68
 
69
  function translated_attribute_label($label, $name, $product_obj = false){
70
+ global $sitepress,$product;
71
 
72
  $product_id = false;
73
  $lang = $sitepress->get_current_language();
92
  }
93
 
94
  if(is_admin() && !wpml_is_ajax()){
95
+ global $sitepress_settings;
 
 
96
 
97
+ $string_language = $this->get_string_language( 'taxonomy singular name: '.$label, 'WordPress' );
 
 
 
 
98
 
99
+ if($sitepress_settings['admin_default_language'] != $string_language){
100
+ $string_id = icl_get_string_id( 'taxonomy singular name: '.$label, 'WordPress' );
101
+ $strings = icl_get_string_translations_by_id($string_id);
102
+ if($strings){
103
+ return $strings[$sitepress_settings['admin_default_language']]['value'];
104
  }
105
  }else{
106
  return $label;
108
 
109
  }
110
 
111
+ $trnsl_label = apply_filters( 'wpml_translate_single_string', $label, 'WordPress', 'taxonomy singular name: '.$label, $lang );
112
 
113
  if( $label != $trnsl_label ){
114
  return $trnsl_label;
162
 
163
 
164
  function translate_query_var_for_product($public_query_vars){
165
+ global $woocommerce_wpml, $sitepress;
166
 
167
+ $product_permalink = $this->product_permalink_slug();
168
+ $string_language = $this->get_string_language( $product_permalink, $woocommerce_wpml->url_translation->url_strings_context(), $woocommerce_wpml->url_translation->url_string_name('product') );
169
 
170
+ if($sitepress->get_current_language() != $string_language){
171
+ $translated_slug = $this->get_translated_product_base_by_lang( false,$product_permalink );
 
 
172
 
173
  if(isset($_GET[$translated_slug])){
174
  $buff = $_GET[$translated_slug];
181
  return $public_query_vars;
182
  }
183
 
184
+ function get_translated_product_base_by_lang($language = false, $product_slug = false){
185
+ global $woocommerce_wpml;
186
+
187
  if(!$language){
188
  global $sitepress;
189
  $language = $sitepress->get_current_language();
190
 
191
  }
192
 
193
+ if(!$product_slug){
194
+ $product_slug = $this->product_permalink_slug();
195
  }
196
 
197
+ if ( version_compare( WPML_ST_VERSION, '2.3', '>=' ) ) {
198
+ $translated_slug = apply_filters( 'wpml_get_translated_slug', $product_slug, 'product' , $language );
199
+ }elseif ( apply_filters( 'wpml_slug_translation_available', false) ) {
200
+ $translated_slug = apply_filters( 'wpml_get_translated_slug', 'product' , $language );
 
201
  } else {
202
+ $translated_slug = apply_filters( 'wpml_translate_single_string', $product_slug, $woocommerce_wpml->url_translation->url_strings_context(), $woocommerce_wpml->url_translation->url_string_name( 'product' ) );
 
 
 
 
 
203
  }
204
 
205
  return $translated_slug;
207
 
208
  // Catch the default slugs for translation
209
  function translate_default_slug($translation, $text, $context, $domain) {
210
+ global $sitepress, $woocommerce_wpml;
211
 
212
  if ($context == 'slug' || $context == 'default-slug') {
213
+ $wc_slug = $woocommerce_wpml->url_translation->get_woocommerce_product_base();
214
  if(is_admin()){
215
  $admin_language = $sitepress->get_admin_language();
216
  }
217
  $current_language = $sitepress->get_current_language();
218
+
219
+ $strings_language = $this->get_domain_language('woocommerce');
 
 
 
 
 
 
 
220
 
221
  if ($text == $wc_slug && $domain == 'woocommerce' && $strings_language) {
222
  $sitepress->switch_lang($strings_language);
300
  }
301
 
302
  function register_tax_label($label){
 
303
 
304
  do_action('wpml_register_single_string', 'woocommerce', 'VAT_tax_label', $label );
305
  $label = apply_filters( 'wpml_translate_single_string', $label, 'woocommerce', 'VAT_tax_label' );
309
 
310
  function show_custom_url_base_language_requirement(){
311
  $this->string_language_notice();
312
+ $category_base = ($c = get_option('category_base') ) ? $c : 'category';
313
  ?>
314
  <script>
315
  if(jQuery('#woocommerce_permalink_structure').length){
316
  jQuery('#woocommerce_permalink_structure').parent().append(jQuery('#wpml_wcml_custom_base_req').html());
317
  }
318
+ if(jQuery('input[name="woocommerce_product_category_slug"]').length && jQuery('input[name="woocommerce_product_category_slug"]').val() == '<?php echo $category_base ?>'){
319
+ jQuery('input[name="woocommerce_product_category_slug"]').parent().append('<br><i class="icon-warning-sign"><?php
320
+ _e('You are using the same value as for the regular category base. This is known to create conflicts resulting in urls not working properly.', 'woocommerce-multilingual') ?></i>');
321
+ }
322
+ </script>
323
+ <?php
324
+
325
+ }
326
+
327
+ function show_custom_url_base_translation_links(){
328
+ global $woocommerce_wpml,$sitepress;
329
+
330
+ ?>
331
+ <script>
332
+ var inputs = ['woocommerce_product_category_slug', 'woocommerce_product_tag_slug', 'woocommerce_product_attribute_slug', 'product_permalink_structure'];
333
+
334
+ for(i in inputs){
335
+ var input = jQuery('input[name="' + inputs[i] + '"]');
336
+ if(input.length){
337
+
338
+ if(inputs[i] == 'product_permalink_structure' && jQuery('input[name="product_permalink"]:checked').val() == '' ){
339
+ input = jQuery('input[name="product_permalink"]:checked').closest('.form-table').find('code').eq(0);
340
+ }
341
+
342
+ input.parent().append('<div class="translation_controls"></div>');
343
+
344
+ if(inputs[i] == 'woocommerce_product_attribute_slug' && input.val() == '' ){
345
+
346
+ input.parent().find('.translation_controls').append('&nbsp;');
347
+
348
+ }else{
349
+ input.parent().find('.translation_controls').append('<a href="<?php
350
+ echo admin_url( 'admin.php?page=' . WPML_ST_FOLDER . '/menu/string-translation.php&context='. urlencode($woocommerce_wpml->url_translation->url_strings_context()) )
351
+ ?>"><?php _e('translations', 'woocommerce-multilingual') ?></a>');
352
+ }
353
+
354
+ }
355
  }
356
  </script>
357
  <?php
358
 
359
+ $lang_selector = new WPML_Simple_Language_Selector( $sitepress );
360
+
361
+ $permalink_options = get_option( 'woocommerce_permalinks' );
362
+
363
+ $bases = array( 'tag_base' => 'product_tag', 'category_base' => 'product_cat', 'attribute_base' => 'attribute', 'product_base' => 'product' );
364
+
365
+ foreach( $bases as $key => $base ){
366
+
367
+ switch($base){
368
+ case 'product_tag':
369
+ $input_name = 'woocommerce_product_tag_slug';
370
+ $value = !empty( $permalink_options['tag_base'] ) ? $permalink_options['tag_base'] : $woocommerce_wpml->url_translation->default_product_tag_base;
371
+ break;
372
+ case 'product_cat':
373
+ $input_name = 'woocommerce_product_category_slug';
374
+ $value = !empty( $permalink_options['category_base'] ) ? $permalink_options['category_base'] : $woocommerce_wpml->url_translation->default_product_category_base;
375
+ break;
376
+ case 'attribute':
377
+ $input_name = 'woocommerce_product_attribute_slug';
378
+ $value = !empty( $permalink_options['attribute_base'] ) ? $permalink_options['attribute_base'] : '';
379
+ break;
380
+ case 'product':
381
+ $input_name = 'product_permalink_structure';
382
+ $value = !empty( $permalink_options['product_base'] ) ? trim( $permalink_options['product_base'], '/' ) : $woocommerce_wpml->url_translation->default_product_base;
383
+ break;
384
+ }
385
+
386
+ $language = $this->get_string_language( trim( $value, '/' ), $woocommerce_wpml->url_translation->url_strings_context(), $woocommerce_wpml->url_translation->url_string_name( $base ) );
387
+
388
+ if( is_null($language) ){
389
+ $language = $sitepress->get_default_language();
390
+ }
391
+
392
+ echo $lang_selector->render( array( 'id' => $key.'_language_selector', 'name' => $key.'_language', 'selected' => $language, 'show_please_select' => false ) ); ?>
393
+
394
+ <script>
395
+ var input = jQuery('input[name="<?php echo $input_name ?>"]');
396
+
397
+ if( '<?php echo $input_name ?>' == 'product_permalink_structure' && jQuery('input[name="product_permalink"]:checked').val() == '' ){
398
+
399
+ input = jQuery('input[name="product_permalink"]:checked').closest('.form-table').find('code').eq(0);
400
+ }
401
+
402
+ jQuery('#<?php echo $key ?>_language_selector').appendTo( input.parent().find('.translation_controls') );
403
+ </script>
404
+ <?php }
405
+
406
  }
407
 
408
  function show_language_notice_for_wc_settings(){
449
  echo '<div id="wpml_wcml_custom_base_req" style="display:none"><div><i>';
450
  if( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $sitepress_settings['st']['strings_language'] != $sitepress->get_default_language() ){
451
  $strings_language = $sitepress->get_language_details($sitepress_settings['st']['strings_language']);
452
+ echo sprintf(__('Please enter this text in %s', 'woocommerce-multilingual'), '<strong>' . $strings_language['display_name'] . '</strong>');
453
  echo '</i>&nbsp;<i class="icon-question-sign wcml_tootlip_icon" data-tip="';
454
+ echo sprintf(__('You have to enter this text in the strings language ( %s ) so you can translate it using the WPML String Translation.', 'woocommerce-multilingual'), $strings_language['display_name'] ).'">';
455
  }
456
  echo '</i></div></div>';
457
 
465
  $default_language = $sitepress->get_language_details($sitepress->get_default_language());
466
  $strings_language = $sitepress->get_language_details($sitepress_settings['st']['strings_language']);
467
  echo '<div id="wpml_wcml_attr_language" style="display:none"><div class="icl_cyan_box"><i>';
468
+ echo sprintf(__("You need to enter attribute names in %s (even though your site's default language is %s). Then, translate it to %s and the rest of the site's languages using in the %sWooCommerce Multlingual admin%s.", 'woocommerce-multilingual'),
469
  $strings_language['display_name'],
470
  $default_language['display_name'], $default_language['display_name'],
471
  '<strong><a href="' . admin_url('admin.php?page=wpml-wcml') . '">', '</a></strong>');
511
  }
512
 
513
 
514
+ function get_missed_product_slug_translations_languages(){
515
+ global $sitepress, $woocommerce_wpml;
516
 
517
  $slug = $this->product_permalink_slug();
 
518
 
519
+ if ( has_filter( 'wpml_slug_translation_available') ) {
520
+
521
+ if( version_compare( WPML_ST_VERSION, '2.2.6', '>' ) ){
522
+ $slug_translation_languages = apply_filters( 'wpml_get_slug_translation_languages', array(), 'product' );
523
+ } else {
524
+ $slug_translation_languages = apply_filters( 'wpml_get_slug_translation_languages', array(), $slug );
525
+ }
526
+
527
  } else {
528
+ $string_id = icl_get_string_id( $slug, $woocommerce_wpml->url_translation->url_strings_context(), $woocommerce_wpml->url_translation->url_string_name('product') );
529
+ $slug_translations = icl_get_string_translations_by_id( $string_id );
530
  }
 
531
 
532
+ $miss_slug_lang = array();
533
 
534
+ $string_language = $this->get_string_language( $slug, $woocommerce_wpml->url_translation->url_strings_context(), $woocommerce_wpml->url_translation->url_string_name('product') );
 
 
 
 
 
 
 
 
535
 
536
  foreach( $sitepress->get_active_languages() as $lang_info ){
537
+ if(
538
+ (
539
+ ( isset( $slug_translations ) && !array_key_exists( $lang_info['code'], $slug_translations ) ) ||
540
+ ( isset( $slug_translation_languages ) && !in_array( $lang_info['code'], $slug_translation_languages ) )
541
+ ) && $lang_info['code'] != $string_language
542
+ ){
543
  $miss_slug_lang[] = ucfirst($lang_info['display_name']);
544
  }
545
  }
555
  return $slug;
556
  }
557
 
558
+ function get_domain_language( $domain ){
559
 
560
  if ( WPML_SUPPORT_STRINGS_IN_DIFF_LANG ) {
561
+ global $sitepress;
562
 
563
+ $lang_of_domain = new WPML_Language_Of_Domain( $sitepress );
564
+ $domain_lang = $lang_of_domain->get_language( $domain );
565
+ if ( $domain_lang ) {
566
+ $source_lang = $domain_lang;
567
  }else{
568
+ $source_lang = 'en';
569
  }
570
 
571
+ return $source_lang;
572
  }else{
573
  global $sitepress_settings;
574
 
576
  return $sitepress_settings['st']['strings_language'];
577
  }
578
 
579
+ return 'en';
580
+ }
581
+
582
+ }
583
+
584
+ // TODO will use a filter in the future wpmlst-529
585
+ function get_string_language( $value, $context, $name = false ){
586
+
587
+ if ( WPML_SUPPORT_STRINGS_IN_DIFF_LANG ) {
588
+ global $wpdb;
589
+
590
+ if( $name !== false ){
591
+
592
+ $string_language = apply_filters( 'wpml_get_string_language', null, $context, $name );
593
+
594
+ }else{
595
+
596
+ $string_id = icl_get_string_id( $value, $context, $name );
597
+
598
+ $string_object = new WPML_ST_String($string_id, $wpdb);
599
+ $string_language = $string_object->get_language();
600
+
601
+ }
602
+
603
+
604
+ return $string_language;
605
+ }else{
606
+ global $sitepress_settings;
607
+
608
+ if ( isset($sitepress_settings['st']['strings_language']) ){
609
+ return $sitepress_settings['st']['strings_language'];
610
+ }
611
+
612
+ return 'en';
613
+ }
614
+
615
+ }
616
+
617
+ function set_string_language( $value, $context, $name , $language ){
618
+
619
+ if ( WPML_SUPPORT_STRINGS_IN_DIFF_LANG ) {
620
+ global $wpdb;
621
+
622
+ $string_id = icl_get_string_id( $value, $context, $name );
623
+
624
+ $string_object = new WPML_ST_String( $string_id, $wpdb );
625
+ $string_language = $string_object->set_language( $language );
626
+
627
+ return $string_language;
628
+ }else{
629
+
630
  return false;
631
  }
632
 
633
  }
634
 
635
+
636
  /*
637
  * Filter breadcrumbs
638
  *
640
  function filter_woocommerce_breadcrumbs( $breadcrumbs, $object ){
641
  global $sitepress;
642
 
643
+ if( $sitepress->get_current_language() != $sitepress->get_default_language() ){
644
 
645
  $permalinks = get_option( 'woocommerce_permalinks' );
646
+
647
  $shop_page_id = wc_get_page_id( 'shop' );
648
+ $orig_shop_page = get_post( apply_filters( 'translate_object_id', $shop_page_id, 'page', true, $sitepress->get_default_language() ) );
649
 
650
  // If permalinks contain the shop page in the URI prepend the breadcrumb with shop
651
  // Similar to WC_Breadcrumb::prepend_shop_page
665
  $i++;
666
  }
667
  $breadcrumbs = $breadcrumbs_buff;
 
668
 
669
+ $breadcrumbs = array_values($breadcrumbs);
670
+ }
671
 
672
  }
673
 
683
  if( isset( $_GET['post'] ) && $sitepress->get_default_language() != $sitepress->get_current_language() ){
684
  $original_product_id = apply_filters( 'translate_object_id', $_GET['post'], 'product', true, $sitepress->get_default_language() );
685
 
686
+ printf( '<p>'.__('In order to edit custom attributes you need to use the <a href="%s">custom product translation editor</a>', 'woocommerce-multilingual').'</p>', admin_url('admin.php?page=wpml-wcml&tab=products&prid='.$original_product_id ) );
687
  }
688
  }
689
 
690
  function translate_attribute_taxonomies_labels( $attribute_taxonomies ){
691
+ global $sitepress;
692
 
693
  if( is_admin() && !wpml_is_ajax() ){
694
 
 
 
695
  foreach( $attribute_taxonomies as $key => $attribute_taxonomy ){
696
+ $string_language = $this->get_string_language( $attribute_taxonomy->attribute_name, 'WordPress', 'taxonomy singular name: '.$attribute_taxonomy->attribute_name );
697
+
698
+ if( $sitepress->get_current_language() == $string_language ) continue;
699
+
700
+ $string_id = icl_get_string_id( $attribute_taxonomy->attribute_name, 'WordPress', 'taxonomy singular name: '.$attribute_taxonomy->attribute_name );
701
+ $strings = icl_get_string_translations_by_id( $string_id );
702
+
703
+ if($strings && isset($strings[$sitepress->get_current_language()])) {
704
+ $attribute_taxonomies[$key]->attribute_label = $strings[$sitepress->get_current_language()]['value'];
705
  }
706
  }
707
 
711
  return $attribute_taxonomies;
712
  }
713
 
714
+ function get_translation_from_woocommerce_mo_file( $string, $language, $return_original = true ){
715
+ global $sitepress;
716
+
717
+ $original_string = $string;
718
+
719
+ if ( ! isset( $this->translations_from_mo_file[ $original_string ][ $language ] ) ) {
720
+
721
+ if ( ! isset( $this->translations_from_mo_file[ $original_string ] ) ) {
722
+ $this->translations_from_mo_file[ $original_string ] = array();
723
+ }
724
+
725
+ if ( ! isset( $this->mo_files[ $language ] ) ) {
726
+ $mo = new MO();
727
+ $mo_file = WP_LANG_DIR . '/plugins/woocommerce-' . $sitepress->get_locale( $language ) . '.mo';
728
+ if( !file_exists( $mo_file ) ){
729
+ return $return_original ? $string : null;
730
+ }
731
+
732
+ $mo->import_from_file( $mo_file );
733
+ $this->mo_files[ $language ] = &$mo->entries;
734
+ }
735
+
736
+ if( in_array( $string, array( 'product','product-category','product-tag' ) ) ){
737
+ $string = 'slug'. chr(4) .$string;
738
+ }
739
+
740
+ if( isset( $this->mo_files[ $language ][$string] ) ){
741
+ $this->translations_from_mo_file[ $original_string ][ $language ] = $this->mo_files[ $language ][$string]->translations[0];
742
+ } else {
743
+ $this->translations_from_mo_file[ $original_string ][ $language ] = $return_original ? $original_string : null;
744
+ }
745
+ }
746
+
747
+ return $this->translations_from_mo_file[ $original_string ][ $language ];
748
+
749
+ }
750
+
751
  }
inc/xdomain-data.class.php CHANGED
@@ -4,7 +4,7 @@ class xDomain_Data{
4
 
5
  function __construct(){
6
 
7
- add_filter( 'WPML_cross_domain_language_data', array( $this, 'pass_data_to_domain' ) );
8
 
9
  add_action( 'init', array( $this, 'check_request' ) );
10
  }
@@ -39,13 +39,21 @@ class xDomain_Data{
39
 
40
  function check_request(){
41
 
42
- if( isset($_GET['xdomain_data']) ){
43
- $xdomain_data = json_decode( base64_decode( $_GET['xdomain_data'] ), JSON_OBJECT_AS_ARRAY );
44
- if(isset($xdomain_data[ 'wcsid' ])){
45
- $this->set_session_data( $xdomain_data[ 'wcsid' ] );
 
 
 
 
46
  }
47
  }
48
 
 
 
 
 
49
  }
50
 
51
  function set_session_data( $wcml_session_id ){
4
 
5
  function __construct(){
6
 
7
+ add_filter( 'wpml_cross_domain_language_data', array( $this, 'pass_data_to_domain' ) );
8
 
9
  add_action( 'init', array( $this, 'check_request' ) );
10
  }
39
 
40
  function check_request(){
41
 
42
+ if( has_filter( 'wpml_get_cross_domain_language_data' ) ){ // After WPML 3.2.7
43
+
44
+ $xdomain_data = apply_filters('wpml_get_cross_domain_language_data', array());
45
+
46
+ } else {
47
+ if (isset($_GET['xdomain_data'])) {
48
+ $xdomain_data = json_decode(base64_decode($_GET['xdomain_data']), JSON_OBJECT_AS_ARRAY);
49
+
50
  }
51
  }
52
 
53
+ if (isset($xdomain_data['wcsid'])) {
54
+ $this->set_session_data($xdomain_data['wcsid']);
55
+ }
56
+
57
  }
58
 
59
  function set_session_data( $wcml_session_id ){
locale/woocommerce-multilingual-ar.mo ADDED
Binary file
locale/woocommerce-multilingual-de_DE.mo ADDED
Binary file
locale/woocommerce-multilingual-el.mo ADDED
Binary file
locale/woocommerce-multilingual-es_ES.mo ADDED
Binary file
locale/woocommerce-multilingual-fr_FR.mo ADDED
Binary file
locale/woocommerce-multilingual-he_IL.mo ADDED
Binary file
locale/woocommerce-multilingual-it_IT.mo ADDED
Binary file
locale/woocommerce-multilingual-ja.mo ADDED
Binary file
locale/woocommerce-multilingual-ko_KR.mo ADDED
Binary file
locale/woocommerce-multilingual-nl_NL.mo ADDED
Binary file
locale/woocommerce-multilingual-pl_PL.mo ADDED
Binary file
locale/woocommerce-multilingual-pt_BR.mo ADDED
Binary file
locale/woocommerce-multilingual-pt_PT.mo ADDED
Binary file
locale/woocommerce-multilingual-ru_RU.mo ADDED
Binary file
locale/woocommerce-multilingual-sv_SE.mo ADDED
Binary file
locale/woocommerce-multilingual-uk_UA.mo ADDED
Binary file
locale/woocommerce-multilingual-vi.mo ADDED
Binary file
locale/woocommerce-multilingual-zh_CN.mo ADDED
Binary file
locale/woocommerce-multilingual-zh_TW.mo ADDED
Binary file
locale/wpml-wcml-ar.mo DELETED
Binary file
locale/wpml-wcml-de_DE.mo DELETED
Binary file
locale/wpml-wcml-el.mo DELETED
Binary file
locale/wpml-wcml-es_ES.mo DELETED
Binary file
locale/wpml-wcml-fr_FR.mo DELETED
Binary file
locale/wpml-wcml-he_IL.mo DELETED
Binary file
locale/wpml-wcml-it_IT.mo DELETED
Binary file
locale/wpml-wcml-ja.mo DELETED
Binary file
locale/wpml-wcml-ko_KR.mo DELETED
Binary file
locale/wpml-wcml-nl_NL.mo DELETED
Binary file
locale/wpml-wcml-pl_PL.mo DELETED
Binary file
locale/wpml-wcml-pt_BR.mo DELETED
Binary file
locale/wpml-wcml-pt_PT.mo DELETED
Binary file
locale/wpml-wcml-ru_RU.mo DELETED
Binary file
locale/wpml-wcml-sv_SE.mo DELETED
Binary file
locale/wpml-wcml-uk_UA.mo DELETED
Binary file
locale/wpml-wcml-vi.mo DELETED
Binary file
locale/wpml-wcml-zh_CN.mo DELETED
Binary file
locale/wpml-wcml-zh_TW.mo DELETED
Binary file
menu/management.php CHANGED
@@ -31,15 +31,15 @@ if(isset($_GET['tab'])){
31
 
32
  <div class="wrap">
33
  <div id="icon-wpml" class="icon32"><br /></div>
34
- <h2><?php _e('WooCommerce Multilingual', 'wpml-wcml') ?></h2>
35
 
36
  <?php if(current_user_can('wpml_manage_woocommerce_multilingual')): ?>
37
- <a class="nav-tab <?php echo $current_tab == 'settings' ?'nav-tab-active':''; ?>" href="<?php echo admin_url('admin.php?page=wpml-wcml'); ?>"><?php _e('General settings', 'wpml-wcml') ?></a>
38
  <?php endif; ?>
39
- <a class="nav-tab <?php echo $current_tab == 'products' ? 'nav-tab-active' : ''; ?>" href="<?php echo admin_url('admin.php?page=wpml-wcml&tab=products'); ?>"><?php _e('Products', 'wpml-wcml') ?></a>
40
  <?php if( current_user_can('wpml_operate_woocommerce_multilingual')): ?>
41
  <?php foreach($products_and_variation_taxonomies as $tax_key => $tax): if(!$sitepress->is_translated_taxonomy($tax_key)) continue; ?>
42
- <a class="nav-tab <?php echo (isset($_GET['tab']) && $_GET['tab'] == $tax_key)?'nav-tab-active':''; ?>" href="<?php echo admin_url('admin.php?page=wpml-wcml&tab='.$tax_key); ?>" <?php if(!WCML_Terms::is_fully_translated($tax_key)): ?>title="<?php esc_attr_e('You have untranslated terms!', 'wpml-wcml'); ?>"<?php endif;?>>
43
  <?php echo $tax->labels->name ?>
44
  <?php if(!WCML_Terms::is_fully_translated($tax_key)): ?>
45
  &nbsp;<i class="icon-warning-sign"></i>
@@ -47,7 +47,7 @@ if(isset($_GET['tab'])){
47
  </a>
48
  <?php endforeach; ?>
49
  <?php foreach($all_products_taxonomies as $tax_key => $tax): if(!$sitepress->is_translated_taxonomy($tax_key) || $tax_key == 'product_type') continue; ?>
50
- <a class="js-tax-tab-<?php echo $tax_key ?> nav-tab <?php echo (isset($_GET['tab']) && $_GET['tab'] == $tax_key)?'nav-tab-active':''; ?>" href="<?php echo admin_url('admin.php?page=wpml-wcml&tab='.$tax_key); ?>" <?php if(!WCML_Terms::is_fully_translated($tax_key)): ?>title="<?php esc_attr_e('You have untranslated terms!', 'wpml-wcml'); ?>"<?php endif;?>>
51
  <?php echo $tax->labels->name ?>
52
  <?php if(!WCML_Terms::is_fully_translated($tax_key)): ?>
53
  &nbsp;<i class="icon-warning-sign"></i>
31
 
32
  <div class="wrap">
33
  <div id="icon-wpml" class="icon32"><br /></div>
34
+ <h2><?php _e('WooCommerce Multilingual', 'woocommerce-multilingual') ?></h2>
35
 
36
  <?php if(current_user_can('wpml_manage_woocommerce_multilingual')): ?>
37
+ <a class="nav-tab <?php echo $current_tab == 'settings' ?'nav-tab-active':''; ?>" href="<?php echo admin_url('admin.php?page=wpml-wcml'); ?>"><?php _e('General settings', 'woocommerce-multilingual') ?></a>
38
  <?php endif; ?>
39
+ <a class="nav-tab <?php echo $current_tab == 'products' ? 'nav-tab-active' : ''; ?>" href="<?php echo admin_url('admin.php?page=wpml-wcml&tab=products'); ?>"><?php _e('Products', 'woocommerce-multilingual') ?></a>
40
  <?php if( current_user_can('wpml_operate_woocommerce_multilingual')): ?>
41
  <?php foreach($products_and_variation_taxonomies as $tax_key => $tax): if(!$sitepress->is_translated_taxonomy($tax_key)) continue; ?>
42
+ <a class="nav-tab <?php echo (isset($_GET['tab']) && $_GET['tab'] == $tax_key)?'nav-tab-active':''; ?>" href="<?php echo admin_url('admin.php?page=wpml-wcml&tab='.$tax_key); ?>" <?php if(!WCML_Terms::is_fully_translated($tax_key)): ?>title="<?php esc_attr_e('You have untranslated terms!', 'woocommerce-multilingual'); ?>"<?php endif;?>>
43
  <?php echo $tax->labels->name ?>
44
  <?php if(!WCML_Terms::is_fully_translated($tax_key)): ?>
45
  &nbsp;<i class="icon-warning-sign"></i>
47
  </a>
48
  <?php endforeach; ?>
49
  <?php foreach($all_products_taxonomies as $tax_key => $tax): if(!$sitepress->is_translated_taxonomy($tax_key) || $tax_key == 'product_type') continue; ?>
50
+ <a class="js-tax-tab-<?php echo $tax_key ?> nav-tab <?php echo (isset($_GET['tab']) && $_GET['tab'] == $tax_key)?'nav-tab-active':''; ?>" href="<?php echo admin_url('admin.php?page=wpml-wcml&tab='.$tax_key); ?>" <?php if(!WCML_Terms::is_fully_translated($tax_key)): ?>title="<?php esc_attr_e('You have untranslated terms!', 'woocommerce-multilingual'); ?>"<?php endif;?>>
51
  <?php echo $tax->labels->name ?>
52
  <?php if(!WCML_Terms::is_fully_translated($tax_key)): ?>
53
  &nbsp;<i class="icon-warning-sign"></i>
menu/plugins.php CHANGED
@@ -1,54 +1,54 @@
1
  <?php global $woocommerce_wpml, $sitepress; ?>
2
  <div class="wrap">
3
  <div id="icon-wpml" class="icon32"><br /></div>
4
- <h2><?php _e('WooCommerce Multilingual', 'wpml-wcml') ?></h2>
5
- <a class="nav-tab nav-tab-active" href="<?php echo admin_url('admin.php?page=wpml-wcml'); ?>"><?php _e('Required plugins', 'wpml-wcml') ?></a>
6
  <div class="wcml_wrap">
7
  <div class="wcml-section">
8
  <div class="wcml-section-header">
9
  <h3>
10
- <?php _e('Plugins Status','wpml-wcml'); ?>
11
- <i class="icon-question-signp" data-tip="<?php _e('WooCommerce Multilingual depends on several plugins to work. If any required plugin is missing, you should install and activate it.', 'wpml-wcml') ?>"></i>
12
  </h3>
13
  </div>
14
  <div class="wcml-section-content">
15
  <ul>
16
  <?php if (defined('ICL_SITEPRESS_VERSION') && version_compare(ICL_SITEPRESS_VERSION, '2.0.5', '<')) : ?>
17
- <li><i class="icon-warning-sign"></i> <?php printf(__('WooCommerce Multilingual is enabled but not effective. It is not compatible with <a href="%s">WPML</a> versions prior 2.0.5.', 'wpml-wcml'), $woocommerce_wpml->generate_tracking_link('http://wpml.org/')); ?> <a href="<?php echo $woocommerce_wpml->generate_tracking_link('http://wpml.org/shop/account/',false,'account') ?>" target="_blank"><?php _e('Update WPML', 'wpml-wcml'); ?></a></li>
18
  <?php elseif (defined('ICL_SITEPRESS_VERSION')) : ?>
19
- <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'wpml-wcml'), '<strong>WPML</strong>'); ?></li>
20
  <?php if($sitepress->setup()): ?>
21
- <li><i class="icon-ok"></i> <?php printf(__('%s is set up.', 'wpml-wcml'), '<strong>WPML</strong>'); ?></li>
22
  <?php else: ?>
23
- <li><i class="icon-warning-sign"></i> <?php printf(__('%s is not set up.', 'wpml-wcml'), '<strong>WPML</strong>'); ?></li>
24
  <?php endif; ?>
25
  <?php else : ?>
26
- <li><i class="icon-warning-sign"></i> <?php printf(__('%s plugin is either not installed or not active.', 'wpml-wcml'), '<strong>WPML</strong>'); ?> <a href="<?php echo $woocommerce_wpml->generate_tracking_link('http://wpml.org/') ?>" target="_blank"><?php _e('Get WPML', 'wpml-wcml'); ?></a></li>
27
  <?php endif; ?>
28
  <?php if (defined('WPML_MEDIA_VERSION')) : ?>
29
- <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'wpml-wcml'), '<strong>WPML Media</strong>'); ?></li>
30
  <?php else : ?>
31
- <li><i class="icon-warning-sign"></i> <?php printf(__('%s plugin is either not installed or not active.', 'wpml-wcml'), '<strong>WPML Media</strong>'); ?> <a href="<?php echo $woocommerce_wpml->generate_tracking_link('http://wpml.org/') ?>" target="_blank"><?php _e('Get WPML Media', 'wpml-wcml'); ?></a></li>
32
  <?php endif; ?>
33
  <?php if (defined('WPML_TM_VERSION')) : ?>
34
- <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'wpml-wcml'), '<strong>WPML Translation Management</strong>'); ?></li>
35
  <?php else : ?>
36
- <li><i class="icon-warning-sign"></i> <?php printf(__('%s plugin is either not installed or not active.', 'wpml-wcml'), '<strong>WPML Translation Management</strong>'); ?> <a href="<?php echo $woocommerce_wpml->generate_tracking_link('http://wpml.org/') ?>" target="_blank"><?php _e('Get WPML Translation Management', 'wpml-wcml'); ?></a></li>
37
  <?php endif; ?>
38
  <?php if (defined('WPML_ST_VERSION')) : ?>
39
- <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'wpml-wcml'), '<strong>WPML String Translation</strong>'); ?></li>
40
  <?php else : ?>
41
- <li><i class="icon-warning-sign"></i> <?php printf(__('%s plugin is either not installed or not active.', 'wpml-wcml'), '<strong>WPML String Translation</strong>'); ?> <a href="<?php echo $woocommerce_wpml->generate_tracking_link('http://wpml.org/') ?>" target="_blank"><?php _e('Get WPML String Translation', 'wpml-wcml'); ?></a></li>
42
  <?php endif; ?>
43
  <?php
44
  global $woocommerce;
45
  if (class_exists('Woocommerce') && $woocommerce && isset($woocommerce->version) && version_compare($woocommerce->version, '2.0', '<')) :
46
  ?>
47
- <li><i class="icon-warning-sign"></i> <?php printf(__('%1$s is installed, but with incorrect version. You need %1$s %2$s or higher. ', 'wpml-wcml'), '<strong>WooCommerce</strong>', '2.0'); ?> <a href="http://wordpress.org/extend/plugins/woocommerce/" target="_blank"><?php _e('Download WooCommerce', 'wpml-wcml'); ?></a></li>
48
  <?php elseif (class_exists('Woocommerce')) : ?>
49
- <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'wpml-wcml'), '<strong>WooCommerce</strong>'); ?></li>
50
  <?php else : ?>
51
- <li><i class="icon-warning-sign"></i> <?php printf(__('%s plugin is either not installed or not active.', 'wpml-wcml'), '<strong>WooCommerce</strong>'); ?> <a href="http://wordpress.org/extend/plugins/woocommerce/" target="_blank"><?php _e('Download WooCommerce', 'wpml-wcml'); ?></a></li>
52
  <?php endif; ?>
53
  </ul>
54
  </div> <!-- .wcml-section-content -->
1
  <?php global $woocommerce_wpml, $sitepress; ?>
2
  <div class="wrap">
3
  <div id="icon-wpml" class="icon32"><br /></div>
4
+ <h2><?php _e('WooCommerce Multilingual', 'woocommerce-multilingual') ?></h2>
5
+ <a class="nav-tab nav-tab-active" href="<?php echo admin_url('admin.php?page=wpml-wcml'); ?>"><?php _e('Required plugins', 'woocommerce-multilingual') ?></a>
6
  <div class="wcml_wrap">
7
  <div class="wcml-section">
8
  <div class="wcml-section-header">
9
  <h3>
10
+ <?php _e('Plugins Status', 'woocommerce-multilingual'); ?>
11
+ <i class="icon-question-signp" data-tip="<?php _e('WooCommerce Multilingual depends on several plugins to work. If any required plugin is missing, you should install and activate it.', 'woocommerce-multilingual') ?>"></i>
12
  </h3>
13
  </div>
14
  <div class="wcml-section-content">
15
  <ul>
16
  <?php if (defined('ICL_SITEPRESS_VERSION') && version_compare(ICL_SITEPRESS_VERSION, '2.0.5', '<')) : ?>
17
+ <li><i class="icon-warning-sign"></i> <?php printf(__('WooCommerce Multilingual is enabled but not effective. It is not compatible with <a href="%s">WPML</a> versions prior 2.0.5.', 'woocommerce-multilingual'), $woocommerce_wpml->generate_tracking_link('http://wpml.org/')); ?> <a href="<?php echo $woocommerce_wpml->generate_tracking_link('http://wpml.org/shop/account/',false,'account') ?>" target="_blank"><?php _e('Update WPML', 'woocommerce-multilingual'); ?></a></li>
18
  <?php elseif (defined('ICL_SITEPRESS_VERSION')) : ?>
19
+ <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'woocommerce-multilingual'), '<strong>WPML</strong>'); ?></li>
20
  <?php if($sitepress->setup()): ?>
21
+ <li><i class="icon-ok"></i> <?php printf(__('%s is set up.', 'woocommerce-multilingual'), '<strong>WPML</strong>'); ?></li>
22
  <?php else: ?>
23
+ <li><i class="icon-warning-sign"></i> <?php printf(__('%s is not set up.', 'woocommerce-multilingual'), '<strong>WPML</strong>'); ?></li>
24
  <?php endif; ?>
25
  <?php else : ?>
26
+ <li><i class="icon-warning-sign"></i> <?php printf(__('%s plugin is either not installed or not active.', 'woocommerce-multilingual'), '<strong>WPML</strong>'); ?> <a href="<?php echo $woocommerce_wpml->generate_tracking_link('http://wpml.org/') ?>" target="_blank"><?php _e('Get WPML', 'woocommerce-multilingual'); ?></a></li>
27
  <?php endif; ?>
28
  <?php if (defined('WPML_MEDIA_VERSION')) : ?>
29
+ <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'woocommerce-multilingual'), '<strong>WPML Media</strong>'); ?></li>
30
  <?php else : ?>
31
+ <li><i class="icon-warning-sign"></i> <?php printf(__('%s plugin is either not installed or not active.', 'woocommerce-multilingual'), '<strong>WPML Media</strong>'); ?> <a href="<?php echo $woocommerce_wpml->generate_tracking_link('http://wpml.org/') ?>" target="_blank"><?php _e('Get WPML Media', 'woocommerce-multilingual'); ?></a></li>
32
  <?php endif; ?>
33
  <?php if (defined('WPML_TM_VERSION')) : ?>
34
+ <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'woocommerce-multilingual'), '<strong>WPML Translation Management</strong>'); ?></li>
35
  <?php else : ?>
36
+ <li><i class="icon-warning-sign"></i> <?php printf(__('%s plugin is either not installed or not active.', 'woocommerce-multilingual'), '<strong>WPML Translation Management</strong>'); ?> <a href="<?php echo $woocommerce_wpml->generate_tracking_link('http://wpml.org/') ?>" target="_blank"><?php _e('Get WPML Translation Management', 'woocommerce-multilingual'); ?></a></li>
37
  <?php endif; ?>
38
  <?php if (defined('WPML_ST_VERSION')) : ?>
39
+ <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'woocommerce-multilingual'), '<strong>WPML String Translation</strong>'); ?></li>
40
  <?php else : ?>
41
+ <li><i class="icon-warning-sign"></i> <?php printf(__('%s plugin is either not installed or not active.', 'woocommerce-multilingual'), '<strong>WPML String Translation</strong>'); ?> <a href="<?php echo $woocommerce_wpml->generate_tracking_link('http://wpml.org/') ?>" target="_blank"><?php _e('Get WPML String Translation', 'woocommerce-multilingual'); ?></a></li>
42
  <?php endif; ?>
43
  <?php
44
  global $woocommerce;
45
  if (class_exists('Woocommerce') && $woocommerce && isset($woocommerce->version) && version_compare($woocommerce->version, '2.0', '<')) :
46
  ?>
47
+ <li><i class="icon-warning-sign"></i> <?php printf(__('%1$s is installed, but with incorrect version. You need %1$s %2$s or higher. ', 'woocommerce-multilingual'), '<strong>WooCommerce</strong>', '2.0'); ?> <a href="http://wordpress.org/extend/plugins/woocommerce/" target="_blank"><?php _e('Download WooCommerce', 'woocommerce-multilingual'); ?></a></li>
48
  <?php elseif (class_exists('Woocommerce')) : ?>
49
+ <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'woocommerce-multilingual'), '<strong>WooCommerce</strong>'); ?></li>
50
  <?php else : ?>
51
+ <li><i class="icon-warning-sign"></i> <?php printf(__('%s plugin is either not installed or not active.', 'woocommerce-multilingual'), '<strong>WooCommerce</strong>'); ?> <a href="http://wordpress.org/extend/plugins/woocommerce/" target="_blank"><?php _e('Download WooCommerce', 'woocommerce-multilingual'); ?></a></li>
52
  <?php endif; ?>
53
  </ul>
54
  </div> <!-- .wcml-section-content -->
menu/sub/currency-switcher-options.php CHANGED
@@ -8,14 +8,14 @@ $currency_switcher_style = isset($settings['currency_switcher_style'])?$settings
8
 
9
  <div class="wcml-section-header">
10
  <h3>
11
- <?php _e('Currency switcher options', 'wpml-wcml'); ?>
12
- <i class="icon-question-sign" data-tip="<?php _e('You can customize currency switcher on front-end', 'wpml-wcml') ?>"></i>
13
  </h3>
14
  </div>
15
 
16
  <div class="wcml-section-content">
17
  <div class="wcml-section-content-inner">
18
- <h4><?php _e('Currency order', 'wpml-wcml'); ?></h4>
19
  <?php
20
  $wc_currencies = get_woocommerce_currencies();
21
 
@@ -32,49 +32,49 @@ $currency_switcher_style = isset($settings['currency_switcher_style'])?$settings
32
  </ul>
33
  <span style="display:none;" class="wcml_currencies_order_ajx_resp"></span>
34
  <input type="hidden" id="wcml_currencies_order_order_nonce" value="<?php echo wp_create_nonce('set_currencies_order_nonce') ?>" />
35
- <p class="explanation-text"><?php _e('Drag the currencies to change their order', 'wpml-wcml') ?></p>
36
  </div>
37
  <div class="wcml-section-content-inner">
38
- <h4><?php _e('Currency switcher style', 'wpml-wcml'); ?></h4>
39
  <ul class="wcml_curr_style">
40
  <li>
41
  <label for="wcml_curr_sel_stype">
42
  <input type="radio" name="currency_switcher_style" value="dropdown" <?php if(!$currency_switcher_style || $currency_switcher_style == 'dropdown'):?>checked="checked"<?php endif?> />
43
- <?php echo __('Drop-down menu', 'wpml-wcml') ?>
44
  </label>
45
  </li>
46
  <li>
47
  <label for="wcml_curr_sel_orientation">
48
  <input type="radio" name="currency_switcher_style" value="list" <?php if($currency_switcher_style == 'list'):?>checked="checked"<?php endif?> />
49
- <?php echo __('List of currencies', 'wpml-wcml') ?>
50
  </label>
51
  <select id="wcml_curr_sel_orientation" name="wcml_curr_sel_orientation" <?php if($currency_switcher_style != 'list'): ?>style="display: none;"<?php endif;?>>
52
- <option value="vertical"><?php _e('Vertical', 'wpml-wcml') ?></option>
53
- <option value="horizontal" <?php if(isset($settings['wcml_curr_sel_orientation']) && $settings['wcml_curr_sel_orientation'] == 'horizontal'): ?>selected="selected"<?php endif;?>><?php _e('Horizontal', 'wpml-wcml') ?></option>
54
  </select>
55
  </li>
56
  </ul>
57
  </div>
58
  <div class="wcml-section-content-inner">
59
- <h4><?php _e('Visibility', 'wpml-wcml'); ?></h4>
60
  <ul class="wcml_curr_visibility">
61
  <li>
62
  <label>
63
  <input type="checkbox" name="currency_switcher_product_visibility" value="1" <?php echo checked( 1, isset($settings['currency_switcher_product_visibility'])?$settings['currency_switcher_product_visibility']:1 ) ?>>
64
- <?php echo __('Show a currency selector on the product page template', 'wpml-wcml') ?>
65
  </label>
66
  </li>
67
  </ul>
68
  </div>
69
  <div class="wcml-section-content-inner">
70
- <h4><?php _e('Available parameters', 'wpml-wcml'); ?></h4>
71
- <span class="explanation-text"><?php _e('%name%, %symbol%, %code%', 'wpml-wcml'); ?></span>
72
- <h4><?php _e('Template for currency switcher', 'wpml-wcml'); ?></h4>
73
  <input type="text" name="wcml_curr_template" value="<?php echo isset($settings['wcml_curr_template'])?$settings['wcml_curr_template']:''; ?>" />
74
- <span class="explanation-text"><?php _e('Default: %name% (%symbol%) - %code%', 'wpml-wcml'); ?></span>
75
  <input type="hidden" id="currency_switcher_default" value="%name% (%symbol%) - %code%" />
76
  <div id="wcml_curr_sel_preview_wrap">
77
- <p><strong><?php _e('Currency switcher preview', 'wpml-wcml')?></strong></p>
78
  <input type="hidden" id="wcml_currencies_switcher_preview_nonce" value="<?php echo wp_create_nonce('wcml_currencies_switcher_preview') ?>" />
79
  <div id="wcml_curr_sel_preview">
80
  <?php echo $woocommerce_wpml->multi_currency_support->currency_switcher(); ?>
@@ -83,7 +83,7 @@ $currency_switcher_style = isset($settings['currency_switcher_style'])?$settings
83
  </div>
84
  </div>
85
  <p class="button-wrap general_option_btn">
86
- <input type='submit' name="currency_switcher_options" value='<?php _e('Save', 'wpml-wcml'); ?>' class='button-secondary' />
87
  <?php wp_nonce_field('currency_switcher_options', 'currency_switcher_options_nonce'); ?>
88
  </p>
89
 
8
 
9
  <div class="wcml-section-header">
10
  <h3>
11
+ <?php _e('Currency switcher options', 'woocommerce-multilingual'); ?>
12
+ <i class="icon-question-sign" data-tip="<?php _e('You can customize currency switcher on front-end', 'woocommerce-multilingual') ?>"></i>
13
  </h3>
14
  </div>
15
 
16
  <div class="wcml-section-content">
17
  <div class="wcml-section-content-inner">
18
+ <h4><?php _e('Currency order', 'woocommerce-multilingual'); ?></h4>
19
  <?php
20
  $wc_currencies = get_woocommerce_currencies();
21
 
32
  </ul>
33
  <span style="display:none;" class="wcml_currencies_order_ajx_resp"></span>
34
  <input type="hidden" id="wcml_currencies_order_order_nonce" value="<?php echo wp_create_nonce('set_currencies_order_nonce') ?>" />
35
+ <p class="explanation-text"><?php _e('Drag the currencies to change their order', 'woocommerce-multilingual') ?></p>
36
  </div>
37
  <div class="wcml-section-content-inner">
38
+ <h4><?php _e('Currency switcher style', 'woocommerce-multilingual'); ?></h4>
39
  <ul class="wcml_curr_style">
40
  <li>
41
  <label for="wcml_curr_sel_stype">
42
  <input type="radio" name="currency_switcher_style" value="dropdown" <?php if(!$currency_switcher_style || $currency_switcher_style == 'dropdown'):?>checked="checked"<?php endif?> />
43
+ <?php echo __('Drop-down menu', 'woocommerce-multilingual') ?>
44
  </label>
45
  </li>
46
  <li>
47
  <label for="wcml_curr_sel_orientation">
48
  <input type="radio" name="currency_switcher_style" value="list" <?php if($currency_switcher_style == 'list'):?>checked="checked"<?php endif?> />
49
+ <?php echo __('List of currencies', 'woocommerce-multilingual') ?>
50
  </label>
51
  <select id="wcml_curr_sel_orientation" name="wcml_curr_sel_orientation" <?php if($currency_switcher_style != 'list'): ?>style="display: none;"<?php endif;?>>
52
+ <option value="vertical"><?php _e('Vertical', 'woocommerce-multilingual') ?></option>
53
+ <option value="horizontal" <?php if(isset($settings['wcml_curr_sel_orientation']) && $settings['wcml_curr_sel_orientation'] == 'horizontal'): ?>selected="selected"<?php endif;?>><?php _e('Horizontal', 'woocommerce-multilingual') ?></option>
54
  </select>
55
  </li>
56
  </ul>
57
  </div>
58
  <div class="wcml-section-content-inner">
59
+ <h4><?php _e('Visibility', 'woocommerce-multilingual'); ?></h4>
60
  <ul class="wcml_curr_visibility">
61
  <li>
62
  <label>
63
  <input type="checkbox" name="currency_switcher_product_visibility" value="1" <?php echo checked( 1, isset($settings['currency_switcher_product_visibility'])?$settings['currency_switcher_product_visibility']:1 ) ?>>
64
+ <?php echo __('Show a currency selector on the product page template', 'woocommerce-multilingual') ?>
65
  </label>
66
  </li>
67
  </ul>
68
  </div>
69
  <div class="wcml-section-content-inner">
70
+ <h4><?php _e('Available parameters', 'woocommerce-multilingual'); ?></h4>
71
+ <span class="explanation-text"><?php _e('%name%, %symbol%, %code%', 'woocommerce-multilingual'); ?></span>
72
+ <h4><?php _e('Template for currency switcher', 'woocommerce-multilingual'); ?></h4>
73
  <input type="text" name="wcml_curr_template" value="<?php echo isset($settings['wcml_curr_template'])?$settings['wcml_curr_template']:''; ?>" />
74
+ <span class="explanation-text"><?php _e('Default: %name% (%symbol%) - %code%', 'woocommerce-multilingual'); ?></span>
75
  <input type="hidden" id="currency_switcher_default" value="%name% (%symbol%) - %code%" />
76
  <div id="wcml_curr_sel_preview_wrap">
77
+ <p><strong><?php _e('Currency switcher preview', 'woocommerce-multilingual')?></strong></p>
78
  <input type="hidden" id="wcml_currencies_switcher_preview_nonce" value="<?php echo wp_create_nonce('wcml_currencies_switcher_preview') ?>" />
79
  <div id="wcml_curr_sel_preview">
80
  <?php echo $woocommerce_wpml->multi_currency_support->currency_switcher(); ?>
83
  </div>
84
  </div>
85
  <p class="button-wrap general_option_btn">
86
+ <input type='submit' name="currency_switcher_options" value='<?php _e('Save', 'woocommerce-multilingual'); ?>' class='button-secondary' />
87
  <?php wp_nonce_field('currency_switcher_options', 'currency_switcher_options_nonce'); ?>
88
  </p>
89
 
menu/sub/custom-box.php CHANGED
@@ -1,5 +1,5 @@
1
- <button id="custom_block_link_<?php echo $lang ?>" class="button-secondary js-table-toggle prod_images_link<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" data-text-opened="<?php _e('Collapse','wpml-wcml'); ?>" data-text-closed="<?php _e('Expand','wpml-wcml'); ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>>
2
- <span><?php _e('Expand','wpml-wcml'); ?></span>
3
  <i class="icon-caret-down"></i>
4
  </button>
5
 
1
+ <button id="custom_block_link_<?php echo $lang ?>" class="button-secondary js-table-toggle prod_images_link<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" data-text-opened="<?php _e('Collapse', 'woocommerce-multilingual'); ?>" data-text-closed="<?php _e('Expand', 'woocommerce-multilingual'); ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>>
2
+ <span><?php _e('Expand', 'woocommerce-multilingual'); ?></span>
3
  <i class="icon-caret-down"></i>
4
  </button>
5
 
menu/sub/custom-currency-options.php CHANGED
@@ -5,72 +5,72 @@
5
  <table id="wcml_currency_options_<?php echo $code ?>" class="wcml_currency_options_popup">
6
  <tr>
7
  <td>
8
- <h4><?php printf(__('Currency options for %s', 'wpml-wcml'), '<strong>' . $currency_name . ' (' . $currency_symbol . ')</strong>') ?></h4>
9
  <hr />
10
  <table>
11
 
12
  <tr>
13
- <td align="right"><?php _e('Exchange Rate', 'wpml-wcml') ?></td>
14
  <td>
15
- <?php printf("1 %s = %s %s", $wc_currency, '<input name="currency_options[' . $code . '][rate]" type="number" class="ext_rate" step="0.01" value="' . $currency['rate'] . '" data-message="'. __( 'Only numeric', 'wpml-wcml' ) .'" />', $code) ?>
16
  </td>
17
  </tr>
18
  <tr>
19
  <td>&nbsp;</td>
20
- <td><small><i><?php printf(__('Set on %s', 'wpml-wcml'), date('F j, Y, H:i', strtotime(isset($currency['updated'])? $currency['updated']: time()))); ?></i></small></td>
21
  </tr>
22
 
23
  <tr>
24
  <td colspan="2"><hr /></td>
25
  </tr>
26
  <tr>
27
- <td align="right"><?php _e('Currency Position', 'wpml-wcml') ?></td>
28
  <td>
29
  <select name="currency_options[<?php echo $code ?>][position]">
30
  <option value="left" <?php selected('left', $currency['position'], 1); ?>><?php
31
- echo $post_str['left'] = sprintf(__('Left (%s99.99)', 'wpml-wcml'),
32
  $currency_symbol); ?></option>
33
  <option value="right" <?php selected('right', $currency['position'], 1); ?>><?php
34
- echo $post_str['right'] = sprintf(__('Right (99.99%s)', 'wpml-wcml'),
35
  $currency_symbol); ?></option>
36
  <option value="left_space" <?php selected('left_space', $currency['position'], 1); ?>><?php
37
- echo $post_str['left_space'] = sprintf(__('Left with space (%s 99.99)', 'wpml-wcml'),
38
  $currency_symbol); ?></option>
39
  <option value="right_space" <?php selected('right_space', $currency['position'], 1); ?>><?php
40
- echo $post_str['right_space'] = sprintf(__('Right with space (99.99 %s)', 'wpml-wcml'),
41
  $currency_symbol); ?></option>
42
  </select>
43
  </td>
44
  </tr>
45
  <tr>
46
- <td align="right"><?php _e('Thousand Separator', 'wpml-wcml') ?></td>
47
  <td><input name="currency_options[<?php echo $code ?>][thousand_sep]" type="text" class="currency_option_input" value="<?php echo esc_attr($currency['thousand_sep']) ?>" /></td>
48
  </tr>
49
  <tr>
50
- <td align="right"><?php _e('Decimal Separator', 'wpml-wcml') ?></td>
51
  <td><input name="currency_options[<?php echo $code ?>][decimal_sep]" type="text" class="currency_option_input" value="<?php echo esc_attr($currency['decimal_sep']) ?>" /></td>
52
  </tr>
53
  <tr>
54
- <td align="right"><?php _e('Number of Decimals', 'wpml-wcml') ?></td>
55
- <td><input name="currency_options[<?php echo $code ?>][num_decimals]" type="number" class="decimals_number" value="<?php echo esc_attr($currency['num_decimals']) ?>" min="0" step="1" data-message="<?php _e( 'Only numeric', 'wpml-wcml' ); ?>" /></td>
56
  </tr>
57
 
58
  <tr>
59
  <td colspan="2"><hr /></td>
60
  </tr>
61
  <tr>
62
- <td align="right"><?php _e('Rounding to the nearest integer', 'wpml-wcml') ?></td>
63
  <td>
64
  <select name="currency_options[<?php echo $code ?>][rounding]">
65
- <option value="disabled" <?php selected('disabled', $currency['rounding']) ?> ><?php _e('disabled', 'wpml-wcml') ?></option>
66
- <option value="up" <?php selected('up', $currency['rounding']) ?>><?php _e('up', 'wpml-wcml') ?></option>
67
- <option value="down" <?php selected('down', $currency['rounding']) ?>><?php _e('down', 'wpml-wcml') ?></option>
68
- <option value="down" <?php selected('nearest', $currency['rounding']) ?>><?php _e('nearest', 'wpml-wcml') ?></option>
69
  </select>
70
  </td>
71
  </tr>
72
  <tr>
73
- <td align="right"><?php _e('Increment for nearest integer', 'wpml-wcml') ?></td>
74
  <td>
75
  <select name="currency_options[<?php echo $code ?>][rounding_increment]">
76
  <option value="1" <?php selected('1', $currency['rounding_increment']) ?> >1</option>
@@ -81,9 +81,9 @@
81
  </td>
82
  </tr>
83
  <tr>
84
- <td align="right"><?php _e('Autosubtract amount', 'wpml-wcml') ?></td>
85
  <td>
86
- <input name="currency_options[<?php echo $code ?>][auto_subtract]" class="abstract_amount" value="<?php echo $currency['auto_subtract'] ?>" type="number" value="0" data-message="<?php _e( 'Only numeric', 'wpml-wcml' ); ?>" />
87
  </td>
88
  </tr>
89
  </table>
@@ -94,8 +94,8 @@
94
 
95
  <tr>
96
  <td colspan="2" align="right">
97
- <input type="button" class="button-secondary currency_options_cancel" value="<?php esc_attr_e('Cancel', 'wpml-wcml') ?>" data-currency="<?php echo $code ?>" />&nbsp;
98
- <input type="submit" class="button-primary currency_options_save" value="<?php esc_attr_e('Save', 'wpml-wcml') ?>" data-currency="<?php echo $code ?>" />
99
  <input type="hidden" id="save_currency_nonce" value="<?php echo wp_create_nonce('save_currency'); ?>" />
100
  <br /><br />
101
  </td>
5
  <table id="wcml_currency_options_<?php echo $code ?>" class="wcml_currency_options_popup">
6
  <tr>
7
  <td>
8
+ <h4><?php printf(__('Currency options for %s', 'woocommerce-multilingual'), '<strong>' . $currency_name . ' (' . $currency_symbol . ')</strong>') ?></h4>
9
  <hr />
10
  <table>
11
 
12
  <tr>
13
+ <td align="right"><?php _e('Exchange Rate', 'woocommerce-multilingual') ?></td>
14
  <td>
15
+ <?php printf("1 %s = %s %s", $wc_currency, '<input name="currency_options[' . $code . '][rate]" type="number" class="ext_rate" step="0.01" value="' . $currency['rate'] . '" data-message="'. __( 'Only numeric', 'woocommerce-multilingual' ) .'" />', $code) ?>
16
  </td>
17
  </tr>
18
  <tr>
19
  <td>&nbsp;</td>
20
+ <td><small><i><?php printf(__('Set on %s', 'woocommerce-multilingual'), date('F j, Y, H:i', strtotime(isset($currency['updated'])? $currency['updated']: time()))); ?></i></small></td>
21
  </tr>
22
 
23
  <tr>
24
  <td colspan="2"><hr /></td>
25
  </tr>
26
  <tr>
27
+ <td align="right"><?php _e('Currency Position', 'woocommerce-multilingual') ?></td>
28
  <td>
29
  <select name="currency_options[<?php echo $code ?>][position]">
30
  <option value="left" <?php selected('left', $currency['position'], 1); ?>><?php
31
+ echo $post_str['left'] = sprintf(__('Left (%s99.99)', 'woocommerce-multilingual'),
32
  $currency_symbol); ?></option>
33
  <option value="right" <?php selected('right', $currency['position'], 1); ?>><?php
34
+ echo $post_str['right'] = sprintf(__('Right (99.99%s)', 'woocommerce-multilingual'),
35
  $currency_symbol); ?></option>
36
  <option value="left_space" <?php selected('left_space', $currency['position'], 1); ?>><?php
37
+ echo $post_str['left_space'] = sprintf(__('Left with space (%s 99.99)', 'woocommerce-multilingual'),
38
  $currency_symbol); ?></option>
39
  <option value="right_space" <?php selected('right_space', $currency['position'], 1); ?>><?php
40
+ echo $post_str['right_space'] = sprintf(__('Right with space (99.99 %s)', 'woocommerce-multilingual'),
41
  $currency_symbol); ?></option>
42
  </select>
43
  </td>
44
  </tr>
45
  <tr>
46
+ <td align="right"><?php _e('Thousand Separator', 'woocommerce-multilingual') ?></td>
47
  <td><input name="currency_options[<?php echo $code ?>][thousand_sep]" type="text" class="currency_option_input" value="<?php echo esc_attr($currency['thousand_sep']) ?>" /></td>
48
  </tr>
49
  <tr>
50
+ <td align="right"><?php _e('Decimal Separator', 'woocommerce-multilingual') ?></td>
51
  <td><input name="currency_options[<?php echo $code ?>][decimal_sep]" type="text" class="currency_option_input" value="<?php echo esc_attr($currency['decimal_sep']) ?>" /></td>
52
  </tr>
53
  <tr>
54
+ <td align="right"><?php _e('Number of Decimals', 'woocommerce-multilingual') ?></td>
55
+ <td><input name="currency_options[<?php echo $code ?>][num_decimals]" type="number" class="decimals_number" value="<?php echo esc_attr($currency['num_decimals']) ?>" min="0" step="1" data-message="<?php _e( 'Only numeric', 'woocommerce-multilingual' ); ?>" /></td>
56
  </tr>
57
 
58
  <tr>
59
  <td colspan="2"><hr /></td>
60
  </tr>
61
  <tr>
62
+ <td align="right"><?php _e('Rounding to the nearest integer', 'woocommerce-multilingual') ?></td>
63
  <td>
64
  <select name="currency_options[<?php echo $code ?>][rounding]">
65
+ <option value="disabled" <?php selected('disabled', $currency['rounding']) ?> ><?php _e('disabled', 'woocommerce-multilingual') ?></option>
66
+ <option value="up" <?php selected('up', $currency['rounding']) ?>><?php _e('up', 'woocommerce-multilingual') ?></option>
67
+ <option value="down" <?php selected('down', $currency['rounding']) ?>><?php _e('down', 'woocommerce-multilingual') ?></option>
68
+ <option value="down" <?php selected('nearest', $currency['rounding']) ?>><?php _e('nearest', 'woocommerce-multilingual') ?></option>
69
  </select>
70
  </td>
71
  </tr>
72
  <tr>
73
+ <td align="right"><?php _e('Increment for nearest integer', 'woocommerce-multilingual') ?></td>
74
  <td>
75
  <select name="currency_options[<?php echo $code ?>][rounding_increment]">
76
  <option value="1" <?php selected('1', $currency['rounding_increment']) ?> >1</option>
81
  </td>
82
  </tr>
83
  <tr>
84
+ <td align="right"><?php _e('Autosubtract amount', 'woocommerce-multilingual') ?></td>
85
  <td>
86
+ <input name="currency_options[<?php echo $code ?>][auto_subtract]" class="abstract_amount" value="<?php echo $currency['auto_subtract'] ?>" type="number" value="0" data-message="<?php _e( 'Only numeric', 'woocommerce-multilingual' ); ?>" />
87
  </td>
88
  </tr>
89
  </table>
94
 
95
  <tr>
96
  <td colspan="2" align="right">
97
+ <input type="button" class="button-secondary currency_options_cancel" value="<?php esc_attr_e('Cancel', 'woocommerce-multilingual') ?>" data-currency="<?php echo $code ?>" />&nbsp;
98
+ <input type="submit" class="button-primary currency_options_save" value="<?php esc_attr_e('Save', 'woocommerce-multilingual') ?>" data-currency="<?php echo $code ?>" />
99
  <input type="hidden" id="save_currency_nonce" value="<?php echo wp_create_nonce('save_currency'); ?>" />
100
  <br /><br />
101
  </td>
menu/sub/custom-prices.php CHANGED
@@ -14,26 +14,26 @@ $currencies = $woocommerce_wpml->multi_currency_support->get_currencies();
14
  <div class="wcml_custom_prices_block">
15
  <?php if(empty($currencies)): ?>
16
  <div class="custom_prices_message_block">
17
- <label><?php _e('Multi-currency is enabled but no secondary currencies have been set','wpml-wcml')?></label>
18
  </div>
19
  <?php else: ?>
20
  <div class="wcml_custom_prices_options_block">
21
 
22
  <input type="radio" name="_wcml_custom_prices[<?php echo $post_id; ?>]" id="wcml_custom_prices_auto[<?php echo $post_id ?>]" value="0" class="wcml_custom_prices_input"<?php echo $checked ?> />
23
- <label for="wcml_custom_prices_auto[<?php echo $post_id ?>]"><?php _e('Calculate prices in other currencies automatically','wpml-wcml')?>&nbsp;
24
  <span class="block_actions">(
25
- <a href="javascript:void(0);" class="wcml_custom_prices_auto_block_show" title="<?php _e('Click to see the prices in the other currencies as they are currently shown onthe front end.', 'wpml-wcml') ?>"><?php _e('Show','wpml-wcml') ?></a>
26
- <a href="javascript:void(0);" class="wcml_custom_prices_auto_block_hide"><?php _e('Hide','wpml-wcml') ?></a>
27
  )</span>
28
  </label>
29
 
30
  <?php $checked = isset($custom_prices['_wcml_custom_prices_status']) && $custom_prices['_wcml_custom_prices_status'][0] == 1?'checked="checked"':' '; ?>
31
 
32
  <input type="radio" name="_wcml_custom_prices[<?php echo $post_id ?>]" value="1" id="wcml_custom_prices_manually[<?php echo $post_id ?>]" class="wcml_custom_prices_input" <?php echo $checked ?> />
33
- <label for="wcml_custom_prices_manually[<?php echo $post_id ?>]"><?php _e('Set prices in other currencies manually','wpml-wcml') ?></label>
34
  <div class="wcml_custom_prices_manually_block_control">
35
- <a <?php if(!trim($checked)): ?>style="display:none"<?php endif ?> href="javascript:void(0);" class="wcml_custom_prices_manually_block_show">&raquo; <?php _e('Enter prices in other currencies','wpml-wcml') ?></a>
36
- <a style="display:none" href="javascript:void(0);" class="wcml_custom_prices_manually_block_hide">- <?php _e('Hide prices in other currencies','wpml-wcml') ?></a>
37
  </div>
38
  </div>
39
 
@@ -59,11 +59,11 @@ $currencies = $woocommerce_wpml->multi_currency_support->get_currencies();
59
  } ?>
60
  <div class="currency_blck">
61
  <label>
62
- <?php echo $wc_currencies[$currency_code].sprintf(__(' (%s)','wpml-wcml'),get_woocommerce_currency_symbol($currency_code)) ?>
63
  </label>
64
 
65
  <?php if($regular_price == ''): ?>
66
- <span class="wcml_no_price_message"><?php _e('Determined automatically based on exchange rate','wpml-wcml'); ?></span>
67
  <?php endif; ?>
68
 
69
  <?php if($is_variation){
@@ -76,12 +76,12 @@ $currencies = $woocommerce_wpml->multi_currency_support->get_currencies();
76
  }
77
  ?>
78
  <p>
79
- <label><?php echo __( 'Regular Price', 'wpml-wcml' ) . ' ('.get_woocommerce_currency_symbol($currency_code).')' ?></label>
80
  <input type="<?php echo $wc_input_type; ?>" size="5" name="_custom_variation_regular_price<?php echo $custom_id ?>" class="wc_input_price wcml_input_price short wcml_regular_price" value="<?php echo $regular_price ?>" step="any" min="0" />
81
  </p>
82
 
83
  <p>
84
- <label><?php echo __( 'Sale Price', 'wpml-wcml' ) . ' ('.get_woocommerce_currency_symbol($currency_code).')' ?></label>
85
  <input type="<?php echo $wc_input_type; ?>" size="5" name="_custom_variation_sale_price<?php echo $custom_id ?>" class="wc_input_price wcml_input_price short wcml_sale_price" value="<?php echo $sale_price ?>" step="any" min="0" />
86
  </p>
87
  <?php }else{
@@ -99,25 +99,25 @@ $currencies = $woocommerce_wpml->multi_currency_support->get_currencies();
99
  $wc_input['type_val'] = 'price';
100
  }
101
 
102
- woocommerce_wp_text_input( array( 'id' => '_custom_regular_price'.$custom_id, 'value'=>$regular_price ,'class' => 'wc_input_price wcml_input_price short wcml_regular_price', 'label' => __( 'Regular Price', 'wpml-wcml' ) . ' ('.get_woocommerce_currency_symbol($currency_code).')', $wc_input['type_name'] => $wc_input['type_val'], 'custom_attributes' => $wc_input['custom_attributes'] ) );
103
 
104
- woocommerce_wp_text_input( array( 'id' => '_custom_sale_price'.$custom_id, 'value'=>$sale_price , 'class' => 'wc_input_price wcml_input_price short wcml_sale_price', 'label' => __( 'Sale Price', 'wpml-wcml' ) . ' ('.get_woocommerce_currency_symbol($currency_code).')', $wc_input['type_name'] => $wc_input['type_val'], 'custom_attributes' => $wc_input['custom_attributes'] ) );
105
  } ?>
106
  <div class="wcml_schedule">
107
- <label><?php _e('Schedule','wpml-wcml') ?></label>
108
  <div class="wcml_schedule_options">
109
  <?php $checked = (!isset($custom_prices['_wcml_schedule_'.$currency_code]) || (isset($custom_prices['_wcml_schedule_'.$currency_code]) && $custom_prices['_wcml_schedule_'.$currency_code][0] == 0))?'checked="checked"':' '; ?>
110
 
111
  <input type="radio" name="_wcml_schedule[<?php echo $currency_code.']'.$html_id; ?>" id="wcml_schedule_auto[<?php echo $currency_code.']'.$html_id ?>" value="0" class="wcml_schedule_input"<?php echo $checked ?> />
112
- <label for="wcml_schedule_auto[<?php echo $currency_code.']'.$html_id ?>"><?php _e('Same as default currency','wpml-wcml')?></label>
113
 
114
  <?php $checked = isset($custom_prices['_wcml_schedule_'.$currency_code]) && $custom_prices['_wcml_schedule_'.$currency_code][0] == 1?'checked="checked"':' '; ?>
115
 
116
  <input type="radio" name="_wcml_schedule[<?php echo $currency_code.']'.$html_id ?>" value="1" id="wcml_schedule_manually[<?php echo $currency_code.']'.$html_id ?>" class="wcml_schedule_input" <?php echo $checked ?> />
117
- <label for="wcml_schedule_manually[<?php echo $currency_code.']'.$html_id ?>"><?php _e('Set dates','wpml-wcml') ?>
118
  <span class="block_actions">(
119
- <a href="javascript:void(0);" class="wcml_schedule_manually_block_show"><?php _e('Schedule','wpml-wcml') ?></a>
120
- <a href="javascript:void(0);" class="wcml_schedule_manually_block_hide"><?php _e('Collapse','wpml-wcml') ?></a>
121
  )</span>
122
  </label>
123
 
@@ -126,8 +126,8 @@ $currencies = $woocommerce_wpml->multi_currency_support->get_currencies();
126
  $sale_price_dates_from = (isset($custom_prices['_sale_price_dates_from_'.$currency_code]) && $custom_prices['_sale_price_dates_from_'.$currency_code][0] != '') ? date_i18n( 'Y-m-d', $custom_prices['_sale_price_dates_from_'.$currency_code][0] ) : '';
127
  $sale_price_dates_to = (isset($custom_prices['_sale_price_dates_to_'.$currency_code]) && $custom_prices['_sale_price_dates_to_'.$currency_code][0] != '') ? date_i18n( 'Y-m-d', $custom_prices['_sale_price_dates_to_'.$currency_code][0] ) : '';
128
  ?>
129
- <input type="text" class="short custom_sale_price_dates_from" name="_custom_sale_price_dates_from<?php echo $custom_id; ?>" id="_custom_sale_price_dates_from<?php echo $custom_id; ?>" value="<?php echo esc_attr( $sale_price_dates_from ) ?>" placeholder="<?php echo _x( 'From&hellip;', 'placeholder', 'wpml-wcml' ) ?> YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
130
- <input type="text" class="short custom_sale_price_dates_to" name="_custom_sale_price_dates_to<?php echo $custom_id; ?>" id="_custom_sale_price_dates_to<?php echo $custom_id; ?>" value="<?php echo esc_attr( $sale_price_dates_to ) ?>" placeholder="<?php echo _x( 'To&hellip;', 'placeholder', 'wpml-wcml' ) ?> YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
131
  </div>
132
 
133
  </div>
@@ -160,17 +160,17 @@ $currencies = $woocommerce_wpml->multi_currency_support->get_currencies();
160
  }
161
  } ?>
162
 
163
- <label><?php echo $wc_currencies[$currency_code].sprintf(__(' (%s)','wpml-wcml'),get_woocommerce_currency_symbol($currency_code)) ?></label>
164
 
165
  <?php
166
  if($is_variation){ ?>
167
  <p>
168
- <label><?php echo __( 'Regular Price', 'wpml-wcml' ) . ' ('.get_woocommerce_currency_symbol($currency_code).')' ?></label>
169
  <input type="number" size="5" name="_readonly_regular_price" class="wc_input_price short" value="<?php echo $regular_price ?>" step="any" min="0" readonly = "readonly" rel="<?php echo $currency['rate'] ?>" />
170
  </p>
171
 
172
  <p>
173
- <label><?php echo __( 'Sale Price', 'wpml-wcml' ) . ' ('.get_woocommerce_currency_symbol($currency_code).')' ?></label>
174
  <input type="number" size="5" name="_readonly_sale_price" class="wc_input_price short" value="<?php echo $sale_price ?>" step="any" min="0" readonly = "readonly" rel="<?php echo $currency['rate'] ?>" />
175
  </p>
176
  <?php
@@ -179,9 +179,9 @@ $currencies = $woocommerce_wpml->multi_currency_support->get_currencies();
179
 
180
  $wc_input['custom_attributes'] = array( 'readonly' => 'readonly', 'rel'=> $currency['rate'] ) ;
181
 
182
- woocommerce_wp_text_input( array( 'id' => '_readonly_regular_price', 'value'=>$regular_price, 'class' => 'wc_input_price short', 'label' => __( 'Regular Price', 'wpml-wcml' ) . ' ('.get_woocommerce_currency_symbol($currency_code).')', $wc_input['type_name'] => $wc_input['type_val'], 'custom_attributes' => $wc_input['custom_attributes'] ) );
183
 
184
- woocommerce_wp_text_input( array( 'id' => '_readonly_sale_price', 'value'=>$sale_price, 'class' => 'wc_input_price short', 'label' => __( 'Sale Price', 'wpml-wcml' ) . ' ('.get_woocommerce_currency_symbol($currency_code).')', $wc_input['type_name'] => $wc_input['type_val'], 'custom_attributes' => $wc_input['custom_attributes'] ) );
185
  }
186
 
187
  } ?>
@@ -189,7 +189,7 @@ $currencies = $woocommerce_wpml->multi_currency_support->get_currencies();
189
  </div>
190
  <?php endif; ?>
191
  <?php if(!$is_variation): ?>
192
- <div class="wcml_price_error"><?php _e( 'Please enter in a value less than the regular price', 'wpml-wcml' ) ?></div>
193
  <?php endif; ?>
194
  </div>
195
  <?php if($is_variation): ?>
14
  <div class="wcml_custom_prices_block">
15
  <?php if(empty($currencies)): ?>
16
  <div class="custom_prices_message_block">
17
+ <label><?php _e('Multi-currency is enabled but no secondary currencies have been set', 'woocommerce-multilingual')?></label>
18
  </div>
19
  <?php else: ?>
20
  <div class="wcml_custom_prices_options_block">
21
 
22
  <input type="radio" name="_wcml_custom_prices[<?php echo $post_id; ?>]" id="wcml_custom_prices_auto[<?php echo $post_id ?>]" value="0" class="wcml_custom_prices_input"<?php echo $checked ?> />
23
+ <label for="wcml_custom_prices_auto[<?php echo $post_id ?>]"><?php _e('Calculate prices in other currencies automatically', 'woocommerce-multilingual')?>&nbsp;
24
  <span class="block_actions">(
25
+ <a href="javascript:void(0);" class="wcml_custom_prices_auto_block_show" title="<?php _e('Click to see the prices in the other currencies as they are currently shown onthe front end.', 'woocommerce-multilingual') ?>"><?php _e('Show', 'woocommerce-multilingual') ?></a>
26
+ <a href="javascript:void(0);" class="wcml_custom_prices_auto_block_hide"><?php _e('Hide', 'woocommerce-multilingual') ?></a>
27
  )</span>
28
  </label>
29
 
30
  <?php $checked = isset($custom_prices['_wcml_custom_prices_status']) && $custom_prices['_wcml_custom_prices_status'][0] == 1?'checked="checked"':' '; ?>
31
 
32
  <input type="radio" name="_wcml_custom_prices[<?php echo $post_id ?>]" value="1" id="wcml_custom_prices_manually[<?php echo $post_id ?>]" class="wcml_custom_prices_input" <?php echo $checked ?> />
33
+ <label for="wcml_custom_prices_manually[<?php echo $post_id ?>]"><?php _e('Set prices in other currencies manually', 'woocommerce-multilingual') ?></label>
34
  <div class="wcml_custom_prices_manually_block_control">
35
+ <a <?php if(!trim($checked)): ?>style="display:none"<?php endif ?> href="javascript:void(0);" class="wcml_custom_prices_manually_block_show">&raquo; <?php _e('Enter prices in other currencies', 'woocommerce-multilingual') ?></a>
36
+ <a style="display:none" href="javascript:void(0);" class="wcml_custom_prices_manually_block_hide">- <?php _e('Hide prices in other currencies', 'woocommerce-multilingual') ?></a>
37
  </div>
38
  </div>
39
 
59
  } ?>
60
  <div class="currency_blck">
61
  <label>
62
+ <?php echo $wc_currencies[$currency_code].sprintf(__(' (%s)', 'woocommerce-multilingual'),get_woocommerce_currency_symbol($currency_code)) ?>
63
  </label>
64
 
65
  <?php if($regular_price == ''): ?>
66
+ <span class="wcml_no_price_message"><?php _e('Determined automatically based on exchange rate', 'woocommerce-multilingual'); ?></span>
67
  <?php endif; ?>
68
 
69
  <?php if($is_variation){
76
  }
77
  ?>
78
  <p>
79
+ <label><?php echo __( 'Regular Price', 'woocommerce-multilingual' ) . ' ('.get_woocommerce_currency_symbol($currency_code).')' ?></label>
80
  <input type="<?php echo $wc_input_type; ?>" size="5" name="_custom_variation_regular_price<?php echo $custom_id ?>" class="wc_input_price wcml_input_price short wcml_regular_price" value="<?php echo $regular_price ?>" step="any" min="0" />
81
  </p>
82
 
83
  <p>
84
+ <label><?php echo __( 'Sale Price', 'woocommerce-multilingual' ) . ' ('.get_woocommerce_currency_symbol($currency_code).')' ?></label>
85
  <input type="<?php echo $wc_input_type; ?>" size="5" name="_custom_variation_sale_price<?php echo $custom_id ?>" class="wc_input_price wcml_input_price short wcml_sale_price" value="<?php echo $sale_price ?>" step="any" min="0" />
86
  </p>
87
  <?php }else{
99
  $wc_input['type_val'] = 'price';
100
  }
101
 
102
+ woocommerce_wp_text_input( array( 'id' => '_custom_regular_price'.$custom_id, 'value'=>$regular_price ,'class' => 'wc_input_price wcml_input_price short wcml_regular_price', 'label' => __( 'Regular Price', 'woocommerce-multilingual' ) . ' ('.get_woocommerce_currency_symbol($currency_code).')', $wc_input['type_name'] => $wc_input['type_val'], 'custom_attributes' => $wc_input['custom_attributes'] ) );
103
 
104
+ woocommerce_wp_text_input( array( 'id' => '_custom_sale_price'.$custom_id, 'value'=>$sale_price , 'class' => 'wc_input_price wcml_input_price short wcml_sale_price', 'label' => __( 'Sale Price', 'woocommerce-multilingual' ) . ' ('.get_woocommerce_currency_symbol($currency_code).')', $wc_input['type_name'] => $wc_input['type_val'], 'custom_attributes' => $wc_input['custom_attributes'] ) );
105
  } ?>
106
  <div class="wcml_schedule">
107
+ <label><?php _e('Schedule', 'woocommerce-multilingual') ?></label>
108
  <div class="wcml_schedule_options">
109
  <?php $checked = (!isset($custom_prices['_wcml_schedule_'.$currency_code]) || (isset($custom_prices['_wcml_schedule_'.$currency_code]) && $custom_prices['_wcml_schedule_'.$currency_code][0] == 0))?'checked="checked"':' '; ?>
110
 
111
  <input type="radio" name="_wcml_schedule[<?php echo $currency_code.']'.$html_id; ?>" id="wcml_schedule_auto[<?php echo $currency_code.']'.$html_id ?>" value="0" class="wcml_schedule_input"<?php echo $checked ?> />
112
+ <label for="wcml_schedule_auto[<?php echo $currency_code.']'.$html_id ?>"><?php _e('Same as default currency', 'woocommerce-multilingual')?></label>
113
 
114
  <?php $checked = isset($custom_prices['_wcml_schedule_'.$currency_code]) && $custom_prices['_wcml_schedule_'.$currency_code][0] == 1?'checked="checked"':' '; ?>
115
 
116
  <input type="radio" name="_wcml_schedule[<?php echo $currency_code.']'.$html_id ?>" value="1" id="wcml_schedule_manually[<?php echo $currency_code.']'.$html_id ?>" class="wcml_schedule_input" <?php echo $checked ?> />
117
+ <label for="wcml_schedule_manually[<?php echo $currency_code.']'.$html_id ?>"><?php _e('Set dates', 'woocommerce-multilingual') ?>
118
  <span class="block_actions">(
119
+ <a href="javascript:void(0);" class="wcml_schedule_manually_block_show"><?php _e('Schedule', 'woocommerce-multilingual') ?></a>
120
+ <a href="javascript:void(0);" class="wcml_schedule_manually_block_hide"><?php _e('Collapse', 'woocommerce-multilingual') ?></a>
121
  )</span>
122
  </label>
123
 
126
  $sale_price_dates_from = (isset($custom_prices['_sale_price_dates_from_'.$currency_code]) && $custom_prices['_sale_price_dates_from_'.$currency_code][0] != '') ? date_i18n( 'Y-m-d', $custom_prices['_sale_price_dates_from_'.$currency_code][0] ) : '';
127
  $sale_price_dates_to = (isset($custom_prices['_sale_price_dates_to_'.$currency_code]) && $custom_prices['_sale_price_dates_to_'.$currency_code][0] != '') ? date_i18n( 'Y-m-d', $custom_prices['_sale_price_dates_to_'.$currency_code][0] ) : '';
128
  ?>
129
+ <input type="text" class="short custom_sale_price_dates_from" name="_custom_sale_price_dates_from<?php echo $custom_id; ?>" id="_custom_sale_price_dates_from<?php echo $custom_id; ?>" value="<?php echo esc_attr( $sale_price_dates_from ) ?>" placeholder="<?php echo _x( 'From&hellip;', 'placeholder', 'woocommerce-multilingual' ) ?> YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
130
+ <input type="text" class="short custom_sale_price_dates_to" name="_custom_sale_price_dates_to<?php echo $custom_id; ?>" id="_custom_sale_price_dates_to<?php echo $custom_id; ?>" value="<?php echo esc_attr( $sale_price_dates_to ) ?>" placeholder="<?php echo _x( 'To&hellip;', 'placeholder', 'woocommerce-multilingual' ) ?> YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
131
  </div>
132
 
133
  </div>
160
  }
161
  } ?>
162
 
163
+ <label><?php echo $wc_currencies[$currency_code].sprintf(__(' (%s)', 'woocommerce-multilingual'),get_woocommerce_currency_symbol($currency_code)) ?></label>
164
 
165
  <?php
166
  if($is_variation){ ?>
167
  <p>
168
+ <label><?php echo __( 'Regular Price', 'woocommerce-multilingual' ) . ' ('.get_woocommerce_currency_symbol($currency_code).')' ?></label>
169
  <input type="number" size="5" name="_readonly_regular_price" class="wc_input_price short" value="<?php echo $regular_price ?>" step="any" min="0" readonly = "readonly" rel="<?php echo $currency['rate'] ?>" />
170
  </p>
171
 
172
  <p>
173
+ <label><?php echo __( 'Sale Price', 'woocommerce-multilingual' ) . ' ('.get_woocommerce_currency_symbol($currency_code).')' ?></label>
174
  <input type="number" size="5" name="_readonly_sale_price" class="wc_input_price short" value="<?php echo $sale_price ?>" step="any" min="0" readonly = "readonly" rel="<?php echo $currency['rate'] ?>" />
175
  </p>
176
  <?php
179
 
180
  $wc_input['custom_attributes'] = array( 'readonly' => 'readonly', 'rel'=> $currency['rate'] ) ;
181
 
182
+ woocommerce_wp_text_input( array( 'id' => '_readonly_regular_price', 'value'=>$regular_price, 'class' => 'wc_input_price short', 'label' => __( 'Regular Price', 'woocommerce-multilingual' ) . ' ('.get_woocommerce_currency_symbol($currency_code).')', $wc_input['type_name'] => $wc_input['type_val'], 'custom_attributes' => $wc_input['custom_attributes'] ) );
183
 
184
+ woocommerce_wp_text_input( array( 'id' => '_readonly_sale_price', 'value'=>$sale_price, 'class' => 'wc_input_price short', 'label' => __( 'Sale Price', 'woocommerce-multilingual' ) . ' ('.get_woocommerce_currency_symbol($currency_code).')', $wc_input['type_name'] => $wc_input['type_val'], 'custom_attributes' => $wc_input['custom_attributes'] ) );
185
  }
186
 
187
  } ?>
189
  </div>
190
  <?php endif; ?>
191
  <?php if(!$is_variation): ?>
192
+ <div class="wcml_price_error"><?php _e( 'Please enter in a value less than the regular price', 'woocommerce-multilingual' ) ?></div>
193
  <?php endif; ?>
194
  </div>
195
  <?php if($is_variation): ?>
menu/sub/downloadable-files-box.php CHANGED
@@ -6,9 +6,9 @@
6
  <input type="text" value="<?php echo $data['files_data'][$i]['value']; ?>" class="" disabled="disabled">
7
  <?php else: ?>
8
  <div>
9
- <input type="text" value="<?php echo isset($data['files_data'][$i])?$data['files_data'][$i]['label']:''; ?>" name='<?php echo $data['product_content'].'_'.$data['lang'].'['.$i.'][name]'; ?>' class="wcml_file_paths_name" placeholder="<?php esc_attr_e('Enter translation for name', 'wpml-wcml') ?>">
10
- <input type="text" value="<?php echo isset($data['files_data'][$i])?$data['files_data'][$i]['value']:''; ?>" name='<?php echo $data['product_content'].'_'.$data['lang'].'['.$i.'][file]'; ?>' class="wcml_file_paths_file" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"/>
11
- <button type="button" class="button-secondary wcml_file_paths_button"><?php _e('Choose a file', 'wpml-wcml') ?></button>
12
  </div>
13
  <?php endif; ?>
14
  <?php endfor; ?>
6
  <input type="text" value="<?php echo $data['files_data'][$i]['value']; ?>" class="" disabled="disabled">
7
  <?php else: ?>
8
  <div>
9
+ <input type="text" value="<?php echo isset($data['files_data'][$i])?$data['files_data'][$i]['label']:''; ?>" name='<?php echo $data['product_content'].'_'.$data['lang'].'['.$i.'][name]'; ?>' class="wcml_file_paths_name" placeholder="<?php esc_attr_e('Enter translation for name', 'woocommerce-multilingual') ?>">
10
+ <input type="text" value="<?php echo isset($data['files_data'][$i])?$data['files_data'][$i]['value']:''; ?>" name='<?php echo $data['product_content'].'_'.$data['lang'].'['.$i.'][file]'; ?>' class="wcml_file_paths_file" placeholder="<?php esc_attr_e('Enter translation', 'woocommerce-multilingual') ?>"/>
11
+ <button type="button" class="button-secondary wcml_file_paths_button"><?php _e('Choose a file', 'woocommerce-multilingual') ?></button>
12
  </div>
13
  <?php endif; ?>
14
  <?php endfor; ?>
menu/sub/images-box.php CHANGED
@@ -1,5 +1,5 @@
1
- <button id="prod_images_link_<?php echo $lang ?>" class="button-secondary js-table-toggle prod_images_link<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" data-text-opened="<?php _e('Collapse','wpml-wcml'); ?>" data-text-closed="<?php _e('Expand','wpml-wcml'); ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>>
2
- <span><?php _e('Expand','wpml-wcml'); ?></span>
3
  <i class="icon-caret-down"></i>
4
  </button>
5
 
@@ -19,11 +19,11 @@
19
  </tr>
20
  <?php if(isset($template_data['empty_images'])): ?>
21
  <tr>
22
- <td><?php _e('Please set images for product','wpml-wcml'); ?></td>
23
  </tr>
24
  <?php elseif(isset($template_data['empty_translation'])): ?>
25
  <tr>
26
- <td><?php _e('Please save translation before translate images texts','wpml-wcml'); ?></td>
27
  </tr>
28
  <?php else: ?>
29
  <?php $texts = array('title','caption','description'); ?>
@@ -31,11 +31,11 @@
31
  <tr>
32
  <td>
33
  <?php if($text == 'title'): ?>
34
- <?php _e('Title','wpml-wcml'); ?>
35
  <?php elseif($text == 'caption'): ?>
36
- <?php _e('Caption','wpml-wcml'); ?>
37
  <?php else: ?>
38
- <?php _e('Description','wpml-wcml'); ?>
39
  <?php endif; ?>
40
  </td>
41
  <?php foreach($template_data['images_data'] as $key=>$image_data): ?>
@@ -44,7 +44,7 @@
44
  <?php if($template_data['original']): ?>
45
  <input type="text" value="<?php echo $image_data[$text]?>" readonly="readonly"/>
46
  <?php else: ?>
47
- <input type="text" name="images[<?php echo $key ?>][<?php echo $text; ?>]" value="<?php echo $image_data[$text]?>" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"/>
48
  <?php endif; ?>
49
  </td>
50
  <?php endif; ?>
1
+ <button id="prod_images_link_<?php echo $lang ?>" class="button-secondary js-table-toggle prod_images_link<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" data-text-opened="<?php _e('Collapse', 'woocommerce-multilingual'); ?>" data-text-closed="<?php _e('Expand', 'woocommerce-multilingual'); ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>>
2
+ <span><?php _e('Expand', 'woocommerce-multilingual'); ?></span>
3
  <i class="icon-caret-down"></i>
4
  </button>
5
 
19
  </tr>
20
  <?php if(isset($template_data['empty_images'])): ?>
21
  <tr>
22
+ <td><?php _e('Please set images for product', 'woocommerce-multilingual'); ?></td>
23
  </tr>
24
  <?php elseif(isset($template_data['empty_translation'])): ?>
25
  <tr>
26
+ <td><?php _e('Please save translation before translate images texts', 'woocommerce-multilingual'); ?></td>
27
  </tr>
28
  <?php else: ?>
29
  <?php $texts = array('title','caption','description'); ?>
31
  <tr>
32
  <td>
33
  <?php if($text == 'title'): ?>
34
+ <?php _e('Title', 'woocommerce-multilingual'); ?>
35
  <?php elseif($text == 'caption'): ?>
36
+ <?php _e('Caption', 'woocommerce-multilingual'); ?>
37
  <?php else: ?>
38
+ <?php _e('Description', 'woocommerce-multilingual'); ?>
39
  <?php endif; ?>
40
  </td>
41
  <?php foreach($template_data['images_data'] as $key=>$image_data): ?>
44
  <?php if($template_data['original']): ?>
45
  <input type="text" value="<?php echo $image_data[$text]?>" readonly="readonly"/>
46
  <?php else: ?>
47
+ <input type="text" name="images[<?php echo $key ?>][<?php echo $text; ?>]" value="<?php echo $image_data[$text]?>" placeholder="<?php esc_attr_e('Enter translation', 'woocommerce-multilingual') ?>"/>
48
  <?php endif; ?>
49
  </td>
50
  <?php endif; ?>
menu/sub/notice-translation-upgrade.php CHANGED
@@ -8,15 +8,15 @@ $notices = implode(', ', $notices);
8
  ?>
9
 
10
  <div id="wcml_translations_message" class="message error">
11
- <p><?php printf( __( '<strong>WooCommerce Translation Available</strong> &#8211; Install or update your <code>%s</code> translations to version <code>%s</code>.', 'wpml-wcml' ), $notices, WC_VERSION ); ?></p>
12
 
13
  <p>
14
  <?php if ( is_multisite() ) : ?>
15
- <a href="<?php echo wp_nonce_url( admin_url( 'admin.php?page=wc-status&tab=tools&action=translation_upgrade' ), 'debug_action' ); ?>" class="button-primary"><?php _e( 'Update Translation', 'wpml-wcml' ); ?></a>
16
  <?php else : ?>
17
- <a href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'do-translation-upgrade' ), admin_url( 'update-core.php' ) ), 'upgrade-translations' ); ?>" class="button-primary"><?php _e( 'Update Translation', 'wpml-wcml' ); ?></a>
18
  <?php endif; ?>
19
- <a href="javascript:void(0);" class="button"><?php _e( 'Hide This Message', 'wpml-wcml' ); ?></a>
20
  </p>
21
  </div>
22
 
8
  ?>
9
 
10
  <div id="wcml_translations_message" class="message error">
11
+ <p><?php printf( __( '<strong>WooCommerce Translation Available</strong> &#8211; Install or update your <code>%s</code> translations to version <code>%s</code>.', 'woocommerce-multilingual' ), $notices, WC_VERSION ); ?></p>
12
 
13
  <p>
14
  <?php if ( is_multisite() ) : ?>
15
+ <a href="<?php echo wp_nonce_url( admin_url( 'admin.php?page=wc-status&tab=tools&action=translation_upgrade' ), 'debug_action' ); ?>" class="button-primary"><?php _e( 'Update Translation', 'woocommerce-multilingual' ); ?></a>
16
  <?php else : ?>
17
+ <a href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'do-translation-upgrade' ), admin_url( 'update-core.php' ) ), 'upgrade-translations' ); ?>" class="button-primary"><?php _e( 'Update Translation', 'woocommerce-multilingual' ); ?></a>
18
  <?php endif; ?>
19
+ <a href="javascript:void(0);" class="button"><?php _e( 'Hide This Message', 'woocommerce-multilingual' ); ?></a>
20
  </p>
21
  </div>
22
 
menu/sub/product-data.php CHANGED
@@ -27,8 +27,8 @@ if( isset($job->language_code ) ){
27
 
28
 
29
  $button_labels = array(
30
- 'save' => esc_attr__('Save', 'wpml-wcml'),
31
- 'update' => esc_attr__('Update', 'wpml-wcml'),
32
  );
33
  ?>
34
  <tr class="outer" data-prid="<?php echo $product->ID; ?>" <?php echo !isset( $display_inline ) ? 'display="none"' : ''; ?> >
@@ -38,7 +38,7 @@ $button_labels = array(
38
  <table class="fixed wcml_products_translation">
39
  <thead>
40
  <tr>
41
- <th scope="col"><?php _e('Language', 'wpml-wcml') ?></th>
42
  <?php $product_contents_labels = $woocommerce_wpml->products->get_product_contents_labels($product_id);?>
43
  <?php foreach ($product_contents_labels as $product_content) : ?>
44
  <th scope="col"><?php echo $product_content; ?></th>
@@ -68,10 +68,10 @@ $button_labels = array(
68
  <span class="js-wcml_duplicate_product_notice_<?php echo $key ?>" >
69
  <?php printf(__('This product is an exact duplicate of the %s product.', 'wcml-wpml'),
70
  $lang_codes[$sitepress->get_default_language()]); ?>&nbsp;
71
- <a href="#edit-<?php echo $product_id ?>_<?php echo $key ?>"><?php _e('Edit independently.', 'wpml-wcml') ?></a>
72
  </span>
73
  <span class="js-wcml_duplicate_product_undo_<?php echo $key ?>" style="display: none;" >
74
- <a href="#undo-<?php echo $product_id ?>_<?php echo $key ?>"><?php _e('Undo (keep this product as a duplicate)', 'wpml-wcml') ?></a>
75
  </span>
76
  </td>
77
  </tr>
@@ -97,7 +97,7 @@ $button_labels = array(
97
 
98
  if(!is_null($tr_status) && get_current_user_id() != $tr_status->translator_id ){
99
  if($tr_status->status == ICL_TM_IN_PROGRESS){ ?>
100
- <td><?php _e('Translation in progress', 'wpml-wcml'); ?><br>&nbsp;</td>
101
  <?php continue;
102
  }elseif($tr_status->status == ICL_TM_WAITING_FOR_TRANSLATOR && !$job_id ){
103
  $tr_job_id = $wpdb->get_var($wpdb->prepare("
@@ -107,7 +107,7 @@ $button_labels = array(
107
  WHERE s.translation_id = %d
108
  ", $product_translations[$key]->translation_id ) );
109
  ?>
110
- <td><?php printf('<a href="%s" class="button-secondary">'.__('Take this and edit', 'wpml-wcml').'</a>', admin_url('admin.php?page=wpml-wcml&tab=products&prid=' . $product->ID.'&job_id='.$tr_job_id)); ?><br>&nbsp;</td>
111
  <?php continue;
112
  }
113
  }
@@ -144,18 +144,18 @@ $button_labels = array(
144
  <textarea value="<?php echo $file_paths; ?>" disabled="disabled"><?php echo $file_paths; ?></textarea>
145
  <?php else: ?>
146
  <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>
147
- <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>
148
  <?php endif;?>
149
  <?php elseif($product_content == 'title'): ?>
150
  <?php if($default_language == $key): ?>
151
  <textarea rows="1" disabled="disabled"><?php echo $trn_contents['title']; ?></textarea><br>
152
  <?php else: ?>
153
- <textarea class="<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" name="<?php echo $product_content.'_'.$key; ?>" rows="2" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> ><?php echo $trn_contents['title']; ?></textarea>
154
  <?php endif;?>
155
  <div class="edit_slug_block">
156
  <?php $hide = !$trn_contents['name'] ? 'hidden' : ''; ?>
157
- <a href="javascript:void(0)" class="edit_slug_show_link <?php echo $hide; ?>"><?php $default_language == $key ? _e('Show slug', 'wpml-wcml') : _e('Edit slug', 'wpml-wcml') ?></a>
158
- <a href="javascript:void(0)" class="edit_slug_hide_link <?php echo $hide; ?>"><?php _e('Hide', 'wpml-wcml') ?></a>
159
  </br>
160
  <?php if($default_language == $key): ?>
161
  <input type="text" value="<?php echo $trn_contents['name']; ?>" class="edit_slug_input" disabled="disabled" />
@@ -163,7 +163,7 @@ $button_labels = array(
163
  <input type="text" value="<?php echo $trn_contents['name']; ?>" class="edit_slug_input <?php echo $hide; ?>" name="<?php echo 'post_name_'.$key; ?>" <?php echo $hide?'disabled="disabled"':''; ?> />
164
  <?php endif;?>
165
  <?php if(!$trn_contents['name']): ?>
166
- <span class="edit_slug_warning"><?php _e('Please save translation before edit slug', 'wpml-wcml') ?></span>
167
  <?php endif;?>
168
  </div>
169
  <?php elseif(is_array($trn_contents)): ?>
@@ -171,32 +171,33 @@ $button_labels = array(
171
  <?php if($default_language == $key): ?>
172
  <textarea rows="1" disabled="disabled"><?php echo $trn_content; ?></textarea>
173
  <?php else: ?>
174
- <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>
175
  <?php endif;?>
176
  <?php endforeach; ?>
177
  <?php elseif(in_array($product_content,array('content','excerpt'))): ?>
178
  <?php if($default_language == $key): ?>
179
- <button type="button" class="button-secondary wcml_edit_content origin_content"><?php _e('Show content', 'wpml-wcml') ?></button>
180
  <?php else: ?>
181
- <button type="button" class="button-secondary wcml_edit_content<?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>
182
  <?php if($missing_translation): ?>
183
  <span class="wcml_field_translation_<?php echo $product_content ?>_<?php echo $key ?>">
184
  <p class="missing-translation">
185
  <i class="icon-warning-sign"></i>
186
- <?php _e('Translation missing', 'wpml-wcml'); ?>
187
  </p>
188
  </span>
189
  <?php endif; ?>
190
  <?php endif;?>
191
  <div class="wcml_editor">
192
- <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>
193
  <div class="wcml_editor_original">
194
- <h3><?php _e('Original content:', 'wpml-wcml') ?></h3>
195
  <?php
196
  if($product_content == 'content'){
197
- $original_content = apply_filters('the_content', $product->post_content);
 
198
  }else{
199
- $original_content = apply_filters('the_content', $product->post_excerpt);
200
  }
201
  ?>
202
  <textarea class="wcml_original_content"><?php echo $original_content; ?></textarea>
@@ -233,11 +234,11 @@ $button_labels = array(
233
  </div>
234
  <div class="wcml_editor_buttons">
235
  <?php if($default_language == $key): ?>
236
- <button type="button" class="button-secondary wcml_popup_close"><?php _e('Close', 'wpml-wcml') ?></button>
237
  <?php else: ?>
238
- <h3><?php printf(__('%s translation', 'wpml-wcml'),$lang); ?></h3>
239
- <button type="button" class="button-secondary wcml_popup_cancel"><?php _e('Cancel', 'wpml-wcml') ?></button>
240
- <button type="button" class="button-secondary wcml_popup_ok"><?php _e('Ok', 'wpml-wcml') ?></button>
241
  <?php endif; ?>
242
  </div>
243
  </div>
@@ -246,13 +247,13 @@ $button_labels = array(
246
  <?php elseif(in_array($product_content,array('variations'))):
247
  echo $woocommerce_wpml->products->product_variations_box($product_id,$key,$is_duplicate_product); ?>
248
  <?php elseif($product_content == '_file_paths'): ?>
249
- <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>
250
- <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>
251
  <?php else: ?>
252
  <?php if($default_language == $key): ?>
253
  <textarea rows="1" disabled="disabled"><?php echo $trn_contents; ?></textarea><br>
254
  <?php else: ?>
255
- <textarea class="<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" name="<?php echo $product_content.'_'.$key; ?>" rows="2" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> ><?php echo $trn_contents; ?></textarea>
256
  <?php endif;?>
257
  <?php endif; ?>
258
  </td>
@@ -262,27 +263,27 @@ $button_labels = array(
262
  foreach ($attributes as $attr_key=>$attribute): ?>
263
  <td>
264
  <?php $trn_attribute = $woocommerce_wpml->products->get_custom_attribute_translation($product_id, $attr_key, $attribute, $key); ?>
265
- <label class="custom_attr_label"><?php _e('name','wpml-wcml'); ?></label>
266
  <br>
267
  <?php if (!$trn_attribute): ?>
268
- <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;?> />
269
  <?php else: ?>
270
  <?php if($default_language == $key): ?>
271
  <textarea rows="1" disabled="disabled"><?php echo $trn_attribute['name']; ?></textarea>
272
  <?php else: ?>
273
- <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;?> />
274
  <?php endif;?>
275
  <?php endif;?>
276
  <br>
277
- <label class="custom_attr_label"><?php _e('values','wpml-wcml'); ?></label>
278
  <br>
279
  <?php if (!$trn_attribute): ?>
280
- <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;?>/>
281
  <?php else: ?>
282
  <?php if($default_language == $key): ?>
283
  <textarea rows="1" disabled="disabled"><?php echo $trn_attribute['value']; ?></textarea>
284
  <?php else: ?>
285
- <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;?> />
286
  <?php endif; ?>
287
  <?php endif; ?>
288
  </td>
27
 
28
 
29
  $button_labels = array(
30
+ 'save' => esc_attr__('Save', 'woocommerce-multilingual'),
31
+ 'update' => esc_attr__('Update', 'woocommerce-multilingual'),
32
  );
33
  ?>
34
  <tr class="outer" data-prid="<?php echo $product->ID; ?>" <?php echo !isset( $display_inline ) ? 'display="none"' : ''; ?> >
38
  <table class="fixed wcml_products_translation">
39
  <thead>
40
  <tr>
41
+ <th scope="col"><?php _e('Language', 'woocommerce-multilingual') ?></th>
42
  <?php $product_contents_labels = $woocommerce_wpml->products->get_product_contents_labels($product_id);?>
43
  <?php foreach ($product_contents_labels as $product_content) : ?>
44
  <th scope="col"><?php echo $product_content; ?></th>
68
  <span class="js-wcml_duplicate_product_notice_<?php echo $key ?>" >
69
  <?php printf(__('This product is an exact duplicate of the %s product.', 'wcml-wpml'),
70
  $lang_codes[$sitepress->get_default_language()]); ?>&nbsp;
71
+ <a href="#edit-<?php echo $product_id ?>_<?php echo $key ?>"><?php _e('Edit independently.', 'woocommerce-multilingual') ?></a>
72
  </span>
73
  <span class="js-wcml_duplicate_product_undo_<?php echo $key ?>" style="display: none;" >
74
+ <a href="#undo-<?php echo $product_id ?>_<?php echo $key ?>"><?php _e('Undo (keep this product as a duplicate)', 'woocommerce-multilingual') ?></a>
75
  </span>
76
  </td>
77
  </tr>
97
 
98
  if(!is_null($tr_status) && get_current_user_id() != $tr_status->translator_id ){
99
  if($tr_status->status == ICL_TM_IN_PROGRESS){ ?>
100
+ <td><?php _e('Translation in progress', 'woocommerce-multilingual'); ?><br>&nbsp;</td>
101
  <?php continue;
102
  }elseif($tr_status->status == ICL_TM_WAITING_FOR_TRANSLATOR && !$job_id ){
103
  $tr_job_id = $wpdb->get_var($wpdb->prepare("
107
  WHERE s.translation_id = %d
108
  ", $product_translations[$key]->translation_id ) );
109
  ?>
110
+ <td><?php printf('<a href="%s" class="button-secondary">'.__('Take this and edit', 'woocommerce-multilingual').'</a>', admin_url('admin.php?page=wpml-wcml&tab=products&prid=' . $product->ID.'&job_id='.$tr_job_id)); ?><br>&nbsp;</td>
111
  <?php continue;
112
  }
113
  }
144
  <textarea value="<?php echo $file_paths; ?>" disabled="disabled"><?php echo $file_paths; ?></textarea>
145
  <?php else: ?>
146
  <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>
147
+ <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', 'woocommerce-multilingual') ?></button>
148
  <?php endif;?>
149
  <?php elseif($product_content == 'title'): ?>
150
  <?php if($default_language == $key): ?>
151
  <textarea rows="1" disabled="disabled"><?php echo $trn_contents['title']; ?></textarea><br>
152
  <?php else: ?>
153
+ <textarea class="<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" name="<?php echo $product_content.'_'.$key; ?>" rows="2" placeholder="<?php esc_attr_e('Enter translation', 'woocommerce-multilingual') ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> ><?php echo $trn_contents['title']; ?></textarea>
154
  <?php endif;?>
155
  <div class="edit_slug_block">
156
  <?php $hide = !$trn_contents['name'] ? 'hidden' : ''; ?>
157
+ <a href="javascript:void(0)" class="edit_slug_show_link <?php echo $hide; ?>"><?php $default_language == $key ? _e('Show slug', 'woocommerce-multilingual') : _e('Edit slug', 'woocommerce-multilingual') ?></a>
158
+ <a href="javascript:void(0)" class="edit_slug_hide_link <?php echo $hide; ?>"><?php _e('Hide', 'woocommerce-multilingual') ?></a>
159
  </br>
160
  <?php if($default_language == $key): ?>
161
  <input type="text" value="<?php echo $trn_contents['name']; ?>" class="edit_slug_input" disabled="disabled" />
163
  <input type="text" value="<?php echo $trn_contents['name']; ?>" class="edit_slug_input <?php echo $hide; ?>" name="<?php echo 'post_name_'.$key; ?>" <?php echo $hide?'disabled="disabled"':''; ?> />
164
  <?php endif;?>
165
  <?php if(!$trn_contents['name']): ?>
166
+ <span class="edit_slug_warning"><?php _e('Please save translation before edit slug', 'woocommerce-multilingual') ?></span>
167
  <?php endif;?>
168
  </div>
169
  <?php elseif(is_array($trn_contents)): ?>
171
  <?php if($default_language == $key): ?>
172
  <textarea rows="1" disabled="disabled"><?php echo $trn_content; ?></textarea>
173
  <?php else: ?>
174
+ <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', 'woocommerce-multilingual') ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> /><br>
175
  <?php endif;?>
176
  <?php endforeach; ?>
177
  <?php elseif(in_array($product_content,array('content','excerpt'))): ?>
178
  <?php if($default_language == $key): ?>
179
+ <button type="button" class="button-secondary wcml_edit_content origin_content"><?php _e('Show content', 'woocommerce-multilingual') ?></button>
180
  <?php else: ?>
181
+ <button type="button" class="button-secondary wcml_edit_content<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>><?php _e('Edit translation', 'woocommerce-multilingual') ?></button>
182
  <?php if($missing_translation): ?>
183
  <span class="wcml_field_translation_<?php echo $product_content ?>_<?php echo $key ?>">
184
  <p class="missing-translation">
185
  <i class="icon-warning-sign"></i>
186
+ <?php _e('Translation missing', 'woocommerce-multilingual'); ?>
187
  </p>
188
  </span>
189
  <?php endif; ?>
190
  <?php endif;?>
191
  <div class="wcml_editor">
192
+ <a class="media-modal-close wcml_close_cross" href="javascript:void(0);" title="<?php esc_attr_e('Close', 'woocommerce-multilingual') ?>"><span class="media-modal-icon"></span></a>
193
  <div class="wcml_editor_original">
194
+ <h3><?php _e('Original content:', 'woocommerce-multilingual') ?></h3>
195
  <?php
196
  if($product_content == 'content'){
197
+ $original_content = apply_filters('the_editor_content', $product->post_content);
198
+ $original_content = wpautop($original_content);
199
  }else{
200
+ $original_content = apply_filters('the_editor_content', $product->post_excerpt);
201
  }
202
  ?>
203
  <textarea class="wcml_original_content"><?php echo $original_content; ?></textarea>
234
  </div>
235
  <div class="wcml_editor_buttons">
236
  <?php if($default_language == $key): ?>
237
+ <button type="button" class="button-secondary wcml_popup_close"><?php _e('Close', 'woocommerce-multilingual') ?></button>
238
  <?php else: ?>
239
+ <h3><?php printf(__('%s translation', 'woocommerce-multilingual'),$lang); ?></h3>
240
+ <button type="button" class="button-secondary wcml_popup_cancel"><?php _e('Cancel', 'woocommerce-multilingual') ?></button>
241
+ <button type="button" class="button-secondary wcml_popup_ok"><?php _e('Ok', 'woocommerce-multilingual') ?></button>
242
  <?php endif; ?>
243
  </div>
244
  </div>
247
  <?php elseif(in_array($product_content,array('variations'))):
248
  echo $woocommerce_wpml->products->product_variations_box($product_id,$key,$is_duplicate_product); ?>
249
  <?php elseif($product_content == '_file_paths'): ?>
250
+ <textarea placeholder="<?php esc_attr_e('Upload file', 'woocommerce-multilingual') ?>" 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>
251
+ <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', 'woocommerce-multilingual') ?></button>
252
  <?php else: ?>
253
  <?php if($default_language == $key): ?>
254
  <textarea rows="1" disabled="disabled"><?php echo $trn_contents; ?></textarea><br>
255
  <?php else: ?>
256
+ <textarea class="<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" name="<?php echo $product_content.'_'.$key; ?>" rows="2" placeholder="<?php esc_attr_e('Enter translation', 'woocommerce-multilingual') ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> ><?php echo $trn_contents; ?></textarea>
257
  <?php endif;?>
258
  <?php endif; ?>
259
  </td>
263
  foreach ($attributes as $attr_key=>$attribute): ?>
264
  <td>
265
  <?php $trn_attribute = $woocommerce_wpml->products->get_custom_attribute_translation($product_id, $attr_key, $attribute, $key); ?>
266
+ <label class="custom_attr_label"><?php _e('name', 'woocommerce-multilingual'); ?></label>
267
  <br>
268
  <?php if (!$trn_attribute): ?>
269
+ <input type="text" name="<?php echo $attr_key . '_name_' . $key ; ?>" value="" placeholder="<?php esc_attr_e('Enter translation', 'woocommerce-multilingual') ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> />
270
  <?php else: ?>
271
  <?php if($default_language == $key): ?>
272
  <textarea rows="1" disabled="disabled"><?php echo $trn_attribute['name']; ?></textarea>
273
  <?php else: ?>
274
+ <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', 'woocommerce-multilingual') ?>" <?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> />
275
  <?php endif;?>
276
  <?php endif;?>
277
  <br>
278
+ <label class="custom_attr_label"><?php _e('values', 'woocommerce-multilingual'); ?></label>
279
  <br>
280
  <?php if (!$trn_attribute): ?>
281
+ <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', 'woocommerce-multilingual') ?>" <?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>/>
282
  <?php else: ?>
283
  <?php if($default_language == $key): ?>
284
  <textarea rows="1" disabled="disabled"><?php echo $trn_attribute['value']; ?></textarea>
285
  <?php else: ?>
286
+ <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', 'woocommerce-multilingual') ?>" <?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> />
287
  <?php endif; ?>
288
  <?php endif; ?>
289
  </td>
menu/sub/products.php CHANGED
@@ -73,8 +73,8 @@ if($lm){
73
  }
74
 
75
  $button_labels = array(
76
- 'save' => esc_attr__('Save', 'wpml-wcml'),
77
- 'update' => esc_attr__('Update', 'wpml-wcml'),
78
  );
79
 
80
  $woocommerce_wpml->settings['first_editor_call'] = false;
@@ -82,11 +82,11 @@ $woocommerce_wpml->update_settings();
82
 
83
  if(isset($_GET['prid'])): ?>
84
  <div class="wcml_product_title_block">
85
- <h3><?php printf( __('Translate %s','wpml-wcml'), get_the_title($_GET['prid']) ); ?></h3>
86
- <a href="<?php echo $pagination_url; ?>1"><?php _e('Show all products', 'wpml-wcml'); ?></a>
87
  </div>
88
  <?php else: ?>
89
- <h3><?php _e('WooCommerce Products','wpml-wcml'); ?></h3>
90
  <?php endif; ?>
91
 
92
  <span style="display:none" id="wcml_product_update_button_label"><?php echo $button_labels['update'] ?></span>
@@ -94,14 +94,14 @@ if(isset($_GET['prid'])): ?>
94
  <?php if(!isset($_GET['prid']) && !$translator_id): ?>
95
  <div class="wcml_prod_filters">
96
  <select class="wcml_translation_status_lang">
97
- <option value="all" <?php echo !$slang?'selected="selected"':''; ?> ><?php _e('All languages','wpml-wcml'); ?></option>
98
  <?php foreach($active_languages as $lang): ?>
99
  <option value="<?php echo $lang['code'] ?>" <?php echo ($slang == $lang['code'])?'selected="selected"':''; ?> ><?php echo $lang['display_name'] ?></option>
100
  <?php endforeach; ?>
101
  </select>
102
 
103
  <select class="wcml_product_category">
104
- <option value="0"><?php _e('Any category', 'wpml-wcml'); ?></option>
105
  <?php
106
 
107
  $sql = "SELECT tt.term_taxonomy_id,tt.term_id,t.name FROM $wpdb->term_taxonomy AS tt
@@ -124,11 +124,11 @@ if(isset($_GET['prid'])): ?>
124
  ?>
125
  </select>
126
  <select class="wcml_translation_status">
127
- <option value="all"><?php _e('All products', 'wpml-wcml'); ?></option>
128
- <option value="not" <?php echo (isset($_GET['trst']) && $_GET['trst']=='not')?'selected="selected"':''; ?>><?php _e('Not translated or needs updating', 'wpml-wcml'); ?></option>
129
- <option value="need_update" <?php echo (isset($_GET['trst']) && $_GET['trst']=='need_update')?'selected="selected"':''; ?>><?php _e('Needs updating', 'wpml-wcml'); ?></option>
130
- <option value="in_progress" <?php echo (isset($_GET['trst']) && $_GET['trst']=='in_progress')?'selected="selected"':''; ?>><?php _e('Translation in progress', 'wpml-wcml'); ?></option>
131
- <option value="complete" <?php echo (isset($_GET['trst']) && $_GET['trst']=='complete')?'selected="selected"':''; ?>><?php _e('Translation complete', 'wpml-wcml'); ?></option>
132
  </select>
133
 
134
  <?php
@@ -137,7 +137,7 @@ if(isset($_GET['prid'])): ?>
137
  unset( $all_statuses['trash'], $all_statuses['auto-draft'], $all_statuses['inherit'], $all_statuses['wc-pending'], $all_statuses['wc-processing'], $all_statuses['wc-on-hold'], $all_statuses['wc-completed'], $all_statuses['wc-cancelled'], $all_statuses['wc-refunded'], $all_statuses['wc-failed'] );
138
  ?>
139
  <select class="wcml_product_status">
140
- <option value="all"><?php _e('All statuses', 'wpml-wcml'); ?></option>
141
  <?php foreach($all_statuses as $key=>$status): ?>
142
  <option value="<?php echo $key; ?>" <?php echo (isset($_GET['st']) && $_GET['st']==$key)?'selected="selected"':''; ?> ><?php echo ucfirst($status); ?></option>
143
  <?php endforeach; ?>
@@ -145,29 +145,29 @@ if(isset($_GET['prid'])): ?>
145
  </div>
146
 
147
  <div>
148
- <input type="text" class="wcml_product_name" placeholder="<?php _e('Search', 'wpml-wcml'); ?>" value="<?php echo isset($_GET['s'])?$_GET['s']:''; ?>"/>
149
  <input type="hidden" value="<?php echo admin_url('admin.php?page=wpml-wcml&tab=products'); ?>" class="wcml_products_admin_url" />
150
  <input type="hidden" value="<?php echo $pagination_url; ?>" class="wcml_pagination_url" />
151
 
152
- <button type="button" value="search" class="wcml_search button-secondary"><?php _e('Search', 'wpml-wcml'); ?></button>
153
  <?php if($search): ?>
154
- <button type="button" value="reset" class="button-secondary wcml_reset_search"><?php _e('Reset', 'wpml-wcml'); ?></button>
155
  <?php endif;?>
156
  </div>
157
  <?php endif; ?>
158
 
159
  <?php if( $products && !isset( $_GET['prid'] ) ): ?>
160
  <div class="wcml_product_pagination">
161
- <span class="displaying-num"><?php printf(__('%d products', 'wpml-wcml'), $products_count); ?></span>
162
  <?php if(!isset($_GET['prid']) && isset($last) && $last > 1): ?>
163
- <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'); ?>">&laquo;</a>
164
- <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'); ?>">&lsaquo;</a>
165
- <input type="text" class="current-page wcml_pagin" value="<?php echo $pn;?>" size="1"/>&nbsp;<span><?php _e('of', 'wpml-wcml'); ?>&nbsp;<?php echo $last; ?><span>
166
- <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'); ?>">&rsaquo;</a>
167
- <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'); ?>">&raquo;</a>
168
  <?php endif; ?>
169
  <?php if(isset($_GET['prid']) || ($lm && isset($last)) && $last > 1): ?>
170
- <a href="<?php echo $pagination_url; ?>1"><?php _e('Show all products', 'wpml-wcml'); ?></a>
171
  <?php endif; ?>
172
  </div>
173
  <?php endif; ?>
@@ -177,14 +177,14 @@ if(isset($_GET['prid'])): ?>
177
  <table class="widefat fixed wcml_products" cellspacing="0">
178
  <thead>
179
  <tr>
180
- <th scope="col" width="5%"><?php _e('Type', 'wpml-wcml') ?></th>
181
- <th scope="col" width="20%"><?php _e('Product', 'wpml-wcml') ?></th>
182
  <th scope="col" width="75%"><?php echo $woocommerce_wpml->products->get_translation_flags($active_languages,$slang,$job_id ? $job_language : false); ?></th>
183
  </tr>
184
  </thead>
185
  <tbody>
186
  <?php if(empty($products)): ?>
187
- <tr><td colspan="4"><h3 class="wcml_no_found_text"><?php _e('No products found','wpml-wcml'); ?></h3></td></tr>
188
  <?php else: ?>
189
  <?php foreach ($products as $product) :
190
  $trid = $sitepress->get_element_trid($product->ID,'post_'.$product->post_type);
@@ -222,10 +222,10 @@ if(isset($_GET['prid'])): ?>
222
  <?php endif; ?>
223
  <?php echo $product->post_title;
224
  if($product->post_status == 'draft' && ((isset($_GET['st']) && $_GET['st'] != 'draft') || !isset($_GET['st']))): ?>
225
- <span class="wcml_product_status_text"><?php _e(' (draft)','wpml-wcml'); ?></span>
226
  <?php endif; ?>
227
  <?php if ($search && $product->post_parent != 0): ?>
228
- <span class="prod_parent_text"><?php printf(__(' | Parent product: %s','wpml-wcml'),get_the_title($product->post_parent)); ?><span>
229
  <?php endif; ?>
230
  </td>
231
  <td>
@@ -239,7 +239,7 @@ if(isset($_GET['prid'])): ?>
239
  echo $woocommerce_wpml->products->get_translation_statuses($product_translations,$active_languages,$prod_lang,$trid,$job_id ? $job_language : false); ?>
240
  </div>
241
  <span class="spinner"></span>
242
- <a href="#prid_<?php echo $product->ID; ?>" job_id = "<?php echo $job_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 isset( $_GET['prid'] ) ? _e('Close', 'wpml-wcml') : _e('Edit translation', 'wpml-wcml') ?></a>
243
 
244
  </td>
245
  </tr>
@@ -259,16 +259,16 @@ if(isset($_GET['prid'])): ?>
259
 
260
  <?php if( $products && !isset( $_GET['prid'] )): ?>
261
  <div class="wcml_product_pagination">
262
- <span class="displaying-num"><?php printf(__('%d products', 'wpml-wcml'), $products_count); ?></span>
263
  <?php if(!isset($_GET['prid']) && isset($last) && $last > 1): ?>
264
- <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'); ?>">&laquo;</a>
265
- <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'); ?>">&lsaquo;</a>
266
- <span><?php echo $pn;?>&nbsp;<?php _e('of', 'wpml-wcml'); ?>&nbsp;<?php echo $last; ?><span>
267
- <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'); ?>">&rsaquo;</a>
268
- <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'); ?>">&raquo;</a>
269
  <?php endif; ?>
270
  <?php if(isset($_GET['prid']) || ($lm && isset($last)) && $last > 1): ?>
271
- <a href="<?php echo $pagination_url; ?>1"><?php _e('Show all products', 'wpml-wcml'); ?></a>
272
  <?php endif; ?>
273
  </div>
274
  <div class="clr"></div>
73
  }
74
 
75
  $button_labels = array(
76
+ 'save' => esc_attr__('Save', 'woocommerce-multilingual'),
77
+ 'update' => esc_attr__('Update', 'woocommerce-multilingual'),
78
  );
79
 
80
  $woocommerce_wpml->settings['first_editor_call'] = false;
82
 
83
  if(isset($_GET['prid'])): ?>
84
  <div class="wcml_product_title_block">
85
+ <h3><?php printf( __('Translate %s', 'woocommerce-multilingual'), get_the_title($_GET['prid']) ); ?></h3>
86
+ <a href="<?php echo $pagination_url; ?>1"><?php _e('Show all products', 'woocommerce-multilingual'); ?></a>
87
  </div>
88
  <?php else: ?>
89
+ <h3><?php _e('WooCommerce Products', 'woocommerce-multilingual'); ?></h3>
90
  <?php endif; ?>
91
 
92
  <span style="display:none" id="wcml_product_update_button_label"><?php echo $button_labels['update'] ?></span>
94
  <?php if(!isset($_GET['prid']) && !$translator_id): ?>
95
  <div class="wcml_prod_filters">
96
  <select class="wcml_translation_status_lang">
97
+ <option value="all" <?php echo !$slang?'selected="selected"':''; ?> ><?php _e('All languages', 'woocommerce-multilingual'); ?></option>
98
  <?php foreach($active_languages as $lang): ?>
99
  <option value="<?php echo $lang['code'] ?>" <?php echo ($slang == $lang['code'])?'selected="selected"':''; ?> ><?php echo $lang['display_name'] ?></option>
100
  <?php endforeach; ?>
101
  </select>
102
 
103
  <select class="wcml_product_category">
104
+ <option value="0"><?php _e('Any category', 'woocommerce-multilingual'); ?></option>
105
  <?php
106
 
107
  $sql = "SELECT tt.term_taxonomy_id,tt.term_id,t.name FROM $wpdb->term_taxonomy AS tt
124
  ?>
125
  </select>
126
  <select class="wcml_translation_status">
127
+ <option value="all"><?php _e('All products', 'woocommerce-multilingual'); ?></option>
128
+ <option value="not" <?php echo (isset($_GET['trst']) && $_GET['trst']=='not')?'selected="selected"':''; ?>><?php _e('Not translated or needs updating', 'woocommerce-multilingual'); ?></option>
129
+ <option value="need_update" <?php echo (isset($_GET['trst']) && $_GET['trst']=='need_update')?'selected="selected"':''; ?>><?php _e('Needs updating', 'woocommerce-multilingual'); ?></option>
130
+ <option value="in_progress" <?php echo (isset($_GET['trst']) && $_GET['trst']=='in_progress')?'selected="selected"':''; ?>><?php _e('Translation in progress', 'woocommerce-multilingual'); ?></option>
131
+ <option value="complete" <?php echo (isset($_GET['trst']) && $_GET['trst']=='complete')?'selected="selected"':''; ?>><?php _e('Translation complete', 'woocommerce-multilingual'); ?></option>
132
  </select>
133
 
134
  <?php
137
  unset( $all_statuses['trash'], $all_statuses['auto-draft'], $all_statuses['inherit'], $all_statuses['wc-pending'], $all_statuses['wc-processing'], $all_statuses['wc-on-hold'], $all_statuses['wc-completed'], $all_statuses['wc-cancelled'], $all_statuses['wc-refunded'], $all_statuses['wc-failed'] );
138
  ?>
139
  <select class="wcml_product_status">
140
+ <option value="all"><?php _e('All statuses', 'woocommerce-multilingual'); ?></option>
141
  <?php foreach($all_statuses as $key=>$status): ?>
142
  <option value="<?php echo $key; ?>" <?php echo (isset($_GET['st']) && $_GET['st']==$key)?'selected="selected"':''; ?> ><?php echo ucfirst($status); ?></option>
143
  <?php endforeach; ?>
145
  </div>
146
 
147
  <div>
148
+ <input type="text" class="wcml_product_name" placeholder="<?php _e('Search', 'woocommerce-multilingual'); ?>" value="<?php echo isset($_GET['s'])?$_GET['s']:''; ?>"/>
149
  <input type="hidden" value="<?php echo admin_url('admin.php?page=wpml-wcml&tab=products'); ?>" class="wcml_products_admin_url" />
150
  <input type="hidden" value="<?php echo $pagination_url; ?>" class="wcml_pagination_url" />
151
 
152
+ <button type="button" value="search" class="wcml_search button-secondary"><?php _e('Search', 'woocommerce-multilingual'); ?></button>
153
  <?php if($search): ?>
154
+ <button type="button" value="reset" class="button-secondary wcml_reset_search"><?php _e('Reset', 'woocommerce-multilingual'); ?></button>
155
  <?php endif;?>
156
  </div>
157
  <?php endif; ?>
158
 
159
  <?php if( $products && !isset( $_GET['prid'] ) ): ?>
160
  <div class="wcml_product_pagination">
161
+ <span class="displaying-num"><?php printf(__('%d products', 'woocommerce-multilingual'), $products_count); ?></span>
162
  <?php if(!isset($_GET['prid']) && isset($last) && $last > 1): ?>
163
+ <a class="first-page <?php echo $pn==1?'disabled':''; ?>" href="<?php echo $pagination_url; ?>1" title="<?php _e('Go to the first page', 'woocommerce-multilingual'); ?>">&laquo;</a>
164
+ <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', 'woocommerce-multilingual'); ?>">&lsaquo;</a>
165
+ <input type="text" class="current-page wcml_pagin" value="<?php echo $pn;?>" size="1"/>&nbsp;<span><?php _e('of', 'woocommerce-multilingual'); ?>&nbsp;<?php echo $last; ?><span>
166
+ <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', 'woocommerce-multilingual'); ?>">&rsaquo;</a>
167
+ <a class="last-page <?php echo $pn==$last?'disabled':''; ?>" href="<?php echo $pagination_url.$last; ?>" title="<?php _e('Go to the last page', 'woocommerce-multilingual'); ?>">&raquo;</a>
168
  <?php endif; ?>
169
  <?php if(isset($_GET['prid']) || ($lm && isset($last)) && $last > 1): ?>
170
+ <a href="<?php echo $pagination_url; ?>1"><?php _e('Show all products', 'woocommerce-multilingual'); ?></a>
171
  <?php endif; ?>
172
  </div>
173
  <?php endif; ?>
177
  <table class="widefat fixed wcml_products" cellspacing="0">
178
  <thead>
179
  <tr>
180
+ <th scope="col" width="5%"><?php _e('Type', 'woocommerce-multilingual') ?></th>
181
+ <th scope="col" width="20%"><?php _e('Product', 'woocommerce-multilingual') ?></th>
182
  <th scope="col" width="75%"><?php echo $woocommerce_wpml->products->get_translation_flags($active_languages,$slang,$job_id ? $job_language : false); ?></th>
183
  </tr>
184
  </thead>
185
  <tbody>
186
  <?php if(empty($products)): ?>
187
+ <tr><td colspan="4"><h3 class="wcml_no_found_text"><?php _e('No products found', 'woocommerce-multilingual'); ?></h3></td></tr>
188
  <?php else: ?>
189
  <?php foreach ($products as $product) :
190
  $trid = $sitepress->get_element_trid($product->ID,'post_'.$product->post_type);
222
  <?php endif; ?>
223
  <?php echo $product->post_title;
224
  if($product->post_status == 'draft' && ((isset($_GET['st']) && $_GET['st'] != 'draft') || !isset($_GET['st']))): ?>
225
+ <span class="wcml_product_status_text"><?php _e(' (draft)', 'woocommerce-multilingual'); ?></span>
226
  <?php endif; ?>
227
  <?php if ($search && $product->post_parent != 0): ?>
228
+ <span class="prod_parent_text"><?php printf(__(' | Parent product: %s', 'woocommerce-multilingual'),get_the_title($product->post_parent)); ?><span>
229
  <?php endif; ?>
230
  </td>
231
  <td>
239
  echo $woocommerce_wpml->products->get_translation_statuses($product_translations,$active_languages,$prod_lang,$trid,$job_id ? $job_language : false); ?>
240
  </div>
241
  <span class="spinner"></span>
242
+ <a href="#prid_<?php echo $product->ID; ?>" job_id = "<?php echo $job_id; ?>" id="wcml_details_<?php echo $product->ID; ?>" class="wcml_details" data-text-opened="<?php _e('Close', 'woocommerce-multilingual') ?>" data-text-closed="<?php _e('Edit translation', 'woocommerce-multilingual') ?>"><?php isset( $_GET['prid'] ) ? _e('Close', 'woocommerce-multilingual') : _e('Edit translation', 'woocommerce-multilingual') ?></a>
243
 
244
  </td>
245
  </tr>
259
 
260
  <?php if( $products && !isset( $_GET['prid'] )): ?>
261
  <div class="wcml_product_pagination">
262
+ <span class="displaying-num"><?php printf(__('%d products', 'woocommerce-multilingual'), $products_count); ?></span>
263
  <?php if(!isset($_GET['prid']) && isset($last) && $last > 1): ?>
264
+ <a class="first-page <?php echo $pn==1?'disabled':''; ?>" href="<?php echo $pagination_url; ?>1" title="<?php _e('Go to the first page', 'woocommerce-multilingual'); ?>">&laquo;</a>
265
+ <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', 'woocommerce-multilingual'); ?>">&lsaquo;</a>
266
+ <span><?php echo $pn;?>&nbsp;<?php _e('of', 'woocommerce-multilingual'); ?>&nbsp;<?php echo $last; ?><span>
267
+ <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', 'woocommerce-multilingual'); ?>">&rsaquo;</a>
268
+ <a class="last-page <?php echo $pn==$last?'disabled':''; ?>" href="<?php echo $pagination_url.$last; ?>" title="<?php _e('Go to the last page', 'woocommerce-multilingual'); ?>">&raquo;</a>
269
  <?php endif; ?>
270
  <?php if(isset($_GET['prid']) || ($lm && isset($last)) && $last > 1): ?>
271
+ <a href="<?php echo $pagination_url; ?>1"><?php _e('Show all products', 'woocommerce-multilingual'); ?></a>
272
  <?php endif; ?>
273
  </div>
274
  <div class="clr"></div>
menu/sub/settings.php CHANGED
@@ -5,33 +5,33 @@ $default_language = $sitepress->get_default_language();
5
  <div class="wcml-section">
6
  <div class="wcml-section-header">
7
  <h3>
8
- <?php _e('Plugins Status','wpml-wcml'); ?>
9
- <i class="icon-question-sign" data-tip="<?php _e('WooCommerce Multilingual depends on several plugins to work. If any required plugin is missing, you should install and activate it.', 'wpml-wcml') ?>"></i>
10
  </h3>
11
  </div>
12
  <div class="wcml-section-content">
13
  <ul>
14
  <?php if (defined('ICL_SITEPRESS_VERSION')) : ?>
15
- <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'wpml-wcml'), '<strong>WPML</strong>'); ?></li>
16
  <?php if($sitepress->setup()): ?>
17
- <li><i class="icon-ok"></i> <?php printf(__('%s is set up.', 'wpml-wcml'), '<strong>WPML</strong>'); ?></li>
18
  <?php else: ?>
19
- <li><i class="icon-warning-sign"></i> <?php printf(__('%s is not set up.', 'wpml-wcml'), '<strong>WPML</strong>'); ?></li>
20
  <?php endif; ?>
21
  <?php endif; ?>
22
  <?php if (defined('WPML_MEDIA_VERSION')) : ?>
23
- <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'wpml-wcml'), '<strong>WPML Media</strong>'); ?></li>
24
  <?php endif; ?>
25
  <?php if (defined('WPML_TM_VERSION')) : ?>
26
- <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'wpml-wcml'), '<strong>WPML Translation Management</strong>'); ?></li>
27
  <?php endif; ?>
28
  <?php if (defined('WPML_ST_VERSION')) : ?>
29
- <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'wpml-wcml'), '<strong>WPML String Translation</strong>'); ?></li>
30
  <?php endif; ?>
31
  <?php
32
  global $woocommerce;
33
  if (class_exists('Woocommerce')) : ?>
34
- <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'wpml-wcml'), '<strong>WooCommerce</strong>'); ?></li>
35
  <?php endif; ?>
36
  </ul>
37
  </div> <!-- .wcml-section-content -->
@@ -40,15 +40,15 @@ $default_language = $sitepress->get_default_language();
40
 
41
 
42
  <?php
43
- $miss_slug_lang = $woocommerce_wpml->strings->get_missed_product_slag_translations_languages();
44
  $prod_slug = $woocommerce_wpml->strings->product_permalink_slug();
45
 
46
  if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty( $woocommerce_wpml->settings['dismiss_non_default_language_warning'] ) ) || !empty($woocommerce_wpml->dependencies->xml_config_errors) || !empty($miss_slug_lang) ): ?>
47
  <div class="wcml-section">
48
  <div class="wcml-section-header">
49
  <h3>
50
- <?php _e('Configuration warnings','wpml-wcml'); ?>
51
- <i class="icon-question-sign" data-tip="<?php _e('Reporting miscelaneous configuration issues that can make WooCommerce Multilingual not run normally', 'wpml-wcml') ?>"></i>
52
  </h3>
53
  </div>
54
 
@@ -58,9 +58,9 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
58
 
59
  <?php if ( apply_filters( 'wpml_slug_translation_available', false ) ): ?>
60
  <?php // Use new API for WPML >= 3.2.3 ?>
61
- <p><i class="icon-warning-sign"></i><?php printf(__("Your product permalink base is not translated in %s. The urls for the translated products will not work. Go to the %sSlugs Translation%s to translate.", 'wpml-wcml'), '<b>'. implode(', ',$miss_slug_lang).'</b>' ,'<a href="' . apply_filters( 'wpml_get_slug_translation_url' , '' ) . '">', '</a>') ?> </p>
62
  <?php else:?>
63
- <p><i class="icon-warning-sign"></i><?php printf(__("Your product permalink base is not translated in %s. The urls for the translated products will not work. Go to the %sString Translation%s to translate.", 'wpml-wcml'), '<b>'. implode(', ',$miss_slug_lang).'</b>' ,'<a href="'.admin_url('admin.php?page='.WPML_ST_FOLDER.'/menu/string-translation.php&search='.$prod_slug.'&context=WordPress&em=1').'">', '</a>') ?> </p>
64
  <?php endif;?>
65
 
66
  <?php endif;?>
@@ -68,32 +68,32 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
68
  <?php if(!WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en'): ?>
69
 
70
  <?php if($sitepress_settings['st']['strings_language'] != 'en'): ?>
71
- <p><i class="icon-warning-sign"></i><strong><?php _e('Attention required: probable problem with URLs in different languages', 'wpml-wcml') ?></strong></p>
72
 
73
- <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>
74
 
75
  <ul>
76
- <li>&raquo;&nbsp;<?php _e('Change the strings language to English', 'wpml-wcml') ?></li>
77
- <li>&raquo;&nbsp;<?php _e('Re-scan strings', 'wpml-wcml') ?></li>
78
  </ul>
79
 
80
  <p class="submit">
81
  <input type="hidden" id="wcml_fix_strings_language_nonce" value="<?php echo wp_create_nonce('wcml_fix_strings_language') ?>" />
82
- <input id="wcml_fix_strings_language" type="button" class="button-primary" value="<?php esc_attr_e('Run fix', 'wpml-wcml') ?>" />
83
  </p>
84
 
85
- <p><?php printf(__("Please review the %sguide for running WooCommerce multilingual with default language other than English%s.", 'wpml-wcml'), '<a href="http://wpml.org/?page_id=355545">', '</a>') ?> </p>
86
 
87
  <?php elseif( empty( $woocommerce_wpml->settings['dismiss_non_default_language_warning'] ) ): ?>
88
 
89
- <p><?php _e("Your site's default language is not English. There are some settings that require careful attention.", 'wpml-wcml') ?> </p>
90
- <p><?php printf(__("Please review the %sguide for running WooCommerce multilingual with default language other than English%s.", 'wpml-wcml'), '<a href="http://wpml.org/?page_id=355545">', '</a>') ?> </p>
91
 
92
  <?php endif; ?>
93
 
94
  <?php if($sitepress_settings['st']['strings_language'] == 'en' && empty( $woocommerce_wpml->settings['dismiss_non_default_language_warning'] )): ?>
95
  <p class="submit">
96
- <input id="wcml_dimiss_non_default_language_warning" type="button" class="button-primary" value="<?php esc_attr_e('Dismiss', 'wpml-wcml') ?>" />
97
  <?php wp_nonce_field('wcml_settings', 'wcml_settings_nonce'); ?>
98
  </p>
99
  <?php endif; ?>
@@ -102,9 +102,9 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
102
 
103
  <?php if(!empty($woocommerce_wpml->dependencies->xml_config_errors)): ?>
104
  <p><i class="icon-warning-sign"></i>
105
- <strong><?php _e('Some settings from the WooCommerce Multilingual wpml-config.xml file have been overwritten.', 'wpml-wcml'); ?></strong>
106
  </p>
107
- <p><?php printf(__('You should check WPML configuration files added by other plugins or manual settings on the %sMultilingual Content Setup%s section.', 'wpml-wcml'),
108
  '<a href="' . admin_url('admin.php?page=' . WPML_TM_FOLDER . '/menu/main.php&sm=mcsetup') . '">' , '</a>') ?>
109
  </p>
110
  <ul>
@@ -123,8 +123,8 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
123
 
124
  <div class="wcml-section-header">
125
  <h3>
126
- <?php _e('WooCommerce Store Pages','wpml-wcml'); ?>
127
- <i class="icon-question-sign" data-tip="<?php _e('To run a multilingual e-commerce site, you need to have the WooCommerce shop pages translated in all the site\'s languages. Once all the pages are installed you can add the translations for them from this menu.', 'wpml-wcml') ?>"></i>
128
  </h3>
129
  </div>
130
 
@@ -134,7 +134,7 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
134
  <?php if($miss_lang == 'non_exist'): ?>
135
  <ul>
136
  <li>
137
- <i class="icon-warning-sign"></i><span><?php _e("One or more WooCommerce pages have not been created.",'wpml-wcml'); ?></span>
138
  </li>
139
  <li><a href="<?php echo version_compare($woocommerce->version, '2.1', '<') ? admin_url('admin.php?page=woocommerce_settings&tab=pages') : admin_url('admin.php?page=wc-status&tab=tools'); ?>"><?php _e('Install WooCommerce Pages') ?></a></li>
140
  </ul>
@@ -149,9 +149,9 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
149
  </p>
150
  <?php
151
  if(count($miss_lang['codes']) == 1){
152
- _e("WooCommerce store pages don't exist for this language:",'wpml-wcml');
153
  }else{
154
- _e("WooCommerce store pages don't exist for these languages:",'wpml-wcml');
155
  }
156
  ?>
157
  </p>
@@ -161,27 +161,27 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
161
  if(isset($miss_lang['lang'])): ?>
162
  <p>
163
  <strong><?php echo $miss_lang['lang'] ?></strong>
164
- <input class="button" type="submit" name="create_pages" value="<?php esc_attr(_e('Create missing translations.', 'wpml-wcml')) ?>" />
165
  </p>
166
  <?php endif; ?>
167
 
168
  <?php
169
  if(isset($miss_lang['in_progress'])): ?>
170
  <p>
171
- <?php _e("These pages are currently being translated by translators via WPML: ",'wpml-wcml'); ?>
172
  <strong><?php echo $miss_lang['in_progress'] ?></strong>
173
  </p>
174
  <?php endif; ?>
175
 
176
- <a id="wcmp_hide" class="wcmp_lang_hide" href="javascript:void(0);"><?php _e('Hide this message', 'wpml-wcml') ?></a>
177
  </div>
178
  <p>
179
- <a id="wcmp_show" class="none" href="javascript:void(0);"><?php _e('Show details about missing translations', 'wpml-wcml') ?></a>
180
  </p>
181
  </form>
182
  <?php else: ?>
183
  <p>
184
- <i class="icon-ok"></i><span><?php _e("WooCommerce store pages are translated to all the site's languages.",'wpml-wcml'); ?></span>
185
  </p>
186
  <?php endif; ?>
187
 
@@ -193,8 +193,8 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
193
 
194
  <div class="wcml-section-header">
195
  <h3>
196
- <?php _e('Taxonomies missing translations','wpml-wcml'); ?>
197
- <i class="icon-question-sign" data-tip="<?php esc_attr_e('To run a fully translated site, you should translate all taxonomy terms. Some store elements, such as variations, depend on taxonomy translation.', 'wpml-wcml') ?>"></i>
198
  </h3>
199
  </div>
200
 
@@ -225,24 +225,24 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
225
  <li class="js-tax-translation-<?php echo $taxonomy ?>">
226
  <?php if($untranslated = WCML_Terms::get_untranslated_terms_number($taxonomy)): ?>
227
  <?php if(WCML_Terms::is_fully_translated($taxonomy)): // covers the 'ignore' case' ?>
228
- <i class="icon-ok"></i> <?php printf(__('%s do not require translation.', 'wpml-wcml'), get_taxonomy($taxonomy)->labels->name); ?>
229
  <div class="actions">
230
- <a href="#unignore-<?php echo $taxonomy ?>" title="<?php esc_attr_e('This taxonomy requires translation.', 'wpml-wcml') ?>"><?php _e('Change', 'wpml-wcml') ?></a>
231
  </div>
232
  <?php else: ?>
233
- <i class="icon-warning-sign"></i> <?php printf(__('Some %s are missing translations (%d translations missing).', 'wpml-wcml'), get_taxonomy($taxonomy)->labels->name, $untranslated); ?>
234
  <div class="actions">
235
- <a href="<?php echo admin_url('admin.php?page=wpml-wcml&tab=' . $taxonomy) ?>"><?php _e('Translate now', 'wpml-wcml') ?></a> |
236
- <a href="#ignore-<?php echo $taxonomy ?>" title="<?php esc_attr_e('This taxonomy does not require translation.', 'wpml-wcml') ?>"><?php _e('Ignore', 'wpml-wcml') ?></a>
237
  </div>
238
  <?php endif; ?>
239
  <?php else: ?>
240
- <i class="icon-ok"></i> <?php printf(__('All %s are translated.', 'wpml-wcml'), get_taxonomy($taxonomy)->labels->name); ?>
241
  <?php endif; ?>
242
  </li>
243
  <?php endforeach; ?>
244
  <?php if($no_tax_to_update): ?>
245
- <li><i class="icon-ok"></i> <?php _e('Right now, there are no taxonomy terms needing translation.', 'wpml-wcml'); ?></li>
246
  <?php endif; ?>
247
  </ul>
248
 
@@ -254,8 +254,8 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
254
  <div class="wcml-section">
255
  <div class="wcml-section-header">
256
  <h3>
257
- <?php _e('Product Translation Interface','wpml-wcml'); ?>
258
- <i class="icon-question-sign" data-tip="<?php _e('The recommended way to translate products is using the products translation table in the WooCommerce Multilingual admin. Choose to go to the native WooCommerce interface, if your products include custom sections that require direct access.', 'wpml-wcml') ?>"></i>
259
  </h3>
260
  </div>
261
  <div class="wcml-section-content">
@@ -263,19 +263,19 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
263
  <?php wp_nonce_field('wcml_trsl_interface_table', 'wcml_nonce'); ?>
264
  <ul>
265
  <li>
266
- <p><?php _e('Choose what to do when clicking on the translation controls for products:','wpml-wcml'); ?></p>
267
  </li>
268
  <li>
269
  <input type="radio" name="trnsl_interface" value="1" <?php echo $woocommerce_wpml->settings['trnsl_interface'] == '1'?'checked':''; ?> id="wcml_trsl_interface_wcml" />
270
- <label for="wcml_trsl_interface_wcml"><?php _e('Go to the product translation table in WooCommerce Multilingual', 'wpml-wcml'); ?></label>
271
  </li>
272
  <li>
273
  <input type="radio" name="trnsl_interface" value="0" <?php echo $woocommerce_wpml->settings['trnsl_interface'] == '0'?'checked':''; ?> id="wcml_trsl_interface_native" />
274
- <label for="wcml_trsl_interface_native"><?php _e('Go to the native WooCommerce product editing screen', 'wpml-wcml'); ?></label>
275
  </li>
276
  </ul>
277
  <p class="button-wrap">
278
- <input type='submit' name="wcml_trsl_interface_table" value='<?php esc_attr(_e('Save', 'wpml-wcml')); ?>' class='button-secondary' />
279
  </p>
280
  </form>
281
  </div> <!-- .wcml-section-content -->
@@ -286,8 +286,8 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
286
 
287
  <div class="wcml-section-header">
288
  <h3>
289
- <?php _e('Products synchronization', 'wpml-wcml'); ?>
290
- <i class="icon-question-sign" data-tip="<?php _e('Configure specific product properties that should be synced to translations.', 'wpml-wcml') ?>"></i>
291
  </h3>
292
  </div>
293
 
@@ -297,15 +297,15 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
297
  <ul>
298
  <li>
299
  <input type="checkbox" name="products_sync_date" value="1" <?php echo checked(1, $woocommerce_wpml->settings['products_sync_date']) ?> id="wcml_products_sync_date" />
300
- <label for="wcml_products_sync_date"><?php _e('Sync publishing date for translated products.', 'wpml-wcml'); ?></label>
301
  </li>
302
  <li>
303
  <input type="checkbox" name="products_sync_order" value="1" <?php echo checked(1, $woocommerce_wpml->settings['products_sync_order']) ?> id="wcml_products_sync_order" />
304
- <label for="wcml_products_sync_order"><?php _e('Sync products and product taxonomies order.', 'wpml-wcml'); ?></label>
305
  </li>
306
  </ul>
307
  <p class="button-wrap">
308
- <input type='submit' name="wcml_products_sync_prop" value='<?php esc_attr(_e('Save', 'wpml-wcml')); ?>' class='button-secondary' />
309
  </p>
310
  </form>
311
  </div>
@@ -317,8 +317,8 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
317
 
318
  <div class="wcml-section-header">
319
  <h3>
320
- <?php _e('File Paths Synchronization ', 'wpml-wcml'); ?>
321
- <i class="icon-question-sign" data-tip="<?php _e('If you are using downloadable products, you can choose to have their paths synchronized, or seperate for each language.', 'wpml-wcml') ?>"></i>
322
  </h3>
323
  </div>
324
 
@@ -328,15 +328,15 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
328
  <ul>
329
  <li>
330
  <input type="radio" name="wcml_file_path_sync" value="1" <?php echo $woocommerce_wpml->settings['file_path_sync'] == '1'?'checked':''; ?> id="wcml_file_path_sync_auto" />
331
- <label for="wcml_file_path_sync_auto"><?php _e('Use the same file paths in all languages', 'wpml-wcml'); ?></label>
332
  </li>
333
  <li>
334
  <input type="radio" name="wcml_file_path_sync" value="0" <?php echo $woocommerce_wpml->settings['file_path_sync'] == '0'?'checked':''; ?> id="wcml_file_path_sync_self" />
335
- <label for="wcml_file_path_sync_self"><?php _e('Different file paths for each language', 'wpml-wcml'); ?></label>
336
  </li>
337
  </ul>
338
  <p class="button-wrap">
339
- <input type='submit' name="wcml_file_path_options_table" value='<?php esc_attr(_e('Save', 'wpml-wcml')); ?>' class='button-secondary' />
340
  </p>
341
  </form>
342
 
@@ -349,8 +349,8 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
349
 
350
  <div class="wcml-section-header">
351
  <h3>
352
- <?php _e('Manage Currencies', 'wpml-wcml'); ?>
353
- <i class="icon-question-sign" data-tip="<?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>
354
  </h3>
355
  </div>
356
  <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>" id="wcml_mc_options">
@@ -364,13 +364,13 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
364
  <li>
365
  <input type="radio" name="multi_currency" id="multi_currency_disabled" value="<?php echo WCML_MULTI_CURRENCIES_DISABLED ?>" <?php
366
  echo checked($woocommerce_wpml->settings['enable_multi_currency'], WCML_MULTI_CURRENCIES_DISABLED) ?> />
367
- <label for="multi_currency_disabled"><?php _e("No multi-currency.",'wpml-wcml'); ?></label>
368
  </li>
369
  <li>
370
  <input type="radio" name="multi_currency" id="multi_currency_independent" value="<?php echo WCML_MULTI_CURRENCIES_INDEPENDENT ?>" <?php
371
  echo checked($woocommerce_wpml->settings['enable_multi_currency'], WCML_MULTI_CURRENCIES_INDEPENDENT) ?> />
372
  <label for="multi_currency_independent">
373
- <?php _e("Multiple currencies, independent of languages.",'wpml-wcml'); ?>
374
  &nbsp;
375
  <a href=" <?php echo $woocommerce_wpml->generate_tracking_link('http://wpml.org/documentation/related-projects/woocommerce-multilingual/multi-currency-support-woocommerce/','multi-currency-support-woocommerce','documentation') ?>"><?php _e('Learn more', 'wpl-wcml') ?></a>.
376
  </label>
@@ -399,21 +399,21 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
399
 
400
  ?>
401
  <p>
402
- <?php printf(__("Your store's base currency is %s (%s). To change it, go to the %s page.", 'wpml-wcml'), $wc_currencies[$wc_currency],get_woocommerce_currency_symbol($wc_currency),'<a href="'. admin_url(sprintf('admin.php?page=%s&tab=general', version_compare($woocommerce->version, '2.1', '<') ? 'woocommerce_settings' : 'wc-settings')) .'">WooCommerce settings</a>'); ?>
403
  </p>
404
  <input type="hidden" id="update_currency_lang_nonce" value="<?php echo wp_create_nonce('wcml_update_currency_lang'); ?>"/>
405
  <table class="widefat currency_table" id="currency-table">
406
  <thead>
407
  <tr>
408
- <th><?php _e('Currency', 'wpml-wcml'); ?></th>
409
  <th></th>
410
  </tr>
411
  </thead>
412
  <tbody>
413
  <tr>
414
  <td class="currency_code">
415
- <span class="code_val"><?php echo $wc_currencies[$wc_currency]; ?><?php printf(__(' (%s)','wpml-wcml'), $positioned_price); ?></span>
416
- <div class="currency_value"><span><?php _e( 'default', 'wpml-wcml' ); ?></span></div>
417
  </td>
418
  <td class="currency-actions"></td>
419
 
@@ -432,7 +432,7 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
432
  <tr id="currency_row_<?php echo $code ?>">
433
  <td class="currency_code">
434
  <?php include WCML_PLUGIN_PATH . '/menu/sub/custom-currency-options.php'; ?>
435
- <span class="code_val"><?php echo $wc_currencies[$code]; ?><?php printf(__(' (%s)','wpml-wcml'), $positioned_price); ?></span>
436
  <div class="currency_value">
437
  <span><?php printf('1 %s = %s %s', $wc_currency, $currency['rate'], $code); ?></span>
438
  </div>
@@ -441,14 +441,14 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
441
 
442
  <td class="currency-actions">
443
  <div class="currency_action_update">
444
- <a href="javascript:void(0);" title="<?php esc_attr(_e('Edit', 'wpml-wcml')); ?>" class="edit_currency" data-currency="<?php echo $code ?>">
445
- <i class="icon-edit" title="<?php esc_attr(_e('Edit', 'wpml-wcml')); ?>"></i>
446
  </a>
447
  <i class="icon-ok-circle save_currency"></i>
448
  </div>
449
  <div class="currency_action_delete">
450
- <a href="javascript:void(0);" title="<?php esc_attr(_e('Delete', 'wpml-wcml')); ?>" class="delete_currency" data-currency="<?php echo $code ?>" >
451
- <i class="icon-trash" title="<?php esc_attr(_e('Delete', 'wpml-wcml')); ?>"></i>
452
  </a>
453
  <i class="icon-remove-circle cancel_currency"></i>
454
  </div>
@@ -457,8 +457,8 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
457
  <?php endforeach; ?>
458
  <tr class="default_currency">
459
  <td colspan="2">
460
- <span class="cur_label"><?php _e('Default currency', 'wpml-wcml'); ?></span>
461
- <span class="inf_message"><?php _e('Switch to this currency when switching language in the front-end', 'wpml-wcml'); ?></span>
462
  </td>
463
  </tr>
464
  </tbody>
@@ -482,8 +482,8 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
482
  <td class="currency_languages">
483
  <div class="wcml_onof_buttons">
484
  <ul>
485
- <li <?php echo $woocommerce_wpml->settings['currency_options'][$wc_currency]['languages'][$language['code']] == 0 ?'class="on"':''; ?> ><a class="off_btn" href="javascript:void(0);" data-language="<?php echo $language['code']; ?>" data-currency="<?php echo $wc_currency; ?>" ><?php _e( 'OFF', 'wpml-wcml' ); ?></a></li>
486
- <li <?php echo $woocommerce_wpml->settings['currency_options'][$wc_currency]['languages'][$language['code']] == 1 ?'class="on"':''; ?> ><a class="on_btn" href="javascript:void(0);" data-language="<?php echo $language['code']; ?>" data-currency="<?php echo $wc_currency ?>"><?php _e( 'ON', 'wpml-wcml' ); ?></a></li>
487
  </ul>
488
  </div>
489
  </td>
@@ -495,8 +495,8 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
495
  <td class="currency_languages">
496
  <div class="wcml_onof_buttons">
497
  <ul>
498
- <li <?php echo $currency['languages'][$language['code']] == 0 ?'class="on"':''; ?> ><a class="off_btn" href="javascript:void(0);" data-language="<?php echo $language['code']; ?>" data-currency="<?php echo $code; ?>"><?php _e( 'OFF', 'wpml-wcml' ); ?></a></li>
499
- <li <?php echo $currency['languages'][$language['code']] == 1 ?'class="on"':''; ?> ><a class="on_btn" href="javascript:void(0);" data-language="<?php echo $language['code']; ?>" data-currency="<?php echo $code; ?>"><?php _e( 'ON', 'wpml-wcml' ); ?></a></li>
500
  </ul>
501
  </div>
502
  </td>
@@ -507,7 +507,7 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
507
  <?php foreach($active_languages as $language): ?>
508
  <td class="currency_languages">
509
  <select rel="<?php echo $language['code']; ?>">
510
- <option value="0" <?php selected('0', $woocommerce_wpml->settings['default_currencies'][$language['code']]); ?>><?php _e('Keep', 'wpml-wcml'); ?></option>
511
  <?php if($woocommerce_wpml->settings['currency_options'][$wc_currency]['languages'][$language['code']] == 1): ?>
512
  <option value="<?php echo $wc_currency; ?>" <?php selected($wc_currency, $woocommerce_wpml->settings['default_currencies'][$language['code']]); ?>><?php echo $wc_currency; ?></option>
513
  <?php endif; ?>
@@ -530,7 +530,7 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
530
  <?php // this is a template for scripts.js : jQuery('.wcml_add_currency button').click(function(); ?>
531
  <table class="hidden js-table-row-wrapper">
532
  <tr class="edit-mode js-table-row">
533
- <td class="currency_code" data-message="<?php _e( 'Please fill field', 'wpml-wcml' ); ?>">
534
  <span class="code_val"></span>
535
  <select name="code" style="display:block">
536
  <?php foreach($wc_currencies as $wc_code=>$currency_name): ?>
@@ -539,7 +539,7 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
539
  <?php endif; ?>
540
  <?php endforeach; ?>
541
  </select>
542
- <div class="currency_value" data-message="<?php _e( 'Only numeric', 'wpml-wcml' ); ?>">
543
  <span>
544
  <?php printf('1 %s = ',$wc_currency); ?>
545
  <span class="curr_val"></span>
@@ -571,8 +571,8 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
571
  <td class="currency_languages">
572
  <div class="wcml_onof_buttons">
573
  <ul>
574
- <li><a class="off_btn" href="javascript:void(0);" data-language="<?php echo $language['code']; ?>"><?php _e( 'OFF', 'wpml-wcml' ); ?></a></li>
575
- <li class="on"><a class="on_btn" href="javascript:void(0);" data-language="<?php echo $language['code']; ?>"><?php _e( 'ON', 'wpml-wcml' ); ?></a></li>
576
  </ul>
577
  </div>
578
  </td>
@@ -589,7 +589,7 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty(
589
  <p class="wcml_add_currency button-wrap">
590
  <button type="button" class="button-secondary">
591
  <i class="icon-plus"></i>
592
- <?php _e('Add currency','wpml-wcml'); ?>
593
  </button>
594
  </p>
595
 
@@ -619,13 +619,13 @@ if($posts){
619
  return false;
620
  }";
621
  echo '</script>';
622
- 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>';
623
  echo '<form method="post" id="wcml_custom_exchange_rates">';
624
  echo '<input type="hidden" name="action" value="legacy_update_custom_rates">';
625
  echo '<table class="widefat currency_table" >';
626
  echo '<thead>';
627
  echo '<tr>';
628
- echo '<th rowspan="2">' . __('Product', 'wpml-wcml') . '</th>';
629
  echo '<th colspan="' . count($currencies) . '">_price</th>';
630
  echo '<th colspan="' . count($currencies) . '">_sale_price</th>';
631
  echo '<th rowspan="2">&nbsp;</th>';
@@ -650,7 +650,7 @@ if($posts){
650
  if(isset($rates['_price'][$code])){
651
  echo '<input name="posts[' . $post->post_id . '][_price][' . $code . ']" size="3" value="' . round($rates['_price'][$code],3) . '">';
652
  }else{
653
- _e('n/a', 'wpml-wcml');
654
  }
655
  echo '</td>';
656
  }
@@ -660,18 +660,18 @@ if($posts){
660
  if(isset($rates['_sale_price'][$code])){
661
  echo '<input name="posts[' . $post->post_id . '][_sale_price][' . $code . ']" size="3" value="' . round($rates['_sale_price'][$code],3) . '">';
662
  }else{
663
- _e('n/a', 'wpml-wcml');
664
  }
665
  echo '</td>';
666
  }
667
 
668
- 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>';
669
  echo '<tr>';
670
 
671
  }
672
  echo '</tbody>';
673
  echo '</table>';
674
- echo '<p class="button-wrap"><input class="button-secondary" type="submit" value="' . esc_attr__('Update', 'wpml-wcml') . '" /></p>';
675
  echo '</form>';
676
 
677
 
@@ -680,12 +680,12 @@ if($posts){
680
  <ul id="display_custom_prices_select">
681
  <li>
682
  <input type="checkbox" name="display_custom_prices" id="display_custom_prices" value="1" <?php echo checked( 1, $woocommerce_wpml->settings['display_custom_prices']) ?> >
683
- <label for="display_custom_prices"><?php _e('Show only products with custom prices in secondary currencies', 'wpml-wcml'); ?></label>
684
- <i class="icon-question-sign" data-tip="<?php _e('When this option is on, when you switch to a secondary currency on the front end, only the products with custom prices in that currency are being displayed. Products with prices determined based on the exchange rate are hidden.', 'wpml-wcml') ?>"></i>
685
  </li>
686
  </ul>
687
  <p class="button-wrap general_option_btn">
688
- <input type='submit' name="wcml_mc_options" value='<?php _e('Save', 'wpml-wcml'); ?>' class='button-secondary' />
689
  <?php wp_nonce_field('wcml_mc_options', 'wcml_mc_options_nonce'); ?>
690
  </p>
691
  </div>
@@ -695,9 +695,9 @@ if($posts){
695
  </div>
696
  </form>
697
  </div> <!-- .wcml-section -->
698
- <input type="hidden" id="wcml_warn_message" value="<?php esc_attr_e('The changes you made will be lost if you navigate away from this page.','wpml-wcml');?>"/>
699
- <input type="hidden" id="wcml_warn_disable_language_massage" value="<?php esc_attr_e('At least one currency must be enabled for this language!','wpml-wcml');?>"/>
700
  <div class="troubleshoot_link_block">
701
- <a href="<?php echo admin_url('admin.php?page='.basename(WCML_PLUGIN_PATH) .'/menu/sub/troubleshooting.php'); ?>"><?php _e('Troubleshooting page','wpml-wcml'); ?></a>
702
  </div>
703
  <div class="clear"></div>
5
  <div class="wcml-section">
6
  <div class="wcml-section-header">
7
  <h3>
8
+ <?php _e('Plugins Status', 'woocommerce-multilingual'); ?>
9
+ <i class="icon-question-sign" data-tip="<?php _e('WooCommerce Multilingual depends on several plugins to work. If any required plugin is missing, you should install and activate it.', 'woocommerce-multilingual') ?>"></i>
10
  </h3>
11
  </div>
12
  <div class="wcml-section-content">
13
  <ul>
14
  <?php if (defined('ICL_SITEPRESS_VERSION')) : ?>
15
+ <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'woocommerce-multilingual'), '<strong>WPML</strong>'); ?></li>
16
  <?php if($sitepress->setup()): ?>
17
+ <li><i class="icon-ok"></i> <?php printf(__('%s is set up.', 'woocommerce-multilingual'), '<strong>WPML</strong>'); ?></li>
18
  <?php else: ?>
19
+ <li><i class="icon-warning-sign"></i> <?php printf(__('%s is not set up.', 'woocommerce-multilingual'), '<strong>WPML</strong>'); ?></li>
20
  <?php endif; ?>
21
  <?php endif; ?>
22
  <?php if (defined('WPML_MEDIA_VERSION')) : ?>
23
+ <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'woocommerce-multilingual'), '<strong>WPML Media</strong>'); ?></li>
24
  <?php endif; ?>
25
  <?php if (defined('WPML_TM_VERSION')) : ?>
26
+ <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'woocommerce-multilingual'), '<strong>WPML Translation Management</strong>'); ?></li>
27
  <?php endif; ?>
28
  <?php if (defined('WPML_ST_VERSION')) : ?>
29
+ <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'woocommerce-multilingual'), '<strong>WPML String Translation</strong>'); ?></li>
30
  <?php endif; ?>
31
  <?php
32
  global $woocommerce;
33
  if (class_exists('Woocommerce')) : ?>
34
+ <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'woocommerce-multilingual'), '<strong>WooCommerce</strong>'); ?></li>
35
  <?php endif; ?>
36
  </ul>
37
  </div> <!-- .wcml-section-content -->
40
 
41
 
42
  <?php
43
+ $miss_slug_lang = $woocommerce_wpml->strings->get_missed_product_slug_translations_languages();
44
  $prod_slug = $woocommerce_wpml->strings->product_permalink_slug();
45
 
46
  if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && empty( $woocommerce_wpml->settings['dismiss_non_default_language_warning'] ) ) || !empty($woocommerce_wpml->dependencies->xml_config_errors) || !empty($miss_slug_lang) ): ?>
47
  <div class="wcml-section">
48
  <div class="wcml-section-header">
49
  <h3>
50
+ <?php _e('Configuration warnings', 'woocommerce-multilingual'); ?>
51
+ <i class="icon-question-sign" data-tip="<?php _e('Reporting miscelaneous configuration issues that can make WooCommerce Multilingual not run normally', 'woocommerce-multilingual') ?>"></i>
52
  </h3>
53
  </div>
54
 
58
 
59
  <?php if ( apply_filters( 'wpml_slug_translation_available', false ) ): ?>
60
  <?php // Use new API for WPML >= 3.2.3 ?>
61
+ <p><i class="icon-warning-sign"></i><?php printf(__("Your product permalink base is not translated in %s. The urls for the translated products will not work. Go to the %sSlugs Translation%s to translate.", 'woocommerce-multilingual'), '<b>'. implode(', ',$miss_slug_lang).'</b>' ,'<a href="' . apply_filters( 'wpml_get_slug_translation_url' , '' ) . '">', '</a>') ?> </p>
62
  <?php else:?>
63
+ <p><i class="icon-warning-sign"></i><?php printf(__("Your product permalink base is not translated in %s. The urls for the translated products will not work. Go to the %sString Translation%s to translate.", 'woocommerce-multilingual'), '<b>'. implode(', ',$miss_slug_lang).'</b>' ,'<a href="'.admin_url('admin.php?page='.WPML_ST_FOLDER.'/menu/string-translation.php&search='.$prod_slug.'&context=WordPress&em=1').'">', '</a>') ?> </p>
64
  <?php endif;?>
65
 
66
  <?php endif;?>
68
  <?php if(!WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en'): ?>
69
 
70
  <?php if($sitepress_settings['st']['strings_language'] != 'en'): ?>
71
+ <p><i class="icon-warning-sign"></i><strong><?php _e('Attention required: probable problem with URLs in different languages', 'woocommerce-multilingual') ?></strong></p>
72
 
73
+ <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.", 'woocommerce-multilingual') ?></p>
74
 
75
  <ul>
76
+ <li>&raquo;&nbsp;<?php _e('Change the strings language to English', 'woocommerce-multilingual') ?></li>
77
+ <li>&raquo;&nbsp;<?php _e('Re-scan strings', 'woocommerce-multilingual') ?></li>
78
  </ul>
79
 
80
  <p class="submit">
81
  <input type="hidden" id="wcml_fix_strings_language_nonce" value="<?php echo wp_create_nonce('wcml_fix_strings_language') ?>" />
82
+ <input id="wcml_fix_strings_language" type="button" class="button-primary" value="<?php esc_attr_e('Run fix', 'woocommerce-multilingual') ?>" />
83
  </p>
84
 
85
+ <p><?php printf(__("Please review the %sguide for running WooCommerce multilingual with default language other than English%s.", 'woocommerce-multilingual'), '<a href="http://wpml.org/?page_id=355545">', '</a>') ?> </p>
86
 
87
  <?php elseif( empty( $woocommerce_wpml->settings['dismiss_non_default_language_warning'] ) ): ?>
88
 
89
+ <p><?php _e("Your site's default language is not English. There are some settings that require careful attention.", 'woocommerce-multilingual') ?> </p>
90
+ <p><?php printf(__("Please review the %sguide for running WooCommerce multilingual with default language other than English%s.", 'woocommerce-multilingual'), '<a href="http://wpml.org/?page_id=355545">', '</a>') ?> </p>
91
 
92
  <?php endif; ?>
93
 
94
  <?php if($sitepress_settings['st']['strings_language'] == 'en' && empty( $woocommerce_wpml->settings['dismiss_non_default_language_warning'] )): ?>
95
  <p class="submit">
96
+ <input id="wcml_dimiss_non_default_language_warning" type="button" class="button-primary" value="<?php esc_attr_e('Dismiss', 'woocommerce-multilingual') ?>" />
97
  <?php wp_nonce_field('wcml_settings', 'wcml_settings_nonce'); ?>
98
  </p>
99
  <?php endif; ?>
102
 
103
  <?php if(!empty($woocommerce_wpml->dependencies->xml_config_errors)): ?>
104
  <p><i class="icon-warning-sign"></i>
105
+ <strong><?php _e('Some settings from the WooCommerce Multilingual wpml-config.xml file have been overwritten.', 'woocommerce-multilingual'); ?></strong>
106
  </p>
107
+ <p><?php printf(__('You should check WPML configuration files added by other plugins or manual settings on the %sMultilingual Content Setup%s section.', 'woocommerce-multilingual'),
108
  '<a href="' . admin_url('admin.php?page=' . WPML_TM_FOLDER . '/menu/main.php&sm=mcsetup') . '">' , '</a>') ?>
109
  </p>
110
  <ul>
123
 
124
  <div class="wcml-section-header">
125
  <h3>
126
+ <?php _e('WooCommerce Store Pages', 'woocommerce-multilingual'); ?>
127
+ <i class="icon-question-sign" data-tip="<?php _e('To run a multilingual e-commerce site, you need to have the WooCommerce shop pages translated in all the site\'s languages. Once all the pages are installed you can add the translations for them from this menu.', 'woocommerce-multilingual') ?>"></i>
128
  </h3>
129
  </div>
130
 
134
  <?php if($miss_lang == 'non_exist'): ?>
135
  <ul>
136
  <li>
137
+ <i class="icon-warning-sign"></i><span><?php _e("One or more WooCommerce pages have not been created.", 'woocommerce-multilingual'); ?></span>
138
  </li>
139
  <li><a href="<?php echo version_compare($woocommerce->version, '2.1', '<') ? admin_url('admin.php?page=woocommerce_settings&tab=pages') : admin_url('admin.php?page=wc-status&tab=tools'); ?>"><?php _e('Install WooCommerce Pages') ?></a></li>
140
  </ul>
149
  </p>
150
  <?php
151
  if(count($miss_lang['codes']) == 1){
152
+ _e("WooCommerce store pages don't exist for this language:", 'woocommerce-multilingual');
153
  }else{
154
+ _e("WooCommerce store pages don't exist for these languages:", 'woocommerce-multilingual');
155
  }
156
  ?>
157
  </p>
161
  if(isset($miss_lang['lang'])): ?>
162
  <p>
163
  <strong><?php echo $miss_lang['lang'] ?></strong>
164
+ <input class="button" type="submit" name="create_pages" value="<?php esc_attr(_e('Create missing translations.', 'woocommerce-multilingual')) ?>" />
165
  </p>
166
  <?php endif; ?>
167
 
168
  <?php
169
  if(isset($miss_lang['in_progress'])): ?>
170
  <p>
171
+ <?php _e("These pages are currently being translated by translators via WPML: ", 'woocommerce-multilingual'); ?>
172
  <strong><?php echo $miss_lang['in_progress'] ?></strong>
173
  </p>
174
  <?php endif; ?>
175
 
176
+ <a id="wcmp_hide" class="wcmp_lang_hide" href="javascript:void(0);"><?php _e('Hide this message', 'woocommerce-multilingual') ?></a>
177
  </div>
178
  <p>
179
+ <a id="wcmp_show" class="none" href="javascript:void(0);"><?php _e('Show details about missing translations', 'woocommerce-multilingual') ?></a>
180
  </p>
181
  </form>
182
  <?php else: ?>
183
  <p>
184
+ <i class="icon-ok"></i><span><?php _e("WooCommerce store pages are translated to all the site's languages.", 'woocommerce-multilingual'); ?></span>
185
  </p>
186
  <?php endif; ?>
187
 
193
 
194
  <div class="wcml-section-header">
195
  <h3>
196
+ <?php _e('Taxonomies missing translations', 'woocommerce-multilingual'); ?>
197
+ <i class="icon-question-sign" data-tip="<?php esc_attr_e('To run a fully translated site, you should translate all taxonomy terms. Some store elements, such as variations, depend on taxonomy translation.', 'woocommerce-multilingual') ?>"></i>
198
  </h3>
199
  </div>
200
 
225
  <li class="js-tax-translation-<?php echo $taxonomy ?>">
226
  <?php if($untranslated = WCML_Terms::get_untranslated_terms_number($taxonomy)): ?>
227
  <?php if(WCML_Terms::is_fully_translated($taxonomy)): // covers the 'ignore' case' ?>
228
+ <i class="icon-ok"></i> <?php printf(__('%s do not require translation.', 'woocommerce-multilingual'), get_taxonomy($taxonomy)->labels->name); ?>
229
  <div class="actions">
230
+ <a href="#unignore-<?php echo $taxonomy ?>" title="<?php esc_attr_e('This taxonomy requires translation.', 'woocommerce-multilingual') ?>"><?php _e('Change', 'woocommerce-multilingual') ?></a>
231
  </div>
232
  <?php else: ?>
233
+ <i class="icon-warning-sign"></i> <?php printf(__('Some %s are missing translations (%d translations missing).', 'woocommerce-multilingual'), get_taxonomy($taxonomy)->labels->name, $untranslated); ?>
234
  <div class="actions">
235
+ <a href="<?php echo admin_url('admin.php?page=wpml-wcml&tab=' . $taxonomy) ?>"><?php _e('Translate now', 'woocommerce-multilingual') ?></a> |
236
+ <a href="#ignore-<?php echo $taxonomy ?>" title="<?php esc_attr_e('This taxonomy does not require translation.', 'woocommerce-multilingual') ?>"><?php _e('Ignore', 'woocommerce-multilingual') ?></a>
237
  </div>
238
  <?php endif; ?>
239
  <?php else: ?>
240
+ <i class="icon-ok"></i> <?php printf(__('All %s are translated.', 'woocommerce-multilingual'), get_taxonomy($taxonomy)->labels->name); ?>
241
  <?php endif; ?>
242
  </li>
243
  <?php endforeach; ?>
244
  <?php if($no_tax_to_update): ?>
245
+ <li><i class="icon-ok"></i> <?php _e('Right now, there are no taxonomy terms needing translation.', 'woocommerce-multilingual'); ?></li>
246
  <?php endif; ?>
247
  </ul>
248
 
254
  <div class="wcml-section">
255
  <div class="wcml-section-header">
256
  <h3>
257
+ <?php _e('Product Translation Interface', 'woocommerce-multilingual'); ?>
258
+ <i class="icon-question-sign" data-tip="<?php _e('The recommended way to translate products is using the products translation table in the WooCommerce Multilingual admin. Choose to go to the native WooCommerce interface, if your products include custom sections that require direct access.', 'woocommerce-multilingual') ?>"></i>
259
  </h3>
260
  </div>
261
  <div class="wcml-section-content">
263
  <?php wp_nonce_field('wcml_trsl_interface_table', 'wcml_nonce'); ?>
264
  <ul>
265
  <li>
266
+ <p><?php _e('Choose what to do when clicking on the translation controls for products:', 'woocommerce-multilingual'); ?></p>
267
  </li>
268
  <li>
269
  <input type="radio" name="trnsl_interface" value="1" <?php echo $woocommerce_wpml->settings['trnsl_interface'] == '1'?'checked':''; ?> id="wcml_trsl_interface_wcml" />
270
+ <label for="wcml_trsl_interface_wcml"><?php _e('Go to the product translation table in WooCommerce Multilingual', 'woocommerce-multilingual'); ?></label>
271
  </li>
272
  <li>
273
  <input type="radio" name="trnsl_interface" value="0" <?php echo $woocommerce_wpml->settings['trnsl_interface'] == '0'?'checked':''; ?> id="wcml_trsl_interface_native" />
274
+ <label for="wcml_trsl_interface_native"><?php _e('Go to the native WooCommerce product editing screen', 'woocommerce-multilingual'); ?></label>
275
  </li>
276
  </ul>
277
  <p class="button-wrap">
278
+ <input type='submit' name="wcml_trsl_interface_table" value='<?php esc_attr(_e('Save', 'woocommerce-multilingual')); ?>' class='button-secondary' />
279
  </p>
280
  </form>
281
  </div> <!-- .wcml-section-content -->
286
 
287
  <div class="wcml-section-header">
288
  <h3>
289
+ <?php _e('Products synchronization', 'woocommerce-multilingual'); ?>
290
+ <i class="icon-question-sign" data-tip="<?php _e('Configure specific product properties that should be synced to translations.', 'woocommerce-multilingual') ?>"></i>
291
  </h3>
292
  </div>
293
 
297
  <ul>
298
  <li>
299
  <input type="checkbox" name="products_sync_date" value="1" <?php echo checked(1, $woocommerce_wpml->settings['products_sync_date']) ?> id="wcml_products_sync_date" />
300
+ <label for="wcml_products_sync_date"><?php _e('Sync publishing date for translated products.', 'woocommerce-multilingual'); ?></label>
301
  </li>
302
  <li>
303
  <input type="checkbox" name="products_sync_order" value="1" <?php echo checked(1, $woocommerce_wpml->settings['products_sync_order']) ?> id="wcml_products_sync_order" />
304
+ <label for="wcml_products_sync_order"><?php _e('Sync products and product taxonomies order.', 'woocommerce-multilingual'); ?></label>
305
  </li>
306
  </ul>
307
  <p class="button-wrap">
308
+ <input type='submit' name="wcml_products_sync_prop" value='<?php esc_attr(_e('Save', 'woocommerce-multilingual')); ?>' class='button-secondary' />
309
  </p>
310
  </form>
311
  </div>
317
 
318
  <div class="wcml-section-header">
319
  <h3>
320
+ <?php _e('File Paths Synchronization ', 'woocommerce-multilingual'); ?>
321
+ <i class="icon-question-sign" data-tip="<?php _e('If you are using downloadable products, you can choose to have their paths synchronized, or seperate for each language.', 'woocommerce-multilingual') ?>"></i>
322
  </h3>
323
  </div>
324
 
328
  <ul>
329
  <li>
330
  <input type="radio" name="wcml_file_path_sync" value="1" <?php echo $woocommerce_wpml->settings['file_path_sync'] == '1'?'checked':''; ?> id="wcml_file_path_sync_auto" />
331
+ <label for="wcml_file_path_sync_auto"><?php _e('Use the same file paths in all languages', 'woocommerce-multilingual'); ?></label>
332
  </li>
333
  <li>
334
  <input type="radio" name="wcml_file_path_sync" value="0" <?php echo $woocommerce_wpml->settings['file_path_sync'] == '0'?'checked':''; ?> id="wcml_file_path_sync_self" />
335
+ <label for="wcml_file_path_sync_self"><?php _e('Different file paths for each language', 'woocommerce-multilingual'); ?></label>
336
  </li>
337
  </ul>
338
  <p class="button-wrap">
339
+ <input type='submit' name="wcml_file_path_options_table" value='<?php esc_attr(_e('Save', 'woocommerce-multilingual')); ?>' class='button-secondary' />
340
  </p>
341
  </form>
342
 
349
 
350
  <div class="wcml-section-header">
351
  <h3>
352
+ <?php _e('Manage Currencies', 'woocommerce-multilingual'); ?>
353
+ <i class="icon-question-sign" data-tip="<?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.', 'woocommerce-multilingual') ?>"></i>
354
  </h3>
355
  </div>
356
  <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>" id="wcml_mc_options">
364
  <li>
365
  <input type="radio" name="multi_currency" id="multi_currency_disabled" value="<?php echo WCML_MULTI_CURRENCIES_DISABLED ?>" <?php
366
  echo checked($woocommerce_wpml->settings['enable_multi_currency'], WCML_MULTI_CURRENCIES_DISABLED) ?> />
367
+ <label for="multi_currency_disabled"><?php _e("No multi-currency.", 'woocommerce-multilingual'); ?></label>
368
  </li>
369
  <li>
370
  <input type="radio" name="multi_currency" id="multi_currency_independent" value="<?php echo WCML_MULTI_CURRENCIES_INDEPENDENT ?>" <?php
371
  echo checked($woocommerce_wpml->settings['enable_multi_currency'], WCML_MULTI_CURRENCIES_INDEPENDENT) ?> />
372
  <label for="multi_currency_independent">
373
+ <?php _e("Multiple currencies, independent of languages.", 'woocommerce-multilingual'); ?>
374
  &nbsp;
375
  <a href=" <?php echo $woocommerce_wpml->generate_tracking_link('http://wpml.org/documentation/related-projects/woocommerce-multilingual/multi-currency-support-woocommerce/','multi-currency-support-woocommerce','documentation') ?>"><?php _e('Learn more', 'wpl-wcml') ?></a>.
376
  </label>
399
 
400
  ?>
401
  <p>
402
+ <?php printf(__("Your store's base currency is %s (%s). To change it, go to the %s page.", 'woocommerce-multilingual'), $wc_currencies[$wc_currency],get_woocommerce_currency_symbol($wc_currency),'<a href="'. admin_url(sprintf('admin.php?page=%s&tab=general', version_compare($woocommerce->version, '2.1', '<') ? 'woocommerce_settings' : 'wc-settings')) .'">WooCommerce settings</a>'); ?>
403
  </p>
404
  <input type="hidden" id="update_currency_lang_nonce" value="<?php echo wp_create_nonce('wcml_update_currency_lang'); ?>"/>
405
  <table class="widefat currency_table" id="currency-table">
406
  <thead>
407
  <tr>
408
+ <th><?php _e('Currency', 'woocommerce-multilingual'); ?></th>
409
  <th></th>
410
  </tr>
411
  </thead>
412
  <tbody>
413
  <tr>
414
  <td class="currency_code">
415
+ <span class="code_val"><?php echo $wc_currencies[$wc_currency]; ?><?php printf(__(' (%s)', 'woocommerce-multilingual'), $positioned_price); ?></span>
416
+ <div class="currency_value"><span><?php _e( 'default', 'woocommerce-multilingual' ); ?></span></div>
417
  </td>
418
  <td class="currency-actions"></td>
419
 
432
  <tr id="currency_row_<?php echo $code ?>">
433
  <td class="currency_code">
434
  <?php include WCML_PLUGIN_PATH . '/menu/sub/custom-currency-options.php'; ?>
435
+ <span class="code_val"><?php echo $wc_currencies[$code]; ?><?php printf(__(' (%s)', 'woocommerce-multilingual'), $positioned_price); ?></span>
436
  <div class="currency_value">
437
  <span><?php printf('1 %s = %s %s', $wc_currency, $currency['rate'], $code); ?></span>
438
  </div>
441
 
442
  <td class="currency-actions">
443
  <div class="currency_action_update">
444
+ <a href="javascript:void(0);" title="<?php esc_attr(_e('Edit', 'woocommerce-multilingual')); ?>" class="edit_currency" data-currency="<?php echo $code ?>">
445
+ <i class="icon-edit" title="<?php esc_attr(_e('Edit', 'woocommerce-multilingual')); ?>"></i>
446
  </a>
447
  <i class="icon-ok-circle save_currency"></i>
448
  </div>
449
  <div class="currency_action_delete">
450
+ <a href="javascript:void(0);" title="<?php esc_attr(_e('Delete', 'woocommerce-multilingual')); ?>" class="delete_currency" data-currency="<?php echo $code ?>" >
451
+ <i class="icon-trash" title="<?php esc_attr(_e('Delete', 'woocommerce-multilingual')); ?>"></i>
452
  </a>
453
  <i class="icon-remove-circle cancel_currency"></i>
454
  </div>
457
  <?php endforeach; ?>
458
  <tr class="default_currency">
459
  <td colspan="2">
460
+ <span class="cur_label"><?php _e('Default currency', 'woocommerce-multilingual'); ?></span>
461
+ <span class="inf_message"><?php _e('Switch to this currency when switching language in the front-end', 'woocommerce-multilingual'); ?></span>
462
  </td>
463
  </tr>
464
  </tbody>
482
  <td class="currency_languages">
483
  <div class="wcml_onof_buttons">
484
  <ul>
485
+ <li <?php echo $woocommerce_wpml->settings['currency_options'][$wc_currency]['languages'][$language['code']] == 0 ?'class="on"':''; ?> ><a class="off_btn" href="javascript:void(0);" data-language="<?php echo $language['code']; ?>" data-currency="<?php echo $wc_currency; ?>" ><?php _e( 'OFF', 'woocommerce-multilingual' ); ?></a></li>
486
+ <li <?php echo $woocommerce_wpml->settings['currency_options'][$wc_currency]['languages'][$language['code']] == 1 ?'class="on"':''; ?> ><a class="on_btn" href="javascript:void(0);" data-language="<?php echo $language['code']; ?>" data-currency="<?php echo $wc_currency ?>"><?php _e( 'ON', 'woocommerce-multilingual' ); ?></a></li>
487
  </ul>
488
  </div>
489
  </td>
495
  <td class="currency_languages">
496
  <div class="wcml_onof_buttons">
497
  <ul>
498
+ <li <?php echo $currency['languages'][$language['code']] == 0 ?'class="on"':''; ?> ><a class="off_btn" href="javascript:void(0);" data-language="<?php echo $language['code']; ?>" data-currency="<?php echo $code; ?>"><?php _e( 'OFF', 'woocommerce-multilingual' ); ?></a></li>
499
+ <li <?php echo $currency['languages'][$language['code']] == 1 ?'class="on"':''; ?> ><a class="on_btn" href="javascript:void(0);" data-language="<?php echo $language['code']; ?>" data-currency="<?php echo $code; ?>"><?php _e( 'ON', 'woocommerce-multilingual' ); ?></a></li>
500
  </ul>
501
  </div>
502
  </td>
507
  <?php foreach($active_languages as $language): ?>
508
  <td class="currency_languages">
509
  <select rel="<?php echo $language['code']; ?>">
510
+ <option value="0" <?php selected('0', $woocommerce_wpml->settings['default_currencies'][$language['code']]); ?>><?php _e('Keep', 'woocommerce-multilingual'); ?></option>
511
  <?php if($woocommerce_wpml->settings['currency_options'][$wc_currency]['languages'][$language['code']] == 1): ?>
512
  <option value="<?php echo $wc_currency; ?>" <?php selected($wc_currency, $woocommerce_wpml->settings['default_currencies'][$language['code']]); ?>><?php echo $wc_currency; ?></option>
513
  <?php endif; ?>
530
  <?php // this is a template for scripts.js : jQuery('.wcml_add_currency button').click(function(); ?>
531
  <table class="hidden js-table-row-wrapper">
532
  <tr class="edit-mode js-table-row">
533
+ <td class="currency_code" data-message="<?php _e( 'Please fill field', 'woocommerce-multilingual' ); ?>">
534
  <span class="code_val"></span>
535
  <select name="code" style="display:block">
536
  <?php foreach($wc_currencies as $wc_code=>$currency_name): ?>
539
  <?php endif; ?>
540
  <?php endforeach; ?>
541
  </select>
542
+ <div class="currency_value" data-message="<?php _e( 'Only numeric', 'woocommerce-multilingual' ); ?>">
543
  <span>
544
  <?php printf('1 %s = ',$wc_currency); ?>
545
  <span class="curr_val"></span>
571
  <td class="currency_languages">
572
  <div class="wcml_onof_buttons">
573
  <ul>
574
+ <li><a class="off_btn" href="javascript:void(0);" data-language="<?php echo $language['code']; ?>"><?php _e( 'OFF', 'woocommerce-multilingual' ); ?></a></li>
575
+ <li class="on"><a class="on_btn" href="javascript:void(0);" data-language="<?php echo $language['code']; ?>"><?php _e( 'ON', 'woocommerce-multilingual' ); ?></a></li>
576
  </ul>
577
  </div>
578
  </td>
589
  <p class="wcml_add_currency button-wrap">
590
  <button type="button" class="button-secondary">
591
  <i class="icon-plus"></i>
592
+ <?php _e('Add currency', 'woocommerce-multilingual'); ?>
593
  </button>
594
  </p>
595
 
619
  return false;
620
  }";
621
  echo '</script>';
622
+ echo '<p>' . __('Products using custom currency rates as they were migrated from the previous versions - option to support different prices per language', 'woocommerce-multilingual') . '</p>';
623
  echo '<form method="post" id="wcml_custom_exchange_rates">';
624
  echo '<input type="hidden" name="action" value="legacy_update_custom_rates">';
625
  echo '<table class="widefat currency_table" >';
626
  echo '<thead>';
627
  echo '<tr>';
628
+ echo '<th rowspan="2">' . __('Product', 'woocommerce-multilingual') . '</th>';
629
  echo '<th colspan="' . count($currencies) . '">_price</th>';
630
  echo '<th colspan="' . count($currencies) . '">_sale_price</th>';
631
  echo '<th rowspan="2">&nbsp;</th>';
650
  if(isset($rates['_price'][$code])){
651
  echo '<input name="posts[' . $post->post_id . '][_price][' . $code . ']" size="3" value="' . round($rates['_price'][$code],3) . '">';
652
  }else{
653
+ _e('n/a', 'woocommerce-multilingual');
654
  }
655
  echo '</td>';
656
  }
660
  if(isset($rates['_sale_price'][$code])){
661
  echo '<input name="posts[' . $post->post_id . '][_sale_price][' . $code . ']" size="3" value="' . round($rates['_sale_price'][$code],3) . '">';
662
  }else{
663
+ _e('n/a', 'woocommerce-multilingual');
664
  }
665
  echo '</td>';
666
  }
667
 
668
+ echo '<td align="right"><a href="#" onclick=" if(confirm(\'' . esc_js(__('Are you sure?', 'woocommerce-multilingual') ) . '\')) wcml_remove_custom_rates(' . $post->post_id . ', jQuery(this));return false;"><i class="icon-trash" title="' . __('Delete', 'woocommerce-multilingual') . '"></i></a></td>';
669
  echo '<tr>';
670
 
671
  }
672
  echo '</tbody>';
673
  echo '</table>';
674
+ echo '<p class="button-wrap"><input class="button-secondary" type="submit" value="' . esc_attr__('Update', 'woocommerce-multilingual') . '" /></p>';
675
  echo '</form>';
676
 
677
 
680
  <ul id="display_custom_prices_select">
681
  <li>
682
  <input type="checkbox" name="display_custom_prices" id="display_custom_prices" value="1" <?php echo checked( 1, $woocommerce_wpml->settings['display_custom_prices']) ?> >
683
+ <label for="display_custom_prices"><?php _e('Show only products with custom prices in secondary currencies', 'woocommerce-multilingual'); ?></label>
684
+ <i class="icon-question-sign" data-tip="<?php _e('When this option is on, when you switch to a secondary currency on the front end, only the products with custom prices in that currency are being displayed. Products with prices determined based on the exchange rate are hidden.', 'woocommerce-multilingual') ?>"></i>
685
  </li>
686
  </ul>
687
  <p class="button-wrap general_option_btn">
688
+ <input type='submit' name="wcml_mc_options" value='<?php _e('Save', 'woocommerce-multilingual'); ?>' class='button-secondary' />
689
  <?php wp_nonce_field('wcml_mc_options', 'wcml_mc_options_nonce'); ?>
690
  </p>
691
  </div>
695
  </div>
696
  </form>
697
  </div> <!-- .wcml-section -->
698
+ <input type="hidden" id="wcml_warn_message" value="<?php esc_attr_e('The changes you made will be lost if you navigate away from this page.', 'woocommerce-multilingual');?>"/>
699
+ <input type="hidden" id="wcml_warn_disable_language_massage" value="<?php esc_attr_e('At least one currency must be enabled for this language!', 'woocommerce-multilingual');?>"/>
700
  <div class="troubleshoot_link_block">
701
+ <a href="<?php echo admin_url('admin.php?page='.basename(WCML_PLUGIN_PATH) .'/menu/sub/troubleshooting.php'); ?>"><?php _e('Troubleshooting page', 'woocommerce-multilingual'); ?></a>
702
  </div>
703
  <div class="clear"></div>
menu/sub/sync-taxonomy-translations.php CHANGED
@@ -10,7 +10,7 @@
10
  <input type="hidden" name="languages_processed" value="0" />
11
 
12
  <p>
13
- <input class="button-secondary" type="submit" value="<?php esc_attr_e("Synchronize attributes and update product variations", 'wpml-wcml') ?>" />
14
  <img src="<?php echo ICL_PLUGIN_URL . '/res/img/ajax-loader.gif' ?>" alt="loading" height="16" width="16" class="wpml_tt_spinner" />
15
  </p>
16
  <span class="errors icl_error_text"></span>
@@ -18,9 +18,9 @@
18
  </form>
19
 
20
 
21
- <p><?php _e('This will automatically generate variations for translated products corresponding to recently translated attributes.','wpml-wcml'); ?></p>
22
  <?php if(!empty($wcml_settings['variations_needed'][$taxonomy])): ?>
23
- <p><?php printf(__('Currently, there are %s variations that need to be created.', 'wpml-wcml'), '<strong>' . $wcml_settings['variations_needed'][$taxonomy] . '</strong>') ?></p>
24
  <?php endif; ?>
25
 
26
  <?php else: ?>
@@ -29,7 +29,7 @@
29
  <input type="hidden" name="taxonomy" value="<?php echo $taxonomy ?>"/>
30
  <?php wp_nonce_field('wcml_sync_taxonomies_in_content_preview', 'wcml_sync_taxonomies_in_content_preview_nonce'); ?>
31
  <p>
32
- <input class="button-secondary" type="submit" value="<?php printf( __( "Synchronize %s assignment in content", 'wpml-wcml' ), $taxonomy_obj->labels->name ) ?>"/>
33
  <img src="<?php echo ICL_PLUGIN_URL . '/res/img/ajax-loader.gif' ?>" alt="loading" height="16" width="16" class="wpml_tt_spinner"/>
34
  </p>
35
  <span class="errors icl_error_text"></span>
@@ -37,7 +37,7 @@
37
  <div id="wcml_tt_sync_preview"></div>
38
 
39
 
40
- <p><?php printf( __( 'This action lets you automatically apply the %s taxonomy to your content in different languages. It will scan the original content and apply the same taxonomy to translated content.', 'wpml-wcml' ), '<i>' . $taxonomy_obj->labels->singular_name . '</i>' ); ?></p>
41
 
42
 
43
  <?php endif; ?>
10
  <input type="hidden" name="languages_processed" value="0" />
11
 
12
  <p>
13
+ <input class="button-secondary" type="submit" value="<?php esc_attr_e("Synchronize attributes and update product variations", 'woocommerce-multilingual') ?>" />
14
  <img src="<?php echo ICL_PLUGIN_URL . '/res/img/ajax-loader.gif' ?>" alt="loading" height="16" width="16" class="wpml_tt_spinner" />
15
  </p>
16
  <span class="errors icl_error_text"></span>
18
  </form>
19
 
20
 
21
+ <p><?php _e('This will automatically generate variations for translated products corresponding to recently translated attributes.', 'woocommerce-multilingual'); ?></p>
22
  <?php if(!empty($wcml_settings['variations_needed'][$taxonomy])): ?>
23
+ <p><?php printf(__('Currently, there are %s variations that need to be created.', 'woocommerce-multilingual'), '<strong>' . $wcml_settings['variations_needed'][$taxonomy] . '</strong>') ?></p>
24
  <?php endif; ?>
25
 
26
  <?php else: ?>
29
  <input type="hidden" name="taxonomy" value="<?php echo $taxonomy ?>"/>
30
  <?php wp_nonce_field('wcml_sync_taxonomies_in_content_preview', 'wcml_sync_taxonomies_in_content_preview_nonce'); ?>
31
  <p>
32
+ <input class="button-secondary" type="submit" value="<?php printf( __( "Synchronize %s assignment in content", 'woocommerce-multilingual' ), $taxonomy_obj->labels->name ) ?>"/>
33
  <img src="<?php echo ICL_PLUGIN_URL . '/res/img/ajax-loader.gif' ?>" alt="loading" height="16" width="16" class="wpml_tt_spinner"/>
34
  </p>
35
  <span class="errors icl_error_text"></span>
37
  <div id="wcml_tt_sync_preview"></div>
38
 
39
 
40
+ <p><?php printf( __( 'This action lets you automatically apply the %s taxonomy to your content in different languages. It will scan the original content and apply the same taxonomy to translated content.', 'woocommerce-multilingual' ), '<i>' . $taxonomy_obj->labels->singular_name . '</i>' ); ?></p>
41
 
42
 
43
  <?php endif; ?>
menu/sub/troubleshooting.php CHANGED
@@ -13,25 +13,25 @@ unset($all_products_taxonomies['product_type'],$all_products_taxonomies['product
13
  ?>
14
  <div class="wrap wcml_trblsh">
15
  <div id="icon-wpml" class="icon32"><br /></div>
16
- <h2><?php _e('Troubleshooting', 'wpml-wcml') ?></h2>
17
  <div class="wcml_trbl_warning">
18
- <h3><?php _e('Please make a backup of your database before you start the synchronization', 'wpml-wcml') ?></h3>
19
  </div>
20
  <div class="trbl_variables_products">
21
- <h3><?php _e('Sync variables products', 'wpml-wcml') ?></h3>
22
  <ul>
23
  <li>
24
  <label>
25
  <input type="checkbox" id="wcml_sync_update_product_count" />
26
- <?php _e('Update products count:', 'wpml-wcml') ?>
27
- <span class="var_status"><?php echo $prod_with_variations; ?></span>&nbsp;<span><?php _e('products with variations', 'wpml-wcml'); ?></span>
28
  </label>
29
  </li>
30
  <li>
31
  <label>
32
  <input type="checkbox" id="wcml_sync_product_variations" checked="checked" />
33
- <?php _e('Sync products variations:', 'wpml-wcml') ?>
34
- <span class="var_status"><?php echo $prod_with_variations; ?></span>&nbsp;<span><?php _e('left', 'wpml-wcml') ?></span>
35
  </label>
36
 
37
  </li>
@@ -39,16 +39,16 @@ unset($all_products_taxonomies['product_type'],$all_products_taxonomies['product
39
  <li>
40
  <label>
41
  <input type="checkbox" id="wcml_sync_gallery_images" />
42
- <?php _e('Sync products "gallery images"', 'wpml-wcml') ?>
43
- <span class="gallery_status"><?php echo $prod_count; ?></span>&nbsp;<span><?php _e('left', 'wpml-wcml') ?></span>
44
  </label>
45
  </li>
46
  <?php endif; ?>
47
  <li>
48
  <label>
49
  <input type="checkbox" id="wcml_sync_categories" />
50
- <?php _e('Sync products categories (display type, thumbnail):', 'wpml-wcml') ?>
51
- <span class="cat_status"><?php echo $prod_categories_count; ?></span>&nbsp;<span><?php _e('left', 'wpml-wcml') ?></span>
52
  </label>
53
 
54
  </li>
@@ -56,24 +56,24 @@ unset($all_products_taxonomies['product_type'],$all_products_taxonomies['product
56
  <li>
57
  <label>
58
  <input type="checkbox" id="wcml_duplicate_terms" <?php echo !count($all_products_taxonomies)?'disabled="disabled"':''; ?> />
59
- <?php _e('Duplicate terms ( please select attribute ):', 'wpml-wcml') ?>
60
  <select id="attr_to_duplicate" <?php echo !count($all_products_taxonomies)?'disabled="disabled"':''; ?>>
61
  <?php
62
  $terms_count = false;
63
  if(!count($all_products_taxonomies)){ ?>
64
- <option value="0" ><?php _e('none', 'wpml-wcml'); ?></option>
65
  <?php }
66
  foreach($all_products_taxonomies as $tax_key => $tax):
67
  if(!$terms_count) $terms_count = wp_count_terms($tax_key); ?>
68
  <option value="<?php echo $tax_key; ?>" rel="<?php echo wp_count_terms($tax_key); ?>"><?php echo ucfirst($tax->labels->name); ?></option>
69
  <?php endforeach; ?>
70
  </select>
71
- <span class="attr_status"><?php echo $terms_count; ?></span>&nbsp;<span><?php _e('left', 'wpml-wcml') ?></span>
72
  </label>
73
 
74
  </li>
75
  <li>
76
- <button type="button" class="button-secondary" id="wcml_trbl"><?php _e('Start', 'wpml-wcml') ?></button>
77
  <input id="count_prod_variat" type="hidden" value="<?php echo $prod_with_variations; ?>"/>
78
  <input id="count_prod" type="hidden" value="<?php echo $prod_count; ?>"/>
79
  <input id="count_categories" type="hidden" value="<?php echo $prod_categories_count; ?>"/>
13
  ?>
14
  <div class="wrap wcml_trblsh">
15
  <div id="icon-wpml" class="icon32"><br /></div>
16
+ <h2><?php _e('Troubleshooting', 'woocommerce-multilingual') ?></h2>
17
  <div class="wcml_trbl_warning">
18
+ <h3><?php _e('Please make a backup of your database before you start the synchronization', 'woocommerce-multilingual') ?></h3>
19
  </div>
20
  <div class="trbl_variables_products">
21
+ <h3><?php _e('Sync variables products', 'woocommerce-multilingual') ?></h3>
22
  <ul>
23
  <li>
24
  <label>
25
  <input type="checkbox" id="wcml_sync_update_product_count" />
26
+ <?php _e('Update products count:', 'woocommerce-multilingual') ?>
27
+ <span class="var_status"><?php echo $prod_with_variations; ?></span>&nbsp;<span><?php _e('products with variations', 'woocommerce-multilingual'); ?></span>
28
  </label>
29
  </li>
30
  <li>
31
  <label>
32
  <input type="checkbox" id="wcml_sync_product_variations" checked="checked" />
33
+ <?php _e('Sync products variations:', 'woocommerce-multilingual') ?>
34
+ <span class="var_status"><?php echo $prod_with_variations; ?></span>&nbsp;<span><?php _e('left', 'woocommerce-multilingual') ?></span>
35
  </label>
36
 
37
  </li>
39
  <li>
40
  <label>
41
  <input type="checkbox" id="wcml_sync_gallery_images" />
42
+ <?php _e('Sync products "gallery images"', 'woocommerce-multilingual') ?>
43
+ <span class="gallery_status"><?php echo $prod_count; ?></span>&nbsp;<span><?php _e('left', 'woocommerce-multilingual') ?></span>
44
  </label>
45
  </li>
46
  <?php endif; ?>
47
  <li>
48
  <label>
49
  <input type="checkbox" id="wcml_sync_categories" />
50
+ <?php _e('Sync products categories (display type, thumbnail):', 'woocommerce-multilingual') ?>
51
+ <span class="cat_status"><?php echo $prod_categories_count; ?></span>&nbsp;<span><?php _e('left', 'woocommerce-multilingual') ?></span>
52
  </label>
53
 
54
  </li>
56
  <li>
57
  <label>
58
  <input type="checkbox" id="wcml_duplicate_terms" <?php echo !count($all_products_taxonomies)?'disabled="disabled"':''; ?> />
59
+ <?php _e('Duplicate terms ( please select attribute ):', 'woocommerce-multilingual') ?>
60
  <select id="attr_to_duplicate" <?php echo !count($all_products_taxonomies)?'disabled="disabled"':''; ?>>
61
  <?php
62
  $terms_count = false;
63
  if(!count($all_products_taxonomies)){ ?>
64
+ <option value="0" ><?php _e('none', 'woocommerce-multilingual'); ?></option>
65
  <?php }
66
  foreach($all_products_taxonomies as $tax_key => $tax):
67
  if(!$terms_count) $terms_count = wp_count_terms($tax_key); ?>
68
  <option value="<?php echo $tax_key; ?>" rel="<?php echo wp_count_terms($tax_key); ?>"><?php echo ucfirst($tax->labels->name); ?></option>
69
  <?php endforeach; ?>
70
  </select>
71
+ <span class="attr_status"><?php echo $terms_count; ?></span>&nbsp;<span><?php _e('left', 'woocommerce-multilingual') ?></span>
72
  </label>
73
 
74
  </li>
75
  <li>
76
+ <button type="button" class="button-secondary" id="wcml_trbl"><?php _e('Start', 'woocommerce-multilingual') ?></button>
77
  <input id="count_prod_variat" type="hidden" value="<?php echo $prod_with_variations; ?>"/>
78
  <input id="count_prod" type="hidden" value="<?php echo $prod_count; ?>"/>
79
  <input id="count_categories" type="hidden" value="<?php echo $prod_categories_count; ?>"/>
menu/sub/variations_box.php CHANGED
@@ -1,12 +1,12 @@
1
- <button id="prod_variations_link_<?php echo $product_id ?>_<?php echo $lang ?>" class="button-secondary js-table-toggle<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" data-text-opened="<?php esc_attr_e('Collapse','wpml-wcml'); ?>" data-text-closed="<?php esc_attr_e('Expand','wpml-wcml'); ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>>
2
- <span><?php _e('Expand','wpml-wcml'); ?></span>
3
  <i class="icon-caret-down"></i>
4
  </button>
5
 
6
  <table id="prod_variations_<?php echo $product_id ?>_<?php echo $lang ?>" class="widefat prod_variations js-table">
7
  <?php if(isset($template_data['empty_variations'])): ?>
8
  <tr>
9
- <td><?php _e('Please add variations to product','wpml-wcml'); ?></td>
10
  <tr>
11
  <?php else: ?>
12
  <tbody>
@@ -23,16 +23,16 @@
23
 
24
  <?php if(isset($template_data['empty_translation'])): ?>
25
  <tr>
26
- <td><?php _e('Please save translation before translate variations file paths','wpml-wcml'); ?></td>
27
  </tr>
28
  <?php elseif(isset($template_data['not_downloaded'])): ?>
29
  <tr>
30
- <td><?php _e('Variations are not downloadable','wpml-wcml'); ?></td>
31
  </tr>
32
  <?php else: ?>
33
  <?php if($is_downloable): ?>
34
  <tr>
35
- <td><?php _e('Download URL','wpml-wcml'); ?></td>
36
  <?php foreach($template_data['all_variations_ids'] as $variation_id): $file_paths = ''; ?>
37
  <?php if(isset($template_data['all_file_paths'][$variation_id]['not_translated'])){
38
  echo '<td></td>';
@@ -49,8 +49,8 @@
49
  if($template_data['original']): ?>
50
  <textarea value="<?php echo $file_paths; ?>" class="wcml_file_paths_textarea" disabled="disabled"><?php echo $file_paths; ?></textarea>
51
  <?php else: ?>
52
- <textarea value="<?php echo $file_paths; ?>" name='<?php echo 'variations_file_paths['.$variation_id.']'; ?>' class="wcml_file_paths_textarea" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"><?php echo $file_paths; ?></textarea>
53
- <button type="button" class="button-secondary wcml_file_paths"><?php _e('Choose a file', 'wpml-wcml') ?></button>
54
  <?php endif;
55
  }else{
56
  for($i=0;$i<$template_data['all_file_paths']['count'];$i++): ?>
@@ -59,9 +59,9 @@
59
  <input type="text" value="<?php echo $template_data['all_file_paths'][$variation_id][$i]['value']; ?>" class="" disabled="disabled">
60
  <?php else: ?>
61
  <div>
62
- <input type="text" value="<?php echo isset($template_data['all_file_paths'][$variation_id][$i])?$template_data['all_file_paths'][$variation_id][$i]['label']:''; ?>" name='<?php echo 'variations_file_paths['.$variation_id.']['.$i.'][name]'; ?>' class="wcml_file_paths_name" placeholder="<?php esc_attr_e('Enter translation for name', 'wpml-wcml') ?>">
63
- <input type="text" value="<?php echo isset($template_data['all_file_paths'][$variation_id][$i])?$template_data['all_file_paths'][$variation_id][$i]['value']:''; ?>" name='<?php echo 'variations_file_paths['.$variation_id.']['.$i.'][file]'; ?>' class="wcml_file_paths_file" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"/>
64
- <button type="button" class="button-secondary wcml_file_paths_button"><?php _e('Choose a file', 'wpml-wcml') ?></button>
65
  </div>
66
  <?php endif; ?>
67
  <?php endfor; ?>
@@ -69,7 +69,7 @@
69
  ?>
70
  </td>
71
  <?php else: ?>
72
- <td><?php _e('Variation is not downloadable','wpml-wcml'); ?></td>
73
  <?php endif; ?>
74
  <?php endforeach; ?>
75
  </tr>
1
+ <button id="prod_variations_link_<?php echo $product_id ?>_<?php echo $lang ?>" class="button-secondary js-table-toggle<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" data-text-opened="<?php esc_attr_e('Collapse', 'woocommerce-multilingual'); ?>" data-text-closed="<?php esc_attr_e('Expand', 'woocommerce-multilingual'); ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>>
2
+ <span><?php _e('Expand', 'woocommerce-multilingual'); ?></span>
3
  <i class="icon-caret-down"></i>
4
  </button>
5
 
6
  <table id="prod_variations_<?php echo $product_id ?>_<?php echo $lang ?>" class="widefat prod_variations js-table">
7
  <?php if(isset($template_data['empty_variations'])): ?>
8
  <tr>
9
+ <td><?php _e('Please add variations to product', 'woocommerce-multilingual'); ?></td>
10
  <tr>
11
  <?php else: ?>
12
  <tbody>
23
 
24
  <?php if(isset($template_data['empty_translation'])): ?>
25
  <tr>
26
+ <td><?php _e('Please save translation before translate variations file paths', 'woocommerce-multilingual'); ?></td>
27
  </tr>
28
  <?php elseif(isset($template_data['not_downloaded'])): ?>
29
  <tr>
30
+ <td><?php _e('Variations are not downloadable', 'woocommerce-multilingual'); ?></td>
31
  </tr>
32
  <?php else: ?>
33
  <?php if($is_downloable): ?>
34
  <tr>
35
+ <td><?php _e('Download URL', 'woocommerce-multilingual'); ?></td>
36
  <?php foreach($template_data['all_variations_ids'] as $variation_id): $file_paths = ''; ?>
37
  <?php if(isset($template_data['all_file_paths'][$variation_id]['not_translated'])){
38
  echo '<td></td>';
49
  if($template_data['original']): ?>
50
  <textarea value="<?php echo $file_paths; ?>" class="wcml_file_paths_textarea" disabled="disabled"><?php echo $file_paths; ?></textarea>
51
  <?php else: ?>
52
+ <textarea value="<?php echo $file_paths; ?>" name='<?php echo 'variations_file_paths['.$variation_id.']'; ?>' class="wcml_file_paths_textarea" placeholder="<?php esc_attr_e('Enter translation', 'woocommerce-multilingual') ?>"><?php echo $file_paths; ?></textarea>
53
+ <button type="button" class="button-secondary wcml_file_paths"><?php _e('Choose a file', 'woocommerce-multilingual') ?></button>
54
  <?php endif;
55
  }else{
56
  for($i=0;$i<$template_data['all_file_paths']['count'];$i++): ?>
59
  <input type="text" value="<?php echo $template_data['all_file_paths'][$variation_id][$i]['value']; ?>" class="" disabled="disabled">
60
  <?php else: ?>
61
  <div>
62
+ <input type="text" value="<?php echo isset($template_data['all_file_paths'][$variation_id][$i])?$template_data['all_file_paths'][$variation_id][$i]['label']:''; ?>" name='<?php echo 'variations_file_paths['.$variation_id.']['.$i.'][name]'; ?>' class="wcml_file_paths_name" placeholder="<?php esc_attr_e('Enter translation for name', 'woocommerce-multilingual') ?>">
63
+ <input type="text" value="<?php echo isset($template_data['all_file_paths'][$variation_id][$i])?$template_data['all_file_paths'][$variation_id][$i]['value']:''; ?>" name='<?php echo 'variations_file_paths['.$variation_id.']['.$i.'][file]'; ?>' class="wcml_file_paths_file" placeholder="<?php esc_attr_e('Enter translation', 'woocommerce-multilingual') ?>"/>
64
+ <button type="button" class="button-secondary wcml_file_paths_button"><?php _e('Choose a file', 'woocommerce-multilingual') ?></button>
65
  </div>
66
  <?php endif; ?>
67
  <?php endfor; ?>
69
  ?>
70
  </td>
71
  <?php else: ?>
72
+ <td><?php _e('Variation is not downloadable', 'woocommerce-multilingual'); ?></td>
73
  <?php endif; ?>
74
  <?php endforeach; ?>
75
  </tr>
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multili
5
  License: GPLv2
6
  Requires at least: 3.0
7
  Tested up to: 4.3
8
- Stable tag: 3.6.11
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
@@ -78,6 +78,25 @@ In order for the checkout and store pages to appear translated, you need to crea
78
 
79
  == Changelog ==
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  = 3.6.11 =
82
  * Fixed one issue that was causing a fatal error when an older version WPML was used (3.1.9.7)
83
 
5
  License: GPLv2
6
  Requires at least: 3.0
7
  Tested up to: 4.3
8
+ Stable tag: 3.7.1
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
78
 
79
  == Changelog ==
80
 
81
+ = 3.7.1 =
82
+ * Compatibility fixes for WooCommerce Bookings and WooCommerce Composite Products
83
+ * Fixed a typo in a function that caused a fatal error
84
+
85
+ = 3.7 =
86
+ * Added support for strings in different languages. Translated strings are not required to be in English (Requires WPML 3.3+)
87
+ * Fixed a compatibility issue with WooCommerce Bookings: bookings in all languages showing on calendar (requires WooCommerce Bookings 1.8+)
88
+ * Fixed a compatibility issue with WooCommerce Bookings: deleting a reservation did not delete translations too (requires WooCommerce Bookings 1.8+)
89
+ * Fixed a PayPal checkout issue when multi-currency was enabled and the decimal separator was set to comma and thousands separator was set to dot
90
+ * Fixed a compatibility issue with WooCommerce Product Addons: adding a second item for the same product added the first product again too
91
+ * Bug fix: a slash character was missing the in product breadcrumb when the translated page slug was identical to the one in the default language
92
+ * Bug fix: incorrect cost for the flat rate shipping was displayed in certain circumstances
93
+ * Improved compatibility with Gravity Forms Product Addons for translating the cart data
94
+ * Removed a deprecated hook used for the compatibility with WooCommerce Subscriptions
95
+ * Bug fix: cart_widget.js code was loaded in places that it wasn't needed
96
+ * Bug fix: in a specific case, the price in a secondary currency was not displayed correctly (the amount in the original currency was displayed)
97
+ * Bug fix: content was disappearing when switching between the visual and text editors on the product translation editor
98
+ * Bug fix: when using attributes that were numeric values a catchable fatal error was triggered
99
+
100
  = 3.6.11 =
101
  * Fixed one issue that was causing a fatal error when an older version WPML was used (3.1.9.7)
102
 
woocommerce_wpml.class.php CHANGED
@@ -57,6 +57,8 @@ class woocommerce_wpml {
57
  $this->currency_switcher = new WCML_CurrencySwitcher;
58
  $this->xdomain_data = new xDomain_Data;
59
 
 
 
60
 
61
 
62
  if(isset($_GET['page']) && $_GET['page'] == 'wc-reports'){
@@ -89,11 +91,8 @@ class woocommerce_wpml {
89
  add_filter('woocommerce_get_return_url', array($this, 'filter_woocommerce_redirect_location'));
90
  //add_filter('woocommerce_redirect', array($this, 'filter_woocommerce_redirect_location'));
91
 
92
- add_filter('option_woocommerce_permalinks', array($this, 'filter_woocommerce_permalinks_option'));
93
  add_filter('woocommerce_paypal_args', array($this, 'add_language_to_paypal'));
94
 
95
- //set translate product by default
96
- $this->translate_product_slug();
97
 
98
  if(is_admin() &&
99
  (
@@ -135,38 +134,6 @@ class woocommerce_wpml {
135
 
136
  }
137
 
138
- function translate_product_slug(){
139
- global $sitepress, $wpdb, $woocommerce;
140
-
141
- if(!defined('WOOCOMMERCE_VERSION') || (!isset($GLOBALS['ICL_Pro_Translation']) || is_null($GLOBALS['ICL_Pro_Translation']))){
142
- return;
143
- }
144
-
145
- $slug = $this->get_woocommerce_product_slug();
146
-
147
- if ( apply_filters( 'wpml_slug_translation_available', false) ) {
148
- // Use new API for WPML >= 3.2.3
149
- do_action( 'wpml_activate_slug_translation', $slug );
150
-
151
- } else {
152
- // Pre WPML 3.2.3
153
- $string = $wpdb->get_row($wpdb->prepare("SELECT id,status FROM {$wpdb->prefix}icl_strings WHERE name = %s AND value = %s ", 'URL slug: ' . $slug, $slug));
154
-
155
- if(!$string){
156
- do_action('wpml_register_single_string', 'WordPress', 'URL slug: ' . $slug, $slug);
157
- $string = $wpdb->get_row($wpdb->prepare("SELECT id,status FROM {$wpdb->prefix}icl_strings WHERE name = %s AND value = %s ", 'URL slug: ' . $slug, $slug));
158
- }
159
-
160
- }
161
- $iclsettings = $sitepress->get_settings();
162
- if(empty($iclsettings['posts_slug_translation']['on']) || empty($iclsettings['posts_slug_translation']['types']['product'])){
163
- $iclsettings['posts_slug_translation']['on'] = 1;
164
- $iclsettings['posts_slug_translation']['types']['product'] = 1;
165
- $sitepress->save_settings($iclsettings);
166
- }
167
-
168
- }
169
-
170
  function get_settings(){
171
 
172
  $defaults = array(
@@ -217,7 +184,7 @@ class woocommerce_wpml {
217
  }
218
 
219
  function load_locale(){
220
- load_plugin_textdomain('wpml-wcml', false, WCML_LOCALE_PATH);
221
  }
222
 
223
  function install(){
@@ -339,12 +306,12 @@ class woocommerce_wpml {
339
  $top_page = apply_filters('icl_menu_main_page', basename(ICL_PLUGIN_PATH) .'/menu/languages.php');
340
 
341
  if(current_user_can('wpml_manage_woocommerce_multilingual')){
342
- add_submenu_page($top_page, __('WooCommerce Multilingual','wpml-wcml'),
343
- __('WooCommerce Multilingual', 'wpml-wcml'), 'wpml_manage_woocommerce_multilingual', 'wpml-wcml', array($this, 'menu_content'));
344
 
345
  if(isset($_GET['page']) && $_GET['page'] == basename(WCML_PLUGIN_PATH).'/menu/sub/troubleshooting.php'){
346
  add_submenu_page($top_page,
347
- __('Troubleshooting','wpml-wcml'), __('Troubleshooting','wpml-wcml'),
348
  'wpml_manage_troubleshooting', basename(WCML_PLUGIN_PATH).'/menu/sub/troubleshooting.php');
349
  }
350
 
@@ -352,20 +319,20 @@ class woocommerce_wpml {
352
  global $wpdb,$sitepress_settings,$sitepress;
353
  $user_lang_pairs = get_user_meta(get_current_user_id(), $wpdb->prefix.'language_pairs', true);
354
  if( !empty( $user_lang_pairs[$sitepress->get_default_language()] ) ){
355
- add_menu_page(__('WooCommerce Multilingual','wpml-wcml'),
356
- __('WooCommerce Multilingual','wpml-wcml'), 'translate',
357
  'wpml-wcml', array($this, 'menu_content'), ICL_PLUGIN_URL . '/res/img/icon16.png');
358
  }
359
  }
360
 
361
  }elseif(current_user_can('wpml_manage_woocommerce_multilingual')){
362
  if(!defined('ICL_SITEPRESS_VERSION')){
363
- add_menu_page( __( 'WooCommerce Multilingual', 'wpml-wcml' ), __( 'WooCommerce Multilingual', 'wpml-wcml' ),
364
  'wpml_manage_woocommerce_multilingual', WCML_PLUGIN_PATH . '/menu/plugins.php', null, WCML_PLUGIN_URL . '/assets/images/icon16.png' );
365
  }else{
366
  $top_page = apply_filters('icl_menu_main_page', basename(ICL_PLUGIN_PATH) .'/menu/languages.php');
367
- add_submenu_page($top_page, __('WooCommerce Multilingual','wpml-wcml'),
368
- __('WooCommerce Multilingual', 'wpml-wcml'), 'wpml_manage_woocommerce_multilingual', 'wpml-wcml', array($this, 'menu_content'));
369
  }
370
 
371
  }
@@ -385,6 +352,8 @@ class woocommerce_wpml {
385
  }
386
 
387
  function load_css_and_js() {
 
 
388
  if(isset($_GET['page'])){
389
 
390
  if( in_array($_GET['page'], array('wpml-wcml',basename(WCML_PLUGIN_PATH).'/menu/sub/troubleshooting.php',basename(WCML_PLUGIN_PATH).'/menu/plugins.php'))) {
@@ -436,6 +405,11 @@ class woocommerce_wpml {
436
  }
437
  }
438
 
 
 
 
 
 
439
  if( !is_admin() ){
440
  wp_register_script('cart-widget', WCML_PLUGIN_URL . '/assets/js/cart_widget.js', array('jquery'), WCML_VERSION);
441
  wp_enqueue_script('cart-widget');
@@ -462,7 +436,7 @@ class woocommerce_wpml {
462
  }
463
 
464
  function hidden_label(){
465
- echo '<img src="'.WCML_PLUGIN_URL.'/assets/images/locked.png" class="wcml_lock_img" alt="'.__('This field is locked for editing because WPML will copy its value from the original language.','wpml-wcml').'" title="'.__('This field is locked for editing because WPML will copy its value from the original language.','wpml-wcml').'" style="display: none;position:relative;left:2px;top:2px;">';
466
 
467
  if( isset($_GET['post']) ){
468
  $original_language = $this->products->get_original_product_language($_GET['post']);
@@ -472,7 +446,7 @@ class woocommerce_wpml {
472
  $original_id = $sitepress->get_original_element_id_by_trid( $_GET['trid'] );
473
  }
474
 
475
- echo '<h3 class="wcml_prod_hidden_notice">'.sprintf(__("This is a translation of %s. Some of the fields are not editable. It's recommended to use the %s for translating products.",'wpml-wcml'),'<a href="'.get_edit_post_link($original_id).'" >'.get_the_title($original_id).'</a>','<a href="'.admin_url('admin.php?page=wpml-wcml&tab=products&prid='.$original_id).'" >'.__('WooCommerce Multilingual products translator','wpml-wcml').'</a>').'</h3>';
476
  }
477
 
478
  function generate_tracking_link($link,$term=false,$content = false, $id = false){
@@ -491,12 +465,15 @@ class woocommerce_wpml {
491
  function documentation_links(){
492
  global $post, $pagenow;
493
 
494
- $get_post_type = get_post_type(@$post->ID);
 
 
 
495
 
496
  if($get_post_type == 'product' && $pagenow == 'edit.php'){
497
- $prot_link = '<span class="button" style="padding:4px;margin-top:10px;"><img align="baseline" src="' . ICL_PLUGIN_URL .'/res/img/icon16.png" width="16" height="16" style="margin-bottom:-4px" /> <a href="'. $this->generate_tracking_link('http://wpml.org/documentation/related-projects/woocommerce-multilingual/','woocommerce-multilingual','documentation','#4') .'" target="_blank">' .
498
  __('How to translate products', 'sitepress') . '<\/a>' . '<\/span>';
499
- $quick_edit_notice = '<div id="quick_edit_notice" style="display:none;"><p>'. sprintf(__("Quick edit is disabled for product translations. It\'s recommended to use the %s for editing products translations. %s",'wpml-wcml'), '<a href="'.admin_url('admin.php?page=wpml-wcml&tab=products').'" >'.__('WooCommerce Multilingual products editor','wpml-wcml').'</a>','<a href="" class="quick_product_trnsl_link" >'.__('Edit this product translation','wpml-wcml').'</a>').'</p></div>';
500
  $quick_edit_notice_prod_link = '<input type="hidden" id="wcml_product_trnsl_link" value="'.admin_url('admin.php?page=wpml-wcml&tab=products&prid=').'">';
501
  ?>
502
  <script type="text/javascript">
@@ -549,11 +526,11 @@ class woocommerce_wpml {
549
  }
550
  ?>
551
  <div id="message" class="updated message fade" style="clear:both;margin-top:5px;"><p>
552
- <?php _e('Would you like to see a quick overview?', 'wpml-wcml'); ?>
553
  </p>
554
  <p>
555
- <a class="button-primary" href="<?php echo $this->generate_tracking_link('http://wpml.org/documentation/related-projects/woocommerce-multilingual/','woocommerce-multilingual','documentation'); ?>" target="_blank"><?php _e('Learn how to turn your e-commerce site multilingual', 'wpml-wcml') ?></a>
556
- <a class="button-secondary" href="<?php echo $url; ?>"><?php _e('Dismiss', 'wpml-wcml') ?></a>
557
  </p>
558
  </div>
559
  <?php
@@ -565,29 +542,6 @@ class woocommerce_wpml {
565
  return html_entity_decode($sitepress->convert_url($link));
566
  }
567
 
568
- function filter_woocommerce_permalinks_option($value){
569
- global $sitepress_settings;
570
-
571
- if (WPML_SUPPORT_STRINGS_IN_DIFF_LANG && isset($value['product_base']) && $value['product_base']) {
572
- do_action('wpml_register_single_string', 'URL slugs', 'URL slug: ' . trim($value['product_base'], '/'), trim($value['product_base'], '/'));
573
- // only register. it'll have to be translated via the string translation
574
- }
575
-
576
- $category_base = !empty($value['category_base']) ? $value['category_base'] : 'product-category';
577
- do_action('wpml_register_single_string', 'URL product_cat slugs - ' . $category_base, 'Url product_cat slug: ' . $category_base, $category_base);
578
-
579
- $tag_base = !empty($value['tag_base']) ? $value['tag_base'] : 'product-tag';
580
- do_action('wpml_register_single_string', 'URL product_tag slugs - ' . $tag_base, 'Url product_tag slug: ' . $tag_base, $tag_base);
581
-
582
- if (isset($value['attribute_base']) && $value['attribute_base']) {
583
- $attr_base = trim($value['attribute_base'], '/');
584
- do_action('wpml_register_single_string', 'URL attribute slugs - ' . $attr_base, 'Url attribute slug: ' . $attr_base, $attr_base);
585
- }
586
-
587
- return $value;
588
-
589
- }
590
-
591
  function add_language_to_paypal($args) {
592
  global $sitepress;
593
  $args['lc'] = $sitepress->get_current_language();
@@ -835,20 +789,6 @@ class woocommerce_wpml {
835
  die();
836
  }
837
 
838
- function get_woocommerce_product_slug(){
839
-
840
- $woocommerce_permalinks = maybe_unserialize( get_option('woocommerce_permalinks') );
841
-
842
- if( isset( $woocommerce_permalinks['product_base'] ) && !empty( $woocommerce_permalinks['product_base'] ) ){
843
- return trim( $woocommerce_permalinks['product_base'], '/');
844
- }elseif(get_option('woocommerce_product_slug') != false ){
845
- return trim( get_option('woocommerce_product_slug'), '/');
846
- }else{
847
- return 'product';
848
- }
849
-
850
- }
851
-
852
  function currency_options_update_default_currency(){
853
  $current_currency = get_option('woocommerce_currency');
854
  $new_currency = $_POST['woocommerce_currency'];
57
  $this->currency_switcher = new WCML_CurrencySwitcher;
58
  $this->xdomain_data = new xDomain_Data;
59
 
60
+ $this->url_translation = new WCML_Url_Translation;
61
+
62
 
63
 
64
  if(isset($_GET['page']) && $_GET['page'] == 'wc-reports'){
91
  add_filter('woocommerce_get_return_url', array($this, 'filter_woocommerce_redirect_location'));
92
  //add_filter('woocommerce_redirect', array($this, 'filter_woocommerce_redirect_location'));
93
 
 
94
  add_filter('woocommerce_paypal_args', array($this, 'add_language_to_paypal'));
95
 
 
 
96
 
97
  if(is_admin() &&
98
  (
134
 
135
  }
136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  function get_settings(){
138
 
139
  $defaults = array(
184
  }
185
 
186
  function load_locale(){
187
+ load_plugin_textdomain('woocommerce-multilingual', false, WCML_LOCALE_PATH);
188
  }
189
 
190
  function install(){
306
  $top_page = apply_filters('icl_menu_main_page', basename(ICL_PLUGIN_PATH) .'/menu/languages.php');
307
 
308
  if(current_user_can('wpml_manage_woocommerce_multilingual')){
309
+ add_submenu_page($top_page, __('WooCommerce Multilingual', 'woocommerce-multilingual'),
310
+ __('WooCommerce Multilingual', 'woocommerce-multilingual'), 'wpml_manage_woocommerce_multilingual', 'wpml-wcml', array($this, 'menu_content'));
311
 
312
  if(isset($_GET['page']) && $_GET['page'] == basename(WCML_PLUGIN_PATH).'/menu/sub/troubleshooting.php'){
313
  add_submenu_page($top_page,
314
+ __('Troubleshooting', 'woocommerce-multilingual'), __('Troubleshooting', 'woocommerce-multilingual'),
315
  'wpml_manage_troubleshooting', basename(WCML_PLUGIN_PATH).'/menu/sub/troubleshooting.php');
316
  }
317
 
319
  global $wpdb,$sitepress_settings,$sitepress;
320
  $user_lang_pairs = get_user_meta(get_current_user_id(), $wpdb->prefix.'language_pairs', true);
321
  if( !empty( $user_lang_pairs[$sitepress->get_default_language()] ) ){
322
+ add_menu_page(__('WooCommerce Multilingual', 'woocommerce-multilingual'),
323
+ __('WooCommerce Multilingual', 'woocommerce-multilingual'), 'translate',
324
  'wpml-wcml', array($this, 'menu_content'), ICL_PLUGIN_URL . '/res/img/icon16.png');
325
  }
326
  }
327
 
328
  }elseif(current_user_can('wpml_manage_woocommerce_multilingual')){
329
  if(!defined('ICL_SITEPRESS_VERSION')){
330
+ add_menu_page( __( 'WooCommerce Multilingual', 'woocommerce-multilingual' ), __( 'WooCommerce Multilingual', 'woocommerce-multilingual' ),
331
  'wpml_manage_woocommerce_multilingual', WCML_PLUGIN_PATH . '/menu/plugins.php', null, WCML_PLUGIN_URL . '/assets/images/icon16.png' );
332
  }else{
333
  $top_page = apply_filters('icl_menu_main_page', basename(ICL_PLUGIN_PATH) .'/menu/languages.php');
334
+ add_submenu_page($top_page, __('WooCommerce Multilingual', 'woocommerce-multilingual'),
335
+ __('WooCommerce Multilingual', 'woocommerce-multilingual'), 'wpml_manage_woocommerce_multilingual', 'wpml-wcml', array($this, 'menu_content'));
336
  }
337
 
338
  }
352
  }
353
 
354
  function load_css_and_js() {
355
+ global $pagenow;
356
+
357
  if(isset($_GET['page'])){
358
 
359
  if( in_array($_GET['page'], array('wpml-wcml',basename(WCML_PLUGIN_PATH).'/menu/sub/troubleshooting.php',basename(WCML_PLUGIN_PATH).'/menu/plugins.php'))) {
405
  }
406
  }
407
 
408
+ if( $pagenow == 'options-permalink.php' ){
409
+ wp_register_style('wcml_op', WCML_PLUGIN_URL . '/assets/css/options-permalink.css', null, WCML_VERSION);
410
+ wp_enqueue_style('wcml_op');
411
+ }
412
+
413
  if( !is_admin() ){
414
  wp_register_script('cart-widget', WCML_PLUGIN_URL . '/assets/js/cart_widget.js', array('jquery'), WCML_VERSION);
415
  wp_enqueue_script('cart-widget');
436
  }
437
 
438
  function hidden_label(){
439
+ echo '<img src="'.WCML_PLUGIN_URL.'/assets/images/locked.png" class="wcml_lock_img" alt="'.__('This field is locked for editing because WPML will copy its value from the original language.', 'woocommerce-multilingual').'" title="'.__('This field is locked for editing because WPML will copy its value from the original language.', 'woocommerce-multilingual').'" style="display: none;position:relative;left:2px;top:2px;">';
440
 
441
  if( isset($_GET['post']) ){
442
  $original_language = $this->products->get_original_product_language($_GET['post']);
446
  $original_id = $sitepress->get_original_element_id_by_trid( $_GET['trid'] );
447
  }
448
 
449
+ echo '<h3 class="wcml_prod_hidden_notice">'.sprintf(__("This is a translation of %s. Some of the fields are not editable. It's recommended to use the %s for translating products.", 'woocommerce-multilingual'),'<a href="'.get_edit_post_link($original_id).'" >'.get_the_title($original_id).'</a>','<a href="'.admin_url('admin.php?page=wpml-wcml&tab=products&prid='.$original_id).'" >'.__('WooCommerce Multilingual products translator', 'woocommerce-multilingual').'</a>').'</h3>';
450
  }
451
 
452
  function generate_tracking_link($link,$term=false,$content = false, $id = false){
465
  function documentation_links(){
466
  global $post, $pagenow;
467
 
468
+ if( is_null( $post ) )
469
+ return;
470
+
471
+ $get_post_type = get_post_type($post->ID);
472
 
473
  if($get_post_type == 'product' && $pagenow == 'edit.php'){
474
+ $prot_link = '<span class="button"><img align="baseline" src="' . ICL_PLUGIN_URL .'/res/img/icon.png" width="16" height="16" style="margin-bottom:-4px" /> <a href="'. $this->generate_tracking_link('http://wpml.org/documentation/related-projects/woocommerce-multilingual/','woocommerce-multilingual','documentation','#4') .'" target="_blank">' .
475
  __('How to translate products', 'sitepress') . '<\/a>' . '<\/span>';
476
+ $quick_edit_notice = '<div id="quick_edit_notice" style="display:none;"><p>'. sprintf(__("Quick edit is disabled for product translations. It\'s recommended to use the %s for editing products translations. %s", 'woocommerce-multilingual'), '<a href="'.admin_url('admin.php?page=wpml-wcml&tab=products').'" >'.__('WooCommerce Multilingual products editor', 'woocommerce-multilingual').'</a>','<a href="" class="quick_product_trnsl_link" >'.__('Edit this product translation', 'woocommerce-multilingual').'</a>').'</p></div>';
477
  $quick_edit_notice_prod_link = '<input type="hidden" id="wcml_product_trnsl_link" value="'.admin_url('admin.php?page=wpml-wcml&tab=products&prid=').'">';
478
  ?>
479
  <script type="text/javascript">
526
  }
527
  ?>
528
  <div id="message" class="updated message fade" style="clear:both;margin-top:5px;"><p>
529
+ <?php _e('Would you like to see a quick overview?', 'woocommerce-multilingual'); ?>
530
  </p>
531
  <p>
532
+ <a class="button-primary" href="<?php echo $this->generate_tracking_link('http://wpml.org/documentation/related-projects/woocommerce-multilingual/','woocommerce-multilingual','documentation'); ?>" target="_blank"><?php _e('Learn how to turn your e-commerce site multilingual', 'woocommerce-multilingual') ?></a>
533
+ <a class="button-secondary" href="<?php echo $url; ?>"><?php _e('Dismiss', 'woocommerce-multilingual') ?></a>
534
  </p>
535
  </div>
536
  <?php
542
  return html_entity_decode($sitepress->convert_url($link));
543
  }
544
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
545
  function add_language_to_paypal($args) {
546
  global $sitepress;
547
  $args['lc'] = $sitepress->get_current_language();
789
  die();
790
  }
791
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
792
  function currency_options_update_default_currency(){
793
  $current_currency = get_option('woocommerce_currency');
794
  $new_currency = $_POST['woocommerce_currency'];
wpml-woocommerce.php CHANGED
@@ -5,18 +5,17 @@
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: OnTheGoSystems
7
  Author URI: http://www.onthegosystems.com/
8
- Version: 3.6.11
 
9
  */
10
 
11
 
12
  if(defined('WCML_VERSION')) return;
13
- define('WCML_VERSION', '3.6.11');
14
  define('WCML_PLUGIN_PATH', dirname(__FILE__));
15
  define('WCML_PLUGIN_FOLDER', basename(WCML_PLUGIN_PATH));
16
- define('WCML_PLUGIN_URL', plugins_url() . '/' . WCML_PLUGIN_FOLDER);
17
  define('WCML_LOCALE_PATH',WCML_PLUGIN_PATH.'/locale');
18
  define('WPML_LOAD_API_SUPPORT',true);
19
- define('WPML_SUPPORT_STRINGS_IN_DIFF_LANG', false);
20
 
21
  define('WCML_MULTI_CURRENCIES_DISABLED', 0);
22
  define('WCML_MULTI_CURRENCIES_PER_LANGUAGE', 1); //obsolete - migrate to 2
@@ -39,9 +38,11 @@ require WCML_PLUGIN_PATH . '/inc/compatibility.class.php';
39
  require WCML_PLUGIN_PATH . '/inc/endpoints.class.php';
40
  require WCML_PLUGIN_PATH . '/inc/currency-switcher.class.php';
41
  require WCML_PLUGIN_PATH . '/inc/xdomain-data.class.php';
 
42
 
43
  require WCML_PLUGIN_PATH . '/woocommerce_wpml.class.php';
44
 
 
45
 
46
  function wpml_wcml_startup() {
47
  global $woocommerce_wpml;
5
  Description: Allows running fully multilingual e-Commerce sites with WooCommerce and WPML. <a href="http://wpml.org/documentation/related-projects/woocommerce-multilingual/">Documentation</a>.
6
  Author: OnTheGoSystems
7
  Author URI: http://www.onthegosystems.com/
8
+ Text Domain: woocommerce-multilingual
9
+ Version: 3.7.1
10
  */
11
 
12
 
13
  if(defined('WCML_VERSION')) return;
14
+ define('WCML_VERSION', '3.7.1');
15
  define('WCML_PLUGIN_PATH', dirname(__FILE__));
16
  define('WCML_PLUGIN_FOLDER', basename(WCML_PLUGIN_PATH));
 
17
  define('WCML_LOCALE_PATH',WCML_PLUGIN_PATH.'/locale');
18
  define('WPML_LOAD_API_SUPPORT',true);
 
19
 
20
  define('WCML_MULTI_CURRENCIES_DISABLED', 0);
21
  define('WCML_MULTI_CURRENCIES_PER_LANGUAGE', 1); //obsolete - migrate to 2
38
  require WCML_PLUGIN_PATH . '/inc/endpoints.class.php';
39
  require WCML_PLUGIN_PATH . '/inc/currency-switcher.class.php';
40
  require WCML_PLUGIN_PATH . '/inc/xdomain-data.class.php';
41
+ require WCML_PLUGIN_PATH . '/inc/url-translation.class.php';
42
 
43
  require WCML_PLUGIN_PATH . '/woocommerce_wpml.class.php';
44
 
45
+ define('WCML_PLUGIN_URL', wpml_filter_include_url( untrailingslashit( plugin_dir_url( __FILE__ ) ) ));
46
 
47
  function wpml_wcml_startup() {
48
  global $woocommerce_wpml;