Saphali Woocommerce Russian - Version 1.8.13

Version Description

  • select, radio.
  • Fix , .
Download this release

Release Info

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

Code changes from version 1.8.12 to 1.8.13

Files changed (2) hide show
  1. readme.txt +7 -2
  2. saphali-woocommerce-lite.php +44 -7
readme.txt CHANGED
@@ -5,8 +5,8 @@ Plugin URI: http://saphali.com/saphali-woocommerce-plugin-wordpress
5
  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.8
9
- Stable tag: 1.8.12
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -75,6 +75,11 @@ define('SAPHALI_LITE_SYMBOL', 0 );
75
  5. Управление количеством колонок в каталоге товаров и рубриках.
76
 
77
  == Changelog ==
 
 
 
 
 
78
  = 1.8.12 =
79
  * Fix обработки ошибок.
80
 
5
  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: 6.0
9
+ Stable tag: 1.8.13
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
75
  5. Управление количеством колонок в каталоге товаров и рубриках.
76
 
77
  == Changelog ==
78
+
79
+ = 1.8.13 =
80
+ * Добавлен фильтр для обработки полей с типом select, radio.
81
+ * Fix при фиксировании обязательного поля в полях для доставки, когда такие поля отсутствуют в полях оплаты.
82
+
83
  = 1.8.12 =
84
  * Fix обработки ошибок.
85
 
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.12
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: 5.5
13
  */
14
 
15
 
@@ -35,11 +35,12 @@ WC tested up to: 5.5
35
 
36
  // Подключение валюты и локализации
37
  define('SAPHALI_PLUGIN_DIR_URL',plugin_dir_url(__FILE__));
38
- define('SAPHALI_LITE_VERSION', '1.8.12' );
39
  define('SAPHALI_PLUGIN_DIR_PATH',plugin_dir_path(__FILE__));
40
  class saphali_lite {
41
  var $email_order_id;
42
  var $fieldss;
 
43
  var $unuque = array();
44
  var $locale_tmp;
45
  var $column_count_saphali;
@@ -83,7 +84,26 @@ WC tested up to: 5.5
83
  /* add_action( 'woocommerce_admin_order_data_after_billing_address', array($this,'woocommerce_admin_order_data_after_billing_address_s') );
84
  add_action( 'woocommerce_admin_order_data_after_shipping_address', array($this,'woocommerce_admin_order_data_after_shipping_address_s') ); */
85
  add_action( 'woocommerce_admin_order_data_after_order_details', array($this,'woocommerce_admin_order_data_after_order_details_s') );
86
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
88
  add_filter( 'woocommerce_currencies', array($this,'add_inr_currency') , 11);
89
  add_filter( 'woocommerce_currency_symbol', array($this,'add_inr_currency_symbol') , 1, 2 );
@@ -343,6 +363,7 @@ public function woocommerce_checkout_posted_data( $data ) {
343
  }
344
  }
345
  function print_script_payment_method() {
 
346
  if( !(is_cart() || is_checkout()) ) return;
347
  if(! isset($this->fieldss) )
348
  $this->fieldss = get_option('woocommerce_saphali_filds_filters');
@@ -878,6 +899,15 @@ public function woocommerce_checkout_posted_data( $data ) {
878
  $locate[$new_key] = $filds_finish_filter['shipping'][$k_f];
879
  }
880
  }
 
 
 
 
 
 
 
 
 
881
  if(!update_option('woocommerce_saphali_filds_locate',$locate))add_option('woocommerce_saphali_filds_locate',$locate);
