Saphali Woocommerce Russian - Version 1.8.7

Version Description

  • . .
Download this release

Release Info

Developer Saphali
Plugin Icon wp plugin Saphali Woocommerce Russian
Version 1.8.7
Comparing to
See all releases

Code changes from version 1.8.6 to 1.8.7

Files changed (2) hide show
  1. readme.txt +4 -1
  2. saphali-woocommerce-lite.php +105 -146
readme.txt CHANGED
@@ -6,7 +6,7 @@ Donate link: https://money.yandex.ru/to/410011651211340
6
  Tags: woocommerce, woo commerce russian, russian ruble, ukrainian hryvnia, mod, manadger filds checkout
7
  Requires at least: WP 3.3 or higher & WooCommerce 1.6.6 or higher
8
  Tested up to: 5.3
9
- Stable tag: 1.8.6
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -76,6 +76,9 @@ define('SAPHALI_LITE_SYMBOL', 0 );
76
 
77
  == Changelog ==
78
 
 
 
 
79
  = 1.8.6 =
80
  * Fix вывод добавленных плагином полей в письмах для WC 3.x.
81
 
6
  Tags: woocommerce, woo commerce russian, russian ruble, ukrainian hryvnia, mod, manadger filds checkout
7
  Requires at least: WP 3.3 or higher & WooCommerce 1.6.6 or higher
8
  Tested up to: 5.3
9
+ Stable tag: 1.8.7
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
76
 
77
  == Changelog ==
78
 
79
+ = 1.8.7 =
80
+ * Мелкие ошибки. Оптимизация кода.
81
+
82
  = 1.8.6 =
83
  * Fix вывод добавленных плагином полей в письмах для WC 3.x.
84
 
saphali-woocommerce-lite.php CHANGED
@@ -3,13 +3,13 @@
3
  Plugin Name: Saphali Woocommerce Russian
4
  Plugin URI: http://saphali.com/saphali-woocommerce-plugin-wordpress
5
  Description: Saphali Woocommerce Russian - это бесплатный вордпресс плагин, который добавляет набор дополнений к интернет-магазину на Woocommerce.
6
- Version: 1.8.6
7
  Author: Saphali
8
  Author URI: http://saphali.com/
9
  Text Domain: saphali-woocommerce-lite
10
  Domain Path: /languages
11
  WC requires at least: 1.6.6
12
- WC tested up to: 3.8
13
  */
14
 
15
 
@@ -35,7 +35,7 @@ WC tested up to: 3.8
35
 
36
  // Подключение валюты и локализации
37
  define('SAPHALI_PLUGIN_DIR_URL',plugin_dir_url(__FILE__));
38
- define('SAPHALI_LITE_VERSION', '1.8.6' );
39
  define('SAPHALI_PLUGIN_DIR_PATH',plugin_dir_path(__FILE__));
40
  class saphali_lite {
41
  var $email_order_id;
@@ -324,6 +324,7 @@ public function woocommerce_checkout_posted_data( $data ) {
324
  }
325
  }
