WooCommerce Multilingual – run WooCommerce with WPML - Version 3.6.1

Version Description

  • Updated the taxonomy translation synchronization to be compatible with WPML 3.2
  • Bug fix: the notice that shows up on the general settings page when the default language is not English did not hide when it was dismissed.
  • Bug fix: after adding a new currency and reloading the page, the new currency was gone. Also the exchange rate was wrong after re-adding teh currency.
  • Bug fix: an incorrect currency was being passed to the payment gateway when paying for an order created in the backend.
  • Bug fix: the prices in the custom currencies were not saved when a product was published.
  • Bug fix: extra backslashes were added when translating custom attribute name in products.
  • Bug fix: custom product categories template was not working as expected
  • Bug fix: updating WordPress language packs was not working when using custom locale codes in WPML
  • Bug fix: Variable products returned error in secondary language "This product is currently out of stock and unavailable."
  • Bug fix: The publishing date was not updating on translation when changed on the product in the original language
  • Bug fix: Attributes with the value "0" value were not displayed on the front end
  • Bug fix: Modified Free shipping label could not be translated
  • Bug fix: When editing product translations it was possible to save an empty slug.
Download this release

Release Info

Developer sergey.r
Plugin Icon 128x128 WooCommerce Multilingual – run WooCommerce with WPML
Version 3.6.1
Comparing to
See all releases

Code changes from version 3.6 to 3.6.1

Files changed (43) hide show
  1. assets/css/management.css +12 -21
  2. assets/css/tooltip.css +22 -0
  3. assets/js/scripts.js +4 -1
  4. assets/js/tooltip_init.js +11 -0
  5. compatibility/wc_bookings.class.php +15 -15
  6. compatibility/wc_checkout_field_editor.class.php +125 -0
  7. compatibility/wc_dynamic_pricing.class.php +1 -1
  8. compatibility/wc_exporter.class.php +3 -3
  9. compatibility/wc_extra_product_options.class.php +2 -2
  10. compatibility/wc_product_addons.class.php +1 -1
  11. compatibility/wc_product_bundles.class.php +8 -8
  12. compatibility/wc_sensei.class.php +7 -7
  13. compatibility/wc_tab_manager.class.php +2 -2
  14. compatibility/wc_variation_swatches_photos.class.php +2 -2
  15. inc/ajax-setup.class.php +3 -3
  16. inc/compatibility.class.php +7 -1
  17. inc/dependencies.class.php +1 -1
  18. inc/emails.class.php +12 -3
  19. inc/endpoints.class.php +1 -1
  20. inc/functions-troubleshooting.class.php +4 -4
  21. inc/missing-php-functions.php +8 -2
  22. inc/multi-currency-support.class.php +17 -9
  23. inc/multi-currency.class.php +1 -1
  24. inc/orders.class.php +11 -8
  25. inc/products.class.php +210 -109
  26. inc/reports.class.php +1 -1
  27. inc/requests.class.php +1 -1
  28. inc/store-pages.class.php +83 -10
  29. inc/terms.class.php +8 -7
  30. inc/wc-strings.class.php +74 -16
  31. locale/wpml-wcml-fr_FR.mo +0 -0
  32. locale/wpml-wcml-he_IL.mo +0 -0
  33. locale/wpml-wcml-nl_NL.mo +0 -0
  34. locale/wpml-wcml-uk_UA.mo +0 -0
  35. menu/management.php +1 -6
  36. menu/plugins.php +1 -1
  37. menu/sub/currency-switcher-options.php +1 -1
  38. menu/sub/product-data.php +25 -10
  39. menu/sub/products.php +48 -13
  40. menu/sub/settings.php +431 -426
  41. readme.txt +18 -3
  42. woocommerce_wpml.class.php +27 -9
  43. wpml-woocommerce.php +3 -3
assets/css/management.css CHANGED
@@ -118,23 +118,6 @@
118
  font-size: 20px;
119
  }
120
 
121
- .wcml-section-header .icon-question-sign,
122
- th .icon-question-sign{
123
- color: #ccc;
124
- cursor: pointer;
125
- vertical-align: middle;
126
- font-size: 12px;
127
- }
128
-
129
- .wcml-section-header .icon-question-sign:hover,
130
- th .icon-question-sign:hover{
131
- color: #007cbd;
132
- -webkit-transition: all 0.15s linear;
133
- -moz-transition: all 0.15s linear;
134
- -ms-transition: all 0.15s linear;
135
- -o-transition: all 0.15s linear;
136
- transition: all 0.15s linear;
137
- }
138
 
139
  .wcml-section-content {
140
  float: left;
@@ -230,7 +213,6 @@
230
  }
231
  .wcml_products .outer {
232
  position:relative;
233
- display: none;
234
  }
235
 
236
  .wcml_product_row .inner {
@@ -267,6 +249,7 @@
267
  float: left;
268
  margin: 0 5px;
269
  display: none;
 
270
  }
271
  .wcml_cat_block{
272
  display: none;
@@ -519,7 +502,8 @@
519
  color: #777;
520
  font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
521
  }
522
- .wcml_product_pagination a{
 
523
  border-color: #e3e3e3;
524
  background: #eee;
525
  -moz-box-shadow: inset 0 1px 0 #fff;
@@ -532,10 +516,17 @@
532
  border-width: 1px;
533
  border-style: solid;
534
  }
535
- .wcml_product_pagination a.disabled{
 
536
  color: #aaa;
537
  cursor: default;
538
  }
 
 
 
 
 
 