882
  } else {
883
  delete_option('woocommerce_saphali_filds');
@@ -1030,11 +1060,17 @@ public function woocommerce_checkout_posted_data( $data ) {
1030
  <td>
1031
  <select multiple="multiple" width="120px" name="billing[<?php echo $key?>][shipping_method][]">
1032
  <option value="0"<?php if( isset($value['shipping_method']) && ( is_array($value['shipping_method']) && in_array('0', (array)$value['shipping_method']) || empty($value['shipping_method']) ) || !isset($value['shipping_method']) ) echo 'selected';?>>Все</option>
1033
- <?php
 
1034
  foreach ( $woocommerce->shipping->get_shipping_methods() as $act_id => $shipping ) {
1035
  if ( $shipping->enabled == 'no' ) continue;
 
1036
  ?><option value="<?php echo $act_id; ?>" <?php if(isset($value['shipping_method']) && is_array($value['shipping_method']) && in_array($act_id, (array)$value['shipping_method']) ) echo 'selected';?>><?php echo $shipping->title ? $shipping->title: $shipping->method_title; ?></option><?php
1037
- }
 
 
 
 
1038
  ?>
1039
  </select>
1040
  </td>
@@ -1801,7 +1837,8 @@ public function woocommerce_checkout_posted_data( $data ) {
1801
  public function email_pickup_location( $template_name, $template_path, $located, $args = array() ) {
1802
  global $_shipping_data, $_billing_data;
1803
  if($template_name == 'emails/email-addresses.php' && isset($args["order"]) && is_object($args["order"]) ) {
1804
- $this->email_order_id = $args["order"]->get_id();
 
1805
  }
1806
 
1807
  if ( $template_name == 'emails/email-addresses.php' && $this->email_order_id ) {
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.13
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: 6.6
13
  */
14
 
15
 
35
 
36
  // Подключение валюты и локализации
37
  define('SAPHALI_PLUGIN_DIR_URL',plugin_dir_url(__FILE__));
38
+ define('SAPHALI_LITE_VERSION', '1.8.13' );
39
  define('SAPHALI_PLUGIN_DIR_PATH',plugin_dir_path(__FILE__));
40
  class saphali_lite {
41
  var $email_order_id;
42
  var $fieldss;
43
+ var $fields_valid = array();
44
  var $unuque = array();
45
  var $locale_tmp;
46
  var $column_count_saphali;
84
  /* add_action( 'woocommerce_admin_order_data_after_billing_address', array($this,'woocommerce_admin_order_data_after_billing_address_s') );
85
  add_action( 'woocommerce_admin_order_data_after_shipping_address', array($this,'woocommerce_admin_order_data_after_shipping_address_s') ); */
86
  add_action( 'woocommerce_admin_order_data_after_order_details', array($this,'woocommerce_admin_order_data_after_order_details_s') );
87
+ if ( ! version_compare( WOOCOMMERCE_VERSION, '3.0.0', '<' ) ) {
88
+ $billing_data = $this->woocommerce_get_customer_meta_fields_saphali();
89
+
90
+ if(is_array($billing_data["billing"])) {
91
+ foreach ( $billing_data["billing"] as $key => $field ) {
92
+ // var_dump($field["type"]);
93
+ if (isset($field['show']) && !$field['show']) continue;
94
+
95
+ $field_name = '_'.$key;
96
+ $this->fields_valid[] = $field;
97
+ add_filter('woocommerce_order_get_'. $field_name, function($fild) {
98
+ $field = array_shift($this->fields_valid);
99
+ if( $fild && in_array($field["type"] , array('select', 'radio')) && isset($field["options"][$fild]) ) {
100
+ $fild = $field["options"][$fild];
101
+ }
102
+ return $fild;
103
+ });
104
+ }
105
+ }
106
+ }
107
  }
108
  add_filter( 'woocommerce_currencies', array($this,'add_inr_currency') , 11);
109
  add_filter( 'woocommerce_currency_symbol', array($this,'add_inr_currency_symbol') , 1, 2 );
363
  }
364
  }
365
  function print_script_payment_method() {
366
+ if(!function_exists('is_cart')) return;
367
  if( !(is_cart() || is_checkout()) ) return;
368
  if(! isset($this->fieldss) )
369
  $this->fieldss = get_option('woocommerce_saphali_filds_filters');
899
  $locate[$new_key] = $filds_finish_filter['shipping'][$k_f];
900
  }
901
  }
902
+ foreach ($filds_finish_filter['shipping'] as $k_f => $v_f) {
903
+ $new_key = str_replace('shipping_', '', $k_f);
904
+ if(isset($locate[$new_key])) continue;
905
+ if (in_array($new_key, array('country', 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode')))
906
+ $locate[$new_key] = $v_f;
907
+ elseif (in_array(str_replace('billing_', '', $k_f), array('country', 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode'))) {
908
+ $locate[$new_key] = $filds_finish_filter['billing'][$k_f];
909
+ }
910
+ }
911
  if(!update_option('woocommerce_saphali_filds_locate',$locate))add_option('woocommerce_saphali_filds_locate',$locate);
912
  } else {
913
  delete_option('woocommerce_saphali_filds');
1060
  <td>
1061
  <select multiple="multiple" width="120px" name="billing[<?php echo $key?>][shipping_method][]">
1062
  <option value="0"<?php if( isset($value['shipping_method']) && ( is_array($value['shipping_method']) && in_array('0', (array)$value['shipping_method']) || empty($value['shipping_method']) ) || !isset($value['shipping_method']) ) echo 'selected';?>>Все</option>
1063
+ <?php
1064
+ $no_add_option = true;
1065
  foreach ( $woocommerce->shipping->get_shipping_methods() as $act_id => $shipping ) {
1066
  if ( $shipping->enabled == 'no' ) continue;
1067
+ if( in_array($act_id, (array)$value['shipping_method']) ) $no_add_option = false;
1068
  ?><option value="<?php echo $act_id; ?>" <?php if(isset($value['shipping_method']) && is_array($value['shipping_method']) && in_array($act_id, (array)$value['shipping_method']) ) echo 'selected';?>><?php echo $shipping->title ? $shipping->title: $shipping->method_title; ?></option><?php
1069
+ }
1070
+ if($no_add_option && !empty($value['shipping_method'])) {
1071
+ $value_shipping_method = is_array($value['shipping_method']) ? $value['shipping_method'][0] : $value['shipping_method'];
1072
+ ?><option value="<?php echo $value_shipping_method; ?>" <?php echo 'selected';?>><?php echo $value_shipping_method; ?></option><?php
1073
+ }
1074
  ?>
1075
  </select>
1076
  </td>
1837
  public function email_pickup_location( $template_name, $template_path, $located, $args = array() ) {
1838
  global $_shipping_data, $_billing_data;
1839
  if($template_name == 'emails/email-addresses.php' && isset($args["order"]) && is_object($args["order"]) ) {
1840
+ $id = method_exists($args["order"], 'get_id') ? $args["order"]->get_id() : $args["order"]->id;
1841
+ $this->email_order_id = $id;
1842
  }
1843
 
1844
  if ( $template_name == 'emails/email-addresses.php' && $this->email_order_id ) {