WooCommerce Multilingual – run WooCommerce with WPML - Version 3.2

Version Description

  • Compatibility with upcoming WooCommerce 2.1
  • Multi-currency support: configure currencies per languages
  • Multi-currency support: custom prices for different currencies
  • Support translation for the attribute base (permalinks)
  • Bug: Emails not sent in the correct language when uses bulk action on orders list page
  • Bug: Order notes email in wrong language in certain circumstances
  • Bug: Shipping method names are being registered in the wrong language
  • Bug: WooCommerce Multilingual menu doesn't display for translators
  • Bug: Using 'category' for products cat slug conflicts with posts 'category'
  • Bug: Paypal rejects payments with decimals on certain currencies
Download this release

Release Info

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

Code changes from version 3.1 to 3.2

Files changed (55) hide show
  1. assets/css/management.css +172 -9
  2. assets/css/wcml-prices.css +87 -0
  3. assets/images/icon16.png +0 -0
  4. assets/images/locked.png +0 -0
  5. assets/js/lock_fields.js +31 -0
  6. assets/js/prices.js +172 -0
  7. assets/js/scripts.js +301 -197
  8. compatibility/templates/wc_tab_manager_custom_box_html.php +49 -0
  9. compatibility/wc_subscriptions.class.php +23 -0
  10. compatibility/wc_tab_manager.class.php +137 -0
  11. compatibility/wc_table_rate_shipping.class.php +24 -0
  12. inc/compatibility.class.php +35 -0
  13. inc/dependencies.class.php +1 -1
  14. inc/emails.class.php +83 -12
  15. inc/functions-troubleshooting.class.php +0 -1
  16. inc/multi-currency-support.class.php +285 -14
  17. inc/multi-currency.class.php +356 -14
  18. inc/orders.class.php +46 -0
  19. inc/products.class.php +351 -123
  20. inc/store-pages.class.php +9 -23
  21. inc/terms.class.php +79 -59
  22. inc/upgrade.class.php +18 -3
  23. inc/wc-strings.class.php +58 -15
  24. inc/woocommerce-2.0-backward-compatibility.php +66 -0
  25. locale/orig/wpml-wcml.po +220 -55
  26. locale/wpml-wcml-ar.mo +0 -0
  27. locale/wpml-wcml-de_DE.mo +0 -0
  28. locale/wpml-wcml-el.mo +0 -0
  29. locale/wpml-wcml-es_ES.mo +0 -0
  30. locale/wpml-wcml-fr_FR.mo +0 -0
  31. locale/wpml-wcml-he_IL.mo +0 -0
  32. locale/wpml-wcml-it_IT.mo +0 -0
  33. locale/wpml-wcml-ja.mo +0 -0
  34. locale/wpml-wcml-ko_KO.mo +0 -0
  35. locale/wpml-wcml-nl_NL.mo +0 -0
  36. locale/wpml-wcml-pl_PL.mo +0 -0
  37. locale/wpml-wcml-pt_BR.mo +0 -0
  38. locale/wpml-wcml-pt_PT.mo +0 -0
  39. locale/wpml-wcml-ru_RU.mo +0 -0
  40. locale/wpml-wcml-sv_SE.mo +0 -0
  41. locale/wpml-wcml-vn.mo +0 -0
  42. locale/wpml-wcml-zh_CN.mo +0 -0
  43. locale/wpml-wcml-zh_TW.mo +0 -0
  44. menu/management.php +15 -7
  45. menu/plugins.php +54 -0
  46. menu/sub/custom-box.php +10 -0
  47. menu/sub/custom-prices.php +187 -0
  48. menu/sub/images-box.php +56 -0
  49. menu/sub/products.php +10 -8
  50. menu/sub/settings.php +178 -72
  51. menu/sub/variations_box.php +11 -31
  52. readme.txt +13 -1
  53. woocommerce_wpml.class.php +123 -46
  54. wpml-config.xml +8 -0
  55. wpml-woocommerce.php +3 -2
assets/css/management.css CHANGED
@@ -111,14 +111,16 @@
111
  font-size: 20px;
112
  }
113
 
114
- .wcml-section-header .icon-question-sign {
 
115
  color: #ccc;
116
  cursor: pointer;
117
  vertical-align: middle;
118
  font-size: 12px;
119
  }
120
 
121
- .wcml-section-header .icon-question-sign:hover {
 
122
  color: #007cbd;
123
  -webkit-transition: all 0.15s linear;
124
  -moz-transition: all 0.15s linear;
@@ -175,7 +177,10 @@
175
  border-bottom: 0;
176
  position: absolute;
177
  left: 0;
178
- width: 220px;
 
 
 
179
  }
180
 
181
  .wcml_products_translation .prod_images,
@@ -570,10 +575,33 @@ textarea[disabled] {
570
  .languages_currencies_table input[type="submit"]{
571
  margin-top: 10px;
572
  }
573
- .wp-core-ui .button-secondary.save_currency,.wp-core-ui .button-secondary.cancel_currency,.currency_code input,.currency_value input{
574
  display: none;
575
  }
576
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
577
  .currency-actions {
578
  text-align: right;
579
  }
@@ -585,9 +613,18 @@ textarea[disabled] {
585
  .edit-mode .currency_action_update,
586
  .edit-mode .currency_action_delete {
587
  display: block;
588
- margin: 2px 0;
 
 
 
 
 
 
 
 
 
 
589
  }
590
-
591
  .currency-actions button {
592
  margin: 0 0 4px 0;
593
  }
@@ -598,7 +635,11 @@ textarea[disabled] {
598
  vertical-align: middle;
599
  margin: 0 5px 0 0;
600
  }
601
-
 
 
 
 
602
  .currency_table .icon-trash,
603
  .currency_table .icon-edit {
604
  font-size: 16px;
@@ -611,7 +652,7 @@ textarea[disabled] {
611
  .currency_table .icon-edit {
612
  color: #333;
613
  }
614
- .prod_images,.prod_variations{
615
  display: none;
616
  }
617
  .prod_images img{
@@ -708,3 +749,125 @@ textarea[disabled] {
708
  .wcml_no_found_text{
709
  text-align: center;
710
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  font-size: 20px;
112
  }
113
 
114
+ .wcml-section-header .icon-question-sign,
115
+ th .icon-question-sign{
116
  color: #ccc;
117
  cursor: pointer;
118
  vertical-align: middle;
119
  font-size: 12px;
120
  }
121
 
122
+ .wcml-section-header .icon-question-sign:hover,
123
+ th .icon-question-sign:hover{
124
  color: #007cbd;
125
  -webkit-transition: all 0.15s linear;
126
  -moz-transition: all 0.15s linear;
177
  border-bottom: 0;
178
  position: absolute;
179
  left: 0;
180
+ width: 217px;
181
+ }
182
+ .wcml_products_translation>tbody>tr{
183
+ border-bottom: 1px solid #e1e1e1;
184
  }
185
 
186
  .wcml_products_translation .prod_images,
575
  .languages_currencies_table input[type="submit"]{
576
  margin-top: 10px;
577
  }
578
+ .wp-core-ui .save_currency,.wp-core-ui .cancel_currency,.currency_code select,.currency_value input{
579
  display: none;
580
  }
581
+ .wp-core-ui .save_currency{
582
+ color: #51a351;
583
+ font-size: 18px;
584
+ cursor: pointer;
585
+ }
586
+ .wp-core-ui .cancel_currency{
587
+ color: #9d261d;
588
+ font-size: 18px;
589
+ cursor: pointer;
590
+ }
591
+ .wp-core-ui .button-secondary.save_currency{
592
+ background: #1e8cbe;
593
+ border-color: #0074a2;
594
+ -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,.6);
595
+ box-shadow: inset 0 1px 0 rgba(120,200,230,.6);
596
+ color: #fff;
597
+ }
598
+ .currency_value{
599
+ float: left;
600
+ margin-right: 3px;
601
+ }
602
+ .currency_value input[type=text]{
603
+ width: 45px;
604
+ }
605
  .currency-actions {
606
  text-align: right;
607
  }
613
  .edit-mode .currency_action_update,
614
  .edit-mode .currency_action_delete {
615
  display: block;
616
+ margin: 2px 1px;
617
+ float: left;
618
+ }
619
+ .currency_changed,
620
+ .currency_value span{
621
+ font-size: 10px;
622
+ font-style: italic;
623
+ color: #9A9A9A;
624
+ }
625
+ .currency_code .code_val{
626
+ display: block;
627
  }
 
628
  .currency-actions button {
629
  margin: 0 0 4px 0;
630
  }
635
  vertical-align: middle;
636
  margin: 0 5px 0 0;
637
  }
638
+ table.widefat.currency_table{
639
+ float: left;
640
+ width: 250px;
641
+ border-right: none;
642
+ }
643
  .currency_table .icon-trash,
644
  .currency_table .icon-edit {
645
  font-size: 16px;
652
  .currency_table .icon-edit {
653
  color: #333;
654
  }
655
+ .prod_images,.prod_variations,.custom_fields_block{
656
  display: none;
657
  }
658
  .prod_images img{
749
  .wcml_no_found_text{
750
  text-align: center;
751
  }
752
+ #multi-currency-per-language-details{
753
+ float: left;
754
+ }
755
+ /* on/off buttons */
756
+ .currency_languages{
757
+ position: relative;
758
+ text-align: center;
759
+ }
760
+ .currency_languages ul{
761
+ list-style:none;
762
+ width:43px;
763
+ height:20px;
764
+ float: left;
765
+ display: block;
766
+ margin: 0;
767
+ }
768
+ .currency_languages .wcml_onof_buttons{
769
+ display: inline-block;
770
+ }
771
+ .currency_languages ul li{
772
+ float: left;
773
+ line-height: 16px;
774
+ font-size: 8px;
775
+ padding: 1px 3px 0;
776
+ background: #E5E5E5;
777
+ background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#F3F3F3), to(#E5E5E5));
778
+ text-shadow: 0 1px 0 #FFF;
779
+ border-left: 1px solid #D5D5D5;
780
+ border-top: 1px solid #D5D5D5;
781
+ border-bottom: 1px solid #D5D5D5;
782
+ -webkit-box-shadow: 0 1px 0 #FFF inset, 0 0 5px rgba(0, 0, 0, .1) inset, 0 1px 1px rgba(0, 0, 0, .3);
783
+ margin: 0;
784
+ }
785
+
786
+ .currency_languages ul li:first-child{
787
+ -webkit-border-radius:5px 0 0 5px;
788
+ }
789
+ .currency_languages ul li:last-child{
790
+ -webkit-border-radius:0 5px 5px 0;
791
+ }
792
+
793
+ .currency_languages ul li a{
794
+ text-decoration: none;
795
+ font-family:Helvetica, Arial;
796
+ text-transform:uppercase;
797
+ color:#a1a1a1;
798
+ }
799
+
800
+ .currency_languages .on{
801
+ background: #21759b;
802
+ background-image:-webkit-gradient(linear, 0% 0%, 0% 100%, from(#21759b), to(#21759b));
803
+ text-shadow:0 -1px 0 #21759b, 0 0 7px #FFF;
804
+ border-right:1px solid #21759b;
805
+ border-top:1px solid #21759b;
806
+ border-bottom:1px solid #21759b;
807
+ -webkit-box-shadow:0 1px 2px rgba(0, 0, 0, .7) inset, 0 1px 0 #21759b;
808
+ }
809
+
810
+ .currency_languages ul li:not(.on):active{
811
+ background-image:-webkit-gradient(linear, 0% 0%, 0% 100%, from(#ddd), to(#f1f1f1));
812
+ }
813
+
814
+ table.widefat.currency_lang_table{
815
+ border-left: none;
816
+ }
817
+ .currency_languages ul li.on a{
818
+ color:#FFF;
819
+ cursor: default;
820
+ }
821
+ .currency_lang_table th{
822
+ text-align: center;
823
+ }
824
+ .currency_wrap{
825
+ width: 320px;
826
+ float: left;
827
+ margin-bottom: 10px;
828
+ }
829
+ .currency_inner{
830
+ overflow-x: auto;
831
+ overflow-y: visible;
832
+ }
833
+ .currency_table tr,
834
+ .currency_lang_table tr{
835
+ height: 59px;
836
+ }
837
+
838
+ .currency_table tr td{
839
+ padding-top: 0;
840
+ padding-bottom: 0;
841
+ }
842
+
843
+ .currency_table td,.currency_lang_table td{
844
+ vertical-align: middle;
845
+ }
846
+ .currency_lang_table.widefat td{
847
+ padding-right: 0;
848
+ padding-left: 0;
849
+ }
850
+ .currency_lang_table tr.default_currency{
851
+ height: 60px;
852
+ }
853
+ .default_currency select{
854
+ font-size: 10px;
855
+ height: 24px;
856
+ margin: 0;
857
+ margin-right: 3px;
858
+ }
859
+ .default_currency td{
860
+ border-top: 1px solid #e5e5e5;
861
+ }
862
+ .default_currency .cur_label{
863
+ display: block;
864
+ }
865
+ .default_currency .inf_message{
866
+ font-size: 10px;
867
+ font-style: italic;
868
+ color: #9A9A9A;
869
+ }
870
+ .wcml_add_currency.button-wrap{
871
+ margin-top: 0;
872
+ float: left;
873
+ }
assets/css/wcml-prices.css ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wcml_custom_prices_block{
2
+ float: left;
3
+ margin-top: 10px;
4
+ width: 100%;
5
+ }
6
+ .wcml_custom_prices_options_block{
7
+ display: inline-block;
8
+ width: 100%;
9
+ }
10
+
11
+ .wcml_custom_prices_manually_block_control{
12
+ padding-left:10px;
13
+ }
14
+
15
+ .wcml_custom_prices_options_block input.wcml_custom_prices_input,
16
+ .wc-metaboxes-wrapper .wcml_custom_prices_options_block input.wcml_custom_prices_input,
17
+ .wcml_custom_prices_manually_block input.wcml_schedule_input,
18
+ .wc-metaboxes-wrapper .wcml_custom_prices_manually_block input.wcml_schedule_input{
19
+ width: 16px;
20
+ clear: both;
21
+ margin: 2px 5px 2px 0;
22
+ float: left;
23
+ }
24
+ .woocommerce_options_panel .wcml_custom_prices_options_block label,
25
+ .wcml_schedule_options label{
26
+ width: auto;
27
+ }
28
+
29
+ .wc-metaboxes-wrapper .wcml_custom_prices_manually_block .currency_blck>label,
30
+ .wc-metaboxes-wrapper .wcml_automaticaly_prices_block label,
31
+ .currency_blck,
32
+ .wcml_schedule_dates{
33
+ clear: both;
34
+ }
35
+ .wcml_custom_prices_manually_block,
36
+ .wcml_automaticaly_prices_block,
37
+ .wcml_schedule_dates{
38
+ clear: both;
39
+ display: none;
40
+ padding-left:10px;
41
+ }
42
+ .wcml_custom_prices_manually_block p,
43
+ .wcml_automaticaly_prices_block p{
44
+ clear: both;
45
+ margin-top: 0;
46
+ }
47
+ .currency_blck{
48
+ float: left;
49
+ width: 100%;
50
+ margin-bottom: 5px;
51
+ border-bottom: 1px solid #dfdfdf;
52
+ padding: 5px 0;
53
+ }
54
+ .currency_blck>label,
55
+ .wcml_automaticaly_prices_block>label{
56
+ font-weight: bold;
57
+ }
58
+
59
+ .wcml_schedule_manually_block_hide,
60
+ .block_actions,
61
+ .wcml_custom_prices_auto_block_hide{
62
+ display: none;
63
+ }
64
+ .wcml_custom_prices_manually_block_show,
65
+ .wcml_custom_prices_manually_block_hide{
66
+ display: none;
67
+ clear: both;
68
+ float: left;
69
+ }
70
+ .wcml_no_price_message{
71
+ font-style: italic;
72
+ font-size: 12px;
73
+ }
74
+ .wcml_schedule{
75
+ padding-left: 12px;
76
+ clear: both;
77
+ float: left;
78
+ }
79
+ .wcml_schedule_options{
80
+ float: left;
81
+ }
82
+ .wcml_schedule .wcml_schedule_options label{
83
+ width: 200px;
84
+ }
85
+ .wc-metaboxes-wrapper .wc-metabox table td .wcml_schedule_dates input{
86
+ width: 85px;
87
+ }
assets/images/icon16.png ADDED
Binary file
assets/images/locked.png ADDED
Binary file
assets/js/lock_fields.js ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($){
2
+ var i;
3
+ var ids = ['_sku','_virtual','_downloadable','product-type','_stock_status','_backorders','_manage_stock','_stock','_sold_individually','_weight','product_length','_regular_price','_sale_price','_sale_price_dates_from','_sale_price_dates_to','menu_order','comment_status','_tax_status','_tax_class'];
4
+
5
+ for (i = 0; i < ids.length; i++) {
6
+ $('#'+ids[i]).attr('disabled','disabled');
7
+ $('#'+ids[i]).after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show());
8
+ }
9
+
10
+ $('input[name="_width"]').attr('readonly','readonly');
11
+ $('input[name="_width"]').after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show());
12
+ $('input[name="_height"]').attr('readonly','readonly');
13
+ $('input[name="_height"]').after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show());
14
+ $('.woocommerce_variation input[type="text"],.woocommerce_variation input[type="number"]').each(function(){
15
+ $(this).attr('readonly','readonly');
16
+ $(this).after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show());
17
+ });
18
+
19
+ $('.woocommerce_variation select').each(function(){
20
+ $(this).attr('disabled','disabled');
21
+ $(this).after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show());
22
+ });
23
+
24
+ $('form#post input[type="submit"]').click(function(){
25
+ for (i = 0; i < ids.length; i++) {
26
+ $('#'+ids[i]).removeAttr('disabled');
27
+ }
28
+ });
29
+
30
+ });
31
+
assets/js/prices.js ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($){
2
+
3
+ $('.wcml_custom_prices_input').each(function(){
4
+ if($(this).is(':checked')){
5
+ if($(this).val() == 0){
6
+ $(this).parent().find('.block_actions').show();
7
+ }else{
8
+ $(this).parent().find('.wcml_custom_prices_manually_block_show').show();
9
+ }
10
+ }
11
+ });
12
+
13
+ $('.wcml_schedule_input').each(function(){
14
+ if($(this).is(':checked') && $(this).val() == 1){
15
+ $(this).parent().find('.block_actions').show();
16
+ }
17
+ });
18
+
19
+ $(document).on('change','.wcml_custom_prices_input', function(){
20
+ if($(this).val() == 1){
21
+ $(this).closest('.wcml_custom_prices_block').find('.wcml_automaticaly_prices_block').hide();
22
+ $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block').show();
23
+ $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block_hide').show();
24
+ $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block_show').hide();
25
+ $(this).parent().find('.block_actions').hide();
26
+ }else{
27
+ $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block').hide();
28
+ $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block_hide').hide();
29
+ $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block_show').hide();
30
+ $(this).parent().find('.block_actions').show();
31
+ }
32
+ });
33
+
34
+ $(document).on('click','.wcml_custom_prices_auto_block_show', function(){
35
+ if($(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_input:checked').val() == 0){
36
+ if(!$(this).closest('.wcml_custom_prices_block').find('.wcml_automaticaly_prices_block').is(':visible')){
37
+ $(this).hide();
38
+ $(this).closest('.wcml_custom_prices_block').find('.wcml_automaticaly_prices_block').show();
39
+ $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_auto_block_hide').show();
40
+ }
41
+ }
42
+ });
43
+
44
+ $(document).on('click','.wcml_custom_prices_auto_block_hide', function(){
45
+ if($(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_input:checked').val() == 0){
46
+ if($(this).closest('.wcml_custom_prices_block').find('.wcml_automaticaly_prices_block').is(':visible')){
47
+ $(this).hide();
48
+ $(this).closest('.wcml_custom_prices_block').find('.wcml_automaticaly_prices_block').hide();
49
+ $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_auto_block_show').show();
50
+ }
51
+ }
52
+ });
53
+
54
+ $(document).on('click','.wcml_custom_prices_manually_block_hide', function(){
55
+ if($(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_input:checked').val() == 1){
56
+ $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block').hide();
57
+ $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block_hide').hide();
58
+ $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block_show').show();
59
+ }
60
+ });
61
+
62
+ $(document).on('click','.wcml_custom_prices_manually_block_show', function(){
63
+ if($(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_input:checked').val() == 1){
64
+ $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block').show();
65
+ $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block_hide').show();
66
+ $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block_show').hide();
67
+ }
68
+ });
69
+
70
+ $(document).on('change','#_regular_price', function(){
71
+ var val = $(this).val();
72
+ $(this).closest('div').find('input[name="_readonly_regular_price"]').each(function(){
73
+ $(this).val(val*$(this).attr('rel'));
74
+ });
75
+ });
76
+
77
+ $(document).on('change','#_sale_price', function(){
78
+ var val = $(this).val();
79
+ $(this).closest('div').find('input[name="_readonly_sale_price"]').each(function(){
80
+ $(this).val(val*$(this).attr('rel'));
81
+ });
82
+ });
83
+
84
+ $(document).on('change','input[name^="variable_regular_price"]', function(){
85
+ var val = $(this).val();
86
+ $(this).closest('table').find('input[name="_readonly_regular_price"]').each(function(){
87
+ $(this).val(val*$(this).attr('rel'));
88
+ });
89
+ });
90
+
91
+ $(document).on('change','input[name^="variable_sale_price"]', function(){
92
+ var val = $(this).val();
93
+ $(this).closest('table').find('input[name="_readonly_sale_price"]').each(function(){
94
+ $(this).val(val*$(this).attr('rel'));
95
+ });
96
+ });
97
+
98
+ $(document).on('change','input.wcml_input_price', function(){
99
+ if($(this).val() > 0){
100
+ $(this).closest('.currency_blck').find('.wcml_no_price_message').hide();
101
+ }
102
+ });
103
+
104
+ $(document).on('change','.wcml_schedule_input', function(){
105
+ if($(this).val() == 1){
106
+ datepick();
107
+ $(this).closest('div').find('.wcml_schedule_dates').show();
108
+ $(this).closest('div').find('.wcml_schedule_manually_block_show').hide();
109
+ $(this).closest('div').find('.wcml_schedule_manually_block_hide').show();
110
+ $(this).parent().find('.block_actions').show();
111
+ }else{
112
+ $(this).closest('div').find('.wcml_schedule_dates').hide();
113
+ $(this).closest('div').find('.wcml_schedule_manually_block_show').show();
114
+ $(this).closest('div').find('.wcml_schedule_manually_block_hide').hide();
115
+ $(this).parent().find('.block_actions').hide();
116
+ }
117
+ });
118
+
119
+ $(document).on('click','.wcml_schedule_manually_block_hide', function(){
120
+ if($(this).closest('div').find('.wcml_schedule_input:checked').val() == 1){
121
+ $(this).closest('div').find('.wcml_schedule_dates').hide();
122
+ $(this).closest('div').find('.wcml_schedule_manually_block_show').show();
123
+ $(this).closest('div').find('.wcml_schedule_manually_block_hide').hide();
124
+ }
125
+ });
126
+
127
+ $(document).on('click','.wcml_schedule_manually_block_show', function(){
128
+ if($(this).closest('div').find('.wcml_schedule_input:checked').val() == 1){
129
+ datepick();
130
+ $(this).closest('div').find('.wcml_schedule_dates').show();
131
+ $(this).closest('div').find('.wcml_schedule_manually_block_show').hide();
132
+ $(this).closest('div').find('.wcml_schedule_manually_block_hide').show();
133
+ }
134
+ });
135
+
136
+ function datepick(){
137
+ var date_img = '';
138
+ if(typeof woocommerce_admin_meta_boxes != 'undefined'){
139
+ date_img = woocommerce_admin_meta_boxes.calendar_image;
140
+ }else{
141
+ date_img = woocommerce_writepanel_params.calendar_image;
142
+ }
143
+
144
+ $( ".wcml_schedule_dates input" ).datepicker({
145
+ defaultDate: "",
146
+ dateFormat: "yy-mm-dd",
147
+ numberOfMonths: 1,
148
+ showButtonPanel: true,
149
+ showOn: "button",
150
+ buttonImage: date_img,
151
+ buttonImageOnly: true,
152
+ onSelect: function( selectedDate ) {
153
+
154
+ var instance = $( this ).data( "datepicker" ),
155
+ date = $.datepicker.parseDate(
156
+ instance.settings.dateFormat ||
157
+ $.datepicker._defaults.dateFormat,
158
+ selectedDate, instance.settings );
159
+
160
+ if($(this).is('.custom_sale_price_dates_from')){
161
+ $(this).closest('div').find('.custom_sale_price_dates_to').datepicker( "option", "minDate", date );
162
+ }else{
163
+ $(this).closest('div').find('.custom_sale_price_dates_from').datepicker( "option", "maxDate", date );
164
+ }
165
+
166
+ }
167
+ });
168
+ }
169
+
170
+
171
+ });
172
+
assets/js/scripts.js CHANGED
@@ -1,42 +1,59 @@
1
  jQuery(document).ready(function($){
2
 
3
- jQuery('#wcmp_hide').click(function(){
4
- jQuery('.wcml_miss_lang').slideUp('3000',function(){jQuery('#wcmp_show').show();});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  });
6
 
7
- jQuery('#wcmp_show').click(function(){
8
- jQuery('#wcmp_show').hide();
9
- jQuery('.wcml_miss_lang').slideDown('3000');
10
  });
11
 
12
- jQuery('.wcml_check_all').click(function(){
13
- if(jQuery(this).is(":checked")){
14
- jQuery("table.wcml_products input[type='checkbox']").each(function(){
15
- jQuery(this).attr("checked","checked");
16
  });
17
  }else{
18
- jQuery("table.wcml_products input[type='checkbox']").each(function(){
19
- jQuery(this).removeAttr("checked");
20
  });
21
  }
22
  });
23
 
24
- jQuery('.wcml_search').click(function(){
25
- window.location = jQuery('.wcml_products_admin_url').val()+'&s='+jQuery('.wcml_product_name').val()+'&cat='+jQuery('.wcml_product_category').val()+'&trst='+jQuery('.wcml_translation_status').val()+'&st='+jQuery('.wcml_product_status').val()+'&slang='+jQuery('.wcml_translation_status_lang').val();
26
  });
27
 
28
- jQuery('.wcml_reset_search').click(function(){
29
- window.location = jQuery('.wcml_products_admin_url').val();
30
  });
31
 
32
- jQuery('.wcml_pagin').keypress(function(e) {
33
  if(e.which == 13) {
34
- window.location = jQuery('.wcml_pagination_url').val()+jQuery(this).val();
35
  return false;
36
  }
37
  });
38
 
39
- jQuery('.wcml_details').click(function(e){
40
  e.preventDefault();
41
  var textClosed = $(this).data('text-closed');
42
  var textOpened = $(this).data('text-opened');
@@ -44,7 +61,7 @@ jQuery(document).ready(function($){
44
 
45
  if ( $table.is(':visible') ){
46
  $table.find('input').each(function(){
47
- jQuery(this).val(jQuery(this).data('def'));
48
  });
49
  $table.closest('.outer').hide();
50
  $(this).text(textClosed);
@@ -52,7 +69,7 @@ jQuery(document).ready(function($){
52
  else {
53
  //set def data
54
  $table.find('input').each(function(){
55
- jQuery(this).data('def',jQuery(this).val());
56
  });
57
  $table.closest('.outer').show();
58
  $(this).text(textOpened);
@@ -60,11 +77,11 @@ jQuery(document).ready(function($){
60
  return false;
61
  });
62
 
63
- jQuery('button[name="cancel"]').click(function(){
64
- var $outer = jQuery(this).closest('.outer');
65
 
66
  $outer.find('input').each(function(){
67
- jQuery(this).val(jQuery(this).data('def'));
68
  });
69
 
70
  var prid = $outer.data('prid');
@@ -76,63 +93,63 @@ jQuery(document).ready(function($){
76
  });
77
 
78
 
79
- jQuery('button[name="cancel"]').click(function(){
80
- jQuery(this).parent().find('input').each(function(){
81
- jQuery(this).val(jQuery(this).data('def'));
82
  });
83
- jQuery(this).closest('.outer').slideUp('3000');
84
  });
85
 
86
- jQuery('.wcml_action_top').click(function(){
87
- if(jQuery(this).val() == 'apply' && jQuery(this).parent().find('select[name="test_action"]').val() == 'to_translation'){
88
  var ids = '',i = 0;
89
- jQuery('input[name="product[]"]').each(function(){
90
- if(jQuery(this).is(':checked')){
91
- ids += i+"="+jQuery(this).val()+"&";
92
  i++;
93
  }
94
  });
95
- jQuery('.icl_selected_posts').val(ids);
96
- jQuery('.wcml_send_to_trnsl').click();
97
  return false;
98
  }
99
  });
100
 
101
- jQuery('.wcml_action_bottom').click(function(){
102
- if(jQuery(this).val() == 'apply' && jQuery(this).parent().find('select[name="test_action_bottom"]').val() == 'to_translation'){
103
  var ids = '',i = 0;
104
- jQuery('input[name="product[]"]').each(function(){
105
- if(jQuery(this).is(':checked')){
106
- ids += i+"="+jQuery(this).val()+"&";
107
  i++;
108
  }
109
  });
110
- jQuery('.icl_selected_posts').val(ids);
111
- jQuery('.wcml_send_to_trnsl').click();
112
  return false;
113
  }
114
  });
115
 
116
 
117
- jQuery(".wcml_update").click( function() {
118
- var field = jQuery(this);
119
 
120
- var spl = jQuery(this).attr('name').split('#');
121
 
122
  var product_id = spl[1];
123
  var language = spl[2];
124
 
125
  var records = '';
126
  field.closest('.outer').find("input").each(function(){
127
- records += jQuery(this).serialize()+"&";
128
  });
129
  field.closest('.outer').find("textarea").each(function(){
130
- records += jQuery(this).serialize()+"&";
131
  });
132
  field.hide();
133
  field.parent().find('.wcml_spinner').css('display','inline-block');
134
 
135
- jQuery.ajax({
136
  type : "post",
137
  url : ajaxurl,
138
  dataType: 'json',
@@ -141,15 +158,15 @@ jQuery(document).ready(function($){
141
  product_id : product_id,
142
  language : language,
143
  records : records,
144
- slang : jQuery('.wcml_translation_status_lang').val(),
145
- wcml_nonce: jQuery('#upd_product_nonce').val()
146
  },
147
  success: function(response) {
148
  if(typeof response.error !== "undefined"){
149
  alert(response.error);
150
  }else{
151
  //update status block
152
- jQuery('.translations_statuses.prid_'+product_id).html(response.status);
153
 
154
 
155
  //update images block
@@ -167,19 +184,19 @@ jQuery(document).ready(function($){
167
 
168
  //set def data
169
  field.closest('.outer').find('input').each(function(){
170
- jQuery(this).data('def',jQuery(this).val());
171
  });
172
 
173
 
174
 
175
- field.val(jQuery('#wcml_product_update_button_label').html());
176
 
177
  }
178
  field.parent().find('.wcml_spinner').hide();
179
  field.prop('disabled', true).removeClass('button-primary').addClass('button-secondary');
180
  field.show();
181
 
182
- jQuery('#prid_' + product_id + ' .js-wcml_duplicate_product_undo_' + language).fadeOut();
183
 
184
  }
185
  });
@@ -191,21 +208,21 @@ jQuery(document).ready(function($){
191
 
192
  WPML_Translate_taxonomy.callbacks.add(function(func, taxonomy){
193
 
194
- if(jQuery('.js-tax-tab-' + taxonomy + ' i.icon-warning-sign').length){
195
 
196
- jQuery.ajax({
197
  type : "post",
198
  url : ajaxurl,
199
  dataType: 'json',
200
  data : {
201
  action: "wcml_update_term_translated_warnings",
202
  taxonomy: taxonomy,
203
- wcml_nonce: jQuery('#wcml_update_term_translated_warnings_nonce').val()
204
  },
205
  success: function(response) {
206
  if(response.hide){
207
- jQuery('.js-tax-tab-' + taxonomy).removeAttr('title');
208
- jQuery('.js-tax-tab-' + taxonomy + ' i.icon-warning-sign').remove();
209
  }
210
  }
211
  })
@@ -217,57 +234,57 @@ jQuery(document).ready(function($){
217
  });
218
  }
219
 
220
- jQuery(document).on('click', '.wcml_duplicate_product_notice a[href^=#edit-]', function(){
221
 
222
- var spl = jQuery(this).attr('href').replace(/#edit-/, '').split('_');
223
  var pid = spl[0];
224
  var lng = spl[1];
225
 
226
- jQuery('#prid_' + pid + ' tr[rel=' + lng + '] .js-dup-disabled').removeAttr('disabled');
227
- jQuery('#prid_' + pid + ' tr[rel=' + lng + '] input[name^=end_duplication]').val(1);
228
- jQuery('#prid_' + pid + ' .js-wcml_duplicate_product_notice_'+lng).hide();
229
- jQuery('#prid_' + pid + ' .js-wcml_duplicate_product_undo_'+lng).show();
230
 
231
  return false;
232
 
233
  });
234
 
235
- jQuery(document).on('click', '.wcml_duplicate_product_notice a[href^=#undo-]', function(){
236
 
237
- var spl = jQuery(this).attr('href').replace(/#undo-/, '').split('_');
238
  var pid = spl[0];
239
  var lng = spl[1];
240
 
241
- jQuery('#prid_' + pid + ' tr[rel=' + lng + '] .js-dup-disabled').attr('disabled', 'disabled');
242
- jQuery('#prid_' + pid + ' tr[rel=' + lng + '] input[name^=end_duplication]').val(0);
243
- jQuery('#prid_' + pid + ' .js-wcml_duplicate_product_undo_'+lng).hide();
244
- jQuery('#prid_' + pid + ' .js-wcml_duplicate_product_notice_'+lng).show();
245
 
246
  return false;
247
 
248
  });
249
 
250
- jQuery(document).on('click', '.js-tax-translation li a[href^=#ignore-]', function(){
251
 
252
- var taxonomy = jQuery(this).attr('href').replace(/#ignore-/, '');
253
 
254
- jQuery.ajax({
255
  type : "post",
256
  url : ajaxurl,
257
  dataType: 'json',
258
  data : {
259
  action: "wcml_ingore_taxonomy_translation",
260
  taxonomy: taxonomy,
261
- wcml_nonce: jQuery('#wcml_ingore_taxonomy_translation_nonce').val()
262
  },
263
  success: function(response) {
264
 
265
  if(response.html){
266
 
267
- jQuery('.js-tax-translation li.js-tax-translation-' + taxonomy).html(response.html);
268
 
269
- jQuery('.js-tax-tab-' + taxonomy).removeAttr('title');
270
- jQuery('.js-tax-tab-' + taxonomy + ' i.icon-warning-sign').remove();
271
 
272
 
273
  }
@@ -278,24 +295,24 @@ jQuery(document).ready(function($){
278
  return false;
279
  })
280
 
281
- jQuery(document).on('click', '.js-tax-translation li a[href^=#unignore-]', function(){
282
 
283
- var taxonomy = jQuery(this).attr('href').replace(/#unignore-/, '');
284
 
285
- jQuery.ajax({
286
  type : "post",
287
  url : ajaxurl,
288
  dataType: 'json',
289
  data : {
290
  action: "wcml_uningore_taxonomy_translation",
291
  taxonomy: taxonomy,
292
- wcml_nonce: jQuery('#wcml_ingore_taxonomy_translation_nonce').val()
293
  },
294
  success: function(response) {
295
  if(response.html){
296
- jQuery('.js-tax-translation li.js-tax-translation-' + taxonomy).html(response.html);
297
  if(response.warn){
298
- jQuery('.js-tax-tab-' + taxonomy).append('&nbsp;<i class="icon-warning-sign"></i>');
299
  }
300
 
301
  }
@@ -306,14 +323,14 @@ jQuery(document).ready(function($){
306
  })
307
 
308
 
309
- jQuery(document).on('submit', '#icl_tt_sync_variations', function(){
310
 
311
- var this_form = jQuery('#icl_tt_sync_variations');
312
  var data = this_form.serialize();
313
  this_form.find('.wpml_tt_spinner').fadeIn();
314
  this_form.find('input[type=submit]').attr('disabled', 'disabled');
315
 
316
- jQuery.ajax({
317
  type : "post",
318
  url : ajaxurl,
319
  dataType: 'json',
@@ -342,117 +359,117 @@ jQuery(document).ready(function($){
342
  var wcml_get_product_fields_string = function(row){
343
  var string = '';
344
  row.find('input[type=text], textarea').each(function(){
345
- string += jQuery(this).val();
346
  });
347
 
348
  return string;
349
  }
350
 
351
- jQuery(document).on('focus','.wcml_products_translation input[type=text], .wcml_products_translation textarea',function(){
352
 
353
- var row_lang = jQuery(this).closest('tr[rel]').attr('rel');
354
- var prod_id = jQuery(this).closest('div.wcml_product_row').attr('id');
355
 
356
- wcml_product_rows_data[prod_id + '_' + row_lang] = wcml_get_product_fields_string(jQuery(this).closest('tr'));
357
 
358
  });
359
 
360
- jQuery(document).on('input keyup change paste mouseup','.wcml_products_translation input[type=text], .wcml_products_translation textarea',function(){
361
 
362
- if(jQuery(this).attr('disabled')) return;
363
 
364
- var row_lang = jQuery(this).closest('tr[rel]').attr('rel');
365
- var prod_id = jQuery(this).closest('div.wcml_product_row').attr('id');
366
 
367
- if(jQuery(this).closest('tr[rel]').find('.wcml_update').prop('disabled')){
368
 
369
- if(wcml_product_rows_data[prod_id + '_' + row_lang] != wcml_get_product_fields_string(jQuery(this).closest('tr'))){
370
- jQuery(this).closest('tr[rel]').find('.wcml_update').prop('disabled',false).removeClass('button-secondary').addClass('button-primary');;
371
  }
372
 
373
  }
374
 
375
  })
376
 
377
- jQuery(".wcml_edit_conten").click(function(){
378
- jQuery(".wcml_fade").show();
379
- jQuery(this).parent().find('.wcml_editor').show();
380
- jQuery(this).parent().find('.wcml_editor table.mceLayout').css('height','auto');
381
- jQuery(this).parent().find('.wcml_editor table.mceLayout iframe').css('min-height','150px');
382
  var txt_height = '90%';
383
- jQuery(this).parent().find('textarea.wcml_content_tr').data('def',jQuery(this).parent().find('textarea.wcml_content_tr').val());
384
- jQuery(this).parent().find('.wcml_original_content').cleditor({
385
  height: txt_height,
386
  controls: // controls to add to the toolbar
387
  " source "
388
  });
389
- jQuery(this).parent().find('.wcml_original_content').cleditor()[0].disable(true);
390
 
391
- jQuery(document).on('click','.cleditorButton',function(){
392
- if(jQuery(this).closest('.cleditorMain').find('textarea').is(':visible')){
393
- jQuery(this).closest('.cleditorMain').find('textarea').hide();
394
- jQuery(this).closest('.cleditorMain').find('iframe').show();
395
  }else{
396
- jQuery(this).closest('.cleditorMain').find('textarea').show();
397
- jQuery(this).closest('.cleditorMain').find('iframe').hide();
398
  }
399
  });
400
  });
401
 
402
- jQuery(".wcml_close_cross,.wcml_popup_cancel").click(function(){
403
- jQuery(".wcml_fade").hide();
404
  if(tinyMCE.activeEditor != null){
405
- if(jQuery('textarea.wcml_content_tr')>0){
406
- tinyMCE.activeEditor.setContent(jQuery(this).closest('.wcml_editor').find('.wcml_editor_translation textarea').data('def'));
407
  }
408
  }
409
- jQuery(this).closest('.wcml_editor').css('display','none');
410
- jQuery(this).closest('.wcml_editor').find('.wcml_editor_translation textarea').val(jQuery(this).closest('.wcml_editor').find('.wcml_editor_translation textarea').data('def'));
411
  });
412
 
413
- jQuery(".wcml_popup_close").click(function(){
414
- jQuery(".wcml_fade").hide();
415
- jQuery(this).closest('.wcml_editor').css('display','none');
416
  });
417
 
418
 
419
- jQuery(".wcml_popup_ok").click(function(){
420
- var text_area = jQuery(this).closest('.wcml_editor').find('.wcml_editor_translation textarea');
421
- jQuery(".wcml_fade").hide();
422
 
423
  if(text_area.size()>0 && !text_area.is(':visible')){
424
  text_area.val(window.parent.tinyMCE.get(text_area.attr('id')).getContent());
425
  }
426
- jQuery(this).closest('.wcml_editor').css('display','none');
427
 
428
 
429
- var row_lang = jQuery(this).closest('tr[rel]').attr('rel');
430
- var prod_id = jQuery(this).closest('div.wcml_product_row').attr('id');
431
 
432
  if(text_area.val() != ''){
433
- jQuery(this).closest('tr').find('.wcml_field_translation_' + text_area.attr('name')).hide();
434
  }else{
435
- if(jQuery(this).closest('tr').find('.wcml_field_translation_' + text_area.attr('name')).length){
436
- jQuery(this).closest('tr').find('.wcml_field_translation_' + text_area.attr('name')).show();
437
  }
438
  }
439
 
440
- if(wcml_product_rows_data[prod_id + '_' + row_lang] != wcml_get_product_fields_string(jQuery(this).closest('tr'))){
441
- jQuery(this).closest('tr[rel]').find('.wcml_update').prop('disabled',false);
442
  }
443
 
444
  });
445
 
446
 
447
- if(jQuery('.wcml_file_paths').size()>0){
448
  // Uploading files
449
  var downloadable_file_frame;
450
  var file_path_field;
451
  var file_paths;
452
 
453
- jQuery(document).on( 'click', '.wcml_file_paths', function( event ){
454
 
455
- var $el = jQuery(this);
456
 
457
  file_path_field = $el.parent().find('textarea');
458
  file_paths = file_path_field.val();
@@ -516,7 +533,7 @@ jQuery(document).ready(function($){
516
 
517
  downloadable_file_frame.on( 'close', function() {
518
  // TODO: /wp-admin should be a variable. Some plugions, like WP Better Security changes the name of this dir.
519
- jQuery.removeCookie('_icl_current_language', { path: '/wp-admin' });
520
  });
521
 
522
  // Finally, open the modal.
@@ -524,14 +541,14 @@ jQuery(document).ready(function($){
524
  });
525
  }
526
 
527
- if(jQuery(".wcml_editor_original").size() > 0 ){
528
- jQuery(".wcml_editor_original").resizable({
529
  handles: 'n, s',
530
  resize: function( event, ui ) {
531
- jQuery(this).find('.cleditorMain').css('height',jQuery(this).height() - 60)
532
  },
533
  start: function(event, ui) {
534
- jQuery('<div class="ui-resizable-iframeFix" style="background: #FFF;"></div>')
535
  .css({
536
  width:'100%', height: '100%',
537
  position: "absolute", opacity: "0.001", zIndex: 160001
@@ -539,29 +556,29 @@ jQuery(document).ready(function($){
539
  .prependTo(".wcml_editor_original");
540
  },
541
  stop: function(event, ui) {
542
- jQuery('.ui-resizable-iframeFix').remove()
543
  }
544
  });
545
  }
546
 
547
- jQuery('#multi_currency_option_select input[name=multi_currency]').change(function(){
548
 
549
- if(jQuery(this).attr('id') != 'multi_currency_independent'){
550
- jQuery('#multi-currency-per-language-details').fadeOut();
551
  }else{
552
- jQuery('#multi-currency-per-language-details').fadeIn();
553
  }
554
 
555
  })
556
 
557
- jQuery('#wcml_custom_exchange_rates').submit(function(){
558
 
559
- var thisf = jQuery(this);
560
 
561
  thisf.find(':submit').parent().prepend(icl_ajxloaderimg + '&nbsp;')
562
  thisf.find(':submit').prop('disabled', true);
563
 
564
- jQuery.ajax({
565
 
566
  type: 'post',
567
  dataType: 'json',
@@ -579,16 +596,16 @@ jQuery(document).ready(function($){
579
 
580
  function wcml_remove_custom_rates(post_id){
581
 
582
- var thisa = jQuery(this);
583
 
584
- jQuery.ajax({
585
 
586
  type: 'post',
587
  dataType: 'json',
588
  url: ajaxurl,
589
  data: {action: 'wcml_remove_custom_rates', 'post_id': post_id},
590
  success: function(){
591
- thisa.parent().parent().parent().fadeOut(function(){ jQuery(this).remove()});
592
  }
593
 
594
  })
@@ -597,21 +614,21 @@ jQuery(document).ready(function($){
597
 
598
  }
599
 
600
- jQuery(document).on('click', '#wcml_fix_strings_language', function(){
601
 
602
- var thisb = jQuery(this);
603
  thisb.prop('disabled', true);
604
  var $ajaxLoader = $('<span>&nbsp;</span>' + icl_ajxloaderimg);
605
  $ajaxLoader.insertAfter(thisb).show();
606
 
607
- jQuery.ajax({
608
 
609
  type : "post",
610
  dataType:'json',
611
  url : ajaxurl,
612
  data : {
613
  action: "wcml_fix_strings_language",
614
- wcml_nonce: jQuery('#wcml_fix_strings_language_nonce').val()
615
  },
616
  error: function(respnse) {
617
  thisb.prop('disabled', false);
@@ -620,7 +637,7 @@ jQuery(document).ready(function($){
620
 
621
  var sucess_1 = response.success_1;
622
 
623
- jQuery.ajax({
624
  type : "post",
625
  dataType:'json',
626
  url : icl_ajx_url,
@@ -630,7 +647,6 @@ jQuery(document).ready(function($){
630
  _wpnonce: response._wpnonce
631
  },
632
  complete: function(response){
633
- //thisb.prop('disabled',false);
634
  $ajaxLoader.remove();
635
  thisb.after(sucess_1);
636
  }
@@ -642,57 +658,69 @@ jQuery(document).ready(function($){
642
 
643
  });
644
 
645
- jQuery(document).on('click','.edit_currency',function(){
646
- var $tableRow = jQuery(this).closest('tr');
647
  $tableRow.addClass('edit-mode');
648
- $tableRow.find('.currency_code span').hide();
649
- $tableRow.find('.currency_code input').show();
650
- $tableRow.find('.currency_value span').hide();
651
  $tableRow.find('.currency_value input').show();
652
- $tableRow.find('.currency_changed span').hide();
653
  $tableRow.find('.edit_currency').hide();
654
  $tableRow.find('.delete_currency').hide();
655
  $tableRow.find('.save_currency').show();
656
  $tableRow.find('.cancel_currency').show();
657
  });
658
 
659
- jQuery(document).on('click','.cancel_currency',function(){
660
- var $tableRow = jQuery(this).closest('tr');
661
  $tableRow.removeClass('edit-mode');
662
  if($tableRow.find('.currency_id').val() > 0){
663
- $tableRow.find('.currency_code span').show();
664
- $tableRow.find('.currency_code input').hide();
665
- $tableRow.find('.currency_value span').show();
666
  $tableRow.find('.currency_value input').hide();
667
- $tableRow.find('.currency_changed span').show();
668
  $tableRow.find('.edit_currency').show();
669
  $tableRow.find('.delete_currency').show();
670
  $tableRow.find('.save_currency').hide();
671
  $tableRow.find('.cancel_currency').hide();
672
  $tableRow.find('.wcml-error').remove();
673
  }else{
 
 
674
  $tableRow.remove();
675
  }
676
  });
677
 
678
- jQuery('.wcml_add_currency button').click(function(){
679
- var pluginurl = jQuery('.wcml_plugin_url').val();
 
 
 
 
 
680
  var $tableRow = $('.js-table-row-wrapper .js-table-row').clone();
681
- jQuery('#currency-table').find('tbody').append( $tableRow );
 
 
682
  });
683
 
684
- jQuery(document).on('click','.save_currency',function(e){
685
  e.preventDefault();
686
 
687
- var $this = jQuery(this);
688
  var $ajaxLoader = $('<span class="spinner">');
689
- var $messageContainer = jQuery('<span class="wcml-error">');
690
- $ajaxLoader.insertBefore($this).show();
691
 
692
  $this.prop('disabled',true);
693
 
694
- var parent = jQuery(this).closest('tr');
695
-
 
 
 
 
696
  if(parent.find('.currency_id').val() > 0){
697
  var currency_id = parent.find('.currency_id').val();
698
  }else{
@@ -702,7 +730,7 @@ jQuery(document).ready(function($){
702
  $currencyCodeWraper = parent.find('.currency_code');
703
  $currencyValueWraper = parent.find('.currency_value');
704
 
705
- var currency_code = $currencyCodeWraper.find('input').val();
706
  var currency_value = $currencyValueWraper.find('input').val();
707
  var flag = false;
708
 
@@ -749,6 +777,8 @@ jQuery(document).ready(function($){
749
  if(flag){
750
  $ajaxLoader.remove();
751
  $this.prop('disabled',false);
 
 
752
  return false;
753
  }
754
 
@@ -765,12 +795,13 @@ jQuery(document).ready(function($){
765
  var today = dd+'/'+mm+'/'+yyyy;
766
 
767
 
768
- jQuery.ajax({
769
  type : "post",
770
  url : ajaxurl,
 
771
  data : {
772
  action: "wcml_update_currency",
773
- wcml_nonce: jQuery('#upd_currency_nonce').val(),
774
  currency_id : currency_id,
775
  currency_code : currency_code,
776
  currency_value : currency_value,
@@ -781,20 +812,24 @@ jQuery(document).ready(function($){
781
  },
782
  success: function(response) {
783
  if(currency_id == 0){
784
- parent.find('.currency_id').val(response);
785
  }
786
-
787
- parent.find('.currency_code span').html(parent.closest('tr').find('.currency_code input').val()).show();
788
- parent.find('.currency_code input').hide();
789
- parent.find('.currency_value span').html(parent.closest('tr').find('.currency_value input').val()).show();
 
 
790
  parent.find('.currency_value input').hide();
791
- parent.find('.currency_changed span').html(today).show();
792
  parent.find('.edit_currency').show();
793
  parent.find('.delete_currency').show();
794
- parent.find('.save_currency').hide();
795
- parent.find('.cancel_currency').hide();
796
- $this.closest('.edit-mode').removeClass('edit-mode');
797
 
 
 
 
 
 
798
  },
799
  complete: function() {
800
  $ajaxLoader.remove();
@@ -806,25 +841,35 @@ jQuery(document).ready(function($){
806
  });
807
 
808
 
809
- jQuery(document).on('click','.delete_currency',function(e){
810
  e.preventDefault();
811
 
812
- var parent = jQuery(this).closest('tr');
813
- var $this = jQuery(this);
814
  var $ajaxLoader = $('<span class="spinner">');
815
  var currency_id = parent.find('.currency_id').val();
816
  $this.hide();
817
  $this.parent().append($ajaxLoader).show();
818
 
819
- jQuery.ajax({
820
  type : "post",
821
  url : ajaxurl,
822
  data : {
823
  action: "wcml_delete_currency",
824
- wcml_nonce: jQuery('#del_currency_nonce').val(),
825
- currency_id : currency_id
 
826
  },
827
  success: function(response) {
 
 
 
 
 
 
 
 
 
828
  parent.remove();
829
  },
830
  done: function() {
@@ -905,9 +950,68 @@ jQuery(document).ready(function($){
905
  }
906
  }).pointer('open');
907
  });
908
-
909
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
910
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
911
 
912
  function isNumber(n) {
913
  return !isNaN(parseFloat(n)) && isFinite(n);
1
  jQuery(document).ready(function($){
2
 
3
+ var discard = false;
4
+
5
+ window.onbeforeunload = function(e) {
6
+ if(discard){
7
+ return $('#wcml_warn_message').val();
8
+ }
9
+ }
10
+
11
+ $('.wcml-section input[type="submit"]').click(function(){
12
+ discard = false;
13
+ });
14
+
15
+ $('.wcml-section input[type="radio"],#wcml_products_sync_date').click(function(){
16
+ discard = true;
17
+ $(this).closest('.wcml-section').find('.button-wrap input').css("border-color","#1e8cbe");
18
+ });
19
+
20
+ $('#wcmp_hide').click(function(){
21
+ $('.wcml_miss_lang').slideUp('3000',function(){$('#wcmp_show').show();});
22
  });
23
 
24
+ $('#wcmp_show').click(function(){
25
+ $('#wcmp_show').hide();
26
+ $('.wcml_miss_lang').slideDown('3000');
27
  });
28
 
29
+ $('.wcml_check_all').click(function(){
30
+ if($(this).is(":checked")){
31
+ $("table.wcml_products input[type='checkbox']").each(function(){
32
+ $(this).attr("checked","checked");
33
  });
34
  }else{
35
+ $("table.wcml_products input[type='checkbox']").each(function(){
36
+ $(this).removeAttr("checked");
37
  });
38
  }
39
  });
40
 
41
+ $('.wcml_search').click(function(){
42
+ window.location = $('.wcml_products_admin_url').val()+'&s='+$('.wcml_product_name').val()+'&cat='+$('.wcml_product_category').val()+'&trst='+$('.wcml_translation_status').val()+'&st='+$('.wcml_product_status').val()+'&slang='+$('.wcml_translation_status_lang').val();
43
  });
44
 
45
+ $('.wcml_reset_search').click(function(){
46
+ window.location = $('.wcml_products_admin_url').val();
47
  });
48
 
49
+ $('.wcml_pagin').keypress(function(e) {
50
  if(e.which == 13) {
51
+ window.location = $('.wcml_pagination_url').val()+$(this).val();
52
  return false;
53
  }
54
  });
55
 
56
+ $('.wcml_details').click(function(e){
57
  e.preventDefault();
58
  var textClosed = $(this).data('text-closed');
59
  var textOpened = $(this).data('text-opened');
61
 
62
  if ( $table.is(':visible') ){
63
  $table.find('input').each(function(){
64
+ $(this).val($(this).data('def'));
65
  });
66
  $table.closest('.outer').hide();
67
  $(this).text(textClosed);
69
  else {
70
  //set def data
71
  $table.find('input').each(function(){
72
+ $(this).data('def',$(this).val());
73
  });
74
  $table.closest('.outer').show();
75
  $(this).text(textOpened);
77
  return false;
78
  });
79
 
80
+ $('button[name="cancel"]').click(function(){
81
+ var $outer = $(this).closest('.outer');
82
 
83
  $outer.find('input').each(function(){
84
+ $(this).val($(this).data('def'));
85
  });
86
 
87
  var prid = $outer.data('prid');
93
  });
94
 
95
 
96
+ $('button[name="cancel"]').click(function(){
97
+ $(this).parent().find('input').each(function(){
98
+ $(this).val($(this).data('def'));
99
  });
100
+ $(this).closest('.outer').slideUp('3000');
101
  });
102
 
103
+ $('.wcml_action_top').click(function(){
104
+ if($(this).val() == 'apply' && $(this).parent().find('select[name="test_action"]').val() == 'to_translation'){
105
  var ids = '',i = 0;
106
+ $('input[name="product[]"]').each(function(){
107
+ if($(this).is(':checked')){
108
+ ids += i+"="+$(this).val()+"&";
109
  i++;
110
  }
111
  });
112
+ $('.icl_selected_posts').val(ids);
113
+ $('.wcml_send_to_trnsl').click();
114
  return false;
115
  }
116
  });
117
 
118
+ $('.wcml_action_bottom').click(function(){
119
+ if($(this).val() == 'apply' && $(this).parent().find('select[name="test_action_bottom"]').val() == 'to_translation'){
120
  var ids = '',i = 0;
121
+ $('input[name="product[]"]').each(function(){
122
+ if($(this).is(':checked')){
123
+ ids += i+"="+$(this).val()+"&";
124
  i++;
125
  }
126
  });
127
+ $('.icl_selected_posts').val(ids);
128
+ $('.wcml_send_to_trnsl').click();
129
  return false;
130
  }
131
  });
132
 
133
 
134
+ $(".wcml_update").click( function() {
135
+ var field = $(this);
136
 
137
+ var spl = $(this).attr('name').split('#');
138
 
139
  var product_id = spl[1];
140
  var language = spl[2];
141
 
142
  var records = '';
143
  field.closest('.outer').find("input").each(function(){
144
+ records += $(this).serialize()+"&";
145
  });
146
  field.closest('.outer').find("textarea").each(function(){
147
+ records += $(this).serialize()+"&";
148
  });
149
  field.hide();
150
  field.parent().find('.wcml_spinner').css('display','inline-block');
151
 
152
+ $.ajax({
153
  type : "post",
154
  url : ajaxurl,
155
  dataType: 'json',
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()
163
  },
164
  success: function(response) {
165
  if(typeof response.error !== "undefined"){
166
  alert(response.error);
167
  }else{
168
  //update status block
169
+ $('.translations_statuses.prid_'+product_id).html(response.status);
170
 
171
 
172
  //update images block
184
 
185
  //set def data
186
  field.closest('.outer').find('input').each(function(){
187
+ $(this).data('def',$(this).val());
188
  });
189
 
190
 
191
 
192
+ field.val($('#wcml_product_update_button_label').html());
193
 
194
  }
195
  field.parent().find('.wcml_spinner').hide();
196
  field.prop('disabled', true).removeClass('button-primary').addClass('button-secondary');
197
  field.show();
198
 
199
+ $('#prid_' + product_id + ' .js-wcml_duplicate_product_undo_' + language).fadeOut();
200
 
201
  }
202
  });
208
 
209
  WPML_Translate_taxonomy.callbacks.add(function(func, taxonomy){
210
 
211
+ if($('.js-tax-tab-' + taxonomy + ' i.icon-warning-sign').length){
212
 
213
+ $.ajax({
214
  type : "post",
215
  url : ajaxurl,
216
  dataType: 'json',
217
  data : {
218
  action: "wcml_update_term_translated_warnings",
219
  taxonomy: taxonomy,
220
+ wcml_nonce: $('#wcml_update_term_translated_warnings_nonce').val()
221
  },
222
  success: function(response) {
223
  if(response.hide){
224
+ $('.js-tax-tab-' + taxonomy).removeAttr('title');
225
+ $('.js-tax-tab-' + taxonomy + ' i.icon-warning-sign').remove();
226
  }
227
  }
228
  })
234
  });
235
  }
236
 
237
+ $(document).on('click', '.wcml_duplicate_product_notice a[href^=#edit-]', function(){
238
 
239
+ var spl = $(this).attr('href').replace(/#edit-/, '').split('_');
240
  var pid = spl[0];
241
  var lng = spl[1];
242
 
243
+ $('#prid_' + pid + ' tr[rel=' + lng + '] .js-dup-disabled').removeAttr('disabled');
244
+ $('#prid_' + pid + ' tr[rel=' + lng + '] input[name^=end_duplication]').val(1);
245
+ $('#prid_' + pid + ' .js-wcml_duplicate_product_notice_'+lng).hide();
246
+ $('#prid_' + pid + ' .js-wcml_duplicate_product_undo_'+lng).show();
247
 
248
  return false;
249
 
250
  });
251
 
252
+ $(document).on('click', '.wcml_duplicate_product_notice a[href^=#undo-]', function(){
253
 
254
+ var spl = $(this).attr('href').replace(/#undo-/, '').split('_');
255
  var pid = spl[0];
256
  var lng = spl[1];
257
 
258
+ $('#prid_' + pid + ' tr[rel=' + lng + '] .js-dup-disabled').attr('disabled', 'disabled');
259
+ $('#prid_' + pid + ' tr[rel=' + lng + '] input[name^=end_duplication]').val(0);
260
+ $('#prid_' + pid + ' .js-wcml_duplicate_product_undo_'+lng).hide();
261
+ $('#prid_' + pid + ' .js-wcml_duplicate_product_notice_'+lng).show();
262
 
263
  return false;
264
 
265
  });
266
 
267
+ $(document).on('click', '.js-tax-translation li a[href^=#ignore-]', function(){
268
 
269
+ var taxonomy = $(this).attr('href').replace(/#ignore-/, '');
270
 
271
+ $.ajax({
272
  type : "post",
273
  url : ajaxurl,
274
  dataType: 'json',
275
  data : {
276
  action: "wcml_ingore_taxonomy_translation",
277
  taxonomy: taxonomy,
278
+ wcml_nonce: $('#wcml_ingore_taxonomy_translation_nonce').val()
279
  },
280
  success: function(response) {
281
 
282
  if(response.html){
283
 
284
+ $('.js-tax-translation li.js-tax-translation-' + taxonomy).html(response.html);
285
 
286
+ $('.js-tax-tab-' + taxonomy).removeAttr('title');
287
+ $('.js-tax-tab-' + taxonomy + ' i.icon-warning-sign').remove();
288
 
289
 
290
  }
295
  return false;
296
  })
297
 
298
+ $(document).on('click', '.js-tax-translation li a[href^=#unignore-]', function(){
299
 
300
+ var taxonomy = $(this).attr('href').replace(/#unignore-/, '');
301
 
302
+ $.ajax({
303
  type : "post",
304
  url : ajaxurl,
305
  dataType: 'json',
306
  data : {
307
  action: "wcml_uningore_taxonomy_translation",
308
  taxonomy: taxonomy,
309
+ wcml_nonce: $('#wcml_ingore_taxonomy_translation_nonce').val()
310
  },
311
  success: function(response) {
312
  if(response.html){
313
+ $('.js-tax-translation li.js-tax-translation-' + taxonomy).html(response.html);
314
  if(response.warn){
315
+ $('.js-tax-tab-' + taxonomy).append('&nbsp;<i class="icon-warning-sign"></i>');
316
  }
317
 
318
  }
323
  })
324
 
325
 
326
+ $(document).on('submit', '#icl_tt_sync_variations', function(){
327
 
328
+ var this_form = $('#icl_tt_sync_variations');
329
  var data = this_form.serialize();
330
  this_form.find('.wpml_tt_spinner').fadeIn();
331
  this_form.find('input[type=submit]').attr('disabled', 'disabled');
332
 
333
+ $.ajax({
334
  type : "post",
335
  url : ajaxurl,
336
  dataType: 'json',
359
  var wcml_get_product_fields_string = function(row){
360
  var string = '';
361
  row.find('input[type=text], textarea').each(function(){
362
+ string += $(this).val();
363
  });
364
 
365
  return string;
366
  }
367
 
368
+ $(document).on('focus','.wcml_products_translation input[type=text], .wcml_products_translation textarea',function(){
369
 
370
+ var row_lang = $(this).closest('tr[rel]').attr('rel');
371
+ var prod_id = $(this).closest('div.wcml_product_row').attr('id');
372
 
373
+ wcml_product_rows_data[prod_id + '_' + row_lang] = wcml_get_product_fields_string($(this).closest('tr'));
374
 
375
  });
376
 
377
+ $(document).on('input keyup change paste mouseup','.wcml_products_translation input[type=text], .wcml_products_translation textarea',function(){
378
 
379
+ if($(this).attr('disabled')) return;
380
 
381
+ var row_lang = $(this).closest('tr[rel]').attr('rel');
382
+ var prod_id = $(this).closest('div.wcml_product_row').attr('id');
383
 
384
+ if($(this).closest('tr[rel]').find('.wcml_update').prop('disabled')){
385
 
386
+ if(wcml_product_rows_data[prod_id + '_' + row_lang] != wcml_get_product_fields_string($(this).closest('tr'))){
387
+ $(this).closest('tr[rel]').find('.wcml_update').prop('disabled',false).removeClass('button-secondary').addClass('button-primary');;
388
  }
389
 
390
  }
391
 
392
  })
393
 
394
+ $(".wcml_edit_conten").click(function(){
395
+ $(".wcml_fade").show();
396
+ $(this).parent().find('.wcml_editor').show();
397
+ $(this).parent().find('.wcml_editor table.mceLayout').css('height','auto');
398
+ $(this).parent().find('.wcml_editor table.mceLayout iframe').css('min-height','150px');
399
  var txt_height = '90%';
400
+ $(this).parent().find('textarea.wcml_content_tr').data('def',$(this).parent().find('textarea.wcml_content_tr').val());
401
+ $(this).parent().find('.wcml_original_content').cleditor({
402
  height: txt_height,
403
  controls: // controls to add to the toolbar
404
  " source "
405
  });
406
+ $(this).parent().find('.wcml_original_content').cleditor()[0].disable(true);
407
 
408
+ $(document).on('click','.cleditorButton',function(){
409
+ if($(this).closest('.cleditorMain').find('textarea').is(':visible')){
410
+ $(this).closest('.cleditorMain').find('textarea').hide();
411
+ $(this).closest('.cleditorMain').find('iframe').show();
412
  }else{
413
+ $(this).closest('.cleditorMain').find('textarea').show();
414
+ $(this).closest('.cleditorMain').find('iframe').hide();
415
  }
416
  });
417
  });
418
 
419
+ $(".wcml_close_cross,.wcml_popup_cancel").click(function(){
420
+ $(".wcml_fade").hide();
421
  if(tinyMCE.activeEditor != null){
422
+ if($(this).closest('.wcml_editor').find('textarea.wcml_content_tr').size() >0){
423
+ tinyMCE.activeEditor.setContent($(this).closest('.wcml_editor').find('.wcml_editor_translation textarea').data('def'));
424
  }
425
  }
426
+ $(this).closest('.wcml_editor').css('display','none');
427
+ $(this).closest('.wcml_editor').find('.wcml_editor_translation textarea').val($(this).closest('.wcml_editor').find('.wcml_editor_translation textarea').data('def'));
428
  });
429
 
430
+ $(".wcml_popup_close").click(function(){
431
+ $(".wcml_fade").hide();
432
+ $(this).closest('.wcml_editor').css('display','none');
433
  });
434
 
435
 
436
+ $(".wcml_popup_ok").click(function(){
437
+ var text_area = $(this).closest('.wcml_editor').find('.wcml_editor_translation textarea');
438
+ $(".wcml_fade").hide();
439
 
440
  if(text_area.size()>0 && !text_area.is(':visible')){
441
  text_area.val(window.parent.tinyMCE.get(text_area.attr('id')).getContent());
442
  }
443
+ $(this).closest('.wcml_editor').css('display','none');
444
 
445
 
446
+ var row_lang = $(this).closest('tr[rel]').attr('rel');
447
+ var prod_id = $(this).closest('div.wcml_product_row').attr('id');
448
 
449
  if(text_area.val() != ''){
450
+ $(this).closest('tr').find('.wcml_field_translation_' + text_area.attr('name')).hide();
451
  }else{
452
+ if($(this).closest('tr').find('.wcml_field_translation_' + text_area.attr('name')).length){
453
+ $(this).closest('tr').find('.wcml_field_translation_' + text_area.attr('name')).show();
454
  }
455
  }
456
 
457
+ if(wcml_product_rows_data[prod_id + '_' + row_lang] != wcml_get_product_fields_string($(this).closest('tr'))){
458
+ $(this).closest('tr[rel]').find('.wcml_update').prop('disabled',false);
459
  }
460
 
461
  });
462
 
463
 
464
+ if($('.wcml_file_paths').size()>0){
465
  // Uploading files
466
  var downloadable_file_frame;
467
  var file_path_field;
468
  var file_paths;
469
 
470
+ $(document).on( 'click', '.wcml_file_paths', function( event ){
471
 
472
+ var $el = $(this);
473
 
474
  file_path_field = $el.parent().find('textarea');
475
  file_paths = file_path_field.val();
533
 
534
  downloadable_file_frame.on( 'close', function() {
535
  // TODO: /wp-admin should be a variable. Some plugions, like WP Better Security changes the name of this dir.
536
+ $.removeCookie('_icl_current_language', { path: '/wp-admin' });
537
  });
538
 
539
  // Finally, open the modal.
541
  });
542
  }
543
 
544
+ if($(".wcml_editor_original").size() > 0 ){
545
+ $(".wcml_editor_original").resizable({
546
  handles: 'n, s',
547
  resize: function( event, ui ) {
548
+ $(this).find('.cleditorMain').css('height',$(this).height() - 60)
549
  },
550
  start: function(event, ui) {
551
+ $('<div class="ui-resizable-iframeFix" style="background: #FFF;"></div>')
552
  .css({
553
  width:'100%', height: '100%',
554
  position: "absolute", opacity: "0.001", zIndex: 160001
556
  .prependTo(".wcml_editor_original");
557
  },
558
  stop: function(event, ui) {
559
+ $('.ui-resizable-iframeFix').remove()
560
  }
561
  });
562
  }
563
 
564
+ $('#multi_currency_option_select input[name=multi_currency]').change(function(){
565
 
566
+ if($(this).attr('id') != 'multi_currency_independent'){
567
+ $('#multi-currency-per-language-details').fadeOut();
568
  }else{
569
+ $('#multi-currency-per-language-details').fadeIn();
570
  }
571
 
572
  })
573
 
574
+ $('#wcml_custom_exchange_rates').submit(function(){
575
 
576
+ var thisf = $(this);
577
 
578
  thisf.find(':submit').parent().prepend(icl_ajxloaderimg + '&nbsp;')
579
  thisf.find(':submit').prop('disabled', true);
580
 
581
+ $.ajax({
582
 
583
  type: 'post',
584
  dataType: 'json',
596
 
597
  function wcml_remove_custom_rates(post_id){
598
 
599
+ var thisa = $(this);
600
 
601
+ $.ajax({
602
 
603
  type: 'post',
604
  dataType: 'json',
605
  url: ajaxurl,
606
  data: {action: 'wcml_remove_custom_rates', 'post_id': post_id},
607
  success: function(){
608
+ thisa.parent().parent().parent().fadeOut(function(){ $(this).remove()});
609
  }
610
 
611
  })
614
 
615
  }
616
 
617
+ $(document).on('click', '#wcml_fix_strings_language', function(){
618
 
619
+ var thisb = $(this);
620
  thisb.prop('disabled', true);
621
  var $ajaxLoader = $('<span>&nbsp;</span>' + icl_ajxloaderimg);
622
  $ajaxLoader.insertAfter(thisb).show();
623
 
624
+ $.ajax({
625
 
626
  type : "post",
627
  dataType:'json',
628
  url : ajaxurl,
629
  data : {
630
  action: "wcml_fix_strings_language",
631
+ wcml_nonce: $('#wcml_fix_strings_language_nonce').val()
632
  },
633
  error: function(respnse) {
634
  thisb.prop('disabled', false);
637
 
638
  var sucess_1 = response.success_1;
639
 
640
+ $.ajax({
641
  type : "post",
642
  dataType:'json',
643
  url : icl_ajx_url,
647
  _wpnonce: response._wpnonce
648
  },
649
  complete: function(response){
 
650
  $ajaxLoader.remove();
651
  thisb.after(sucess_1);
652
  }
658
 
659
  });
660
 
661
+ $(document).on('click','.edit_currency',function(){
662
+ var $tableRow = $(this).closest('tr');
663
  $tableRow.addClass('edit-mode');
664
+ $tableRow.find('.currency_code .code_val').hide();
665
+ $tableRow.find('.currency_code select').show();
666
+ $tableRow.find('.currency_value span.curr_val').hide();
667
  $tableRow.find('.currency_value input').show();
668
+ $tableRow.find('.currency_changed').hide();
669
  $tableRow.find('.edit_currency').hide();
670
  $tableRow.find('.delete_currency').hide();
671
  $tableRow.find('.save_currency').show();
672
  $tableRow.find('.cancel_currency').show();
673
  });
674
 
675
+ $(document).on('click','.cancel_currency',function(){
676
+ var $tableRow = $(this).closest('tr');
677
  $tableRow.removeClass('edit-mode');
678
  if($tableRow.find('.currency_id').val() > 0){
679
+ $tableRow.find('.currency_code .code_val').show();
680
+ $tableRow.find('.currency_code select').hide();
681
+ $tableRow.find('.currency_value span.curr_val').show();
682
  $tableRow.find('.currency_value input').hide();
683
+ $tableRow.find('.currency_changed').show();
684
  $tableRow.find('.edit_currency').show();
685
  $tableRow.find('.delete_currency').show();
686
  $tableRow.find('.save_currency').hide();
687
  $tableRow.find('.cancel_currency').hide();
688
  $tableRow.find('.wcml-error').remove();
689
  }else{
690
+ var index = $tableRow[0].rowIndex;
691
+ $('#currency-lang-table tr').eq(index).remove();
692
  $tableRow.remove();
693
  }
694
  });
695
 
696
+ $(document).on('change','.currency_code select',function(){
697
+ $(this).parent().find('.curr_val_code').html($(this).val());
698
+ });
699
+
700
+ $('.wcml_add_currency button').click(function(){
701
+ $('.js-table-row-wrapper .curr_val_code').html($('.js-table-row-wrapper select').val());
702
+ var pluginurl = $('.wcml_plugin_url').val();
703
  var $tableRow = $('.js-table-row-wrapper .js-table-row').clone();
704
+ var $LangTableRow = $('.js-currency_lang_table tr').clone();
705
+ $('#currency-table').find('tr.default_currency').before( $tableRow );
706
+ $('#currency-lang-table').find('tr.default_currency').before( $LangTableRow );
707
  });
708
 
709
+ $(document).on('click','.save_currency',function(e){
710
  e.preventDefault();
711
 
712
+ var $this = $(this);
713
  var $ajaxLoader = $('<span class="spinner">');
714
+ var $messageContainer = $('<span class="wcml-error">');
 
715
 
716
  $this.prop('disabled',true);
717
 
718
+ var parent = $(this).closest('tr');
719
+
720
+ parent.find('.save_currency').hide();
721
+ parent.find('.cancel_currency').hide();
722
+ $ajaxLoader.insertBefore($this).show();
723
+
724
  if(parent.find('.currency_id').val() > 0){
725
  var currency_id = parent.find('.currency_id').val();
726
  }else{
730
  $currencyCodeWraper = parent.find('.currency_code');
731
  $currencyValueWraper = parent.find('.currency_value');
732
 
733
+ var currency_code = $currencyCodeWraper.find('select').val();
734
  var currency_value = $currencyValueWraper.find('input').val();
735
  var flag = false;
736
 
777
  if(flag){
778
  $ajaxLoader.remove();
779
  $this.prop('disabled',false);
780
+ parent.find('.save_currency').show();
781
+ parent.find('.cancel_currency').show();
782
  return false;
783
  }
784
 
795
  var today = dd+'/'+mm+'/'+yyyy;
796
 
797
 
798
+ $.ajax({
799
  type : "post",
800
  url : ajaxurl,
801
+ dataType: 'json',
802
  data : {
803
  action: "wcml_update_currency",
804
+ wcml_nonce: $('#upd_currency_nonce').val(),
805
  currency_id : currency_id,
806
  currency_code : currency_code,
807
  currency_value : currency_value,
812
  },
813
  success: function(response) {
814
  if(currency_id == 0){
815
+ parent.find('.currency_id').val(response.id);
816
  }
817
+ var curr_code = parent.closest('tr').find('.currency_code select').val();
818
+ parent.find('.currency_code .code_val').html(parent.closest('tr').find('.currency_code select').find(":selected").text()+response.symbol).show();
819
+ parent.find('.currency_code select').hide();
820
+ parent.find('.currency_value span.curr_val').html(parent.closest('tr').find('.currency_value input').val());
821
+ parent.find('.currency_value span.curr_val_code').html(curr_code);
822
+ parent.find('.currency_value span.curr_val').show();
823
  parent.find('.currency_value input').hide();
824
+ parent.find('.currency_changed').html('('+today+')').show();
825
  parent.find('.edit_currency').show();
826
  parent.find('.delete_currency').show();
 
 
 
827
 
828
+ $this.closest('.edit-mode').removeClass('edit-mode');
829
+ $('.js-table-row-wrapper select option[value="'+curr_code+'"]').remove();
830
+ $('.currency_languages select').each(function(){
831
+ $(this).append('<option value="'+curr_code+'">'+curr_code+'</option>');
832
+ });
833
  },
834
  complete: function() {
835
  $ajaxLoader.remove();
841
  });
842
 
843
 
844
+ $(document).on('click','.delete_currency',function(e){
845
  e.preventDefault();
846
 
847
+ var parent = $(this).closest('tr');
848
+ var $this = $(this);
849
  var $ajaxLoader = $('<span class="spinner">');
850
  var currency_id = parent.find('.currency_id').val();
851
  $this.hide();
852
  $this.parent().append($ajaxLoader).show();
853
 
854
+ $.ajax({
855
  type : "post",
856
  url : ajaxurl,
857
  data : {
858
  action: "wcml_delete_currency",
859
+ wcml_nonce: $('#del_currency_nonce').val(),
860
+ currency_id : currency_id,
861
+ code: parent.find('.currency_code select').val()
862
  },
863
  success: function(response) {
864
+ var index = parent[0].rowIndex;
865
+
866
+ $('.currency_languages select').each(function(){
867
+ if(parent.find('select').val() == $(this).val()){
868
+ update_default_currency($(this).attr('rel'),0);
869
+ }
870
+ $(this).find('option[value="'+parent.find('select').val()+'"]').remove();
871
+ });
872
+ $('#currency-lang-table tr').eq(index).remove();
873
  parent.remove();
874
  },
875
  done: function() {
950
  }
951
  }).pointer('open');
952
  });
 
953
 
954
+ $(document).on('click','.currency_languages a.on_btn',function(e){
955
+ $(this).closest('ul').find('.on').removeClass('on');
956
+ $(this).parent().addClass('on');
957
+ var index = $(this).closest('tr')[0].rowIndex;
958
+ var lang = $(this).attr('rel');
959
+ var code = $('.currency_table tr').eq(index).find('.currency_code select').val();
960
+ $('.currency_languages select[rel="'+lang+'"]').append('<option value="'+code+'">'+code+'</option>');
961
+ update_currency_lang(1,lang,code,0);
962
+ });
963
+
964
+ $(document).on('click','.currency_languages a.off_btn',function(e){
965
+ $(this).closest('ul').find('.on').removeClass('on');
966
+ $(this).parent().addClass('on');
967
+ var index = $(this).closest('tr')[0].rowIndex;
968
+ var lang = $(this).attr('rel');
969
+ var code = $('.currency_table tr').eq(index).find('.currency_code select').val();
970
+ if($('.currency_languages select[rel="'+lang+'"]').val() == code){
971
+ update_currency_lang(0,lang,code,1);
972
+ }else{
973
+ update_currency_lang(0,lang,code,0);
974
+ }
975
+ $('.currency_languages select[rel="'+lang+'"] option[value="'+code+'"]').remove();
976
+ });
977
+
978
+ function update_currency_lang(value,lang,code,upd_def){
979
+ $.ajax({
980
+ type: 'post',
981
+ url: ajaxurl,
982
+ data: {
983
+ action: 'wcml_update_currency_lang',
984
+ value: value,
985
+ lang: lang,
986
+ code: code,
987
+ wcml_nonce: $('#update_currency_lang_nonce').val()
988
+ },
989
+ success: function(){
990
+ if(upd_def){
991
+ update_default_currency(lang,0);
992
+ }
993
+ }
994
+ });
995
+ }
996
+
997
+ $('.default_currency select').change(function(){
998
+ update_default_currency($(this).attr('rel'),$(this).val());
999
+ });
1000
 
1001
+ function update_default_currency(lang,code){
1002
+ $.ajax({
1003
+ type: 'post',
1004
+ url: ajaxurl,
1005
+ data: {
1006
+ action: 'wcml_update_default_currency',
1007
+ lang: lang,
1008
+ code: code,
1009
+ wcml_nonce: $('#wcml_update_default_currency_nonce').val()
1010
+ },
1011
+ success: function(){
1012
+ }
1013
+ });
1014
+ }
1015
 
1016
  function isNumber(n) {
1017
  return !isNaN(parseFloat(n)) && isFinite(n);
compatibility/templates/wc_tab_manager_custom_box_html.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if(isset($template_data['orig_tabs'])): ?>
2
+ <?php foreach($template_data['orig_tabs']['ids'] as $key=>$id):
3
+ $trnsl_tab_id = isset($template_data['tr_tabs']['ids'][$key])?$template_data['tr_tabs']['ids'][$key]:'';
4
+ ?>
5
+ <tr>
6
+ <td>
7
+ <?php if(!$template_data['original']): ?><input type="hidden" name="<?php echo $template_data['product_content'].'_'.$template_data['lang'].'[id][]'; ?>" value="<?php echo $trnsl_tab_id; ?>" /><?php endif;?>
8
+ <textarea rows="1" <?php if(!$template_data['original']): ?>name="<?php echo $template_data['product_content'].'_'.$template_data['lang'].'[title][]'; ?>"<?php endif;?> <?php if($template_data['original']): ?> disabled="disabled"<?php endif;?>><?php echo $template_data['original']?get_the_title($id):get_the_title($trnsl_tab_id); ?></textarea>
9
+ </td>
10
+ <td>
11
+ <?php if($template_data['original']): ?>
12
+ <button type="button" class="button-secondary wcml_edit_conten"><?php _e('Show content', 'wpml-wcml') ?></button>
13
+ <?php else: ?>
14
+ <button type="button" class="button-secondary wcml_edit_conten<?php if($template_data['is_duplicate_product']): ?> js-dup-disabled<?php endif;?>"<?php if($template_data['is_duplicate_product']): ?> disabled="disabled"<?php endif;?>><?php _e('Edit translation', 'wpml-wcml') ?></button>
15
+ <?php endif;?>
16
+ <div class="wcml_editor">
17
+ <a class="media-modal-close wcml_close_cross" href="javascript:void(0);" title="<?php esc_attr_e('Close', 'wpml-wcml') ?>"><span class="media-modal-icon"></span></a>
18
+ <div class="wcml_editor_original">
19
+ <h3><?php _e('Original content:', 'wpml-wcml') ?></h3>
20
+ <textarea class="wcml_original_content"><?php echo get_post($id)->post_content; ?></textarea>
21
+ </div>
22
+ <div class="wcml_line"></div>
23
+ <div class="wcml_editor_translation">
24
+ <?php if(!$template_data['original']): ?>
25
+ <?php
26
+ if($trnsl_tab_id){
27
+ $content = get_post($trnsl_tab_id)->post_content;
28
+ }else{
29
+ $content = '';
30
+ }
31
+
32
+ wp_editor($content, 'wcmleditor'.$template_data['product_content'].$id.$template_data['lang'], array('textarea_name'=>$template_data['product_content'] .
33
+ '_'.$template_data['lang'].'[content][]','textarea_rows'=>20,'editor_class'=>'wcml_content_tr')); ?>
34
+ <?php endif; ?>
35
+ </div>
36
+ <div class="wcml_editor_buttons">
37
+ <?php if($template_data['original']): ?>
38
+ <button type="button" class="button-secondary wcml_popup_close"><?php _e('Close', 'wpml-wcml') ?></button>
39
+ <?php else: ?>
40
+ <h3><?php printf(__('%s translation', 'wpml-wcml'),$template_data['lang_name']); ?></h3>
41
+ <button type="button" class="button-secondary wcml_popup_cancel"><?php _e('Cancel', 'wpml-wcml') ?></button>
42
+ <button type="button" class="button-secondary wcml_popup_ok"><?php _e('Ok', 'wpml-wcml') ?></button>
43
+ <?php endif; ?>
44
+ </div>
45
+ </div>
46
+ </td>
47
+ </tr>
48
+ <?php endforeach; ?>
49
+ <?php endif; ?>
compatibility/wc_subscriptions.class.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WCML_WC_Subscriptions{
4
+
5
+ function __construct(){
6
+
7
+ add_action('init', array($this, 'init'),9);
8
+ }
9
+
10
+ function init(){
11
+ if(!is_admin()){
12
+ add_filter('woocommerce_subscriptions_product_sign_up_fee', array($this, 'product_price_filter'), 10, 2);
13
+ }
14
+ }
15
+
16
+ function product_price_filter($subscription_sign_up_fee, $product){
17
+
18
+ $subscription_sign_up_fee = apply_filters('wcml_raw_price_amount', $subscription_sign_up_fee, $product->ID);
19
+
20
+ return $subscription_sign_up_fee;
21
+ }
22
+
23
+ }
compatibility/wc_tab_manager.class.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WCML_Tab_Manager{
4
+
5
+ function __construct(){
6
+
7
+ add_action('init', array($this, 'init'),9);
8
+ }
9
+
10
+ function init(){
11
+ add_action('wcml_after_duplicate_product_post_meta',array($this,'sync_tabs'),10,3);
12
+ add_filter('wcml_product_content_exception',array($this,'is_have_custom_product_tab'),10,2);
13
+ add_filter('wcml_custom_box_html',array($this,'custom_box_html'),10,2);
14
+
15
+ }
16
+
17
+ function sync_tabs($original_product_id, $trnsl_product_id, $data = false){
18
+ global $wc_tab_manager,$sitepress,$wpdb;
19
+
20
+ $orig_prod_tabs = $wc_tab_manager->get_product_tabs($original_product_id);
21
+ $lang = $sitepress->get_language_for_element($trnsl_product_id,'post_product');
22
+
23
+ if($orig_prod_tabs){
24
+ $trnsl_product_tabs = array();
25
+ $i = 0;
26
+ foreach($orig_prod_tabs as $key=>$orig_prod_tab){
27
+ switch($orig_prod_tab['type']){
28
+ case 'core':
29
+ $trnsl_product_tabs[$key] = $orig_prod_tabs[$key];
30
+ break;
31
+ case 'global':
32
+ $tr_tab_id = icl_object_id($orig_prod_tab['id'],'wc_product_tab',true,$lang);
33
+ $trnsl_product_tabs[$orig_prod_tab['type'].'_tab_'.$tr_tab_id] = array(
34
+ 'position' => $orig_prod_tab['position'],
35
+ 'type' => $orig_prod_tab['type'],
36
+ 'id' => $tr_tab_id,
37
+ 'name' => get_post($tr_tab_id)->post_name
38
+ );
39
+ break;
40
+ case 'product':
41
+ if(isset($data['_product_tabs_'.$lang]['id'][$i])){
42
+ $tr_tab_id = icl_object_id($orig_prod_tab['id'],'wc_product_tab',false,$lang);
43
+ if(!is_null($tr_tab_id) || get_post_type($data['_product_tabs_'.$lang]['id'][$i]) == 'wc_product_tab'){
44
+ $tab_id = !is_null($tr_tab_id)?$tr_tab_id:$data['_product_tabs_'.$lang]['id'][$i];
45
+ //update existing tab
46
+ $args = array();
47
+ $args['post_title'] = $data['_product_tabs_'.$lang]['title'][$i];
48
+ $args['post_content'] = $data['_product_tabs_'.$lang]['content'][$i];
49
+ $wpdb->update( $wpdb->posts, $args, array( 'ID' => $tab_id ) );
50
+ }else{
51
+ //tab not exist creating new
52
+ $args = array();
53
+ $args['post_title'] = $data['_product_tabs_'.$lang]['title'][$i];
54
+ $args['post_content'] = $data['_product_tabs_'.$lang]['content'][$i];
55
+ $args['post_author'] = get_current_user_id();
56
+ $args['post_name'] = sanitize_title($data['_product_tabs_'.$lang]['title'][$i]);
57
+ $args['post_type'] = 'wc_product_tab';
58
+ $args['post_parent'] = $trnsl_product_id;
59
+ $args['post_status'] = 'publish';
60
+ $wpdb->insert( $wpdb->posts, $args );
61
+
62
+ $tab_id = $wpdb->insert_id;
63
+ $tab_trid = $sitepress->get_element_trid($orig_prod_tab['id'], 'post_wc_product_tab');
64
+ if(!$tab_trid){
65
+ $sitepress->set_element_language_details($orig_prod_tab['id'], 'post_wc_product_tab', false,$sitepress->get_default_language());
66
+ $tab_trid = $sitepress->get_element_trid($orig_prod_tab['id'], 'post_wc_product_tab');
67
+ }
68
+ $sitepress->set_element_language_details($tab_id, 'post_wc_product_tab', $tab_trid, $lang);
69
+ }
70
+
71
+ $trnsl_product_tabs[$orig_prod_tab['type'].'_tab_'.$tab_id] = array(
72
+ 'position' => $orig_prod_tab['position'],
73
+ 'type' => $orig_prod_tab['type'],
74
+ 'id' => $tab_id,
75
+ 'name' => get_post($tab_id)->post_name
76
+ );
77
+ }
78
+ $i++;
79
+ break;
80
+ }
81
+ }
82
+
83
+ update_post_meta($trnsl_product_id,'_product_tabs',$trnsl_product_tabs);
84
+ }
85
+ }
86
+
87
+ function is_have_custom_product_tab($exception,$product_id){
88
+ $prod_tabs = maybe_unserialize(get_post_meta($product_id,'_product_tabs',true));
89
+ foreach($prod_tabs as $prod_tab){
90
+ if($prod_tab['type'] == 'product'){
91
+ $exception = false;
92
+ break;
93
+ }
94
+ }
95
+
96
+ return $exception;
97
+ }
98
+
99
+
100
+ function custom_box_html($html,$template_data){
101
+ if($template_data['product_content'] == '_product_tabs'){
102
+ global $wc_tab_manager;
103
+
104
+ if($template_data['tr_product_id']){
105
+ $tr_prod_tabs = $wc_tab_manager->get_product_tabs($template_data['tr_product_id']);
106
+
107
+ if(!is_array($tr_prod_tabs)){
108
+ return __('Please update original product','wpml-wcml');
109
+ }
110
+
111
+ foreach($tr_prod_tabs as $key=>$prod_tab){
112
+ if($prod_tab['type'] == 'product'){
113
+ $template_data['tr_tabs']['ids'][] = $prod_tab['id'];
114
+ }
115
+ }
116
+ }
117
+
118
+ $orig_prod_tabs = $wc_tab_manager->get_product_tabs($template_data['product_id']);
119
+
120
+ foreach($orig_prod_tabs as $key=>$prod_tab){
121
+ if($prod_tab['type'] == 'product'){
122
+ $template_data['orig_tabs']['ids'][] = $prod_tab['id'];
123
+ }
124
+ }
125
+
126
+ ob_start();
127
+
128
+ include WCML_PLUGIN_PATH . '/compatibility/templates/wc_tab_manager_custom_box_html.php';
129
+
130
+ $html = ob_get_clean();
131
+
132
+ }
133
+
134
+ return $html;
135
+ }
136
+
137
+ }
compatibility/wc_table_rate_shipping.class.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WCML_Table_Rate_Shipping{
4
+
5
+ function __construct(){
6
+
7
+ add_action('init', array($this, 'init'),9);
8
+ }
9
+
10
+ function init(){
11
+ global $pagenow;
12
+
13
+ //register shipping label
14
+ if($pagenow == 'admin.php' && isset($_GET['page']) && $_GET['page']=='shipping_zones' && isset( $_POST['shipping_label'] ) && isset( $_POST['woocommerce_table_rate_title'] )){
15
+ icl_register_string('woocommerce', $_POST['woocommerce_table_rate_title'] .'_shipping_method_title', $_POST['woocommerce_table_rate_title']);
16
+ $shipping_labels = array_map( 'woocommerce_clean', $_POST['shipping_label'] );
17
+ foreach($shipping_labels as $shipping_label){
18
+ icl_register_string('woocommerce', $shipping_label .'_shipping_method_title', $shipping_label);
19
+ }
20
+ }
21
+
22
+ }
23
+
24
+ }
inc/compatibility.class.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WCML_Compatibility {
4
+
5
+ function __construct(){
6
+
7
+ add_action('init', array($this, 'init'));
8
+
9
+ }
10
+
11
+ function init(){
12
+ //hardcoded list of extensions and check which ones the user has and then include the corresponding file from the ‘compatibility’ folder
13
+
14
+ //WooCommerce Tab Manager plugin
15
+ if(class_exists('WC_Tab_Manager')){
16
+ require_once WCML_PLUGIN_PATH . '/compatibility/wc_tab_manager.class.php';
17
+ $this->tab_manager = new WCML_Tab_Manager();
18
+ }
19
+
20
+ //WooCommerce Table Rate Shipping plugin
21
+ if(defined('TABLE_RATE_SHIPPING_VERSION')){
22
+ require_once WCML_PLUGIN_PATH . '/compatibility/wc_table_rate_shipping.class.php';
23
+ $this->table_rate_shipping = new WCML_Table_Rate_Shipping();
24
+ }
25
+
26
+ //WooCommerce Subscriptions
27
+ if(class_exists('WC_Subscriptions')){
28
+ require_once WCML_PLUGIN_PATH . '/compatibility/wc_subscriptions.class.php';
29
+ $this->wp_subscriptions = new WCML_WC_Subscriptions();
30
+ }
31
+
32
+
33
+ }
34
+
35
+ }
inc/dependencies.class.php CHANGED
@@ -228,7 +228,7 @@ class WCML_Dependencies{
228
 
229
  $file = realpath(WCML_PLUGIN_PATH . '/wpml-config.xml');
230
  if(!file_exists($file)){
231
- $this->xml_config_errors[] = __('wpml-config.xml file missing form WooCommerce Multilingual folder.', 'wpml-wcml');
232
  }else{
233
  $config = icl_xml2array(file_get_contents($file));
234
 
228
 
229
  $file = realpath(WCML_PLUGIN_PATH . '/wpml-config.xml');
230
  if(!file_exists($file)){
231
+ $this->xml_config_errors[] = __('wpml-config.xml file missing from WooCommerce Multilingual folder.', 'wpml-wcml');
232
  }else{
233
  $config = icl_xml2array(file_get_contents($file));
234
 
inc/emails.class.php CHANGED
@@ -9,20 +9,30 @@ class WCML_Emails{
9
  }
10
 
11
  function init(){
 
 
 
 
 
 
 
 
 
12
  //wrappers for email's body
13
- add_filter('woocommerce_order_status_completed_notification', array($this, 'email_header'));
14
- add_filter('woocommerce_order_status_processing_notification', array($this, 'email_header'));
15
- add_filter('woocommerce_new_customer_note_notification', array($this, 'email_header'));
16
- add_filter('woocommerce_before_resend_order_emails', array($this, 'email_header'));
17
- add_filter('woocommerce_after_resend_order_email', array($this, 'email_footer'));
18
 
19
  //WPML job link
20
  add_filter('icl_job_edit_url',array($this,'icl_job_edit_url'),10 ,2);
21
 
22
  //change order status
23
  add_action('woocommerce_order_status_completed',array($this,'refresh_email_lang'),9);
24
- add_action('woocommerce_order_status_processing',array($this,'refresh_email_lang'),9);
 
25
  add_action('woocommerce_new_customer_note',array($this,'refresh_email_lang'),9);
 
 
 
26
  }
27
 
28
  /**
@@ -47,7 +57,6 @@ class WCML_Emails{
47
 
48
 
49
  function refresh_email_lang($order_id){
50
- global $sitepress,$woocommerce;
51
 
52
  if(is_array($order_id)){
53
  if(isset($order_id['order_id'])){
@@ -60,10 +69,7 @@ class WCML_Emails{
60
 
61
  $lang = get_post_meta($order_id, 'wpml_language', TRUE);
62
  if(!empty($lang)){
63
- $sitepress->switch_lang($lang, true);
64
- $domain = 'woocommerce';
65
- unload_textdomain($domain);
66
- $woocommerce->load_plugin_textdomain();
67
  }
68
  }
69
 
@@ -75,8 +81,73 @@ class WCML_Emails{
75
  */
76
  function email_footer() {
77
  global $sitepress;
 
 
 
 
 
 
 
 
78
 
79
- $sitepress->switch_lang(ICL_LANGUAGE_CODE, true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  }
81
 
82
 
9
  }
10
 
11
  function init(){
12
+ //wrappers for email's header
13
+ if(is_admin() && !defined( 'DOING_AJAX' )){
14
+ add_action('woocommerce_order_status_completed_notification', array($this, 'email_heading_completed'),9);
15
+ add_action( 'woocommerce_order_status_pending_to_processing_notification', array( $this, 'email_heading_processing' ) );
16
+ add_action( 'woocommerce_order_status_pending_to_on-hold_notification', array( $this, 'email_heading_processing' ) );
17
+ add_action('woocommerce_new_customer_note_notification', array($this, 'email_heading_note'),9);
18
+ add_action('woocommerce_order_status_changed', array($this, 'comments_language'),10);
19
+ }
20
+
21
  //wrappers for email's body
22
+ add_action('woocommerce_before_resend_order_emails', array($this, 'email_header'));
23
+ add_action('woocommerce_after_resend_order_email', array($this, 'email_footer'));
 
 
 
24
 
25
  //WPML job link
26
  add_filter('icl_job_edit_url',array($this,'icl_job_edit_url'),10 ,2);
27
 
28
  //change order status
29
  add_action('woocommerce_order_status_completed',array($this,'refresh_email_lang'),9);
30
+ add_action('woocommerce_order_status_pending_to_processing_notification',array($this,'refresh_email_lang'),9);
31
+ add_action('woocommerce_order_status_pending_to_on-hold_notification',array($this,'refresh_email_lang'),9);
32
  add_action('woocommerce_new_customer_note',array($this,'refresh_email_lang'),9);
33
+
34
+
35
+
36
  }
37
 
38
  /**
57
 
58
 
59
  function refresh_email_lang($order_id){
 
60
 
61
  if(is_array($order_id)){
62
  if(isset($order_id['order_id'])){
69
 
70
  $lang = get_post_meta($order_id, 'wpml_language', TRUE);
71
  if(!empty($lang)){
72
+ $this->change_email_language($lang);
 
 
 
73
  }
74
  }
75
 
81
  */
82
  function email_footer() {
83
  global $sitepress;
84
+ $sitepress->switch_lang($sitepress->get_default_language());
85
+
86
+ }
87
+
88
+ function comments_language(){
89
+ global $sitepress_settings;
90
+ $this->change_email_language($sitepress_settings['st']['strings_language']);
91
+ }
92
 
93
+ function email_heading_completed($order_id){
94
+ global $woocommerce,$wpdb,$sitepress_settings;
95
+ if(class_exists('WC_Email_Customer_Completed_Order')){
96
+ $heading = $wpdb->get_results($wpdb->prepare("SELECT value,context FROM {$wpdb->prefix}icl_strings WHERE language = %s AND name = %s ", $sitepress_settings['st']['strings_language'],'[woocommerce_customer_completed_order_settings]heading'));
97
+ $woocommerce->woocommerce_email->emails['WC_Email_Customer_Completed_Order']->heading = icl_t($heading[0]->context,'[woocommerce_customer_completed_order_settings]heading',$heading[0]->value);
98
+ $subject = $wpdb->get_results($wpdb->prepare("SELECT value,context FROM {$wpdb->prefix}icl_strings WHERE language = %s AND name = %s ", $sitepress_settings['st']['strings_language'], '[woocommerce_customer_completed_order_settings]subject'));
99
+ $woocommerce->woocommerce_email->emails['WC_Email_Customer_Completed_Order']->subject = icl_t($subject[0]->context,'[woocommerce_customer_completed_order_settings]subject',$subject[0]->value);
100
+ $heading_downloadable = $wpdb->get_results($wpdb->prepare("SELECT value,context FROM {$wpdb->prefix}icl_strings WHERE language = %s AND name = %s ", $sitepress_settings['st']['strings_language'],'[woocommerce_customer_completed_order_settings]heading_downloadable'));
101
+ $woocommerce->woocommerce_email->emails['WC_Email_Customer_Completed_Order']->heading_downloadable = icl_t($heading_downloadable[0]->context,'[woocommerce_customer_completed_order_settings]heading_downloadable',$heading_downloadable[0]->value);
102
+ $subject_downloadable = $wpdb->get_results($wpdb->prepare("SELECT value,context FROM {$wpdb->prefix}icl_strings WHERE language = %s AND name = %s ", $sitepress_settings['st']['strings_language'], '[woocommerce_customer_completed_order_settings]subject_downloadable'));
103
+ $woocommerce->woocommerce_email->emails['WC_Email_Customer_Completed_Order']->subject_downloadable = icl_t($subject_downloadable[0]->context,'[woocommerce_customer_completed_order_settings]subject_downloadable',$subject_downloadable[0]->value);
104
+
105
+ $enabled = $woocommerce->woocommerce_email->emails['WC_Email_Customer_Completed_Order']->enabled;
106
+ $woocommerce->woocommerce_email->emails['WC_Email_Customer_Completed_Order']->enabled = false;
107
+ $woocommerce->woocommerce_email->emails['WC_Email_Customer_Completed_Order']->trigger($order_id);
108
+ $woocommerce->woocommerce_email->emails['WC_Email_Customer_Completed_Order']->enabled = $enabled;
109
+ }
110
+ }
111
+
112
+ function email_heading_processing($order_id){
113
+ global $woocommerce,$wpdb,$sitepress_settings;
114
+ if(class_exists('WC_Email_Customer_Processing_Order')){
115
+ $heading = $wpdb->get_results($wpdb->prepare("SELECT value,context FROM {$wpdb->prefix}icl_strings WHERE language = %s AND name = %s ", $sitepress_settings['st']['strings_language'], '[woocommerce_customer_processing_order_settings]heading'));
116
+ $woocommerce->woocommerce_email->emails['WC_Email_Customer_Processing_Order']->heading = icl_t($heading[0]->context,'[woocommerce_customer_processing_order_settings]heading',$heading[0]->value);
117
+ $subject = $wpdb->get_results($wpdb->prepare("SELECT value,context FROM {$wpdb->prefix}icl_strings WHERE language = %s AND name = %s ", $sitepress_settings['st']['strings_language'], '[woocommerce_customer_processing_order_settings]subject'));
118
+ $woocommerce->woocommerce_email->emails['WC_Email_Customer_Processing_Order']->subject = icl_t($subject[0]->context,'[woocommerce_customer_processing_order_settings]subject',$subject[0]->value);
119
+
120
+ $enabled = $woocommerce->woocommerce_email->emails['WC_Email_Customer_Processing_Order']->enabled;
121
+ $woocommerce->woocommerce_email->emails['WC_Email_Customer_Processing_Order']->enabled = false;
122
+ $woocommerce->woocommerce_email->emails['WC_Email_Customer_Processing_Order']->trigger($order_id);
123
+ $woocommerce->woocommerce_email->emails['WC_Email_Customer_Processing_Order']->enabled = $enabled;
124
+ }
125
+ }
126
+
127
+ function email_heading_note($args){
128
+ global $woocommerce,$wpdb,$sitepress_settings,$sitepress;
129
+ if(class_exists('WC_Email_Customer_Note')){
130
+ $heading = $wpdb->get_results($wpdb->prepare("SELECT value,context FROM {$wpdb->prefix}icl_strings WHERE language = %s AND name = %s ", $sitepress_settings['st']['strings_language'], '[woocommerce_customer_note_settings]heading'));
131
+ $woocommerce->woocommerce_email->emails['WC_Email_Customer_Note']->heading = icl_t($heading[0]->context,'[woocommerce_customer_note_settings]heading',$heading[0]->value);
132
+ $subject = $wpdb->get_results($wpdb->prepare("SELECT value,context FROM {$wpdb->prefix}icl_strings WHERE language = %s AND name = %s ", $sitepress_settings['st']['strings_language'],'[woocommerce_customer_note_settings]subject'));
133
+ $woocommerce->woocommerce_email->emails['WC_Email_Customer_Note']->subject = icl_t($subject[0]->context,'[woocommerce_customer_note_settings]subject',$subject[0]->value);
134
+
135
+ $enabled = $woocommerce->woocommerce_email->emails['WC_Email_Customer_Note']->enabled;
136
+ $woocommerce->woocommerce_email->emails['WC_Email_Customer_Note']->enabled = false;
137
+ $woocommerce->woocommerce_email->emails['WC_Email_Customer_Note']->trigger($args);
138
+ $woocommerce->woocommerce_email->emails['WC_Email_Customer_Note']->enabled = $enabled;
139
+ }
140
+ }
141
+
142
+ function change_email_language($lang){
143
+ global $sitepress,$woocommerce;
144
+ $sitepress->switch_lang($lang,true);
145
+ unload_textdomain('woocommerce');
146
+ unload_textdomain('default');
147
+ $woocommerce->load_plugin_textdomain();
148
+ load_default_textdomain();
149
+ global $wp_locale;
150
+ $wp_locale = new WP_Locale();
151
  }
152
 
153
 
inc/functions-troubleshooting.class.php CHANGED
@@ -9,7 +9,6 @@ class WCML_Troubleshooting{
9
  }
10
 
11
  function init(){
12
-
13
  add_action('wp_ajax_trbl_sync_variations', array($this,'trbl_sync_variations'));
14
  add_action('wp_ajax_trbl_gallery_images', array($this,'trbl_gallery_images'));
15
  add_action('wp_ajax_trbl_update_count', array($this,'trbl_update_count'));
9
  }
10
 
11
  function init(){
 
12
  add_action('wp_ajax_trbl_sync_variations', array($this,'trbl_sync_variations'));
13
  add_action('wp_ajax_trbl_gallery_images', array($this,'trbl_gallery_images'));
14
  add_action('wp_ajax_trbl_update_count', array($this,'trbl_update_count'));
inc/multi-currency-support.class.php CHANGED
@@ -9,6 +9,7 @@ class WCML_Multi_Currency_Support{
9
  function __construct(){
10
 
11
  add_action('init', array($this, 'init'), 5);
 
12
 
13
  if(is_ajax()){
14
  add_action('wp_ajax_nopriv_wcml_switch_currency', array($this, 'switch_currency'));
@@ -18,8 +19,6 @@ class WCML_Multi_Currency_Support{
18
  add_action('wp_ajax_legacy_remove_custom_rates', array($this, 'legacy_remove_custom_rates'));
19
  }
20
 
21
-
22
-
23
  }
24
 
25
  function _load_filters(){
@@ -30,7 +29,11 @@ class WCML_Multi_Currency_Support{
30
  }else{
31
  if(is_ajax() && $this->get_client_currency() != get_option('woocommerce_currency')){
32
  if(isset($_REQUEST['action'])){
33
- if(in_array($_REQUEST['action'], array('woocommerce_get_refreshed_fragments', 'woocommerce_update_order_review', 'woocommerce_update_shipping_method', 'woocommerce-checkout'))){
 
 
 
 
34
  $load = true;
35
  }
36
  }
@@ -41,8 +44,10 @@ class WCML_Multi_Currency_Support{
41
  }
42
 
43
  function init(){
44
-
45
  if($this->_load_filters()){
 
 
46
 
47
  add_filter('woocommerce_currency', array($this, 'currency_filter'));
48
  //add_filter('option_woocommerce_currency', array($this, 'currency_filter'));
@@ -50,7 +55,7 @@ class WCML_Multi_Currency_Support{
50
  add_filter('get_post_metadata', array($this, 'product_price_filter'), 10, 4);
51
  add_filter('get_post_metadata', array($this, 'variation_prices_filter'), 12, 4); // second
52
 
53
- add_filter('woocommerce_available_shipping_methods', array($this, 'shipping_taxes_filter'));
54
 
55
  add_action('woocommerce_coupon_loaded', array($this, 'filter_coupon_data'));
56
 
@@ -62,6 +67,8 @@ class WCML_Multi_Currency_Support{
62
  add_filter('woocommerce_table_rate_instance_settings', array($this, 'table_rate_instance_settings'));
63
  }
64
 
 
 
65
  }
66
 
67
  add_shortcode('currency_switcher', array($this, 'currency_switcher'));
@@ -70,10 +77,41 @@ class WCML_Multi_Currency_Support{
70
 
71
  }
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  function load_inline_js(){
74
- global $woocommerce;
75
 
76
- $woocommerce->add_inline_js( "
77
  jQuery('.wcml_currency_switcher').on('change', function(){
78
  var currency = jQuery(this).val();
79
  jQuery('.wcml_currency_switcher').attr('disabled', 'disabled');
@@ -85,6 +123,7 @@ class WCML_Multi_Currency_Support{
85
  });
86
  });
87
  " );
 
88
  }
89
 
90
  function product_price_filter($null, $object_id, $meta_key, $single){
@@ -114,8 +153,19 @@ class WCML_Multi_Currency_Support{
114
  }else{
115
 
116
  // normal filtering
117
- $price = get_post_meta($object_id, $meta_key, $single);
118
- $price = apply_filters('wcml_raw_price_amount', $price, $object_id);
 
 
 
 
 
 
 
 
 
 
 
119
 
120
  }
121
 
@@ -138,13 +188,21 @@ class WCML_Multi_Currency_Support{
138
 
139
  $variation_fields = get_post_meta($object_id);
140
 
 
 
141
  foreach($variation_fields as $k => $v){
142
 
143
  if(in_array($k, array('_price', '_regular_price', '_sale_price'))){
144
 
145
  foreach($v as $j => $amount){
146
 
147
- $variation_fields[$k][$j] = apply_filters('wcml_raw_price_amount', $amount, $object_id);
 
 
 
 
 
 
148
 
149
  }
150
 
@@ -161,6 +219,211 @@ class WCML_Multi_Currency_Support{
161
 
162
  }
163
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  function currency_filter($currency){
165
 
166
  $currency = apply_filters('wcml_price_currency', $currency);
@@ -182,7 +445,7 @@ class WCML_Multi_Currency_Support{
182
  // exceptions
183
  if(
184
  isset($shipping_methods[$method->id]) && isset($shipping_methods[$method->id]->settings['type']) && $shipping_methods[$method->id]->settings['type'] == 'percent'
185
- || preg_match('/^table_rate-[0-9]+ : [0-9]$/', $k)
186
  ){
187
  continue;
188
  }
@@ -254,9 +517,10 @@ class WCML_Multi_Currency_Support{
254
 
255
  if(!empty($woocommerce->session)){
256
  $this->client_currency = $woocommerce->session->get('client_currency');
 
257
  if(is_null($this->client_currency)){
258
  $this->client_currency = get_option('woocommerce_currency');
259
- $woocommerce->session->set('client_currency', $this->client_currency);
260
  }
261
  }else{
262
  $this->client_currency = get_option('woocommerce_currency');
@@ -303,7 +567,7 @@ class WCML_Multi_Currency_Support{
303
 
304
 
305
  function currency_switcher( $atts ){
306
-
307
  // format tags
308
  // Name - %name
309
  // Symbol - %symbol
@@ -319,6 +583,7 @@ class WCML_Multi_Currency_Support{
319
 
320
  echo '<select class="wcml_currency_switcher">';
321
  foreach($exchange_rates as $currency => $rate){
 
322
  $selected = $currency == $this->get_client_currency() ? ' selected="selcted"' : '';
323
 
324
  $currency_format = preg_replace(array('#%name#', '#%symbol#', '#%code#'),
@@ -326,14 +591,20 @@ class WCML_Multi_Currency_Support{
326
 
327
  echo '<option value="' . $currency . '"' . $selected . '>' . $currency_format . '</option>';
328
  }
 
329
  echo '</select>';
330
 
331
  }
332
 
333
  function switch_currency(){
334
-
335
  $this->set_client_currency($_POST['currency']);
336
 
 
 
 
 
 
 
337
  do_action('wcml_switch_currency', $_POST['currency']);
338
 
339
  exit;
9
  function __construct(){
10
 
11
  add_action('init', array($this, 'init'), 5);
12
+ add_action('wp_head', array($this, 'set_default_currency')); //@todo - review
13
 
14
  if(is_ajax()){
15
  add_action('wp_ajax_nopriv_wcml_switch_currency', array($this, 'switch_currency'));
19
  add_action('wp_ajax_legacy_remove_custom_rates', array($this, 'legacy_remove_custom_rates'));
20
  }
21
 
 
 
22
  }
23
 
24
  function _load_filters(){
29
  }else{
30
  if(is_ajax() && $this->get_client_currency() != get_option('woocommerce_currency')){
31
  if(isset($_REQUEST['action'])){
32
+ $ajax_actions = array('woocommerce_get_refreshed_fragments', 'woocommerce_update_order_review', 'woocommerce-checkout', 'woocommerce_checkout');
33
+ if(version_compare($GLOBALS['woocommerce']->version, '2.1', '>=')){
34
+ $ajax_actions[] = 'woocommerce_update_shipping_method';
35
+ }
36
+ if(in_array($_REQUEST['action'], $ajax_actions)){
37
  $load = true;
38
  }
39
  }
44
  }
45
 
46
  function init(){
47
+
48
  if($this->_load_filters()){
49
+
50
+ $this->set_default_currency();
51
 
52
  add_filter('woocommerce_currency', array($this, 'currency_filter'));
53
  //add_filter('option_woocommerce_currency', array($this, 'currency_filter'));
55
  add_filter('get_post_metadata', array($this, 'product_price_filter'), 10, 4);
56
  add_filter('get_post_metadata', array($this, 'variation_prices_filter'), 12, 4); // second
57
 
58
+ add_filter('woocommerce_package_rates', array($this, 'shipping_taxes_filter'));
59
 
60
  add_action('woocommerce_coupon_loaded', array($this, 'filter_coupon_data'));
61
 
67
  add_filter('woocommerce_table_rate_instance_settings', array($this, 'table_rate_instance_settings'));
68
  }
69
 
70
+ add_action('currency_switcher', array($this, 'currency_switcher'));
71
+
72
  }
73
 
74
  add_shortcode('currency_switcher', array($this, 'currency_switcher'));
77
 
78
  }
79
 
80
+ function set_default_currency(){
81
+
82
+ if(!is_admin()){
83
+ global $sitepress,$woocommerce_wpml,$post;
84
+ $current_language = $sitepress->get_current_language();
85
+ $currency_code = $woocommerce_wpml->settings['default_currencies'][$current_language];
86
+
87
+ if($currency_code && (isset($post->ID) && get_post_type($post->ID) == 'product' && isset($_COOKIE['_wcml_product_id']) && $post->ID != $_COOKIE['_wcml_product_id'])){
88
+ $this->set_client_currency($currency_code);
89
+
90
+ }elseif(!$woocommerce_wpml->settings['currencies_languages'][$this->get_client_currency()][$current_language]){
91
+ foreach($woocommerce_wpml->settings['currencies_languages'] as $code=>$langs){
92
+ if($langs[$current_language]){
93
+ $this->set_client_currency($code);
94
+ break;
95
+ }
96
+ }
97
+ }
98
+
99
+ $this->set_current_product_id();
100
+
101
+ }
102
+ }
103
+
104
+ function set_current_product_id(){
105
+ global $post;
106
+
107
+ if(isset($post->ID) && !headers_sent()){
108
+ setcookie( '_wcml_product_id', $post->ID, time() + 86400, '/', $_SERVER[ 'HTTP_HOST' ] );
109
+ }
110
+ }
111
+
112
  function load_inline_js(){
 
113
 
114
+ wc_enqueue_js( "
115
  jQuery('.wcml_currency_switcher').on('change', function(){
116
  var currency = jQuery(this).val();
117
  jQuery('.wcml_currency_switcher').attr('disabled', 'disabled');
123
  });
124
  });
125
  " );
126
+
127
  }
128
 
129
  function product_price_filter($null, $object_id, $meta_key, $single){
153
  }else{
154
 
155
  // normal filtering
156
+ // 1. manual prices
157
+ $manual_prices = $this->get_product_custom_prices($object_id, $this->get_client_currency());
158
+
159
+ if($manual_prices && !empty($manual_prices[$meta_key])){
160
+
161
+ $price = $manual_prices[$meta_key];
162
+
163
+ }else{
164
+ // 2. automatic conversion
165
+ $price = get_post_meta($object_id, $meta_key, $single);
166
+ $price = apply_filters('wcml_raw_price_amount', $price, $object_id);
167
+
168
+ }
169
 
170
  }
171
 
188
 
189
  $variation_fields = get_post_meta($object_id);
190
 
191
+ $manual_prices = $this->get_product_custom_prices($object_id, $this->get_client_currency());
192
+
193
  foreach($variation_fields as $k => $v){
194
 
195
  if(in_array($k, array('_price', '_regular_price', '_sale_price'))){
196
 
197
  foreach($v as $j => $amount){
198
 
199
+ if(isset($manual_prices[$k])){
200
+ $variation_fields[$k][$j] = $manual_prices[$k]; // manual price
201
+
202
+ }else{
203
+ $variation_fields[$k][$j] = apply_filters('wcml_raw_price_amount', $amount, $object_id); // automatic conversion
204
+ }
205
+
206
 
207
  }
208
 
219
 
220
  }
221
 
222
+ function get_product_custom_prices($product_id, $currency = false){
223
+ global $wpdb, $sitepress;
224
+
225
+ $distinct_prices = false;
226
+
227
+ if(empty($currency)){
228
+ $currency = $this->get_client_currency();
229
+ }
230
+
231
+ $original_product_id = $product_id;
232
+ $post_type = get_post_type($product_id);
233
+ $product_translations = $sitepress->get_element_translations($sitepress->get_element_trid($product_id, 'post_'.$post_type), 'post_'.$post_type);
234
+ foreach($product_translations as $translation){
235
+ if($translation->original){
236
+ $original_product_id = $translation->element_id;
237
+ break;
238
+ }
239
+ }
240
+
241
+ $product_meta = get_post_custom($original_product_id);
242
+
243
+ $custom_prices = false;
244
+
245
+ if(!empty($product_meta['_wcml_custom_prices_status'][0])){
246
+
247
+ $prices_keys = array(
248
+ '_price', '_regular_price', '_sale_price',
249
+ '_min_variation_price', '_max_variation_price',
250
+ '_min_variation_regular_price', '_max_variation_regular_price',
251
+ '_min_variation_sale_price', '_max_variation_sale_price');
252
+
253
+ foreach($prices_keys as $key){
254
+
255
+ if(!empty($product_meta[$key . '_' . $currency][0])){
256
+ $custom_prices[$key] = $product_meta[$key . '_' . $currency][0];
257
+ }
258
+
259
+ }
260
+
261
+ }
262
+
263
+ if(!isset($custom_prices['_price'])) return false;
264
+
265
+ $current__price_value = $custom_prices['_price'];
266
+
267
+ // update sale price
268
+ if(!empty($custom_prices['_sale_price'])){
269
+
270
+ if(!empty($product_meta['_wcml_schedule_' . $currency][0])){
271
+ // custom dates
272
+ if(!empty($product_meta['_sale_price_dates_from_' . $currency][0]) && !empty($product_meta['_sale_price_dates_to_' . $currency][0])){
273
+ if(current_time('timestamp') > $product_meta['_sale_price_dates_from_' . $currency][0] && current_time('timestamp') < $product_meta['_sale_price_dates_to_' . $currency][0]){
274
+ $custom_prices['_price'] = $custom_prices['_sale_price'];
275
+ }else{
276
+ $custom_prices['_price'] = $custom_prices['_regular_price'];
277
+ }
278
+ }else{
279
+ $custom_prices['_price'] = $custom_prices['_sale_price'];
280
+ }
281
+
282
+ }else{
283
+ // inherit
284
+ if(!empty($product_meta['_sale_price_dates_from'][0]) && !empty($product_meta['_sale_price_dates_to'][0])){
285
+ if(current_time('timestamp') > $product_meta['_sale_price_dates_from'][0] && current_time('timestamp') < $product_meta['_sale_price_dates_to'][0]){
286
+ $custom_prices['_price'] = $custom_prices['_sale_price'];
287
+ }else{
288
+ $custom_prices['_price'] = $custom_prices['_regular_price'];
289
+ }
290
+ }else{
291
+ $custom_prices['_price'] = $custom_prices['_sale_price'];
292
+ }
293
+ }
294
+
295
+ }
296
+
297
+ if($custom_prices['_price'] != $current__price_value){
298
+ update_post_meta($product_id, '_price_' . $currency, $custom_prices['_price']);
299
+ }
300
+
301
+ // detemine min/max variation prices
302
+ if(!empty($product_meta['_min_variation_price'])){
303
+
304
+ static $product_min_max_prices = array();
305
+
306
+ if(empty($product_min_max_prices[$product_id])){
307
+
308
+ // get variation ids
309
+ $variation_ids = $wpdb->get_col($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_parent = %d", $product_id));
310
+
311
+ // variations with custom prices
312
+ $res = $wpdb->get_results("SELECT post_id, meta_value FROM {$wpdb->postmeta} WHERE post_id IN(" . join(',', $variation_ids) . ") AND meta_key='_wcml_custom_prices_status'");
313
+ foreach($res as $row){
314
+ $custom_prices_enabled[$row->post_id] = $row->meta_value;
315
+ }
316
+
317
+ // REGULAR PRICES
318
+ // get custom prices
319
+ $res = $wpdb->get_results("SELECT post_id, meta_value FROM {$wpdb->postmeta} WHERE post_id IN(" . join(',', $variation_ids) . ") AND meta_key='_regular_price_" . $currency . "'");
320
+ foreach($res as $row){
321
+ $regular_prices[$row->post_id] = $row->meta_value;
322
+ }
323
+
324
+ // get default prices (default currency)
325
+ $res = $wpdb->get_results("SELECT post_id, meta_value FROM {$wpdb->postmeta} WHERE post_id IN(" . join(',', $variation_ids) . ") AND meta_key='_regular_price'");
326
+ foreach($res as $row){
327
+ $default_regular_prices[$row->post_id] = $row->meta_value;
328
+ }
329
+
330
+ // include the dynamic prices
331
+ foreach($variation_ids as $vid){
332
+ if(empty($regular_prices[$vid]) && isset($default_regular_prices[$vid])){
333
+ $regular_prices[$vid] = apply_filters('wcml_raw_price_amount', $default_regular_prices[$vid], $vid);
334
+ }
335
+ }
336
+
337
+ // SALE PRICES
338
+ // get custom prices
339
+ $res = $wpdb->get_results("SELECT post_id, meta_value FROM {$wpdb->postmeta} WHERE post_id IN(" . join(',', $variation_ids) . ") AND meta_key='_sale_price_" . $currency . "'");
340
+ foreach($res as $row){
341
+ $custom_sale_prices[$row->post_id] = $row->meta_value;
342
+ }
343
+
344
+ // get default prices (default currency)
345
+ $res = $wpdb->get_results("SELECT post_id, meta_value FROM {$wpdb->postmeta} WHERE post_id IN(" . join(',', $variation_ids) . ") AND meta_key='_sale_price' AND meta_value <> ''");
346
+ foreach($res as $row){
347
+ $default_sale_prices[$row->post_id] = $row->meta_value;
348
+ }
349
+
350
+ // include the dynamic prices
351
+ foreach($variation_ids as $vid){
352
+ if(empty($sale_prices[$vid]) && isset($default_sale_prices[$vid])){
353
+ $sale_prices[$vid] = apply_filters('wcml_raw_price_amount', $default_sale_prices[$vid], $vid);
354
+ }
355
+ }
356
+
357
+
358
+ // PRICES
359
+ // get custom prices
360
+ $res = $wpdb->get_results("SELECT post_id, meta_value FROM {$wpdb->postmeta} WHERE post_id IN(" . join(',', $variation_ids) . ") AND meta_key='_price_" . $currency . "'");
361
+ foreach($res as $row){
362
+ $custom_prices_prices[$row->post_id] = $row->meta_value;
363
+ }
364
+
365
+ // get default prices (default currency)
366
+ $res = $wpdb->get_results("SELECT post_id, meta_value FROM {$wpdb->postmeta} WHERE post_id IN(" . join(',', $variation_ids) . ") AND meta_key='_price'");
367
+ foreach($res as $row){
368
+ $default_prices[$row->post_id] = $row->meta_value;
369
+ }
370
+
371
+ // include the dynamic prices
372
+ foreach($variation_ids as $vid){
373
+ if(empty($custom_prices_prices[$vid]) && isset($default_prices[$vid])){
374
+ $prices[$vid] = apply_filters('wcml_raw_price_amount', $default_prices[$vid], $vid);
375
+ }
376
+ }
377
+
378
+ if(!empty($regular_prices)){
379
+ $product_min_max_prices[$product_id]['_min_variation_regular_price'] = min($regular_prices);
380
+ $product_min_max_prices[$product_id]['_max_variation_regular_price'] = max($regular_prices);
381
+ }
382
+
383
+ if(!empty($sale_prices)){
384
+ $product_min_max_prices[$product_id]['_min_variation_sale_price'] = min($sale_prices);
385
+ $product_min_max_prices[$product_id]['_max_variation_sale_price'] = max($sale_prices);
386
+ }
387
+
388
+ if(!empty($prices)){
389
+ $product_min_max_prices[$product_id]['_min_variation_price'] = min($prices);
390
+ $product_min_max_prices[$product_id]['_max_variation_price'] = max($prices);
391
+ }
392
+
393
+
394
+ }
395
+
396
+ if(isset($product_min_max_prices[$product_id]['_min_variation_regular_price'])){
397
+ $custom_prices['_min_variation_regular_price'] = $product_min_max_prices[$product_id]['_min_variation_regular_price'];
398
+ }
399
+ if(isset($product_min_max_prices[$product_id]['_max_variation_regular_price'])){
400
+ $custom_prices['_max_variation_regular_price'] = $product_min_max_prices[$product_id]['_max_variation_regular_price'];
401
+ }
402
+
403
+ if(isset($product_min_max_prices[$product_id]['_min_variation_sale_price'])){
404
+ $custom_prices['_min_variation_sale_price'] = $product_min_max_prices[$product_id]['_min_variation_sale_price'];
405
+ }
406
+ if(isset($product_min_max_prices[$product_id]['_max_variation_sale_price'])){
407
+ $custom_prices['_max_variation_sale_price'] = $product_min_max_prices[$product_id]['_max_variation_sale_price'];
408
+ }
409
+
410
+ if(isset($product_min_max_prices[$product_id]['_min_variation_price'])){
411
+ $custom_prices['_min_variation_price'] = $product_min_max_prices[$product_id]['_min_variation_price'];
412
+ }
413
+ if(isset($product_min_max_prices[$product_id]['_max_variation_price'])){
414
+ $custom_prices['_max_variation_price'] = $product_min_max_prices[$product_id]['_max_variation_price'];
415
+ }
416
+
417
+
418
+
419
+
420
+
421
+ }
422
+
423
+ return $custom_prices;
424
+
425
+ }
426
+
427
  function currency_filter($currency){
428
 
429
  $currency = apply_filters('wcml_price_currency', $currency);
445
  // exceptions
446
  if(
447
  isset($shipping_methods[$method->id]) && isset($shipping_methods[$method->id]->settings['type']) && $shipping_methods[$method->id]->settings['type'] == 'percent'
448
+ || preg_match('/^table_rate-[0-9]+ : [0-9]+$/', $k)
449
  ){
450
  continue;
451
  }
517
 
518
  if(!empty($woocommerce->session)){
519
  $this->client_currency = $woocommerce->session->get('client_currency');
520
+
521
  if(is_null($this->client_currency)){
522
  $this->client_currency = get_option('woocommerce_currency');
523
+ $woocommerce->session->set('client_currency', $this->client_currency);
524
  }
525
  }else{
526
  $this->client_currency = get_option('woocommerce_currency');
567
 
568
 
569
  function currency_switcher( $atts ){
570
+ global $sitepress,$woocommerce_wpml;
571
  // format tags
572
  // Name - %name
573
  // Symbol - %symbol
583
 
584
  echo '<select class="wcml_currency_switcher">';
585
  foreach($exchange_rates as $currency => $rate){
586
+ if($woocommerce_wpml->settings['currencies_languages'][$currency][$sitepress->get_current_language()] == 1 ){
587
  $selected = $currency == $this->get_client_currency() ? ' selected="selcted"' : '';
588
 
589
  $currency_format = preg_replace(array('#%name#', '#%symbol#', '#%code#'),
591
 
592
  echo '<option value="' . $currency . '"' . $selected . '>' . $currency_format . '</option>';
593
  }
594
+ }
595
  echo '</select>';
596
 
597
  }
598
 
599
  function switch_currency(){
 
600
  $this->set_client_currency($_POST['currency']);
601
 
602
+ // force set user cookie when user is not logged in
603
+ global $woocommerce, $current_user;
604
+ if(empty($woocommerce->session->data) && empty($current_user->ID)){
605
+ $woocommerce->session->set_customer_session_cookie(true);
606
+ }
607
+
608
  do_action('wcml_switch_currency', $_POST['currency']);
609
 
610
  exit;
inc/multi-currency.class.php CHANGED
@@ -11,6 +11,8 @@ class WCML_WC_MultiCurrency{
11
 
12
  private $exchange_rates = array();
13
 
 
 
14
  function __construct(){
15
 
16
  add_filter('init', array($this, 'init'), 5);
@@ -18,7 +20,7 @@ class WCML_WC_MultiCurrency{
18
  }
19
 
20
  function init(){
21
-
22
  add_filter('wcml_price_currency', array($this, 'price_currency_filter'));
23
 
24
  add_filter('wcml_raw_price_amount', array($this, 'raw_price_filter'), 10, 2);
@@ -31,8 +33,8 @@ class WCML_WC_MultiCurrency{
31
 
32
  // exchange rate GUI and logic
33
  if(is_admin()){
34
- add_action('wp_ajax_wcml_update_currency', array($this,'update_currency_exchange_rate'));
35
- add_action('wp_ajax_wcml_delete_currency', array($this,'delete_currency_exchange_rate'));
36
  }
37
 
38
  if(defined('W3TC')){
@@ -58,8 +60,23 @@ class WCML_WC_MultiCurrency{
58
 
59
  }
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  }
62
 
 
63
  static function install(){
64
  global $wpdb;
65
 
@@ -76,6 +93,15 @@ class WCML_WC_MultiCurrency{
76
 
77
  }
78
 
 
 
 
 
 
 
 
 
 
79
  function raw_price_filter($price, $product_id = false) {
80
 
81
  $price = $this->convert_price_amount($price, $this->get_client_currency());
@@ -110,13 +136,16 @@ class WCML_WC_MultiCurrency{
110
 
111
  if(isset($exchange_rates[$currency]) && is_numeric($amount)){
112
  $amount = $amount * $exchange_rates[$currency];
 
 
 
113
  }else{
114
  $amount = 0;
115
  }
116
 
117
  return $amount;
118
 
119
- }
120
 
121
  function price_currency_filter($currency){
122
 
@@ -156,6 +185,7 @@ class WCML_WC_MultiCurrency{
156
  }
157
 
158
  global $wpdb;
 
159
  if($_POST['currency_id'] == 0){
160
  $wpdb->insert($wpdb->prefix .'icl_currencies', array(
161
  'code' => $_POST['currency_code'],
@@ -163,8 +193,17 @@ class WCML_WC_MultiCurrency{
163
  'changed' => date('Y-m-d H:i:s')
164
  )
165
  );
166
-
167
- echo $wpdb->insert_id;
 
 
 
 
 
 
 
 
 
168
  } else {
169
  $wpdb->update(
170
  $wpdb->prefix .'icl_currencies',
@@ -176,6 +215,10 @@ class WCML_WC_MultiCurrency{
176
  array( 'id' => $_POST['currency_id'] )
177
  );
178
  }
 
 
 
 
179
  die();
180
  }
181
 
@@ -183,11 +226,72 @@ class WCML_WC_MultiCurrency{
183
  if(!wp_verify_nonce($_REQUEST['wcml_nonce'], 'wcml_delete_currency')){
184
  die('Invalid nonce');
185
  }
186
- global $wpdb;
187
  $wpdb->query($wpdb->prepare("DELETE FROM ". $wpdb->prefix ."icl_currencies WHERE id = %d", $_POST['currency_id']));
 
 
 
 
 
188
  die();
189
  }
190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  function currency_switcher(){
192
  echo(do_shortcode('[currency_switcher]'));
193
  }
@@ -241,7 +345,7 @@ class WCML_WC_MultiCurrency{
241
  }
242
 
243
  function filter_orders_by_currency_dropdown(){
244
- global $woocommerce, $wp_query, $typenow;
245
 
246
  if($typenow != 'shop_order') return false;
247
 
@@ -257,9 +361,7 @@ class WCML_WC_MultiCurrency{
257
  <?php endforeach; ?>
258
  </select>
259
  <?php
260
- $woocommerce->add_inline_js( "jQuery('select#dropdown_shop_order_currency, select[name=m]').css('width', '180px').chosen();");
261
-
262
- $this->get_orders_currencies();
263
 
264
  }
265
 
@@ -286,22 +388,262 @@ class WCML_WC_MultiCurrency{
286
 
287
  function _use_order_currency_symbol($currency){
288
  global $wp_query, $typenow, $woocommerce;
289
- remove_filter('woocommerce_currency_symbol', array($this, '_use_order_currency_symbol'));
290
 
291
- $current_screen = get_current_screen();
 
 
292
 
293
- if($current_screen->id == 'shop_order'){
 
 
294
 
295
  $the_order = new WC_Order( get_the_ID() );
296
  if($the_order && method_exists($the_order, 'get_order_currency')){
 
 
297
  $currency = get_woocommerce_currency_symbol($the_order->get_order_currency());
 
 
298
  }
 
299
  }
300
 
301
  return $currency;
302
  }
303
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
305
 
306
  }
307
 
11
 
12
  private $exchange_rates = array();
13
 
14
+ private $currencies_without_cents = array('JPY', 'TWD', 'KRW', 'BIF', 'BYR', 'CLP', 'GNF', 'ISK', 'KMF', 'PYG', 'RWF', 'VUV', 'XAF', 'XOF', 'XPF');
15
+
16
  function __construct(){
17
 
18
  add_filter('init', array($this, 'init'), 5);
20
  }
21
 
22
  function init(){
23
+
24
  add_filter('wcml_price_currency', array($this, 'price_currency_filter'));
25
 
26
  add_filter('wcml_raw_price_amount', array($this, 'raw_price_filter'), 10, 2);
33
 
34
  // exchange rate GUI and logic
35
  if(is_admin()){
36
+
37
+ $this->init_ajax_currencies_actions();
38
  }
39
 
40
  if(defined('W3TC')){
60
 
61
  }
62
 
63
+ // reports
64
+ if(is_admin()){
65
+ add_action('woocommerce_reports_tabs', array($this, 'reports_currency_dropdown')); // WC 2.0.x
66
+ add_action('wc_reports_tabs', array($this, 'reports_currency_dropdown')); // WC 2.1.x
67
+
68
+ add_action('init', array($this, 'reports_init'));
69
+
70
+ add_action('wp_ajax_wcml_reports_set_currency', array($this,'set_reports_currency'));
71
+ }
72
+
73
+
74
+ //custom prices for different currencies for products/variations [BACKEND]
75
+ add_action('woocommerce_product_options_pricing',array($this,'woocommerce_product_options_custom_pricing'));
76
+ add_action('woocommerce_product_after_variable_attributes',array($this,'woocommerce_product_after_variable_attributes_custom_pricing'),10,3);
77
  }
78
 
79
+
80
  static function install(){
81
  global $wpdb;
82
 
93
 
94
  }
95
 
96
+ function init_ajax_currencies_actions(){
97
+ add_action('wp_ajax_wcml_update_currency', array($this,'update_currency_exchange_rate'));
98
+ add_action('wp_ajax_wcml_delete_currency', array($this,'delete_currency_exchange_rate'));
99
+ add_action('wp_ajax_wcml_update_currency_lang', array($this,'wcml_update_currency_lang'));
100
+ add_action('wp_ajax_wcml_update_default_currency', array($this,'wcml_update_default_currency'));
101
+
102
+ $this->set_default_currencies_languages();
103
+ }
104
+
105
  function raw_price_filter($price, $product_id = false) {
106
 
107
  $price = $this->convert_price_amount($price, $this->get_client_currency());
136
 
137
  if(isset($exchange_rates[$currency]) && is_numeric($amount)){
138
  $amount = $amount * $exchange_rates[$currency];
139
+ if(in_array($currency, $this->currencies_without_cents)){
140
+ $amount = round($amount, 0, PHP_ROUND_HALF_UP);
141
+ }
142
  }else{
143
  $amount = 0;
144
  }
145
 
146
  return $amount;
147
 
148
+ }
149
 
150
  function price_currency_filter($currency){
151
 
185
  }
186
 
187
  global $wpdb;
188
+ $return = array();
189
  if($_POST['currency_id'] == 0){
190
  $wpdb->insert($wpdb->prefix .'icl_currencies', array(
191
  'code' => $_POST['currency_code'],
193
  'changed' => date('Y-m-d H:i:s')
194
  )
195
  );
196
+ $return['id'] = $wpdb->insert_id;
197
+ global $sitepress,$woocommerce_wpml;
198
+ $active_languages = $sitepress->get_active_languages();
199
+ $settings = $woocommerce_wpml->get_settings();
200
+ $return['languages'] ='';
201
+ foreach($active_languages as $language){
202
+ if(!isset($settings['currencies_languages'][$_POST['currency_code']][$language['code']])){
203
+ $settings['currencies_languages'][$_POST['currency_code']][$language['code']] = 1;
204
+ }
205
+ }
206
+ $woocommerce_wpml->update_settings($settings);
207
  } else {
208
  $wpdb->update(
209
  $wpdb->prefix .'icl_currencies',
215
  array( 'id' => $_POST['currency_id'] )
216
  );
217
  }
218
+
219
+ $return['symbol'] = sprintf(__(' (%s)','wpml-wcml'),get_woocommerce_currency_symbol($_POST['currency_code']));;
220
+
221
+ echo json_encode($return);
222
  die();
223
  }
224
 
226
  if(!wp_verify_nonce($_REQUEST['wcml_nonce'], 'wcml_delete_currency')){
227
  die('Invalid nonce');
228
  }
229
+ global $wpdb,$woocommerce_wpml;
230
  $wpdb->query($wpdb->prepare("DELETE FROM ". $wpdb->prefix ."icl_currencies WHERE id = %d", $_POST['currency_id']));
231
+
232
+ $settings = $woocommerce_wpml->get_settings();
233
+ unset($settings['currencies_languages'][$_POST['code']]);
234
+ $woocommerce_wpml->update_settings($settings);
235
+
236
  die();
237
  }
238
 
239
+ function wcml_update_currency_lang(){
240
+ if(!wp_verify_nonce($_REQUEST['wcml_nonce'], 'wcml_update_currency_lang')){
241
+ die('Invalid nonce');
242
+ }
243
+ global $woocommerce_wpml;
244
+
245
+ $settings = $woocommerce_wpml->get_settings();
246
+ $settings['currencies_languages'][$_POST['code']][$_POST['lang']] = $_POST['value'];
247
+
248
+ $woocommerce_wpml->update_settings($settings);
249
+ die();
250
+ }
251
+
252
+ function wcml_update_default_currency(){
253
+ if(!wp_verify_nonce($_REQUEST['wcml_nonce'], 'wcml_update_default_currency')){
254
+ die('Invalid nonce');
255
+ }
256
+ global $woocommerce_wpml;
257
+
258
+ $settings = $woocommerce_wpml->get_settings();
259
+ $settings['default_currencies'][$_POST['lang']] = $_POST['code'];
260
+
261
+ $woocommerce_wpml->update_settings($settings);
262
+ die();
263
+ }
264
+
265
+ function set_default_currencies_languages(){
266
+ global $woocommerce_wpml,$sitepress,$wpdb;
267
+
268
+ $settings = $woocommerce_wpml->get_settings();
269
+ $wc_currency = get_option('woocommerce_currency');
270
+
271
+ $exists_codes = $wpdb->get_col("SELECT code FROM " . $wpdb->prefix . "icl_currencies ORDER BY `id` DESC");
272
+ $active_languages = $sitepress->get_active_languages();
273
+ foreach ($exists_codes as $code) {
274
+ foreach($active_languages as $language){
275
+ if(!isset($settings['currencies_languages'][$code][$language['code']])){
276
+ $settings['currencies_languages'][$code][$language['code']] = 1;
277
+ }
278
+ }
279
+ }
280
+
281
+ foreach($active_languages as $language){
282
+ if(!isset($settings['default_currencies'][$language['code']])){
283
+ $settings['default_currencies'][$language['code']] = false;
284
+ }
285
+
286
+ if(!isset($settings['currencies_languages'][$wc_currency][$language['code']])){
287
+ $settings['currencies_languages'][$wc_currency][$language['code']] = 1;
288
+ }
289
+ }
290
+
291
+ $woocommerce_wpml->update_settings($settings);
292
+
293
+ }
294
+
295
  function currency_switcher(){
296
  echo(do_shortcode('[currency_switcher]'));
297
  }
345
  }
346
 
347
  function filter_orders_by_currency_dropdown(){
348
+ global $wp_query, $typenow;
349
 
350
  if($typenow != 'shop_order') return false;
351
 
361
  <?php endforeach; ?>
362
  </select>
363
  <?php
364
+ wc_enqueue_js( "jQuery('select#dropdown_shop_order_currency, select[name=m]').css('width', '180px').chosen();");
 
 
365
 
366
  }
367
 
388
 
389
  function _use_order_currency_symbol($currency){
390
  global $wp_query, $typenow, $woocommerce;
 
391
 
392
+ if(!function_exists('get_current_screen')){
393
+ return $currency;
394
+ }
395
 
396
+ $current_screen = get_current_screen();
397
+
398
+ if(!empty($current_screen) && $current_screen->id == 'shop_order'){
399
 
400
  $the_order = new WC_Order( get_the_ID() );
401
  if($the_order && method_exists($the_order, 'get_order_currency')){
402
+ remove_filter('woocommerce_currency_symbol', array($this, '_use_order_currency_symbol'));
403
+
404
  $currency = get_woocommerce_currency_symbol($the_order->get_order_currency());
405
+
406
+ add_filter('woocommerce_currency_symbol', array($this, '_use_order_currency_symbol'));
407
  }
408
+
409
  }
410
 
411
  return $currency;
412
  }
413
 
414
+ function reports_init(){
415
+
416
+ if(isset($_GET['page']) && ($_GET['page'] == 'woocommerce_reports' || $_GET['page'] == 'wc-reports')){ //wc-reports - 2.1.x, woocommerce_reports 2.0.x
417
+
418
+ add_filter('woocommerce_reports_get_order_report_query', array($this, 'admin_reports_query_filter'));
419
+
420
+ wc_enqueue_js( "
421
+ jQuery('#dropdown_shop_report_currency').on('change', function(){
422
+ jQuery('#dropdown_shop_report_currency_chzn').after('&nbsp;' + icl_ajxloaderimg); // WC 2.0
423
+ jQuery('#dropdown_shop_report_currency_chzn a.chzn-single').css('color', '#aaa'); // WC 2.0
424
+ jQuery('#dropdown_shop_report_currency_chosen').after('&nbsp;' + icl_ajxloaderimg);
425
+ jQuery('#dropdown_shop_report_currency_chosen a.chosen-single').css('color', '#aaa');
426
+ jQuery.ajax({
427
+ url: ajaxurl,
428
+ type: 'post',
429
+ data: {action: 'wcml_reports_set_currency', currency: jQuery('#dropdown_shop_report_currency').val()},
430
+ success: function(){location.reload();}
431
+ })
432
+ });
433
+ ");
434
+
435
+ $this->reports_currency = isset($_COOKIE['_wcml_reports_currency']) ? $_COOKIE['_wcml_reports_currency'] : get_option('woocommerce_currency');
436
+
437
+ add_filter('woocommerce_currency_symbol', array($this, '_set_reports_currency_symbol'));
438
+
439
+ /* for WC 2.0.x - start */
440
+ add_filter('woocommerce_reports_sales_overview_order_totals_join', array($this, 'reports_filter_by_currency_join'));
441
+ add_filter('woocommerce_reports_sales_overview_order_totals_where', array($this, 'reports_filter_by_currency_where'));
442
+
443
+ add_filter('woocommerce_reports_sales_overview_discount_total_join', array($this, 'reports_filter_by_currency_join'));
444
+ add_filter('woocommerce_reports_sales_overview_discount_total_where', array($this, 'reports_filter_by_currency_where'));
445
+
446
+ add_filter('woocommerce_reports_sales_overview_shipping_total_join', array($this, 'reports_filter_by_currency_join'));
447
+ add_filter('woocommerce_reports_sales_overview_shipping_total_where', array($this, 'reports_filter_by_currency_where'));
448
+
449
+ add_filter('woocommerce_reports_sales_overview_order_items_join', array($this, 'reports_filter_by_currency_join'));
450
+ add_filter('woocommerce_reports_sales_overview_order_items_where', array($this, 'reports_filter_by_currency_where'));
451
+
452
+ add_filter('woocommerce_reports_sales_overview_orders_join', array($this, 'reports_filter_by_currency_join'));
453
+ add_filter('woocommerce_reports_sales_overview_orders_where', array($this, 'reports_filter_by_currency_where'));
454
+
455
+ add_filter('woocommerce_reports_daily_sales_orders_join', array($this, 'reports_filter_by_currency_join'));
456
+ add_filter('woocommerce_reports_daily_sales_orders_where', array($this, 'reports_filter_by_currency_where'));
457
+
458
+ add_filter('woocommerce_reports_monthly_sales_orders_join', array($this, 'reports_filter_by_currency_join'));
459
+ add_filter('woocommerce_reports_monthly_sales_orders_where', array($this, 'reports_filter_by_currency_where'));
460
+
461
+ add_filter('woocommerce_reports_monthly_sales_order_items_join', array($this, 'reports_filter_by_currency_join'));
462
+ add_filter('woocommerce_reports_monthly_sales_order_items_where', array($this, 'reports_filter_by_currency_where'));
463
+
464
+ add_filter('woocommerce_reports_top_sellers_order_items_join', array($this, 'reports_filter_by_currency_join'));
465
+ add_filter('woocommerce_reports_top_sellers_order_items_where', array($this, 'reports_filter_by_currency_where'));
466
+
467
+ add_filter('woocommerce_reports_top_earners_order_items_join', array($this, 'reports_filter_by_currency_join'));
468
+ add_filter('woocommerce_reports_top_earners_order_items_where', array($this, 'reports_filter_by_currency_where'));
469
+
470
+ add_filter('woocommerce_reports_product_sales_order_items_join', array($this, 'reports_filter_by_currency_join'));
471
+ add_filter('woocommerce_reports_product_sales_order_items_where', array($this, 'reports_filter_by_currency_where'));
472
+
473
+ add_filter('woocommerce_reports_coupons_overview_total_order_count_join', array($this, 'reports_filter_by_currency_join'));
474
+ add_filter('woocommerce_reports_coupons_overview_total_order_count_where', array($this, 'reports_filter_by_currency_where'));
475
+
476
+ add_filter('woocommerce_reports_coupons_overview_totals_join', array($this, 'reports_filter_by_currency_join'));
477
+ add_filter('woocommerce_reports_coupons_overview_totals_where', array($this, 'reports_filter_by_currency_where'));
478
+
479
+ add_filter('woocommerce_reports_coupons_overview_coupons_by_count_join', array($this, 'reports_filter_by_currency_join'));
480
+ add_filter('woocommerce_reports_coupons_overview_coupons_by_count_where', array($this, 'reports_filter_by_currency_where'));
481
+
482
+ add_filter('woocommerce_reports_coupons_sales_used_coupons_join', array($this, 'reports_filter_by_currency_join'));
483
+ add_filter('woocommerce_reports_coupons_sales_used_coupons_where', array($this, 'reports_filter_by_currency_where'));
484
+
485
+ add_filter('woocommerce_reports_coupon_sales_order_totals_join', array($this, 'reports_filter_by_currency_join'));
486
+ add_filter('woocommerce_reports_coupon_sales_order_totals_where', array($this, 'reports_filter_by_currency_where'));
487
+
488
+ add_filter('woocommerce_reports_customer_overview_customer_orders_join', array($this, 'reports_filter_by_currency_join'));
489
+ add_filter('woocommerce_reports_customer_overview_customer_orders_where', array($this, 'reports_filter_by_currency_where'));
490
+
491
+ add_filter('woocommerce_reports_customer_overview_guest_orders_join', array($this, 'reports_filter_by_currency_join'));
492
+ add_filter('woocommerce_reports_customer_overview_guest_orders_where', array($this, 'reports_filter_by_currency_where'));
493
+
494
+
495
+ add_filter('woocommerce_reports_monthly_taxes_gross_join', array($this, 'reports_filter_by_currency_join'));
496
+ add_filter('woocommerce_reports_monthly_taxes_gross_where', array($this, 'reports_filter_by_currency_where'));
497
+
498
+ add_filter('woocommerce_reports_monthly_taxes_shipping_join', array($this, 'reports_filter_by_currency_join'));
499
+ add_filter('woocommerce_reports_monthly_taxes_shipping_where', array($this, 'reports_filter_by_currency_where'));
500
+
501
+ add_filter('woocommerce_reports_monthly_taxes_order_tax_join', array($this, 'reports_filter_by_currency_join'));
502
+ add_filter('woocommerce_reports_monthly_taxes_order_tax_where', array($this, 'reports_filter_by_currency_where'));
503
+
504
+ add_filter('woocommerce_reports_monthly_taxes_shipping_tax_join', array($this, 'reports_filter_by_currency_join'));
505
+ add_filter('woocommerce_reports_monthly_taxes_shipping_tax_where', array($this, 'reports_filter_by_currency_where'));
506
+
507
+ add_filter('woocommerce_reports_monthly_taxes_tax_rows_join', array($this, 'reports_filter_by_currency_join'));
508
+ add_filter('woocommerce_reports_monthly_taxes_tax_rows_where', array($this, 'reports_filter_by_currency_where'));
509
+
510
+ add_filter('woocommerce_reports_category_sales_order_items_join', array($this, 'reports_filter_by_currency_join'));
511
+ add_filter('woocommerce_reports_category_sales_order_items_where', array($this, 'reports_filter_by_currency_where'));
512
+
513
+ /* for WC 2.0.x - end */
514
+
515
+ }
516
+ }
517
+
518
+ function admin_reports_query_filter($query){
519
+ global $wpdb;
520
+
521
+ $query['join'] .= " LEFT JOIN {$wpdb->postmeta} AS meta_order_currency ON meta_order_currency.post_id = posts.ID ";
522
+
523
+ $query['where'] .= sprintf(" AND meta_order_currency.meta_key='_order_currency' AND meta_order_currency.meta_value = '%s' ", $this->reports_currency);
524
+
525
+ return $query;
526
+ }
527
 
528
+ function set_reports_currency(){
529
+
530
+ setcookie('_wcml_reports_currency', $_POST['currency'], time() + 86400, COOKIEPATH, COOKIE_DOMAIN);
531
+
532
+ exit;
533
+
534
+ }
535
+
536
+ function reports_currency_dropdown(){
537
+
538
+ $orders_currencies = $this->get_orders_currencies();
539
+ $currencies = get_woocommerce_currencies();
540
+
541
+ // remove temporary
542
+ remove_filter('woocommerce_currency_symbol', array($this, '_set_reports_currency_symbol'));
543
+
544
+ ?>
545
+
546
+ <select id="dropdown_shop_report_currency">
547
+ <?php foreach($orders_currencies as $currency => $count): ?>
548
+ <option value="<?php echo $currency ?>" <?php selected( $currency, $this->reports_currency ); ?>><?php
549
+ printf("%s (%s)", $currencies[$currency], get_woocommerce_currency_symbol($currency)) ?></option>
550
+ <?php endforeach; ?>
551
+ </select>
552
+
553
+ <?php
554
+ wc_enqueue_js( "jQuery('select#dropdown_shop_report_currency, select[name=m]').css('width', '180px').chosen();");
555
+
556
+ // add back
557
+ add_filter('woocommerce_currency_symbol', array($this, '_set_reports_currency_symbol'));
558
+
559
+ }
560
+
561
+ function _set_reports_currency_symbol($currency){
562
+ static $no_recur = false;
563
+ if(!empty($this->reports_currency) && empty($no_recur)){
564
+ $no_recur= true;
565
+ $currency = get_woocommerce_currency_symbol($this->reports_currency);
566
+ $no_recur= false;
567
+ }
568
+ return $currency;
569
+ }
570
+
571
+ function woocommerce_product_options_custom_pricing(){
572
+ global $pagenow,$sitepress;
573
+
574
+ $def_lang = $sitepress->get_default_language();
575
+ if((isset($_GET['lang']) && $_GET['lang'] != $def_lang) || (isset($_GET['post']) && $sitepress->get_language_for_element($_GET['post'],'post_product') != $def_lang) || $sitepress->get_current_language() != $def_lang){
576
+ return;
577
+ }
578
+
579
+ $product_id = false;
580
+
581
+ if($pagenow == 'post.php' && isset($_GET['post']) && get_post_type($_GET['post']) == 'product'){
582
+ $product_id = $_GET['post'];
583
+ }
584
+
585
+ $this->custom_pricing_output($product_id);
586
+
587
+ wp_nonce_field('wcml_save_custom_prices','_wcml_custom_prices_nonce');
588
+
589
+ $this->load_custom_prices_js_css();
590
+ }
591
+
592
+ function custom_pricing_output($post_id = false){
593
+ global $wpdb,$woocommerce;
594
+
595
+ $custom_prices = array();
596
+ $is_variation = false;
597
+
598
+ if($post_id){
599
+ $custom_prices = get_post_custom($post_id);
600
+ if(get_post_type($post_id) == 'product_variation'){
601
+ $is_variation = true;
602
+ }
603
+ }
604
+
605
+ include WCML_PLUGIN_PATH . '/menu/sub/custom-prices.php';
606
+ }
607
+
608
+ function load_custom_prices_js_css(){
609
+ wp_register_style('wpml-wcml-prices', WCML_PLUGIN_URL . '/assets/css/wcml-prices.css', null, WCML_VERSION);
610
+ wp_register_script('wcml-tm-scripts-prices', WCML_PLUGIN_URL . '/assets/js/prices.js', array('jquery'), WCML_VERSION);
611
+
612
+ wp_enqueue_style('wpml-wcml-prices');
613
+ wp_enqueue_script('wcml-tm-scripts-prices');
614
+ }
615
+
616
+
617
+ function woocommerce_product_after_variable_attributes_custom_pricing($loop, $variation_data, $variation){
618
+ global $sitepress;
619
+
620
+ $def_lang = $sitepress->get_default_language();
621
+ if((isset($_GET['lang']) && $_GET['lang'] != $def_lang) || (isset($_GET['post']) && $sitepress->get_language_for_element($_GET['post'],'post_product') != $def_lang) || $sitepress->get_current_language() != $def_lang){
622
+ return;
623
+ }
624
+
625
+ echo '<tr><td>';
626
+ $this->custom_pricing_output($variation->ID);
627
+ echo '</td></tr>';
628
+ }
629
+
630
+
631
+ /* for WC 2.0.x - start */
632
+ function reports_filter_by_currency_join($join){
633
+ global $wpdb;
634
+
635
+ $join .= " LEFT JOIN {$wpdb->postmeta} wcml_rpm ON wcml_rpm.post_id = posts.ID ";
636
+
637
+ return $join;
638
+ }
639
+
640
+ function reports_filter_by_currency_where($where){
641
+
642
+ $where .= " AND wcml_rpm.meta_key = '_order_currency' AND wcml_rpm.meta_value = '" . esc_sql($this->reports_currency) . "'";
643
+
644
+ return $where;
645
+ }
646
+ /* for WC 2.0.x - end */
647
 
648
  }
649
 
inc/orders.class.php CHANGED
@@ -1,6 +1,12 @@
1
  <?php
2
  class WCML_Orders{
3
 
 
 
 
 
 
 
4
  function __construct(){
5
 
6
  add_action('init', array($this, 'init'));
@@ -14,6 +20,46 @@ class WCML_Orders{
14
 
15
  add_filter('icl_lang_sel_copy_parameters', array($this, 'append_query_parameters'));
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  }
18
 
19
  // Fix for shipping update on the checkout page.
1
  <?php
2
  class WCML_Orders{
3
 
4
+ private $standart_order_notes = array('Order status changed from %s to %s.',
5
+ 'Order item stock reduced successfully.','Item #%s stock reduced from %s to %s.','Awaiting BACS payment','Awaiting cheque payment','Payment to be made upon delivery.',
6
+ 'Validation error: PayPal amounts do not match (gross %s).','Validation error: PayPal IPN response from a different email address (%s).','Payment pending: %s',
7
+ 'Payment %s via IPN.','Validation error: PayPal amounts do not match (amt %s).','IPN payment completed','PDT payment completed'
8
+ );
9
+
10
  function __construct(){
11
 
12
  add_action('init', array($this, 'init'));
20
 
21
  add_filter('icl_lang_sel_copy_parameters', array($this, 'append_query_parameters'));
22
 
23
+ add_filter('the_comments', array($this, 'get_filtered_comments'));
24
+ add_filter('gettext',array($this, 'filtered_woocommerce_new_order_note_data'),10,3);
25
+ }
26
+
27
+ function filtered_woocommerce_new_order_note_data($translations, $text, $domain ){
28
+ if(in_array($text,$this->standart_order_notes)){
29
+ global $sitepress_settings,$wpdb;
30
+
31
+ if($sitepress_settings['admin_default_language'] == $sitepress_settings['st']['strings_language']){
32
+ return $text;
33
+ }
34
+
35
+ $string_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM {$wpdb->prefix}icl_strings WHERE language = %s AND value = %s ", $sitepress_settings['st']['strings_language'], $text));
36
+ if($string_id){
37
+ $string = $wpdb->get_var($wpdb->prepare("SELECT value FROM {$wpdb->prefix}icl_string_translations WHERE string_id = %s and language = %s", $string_id, $sitepress_settings['admin_default_language']));
38
+ if($string){
39
+ $translations = $string;
40
+ }
41
+ }
42
+ }
43
+
44
+ return $translations;
45
+ }
46
+
47
+ function get_filtered_comments($comments){
48
+ global $sitepress_settings,$wpdb,$current_user;
49
+ $user_language = get_user_meta( $current_user->data->ID, 'icl_admin_language', true );
50
+
51
+ foreach($comments as $key=>$comment){
52
+ $comment_string_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM {$wpdb->prefix}icl_strings WHERE language = %s AND value = %s ", $sitepress_settings['st']['strings_language'], $comment->comment_content));
53
+ if($comment_string_id){
54
+ $comment_string = $wpdb->get_var($wpdb->prepare("SELECT value FROM {$wpdb->prefix}icl_string_translations WHERE string_id = %s and language = %s", $comment_string_id, $user_language));
55
+ if($comment_string){
56
+ $comments[$key]->comment_content = $comment_string;
57
+ }
58
+ }
59
+ }
60
+
61
+ return $comments;
62
+
63
  }
64
 
65
  // Fix for shipping update on the checkout page.
inc/products.class.php CHANGED
@@ -12,12 +12,15 @@ class WCML_Products{
12
  add_action('init', array($this, 'wc_cart_widget_actions'));
13
  add_action('init', array($this, 'set_price_config'), 16); // After TM parses wpml-config.xml
14
 
 
 
15
  }
16
 
17
  function init(){
18
 
19
  if(is_admin()){
20
  add_action('wp_ajax_wcml_update_product', array($this,'update_product_actions'));
 
21
 
22
  add_filter('wpml_post_edit_page_link_to_translation',array($this,'_filter_link_to_translation'));
23
  add_action('admin_init', array($this, 'restrict_admin_with_redirect'));
@@ -50,6 +53,8 @@ class WCML_Products{
50
  add_filter('woocommerce_json_search_found_products', array($this, 'filter_found_products_by_language'));
51
  }
52
  add_action('woocommerce_email',array($this,'wcml_refresh_text_domain'));
 
 
53
  add_filter('wpml_link_to_translation',array($this,'_filter_link_to_translation'));
54
 
55
  add_filter('woocommerce_upsell_crosssell_search_products', array($this, 'filter_woocommerce_upsell_crosssell_posts_by_language'));
@@ -80,13 +85,7 @@ class WCML_Products{
80
  // Hooks for translating product attribute values
81
  add_filter('woocommerce_variation_option_name', array($this, 'translate_variation_term_name'));
82
  add_filter('woocommerce_attribute', array($this, 'translate_attribute_terms'));
83
- add_action('wp_ajax_woocommerce_remove_variation', array($this,'remove_variation_ajax'),9);
84
- //translate attribute label
85
- add_filter('woocommerce_attribute_label',array($this,'translated_attribute_label'),10,2);
86
- add_filter('woocommerce_in_cart_product_title',array($this,'translated_cart_product_title'),10,3);
87
- add_filter('woocommerce_checkout_product_title',array($this,'translated_checkout_product_title'),10,2);
88
-
89
-
90
  //WooCommerce subscription
91
  add_filter('woocommerce_users_subscriptions',array($this, 'woocommerce_users_subscriptions'),10,2);
92
 
@@ -266,8 +265,13 @@ class WCML_Products{
266
  switch ($action){
267
  case 'duplicate':
268
  if($language['code'] != $default_language){
269
- $tr_product_id = icl_object_id($product_id, 'product', false, $language['code']);
270
- if(is_null($tr_product_id)){
 
 
 
 
 
271
  break;
272
  }
273
 
@@ -563,25 +567,6 @@ class WCML_Products{
563
  // synchronize post variations
564
  $this->sync_product_variations($original_product_id, $tr_product_id, $language, $data);
565
 
566
-
567
- //save prices
568
- if($woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT){
569
- foreach(wp_get_post_terms($tr_product_id, 'product_type', array("fields" => "names")) as $type){
570
- $product_type = $type;
571
- }
572
-
573
- $price_keys = array();
574
- $price_keys[]='regular_price';
575
- $price_keys[]='sale_price';
576
-
577
- if($product_type == 'simple' || $product_type == 'external'){
578
- foreach($price_keys as $price_key){
579
- update_post_meta($tr_product_id, '_' . $price_key, $data[$price_key.'_'.$language]);
580
- }
581
- }
582
- }
583
-
584
-
585
  //save images texts
586
  if(isset($data['images'])){
587
  foreach($data['images'] as $key=>$image){
@@ -600,7 +585,9 @@ class WCML_Products{
600
 
601
 
602
  $translations = $sitepress->get_element_translations($product_trid,'post_product');
 
603
  ob_clean();
 
604
  ob_start();
605
  $return = array();
606
 
@@ -615,13 +602,11 @@ class WCML_Products{
615
 
616
  $is_variable_product = $this->is_variable_product($original_product_id);
617
 
618
- if($is_variable_product){
619
- if($woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT){
620
  ob_start();
621
  $this->product_variations_box($tr_product_id,$language);
622
  $return['variations'][$language] = ob_get_clean();
623
  }
624
- }
625
 
626
  // no longer a duplicate
627
  if(!empty($data['end_duplication'][$original_product_id][$language])){
@@ -689,7 +674,7 @@ class WCML_Products{
689
  $settings = $sitepress->get_settings();
690
  $lang = $sitepress->get_language_for_element($trnsl_product_id,'post_product');
691
 
692
- $all_meta = get_post_meta($original_product_id);
693
 
694
  unset($all_meta['_thumbnail_id']);
695
 
@@ -698,7 +683,11 @@ class WCML_Products{
698
  }
699
 
700
  foreach ($all_meta as $key => $meta) {
 
 
 
701
  foreach ($meta as $meta_value) {
 
702
  if($data){
703
  if(isset($data[$key.'_'.$lang]) && isset($settings['translation-management']['custom_fields_translation'][$key]) && $settings['translation-management']['custom_fields_translation'][$key] == 2){
704
  if($key == '_file_paths'){
@@ -711,11 +700,8 @@ class WCML_Products{
711
  }else{
712
  $meta_value = $data[$key.'_'.$lang];
713
  }
714
- }else{
715
- if($key == '_file_paths'){
716
- $meta_value = maybe_unserialize($meta_value);
717
- }
718
  }
 
719
  if(isset($data['regular_price_'.$lang]) && isset($data['sale_price_'.$lang]) && $product_type == 'variable'){
720
  switch($key){
721
  case '_min_variation_sale_price':
@@ -769,16 +755,20 @@ class WCML_Products{
769
  }
770
  }
771
 
 
772
  if($add){
773
  add_post_meta($trnsl_product_id, $key, $meta_value, true);
774
  }else{
775
  update_post_meta($trnsl_product_id,$key,$meta_value);
776
  }
777
  }else{
778
- add_post_meta($trnsl_product_id, $key, $meta_value, true);
 
779
  }
780
  }
781
  }
 
 
782
  }
783
 
784
  function sync_product_gallery($product_id){
@@ -809,7 +799,7 @@ class WCML_Products{
809
 
810
  function get_translation_flags($active_languages,$default_language,$slang = false){
811
  foreach($active_languages as $language){
812
- if ($default_language != $language['code'] && (($slang && $slang == $language['code']) || !$slang) && (current_user_can('manage_options') || wpml_check_user_is_translator($default_language,$language['code'])) && (!isset($_POST['translation_status_lang']) || (isset($_POST['translation_status_lang']) && ($_POST['translation_status_lang'] == $language['code']) || $_POST['translation_status_lang']==''))){
813
  echo '<img src="'. ICL_PLUGIN_URL .'/res/flags/'. $language['code'] .'.png" width="18" height="12" class="flag_img" />';
814
  }
815
  }
@@ -820,7 +810,7 @@ class WCML_Products{
820
  global $wpdb;
821
 
822
  foreach ($active_languages as $language) {
823
- if ($default_language != $language['code'] && (($slang && $slang == $language['code']) || !$slang) && (current_user_can('manage_options') || wpml_check_user_is_translator($default_language,$language['code'])) && (!isset($_POST['translation_status_lang']) || (isset($_POST['translation_status_lang']) && ($_POST['translation_status_lang'] == $language['code']) || $_POST['translation_status_lang']==''))) {
824
  if (isset($product_translations[$language['code']])) {
825
  $tr_status = $wpdb->get_row($wpdb->prepare("SELECT status,needs_update FROM " . $wpdb->prefix . "icl_translation_status WHERE translation_id = %d", $product_translations[$language['code']]->translation_id));
826
  if(!$tr_status){
@@ -863,10 +853,15 @@ class WCML_Products{
863
  WHERE post_status IN ('publish','private') AND post_type = 'product_variation' AND post_parent = %d ORDER BY ID",$product_id));
864
 
865
  $duplicated_post_variation_ids = array();
 
866
  foreach($get_all_post_variations as $k => $post_data){
867
  $duplicated_post_variation_ids[] = $post_data->ID;
868
  }
869
 
 
 
 
 
870
  foreach ($get_all_post_variations as $k => $post_data) {
871
 
872
  // Find if this has already been duplicated
@@ -1023,6 +1018,7 @@ class WCML_Products{
1023
  foreach($values_arrs as $key=>$value){
1024
  $value = str_replace(' ','-',trim($value));
1025
  $value = lcfirst($value);
 
1026
  if($value == $meta_value && isset($values_arrs_tr[$key])){
1027
  $meta_value = trim($values_arrs_tr[$key]);
1028
  $meta_value = str_replace(' ','-',$meta_value);
@@ -1359,6 +1355,27 @@ class WCML_Products{
1359
  return;
1360
  }
1361
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1362
  // If we reach this point, we go ahead with sync.
1363
  // Remove filter to avoid double sync
1364
  remove_action('save_post', array($this, 'sync_post_action'), 11, 2);
@@ -1450,6 +1467,115 @@ class WCML_Products{
1450
  $this->sync_product_variations($duplicated_post_id,$post_id,$lang);
1451
 
1452
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1453
  }
1454
 
1455
 
@@ -1542,18 +1668,15 @@ class WCML_Products{
1542
  $contents[] = 'content';
1543
  $contents[] = 'excerpt';
1544
  $contents[] = 'images';
1545
- if($woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT){
1546
  if(!isset($product_type)){
1547
  foreach(wp_get_post_terms($product_id, 'product_type', array("fields" => "names")) as $type){
1548
  $product_type = $type;
1549
  }
1550
  }
1551
- if($product_type == 'variable'){
1552
- $contents[] = 'variations';
1553
- }elseif($product_type != 'grouped'){
1554
- $contents[] = 'sale_price';
1555
- $contents[] = 'regular_price';
1556
- }
1557
  }
1558
 
1559
  global $sitepress;
@@ -1565,9 +1688,14 @@ class WCML_Products{
1565
  if(in_array($meta_key,$this->not_display_fields_for_variables_product)){
1566
  continue;
1567
  }
1568
- $contents[] = $meta_key;
 
 
 
1569
  }
1570
  }
 
 
1571
  }
1572
 
1573
  return $contents;
@@ -1582,16 +1710,13 @@ class WCML_Products{
1582
  $contents[] = __('Content','wpml-wcml');
1583
  $contents[] = __('Excerpt','wpml-wcml');
1584
  $contents[] = __('Images','wpml-wcml');
1585
- if($woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT){
1586
  foreach(wp_get_post_terms($product_id, 'product_type', array("fields" => "names")) as $type){
1587
  $product_type = $type;
1588
  }
1589
- if($product_type == 'variable'){
1590
- $contents[] = __('Variations','wpml-wcml');
1591
- }elseif($product_type != 'grouped'){
1592
- $contents[] = __('Sale price','wpml-wcml');
1593
- $contents[] = __('Regular price','wpml-wcml');
1594
- }
1595
  }
1596
 
1597
  global $sitepress,$wpseo_metabox;
@@ -1611,9 +1736,18 @@ class WCML_Products{
1611
  }
1612
  }
1613
 
 
 
 
 
 
 
 
 
 
1614
  $custom_key_label = str_replace('_',' ',$meta_key);
1615
  $contents[] = trim($custom_key_label[0]) ? ucfirst($custom_key_label) : ucfirst(substr($custom_key_label,1));
1616
- }
1617
  }
1618
  }
1619
 
@@ -1765,11 +1899,7 @@ class WCML_Products{
1765
 
1766
 
1767
  foreach($variations as $variation){
1768
- $flag = true;
1769
- if($var_key == '_file_paths'){
1770
- $flag = $wpdb->get_var($wpdb->prepare("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_downloadable' AND meta_value='yes' AND post_id = %d",$variation->ID));
1771
- }
1772
- if($flag){
1773
  $variation_values = $wpdb->get_results($wpdb->prepare("SELECT meta_key,meta_value FROM $wpdb->postmeta WHERE (meta_key = %s OR meta_key LIKE 'attribute_%%') AND post_id = %d",$var_key,$variation->ID));
1774
  $variables = array();
1775
  $variables['value'] = '';
@@ -1794,19 +1924,34 @@ class WCML_Products{
1794
  }
1795
 
1796
  if(!$term_name){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1797
  $label = __('Please translate all attributes','wpml-wcml');
1798
  $variables['label'] .= $label.' & ';
1799
  $variables['not_translated'] = true;
1800
  continue;
1801
  }
1802
  }
 
1803
  $variables['label'] .= urldecode($term_name).' & ';
1804
  }
1805
  }
1806
 
1807
  $variables['label'] = substr($variables['label'],0,strlen($variables['label'])-3);
1808
  $variables_all[$variation->ID] = $variables;
1809
- }
1810
  }
1811
  return $variables_all;
1812
  }
@@ -1822,6 +1967,7 @@ class WCML_Products{
1822
  $template_data = array();
1823
  $template_data['all_variations_ids'] = array();
1824
 
 
1825
  if ($default_language != $lang) {
1826
  $trn_product_id = icl_object_id($product_id, 'product', false, $lang);
1827
  }
@@ -1832,31 +1978,27 @@ class WCML_Products{
1832
  $template_data['original'] = false;
1833
  }
1834
 
1835
- //regular price
1836
- $template_data['regular_price'] = $this->get_product_content_translation($product_id, 'regular_price', $lang);
1837
-
1838
- //sale price
1839
- $template_data['sale_price'] = $this->get_product_content_translation($product_id, 'sale_price', $lang);
1840
-
1841
  //file path
1842
  if (!$woocommerce_wpml->settings['file_path_sync']) {
1843
  global $wpdb;
1844
  $is_downloable = $wpdb->get_results($wpdb->prepare("SELECT pm.meta_value FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS pm ON p.id=pm.post_id WHERE p.post_parent = %d AND p.post_type = 'product_variation' AND pm.meta_key='_downloadable' AND pm.meta_value = 'yes'", $product_id));
1845
- if ($is_downloable) {
1846
  $template_data['all_file_paths'] = $this->get_product_content_translation($product_id, 'variations_file_paths', $lang);
1847
- }
1848
  }
1849
 
1850
  $is_product_has_variations = $wpdb->get_var($wpdb->prepare("SELECT count(id) FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'product_variation'",$product_id));
1851
 
1852
- if (!$is_product_has_variations){
1853
- $template_data['empty_variations'] = true;
1854
- } elseif ($template_data['original'] || !is_null($trn_product_id)) {
1855
- foreach ($template_data['regular_price'] as $key => $price) {
1856
  $template_data['all_variations_ids'][] = $key;
1857
  }
1858
- } else {
 
 
 
1859
  $template_data['empty_translation'] = true;
 
 
1860
  }
1861
 
1862
  include WCML_PLUGIN_PATH . '/menu/sub/variations_box.php';
@@ -1898,9 +2040,42 @@ class WCML_Products{
1898
  } else {
1899
  $template_data['empty_translation'] = true;
1900
  }
1901
- include WCML_PLUGIN_PATH . '/menu/sub/images_box.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1902
  }
1903
 
 
1904
  function product_images_ids($product_id){
1905
  global $wpdb;
1906
  $product_images_ids = array();
@@ -1988,7 +2163,7 @@ class WCML_Products{
1988
  $original_slug = $original_term->slug;
1989
  //get variations with original slug
1990
 
1991
- $variations = $wpdb->get_results($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key='%s' AND meta_value = '%s'",'attribute_'.$taxonomy,$original_slug));
1992
 
1993
  foreach($variations as $variation){
1994
  //update taxonomy in translation of variation
@@ -2124,38 +2299,6 @@ class WCML_Products{
2124
  }
2125
  }
2126
 
2127
-
2128
- function translated_attribute_label($label, $name){
2129
- global $sitepress;
2130
- $name = woocommerce_sanitize_taxonomy_name($name);
2131
- $lang = $sitepress->get_current_language();
2132
- $trnsl_labels = get_option('wcml_custom_attr_translations');
2133
- if(isset($trnsl_labels[$lang][$name])){
2134
- return $trnsl_labels[$lang][$name];
2135
- }
2136
-
2137
- return icl_t('WordPress','taxonomy singular name: '.$label,$label);
2138
- }
2139
-
2140
-
2141
- function translated_cart_product_title($title, $values, $cart_item_key){
2142
- global $sitepress;
2143
- if($values){
2144
- $tr_product_id = icl_object_id($values['product_id'],'product',true,$sitepress->get_current_language());
2145
- $title = get_the_title($tr_product_id);
2146
- }
2147
- return $title;
2148
- }
2149
-
2150
- function translated_checkout_product_title($title,$product){
2151
- global $sitepress;
2152
- if(isset($product->id)){
2153
- $tr_product_id = icl_object_id($product->id,'product',true,$sitepress->get_current_language());
2154
- $title = get_the_title($tr_product_id);
2155
- }
2156
- return $title;
2157
- }
2158
-
2159
  function icl_make_duplicate($master_post_id, $lang, $postarr, $id){
2160
  if(get_post_type($master_post_id)=='product'){
2161
  $this->product_test_content_action(array($master_post_id), 'duplicate', $lang, true);
@@ -2226,29 +2369,38 @@ class WCML_Products{
2226
 
2227
  foreach($cart->cart_contents as $key=>$cart_item){
2228
  $tr_product_id = icl_object_id($cart_item['product_id'],'product',false,$current_language);
 
2229
  if(isset($cart->cart_contents[$key]['variation_id']) && $cart->cart_contents[$key]['variation_id']){
2230
  $tr_variation_id = icl_object_id($cart_item['variation_id'],'product_variation',false,$current_language);
2231
  if(!is_null($tr_variation_id)){
2232
- $price = get_post_meta($tr_variation_id,'_price',true);
2233
  $cart->cart_contents[$key]['product_id'] = $tr_product_id;
2234
  $cart->cart_contents[$key]['variation_id'] = $tr_variation_id;
2235
- $cart->cart_contents[$key]['data'] = get_product( $tr_variation_id );
 
2236
  if($cart_item['variation']){
2237
 
2238
  foreach($cart_item['variation'] as $attr_key=>$attribute){
2239
- if(taxonomy_exists($attr_key)){
2240
- $term = get_term_by('slug',$attribute,$attr_key);
2241
- $trnsl_term_id = icl_object_id($term->term_id,$attr_key,true,$current_language);
 
 
 
 
 
 
 
2242
 
2243
- $cart->cart_contents[$key]['variation'][$attr_key] = get_term($trnsl_term_id,$attr_key)->slug;
2244
  }else{
2245
  $orig_product_attributes = get_post_meta($cart_item['product_id'], '_product_attributes', true);
2246
  $unserialized_orig_product_attributes = maybe_unserialize($orig_product_attributes);
2247
  foreach($unserialized_orig_product_attributes as $orig_attr_key => $orig_product_attribute){
2248
- if($attr_key == $orig_attr_key){
 
2249
  $values = explode('|',$orig_product_attribute['value']);
2250
  foreach($values as $key_id => $value){
2251
- if($value == $attribute){
2252
  $attr_key_id = $key_id;
2253
  }
2254
  }
@@ -2257,10 +2409,11 @@ class WCML_Products{
2257
 
2258
  $trnsl_product_attributes = get_post_meta($tr_product_id, '_product_attributes', true);
2259
  $unserialized_trnsl_product_attributes = maybe_unserialize($trnsl_product_attributes);
2260
-
2261
- $trnsl_attr_values = explode('|',$unserialized_trnsl_product_attributes[$attr_key]['value']);
 
2262
  if(isset($trnsl_attr_values[$attr_key_id])){
2263
- $cart->cart_contents[$key]['variation'][$attr_key] = $trnsl_attr_values[$attr_key_id];
2264
  }
2265
  }
2266
  }
@@ -2268,17 +2421,20 @@ class WCML_Products{
2268
  }
2269
  }else{
2270
  if(!is_null($tr_product_id)){
2271
- $price = get_post_meta($tr_product_id,'_price',true);
2272
  $cart->cart_contents[$key]['product_id'] = $tr_product_id;
2273
- $cart->cart_contents[$key]['data'] = get_product( $tr_product_id );
 
2274
  }
2275
  }
2276
 
2277
  if(!is_null($tr_product_id)){
2278
  $new_key = $woocommerce->cart->generate_cart_id( $cart->cart_contents[$key]['product_id'], $cart->cart_contents[$key]['variation_id'], $cart->cart_contents[$key]['variation'], $cart->cart_contents[$key]['data'] );
 
2279
  $new_cart_data[$new_key] = $cart->cart_contents[$key];
 
2280
  }
2281
 
 
2282
  }
2283
  $cart->cart_contents = $new_cart_data;
2284
 
@@ -2287,9 +2443,56 @@ class WCML_Products{
2287
  return $cart;
2288
  }
2289
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2290
 
2291
  function set_price_config() {
2292
- global $sitepress, $iclTranslationManagement,$sitepress_settings;
2293
 
2294
  $all_products_taxonomies = get_taxonomies(array('object_type'=>array('product')),'objects');
2295
  foreach($all_products_taxonomies as $tax_key => $tax){
@@ -2313,8 +2516,12 @@ class WCML_Products{
2313
  '_min_variation_price',
2314
  '_max_variation_regular_price',
2315
  '_max_variation_sale_price',
2316
- '_max_variation_price'
 
 
 
2317
  );
 
2318
  $save = false;
2319
  foreach ($keys as $key) {
2320
  $iclTranslationManagement->settings['custom_fields_readonly_config'][] = $key;
@@ -2323,7 +2530,20 @@ class WCML_Products{
2323
  $wpml_settings['translation-management']['custom_fields_translation'][$key] = 1;
2324
  $save = true;
2325
  }
 
 
 
 
 
 
 
 
 
 
 
 
2326
  }
 
2327
  if ($save) {
2328
  $sitepress->save_settings($wpml_settings);
2329
  }
@@ -2335,4 +2555,12 @@ class WCML_Products{
2335
  $sitepress->set_element_language_details($new_id, 'post_' . $post->post_type, false, $sitepress->get_current_language());
2336
  }
2337
 
 
 
 
 
 
 
 
 
2338
  }
12
  add_action('init', array($this, 'wc_cart_widget_actions'));
13
  add_action('init', array($this, 'set_price_config'), 16); // After TM parses wpml-config.xml
14
 
15
+ //add action for coupons data from WC_Coupon construct
16
+ add_action('woocommerce_coupon_loaded',array($this,'wcml_coupon_loaded'));
17
  }
18
 
19
  function init(){
20
 
21
  if(is_admin()){
22
  add_action('wp_ajax_wcml_update_product', array($this,'update_product_actions'));
23
+ $this->check_currency_ajax_actions();
24
 
25
  add_filter('wpml_post_edit_page_link_to_translation',array($this,'_filter_link_to_translation'));
26
  add_action('admin_init', array($this, 'restrict_admin_with_redirect'));
53
  add_filter('woocommerce_json_search_found_products', array($this, 'filter_found_products_by_language'));
54
  }
55
  add_action('woocommerce_email',array($this,'wcml_refresh_text_domain'));
56
+ add_action('wp_ajax_woocommerce_update_shipping_method',array($this,'wcml_refresh_text_domain'));
57
+ add_action('wp_ajax_nopriv_woocommerce_update_shipping_method',array($this,'wcml_refresh_text_domain'));
58
  add_filter('wpml_link_to_translation',array($this,'_filter_link_to_translation'));
59
 
60
  add_filter('woocommerce_upsell_crosssell_search_products', array($this, 'filter_woocommerce_upsell_crosssell_posts_by_language'));
85
  // Hooks for translating product attribute values
86
  add_filter('woocommerce_variation_option_name', array($this, 'translate_variation_term_name'));
87
  add_filter('woocommerce_attribute', array($this, 'translate_attribute_terms'));
88
+ add_action('wp_ajax_woocommerce_remove_variation', array($this,'remove_variation_ajax'),9);
 
 
 
 
 
 
89
  //WooCommerce subscription
90
  add_filter('woocommerce_users_subscriptions',array($this, 'woocommerce_users_subscriptions'),10,2);
91
 
265
  switch ($action){
266
  case 'duplicate':
267
  if($language['code'] != $default_language){
268
+ $trid = $sitepress->get_element_trid( $product_id, 'post_' . get_post_type($product_id) );
269
+ //use query because icl_object_id returned null
270
+ $tr_product_id = $wpdb->get_var($wpdb->prepare("
271
+ SELECT element_id FROM {$wpdb->prefix}icl_translations WHERE trid=%d AND language_code='%s'
272
+ ", $trid, $language['code']));
273
+
274
+ if(!($tr_product_id)){
275
  break;
276
  }
277
 
567
  // synchronize post variations
568
  $this->sync_product_variations($original_product_id, $tr_product_id, $language, $data);
569
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
570
  //save images texts
571
  if(isset($data['images'])){
572
  foreach($data['images'] as $key=>$image){
585
 
586
 
587
  $translations = $sitepress->get_element_translations($product_trid,'post_product');
588
+ if(ob_get_length()){
589
  ob_clean();
590
+ }
591
  ob_start();
592
  $return = array();
593
 
602
 
603
  $is_variable_product = $this->is_variable_product($original_product_id);
604
 
605
+ if($is_variable_product && !$woocommerce_wpml->settings['file_path_sync'] && $woocommerce_wpml->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT){
 
606
  ob_start();
607
  $this->product_variations_box($tr_product_id,$language);
608
  $return['variations'][$language] = ob_get_clean();
609
  }
 
610
 
611
  // no longer a duplicate
612
  if(!empty($data['end_duplication'][$original_product_id][$language])){
674
  $settings = $sitepress->get_settings();
675
  $lang = $sitepress->get_language_for_element($trnsl_product_id,'post_product');
676
 
677
+ $all_meta = get_post_custom($original_product_id);
678
 
679
  unset($all_meta['_thumbnail_id']);
680
 
683
  }
684
 
685
  foreach ($all_meta as $key => $meta) {
686
+ if(isset($settings['translation-management']['custom_fields_translation'][$key]) && $settings['translation-management']['custom_fields_translation'][$key] == 0){
687
+ continue;
688
+ }
689
  foreach ($meta as $meta_value) {
690
+ $meta_value = maybe_unserialize($meta_value);
691
  if($data){
692
  if(isset($data[$key.'_'.$lang]) && isset($settings['translation-management']['custom_fields_translation'][$key]) && $settings['translation-management']['custom_fields_translation'][$key] == 2){
693
  if($key == '_file_paths'){
700
  }else{
701
  $meta_value = $data[$key.'_'.$lang];
702
  }
 
 
 
 
703
  }
704
+
705
  if(isset($data['regular_price_'.$lang]) && isset($data['sale_price_'.$lang]) && $product_type == 'variable'){
706
  switch($key){
707
  case '_min_variation_sale_price':
755
  }
756
  }
757
 
758
+ $meta_value = apply_filters('wcml_meta_value_before_add',$meta_value,$key);
759
  if($add){
760
  add_post_meta($trnsl_product_id, $key, $meta_value, true);
761
  }else{
762
  update_post_meta($trnsl_product_id,$key,$meta_value);
763
  }
764
  }else{
765
+ $meta_value = apply_filters('wcml_meta_value_before_add',$meta_value,$key);
766
+ update_post_meta($trnsl_product_id, $key, $meta_value);
767
  }
768
  }
769
  }
770
+
771
+ do_action('wcml_after_duplicate_product_post_meta',$original_product_id, $trnsl_product_id, $data);
772
  }
773
 
774
  function sync_product_gallery($product_id){
799
 
800
  function get_translation_flags($active_languages,$default_language,$slang = false){
801
  foreach($active_languages as $language){
802
+ if ($default_language != $language['code'] && (($slang && $slang == $language['code']) || !$slang) && (current_user_can('wpml_manage_woocommerce_multilingual') || wpml_check_user_is_translator($default_language,$language['code'])) && (!isset($_POST['translation_status_lang']) || (isset($_POST['translation_status_lang']) && ($_POST['translation_status_lang'] == $language['code']) || $_POST['translation_status_lang']==''))){
803
  echo '<img src="'. ICL_PLUGIN_URL .'/res/flags/'. $language['code'] .'.png" width="18" height="12" class="flag_img" />';
804
  }
805
  }
810
  global $wpdb;
811
 
812
  foreach ($active_languages as $language) {
813
+ if ($default_language != $language['code'] && (($slang && $slang == $language['code']) || !$slang) && (current_user_can('wpml_manage_woocommerce_multilingual') || wpml_check_user_is_translator($default_language,$language['code'])) && (!isset($_POST['translation_status_lang']) || (isset($_POST['translation_status_lang']) && ($_POST['translation_status_lang'] == $language['code']) || $_POST['translation_status_lang']==''))) {
814
  if (isset($product_translations[$language['code']])) {
815
  $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));
816
  if(!$tr_status){
853
  WHERE post_status IN ('publish','private') AND post_type = 'product_variation' AND post_parent = %d ORDER BY ID",$product_id));
854
 
855
  $duplicated_post_variation_ids = array();
856
+ $min_max_prices = array();
857
  foreach($get_all_post_variations as $k => $post_data){
858
  $duplicated_post_variation_ids[] = $post_data->ID;
859
  }
860
 
861
+ foreach($min_max_prices as $price_key=>$min_max_price){
862
+ update_post_meta($product_id,$price_key,$min_max_price);
863
+ }
864
+
865
  foreach ($get_all_post_variations as $k => $post_data) {
866
 
867
  // Find if this has already been duplicated
1018
  foreach($values_arrs as $key=>$value){
1019
  $value = str_replace(' ','-',trim($value));
1020
  $value = lcfirst($value);
1021
+ $meta_value = urldecode($meta_value);
1022
  if($value == $meta_value && isset($values_arrs_tr[$key])){
1023
  $meta_value = trim($values_arrs_tr[$key]);
1024
  $meta_value = str_replace(' ','-',$meta_value);
1355
  return;
1356
  }
1357
 
1358
+ //save custom prices
1359
+ if(isset( $_REQUEST['_wcml_custom_prices'][$post_id]) && isset( $_REQUEST['_wcml_custom_prices_nonce'] ) && wp_verify_nonce( $_REQUEST['_wcml_custom_prices_nonce'], 'wcml_save_custom_prices' )){
1360
+
1361
+ update_post_meta($post_id,'_wcml_custom_prices_status',$_REQUEST['_wcml_custom_prices'][$post_id]);
1362
+
1363
+ $currencies = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "icl_currencies ORDER BY `id` ASC", OBJECT);
1364
+
1365
+ if($_REQUEST['_wcml_custom_prices'][$post_id] == 1){
1366
+ foreach($currencies as $currency){
1367
+ $sale_price = $_REQUEST['_custom_sale_price'][$currency->code];
1368
+ $regular_price = $_REQUEST['_custom_regular_price'][$currency->code];
1369
+
1370
+ $date_from = strtotime($_REQUEST['_custom_sale_price_dates_from'][$currency->code]);
1371
+ $date_to = strtotime($_REQUEST['_custom_sale_price_dates_to'][$currency->code]);
1372
+ $schedule = $_REQUEST['_wcml_schedule'][$currency->code];
1373
+
1374
+ $pr_price = $this->update_custom_prices($post_id,$regular_price,$sale_price,$schedule,$date_from,$date_to,$currency->code);
1375
+ }
1376
+ }
1377
+ }
1378
+
1379
  // If we reach this point, we go ahead with sync.
1380
  // Remove filter to avoid double sync
1381
  remove_action('save_post', array($this, 'sync_post_action'), 11, 2);
1467
  $this->sync_product_variations($duplicated_post_id,$post_id,$lang);
1468
 
1469
  }
1470
+
1471
+ $this->sync_product_variations_custom_prices($duplicated_post_id);
1472
+ }
1473
+
1474
+ function update_custom_prices($post_id,$regular_price,$sale_price,$schedule,$date_from,$date_to,$code){
1475
+ $price = '';
1476
+ update_post_meta($post_id,'_regular_price_'.$code,$regular_price);
1477
+ update_post_meta($post_id,'_sale_price_'.$code,$sale_price);
1478
+
1479
+ // Dates
1480
+ update_post_meta($post_id,'_wcml_schedule_'.$code,$schedule);
1481
+ if ( $date_from )
1482
+ update_post_meta( $post_id, '_sale_price_dates_from_'.$code, $date_from );
1483
+ else
1484
+ update_post_meta( $post_id, '_sale_price_dates_from_'.$code, '' );
1485
+
1486
+ if ( $date_to )
1487
+ update_post_meta( $post_id, '_sale_price_dates_to_'.$code, $date_to );
1488
+ else
1489
+ update_post_meta( $post_id, '_sale_price_dates_to_'.$code, '' );
1490
+
1491
+ if ( $date_to && ! $date_from )
1492
+ update_post_meta( $post_id, '_sale_price_dates_from_'.$code, strtotime( 'NOW', current_time( 'timestamp' ) ) );
1493
+
1494
+ // Update price if on sale
1495
+ if ( $sale_price != '' && $date_to == '' && $date_from == '' ){
1496
+ $price = stripslashes( $sale_price );
1497
+ update_post_meta( $post_id, '_price_'.$code, stripslashes( $sale_price ) );
1498
+ }else{
1499
+ $price = stripslashes( $regular_price );
1500
+ update_post_meta( $post_id, '_price_'.$code, stripslashes( $regular_price ) );
1501
+ }
1502
+
1503
+ if ( $sale_price != '' && $date_from < strtotime( 'NOW', current_time( 'timestamp' ) ) ){
1504
+ update_post_meta( $post_id, '_price_'.$code, stripslashes($sale_price) );
1505
+ $price = stripslashes( $sale_price );
1506
+ }
1507
+
1508
+ if ( $date_to < strtotime( 'NOW', current_time( 'timestamp' ) ) ) {
1509
+ update_post_meta( $post_id, '_price_'.$code, stripslashes($regular_price) );
1510
+ $price = stripslashes( $regular_price );
1511
+ update_post_meta( $post_id, '_sale_price_dates_from_'.$code, '');
1512
+ update_post_meta( $post_id, '_sale_price_dates_to_'.$code, '');
1513
+ }
1514
+
1515
+ return $price;
1516
+ }
1517
+
1518
+ function sync_product_variations_custom_prices($product_id){
1519
+ global $wpdb;
1520
+ $is_variable_product = $this->is_variable_product($product_id);
1521
+
1522
+ if($is_variable_product){
1523
+ $get_all_post_variations = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->posts
1524
+ WHERE post_status IN ('publish','private') AND post_type = 'product_variation' AND post_parent = %d ORDER BY ID",$product_id));
1525
+
1526
+ $duplicated_post_variation_ids = array();
1527
+ $min_max_prices = array();
1528
+ foreach($get_all_post_variations as $k => $post_data){
1529
+ $duplicated_post_variation_ids[] = $post_data->ID;
1530
+
1531
+ //save custom prices for variation
1532
+ if(isset( $_REQUEST['_wcml_custom_prices'][$post_data->ID]) && isset( $_REQUEST['_wcml_custom_prices_nonce'] ) && wp_verify_nonce( $_REQUEST['_wcml_custom_prices_nonce'], 'wcml_save_custom_prices' )){
1533
+
1534
+ update_post_meta($post_data->ID,'_wcml_custom_prices_status',$_REQUEST['_wcml_custom_prices'][$post_data->ID]);
1535
+
1536
+ $currencies = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "icl_currencies ORDER BY `id` ASC", OBJECT);
1537
+
1538
+ if($_REQUEST['_wcml_custom_prices'][$post_data->ID] == 1){
1539
+ foreach($currencies as $currency){
1540
+ $sale_price = $_REQUEST['_custom_variation_sale_price'][$currency->code][$post_data->ID];
1541
+ $regular_price = $_REQUEST['_custom_variation_regular_price'][$currency->code][$post_data->ID];
1542
+
1543
+ $date_from = strtotime($_REQUEST['_custom_sale_price_dates_from'][$currency->code][$post_data->ID]);
1544
+ $date_to = strtotime($_REQUEST['_custom_sale_price_dates_to'][$currency->code][$post_data->ID]);
1545
+ $schedule = $_REQUEST['_wcml_schedule'][$currency->code][$post_data->ID];
1546
+
1547
+ $price = $this->update_custom_prices($post_data->ID,$regular_price,$sale_price,$schedule,$date_from,$date_to,$currency->code);
1548
+
1549
+ if(!isset($min_max_prices['_min_variation_price_'.$currency->code]) || ($price && $price < $min_max_prices['_min_variation_price_'.$currency->code])){
1550
+ $min_max_prices['_min_variation_price_'.$currency->code] = $price;
1551
+ $min_max_prices['_min_price_variation_id_'.$currency->code] = $post_data->ID;
1552
+ }
1553
+
1554
+ if(!isset($min_max_prices['_max_variation_price_'.$currency->code]) || ($price && $price > $min_max_prices['_max_variation_price_'.$currency->code])){
1555
+ $min_max_prices['_max_variation_price_'.$currency->code] = $price;
1556
+ $min_max_prices['_max_price_variation_id_'.$currency->code] = $post_data->ID;
1557
+ }
1558
+
1559
+ if(!isset($min_max_prices['_min_variation_regular_price_'.$currency->code]) || ($regular_price && $regular_price < $min_max_prices['_min_variation_regular_price_'.$currency->code])){
1560
+ $min_max_prices['_min_variation_regular_price_'.$currency->code] = $regular_price;
1561
+ }
1562
+
1563
+ if(!isset($min_max_prices['_max_variation_regular_price_'.$currency->code]) || ($regular_price && $regular_price > $min_max_prices['_max_variation_regular_price_'.$currency->code])){
1564
+ $min_max_prices['_max_variation_regular_price_'.$currency->code] = $regular_price;
1565
+ }
1566
+
1567
+ if(!isset($min_max_prices['_min_variation_sale_price_'.$currency->code]) || ($sale_price && $sale_price < $min_max_prices['_min_variation_sale_price_'.$currency->code])){
1568
+ $min_max_prices['_min_variation_sale_price_'.$currency->code] = $sale_price;
1569
+ }
1570
+
1571
+ if(!isset($min_max_prices['_max_variation_sale_price_'.$currency->code]) || ($sale_price && $sale_price > $min_max_prices['_max_variation_sale_price_'.$currency->code])){
1572
+ $min_max_prices['_max_variation_sale_price_'.$currency->code] = $sale_price;
1573
+ }
1574
+ }
1575
+ }
1576
+ }
1577
+ }
1578
+ }
1579
  }
1580
 
1581
 
1668
  $contents[] = 'content';
1669
  $contents[] = 'excerpt';
1670
  $contents[] = 'images';
1671
+
1672
  if(!isset($product_type)){
1673
  foreach(wp_get_post_terms($product_id, 'product_type', array("fields" => "names")) as $type){
1674
  $product_type = $type;
1675
  }
1676
  }
1677
+
1678
+ if(!$woocommerce_wpml->settings['file_path_sync'] && $product_type == 'variable'){
1679
+ $contents[] = 'variations';
 
 
 
1680
  }
1681
 
1682
  global $sitepress;
1688
  if(in_array($meta_key,$this->not_display_fields_for_variables_product)){
1689
  continue;
1690
  }
1691
+ }else{
1692
+ $exception = apply_filters('wcml_product_content_exception',true,$product_id);
1693
+ if($exception){
1694
+ continue;
1695
  }
1696
  }
1697
+ $contents[] = $meta_key;
1698
+ }
1699
  }
1700
 
1701
  return $contents;
1710
  $contents[] = __('Content','wpml-wcml');
1711
  $contents[] = __('Excerpt','wpml-wcml');
1712
  $contents[] = __('Images','wpml-wcml');
1713
+
1714
  foreach(wp_get_post_terms($product_id, 'product_type', array("fields" => "names")) as $type){
1715
  $product_type = $type;
1716
  }
1717
+
1718
+ if(!$woocommerce_wpml->settings['file_path_sync'] && $product_type == 'variable'){
1719
+ $contents[] = __('Variations','wpml-wcml');
 
 
 
1720
  }
1721
 
1722
  global $sitepress,$wpseo_metabox;
1736
  }
1737
  }
1738
 
1739
+
1740
+ }else{
1741
+ $exception = apply_filters('wcml_product_content_exception',true,$product_id);
1742
+ if($exception){
1743
+ continue;
1744
+ }
1745
+
1746
+ }
1747
+
1748
  $custom_key_label = str_replace('_',' ',$meta_key);
1749
  $contents[] = trim($custom_key_label[0]) ? ucfirst($custom_key_label) : ucfirst(substr($custom_key_label,1));
1750
+
1751
  }
1752
  }
1753
 
1899
 
1900
 
1901
  foreach($variations as $variation){
1902
+
 
 
 
 
1903
  $variation_values = $wpdb->get_results($wpdb->prepare("SELECT meta_key,meta_value FROM $wpdb->postmeta WHERE (meta_key = %s OR meta_key LIKE 'attribute_%%') AND post_id = %d",$var_key,$variation->ID));
1904
  $variables = array();
1905
  $variables['value'] = '';
1924
  }
1925
 
1926
  if(!$term_name){
1927
+ $orig_variation_id = icl_object_id($variation->ID,'product_variation',true,$sitepress->get_default_language());
1928
+
1929
+ if(get_post_meta($orig_variation_id,$var_key,true) == ''){
1930
+ if(substr($tr_product_attr[$attribute]['name'], 0, 3) == 'pa_'){
1931
+ $attr_name = str_replace('pa_','',$tr_product_attr[$attribute]['name']);
1932
+ $attr_name = str_replace('_','',$attr_name);
1933
+ }else{
1934
+ $attr_name = str_replace('_','',$tr_product_attr[$attribute]['name']);
1935
+ }
1936
+
1937
+ $label = sprintf(__('Any %s','wpml-wcml'),$attr_name);
1938
+ $variables['label'] .= $label.' & ';
1939
+ continue;
1940
+ }else{
1941
  $label = __('Please translate all attributes','wpml-wcml');
1942
  $variables['label'] .= $label.' & ';
1943
  $variables['not_translated'] = true;
1944
  continue;
1945
  }
1946
  }
1947
+ }
1948
  $variables['label'] .= urldecode($term_name).' & ';
1949
  }
1950
  }
1951
 
1952
  $variables['label'] = substr($variables['label'],0,strlen($variables['label'])-3);
1953
  $variables_all[$variation->ID] = $variables;
1954
+
1955
  }
1956
  return $variables_all;
1957
  }
1967
  $template_data = array();
1968
  $template_data['all_variations_ids'] = array();
1969
 
1970
+ $trn_product_id = null;
1971
  if ($default_language != $lang) {
1972
  $trn_product_id = icl_object_id($product_id, 'product', false, $lang);
1973
  }
1978
  $template_data['original'] = false;
1979
  }
1980
 
 
 
 
 
 
 
1981
  //file path
1982
  if (!$woocommerce_wpml->settings['file_path_sync']) {
1983
  global $wpdb;
1984
  $is_downloable = $wpdb->get_results($wpdb->prepare("SELECT pm.meta_value FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS pm ON p.id=pm.post_id WHERE p.post_parent = %d AND p.post_type = 'product_variation' AND pm.meta_key='_downloadable' AND pm.meta_value = 'yes'", $product_id));
1985
+
1986
  $template_data['all_file_paths'] = $this->get_product_content_translation($product_id, 'variations_file_paths', $lang);
1987
+
1988
  }
1989
 
1990
  $is_product_has_variations = $wpdb->get_var($wpdb->prepare("SELECT count(id) FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'product_variation'",$product_id));
1991
 
1992
+ foreach ($template_data['all_file_paths'] as $key => $price) {
 
 
 
1993
  $template_data['all_variations_ids'][] = $key;
1994
  }
1995
+
1996
+ if (!$is_product_has_variations){
1997
+ $template_data['empty_variations'] = true;
1998
+ } elseif($default_language != $lang && is_null($trn_product_id)){
1999
  $template_data['empty_translation'] = true;
2000
+ }elseif (!$is_downloable){
2001
+ $template_data['not_downloaded'] = true;
2002
  }
2003
 
2004
  include WCML_PLUGIN_PATH . '/menu/sub/variations_box.php';
2040
  } else {
2041
  $template_data['empty_translation'] = true;
2042
  }
2043
+ include WCML_PLUGIN_PATH . '/menu/sub/images-box.php';
2044
+ }
2045
+
2046
+ function custom_box($product_id,$product_content,$trn_contents,$lang,$lang_name,$is_duplicate_product){
2047
+ global $sitepress;
2048
+ $default_language = $sitepress->get_default_language();
2049
+ $tr_product_id = icl_object_id($product_id, 'product', false, $lang);
2050
+ $template_data = array();
2051
+
2052
+ $template_data['product_id'] = $product_id;
2053
+ $template_data['tr_product_id'] = $tr_product_id;
2054
+ $template_data['product_content'] = $product_content;
2055
+ $template_data['trn_contents'] = $trn_contents;
2056
+ $template_data['lang'] = $lang;
2057
+ $template_data['lang_name'] = $lang_name;
2058
+ $template_data['is_duplicate_product'] = $is_duplicate_product;
2059
+
2060
+ if($default_language == $lang){
2061
+ $template_data['original'] = true;
2062
+ }else{
2063
+ $template_data['original'] = false;
2064
+ }
2065
+
2066
+ if($tr_product_id){
2067
+ $template_data['translation_exist'] = true;
2068
+ }else{
2069
+ $template_data['translation_exist'] = false;
2070
+ }
2071
+
2072
+ $custom_box_html = apply_filters('wcml_custom_box_html','',$template_data);
2073
+
2074
+ include WCML_PLUGIN_PATH . '/menu/sub/custom-box.php';
2075
+
2076
  }
2077
 
2078
+
2079
  function product_images_ids($product_id){
2080
  global $wpdb;
2081
  $product_images_ids = array();
2163
  $original_slug = $original_term->slug;
2164
  //get variations with original slug
2165
 
2166
+ $variations = $wpdb->get_results($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key=%s AND meta_value = %s",'attribute_'.$taxonomy,$original_slug));
2167
 
2168
  foreach($variations as $variation){
2169
  //update taxonomy in translation of variation
2299
  }
2300
  }
2301
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2302
  function icl_make_duplicate($master_post_id, $lang, $postarr, $id){
2303
  if(get_post_type($master_post_id)=='product'){
2304
  $this->product_test_content_action(array($master_post_id), 'duplicate', $lang, true);
2369
 
2370
  foreach($cart->cart_contents as $key=>$cart_item){
2371
  $tr_product_id = icl_object_id($cart_item['product_id'],'product',false,$current_language);
2372
+
2373
  if(isset($cart->cart_contents[$key]['variation_id']) && $cart->cart_contents[$key]['variation_id']){
2374
  $tr_variation_id = icl_object_id($cart_item['variation_id'],'product_variation',false,$current_language);
2375
  if(!is_null($tr_variation_id)){
 
2376
  $cart->cart_contents[$key]['product_id'] = $tr_product_id;
2377
  $cart->cart_contents[$key]['variation_id'] = $tr_variation_id;
2378
+ $cart->cart_contents[$key]['data']->id = $tr_product_id;
2379
+ $cart->cart_contents[$key]['data']->post = get_post( $tr_product_id );
2380
  if($cart_item['variation']){
2381
 
2382
  foreach($cart_item['variation'] as $attr_key=>$attribute){
2383
+ if(version_compare(preg_replace('#-(.+)$#', '', $woocommerce->version), '2.1', '<')){
2384
+ $taxonomy = $attr_key;
2385
+ }else{
2386
+ //delete 'attribute_' at the beginning
2387
+ $taxonomy = substr($attr_key, 10, strlen($attr_key)-1 );
2388
+ }
2389
+
2390
+ if(taxonomy_exists($taxonomy)){
2391
+ $term = get_term_by('slug',$attribute,$taxonomy);
2392
+ $trnsl_term_id = icl_object_id($term->term_id,$taxonomy,true,$current_language);
2393
 
2394
+ $cart->cart_contents[$key]['variation'][$attr_key] = get_term($trnsl_term_id,$taxonomy)->slug;
2395
  }else{
2396
  $orig_product_attributes = get_post_meta($cart_item['product_id'], '_product_attributes', true);
2397
  $unserialized_orig_product_attributes = maybe_unserialize($orig_product_attributes);
2398
  foreach($unserialized_orig_product_attributes as $orig_attr_key => $orig_product_attribute){
2399
+ $orig_attr_key = urldecode($orig_attr_key);
2400
+ if($taxonomy == $orig_attr_key){
2401
  $values = explode('|',$orig_product_attribute['value']);
2402
  foreach($values as $key_id => $value){
2403
+ if(trim($value," ") == $attribute){
2404
  $attr_key_id = $key_id;
2405
  }
2406
  }
2409
 
2410
  $trnsl_product_attributes = get_post_meta($tr_product_id, '_product_attributes', true);
2411
  $unserialized_trnsl_product_attributes = maybe_unserialize($trnsl_product_attributes);
2412
+ $taxonomy = sanitize_title($taxonomy);
2413
+ $trnsl_attr_values = explode('|',$unserialized_trnsl_product_attributes[$taxonomy]['value']);
2414
+
2415
  if(isset($trnsl_attr_values[$attr_key_id])){
2416
+ $cart->cart_contents[$key]['variation'][$attr_key] = trim($trnsl_attr_values[$attr_key_id]);
2417
  }
2418
  }
2419
  }
2421
  }
2422
  }else{
2423
  if(!is_null($tr_product_id)){
 
2424
  $cart->cart_contents[$key]['product_id'] = $tr_product_id;
2425
+ $cart->cart_contents[$key]['data']->id = $tr_product_id;
2426
+ $cart->cart_contents[$key]['data']->post = get_post( $tr_product_id );
2427
  }
2428
  }
2429
 
2430
  if(!is_null($tr_product_id)){
2431
  $new_key = $woocommerce->cart->generate_cart_id( $cart->cart_contents[$key]['product_id'], $cart->cart_contents[$key]['variation_id'], $cart->cart_contents[$key]['variation'], $cart->cart_contents[$key]['data'] );
2432
+ $cart->cart_contents = apply_filters('wcml_update_cart_contents_lang_switch',$cart->cart_contents,$new_cart_data,$key, $new_key,$current_language);
2433
  $new_cart_data[$new_key] = $cart->cart_contents[$key];
2434
+
2435
  }
2436
 
2437
+ $new_cart_data = apply_filters('wcml_update_cart_lang_switch', $new_cart_data, $cart->cart_contents,$key, $new_key);
2438
  }
2439
  $cart->cart_contents = $new_cart_data;
2440
 
2443
  return $cart;
2444
  }
2445
 
2446
+ function wcml_coupon_loaded($coupons_data){
2447
+ global $sitepress;
2448
+
2449
+ $product_ids = array();
2450
+ $exclude_product_ids = array();
2451
+ $product_categories_ids = array();
2452
+ $exclude_product_categories_ids = array();
2453
+
2454
+ foreach($coupons_data->product_ids as $prod_id){
2455
+ $trid = $sitepress->get_element_trid($prod_id,'post_product');
2456
+ $translations = $sitepress->get_element_translations($trid,'post_product');
2457
+ foreach($translations as $translation){
2458
+ $product_ids[] = $translation->element_id;
2459
+ }
2460
+ }
2461
+ foreach($coupons_data->exclude_product_ids as $prod_id){
2462
+ $trid = $sitepress->get_element_trid($prod_id,'post_product');
2463
+ $translations = $sitepress->get_element_translations($trid,'post_product');
2464
+ foreach($translations as $translation){
2465
+ $exclude_product_ids[] = $translation->element_id;
2466
+ }
2467
+ }
2468
+
2469
+ foreach($coupons_data->product_categories as $cat_id){
2470
+ $trid = $sitepress->get_element_trid($cat_id,'tax_product_cat');
2471
+ $translations = $sitepress->get_element_translations($trid,'tax_product_cat');
2472
+ foreach($translations as $translation){
2473
+ $product_categories_ids[] = $translation->element_id;
2474
+ }
2475
+ }
2476
+
2477
+ foreach($coupons_data->exclude_product_categories as $cat_id){
2478
+ $trid = $sitepress->get_element_trid($cat_id,'tax_product_cat');
2479
+ $translations = $sitepress->get_element_translations($trid,'tax_product_cat');
2480
+ foreach($translations as $translation){
2481
+ $exclude_product_categories_ids[] = $translation->element_id;
2482
+ }
2483
+ }
2484
+
2485
+ $coupons_data->product_ids = $product_ids;
2486
+ $coupons_data->exclude_product_ids = $exclude_product_ids;
2487
+ $coupons_data->product_categories = $product_categories_ids;
2488
+ $coupons_data->exclude_product_categories = $exclude_product_categories_ids;
2489
+
2490
+ return $coupons_data;
2491
+ }
2492
+
2493
 
2494
  function set_price_config() {
2495
+ global $sitepress, $iclTranslationManagement,$sitepress_settings,$wpdb;
2496
 
2497
  $all_products_taxonomies = get_taxonomies(array('object_type'=>array('product')),'objects');
2498
  foreach($all_products_taxonomies as $tax_key => $tax){
2516
  '_min_variation_price',
2517
  '_max_variation_regular_price',
2518
  '_max_variation_sale_price',
2519
+ '_max_variation_price',
2520
+ '_sale_price_dates_from',
2521
+ '_sale_price_dates_to',
2522
+ '_wcml_schedule'
2523
  );
2524
+
2525
  $save = false;
2526
  foreach ($keys as $key) {
2527
  $iclTranslationManagement->settings['custom_fields_readonly_config'][] = $key;
2530
  $wpml_settings['translation-management']['custom_fields_translation'][$key] = 1;
2531
  $save = true;
2532
  }
2533
+
2534
+ $exists_codes = $wpdb->get_col("SELECT code FROM " . $wpdb->prefix . "icl_currencies ORDER BY `id` ASC");
2535
+ foreach($exists_codes as $code){
2536
+ $new_key = $key.'_'.$code;
2537
+ $iclTranslationManagement->settings['custom_fields_readonly_config'][] = $new_key;
2538
+ if (!isset($sitepress_settings['translation-management']['custom_fields_translation'][$new_key]) ||
2539
+ $wpml_settings['translation-management']['custom_fields_translation'][$new_key] != 0) {
2540
+ $wpml_settings['translation-management']['custom_fields_translation'][$new_key] = 0;
2541
+ $save = true;
2542
+ }
2543
+ }
2544
+
2545
  }
2546
+
2547
  if ($save) {
2548
  $sitepress->save_settings($wpml_settings);
2549
  }
2555
  $sitepress->set_element_language_details($new_id, 'post_' . $post->post_type, false, $sitepress->get_current_language());
2556
  }
2557
 
2558
+ function check_currency_ajax_actions(){
2559
+ global $woocommerce_wpml;
2560
+ if($woocommerce_wpml->settings['enable_multi_currency'] != WCML_MULTI_CURRENCIES_INDEPENDENT){
2561
+ $WCML_WC_MultiCurrency = new WCML_WC_MultiCurrency;
2562
+ $WCML_WC_MultiCurrency->init_ajax_currencies_actions();
2563
+ }
2564
+ }
2565
+
2566
  }
inc/store-pages.class.php CHANGED
@@ -78,7 +78,7 @@ class WCML_Store_Pages{
78
  return;
79
 
80
  $front_page_id = get_option('page_on_front');
81
- $shop_page_id = get_option('woocommerce_shop_page_id');
82
  $shop_page = get_post( woocommerce_get_page_id('shop') );
83
 
84
  if (!empty($shop_page) && $q->get('page_id') !== $front_page_id && $shop_page_id == $q->get('page_id')) {
@@ -170,20 +170,14 @@ class WCML_Store_Pages{
170
  if ($miss_lang) {
171
  $wp_rewrite = new WP_Rewrite();
172
  $current_language = $sitepress->get_current_language();
173
-
174
- $check_pages = array(
175
  'woocommerce_shop_page_id',
176
  'woocommerce_cart_page_id',
177
  'woocommerce_checkout_page_id',
178
- 'woocommerce_myaccount_page_id',
179
- 'woocommerce_lost_password_page_id',
180
- 'woocommerce_edit_address_page_id',
181
- 'woocommerce_view_order_page_id',
182
- 'woocommerce_change_password_page_id',
183
- 'woocommerce_logout_page_id',
184
- 'woocommerce_pay_page_id',
185
- 'woocommerce_thanks_page_id'
186
- );
187
 
188
  foreach ($miss_lang['codes'] as $mis_lang) {
189
  $args = array();
@@ -230,20 +224,12 @@ class WCML_Store_Pages{
230
  */
231
  function get_missing_store_pages() {
232
 
233
- $check_pages = array(
234
  'woocommerce_shop_page_id',
235
  'woocommerce_cart_page_id',
236
  'woocommerce_checkout_page_id',
237
- 'woocommerce_myaccount_page_id',
238
- 'woocommerce_lost_password_page_id',
239
- 'woocommerce_edit_address_page_id',
240
- 'woocommerce_view_order_page_id',
241
- 'woocommerce_change_password_page_id',
242
- 'woocommerce_logout_page_id',
243
- 'woocommerce_pay_page_id',
244
- 'woocommerce_thanks_page_id'
245
- );
246
-
247
 
248
  $missing_lang = '';
249
 
78
  return;
79
 
80
  $front_page_id = get_option('page_on_front');
81
+ $shop_page_id = woocommerce_get_page_id('shop');
82
  $shop_page = get_post( woocommerce_get_page_id('shop') );
83
 
84
  if (!empty($shop_page) && $q->get('page_id') !== $front_page_id && $shop_page_id == $q->get('page_id')) {
170
  if ($miss_lang) {
171
  $wp_rewrite = new WP_Rewrite();
172
  $current_language = $sitepress->get_current_language();
173
+
174
+ $check_pages = apply_filters('wcml_wc_installed_pages', array(
175
  'woocommerce_shop_page_id',
176
  'woocommerce_cart_page_id',
177
  'woocommerce_checkout_page_id',
178
+ 'woocommerce_myaccount_page_id'
179
+ ));
180
+
 
 
 
 
 
 
181
 
182
  foreach ($miss_lang['codes'] as $mis_lang) {
183
  $args = array();
224
  */
225
  function get_missing_store_pages() {
226
 
227
+ $check_pages = apply_filters('wcml_wc_installed_pages', array(
228
  'woocommerce_shop_page_id',
229
  'woocommerce_cart_page_id',
230
  'woocommerce_checkout_page_id',
231
+ 'woocommerce_myaccount_page_id'
232
+ ));
 
 
 
 
 
 
 
 
233
 
234
  $missing_lang = '';
235
 
inc/terms.class.php CHANGED
@@ -46,10 +46,10 @@ class WCML_Terms{
46
  add_action('admin_menu', array($this, 'admin_menu_setup'));
47
  }
48
 
 
49
  add_filter('get_the_terms',array($this,'shipping_terms'),10,3);
50
  //filter coupons terms in admin
51
  add_filter('get_terms',array($this,'filter_coupons_terms'),10,3);
52
- add_action('woocommerce_coupon_loaded',array($this,'woocommerce_coupon_loaded'));
53
  }
54
 
55
  function admin_menu_setup(){
@@ -85,14 +85,14 @@ class WCML_Terms{
85
  $value = $val;
86
 
87
  }else{
88
-
89
  $taxonomies = array('product_cat', 'product_tag');
90
 
91
  foreach($taxonomies as $taxonomy ){
92
 
93
  $taxonomy_obj = get_taxonomy($taxonomy);
94
  $slug = isset($taxonomy_obj->rewrite['slug']) ? trim($taxonomy_obj->rewrite['slug'],'/') : false;
95
-
96
  if($slug && $sitepress->get_current_language() != $strings_language){
97
 
98
  $slug_translation = $wpdb->get_var($wpdb->prepare("
@@ -137,6 +137,54 @@ class WCML_Terms{
137
 
138
  }
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  wp_cache_add($cache_key, $value);
141
 
142
  }
@@ -158,7 +206,14 @@ class WCML_Terms{
158
  global $sitepress_settings, $sitepress, $wp_rewrite, $wpdb;
159
  static $no_recursion_flag;
160
 
161
- if(($taxonomy == 'product_cat' || $taxonomy == 'product_tag') && !$no_recursion_flag){
 
 
 
 
 
 
 
162
 
163
  $cache_key = 'termlink#' . $taxonomy .'#' . $term->term_id;
164
  if($link = wp_cache_get($cache_key, 'terms')){
@@ -174,7 +229,7 @@ class WCML_Terms{
174
  if(!empty($term_language)){
175
 
176
  $permalinks = get_option( 'woocommerce_permalinks' );
177
- $base = $taxonomy == 'product_tag' ? $permalinks['tag_base'] : $permalinks['category_base'];
178
 
179
  if($base === ''){
180
  // handle exception - default woocommerce category and tag bases used
@@ -203,7 +258,9 @@ class WCML_Terms{
203
 
204
  }
205
  }else{
206
-
 
 
207
  if($term_language->language_code != $strings_language){
208
  $base_translated = $wpdb->get_var("
209
  SELECT t.value
@@ -211,9 +268,10 @@ class WCML_Terms{
211
  JOIN {$wpdb->prefix}icl_string_translations t ON t.string_id = s.id
212
  WHERE s.value='". esc_sql($base)."'
213
  AND s.language = '{$strings_language}'
214
- AND s.name LIKE 'URL {$taxonomy} slug:%'
215
  AND t.language = '{$term_language->language_code}'
216
  ");
 
217
  }else{
218
  $base_translated = $base;
219
  }
@@ -298,7 +356,7 @@ class WCML_Terms{
298
  function sync_term_order_globally() {
299
  //syncs the term order of any taxonomy in $wpdb->prefix.'woocommerce_attribute_taxonomies'
300
  //use it when term orderings have become unsynched, e.g. before WCML 3.3.
301
- global $sitepress, $wpdb, $woocommerce, $woocommerce_wpml;
302
 
303
  if(!defined('WOOCOMMERCE_VERSION')){
304
  return;
@@ -308,7 +366,7 @@ class WCML_Terms{
308
  $lang = $sitepress->get_default_language();
309
  $sitepress->switch_lang($lang);
310
 
311
- $taxes = $woocommerce->get_attribute_taxonomies(); //="SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies"
312
 
313
  if ($taxes) foreach ($taxes as $woo_tax) {
314
  $tax = 'pa_'.$woo_tax->attribute_name;
@@ -546,15 +604,13 @@ class WCML_Terms{
546
  }
547
 
548
  static function set_flag_for_variation_on_attribute_update($term_id, $tt_id, $taxonomy){
549
- global $woocommerce, $woocommerce_wpml, $sitepress;
550
 
551
-
552
- $attribute_taxonomies = $woocommerce->get_attribute_taxonomies();
553
  foreach($attribute_taxonomies as $a){
554
  $attribute_taxonomies_arr[] = 'pa_' . $a->attribute_name;
555
  }
556
 
557
-
558
  if(isset( $attribute_taxonomies_arr ) && in_array($taxonomy, $attribute_taxonomies_arr)){
559
 
560
  $wcml_settings = $woocommerce_wpml->get_settings();
@@ -582,11 +638,11 @@ class WCML_Terms{
582
  }
583
 
584
  static function show_variations_sync_button($taxonomy){
585
- global $woocommerce_wpml, $woocommerce;
586
 
587
  if(is_admin() && isset($_GET['page']) && $_GET['page'] == 'wpml-wcml' && isset($_GET['tab'])){
588
  $wcml_settings = $woocommerce_wpml->get_settings();
589
- $attribute_taxonomies = $woocommerce->get_attribute_taxonomies();
590
  foreach($attribute_taxonomies as $a){
591
  $attribute_taxonomies_arr[] = 'pa_' . $a->attribute_name;
592
  }
@@ -626,12 +682,12 @@ class WCML_Terms{
626
  }
627
 
628
  static function hide_tax_sync_button_for_attributes($value){
629
- global $woocommerce_wpml, $woocommerce;
630
 
631
  if(is_admin() && isset($_GET['page']) && $_GET['page'] == 'wpml-wcml' && isset($_GET['tab'])){
632
 
633
  $wcml_settings = $woocommerce_wpml->get_settings();
634
- $attribute_taxonomies = $woocommerce->get_attribute_taxonomies();
635
  foreach($attribute_taxonomies as $a){
636
  $attribute_taxonomies_arr[] = 'pa_' . $a->attribute_name;
637
  }
@@ -766,52 +822,16 @@ class WCML_Terms{
766
  return $terms;
767
  }
768
 
769
- function woocommerce_coupon_loaded($coupons_data){
770
- global $sitepress;
771
- $default_language = $sitepress->get_default_language();
772
- $current_language = $sitepress->get_current_language();
773
-
774
- if($default_language != $current_language){
775
- $product_ids = array();
776
- $exclude_product_ids = array();
777
- $product_categories_ids = array();
778
- $exclude_product_categories_ids = array();
779
-
780
- foreach($coupons_data->product_ids as $prod_id){
781
- $trnsl_id = icl_object_id($prod_id,'product',false,$current_language);
782
- if(!is_null($trnsl_id)){
783
- $product_ids[] = $trnsl_id;
784
- }
785
- }
786
-
787
- foreach($coupons_data->exclude_product_ids as $prod_id){
788
- $trnsl_id = icl_object_id($prod_id,'product',false,$current_language);
789
- if(!is_null($trnsl_id)){
790
- $exclude_product_ids[] = $trnsl_id;
791
- }
792
- }
793
-
794
- foreach($coupons_data->product_categories as $cat_id){
795
- $trnsl_id = icl_object_id($cat_id,'product_cat',false,$current_language);
796
- if(!is_null($trnsl_id)){
797
- $product_categories_ids[] = $trnsl_id;
798
- }
799
- }
800
 
801
- foreach($coupons_data->exclude_product_categories as $cat_id){
802
- $trnsl_id = icl_object_id($cat_id,'product_cat',false,$current_language);
803
- if(!is_null($trnsl_id)){
804
- $exclude_product_categories_ids[] = $trnsl_id;
805
- }
806
  }
807
-
808
- $coupons_data->product_ids = $product_ids;
809
- $coupons_data->exclude_product_ids = $exclude_product_ids;
810
- $coupons_data->product_categories = $product_categories_ids;
811
- $coupons_data->exclude_product_categories = $exclude_product_categories_ids;
812
  }
813
 
814
- return $coupons_data;
815
  }
816
 
817
  }
46
  add_action('admin_menu', array($this, 'admin_menu_setup'));
47
  }
48
 
49
+ add_action('delete_term',array($this, 'wcml_delete_term'),10,4);
50
  add_filter('get_the_terms',array($this,'shipping_terms'),10,3);
51
  //filter coupons terms in admin
52
  add_filter('get_terms',array($this,'filter_coupons_terms'),10,3);
 
53
  }
54
 
55
  function admin_menu_setup(){
85
  $value = $val;
86
 
87
  }else{
88
+
89
  $taxonomies = array('product_cat', 'product_tag');
90
 
91
  foreach($taxonomies as $taxonomy ){
92
 
93
  $taxonomy_obj = get_taxonomy($taxonomy);
94
  $slug = isset($taxonomy_obj->rewrite['slug']) ? trim($taxonomy_obj->rewrite['slug'],'/') : false;
95
+
96
  if($slug && $sitepress->get_current_language() != $strings_language){
97
 
98
  $slug_translation = $wpdb->get_var($wpdb->prepare("
137
 
138
  }
139
 
140
+ // handle attributes
141
+ $wc_taxonomies = wc_get_attribute_taxonomies();
142
+ $wc_taxonomies_wc_format = array();
143
+ foreach($wc_taxonomies as $k => $v){
144
+ $wc_taxonomies_wc_format[] = 'pa_' . $v->attribute_name;
145
+ }
146
+
147
+ foreach($wc_taxonomies_wc_format as $taxonomy ){
148
+ $taxonomy_obj = get_taxonomy($taxonomy);
149
+
150
+ if(isset($taxonomy_obj->rewrite['slug'])){
151
+ $exp = explode('/', $taxonomy_obj->rewrite['slug']);
152
+ $slug = join('/', array_slice($exp, 0, count($exp) - 1));
153
+ }
154
+
155
+ if($slug && $sitepress->get_current_language() != $strings_language){
156
+
157
+ $slug_translation = $wpdb->get_var($wpdb->prepare("
158
+ SELECT t.value
159
+ FROM {$wpdb->prefix}icl_string_translations t
160
+ JOIN {$wpdb->prefix}icl_strings s ON t.string_id = s.id
161
+ WHERE t.language = %s AND s.name = %s AND s.value = %s
162
+ ", $sitepress->get_current_language(), 'URL attribute slug: ' . $slug, $slug));
163
+
164
+ if($slug_translation){
165
+
166
+ $buff_value = array();
167
+ foreach((array)$value as $k=>$v){
168
+
169
+ if($slug != $slug_translation){
170
+ if(preg_match('#^' . $slug . '/(.*)#', $k) && $slug != $slug_translation){
171
+ $k = preg_replace('#^' . $slug . '/(.*)#', $slug_translation . '/$1' , $k);
172
+ }
173
+ }
174
+
175
+ $buff_value[$k] = $v;
176
+
177
+ }
178
+
179
+ $value = $buff_value;
180
+ unset($buff_value);
181
+
182
+ }
183
+
184
+ }
185
+
186
+ }
187
+
188
  wp_cache_add($cache_key, $value);
189
 
190
  }
206
  global $sitepress_settings, $sitepress, $wp_rewrite, $wpdb;
207
  static $no_recursion_flag;
208
 
209
+ // handles product categories, product tags and attributes
210
+
211
+ $wc_taxonomies = wc_get_attribute_taxonomies();
212
+ foreach($wc_taxonomies as $k => $v){
213
+ $wc_taxonomies_wc_format[] = 'pa_' . $v->attribute_name;
214
+ }
215
+
216
+ if(($taxonomy == 'product_cat' || $taxonomy == 'product_tag' || !empty($wc_taxonomies_wc_format) && in_array($taxonomy, $wc_taxonomies_wc_format)) && !$no_recursion_flag){
217
 
218
  $cache_key = 'termlink#' . $taxonomy .'#' . $term->term_id;
219
  if($link = wp_cache_get($cache_key, 'terms')){
229
  if(!empty($term_language)){
230
 
231
  $permalinks = get_option( 'woocommerce_permalinks' );
232
+ $base = $taxonomy == 'product_tag' ? $permalinks['tag_base'] : ($taxonomy == 'category_tag' ? $permalinks['category_base'] : $permalinks['attribute_base']);
233
 
234
  if($base === ''){
235
  // handle exception - default woocommerce category and tag bases used
258
 
259
  }
260
  }else{
261
+
262
+ $string_identifier = $taxonomy == 'product_tag' || $taxonomy == 'product_category' ? $taxonomy : 'attribute';
263
+
264
  if($term_language->language_code != $strings_language){
265
  $base_translated = $wpdb->get_var("
266
  SELECT t.value
268
  JOIN {$wpdb->prefix}icl_string_translations t ON t.string_id = s.id
269
  WHERE s.value='". esc_sql($base)."'
270
  AND s.language = '{$strings_language}'
271
+ AND s.name LIKE 'URL {$string_identifier} slug:%'
272
  AND t.language = '{$term_language->language_code}'
273
  ");
274
+
275
  }else{
276
  $base_translated = $base;
277
  }
356
  function sync_term_order_globally() {
357
  //syncs the term order of any taxonomy in $wpdb->prefix.'woocommerce_attribute_taxonomies'
358
  //use it when term orderings have become unsynched, e.g. before WCML 3.3.
359
+ global $sitepress, $wpdb, $woocommerce_wpml;
360
 
361
  if(!defined('WOOCOMMERCE_VERSION')){
362
  return;
366
  $lang = $sitepress->get_default_language();
367
  $sitepress->switch_lang($lang);
368
 
369
+ $taxes = wc_get_attribute_taxonomies (); //="SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies"
370
 
371
  if ($taxes) foreach ($taxes as $woo_tax) {
372
  $tax = 'pa_'.$woo_tax->attribute_name;
604
  }
605
 
606
  static function set_flag_for_variation_on_attribute_update($term_id, $tt_id, $taxonomy){
607
+ global $woocommerce_wpml, $sitepress;
608
 
609
+ $attribute_taxonomies = wc_get_attribute_taxonomies();
 
610
  foreach($attribute_taxonomies as $a){
611
  $attribute_taxonomies_arr[] = 'pa_' . $a->attribute_name;
612
  }
613
 
 
614
  if(isset( $attribute_taxonomies_arr ) && in_array($taxonomy, $attribute_taxonomies_arr)){
615
 
616
  $wcml_settings = $woocommerce_wpml->get_settings();
638
  }
639
 
640
  static function show_variations_sync_button($taxonomy){
641
+ global $woocommerce_wpml;
642
 
643
  if(is_admin() && isset($_GET['page']) && $_GET['page'] == 'wpml-wcml' && isset($_GET['tab'])){
644
  $wcml_settings = $woocommerce_wpml->get_settings();
645
+ $attribute_taxonomies = wc_get_attribute_taxonomies();
646
  foreach($attribute_taxonomies as $a){
647
  $attribute_taxonomies_arr[] = 'pa_' . $a->attribute_name;
648
  }
682
  }
683
 
684
  static function hide_tax_sync_button_for_attributes($value){
685
+ global $woocommerce_wpml;
686
 
687
  if(is_admin() && isset($_GET['page']) && $_GET['page'] == 'wpml-wcml' && isset($_GET['tab'])){
688
 
689
  $wcml_settings = $woocommerce_wpml->get_settings();
690
+ $attribute_taxonomies = wc_get_attribute_taxonomies();
691
  foreach($attribute_taxonomies as $a){
692
  $attribute_taxonomies_arr[] = 'pa_' . $a->attribute_name;
693
  }
822
  return $terms;
823
  }
824
 
825
+ function wcml_delete_term($term, $tt_id, $taxonomy, $deleted_term){
826
+ global $wp_taxonomies;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
827
 
828
+ foreach($wp_taxonomies as $key=>$taxonomy_obj){
829
+ if((in_array('product',$taxonomy_obj->object_type) || in_array('product_variation',$taxonomy_obj->object_type) ) && $key==$taxonomy){
830
+ self::update_terms_translated_status($taxonomy);
831
+ break;
 
832
  }
 
 
 
 
 
833
  }
834
 
 
835
  }
836
 
837
  }
inc/upgrade.class.php CHANGED
@@ -5,7 +5,8 @@ class WCML_Upgrade{
5
  private $versions = array(
6
 
7
  '2.9.9.1',
8
- '3.1'
 
9
 
10
  );
11
 
@@ -242,11 +243,25 @@ class WCML_Upgrade{
242
 
243
  }
244
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
 
246
 
247
 
248
 
249
 
250
 
251
- }
252
-
5
  private $versions = array(
6
 
7
  '2.9.9.1',
8
+ '3.1',
9
+ '3.2'
10
 
11
  );
12
 
243
 
244
  }
245
 
246
+ function upgrade_3_2(){
247
+
248
+ woocommerce_wpml::set_up_capabilities();
249
+
250
+ //delete not existing currencies in WC
251
+ global $wpdb;
252
+ $currencies = $wpdb->get_results("SELECT id,code FROM " . $wpdb->prefix . "icl_currencies ORDER BY `id` DESC");
253
+ $wc_currencies = get_woocommerce_currencies();
254
+ foreach ($currencies as $currency){
255
+ if(!array_key_exists($currency->code,$wc_currencies)){
256
+ $wpdb->delete( $wpdb->prefix . 'icl_currencies', array( 'ID' => $currency->id ) );
257
+ }
258
+ }
259
+
260
+ }
261
 
262
 
263
 
264
 
265
 
266
 
267
+ }
 
inc/wc-strings.class.php CHANGED
@@ -18,13 +18,16 @@ class WCML_WC_Strings{
18
  function init(){
19
  global $pagenow;
20
 
21
- add_filter('woocommerce_available_shipping_methods', array($this, 'register_shipping_methods'));
22
  add_action('option_woocommerce_tax_rates', array($this, 'translate_tax_rates'));
23
 
24
- add_filter('woocommerce_gateway_title', array($this, 'translate_gateway_title'), 10);
25
  add_filter('woocommerce_gateway_description', array($this, 'translate_gateway_description'), 10, 2);
26
 
27
- add_filter('woocommerce_attribute_label', array($this, 'translate_attributes'), 14, 2);
 
 
 
28
  add_filter('woocommerce_countries_tax_or_vat', array($this, 'register_tax_label'));
29
 
30
  if(is_admin() && $pagenow == 'options-permalink.php'){
@@ -40,6 +43,52 @@ class WCML_WC_Strings{
40
 
41
  }
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
  function translate_query_var_for_product($public_query_vars){
45
  global $wpdb, $sitepress, $sitepress_settings;
@@ -75,7 +124,7 @@ class WCML_WC_Strings{
75
  $admin_language = $sitepress->get_admin_language();
76
  }
77
  $current_language = $sitepress->get_current_language();
78
- if ($text == $wc_slug && $domain == 'woocommerce') {
79
  $sitepress->switch_lang($sitepress_settings['st']['strings_language']);
80
  $translation = _x($text, 'URL slug', $domain);
81
  $sitepress->switch_lang($current_language);
@@ -110,9 +159,9 @@ class WCML_WC_Strings{
110
  return $rates;
111
  }
112
 
113
- function translate_gateway_title($title) {
114
  if (function_exists('icl_translate')) {
115
- $title = icl_translate('woocommerce', $title .'_gateway_title', $title);
116
  }
117
  return $title;
118
  }
@@ -123,16 +172,7 @@ class WCML_WC_Strings{
123
  }
124
  return $description;
125
  }
126
-
127
- function translate_attributes($name){
128
- if(function_exists('icl_register_string')){
129
- icl_register_string('woocommerce', $name .'_attribute', $name);
130
- $name = icl_t('woocommerce', $name .'_attribute', $name);
131
- }
132
 
133
- return $name;
134
- }
135
-
136
  function register_tax_label($label){
137
  global $sitepress;
138
 
@@ -155,6 +195,9 @@ class WCML_WC_Strings{
155
  if(jQuery('#woocommerce_permalink_structure').length){
156
  jQuery('#woocommerce_permalink_structure').parent().append(jQuery('#wpml_wcml_custom_base_req').html());
157
  }
 
 
 
158
  </script>
159
  <?php
160
 
18
  function init(){
19
  global $pagenow;
20
 
21
+ add_filter('woocommerce_package_rates', array($this, 'register_shipping_methods'));
22
  add_action('option_woocommerce_tax_rates', array($this, 'translate_tax_rates'));
23
 
24
+ add_filter('woocommerce_gateway_title', array($this, 'translate_gateway_title'), 10, 2);
25
  add_filter('woocommerce_gateway_description', array($this, 'translate_gateway_description'), 10, 2);
26
 
27
+ //translate attribute label
28
+ add_filter('woocommerce_attribute_label',array($this,'translated_attribute_label'),10,2);
29
+ add_filter('woocommerce_cart_item_name',array($this,'translated_cart_item_name'),10,3);
30
+ add_filter('woocommerce_checkout_product_title',array($this,'translated_checkout_product_title'),10,2);
31
  add_filter('woocommerce_countries_tax_or_vat', array($this, 'register_tax_label'));
32
 
33
  if(is_admin() && $pagenow == 'options-permalink.php'){
43
 
44
  }
45
 
46
+ function translated_attribute_label($label, $name){
47
+ global $sitepress;
48
+
49
+ if(is_admin()){
50
+ global $wpdb,$sitepress_settings;
51
+ if($sitepress_settings['admin_default_language'] == $sitepress_settings['st']['strings_language']){
52
+ return $label;
53
+ }else{
54
+ $string_id = icl_get_string_id('taxonomy singular name: '.$label,'WordPress');
55
+ if($string_id){
56
+ $string = $wpdb->get_var($wpdb->prepare("SELECT value FROM {$wpdb->prefix}icl_string_translations WHERE string_id = %s and language = %s", $string_id, $sitepress_settings['admin_default_language']));
57
+ if($string){
58
+ return $string;
59
+ }
60
+ }
61
+ }
62
+ }
63
+ $name = woocommerce_sanitize_taxonomy_name($name);
64
+ $lang = $sitepress->get_current_language();
65
+ $trnsl_labels = get_option('wcml_custom_attr_translations');
66
+
67
+ if(isset($trnsl_labels[$lang][$name])){
68
+ return $trnsl_labels[$lang][$name];
69
+ }
70
+
71
+ return icl_t('WordPress','taxonomy singular name: '.$label,$label);
72
+ }
73
+
74
+ function translated_cart_item_name($title, $values, $cart_item_key){
75
+ global $sitepress;
76
+ if($values){
77
+ $tr_product_id = icl_object_id($values['product_id'],'product',true,$sitepress->get_current_language());
78
+ $title = get_the_title($tr_product_id);
79
+ }
80
+ return $title;
81
+ }
82
+
83
+ function translated_checkout_product_title($title,$product){
84
+ global $sitepress;
85
+ if(isset($product->id)){
86
+ $tr_product_id = icl_object_id($product->id,'product',true,$sitepress->get_current_language());
87
+ $title = get_the_title($tr_product_id);
88
+ }
89
+ return $title;
90
+ }
91
+
92
 
93
  function translate_query_var_for_product($public_query_vars){
94
  global $wpdb, $sitepress, $sitepress_settings;
124
  $admin_language = $sitepress->get_admin_language();
125
  }
126
  $current_language = $sitepress->get_current_language();
127
+ if ($text == $wc_slug && $domain == 'woocommerce' && isset($sitepress_settings['st'])) {
128
  $sitepress->switch_lang($sitepress_settings['st']['strings_language']);
129
  $translation = _x($text, 'URL slug', $domain);
130
  $sitepress->switch_lang($current_language);
159
  return $rates;
160
  }
161
 
162
+ function translate_gateway_title($title, $gateway_title) {
163
  if (function_exists('icl_translate')) {
164
+ $title = icl_translate('woocommerce', $gateway_title .'_gateway_title', $title);
165
  }
166
  return $title;
167
  }
172
  }
173
  return $description;
174
  }
 
 
 
 
 
 
175
 
 
 
 
176
  function register_tax_label($label){
177
  global $sitepress;
178
 
195
  if(jQuery('#woocommerce_permalink_structure').length){
196
  jQuery('#woocommerce_permalink_structure').parent().append(jQuery('#wpml_wcml_custom_base_req').html());
197
  }
198
+ if(jQuery('input[name="woocommerce_product_category_slug"]').length){
199
+ jQuery('input[name="woocommerce_product_category_slug"]').parent().append('<br><i><?php _e('Please use a different product category base than "category"', 'wpml-wcml') ?></i>');
200
+ }
201
  </script>
202
  <?php
203
 
inc/woocommerce-2.0-backward-compatibility.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ global $woocommerce;
4
+
5
+ if(version_compare(preg_replace('#-(.+)$#', '', $woocommerce->version), '2.1', '<')){
6
+
7
+ //wc_enqueue_js
8
+ if(!function_exists('wc_enqueue_js')){
9
+ function wc_enqueue_js($code){
10
+ global $woocommerce;
11
+ return $woocommerce->add_inline_js($code) ;
12
+ }
13
+
14
+ }
15
+
16
+ //wc_get_attribute_taxonomies
17
+ if(!function_exists('wc_get_attribute_taxonomies')){
18
+
19
+ function wc_get_attribute_taxonomies(){
20
+ global $woocommerce;
21
+ return $woocommerce->get_attribute_taxonomies();
22
+ }
23
+
24
+ }
25
+
26
+ //
27
+ add_filter('wcml_wc_installed_pages', 'wcml_wc_2_0_backward_compatibility_pages');
28
+ function wcml_wc_2_0_backward_compatibility_pages($pages){
29
+
30
+ $pages = array(
31
+ 'woocommerce_shop_page_id',
32
+ 'woocommerce_cart_page_id',
33
+ 'woocommerce_checkout_page_id',
34
+ 'woocommerce_myaccount_page_id',
35
+ 'woocommerce_lost_password_page_id',
36
+ 'woocommerce_edit_address_page_id',
37
+ 'woocommerce_view_order_page_id',
38
+ 'woocommerce_change_password_page_id',
39
+ 'woocommerce_logout_page_id',
40
+ 'woocommerce_pay_page_id',
41
+ 'woocommerce_thanks_page_id'
42
+ );
43
+
44
+ return $pages;
45
+
46
+ }
47
+
48
+ //
49
+ function wcml_wc_2_0_backward_compatibility_register_shipping_methods($available_methods){
50
+ foreach($available_methods as $method){
51
+ $method->label = icl_translate('woocommerce', $method->label .'_shipping_method_title', $method->label);
52
+ }
53
+ return $available_methods;
54
+ }
55
+ add_filter('woocommerce_available_shipping_methods', 'wcml_wc_2_0_backward_compatibility_register_shipping_methods');
56
+
57
+ if(isset($WCML_Multi_Currency_Support)){
58
+ add_filter('woocommerce_available_shipping_methods', array($WCML_Multi_Currency_Support, 'shipping_taxes_filter'));
59
+ }
60
+
61
+ add_filter('woocommerce_in_cart_product_title',array($this->products, 'translated_cart_item_name'), 10, 3);
62
+
63
+
64
+ }
65
+
66
+
locale/orig/wpml-wcml.po CHANGED
@@ -12,6 +12,30 @@ msgstr ""
12
  "Language-Team: \n"
13
  "MIME-Version: 1.0\n"
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  msgid "WooCommerce Multilingual is enabled but not effective. It is not compatible with <a href=\"%s\">WPML</a> versions prior %s."
16
  msgstr ""
17
 
@@ -42,6 +66,27 @@ msgstr ""
42
  msgid "If you want different slugs for shop pages (%s/%s), you need to disable the shop prefix for products in <a href=\"%s\">WooCommerce Settings</a>"
43
  msgstr ""
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  msgid "Invalid nonce"
46
  msgstr ""
47
 
@@ -81,6 +126,18 @@ msgstr ""
81
  msgid "Images"
82
  msgstr ""
83
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  msgid "Please translate all attributes"
85
  msgstr ""
86
 
@@ -168,6 +225,9 @@ msgstr ""
168
  msgid "You need to enter attribute names in %s (even though your site's default language is %s). Then, translate it to %s and the rest of the site's languages using in the %sWooCommerce Multlingual admin%s."
169
  msgstr ""
170
 
 
 
 
171
  msgid "product"
172
  msgstr ""
173
 
@@ -183,12 +243,99 @@ msgstr ""
183
  msgid "You have untranslated terms!"
184
  msgstr ""
185
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  msgid "Collapse"
187
  msgstr ""
188
 
189
  msgid "Expand"
190
  msgstr ""
191
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  msgid "Please set images for product"
193
  msgstr ""
194
 
@@ -207,6 +354,9 @@ msgstr ""
207
  msgid "%d products"
208
  msgstr ""
209
 
 
 
 
210
  msgid "This product is an exact duplicate of the %s product."
211
  msgstr ""
212
 
@@ -240,6 +390,9 @@ msgstr ""
240
  msgid "Translation complete"
241
  msgstr ""
242
 
 
 
 
243
  msgid "All languages"
244
  msgstr ""
245
 
@@ -282,10 +435,10 @@ msgstr ""
282
  msgid "Product"
283
  msgstr ""
284
 
285
- msgid "Close"
286
  msgstr ""
287
 
288
- msgid "Edit translation"
289
  msgstr ""
290
 
291
  msgid "Language"
@@ -303,24 +456,9 @@ msgstr ""
303
  msgid "Choose a file"
304
  msgstr ""
305
 
306
- msgid "Show content"
307
- msgstr ""
308
-
309
  msgid "Translation missing"
310
  msgstr ""
311
 
312
- msgid "Original content:"
313
- msgstr ""
314
-
315
- msgid "Please enter translation:"
316
- msgstr ""
317
-
318
- msgid "Cancel"
319
- msgstr ""
320
-
321
- msgid "Ok"
322
- msgstr ""
323
-
324
  msgid "name"
325
  msgstr ""
326
 
@@ -333,49 +471,40 @@ msgstr ""
333
  msgid "Upload file"
334
  msgstr ""
335
 
336
- msgid "WooCommerce Multilingual is enabled but not effective. It is not compatible with <a href=\"%s\">WPML</a> versions prior 2.0.5."
337
- msgstr ""
338
-
339
  msgid "%s plugin is installed and activated."
340
  msgstr ""
341
 
342
- msgid "%s plugin is either not installed or not activated."
343
  msgstr ""
344
 
345
- msgid "%1$s is installed, but with incorrect version. You need %1$s %2$s or higher. "
346
- msgstr ""
347
-
348
- msgid "Your store's base currency is %s. To change it, go to the %s page."
349
  msgstr ""
350
 
351
- msgid "Exchange rate to %s"
352
  msgstr ""
353
 
354
- msgid "Plugins Status"
355
  msgstr ""
356
 
357
- msgid "Check required plugins"
358
  msgstr ""
359
 
360
- msgid "WooCommerce Multilingual depends on several plugins to work. If any required plugin is missing, you should install and activate it."
361
  msgstr ""
362
 
363
- msgid "Update WPML"
364
  msgstr ""
365
 
366
- msgid "Get WPML"
367
  msgstr ""
368
 
369
- msgid "Get WPML Media"
370
  msgstr ""
371
 
372
- msgid "Get WPML Translation Management"
373
  msgstr ""
374
 
375
- msgid "Get WPML String Translation"
376
- msgstr ""
377
-
378
- msgid "Download WooCommerce"
379
  msgstr ""
380
 
381
  msgid "WooCommerce Store Pages"
@@ -384,10 +513,13 @@ msgstr ""
384
  msgid "Translated store pages"
385
  msgstr ""
386
 
387
- msgid "To run a multilingual e-commerce site, you need to have several WooCommerce shop pages in all the site's language. If they are missing, we will create them automatically for you."
388
  msgstr ""
389
 
390
- msgid "One or more WooCommerce pages have not been created"
 
 
 
391
  msgstr ""
392
 
393
  msgid "WooCommerce store pages don't exist for this language:"
@@ -396,13 +528,13 @@ msgstr ""
396
  msgid "WooCommerce store pages don't exist for these languages:"
397
  msgstr ""
398
 
399
- msgid "Create missing store pages"
400
  msgstr ""
401
 
402
  msgid "Hide this message"
403
  msgstr ""
404
 
405
- msgid "Show missing languages"
406
  msgstr ""
407
 
408
  msgid "WooCommerce store pages are translated to all the site's languages."
@@ -435,6 +567,15 @@ msgstr ""
435
  msgid "Go to the native WooCommerce product editing screen"
436
  msgstr ""
437
 
 
 
 
 
 
 
 
 
 
438
  msgid "File Paths Synchronization "
439
  msgstr ""
440
 
@@ -456,22 +597,25 @@ msgstr ""
456
  msgid "Currency management"
457
  msgstr ""
458
 
459
- msgid "You can use different currencies and amounts for products in different languages. Once enabled, add currencies and choose a currency for each language."
460
  msgstr ""
461
 
462
- msgid "Enable multi-currency"
463
  msgstr ""
464
 
465
- msgid "Automatically calculate pricing in different currencies, based on the exchange rate"
466
  msgstr ""
467
 
468
- msgid "I will manage the pricing in each currency myself"
469
  msgstr ""
470
 
471
- msgid "Currency code"
472
  msgstr ""
473
 
474
- msgid "Changed"
 
 
 
475
  msgstr ""
476
 
477
  msgid "Please fill field"
@@ -483,21 +627,33 @@ msgstr ""
483
  msgid "Edit"
484
  msgstr ""
485
 
486
- msgid "Delete"
 
 
 
487
  msgstr ""
488
 
489
- msgid "(*) This exchange rate is not applied automatically because you chose to set pricing manually in different currencies."
 
 
 
 
 
 
490
  msgstr ""
491
 
492
  msgid "Add currency"
493
  msgstr ""
494
 
495
- msgid "Currency"
496
  msgstr ""
497
 
498
  msgid "Troubleshooting page"
499
  msgstr ""
500
 
 
 
 
501
  msgid "Taxonomies without translation"
502
  msgstr ""
503
 
@@ -510,10 +666,13 @@ msgstr ""
510
  msgid "This taxonomy does not require translation."
511
  msgstr ""
512
 
 
 
 
513
  msgid "Troubleshooting"
514
  msgstr ""
515
 
516
- msgid "Please make backup of your database before start synchronization"
517
  msgstr ""
518
 
519
  msgid "Sync variables products"
@@ -531,22 +690,28 @@ msgstr ""
531
  msgid "left"
532
  msgstr ""
533
 
 
 
 
534
  msgid "Start"
535
  msgstr ""
536
 
537
  msgid "Please add variations to product"
538
  msgstr ""
539
 
540
- msgid "Please save translation before translate variations prices"
541
  msgstr ""
542
 
543
- msgid "Regular price"
544
  msgstr ""
545
 
546
- msgid "Sale price"
547
  msgstr ""
548
 
549
- msgid "Download URL"
 
 
 
550
  msgstr ""
551
 
552
  msgid "How to translate products"
12
  "Language-Team: \n"
13
  "MIME-Version: 1.0\n"
14
 
15
+ msgid "%s translation"
16
+ msgstr ""
17
+
18
+ msgid "Show content"
19
+ msgstr ""
20
+
21
+ msgid "Edit translation"
22
+ msgstr ""
23
+
24
+ msgid "Original content:"
25
+ msgstr ""
26
+
27
+ msgid "Close"
28
+ msgstr ""
29
+
30
+ msgid "Cancel"
31
+ msgstr ""
32
+
33
+ msgid "Ok"
34
+ msgstr ""
35
+
36
+ msgid "Please update original product"
37
+ msgstr ""
38
+
39
  msgid "WooCommerce Multilingual is enabled but not effective. It is not compatible with <a href=\"%s\">WPML</a> versions prior %s."
40
  msgstr ""
41
 
66
  msgid "If you want different slugs for shop pages (%s/%s), you need to disable the shop prefix for products in <a href=\"%s\">WooCommerce Settings</a>"
67
  msgstr ""
68
 
69
+ msgid "Finished! You can visit the %sstrings translation%s screen to translate the strings now."
70
+ msgstr ""
71
+
72
+ msgid "wpml-config.xml file missing from WooCommerce Multilingual folder."
73
+ msgstr ""
74
+
75
+ msgid "Custom field %s configuration from wpml-config.xml file was altered!"
76
+ msgstr ""
77
+
78
+ msgid "Custom type %s configuration from wpml-config.xml file was altered!"
79
+ msgstr ""
80
+
81
+ msgid "Custom taxonomy %s configuration from wpml-config.xml file was altered!"
82
+ msgstr ""
83
+
84
+ msgid " (%s)"
85
+ msgstr ""
86
+
87
+ msgid "Show all currencies"
88
+ msgstr ""
89
+
90
  msgid "Invalid nonce"
91
  msgstr ""
92
 
126
  msgid "Images"
127
  msgstr ""
128
 
129
+ msgid "Sale price"
130
+ msgstr ""
131
+
132
+ msgid "Regular price"
133
+ msgstr ""
134
+
135
+ msgid "Variations"
136
+ msgstr ""
137
+
138
+ msgid "Any %s"
139
+ msgstr ""
140
+
141
  msgid "Please translate all attributes"
142
  msgstr ""
143
 
225
  msgid "You need to enter attribute names in %s (even though your site's default language is %s). Then, translate it to %s and the rest of the site's languages using in the %sWooCommerce Multlingual admin%s."
226
  msgstr ""
227
 
228
+ msgid "Please use a different product category base than \"category\""
229
+ msgstr ""
230
+
231
  msgid "product"
232
  msgstr ""
233
 
243
  msgid "You have untranslated terms!"
244
  msgstr ""
245
 
246
+ msgid "WooCommerce Multilingual is enabled but not effective. It is not compatible with <a href=\"%s\">WPML</a> versions prior 2.0.5."
247
+ msgstr ""
248
+
249
+ msgid "%s plugin is installed and active."
250
+ msgstr ""
251
+
252
+ msgid "%s plugin is either not installed or not active."
253
+ msgstr ""
254
+
255
+ msgid "%1$s is installed, but with incorrect version. You need %1$s %2$s or higher. "
256
+ msgstr ""
257
+
258
+ msgid "Required plugins"
259
+ msgstr ""
260
+
261
+ msgid "Plugins Status"
262
+ msgstr ""
263
+
264
+ msgid "Check required plugins"
265
+ msgstr ""
266
+
267
+ msgid "WooCommerce Multilingual depends on several plugins to work. If any required plugin is missing, you should install and activate it."
268
+ msgstr ""
269
+
270
+ msgid "Update WPML"
271
+ msgstr ""
272
+
273
+ msgid "Get WPML"
274
+ msgstr ""
275
+
276
+ msgid "Get WPML Media"
277
+ msgstr ""
278
+
279
+ msgid "Get WPML Translation Management"
280
+ msgstr ""
281
+
282
+ msgid "Get WPML String Translation"
283
+ msgstr ""
284
+
285
+ msgid "Download WooCommerce"
286
+ msgstr ""
287
+
288
  msgid "Collapse"
289
  msgstr ""
290
 
291
  msgid "Expand"
292
  msgstr ""
293
 
294
+ msgid "Regular Price"
295
+ msgstr ""
296
+
297
+ msgid "Sale Price"
298
+ msgstr ""
299
+
300
+ msgid "Calculate prices in other currencies automatically"
301
+ msgstr ""
302
+
303
+ msgid "Click to see the prices in the other currencies as they are currently shown onthe front end."
304
+ msgstr ""
305
+
306
+ msgid "Show"
307
+ msgstr ""
308
+
309
+ msgid "Hide"
310
+ msgstr ""
311
+
312
+ msgid "Set prices in other currencies manually"
313
+ msgstr ""
314
+
315
+ msgid "Enter prices in other currencies"
316
+ msgstr ""
317
+
318
+ msgid "Hide prices in other currencies"
319
+ msgstr ""
320
+
321
+ msgid "Determined automatically based on exchange rate"
322
+ msgstr ""
323
+
324
+ msgid "Schedule"
325
+ msgstr ""
326
+
327
+ msgid "Same as default currency"
328
+ msgstr ""
329
+
330
+ msgid "Set dates"
331
+ msgstr ""
332
+
333
+ msgid "From&hellip;"
334
+ msgstr ""
335
+
336
+ msgid "To&hellip;"
337
+ msgstr ""
338
+
339
  msgid "Please set images for product"
340
  msgstr ""
341
 
354
  msgid "%d products"
355
  msgstr ""
356
 
357
+ msgid " | Parent product: %s"
358
+ msgstr ""
359
+
360
  msgid "This product is an exact duplicate of the %s product."
361
  msgstr ""
362
 
390
  msgid "Translation complete"
391
  msgstr ""
392
 
393
+ msgid "All statuses"
394
+ msgstr ""
395
+
396
  msgid "All languages"
397
  msgstr ""
398
 
435
  msgid "Product"
436
  msgstr ""
437
 
438
+ msgid "No products found"
439
  msgstr ""
440
 
441
+ msgid " (draft)"
442
  msgstr ""
443
 
444
  msgid "Language"
456
  msgid "Choose a file"
457
  msgstr ""
458
 
 
 
 
459
  msgid "Translation missing"
460
  msgstr ""
461
 
 
 
 
 
 
 
 
 
 
 
 
 
462
  msgid "name"
463
  msgstr ""
464
 
471
  msgid "Upload file"
472
  msgstr ""
473
 
 
 
 
474
  msgid "%s plugin is installed and activated."
475
  msgstr ""
476
 
477
+ msgid "Your store's base currency is %s (%s). To change it, go to the %s page."
478
  msgstr ""
479
 
480
+ msgid "Products using custom currency rates as they were migrated from the previous versions - option to support different prices per language"
 
 
 
481
  msgstr ""
482
 
483
+ msgid "Are you sure?"
484
  msgstr ""
485
 
486
+ msgid "Delete"
487
  msgstr ""
488
 
489
+ msgid "Configuration warnings"
490
  msgstr ""
491
 
492
+ msgid "Reporting miscelaneous configuration issues that can make WooCommerce Multilingual not run normally"
493
  msgstr ""
494
 
495
+ msgid "Attention required: probable problem with URLs in different languages"
496
  msgstr ""
497
 
498
+ msgid "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."
499
  msgstr ""
500
 
501
+ msgid "Change the strings language to English"
502
  msgstr ""
503
 
504
+ msgid "Re-scan strings"
505
  msgstr ""
506
 
507
+ msgid "Some settings from the WooCommerce Multilingual wpml-config.xml file have been overwritten"
 
 
 
508
  msgstr ""
509
 
510
  msgid "WooCommerce Store Pages"
513
  msgid "Translated store pages"
514
  msgstr ""
515
 
516
+ msgid "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."
517
  msgstr ""
518
 
519
+ msgid "One or more WooCommerce pages have not been created."
520
+ msgstr ""
521
+
522
+ msgid "Install WooCommerce Pages"
523
  msgstr ""
524
 
525
  msgid "WooCommerce store pages don't exist for this language:"
528
  msgid "WooCommerce store pages don't exist for these languages:"
529
  msgstr ""
530
 
531
+ msgid "Create missing translations."
532
  msgstr ""
533
 
534
  msgid "Hide this message"
535
  msgstr ""
536
 
537
+ msgid "Show details about missing translations"
538
  msgstr ""
539
 
540
  msgid "WooCommerce store pages are translated to all the site's languages."
567
  msgid "Go to the native WooCommerce product editing screen"
568
  msgstr ""
569
 
570
+ msgid "Products synchronization"
571
+ msgstr ""
572
+
573
+ msgid "Configure specific product properties that should be synced to translations."
574
+ msgstr ""
575
+
576
+ msgid "Sync publishing date for translated products."
577
+ msgstr ""
578
+
579
  msgid "File Paths Synchronization "
580
  msgstr ""
581
 
597
  msgid "Currency management"
598
  msgstr ""
599
 
600
+ msgid "This will let you enable the multi-currency mode where users can see prices according to their currency preference and configured exchange rate."
601
  msgstr ""
602
 
603
+ msgid "No multi-currency"
604
  msgstr ""
605
 
606
+ msgid "Multiple currencies, independent of languages"
607
  msgstr ""
608
 
609
+ msgid "BETA"
610
  msgstr ""
611
 
612
+ msgid "Learn more"
613
  msgstr ""
614
 
615
+ msgid "Currency"
616
+ msgstr ""
617
+
618
+ msgid "default"
619
  msgstr ""
620
 
621
  msgid "Please fill field"
627
  msgid "Edit"
628
  msgstr ""
629
 
630
+ msgid "Default currency"
631
+ msgstr ""
632
+
633
+ msgid "Switch to this currency when switching language in the front-end"
634
  msgstr ""
635
 
636
+ msgid "OFF"
637
+ msgstr ""
638
+
639
+ msgid "ON"
640
+ msgstr ""
641
+
642
+ msgid "Keep"
643
  msgstr ""
644
 
645
  msgid "Add currency"
646
  msgstr ""
647
 
648
+ msgid "n/a"
649
  msgstr ""
650
 
651
  msgid "Troubleshooting page"
652
  msgstr ""
653
 
654
+ msgid "Run fix"
655
+ msgstr ""
656
+
657
  msgid "Taxonomies without translation"
658
  msgstr ""
659
 
666
  msgid "This taxonomy does not require translation."
667
  msgstr ""
668
 
669
+ msgid "The changes you made will be lost if you navigate away from this page."
670
+ msgstr ""
671
+
672
  msgid "Troubleshooting"
673
  msgstr ""
674
 
675
+ msgid "Please make a backup of your database before you start the synchronization"
676
  msgstr ""
677
 
678
  msgid "Sync variables products"
690
  msgid "left"
691
  msgstr ""
692
 
693
+ msgid "Sync products \"gallery images\""
694
+ msgstr ""
695
+
696
  msgid "Start"
697
  msgstr ""
698
 
699
  msgid "Please add variations to product"
700
  msgstr ""
701
 
702
+ msgid "Please save translation before translate variations file paths"
703
  msgstr ""
704
 
705
+ msgid "Variations are not downloadable"
706
  msgstr ""
707
 
708
+ msgid "Download URL"
709
  msgstr ""
710
 
711
+ msgid "Variation is not downloadable"
712
+ msgstr ""
713
+
714
+ msgid "This field is locked for editing because WPML will copy its value from the original language."
715
  msgstr ""
716
 
717
  msgid "How to translate products"
locale/wpml-wcml-ar.mo CHANGED
Binary file
locale/wpml-wcml-de_DE.mo CHANGED
Binary file
locale/wpml-wcml-el.mo CHANGED
Binary file
locale/wpml-wcml-es_ES.mo CHANGED
Binary file
locale/wpml-wcml-fr_FR.mo CHANGED
Binary file
locale/wpml-wcml-he_IL.mo CHANGED
Binary file
locale/wpml-wcml-it_IT.mo CHANGED
Binary file
locale/wpml-wcml-ja.mo CHANGED
Binary file
locale/wpml-wcml-ko_KO.mo CHANGED
Binary file
locale/wpml-wcml-nl_NL.mo CHANGED
Binary file
locale/wpml-wcml-pl_PL.mo CHANGED
Binary file
locale/wpml-wcml-pt_BR.mo CHANGED
Binary file
locale/wpml-wcml-pt_PT.mo CHANGED
Binary file
locale/wpml-wcml-ru_RU.mo CHANGED
Binary file
locale/wpml-wcml-sv_SE.mo CHANGED
Binary file
locale/wpml-wcml-vn.mo CHANGED
Binary file
locale/wpml-wcml-zh_CN.mo CHANGED
Binary file
locale/wpml-wcml-zh_TW.mo CHANGED
Binary file
menu/management.php CHANGED
@@ -1,21 +1,29 @@
1
  <?php
2
  //actions
3
- global $woocommerce_wpml, $sitepress,$wpdb;
4
 
5
  $default_language = $sitepress->get_default_language();
6
  $active_languages = $sitepress->get_active_languages();
7
 
8
- $all_products_taxonomies = get_taxonomies(array('object_type'=>array('product')),'objects');
9
  $products_and_variation_taxonomies = get_taxonomies(array('object_type'=>array('product','product_variation')),'objects');
10
 
 
 
 
 
 
 
 
 
11
 
12
  if(isset($_GET['tab'])){
13
  $current_tab = $_GET['tab'];
14
- if($current_tab == 'settings' && !current_user_can('manage_options')){
15
  $current_tab = 'products';
16
  }
17
  }else{
18
- $current_tab = current_user_can('manage_options') ? 'settings' : 'products';
19
  }
20
 
21
 
@@ -25,7 +33,7 @@ if(isset($_GET['tab'])){
25
  <div id="icon-wpml" class="icon32"><br /></div>
26
  <h2><?php _e('WooCommerce Multilingual', 'wpml-wcml') ?></h2>
27
 
28
- <?php if(current_user_can('manage_options')): ?>
29
  <a class="nav-tab <?php echo $current_tab == 'settings' ?'nav-tab-active':''; ?>" href="admin.php?page=wpml-wcml"><?php _e('General settings', 'wpml-wcml') ?></a>
30
  <?php endif; ?>
31
  <a class="nav-tab <?php echo $current_tab == 'products' ? 'nav-tab-active' : ''; ?>" href="admin.php?page=wpml-wcml&tab=products"><?php _e('Products', 'wpml-wcml') ?></a>
@@ -43,11 +51,11 @@ if(isset($_GET['tab'])){
43
 
44
  <?php endforeach; ?>
45
  <div class="wcml_wrap">
46
- <?php if(!isset($_GET['tab']) && current_user_can('manage_options')): ?>
47
  <?php include WCML_PLUGIN_PATH . '/menu/sub/settings.php'; ?>
48
  <?php elseif(isset($all_products_taxonomies[$current_tab]) || isset($products_and_variation_taxonomies[$current_tab])): ?>
49
  <?php include WCML_PLUGIN_PATH . '/menu/sub/product-taxonomy.php'; ?>
50
- <?php elseif((isset($_GET['tab']) && $_GET['tab'] == 'products') || !current_user_can('manage_options')): ?>
51
  <?php include WCML_PLUGIN_PATH . '/menu/sub/products.php'; ?>
52
  <?php endif; ?>
53
  </div>
1
  <?php
2
  //actions
3
+ global $woocommerce_wpml, $sitepress,$wpdb,$wp_taxonomies;
4
 
5
  $default_language = $sitepress->get_default_language();
6
  $active_languages = $sitepress->get_active_languages();
7
 
8
+ $all_products_taxonomies = array();
9
  $products_and_variation_taxonomies = get_taxonomies(array('object_type'=>array('product','product_variation')),'objects');
10
 
11
+ //don't use get_taxonomies for product, because when one more post type registered for product taxonomy functions returned taxonomies only for product type
12
+ foreach($wp_taxonomies as $key=>$taxonomy){
13
+ if(in_array('product',$taxonomy->object_type) && !array_key_exists($key,$products_and_variation_taxonomies)){
14
+ $all_products_taxonomies[$key] = $taxonomy;
15
+ }
16
+ }
17
+
18
+
19
 
20
  if(isset($_GET['tab'])){
21
  $current_tab = $_GET['tab'];
22
+ if($current_tab == 'settings' && !current_user_can('wpml_manage_woocommerce_multilingual')){
23
  $current_tab = 'products';
24
  }
25
  }else{
26
+ $current_tab = current_user_can('wpml_manage_woocommerce_multilingual') ? 'settings' : 'products';
27
  }
28
 
29
 
33
  <div id="icon-wpml" class="icon32"><br /></div>
34
  <h2><?php _e('WooCommerce Multilingual', 'wpml-wcml') ?></h2>
35
 
36
+ <?php if(current_user_can('wpml_manage_woocommerce_multilingual')): ?>
37
  <a class="nav-tab <?php echo $current_tab == 'settings' ?'nav-tab-active':''; ?>" href="admin.php?page=wpml-wcml"><?php _e('General settings', 'wpml-wcml') ?></a>
38
  <?php endif; ?>
39
  <a class="nav-tab <?php echo $current_tab == 'products' ? 'nav-tab-active' : ''; ?>" href="admin.php?page=wpml-wcml&tab=products"><?php _e('Products', 'wpml-wcml') ?></a>
51
 
52
  <?php endforeach; ?>
53
  <div class="wcml_wrap">
54
+ <?php if(!isset($_GET['tab']) && current_user_can('wpml_manage_woocommerce_multilingual')): ?>
55
  <?php include WCML_PLUGIN_PATH . '/menu/sub/settings.php'; ?>
56
  <?php elseif(isset($all_products_taxonomies[$current_tab]) || isset($products_and_variation_taxonomies[$current_tab])): ?>
57
  <?php include WCML_PLUGIN_PATH . '/menu/sub/product-taxonomy.php'; ?>
58
+ <?php elseif((isset($_GET['tab']) && $_GET['tab'] == 'products') || !current_user_can('wpml_manage_woocommerce_multilingual')): ?>
59
  <?php include WCML_PLUGIN_PATH . '/menu/sub/products.php'; ?>
60
  <?php endif; ?>
61
  </div>
menu/plugins.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <div id="icon-wpml" class="icon32"><br /></div>
3
+ <h2><?php _e('WooCommerce Multilingual', 'wpml-wcml') ?></h2>
4
+ <a class="nav-tab nav-tab-active" href="admin.php?page=wpml-wcml"><?php _e('Required plugins', 'wpml-wcml') ?></a>
5
+ <div class="wcml_wrap">
6
+ <div class="wcml-section">
7
+ <div class="wcml-section-header">
8
+ <h3>
9
+ <?php _e('Plugins Status','wpml-wcml'); ?>
10
+ <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>
11
+ </h3>
12
+ </div>
13
+ <div class="wcml-section-content">
14
+ <ul>
15
+ <?php if (defined('ICL_SITEPRESS_VERSION') && version_compare(ICL_SITEPRESS_VERSION, '2.0.5', '<')) : ?>
16
+ <li><i class="icon-warning-sign"></i> <?php printf(__('WooCommerce Multilingual is enabled but not effective. It is not compatible with <a href="%s">WPML</a> versions prior 2.0.5.', 'wpml-wcml'), 'http://wpml.org/'); ?> <a href="http://wpml.org/shop/account/" target="_blank"><?php _e('Update WPML', 'wpml-wcml'); ?></a></li>
17
+ <?php elseif (defined('ICL_SITEPRESS_VERSION')) : ?>
18
+ <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'wpml-wcml'), '<strong>WPML</strong>'); ?></li>
19
+ <?php else : ?>
20
+ <li><i class="icon-warning-sign"></i> <?php printf(__('%s plugin is either not installed or not active.', 'wpml-wcml'), '<strong>WPML</strong>'); ?> <a href="http://wpml.org" target="_blank"><?php _e('Get WPML', 'wpml-wcml'); ?></a></li>
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 else : ?>
25
+ <li><i class="icon-warning-sign"></i> <?php printf(__('%s plugin is either not installed or not active.', 'wpml-wcml'), '<strong>WPML Media</strong>'); ?> <a href="http://wpml.org" target="_blank"><?php _e('Get WPML Media', 'wpml-wcml'); ?></a></li>
26
+ <?php endif; ?>
27
+ <?php if (defined('WPML_TM_VERSION')) : ?>
28
+ <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'wpml-wcml'), '<strong>WPML Translation Management</strong>'); ?></li>
29
+ <?php else : ?>
30
+ <li><i class="icon-warning-sign"></i> <?php printf(__('%s plugin is either not installed or not active.', 'wpml-wcml'), '<strong>WPML Translation Management</strong>'); ?> <a href="http://wpml.org" target="_blank"><?php _e('Get WPML Translation Management', 'wpml-wcml'); ?></a></li>
31
+ <?php endif; ?>
32
+ <?php if (defined('WPML_ST_VERSION')) : ?>
33
+ <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'wpml-wcml'), '<strong>WPML String Translation</strong>'); ?></li>
34
+ <?php else : ?>
35
+ <li><i class="icon-warning-sign"></i> <?php printf(__('%s plugin is either not installed or not active.', 'wpml-wcml'), '<strong>WPML String Translation</strong>'); ?> <a href="http://wpml.org" target="_blank"><?php _e('Get WPML String Translation', 'wpml-wcml'); ?></a></li>
36
+ <?php endif; ?>
37
+ <?php
38
+ global $woocommerce;
39
+ if (class_exists('Woocommerce') && $woocommerce && isset($woocommerce->version) && version_compare($woocommerce->version, '2.0', '<')) :
40
+ ?>
41
+ <li><i class="icon-warning-sign"></i> <?php printf(__('%1$s is installed, but with incorrect version. You need %1$s %2$s or higher. ', 'wpml-wcml'), '<strong>WooCommerce</strong>', '2.0'); ?> <a href="http://wordpress.org/extend/plugins/woocommerce/" target="_blank"><?php _e('Download WooCommerce', 'wpml-wcml'); ?></a></li>
42
+ <?php elseif (class_exists('Woocommerce')) : ?>
43
+ <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and active.', 'wpml-wcml'), '<strong>WooCommerce</strong>'); ?></li>
44
+ <?php else : ?>
45
+ <li><i class="icon-warning-sign"></i> <?php printf(__('%s plugin is either not installed or not active.', 'wpml-wcml'), '<strong>WooCommerce</strong>'); ?> <a href="http://wordpress.org/extend/plugins/woocommerce/" target="_blank"><?php _e('Download WooCommerce', 'wpml-wcml'); ?></a></li>
46
+ <?php endif; ?>
47
+ </ul>
48
+ </div> <!-- .wcml-section-content -->
49
+
50
+ </div> <!-- .wcml-section -->
51
+ </div>
52
+
53
+ </div>
54
+
menu/sub/custom-box.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <button id="custom_block_link_<?php echo $lang ?>" class="button-secondary js-table-toggle prod_images_link<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" data-text-opened="<?php _e('Collapse','wpml-wcml'); ?>" data-text-closed="<?php _e('Expand','wpml-wcml'); ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>>
2
+ <span><?php _e('Expand','wpml-wcml'); ?></span>
3
+ <i class="icon-caret-down"></i>
4
+ </button>
5
+
6
+ <table id="<?php echo $product_content.'_'.$lang ?>" class="widefat custom_fields_block js-table">
7
+ <tbody>
8
+ <?php echo $custom_box_html; ?>
9
+ </tbody>
10
+ </table>
menu/sub/custom-prices.php ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $checked = !isset($custom_prices['_wcml_custom_prices_status']) || (isset($custom_prices['_wcml_custom_prices_status']) && $custom_prices['_wcml_custom_prices_status'][0] == 0)?'checked="checked"':' ';
4
+
5
+ if($is_variation){
6
+ $html_id = '['.$post_id.']'; ?>
7
+ <tr><td>
8
+ <?php }else{
9
+ $html_id = '';
10
+ }
11
+ ?>
12
+ <div class="wcml_custom_prices_block">
13
+
14
+ <div class="wcml_custom_prices_options_block">
15
+
16
+ <input type="radio" name="_wcml_custom_prices[<?php echo $post_id; ?>]" id="wcml_custom_prices_auto[<?php echo $post_id ?>]" value="0" class="wcml_custom_prices_input"<?php echo $checked ?> />
17
+ <label for="wcml_custom_prices_auto[<?php echo $post_id ?>]"><?php _e('Calculate prices in other currencies automatically','wpml-wcml')?>&nbsp;
18
+ <span class="block_actions">(
19
+ <a href="javascript:void(0);" class="wcml_custom_prices_auto_block_show" title="<?php _e('Click to see the prices in the other currencies as they are currently shown onthe front end.', 'wpml-wcml') ?>"><?php _e('Show','wpml-wcml') ?></a>
20
+ <a href="javascript:void(0);" class="wcml_custom_prices_auto_block_hide"><?php _e('Hide','wpml-wcml') ?></a>
21
+ )</span>
22
+ </label>
23
+
24
+ <?php $checked = isset($custom_prices['_wcml_custom_prices_status']) && $custom_prices['_wcml_custom_prices_status'][0] == 1?'checked="checked"':' '; ?>
25
+
26
+ <input type="radio" name="_wcml_custom_prices[<?php echo $post_id ?>]" value="1" id="wcml_custom_prices_manually[<?php echo $post_id ?>]" class="wcml_custom_prices_input" <?php echo $checked ?> />
27
+ <label for="wcml_custom_prices_manually[<?php echo $post_id ?>]"><?php _e('Set prices in other currencies manually','wpml-wcml') ?></label>
28
+ <div class="wcml_custom_prices_manually_block_control">
29
+ <a href="javascript:void(0);" class="wcml_custom_prices_manually_block_show">&raquo; <?php _e('Enter prices in other currencies','wpml-wcml') ?></a>
30
+ <a href="javascript:void(0);" class="wcml_custom_prices_manually_block_hide">- <?php _e('Hide prices in other currencies','wpml-wcml') ?></a>
31
+ </div>
32
+ </div>
33
+
34
+ <div class="wcml_custom_prices_manually_block">
35
+
36
+ <?php $currencies = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "icl_currencies ORDER BY `id` ASC", OBJECT);
37
+ $wc_currencies = get_woocommerce_currencies();
38
+
39
+ foreach($currencies as $currency){
40
+
41
+ $regular_price = '';
42
+ $sale_price = '';
43
+
44
+ if(isset($custom_prices['_wcml_custom_prices_status'])){
45
+
46
+ if(isset($custom_prices['_regular_price_'.$currency->code][0])){
47
+ $regular_price = $custom_prices['_regular_price_'.$currency->code][0];
48
+ }
49
+
50
+ if(isset($custom_prices['_sale_price_'.$currency->code][0])){
51
+ $sale_price = $custom_prices['_sale_price_'.$currency->code][0];
52
+ }
53
+ } ?>
54
+ <div class="currency_blck">
55
+ <label>
56
+ <?php echo $wc_currencies[$currency->code].sprintf(__(' (%s)','wpml-wcml'),get_woocommerce_currency_symbol($currency->code)) ?>
57
+ </label>
58
+
59
+ <?php if($regular_price == ''): ?>
60
+ <span class="wcml_no_price_message"><?php _e('Determined automatically based on exchange rate','wpml-wcml'); ?></span>
61
+ <?php endif; ?>
62
+
63
+ <?php if($is_variation){
64
+ $custom_id = '['.$currency->code.']['.$post_id.']';
65
+
66
+ if(version_compare(preg_replace('#-(.+)$#', '', $woocommerce->version), '2.1', '<')){
67
+ $wc_input_type = 'number';
68
+ }else{
69
+ $wc_input_type = 'text';
70
+ }
71
+ ?>
72
+ <p>
73
+ <label><?php echo __( 'Regular Price', 'woocommerce' ) . ' ('.get_woocommerce_currency_symbol($currency->code).')' ?></label>
74
+ <input type="<?php echo $wc_input_type; ?>" size="5" name="_custom_variation_regular_price<?php echo $custom_id ?>" class="wc_input_price wcml_input_price short" value="<?php echo $regular_price ?>" step="any" min="0" />
75
+ </p>
76
+
77
+ <p>
78
+ <label><?php echo __( 'Sale Price', 'woocommerce' ) . ' ('.get_woocommerce_currency_symbol($currency->code).')' ?></label>
79
+ <input type="<?php echo $wc_input_type; ?>" size="5" name="_custom_variation_sale_price<?php echo $custom_id ?>" class="wc_input_price wcml_input_price short" value="<?php echo $sale_price ?>" step="any" min="0" />
80
+ </p>
81
+ <?php }else{
82
+ $custom_id = '['.$currency->code.']';
83
+
84
+ $wc_input = array();
85
+
86
+ if(version_compare(preg_replace('#-(.+)$#', '', $woocommerce->version), '2.1', '<')){
87
+ $wc_input['custom_attributes'] = array('step' => 'any','min' => '0') ;
88
+ $wc_input['type_name'] = 'type';
89
+ $wc_input['type_val'] = 'number';
90
+ }else{
91
+ $wc_input['custom_attributes'] = array() ;
92
+ $wc_input['type_name'] = 'data_type';
93
+ $wc_input['type_val'] = 'price';
94
+ }
95
+
96
+ woocommerce_wp_text_input( array( 'id' => '_custom_regular_price'.$custom_id, 'value'=>$regular_price ,'class' => 'wc_input_price wcml_input_price short', 'label' => __( 'Regular Price', 'woocommerce' ) . ' ('.get_woocommerce_currency_symbol($currency->code).')', $wc_input['type_name'] => $wc_input['type_val'], 'custom_attributes' => $wc_input['custom_attributes'] ) );
97
+
98
+ woocommerce_wp_text_input( array( 'id' => '_custom_sale_price'.$custom_id, 'value'=>$sale_price , 'class' => 'wc_input_price wcml_input_price short', 'label' => __( 'Sale Price', 'woocommerce' ) . ' ('.get_woocommerce_currency_symbol($currency->code).')', $wc_input['type_name'] => $wc_input['type_val'], 'custom_attributes' => $wc_input['custom_attributes'] ) );
99
+ } ?>
100
+ <div class="wcml_schedule">
101
+ <label><?php _e('Schedule','wpml-wcml') ?></label>
102
+ <div class="wcml_schedule_options">
103
+ <?php $checked = (!isset($custom_prices['_wcml_schedule_'.$currency->code]) || (isset($custom_prices['_wcml_schedule_'.$currency->code]) && $custom_prices['_wcml_schedule_'.$currency->code][0] == 0))?'checked="checked"':' '; ?>
104
+
105
+ <input type="radio" name="_wcml_schedule[<?php echo $currency->code.']'.$html_id; ?>" id="wcml_schedule_auto[<?php echo $currency->code.']'.$html_id ?>" value="0" class="wcml_schedule_input"<?php echo $checked ?> />
106
+ <label for="wcml_schedule_auto[<?php echo $currency->code.']'.$html_id ?>"><?php _e('Same as default currency','wpml-wcml')?></label>
107
+
108
+ <?php $checked = isset($custom_prices['_wcml_schedule_'.$currency->code]) && $custom_prices['_wcml_schedule_'.$currency->code][0] == 1?'checked="checked"':' '; ?>
109
+
110
+ <input type="radio" name="_wcml_schedule[<?php echo $currency->code.']'.$html_id ?>" value="1" id="wcml_schedule_manually[<?php echo $currency->code.']'.$html_id ?>" class="wcml_schedule_input" <?php echo $checked ?> />
111
+ <label for="wcml_schedule_manually[<?php echo $currency->code.']'.$html_id ?>"><?php _e('Set dates','wpml-wcml') ?>
112
+ <span class="block_actions">(
113
+ <a href="javascript:void(0);" class="wcml_schedule_manually_block_show"><?php _e('Schedule','wpml-wcml') ?></a>
114
+ <a href="javascript:void(0);" class="wcml_schedule_manually_block_hide"><?php _e('Collapse','wpml-wcml') ?></a>
115
+ )</span>
116
+ </label>
117
+
118
+ <div class="wcml_schedule_dates">
119
+ <?php
120
+ $sale_price_dates_from = (isset($custom_prices['_sale_price_dates_from_'.$currency->code]) && $custom_prices['_sale_price_dates_from_'.$currency->code][0] != '') ? date_i18n( 'Y-m-d', $custom_prices['_sale_price_dates_from_'.$currency->code][0] ) : '';
121
+ $sale_price_dates_to = (isset($custom_prices['_sale_price_dates_to_'.$currency->code]) && $custom_prices['_sale_price_dates_to_'.$currency->code][0] != '') ? date_i18n( 'Y-m-d', $custom_prices['_sale_price_dates_to_'.$currency->code][0] ) : '';
122
+ ?>
123
+ <input type="text" class="short custom_sale_price_dates_from" name="_custom_sale_price_dates_from<?php echo $custom_id; ?>" id="_custom_sale_price_dates_from<?php echo $custom_id; ?>" value="<?php echo esc_attr( $sale_price_dates_from ) ?>" placeholder="<?php echo _x( 'From&hellip;', 'placeholder', 'woocommerce' ) ?> YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
124
+ <input type="text" class="short custom_sale_price_dates_to" name="_custom_sale_price_dates_to<?php echo $custom_id; ?>" id="_custom_sale_price_dates_to<?php echo $custom_id; ?>" value="<?php echo esc_attr( $sale_price_dates_to ) ?>" placeholder="<?php echo _x( 'To&hellip;', 'placeholder', 'woocommerce' ) ?> YYYY-MM-DD" maxlength="10" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />
125
+ </div>
126
+
127
+ </div>
128
+ </div>
129
+
130
+ </div>
131
+ <?php } ?>
132
+
133
+
134
+ </div>
135
+
136
+ <div class="wcml_automaticaly_prices_block">
137
+
138
+ <?php
139
+ foreach($currencies as $currency){
140
+
141
+ $regular_price = '';
142
+ $sale_price = '';
143
+
144
+ if($post_id){
145
+
146
+ $regular_price = get_post_meta($post_id,'_regular_price',true);
147
+ if($regular_price){
148
+ $regular_price = $regular_price*$currency->value;
149
+ }
150
+
151
+ $sale_price = get_post_meta($post_id,'_sale_price',true);
152
+ if($sale_price){
153
+ $sale_price = $sale_price*$currency->value;
154
+ }
155
+ } ?>
156
+
157
+ <label><?php echo $wc_currencies[$currency->code].sprintf(__(' (%s)','wpml-wcml'),get_woocommerce_currency_symbol($currency->code)) ?></label>
158
+
159
+ <?php
160
+ if($is_variation){ ?>
161
+ <p>
162
+ <label><?php echo __( 'Regular Price', 'woocommerce' ) . ' ('.get_woocommerce_currency_symbol($currency->code).')' ?></label>
163
+ <input type="number" size="5" name="_readonly_regular_price" class="wc_input_price short" value="<?php echo $regular_price ?>" step="any" min="0" readonly = "readonly" rel="<?php echo $currency->value ?>" />
164
+ </p>
165
+
166
+ <p>
167
+ <label><?php echo __( 'Sale Price', 'woocommerce' ) . ' ('.get_woocommerce_currency_symbol($currency->code).')' ?></label>
168
+ <input type="number" size="5" name="_readonly_sale_price" class="wc_input_price short" value="<?php echo $sale_price ?>" step="any" min="0" readonly = "readonly" rel="<?php echo $currency->value ?>" />
169
+ </p>
170
+ <?php
171
+
172
+ }else{
173
+
174
+ $wc_input['custom_attributes'] = array( 'readonly' => 'readonly', 'rel'=> $currency->value ) ;
175
+
176
+ woocommerce_wp_text_input( array( 'id' => '_readonly_regular_price', 'value'=>$regular_price, 'class' => 'wc_input_price short', 'label' => __( 'Regular Price', 'woocommerce' ) . ' ('.get_woocommerce_currency_symbol($currency->code).')', $wc_input['type_name'] => $wc_input['type_val'], 'custom_attributes' => $wc_input['custom_attributes'] ) );
177
+
178
+ woocommerce_wp_text_input( array( 'id' => '_readonly_sale_price', 'value'=>$sale_price, 'class' => 'wc_input_price short', 'label' => __( 'Sale Price', 'woocommerce' ) . ' ('.get_woocommerce_currency_symbol($currency->code).')', $wc_input['type_name'] => $wc_input['type_val'], 'custom_attributes' => $wc_input['custom_attributes'] ) );
179
+ }
180
+
181
+ } ?>
182
+
183
+ </div>
184
+ </div>
185
+ <?php if($is_variation){ ?>
186
+ </td></tr>
187
+ <?php } ?>
menu/sub/images-box.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <button id="prod_images_link_<?php echo $lang ?>" class="button-secondary js-table-toggle prod_images_link<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" data-text-opened="<?php _e('Collapse','wpml-wcml'); ?>" data-text-closed="<?php _e('Expand','wpml-wcml'); ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>>
2
+ <span><?php _e('Expand','wpml-wcml'); ?></span>
3
+ <i class="icon-caret-down"></i>
4
+ </button>
5
+
6
+ <table id="prod_images_<?php echo $lang ?>" class="widefat prod_images js-table">
7
+ <tbody>
8
+ <tr>
9
+ <?php if($template_data['original']): ?>
10
+ <td></td>
11
+ <?php if(!isset($template_data['empty_images'])): ?>
12
+ <?php foreach($template_data['images_thumbnails'] as $prod_image): ?>
13
+ <td>
14
+ <?php echo wp_get_attachment_image( $prod_image , 'thumbnail'); ?>
15
+ </td>
16
+ <?php endforeach; ?>
17
+ <?php endif; ?>
18
+ <?php endif; ?>
19
+ </tr>
20
+ <?php if(isset($template_data['empty_images'])): ?>
21
+ <tr>
22
+ <td><?php _e('Please set images for product','wpml-wcml'); ?></td>
23
+ </tr>
24
+ <?php elseif(isset($template_data['empty_translation'])): ?>
25
+ <tr>
26
+ <td><?php _e('Please save translation before translate images texts','wpml-wcml'); ?></td>
27
+ </tr>
28
+ <?php else: ?>
29
+ <?php $texts = array('title','caption','description'); ?>
30
+ <?php foreach($texts as $text): ?>
31
+ <tr>
32
+ <td>
33
+ <?php if($text == 'title'): ?>
34
+ <?php _e('Title','wpml-wcml'); ?>
35
+ <?php elseif($text == 'caption'): ?>
36
+ <?php _e('Caption','wpml-wcml'); ?>
37
+ <?php else: ?>
38
+ <?php _e('Description','wpml-wcml'); ?>
39
+ <?php endif; ?>
40
+ </td>
41
+ <?php foreach($template_data['images_data'] as $key=>$image_data): ?>
42
+ <?php if(!empty($image_data)): ?>
43
+ <td>
44
+ <?php if($template_data['original']): ?>
45
+ <input type="text" value="<?php echo $image_data[$text]?>" readonly="readonly"/>
46
+ <?php else: ?>
47
+ <input type="text" name="images[<?php echo $key ?>][<?php echo $text; ?>]" value="<?php echo $image_data[$text]?>" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"/>
48
+ <?php endif; ?>
49
+ </td>
50
+ <?php endif; ?>
51
+ <?php endforeach; ?>
52
+ </tr>
53
+ <?php endforeach; ?>
54
+ <?php endif; ?>
55
+ </tbody>
56
+ </table>
menu/sub/products.php CHANGED
@@ -87,7 +87,7 @@ $button_labels = array(
87
  <button type="button" value="reset" class="button-secondary wcml_reset_search"><?php _e('Reset', 'wpml-wcml'); ?></button>
88
  <?php endif;?>
89
  <p>
90
- <?php if(current_user_can('manage_options')): ?>
91
  <div class="wcml_product_actions">
92
  <p>
93
  <select name="test_action">
@@ -121,7 +121,7 @@ $button_labels = array(
121
  <table class="widefat fixed wcml_products" cellspacing="0">
122
  <thead>
123
  <tr>
124
- <th scope="col"><input type="checkbox" value="" class="wcml_check_all"/></th>
125
  <th scope="col" width="5%"><?php _e('Type', 'wpml-wcml') ?></th>
126
  <th scope="col" width="20%"><?php _e('Product', 'wpml-wcml') ?></th>
127
  <th scope="col" width="73%"><?php echo $woocommerce_wpml->products->get_translation_flags($active_languages,$default_language,isset($_GET['slang']) && $_GET['slang'] != "all"?$_GET['slang']:false); ?></th>
@@ -131,7 +131,7 @@ $button_labels = array(
131
  <?php
132
  $lang_codes = array();
133
  foreach ($active_languages as $language) {
134
- if($default_language == $language['code'] || current_user_can('manage_options') || (wpml_check_user_is_translator($default_language,$language['code']) && !current_user_can('manage_options')) ){
135
  if(!isset($_GET['slang']) || (isset($_GET['slang']) && ($_GET['slang'] == $language['code'] || $default_language == $language['code'] || $_GET['slang'] == 'all')))
136
  $lang_codes[$language['code']] = $language['display_name'];
137
  }
@@ -272,7 +272,9 @@ $button_labels = array(
272
  }
273
  }
274
 
275
- if(is_array($trn_contents)): ?>
 
 
276
  <?php if(in_array($product_content, array('_file_paths'))): ?>
277
  <?php
278
  $file_paths = '';
@@ -350,9 +352,9 @@ $button_labels = array(
350
  <button type="button" class="button-secondary wcml_file_paths<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>><?php _e('Choose a file', 'wpml-wcml') ?></button>
351
  <?php else: ?>
352
  <?php if($default_language == $key): ?>
353
- <textarea rows="1" disabled="disabled"><?php echo $trn_contents; ?></textarea><br>
354
- <?php elseif(in_array($product_content,array('regular_price','sale_price'))): ?>
355
- <input class="<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" type="text" name="<?php echo $product_content.'_'.$key; ?>" value="<?php echo $trn_contents; ?>" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>" <?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> />
356
  <?php else: ?>
357
  <input class="<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" type="text" name="<?php echo $product_content.'_'.$key; ?>" value="<?php echo $trn_contents; ?>" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> /><br>
358
  <?php endif;?>
@@ -419,7 +421,7 @@ $button_labels = array(
419
  </div>
420
  <div class="clr"></div>
421
 
422
- <?php if(current_user_can('manage_options')): ?>
423
  <div class="wcml_product_actions">
424
  <select name="test_action_bottom">
425
  <?php /*<option value="duplicate"><?php _e('Duplicate for testing', 'wpml-wcml'); ?></option> */ ?>
87
  <button type="button" value="reset" class="button-secondary wcml_reset_search"><?php _e('Reset', 'wpml-wcml'); ?></button>
88
  <?php endif;?>
89
  <p>
90
+ <?php if(current_user_can('wpml_manage_woocommerce_multilingual')): ?>
91
  <div class="wcml_product_actions">
92
  <p>
93
  <select name="test_action">
121
  <table class="widefat fixed wcml_products" cellspacing="0">
122
  <thead>
123
  <tr>
124
+ <th scope="col" width="2%"><input type="checkbox" value="" class="wcml_check_all"/></th>
125
  <th scope="col" width="5%"><?php _e('Type', 'wpml-wcml') ?></th>
126
  <th scope="col" width="20%"><?php _e('Product', 'wpml-wcml') ?></th>
127
  <th scope="col" width="73%"><?php echo $woocommerce_wpml->products->get_translation_flags($active_languages,$default_language,isset($_GET['slang']) && $_GET['slang'] != "all"?$_GET['slang']:false); ?></th>
131
  <?php
132
  $lang_codes = array();
133
  foreach ($active_languages as $language) {
134
+ if($default_language == $language['code'] || current_user_can('wpml_manage_woocommerce_multilingual') || (wpml_check_user_is_translator($default_language,$language['code']) && !current_user_can('wpml_manage_woocommerce_multilingual')) ){
135
  if(!isset($_GET['slang']) || (isset($_GET['slang']) && ($_GET['slang'] == $language['code'] || $default_language == $language['code'] || $_GET['slang'] == 'all')))
136
  $lang_codes[$language['code']] = $language['display_name'];
137
  }
272
  }
273
  }
274
 
275
+ if(!$woocommerce_wpml->products->check_custom_field_is_single_value($product_id,$product_content)){
276
+ echo $woocommerce_wpml->products->custom_box($product_id,$product_content,$trn_contents,$key,$lang,$is_duplicate_product);
277
+ }else if(is_array($trn_contents)): ?>
278
  <?php if(in_array($product_content, array('_file_paths'))): ?>
279
  <?php
280
  $file_paths = '';
352
  <button type="button" class="button-secondary wcml_file_paths<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?>><?php _e('Choose a file', 'wpml-wcml') ?></button>
353
  <?php else: ?>
354
  <?php if($default_language == $key): ?>
355
+ <textarea rows="1" disabled="disabled"><?php echo $trn_contents; ?></textarea><br>
356
+ <?php elseif(in_array($product_content,array('_purchase_note'))): ?>
357
+ <textarea class="<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" name="<?php echo $product_content.'_'.$key; ?>" rows="2" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> ><?php echo $trn_contents; ?></textarea>
358
  <?php else: ?>
359
  <input class="<?php if($is_duplicate_product): ?> js-dup-disabled<?php endif;?>" type="text" name="<?php echo $product_content.'_'.$key; ?>" value="<?php echo $trn_contents; ?>" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"<?php if($is_duplicate_product): ?> disabled="disabled"<?php endif;?> /><br>
360
  <?php endif;?>
421
  </div>
422
  <div class="clr"></div>
423
 
424
+ <?php if(current_user_can('wpml_manage_woocommerce_multilingual')): ?>
425
  <div class="wcml_product_actions">
426
  <select name="test_action_bottom">
427
  <?php /*<option value="duplicate"><?php _e('Duplicate for testing', 'wpml-wcml'); ?></option> */ ?>
menu/sub/settings.php CHANGED
@@ -7,37 +7,22 @@
7
  </div>
8
  <div class="wcml-section-content">
9
  <ul>
10
- <?php if (defined('ICL_SITEPRESS_VERSION') && version_compare(ICL_SITEPRESS_VERSION, '2.0.5', '<')) : ?>
11
- <li><i class="icon-warning-sign"></i> <?php printf(__('WooCommerce Multilingual is enabled but not effective. It is not compatible with <a href="%s">WPML</a> versions prior 2.0.5.', 'wpml-wcml'), 'http://wpml.org/'); ?> <a href="http://wpml.org/shop/account/" target="_blank"><?php _e('Update WPML', 'wpml-wcml'); ?></a></li>
12
- <?php elseif (defined('ICL_SITEPRESS_VERSION')) : ?>
13
- <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and activated.', 'wpml-wcml'), '<strong>WPML</strong>'); ?></li>
14
- <?php else : ?>
15
- <li><i class="icon-warning-sign"></i> <?php printf(__('%s plugin is either not installed or not activated.', 'wpml-wcml'), '<strong>WPML</strong>'); ?> <a href="http://wpml.org" target="_blank"><?php _e('Get WPML', 'wpml-wcml'); ?></a></li>
16
  <?php endif; ?>
17
  <?php if (defined('WPML_MEDIA_VERSION')) : ?>
18
- <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and activated.', 'wpml-wcml'), '<strong>WPML Media</strong>'); ?></li>
19
- <?php else : ?>
20
- <li><i class="icon-warning-sign"></i> <?php printf(__('%s plugin is either not installed or not activated.', 'wpml-wcml'), '<strong>WPML Media</strong>'); ?> <a href="http://wpml.org" target="_blank"><?php _e('Get WPML Media', 'wpml-wcml'); ?></a></li>
21
  <?php endif; ?>
22
  <?php if (defined('WPML_TM_VERSION')) : ?>
23
- <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and activated.', 'wpml-wcml'), '<strong>WPML Translation Management</strong>'); ?></li>
24
- <?php else : ?>
25
- <li><i class="icon-warning-sign"></i> <?php printf(__('%s plugin is either not installed or not activated.', 'wpml-wcml'), '<strong>WPML Translation Management</strong>'); ?> <a href="http://wpml.org" target="_blank"><?php _e('Get WPML Translation Management', 'wpml-wcml'); ?></a></li>
26
  <?php endif; ?>
27
  <?php if (defined('WPML_ST_VERSION')) : ?>
28
  <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and activated.', 'wpml-wcml'), '<strong>WPML String Translation</strong>'); ?></li>
29
- <?php else : ?>
30
- <li><i class="icon-warning-sign"></i> <?php printf(__('%s plugin is either not installed or not activated.', 'wpml-wcml'), '<strong>WPML String Translation</strong>'); ?> <a href="http://wpml.org" target="_blank"><?php _e('Get WPML String Translation', 'wpml-wcml'); ?></a></li>
31
  <?php endif; ?>
32
  <?php
33
  global $woocommerce;
34
- if (class_exists('Woocommerce') && $woocommerce && isset($woocommerce->version) && version_compare($woocommerce->version, '2.0', '<')) :
35
- ?>
36
- <li><i class="icon-warning-sign"></i> <?php printf(__('%1$s is installed, but with incorrect version. You need %1$s %2$s or higher. ', 'wpml-wcml'), '<strong>WooCommerce</strong>', '2.0'); ?> <a href="http://wordpress.org/extend/plugins/woocommerce/" target="_blank"><?php _e('Download WooCommerce', 'wpml-wcml'); ?></a></li>
37
- <?php elseif (class_exists('Woocommerce')) : ?>
38
- <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and activated.', 'wpml-wcml'), '<strong>WooCommerce</strong>'); ?></li>
39
- <?php else : ?>
40
- <li><i class="icon-warning-sign"></i> <?php printf(__('%s plugin is either not installed or not activated.', 'wpml-wcml'), '<strong>WooCommerce</strong>'); ?> <a href="http://wordpress.org/extend/plugins/woocommerce/" target="_blank"><?php _e('Download WooCommerce', 'wpml-wcml'); ?></a></li>
41
  <?php endif; ?>
42
  </ul>
43
  </div> <!-- .wcml-section-content -->
@@ -92,7 +77,7 @@
92
  <div class="wcml-section-header">
93
  <h3>
94
  <?php _e('WooCommerce Store Pages','wpml-wcml'); ?>
95
- <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 several WooCommerce shop pages in all the site\'s language. If they are missing, we will create them automatically for you.', 'wpml-wcml') ?>"></i>
96
  </h3>
97
  </div>
98
 
@@ -102,8 +87,9 @@
102
  <?php if($miss_lang == 'non_exist'): ?>
103
  <ul>
104
  <li>
105
- <i class="icon-warning-sign"></i><span><?php _e("One or more WooCommerce pages have not been created",'wpml-wcml'); ?></span>
106
  </li>
 
107
  </ul>
108
  <?php elseif($miss_lang): ?>
109
  <form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">
@@ -121,12 +107,12 @@
121
  </p>
122
  <p>
123
  <strong><?php echo $miss_lang['lang'] ?></strong>
124
- <input class="button" type="submit" name="create_pages" value="<?php esc_attr(_e('Create missing store pages', 'wpml-wcml')) ?>" />
125
  <a id="wcmp_hide" class="wcmp_lang_hide" href="javascript:void(0);"><?php _e('Hide this message', 'wpml-wcml') ?></a>
126
  </p>
127
  </div>
128
  <p>
129
- <a id="wcmp_show" class="none" href="javascript:void(0);"><?php _e('Show missing languages', 'wpml-wcml') ?></a>
130
  </p>
131
  </form>
132
  <?php else: ?>
@@ -150,7 +136,18 @@
150
 
151
  <div class="wcml-section-content js-tax-translation">
152
  <input type="hidden" id="wcml_ingore_taxonomy_translation_nonce" value="<?php echo wp_create_nonce('wcml_ingore_taxonomy_translation_nonce') ?>" />
153
- <?php $taxonomies = array_unique(get_object_taxonomies('product') + get_object_taxonomies('product_variation')); ?>
 
 
 
 
 
 
 
 
 
 
 
154
 
155
  <ul>
156
  <?php
@@ -315,109 +312,211 @@
315
  </ul>
316
  </li>
317
  </ul>
318
-
319
- <p class="button-wrap">
320
- <input type='submit' name="general_options" value='<?php _e('Save', 'wpml-wcml'); ?>' class='button-secondary' />
321
- <?php wp_nonce_field('general_options', 'general_options_nonce'); ?>
322
- </p>
323
-
324
-
325
- </form>
326
 
327
 
328
 
329
- <div id="multi-currency-per-language-details" <?php if ( $woocommerce_wpml->settings['enable_multi_currency'] != WCML_MULTI_CURRENCIES_INDEPENDENT ):?>style="display:none"<?php endif;?>>
330
 
 
 
 
 
 
 
331
  <p>
332
- <?php printf(__('Your store\'s base currency is %s. To change it, go to the %s page.', 'wpml-wcml'),get_option('woocommerce_currency'),'<a href="'. admin_url('admin.php?page=woocommerce_settings&tab=general') .'">WooCommerce settings</a>'); ?>
333
  </p>
334
-
335
  <table class="widefat currency_table" id="currency-table">
336
  <thead>
337
  <tr>
338
- <th><?php _e('Currency code', 'wpml-wcml'); ?></th>
339
- <th><?php printf(__('Exchange rate to %s', 'wpml-wcml'),get_option('woocommerce_currency')); ?></th>
340
- <th><?php _e('Changed', 'wpml-wcml'); ?></th>
341
  <th></th>
342
  </tr>
343
  </thead>
344
- <tfoot>
 
 
 
 
345
  <tr>
346
- <th><?php _e('Currency code', 'wpml-wcml'); ?></th>
347
- <th><?php printf(__('Exchange rate to %s', 'wpml-wcml'),get_option('woocommerce_currency')); ?></th>
348
- <th><?php _e('Changed', 'wpml-wcml'); ?></th>
349
- <th></th>
 
 
 
 
 
 
 
350
  </tr>
351
- </tfoot>
352
- <tbody>
353
  <?php
354
- $currencies = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "icl_currencies ORDER BY `id` DESC", OBJECT);
355
  foreach ($currencies as $key => $currency) : ?>
356
  <tr>
357
  <td class="currency_code" data-message="<?php _e( 'Please fill field', 'wpml-wcml' ); ?>">
358
- <span><?php echo $currency->code; ?></span>
359
- <input type="text" value="<?php echo $currency->code; ?>"/>
360
- </td>
361
- <td class="currency_value" data-message="<?php _e( 'Only numeric', 'wpml-wcml' ); ?>">
362
- <span><?php echo $currency->value; ?></span>
363
- <input type="text" value="<?php echo $currency->value; ?>"/>
364
- </td>
365
- <td class="currency_changed">
366
- <span><?php echo date('d/m/Y',strtotime($currency->changed)); ?></span>
367
  <input type="hidden" value="<?php echo $currency->id; ?>" class="currency_id" />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
368
  </td>
369
  <td class="currency-actions">
370
  <div class="currency_action_update">
371
  <a href="javascript:void(0);" title="<?php esc_attr(_e('Edit', 'wpml-wcml')); ?>" class="edit_currency">
372
  <i class="icon-edit" title="<?php esc_attr(_e('Edit', 'wpml-wcml')); ?>"></i>
373
  </a>
374
- <button type="button" class="button-secondary cancel_currency"><?php _e('Cancel','wpml-wcml'); ?></button>
375
  </div>
376
  <div class="currency_action_delete">
377
  <a href="javascript:void(0);" title="<?php esc_attr(_e('Delete', 'wpml-wcml')); ?>" class="delete_currency">
378
  <i class="icon-trash" title="<?php esc_attr(_e('Delete', 'wpml-wcml')); ?>"></i>
379
  </a>
380
- <button type="button" class="button-secondary save_currency"><?php _e('Save','wpml-wcml'); ?></button>
381
  </div>
382
  </td>
383
  </tr>
384
  <?php endforeach; ?>
 
 
 
 
 
 
 
 
385
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
386
  </tbody>
387
  </table>
 
 
388
 
389
  <?php // this is a template for scripts.js : jQuery('.wcml_add_currency button').click(function(); ?>
390
  <table class="hidden js-table-row-wrapper">
391
  <tr class="edit-mode js-table-row">
392
  <td class="currency_code" data-message="<?php _e( 'Please fill field', 'wpml-wcml' ); ?>">
393
- <span></span>
394
- <input type="text" value="" style="display:block">
395
- </td>
396
- <td class="currency_value" data-message="<?php _e( 'Only numeric', 'wpml-wcml' ); ?>">
397
- <span></span>
398
- <input type="text" value="" style="display:block">
399
- </td>
400
- <td class="currency_changed">
401
- <span></span>
402
- <input type="hidden" value="" class="currency_id" />
 
 
 
 
 
 
 
 
403
  </td>
404
  <td class="currency-actions">
405
  <div class="currency_action_update">
406
  <a href="javascript:void(0);" title="Edit" class="edit_currency" style="display:none">
407
  <i class="icon-edit" title="Edit"></i>
408
  </a>
409
- <button type="button" class="button-secondary cancel_currency" style="display:inline-block"><?php _e('Cancel', 'wpml-wcml') ?></button>
410
  </div>
411
  <div class="currency_action_delete">
412
  <a href="javascript:void(0);" title="Delete" class="delete_currency" style="display:none">
413
  <i class="icon-trash" alt="Delete"></i>
414
  </a>
415
- <button type="button" class="button-secondary save_currency" style="display:inline-block"><?php _e('Save', 'wpml-wcml') ?></button>
416
  </div>
417
  </td>
418
  </tr>
419
  </table>
420
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
421
  <input type="hidden" value="<?php echo WCML_PLUGIN_URL; ?>" class="wcml_plugin_url" />
422
  <input type="hidden" id="upd_currency_nonce" value="<?php echo wp_create_nonce('wcml_update_currency'); ?>" />
423
  <input type="hidden" id="del_currency_nonce" value="<?php echo wp_create_nonce('wcml_delete_currency'); ?>" />
@@ -518,11 +617,18 @@
518
 
519
 
520
  </div>
 
 
 
 
 
 
 
521
 
522
  </div> <!-- .wcml-section-content -->
523
 
524
  </div> <!-- .wcml-section -->
525
-
526
  <div class="troubleshoot_link_block">
527
  <a href="admin.php?page=<?php echo basename(WCML_PLUGIN_PATH) ?>/menu/sub/troubleshooting.php"><?php _e('Troubleshooting page','wpml-wcml'); ?></a>
528
  </div>
7
  </div>
8
  <div class="wcml-section-content">
9
  <ul>
10
+ <?php if (defined('ICL_SITEPRESS_VERSION')) : ?>
11
+ <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and activated.', 'wpml-wcml'), '<strong>WPML</strong>'); ?></li>
 
 
 
 
12
  <?php endif; ?>
13
  <?php if (defined('WPML_MEDIA_VERSION')) : ?>
14
+ <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and activated.', 'wpml-wcml'), '<strong>WPML Media</strong>'); ?></li>
 
 
15
  <?php endif; ?>
16
  <?php if (defined('WPML_TM_VERSION')) : ?>
17
+ <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and activated.', 'wpml-wcml'), '<strong>WPML Translation Management</strong>'); ?></li>
 
 
18
  <?php endif; ?>
19
  <?php if (defined('WPML_ST_VERSION')) : ?>
20
  <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and activated.', 'wpml-wcml'), '<strong>WPML String Translation</strong>'); ?></li>
 
 
21
  <?php endif; ?>
22
  <?php
23
  global $woocommerce;
24
+ if (class_exists('Woocommerce')) : ?>
25
+ <li><i class="icon-ok"></i> <?php printf(__('%s plugin is installed and activated.', 'wpml-wcml'), '<strong>WooCommerce</strong>'); ?></li>
 
 
 
 
 
26
  <?php endif; ?>
27
  </ul>
28
  </div> <!-- .wcml-section-content -->
77
  <div class="wcml-section-header">
78
  <h3>
79
  <?php _e('WooCommerce Store Pages','wpml-wcml'); ?>
80
+ <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>
81
  </h3>
82
  </div>
83
 
87
  <?php if($miss_lang == 'non_exist'): ?>
88
  <ul>
89
  <li>
90
+ <i class="icon-warning-sign"></i><span><?php _e("One or more WooCommerce pages have not been created.",'wpml-wcml'); ?></span>
91
  </li>
92
+ <li><a href="<?php echo version_compare($woocommerce->version, '2.1', '<') ? admin_url('admin.php?page=woocommerce_settings&tab=pages') : admin_url('admin.php?page=wc-status&tab=tools'); ?>"><?php _e('Install WooCommerce Pages') ?></a></li>
93
  </ul>
94
  <?php elseif($miss_lang): ?>
95
  <form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">
107
  </p>
108
  <p>
109
  <strong><?php echo $miss_lang['lang'] ?></strong>
110
+ <input class="button" type="submit" name="create_pages" value="<?php esc_attr(_e('Create missing translations.', 'wpml-wcml')) ?>" />
111
  <a id="wcmp_hide" class="wcmp_lang_hide" href="javascript:void(0);"><?php _e('Hide this message', 'wpml-wcml') ?></a>
112
  </p>
113
  </div>
114
  <p>
115
+ <a id="wcmp_show" class="none" href="javascript:void(0);"><?php _e('Show details about missing translations', 'wpml-wcml') ?></a>
116
  </p>
117
  </form>
118
  <?php else: ?>
136
 
137
  <div class="wcml-section-content js-tax-translation">
138
  <input type="hidden" id="wcml_ingore_taxonomy_translation_nonce" value="<?php echo wp_create_nonce('wcml_ingore_taxonomy_translation_nonce') ?>" />
139
+ <?php
140
+ global $wp_taxonomies;
141
+ $taxonomies = array();
142
+
143
+ //don't use get_taxonomies for product, because when one more post type registered for product taxonomy functions returned taxonomies only for product type
144
+ foreach($wp_taxonomies as $key=>$taxonomy){
145
+ if((in_array('product',$taxonomy->object_type) || in_array('product_variation',$taxonomy->object_type) ) && !in_array($key,$taxonomies)){
146
+ $taxonomies[] = $key;
147
+ }
148
+ }
149
+
150
+ ?>
151
 
152
  <ul>
153
  <?php
312
  </ul>
313
  </li>
314
  </ul>
 
 
 
 
 
 
 
 
315
 
316
 
317
 
318
+
319
 
320
+ <div id="multi-currency-per-language-details" <?php if ( $woocommerce_wpml->settings['enable_multi_currency'] != WCML_MULTI_CURRENCIES_INDEPENDENT ):?>style="display:none"<?php endif;?>>
321
+ <?php
322
+ $wc_currencies = get_woocommerce_currencies();
323
+ $wc_currency = get_option('woocommerce_currency');
324
+ $active_languages = $sitepress->get_active_languages();
325
+ ?>
326
  <p>
327
+ <?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('admin.php?page=woocommerce_settings&tab=general') .'">WooCommerce settings</a>'); ?>
328
  </p>
329
+ <input type="hidden" id="update_currency_lang_nonce" value="<?php echo wp_create_nonce('wcml_update_currency_lang'); ?>"/>
330
  <table class="widefat currency_table" id="currency-table">
331
  <thead>
332
  <tr>
333
+ <th><?php _e('Currency', 'wpml-wcml'); ?></th>
 
 
334
  <th></th>
335
  </tr>
336
  </thead>
337
+ <tbody>
338
+ <?php
339
+
340
+ $currencies = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "icl_currencies ORDER BY `id` ASC", OBJECT);
341
+ $exists_codes = $wpdb->get_col("SELECT code FROM " . $wpdb->prefix . "icl_currencies ORDER BY `id` ASC"); ?>
342
  <tr>
343
+ <td class="currency_code">
344
+ <span class="code_val"><?php echo $wc_currencies[$wc_currency]; ?><?php printf(__(' (%s)','wpml-wcml'),get_woocommerce_currency_symbol($wc_currency)); ?></span>
345
+ <select>
346
+ <option value="<?php echo $wc_currency; ?>" selected="selected"><?php echo $wc_currency; ?></option>
347
+ </select>
348
+ <div class="currency_value">
349
+ <span><?php _e( 'default', 'wpml-wcml' ); ?></span>
350
+ </div>
351
+ </td>
352
+
353
+ <td class="currency-actions"></td>
354
  </tr>
 
 
355
  <?php
356
+ unset($wc_currencies[$wc_currency]);
357
  foreach ($currencies as $key => $currency) : ?>
358
  <tr>
359
  <td class="currency_code" data-message="<?php _e( 'Please fill field', 'wpml-wcml' ); ?>">
360
+ <span class="code_val"><?php echo $wc_currencies[$currency->code]; ?><?php printf(__(' (%s)','wpml-wcml'),get_woocommerce_currency_symbol($currency->code)); ?></span>
 
 
 
 
 
 
 
 
361
  <input type="hidden" value="<?php echo $currency->id; ?>" class="currency_id" />
362
+ <select>
363
+ <?php foreach($wc_currencies as $key=>$currency_name): ?>
364
+ <?php if(!in_array($key,$exists_codes) || $currency->code==$key): ?>
365
+ <option value="<?php echo $key; ?>" <?php echo $currency->code==$key?'selected="selected"':''; ?>><?php echo $currency_name; ?></option>
366
+ <?php endif; ?>
367
+ <?php endforeach; ?>
368
+ </select>
369
+ <div class="currency_value" data-message="<?php _e( 'Only numeric', 'wpml-wcml' ); ?>">
370
+ <span><?php printf('1 %s = ',$wc_currency); ?>
371
+ <span class="curr_val"><?php echo $currency->value; ?></span>
372
+ <input type="text" value="<?php echo $currency->value; ?>"/>
373
+ <span class="curr_val_code"><?php echo $currency->code; ?></span>
374
+ </span>
375
+ </div>
376
+ <span class="currency_changed">(<?php echo date('d/m/Y',strtotime($currency->changed)); ?>)</span>
377
  </td>
378
  <td class="currency-actions">
379
  <div class="currency_action_update">
380
  <a href="javascript:void(0);" title="<?php esc_attr(_e('Edit', 'wpml-wcml')); ?>" class="edit_currency">
381
  <i class="icon-edit" title="<?php esc_attr(_e('Edit', 'wpml-wcml')); ?>"></i>
382
  </a>
383
+ <i class="icon-ok-circle save_currency"></i>
384
  </div>
385
  <div class="currency_action_delete">
386
  <a href="javascript:void(0);" title="<?php esc_attr(_e('Delete', 'wpml-wcml')); ?>" class="delete_currency">
387
  <i class="icon-trash" title="<?php esc_attr(_e('Delete', 'wpml-wcml')); ?>"></i>
388
  </a>
389
+ <i class="icon-remove-circle cancel_currency"></i>
390
  </div>
391
  </td>
392
  </tr>
393
  <?php endforeach; ?>
394
+ <tr class="default_currency">
395
+ <td colspan="2">
396
+ <span class="cur_label"><?php _e('Default currency', 'wpml-wcml'); ?></span>
397
+ <span class="inf_message"><?php _e('Switch to this currency when switching language in the front-end', 'wpml-wcml'); ?></span>
398
+ </td>
399
+ </tr>
400
+ </tbody>
401
+ </table>
402
 
403
+ <div class="currency_wrap">
404
+ <div class="currency_inner">
405
+ <table class="widefat currency_lang_table" id="currency-lang-table">
406
+ <thead>
407
+ <tr>
408
+ <?php foreach($active_languages as $language): ?>
409
+ <th>
410
+ <img src="<?php echo ICL_PLUGIN_URL ?>/res/flags/<?php echo $language['code'] ?>.png" width="18" height="12" />
411
+ </th>
412
+ <?php endforeach; ?>
413
+ </tr>
414
+ </thead>
415
+ <tbody>
416
+ <tr>
417
+ <?php foreach($active_languages as $language): ?>
418
+ <td class="currency_languages">
419
+ <div class="wcml_onof_buttons">
420
+ <ul>
421
+ <li <?php echo $woocommerce_wpml->settings['currencies_languages'][$wc_currency][$language['code']] == 0 ?'class="on"':''; ?> ><a class="off_btn" href="javascript:void(0);" rel="<?php echo $language['code']; ?>"><?php _e( 'OFF', 'wpml-wcml' ); ?></a></li>
422
+ <li <?php echo $woocommerce_wpml->settings['currencies_languages'][$wc_currency][$language['code']] == 1 ?'class="on"':''; ?> ><a class="on_btn" href="javascript:void(0);" rel="<?php echo $language['code']; ?>"><?php _e( 'ON', 'wpml-wcml' ); ?></a></li>
423
+ </ul>
424
+ </div>
425
+ </td>
426
+ <?php endforeach; ?>
427
+ </tr>
428
+ <?php foreach ($currencies as $key => $currency) : ?>
429
+ <tr>
430
+ <?php foreach($active_languages as $language): ?>
431
+ <td class="currency_languages">
432
+ <div class="wcml_onof_buttons">
433
+ <ul>
434
+ <li <?php echo $woocommerce_wpml->settings['currencies_languages'][$currency->code][$language['code']] == 0 ?'class="on"':''; ?> ><a class="off_btn" href="javascript:void(0);" rel="<?php echo $language['code']; ?>"><?php _e( 'OFF', 'wpml-wcml' ); ?></a></li>
435
+ <li <?php echo $woocommerce_wpml->settings['currencies_languages'][$currency->code][$language['code']] == 1 ?'class="on"':''; ?> ><a class="on_btn" href="javascript:void(0);" rel="<?php echo $language['code']; ?>"><?php _e( 'ON', 'wpml-wcml' ); ?></a></li>
436
+ </ul>
437
+ </div>
438
+ </td>
439
+ <?php endforeach; ?>
440
+ </tr>
441
+ <?php endforeach; ?>
442
+ <tr class="default_currency">
443
+ <input type="hidden" id="wcml_update_default_currency_nonce" value="<?php echo wp_create_nonce('wcml_update_default_currency'); ?>"/>
444
+ <?php foreach($active_languages as $language): ?>
445
+ <td class="currency_languages">
446
+ <select rel="<?php echo $language['code']; ?>">
447
+ <option value="0" <?php echo $woocommerce_wpml->settings['default_currencies'][$language['code']] == false ?'selected="selected"':''; ?>><?php _e('Keep', 'wpml-wcml'); ?></option>
448
+ <?php if($woocommerce_wpml->settings['currencies_languages'][$wc_currency][$language['code']] == 1): ?>
449
+ <option value="<?php echo $wc_currency; ?>" <?php echo $woocommerce_wpml->settings['default_currencies'][$language['code']] == $wc_currency ?'selected="selected"':''; ?>><?php echo $wc_currency; ?></option>
450
+ <?php endif; ?>
451
+ <?php foreach($exists_codes as $code): ?>
452
+ <?php if($woocommerce_wpml->settings['currencies_languages'][$code][$language['code']] == 1): ?>
453
+ <option value="<?php echo $code; ?>" <?php echo $woocommerce_wpml->settings['default_currencies'][$language['code']] == $code ?'selected="selected"':''; ?>><?php echo $code; ?></option>
454
+ <?php endif; ?>
455
+ <?php endforeach; ?>
456
+ </select>
457
+ </td>
458
+ <?php endforeach; ?>
459
+ </tr>
460
  </tbody>
461
  </table>
462
+ </div>
463
+ </div>
464
 
465
  <?php // this is a template for scripts.js : jQuery('.wcml_add_currency button').click(function(); ?>
466
  <table class="hidden js-table-row-wrapper">
467
  <tr class="edit-mode js-table-row">
468
  <td class="currency_code" data-message="<?php _e( 'Please fill field', 'wpml-wcml' ); ?>">
469
+ <span class="code_val"></span>
470
+ <input type="hidden" value="" class="currency_id" />
471
+ <select style="display:block">
472
+ <?php foreach($wc_currencies as $key=>$currency_name): ?>
473
+ <?php if(!in_array($key,$exists_codes)): ?>
474
+ <option value="<?php echo $key; ?>"><?php echo $currency_name; ?></option>
475
+ <?php endif; ?>
476
+ <?php endforeach; ?>
477
+ </select>
478
+ <div class="currency_value" data-message="<?php _e( 'Only numeric', 'wpml-wcml' ); ?>">
479
+ <span>
480
+ <?php printf('1 %s = ',$wc_currency); ?>
481
+ <span class="curr_val"></span>
482
+ <input type="text" value="" style="display: inline-block;">
483
+ <span class="curr_val_code"></span>
484
+ </span>
485
+ </div>
486
+ <span class="currency_changed"></span>
487
  </td>
488
  <td class="currency-actions">
489
  <div class="currency_action_update">
490
  <a href="javascript:void(0);" title="Edit" class="edit_currency" style="display:none">
491
  <i class="icon-edit" title="Edit"></i>
492
  </a>
493
+ <i class="icon-ok-circle save_currency" style="display:inline"></i>
494
  </div>
495
  <div class="currency_action_delete">
496
  <a href="javascript:void(0);" title="Delete" class="delete_currency" style="display:none">
497
  <i class="icon-trash" alt="Delete"></i>
498
  </a>
499
+ <i class="icon-remove-circle cancel_currency" style="display:inline"></i>
500
  </div>
501
  </td>
502
  </tr>
503
  </table>
504
 
505
+ <table class="hidden js-currency_lang_table">
506
+ <tr>
507
+ <?php foreach($active_languages as $language): ?>
508
+ <td class="currency_languages">
509
+ <div class="wcml_onof_buttons">
510
+ <ul>
511
+ <li><a class="off_btn" href="javascript:void(0);" rel="<?php echo $language['code']; ?>"><?php _e( 'OFF', 'wpml-wcml' ); ?></a></li>
512
+ <li class="on"><a class="on_btn" href="javascript:void(0);" rel="<?php echo $language['code']; ?>"><?php _e( 'ON', 'wpml-wcml' ); ?></a></li>
513
+ </ul>
514
+ </div>
515
+ </td>
516
+ <?php endforeach; ?>
517
+ </tr>
518
+ </table>
519
+
520
  <input type="hidden" value="<?php echo WCML_PLUGIN_URL; ?>" class="wcml_plugin_url" />
521
  <input type="hidden" id="upd_currency_nonce" value="<?php echo wp_create_nonce('wcml_update_currency'); ?>" />
522
  <input type="hidden" id="del_currency_nonce" value="<?php echo wp_create_nonce('wcml_delete_currency'); ?>" />
617
 
618
 
619
  </div>
620
+ <p class="button-wrap">
621
+ <input type='submit' name="general_options" value='<?php _e('Save', 'wpml-wcml'); ?>' class='button-secondary' />
622
+ <?php wp_nonce_field('general_options', 'general_options_nonce'); ?>
623
+ </p>
624
+
625
+
626
+ </form>
627
 
628
  </div> <!-- .wcml-section-content -->
629
 
630
  </div> <!-- .wcml-section -->
631
+ <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');?>"/>
632
  <div class="troubleshoot_link_block">
633
  <a href="admin.php?page=<?php echo basename(WCML_PLUGIN_PATH) ?>/menu/sub/troubleshooting.php"><?php _e('Troubleshooting page','wpml-wcml'); ?></a>
634
  </div>
menu/sub/variations_box.php CHANGED
@@ -11,54 +11,34 @@
11
  <?php else: ?>
12
  <tbody>
13
  <tr>
 
14
  <th></th>
 
15
  <?php foreach($template_data['all_variations_ids'] as $variation_id): ?>
16
  <th>
17
- <?php echo $template_data['regular_price'][$variation_id]['label']; ?>
18
  </th>
19
  <?php endforeach; ?>
20
  </tr>
21
 
22
  <?php if(isset($template_data['empty_translation'])): ?>
23
  <tr>
24
- <td><?php _e('Please save translation before translate variations prices','wpml-wcml'); ?></td>
25
  </tr>
26
- <?php else: ?>
27
- <?php $texts = array('regular_price','sale_price'); ?>
28
- <?php foreach($texts as $text): ?>
29
  <tr>
30
- <td>
31
- <?php if($text == 'regular_price'): ?>
32
- <?php _e('Regular price','wpml-wcml'); ?>
33
- <?php else: ?>
34
- <?php _e('Sale price','wpml-wcml'); ?>
35
- <?php endif; ?>
36
- </td>
37
- <?php foreach($template_data['all_variations_ids'] as $variation_id): ?>
38
- <?php if(isset($template_data[$text][$variation_id]['not_translated'])): ?>
39
- <td></td>
40
- <?php else: ?>
41
- <?php if($template_data[$text][$variation_id]['label'] == ''): ?>
42
- <td></td>
43
- <?php continue; endif; ?>
44
- <?php if($template_data['original']): ?>
45
- <td><input class="wcml_price" type="text" value="<?php echo $template_data[$text][$variation_id]['value']?>" readonly="readonly" /></td>
46
- <?php else: ?>
47
- <td><input class="wcml_price" type="text" name="<?php echo $text; ?>_<?php echo $lang ?>[<?php echo $variation_id ?>]" value="<?php echo $template_data[$text][$variation_id]['value']?>" placeholder="<?php esc_attr_e('Enter translation', 'wpml-wcml') ?>"/></td>
48
- <?php endif; ?>
49
- <?php endif; ?>
50
- <?php endforeach; ?>
51
  </tr>
52
- <?php endforeach; ?>
53
- <?php if(isset($template_data['all_file_paths'])): ?>
54
  <tr>
55
  <td><?php _e('Download URL','wpml-wcml'); ?></td>
56
  <?php foreach($template_data['all_variations_ids'] as $variation_id): $file_paths = ''; ?>
57
- <?php if($template_data['regular_price'][$variation_id]['label'] == '' || isset($template_data['regular_price'][$variation_id]['not_translated'])){
58
  echo '<td></td>';
59
  continue;
60
  }
61
- if(isset($template_data['all_file_paths'][$variation_id])):
62
  $file_paths_array = unserialize($template_data['all_file_paths'][$variation_id]['value']);
63
  foreach($file_paths_array as $trn_file_paths){
64
  $file_paths = $file_paths ? $file_paths . "\n" .$trn_file_paths : $trn_file_paths;
@@ -73,7 +53,7 @@
73
  <?php endif; ?>
74
  </td>
75
  <?php else: ?>
76
- <td></td>
77
  <?php endif; ?>
78
  <?php endforeach; ?>
79
  </tr>
11
  <?php else: ?>
12
  <tbody>
13
  <tr>
14
+ <?php if($is_downloable): ?>
15
  <th></th>
16
+ <?php endif; ?>
17
  <?php foreach($template_data['all_variations_ids'] as $variation_id): ?>
18
  <th>
19
+ <?php echo $template_data['all_file_paths'][$variation_id]['label']; ?>
20
  </th>
21
  <?php endforeach; ?>
22
  </tr>
23
 
24
  <?php if(isset($template_data['empty_translation'])): ?>
25
  <tr>
26
+ <td><?php _e('Please save translation before translate variations file paths','wpml-wcml'); ?></td>
27
  </tr>
28
+ <?php elseif(isset($template_data['not_downloaded'])): ?>
 
 
29
  <tr>
30
+ <td><?php _e('Variations are not downloadable','wpml-wcml'); ?></td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  </tr>
32
+ <?php else: ?>
33
+ <?php if($is_downloable): ?>
34
  <tr>
35
  <td><?php _e('Download URL','wpml-wcml'); ?></td>
36
  <?php foreach($template_data['all_variations_ids'] as $variation_id): $file_paths = ''; ?>
37
+ <?php if($template_data['all_file_paths'][$variation_id]['label'] == '' || isset($template_data['all_file_paths'][$variation_id]['not_translated'])){
38
  echo '<td></td>';
39
  continue;
40
  }
41
+ if(get_post_meta($variation_id,'_downloadable',true) == 'yes'):
42
  $file_paths_array = unserialize($template_data['all_file_paths'][$variation_id]['value']);
43
  foreach($file_paths_array as $trn_file_paths){
44
  $file_paths = $file_paths ? $file_paths . "\n" .$trn_file_paths : $trn_file_paths;
53
  <?php endif; ?>
54
  </td>
55
  <?php else: ?>
56
+ <td><?php _e('Variation is not downloadable','wpml-wcml'); ?></td>
57
  <?php endif; ?>
58
  <?php endforeach; ?>
59
  </tr>
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multili
5
  License: GPLv2
6
  Requires at least: 3.0
7
  Tested up to: 3.8
8
- Stable tag: 3.1
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
@@ -77,6 +77,18 @@ In order for the checkout and store pages to appear translated, you need to crea
77
 
78
  == Changelog ==
79
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  = 3.1 =
81
  * Support for multi-currency (independent of language) BETA
82
  * Support for translating products via ICanLocalize (professional translation)
5
  License: GPLv2
6
  Requires at least: 3.0
7
  Tested up to: 3.8
8
+ Stable tag: 3.2
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
77
 
78
  == Changelog ==
79
 
80
+ = 3.2 =
81
+ * Compatibility with upcoming WooCommerce 2.1
82
+ * Multi-currency support: configure currencies per languages
83
+ * Multi-currency support: custom prices for different currencies
84
+ * Support translation for the attribute base (permalinks)
85
+ * Bug: Emails not sent in the correct language when uses bulk action on orders list page
86
+ * Bug: Order notes email in wrong language in certain circumstances
87
+ * Bug: Shipping method names are being registered in the wrong language
88
+ * Bug: WooCommerce Multilingual menu doesn't display for translators
89
+ * Bug: Using 'category' for products cat slug conflicts with posts 'category'
90
+ * Bug: Paypal rejects payments with decimals on certain currencies
91
+
92
  = 3.1 =
93
  * Support for multi-currency (independent of language) BETA
94
  * Support for translating products via ICanLocalize (professional translation)
woocommerce_wpml.class.php CHANGED
@@ -18,30 +18,37 @@ class woocommerce_wpml {
18
  }
19
 
20
  function init(){
21
- global $sitepress,$pagenow;
22
-
23
  new WCML_Upgrade;
24
 
25
  $this->settings = $this->get_settings();
26
 
27
  $this->dependencies = new WCML_Dependencies;
 
 
 
 
28
  if(!$this->dependencies->check()){
29
  return false;
30
  }
31
 
 
 
32
  if($this->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT){
33
  require WCML_PLUGIN_PATH . '/inc/multi-currency-support.class.php';
34
  $WCML_Multi_Currency_Support = new WCML_Multi_Currency_Support;
35
  require_once WCML_PLUGIN_PATH . '/inc/multi-currency.class.php';
36
  $WCML_WC_MultiCurrency = new WCML_WC_MultiCurrency;
37
  }
38
-
39
  $this->products = new WCML_Products;
40
  $this->store = new WCML_Store_Pages;
41
  $this->emails = new WCML_Emails;
42
  $this->terms = new WCML_Terms;
43
  $this->orders = new WCML_Orders;
44
  $this->troubleshooting = new WCML_Troubleshooting();
 
 
 
45
 
46
  new WCML_Ajax_Setup;
47
  new WCML_WC_Strings;
@@ -50,14 +57,10 @@ class woocommerce_wpml {
50
 
51
  $this->install();
52
 
53
- add_action('admin_menu', array($this, 'menu'));
54
-
55
  add_action('init', array($this,'load_locale'));
56
 
57
  register_deactivation_hook(__FILE__, array($this, 'deactivation_actions'));
58
 
59
- add_action('init', array($this, 'load_css_and_js'));
60
-
61
  if(is_admin()){
62
  add_action('admin_footer', array($this, 'documentation_links'));
63
  add_action('admin_notices', array($this, 'admin_notice_after_install'));
@@ -75,10 +78,17 @@ class woocommerce_wpml {
75
  $this->translate_product_slug();
76
 
77
  if(is_admin() && ((isset($_GET['page']) && $_GET['page'] == 'wpml-wcml')
78
- || (($pagenow == 'edit.php' || $pagenow == 'post-new.php') && isset($_GET['post_type']) && $_GET['post_type'] == 'shop_coupon')
79
- || ($pagenow == 'post.php' && isset($_GET['post']) && get_post_type($_GET['post']) == 'shop_coupon'))){
80
  remove_action( 'wp_before_admin_bar_render', array($sitepress, 'admin_language_switcher') );
81
  }
 
 
 
 
 
 
 
82
  }
83
 
84
  function translate_product_slug(){
@@ -184,64 +194,107 @@ class woocommerce_wpml {
184
 
185
  function install(){
186
  global $wpdb;
 
 
 
 
 
 
 
187
 
188
- if ($this->settings['is_term_order_synced'] !== 'yes') {
189
- //global term ordering resync when moving to >= 3.3.x
190
- add_action('init', array($this->terms, 'sync_term_order_globally'), 20);
191
- }
192
-
193
- if(!get_option('wcml_custom_attr_translations')){
194
- add_option('wcml_custom_attr_translations',array());
195
- }
196
 
197
- if(!isset($this->settings['wc_admin_options_saved'])){
198
- $this->handle_admin_texts();
199
- $this->settings['wc_admin_options_saved'] = 1;
200
- $this->update_settings();
201
- }
202
 
203
- if(!isset($this->settings['trnsl_interface'])){
204
- $this->settings['trnsl_interface'] = 1;
205
- $this->update_settings();
206
- }
207
-
208
- if(!isset($this->settings['products_sync_date'])){
209
- $this->settings['products_sync_date'] = 1;
 
 
 
 
210
  $this->update_settings();
 
211
  }
212
 
213
  require_once WCML_PLUGIN_PATH . '/inc/multi-currency.class.php';
214
  WCML_WC_MultiCurrency::install();
215
 
216
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217
 
218
  function menu(){
219
- $top_page = apply_filters('icl_menu_main_page', basename(ICL_PLUGIN_PATH) .'/menu/languages.php');
 
220
 
221
- if(current_user_can('manage_options')){
222
- add_submenu_page($top_page, __('WooCommerce Multilingual','wpml-wcml'),
223
- __('WooCommerce Multilingual', 'wpml-wcml'), 'manage_options', 'wpml-wcml', array($this, 'menu_content'));
224
 
 
 
 
 
 
225
 
226
- if(isset($_GET['page']) && $_GET['page'] == basename(WCML_PLUGIN_PATH).'/menu/sub/troubleshooting.php'){
227
- add_submenu_page($top_page,
228
- __('Troubleshooting','wpml-wcml'), __('Troubleshooting','wpml-wcml'),
229
- 'manage_options', basename(WCML_PLUGIN_PATH).'/menu/sub/troubleshooting.php');
 
 
 
 
230
  }
231
-
232
- }else{
233
- global $wpdb,$sitepress_settings;
234
- $user_lang_pairs = get_user_meta(get_current_user_id(), $wpdb->prefix.'language_pairs', true);
235
- if(isset($sitepress_settings['st']['strings_language']) && !empty($user_lang_pairs[$sitepress_settings['st']['strings_language']])){
236
- add_menu_page(__('WooCommerce Multilingual','wpml-wcml'),
237
- __('WooCommerce Multilingual','wpml-wcml'), 'translate',
238
- 'wpml-wcml', array($this, 'menu_content'), ICL_PLUGIN_URL . '/res/img/icon16.png');
 
239
  }
 
240
  }
241
  }
242
 
243
  function menu_content(){
 
244
  include WCML_PLUGIN_PATH . '/menu/management.php';
 
 
 
 
245
  }
246
 
247
  function deactivation_actions(){
@@ -249,7 +302,7 @@ class woocommerce_wpml {
249
  }
250
 
251
  function load_css_and_js() {
252
- if(isset($_GET['page']) && in_array($_GET['page'], array('wpml-wcml',basename(WCML_PLUGIN_PATH).'/menu/sub/troubleshooting.php'))) {
253
 
254
 
255
  if ( !wp_style_is( 'toolset-font-awesome', 'registered' ) ) { // check if style are already registered
@@ -275,6 +328,26 @@ class woocommerce_wpml {
275
  }
276
  }
277
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
  function documentation_links(){
279
  global $post, $pagenow;
280
 
@@ -361,6 +434,10 @@ class woocommerce_wpml {
361
  icl_register_string('URL product_tag slugs - ' . trim($value['tag_base'] ,'/'), 'Url product_tag slug: ' . trim($value['tag_base'] ,'/'), trim($value['tag_base'] ,'/'));
362
  }
363
 
 
 
 
 
364
  $value['product_base'] = trim($value['product_base'], '/');
365
 
366
  return $value;
18
  }
19
 
20
  function init(){
 
 
21
  new WCML_Upgrade;
22
 
23
  $this->settings = $this->get_settings();
24
 
25
  $this->dependencies = new WCML_Dependencies;
26
+
27
+ add_action('init', array($this, 'load_css_and_js'));
28
+ add_action('admin_menu', array($this, 'menu'));
29
+
30
  if(!$this->dependencies->check()){
31
  return false;
32
  }
33
 
34
+ global $sitepress,$pagenow;
35
+
36
  if($this->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT){
37
  require WCML_PLUGIN_PATH . '/inc/multi-currency-support.class.php';
38
  $WCML_Multi_Currency_Support = new WCML_Multi_Currency_Support;
39
  require_once WCML_PLUGIN_PATH . '/inc/multi-currency.class.php';
40
  $WCML_WC_MultiCurrency = new WCML_WC_MultiCurrency;
41
  }
42
+
43
  $this->products = new WCML_Products;
44
  $this->store = new WCML_Store_Pages;
45
  $this->emails = new WCML_Emails;
46
  $this->terms = new WCML_Terms;
47
  $this->orders = new WCML_Orders;
48
  $this->troubleshooting = new WCML_Troubleshooting();
49
+ $this->compatibility = new WCML_Compatibility();
50
+
51
+ include WCML_PLUGIN_PATH . '/inc/woocommerce-2.0-backward-compatibility.php';
52
 
53
  new WCML_Ajax_Setup;
54
  new WCML_WC_Strings;
57
 
58
  $this->install();
59
 
 
 
60
  add_action('init', array($this,'load_locale'));
61
 
62
  register_deactivation_hook(__FILE__, array($this, 'deactivation_actions'));
63
 
 
 
64
  if(is_admin()){
65
  add_action('admin_footer', array($this, 'documentation_links'));
66
  add_action('admin_notices', array($this, 'admin_notice_after_install'));
78
  $this->translate_product_slug();
79
 
80
  if(is_admin() && ((isset($_GET['page']) && $_GET['page'] == 'wpml-wcml')
81
+ || (($pagenow == 'edit.php' || $pagenow == 'post-new.php') && isset($_GET['post_type']) && ($_GET['post_type'] == 'shop_coupon' || $_GET['post_type'] == 'shop_order'))
82
+ || ($pagenow == 'post.php' && isset($_GET['post']) && (get_post_type($_GET['post']) == 'shop_coupon' || get_post_type($_GET['post']) == 'shop_order')))){
83
  remove_action( 'wp_before_admin_bar_render', array($sitepress, 'admin_language_switcher') );
84
  }
85
+
86
+ if((($pagenow == 'post.php' && isset($_GET['post']) && get_post_type($_GET['post']) == 'product') || ($pagenow == 'post-new.php' && isset($_GET['post_type']) && $_GET['post_type'] == 'product'))
87
+ && !$this->settings['trnsl_interface'] && isset($_GET['lang']) && $_GET['lang'] != $sitepress->get_default_language()){
88
+ add_action('init', array($this, 'load_lock_fields_js'));
89
+ add_action( 'admin_footer', array($this,'hidden_label'));
90
+ }
91
+
92
  }
93
 
94
  function translate_product_slug(){
194
 
195
  function install(){
196
  global $wpdb;
197
+
198
+ if(empty($this->settings['set_up'])){ // from 3.2
199
+
200
+ if ($this->settings['is_term_order_synced'] !== 'yes') {
201
+ //global term ordering resync when moving to >= 3.3.x
202
+ add_action('init', array($this->terms, 'sync_term_order_globally'), 20);
203
+ }
204
 
205
+ if(!get_option('wcml_custom_attr_translations')){
206
+ add_option('wcml_custom_attr_translations',array());
207
+ }
 
 
 
 
 
208
 
209
+ if(!isset($this->settings['wc_admin_options_saved'])){
210
+ $this->handle_admin_texts();
211
+ $this->settings['wc_admin_options_saved'] = 1;
212
+ }
 
213
 
214
+ if(!isset($this->settings['trnsl_interface'])){
215
+ $this->settings['trnsl_interface'] = 1;
216
+ }
217
+
218
+ if(!isset($this->settings['products_sync_date'])){
219
+ $this->settings['products_sync_date'] = 1;
220
+ }
221
+
222
+ self::set_up_capabilities();
223
+
224
+ $this->settings['set_up'] = 1;
225
  $this->update_settings();
226
+
227
  }
228
 
229
  require_once WCML_PLUGIN_PATH . '/inc/multi-currency.class.php';
230
  WCML_WC_MultiCurrency::install();
231
 
232
  }
233
+
234
+ public static function set_up_capabilities(){
235
+
236
+ $role = get_role( 'administrator' );
237
+ $role->add_cap( 'wpml_manage_woocommerce_multilingual' );
238
+ $role->add_cap( 'wpml_operate_woocommerce_multilingual' );
239
+
240
+ $super_admins = get_super_admins();
241
+ foreach ($super_admins as $admin) {
242
+ $user = new WP_User( $admin );
243
+ $user->add_cap( 'wpml_manage_woocommerce_multilingual' );
244
+ $user->add_cap( 'wpml_operate_woocommerce_multilingual' );
245
+ }
246
+
247
+ $role = get_role( 'shop_manager' );
248
+ if($role){
249
+ $role->add_cap( 'wpml_operate_woocommerce_multilingual' );
250
+ }
251
+
252
+ }
253
 
254
  function menu(){
255
+ if($this->dependencies->check()){
256
+ $top_page = apply_filters('icl_menu_main_page', basename(ICL_PLUGIN_PATH) .'/menu/languages.php');
257
 
258
+ if(current_user_can('wpml_manage_woocommerce_multilingual')){
259
+ add_submenu_page($top_page, __('WooCommerce Multilingual','wpml-wcml'),
260
+ __('WooCommerce Multilingual', 'wpml-wcml'), 'wpml_manage_woocommerce_multilingual', 'wpml-wcml', array($this, 'menu_content'));
261
 
262
+ if(isset($_GET['page']) && $_GET['page'] == basename(WCML_PLUGIN_PATH).'/menu/sub/troubleshooting.php'){
263
+ add_submenu_page($top_page,
264
+ __('Troubleshooting','wpml-wcml'), __('Troubleshooting','wpml-wcml'),
265
+ 'wpml_manage_troubleshooting', basename(WCML_PLUGIN_PATH).'/menu/sub/troubleshooting.php');
266
+ }
267
 
268
+ }else{
269
+ global $wpdb,$sitepress_settings,$sitepress;
270
+ $user_lang_pairs = get_user_meta(get_current_user_id(), $wpdb->prefix.'language_pairs', true);
271
+ if(isset($sitepress_settings['st']['strings_language']) && !empty($user_lang_pairs[$sitepress->get_default_language()])){
272
+ add_menu_page(__('WooCommerce Multilingual','wpml-wcml'),
273
+ __('WooCommerce Multilingual','wpml-wcml'), 'wpml_operate_woocommerce_multilingual',
274
+ 'wpml-wcml', array($this, 'menu_content'), ICL_PLUGIN_URL . '/res/img/icon16.png');
275
+ }
276
  }
277
+
278
+ }elseif(current_user_can('wpml_manage_woocommerce_multilingual')){
279
+ if(!defined('ICL_SITEPRESS_VERSION')){
280
+ add_menu_page( __( 'WooCommerce Multilingual', 'wpml-wcml' ), __( 'WooCommerce Multilingual', 'wpml-wcml' ),
281
+ 'wpml_manage_woocommerce_multilingual', WCML_PLUGIN_PATH . '/menu/plugins.php', null, WCML_PLUGIN_URL . '/assets/images/icon16.png' );
282
+ }else{
283
+ $top_page = apply_filters('icl_menu_main_page', basename(ICL_PLUGIN_PATH) .'/menu/languages.php');
284
+ add_submenu_page($top_page, __('WooCommerce Multilingual','wpml-wcml'),
285
+ __('WooCommerce Multilingual', 'wpml-wcml'), 'wpml_manage_woocommerce_multilingual', 'wpml-wcml', array($this, 'menu_content'));
286
  }
287
+
288
  }
289
  }
290
 
291
  function menu_content(){
292
+ if($this->dependencies->check()){
293
  include WCML_PLUGIN_PATH . '/menu/management.php';
294
+ }else{
295
+ include WCML_PLUGIN_PATH . '/menu/plugins.php';
296
+ }
297
+
298
  }
299
 
300
  function deactivation_actions(){
302
  }
303
 
304
  function load_css_and_js() {
305
+ if(isset($_GET['page']) && in_array($_GET['page'], array('wpml-wcml',basename(WCML_PLUGIN_PATH).'/menu/sub/troubleshooting.php',basename(WCML_PLUGIN_PATH).'/menu/plugins.php'))) {
306
 
307
 
308
  if ( !wp_style_is( 'toolset-font-awesome', 'registered' ) ) { // check if style are already registered
328
  }
329
  }
330
 
331
+ function load_lock_fields_js(){
332
+ wp_register_script('wcml-lock-script', WCML_PLUGIN_URL . '/assets/js/lock_fields.js', array('jquery'), WCML_VERSION);
333
+ wp_enqueue_script('wcml-lock-script');
334
+ }
335
+
336
+ function hidden_label(){
337
+ echo '<img src="'.WCML_PLUGIN_URL.'/assets/images/locked.png" class="wcml_lock_img" alt="'.__('This field is locked for editing because WPML will copy its value from the original language.','wpml-wcml').'" title="'.__('This field is locked for editing because WPML will copy its value from the original language.','wpml-wcml').'" style="display: none;position:relative;left:2px;top:2px;">';
338
+
339
+ if($this->settings['enable_multi_currency'] == WCML_MULTI_CURRENCIES_INDEPENDENT){ ?>
340
+ <script type="text/javascript">
341
+ jQuery(document).ready(function($){
342
+ $('input[name^="variable_regular_price"],input[name^="variable_sale_price"]').each(function(){
343
+ $(this).removeAttr('readonly');
344
+ $(this).parent().find('img').remove();
345
+ });
346
+ });
347
+ </script>
348
+ <?php }
349
+ }
350
+
351
  function documentation_links(){
352
  global $post, $pagenow;
353
 
434
  icl_register_string('URL product_tag slugs - ' . trim($value['tag_base'] ,'/'), 'Url product_tag slug: ' . trim($value['tag_base'] ,'/'), trim($value['tag_base'] ,'/'));
435
  }
436
 
437
+ if(isset($value['attribute_base']) && $value['attribute_base']){
438
+ icl_register_string('URL attribute slugs - ' . trim($value['attribute_base'] ,'/'), 'Url attribute slug: ' . trim($value['attribute_base'] ,'/'), trim($value['attribute_base'] ,'/'));
439
+ }
440
+
441
  $value['product_base'] = trim($value['product_base'], '/');
442
 
443
  return $value;
wpml-config.xml CHANGED
@@ -13,6 +13,7 @@
13
  <custom-field action="copy">_sku</custom-field>
14
  <custom-field action="copy">_stock</custom-field>
15
  <custom-field action="copy">_stock_status</custom-field>
 
16
  <custom-field action="copy">_subscription_length</custom-field>
17
  <custom-field action="copy">_subscription_period</custom-field>
18
  <custom-field action="copy">_subscription_period_interval</custom-field>
@@ -34,12 +35,16 @@
34
  <custom-field action="translate">_product_url</custom-field>
35
  <custom-field action="translate">_button_text</custom-field>
36
  <custom-field action="translate">_purchase_note</custom-field>
 
 
 
37
  </custom-fields>
38
  <custom-types>
39
  <custom-type translate="1">product</custom-type>
40
  <custom-type translate="0">product_variation</custom-type>
41
  <custom-type translate="0">shop_coupon</custom-type>
42
  <custom-type translate="0">shop_order</custom-type>
 
43
  </custom-types>
44
  <taxonomies>
45
  <taxonomy translate="1">product_cat</taxonomy>
@@ -83,5 +88,8 @@
83
  <key name="subject" />
84
  <key name="heading" />
85
  </key>
 
 
 
86
  </admin-texts>
87
  </wpml-config>
13
  <custom-field action="copy">_sku</custom-field>
14
  <custom-field action="copy">_stock</custom-field>
15
  <custom-field action="copy">_stock_status</custom-field>
16
+ <custom-field action="copy">_sold_individually</custom-field>
17
  <custom-field action="copy">_subscription_length</custom-field>
18
  <custom-field action="copy">_subscription_period</custom-field>
19
  <custom-field action="copy">_subscription_period_interval</custom-field>
35
  <custom-field action="translate">_product_url</custom-field>
36
  <custom-field action="translate">_button_text</custom-field>
37
  <custom-field action="translate">_purchase_note</custom-field>
38
+ <custom-field action="copy">_override_tab_layout</custom-field>
39
+ <custom-field action="translate">_product_tabs</custom-field>
40
+ <custom-field action="ignore">_wcml_custom_prices_status</custom-field>
41
  </custom-fields>
42
  <custom-types>
43
  <custom-type translate="1">product</custom-type>
44
  <custom-type translate="0">product_variation</custom-type>
45
  <custom-type translate="0">shop_coupon</custom-type>
46
  <custom-type translate="0">shop_order</custom-type>
47
+ <custom-type translate="1">wc_product_tab</custom-type>
48
  </custom-types>
49
  <taxonomies>
50
  <taxonomy translate="1">product_cat</taxonomy>
88
  <key name="subject" />
89
  <key name="heading" />
90
  </key>
91
+ <key name="woocommerce_demo_store_notice"/>
92
+ <key name="woocommerce_price_thousand_sep"/>
93
+ <key name="woocommerce_price_decimal_sep"/>
94
  </admin-texts>
95
  </wpml-config>
wpml-woocommerce.php CHANGED
@@ -5,11 +5,11 @@
5
  Description: Allows running fully multilingual e-Commerce sites with WooCommerce and WPML. <a href="http://wpml.org/documentation/related-projects/woocommerce-multilingual/">Documentation</a>.
6
  Author: ICanLocalize
7
  Author URI: http://wpml.org/
8
- Version: 3.1
9
  */
10
 
11
  if(defined('WCML_VERSION')) return;
12
- define('WCML_VERSION', '3.1');
13
  define('WCML_PLUGIN_PATH', dirname(__FILE__));
14
  define('WCML_PLUGIN_FOLDER', basename(WCML_PLUGIN_PATH));
15
  define('WCML_PLUGIN_URL', plugins_url() . '/' . WCML_PLUGIN_FOLDER);
@@ -33,6 +33,7 @@ require WCML_PLUGIN_PATH . '/inc/terms.class.php';
33
  require WCML_PLUGIN_PATH . '/inc/orders.class.php';
34
  require WCML_PLUGIN_PATH . '/inc/requests.class.php';
35
  require WCML_PLUGIN_PATH . '/inc/functions-troubleshooting.class.php';
 
36
 
37
  require WCML_PLUGIN_PATH . '/woocommerce_wpml.class.php';
38
  $woocommerce_wpml = new woocommerce_wpml();
5
  Description: Allows running fully multilingual e-Commerce sites with WooCommerce and WPML. <a href="http://wpml.org/documentation/related-projects/woocommerce-multilingual/">Documentation</a>.
6
  Author: ICanLocalize
7
  Author URI: http://wpml.org/
8
+ Version: 3.2
9
  */
10
 
11
  if(defined('WCML_VERSION')) return;
12
+ define('WCML_VERSION', '3.2');
13
  define('WCML_PLUGIN_PATH', dirname(__FILE__));
14
  define('WCML_PLUGIN_FOLDER', basename(WCML_PLUGIN_PATH));
15
  define('WCML_PLUGIN_URL', plugins_url() . '/' . WCML_PLUGIN_FOLDER);
33
  require WCML_PLUGIN_PATH . '/inc/orders.class.php';
34
  require WCML_PLUGIN_PATH . '/inc/requests.class.php';
35
  require WCML_PLUGIN_PATH . '/inc/functions-troubleshooting.class.php';
36
+ require WCML_PLUGIN_PATH . '/inc/compatibility.class.php';
37
 
38
  require WCML_PLUGIN_PATH . '/woocommerce_wpml.class.php';
39
  $woocommerce_wpml = new woocommerce_wpml();