326
  function print_script_payment_method() {
 
327
  if(! isset($this->fieldss) )
328
  $this->fieldss = get_option('woocommerce_saphali_filds_filters');
329
  $fieldss = $this->fieldss;
@@ -751,145 +752,62 @@ public function woocommerce_checkout_posted_data( $data ) {
751
  if($_POST){
752
  if(@$_POST["reset"] != 'All') {
753
  // Управление новыми полями
754
-
755
- if(@is_array($_POST["billing"]["new_fild"])) {
756
- foreach($_POST["billing"]["new_fild"] as $k_nf => $v_nf) {
757
- if($k_nf == 'name') {
758
- foreach($v_nf as $v_nf_f) {
759
- $new_fild = $v_nf_f;
760
- }
761
- }
762
- else {
763
- if(is_array($v_nf) )
764
- foreach($v_nf as $k_nf_f => $v_nf_f) {
765
- if($k_nf == 'class' ) {
766
- $v_nf_f = array ( $v_nf_f );
767
- $addFild["billing"][$new_fild][$k_nf] = $v_nf_f;
768
- } else $addFild["billing"][$new_fild][$k_nf] = $v_nf_f;
769
- //$addFild["billing"][$new_fild[$k_nf_f]]['add_new'] = true;
770
- }
771
- if($k_nf == 'type' && !is_array($v_nf) || $k_nf == 'options') {
772
- $addFild["billing"][$new_fild][$k_nf] = $v_nf;
773
- }
774
- }
775
- }
776
- unset($_POST["billing"]["new_fild"]);
777
- unset($new_fild);
778
- }
779
- if(@is_array($_POST["shipping"]["new_fild"])) {
780
- foreach($_POST["shipping"]["new_fild"] as $k_nf => $v_nf) {
781
- if($k_nf == 'name')
782
- foreach($v_nf as $v_nf_f)
783
- $new_fild[] = $v_nf_f;
784
- else {
785
- foreach($v_nf as $k_nf_f => $v_nf_f) {
786
- if($k_nf == 'class') {
787
- $v_nf_f = array ( $v_nf_f );
788
- $addFild["shipping"][$new_fild[$k_nf_f]][$k_nf] = $v_nf_f;
789
- } else $addFild["shipping"][$new_fild[$k_nf_f]][$k_nf] = $v_nf_f;
790
- //$addFild["shipping"][$new_fild[$k_nf_f]]['add_new'] = true;
791
  }
792
- }
793
  }
794
- unset($_POST["shipping"]["new_fild"]);
795
- unset($new_fild);
796
- }
797
- if(@is_array($_POST["order"]["new_fild"])) {
798
- foreach($_POST["order"]["new_fild"] as $k_nf => $v_nf) {
799
- if($k_nf == 'name')
800
- foreach($v_nf as $v_nf_f)
801
- $new_fild[] = $v_nf_f;
802
- else {
803
- foreach($v_nf as $k_nf_f => $v_nf_f) {
804
- if($k_nf == 'class') {
805
- $v_nf_f = array ( $v_nf_f );
806
- $addFild["order"][$new_fild[$k_nf_f]][$k_nf] = $v_nf_f;
807
- } else $addFild["order"][$new_fild[$k_nf_f]][$k_nf] = $v_nf_f;
808
- //$addFild["order"][$new_fild[$k_nf_f]]['add_new'] = true;
809
- }
810
- }
811
- }
812
- unset($_POST["order"]["new_fild"]);
813
  }
814
  //END
815
  $filds = $global_f_checkout_fields;
 
 
 
 
 
816
 
817
- if(is_array($filds["billing"])) {
818
- if(!isset($addFild["billing"]) || isset($addFild["billing"]) && !is_array($addFild["billing"])) $addFild["billing"] = array();
819
- if(!is_array($_POST["billing"])) $_POST["billing"] = array();
820
- $filds["billing"] = array_merge($filds["billing"] , $_POST["billing"], $addFild["billing"]);
821
-
822
- foreach($filds["billing"] as $key_post => $value_post) {
823
- $filds["billing"][$key_post]["label"] = str_replace("'", '’', stripcslashes($filds["billing"][$key_post]["label"]) );
824
  $value_post["label"] = str_replace("'", '’', stripcslashes($value_post["label"]) );
825
- if( !isset($global_f_checkout_fields["billing"][$key_post]['type']) && (isset($filds["billing"][$key_post]['type']) && $filds["billing"][$key_post]['type'] != 'select' && $filds["billing"][$key_post]['type'] != 'checkbox' && $filds["billing"][$key_post]['type'] != 'textarea' || !isset($filds["billing"][$key_post]['type'])) ) unset($filds["billing"][$key_post]['type'], $value_post["type"]);
826
 
827
 
828
- if(@$filds["billing"][$key_post]['public'] != 'on') {
829
- $filds_new["billing"][$filds["billing"][$key_post]["order"]][$key_post]["public"] = false;
830
- $fild_remove_filter["billing"][] = $key_post;
831
- } else {$filds_new["billing"][$filds["billing"][$key_post]["order"]][$key_post]["public"] = true;}
832
 
833
 
834
  foreach($value_post as $k_post=> $v_post){
835
  if( 'on' == $v_post ) {
836
- $filds["billing"][$key_post][$k_post] = true;
837
  $value_post[$k_post] = true;
838
- } elseif(in_array($k_post, array('public','clear','required'))) { $filds["billing"][$key_post][$k_post] = false; $value_post[$k_post] = false; if(!$filds["billing"][$key_post][$k_post] && $k_post == 'public') unset($filds["billing"][$key_post][$k_post]); }
839
  }
840
- $filds_new["billing"][$filds["billing"][$key_post]["order"]][$key_post] = $value_post;
841
 
842
- unset($_POST["billing"][$key_post]);
843
  }
844
 
845
  }
846
- if(isset($filds["shipping"]) && is_array($filds["shipping"])) {
847
- if(!isset($addFild["shipping"]) || isset($addFild["shipping"]) && !is_array($addFild["shipping"])) $addFild["shipping"] = array();
848
- if(!is_array($_POST["shipping"])) $_POST["shipping"] = array();
849
- $filds["shipping"] = array_merge($filds["shipping"] , $_POST["shipping"], $addFild["shipping"]);
850
- foreach($filds["shipping"] as $key_post => $value_post) {
851
- $value_post["label"] = str_replace("'", '’', stripcslashes($value_post["label"]) );
852
- if( !isset($global_f_checkout_fields["shipping"][$key_post]['type']) ) unset($filds["shipping"][$key_post]['type'], $value_post["type"]);
853
-
854
- if( isset($filds["shipping"][$key_post]['public']) && $filds["shipping"][$key_post]['public'] != 'on') {
855
- $filds_new["shipping"][$filds["shipping"][$key_post]["order"]][$key_post]["public"] = false;
856
- $fild_remove_filter["shipping"][] = $key_post;
857
- } else {$filds_new["shipping"][$filds["shipping"][$key_post]["order"]][$key_post]["public"] = true;}
858
-
859
- foreach($value_post as $k_post=> $v_post){
860
- if( 'on' == $v_post ) {
861
- $filds["shipping"][$key_post][$k_post] = true;
862
- $value_post[$k_post] = true;
863
- } elseif(in_array($k_post, array('public','clear','required'))) { $filds["shipping"][$key_post][$k_post] = false; $value_post[$k_post] = false; if(!$filds["shipping"][$key_post][$k_post] && $k_post == 'public') unset($filds["shipping"][$key_post][$k_post]); }
864
- }
865
- $filds_new["shipping"][$filds["shipping"][$key_post]["order"]][$key_post] = $value_post;
866
- unset($_POST["shipping"][$key_post]);
867
- }
868
- }
869
- if(isset($filds["order"]) && is_array($filds["order"])) {
870
- if(!isset($addFild["order"]) || isset($addFild["order"]) && !is_array($addFild["order"])) $addFild["order"] = array();
871
- if(!is_array($_POST["order"])) $_POST["order"] = array();
872
- $filds["order"] = array_merge($filds["order"] , $_POST["order"], $addFild["order"]);
873
-
874
- foreach($filds["order"] as $key_post => $value_post) {
875
-
876
- if($filds["order"][$key_post]['public'] != 'on') {
877
- $filds_new["order"][$filds["order"][$key_post]["order"]][$key_post]["public"] = false;
878
- $fild_remove_filter["order"][] = $key_post;
879
- } else {$filds_new["order"][$filds["order"][$key_post]["order"]][$key_post]["public"] = true;}
880
-
881
- foreach($value_post as $k_post=> $v_post){
882
- if( 'on' == $v_post ) {
883
- $filds["order"][$key_post][$k_post] = true;
884
- $value_post[$k_post] = true;
885
- } elseif(in_array($k_post, array('public','clear','required'))) { $filds["order"][$key_post][$k_post] = false; $value_post[$k_post] = false; if(!$filds["order"][$key_post][$k_post] && $k_post == 'public') unset($filds["order"][$key_post][$k_post]); }
886
- }
887
 
888
- $filds_new["order"][$filds["order"][$key_post]["order"]][$key_post] = $value_post;
889
-
890
- unset($_POST["order"][$key_post]);
891
- }
892
- }
893
 
894
  //END Управление публикацией
895
  $filds_finish["billing"] = $filds_finish["shipping"] = $filds_finish["order"] = array();
@@ -940,7 +858,7 @@ public function woocommerce_checkout_posted_data( $data ) {
940
  delete_option('woocommerce_saphali_filds_locate');
941
  }
942
  }
943
-
944
  ?>
945
  <div class="clear"></div>
946
  <h3 class="nav-tab-wrapper woo-nav-tab-wrapper" style="text-align: center;">Управление полями на странице заказа и на странице профиля</h3>
@@ -1000,12 +918,16 @@ public function woocommerce_checkout_posted_data( $data ) {
1000
  }
1001
  if(isset($checkout_fields["billing"][$key]['payment_method'])) {
1002
  $pm_k_remove = array();
 
1003
  foreach($checkout_fields["billing"][$key]['payment_method'] as $k => $v) {
1004
  if($v === '0') {
1005
  $pm_k_remove[] = $k;
1006
  }
 
 
 
1007
  }
1008
-
1009
  foreach($pm_k_remove as $k_remove) {
1010
  unset($checkout_fields["billing"][$key]['payment_method'][$k_remove]);
1011
  }
@@ -1013,10 +935,14 @@ public function woocommerce_checkout_posted_data( $data ) {
1013
  }
1014
  if(isset($checkout_fields["billing"][$key]['shipping_method'])) {
1015
  $pm_k_remove = array();
 
1016
  foreach($checkout_fields["billing"][$key]['shipping_method'] as $k => $v) {
1017
  if($v === '0') {
1018
  $pm_k_remove[] = $k;
1019
  }
 
 
 
1020
  }
1021
 
1022
  foreach($pm_k_remove as $k_remove) {
@@ -1030,10 +956,11 @@ public function woocommerce_checkout_posted_data( $data ) {
1030
  <tr>
1031
  <td> <input disabled value='<?php echo $key?>' type="text" name="billing[<?php echo $key?>][name]" /></td>
1032
  <td><input value='<?php echo $value['label']?>' type="text" name="billing[<?php echo $key?>][label]" /></td>
1033
- <td<?php if(isset($value['type']) && $value['type'] == 'select') {echo ' class="option-area"';} ?>><?php if(!isset($value['type']) || isset($value['type']) && $value['type'] != 'select') { ?><input value='<?php if(isset( $value['placeholder'] )) echo $value['placeholder']; ?>' type="text" name="billing[<?php echo $key?>][placeholder]" /><?php } else {
 
1034
  if( isset($value['options']) && is_array($value['options']) ) {
1035
  foreach($value['options'] as $key_option => $val_option) {?>
1036
- <span><input id="options" type="text" name="billing[<?php echo $key?>][options][<?php echo $key_option; ?>]" value="<?php echo $val_option?>" /> <span class="delete-option" style="cursor:pointer;border:1px solid">Удалить</span></span><br />
1037
 
1038
  <?php } ?>
1039
  <div class="button add_option" rel="<?php echo $key; ?>">Добавить еще</div>
@@ -1048,9 +975,10 @@ public function woocommerce_checkout_posted_data( $data ) {
1048
  } ?></td>
1049
  <td>
1050
  Select <input <?php if(isset($value['type']) && $value['type'] == 'select') echo 'checked'?> type="radio" name="billing[<?php echo $key?>][type]" value="select" /><br />
 
1051
  Checkbox <input <?php if(isset($value['type']) && $value['type'] == 'checkbox') echo 'checked'?> type="radio" name="billing[<?php echo $key?>][type]" value="checkbox" /><br />
1052
  Textarea <input <?php if(isset($value['type']) && $value['type'] == 'textarea') echo 'checked'?> type="radio" name="billing[<?php echo $key?>][type]" value="textarea" /><br />
1053
- <?php echo (!isset($value['type']) || $value['type'] == 'select'|| $value['type'] == 'checkbox'|| $value['type'] == 'textarea') ? 'Text' : $value['type']; ?> <input <?php if(isset($value['type']) && $value['type'] == $value['type'] && $value['type'] != 'select'&& $value['type'] != 'textarea'&& $value['type'] != 'checkbox') echo 'checked'?> type="radio" name="billing[<?php echo $key?>][type]" value="<?php if( isset($value['type']) && $value['type'] != 'select' && $value['type'] != 'textarea'&& $value['type'] != 'checkbox') echo $value['type']; ?>" />
1054
  </td>
1055
  <td><input <?php if( isset($value['required'] ) && $value['required']) echo 'checked'?> type="checkbox" name="billing[<?php echo $key?>][required]" /></td>
1056
  <td><input <?php if(isset($value[$public]) && $value[$public]) echo 'checked';?> type="checkbox" name="billing[<?php echo $key?>][<?php echo $public; ?>]" /></td>
@@ -1142,10 +1070,13 @@ public function woocommerce_checkout_posted_data( $data ) {
1142
  }
1143
  if(isset($checkout_fields["shipping"][$key]['payment_method'])) {
1144
  $pm_k_remove = array();
 
1145
  foreach($checkout_fields["shipping"][$key]['payment_method'] as $k => $v) {
1146
  if($v === '0') {
1147
  $pm_k_remove[] = $k;
1148
  }
 
 
1149
  }
1150
 
1151
  foreach($pm_k_remove as $k_remove) {
@@ -1155,10 +1086,13 @@ public function woocommerce_checkout_posted_data( $data ) {
1155
  }
1156
  if(isset($checkout_fields["shipping"][$key]['shipping_method'])) {
1157
  $pm_k_remove = array();
 
1158
  foreach($checkout_fields["shipping"][$key]['shipping_method'] as $k => $v) {
1159
  if($v === '0') {
1160
  $pm_k_remove[] = $k;
1161
  }
 
 
1162
  }
1163
 
1164
  foreach($pm_k_remove as $k_remove) {
@@ -1206,7 +1140,7 @@ public function woocommerce_checkout_posted_data( $data ) {
1206
  <?php
1207
  if( isset($value['options']) && is_array($value['options']) ) {
1208
  foreach($value['options'] as $key_option => $val_option) {?>
1209
- <input id="options" type="hidden" name="shipping[<?php echo $key?>][options][<?php echo $key_option; ?>]" value="<?php echo $val_option?>" />
1210
  <?php }
1211
  } ?>
1212
  </td>
@@ -1281,7 +1215,7 @@ public function woocommerce_checkout_posted_data( $data ) {
1281
  <?php
1282
  if( isset($value['options']) && is_array($value['options']) ) {
1283
  foreach($value['options'] as $key_option => $val_option) {?>
1284
- <input id="options" type="hidden" name="order[<?php echo $key?>][options][<?php echo $key_option; ?>]" value="<?php echo $val_option?>" />
1285
  <?php }
1286
  } ?>
1287
  </td>
@@ -1329,29 +1263,42 @@ public function woocommerce_checkout_posted_data( $data ) {
1329
  jQuery(this).parent().remove();
1330
  });
1331
  jQuery("body").delegate('.button.add_option', 'click',function() {
1332
- jQuery(this).before(' <span><br /><input type="text" id="options" value="" name="billing['+jQuery(this).attr('rel')+'][options][option-'+ (jQuery(this).parent().find('input').length + 1) +']"/><span class="delete-option" style="cursor:pointer;border:1px solid">Удалить</span></span>');
1333
  });
1334
  jQuery("body").delegate('input[type="radio"]', 'click',function() {
1335
  if( jQuery(this).val() == 'select' || jQuery(this).val() == 'radio') {
1336
- jQuery(this).parent().parent().find('td').css('border-bottom', 'none');
1337
- jQuery(this).parent().parent().addClass('parrent_td_option'+jQuery('.button.add_option').length);
1338
- if('billing[new_fild][name][]' != jQuery(this).parent().parent().find('td:first input').attr('name') )
1339
- jQuery(this).parent().parent().after('<tr style="border-top:0" class="tr_td_option'+jQuery('.button.add_option').length +'" ><td style="border-top:0;padding-left: 72%;" colspan="9"> <span><input id="options" type="text" value="" name="billing['+jQuery(this).parent().parent().find('td:first input').val()+'][options][option-1]"/><span class="delete-option" style="cursor:pointer;border:1px solid">Удалить</span></span> <div class="button add_option" rel="'+jQuery(this).parent().parent().find('td:first input').val()+'">Добавить еще</div></td></tr>');
1340
- else jQuery(this).parent().parent().after('<tr style="border-top:0" class="tr_td_option'+jQuery('.button.add_option').length +'" ><td style="border-top:0;padding-left: 72%;" colspan="9"> <span><input id="options" type="text" value="" name="billing[new_fild][options][option-1]"/><span class="delete-option" style="cursor:pointer;border:1px solid">Удалить</span></span> <div class="button add_option" rel="new_fild">Добавить еще</div></td></tr>');
 
 
 
 
 
 
 
 
 
1341
  } else {
1342
- if(jQuery(this).parent().parent().find('td').attr('style') != '') {
1343
- jQuery(this).parent().parent().find('td').attr('style', '');
1344
- var text = jQuery(this).parent().parent().attr('class');//parrent_td_option
1345
- text = text.replace(/parrent_td_option/g,'');
1346
- jQuery('tr.tr_td_option'+text).remove();
1347
- jQuery(this).parent().parent().attr('class', '');
 
 
 
1348
  }
1349
  }
1350
  });
1351
 
1352
- jQuery("body").delegate('input#options', 'blur', function() {
1353
  var text = jQuery(this).attr('name');
1354
- text = text.replace(/\[options\]\[(.*)\]/g,'[options]['+ jQuery(this).val() +']');
 
1355
  jQuery(this).attr('name', text);
1356
  });
1357
  var fild_pm;
@@ -1378,7 +1325,8 @@ public function woocommerce_checkout_posted_data( $data ) {
1378
  ?>\
1379
  </select>\
1380
  </td>';
1381
- obj.html('<td><input value="billing_new_fild'+(parseInt(obj.parent().find('tr td input#order_count:last').val(),10)+1)+'" type="text" name="billing[new_fild][name][]" /></td><td><input value="" type="text" name="billing[new_fild][label][]" /></td><td><input value="" type="text" name="billing[new_fild][placeholder][]" /></td><td><input type="checkbox" name="billing[new_fild][clear][]" /></td><td><input value="" type="text" name="billing[new_fild][class][]" /></td><td> Select <input type="radio" value="select" name="billing[new_fild][type]"><br>Radio <input type="radio" value="radio" name="billing[new_fild][type]"><br>Checkbox <input type="radio" value="checkbox" name="billing[new_fild][type]"><br> Textarea <input type="radio" value="textarea" name="billing[new_fild][type]"><br> Text <input type="radio" value="" name="billing[new_fild][type]" checked="checked"></td><td><input checked type="checkbox" name="billing[new_fild][required][]" /></td><td><input checked type="checkbox" name="billing[new_fild][public][]" /></td>' + fild_pm + '<td><input id="order_count" rel="sort_order" type="hidden" name="billing[new_fild][order][]" value="'+(parseInt(obj.parent().find('tr td input#order_count:last').val(),10)+1)+'" /><input type="button" class="button" id="billing_delete" value="Удалить -"/></td>');
 
1382
  obj.removeClass('nodrop nodrag');
1383
  obj.after('<tr class="nodrop nodrag"><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td><input type="button" class="button" id="billing" value="Добавить +"/></td></tr>');
1384
  });
@@ -1405,13 +1353,15 @@ public function woocommerce_checkout_posted_data( $data ) {
1405
  ?>\
1406
  </select>\
1407
  </td>';
1408
- obj.html('<td><input value="shipping_new_fild'+(parseInt(obj.parent().find('tr td input#order_count:last').val(),10)+1)+'" type="text" name="shipping[new_fild][name][]" /></td><td><input value="" type="text" name="shipping[new_fild][label][]" /></td><td><input value="" type="text" name="shipping[new_fild][placeholder][]" /></td><td><input type="checkbox" name="shipping[new_fild][clear][]" /></td><td><input value="" type="text" name="shipping[new_fild][class][]" /></td><td><input checked type="checkbox" name="shipping[new_fild][required][]" /></td><td><input checked type="checkbox" name="shipping[new_fild][public][]" /></td>' + fild_pm + '<td><input id="order_count" rel="sort_order" type="hidden" name="shipping[new_fild][order][]" value="'+(parseInt(obj.parent().find('tr td input#order_count:last').val(),10)+1)+'" /><input type="button" class="button" id="billing_delete" value="Удалить -"/></td>');
 
1409
  obj.removeClass('nodrop nodrag');
1410
  obj.after('<tr class="nodrop nodrag"><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td><input type="button" class="button" id="shipping" value="Добавить +"/></td></tr>');
1411
  });
1412
  jQuery("body").delegate('.button#order', 'click',function() {
1413
  var obj = jQuery(this).parent().parent();
1414
- obj.html('<td><input value="order_new_fild'+(parseInt(obj.parent().find('tr td input#order_count:last').val(),10)+1)+'" type="text" name="order[new_fild][name][]" /></td><td><input value="" type="text" name="order[new_fild][label][]" /></td><td><input value="" type="text" name="order[new_fild][placeholder][]" /></td><td><input value="" type="text" name="order[new_fild][class][]" /></td><td><input checked type="text" name="order[new_fild][type][]" /></td><td><input checked type="checkbox" name="order[new_fild][public][]" /></td><td><input id="order_count" rel="sort_order" type="hidden" name="order[new_fild][order][]" value="'+(parseInt(obj.parent().find('tr td input#order_count:last').val(),10)+1)+'" /><input type="button" class="button" id="billing_delete" value="Удалить -"/></td>');
 
1415
  obj.removeClass('nodrop nodrag');
1416
  obj.after('<tr class="nodrop nodrag"><td></td><td></td><td></td><td></td><td></td><td></td><td><input type="button" class="button" id="order" value="Добавить +"/></td></tr>');
1417
  });
@@ -1651,6 +1601,9 @@ public function woocommerce_checkout_posted_data( $data ) {
1651
  elseif ( version_compare( WOOCOMMERCE_VERSION, '3.0', '<' ) )
1652
  $value_fild = $order->__get( $key );
1653
  else $value_fild = get_post_meta( $order->get_id(), '_' . $key, true );
 
 
 
1654
  if ( $value_fild && !empty($field['label']) ) echo '<p><strong>'.$field['label'].':</strong> '.$value_fild.'</p>';
1655
 
1656
  endforeach;
@@ -1827,6 +1780,9 @@ public function woocommerce_checkout_posted_data( $data ) {
1827
  elseif ( version_compare( WOOCOMMERCE_VERSION, '3.0', '<' ) )
1828
  $value_fild = $order->__get( $key );
1829
  else $value_fild = get_post_meta( $order->get_id(), '_' . $key, true );
 
 
 
1830
  if ( $value_fild && !empty($field['label']) )
1831
  echo '<div class="form-field form-field-wide"><label><strong>'. $field['label']. ':</strong></label> ' . $value_fild.'</div>';
1832
  endforeach;
@@ -1922,6 +1878,9 @@ public function woocommerce_checkout_posted_data( $data ) {
1922
  elseif ( version_compare( WOOCOMMERCE_VERSION, '3.0', '<' ) )
1923
  $value_fild = $order->__get( $key );
1924
  else $value_fild = get_post_meta( $order->get_id(), '_' . $key, true );
 
 
 
1925
  if ( $value_fild && !empty($field['label']))
1926
  echo '<div class="form-field form-field-wide"><label><strong>'. $field['label']. ':</strong></label> ' . $value_fild.'</div>';
1927
  endforeach;
3
  Plugin Name: Saphali Woocommerce Russian
4
  Plugin URI: http://saphali.com/saphali-woocommerce-plugin-wordpress
5
  Description: Saphali Woocommerce Russian - это бесплатный вордпресс плагин, который добавляет набор дополнений к интернет-магазину на Woocommerce.
6
+ Version: 1.8.7
7
  Author: Saphali
8
  Author URI: http://saphali.com/
9
  Text Domain: saphali-woocommerce-lite
10
  Domain Path: /languages
11
  WC requires at least: 1.6.6
12
+ WC tested up to: 3.9
13
  */
14
 
15
 
35
 
36
  // Подключение валюты и локализации
37
  define('SAPHALI_PLUGIN_DIR_URL',plugin_dir_url(__FILE__));
38
+ define('SAPHALI_LITE_VERSION', '1.8.7' );
39
  define('SAPHALI_PLUGIN_DIR_PATH',plugin_dir_path(__FILE__));
40
  class saphali_lite {
41
  var $email_order_id;
324
  }
325
  }
326
  function print_script_payment_method() {
327
+ if( !(is_cart() || is_checkout()) ) return;
328
  if(! isset($this->fieldss) )
329
  $this->fieldss = get_option('woocommerce_saphali_filds_filters');
330
  $fieldss = $this->fieldss;
752
  if($_POST){
753
  if(@$_POST["reset"] != 'All') {
754
  // Управление новыми полями
755
+ foreach( array('billing', 'shipping', 'order') as $method)
756
+ if(@is_array($_POST[$method]["new_fild"])) {
757
+ foreach ($_POST[$method]["new_fild"] as $k_nf => $v_nf) {
758
+ if ($k_nf == 'name') continue;
759
+ if (is_array($v_nf))
760
+ foreach ($v_nf as $k_nf_f => $v_nf_f) {
761
+ $new_fild = isset($_POST[$method]["new_fild"]['name'][$k_nf_f]) ? $_POST[$method]["new_fild"]['name'][$k_nf_f] : $new_fild;
762
+ if ($k_nf == 'class') {
763
+ $addFild[$method][$new_fild][$k_nf] = array($v_nf_f);
764
+ } elseif ($k_nf == 'options') {
765
+ foreach ($v_nf_f as $val_v_nf_f) {
766
+ $index = isset($addFild[$method][$new_fild][$k_nf]) ? (sizeof($addFild[$method][$new_fild][$k_nf]) + 1) : 1;
767
+ $addFild[$method][$new_fild][$k_nf]['option-' . $index] = $val_v_nf_f;
768
+ }
769
+ } elseif ($k_nf == 'type') {
770
+ // echo '<pre>';var_dump($v_nf_f);echo '</pre>';
771
+ $addFild[$method][$new_fild][$k_nf] = current($v_nf_f);
772
+ } else $addFild[$method][$new_fild][$k_nf] = $v_nf_f;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
773
  }
 
774
  }
775
+
776
+ unset($new_fild, $_POST[$method]["new_fild"]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
777
  }
778
  //END
779
  $filds = $global_f_checkout_fields;
780
+ foreach( array('billing', 'shipping', 'order') as $method)
781
+ if(is_array($filds[$method])) {
782
+ if(!isset($addFild[$method]) || isset($addFild[$method]) && !is_array($addFild[$method])) $addFild[$method] = array();
783
+ if(!is_array($_POST[$method])) $_POST[$method] = array();
784
+ $filds[$method] = array_merge($filds[$method] , $_POST[$method], $addFild[$method]);
785
 
786
+ foreach($filds[$method] as $key_post => $value_post) {
787
+ $filds[$method][$key_post]["label"] = str_replace("'", '&rsquo;', stripcslashes($filds[$method][$key_post]["label"]) );
 
 
 
 
 
788
  $value_post["label"] = str_replace("'", '&rsquo;', stripcslashes($value_post["label"]) );
789
+ if( !isset($global_f_checkout_fields[$method][$key_post]['type']) && (isset($filds[$method][$key_post]['type']) && $filds[$method][$key_post]['type'] != 'select' && $filds[$method][$key_post]['type'] != 'radio' && $filds[$method][$key_post]['type'] != 'checkbox' && $filds[$method][$key_post]['type'] != 'textarea' || !isset($filds[$method][$key_post]['type'])) ) unset($filds[$method][$key_post]['type'], $value_post["type"]);
790
 
791
 
792
+ if(@$filds[$method][$key_post]['public'] != 'on') {
793
+ $filds_new[$method][$filds[$method][$key_post]["order"]][$key_post]["public"] = false;
794
+ $fild_remove_filter[$method][] = $key_post;
795
+ } else {$filds_new[$method][$filds[$method][$key_post]["order"]][$key_post]["public"] = true;}
796
 
797
 
798
  foreach($value_post as $k_post=> $v_post){
799
  if( 'on' == $v_post ) {
800
+ $filds[$method][$key_post][$k_post] = true;
801
  $value_post[$k_post] = true;
802
+ } elseif(in_array($k_post, array('public','clear','required'))) { $filds[$method][$key_post][$k_post] = false; $value_post[$k_post] = false; if(!$filds[$method][$key_post][$k_post] && $k_post == 'public') unset($filds[$method][$key_post][$k_post]); }
803
  }
804
+ $filds_new[$method][$filds[$method][$key_post]["order"]][$key_post] = $value_post;
805
 
806
+ unset($_POST[$method][$key_post]);
807
  }
808
 
809
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
810
 
 
 
 
 
 
811
 
812
  //END Управление публикацией
813
  $filds_finish["billing"] = $filds_finish["shipping"] = $filds_finish["order"] = array();
858
  delete_option('woocommerce_saphali_filds_locate');
859
  }
860
  }
861
+ add_filter('woocommerce_pre_remove_cart_item_from_session', function() { return true; });
862
  ?>
863
  <div class="clear"></div>
864
  <h3 class="nav-tab-wrapper woo-nav-tab-wrapper" style="text-align: center;">Управление полями на странице заказа и на странице профиля</h3>
918
  }
919
  if(isset($checkout_fields["billing"][$key]['payment_method'])) {
920
  $pm_k_remove = array();
921
+ if(is_array($checkout_fields["billing"][$key]['payment_method']))
922
  foreach($checkout_fields["billing"][$key]['payment_method'] as $k => $v) {
923
  if($v === '0') {
924
  $pm_k_remove[] = $k;
925
  }
926
+ } elseif($checkout_fields["billing"][$key]['payment_method'] === '0') {
927
+ // $pm_k_remove[] = $k;
928
+ unset($checkout_fields["billing"][$key]['payment_method']);
929
  }
930
+
931
  foreach($pm_k_remove as $k_remove) {
932
  unset($checkout_fields["billing"][$key]['payment_method'][$k_remove]);
933
  }
935
  }
936
  if(isset($checkout_fields["billing"][$key]['shipping_method'])) {
937
  $pm_k_remove = array();
938
+ if(is_array($checkout_fields["billing"][$key]['shipping_method']))
939
  foreach($checkout_fields["billing"][$key]['shipping_method'] as $k => $v) {
940
  if($v === '0') {
941
  $pm_k_remove[] = $k;
942
  }
943
+ } elseif($checkout_fields["billing"][$key]['shipping_method'] === '0') {
944
+ // $pm_k_remove[] = $k;
945
+ unset($checkout_fields["billing"][$key]['shipping_method']);
946
  }
947
 
948
  foreach($pm_k_remove as $k_remove) {
956
  <tr>
957
  <td> <input disabled value='<?php echo $key?>' type="text" name="billing[<?php echo $key?>][name]" /></td>
958
  <td><input value='<?php echo $value['label']?>' type="text" name="billing[<?php echo $key?>][label]" /></td>
959
+ <td<?php if(isset($value['type']) && ($value['type'] == 'select' || $value['type'] == 'radio') ) {
960
+ echo ' class="option-area"';} ?>><?php if(!isset($value['type']) || isset($value['type']) && $value['type'] != 'select' && $value['type'] != 'radio') { ?><input value='<?php if(isset( $value['placeholder'] )) echo $value['placeholder']; ?>' type="text" name="billing[<?php echo $key?>][placeholder]" /><?php } else {
961
  if( isset($value['options']) && is_array($value['options']) ) {
962
  foreach($value['options'] as $key_option => $val_option) {?>
963
+ <span><input class="options" type="text" name="billing[<?php echo $key?>][options][<?php echo $key_option; ?>]" value="<?php echo $val_option?>" /> <span class="delete-option" style="cursor:pointer;border:1px solid">Удалить</span></span><br />
964
 
965
  <?php } ?>
966
  <div class="button add_option" rel="<?php echo $key; ?>">Добавить еще</div>
975
  } ?></td>
976
  <td>
977
  Select <input <?php if(isset($value['type']) && $value['type'] == 'select') echo 'checked'?> type="radio" name="billing[<?php echo $key?>][type]" value="select" /><br />
978
+ Radio <input <?php if(isset($value['type']) && $value['type'] == 'radio') echo 'checked'?> type="radio" name="billing[<?php echo $key?>][type]" value="radio" /><br />
979
  Checkbox <input <?php if(isset($value['type']) && $value['type'] == 'checkbox') echo 'checked'?> type="radio" name="billing[<?php echo $key?>][type]" value="checkbox" /><br />
980
  Textarea <input <?php if(isset($value['type']) && $value['type'] == 'textarea') echo 'checked'?> type="radio" name="billing[<?php echo $key?>][type]" value="textarea" /><br />
981
+ <?php echo (!isset($value['type']) || $value['type'] == 'select'|| $value['type'] == 'checkbox'|| $value['type'] == 'textarea') ? 'Text' : $value['type']; ?> <input <?php if(isset($value['type']) && $value['type'] == $value['type'] && !in_array( $value['type'], array('select', 'radio', 'textarea', 'checkbox') ) ) echo 'checked'?> type="radio" name="billing[<?php echo $key?>][type]" value="<?php if( isset($value['type']) && !in_array( $value['type'], array('select', 'radio', 'textarea', 'checkbox') ) ) echo $value['type']; ?>" />
982
  </td>
983
  <td><input <?php if( isset($value['required'] ) && $value['required']) echo 'checked'?> type="checkbox" name="billing[<?php echo $key?>][required]" /></td>
984
  <td><input <?php if(isset($value[$public]) && $value[$public]) echo 'checked';?> type="checkbox" name="billing[<?php echo $key?>][<?php echo $public; ?>]" /></td>
1070
  }
1071
  if(isset($checkout_fields["shipping"][$key]['payment_method'])) {
1072
  $pm_k_remove = array();
1073
+ if(is_array($checkout_fields["shipping"][$key]['payment_method']))
1074
  foreach($checkout_fields["shipping"][$key]['payment_method'] as $k => $v) {
1075
  if($v === '0') {
1076
  $pm_k_remove[] = $k;
1077
  }
1078
+ } elseif($checkout_fields["shipping"][$key]['payment_method']=== '0') {
1079
+ unset($checkout_fields["shipping"][$key]['payment_method']);
1080
  }
1081
 
1082
  foreach($pm_k_remove as $k_remove) {
1086
  }
1087
  if(isset($checkout_fields["shipping"][$key]['shipping_method'])) {
1088
  $pm_k_remove = array();
1089
+ if(is_array($checkout_fields["shipping"][$key]['shipping_method']))
1090
  foreach($checkout_fields["shipping"][$key]['shipping_method'] as $k => $v) {
1091
  if($v === '0') {
1092
  $pm_k_remove[] = $k;
1093
  }
1094
+ } elseif($checkout_fields["shipping"][$key]['shipping_method'] === '0') {
1095
+ unset($checkout_fields["shipping"][$key]['shipping_method']);
1096
  }
1097
 
1098
  foreach($pm_k_remove as $k_remove) {
1140
  <?php
1141
  if( isset($value['options']) && is_array($value['options']) ) {
1142
  foreach($value['options'] as $key_option => $val_option) {?>
1143
+ <input class="options" type="hidden" name="shipping[<?php echo $key?>][options][<?php echo $key_option; ?>]" value="<?php echo $val_option?>" />
1144
  <?php }
1145
  } ?>
1146
  </td>
1215
  <?php
1216
  if( isset($value['options']) && is_array($value['options']) ) {
1217
  foreach($value['options'] as $key_option => $val_option) {?>
1218
+ <input class="options" type="hidden" name="order[<?php echo $key?>][options][<?php echo $key_option; ?>]" value="<?php echo $val_option?>" />
1219
  <?php }
1220
  } ?>
1221
  </td>
1263
  jQuery(this).parent().remove();
1264
  });
1265
  jQuery("body").delegate('.button.add_option', 'click',function() {
1266
+ jQuery(this).before(' <span><br /><input type="text" class="options" value="" name="billing['+jQuery(this).attr('rel')+'][options][option-'+ (jQuery(this).parent().find('input').length + 1) +']"/><span class="delete-option" style="cursor:pointer;border:1px solid">Удалить</span></span>');
1267
  });
1268
  jQuery("body").delegate('input[type="radio"]', 'click',function() {
1269
  if( jQuery(this).val() == 'select' || jQuery(this).val() == 'radio') {
1270
+ if (typeof jQuery(this).closest('tr').find('td:first input') != 'undefined' && jQuery(this).closest('tr').find('td:first input').attr('disabled') == "disabled") {} else {
1271
+ var obj = jQuery(this).parent().parent();
1272
+ obj.find('td').css('border-bottom', 'none');
1273
+
1274
+
1275
+ var indx = obj.attr('class').split(' ')[0].replace('parrent_td_option','');
1276
+ if(!obj.parent().find('tr.tr_td_option' + indx).length) {
1277
+ obj.addClass('parrent_td_option'+jQuery('.button.add_option').length);
1278
+ var firstInput = obj.find('td:first input');
1279
+ if('billing[new_fild][name][]' != firstInput.attr('name') )
1280
+ obj.after('<tr style="border-top:0" class="tr_td_option'+jQuery('.button.add_option').length +'" ><td style="border-top:0;padding-left: 72%;" colspan="9"> <span><input class="options" type="text" value="" name="billing['+firstInput.val()+'][options][option-1]"/><span class="delete-option" style="cursor:pointer;border:1px solid">Удалить</span></span> <div class="button add_option" rel="'+firstInput.val()+'">Добавить еще</div></td></tr>');
1281
+ else obj.after('<tr style="border-top:0" class="tr_td_option'+jQuery('.button.add_option').length +'" ><td style="border-top:0;padding-left: 72%;" colspan="9"> <span><input class="options" type="text" value="" name="billing[new_fild][options][option-1]"/><span class="delete-option" style="cursor:pointer;border:1px solid">Удалить</span></span> <div class="button add_option" rel="new_fild">Добавить еще</div></td></tr>');
1282
+ }
1283
+ }
1284
  } else {
1285
+ var obj = jQuery(this).parent().parent();
1286
+ if(obj.find('td').attr('style') != '') {
1287
+ obj.find('td').attr('style', '');
1288
+ var text = obj.attr('class');//parrent_td_option
1289
+ if (typeof text != 'undefined') {
1290
+ text = text.replace(/parrent_td_option/g, '');
1291
+ jQuery('tr.tr_td_option' + text).remove();
1292
+ obj.attr('class', '');
1293
+ }
1294
  }
1295
  }
1296
  });
1297
 
1298
+ jQuery("body").delegate('input.options', 'blur', function() {
1299
  var text = jQuery(this).attr('name');
1300
+ var class_tr = jQuery(this).closest('tr').attr('class').replace('tr_td_', 'parrent_td_');
1301
+ text = text.replace(/\[options\]\[(.*)\]/g, '[options][' + (parseInt(jQuery('.' + class_tr + ' td input#order_count').val(), 10) - jQuery('input[name="billing[new_fild][name][]"]').length) + '][' + jQuery(this).val() + ']');
1302
  jQuery(this).attr('name', text);
1303
  });
1304
  var fild_pm;
1325
  ?>\
1326
  </select>\
1327
  </td>';
1328
+ var counter = obj.parent().find('tr td input#order_count:last').length ? obj.parent().find('tr td input#order_count:last').val() : 0;
1329
+ obj.html('<td><input value="billing_new_fild'+(parseInt(counter,10)+1)+'" type="text" name="billing[new_fild][name][]" /></td><td><input value="" type="text" name="billing[new_fild][label][]" /></td><td><input value="" type="text" name="billing[new_fild][placeholder][]" /></td><td><input type="checkbox" name="billing[new_fild][clear][]" /></td><td><input value="" type="text" name="billing[new_fild][class][]" /></td><td> Select <input type="radio" value="select" name="billing[new_fild][type][][' + (parseInt(counter, 10) + 1) + ']"><br>Radio <input type="radio" value="radio" name="billing[new_fild][type][][' + (parseInt(counter, 10) + 1) + ']"><br>Checkbox <input type="radio" value="checkbox" name="billing[new_fild][type][][' + (parseInt(counter, 10) + 1) + ']"><br> Textarea <input type="radio" value="textarea" name="billing[new_fild][type][][' + (parseInt(counter, 10) + 1) + ']"><br> Text <input type="radio" value="" name="billing[new_fild][type][][' + (parseInt(counter, 10) + 1) + ']" checked="checked"></td><td><input checked type="checkbox" name="billing[new_fild][required][]" /></td><td><input checked type="checkbox" name="billing[new_fild][public][]" /></td>' + fild_pm + '<td><input id="order_count" rel="sort_order" type="hidden" name="billing[new_fild][order][]" value="'+(parseInt(counter,10)+1)+'" /><input type="button" class="button" id="billing_delete" value="Удалить -"/></td>');
1330
  obj.removeClass('nodrop nodrag');
1331
  obj.after('<tr class="nodrop nodrag"><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td><input type="button" class="button" id="billing" value="Добавить +"/></td></tr>');
1332
  });
1353
  ?>\
1354
  </select>\
1355
  </td>';
1356
+ var counter = obj.parent().find('tr td input#order_count:last').length ? obj.parent().find('tr td input#order_count:last').val() : 0;
1357
+ obj.html('<td><input value="shipping_new_fild'+(parseInt(counter,10)+1)+'" type="text" name="shipping[new_fild][name][]" /></td><td><input value="" type="text" name="shipping[new_fild][label][]" /></td><td><input value="" type="text" name="shipping[new_fild][placeholder][]" /></td><td><input type="checkbox" name="shipping[new_fild][clear][]" /></td><td><input value="" type="text" name="shipping[new_fild][class][]" /></td><td><input checked type="checkbox" name="shipping[new_fild][required][]" /></td><td><input checked type="checkbox" name="shipping[new_fild][public][]" /></td>' + fild_pm + '<td><input id="order_count" rel="sort_order" type="hidden" name="shipping[new_fild][order][]" value="'+(parseInt(counter,10)+1)+'" /><input type="button" class="button" id="billing_delete" value="Удалить -"/></td>');
1358
  obj.removeClass('nodrop nodrag');
1359
  obj.after('<tr class="nodrop nodrag"><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td><input type="button" class="button" id="shipping" value="Добавить +"/></td></tr>');
1360
  });
1361
  jQuery("body").delegate('.button#order', 'click',function() {
1362
  var obj = jQuery(this).parent().parent();
1363
+ var counter = obj.parent().find('tr td input#order_count:last').length ? obj.parent().find('tr td input#order_count:last').val() : 0;
1364
+ obj.html('<td><input value="order_new_fild'+(parseInt(counter,10)+1)+'" type="text" name="order[new_fild][name][]" /></td><td><input value="" type="text" name="order[new_fild][label][]" /></td><td><input value="" type="text" name="order[new_fild][placeholder][]" /></td><td><input value="" type="text" name="order[new_fild][class][]" /></td><td><input checked type="text" name="order[new_fild][type][]" /></td><td><input checked type="checkbox" name="order[new_fild][public][]" /></td><td><input id="order_count" rel="sort_order" type="hidden" name="order[new_fild][order][]" value="'+(parseInt(counter,10)+1)+'" /><input type="button" class="button" id="billing_delete" value="Удалить -"/></td>');
1365
  obj.removeClass('nodrop nodrag');
1366
  obj.after('<tr class="nodrop nodrag"><td></td><td></td><td></td><td></td><td></td><td></td><td><input type="button" class="button" id="order" value="Добавить +"/></td></tr>');
1367
  });
1601
  elseif ( version_compare( WOOCOMMERCE_VERSION, '3.0', '<' ) )
1602
  $value_fild = $order->__get( $key );
1603
  else $value_fild = get_post_meta( $order->get_id(), '_' . $key, true );
1604
+ if( $value_fild && in_array($field["type"] , array('select', 'radio')) && isset($field["options"][$value_fild]) ) {
1605
+ $value_fild = $field["options"][$value_fild];
1606
+ }
1607
  if ( $value_fild && !empty($field['label']) ) echo '<p><strong>'.$field['label'].':</strong> '.$value_fild.'</p>';
1608
 
1609
  endforeach;
1780
  elseif ( version_compare( WOOCOMMERCE_VERSION, '3.0', '<' ) )
1781
  $value_fild = $order->__get( $key );
1782
  else $value_fild = get_post_meta( $order->get_id(), '_' . $key, true );
1783
+ if( $value_fild && in_array($field["type"] , array('select', 'radio')) && isset($field["options"][$value_fild]) ) {
1784
+ $value_fild = $field["options"][$value_fild];
1785
+ }
1786
  if ( $value_fild && !empty($field['label']) )
1787
  echo '<div class="form-field form-field-wide"><label><strong>'. $field['label']. ':</strong></label> ' . $value_fild.'</div>';
1788
  endforeach;
1878
  elseif ( version_compare( WOOCOMMERCE_VERSION, '3.0', '<' ) )
1879
  $value_fild = $order->__get( $key );
1880
  else $value_fild = get_post_meta( $order->get_id(), '_' . $key, true );
1881
+ if( $value_fild && in_array($field["type"] , array('select', 'radio')) && isset($field["options"][$value_fild]) ) {
1882
+ $value_fild = $field["options"][$value_fild];
1883
+ }
1884
  if ( $value_fild && !empty($field['label']))
1885
  echo '<div class="form-field form-field-wide"><label><strong>'. $field['label']. ':</strong></label> ' . $value_fild.'</div>';
1886
  endforeach;