539
  .wcml_product_pagination input{
540
  text-align: center;
541
  border-color: #dfdfdf;
@@ -983,4 +974,4 @@ input[name="wcml_curr_template"]{
983
  .edit_slug_input,
984
  .edit_slug_hide_link{
985
  display: none;
986
- }
118
  font-size: 20px;
119
  }
120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
 
122
  .wcml-section-content {
123
  float: left;
213
  }
214
  .wcml_products .outer {
215
  position:relative;
 
216
  }
217
 
218
  .wcml_product_row .inner {
249
  float: left;
250
  margin: 0 5px;
251
  display: none;
252
+ visibility: visible;
253
  }
254
  .wcml_cat_block{
255
  display: none;
502
  color: #777;
503
  font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
504
  }
505
+ .wcml_product_pagination a,
506
+ .wcml_product_title_block a{
507
  border-color: #e3e3e3;
508
  background: #eee;
509
  -moz-box-shadow: inset 0 1px 0 #fff;
516
  border-width: 1px;
517
  border-style: solid;
518
  }
519
+ .wcml_product_pagination a.disabled,
520
+ .wcml_product_title_block a.disabled{
521
  color: #aaa;
522
  cursor: default;
523
  }
524
+
525
+ .wcml_product_title_block h3{
526
+ display: inline-block;
527
+ margin-right: 20px;
528
+ }
529
+
530
  .wcml_product_pagination input{
531
  text-align: center;
532
  border-color: #dfdfdf;
974
  .edit_slug_input,
975
  .edit_slug_hide_link{
976
  display: none;
977
+ }
assets/css/tooltip.css ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wcml-section-header .icon-question-sign,
2
+ .wcml-section-content .icon-question-sign,
3
+ .wcml_tootlip_icon.icon-question-sign,
4
+ th .icon-question-sign{
5
+ color: #ccc;
6
+ cursor: pointer;
7
+ vertical-align: middle;
8
+ font-size: 12px;
9
+ }
10
+
11
+ .wcml-section-header .icon-question-sign:hover,
12
+ .wcml_tootlip_icon.icon-question-sign:hover,
13
+ .wcml-section-content .icon-question-sign:hover,
14
+ th .icon-question-sign:hover{
15
+ color: #007cbd;
16
+ -webkit-transition: all 0.15s linear;
17
+ -moz-transition: all 0.15s linear;
18
+ -ms-transition: all 0.15s linear;
19
+ -o-transition: all 0.15s linear;
20
+ transition: all 0.15s linear;
21
+ cursor: help;
22
+ }
assets/js/scripts.js CHANGED
@@ -78,6 +78,7 @@ jQuery(document).ready(function($){
78
  }else{
79
  //load product data
80
  var id = $(this).attr('href').replace(/#prid_/, '');
 
81
  element.parent().find('.spinner').show();
82
  $.ajax({
83
  type : "post",
@@ -86,6 +87,7 @@ jQuery(document).ready(function($){
86
  data : {
87
  action: "wcml_product_data",
88
  product_id : id,
 
89
  wcml_nonce: $('#get_product_data_nonce').val()
90
  },
91
  success: function(response) {
@@ -157,6 +159,7 @@ jQuery(document).ready(function($){
157
  action: "wcml_update_product",
158
  product_id : product_id,
159
  language : language,
 
160
  records : records,
161
  slang : $('.wcml_translation_status_lang').val(),
162
  wcml_nonce: $('#upd_product_nonce').val()
@@ -1372,7 +1375,7 @@ jQuery(document).ready(function($){
1372
  action: 'wcml_update_setting_ajx',
1373
  setting: 'dismiss_non_default_language_warning',
1374
  value: 1,
1375
- nonce: wcml_settings.nonce
1376
  },
1377
  success: function(response){
1378
  location.reload();
78
  }else{
79
  //load product data
80
  var id = $(this).attr('href').replace(/#prid_/, '');
81
+ var job_id = $(this).attr('job_id');
82
  element.parent().find('.spinner').show();
83
  $.ajax({
84
  type : "post",
87
  data : {
88
  action: "wcml_product_data",
89
  product_id : id,
90
+ job_id : job_id,
91
  wcml_nonce: $('#get_product_data_nonce').val()
92
  },
93
  success: function(response) {
159
  action: "wcml_update_product",
160
  product_id : product_id,
161
  language : language,
162
+ job_id : field.closest('tr').find('input[name="job_id"]').val(),
163
  records : records,
164
  slang : $('.wcml_translation_status_lang').val(),
165
  wcml_nonce: $('#upd_product_nonce').val()
1375
  action: 'wcml_update_setting_ajx',
1376
  setting: 'dismiss_non_default_language_warning',
1377
  value: 1,
1378
+ nonce: $('#wcml_settings_nonce').val()
1379
  },
1380
  success: function(response){
1381
  location.reload();
assets/js/tooltip_init.js ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($){
2
+ // Tooltips
3
+ var tiptip_args = {
4
+ 'attribute' : 'data-tip',
5
+ 'fadeIn' : 50,
6
+ 'fadeOut' : 50,
7
+ 'delay' : 200
8
+ };
9
+ $(".icon-question-sign").tipTip( tiptip_args );
10
+ });
11
+
compatibility/wc_bookings.class.php CHANGED
@@ -30,7 +30,7 @@ class WCML_Bookings{
30
 
31
  add_filter( 'wcml_cart_contents_not_changed', array( $this, 'filter_bundled_product_in_cart_contents' ), 10, 3 );
32
 
33
- add_action( 'after_woocommerce_bookings_create_booking_page', array( $this, 'booking_currency_dropdown' ) );
34
  add_action( 'init', array( $this, 'set_booking_currency') );
35
  add_action( 'wp_ajax_wcml_booking_set_currency', array( $this, 'set_booking_currency_ajax' ) );
36
  add_action( 'woocommerce_bookings_create_booking_page_add_order_item', array( $this, 'set_order_currency_on_create_booking_page' ) );
@@ -368,7 +368,7 @@ class WCML_Bookings{
368
 
369
  foreach ($orig_resources as $resource) {
370
 
371
- $trns_resource_id = icl_object_id( $resource->resource_id, 'bookable_resource', false, $lang_code );
372
 
373
  if ( !is_null( $trns_resource_id ) && in_array( $trns_resource_id, $trnsl_product_resources ) ) {
374
 
@@ -467,7 +467,7 @@ class WCML_Bookings{
467
 
468
  foreach ($orig_persons as $person) {
469
 
470
- $trnsl_person_id = icl_object_id( $person, 'bookable_person', false, $lang_code );
471
 
472
  if ( !is_null( $trnsl_person_id ) && in_array( $trnsl_person_id, $trnsl_persons ) ) {
473
 
@@ -559,7 +559,7 @@ class WCML_Bookings{
559
 
560
  if( $woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT ){
561
 
562
- $original_id = icl_object_id( $object_id, 'product', true, $woocommerce_wpml->products->get_original_product_language( $object_id ) );
563
 
564
  $cost_status = get_post_meta( $original_id, '_wcml_custom_costs_status', true );
565
 
@@ -784,7 +784,7 @@ class WCML_Bookings{
784
  function sync_resource_costs_with_translations( $object_id, $meta_key, $check = false ){
785
  global $sitepress,$woocommerce_wpml;
786
 
787
- $original_product_id = icl_object_id( $object_id, 'product', true, $woocommerce_wpml->products->get_original_product_language( $object_id ) );
788
 
789
  if( $object_id == $original_product_id ){
790
 
@@ -828,7 +828,7 @@ class WCML_Bookings{
828
 
829
  foreach( $currencies as $custom_costs_resource_id => $custom_cost ){
830
 
831
- $trns_resource_id = icl_object_id( $custom_costs_resource_id, 'bookable_resource', true, $language_code );
832
 
833
  $wc_booking_resource_costs[ 'custom_costs' ][ $code ][ $trns_resource_id ] = $custom_cost;
834
 
@@ -838,7 +838,7 @@ class WCML_Bookings{
838
 
839
  }else{
840
 
841
- $trns_resource_id = icl_object_id( $resource_id, 'bookable_resource', true, $language_code );
842
 
843
  $wc_booking_resource_costs[ $trns_resource_id ] = $costs;
844
 
@@ -882,7 +882,7 @@ class WCML_Bookings{
882
  }
883
 
884
  if( isset( $booking_id ) ){
885
- $original_id = icl_object_id( $booking_id, 'product', true, $woocommerce_wpml->products->get_original_product_language( $booking_id ) );
886
 
887
  if( $booking_id != $original_id ){
888
  $fields = maybe_unserialize( get_post_meta( $original_id, '_wc_booking_pricing', true ) );
@@ -931,7 +931,7 @@ class WCML_Bookings{
931
  if( $cart_item[ 'data' ] instanceof WC_Product_Booking ){
932
  global $woocommerce_wpml;
933
 
934
- $current_id = icl_object_id( $cart_item[ 'data' ]->id, 'product', true, $current_language );
935
  $cart_product_id = $cart_item['data']->id;
936
 
937
  if( $current_id != $cart_product_id ) {
@@ -1138,7 +1138,7 @@ class WCML_Bookings{
1138
 
1139
  if( $resource_id == 'custom_costs' ) continue;
1140
 
1141
- $trns_resource_id = icl_object_id( $resource_id, 'bookable_resource', false, $template_data[ 'lang' ] );
1142
 
1143
  if( !empty( $trns_resource_id ) && $template_data[ 'translation_exist' ] ){
1144
  $resources[ $resource_id ] = $trns_resource_id;
@@ -1159,7 +1159,7 @@ class WCML_Bookings{
1159
 
1160
  foreach( $original_persons as $person ){
1161
 
1162
- $trnsl_person_id = icl_object_id( $person, 'bookable_person', false, $template_data[ 'lang' ] );
1163
 
1164
  if( !empty( $trnsl_person_id ) && $template_data[ 'translation_exist' ] ){
1165
  $persons[ $person ] = $trnsl_person_id;
@@ -1250,13 +1250,13 @@ class WCML_Bookings{
1250
  if( isset( $data[ 'wc_booking_resources_'.$language ] ) ){
1251
 
1252
  $original_product_lang = $woocommerce_wpml->products->get_original_product_language( $tr_product_id );
1253
- $original_product_id = icl_object_id( $tr_product_id, 'product', true, $original_product_lang );
1254
 
1255
  foreach( $data[ 'wc_booking_resources_'.$language ][ 'id' ] as $key => $resource_id ){
1256
 
1257
  if( !$resource_id ){
1258
 
1259
- $resource_id = icl_object_id( $data[ 'wc_booking_resources_'.$language ][ 'orig_id' ][ $key ], 'bookable_resource', false, $language );
1260
 
1261
  $orig_resource = $wpdb->get_row( $wpdb->prepare( "SELECT resource_id, sort_order FROM {$wpdb->prefix}wc_booking_relationships WHERE resource_id = %d AND product_id = %d", $data[ 'wc_booking_resources_'.$language ][ 'orig_id' ][ $key ], $original_product_id ), OBJECT );
1262
 
@@ -1317,13 +1317,13 @@ class WCML_Bookings{
1317
  if( isset( $data[ 'wc_booking_persons_'.$language ] ) ){
1318
 
1319
  $original_product_lang = $woocommerce_wpml->products->get_original_product_language( $tr_product_id );
1320
- $original_product_id = icl_object_id( $tr_product_id, 'product', true, $original_product_lang );
1321
 
1322
  foreach( $data[ 'wc_booking_persons_'.$language ][ 'id' ] as $key => $person_id ) {
1323
 
1324
  if ( !$person_id ) {
1325
 
1326
- $person_id = icl_object_id( $data[ 'wc_booking_persons_'.$language ][ 'orig_id' ][ $key ], 'bookable_person', false, $language );
1327
 
1328
  if( is_null( $person_id ) ){
1329
 
30
 
31
  add_filter( 'wcml_cart_contents_not_changed', array( $this, 'filter_bundled_product_in_cart_contents' ), 10, 3 );
32
 
33
+ add_action( 'woocommerce_bookings_after_create_booking_page', array( $this, 'booking_currency_dropdown' ) );
34
  add_action( 'init', array( $this, 'set_booking_currency') );
35
  add_action( 'wp_ajax_wcml_booking_set_currency', array( $this, 'set_booking_currency_ajax' ) );
36
  add_action( 'woocommerce_bookings_create_booking_page_add_order_item', array( $this, 'set_order_currency_on_create_booking_page' ) );
368
 
369
  foreach ($orig_resources as $resource) {
370
 
371
+ $trns_resource_id = apply_filters( 'translate_object_id', $resource->resource_id, 'bookable_resource', false, $lang_code );
372
 
373
  if ( !is_null( $trns_resource_id ) && in_array( $trns_resource_id, $trnsl_product_resources ) ) {
374
 
467
 
468
  foreach ($orig_persons as $person) {
469
 
470
+ $trnsl_person_id = apply_filters( 'translate_object_id', $person, 'bookable_person', false, $lang_code );
471
 
472
  if ( !is_null( $trnsl_person_id ) && in_array( $trnsl_person_id, $trnsl_persons ) ) {
473
 
559
 
560
  if( $woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT ){
561
 
562
+ $original_id = apply_filters( 'translate_object_id', $object_id, 'product', true, $woocommerce_wpml->products->get_original_product_language( $object_id ) );
563
 
564
  $cost_status = get_post_meta( $original_id, '_wcml_custom_costs_status', true );
565
 
784
  function sync_resource_costs_with_translations( $object_id, $meta_key, $check = false ){
785
  global $sitepress,$woocommerce_wpml;
786
 
787
+ $original_product_id = apply_filters( 'translate_object_id', $object_id, 'product', true, $woocommerce_wpml->products->get_original_product_language( $object_id ) );
788
 
789
  if( $object_id == $original_product_id ){
790
 
828
 
829
  foreach( $currencies as $custom_costs_resource_id => $custom_cost ){
830
 
831
+ $trns_resource_id = apply_filters( 'translate_object_id', $custom_costs_resource_id, 'bookable_resource', true, $language_code );
832
 
833
  $wc_booking_resource_costs[ 'custom_costs' ][ $code ][ $trns_resource_id ] = $custom_cost;
834
 
838
 
839
  }else{
840
 
841
+ $trns_resource_id = apply_filters( 'translate_object_id', $resource_id, 'bookable_resource', true, $language_code );
842
 
843
  $wc_booking_resource_costs[ $trns_resource_id ] = $costs;
844
 
882
  }
883
 
884
  if( isset( $booking_id ) ){
885
+ $original_id = apply_filters( 'translate_object_id', $booking_id, 'product', true, $woocommerce_wpml->products->get_original_product_language( $booking_id ) );
886
 
887
  if( $booking_id != $original_id ){
888
  $fields = maybe_unserialize( get_post_meta( $original_id, '_wc_booking_pricing', true ) );
931
  if( $cart_item[ 'data' ] instanceof WC_Product_Booking ){
932
  global $woocommerce_wpml;
933
 
934
+ $current_id = apply_filters( 'translate_object_id', $cart_item[ 'data' ]->id, 'product', true, $current_language );
935
  $cart_product_id = $cart_item['data']->id;
936
 
937
  if( $current_id != $cart_product_id ) {
1138
 
1139
  if( $resource_id == 'custom_costs' ) continue;
1140
 
1141
+ $trns_resource_id = apply_filters( 'translate_object_id', $resource_id, 'bookable_resource', false, $template_data[ 'lang' ] );
1142
 
1143
  if( !empty( $trns_resource_id ) && $template_data[ 'translation_exist' ] ){
1144
  $resources[ $resource_id ] = $trns_resource_id;
1159
 
1160
  foreach( $original_persons as $person ){
1161
 
1162
+ $trnsl_person_id = apply_filters( 'translate_object_id', $person, 'bookable_person', false, $template_data[ 'lang' ] );
1163
 
1164
  if( !empty( $trnsl_person_id ) && $template_data[ 'translation_exist' ] ){
1165
  $persons[ $person ] = $trnsl_person_id;
1250
  if( isset( $data[ 'wc_booking_resources_'.$language ] ) ){
1251
 
1252
  $original_product_lang = $woocommerce_wpml->products->get_original_product_language( $tr_product_id );
1253
+ $original_product_id = apply_filters( 'translate_object_id', $tr_product_id, 'product', true, $original_product_lang );
1254
 
1255
  foreach( $data[ 'wc_booking_resources_'.$language ][ 'id' ] as $key => $resource_id ){
1256
 
1257
  if( !$resource_id ){
1258
 
1259
+ $resource_id = apply_filters( 'translate_object_id', $data[ 'wc_booking_resources_'.$language ][ 'orig_id' ][ $key ], 'bookable_resource', false, $language );
1260
 
1261
  $orig_resource = $wpdb->get_row( $wpdb->prepare( "SELECT resource_id, sort_order FROM {$wpdb->prefix}wc_booking_relationships WHERE resource_id = %d AND product_id = %d", $data[ 'wc_booking_resources_'.$language ][ 'orig_id' ][ $key ], $original_product_id ), OBJECT );
1262
 
1317
  if( isset( $data[ 'wc_booking_persons_'.$language ] ) ){
1318
 
1319
  $original_product_lang = $woocommerce_wpml->products->get_original_product_language( $tr_product_id );
1320
+ $original_product_id = apply_filters( 'translate_object_id', $tr_product_id, 'product', true, $original_product_lang );
1321
 
1322
  foreach( $data[ 'wc_booking_persons_'.$language ][ 'id' ] as $key => $person_id ) {
1323
 
1324
  if ( !$person_id ) {
1325
 
1326
+ $person_id = apply_filters( 'translate_object_id', $data[ 'wc_booking_persons_'.$language ][ 'orig_id' ][ $key ], 'bookable_person', false, $language );
1327
 
1328
  if( is_null( $person_id ) ){
1329
 
compatibility/wc_checkout_field_editor.class.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WCML_Checkout_Field_Editor {
4
+
5
+ protected $package, $billing, $shipping, $additional;
6
+
7
+ function __construct() {
8
+ $this->package = (object) array(
9
+ 'kind' => 'WooCommerce Add-On',
10
+ 'kind_slug' => 'woocommerce-add-on',
11
+ 'name' => 'checkout-field-editor',
12
+ 'title' => 'WooCommerce Checkout Field Editor'
13
+ );
14
+ global $supress_field_modification;
15
+ if ( !is_admin() && !$supress_field_modification ) {
16
+ add_filter( 'pre_option_wc_fields_billing', array($this, 'get_billing') );
17
+ add_filter( 'pre_option_wc_fields_shipping', array($this, 'get_shipping') );
18
+ add_filter( 'pre_option_wc_fields_additional', array($this, 'get_additional') );
19
+ }
20
+ add_filter( 'pre_update_option_wc_fields_billing', array($this, 'register_fields') );
21
+ add_filter( 'pre_update_option_wc_fields_shipping', array($this, 'register_fields') );
22
+ add_filter( 'pre_update_option_wc_fields_additional', array($this, 'register_fields') );
23
+ }
24
+
25
+ public function register_fields( $fields ) {
26
+ foreach ( $fields as $string_name => $field ) {
27
+ // Translate label
28
+ if ( !empty( $field['label'] ) ) {
29
+ do_action( 'wpml_register_string',
30
+ $field['label'],
31
+ "{$string_name}_label",
32
+ $this->package,
33
+ "{$string_name} Label",
34
+ $this->package->kind
35
+ );
36
+ }
37
+ // Translate placeholder
38
+ if ( !empty( $field['placeholder'] ) ) {
39
+ do_action( 'wpml_register_string',
40
+ $field['placeholder'],
41
+ "{$string_name}_placeholder",
42
+ $this->package,
43
+ "{$string_name} Placeholder",
44
+ $this->package->kind
45
+ );
46
+ }
47
+ // Translate options
48
+ if ( !empty( $field['options'] ) ) {
49
+ $i = 1;
50
+ foreach ( $field['options'] as $option ) {
51
+ do_action( 'wpml_register_string',
52
+ $option,
53
+ "{$string_name}_option_{$i}",
54
+ $this->package,
55
+ "{$string_name} Option {$i}",
56
+ $this->package->kind
57
+ );
58
+ $i++;
59
+ }
60
+ }
61
+ }
62
+ return $fields;
63
+ }
64
+
65
+ public function translate_fields( $fields ) {
66
+ foreach ( $fields as $string_name => &$field ) {
67
+ // Translate label
68
+ if ( !empty( $field['label'] ) ) {
69
+ $field['label'] = apply_filters( 'wpml_translate_string',
70
+ $field['label'],
71
+ "{$string_name}_label",
72
+ $this->package
73
+ );
74
+ }
75
+ // Translate placeholder
76
+ if ( !empty( $field['placeholder'] ) ) {
77
+ $field['placeholder'] = apply_filters( 'wpml_translate_string',
78
+ $field['label'],
79
+ "{$string_name}_placeholder",
80
+ $this->package
81
+ );
82
+ }
83
+ // Translate options
84
+ if ( !empty( $field['options'] ) ) {
85
+ $i = 1;
86
+ foreach ( $field['options'] as $k => $option ) {
87
+ $field['options'][$k] = apply_filters( 'wpml_translate_string',
88
+ $option,
89
+ "{$string_name}_option_{$i}",
90
+ $this->package
91
+ );
92
+ $i++;
93
+ }
94
+ }
95
+ }
96
+ return $fields;
97
+ }
98
+
99
+ public function get_billing() {
100
+ if ( is_null( $this->billing ) ) {
101
+ remove_filter( 'pre_option_wc_fields_billing', array($this, 'get_billing') );
102
+ $this->billing = $this->translate_fields( get_option( 'wc_fields_billing', array() ) );
103
+ add_filter( 'pre_option_wc_fields_billing', array($this, 'get_billing') );
104
+ }
105
+ return $this->billing;
106
+ }
107
+
108
+ public function get_shipping() {
109
+ if ( is_null( $this->shipping ) ) {
110
+ remove_filter( 'pre_option_wc_fields_shipping', array($this, 'get_shipping') );
111
+ $this->shipping = $this->translate_fields( get_option( 'wc_fields_shipping', array() ) );
112
+ add_filter( 'pre_option_wc_fields_shipping', array($this, 'get_shipping') );
113
+ }
114
+ return $this->shipping;
115
+ }
116
+
117
+ public function get_additional() {
118
+ if ( is_null( $this->additional ) ) {
119
+ remove_filter( 'pre_option_wc_fields_additional', array($this, 'get_additional') );
120
+ $this->additional = $this->translate_fields( get_option( 'wc_fields_additional', array() ) );
121
+ add_filter( 'pre_option_wc_fields_additional', array($this, 'get_additional') );
122
+ }
123
+ return $this->additional;
124
+ }
125
+ }
compatibility/wc_dynamic_pricing.class.php CHANGED
@@ -40,7 +40,7 @@ class WCML_Dynamic_Pricing{
40
  function woocommerce_dynamic_pricing_is_applied_to($process_discounts, $_product, $module_id, $obj,$cat_id){
41
  if($cat_id && isset($obj->available_rulesets) && count($obj->available_rulesets) > 0){
42
  global $sitepress;
43
- $cat_id = icl_object_id($cat_id,'product_cat',true,$sitepress->get_current_language());
44
  $process_discounts = is_object_in_term($_product->id, 'product_cat', $cat_id);
45
  }
46
 
40
  function woocommerce_dynamic_pricing_is_applied_to($process_discounts, $_product, $module_id, $obj,$cat_id){
41
  if($cat_id && isset($obj->available_rulesets) && count($obj->available_rulesets) > 0){
42
  global $sitepress;
43
+ $cat_id = apply_filters( 'translate_object_id',$cat_id,'product_cat',true,$sitepress->get_current_language());
44
  $process_discounts = is_object_in_term($_product->id, 'product_cat', $cat_id);
45
  }
46
 
compatibility/wc_exporter.class.php CHANGED
@@ -42,7 +42,7 @@ class WCML_wcExporter{
42
  global $sitepress,$woocommerce_wpml;
43
 
44
  $data->language = $sitepress->get_language_for_element($product_id,'post_'.get_post_type($product_id));
45
- $data->translation_of = icl_object_id($product_id,get_post_type($product_id),true, $woocommerce_wpml->products->get_original_product_language( $product_id ) );
46
 
47
  return $data;
48
  }
@@ -51,7 +51,7 @@ class WCML_wcExporter{
51
  global $sitepress;
52
 
53
  $data->language = $sitepress->get_language_for_element($data->term_taxonomy_id,'tax_product_cat');
54
- $data->translation_of = icl_object_id($data->term_taxonomy_id,'tax_product_cat',true,$sitepress->get_default_language());
55
 
56
  return $data;
57
  }
@@ -61,7 +61,7 @@ class WCML_wcExporter{
61
 
62
  foreach($tags as $key=>$tag){
63
  $tags[$key]->language = $sitepress->get_language_for_element($tag->term_taxonomy_id,'tax_product_tag');
64
- $tags[$key]->translation_of = icl_object_id($tag->term_taxonomy_id,'tax_product_tag',true,$sitepress->get_default_language());
65
  }
66
 
67
  return $tags;
42
  global $sitepress,$woocommerce_wpml;
43
 
44
  $data->language = $sitepress->get_language_for_element($product_id,'post_'.get_post_type($product_id));
45
+ $data->translation_of = apply_filters( 'translate_object_id',$product_id,get_post_type($product_id),true, $woocommerce_wpml->products->get_original_product_language( $product_id ) );
46
 
47
  return $data;
48
  }
51
  global $sitepress;
52
 
53
  $data->language = $sitepress->get_language_for_element($data->term_taxonomy_id,'tax_product_cat');
54
+ $data->translation_of = apply_filters( 'translate_object_id',$data->term_taxonomy_id,'tax_product_cat',true,$sitepress->get_default_language());
55
 
56
  return $data;
57
  }
61
 
62
  foreach($tags as $key=>$tag){
63
  $tags[$key]->language = $sitepress->get_language_for_element($tag->term_taxonomy_id,'tax_product_tag');
64
+ $tags[$key]->translation_of = apply_filters( 'translate_object_id',$tag->term_taxonomy_id,'tax_product_tag',true,$sitepress->get_default_language());
65
  }
66
 
67
  return $tags;
compatibility/wc_extra_product_options.class.php CHANGED
@@ -47,7 +47,7 @@ class WCML_Extra_Product_Options{
47
  global $sitepress,$woocommerce_wpml;
48
  $keys_to_translate = array( 'header_title', 'header_subtitle', 'text_after_price', 'placeholder' );
49
 
50
- $id = icl_object_id( $id, get_post_type( $id ), true, $woocommerce_wpml->products->get_original_product_language( $id ) );
51
 
52
  foreach( $options[ 'tmfbuilder' ] as $key => $values ){
53
  foreach( $keys_to_translate as $key_text ){
@@ -92,7 +92,7 @@ class WCML_Extra_Product_Options{
92
  $translated_terms = array();
93
 
94
  foreach($product_terms as $key => $product_term){
95
- $tr_id = icl_object_id( $key, 'product_cat', true, $sitepress->get_default_language() );
96
 
97
  $translated_terms[$tr_id] = $wpdb->get_row( $wpdb->prepare("
98
  SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, 'product_cat' ) );
47
  global $sitepress,$woocommerce_wpml;
48
  $keys_to_translate = array( 'header_title', 'header_subtitle', 'text_after_price', 'placeholder' );
49
 
50
+ $id = apply_filters( 'translate_object_id', $id, get_post_type( $id ), true, $woocommerce_wpml->products->get_original_product_language( $id ) );
51
 
52
  foreach( $options[ 'tmfbuilder' ] as $key => $values ){
53
  foreach( $keys_to_translate as $key_text ){
92
  $translated_terms = array();
93
 
94
  foreach($product_terms as $key => $product_term){
95
+ $tr_id = apply_filters( 'translate_object_id', $key, 'product_cat', true, $sitepress->get_default_language() );
96
 
97
  $translated_terms[$tr_id] = $wpdb->get_row( $wpdb->prepare("
98
  SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, 'product_cat' ) );
compatibility/wc_product_addons.class.php CHANGED
@@ -59,7 +59,7 @@ class WCML_Product_Addons{
59
  global $sitepress;
60
 
61
  foreach($product_terms as $key => $product_term){
62
- $product_terms[$key] = icl_object_id($product_term,'product_cat',true,$sitepress->get_default_language());
63
  }
64
 
65
  return $product_terms;
59
  global $sitepress;
60
 
61
  foreach($product_terms as $key => $product_term){
62
+ $product_terms[$key] = apply_filters( 'translate_object_id',$product_term,'product_cat',true,$sitepress->get_default_language());
63
  }
64
 
65
  return $product_terms;
compatibility/wc_product_bundles.class.php CHANGED
@@ -23,7 +23,7 @@ class WCML_Product_Bundles{
23
  $tr_ids = array();
24
  $i = 2;
25
  foreach($atts as $id=>$bundle_data){
26
- $tr_id = icl_object_id($id,get_post_type($id),true,$lang);
27
 
28
  if(isset($tr_bundle[$tr_id])){
29
  $bundle_key = $tr_id.'_'.$i;
@@ -58,7 +58,7 @@ class WCML_Product_Bundles{
58
  if(isset($bundle_data['filter_variations']) && $bundle_data['filter_variations']=='yes'){
59
  $allowed_var = $bundle_data['allowed_variations'];
60
  foreach($allowed_var as $key=>$var_id){
61
- $tr_var_id = icl_object_id($var_id,get_post_type($var_id),true,$lang);
62
  $tr_bundle[$bundle_key]['allowed_variations'][$key] = $tr_var_id;
63
  }
64
  }
@@ -68,7 +68,7 @@ class WCML_Product_Bundles{
68
  $term = get_term_by('slug',$term_slug, $tax);
69
  if($term!=false){
70
  // Global Attribute
71
- $tr_def_id = icl_object_id($term->term_id,$tax,true,$lang);
72
  $tr_term = get_term( $tr_def_id, $tax );
73
  $tr_bundle[$bundle_key]['bundle_defaults'][$tax] = $tr_term->slug;
74
  }else{
@@ -76,7 +76,7 @@ class WCML_Product_Bundles{
76
  $args = array( 'post_type' => 'product_variation', 'meta_key' => 'attribute_'.$tax, 'meta_value' => $term_slug, 'meta_compare' => '=');
77
  $variationloop = new WP_Query( $args );
78
  while ( $variationloop->have_posts() ) : $variationloop->the_post();
79
- $tr_var_id = icl_object_id(get_the_ID(),'product_variation',true,$lang);
80
  $tr_meta = get_post_meta($tr_var_id, 'attribute_'.$tax , true);
81
  $tr_bundle[$bundle_key]['bundle_defaults'][$tax] = $tr_meta;
82
  endwhile;
@@ -132,7 +132,7 @@ class WCML_Product_Bundles{
132
 
133
 
134
  if($default_language != $lang){
135
- $tr_product_id = icl_object_id($product_id, 'product', true, $lang);
136
  if($tr_product_id == $product_id){
137
  $translated = false;
138
  }else{
@@ -163,7 +163,7 @@ class WCML_Product_Bundles{
163
  $product_bundles = array_keys($bundle_data);
164
  $k = 0;
165
  foreach($product_bundles as $original_id){
166
- $tr_bundles_ids[$k] = icl_object_id($original_id,'product',false,$lang);
167
  $k++;
168
  }
169
 
@@ -222,13 +222,13 @@ class WCML_Product_Bundles{
222
  global $woocommerce_wpml;
223
  $new_stamp = array();
224
  foreach( $cart_contents[$key]['stamp'] as $st_prd => $st_prod_data){
225
- $tr_st_p_id = icl_object_id($st_prd,'product',false,$current_language);
226
 
227
  if(isset($st_prod_data['variation_id'])){
228
  if(array_key_exists($st_prod_data['variation_id'],$exist_ids_translations)){
229
  $tr_st_v_id = $exist_ids_translations[$st_prod_data['variation_id']];
230
  }else{
231
- $tr_st_v_id = icl_object_id($st_prod_data['variation_id'],'product_variation',false,$current_language);
232
  }
233
 
234
  if(!is_null($tr_st_v_id)){
23
  $tr_ids = array();
24
  $i = 2;
25
  foreach($atts as $id=>$bundle_data){
26
+ $tr_id = apply_filters( 'translate_object_id',$id,get_post_type($id),true,$lang);
27
 
28
  if(isset($tr_bundle[$tr_id])){
29
  $bundle_key = $tr_id.'_'.$i;
58
  if(isset($bundle_data['filter_variations']) && $bundle_data['filter_variations']=='yes'){
59
  $allowed_var = $bundle_data['allowed_variations'];
60
  foreach($allowed_var as $key=>$var_id){
61
+ $tr_var_id = apply_filters( 'translate_object_id',$var_id,get_post_type($var_id),true,$lang);
62
  $tr_bundle[$bundle_key]['allowed_variations'][$key] = $tr_var_id;
63
  }
64
  }
68
  $term = get_term_by('slug',$term_slug, $tax);
69
  if($term!=false){
70
  // Global Attribute
71
+ $tr_def_id = apply_filters( 'translate_object_id',$term->term_id,$tax,true,$lang);
72
  $tr_term = get_term( $tr_def_id, $tax );
73
  $tr_bundle[$bundle_key]['bundle_defaults'][$tax] = $tr_term->slug;
74
  }else{
76
  $args = array( 'post_type' => 'product_variation', 'meta_key' => 'attribute_'.$tax, 'meta_value' => $term_slug, 'meta_compare' => '=');
77
  $variationloop = new WP_Query( $args );
78
  while ( $variationloop->have_posts() ) : $variationloop->the_post();
79
+ $tr_var_id = apply_filters( 'translate_object_id',get_the_ID(),'product_variation',true,$lang);
80
  $tr_meta = get_post_meta($tr_var_id, 'attribute_'.$tax , true);
81
  $tr_bundle[$bundle_key]['bundle_defaults'][$tax] = $tr_meta;
82
  endwhile;
132
 
133
 
134
  if($default_language != $lang){
135
+ $tr_product_id = apply_filters( 'translate_object_id',$product_id, 'product', true, $lang);
136
  if($tr_product_id == $product_id){
137
  $translated = false;
138
  }else{
163
  $product_bundles = array_keys($bundle_data);
164
  $k = 0;
165
  foreach($product_bundles as $original_id){
166
+ $tr_bundles_ids[$k] = apply_filters( 'translate_object_id',$original_id,'product',false,$lang);
167
  $k++;
168
  }
169
 
222
  global $woocommerce_wpml;
223
  $new_stamp = array();
224
  foreach( $cart_contents[$key]['stamp'] as $st_prd => $st_prod_data){
225
+ $tr_st_p_id = apply_filters( 'translate_object_id',$st_prd,'product',false,$current_language);
226
 
227
  if(isset($st_prod_data['variation_id'])){
228
  if(array_key_exists($st_prod_data['variation_id'],$exist_ids_translations)){
229
  $tr_st_v_id = $exist_ids_translations[$st_prod_data['variation_id']];
230
  }else{
231
+ $tr_st_v_id = apply_filters( 'translate_object_id',$st_prod_data['variation_id'],'product_variation',false,$current_language);
232
  }
233
 
234
  if(!is_null($tr_st_v_id)){
compatibility/wc_sensei.class.php CHANGED
@@ -73,7 +73,7 @@ class WCML_sensei{
73
  $lesson_id = get_post_meta( $original_post_id, '_quiz_lesson', true );
74
 
75
  if( $lesson_id ){
76
- $tr_lesson_id = icl_object_id( $lesson_id, 'post_lesson', false, $language );
77
 
78
  if( !is_null( $tr_lesson_id ) ){
79
  update_post_meta( $post_id, '_quiz_lesson', $tr_lesson_id );
@@ -87,7 +87,7 @@ class WCML_sensei{
87
  $course_id = get_post_meta( $original_post_id, '_lesson_course', true );
88
 
89
  if( $course_id ){
90
- $tr_course_id = icl_object_id( $course_id, 'post_course', false, $language );
91
 
92
  if( !is_null( $tr_course_id ) ){
93
  update_post_meta( $post_id, '_lesson_course', $tr_course_id );
@@ -100,7 +100,7 @@ class WCML_sensei{
100
  $lesson_id = get_post_meta( $original_post_id, '_lesson_prerequisite', true );
101
 
102
  if( $lesson_id ){
103
- $tr_lesson_id = icl_object_id( $lesson_id, 'post_lesson', false, $language );
104
 
105
  if( !is_null( $tr_lesson_id ) ){
106
  update_post_meta( $post_id, '_lesson_prerequisite', $tr_lesson_id );
@@ -114,7 +114,7 @@ class WCML_sensei{
114
  $product_id = get_post_meta( $original_post_id, '_course_woocommerce_product', true );
115
 
116
  if( $product_id ){
117
- $tr_product_id = icl_object_id( $product_id, 'post_product', false, $language );
118
 
119
  if( !is_null( $tr_product_id ) ){
120
  update_post_meta( $post_id, '_course_woocommerce_product', $tr_product_id );
@@ -127,7 +127,7 @@ class WCML_sensei{
127
  $course_id = get_post_meta( $original_post_id, '_course_prerequisite', true );
128
 
129
  if( $course_id ){
130
- $tr_course_id = icl_object_id( $course_id, 'post_course', false, $language );
131
 
132
  if( !is_null( $tr_course_id ) ){
133
  update_post_meta( $post_id, '_course_prerequisite', $tr_course_id );
@@ -154,7 +154,7 @@ class WCML_sensei{
154
 
155
  $trid = $sitepress->get_element_trid( $comment_id, 'comment' );
156
 
157
- $tr_comment_id = icl_object_id( $comment_id, 'comment', false, $translation->language_code );
158
  if ( isset( $args['action'] ) && 'update' == $args['action'] && !is_null( $tr_comment_id ) && get_comment( $tr_comment_id ) ) {
159
  $data['comment_ID'] = $tr_comment_id;
160
  $tr_comment_id = wp_update_comment( $data );
@@ -172,7 +172,7 @@ class WCML_sensei{
172
 
173
  $order_language = get_post_meta( $order->id, 'wpml_language', true );
174
 
175
- $tr_product_id = icl_object_id( $product_id, 'post_'.get_post_type( $product_id ), false, $order_language );
176
 
177
  if( !is_null( $tr_product_id ) ){
178
  return $tr_product_id;
73
  $lesson_id = get_post_meta( $original_post_id, '_quiz_lesson', true );
74
 
75
  if( $lesson_id ){
76
+ $tr_lesson_id = apply_filters( 'translate_object_id', $lesson_id, 'post_lesson', false, $language );
77
 
78
  if( !is_null( $tr_lesson_id ) ){
79
  update_post_meta( $post_id, '_quiz_lesson', $tr_lesson_id );
87
  $course_id = get_post_meta( $original_post_id, '_lesson_course', true );
88
 
89
  if( $course_id ){
90
+ $tr_course_id = apply_filters( 'translate_object_id', $course_id, 'post_course', false, $language );
91
 
92
  if( !is_null( $tr_course_id ) ){
93
  update_post_meta( $post_id, '_lesson_course', $tr_course_id );
100
  $lesson_id = get_post_meta( $original_post_id, '_lesson_prerequisite', true );
101
 
102
  if( $lesson_id ){
103
+ $tr_lesson_id = apply_filters( 'translate_object_id', $lesson_id, 'post_lesson', false, $language );
104
 
105
  if( !is_null( $tr_lesson_id ) ){
106
  update_post_meta( $post_id, '_lesson_prerequisite', $tr_lesson_id );
114
  $product_id = get_post_meta( $original_post_id, '_course_woocommerce_product', true );
115
 
116
  if( $product_id ){
117
+ $tr_product_id = apply_filters( 'translate_object_id', $product_id, 'post_product', false, $language );
118
 
119
  if( !is_null( $tr_product_id ) ){
120
  update_post_meta( $post_id, '_course_woocommerce_product', $tr_product_id );
127
  $course_id = get_post_meta( $original_post_id, '_course_prerequisite', true );
128
 
129
  if( $course_id ){
130
+ $tr_course_id = apply_filters( 'translate_object_id', $course_id, 'post_course', false, $language );
131
 
132
  if( !is_null( $tr_course_id ) ){
133
  update_post_meta( $post_id, '_course_prerequisite', $tr_course_id );
154
 
155
  $trid = $sitepress->get_element_trid( $comment_id, 'comment' );
156
 
157
+ $tr_comment_id = apply_filters( 'translate_object_id', $comment_id, 'comment', false, $translation->language_code );
158
  if ( isset( $args['action'] ) && 'update' == $args['action'] && !is_null( $tr_comment_id ) && get_comment( $tr_comment_id ) ) {
159
  $data['comment_ID'] = $tr_comment_id;
160
  $tr_comment_id = wp_update_comment( $data );
172
 
173
  $order_language = get_post_meta( $order->id, 'wpml_language', true );
174
 
175
+ $tr_product_id = apply_filters( 'translate_object_id', $product_id, 'post_'.get_post_type( $product_id ), false, $order_language );
176
 
177
  if( !is_null( $tr_product_id ) ){
178
  return $tr_product_id;
compatibility/wc_tab_manager.class.php CHANGED
@@ -116,7 +116,7 @@ class WCML_Tab_Manager{
116
  }
117
 
118
  function set_global_tab( $orig_prod_tab, $trnsl_product_tabs, $lang ){
119
- $tr_tab_id = icl_object_id( $orig_prod_tab[ 'id' ], 'wc_product_tab', true, $lang );
120
  $trnsl_product_tabs[ $orig_prod_tab[ 'type' ].'_tab_'.$tr_tab_id ] = array(
121
  'position' => $orig_prod_tab[ 'position' ],
122
  'type' => $orig_prod_tab[ 'type' ],
@@ -130,7 +130,7 @@ class WCML_Tab_Manager{
130
  global $wpdb, $sitepress;
131
 
132
  if( !$tab_id ){
133
- $tr_tab_id = icl_object_id( $orig_prod_tab[ 'id' ], 'wc_product_tab', false, $lang );
134
 
135
  if( !is_null( $tr_tab_id ) ){
136
  $tab_id = $tr_tab_id;
116
  }
117
 
118
  function set_global_tab( $orig_prod_tab, $trnsl_product_tabs, $lang ){
119
+ $tr_tab_id = apply_filters( 'translate_object_id', $orig_prod_tab[ 'id' ], 'wc_product_tab', true, $lang );
120
  $trnsl_product_tabs[ $orig_prod_tab[ 'type' ].'_tab_'.$tr_tab_id ] = array(
121
  'position' => $orig_prod_tab[ 'position' ],
122
  'type' => $orig_prod_tab[ 'type' ],
130
  global $wpdb, $sitepress;
131
 
132
  if( !$tab_id ){
133
+ $tr_tab_id = apply_filters( 'translate_object_id', $orig_prod_tab[ 'id' ], 'wc_product_tab', false, $lang );
134
 
135
  if( !is_null( $tr_tab_id ) ){
136
  $tab_id = $tr_tab_id;
compatibility/wc_variation_swatches_photos.class.php CHANGED
@@ -16,7 +16,7 @@ class WCML_Variation_Swatches_and_Photos{
16
  foreach($atts as $att_name=>$att_opts){
17
  foreach($att_opts['attributes'] as $slug=>$options){
18
  $o_term = get_term_by('slug', $slug, $att_name);
19
- $tr_term_id = icl_object_id($o_term->term_id,$att_name,false,$lang);
20
  if(!is_null($tr_term_id)){
21
  $tr_term = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_term_id, $att_name));
22
  $tr_slug = $tr_term->slug;
@@ -25,7 +25,7 @@ class WCML_Variation_Swatches_and_Photos{
25
  $tr_atts[$att_name]['attributes'][$tr_term->slug]= $atts[$att_name]['attributes'][$slug];
26
  if(isset($options['image'])){
27
  $o_img_id = $options['image'];
28
- $tr_img_id = icl_object_id($o_img_id,'image',false,$lang);
29
  }
30
  unset($tr_atts[$att_name]['attributes'][$slug]);
31
  }
16
  foreach($atts as $att_name=>$att_opts){
17
  foreach($att_opts['attributes'] as $slug=>$options){
18
  $o_term = get_term_by('slug', $slug, $att_name);
19
+ $tr_term_id = apply_filters( 'translate_object_id',$o_term->term_id,$att_name,false,$lang);
20
  if(!is_null($tr_term_id)){
21
  $tr_term = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_term_id, $att_name));
22
  $tr_slug = $tr_term->slug;
25
  $tr_atts[$att_name]['attributes'][$tr_term->slug]= $atts[$att_name]['attributes'][$slug];
26
  if(isset($options['image'])){
27
  $o_img_id = $options['image'];
28
+ $tr_img_id = apply_filters( 'translate_object_id',$o_img_id,'image',false,$lang);
29
  }
30
  unset($tr_atts[$att_name]['attributes'][$slug]);
31
  }
inc/ajax-setup.class.php CHANGED
@@ -80,9 +80,9 @@ class WCML_Ajax_Setup{
80
  'pay_page_id' => get_option('woocommerce_pay_page_id'),
81
  'cart_page_id' => get_option('woocommerce_cart_page_id'));
82
 
83
- $ch_pages['translated_checkout_page_id'] = icl_object_id($ch_pages['checkout_page_id'], 'page', false);
84
- $ch_pages['translated_pay_page_id'] = icl_object_id($ch_pages['pay_page_id'], 'page', false);
85
- $ch_pages['translated_cart_page_id'] = icl_object_id($ch_pages['cart_page_id'], 'page', false);
86
 
87
  }
88
 
80
  'pay_page_id' => get_option('woocommerce_pay_page_id'),
81
  'cart_page_id' => get_option('woocommerce_cart_page_id'));
82
 
83
+ $ch_pages['translated_checkout_page_id'] = apply_filters( 'translate_object_id',$ch_pages['checkout_page_id'], 'page', false);
84
+ $ch_pages['translated_pay_page_id'] = apply_filters( 'translate_object_id',$ch_pages['pay_page_id'], 'page', false);
85
+ $ch_pages['translated_cart_page_id'] = apply_filters( 'translate_object_id',$ch_pages['cart_page_id'], 'page', false);
86
 
87
  }
88
 
inc/compatibility.class.php CHANGED
@@ -83,11 +83,17 @@ class WCML_Compatibility {
83
  }
84
 
85
  // WooCommerce Bookings
86
- if(defined( 'WC_BOOKINGS_VERSION' ) && version_compare( WC_BOOKINGS_VERSION, '1.7.4', '>' )){
87
  require_once WCML_PLUGIN_PATH . '/compatibility/wc_bookings.class.php';
88
  $this->bookings = new WCML_Bookings();
89
  }
90
 
 
 
 
 
 
 
91
  }
92
 
93
  }
83
  }
84
 
85
  // WooCommerce Bookings
86
+ if(defined( 'WC_BOOKINGS_VERSION' ) && version_compare( WC_BOOKINGS_VERSION, '2.0', '>' )){
87
  require_once WCML_PLUGIN_PATH . '/compatibility/wc_bookings.class.php';
88
  $this->bookings = new WCML_Bookings();
89
  }
90
 
91
+ // WooCommerce Checkout Field Editor
92
+ if ( function_exists( 'woocommerce_init_checkout_field_editor' ) ) {
93
+ require_once WCML_PLUGIN_PATH . '/compatibility/wc_checkout_field_editor.class.php';
94
+ $this->checkout_field_editor = new WCML_Checkout_Field_Editor();
95
+ }
96
+
97
  }
98
 
99
  }
inc/dependencies.class.php CHANGED
@@ -163,7 +163,7 @@ class WCML_Dependencies{
163
  }
164
  foreach ($languages as $language) {
165
  if ($language['code'] != $sitepress->get_default_language()) {
166
- $translated_shop_page_id = icl_object_id($shop_page_id, 'page', false, $language['code']);
167
  if (!empty($translated_shop_page_id)) {
168
  $translated_slug = get_post($translated_shop_page_id)->post_name;
169
  if (!empty($translated_slug) && $translated_slug != $slug) {
163
  }
164
  foreach ($languages as $language) {
165
  if ($language['code'] != $sitepress->get_default_language()) {
166
+ $translated_shop_page_id = apply_filters( 'translate_object_id',$shop_page_id, 'page', false, $language['code']);
167
  if (!empty($translated_shop_page_id)) {
168
  $translated_slug = get_post($translated_shop_page_id)->post_name;
169
  if (!empty($translated_slug) && $translated_slug != $slug) {
inc/emails.class.php CHANGED
@@ -52,7 +52,7 @@ class WCML_Emails{
52
  add_filter( 'icl_st_admin_string_return_cached', array( $this, 'admin_string_return_cached' ), 10, 2 );
53
 
54
  add_filter( 'plugin_locale', array( $this, 'set_locale_for_emails' ), 10, 2 );
55
- }
56
  function email_refresh_in_ajax(){
57
  if(isset($_GET['order_id'])){
58
  $this->refresh_email_lang($_GET['order_id']);
@@ -234,7 +234,7 @@ class WCML_Emails{
234
 
235
 
236
  function icl_job_edit_url($link,$job_id){
237
- global $wpdb,$sitepress;
238
 
239
  $trid = $wpdb->get_var($wpdb->prepare("
240
  SELECT t.trid
@@ -252,7 +252,16 @@ class WCML_Emails{
252
  ", $trid ));
253
 
254
  if($original_product_id){
255
- $link = admin_url('admin.php?page=wpml-wcml&tab=products&prid='.$original_product_id);
 
 
 
 
 
 
 
 
 
256
  }
257
  }
258
 
52
  add_filter( 'icl_st_admin_string_return_cached', array( $this, 'admin_string_return_cached' ), 10, 2 );
53
 
54
  add_filter( 'plugin_locale', array( $this, 'set_locale_for_emails' ), 10, 2 );
55
+ }
56
  function email_refresh_in_ajax(){
57
  if(isset($_GET['order_id'])){
58
  $this->refresh_email_lang($_GET['order_id']);
234
 
235
 
236
  function icl_job_edit_url($link,$job_id){
237
+ global $wpdb,$sitepress,$iclTranslationManagement;
238
 
239
  $trid = $wpdb->get_var($wpdb->prepare("
240
  SELECT t.trid
252
  ", $trid ));
253
 
254
  if($original_product_id){
255
+
256
+ $job = $iclTranslationManagement->get_translation_job ( $job_id );
257
+
258
+ $needs_edit = in_array( $job->status, array( ICL_TM_WAITING_FOR_TRANSLATOR, ICL_TM_IN_PROGRESS, ICL_TM_COMPLETE ) );
259
+ $is_editable = $job->translator_id > 0 && $needs_edit;
260
+ if ( $is_editable ) {
261
+ $link = admin_url('admin.php?page=wpml-wcml&tab=products&prid=' . $original_product_id);
262
+ }else{
263
+ $link = admin_url('admin.php?page=wpml-wcml&tab=products&prid=' . $original_product_id.'&job_id='.$job_id);
264
+ }
265
  }
266
  }
267
 
inc/endpoints.class.php CHANGED
@@ -101,7 +101,7 @@ class WCML_Endpoints{
101
 
102
  $current_lang = $sitepress->get_current_language();
103
  $page_lang = $sitepress->get_language_for_element( $post->ID, 'post_page');
104
- if( $current_lang != $page_lang && icl_object_id( $pid, 'page', false, $page_lang ) == $post->ID ){
105
 
106
  $endpoints = WC()->query->get_query_vars();
107
 
101
 
102
  $current_lang = $sitepress->get_current_language();
103
  $page_lang = $sitepress->get_language_for_element( $post->ID, 'post_page');
104
+ if( $current_lang != $page_lang && apply_filters( 'translate_object_id', $pid, 'page', false, $page_lang ) == $post->ID ){
105
 
106
  $endpoints = WC()->query->get_query_vars();
107
 
inc/functions-troubleshooting.class.php CHANGED
@@ -92,7 +92,7 @@ class WCML_Troubleshooting{
92
  foreach ($products_for_one_ajax as $key => $product){
93
  foreach($all_active_lang as $language){
94
  if($language['code'] != $product['lang']){
95
- $tr_product_id = icl_object_id($product['id'],'product',false,$language['code']);
96
 
97
  if(!is_null($tr_product_id)){
98
  $woocommerce_wpml->products->sync_product_variations($product['id'],$tr_product_id,$language['code'],false,true);
@@ -169,7 +169,7 @@ class WCML_Troubleshooting{
169
  foreach($translations as $translation){
170
  if($translation->language_code != $category->language_code ){
171
  update_woocommerce_term_meta( $translation->term_id, 'display_type', $type );
172
- update_woocommerce_term_meta( $translation->term_id, 'thumbnail_id', icl_object_id($thumbnail_id,'attachment',true,$translation->language_code) );
173
  }
174
  }
175
  }
@@ -197,7 +197,7 @@ class WCML_Troubleshooting{
197
  $languages = $sitepress->get_active_languages();
198
  foreach($terms as $term){
199
  foreach($languages as $language){
200
- $tr_id = icl_object_id($term->term_id, $attr, false, $language['code']);
201
 
202
  if(is_null($tr_id)){
203
  $term_args = array();
@@ -205,7 +205,7 @@ class WCML_Troubleshooting{
205
  if ( is_taxonomy_hierarchical( $attr ) ) {
206
  // fix hierarchy
207
  if ( $term->parent ) {
208
- $original_parent_translated = icl_object_id( $term->parent, $attr, false, $language['code'] );
209
  if ( $original_parent_translated ) {
210
  $term_args[ 'parent' ] = $original_parent_translated;
211
  }
92
  foreach ($products_for_one_ajax as $key => $product){
93
  foreach($all_active_lang as $language){
94
  if($language['code'] != $product['lang']){
95
+ $tr_product_id = apply_filters( 'translate_object_id',$product['id'],'product',false,$language['code']);
96
 
97
  if(!is_null($tr_product_id)){
98
  $woocommerce_wpml->products->sync_product_variations($product['id'],$tr_product_id,$language['code'],false,true);
169
  foreach($translations as $translation){
170
  if($translation->language_code != $category->language_code ){
171
  update_woocommerce_term_meta( $translation->term_id, 'display_type', $type );
172
+ update_woocommerce_term_meta( $translation->term_id, 'thumbnail_id', apply_filters( 'translate_object_id',$thumbnail_id,'attachment',true,$translation->language_code) );
173
  }
174
  }
175
  }
197
  $languages = $sitepress->get_active_languages();
198
  foreach($terms as $term){
199
  foreach($languages as $language){
200
+ $tr_id = apply_filters( 'translate_object_id',$term->term_id, $attr, false, $language['code']);
201
 
202
  if(is_null($tr_id)){
203
  $term_args = array();
205
  if ( is_taxonomy_hierarchical( $attr ) ) {
206
  // fix hierarchy
207
  if ( $term->parent ) {
208
+ $original_parent_translated = apply_filters( 'translate_object_id', $term->parent, $attr, false, $language['code'] );
209
  if ( $original_parent_translated ) {
210
  $term_args[ 'parent' ] = $original_parent_translated;
211
  }
inc/missing-php-functions.php CHANGED
@@ -35,9 +35,9 @@ if (get_magic_quotes_gpc()) {
35
  /* PHP 5.3 - end */
36
 
37
  //WPML
38
- add_action('plugins_loaded', 'wcml_check_wpml_is_ajax');
39
 
40
- function wcml_check_wpml_is_ajax(){
41
  if(defined('ICL_SITEPRESS_VERSION') && version_compare(preg_replace('#-(.+)$#', '', ICL_SITEPRESS_VERSION), '3.1.5', '<')){
42
 
43
  function wpml_is_ajax() {
@@ -49,9 +49,15 @@ function wcml_check_wpml_is_ajax(){
49
  }
50
 
51
  }
 
 
 
 
52
 
53
 
54
  }
55
 
 
 
56
 
57
  ?>
35
  /* PHP 5.3 - end */
36
 
37
  //WPML
38
+ add_action('plugins_loaded', 'wcml_check_wpml_functions');
39
 
40
+ function wcml_check_wpml_functions(){
41
  if(defined('ICL_SITEPRESS_VERSION') && version_compare(preg_replace('#-(.+)$#', '', ICL_SITEPRESS_VERSION), '3.1.5', '<')){
42
 
43
  function wpml_is_ajax() {
49
  }
50
 
51
  }
52
+
53
+ if( !has_filter( 'translate_object_id' ) ){
54
+ add_filter( 'translate_object_id', 'icl_object_id', 10, 4 );
55
+ }
56
 
57
 
58
  }
59
 
60
+
61
+
62
 
63
  ?>
inc/multi-currency-support.class.php CHANGED
@@ -9,19 +9,19 @@ class WCML_Multi_Currency_Support{
9
  private $exchange_rates = array();
10
 
11
  function __construct(){
12
-
13
  add_action('init', array($this, 'init'), 5);
14
  $this->install();
15
 
16
  $this->init_currencies();
17
 
18
- if(is_ajax()){
19
  add_action('wp_ajax_nopriv_wcml_switch_currency', array($this, 'switch_currency'));
20
  add_action('wp_ajax_wcml_switch_currency', array($this, 'switch_currency'));
21
 
22
  add_action('wp_ajax_legacy_update_custom_rates', array($this, 'legacy_update_custom_rates'));
23
  add_action('wp_ajax_legacy_remove_custom_rates', array($this, 'legacy_remove_custom_rates'));
24
-
25
  add_action('wp_ajax_wcml_new_currency', array($this,'add_currency'));
26
  add_action('wp_ajax_wcml_save_currency', array($this,'save_currency'));
27
  add_action('wp_ajax_wcml_delete_currency', array($this,'delete_currency'));
@@ -265,7 +265,7 @@ class WCML_Multi_Currency_Support{
265
  $settings['currency_options'][$currency_code]['languages'][$language['code']] = 1;
266
  }
267
  }
268
- $settings['currency_options'][$currency_code]['rate'] = (double) filter_input( INPUT_POST, 'currency_value', FILTER_SANITIZE_NUMBER_FLOAT );
269
  $settings['currency_options'][$currency_code]['updated'] = date('Y-m-d H:i:s');
270
 
271
  $wc_currency = get_option('woocommerce_currency');
@@ -291,7 +291,7 @@ class WCML_Multi_Currency_Support{
291
  ob_end_clean();
292
 
293
  }
294
-
295
  echo json_encode($return);
296
  die();
297
  }
@@ -716,7 +716,7 @@ class WCML_Multi_Currency_Support{
716
 
717
  // exception for products migrated from before WCML 3.1 with independent prices
718
  // legacy prior 3.1
719
- $original_object_id = icl_object_id($object_id, get_post_type($object_id), false, $sitepress->get_default_language());
720
  $ccr = get_post_meta($original_object_id, '_custom_conversion_rate', true);
721
  if(in_array($meta_key, array('_price', '_regular_price', '_sale_price')) && !empty($ccr) && isset($ccr[$meta_key][$this->get_client_currency()])){
722
  $price_original = get_post_meta($original_object_id, $meta_key, $single);
@@ -1079,7 +1079,7 @@ class WCML_Multi_Currency_Support{
1079
  }
1080
 
1081
  function get_client_currency(){
1082
- global $woocommerce, $woocommerce_wpml, $sitepress, $wp_query;
1083
 
1084
  $default_currencies = $woocommerce_wpml->settings['default_currencies'];
1085
  $current_language = $sitepress->get_current_language();
@@ -1093,12 +1093,20 @@ class WCML_Multi_Currency_Support{
1093
  $current_product_id = wc_get_product()->id;
1094
  $original_product_language = $woocommerce_wpml->products->get_original_product_language( $current_product_id );
1095
 
1096
- if( !get_post_meta( icl_object_id( $current_product_id , get_post_type( $current_product_id ), true, $original_product_language ), '_wcml_custom_prices_status', true ) ){
1097
  $this->client_currency = get_option('woocommerce_currency');
1098
  }
1099
 
1100
  }
1101
 
 
 
 
 
 
 
 
 
1102
  if(isset($_POST['action']) && $_POST['action'] == 'wcml_switch_currency' && !empty($_POST['currency'])){
1103
  $this->client_currency = filter_input( INPUT_POST, 'currency', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
1104
  }
@@ -1293,7 +1301,7 @@ class WCML_Multi_Currency_Support{
1293
  $current_product_id = wc_get_product()->id;
1294
  $original_product_language = $woocommerce_wpml->products->get_original_product_language( $current_product_id );
1295
 
1296
- if( !get_post_meta( icl_object_id( $current_product_id , get_post_type( $current_product_id ), true, $original_product_language ), '_wcml_custom_prices_status', true ) ){
1297
  return '';
1298
  }
1299
  }
9
  private $exchange_rates = array();
10
 
11
  function __construct(){
12
+
13
  add_action('init', array($this, 'init'), 5);
14
  $this->install();
15
 
16
  $this->init_currencies();
17
 
18
+ if(is_ajax()){
19
  add_action('wp_ajax_nopriv_wcml_switch_currency', array($this, 'switch_currency'));
20
  add_action('wp_ajax_wcml_switch_currency', array($this, 'switch_currency'));
21
 
22
  add_action('wp_ajax_legacy_update_custom_rates', array($this, 'legacy_update_custom_rates'));
23
  add_action('wp_ajax_legacy_remove_custom_rates', array($this, 'legacy_remove_custom_rates'));
24
+
25
  add_action('wp_ajax_wcml_new_currency', array($this,'add_currency'));
26
  add_action('wp_ajax_wcml_save_currency', array($this,'save_currency'));
27
  add_action('wp_ajax_wcml_delete_currency', array($this,'delete_currency'));
265
  $settings['currency_options'][$currency_code]['languages'][$language['code']] = 1;
266
  }
267
  }
268
+ $settings['currency_options'][$currency_code]['rate'] = (double) filter_input( INPUT_POST, 'currency_value', FILTER_VALIDATE_FLOAT , FILTER_FLAG_ALLOW_FRACTION);
269
  $settings['currency_options'][$currency_code]['updated'] = date('Y-m-d H:i:s');
270
 
271
  $wc_currency = get_option('woocommerce_currency');
291
  ob_end_clean();
292
 
293
  }
294
+
295
  echo json_encode($return);
296
  die();
297
  }
716
 
717
  // exception for products migrated from before WCML 3.1 with independent prices
718
  // legacy prior 3.1
719
+ $original_object_id = apply_filters( 'translate_object_id',$object_id, get_post_type($object_id), false, $sitepress->get_default_language());
720
  $ccr = get_post_meta($original_object_id, '_custom_conversion_rate', true);
721
  if(in_array($meta_key, array('_price', '_regular_price', '_sale_price')) && !empty($ccr) && isset($ccr[$meta_key][$this->get_client_currency()])){
722
  $price_original = get_post_meta($original_object_id, $meta_key, $single);
1079
  }
1080
 
1081
  function get_client_currency(){
1082
+ global $woocommerce, $woocommerce_wpml, $sitepress, $wp_query, $wpdb;
1083
 
1084
  $default_currencies = $woocommerce_wpml->settings['default_currencies'];
1085
  $current_language = $sitepress->get_current_language();
1093
  $current_product_id = wc_get_product()->id;
1094
  $original_product_language = $woocommerce_wpml->products->get_original_product_language( $current_product_id );
1095
 
1096
+ if( !get_post_meta( apply_filters( 'translate_object_id', $current_product_id , get_post_type( $current_product_id ), true, $original_product_language ), '_wcml_custom_prices_status', true ) ){
1097
  $this->client_currency = get_option('woocommerce_currency');
1098
  }
1099
 
1100
  }
1101
 
1102
+ if( isset($_GET['pay_for_order']) && $_GET['pay_for_order'] == true && isset($_GET['key']) ){
1103
+ $order_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_order_key' AND meta_value = %s", $_GET['key']));
1104
+ if( $order_id ){
1105
+ $this->client_currency = get_post_meta( $order_id, '_order_currency', true );
1106
+ }
1107
+ }
1108
+
1109
+
1110
  if(isset($_POST['action']) && $_POST['action'] == 'wcml_switch_currency' && !empty($_POST['currency'])){
1111
  $this->client_currency = filter_input( INPUT_POST, 'currency', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
1112
  }
1301
  $current_product_id = wc_get_product()->id;
1302
  $original_product_language = $woocommerce_wpml->products->get_original_product_language( $current_product_id );
1303
 
1304
+ if( !get_post_meta( apply_filters( 'translate_object_id', $current_product_id , get_post_type( $current_product_id ), true, $original_product_language ), '_wcml_custom_prices_status', true ) ){
1305
  return '';
1306
  }
1307
  }
inc/multi-currency.class.php CHANGED
@@ -85,7 +85,7 @@ class WCML_WC_MultiCurrency{
85
  //dashboard status screen
86
  if(is_admin() && ( current_user_can( 'view_woocommerce_reports' ) || current_user_can( 'manage_woocommerce' ) || current_user_can( 'publish_shop_orders' ) ) ){
87
  add_action( 'init', array( $this, 'set_dashboard_currency') );
88
- add_action( 'wp_dashboard_setup', array( $this, 'dashboard_currency_dropdown' ) );
89
 
90
  add_filter( 'woocommerce_dashboard_status_widget_sales_query', array( $this, 'filter_dashboard_status_widget_sales_query' ) );
91
  add_filter( 'woocommerce_dashboard_status_widget_top_seller_query', array( $this, 'filter_dashboard_status_widget_sales_query' ) );
85
  //dashboard status screen
86
  if(is_admin() && ( current_user_can( 'view_woocommerce_reports' ) || current_user_can( 'manage_woocommerce' ) || current_user_can( 'publish_shop_orders' ) ) ){
87
  add_action( 'init', array( $this, 'set_dashboard_currency') );
88
+ add_action( 'woocommerce_after_dashboard_status_widget', array( $this, 'dashboard_currency_dropdown' ) );
89
 
90
  add_filter( 'woocommerce_dashboard_status_widget_sales_query', array( $this, 'filter_dashboard_status_widget_sales_query' ) );
91
  add_filter( 'woocommerce_dashboard_status_widget_top_seller_query', array( $this, 'filter_dashboard_status_widget_sales_query' ) );
inc/orders.class.php CHANGED
@@ -61,11 +61,14 @@ class WCML_Orders{
61
  }
62
 
63
  function get_filtered_comments($comments){
64
- global $sitepress_settings, $wpdb, $current_user;
65
-
66
- if(!empty($current_user) && !is_null($current_user->data)){
 
 
 
67
 
68
- $user_language = get_user_meta( $current_user->data->ID, 'icl_admin_language', true );
69
 
70
  foreach($comments as $key=>$comment){
71
 
@@ -95,14 +98,14 @@ class WCML_Orders{
95
  foreach($items as $index=>$item){
96
  foreach($item as $key=>$item_data){
97
  if($key == 'product_id'){
98
- $tr_product_id = icl_object_id($item_data,'product',false,$sitepress_settings['admin_default_language']);
99
  if(!is_null($tr_product_id)){
100
  $items[$index][$key] = $tr_product_id;
101
  $items[$index]['name'] = get_the_title($tr_product_id);
102
  }
103
  }
104
  if($key == 'variation_id'){
105
- $tr_variation_id = icl_object_id($item_data,'product_variation',false,$sitepress_settings['admin_default_language']);
106
  if(!is_null($tr_variation_id)){
107
  $items[$index][$key] = $tr_variation_id;
108
  }
@@ -112,7 +115,7 @@ class WCML_Orders{
112
  global $wpdb;
113
  //attr is taxonomy
114
  $default_term = get_term_by('slug', $item_data, $key);
115
- $tr_id = icl_object_id($default_term->term_id, $key, false, $sitepress_settings['admin_default_language']);
116
 
117
  if(!is_null($tr_id)){
118
  $translated_slug = $wpdb->get_var($wpdb->prepare("
@@ -163,7 +166,7 @@ class WCML_Orders{
163
  if(!in_array('order', $parameters)) $parameters[] = 'order';
164
  if(!in_array('key', $parameters)) $parameters[] = 'key';
165
  }
166
-
167
  return $parameters;
168
  }
169
 
61
  }
62
 
63
  function get_filtered_comments($comments){
64
+
65
+ $user_id = get_current_user_id();
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
 
98
  foreach($items as $index=>$item){
99
  foreach($item as $key=>$item_data){
100
  if($key == 'product_id'){
101
+ $tr_product_id = apply_filters( 'translate_object_id',$item_data,'product',false,$sitepress_settings['admin_default_language']);
102
  if(!is_null($tr_product_id)){
103
  $items[$index][$key] = $tr_product_id;
104
  $items[$index]['name'] = get_the_title($tr_product_id);
105
  }
106
  }
107
  if($key == 'variation_id'){
108
+ $tr_variation_id = apply_filters( 'translate_object_id',$item_data,'product_variation',false,$sitepress_settings['admin_default_language']);
109
  if(!is_null($tr_variation_id)){
110
  $items[$index][$key] = $tr_variation_id;
111
  }
115
  global $wpdb;
116
  //attr is taxonomy
117
  $default_term = get_term_by('slug', $item_data, $key);
118
+ $tr_id = apply_filters( 'translate_object_id',$default_term->term_id, $key, false, $sitepress_settings['admin_default_language']);
119
 
120
  if(!is_null($tr_id)){
121
  $translated_slug = $wpdb->get_var($wpdb->prepare("
166
  if(!in_array('order', $parameters)) $parameters[] = 'order';
167
  if(!in_array('key', $parameters)) $parameters[] = 'key';
168
  }
169
+
170
  return $parameters;
171
  }
172
 
inc/products.class.php CHANGED
@@ -48,6 +48,8 @@ class WCML_Products{
48
  add_action( 'woocommerce_duplicate_product', array( $this, 'woocommerce_duplicate_product' ), 10, 2 );
49
 
50
  add_filter( 'post_row_actions', array( $this, 'filter_product_actions' ), 10, 2 );
 
 
51
 
52
  }else{
53
  add_filter('woocommerce_json_search_found_products', array($this, 'filter_found_products_by_language'));
@@ -59,7 +61,7 @@ class WCML_Products{
59
  add_action( 'woocommerce_email', array( $this, 'woocommerce_email_refresh_text_domain' ) );
60
  add_action( 'wp_ajax_woocommerce_update_shipping_method', array( $this, 'wcml_refresh_text_domain' ), 9 );
61
  add_action( 'wp_ajax_nopriv_woocommerce_update_shipping_method', array( $this, 'wcml_refresh_text_domain' ), 9 );
62
- add_filter( 'wpml_link_to_translation', array( $this, '_filter_link_to_translation' ) );
63
 
64
  add_filter( 'woocommerce_upsell_crosssell_search_products', array( $this, 'filter_woocommerce_upsell_crosssell_posts_by_language' ) );
65
 
@@ -116,8 +118,9 @@ class WCML_Products{
116
  add_filter( 'icl_wpml_config_array', array( $this, 'set_taxonomies_config' ) );
117
 
118
  add_filter( 'manage_product_posts_columns', array( $this, 'add_languages_column' ), 100 );
 
119
  }
120
-
121
  function hide_multilingual_content_setup_box(){
122
  remove_meta_box('icl_div_config', convert_to_screen('shop_order'), 'normal');
123
  remove_meta_box('icl_div_config', convert_to_screen('shop_coupon'), 'normal');
@@ -416,7 +419,7 @@ class WCML_Products{
416
  die();
417
  }
418
 
419
- global $woocommerce_wpml,$sitepress, $wpdb,$sitepress_settings;
420
 
421
  //get post values
422
  $data = array();
@@ -424,6 +427,7 @@ class WCML_Products{
424
  parse_str($records, $data);
425
 
426
  $original_product_id = filter_input( INPUT_POST, 'product_id', FILTER_SANITIZE_NUMBER_INT );
 
427
  $language = filter_input( INPUT_POST, 'language', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
428
  $orig_product = get_post($original_product_id);
429
 
@@ -435,7 +439,7 @@ class WCML_Products{
435
  $languages = $sitepress->get_active_languages();
436
 
437
  $product_trid = $sitepress->get_element_trid($original_product_id, 'post_' . $orig_product->post_type);
438
- $tr_product_id = icl_object_id($original_product_id, 'product', false, $language);
439
 
440
  if( get_magic_quotes_gpc() ){
441
  foreach( $data as $key => $data_item ){
@@ -457,7 +461,7 @@ class WCML_Products{
457
  $args['menu_order'] = $orig_product->menu_order;
458
  $args['ping_status'] = $orig_product->ping_status;
459
  $args['comment_status'] = $orig_product->comment_status;
460
- $product_parent = icl_object_id($orig_product->post_parent, 'product', false, $language);
461
  $args['post_parent'] = is_null($product_parent) ? 0 : $product_parent;
462
  $_POST['to_lang'] = $language;
463
 
@@ -467,7 +471,35 @@ class WCML_Products{
467
 
468
  $tr_product_id = wp_insert_post($args);
469
 
470
- $sitepress->set_element_language_details($tr_product_id, 'post_' . $orig_product->post_type, $product_trid, $language);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
471
 
472
  $this->duplicate_product_post_meta($original_product_id, $tr_product_id, $data, true);
473
 
@@ -483,7 +515,7 @@ class WCML_Products{
483
  $args['post_status'] = $orig_product->post_status;
484
  $args['ping_status'] = $orig_product->ping_status;
485
  $args['comment_status'] = $orig_product->comment_status;
486
- $product_parent = icl_object_id($orig_product->post_parent, 'product', false, $language);
487
  $args['post_parent'] = is_null($product_parent) ? 0 : $product_parent;
488
  $_POST['to_lang'] = $language;
489
 
@@ -493,9 +525,12 @@ class WCML_Products{
493
  if(isset( $data['post_name_' . $language]) && $post_name != $data['post_name_' . $language]){
494
  // update post_name
495
  // need set POST variable ( WPML used them when filtered this function)
 
 
496
  $_POST[ 'new_title' ] = $data['title_' . $language];
497
- $_POST[ 'new_slug' ] = $data['post_name_' . $language];
498
- $new_slug = wp_unique_post_slug( $data['post_name_' . $language], $tr_product_id, $orig_product->post_status, $orig_product->post_type, $args['post_parent']);
 
499
  }
500
 
501
  $sitepress->set_element_language_details($tr_product_id, 'post_' . $orig_product->post_type, $product_trid, $language);
@@ -509,13 +544,26 @@ class WCML_Products{
509
  $orig_product_attrs = $this->get_product_atributes($original_product_id);
510
  $trnsl_labels = get_option('wcml_custom_attr_translations');
511
  foreach ($orig_product_attrs as $key => $orig_product_attr) {
 
 
 
 
 
 
 
 
 
 
 
512
  if (isset($data[$key . '_' . $language]) && !empty($data[$key . '_' . $language]) && !is_array($data[$key . '_' . $language])) {
513
  //get translation values from $data
514
- $trnsl_labels[$language][$key] = $data[$key . '_name_' . $language];
515
- $orig_product_attrs[$key]['value'] = $data[$key . '_' . $language];
 
516
  } else {
517
- $orig_product_attrs[$key]['value'] = '';
518
  }
 
519
  }
520
  update_option('wcml_custom_attr_translations', $trnsl_labels);
521
 
@@ -568,7 +616,7 @@ class WCML_Products{
568
  ob_start();
569
  $return = array();
570
 
571
- $this->get_translation_statuses($translations,$languages,isset($_POST['slang']) && $_POST['slang'] != 'all'?$_POST['slang']:false, $product_trid);
572
  $return['status'] = ob_get_clean();
573
 
574
 
@@ -632,7 +680,7 @@ class WCML_Products{
632
 
633
  function is_variable_product($product_id){
634
  global $wpdb;
635
- $get_variation_term_taxonomy_ids = $wpdb->get_var("SELECT tt.term_taxonomy_id FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE t.name = 'variable'");
636
  $get_variation_term_taxonomy_ids = apply_filters('wcml_variation_term_taxonomy_ids',(array)$get_variation_term_taxonomy_ids);
637
 
638
  $is_variable_product = $wpdb->get_var($wpdb->prepare("SELECT count(object_id) FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN (".join(',',$get_variation_term_taxonomy_ids).")",$product_id));
@@ -665,7 +713,7 @@ class WCML_Products{
665
  continue;
666
  }
667
 
668
- $tr_id = icl_object_id($term->term_id, $taxonomy, false, $lang);
669
  if(!is_null($tr_id)){
670
  // not using get_term - unfiltered get_term
671
  $translated_term = $wpdb->get_row($wpdb->prepare("
@@ -822,7 +870,7 @@ class WCML_Products{
822
  $duplicated_ids = '';
823
  if (!$translation->original) {
824
  foreach($gallery_ids as $image_id){
825
- $duplicated_id = icl_object_id($image_id,'attachment',false,$translation->language_code);
826
  if(!is_null($duplicated_id)){
827
  $duplicated_ids .= $duplicated_id.',';
828
  }
@@ -833,43 +881,47 @@ class WCML_Products{
833
  }
834
  }
835
 
836
- function get_translation_flags($active_languages,$slang = false){
837
  global $sitepress;
838
 
839
  foreach($active_languages as $language){
840
- if (!$slang || ( ($slang != $language['code']) && (current_user_can('wpml_operate_woocommerce_multilingual') || wpml_check_user_is_translator($slang,$language['code'])) && (!isset($_POST['translation_status_lang']) || (isset($_POST['translation_status_lang']) && ($_POST['translation_status_lang'] == $language['code']) || $_POST['translation_status_lang']=='')))){
 
 
 
841
  echo '<img src="'. ICL_PLUGIN_URL .'/res/flags/'. $language['code'] .'.png" width="18" height="12" class="flag_img" />';
 
842
  }
843
  }
844
  }
845
 
846
 
847
- function get_translation_statuses($product_translations,$active_languages,$slang = false, $trid = false ){
848
  global $wpdb,$sitepress;
849
 
850
  foreach ($active_languages as $language) {
851
- if(!$slang && isset($product_translations[$language['code']]) && $product_translations[$language['code']]->original){
 
 
852
  $alt = __('Original language','wpml-wcml');
853
  echo '<i title="'. $alt .'" class="stat_img icon-minus"></i>';
854
- }elseif( $trid && !current_user_can('wpml_operate_woocommerce_multilingual') && !$this->user_can_translate_product( $trid, $language['code'] ) && $slang != $language['code'] ){
855
- $alt = __('No Permissions','wpml-wcml');
856
- echo '<i title="'. $alt .'" class="stat_img"></i>';
857
- }elseif ($slang != $language['code'] && (current_user_can('wpml_operate_woocommerce_multilingual') || wpml_check_user_is_translator($slang,$language['code'])) && (!isset($_POST['translation_status_lang']) || (isset($_POST['translation_status_lang']) && ($_POST['translation_status_lang'] == $language['code']) || $_POST['translation_status_lang']==''))) {
858
  if (isset($product_translations[$language['code']])) {
859
  $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));
860
  if(!$tr_status){
861
  $alt = __('Not translated','wpml-wcml');
862
  echo '<i title="'. $alt .'" class="stat_img icon-warning-sign"></i>';
863
  }elseif($tr_status->needs_update){
864
- $alt = __('Not translated - needs update','wpml-wcml');
865
- echo '<i title="'. $alt .'" class="stat_img icon-repeat"></i>';
866
- }elseif($tr_status->status != ICL_TM_COMPLETE && $tr_status->status != ICL_TM_DUPLICATE) {
867
- $alt = __('In progress','wpml-wcml');
868
- echo '<i title="'. $alt .'" class="stat_img icon-spinner"></i>';
869
- }elseif($tr_status->status == ICL_TM_COMPLETE || $tr_status->status == ICL_TM_DUPLICATE){
870
- $alt = __('Complete','wpml-wcml');
871
- echo '<i title="'. $alt .'" class="stat_img icon-ok"></i>';
872
- }
873
  } else {
874
  $alt = __('Not translated','wpml-wcml');
875
  echo '<i title="'. $alt .'" class="stat_img icon-warning-sign"></i>';
@@ -1013,7 +1065,7 @@ class WCML_Products{
1013
  $tax_sync = array();
1014
  foreach ( $terms as $term ) {
1015
  if ( $sitepress->is_translated_taxonomy($tt) ) {
1016
- $term_id = icl_object_id( $term->term_id, $tt, false, $lang );
1017
  } else {
1018
  $term_id = $term->term_id;
1019
  }
@@ -1073,47 +1125,55 @@ class WCML_Products{
1073
  $meta_key = $post_meta->meta_key;
1074
  $meta_value = maybe_unserialize($post_meta->meta_value);
1075
 
1076
- // adjust the global attribute slug in the custom field
1077
- $attid = null;
1078
-
1079
- if (substr($meta_key, 0, 10) == 'attribute_') {
1080
- $tax = substr($meta_key, 10);
1081
-
1082
- if (taxonomy_exists($tax)) {
1083
- $att_term = get_term_by('slug', $meta_value, $tax);
1084
- $attid = $att_term?$att_term->term_taxonomy_id:false;
1085
- if($attid){
1086
- $trid = $sitepress->get_element_trid($attid, 'tax_' . $tax);
1087
- if ($trid) {
1088
- $translations = $sitepress->get_element_translations($trid,'tax_' . $tax);
1089
- if (isset($translations[$lang])) {
1090
- $meta_value = $wpdb->get_var($wpdb->prepare("SELECT slug FROM $wpdb->terms WHERE term_id = %s", $translations[$lang]->term_id));
1091
- }else{
1092
- $meta_value = $meta_value.'_'.$lang;
 
 
 
 
1093
  }
1094
  }
1095
- }
1096
- }else{
1097
- if(isset($original_product_attr[$tax])){
1098
- if(isset($tr_product_attr[$tax])){
1099
- $values_arrs = array_map('trim', explode('|',$original_product_attr[$tax]['value']));
1100
- $values_arrs_tr = array_map('trim',explode('|',$tr_product_attr[$tax]['value']));
1101
- foreach($values_arrs as $key=>$value){
1102
- $value_sanitized = sanitize_title($value);
1103
- if($value_sanitized == urldecode($meta_value) && isset($values_arrs_tr[$key])){
1104
- $meta_value = $values_arrs_tr[$key];
 
 
 
 
1105
  }
 
 
1106
  }
1107
- }else{
1108
- $meta_value = $meta_value.'_'.$lang;
1109
  }
1110
 
 
 
1111
  }
1112
  }
1113
- }
1114
- // update current post variations meta
1115
 
1116
- if ((substr($meta_key, 0, 10) == 'attribute_' || isset($cf[$meta_key]) && $cf[$meta_key] == 1)) {
1117
  update_post_meta($current_post_variation_ids[$dp_key], $meta_key, $meta_value);
1118
  }
1119
 
@@ -1127,6 +1187,19 @@ class WCML_Products{
1127
  }
1128
  }
1129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1130
  function sync_linked_products($product_id,$tr_product_id,$lang){
1131
  global $wpdb;
1132
 
@@ -1135,7 +1208,7 @@ class WCML_Products{
1135
  $trnsl_up_sells = array();
1136
  if($original_up_sells) {
1137
  foreach ($original_up_sells as $original_up_sell_product) {
1138
- $trnsl_up_sells[] = icl_object_id($original_up_sell_product, get_post_type($original_up_sell_product), false, $lang);
1139
  }
1140
  }
1141
 
@@ -1146,7 +1219,7 @@ class WCML_Products{
1146
  $trnsl_cross_sells = array();
1147
  if( $original_cross_sells )
1148
  foreach( $original_cross_sells as $original_cross_sell_product ){
1149
- $trnsl_cross_sells[] = icl_object_id( $original_cross_sell_product, get_post_type( $original_cross_sell_product ), false, $lang );
1150
  }
1151
  update_post_meta( $tr_product_id, '_crosssell_ids', $trnsl_cross_sells );
1152
 
@@ -1156,7 +1229,7 @@ class WCML_Products{
1156
  $grouped_ids = get_posts( 'post_parent=' . $product_id . '&post_type=product&orderby=menu_order&order=ASC&fields=ids&post_status=publish&numberposts=-1' );
1157
  $trnsl_grouped_ids = array();
1158
  foreach($grouped_ids as $id){
1159
- $tr_id = icl_object_id($id,get_post_type($id),false,$lang);
1160
  if(!is_null($tr_id)){
1161
  $trnsl_grouped_ids[] =$tr_id;
1162
  $wpdb->update(
@@ -1170,7 +1243,7 @@ class WCML_Products{
1170
  }
1171
  update_option('_transient_wc_product_children_ids_'.$tr_product_id,$trnsl_grouped_ids);
1172
  }elseif($parent_id && get_post_type($product_id) == 'product'){
1173
- $tr_parent_id = icl_object_id($parent_id,'product',false,$lang);
1174
  if(!is_null($tr_parent_id)){
1175
  $grouped_ids = maybe_unserialize(get_option('_transient_wc_product_children_ids_'.$tr_parent_id));
1176
  if($grouped_ids && !in_array($tr_product_id,$grouped_ids)){
@@ -1185,7 +1258,7 @@ class WCML_Products{
1185
  function sync_thumbnail_id($orig_post_id,$trnsl_post_id,$lang){
1186
  if(defined('WPML_MEDIA_VERSION')){
1187
  $thumbnail_id = get_post_meta($orig_post_id,'_thumbnail_id',true);
1188
- $trnsl_thumbnail = icl_object_id($thumbnail_id,'attachment',false,$lang);
1189
  if(!is_null($trnsl_thumbnail)){
1190
  update_post_meta($trnsl_post_id,'_thumbnail_id',$trnsl_thumbnail);
1191
  }else{
@@ -1232,7 +1305,7 @@ class WCML_Products{
1232
  if($woocommerce_wpml->settings['trnsl_interface'] && $pagenow == 'post.php' && !is_ajax() && isset($_GET['post']) && !$this->is_original_product($_GET['post']) && get_post_type($_GET['post'])=='product'){
1233
  if((!isset($_GET['action'])) || (isset($_GET['action']) && !in_array($_GET['action'],array('trash','delete')))){
1234
  $orig_language = $this->get_original_product_language($_GET['post']);
1235
- $prid = icl_object_id($_GET['post'],'product',true,$orig_language);
1236
  wp_redirect(admin_url('admin.php?page=wpml-wcml&tab=products&prid='.$prid)); exit;
1237
  }
1238
  }
@@ -1411,7 +1484,7 @@ class WCML_Products{
1411
  global $pagenow, $sitepress, $sitepress_settings,$woocommerce_wpml;
1412
  $original_language = $this->get_original_product_language($post_id);
1413
  $current_language = $sitepress->get_current_language();
1414
- $duplicated_post_id = icl_object_id($post_id, 'product', false, $original_language);
1415
  $wpml_media_options = maybe_unserialize(get_option('_wpml_media'));
1416
 
1417
  if($wpml_media_options['new_content_settings']['duplicate_media']){
@@ -1478,11 +1551,17 @@ class WCML_Products{
1478
  //save custom prices
1479
  $nonce = filter_input( INPUT_POST, '_wcml_custom_prices_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
1480
 
1481
- if(isset( $_POST['_wcml_custom_prices'][$post_id]) && isset( $nonce ) && wp_verify_nonce( $nonce, 'wcml_save_custom_prices' )){
 
 
 
 
 
 
1482
 
1483
- update_post_meta($post_id,'_wcml_custom_prices_status',$_POST['_wcml_custom_prices'][$post_id]);
1484
 
1485
- if( $_POST['_wcml_custom_prices'][$post_id] == 1){
1486
 
1487
  $currencies = $woocommerce_wpml->multi_currency_support->get_currencies();
1488
 
@@ -1540,7 +1619,7 @@ class WCML_Products{
1540
  update_post_meta($post_id, '_product_attributes', $orig_product_attrs);
1541
 
1542
  // synchronize post variations
1543
- $this->sync_product_variations($duplicated_post_id,$post_id,$lang);
1544
  $this->sync_linked_products($duplicated_post_id,$post_id,$lang);
1545
  }
1546
 
@@ -1549,18 +1628,28 @@ class WCML_Products{
1549
 
1550
  //sync product parent & post_status
1551
  function sync_status_and_parent( $duplicated_post_id, $post_id, $lang ){
1552
- global $wpdb;
 
 
 
 
 
 
 
 
 
 
 
 
 
1553
 
1554
- $tr_parent_id = icl_object_id( wp_get_post_parent_id( $duplicated_post_id ), 'product', false, $lang );
1555
  $wpdb->update(
1556
  $wpdb->posts,
1557
- array(
1558
- 'post_parent' => is_null( $tr_parent_id )? 0 : $tr_parent_id,
1559
- 'post_status' => get_post_status( $duplicated_post_id ),
1560
- 'comment_status' => get_post( $duplicated_post_id )->comment_status
1561
- ),
1562
  array( 'id' => $post_id )
1563
  );
 
 
1564
  }
1565
 
1566
  function update_custom_prices($post_id,$regular_price,$sale_price,$schedule,$date_from,$date_to,$code){
@@ -1683,7 +1772,7 @@ class WCML_Products{
1683
  if (substr($attribute, 0, 3) == 'pa_') {
1684
  //attr is taxonomy
1685
  $default_term = get_term_by('slug', $default_term_slug, $attribute);
1686
- $tr_id = icl_object_id($default_term->term_id, $attribute, false, $lang);
1687
 
1688
  if($tr_id){
1689
  $translated_term = $wpdb->get_row($wpdb->prepare("
@@ -1724,7 +1813,7 @@ class WCML_Products{
1724
  * get attribute translation
1725
  */
1726
  function get_custom_attribute_translation($product_id, $attribute_key, $attribute, $lang_code) {
1727
- $tr_post_id = icl_object_id($product_id, 'product', false, $lang_code);
1728
  $transl = array();
1729
  if ($tr_post_id) {
1730
  if (!$attribute['is_taxonomy']) {
@@ -1863,7 +1952,7 @@ class WCML_Products{
1863
  function get_product_content_translation($product_id,$content,$lang_code){
1864
  global $woocommerce_wpml;
1865
 
1866
- $tr_post_id = icl_object_id($product_id, 'product', false, $lang_code);
1867
 
1868
  if (is_null($tr_post_id) && (in_array($content, array('title','content','excerpt','variations','images'))))
1869
  return false;
@@ -1936,7 +2025,7 @@ class WCML_Products{
1936
 
1937
  if(!$term_name){
1938
  $original_language = $sitepress->get_language_for_element($variation->ID,'post_product_variation');
1939
- $orig_variation_id = icl_object_id($variation->ID,'product_variation',true,$original_language);
1940
 
1941
  if(get_post_meta($orig_variation_id,$var_key,true) == ''){
1942
  if(substr($tr_product_attr[$attribute]['name'], 0, 3) == 'pa_'){
@@ -1981,7 +2070,7 @@ class WCML_Products{
1981
 
1982
  $trn_product_id = null;
1983
  if ($original_language != $lang) {
1984
- $trn_product_id = icl_object_id($product_id, 'product', false, $lang);
1985
  }
1986
 
1987
  if ($original_language == $lang) {
@@ -2006,7 +2095,7 @@ class WCML_Products{
2006
  if(is_null($trn_product_id)){
2007
  $template_data['all_file_paths']['count'] = count($files);
2008
  }else{
2009
- $template_data['all_file_paths']['count'] = count(maybe_unserialize(get_post_meta(icl_object_id($variation->ID, 'product_variation', false, $original_language),'_downloadable_files',true)));
2010
  }
2011
  foreach($files as $file){
2012
  $variables = array();
@@ -2040,8 +2129,12 @@ class WCML_Products{
2040
  global $sitepress,$wpdb;
2041
  $original_language = $this->get_original_product_language($product_id);
2042
  if(!$this->is_original_product($product_id)){
2043
- $product_id = icl_object_id($product_id, 'product', false, $original_language);
 
 
2044
  }
 
 
2045
  $template_data = array();
2046
 
2047
  if($original_language == $lang){
@@ -2050,7 +2143,7 @@ class WCML_Products{
2050
  $template_data['original'] = false;
2051
  }
2052
  if (!is_null($product_id)) {
2053
- $product_images = $this->product_images_ids($product_id);
2054
  if (empty($product_images)) {
2055
  $template_data['empty_images'] = true;
2056
  } else {
@@ -2058,7 +2151,7 @@ class WCML_Products{
2058
  $template_data['images_thumbnails'] = $product_images;
2059
  }
2060
  foreach ($product_images as $prod_image) {
2061
- $prod_image = icl_object_id($prod_image, 'attachment', false, $lang);
2062
  $images_texs = array();
2063
  if(!is_null($prod_image)){
2064
  $attachment_data = $wpdb->get_row($wpdb->prepare("SELECT post_title,post_excerpt,post_content FROM $wpdb->posts WHERE ID = %d", $prod_image));
@@ -2079,7 +2172,7 @@ class WCML_Products{
2079
  function custom_box($product_id,$product_content,$trn_contents,$lang,$lang_name,$is_duplicate_product){
2080
  global $sitepress;
2081
  $original_language = $sitepress->get_language_for_element($product_id,'post_product');
2082
- $tr_product_id = icl_object_id($product_id, 'product', false, $lang);
2083
  $template_data = array();
2084
 
2085
  $template_data['product_id'] = $product_id;
@@ -2220,7 +2313,7 @@ class WCML_Products{
2220
 
2221
  foreach($variations as $variation){
2222
  //update taxonomy in translation of variation
2223
- $trnsl_variation_id = icl_object_id($variation->post_id,'product_variation',false,$language);
2224
  if(!is_null($trnsl_variation_id)){
2225
  if(!$slug){
2226
  $slug = sanitize_title($name);
@@ -2293,9 +2386,9 @@ class WCML_Products{
2293
  }
2294
 
2295
  // translate the product id and product data
2296
- $item['product_id'] = icl_object_id($item['product_id'], 'product', true);
2297
  if ($item['variation_id']) {
2298
- $item['variation_id'] = icl_object_id($item['variation_id'], 'product_variation', true);
2299
  }
2300
  $product_id = $item['variation_id'] ? $item['variation_id'] : $item['product_id'];
2301
  $item['data']->post->post_title = get_the_title($item['product_id']);
@@ -2398,7 +2491,7 @@ class WCML_Products{
2398
  global $sitepress;
2399
 
2400
  foreach($subscriptions as $key=>$subscription){
2401
- $subscriptions[$key]['product_id'] = icl_object_id($subscriptions[$key]['product_id'],get_post_type($subscriptions[$key]['product_id']),true,$sitepress->get_current_language());
2402
  }
2403
 
2404
  return $subscriptions;
@@ -2413,7 +2506,7 @@ class WCML_Products{
2413
  $new_cart_data = array();
2414
 
2415
  foreach($cart->cart_contents as $key=>$cart_item){
2416
- $tr_product_id = icl_object_id($cart_item['product_id'],'product',false,$current_language);
2417
 
2418
  if( $cart_item['product_id'] == $tr_product_id ){
2419
  $new_cart_data[$key] = apply_filters( 'wcml_cart_contents_not_changed', $cart->cart_contents[$key], $key, $current_language );
@@ -2421,7 +2514,7 @@ class WCML_Products{
2421
  }
2422
 
2423
  if(isset($cart->cart_contents[$key]['variation_id']) && $cart->cart_contents[$key]['variation_id']){
2424
- $tr_variation_id = icl_object_id($cart_item['variation_id'],'product_variation',false,$current_language);
2425
  if(!is_null($tr_variation_id)){
2426
  $cart->cart_contents[$key]['product_id'] = intval($tr_product_id);
2427
  $cart->cart_contents[$key]['variation_id'] = intval($tr_variation_id);
@@ -2468,7 +2561,7 @@ class WCML_Products{
2468
 
2469
  if(taxonomy_exists($taxonomy)){
2470
  $term = get_term_by('slug',$attribute,$taxonomy);
2471
- $trnsl_term_id = icl_object_id($term->term_id,$taxonomy,true,$current_language);
2472
 
2473
  return get_term($trnsl_term_id,$taxonomy)->slug;
2474
  }else{
@@ -2808,9 +2901,11 @@ class WCML_Products{
2808
  echo json_encode(array('error' => __('Invalid nonce', 'wpml-wcml')));
2809
  die();
2810
  }
2811
- global $woocommerce_wpml,$sitepress,$wpdb;
2812
 
2813
  $product_id = filter_input( INPUT_POST, 'product_id', FILTER_SANITIZE_NUMBER_INT );
 
 
2814
 
2815
  $product = get_post( $product_id );
2816
  $default_language = $sitepress->get_language_for_element($product_id,'post_product');
@@ -2833,17 +2928,18 @@ class WCML_Products{
2833
 
2834
  // Check if user can translate product
2835
  function user_can_translate_product( $trid, $language_code ){
2836
- global $wpdb, $iclTranslationManagement;
 
2837
  $current_translator = $iclTranslationManagement->get_current_translator();
2838
  $job_id = $wpdb->get_var($wpdb->prepare("
2839
  SELECT tj.job_id FROM {$wpdb->prefix}icl_translate_job tj
2840
  JOIN {$wpdb->prefix}icl_translation_status ts ON tj.rid = ts.rid
2841
  JOIN {$wpdb->prefix}icl_translations t ON ts.translation_id = t.translation_id
2842
- WHERE t.trid = %d AND t.language_code='%s' AND ts.translator_id = %d
2843
  ORDER BY tj.job_id DESC LIMIT 1
2844
- ", $trid, $language_code, $current_translator->translator_id));
2845
 
2846
- if( $job_id ){
2847
  return true;
2848
  }
2849
 
@@ -2976,13 +3072,18 @@ class WCML_Products{
2976
  ", OBJECT_K );
2977
 
2978
  if ( $matched_products_query ) {
 
 
 
2979
  foreach ( $matched_products_query as $product ) {
2980
- if( ! get_post_meta( $product->ID,'_price_'.$client_currency ) ) continue;
2981
  if ( $product->post_type == 'product' )
2982
- $matched_products[] = icl_object_id( $product->ID, 'post_'.get_post_type($product->ID), true );
2983
  if ( $product->post_parent > 0 && ! in_array( $product->post_parent, $matched_products ) )
2984
- $matched_products[] = icl_object_id( $product->post_parent, 'post_'.get_post_type($product->post_parent), true );
2985
  }
 
 
2986
  }
2987
 
2988
  // Filter the id's
48
  add_action( 'woocommerce_duplicate_product', array( $this, 'woocommerce_duplicate_product' ), 10, 2 );
49
 
50
  add_filter( 'post_row_actions', array( $this, 'filter_product_actions' ), 10, 2 );
51
+
52
+ add_filter ( 'locale',array( $this, 'update_product_action_locale_check' ) );
53
 
54
  }else{
55
  add_filter('woocommerce_json_search_found_products', array($this, 'filter_found_products_by_language'));
61
  add_action( 'woocommerce_email', array( $this, 'woocommerce_email_refresh_text_domain' ) );
62
  add_action( 'wp_ajax_woocommerce_update_shipping_method', array( $this, 'wcml_refresh_text_domain' ), 9 );
63
  add_action( 'wp_ajax_nopriv_woocommerce_update_shipping_method', array( $this, 'wcml_refresh_text_domain' ), 9 );
64
+ add_filter( 'wpml_link_to_translation', array( $this, '_filter_link_to_translation' ), 100 );
65
 
66
  add_filter( 'woocommerce_upsell_crosssell_search_products', array( $this, 'filter_woocommerce_upsell_crosssell_posts_by_language' ) );
67
 
118
  add_filter( 'icl_wpml_config_array', array( $this, 'set_taxonomies_config' ) );
119
 
120
  add_filter( 'manage_product_posts_columns', array( $this, 'add_languages_column' ), 100 );
121
+
122
  }
123
+
124
  function hide_multilingual_content_setup_box(){
125
  remove_meta_box('icl_div_config', convert_to_screen('shop_order'), 'normal');
126
  remove_meta_box('icl_div_config', convert_to_screen('shop_coupon'), 'normal');
419
  die();
420
  }
421
 
422
+ global $woocommerce_wpml,$sitepress, $wpdb,$sitepress_settings,$iclTranslationManagement;
423
 
424
  //get post values
425
  $data = array();
427
  parse_str($records, $data);
428
 
429
  $original_product_id = filter_input( INPUT_POST, 'product_id', FILTER_SANITIZE_NUMBER_INT );
430
+ $job_id = filter_input( INPUT_POST, 'job_id', FILTER_SANITIZE_NUMBER_INT );
431
  $language = filter_input( INPUT_POST, 'language', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
432
  $orig_product = get_post($original_product_id);
433
 
439
  $languages = $sitepress->get_active_languages();
440
 
441
  $product_trid = $sitepress->get_element_trid($original_product_id, 'post_' . $orig_product->post_type);
442
+ $tr_product_id = apply_filters( 'translate_object_id',$original_product_id, 'product', false, $language);
443
 
444
  if( get_magic_quotes_gpc() ){
445
  foreach( $data as $key => $data_item ){
461
  $args['menu_order'] = $orig_product->menu_order;
462
  $args['ping_status'] = $orig_product->ping_status;
463
  $args['comment_status'] = $orig_product->comment_status;
464
+ $product_parent = apply_filters( 'translate_object_id',$orig_product->post_parent, 'product', false, $language);
465
  $args['post_parent'] = is_null($product_parent) ? 0 : $product_parent;
466
  $_POST['to_lang'] = $language;
467
 
471
 
472
  $tr_product_id = wp_insert_post($args);
473
 
474
+ $translation_id = $wpdb->get_var( $wpdb->prepare("SELECT translation_id
475
+ FROM {$wpdb->prefix}icl_translations
476
+ WHERE element_type=%s AND trid=%d AND language_code=%s AND element_id IS NULL " ,
477
+ "post_product", $product_trid, $language ) );
478
+
479
+ if ( $translation_id ) {
480
+
481
+ $wpdb->query(
482
+ $wpdb->prepare(
483
+ "DELETE FROM {$wpdb->prefix}icl_translations WHERE element_id=%d AND trid=%d",
484
+ $tr_product_id, $product_trid
485
+ )
486
+ );
487
+
488
+ $wpdb->update($wpdb->prefix . 'icl_translations', array('element_id' => $tr_product_id), array('translation_id' => $translation_id));
489
+
490
+ $iclTranslationManagement->update_translation_status(
491
+ array(
492
+ 'status' => ICL_TM_COMPLETE,
493
+ 'needs_update' => 0,
494
+ 'translation_id' => $translation_id,
495
+ 'translator_id' => get_current_user_id()
496
+ ));
497
+
498
+ }else{
499
+
500
+ $sitepress->set_element_language_details($tr_product_id, 'post_' . $orig_product->post_type, $product_trid, $language);
501
+
502
+ }
503
 
504
  $this->duplicate_product_post_meta($original_product_id, $tr_product_id, $data, true);
505
 
515
  $args['post_status'] = $orig_product->post_status;
516
  $args['ping_status'] = $orig_product->ping_status;
517
  $args['comment_status'] = $orig_product->comment_status;
518
+ $product_parent = apply_filters( 'translate_object_id',$orig_product->post_parent, 'product', false, $language);
519
  $args['post_parent'] = is_null($product_parent) ? 0 : $product_parent;
520
  $_POST['to_lang'] = $language;
521
 
525
  if(isset( $data['post_name_' . $language]) && $post_name != $data['post_name_' . $language]){
526
  // update post_name
527
  // need set POST variable ( WPML used them when filtered this function)
528
+
529
+ $new_post_name = sanitize_title( $data['post_name_' . $language] ? $data['post_name_' . $language] : $data['title_' . $language] );
530
  $_POST[ 'new_title' ] = $data['title_' . $language];
531
+ $_POST[ 'new_slug' ] = $new_post_name;
532
+ $new_slug = wp_unique_post_slug( $new_post_name, $tr_product_id, $orig_product->post_status, $orig_product->post_type, $args['post_parent']);
533
+ $wpdb->update( $wpdb->posts, array( 'post_name' => $new_slug ), array( 'ID' => $tr_product_id ) );
534
  }
535
 
536
  $sitepress->set_element_language_details($tr_product_id, 'post_' . $orig_product->post_type, $product_trid, $language);
544
  $orig_product_attrs = $this->get_product_atributes($original_product_id);
545
  $trnsl_labels = get_option('wcml_custom_attr_translations');
546
  foreach ($orig_product_attrs as $key => $orig_product_attr) {
547
+ $sanitized_key = sanitize_title( $orig_product_attr['name'] );
548
+
549
+ if( $sanitized_key != $key ) {
550
+ $orig_product_attrs_buff = $orig_product_attrs[$key];
551
+ unset($orig_product_attrs[$key]);
552
+ $orig_product_attrs[$sanitized_key] = $orig_product_attrs_buff;
553
+ $key_to_save = $sanitized_key;
554
+ }else{
555
+ $key_to_save = $key;
556
+ }
557
+
558
  if (isset($data[$key . '_' . $language]) && !empty($data[$key . '_' . $language]) && !is_array($data[$key . '_' . $language])) {
559
  //get translation values from $data
560
+
561
+ $trnsl_labels[$language][$key_to_save] = stripslashes( $data[$key . '_name_' . $language] );
562
+ $orig_product_attrs[$key_to_save]['value'] = $data[$key . '_' . $language];
563
  } else {
564
+ $orig_product_attrs[$key_to_save]['value'] = '';
565
  }
566
+
567
  }
568
  update_option('wcml_custom_attr_translations', $trnsl_labels);
569
 
616
  ob_start();
617
  $return = array();
618
 
619
+ $this->get_translation_statuses($translations,$languages,isset($_POST['slang']) && $_POST['slang'] != 'all'?$_POST['slang']:false, $product_trid, $job_id ? $language : false );
620
  $return['status'] = ob_get_clean();
621
 
622
 
680
 
681
  function is_variable_product($product_id){
682
  global $wpdb;
683
+ $get_variation_term_taxonomy_ids = $wpdb->get_col("SELECT tt.term_taxonomy_id FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE t.name = 'variable' AND tt.taxonomy = 'product_type'");
684
  $get_variation_term_taxonomy_ids = apply_filters('wcml_variation_term_taxonomy_ids',(array)$get_variation_term_taxonomy_ids);
685
 
686
  $is_variable_product = $wpdb->get_var($wpdb->prepare("SELECT count(object_id) FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN (".join(',',$get_variation_term_taxonomy_ids).")",$product_id));
713
  continue;
714
  }
715
 
716
+ $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
717
  if(!is_null($tr_id)){
718
  // not using get_term - unfiltered get_term
719
  $translated_term = $wpdb->get_row($wpdb->prepare("
870
  $duplicated_ids = '';
871
  if (!$translation->original) {
872
  foreach($gallery_ids as $image_id){
873
+ $duplicated_id = apply_filters( 'translate_object_id',$image_id,'attachment',false,$translation->language_code);
874
  if(!is_null($duplicated_id)){
875
  $duplicated_ids .= $duplicated_id.',';
876
  }
881
  }
882
  }
883
 
884
+ function get_translation_flags($active_languages,$slang = false,$job_language =false){
885
  global $sitepress;
886
 
887
  foreach($active_languages as $language){
888
+ if( $job_language && $language['code'] != $job_language ) {
889
+ continue;
890
+ }elseif (!$slang || ( ($slang != $language['code']) && (current_user_can('wpml_operate_woocommerce_multilingual') || wpml_check_user_is_translator($slang,$language['code'])) && (!isset($_POST['translation_status_lang']) || (isset($_POST['translation_status_lang']) && ($_POST['translation_status_lang'] == $language['code']) || $_POST['translation_status_lang']=='')))){
891
+
892
  echo '<img src="'. ICL_PLUGIN_URL .'/res/flags/'. $language['code'] .'.png" width="18" height="12" class="flag_img" />';
893
+
894
  }
895
  }
896
  }
897
 
898
 
899
+ function get_translation_statuses($product_translations,$active_languages,$slang = false, $trid = false, $job_language = false ){
900
  global $wpdb,$sitepress;
901
 
902
  foreach ($active_languages as $language) {
903
+ if( $job_language && $language['code'] != $job_language ) {
904
+ continue;
905
+ }elseif(isset($product_translations[$language['code']]) && $product_translations[$language['code']]->original){
906
  $alt = __('Original language','wpml-wcml');
907
  echo '<i title="'. $alt .'" class="stat_img icon-minus"></i>';
908
+ }elseif ($slang != $language['code'] && (!isset($_POST['translation_status_lang']) || (isset($_POST['translation_status_lang']) && ($_POST['translation_status_lang'] == $language['code']) || $_POST['translation_status_lang']==''))) {
909
+
 
 
910
  if (isset($product_translations[$language['code']])) {
911
  $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));
912
  if(!$tr_status){
913
  $alt = __('Not translated','wpml-wcml');
914
  echo '<i title="'. $alt .'" class="stat_img icon-warning-sign"></i>';
915
  }elseif($tr_status->needs_update){
916
+ $alt = __('Not translated - needs update','wpml-wcml');
917
+ echo '<i title="'. $alt .'" class="stat_img icon-repeat"></i>';
918
+ }elseif($tr_status->status != ICL_TM_COMPLETE && $tr_status->status != ICL_TM_DUPLICATE) {
919
+ $alt = __('In progress','wpml-wcml');
920
+ echo '<i title="'. $alt .'" class="stat_img icon-spinner"></i>';
921
+ }elseif($tr_status->status == ICL_TM_COMPLETE || $tr_status->status == ICL_TM_DUPLICATE){
922
+ $alt = __('Complete','wpml-wcml');
923
+ echo '<i title="'. $alt .'" class="stat_img icon-ok"></i>';
924
+ }
925
  } else {
926
  $alt = __('Not translated','wpml-wcml');
927
  echo '<i title="'. $alt .'" class="stat_img icon-warning-sign"></i>';
1065
  $tax_sync = array();
1066
  foreach ( $terms as $term ) {
1067
  if ( $sitepress->is_translated_taxonomy($tt) ) {
1068
+ $term_id = apply_filters( 'translate_object_id', $term->term_id, $tt, false, $lang );
1069
  } else {
1070
  $term_id = $term->term_id;
1071
  }
1125
  $meta_key = $post_meta->meta_key;
1126
  $meta_value = maybe_unserialize($post_meta->meta_value);
1127
 
1128
+ // update current post variations meta
1129
+ if ((substr($meta_key, 0, 10) == 'attribute_' || isset($cf[$meta_key]) && $cf[$meta_key] == 1)) {
1130
+
1131
+ // adjust the global attribute slug in the custom field
1132
+ $attid = null;
1133
+
1134
+ if (substr($meta_key, 0, 10) == 'attribute_') {
1135
+ $tax = substr($meta_key, 10);
1136
+
1137
+ if (taxonomy_exists($tax)) {
1138
+
1139
+ $attid = $wpdb->get_var( $wpdb->prepare( "SELECT tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND t.slug = %s LIMIT 1", $tax, $meta_value ) );
1140
+ if($attid){
1141
+ $trid = $sitepress->get_element_trid($attid, 'tax_' . $tax);
1142
+ if ($trid) {
1143
+ $translations = $sitepress->get_element_translations($trid,'tax_' . $tax);
1144
+ if (isset($translations[$lang])) {
1145
+ $meta_value = $wpdb->get_var($wpdb->prepare("SELECT slug FROM $wpdb->terms WHERE term_id = %s", $translations[$lang]->term_id));
1146
+ }else{
1147
+ $meta_value = $meta_value.'_'.$lang;
1148
+ }
1149
  }
1150
  }
1151
+ }else{
1152
+ if( isset( $original_product_attr[$tax] ) ){
1153
+ $tax = sanitize_title( $original_product_attr[$tax]['name'] );
1154
+ }
1155
+
1156
+ if(isset($original_product_attr[$tax])){
1157
+ if(isset($tr_product_attr[$tax])){
1158
+ $values_arrs = array_map('trim', explode('|',$original_product_attr[$tax]['value']));
1159
+ $values_arrs_tr = array_map('trim',explode('|',$tr_product_attr[$tax]['value']));
1160
+ foreach($values_arrs as $key=>$value){
1161
+ $value_sanitized = sanitize_title($value);
1162
+ if($value_sanitized == urldecode($meta_value) && isset($values_arrs_tr[$key])){
1163
+ $meta_value = $values_arrs_tr[$key];
1164
+ }
1165
  }
1166
+ }else{
1167
+ $meta_value = $meta_value.'_'.$lang;
1168
  }
1169
+
 
1170
  }
1171
 
1172
+ $meta_key = 'attribute_'.$tax;
1173
+
1174
  }
1175
  }
 
 
1176
 
 
1177
  update_post_meta($current_post_variation_ids[$dp_key], $meta_key, $meta_value);
1178
  }
1179
 
1187
  }
1188
  }
1189
 
1190
+ /* Change locale to saving language - needs for sanitize_title exception wcml-390 */
1191
+ function update_product_action_locale_check( $locale ){
1192
+
1193
+ if( isset($_POST['action']) && $_POST['action'] == 'wcml_update_product' ){
1194
+ global $sitepress;
1195
+
1196
+ return $sitepress->get_locale( $_POST['language'] );
1197
+ }
1198
+
1199
+ return $locale;
1200
+
1201
+ }
1202
+
1203
  function sync_linked_products($product_id,$tr_product_id,$lang){
1204
  global $wpdb;
1205
 
1208
  $trnsl_up_sells = array();
1209
  if($original_up_sells) {
1210
  foreach ($original_up_sells as $original_up_sell_product) {
1211
+ $trnsl_up_sells[] = apply_filters( 'translate_object_id',$original_up_sell_product, get_post_type($original_up_sell_product), false, $lang);
1212
  }
1213
  }
1214
 
1219
  $trnsl_cross_sells = array();
1220
  if( $original_cross_sells )
1221
  foreach( $original_cross_sells as $original_cross_sell_product ){
1222
+ $trnsl_cross_sells[] = apply_filters( 'translate_object_id', $original_cross_sell_product, get_post_type( $original_cross_sell_product ), false, $lang );
1223
  }
1224
  update_post_meta( $tr_product_id, '_crosssell_ids', $trnsl_cross_sells );
1225
 
1229
  $grouped_ids = get_posts( 'post_parent=' . $product_id . '&post_type=product&orderby=menu_order&order=ASC&fields=ids&post_status=publish&numberposts=-1' );
1230
  $trnsl_grouped_ids = array();
1231
  foreach($grouped_ids as $id){
1232
+ $tr_id = apply_filters( 'translate_object_id',$id,get_post_type($id),false,$lang);
1233
  if(!is_null($tr_id)){
1234
  $trnsl_grouped_ids[] =$tr_id;
1235
  $wpdb->update(
1243
  }
1244
  update_option('_transient_wc_product_children_ids_'.$tr_product_id,$trnsl_grouped_ids);
1245
  }elseif($parent_id && get_post_type($product_id) == 'product'){
1246
+ $tr_parent_id = apply_filters( 'translate_object_id',$parent_id,'product',false,$lang);
1247
  if(!is_null($tr_parent_id)){
1248
  $grouped_ids = maybe_unserialize(get_option('_transient_wc_product_children_ids_'.$tr_parent_id));
1249
  if($grouped_ids && !in_array($tr_product_id,$grouped_ids)){
1258
  function sync_thumbnail_id($orig_post_id,$trnsl_post_id,$lang){
1259
  if(defined('WPML_MEDIA_VERSION')){
1260
  $thumbnail_id = get_post_meta($orig_post_id,'_thumbnail_id',true);
1261
+ $trnsl_thumbnail = apply_filters( 'translate_object_id',$thumbnail_id,'attachment',false,$lang);
1262
  if(!is_null($trnsl_thumbnail)){
1263
  update_post_meta($trnsl_post_id,'_thumbnail_id',$trnsl_thumbnail);
1264
  }else{
1305
  if($woocommerce_wpml->settings['trnsl_interface'] && $pagenow == 'post.php' && !is_ajax() && isset($_GET['post']) && !$this->is_original_product($_GET['post']) && get_post_type($_GET['post'])=='product'){
1306
  if((!isset($_GET['action'])) || (isset($_GET['action']) && !in_array($_GET['action'],array('trash','delete')))){
1307
  $orig_language = $this->get_original_product_language($_GET['post']);
1308
+ $prid = apply_filters( 'translate_object_id',$_GET['post'],'product',true,$orig_language);
1309
  wp_redirect(admin_url('admin.php?page=wpml-wcml&tab=products&prid='.$prid)); exit;
1310
  }
1311
  }
1484
  global $pagenow, $sitepress, $sitepress_settings,$woocommerce_wpml;
1485
  $original_language = $this->get_original_product_language($post_id);
1486
  $current_language = $sitepress->get_current_language();
1487
+ $duplicated_post_id = apply_filters( 'translate_object_id',$post_id, 'product', false, $original_language);
1488
  $wpml_media_options = maybe_unserialize(get_option('_wpml_media'));
1489
 
1490
  if($wpml_media_options['new_content_settings']['duplicate_media']){
1551
  //save custom prices
1552
  $nonce = filter_input( INPUT_POST, '_wcml_custom_prices_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
1553
 
1554
+ if( isset( $_POST['_wcml_custom_prices'] ) && isset( $nonce ) && wp_verify_nonce( $nonce, 'wcml_save_custom_prices' )){
1555
+
1556
+ if( isset( $_POST['_wcml_custom_prices'][$post_id] ) ) {
1557
+ $wcml_custom_prices_option = $_POST['_wcml_custom_prices'][$post_id];
1558
+ }else{
1559
+ $wcml_custom_prices_option = $_POST['_wcml_custom_prices'][0];
1560
+ }
1561
 
1562
+ update_post_meta($post_id,'_wcml_custom_prices_status',$wcml_custom_prices_option);
1563
 
1564
+ if( $wcml_custom_prices_option == 1){
1565
 
1566
  $currencies = $woocommerce_wpml->multi_currency_support->get_currencies();
1567
 
1619
  update_post_meta($post_id, '_product_attributes', $orig_product_attrs);
1620
 
1621
  // synchronize post variations
1622
+ $this->sync_product_variations($duplicated_post_id,$post_id,$lang);
1623
  $this->sync_linked_products($duplicated_post_id,$post_id,$lang);
1624
  }
1625
 
1628
 
1629
  //sync product parent & post_status
1630
  function sync_status_and_parent( $duplicated_post_id, $post_id, $lang ){
1631
+ global $wpdb,$woocommerce_wpml;
1632
+
1633
+ $tr_parent_id = apply_filters( 'translate_object_id', wp_get_post_parent_id( $duplicated_post_id ), 'product', false, $lang );
1634
+
1635
+ $orig_product = get_post( $duplicated_post_id );
1636
+ $args = array();
1637
+ $args[ 'post_parent' ] = is_null( $tr_parent_id )? 0 : $tr_parent_id;
1638
+ $args[ 'post_status' ] = $orig_product->post_status;
1639
+ $args[ 'comment_status' ] = $orig_product->comment_status;
1640
+
1641
+ //sync product date
1642
+ if( $woocommerce_wpml->settings[ 'products_sync_date' ] ){
1643
+ $args[ 'post_date' ] = $orig_product->post_date;
1644
+ }
1645
 
 
1646
  $wpdb->update(
1647
  $wpdb->posts,
1648
+ $args,
 
 
 
 
1649
  array( 'id' => $post_id )
1650
  );
1651
+
1652
+
1653
  }
1654
 
1655
  function update_custom_prices($post_id,$regular_price,$sale_price,$schedule,$date_from,$date_to,$code){
1772
  if (substr($attribute, 0, 3) == 'pa_') {
1773
  //attr is taxonomy
1774
  $default_term = get_term_by('slug', $default_term_slug, $attribute);
1775
+ $tr_id = apply_filters( 'translate_object_id',$default_term->term_id, $attribute, false, $lang);
1776
 
1777
  if($tr_id){
1778
  $translated_term = $wpdb->get_row($wpdb->prepare("
1813
  * get attribute translation
1814
  */
1815
  function get_custom_attribute_translation($product_id, $attribute_key, $attribute, $lang_code) {
1816
+ $tr_post_id = apply_filters( 'translate_object_id',$product_id, 'product', false, $lang_code);
1817
  $transl = array();
1818
  if ($tr_post_id) {
1819
  if (!$attribute['is_taxonomy']) {
1952
  function get_product_content_translation($product_id,$content,$lang_code){
1953
  global $woocommerce_wpml;
1954
 
1955
+ $tr_post_id = apply_filters( 'translate_object_id',$product_id, 'product', false, $lang_code);
1956
 
1957
  if (is_null($tr_post_id) && (in_array($content, array('title','content','excerpt','variations','images'))))
1958
  return false;
2025
 
2026
  if(!$term_name){
2027
  $original_language = $sitepress->get_language_for_element($variation->ID,'post_product_variation');
2028
+ $orig_variation_id = apply_filters( 'translate_object_id',$variation->ID,'product_variation',true,$original_language);
2029
 
2030
  if(get_post_meta($orig_variation_id,$var_key,true) == ''){
2031
  if(substr($tr_product_attr[$attribute]['name'], 0, 3) == 'pa_'){
2070
 
2071
  $trn_product_id = null;
2072
  if ($original_language != $lang) {
2073
+ $trn_product_id = apply_filters( 'translate_object_id',$product_id, 'product', false, $lang);
2074
  }
2075
 
2076
  if ($original_language == $lang) {
2095
  if(is_null($trn_product_id)){
2096
  $template_data['all_file_paths']['count'] = count($files);
2097
  }else{
2098
+ $template_data['all_file_paths']['count'] = count(maybe_unserialize(get_post_meta(apply_filters( 'translate_object_id',$variation->ID, 'product_variation', false, $original_language),'_downloadable_files',true)));
2099
  }
2100
  foreach($files as $file){
2101
  $variables = array();
2129
  global $sitepress,$wpdb;
2130
  $original_language = $this->get_original_product_language($product_id);
2131
  if(!$this->is_original_product($product_id)){
2132
+ $orig_product_id = apply_filters( 'translate_object_id',$product_id, 'product', false, $original_language);
2133
+ }else{
2134
+ $orig_product_id = $product_id;
2135
  }
2136
+
2137
+ $product_id = apply_filters( 'translate_object_id',$product_id, 'product', false, $lang);
2138
  $template_data = array();
2139
 
2140
  if($original_language == $lang){
2143
  $template_data['original'] = false;
2144
  }
2145
  if (!is_null($product_id)) {
2146
+ $product_images = $this->product_images_ids($orig_product_id);
2147
  if (empty($product_images)) {
2148
  $template_data['empty_images'] = true;
2149
  } else {
2151
  $template_data['images_thumbnails'] = $product_images;
2152
  }
2153
  foreach ($product_images as $prod_image) {
2154
+ $prod_image = apply_filters( 'translate_object_id',$prod_image, 'attachment', false, $lang);
2155
  $images_texs = array();
2156
  if(!is_null($prod_image)){
2157
  $attachment_data = $wpdb->get_row($wpdb->prepare("SELECT post_title,post_excerpt,post_content FROM $wpdb->posts WHERE ID = %d", $prod_image));
2172
  function custom_box($product_id,$product_content,$trn_contents,$lang,$lang_name,$is_duplicate_product){
2173
  global $sitepress;
2174
  $original_language = $sitepress->get_language_for_element($product_id,'post_product');
2175
+ $tr_product_id = apply_filters( 'translate_object_id',$product_id, 'product', false, $lang);
2176
  $template_data = array();
2177
 
2178
  $template_data['product_id'] = $product_id;
2313
 
2314
  foreach($variations as $variation){
2315
  //update taxonomy in translation of variation
2316
+ $trnsl_variation_id = apply_filters( 'translate_object_id',$variation->post_id,'product_variation',false,$language);
2317
  if(!is_null($trnsl_variation_id)){
2318
  if(!$slug){
2319
  $slug = sanitize_title($name);
2386
  }
2387
 
2388
  // translate the product id and product data
2389
+ $item['product_id'] = apply_filters( 'translate_object_id',$item['product_id'], 'product', true);
2390
  if ($item['variation_id']) {
2391
+ $item['variation_id'] = apply_filters( 'translate_object_id',$item['variation_id'], 'product_variation', true);
2392
  }
2393
  $product_id = $item['variation_id'] ? $item['variation_id'] : $item['product_id'];
2394
  $item['data']->post->post_title = get_the_title($item['product_id']);
2491
  global $sitepress;
2492
 
2493
  foreach($subscriptions as $key=>$subscription){
2494
+ $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());
2495
  }
2496
 
2497
  return $subscriptions;
2506
  $new_cart_data = array();
2507
 
2508
  foreach($cart->cart_contents as $key=>$cart_item){
2509
+ $tr_product_id = apply_filters( 'translate_object_id',$cart_item['product_id'],'product',false,$current_language);
2510
 
2511
  if( $cart_item['product_id'] == $tr_product_id ){
2512
  $new_cart_data[$key] = apply_filters( 'wcml_cart_contents_not_changed', $cart->cart_contents[$key], $key, $current_language );
2514
  }
2515
 
2516
  if(isset($cart->cart_contents[$key]['variation_id']) && $cart->cart_contents[$key]['variation_id']){
2517
+ $tr_variation_id = apply_filters( 'translate_object_id',$cart_item['variation_id'],'product_variation',false,$current_language);
2518
  if(!is_null($tr_variation_id)){
2519
  $cart->cart_contents[$key]['product_id'] = intval($tr_product_id);
2520
  $cart->cart_contents[$key]['variation_id'] = intval($tr_variation_id);
2561
 
2562
  if(taxonomy_exists($taxonomy)){
2563
  $term = get_term_by('slug',$attribute,$taxonomy);
2564
+ $trnsl_term_id = apply_filters( 'translate_object_id',$term->term_id,$taxonomy,true,$current_language);
2565
 
2566
  return get_term($trnsl_term_id,$taxonomy)->slug;
2567
  }else{
2901
  echo json_encode(array('error' => __('Invalid nonce', 'wpml-wcml')));
2902
  die();
2903
  }
2904
+ global $woocommerce_wpml,$sitepress,$wpdb,$iclTranslationManagement;
2905
 
2906
  $product_id = filter_input( INPUT_POST, 'product_id', FILTER_SANITIZE_NUMBER_INT );
2907
+ $job_id = filter_input( INPUT_POST, 'job_id', FILTER_SANITIZE_NUMBER_INT );
2908
+ $job = $iclTranslationManagement->get_translation_job ( $job_id );
2909
 
2910
  $product = get_post( $product_id );
2911
  $default_language = $sitepress->get_language_for_element($product_id,'post_product');
2928
 
2929
  // Check if user can translate product
2930
  function user_can_translate_product( $trid, $language_code ){
2931
+ global $wpdb, $iclTranslationManagement,$sitepress;
2932
+
2933
  $current_translator = $iclTranslationManagement->get_current_translator();
2934
  $job_id = $wpdb->get_var($wpdb->prepare("
2935
  SELECT tj.job_id FROM {$wpdb->prefix}icl_translate_job tj
2936
  JOIN {$wpdb->prefix}icl_translation_status ts ON tj.rid = ts.rid
2937
  JOIN {$wpdb->prefix}icl_translations t ON ts.translation_id = t.translation_id
2938
+ WHERE t.trid = %d AND t.language_code='%s'
2939
  ORDER BY tj.job_id DESC LIMIT 1
2940
+ ", $trid, $language_code));
2941
 
2942
+ if( $job_id && wpml_check_user_is_translator( $sitepress->get_source_language_by_trid($trid), $language_code)){
2943
  return true;
2944
  }
2945
 
3072
  ", OBJECT_K );
3073
 
3074
  if ( $matched_products_query ) {
3075
+
3076
+ remove_filter('get_post_metadata', array($woocommerce_wpml->multi_currency_support, 'product_price_filter'), 10, 4);
3077
+
3078
  foreach ( $matched_products_query as $product ) {
3079
+ if( !get_post_meta( $product->ID,'_price_'.$client_currency, true ) ) continue;
3080
  if ( $product->post_type == 'product' )
3081
+ $matched_products[] = apply_filters( 'translate_object_id', $product->ID, 'post_'.get_post_type($product->ID), true );
3082
  if ( $product->post_parent > 0 && ! in_array( $product->post_parent, $matched_products ) )
3083
+ $matched_products[] = apply_filters( 'translate_object_id', $product->post_parent, 'post_'.get_post_type($product->post_parent), true );
3084
  }
3085
+
3086
+ add_filter('get_post_metadata', array($woocommerce_wpml->multi_currency_support, 'product_price_filter'), 10, 4);
3087
  }
3088
 
3089
  // Filter the id's
inc/reports.class.php CHANGED
@@ -182,7 +182,7 @@ class WCML_Reports{
182
 
183
  }else{
184
 
185
- $default_product_id = icl_object_id($row->product_id, 'product', false, $current_language);
186
 
187
  if($default_product_id){
188
  $combined_results[$key] = new stdClass();
182
 
183
  }else{
184
 
185
+ $default_product_id = apply_filters( 'translate_object_id',$row->product_id, 'product', false, $current_language);
186
 
187
  if($default_product_id){
188
  $combined_results[$key] = new stdClass();
inc/requests.class.php CHANGED
@@ -4,7 +4,7 @@ class WCML_Requests{
4
  function __construct(){
5
 
6
  add_action('init', array($this, 'run'));
7
-
8
 
9
  }
10
 
4
  function __construct(){
5
 
6
  add_action('init', array($this, 'run'));
7
+
8
 
9
  }
10
 
inc/store-pages.class.php CHANGED
@@ -11,6 +11,7 @@ class WCML_Store_Pages{
11
  add_action( 'icl_after_set_default_language', array( $this, 'after_set_default_language' ), 10, 2 );
12
  // Translate shop page ids
13
  $this->add_filter_to_get_shop_translated_page_id();
 
14
  }
15
 
16
  function init(){
@@ -118,14 +119,14 @@ class WCML_Store_Pages{
118
  return $id;
119
  }
120
 
121
- return icl_object_id($id, 'page', true);
122
  }
123
 
124
  function default_shipping_class_id($args){
125
  global $sitepress, $woocommerce_wpml;
126
  if($sitepress->get_current_language() != $sitepress->get_default_language() && !empty($args['shipping_class_id'])){
127
 
128
- $args['shipping_class_id'] = icl_object_id($args['shipping_class_id'], 'product_shipping_class', false, $sitepress->get_default_language());
129
 
130
  if($woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT){
131
  // use unfiltred cart price to compare against limits of different shipping methods
@@ -208,7 +209,7 @@ class WCML_Store_Pages{
208
  function translate_ls_shop_url($languages) {
209
  global $sitepress;
210
  $shop_id = $this->shop_page_id;
211
- $front_id = icl_object_id($this->front_page_id, 'page');
212
  foreach ($languages as &$language) {
213
  // shop page
214
  // obsolete?
@@ -216,7 +217,7 @@ class WCML_Store_Pages{
216
  if ($front_id == $shop_id) {
217
  $url = $sitepress->language_url($language['language_code']);
218
  } else {
219
- $url = get_permalink(icl_object_id($shop_id, 'page', true, $language['language_code']));
220
  }
221
  $language['url'] = $url;
222
  }
@@ -274,7 +275,7 @@ class WCML_Store_Pages{
274
 
275
  unload_textdomain('wpml-wcml');
276
  $sitepress->switch_lang($mis_lang);
277
- $woocommerce_wpml->load_locale();
278
 
279
  foreach ($check_pages as $page) {
280
  $orig_id = get_option($page);
@@ -310,7 +311,7 @@ class WCML_Store_Pages{
310
  $args['menu_order'] = $orig_page->menu_order;
311
  $args['ping_status'] = $orig_page->ping_status;
312
  $args['comment_status'] = $orig_page->comment_status;
313
- $post_parent = icl_object_id($orig_page->post_parent, 'page', false, $mis_lang);
314
  $args['post_parent'] = is_null($post_parent)?0:$post_parent;
315
  $new_page_id = wp_insert_post($args);
316
 
@@ -330,7 +331,7 @@ class WCML_Store_Pages{
330
  }
331
  unload_textdomain('wpml-wcml');
332
  $sitepress->switch_lang($default_language);
333
- $woocommerce_wpml->load_locale();
334
  }
335
 
336
  wp_redirect(admin_url('admin.php?page=wpml-wcml')); exit;
@@ -426,7 +427,7 @@ class WCML_Store_Pages{
426
  * Filters WooCommerce checkout link.
427
  */
428
  function get_checkout_page_url(){
429
- return get_permalink(icl_object_id(get_option('woocommerce_checkout_page_id'), 'page', true));
430
  }
431
 
432
  function localize_flat_rates_shipping_classes(){
@@ -452,7 +453,7 @@ class WCML_Store_Pages{
452
  foreach($rates as $shipping_class => $value){
453
  $term = get_term_by('slug', $shipping_class, 'product_shipping_class');
454
  if($term && !is_wp_error($term)){
455
- $translated_term_id = icl_object_id($term->term_id, 'product_shipping_class', true);
456
  if($translated_term_id != $term->term_id){
457
  $term = get_term_by('id', $translated_term_id, 'product_shipping_class');
458
  unset($rates[$shipping_class]);
@@ -483,7 +484,7 @@ class WCML_Store_Pages{
483
  foreach( $pages as $page ){
484
 
485
  if( $page_id = get_option($page) ){
486
- $trnsl_id = icl_object_id( $page_id, 'page', false, $code );
487
  if( !is_null( $trnsl_id ) ){
488
  $wpdb->update( $wpdb->options, array( 'option_value' => $trnsl_id ), array( 'option_name' => $page ) );
489
  }
@@ -495,5 +496,77 @@ class WCML_Store_Pages{
495
  wc_delete_product_transients();
496
  delete_transient( 'woocommerce_cache_excluded_uris' );
497
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
498
 
499
  }
11
  add_action( 'icl_after_set_default_language', array( $this, 'after_set_default_language' ), 10, 2 );
12
  // Translate shop page ids
13
  $this->add_filter_to_get_shop_translated_page_id();
14
+ add_filter( 'template_include', array( $this, 'template_loader' ), 100 );
15
  }
16
 
17
  function init(){
119
  return $id;
120
  }
121
 
122
+ return apply_filters( 'translate_object_id',$id, 'page', true);
123
  }
124
 
125
  function default_shipping_class_id($args){
126
  global $sitepress, $woocommerce_wpml;
127
  if($sitepress->get_current_language() != $sitepress->get_default_language() && !empty($args['shipping_class_id'])){
128
 
129
+ $args['shipping_class_id'] = apply_filters( 'translate_object_id',$args['shipping_class_id'], 'product_shipping_class', false, $sitepress->get_default_language());
130
 
131
  if($woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT){
132
  // use unfiltred cart price to compare against limits of different shipping methods
209
  function translate_ls_shop_url($languages) {
210
  global $sitepress;
211
  $shop_id = $this->shop_page_id;
212
+ $front_id = apply_filters( 'translate_object_id',$this->front_page_id, 'page');
213
  foreach ($languages as &$language) {
214
  // shop page
215
  // obsolete?
217
  if ($front_id == $shop_id) {
218
  $url = $sitepress->language_url($language['language_code']);
219
  } else {
220
+ $url = get_permalink(apply_filters( 'translate_object_id',$shop_id, 'page', true, $language['language_code']));
221
  }
222
  $language['url'] = $url;
223
  }
275
 
276
  unload_textdomain('wpml-wcml');
277
  $sitepress->switch_lang($mis_lang);
278
+ load_textdomain( 'wpml-wcml', WCML_LOCALE_PATH . '/wpml-wcml-' . $sitepress->get_locale( $mis_lang ) . '.mo' );
279
 
280
  foreach ($check_pages as $page) {
281
  $orig_id = get_option($page);
311
  $args['menu_order'] = $orig_page->menu_order;
312
  $args['ping_status'] = $orig_page->ping_status;
313
  $args['comment_status'] = $orig_page->comment_status;
314
+ $post_parent = apply_filters( 'translate_object_id',$orig_page->post_parent, 'page', false, $mis_lang);
315
  $args['post_parent'] = is_null($post_parent)?0:$post_parent;
316
  $new_page_id = wp_insert_post($args);
317
 
331
  }
332
  unload_textdomain('wpml-wcml');
333
  $sitepress->switch_lang($default_language);
334
+ load_textdomain( 'wpml-wcml', WCML_LOCALE_PATH . '/wpml-wcml-' . $sitepress->get_locale( $default_language ) . '.mo' );
335
  }
336
 
337
  wp_redirect(admin_url('admin.php?page=wpml-wcml')); exit;
427
  * Filters WooCommerce checkout link.
428
  */
429
  function get_checkout_page_url(){
430
+ return get_permalink(apply_filters( 'translate_object_id',get_option('woocommerce_checkout_page_id'), 'page', true));
431
  }
432
 
433
  function localize_flat_rates_shipping_classes(){
453
  foreach($rates as $shipping_class => $value){
454
  $term = get_term_by('slug', $shipping_class, 'product_shipping_class');
455
  if($term && !is_wp_error($term)){
456
+ $translated_term_id = apply_filters( 'translate_object_id',$term->term_id, 'product_shipping_class', true);
457
  if($translated_term_id != $term->term_id){
458
  $term = get_term_by('id', $translated_term_id, 'product_shipping_class');
459
  unset($rates[$shipping_class]);
484
  foreach( $pages as $page ){
485
 
486
  if( $page_id = get_option($page) ){
487
+ $trnsl_id = apply_filters( 'translate_object_id', $page_id, 'page', false, $code );
488
  if( !is_null( $trnsl_id ) ){
489
  $wpdb->update( $wpdb->options, array( 'option_value' => $trnsl_id ), array( 'option_name' => $page ) );
490
  }
496
  wc_delete_product_transients();
497
  delete_transient( 'woocommerce_cache_excluded_uris' );
498
  }
499
+
500
+ function template_loader( $template ){
501
+
502
+ if ( is_product_taxonomy() ) {
503
+ global $sitepress;
504
+
505
+ $current_language = $sitepress->get_current_language();
506
+ $default_language = $sitepress->get_default_language();
507
+
508
+ if( $current_language != $default_language ) {
509
+
510
+ if( class_exists( 'WPML_Frontend_Tax_Filters' ) ){
511
+
512
+ $wpml_frontend_filters = new WPML_Frontend_Tax_Filters;
513
+
514
+ $filtered_template = $wpml_frontend_filters->slug_template($template);
515
+
516
+ }else{
517
+
518
+ $filtered_template = $sitepress->slug_template($template);
519
+
520
+ }
521
+
522
+ if ($filtered_template == $template) {
523
+ // check templates in WC folder in default lang
524
+
525
+ $term = get_queried_object();
526
+ $taxonomy = $term->taxonomy;
527
+ $prefix = 'taxonomy-'.$taxonomy;
528
+ $original_term_id = icl_object_id($term->term_id, $taxonomy, true, $default_language);
529
+ remove_filter( 'get_term', array( $sitepress, 'get_term_adjust_id' ), 1 );
530
+ $original_term = get_term_by("id", $original_term_id, $taxonomy);
531
+ add_filter ( 'get_term', array( $sitepress, 'get_term_adjust_id' ), 1, 1 );
532
+
533
+ if ($original_term) {
534
+ $templates[] = WC()->template_path() ."$prefix-{$current_language}-{$original_term->slug}.php";
535
+ $templates[] = WC()->template_path() ."$prefix-{$current_language}-{$original_term_id}.php";
536
+ $templates[] = WC()->template_path() ."$prefix-{$original_term->slug}.php";
537
+ $templates[] = WC()->template_path() ."$prefix-{$original_term_id}.php";
538
+ $templates[] = WC()->template_path() ."$prefix-{$current_language}.php";
539
+ $templates[] = WC()->template_path() ."$prefix.php";
540
+ }
541
+
542
+ $template = locate_template( array_unique($templates) );
543
+
544
+ } else {
545
+
546
+ $template = $filtered_template;
547
+
548
+ }
549
+
550
+ if (!$template || WC_TEMPLATE_DEBUG_MODE) {
551
+
552
+ $term = get_queried_object();
553
+
554
+ if (is_tax('product_cat') || is_tax('product_tag')) {
555
+ $file = 'taxonomy-' . $term->taxonomy . '.php';
556
+ } else {
557
+ $file = 'archive-product.php';
558
+ }
559
+
560
+ $template = WC()->plugin_path() . '/templates/' . $file;
561
+
562
+ }
563
+
564
+ }
565
+
566
+ }
567
+
568
+ return $template;
569
+
570
+ }
571
 
572
  }
inc/terms.class.php CHANGED
@@ -247,7 +247,7 @@ class WCML_Terms{
247
  }else{
248
 
249
  $current_shop_id = woocommerce_get_page_id( 'shop' );
250
- $default_shop_id = icl_object_id( $current_shop_id, 'page', true, $sitepress->get_default_language() );
251
 
252
  if ( is_null( get_post( $current_shop_id ) ) || is_null( get_post( $default_shop_id ) ) )
253
  return $value;
@@ -486,7 +486,7 @@ class WCML_Terms{
486
  if(isset($_POST['display_type'])){
487
  update_woocommerce_term_meta( $translation->term_id, 'display_type', esc_attr( $_POST['display_type'] ) );
488
  }
489
- update_woocommerce_term_meta( $translation->term_id, 'thumbnail_id', icl_object_id(esc_attr( $_POST['product_cat_thumbnail_id'] ),'attachment',true,$translation->language_code));
490
  }
491
  }
492
  }
@@ -689,7 +689,7 @@ class WCML_Terms{
689
 
690
  if($term_language->language_code != $sitepress->get_default_language()){
691
  // get term in the default language
692
- $term_id = icl_object_id($term_id, $taxonomy, false, $sitepress->get_default_language());
693
 
694
  //does it belong to any posts (variations)
695
  $objects = get_objects_in_term($term_id, $taxonomy);
@@ -946,7 +946,8 @@ class WCML_Terms{
946
  global $sitepress, $wp_post_types, $wp_taxonomies,$wpdb;
947
 
948
  $default_language = $sitepress->get_default_language();
949
- $posts = get_posts( array( 'post_type' => $object_type, 'suppress_filters' => false, 'posts_per_page' => -1 ) );
 
950
 
951
  foreach($posts as $post){
952
 
@@ -969,7 +970,7 @@ class WCML_Terms{
969
  $translation_term_ids = array();
970
  foreach($terms_of_translation as $term){
971
 
972
- $term_id_original = icl_object_id($term->term_id, $taxonomy, false, $default_language );
973
  if(!$term_id_original || !in_array($term_id_original, $term_ids)){
974
  // remove term
975
 
@@ -1011,7 +1012,7 @@ class WCML_Terms{
1011
  break(3);
1012
  }
1013
  $terms_array = array();
1014
- $term_id_translated = icl_object_id($term_id, $taxonomy, false, $language);
1015
 
1016
  // not using get_term
1017
  $translated_term = $wpdb->get_row($wpdb->prepare("
@@ -1083,7 +1084,7 @@ class WCML_Terms{
1083
  if( !is_admin() && ( get_post_type($post_id) == 'product' || get_post_type($post_id) == 'product_variation' ) && $taxonomy == 'product_shipping_class'){
1084
  global $sitepress;
1085
  remove_filter('get_the_terms',array($this,'shipping_terms'), 10, 3);
1086
- $terms = get_the_terms(icl_object_id($post_id,get_post_type($post_id),true,$sitepress->get_default_language()),'product_shipping_class');
1087
  add_filter('get_the_terms',array($this,'shipping_terms'), 10, 3);
1088
  return $terms;
1089
  }
247
  }else{
248
 
249
  $current_shop_id = woocommerce_get_page_id( 'shop' );
250
+ $default_shop_id = apply_filters( 'translate_object_id', $current_shop_id, 'page', true, $sitepress->get_default_language() );
251
 
252
  if ( is_null( get_post( $current_shop_id ) ) || is_null( get_post( $default_shop_id ) ) )
253
  return $value;
486
  if(isset($_POST['display_type'])){
487
  update_woocommerce_term_meta( $translation->term_id, 'display_type', esc_attr( $_POST['display_type'] ) );
488
  }
489
+ update_woocommerce_term_meta( $translation->term_id, 'thumbnail_id', apply_filters( 'translate_object_id',esc_attr( $_POST['product_cat_thumbnail_id'] ),'attachment',true,$translation->language_code));
490
  }
491
  }
492
  }
689
 
690
  if($term_language->language_code != $sitepress->get_default_language()){
691
  // get term in the default language
692
+ $term_id = apply_filters( 'translate_object_id',$term_id, $taxonomy, false, $sitepress->get_default_language());
693
 
694
  //does it belong to any posts (variations)
695
  $objects = get_objects_in_term($term_id, $taxonomy);
946
  global $sitepress, $wp_post_types, $wp_taxonomies,$wpdb;
947
 
948
  $default_language = $sitepress->get_default_language();
949
+
950
+ $posts = $wpdb->get_results($wpdb->prepare( "SELECT * FROM $wpdb->posts AS p LEFT JOIN {$wpdb->prefix}icl_translations AS tr ON tr.element_id = p.ID WHERE p.post_status = 'publish' AND p.post_type = %s AND tr.source_language_code is NULL", $object_type ) );
951
 
952
  foreach($posts as $post){
953
 
970
  $translation_term_ids = array();
971
  foreach($terms_of_translation as $term){
972
 
973
+ $term_id_original = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $default_language );
974
  if(!$term_id_original || !in_array($term_id_original, $term_ids)){
975
  // remove term
976
 
1012
  break(3);
1013
  }
1014
  $terms_array = array();
1015
+ $term_id_translated = apply_filters( 'translate_object_id',$term_id, $taxonomy, false, $language);
1016
 
1017
  // not using get_term
1018
  $translated_term = $wpdb->get_row($wpdb->prepare("
1084
  if( !is_admin() && ( get_post_type($post_id) == 'product' || get_post_type($post_id) == 'product_variation' ) && $taxonomy == 'product_shipping_class'){
1085
  global $sitepress;
1086
  remove_filter('get_the_terms',array($this,'shipping_terms'), 10, 3);
1087
+ $terms = get_the_terms(apply_filters( 'translate_object_id',$post_id,get_post_type($post_id),true,$sitepress->get_default_language()),'product_shipping_class');
1088
  add_filter('get_the_terms',array($this,'shipping_terms'), 10, 3);
1089
  return $terms;
1090
  }
inc/wc-strings.class.php CHANGED
@@ -37,6 +37,10 @@ class WCML_WC_Strings{
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 == 'edit.php' && isset($_GET['page']) && $_GET['page'] == 'woocommerce_attributes'){
42
  add_action('admin_footer', array($this, 'show_attribute_label_language_warning'));
@@ -48,7 +52,7 @@ class WCML_WC_Strings{
48
 
49
  add_action( 'woocommerce_product_options_attributes', array ( $this, 'notice_after_woocommerce_product_options_attributes' ) );
50
  }
51
-
52
  function translated_attribute_label($label, $name){
53
  global $sitepress;
54
 
@@ -73,6 +77,13 @@ class WCML_WC_Strings{
73
  }
74
 
75
  }
 
 
 
 
 
 
 
76
  $name = sanitize_title($name);
77
  $lang = $sitepress->get_current_language();
78
  $trnsl_labels = get_option('wcml_custom_attr_translations');
@@ -81,18 +92,18 @@ class WCML_WC_Strings{
81
  return $trnsl_labels[$lang][$name];
82
  }
83
 
84
- return icl_t('WordPress','taxonomy singular name: '.$label,$label);
85
  }
86
 
87
  function translated_cart_item_name($title, $values, $cart_item_key){
88
 
89
  if($values){
90
  $parent = $values['data']->post->post_parent;
91
- $tr_product_id = icl_object_id( $values['product_id'], 'product', true );
92
  $title = get_the_title($tr_product_id);
93
 
94
  if($parent){
95
- $tr_parent = icl_object_id( $parent, 'product', true );
96
  $title = get_the_title( $tr_parent ) . ' &rarr; ' . $title;
97
  }
98
 
@@ -112,7 +123,7 @@ class WCML_WC_Strings{
112
  global $sitepress;
113
 
114
  if(isset($product->id)){
115
- $tr_product_id = icl_object_id($product->id,'product',true,$sitepress->get_current_language());
116
  $title = get_the_title($tr_product_id);
117
  }
118
 
@@ -204,8 +215,9 @@ class WCML_WC_Strings{
204
  }
205
 
206
  function register_shipping_methods($available_methods){
207
- foreach($available_methods as $method){
208
- $method->label = icl_translate('woocommerce', $method->label .'_shipping_method_title', $method->label);
 
209
  }
210
 
211
  return $available_methods;
@@ -272,14 +284,7 @@ class WCML_WC_Strings{
272
  }
273
 
274
  function show_custom_url_base_language_requirement(){
275
- global $sitepress_settings, $sitepress;
276
-
277
- echo '<div id="wpml_wcml_custom_base_req" style="display:none"><br /><i>';
278
- if( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG ){
279
- $strings_language = $sitepress->get_language_details($sitepress_settings['st']['strings_language']);
280
- echo sprintf(__('Please enter string in %s (the strings language)', 'wpml-wcml'), '<strong>' . $strings_language['display_name'] . '</strong>');
281
- }
282
- echo '</i></div>';
283
  ?>
284
  <script>
285
  if(jQuery('#woocommerce_permalink_structure').length){
@@ -293,6 +298,59 @@ class WCML_WC_Strings{
293
 
294
  }
295
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  function show_attribute_label_language_warning(){
297
  global $sitepress_settings, $sitepress;
298
 
@@ -439,7 +497,7 @@ class WCML_WC_Strings{
439
  global $sitepress;
440
 
441
  if( isset( $_GET['post'] ) && $sitepress->get_default_language() != $sitepress->get_current_language() ){
442
- $original_product_id = icl_object_id( $_GET['post'], 'product', true, $sitepress->get_default_language() );
443
 
444
  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 ) );
445
  }
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'){
42
+ add_action('admin_footer', array($this, 'show_language_notice_for_wc_settings'));
43
+ }
44
 
45
  if(is_admin() && $pagenow == 'edit.php' && isset($_GET['page']) && $_GET['page'] == 'woocommerce_attributes'){
46
  add_action('admin_footer', array($this, 'show_attribute_label_language_warning'));
52
 
53
  add_action( 'woocommerce_product_options_attributes', array ( $this, 'notice_after_woocommerce_product_options_attributes' ) );
54
  }
55
+
56
  function translated_attribute_label($label, $name){
57
  global $sitepress;
58
 
77
  }
78
 
79
  }
80
+
81
+ $trnsl_label = icl_t('WordPress','taxonomy singular name: '.$label,$label);
82
+
83
+ if( $label != $trnsl_label ){
84
+ return $trnsl_label;
85
+ }
86
+
87
  $name = sanitize_title($name);
88
  $lang = $sitepress->get_current_language();
89
  $trnsl_labels = get_option('wcml_custom_attr_translations');
92
  return $trnsl_labels[$lang][$name];
93
  }
94
 
95
+ return $label;
96
  }
97
 
98
  function translated_cart_item_name($title, $values, $cart_item_key){
99
 
100
  if($values){
101
  $parent = $values['data']->post->post_parent;
102
+ $tr_product_id = apply_filters( 'translate_object_id', $values['product_id'], 'product', true );
103
  $title = get_the_title($tr_product_id);
104
 
105
  if($parent){
106
+ $tr_parent = apply_filters( 'translate_object_id', $parent, 'product', true );
107
  $title = get_the_title( $tr_parent ) . ' &rarr; ' . $title;
108
  }
109
 
123
  global $sitepress;
124
 
125
  if(isset($product->id)){
126
+ $tr_product_id = apply_filters( 'translate_object_id',$product->id,'product',true,$sitepress->get_current_language());
127
  $title = get_the_title($tr_product_id);
128
  }
129
 
215
  }
216
 
217
  function register_shipping_methods($available_methods){
218
+ foreach($available_methods as $key => $method){
219
+ icl_register_string('woocommerce', $key .'_shipping_method_title', $method->label );
220
+ $method->label = icl_t('woocommerce', $key .'_shipping_method_title', $method->label);
221
  }
222
 
223
  return $available_methods;
284
  }
285
 
286
  function show_custom_url_base_language_requirement(){
287
+ $this->string_language_notice();
 
 
 
 
 
 
 
288
  ?>
289
  <script>
290
  if(jQuery('#woocommerce_permalink_structure').length){
298
 
299
  }
300
 
301
+ function show_language_notice_for_wc_settings(){
302
+ $this->string_language_notice();
303
+ ?>
304
+ <script>
305
+ var notice_ids = ['woocommerce_new_order_subject','woocommerce_new_order_heading',
306
+ 'woocommerce_cancelled_order_subject','woocommerce_cancelled_order_heading',
307
+ 'woocommerce_customer_processing_order_subject','woocommerce_customer_processing_order_heading',
308
+ 'woocommerce_customer_completed_order_subject','woocommerce_customer_completed_order_heading',
309
+ 'woocommerce_customer_invoice_subject','woocommerce_customer_invoice_heading',
310
+ 'woocommerce_customer_note_subject','woocommerce_customer_note_heading',
311
+ 'woocommerce_customer_reset_password_subject','woocommerce_customer_reset_password_heading',
312
+ 'woocommerce_customer_new_account_subject','woocommerce_customer_new_account_heading',
313
+ 'woocommerce_bacs_title','woocommerce_bacs_description','woocommerce_bacs_instructions',
314
+ 'woocommerce_cheque_title','woocommerce_cheque_description','woocommerce_cheque_instructions',
315
+ 'woocommerce_cod_title','woocommerce_cod_description','woocommerce_cod_instructions',
316
+ 'woocommerce_paypal_title','woocommerce_paypal_description',
317
+ 'woocommerce_checkout_pay_endpoint',
318
+ 'woocommerce_checkout_order_received_endpoint',
319
+ 'woocommerce_myaccount_add_payment_method_endpoint',
320
+ 'woocommerce_myaccount_view_order_endpoint',
321
+ 'woocommerce_myaccount_edit_account_endpoint',
322
+ 'woocommerce_myaccount_edit_address_endpoint',
323
+ 'woocommerce_myaccount_lost_password_endpoint',
324
+ 'woocommerce_logout_endpoint'
325
+ ];
326
+
327
+ for (i = 0; i < notice_ids.length; i++) {
328
+
329
+ if( jQuery('#'+notice_ids[i]).length ){
330
+ jQuery('#'+notice_ids[i]).after(jQuery('#wpml_wcml_custom_base_req').html());
331
+ }
332
+
333
+ }
334
+
335
+ </script>
336
+ <?php
337
+ }
338
+
339
+ function string_language_notice(){
340
+ global $sitepress_settings, $sitepress,$woocommerce_wpml;
341
+
342
+ echo '<div id="wpml_wcml_custom_base_req" style="display:none"><div><i>';
343
+ if( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $sitepress_settings['st']['strings_language'] != $sitepress->get_default_language() ){
344
+ $strings_language = $sitepress->get_language_details($sitepress_settings['st']['strings_language']);
345
+ echo sprintf(__('Please enter this text in %s', 'wpml-wcml'), '<strong>' . $strings_language['display_name'] . '</strong>');
346
+ echo '</i>&nbsp;<i class="icon-question-sign wcml_tootlip_icon" data-tip="';
347
+ 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'] ).'">';
348
+ }
349
+ echo '</i></div></div>';
350
+
351
+ $woocommerce_wpml->load_tooltip_resources();
352
+ }
353
+
354
  function show_attribute_label_language_warning(){
355
  global $sitepress_settings, $sitepress;
356
 
497
  global $sitepress;
498
 
499
  if( isset( $_GET['post'] ) && $sitepress->get_default_language() != $sitepress->get_current_language() ){
500
+ $original_product_id = apply_filters( 'translate_object_id', $_GET['post'], 'product', true, $sitepress->get_default_language() );
501
 
502
  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 ) );
503
  }
locale/wpml-wcml-fr_FR.mo CHANGED
Binary file
locale/wpml-wcml-he_IL.mo CHANGED
Binary file
locale/wpml-wcml-nl_NL.mo CHANGED
Binary file
locale/wpml-wcml-uk_UA.mo ADDED
Binary file
menu/management.php CHANGED
@@ -60,12 +60,7 @@ if(isset($_GET['tab'])){
60
  <?php endif; ?>
61
  <div class="wcml_wrap">
62
  <?php if(!isset($_GET['tab']) && current_user_can('wpml_manage_woocommerce_multilingual')): ?>
63
- <?php
64
- if( !isset($woocommerce_wpml->multi_currency_support) ){
65
- require_once WCML_PLUGIN_PATH . '/inc/multi-currency-support.class.php';
66
- $woocommerce_wpml->multi_currency_support = new WCML_Multi_Currency_Support;
67
- }
68
- include WCML_PLUGIN_PATH . '/menu/sub/settings.php'; ?>
69
  <?php elseif(isset($all_products_taxonomies[$current_tab]) || isset($products_and_variation_taxonomies[$current_tab]) && current_user_can('wpml_operate_woocommerce_multilingual')): ?>
70
  <?php include WCML_PLUGIN_PATH . '/menu/sub/product-taxonomy.php'; ?>
71
  <?php elseif((isset($_GET['tab']) && $_GET['tab'] == 'products') || !current_user_can('wpml_manage_woocommerce_multilingual')): ?>
60
  <?php endif; ?>
61
  <div class="wcml_wrap">
62
  <?php if(!isset($_GET['tab']) && current_user_can('wpml_manage_woocommerce_multilingual')): ?>
63
+ <?php include WCML_PLUGIN_PATH . '/menu/sub/settings.php'; ?>
 
 
 
 
 
64
  <?php elseif(isset($all_products_taxonomies[$current_tab]) || isset($products_and_variation_taxonomies[$current_tab]) && current_user_can('wpml_operate_woocommerce_multilingual')): ?>
65
  <?php include WCML_PLUGIN_PATH . '/menu/sub/product-taxonomy.php'; ?>
66
  <?php elseif((isset($_GET['tab']) && $_GET['tab'] == 'products') || !current_user_can('wpml_manage_woocommerce_multilingual')): ?>
menu/plugins.php CHANGED
@@ -8,7 +8,7 @@
8
  <div class="wcml-section-header">
9
  <h3>
10
  <?php _e('Plugins Status','wpml-wcml'); ?>
11
- <i class="icon-question-sign js-display-tooltip" data-header="<?php _e('Check required plugins', 'wpml-wcml') ?>" data-content="<?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">
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">
menu/sub/currency-switcher-options.php CHANGED
@@ -9,7 +9,7 @@ $currency_switcher_style = isset($settings['currency_switcher_style'])?$settings
9
  <div class="wcml-section-header">
10
  <h3>
11
  <?php _e('Currency switcher options', 'wpml-wcml'); ?>
12
- <i class="icon-question-sign js-display-tooltip" data-header="<?php _e('Currency switcher', 'wpml-wcml') ?>" data-content="<?php _e('You can customize currency switcher on front-end', 'wpml-wcml') ?>"></i>
13
  </h3>
14
  </div>
15
 
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
 
menu/sub/product-data.php CHANGED
@@ -18,14 +18,20 @@ foreach ($active_languages as $language) {
18
  }
19
  $default_language_display_name = $lang_codes[$default_language];
20
  unset($lang_codes[$default_language]);
21
- $lang_codes = array($default_language => $default_language_display_name)+$lang_codes;
 
 
 
 
 
 
22
 
23
  $button_labels = array(
24
  'save' => esc_attr__('Save', 'wpml-wcml'),
25
  'update' => esc_attr__('Update', 'wpml-wcml'),
26
  );
27
  ?>
28
- <tr class="outer" data-prid="<?php echo $product->ID; ?>">
29
  <td colspan="3">
30
  <div class="wcml_product_row" id="prid_<?php echo $product->ID; ?>" <?php echo isset($pr_edit) ? 'style="display:block;"':''; ?>>
31
  <div class="inner">
@@ -74,25 +80,34 @@ $button_labels = array(
74
  <tr rel="<?php echo $key; ?>">
75
  <td>
76
  <?php echo $lang; ?>
77
- <?php if($default_language == $key): ?>
78
  <a class="edit-translation-link" title="<?php __("edit product", "wpml-wcml") ?>" href="<?php echo get_edit_post_link($product_id); ?>"><i class="icon-edit"></i></a>
79
  <?php else: ?>
80
- <input type="hidden" class="icl_language" value="<?php echo $key ?>" />
 
81
  <input type="hidden" name="end_duplication[<?php echo $product_id ?>][<?php echo $key ?>]" value="<?php echo !intval($is_duplicate_product) ?>" />
82
- <?php $button_label = isset($product_translations[$key]) ? $button_labels['update'] : $button_labels['save'] ;?>
83
  <input type="submit" name="product#<?php echo $product_id ?>#<?php echo $key ?>" disabled value="<?php echo $button_label ?>" class="button-secondary wcml_update">
84
  <span class="wcml_spinner spinner"></span>
85
  <?php endif; ?>
86
  </td>
87
  <?php
88
- if(isset($product_translations[$key])){
89
  $tr_status = $wpdb->get_row($wpdb->prepare("SELECT status,translator_id FROM ". $wpdb->prefix ."icl_translation_status WHERE translation_id = %d",$product_translations[$key]->translation_id));
90
- if(!is_null($tr_status) && get_current_user_id() != $tr_status->translator_id){
 
91
  if($tr_status->status == ICL_TM_IN_PROGRESS){ ?>
92
  <td><?php _e('Translation in progress', 'wpml-wcml'); ?><br>&nbsp;</td>
93
  <?php continue;
94
- }elseif($tr_status->status == ICL_TM_WAITING_FOR_TRANSLATOR){ ?>
95
- <td><?php _e('Waiting for translator', 'wpml-wcml'); ?><br>&nbsp;</td>
 
 
 
 
 
 
 
96
  <?php continue;
97
  }
98
  }
@@ -191,7 +206,7 @@ $button_labels = array(
191
  <div class="wcml_editor_translation">
192
  <?php if($default_language != $key): ?>
193
  <?php
194
- $tr_id = icl_object_id($product_id, 'product', true, $key);
195
  if(!$woocommerce_wpml->settings['first_editor_call']):
196
  wp_editor($trn_contents, 'wcmleditor'.$product_content.$tr_id.$key, array('textarea_name'=>$product_content .'_'.$key,'textarea_rows'=>20,'editor_class'=>'wcml_content_tr')); ?>
197
  <?php else: ?>
18
  }
19
  $default_language_display_name = $lang_codes[$default_language];
20
  unset($lang_codes[$default_language]);
21
+
22
+ if( isset($job->language_code ) ){
23
+ $lang_codes = array($default_language => $default_language_display_name, $job->language_code => $lang_codes[$job->language_code] );
24
+ }else{
25
+ $lang_codes = array($default_language => $default_language_display_name)+$lang_codes;
26
+ }
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"' : ''; ?> >
35
  <td colspan="3">
36
  <div class="wcml_product_row" id="prid_<?php echo $product->ID; ?>" <?php echo isset($pr_edit) ? 'style="display:block;"':''; ?>>
37
  <div class="inner">
80
  <tr rel="<?php echo $key; ?>">
81
  <td>
82
  <?php echo $lang; ?>
83
+ <?php if($default_language == $key && current_user_can('wpml_operate_woocommerce_multilingual') ): ?>
84
  <a class="edit-translation-link" title="<?php __("edit product", "wpml-wcml") ?>" href="<?php echo get_edit_post_link($product_id); ?>"><i class="icon-edit"></i></a>
85
  <?php else: ?>
86
+ <input type="hidden" name="icl_language" value="<?php echo $key ?>" />
87
+ <input type="hidden" name="job_id" value="<?php echo $job_id ?>" />
88
  <input type="hidden" name="end_duplication[<?php echo $product_id ?>][<?php echo $key ?>]" value="<?php echo !intval($is_duplicate_product) ?>" />
89
+ <?php $button_label = isset($product_translations[$key]) && !is_null($product_translations[$key]->element_id) ? $button_labels['update'] : $button_labels['save'] ;?>
90
  <input type="submit" name="product#<?php echo $product_id ?>#<?php echo $key ?>" disabled value="<?php echo $button_label ?>" class="button-secondary wcml_update">
91
  <span class="wcml_spinner spinner"></span>
92
  <?php endif; ?>
93
  </td>
94
  <?php
95
+ if(!current_user_can('wpml_manage_woocommerce_multilingual') && isset($product_translations[$key])){
96
  $tr_status = $wpdb->get_row($wpdb->prepare("SELECT status,translator_id FROM ". $wpdb->prefix ."icl_translation_status WHERE translation_id = %d",$product_translations[$key]->translation_id));
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("
104
+ SELECT j.job_id
105
+ FROM {$wpdb->prefix}icl_translate_job j
106
+ JOIN {$wpdb->prefix}icl_translation_status s ON j.rid = s.rid
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
  }
206
  <div class="wcml_editor_translation">
207
  <?php if($default_language != $key): ?>
208
  <?php
209
+ $tr_id = apply_filters( 'translate_object_id',$product_id, 'product', true, $key);
210
  if(!$woocommerce_wpml->settings['first_editor_call']):
211
  wp_editor($trn_contents, 'wcmleditor'.$product_content.$tr_id.$key, array('textarea_name'=>$product_content .'_'.$key,'textarea_rows'=>20,'editor_class'=>'wcml_content_tr')); ?>
212
  <?php else: ?>
menu/sub/products.php CHANGED
@@ -9,7 +9,7 @@ $translator_id = false;
9
  if(isset($_GET['prid'])){
10
  if( !$woocommerce_wpml->products->is_original_product($_GET['prid']) ){
11
  $original_language = $this->products->get_original_product_language($_GET['prid']);
12
- $products[] = get_post(icl_object_id($_GET['prid'],'product',true,$original_language));
13
  }else{
14
  $products[] = get_post($_GET['prid']);
15
  }
@@ -17,6 +17,17 @@ if(isset($_GET['prid'])){
17
  $pr_edit = true;
18
  }
19
 
 
 
 
 
 
 
 
 
 
 
 
20
  if( !current_user_can('wpml_operate_woocommerce_multilingual') ) {
21
  global $iclTranslationManagement,$wp_query;
22
  $current_translator = $iclTranslationManagement->get_current_translator();
@@ -28,11 +39,14 @@ if( !current_user_can('wpml_operate_woocommerce_multilingual') ) {
28
  $icl_translation_filter['limit_no'] = $lm;
29
  $translation_jobs = $iclTranslationManagement->get_translation_jobs((array)$icl_translation_filter);
30
  $products = array();
 
31
  foreach ($translation_jobs as $translation_job) {
32
- $products[] = get_post($translation_job->original_doc_id);
 
 
 
33
  }
34
 
35
- $products_count = $wp_query->found_posts;
36
  }
37
 
38
  }
@@ -65,8 +79,16 @@ $button_labels = array(
65
 
66
  $woocommerce_wpml->settings['first_editor_call'] = false;
67
  $woocommerce_wpml->update_settings();
68
- ?>
69
- <h3><?php _e('WooCommerce Products','wpml-wcml'); ?></h3>
 
 
 
 
 
 
 
 
70
  <span style="display:none" id="wcml_product_update_button_label"><?php echo $button_labels['update'] ?></span>
71
  <form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">
72
  <?php if(!isset($_GET['prid']) && !$translator_id): ?>
@@ -134,7 +156,7 @@ $woocommerce_wpml->update_settings();
134
  </div>
135
  <?php endif; ?>
136
 
137
- <?php if($products): ?>
138
  <div class="wcml_product_pagination">
139
  <span class="displaying-num"><?php printf(__('%d products', 'wpml-wcml'), $products_count); ?></span>
140
  <?php if(!isset($_GET['prid']) && isset($last) && $last > 1): ?>
@@ -157,7 +179,7 @@ $woocommerce_wpml->update_settings();
157
  <tr>
158
  <th scope="col" width="5%"><?php _e('Type', 'wpml-wcml') ?></th>
159
  <th scope="col" width="20%"><?php _e('Product', 'wpml-wcml') ?></th>
160
- <th scope="col" width="75%"><?php echo $woocommerce_wpml->products->get_translation_flags($active_languages,$slang); ?></th>
161
  </tr>
162
  </thead>
163
  <tbody>
@@ -166,7 +188,7 @@ $woocommerce_wpml->update_settings();
166
  <?php else: ?>
167
  <?php foreach ($products as $product) :
168
  $trid = $sitepress->get_element_trid($product->ID,'post_'.$product->post_type);
169
- $product_translations = $sitepress->get_element_translations($trid,'post_'.$product->post_type,true,true);
170
  if(!$slang){
171
  foreach($product_translations as $lang_code=>$translation){
172
  if($translation->original){
@@ -176,7 +198,7 @@ $woocommerce_wpml->update_settings();
176
  } else{
177
  $original_lang = $slang;
178
  }
179
- $product_id = icl_object_id($product->ID,'product',true,$original_lang);
180
 
181
  ?>
182
  <tr>
@@ -208,21 +230,34 @@ $woocommerce_wpml->update_settings();
208
  </td>
209
  <td>
210
  <div class="translations_statuses prid_<?php echo $product->ID; ?>">
211
- <?php echo $woocommerce_wpml->products->get_translation_statuses($product_translations,$active_languages,$slang,$trid,$translator_id); ?>
 
 
 
 
 
 
212
  </div>
213
  <span class="spinner"></span>
214
- <a href="#prid_<?php echo $product->ID; ?>" id="wcml_details_<?php echo $product->ID; ?>" class="wcml_details" data-text-opened="<?php _e('Close', 'wpml-wcml') ?>" data-text-closed="<?php _e('Edit translation', 'wpml-wcml') ?>"><?php _e('Edit translation', 'wpml-wcml') ?></a>
215
 
216
  </td>
217
  </tr>
218
- <?php endforeach; ?>
 
 
 
 
 
 
 
219
  <?php endif; ?>
220
  </tbody>
221
  </table>
222
 
223
  <div class="wcml_fade"></div>
224
 
225
- <?php if($products): ?>
226
  <div class="wcml_product_pagination">
227
  <span class="displaying-num"><?php printf(__('%d products', 'wpml-wcml'), $products_count); ?></span>
228
  <?php if(!isset($_GET['prid']) && isset($last) && $last > 1): ?>
9
  if(isset($_GET['prid'])){
10
  if( !$woocommerce_wpml->products->is_original_product($_GET['prid']) ){
11
  $original_language = $this->products->get_original_product_language($_GET['prid']);
12
+ $products[] = get_post(apply_filters( 'translate_object_id',$_GET['prid'],'product',true,$original_language));
13
  }else{
14
  $products[] = get_post($_GET['prid']);
15
  }
17
  $pr_edit = true;
18
  }
19
 
20
+ $job_id = 0;
21
+ if(isset($_GET['job_id'])){
22
+ $job_id = $_GET['job_id'];
23
+
24
+ global $iclTranslationManagement;
25
+ $job = $iclTranslationManagement->get_translation_job( $_GET['job_id'] );
26
+
27
+ $job_language = $job->language_code;
28
+ }
29
+
30
+
31
  if( !current_user_can('wpml_operate_woocommerce_multilingual') ) {
32
  global $iclTranslationManagement,$wp_query;
33
  $current_translator = $iclTranslationManagement->get_current_translator();
39
  $icl_translation_filter['limit_no'] = $lm;
40
  $translation_jobs = $iclTranslationManagement->get_translation_jobs((array)$icl_translation_filter);
41
  $products = array();
42
+ $products_count = 0;
43
  foreach ($translation_jobs as $translation_job) {
44
+ if( $translation_job->original_post_type == 'post_product' && !array_key_exists( $translation_job->original_doc_id, $products ) ){
45
+ $products[$translation_job->original_doc_id] = get_post($translation_job->original_doc_id);
46
+ $products_count ++;
47
+ }
48
  }
49
 
 
50
  }
51
 
52
  }
79
 
80
  $woocommerce_wpml->settings['first_editor_call'] = false;
81
  $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>
93
  <form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">
94
  <?php if(!isset($_GET['prid']) && !$translator_id): ?>
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): ?>
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>
188
  <?php else: ?>
189
  <?php foreach ($products as $product) :
190
  $trid = $sitepress->get_element_trid($product->ID,'post_'.$product->post_type);
191
+ $product_translations = $sitepress->get_element_translations($trid,'post_'.$product->post_type,true,true);
192
  if(!$slang){
193
  foreach($product_translations as $lang_code=>$translation){
194
  if($translation->original){
198
  } else{
199
  $original_lang = $slang;
200
  }
201
+ $product_id = apply_filters( 'translate_object_id',$product->ID,'product',true,$original_lang);
202
 
203
  ?>
204
  <tr>
230
  </td>
231
  <td>
232
  <div class="translations_statuses prid_<?php echo $product->ID; ?>">
233
+ <?php
234
+ if( isset( $current_translator ) ){
235
+ $prod_lang = $woocommerce_wpml->products->get_original_product_language($product->ID);
236
+ }else{
237
+ $prod_lang = $slang;
238
+ }
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>
246
+
247
+ <?php
248
+ if( isset( $_GET['prid']) ){
249
+ $default_language = $sitepress->get_language_for_element($_GET['prid'],'post_product');
250
+ $display_inline = true;
251
+ include WCML_PLUGIN_PATH . '/menu/sub/product-data.php';
252
+ }
253
+ endforeach; ?>
254
  <?php endif; ?>
255
  </tbody>
256
  </table>
257
 
258
  <div class="wcml_fade"></div>
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): ?>
menu/sub/settings.php CHANGED
@@ -6,24 +6,24 @@ $default_language = $sitepress->get_default_language();
6
  <div class="wcml-section-header">
7
  <h3>
8
  <?php _e('Plugins Status','wpml-wcml'); ?>
9
- <i class="icon-question-sign js-display-tooltip" data-header="<?php _e('Check required plugins', 'wpml-wcml') ?>" data-content="<?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>
@@ -31,8 +31,8 @@ $default_language = $sitepress->get_default_language();
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 -->
38
 
@@ -43,70 +43,74 @@ $default_language = $sitepress->get_default_language();
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' && ( $sitepress_settings['st']['strings_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 js-display-tooltip" data-header="<?php _e('Configuration warnings', 'wpml-wcml') ?>" data-content="<?php _e('Reporting miscelaneous configuration issues that can make WooCommerce Multilingual not run normally', 'wpml-wcml') ?>"></i>
52
- </h3>
53
- </div>
54
-
55
- <div class="wcml-section-content">
56
 
57
- <?php if( !empty( $miss_slug_lang ) ): ?>
58
 
59
- <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>
60
 
61
- <?php endif;?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
- <?php if(!WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en'): ?>
64
-
65
- <?php if($sitepress_settings['st']['strings_language'] != 'en'): ?>
66
- <p><i class="icon-warning-sign"></i><strong><?php _e('Attention required: probable problem with URLs in different languages', 'wpml-wcml') ?></strong></p>
67
-
68
- <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>
69
-
70
- <ul>
71
- <li>&raquo;&nbsp;<?php _e('Change the strings language to English', 'wpml-wcml') ?></li>
72
- <li>&raquo;&nbsp;<?php _e('Re-scan strings', 'wpml-wcml') ?></li>
73
- </ul>
74
-
75
- <p class="submit">
76
- <input type="hidden" id="wcml_fix_strings_language_nonce" value="<?php echo wp_create_nonce('wcml_fix_strings_language') ?>" />
77
- <input id="wcml_fix_strings_language" type="button" class="button-primary" value="<?php esc_attr_e('Run fix', 'wpml-wcml') ?>" />
78
- </p>
79
-
80
- <?php else: ?>
81
- <p><?php _e("Your site's default language is not English. There are some settings that require careful attention.", 'wpml-wcml') ?> </p>
82
- <?php endif; ?>
83
-
84
- <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>
85
-
86
- <?php if($sitepress_settings['st']['strings_language'] == 'en'): ?>
87
- <p class="submit">
88
- <input id="wcml_dimiss_non_default_language_warning" type="button" class="button-primary" value="<?php esc_attr_e('Dismiss', 'wpml-wcml') ?>" />
89
- </p>
90
- <?php endif; ?>
91
-
92
- <?php endif; ?>
93
-
94
- <?php if(!empty($woocommerce_wpml->dependencies->xml_config_errors)): ?>
95
- <p><i class="icon-warning-sign"></i>
96
- <strong><?php _e('Some settings from the WooCommerce Multilingual wpml-config.xml file have been overwritten.', 'wpml-wcml'); ?></strong>
97
- </p>
98
- <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'),
99
- '<a href="' . admin_url('admin.php?page=' . WPML_TM_FOLDER . '/menu/main.php&sm=mcsetup') . '">' , '</a>') ?>
100
- </p>
101
- <ul>
102
- <?php foreach($woocommerce_wpml->dependencies->xml_config_errors as $error): ?>
103
- <li><?php echo $error ?></li>
104
- <?php endforeach; ?>
105
- </ul>
106
- <?php endif; ?>
107
  </div>
108
-
109
- </div>
110
  <?php endif; ?>
111
 
112
 
@@ -115,7 +119,7 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && ( $site
115
  <div class="wcml-section-header">
116
  <h3>
117
  <?php _e('WooCommerce Store Pages','wpml-wcml'); ?>
118
- <i class="icon-question-sign js-display-tooltip" data-header="<?php _e('Translated store pages', 'wpml-wcml') ?>" data-content="<?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>
119
  </h3>
120
  </div>
121
 
@@ -138,13 +142,13 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && ( $site
138
  <?php
139
  if(isset($miss_lang['codes'])): ?>
140
  </p>
141
- <?php
142
- if(count($miss_lang['codes']) == 1){
143
- _e("WooCommerce store pages don't exist for this language:",'wpml-wcml');
144
- }else{
145
- _e("WooCommerce store pages don't exist for these languages:",'wpml-wcml');
146
- }
147
- ?>
148
  </p>
149
  <?php endif; ?>
150
 
@@ -185,7 +189,7 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && ( $site
185
  <div class="wcml-section-header">
186
  <h3>
187
  <?php _e('Taxonomies missing translations','wpml-wcml'); ?>
188
- <i class="icon-question-sign js-display-tooltip" data-header="<?php esc_attr_e('Taxonomies without translation', 'wpml-wcml') ?>" data-content="<?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>
189
  </h3>
190
  </div>
191
 
@@ -203,50 +207,50 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && ( $site
203
  }
204
 
205
  ?>
206
-
207
- <ul>
208
- <?php
209
- $no_tax_to_update = true;
210
- foreach($taxonomies as $taxonomy): ?>
211
- <?php if($taxonomy == 'product_type' || WCML_Terms::get_untranslated_terms_number($taxonomy) == 0){
212
- continue;
213
- }else{
214
- $no_tax_to_update = false;
215
- }?>
216
- <li class="js-tax-translation-<?php echo $taxonomy ?>">
217
- <?php if($untranslated = WCML_Terms::get_untranslated_terms_number($taxonomy)): ?>
218
- <?php if(WCML_Terms::is_fully_translated($taxonomy)): // covers the 'ignore' case' ?>
219
- <i class="icon-ok"></i> <?php printf(__('%s do not require translation.', 'wpml-wcml'), get_taxonomy($taxonomy)->labels->name); ?>
220
- <div class="actions">
221
- <a href="#unignore-<?php echo $taxonomy ?>" title="<?php esc_attr_e('This taxonomy requires translation.', 'wpml-wcml') ?>"><?php _e('Change', 'wpml-wcml') ?></a>
222
- </div>
223
- <?php else: ?>
224
- <i class="icon-warning-sign"></i> <?php printf(__('Some %s are missing translations (%d translations missing).', 'wpml-wcml'), get_taxonomy($taxonomy)->labels->name, $untranslated); ?>
225
- <div class="actions">
226
- <a href="<?php echo admin_url('admin.php?page=wpml-wcml&tab=' . $taxonomy) ?>"><?php _e('Translate now', 'wpml-wcml') ?></a> |
227
- <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>
228
- </div>
229
- <?php endif; ?>
230
- <?php else: ?>
231
- <i class="icon-ok"></i> <?php printf(__('All %s are translated.', 'wpml-wcml'), get_taxonomy($taxonomy)->labels->name); ?>
 
 
 
 
 
232
  <?php endif; ?>
233
- </li>
234
- <?php endforeach; ?>
235
- <?php if($no_tax_to_update): ?>
236
- <li><i class="icon-ok"></i> <?php _e('Right now, there are no taxonomy terms needing translation.', 'wpml-wcml'); ?></li>
237
- <?php endif; ?>
238
- </ul>
239
-
240
-
241
  </div>
242
-
243
  </div>
244
 
245
  <div class="wcml-section">
246
  <div class="wcml-section-header">
247
  <h3>
248
  <?php _e('Product Translation Interface','wpml-wcml'); ?>
249
- <i class="icon-question-sign js-display-tooltip" data-header="<?php _e('Product translation interface', 'wpml-wcml') ?>" data-content="<?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>
250
  </h3>
251
  </div>
252
  <div class="wcml-section-content">
@@ -278,10 +282,10 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && ( $site
278
  <div class="wcml-section-header">
279
  <h3>
280
  <?php _e('Products synchronization', 'wpml-wcml'); ?>
281
- <i class="icon-question-sign js-display-tooltip" data-header="<?php _e('Products synchronization', 'wpml-wcml') ?>" data-content="<?php _e('Configure specific product properties that should be synced to translations.', 'wpml-wcml') ?>"></i>
282
  </h3>
283
  </div>
284
-
285
  <div class="wcml-section-content">
286
  <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
287
  <?php wp_nonce_field('wcml_products_sync_prop', 'wcml_nonce'); ?>
@@ -309,7 +313,7 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && ( $site
309
  <div class="wcml-section-header">
310
  <h3>
311
  <?php _e('File Paths Synchronization ', 'wpml-wcml'); ?>
312
- <i class="icon-question-sign js-display-tooltip" data-header="<?php _e('Synchronization for download paths', 'wpml-wcml') ?>" data-content="<?php _e('If you are using downloadable products, you can choose to have their paths synchronized, or seperate for each language.', 'wpml-wcml') ?>"></i>
313
  </h3>
314
  </div>
315
 
@@ -336,257 +340,257 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && ( $site
336
  </div> <!-- .wcml-section -->
337
 
338
 
339
- <div class="wcml-section">
340
-
341
- <div class="wcml-section-header">
342
- <h3>
343
- <?php _e('Manage Currencies', 'wpml-wcml'); ?>
344
- <i class="icon-question-sign js-display-tooltip" data-header="<?php _e('Currency management', 'wpml-wcml') ?>" data-content="<?php _e('This will let you enable the multi-currency mode where users can see prices according to their currency preference and configured exchange rate.', 'wpml-wcml') ?>"></i>
345
- </h3>
346
- </div>
347
- <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>" id="wcml_mc_options">
348
- <div class="wcml-section-content">
349
- <?php wp_nonce_field('wcml_mc_options', 'wcml_nonce'); ?>
350
-
351
- <ul id="wcml_mc_options_block">
352
-
353
- <li>
354
- <ul id="multi_currency_option_select">
355
- <li>
356
- <input type="radio" name="multi_currency" id="multi_currency_disabled" value="<?php echo WCML_MULTI_CURRENCIES_DISABLED ?>" <?php
357
- echo checked($woocommerce_wpml->settings['enable_multi_currency'], WCML_MULTI_CURRENCIES_DISABLED) ?> />
358
- <label for="multi_currency_disabled"><?php _e("No multi-currency.",'wpml-wcml'); ?></label>
359
- </li>
360
- <li>
361
- <input type="radio" name="multi_currency" id="multi_currency_independent" value="<?php echo WCML_MULTI_CURRENCIES_INDEPENDENT ?>" <?php
362
- echo checked($woocommerce_wpml->settings['enable_multi_currency'], WCML_MULTI_CURRENCIES_INDEPENDENT) ?> />
363
- <label for="multi_currency_independent">
364
- <?php _e("Multiple currencies, independent of languages.",'wpml-wcml'); ?>
365
- &nbsp;
366
- <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>.
367
- </label>
368
- </li>
369
- </ul>
370
- </li>
371
- </ul>
372
 
373
-
374
-
375
-
376
-
377
- <div id="multi-currency-per-language-details" <?php if ( $woocommerce_wpml->settings['enable_multi_currency'] != WCML_MULTI_CURRENCIES_INDEPENDENT ):?>style="display:none"<?php endif;?>>
378
- <div class="currencies-table-content">
379
- <?php
380
- $wc_currencies = get_woocommerce_currencies();
381
- $wc_currency = get_option('woocommerce_currency');
382
- $active_languages = $sitepress->get_active_languages();
383
-
384
- switch(get_option('woocommerce_currency_pos')){
385
- case 'left': $positioned_price = sprintf('%s99.99', get_woocommerce_currency_symbol($wc_currency)); break;
386
- case 'right': $positioned_price = sprintf('99.99%s', get_woocommerce_currency_symbol($wc_currency)); break;
387
- case 'left_space': $positioned_price = sprintf('%s 99.99', get_woocommerce_currency_symbol($wc_currency)); break;
388
- case 'right_space': $positioned_price = sprintf('99.99 %s', get_woocommerce_currency_symbol($wc_currency)); break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  }
390
-
391
  ?>
392
- <p>
393
- <?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>'); ?>
394
- </p>
395
- <input type="hidden" id="update_currency_lang_nonce" value="<?php echo wp_create_nonce('wcml_update_currency_lang'); ?>"/>
396
- <table class="widefat currency_table" id="currency-table">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
397
  <thead>
398
- <tr>
399
- <th><?php _e('Currency', 'wpml-wcml'); ?></th>
400
- <th></th>
401
- </tr>
 
 
 
402
  </thead>
403
  <tbody>
404
- <tr>
405
- <td class="currency_code">
406
- <span class="code_val"><?php echo $wc_currencies[$wc_currency]; ?><?php printf(__(' (%s)','wpml-wcml'), $positioned_price); ?></span>
407
- <div class="currency_value"><span><?php _e( 'default', 'wpml-wcml' ); ?></span></div>
 
 
 
 
 
408
  </td>
409
- <td class="currency-actions"></td>
410
-
411
- </tr>
412
- <?php
413
- unset($wc_currencies[$wc_currency]);
414
- $currencies = $woocommerce_wpml->multi_currency_support->get_currencies();
415
- foreach ($currencies as $code => $currency) :
416
- switch($currency['position']){
417
- case 'left': $positioned_price = sprintf('%s99.99', get_woocommerce_currency_symbol($code)); break;
418
- case 'right': $positioned_price = sprintf('99.99%s', get_woocommerce_currency_symbol($code)); break;
419
- case 'left_space': $positioned_price = sprintf('%s 99.99', get_woocommerce_currency_symbol($code)); break;
420
- case 'right_space': $positioned_price = sprintf('99.99 %s', get_woocommerce_currency_symbol($code)); break;
421
- }
422
- ?>
423
- <tr id="currency_row_<?php echo $code ?>">
424
- <td class="currency_code">
425
- <?php include WCML_PLUGIN_PATH . '/menu/sub/custom-currency-options.php'; ?>
426
- <span class="code_val"><?php echo $wc_currencies[$code]; ?><?php printf(__(' (%s)','wpml-wcml'), $positioned_price); ?></span>
427
- <div class="currency_value">
428
- <span><?php printf('1 %s = %s %s', $wc_currency, $currency['rate'], $code); ?></span>
429
- </div>
430
-
431
- </td>
432
-
433
- <td class="currency-actions">
434
- <div class="currency_action_update">
435
- <a href="javascript:void(0);" title="<?php esc_attr(_e('Edit', 'wpml-wcml')); ?>" class="edit_currency" data-currency="<?php echo $code ?>">
436
- <i class="icon-edit" title="<?php esc_attr(_e('Edit', 'wpml-wcml')); ?>"></i>
437
- </a>
438
- <i class="icon-ok-circle save_currency"></i>
439
- </div>
440
- <div class="currency_action_delete">
441
- <a href="javascript:void(0);" title="<?php esc_attr(_e('Delete', 'wpml-wcml')); ?>" class="delete_currency" data-currency="<?php echo $code ?>" >
442
- <i class="icon-trash" title="<?php esc_attr(_e('Delete', 'wpml-wcml')); ?>"></i>
443
- </a>
444
- <i class="icon-remove-circle cancel_currency"></i>
445
  </div>
446
  </td>
447
- </tr>
448
- <?php endforeach; ?>
449
- <tr class="default_currency">
450
- <td colspan="2">
451
- <span class="cur_label"><?php _e('Default currency', 'wpml-wcml'); ?></span>
452
- <span class="inf_message"><?php _e('Switch to this currency when switching language in the front-end', 'wpml-wcml'); ?></span>
453
- </td>
454
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
455
  </tbody>
456
  </table>
 
457
 
458
- <div class="currency_wrap">
459
- <div class="currency_inner">
460
- <table class="widefat currency_lang_table" id="currency-lang-table">
461
- <thead>
462
- <tr>
463
- <?php foreach($active_languages as $language): ?>
464
- <th>
465
- <img src="<?php echo ICL_PLUGIN_URL ?>/res/flags/<?php echo $language['code'] ?>.png" width="18" height="12" />
466
- </th>
467
- <?php endforeach; ?>
468
- </tr>
469
- </thead>
470
- <tbody>
471
- <tr>
472
- <?php foreach($active_languages as $language): ?>
473
- <td class="currency_languages">
474
- <div class="wcml_onof_buttons">
475
- <ul>
476
- <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>
477
- <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>
478
- </ul>
479
- </div>
480
- </td>
481
- <?php endforeach; ?>
482
- </tr>
483
- <?php foreach ($currencies as $code => $currency) : ?>
484
- <tr id="currency_row_langs_<?php echo $code ?>">
485
- <?php foreach($active_languages as $language): ?>
486
- <td class="currency_languages">
487
- <div class="wcml_onof_buttons">
488
- <ul>
489
- <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>
490
- <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>
491
- </ul>
492
- </div>
493
- </td>
494
- <?php endforeach; ?>
495
- </tr>
496
- <?php endforeach; ?>
497
- <tr class="default_currency">
498
- <?php foreach($active_languages as $language): ?>
499
- <td class="currency_languages">
500
- <select rel="<?php echo $language['code']; ?>">
501
- <option value="0" <?php selected('0', $woocommerce_wpml->settings['default_currencies'][$language['code']]); ?>><?php _e('Keep', 'wpml-wcml'); ?></option>
502
- <?php if($woocommerce_wpml->settings['currency_options'][$wc_currency]['languages'][$language['code']] == 1): ?>
503
- <option value="<?php echo $wc_currency; ?>" <?php selected($wc_currency, $woocommerce_wpml->settings['default_currencies'][$language['code']]); ?>><?php echo $wc_currency; ?></option>
504
- <?php endif; ?>
505
- <?php foreach($currencies as $code2 => $currency2): ?>
506
- <?php if($woocommerce_wpml->settings['currency_options'][$code2]['languages'][$language['code']] == 1): ?>
507
- <option value="<?php echo $code2; ?>" <?php selected($code2, $woocommerce_wpml->settings['default_currencies'][$language['code']]); ?>><?php echo $code2; ?></option>
508
- <?php endif; ?>
509
- <?php endforeach; ?>
510
- </select>
511
- </td>
512
- <?php endforeach; ?>
513
- </tr>
514
- </tbody>
515
- </table>
516
- <input type="hidden" id="wcml_update_default_currency_nonce" value="<?php echo wp_create_nonce('wcml_update_default_currency'); ?>"/>
517
-
518
- </div>
519
- </div>
520
-
521
- <?php // this is a template for scripts.js : jQuery('.wcml_add_currency button').click(function(); ?>
522
- <table class="hidden js-table-row-wrapper">
523
- <tr class="edit-mode js-table-row">
524
- <td class="currency_code" data-message="<?php _e( 'Please fill field', 'wpml-wcml' ); ?>">
525
- <span class="code_val"></span>
526
- <select name="code" style="display:block">
527
- <?php foreach($wc_currencies as $wc_code=>$currency_name): ?>
528
- <?php if(empty($currencies[$wc_code])): ?>
529
- <option value="<?php echo $wc_code; ?>"><?php echo $currency_name; ?></option>
530
- <?php endif; ?>
531
- <?php endforeach; ?>
532
- </select>
533
- <div class="currency_value" data-message="<?php _e( 'Only numeric', 'wpml-wcml' ); ?>">
534
  <span>
535
  <?php printf('1 %s = ',$wc_currency); ?>
536
  <span class="curr_val"></span>
537
  <input type="text" value="" style="display: inline-block;">
538
  <span class="curr_val_code"></span>
539
  </span>
540
- </div>
541
- </td>
542
- <td class="currency-actions">
543
- <div class="currency_action_update">
544
- <a href="javascript:void(0);" title="Edit" class="edit_currency" style="display:none">
545
- <i class="icon-edit" title="Edit"></i>
546
- </a>
547
- <i class="icon-ok-circle save_currency" style="display:inline"></i>
548
- </div>
549
- <div class="currency_action_delete">
550
- <a href="javascript:void(0);" title="Delete" class="delete_currency" data-currency="" style="display:none">
551
- <i class="icon-trash" alt="Delete"></i>
552
- </a>
553
- <i class="icon-remove-circle cancel_currency" style="display:inline"></i>
554
- </div>
555
- </td>
556
- </tr>
557
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
558
 
559
- <table class="hidden js-currency_lang_table">
560
- <tr>
561
- <?php foreach($active_languages as $language): ?>
562
- <td class="currency_languages">
563
- <div class="wcml_onof_buttons">
564
- <ul>
565
- <li><a class="off_btn" href="javascript:void(0);" data-language="<?php echo $language['code']; ?>"><?php _e( 'OFF', 'wpml-wcml' ); ?></a></li>
566
- <li class="on"><a class="on_btn" href="javascript:void(0);" data-language="<?php echo $language['code']; ?>"><?php _e( 'ON', 'wpml-wcml' ); ?></a></li>
567
- </ul>
568
- </div>
569
- </td>
570
- <?php endforeach; ?>
571
- </tr>
572
- </table>
573
 
574
- <input type="hidden" value="<?php echo WCML_PLUGIN_URL; ?>" class="wcml_plugin_url" />
575
- <input type="hidden" id="new_currency_nonce" value="<?php echo wp_create_nonce('wcml_new_currency'); ?>" />
576
- <input type="hidden" id="del_currency_nonce" value="<?php echo wp_create_nonce('wcml_delete_currency'); ?>" />
577
- <input type="hidden" id="currencies_list_nonce" value="<?php echo wp_create_nonce('wcml_currencies_list'); ?>" />
578
- </div>
579
-
580
- <p class="wcml_add_currency button-wrap">
581
- <button type="button" class="button-secondary">
582
- <i class="icon-plus"></i>
583
- <?php _e('Add currency','wpml-wcml'); ?>
584
- </button>
585
- </p>
586
-
587
- <?php // backward compatibility ?>
588
- <?php
589
- $posts = $wpdb->get_results($wpdb->prepare("
590
  SELECT m.post_id, m.meta_value, p.post_title
591
  FROM {$wpdb->postmeta} m
592
  JOIN {$wpdb->posts} p ON p.ID = m.post_id
@@ -594,9 +598,9 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && ( $site
594
  WHERE m.meta_key='_custom_conversion_rate' AND t.language_code = %s
595
  ORDER BY m.post_id desc
596
  ", $default_language));
597
-
598
- if($posts){
599
- echo "<script>
600
  function wcml_remove_custom_rates(post_id, el){
601
  jQuery.ajax({
602
  type: 'post',
@@ -608,82 +612,83 @@ if( ( !WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en' && ( $site
608
  }
609
  })
610
  return false;
611
- }";
612
- echo '</script>';
613
- 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>';
614
- echo '<form method="post" id="wcml_custom_exchange_rates">';
615
- echo '<input type="hidden" name="action" value="legacy_update_custom_rates">';
616
- echo '<table class="widefat currency_table" >';
617
- echo '<thead>';
618
- echo '<tr>';
619
- echo '<th rowspan="2">' . __('Product', 'wpml-wcml') . '</th>';
620
- echo '<th colspan="' . count($currencies) . '">_price</th>';
621
- echo '<th colspan="' . count($currencies) . '">_sale_price</th>';
622
- echo '<th rowspan="2">&nbsp;</th>';
623
- echo '</tr>';
624
- echo '<tr>';
625
- foreach($currencies as $code => $currency){
626
- echo '<th>' . $code . '</th>';
627
- }
628
- foreach($currencies as $code => $currency){
629
- echo '<th>' . $code . '</th>';
630
- }
631
- echo '</tr>';
632
- echo '</thead>';
633
- echo '<tbody>';
634
- foreach($posts as $post){
635
- $rates = unserialize($post->meta_value);
636
- echo '<tr>';
637
- echo '<td><a href="' . get_edit_post_link($post->post_id) . '">' . apply_filters('the_title', $post->post_title) . '</a></td>';
638
-
639
- foreach($currencies as $code => $currency){
640
- echo '<td>';
641
- if(isset($rates['_price'][$code])){
642
- echo '<input name="posts[' . $post->post_id . '][_price][' . $code . ']" size="3" value="' . round($rates['_price'][$code],3) . '">';
643
- }else{
644
- _e('n/a', 'wpml-wcml');
645
- }
646
- echo '</td>';
647
- }
648
-
649
- foreach($currencies as $code => $currency){
650
- echo '<td>';
651
- if(isset($rates['_sale_price'][$code])){
652
- echo '<input name="posts[' . $post->post_id . '][_sale_price][' . $code . ']" size="3" value="' . round($rates['_sale_price'][$code],3) . '">';
653
- }else{
654
- _e('n/a', 'wpml-wcml');
655
- }
656
- echo '</td>';
657
- }
658
-
659
- 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>';
660
- echo '<tr>';
661
-
662
- }
663
- echo '</tbody>';
664
- echo '</table>';
665
- echo '<p class="button-wrap"><input class="button-secondary" type="submit" value="' . esc_attr__('Update', 'wpml-wcml') . '" /></p>';
666
- echo '</form>';
667
-
668
-
669
- }
670
- ?>
671
- <ul id="display_custom_prices_select">
672
- <li>
673
- <input type="checkbox" name="display_custom_prices" id="display_custom_prices" value="1" <?php echo checked( 1, $woocommerce_wpml->settings['display_custom_prices']) ?> >
674
- <label for="display_custom_prices"><?php _e('Show only products with custom prices in secondary currencies', 'wpml-wcml'); ?></label>
675
- </li>
676
- </ul>
677
- <p class="button-wrap general_option_btn">
678
- <input type='submit' name="wcml_mc_options" value='<?php _e('Save', 'wpml-wcml'); ?>' class='button-secondary' />
679
- <?php wp_nonce_field('wcml_mc_options', 'wcml_mc_options_nonce'); ?>
680
- </p>
681
- </div>
682
- </div> <!-- .wcml-section-content -->
683
- <div class="wcml-section">
684
- <?php include WCML_PLUGIN_PATH . '/menu/sub/currency-switcher-options.php'; ?>
685
- </div>
686
- </form>
 
687
  </div> <!-- .wcml-section -->
688
  <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');?>"/>
689
  <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');?>"/>
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>
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 -->
38
 
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
 
55
+ <div class="wcml-section-content">
56
 
57
+ <?php if( !empty( $miss_slug_lang ) ): ?>
58
 
59
+ <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>
60
+
61
+ <?php endif;?>
62
+
63
+ <?php if(!WPML_SUPPORT_STRINGS_IN_DIFF_LANG && $default_language != 'en'): ?>
64
+
65
+ <?php if($sitepress_settings['st']['strings_language'] != 'en'): ?>
66
+ <p><i class="icon-warning-sign"></i><strong><?php _e('Attention required: probable problem with URLs in different languages', 'wpml-wcml') ?></strong></p>
67
+
68
+ <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>
69
+
70
+ <ul>
71
+ <li>&raquo;&nbsp;<?php _e('Change the strings language to English', 'wpml-wcml') ?></li>
72
+ <li>&raquo;&nbsp;<?php _e('Re-scan strings', 'wpml-wcml') ?></li>
73
+ </ul>
74
+
75
+ <p class="submit">
76
+ <input type="hidden" id="wcml_fix_strings_language_nonce" value="<?php echo wp_create_nonce('wcml_fix_strings_language') ?>" />
77
+ <input id="wcml_fix_strings_language" type="button" class="button-primary" value="<?php esc_attr_e('Run fix', 'wpml-wcml') ?>" />
78
+ </p>
79
+
80
+ <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>
81
+
82
+ <?php elseif( empty( $woocommerce_wpml->settings['dismiss_non_default_language_warning'] ) ): ?>
83
+
84
+ <p><?php _e("Your site's default language is not English. There are some settings that require careful attention.", 'wpml-wcml') ?> </p>
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 endif; ?>
88
+
89
+ <?php if($sitepress_settings['st']['strings_language'] == 'en' && empty( $woocommerce_wpml->settings['dismiss_non_default_language_warning'] )): ?>
90
+ <p class="submit">
91
+ <input id="wcml_dimiss_non_default_language_warning" type="button" class="button-primary" value="<?php esc_attr_e('Dismiss', 'wpml-wcml') ?>" />
92
+ <?php wp_nonce_field('wcml_settings', 'wcml_settings_nonce'); ?>
93
+ </p>
94
+ <?php endif; ?>
95
+
96
+ <?php endif; ?>
97
+
98
+ <?php if(!empty($woocommerce_wpml->dependencies->xml_config_errors)): ?>
99
+ <p><i class="icon-warning-sign"></i>
100
+ <strong><?php _e('Some settings from the WooCommerce Multilingual wpml-config.xml file have been overwritten.', 'wpml-wcml'); ?></strong>
101
+ </p>
102
+ <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'),
103
+ '<a href="' . admin_url('admin.php?page=' . WPML_TM_FOLDER . '/menu/main.php&sm=mcsetup') . '">' , '</a>') ?>
104
+ </p>
105
+ <ul>
106
+ <?php foreach($woocommerce_wpml->dependencies->xml_config_errors as $error): ?>
107
+ <li><?php echo $error ?></li>
108
+ <?php endforeach; ?>
109
+ </ul>
110
+ <?php endif; ?>
111
+ </div>
112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  </div>
 
 
114
  <?php endif; ?>
115
 
116
 
119
  <div class="wcml-section-header">
120
  <h3>
121
  <?php _e('WooCommerce Store Pages','wpml-wcml'); ?>
122
+ <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>
123
  </h3>
124
  </div>
125
 
142
  <?php
143
  if(isset($miss_lang['codes'])): ?>
144
  </p>
145
+ <?php
146
+ if(count($miss_lang['codes']) == 1){
147
+ _e("WooCommerce store pages don't exist for this language:",'wpml-wcml');
148
+ }else{
149
+ _e("WooCommerce store pages don't exist for these languages:",'wpml-wcml');
150
+ }
151
+ ?>
152
  </p>
153
  <?php endif; ?>
154
 
189
  <div class="wcml-section-header">
190
  <h3>
191
  <?php _e('Taxonomies missing translations','wpml-wcml'); ?>
192
+ <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>
193
  </h3>
194
  </div>
195
 
207
  }
208
 
209
  ?>
210
+
211
+ <ul>
212
+ <?php
213
+ $no_tax_to_update = true;
214
+ foreach($taxonomies as $taxonomy): ?>
215
+ <?php if($taxonomy == 'product_type' || WCML_Terms::get_untranslated_terms_number($taxonomy) == 0){
216
+ continue;
217
+ }else{
218
+ $no_tax_to_update = false;
219
+ }?>
220
+ <li class="js-tax-translation-<?php echo $taxonomy ?>">
221
+ <?php if($untranslated = WCML_Terms::get_untranslated_terms_number($taxonomy)): ?>
222
+ <?php if(WCML_Terms::is_fully_translated($taxonomy)): // covers the 'ignore' case' ?>
223
+ <i class="icon-ok"></i> <?php printf(__('%s do not require translation.', 'wpml-wcml'), get_taxonomy($taxonomy)->labels->name); ?>
224
+ <div class="actions">
225
+ <a href="#unignore-<?php echo $taxonomy ?>" title="<?php esc_attr_e('This taxonomy requires translation.', 'wpml-wcml') ?>"><?php _e('Change', 'wpml-wcml') ?></a>
226
+ </div>
227
+ <?php else: ?>
228
+ <i class="icon-warning-sign"></i> <?php printf(__('Some %s are missing translations (%d translations missing).', 'wpml-wcml'), get_taxonomy($taxonomy)->labels->name, $untranslated); ?>
229
+ <div class="actions">
230
+ <a href="<?php echo admin_url('admin.php?page=wpml-wcml&tab=' . $taxonomy) ?>"><?php _e('Translate now', 'wpml-wcml') ?></a> |
231
+ <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>
232
+ </div>
233
+ <?php endif; ?>
234
+ <?php else: ?>
235
+ <i class="icon-ok"></i> <?php printf(__('All %s are translated.', 'wpml-wcml'), get_taxonomy($taxonomy)->labels->name); ?>
236
+ <?php endif; ?>
237
+ </li>
238
+ <?php endforeach; ?>
239
+ <?php if($no_tax_to_update): ?>
240
+ <li><i class="icon-ok"></i> <?php _e('Right now, there are no taxonomy terms needing translation.', 'wpml-wcml'); ?></li>
241
  <?php endif; ?>
242
+ </ul>
243
+
244
+
 
 
 
 
 
245
  </div>
246
+
247
  </div>
248
 
249
  <div class="wcml-section">
250
  <div class="wcml-section-header">
251
  <h3>
252
  <?php _e('Product Translation Interface','wpml-wcml'); ?>
253
+ <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>
254
  </h3>
255
  </div>
256
  <div class="wcml-section-content">
282
  <div class="wcml-section-header">
283
  <h3>
284
  <?php _e('Products synchronization', 'wpml-wcml'); ?>
285
+ <i class="icon-question-sign" data-tip="<?php _e('Configure specific product properties that should be synced to translations.', 'wpml-wcml') ?>"></i>
286
  </h3>
287
  </div>
288
+
289
  <div class="wcml-section-content">
290
  <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
291
  <?php wp_nonce_field('wcml_products_sync_prop', 'wcml_nonce'); ?>
313
  <div class="wcml-section-header">
314
  <h3>
315
  <?php _e('File Paths Synchronization ', 'wpml-wcml'); ?>
316
+ <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>
317
  </h3>
318
  </div>
319
 
340
  </div> <!-- .wcml-section -->
341
 
342
 
343
+ <div class="wcml-section">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
344
 
345
+ <div class="wcml-section-header">
346
+ <h3>
347
+ <?php _e('Manage Currencies', 'wpml-wcml'); ?>
348
+ <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>
349
+ </h3>
350
+ </div>
351
+ <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>" id="wcml_mc_options">
352
+ <div class="wcml-section-content">
353
+ <?php wp_nonce_field('wcml_mc_options', 'wcml_nonce'); ?>
354
+
355
+ <ul id="wcml_mc_options_block">
356
+
357
+ <li>
358
+ <ul id="multi_currency_option_select">
359
+ <li>
360
+ <input type="radio" name="multi_currency" id="multi_currency_disabled" value="<?php echo WCML_MULTI_CURRENCIES_DISABLED ?>" <?php
361
+ echo checked($woocommerce_wpml->settings['enable_multi_currency'], WCML_MULTI_CURRENCIES_DISABLED) ?> />
362
+ <label for="multi_currency_disabled"><?php _e("No multi-currency.",'wpml-wcml'); ?></label>
363
+ </li>
364
+ <li>
365
+ <input type="radio" name="multi_currency" id="multi_currency_independent" value="<?php echo WCML_MULTI_CURRENCIES_INDEPENDENT ?>" <?php
366
+ echo checked($woocommerce_wpml->settings['enable_multi_currency'], WCML_MULTI_CURRENCIES_INDEPENDENT) ?> />
367
+ <label for="multi_currency_independent">
368
+ <?php _e("Multiple currencies, independent of languages.",'wpml-wcml'); ?>
369
+ &nbsp;
370
+ <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>.
371
+ </label>
372
+ </li>
373
+ </ul>
374
+ </li>
375
+ </ul>
376
+
377
+
378
+
379
+
380
+
381
+ <div id="multi-currency-per-language-details" <?php if ( $woocommerce_wpml->settings['enable_multi_currency'] != WCML_MULTI_CURRENCIES_INDEPENDENT ):?>style="display:none"<?php endif;?>>
382
+ <div class="currencies-table-content">
383
+ <?php
384
+ $wc_currencies = get_woocommerce_currencies();
385
+ $wc_currency = get_option('woocommerce_currency');
386
+ $active_languages = $sitepress->get_active_languages();
387
+
388
+ switch(get_option('woocommerce_currency_pos')){
389
+ case 'left': $positioned_price = sprintf('%s99.99', get_woocommerce_currency_symbol($wc_currency)); break;
390
+ case 'right': $positioned_price = sprintf('99.99%s', get_woocommerce_currency_symbol($wc_currency)); break;
391
+ case 'left_space': $positioned_price = sprintf('%s 99.99', get_woocommerce_currency_symbol($wc_currency)); break;
392
+ case 'right_space': $positioned_price = sprintf('99.99 %s', get_woocommerce_currency_symbol($wc_currency)); break;
393
+ }
394
+
395
+ ?>
396
+ <p>
397
+ <?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>'); ?>
398
+ </p>
399
+ <input type="hidden" id="update_currency_lang_nonce" value="<?php echo wp_create_nonce('wcml_update_currency_lang'); ?>"/>
400
+ <table class="widefat currency_table" id="currency-table">
401
+ <thead>
402
+ <tr>
403
+ <th><?php _e('Currency', 'wpml-wcml'); ?></th>
404
+ <th></th>
405
+ </tr>
406
+ </thead>
407
+ <tbody>
408
+ <tr>
409
+ <td class="currency_code">
410
+ <span class="code_val"><?php echo $wc_currencies[$wc_currency]; ?><?php printf(__(' (%s)','wpml-wcml'), $positioned_price); ?></span>
411
+ <div class="currency_value"><span><?php _e( 'default', 'wpml-wcml' ); ?></span></div>
412
+ </td>
413
+ <td class="currency-actions"></td>
414
+
415
+ </tr>
416
+ <?php
417
+ unset($wc_currencies[$wc_currency]);
418
+ $currencies = $woocommerce_wpml->multi_currency_support->get_currencies();
419
+ foreach ($currencies as $code => $currency) :
420
+ switch($currency['position']){
421
+ case 'left': $positioned_price = sprintf('%s99.99', get_woocommerce_currency_symbol($code)); break;
422
+ case 'right': $positioned_price = sprintf('99.99%s', get_woocommerce_currency_symbol($code)); break;
423
+ case 'left_space': $positioned_price = sprintf('%s 99.99', get_woocommerce_currency_symbol($code)); break;
424
+ case 'right_space': $positioned_price = sprintf('99.99 %s', get_woocommerce_currency_symbol($code)); break;
425
  }
 
426
  ?>
427
+ <tr id="currency_row_<?php echo $code ?>">
428
+ <td class="currency_code">
429
+ <?php include WCML_PLUGIN_PATH . '/menu/sub/custom-currency-options.php'; ?>
430
+ <span class="code_val"><?php echo $wc_currencies[$code]; ?><?php printf(__(' (%s)','wpml-wcml'), $positioned_price); ?></span>
431
+ <div class="currency_value">
432
+ <span><?php printf('1 %s = %s %s', $wc_currency, $currency['rate'], $code); ?></span>
433
+ </div>
434
+
435
+ </td>
436
+
437
+ <td class="currency-actions">
438
+ <div class="currency_action_update">
439
+ <a href="javascript:void(0);" title="<?php esc_attr(_e('Edit', 'wpml-wcml')); ?>" class="edit_currency" data-currency="<?php echo $code ?>">
440
+ <i class="icon-edit" title="<?php esc_attr(_e('Edit', 'wpml-wcml')); ?>"></i>
441
+ </a>
442
+ <i class="icon-ok-circle save_currency"></i>
443
+ </div>
444
+ <div class="currency_action_delete">
445
+ <a href="javascript:void(0);" title="<?php esc_attr(_e('Delete', 'wpml-wcml')); ?>" class="delete_currency" data-currency="<?php echo $code ?>" >
446
+ <i class="icon-trash" title="<?php esc_attr(_e('Delete', 'wpml-wcml')); ?>"></i>
447
+ </a>
448
+ <i class="icon-remove-circle cancel_currency"></i>
449
+ </div>
450
+ </td>
451
+ </tr>
452
+ <?php endforeach; ?>
453
+ <tr class="default_currency">
454
+ <td colspan="2">
455
+ <span class="cur_label"><?php _e('Default currency', 'wpml-wcml'); ?></span>
456
+ <span class="inf_message"><?php _e('Switch to this currency when switching language in the front-end', 'wpml-wcml'); ?></span>
457
+ </td>
458
+ </tr>
459
+ </tbody>
460
+ </table>
461
+
462
+ <div class="currency_wrap">
463
+ <div class="currency_inner">
464
+ <table class="widefat currency_lang_table" id="currency-lang-table">
465
  <thead>
466
+ <tr>
467
+ <?php foreach($active_languages as $language): ?>
468
+ <th>
469
+ <img src="<?php echo ICL_PLUGIN_URL ?>/res/flags/<?php echo $language['code'] ?>.png" width="18" height="12" />
470
+ </th>
471
+ <?php endforeach; ?>
472
+ </tr>
473
  </thead>
474
  <tbody>
475
+ <tr>
476
+ <?php foreach($active_languages as $language): ?>
477
+ <td class="currency_languages">
478
+ <div class="wcml_onof_buttons">
479
+ <ul>
480
+ <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>
481
+ <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>
482
+ </ul>
483
+ </div>
484
  </td>
485
+ <?php endforeach; ?>
486
+ </tr>
487
+ <?php foreach ($currencies as $code => $currency) : ?>
488
+ <tr id="currency_row_langs_<?php echo $code ?>">
489
+ <?php foreach($active_languages as $language): ?>
490
+ <td class="currency_languages">
491
+ <div class="wcml_onof_buttons">
492
+ <ul>
493
+ <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>
494
+ <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>
495
+ </ul>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
496
  </div>
497
  </td>
498
+ <?php endforeach; ?>
 
 
 
 
 
 
499
  </tr>
500
+ <?php endforeach; ?>
501
+ <tr class="default_currency">
502
+ <?php foreach($active_languages as $language): ?>
503
+ <td class="currency_languages">
504
+ <select rel="<?php echo $language['code']; ?>">
505
+ <option value="0" <?php selected('0', $woocommerce_wpml->settings['default_currencies'][$language['code']]); ?>><?php _e('Keep', 'wpml-wcml'); ?></option>
506
+ <?php if($woocommerce_wpml->settings['currency_options'][$wc_currency]['languages'][$language['code']] == 1): ?>
507
+ <option value="<?php echo $wc_currency; ?>" <?php selected($wc_currency, $woocommerce_wpml->settings['default_currencies'][$language['code']]); ?>><?php echo $wc_currency; ?></option>
508
+ <?php endif; ?>
509
+ <?php foreach($currencies as $code2 => $currency2): ?>
510
+ <?php if($woocommerce_wpml->settings['currency_options'][$code2]['languages'][$language['code']] == 1): ?>
511
+ <option value="<?php echo $code2; ?>" <?php selected($code2, $woocommerce_wpml->settings['default_currencies'][$language['code']]); ?>><?php echo $code2; ?></option>
512
+ <?php endif; ?>
513
+ <?php endforeach; ?>
514
+ </select>
515
+ </td>
516
+ <?php endforeach; ?>
517
+ </tr>
518
  </tbody>
519
  </table>
520
+ <input type="hidden" id="wcml_update_default_currency_nonce" value="<?php echo wp_create_nonce('wcml_update_default_currency'); ?>"/>
521
 
522
+ </div>
523
+ </div>
524
+
525
+ <?php // this is a template for scripts.js : jQuery('.wcml_add_currency button').click(function(); ?>
526
+ <table class="hidden js-table-row-wrapper">
527
+ <tr class="edit-mode js-table-row">
528
+ <td class="currency_code" data-message="<?php _e( 'Please fill field', 'wpml-wcml' ); ?>">
529
+ <span class="code_val"></span>
530
+ <select name="code" style="display:block">
531
+ <?php foreach($wc_currencies as $wc_code=>$currency_name): ?>
532
+ <?php if(empty($currencies[$wc_code])): ?>
533
+ <option value="<?php echo $wc_code; ?>"><?php echo $currency_name; ?></option>
534
+ <?php endif; ?>
535
+ <?php endforeach; ?>
536
+ </select>
537
+ <div class="currency_value" data-message="<?php _e( 'Only numeric', 'wpml-wcml' ); ?>">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
538
  <span>
539
  <?php printf('1 %s = ',$wc_currency); ?>
540
  <span class="curr_val"></span>
541
  <input type="text" value="" style="display: inline-block;">
542
  <span class="curr_val_code"></span>
543
  </span>
544
+ </div>
545
+ </td>
546
+ <td class="currency-actions">
547
+ <div class="currency_action_update">
548
+ <a href="javascript:void(0);" title="Edit" class="edit_currency" style="display:none">
549
+ <i class="icon-edit" title="Edit"></i>
550
+ </a>
551
+ <i class="icon-ok-circle save_currency" style="display:inline"></i>
552
+ </div>
553
+ <div class="currency_action_delete">
554
+ <a href="javascript:void(0);" title="Delete" class="delete_currency" data-currency="" style="display:none">
555
+ <i class="icon-trash" alt="Delete"></i>
556
+ </a>
557
+ <i class="icon-remove-circle cancel_currency" style="display:inline"></i>
558
+ </div>
559
+ </td>
560
+ </tr>
561
+ </table>
562
+
563
+ <table class="hidden js-currency_lang_table">
564
+ <tr>
565
+ <?php foreach($active_languages as $language): ?>
566
+ <td class="currency_languages">
567
+ <div class="wcml_onof_buttons">
568
+ <ul>
569
+ <li><a class="off_btn" href="javascript:void(0);" data-language="<?php echo $language['code']; ?>"><?php _e( 'OFF', 'wpml-wcml' ); ?></a></li>
570
+ <li class="on"><a class="on_btn" href="javascript:void(0);" data-language="<?php echo $language['code']; ?>"><?php _e( 'ON', 'wpml-wcml' ); ?></a></li>
571
+ </ul>
572
+ </div>
573
+ </td>
574
+ <?php endforeach; ?>
575
+ </tr>
576
+ </table>
577
 
578
+ <input type="hidden" value="<?php echo WCML_PLUGIN_URL; ?>" class="wcml_plugin_url" />
579
+ <input type="hidden" id="new_currency_nonce" value="<?php echo wp_create_nonce('wcml_new_currency'); ?>" />
580
+ <input type="hidden" id="del_currency_nonce" value="<?php echo wp_create_nonce('wcml_delete_currency'); ?>" />
581
+ <input type="hidden" id="currencies_list_nonce" value="<?php echo wp_create_nonce('wcml_currencies_list'); ?>" />
582
+ </div>
 
 
 
 
 
 
 
 
 
583
 
584
+ <p class="wcml_add_currency button-wrap">
585
+ <button type="button" class="button-secondary">
586
+ <i class="icon-plus"></i>
587
+ <?php _e('Add currency','wpml-wcml'); ?>
588
+ </button>
589
+ </p>
590
+
591
+ <?php // backward compatibility ?>
592
+ <?php
593
+ $posts = $wpdb->get_results($wpdb->prepare("
 
 
 
 
 
 
594
  SELECT m.post_id, m.meta_value, p.post_title
595
  FROM {$wpdb->postmeta} m
596
  JOIN {$wpdb->posts} p ON p.ID = m.post_id
598
  WHERE m.meta_key='_custom_conversion_rate' AND t.language_code = %s
599
  ORDER BY m.post_id desc
600
  ", $default_language));
601
+
602
+ if($posts){
603
+ echo "<script>
604
  function wcml_remove_custom_rates(post_id, el){
605
  jQuery.ajax({
606
  type: 'post',
612
  }
613
  })
614
  return false;
615
+ }";
616
+ echo '</script>';
617
+ 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>';
618
+ echo '<form method="post" id="wcml_custom_exchange_rates">';
619
+ echo '<input type="hidden" name="action" value="legacy_update_custom_rates">';
620
+ echo '<table class="widefat currency_table" >';
621
+ echo '<thead>';
622
+ echo '<tr>';
623
+ echo '<th rowspan="2">' . __('Product', 'wpml-wcml') . '</th>';
624
+ echo '<th colspan="' . count($currencies) . '">_price</th>';
625
+ echo '<th colspan="' . count($currencies) . '">_sale_price</th>';
626
+ echo '<th rowspan="2">&nbsp;</th>';
627
+ echo '</tr>';
628
+ echo '<tr>';
629
+ foreach($currencies as $code => $currency){
630
+ echo '<th>' . $code . '</th>';
631
+ }
632
+ foreach($currencies as $code => $currency){
633
+ echo '<th>' . $code . '</th>';
634
+ }
635
+ echo '</tr>';
636
+ echo '</thead>';
637
+ echo '<tbody>';
638
+ foreach($posts as $post){
639
+ $rates = unserialize($post->meta_value);
640
+ echo '<tr>';
641
+ echo '<td><a href="' . get_edit_post_link($post->post_id) . '">' . apply_filters('the_title', $post->post_title) . '</a></td>';
642
+
643
+ foreach($currencies as $code => $currency){
644
+ echo '<td>';
645
+ if(isset($rates['_price'][$code])){
646
+ echo '<input name="posts[' . $post->post_id . '][_price][' . $code . ']" size="3" value="' . round($rates['_price'][$code],3) . '">';
647
+ }else{
648
+ _e('n/a', 'wpml-wcml');
649
+ }
650
+ echo '</td>';
651
+ }
652
+
653
+ foreach($currencies as $code => $currency){
654
+ echo '<td>';
655
+ if(isset($rates['_sale_price'][$code])){
656
+ echo '<input name="posts[' . $post->post_id . '][_sale_price][' . $code . ']" size="3" value="' . round($rates['_sale_price'][$code],3) . '">';
657
+ }else{
658
+ _e('n/a', 'wpml-wcml');
659
+ }
660
+ echo '</td>';
661
+ }
662
+
663
+ 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>';
664
+ echo '<tr>';
665
+
666
+ }
667
+ echo '</tbody>';
668
+ echo '</table>';
669
+ echo '<p class="button-wrap"><input class="button-secondary" type="submit" value="' . esc_attr__('Update', 'wpml-wcml') . '" /></p>';
670
+ echo '</form>';
671
+
672
+
673
+ }
674
+ ?>
675
+ <ul id="display_custom_prices_select">
676
+ <li>
677
+ <input type="checkbox" name="display_custom_prices" id="display_custom_prices" value="1" <?php echo checked( 1, $woocommerce_wpml->settings['display_custom_prices']) ?> >
678
+ <label for="display_custom_prices"><?php _e('Show only products with custom prices in secondary currencies', 'wpml-wcml'); ?></label>
679
+ <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>
680
+ </li>
681
+ </ul>
682
+ <p class="button-wrap general_option_btn">
683
+ <input type='submit' name="wcml_mc_options" value='<?php _e('Save', 'wpml-wcml'); ?>' class='button-secondary' />
684
+ <?php wp_nonce_field('wcml_mc_options', 'wcml_mc_options_nonce'); ?>
685
+ </p>
686
+ </div>
687
+ </div> <!-- .wcml-section-content -->
688
+ <div class="wcml-section">
689
+ <?php include WCML_PLUGIN_PATH . '/menu/sub/currency-switcher-options.php'; ?>
690
+ </div>
691
+ </form>
692
  </div> <!-- .wcml-section -->
693
  <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');?>"/>
694
  <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');?>"/>
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
- === WooCommerce Multilingual - run WooCommerce with WPML ===
2
  Contributors: AmirHelzer, dominykasgel, dgwatkins, adelval
3
  Donate link: http://wpml.org/documentation/related-projects/woocommerce-multilingual/
4
  Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multilingual, e-shop, shop
5
  License: GPLv2
6
  Requires at least: 3.0
7
- Tested up to: 4.2
8
- Stable tag: 3.6
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
@@ -78,6 +78,21 @@ In order for the checkout and store pages to appear translated, you need to crea
78
 
79
  == Changelog ==
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  = 3.6 =
82
  * Added the ability to edit the slugs of the translated products in the products editor
83
  * Added the option to show only products with custom prices on the front end
1
+ === WooCommerce Multilingual - run WooCommerce with WPML ===
2
  Contributors: AmirHelzer, dominykasgel, dgwatkins, adelval
3
  Donate link: http://wpml.org/documentation/related-projects/woocommerce-multilingual/
4
  Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multilingual, e-shop, shop
5
  License: GPLv2
6
  Requires at least: 3.0
7
+ Tested up to: 4.2.2
8
+ Stable tag: 3.6.1
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
78
 
79
  == Changelog ==
80
 
81
+ = 3.6.1 =
82
+ * Updated the taxonomy translation synchronization to be compatible with WPML 3.2
83
+ * Bug fix: the notice that shows up on the general settings page when the default language is not English did not hide when it was dismissed.
84
+ * Bug fix: after adding a new currency and reloading the page, the new currency was gone. Also the exchange rate was wrong after re-adding teh currency.
85
+ * Bug fix: an incorrect currency was being passed to the payment gateway when paying for an order created in the backend.
86
+ * Bug fix: the prices in the custom currencies were not saved when a product was published.
87
+ * Bug fix: extra backslashes were added when translating custom attribute name in products.
88
+ * Bug fix: custom product categories template was not working as expected
89
+ * Bug fix: updating WordPress language packs was not working when using custom locale codes in WPML
90
+ * Bug fix: Variable products returned error in secondary language "This product is currently out of stock and unavailable."
91
+ * Bug fix: The publishing date was not updating on translation when changed on the product in the original language
92
+ * Bug fix: Attributes with the value "0" value were not displayed on the front end
93
+ * Bug fix: Modified Free shipping label could not be translated
94
+ * Bug fix: When editing product translations it was possible to save an empty slug.
95
+
96
  = 3.6 =
97
  * Added the ability to edit the slugs of the translated products in the products editor
98
  * Added the option to show only products with custom prices on the front end
woocommerce_wpml.class.php CHANGED
@@ -12,11 +12,11 @@ class woocommerce_wpml {
12
  var $missing;
13
 
14
  function __construct(){
 
15
  add_action('init', array($this, 'init'),2);
16
  add_action('init', array($this, 'load_css_and_js'));
17
-
18
-
19
  add_action('widgets_init', array($this, 'register_widget'));
 
20
  }
21
 
22
  function init(){
@@ -33,7 +33,10 @@ class woocommerce_wpml {
33
 
34
  global $sitepress,$pagenow;
35
 
36
- if($this->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT){
 
 
 
37
  require_once WCML_PLUGIN_PATH . '/inc/multi-currency-support.class.php';
38
  $this->multi_currency_support = new WCML_Multi_Currency_Support;
39
  require_once WCML_PLUGIN_PATH . '/inc/multi-currency.class.php';
@@ -103,7 +106,7 @@ class woocommerce_wpml {
103
  }
104
 
105
  if( ($pagenow == 'post.php' && isset($_GET['post']) && get_post_type($_GET['post']) == 'product' && !$this->products->is_original_product($_GET['post'])) ||
106
- ($pagenow == 'post-new.php' && isset($_GET['source_lang']) )
107
  && !$this->settings['trnsl_interface']){
108
  add_action('init', array($this, 'load_lock_fields_js'));
109
  add_action( 'admin_footer', array($this,'hidden_label'));
@@ -188,7 +191,7 @@ class woocommerce_wpml {
188
 
189
  function update_setting_ajx(){
190
  $nonce = filter_input( INPUT_POST, 'nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
191
- if(!$nonce || !wp_verify_nonce($nonce, 'woocommerce_multilingual')){
192
  die('Invalid nonce');
193
  }
194
 
@@ -364,7 +367,7 @@ class woocommerce_wpml {
364
 
365
  function menu_content(){
366
  if($this->dependencies->check()){
367
- include WCML_PLUGIN_PATH . '/menu/management.php';
368
  }else{
369
  include WCML_PLUGIN_PATH . '/menu/plugins.php';
370
  }
@@ -419,6 +422,8 @@ class woocommerce_wpml {
419
  wp_enqueue_style( 'buttons' );
420
  }
421
 
 
 
422
  }elseif( $_GET['page'] == WPML_TM_FOLDER.'/menu/main.php' ){
423
  wp_register_script('wpml_tm', WCML_PLUGIN_URL . '/assets/js/wpml_tm.js', array('jquery'), WCML_VERSION);
424
  wp_enqueue_script('wpml_tm');
@@ -426,6 +431,18 @@ class woocommerce_wpml {
426
  }
427
  }
428
 
 
 
 
 
 
 
 
 
 
 
 
 
429
  function load_lock_fields_js(){
430
  wp_register_script('wcml-lock-script', WCML_PLUGIN_URL . '/assets/js/lock_fields.js', array('jquery'), WCML_VERSION);
431
  wp_enqueue_script('wcml-lock-script');
@@ -438,7 +455,7 @@ class woocommerce_wpml {
438
 
439
  if( isset($_GET['post']) ){
440
  $original_language = $this->products->get_original_product_language($_GET['post']);
441
- $original_id = icl_object_id($_GET['post'],'product',true,$original_language);
442
  }elseif( isset($_GET['trid']) ){
443
  global $sitepress;
444
  $original_id = $sitepress->get_original_element_id_by_trid( $_GET['trid'] );
@@ -669,7 +686,7 @@ class woocommerce_wpml {
669
 
670
  $sitepress->switch_lang( $language['code'], true );
671
 
672
- $locale = get_locale();
673
 
674
  if ( $this->has_available_update( $locale, $wc_upgrader_class ) && isset( $data->translations ) ) {
675
 
@@ -798,8 +815,9 @@ class woocommerce_wpml {
798
  function hide_wcml_translations_message(){
799
  $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
800
  if(!$nonce || !wp_verify_nonce($nonce, 'hide_wcml_translations_message' ) ){
801
- update_option( 'hide_wcml_translations_message', true );
802
  }
 
803
 
804
  die();
805
  }
12
  var $missing;
13
 
14
  function __construct(){
15
+
16
  add_action('init', array($this, 'init'),2);
17
  add_action('init', array($this, 'load_css_and_js'));
 
 
18
  add_action('widgets_init', array($this, 'register_widget'));
19
+
20
  }
21
 
22
  function init(){
33
 
34
  global $sitepress,$pagenow;
35
 
36
+ if($this->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT
37
+ || ( isset($_GET['page']) && $_GET['page'] == 'wpml-wcml' && !isset($_GET['tab']) )
38
+ || ( isset( $_POST[ 'action' ] ) && in_array( $_POST[ 'action' ], array( 'wcml_new_currency', 'wcml_save_currency', 'wcml_delete_currency', 'wcml_currencies_list', 'wcml_update_currency_lang', 'wcml_update_default_currency') ) )
39
+ ){
40
  require_once WCML_PLUGIN_PATH . '/inc/multi-currency-support.class.php';
41
  $this->multi_currency_support = new WCML_Multi_Currency_Support;
42
  require_once WCML_PLUGIN_PATH . '/inc/multi-currency.class.php';
106
  }
107
 
108
  if( ($pagenow == 'post.php' && isset($_GET['post']) && get_post_type($_GET['post']) == 'product' && !$this->products->is_original_product($_GET['post'])) ||
109
+ ($pagenow == 'post-new.php' && isset($_GET['source_lang']) && isset($_GET['post_type']) && $_GET['post_type'] == 'product')
110
  && !$this->settings['trnsl_interface']){
111
  add_action('init', array($this, 'load_lock_fields_js'));
112
  add_action( 'admin_footer', array($this,'hidden_label'));
191
 
192
  function update_setting_ajx(){
193
  $nonce = filter_input( INPUT_POST, 'nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
194
+ if(!$nonce || !wp_verify_nonce($nonce, 'wcml_settings')){
195
  die('Invalid nonce');
196
  }
197
 
367
 
368
  function menu_content(){
369
  if($this->dependencies->check()){
370
+ include WCML_PLUGIN_PATH . '/menu/management.php';
371
  }else{
372
  include WCML_PLUGIN_PATH . '/menu/plugins.php';
373
  }
422
  wp_enqueue_style( 'buttons' );
423
  }
424
 
425
+ $this->load_tooltip_resources();
426
+
427
  }elseif( $_GET['page'] == WPML_TM_FOLDER.'/menu/main.php' ){
428
  wp_register_script('wpml_tm', WCML_PLUGIN_URL . '/assets/js/wpml_tm.js', array('jquery'), WCML_VERSION);
429
  wp_enqueue_script('wpml_tm');
431
  }
432
  }
433
 
434
+ //load Tooltip js and styles from WC
435
+ function load_tooltip_resources(){
436
+ if( class_exists('woocommerce') ){
437
+ wp_register_script( 'jquery-tiptip', WC()->plugin_url() . '/assets/js/jquery-tiptip/jquery.tipTip.min.js', array( 'jquery' ), WC_VERSION, true );
438
+ wp_register_script( 'wcml-tooltip-init', WCML_PLUGIN_URL . '/assets/js/tooltip_init.js', array('jquery'), WCML_VERSION);
439
+ wp_enqueue_script( 'jquery-tiptip' );
440
+ wp_enqueue_script( 'wcml-tooltip-init' );
441
+ wp_enqueue_style( 'woocommerce_admin_styles', WC()->plugin_url() . '/assets/css/admin.css', array(), WC_VERSION );
442
+ wp_enqueue_style( 'wcml_tooltip_styles', WCML_PLUGIN_URL . '/assets/css/tooltip.css', null, WCML_VERSION);
443
+ }
444
+ }
445
+
446
  function load_lock_fields_js(){
447
  wp_register_script('wcml-lock-script', WCML_PLUGIN_URL . '/assets/js/lock_fields.js', array('jquery'), WCML_VERSION);
448
  wp_enqueue_script('wcml-lock-script');
455
 
456
  if( isset($_GET['post']) ){
457
  $original_language = $this->products->get_original_product_language($_GET['post']);
458
+ $original_id = apply_filters( 'translate_object_id',$_GET['post'],'product',true,$original_language);
459
  }elseif( isset($_GET['trid']) ){
460
  global $sitepress;
461
  $original_id = $sitepress->get_original_element_id_by_trid( $_GET['trid'] );
686
 
687
  $sitepress->switch_lang( $language['code'], true );
688
 
689
+ $locale = $sitepress->get_locale( $language['code'] );
690
 
691
  if ( $this->has_available_update( $locale, $wc_upgrader_class ) && isset( $data->translations ) ) {
692
 
815
  function hide_wcml_translations_message(){
816
  $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
817
  if(!$nonce || !wp_verify_nonce($nonce, 'hide_wcml_translations_message' ) ){
818
+ die('Invalid nonce');
819
  }
820
+ update_option( 'hide_wcml_translations_message', true );
821
 
822
  die();
823
  }
wpml-woocommerce.php CHANGED
@@ -5,16 +5,16 @@
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
9
  */
10
 
11
 
12
  if(defined('WCML_VERSION')) return;
13
- define('WCML_VERSION', '3.6');
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_FOLDER.'/locale');
18
  define('WPML_LOAD_API_SUPPORT',true);
19
  define('WPML_SUPPORT_STRINGS_IN_DIFF_LANG', false);
20
 
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.1
9
  */
10
 
11
 
12
  if(defined('WCML_VERSION')) return;
13
+ define('WCML_VERSION', '3.6.1');
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