Saphali Woocommerce Russian - Version 1.3.7

Version Description

  • . , javascript'o ( WC).
Download this release

Release Info

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

Code changes from version 1.3.6.2 to 1.3.7

Files changed (2) hide show
  1. readme.txt +5 -2
  2. saphali-woocommerce-lite.php +56 -7
readme.txt CHANGED
@@ -6,8 +6,8 @@ Donate link: http://saphali.com/
6
  Tags: woocommerce, woo commerce russian, russian ruble, ukrainian hryvnia, mod, manadger filds checkout
7
  Requires at least: 3.3 or higher
8
  Tested up to: 3.6.1
9
- Stable tag: 1.3.6.2
10
- Version: 1.3.6.2
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
@@ -62,6 +62,9 @@ QIWI, Приват24, LiqPay, WebMoney, Яндекс.Деньги, Интерк
62
 
63
  == Changelog ==
64
 
 
 
 
65
  = 1.3.6.2 =
66
  * Повышение приоритета знака валюты по Лебедеву (для рубля) над встроенным.
67
 
6
  Tags: woocommerce, woo commerce russian, russian ruble, ukrainian hryvnia, mod, manadger filds checkout
7
  Requires at least: 3.3 or higher
8
  Tested up to: 3.6.1
9
+ Stable tag: 1.3.7
10
+ Version: 1.3.7
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
62
 
63
  == Changelog ==
64
 
65
+ = 1.3.7 =
66
+ * Добавлен фильтр отображения полей по умолчанию. Отсутствие этого фильтра приводило к тому, что поля подтягивались javascript'oм не так как нужно (название поля и его обязательность отображалось как по умолчанию в WC).
67
+
68
  = 1.3.6.2 =
69
  * Повышение приоритета знака валюты по Лебедеву (для рубля) над встроенным.
70
 
saphali-woocommerce-lite.php CHANGED
@@ -3,7 +3,7 @@
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.3.6.2
7
  Author: Saphali
8
  Author URI: http://saphali.com/
9
  */
@@ -30,7 +30,7 @@ Author URI: http://saphali.com/
30
  ------------------------------------------------------------ */
31
  // Подключение валюты и локализации
32
  define('SAPHALI_PLUGIN_DIR_URL',plugin_dir_url(__FILE__));
33
- define('SAPHALI_LITE_VERSION', '1.3.6.2' );
34
  define('SAPHALI_PLUGIN_DIR_PATH',plugin_dir_path(__FILE__));
35
  class saphali_lite {
36
  var $email_order_id;
@@ -60,6 +60,8 @@ Author URI: http://saphali.com/
60
  add_filter( 'woocommerce_checkout_fields' , array($this,'saphali_custom_override_checkout_fields') );
61
  add_filter( 'woocommerce_billing_fields', array($this,'saphali_custom_billing_fields'), 10, 1 );
62
  add_filter( 'woocommerce_shipping_fields', array($this,'saphali_custom_shipping_fields'), 10, 1 );
 
 
63
  add_action('admin_init', array($this,'woocommerce_customer_meta_fields_action'), 20);
64
  add_action( 'personal_options_update', array($this,'woocommerce_save_customer_meta_fields_saphali') );
65
  add_action( 'edit_user_profile_update', array($this,'woocommerce_save_customer_meta_fields_saphali') );
@@ -71,6 +73,16 @@ Author URI: http://saphali.com/
71
  add_filter( 'woocommerce_currency_symbol', array($this,'add_inr_currency_symbol') , 11 );
72
  }
73
  }
 
 
 
 
 
 
 
 
 
 
74
  public function generator() {
75
  echo "\n\n" . '<!-- Saphali Lite Version -->' . "\n" . '<meta name="generator" content="Saphali Lite ' . esc_attr( SAPHALI_LITE_VERSION ) . '" />' . "\n\n";
76
  }
@@ -265,7 +277,8 @@ Author URI: http://saphali.com/
265
  foreach($value_post as $k_post=> $v_post){
266
  if( 'on' == $v_post ) {
267
  $filds["billing"][$key_post][$k_post] = true;
268
- } elseif(in_array($k_post, array('public','clear','required'))) { $filds["billing"][$key_post][$k_post] = false; if(!$filds["billing"][$key_post][$k_post] && $k_post == 'public') unset($filds["billing"][$key_post][$k_post]); }
 
269
  }
270
  $filds_new["billing"][$filds["billing"][$key_post]["order"]][$key_post] = $value_post;
271
 
@@ -289,7 +302,8 @@ Author URI: http://saphali.com/
289
  foreach($value_post as $k_post=> $v_post){
290
  if( 'on' == $v_post ) {
291
  $filds["shipping"][$key_post][$k_post] = true;
292
- } elseif(in_array($k_post, array('public','clear','required'))) { $filds["shipping"][$key_post][$k_post] = false; if(!$filds["shipping"][$key_post][$k_post] && $k_post == 'public') unset($filds["shipping"][$key_post][$k_post]); }
 
293
  }
294
  $filds_new["shipping"][$filds["shipping"][$key_post]["order"]][$key_post] = $value_post;
295
  unset($_POST["shipping"][$key_post]);
@@ -310,7 +324,8 @@ Author URI: http://saphali.com/
310
  foreach($value_post as $k_post=> $v_post){
311
  if( 'on' == $v_post ) {
312
  $filds["order"][$key_post][$k_post] = true;
313
- } elseif(in_array($k_post, array('public','clear','required'))) { $filds["order"][$key_post][$k_post] = false; if(!$filds["order"][$key_post][$k_post] && $k_post == 'public') unset($filds["order"][$key_post][$k_post]); }
 
314
  }
315
 
316
  $filds_new["order"][$filds["order"][$key_post]["order"]][$key_post] = $value_post;
@@ -353,9 +368,19 @@ Author URI: http://saphali.com/
353
  }
354
  if(!update_option('woocommerce_saphali_filds',$filds_finish))add_option('woocommerce_saphali_filds',$filds_finish);
355
  if(!update_option('woocommerce_saphali_filds_filters',$filds_finish_filter))add_option('woocommerce_saphali_filds_filters',$filds_finish_filter);
 
 
 
 
 
 
 
 
 
356
  } else {
357
  delete_option('woocommerce_saphali_filds');
358
  delete_option('woocommerce_saphali_filds_filters');
 
359
  }
360
  }
361
 
@@ -881,13 +906,15 @@ Author URI: http://saphali.com/
881
  $fields["shipping"] = $fieldss["shipping"];
882
  $fields["order"] = $fieldss["order"];
883
  }
 
884
  return $fields;
885
  }
886
  function saphali_custom_billing_fields( $fields ) {
887
-
888
  $fieldss = get_option('woocommerce_saphali_filds_filters');
889
  if(is_array($fieldss))
890
  $fields = $fieldss["billing"];
 
891
  return $fields;
892
  }
893
  function saphali_custom_shipping_fields( $fields ) {
@@ -1040,4 +1067,26 @@ function _print_script_columns() {
1040
  </style>
1041
  <?php
1042
  }
1043
- add_action( 'admin_enqueue_scripts', array('saphali_lite','admin_enqueue_scripts_page_saphali') );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.3.7
7
  Author: Saphali
8
  Author URI: http://saphali.com/
9
  */
30
  ------------------------------------------------------------ */
31
  // Подключение валюты и локализации
32
  define('SAPHALI_PLUGIN_DIR_URL',plugin_dir_url(__FILE__));
33
+ define('SAPHALI_LITE_VERSION', '1.3.7' );
34
  define('SAPHALI_PLUGIN_DIR_PATH',plugin_dir_path(__FILE__));
35
  class saphali_lite {
36
  var $email_order_id;
60
  add_filter( 'woocommerce_checkout_fields' , array($this,'saphali_custom_override_checkout_fields') );
61
  add_filter( 'woocommerce_billing_fields', array($this,'saphali_custom_billing_fields'), 10, 1 );
62
  add_filter( 'woocommerce_shipping_fields', array($this,'saphali_custom_shipping_fields'), 10, 1 );
63
+ add_filter( 'woocommerce_default_address_fields', array($this,'woocommerce_default_address_fields'), 10, 1 );
64
+ //add_filter( 'woocommerce_get_country_locale', array($this,'woocommerce_get_country_locale'), 10, 1 );
65
  add_action('admin_init', array($this,'woocommerce_customer_meta_fields_action'), 20);
66
  add_action( 'personal_options_update', array($this,'woocommerce_save_customer_meta_fields_saphali') );
67
  add_action( 'edit_user_profile_update', array($this,'woocommerce_save_customer_meta_fields_saphali') );
73
  add_filter( 'woocommerce_currency_symbol', array($this,'add_inr_currency_symbol') , 11 );
74
  }
75
  }
76
+ public function woocommerce_default_address_fields($locale) {
77
+ $fieldss = get_option('woocommerce_saphali_filds_locate');
78
+ if(is_array($fieldss))
79
+ $locale = $fieldss;
80
+ return $locale;
81
+ }
82
+ public function woocommerce_get_country_locale($locale) {
83
+
84
+ return $locale;
85
+ }
86
  public function generator() {
87
  echo "\n\n" . '<!-- Saphali Lite Version -->' . "\n" . '<meta name="generator" content="Saphali Lite ' . esc_attr( SAPHALI_LITE_VERSION ) . '" />' . "\n\n";
88
  }
277
  foreach($value_post as $k_post=> $v_post){
278
  if( 'on' == $v_post ) {
279
  $filds["billing"][$key_post][$k_post] = true;
280
+ $value_post[$k_post] = true;
281
+ } 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]); }
282
  }
283
  $filds_new["billing"][$filds["billing"][$key_post]["order"]][$key_post] = $value_post;
284
 
302
  foreach($value_post as $k_post=> $v_post){
303
  if( 'on' == $v_post ) {
304
  $filds["shipping"][$key_post][$k_post] = true;
305
+ $value_post[$k_post] = true;
306
+ } 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]); }
307
  }
308
  $filds_new["shipping"][$filds["shipping"][$key_post]["order"]][$key_post] = $value_post;
309
  unset($_POST["shipping"][$key_post]);
324
  foreach($value_post as $k_post=> $v_post){
325
  if( 'on' == $v_post ) {
326
  $filds["order"][$key_post][$k_post] = true;
327
+ $value_post[$k_post] = true;
328
+ } 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]); }
329
  }
330
 
331
  $filds_new["order"][$filds["order"][$key_post]["order"]][$key_post] = $value_post;
368
  }
369
  if(!update_option('woocommerce_saphali_filds',$filds_finish))add_option('woocommerce_saphali_filds',$filds_finish);
370
  if(!update_option('woocommerce_saphali_filds_filters',$filds_finish_filter))add_option('woocommerce_saphali_filds_filters',$filds_finish_filter);
371
+ foreach($filds_finish_filter['billing'] as $k_f => $v_f) {
372
+ $new_key = str_replace('billing_', '' , $k_f);
373
+ if(in_array($new_key, array('country', 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode' ) ))
374
+ $locate[$new_key] = $v_f;
375
+ elseif(in_array(str_replace('shipping_', '' , $k_f), array('country', 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode' ) )) {
376
+ $locate[$new_key] = $filds_finish_filter['shipping'][$k_f];
377
+ }
378
+ }
379
+ if(!update_option('woocommerce_saphali_filds_locate',$locate))add_option('woocommerce_saphali_filds_locate',$locate);
380
  } else {
381
  delete_option('woocommerce_saphali_filds');
382
  delete_option('woocommerce_saphali_filds_filters');
383
+ delete_option('woocommerce_saphali_filds_locate');
384
  }
385
  }
386
 
906
  $fields["shipping"] = $fieldss["shipping"];
907
  $fields["order"] = $fieldss["order"];
908
  }
909
+
910
  return $fields;
911
  }
912
  function saphali_custom_billing_fields( $fields ) {
913
+
914
  $fieldss = get_option('woocommerce_saphali_filds_filters');
915
  if(is_array($fieldss))
916
  $fields = $fieldss["billing"];
917
+
918
  return $fields;
919
  }
920
  function saphali_custom_shipping_fields( $fields ) {
1067
  </style>
1068
  <?php
1069
  }
1070
+ add_action( 'admin_enqueue_scripts', array('saphali_lite','admin_enqueue_scripts_page_saphali') );
1071
+
1072
+ register_activation_hook( __FILE__, 'saphali_woo_lite_install' );
1073
+
1074
+ function saphali_woo_lite_install() {
1075
+ $filds_finish_filter = get_option('woocommerce_saphali_filds_filters');
1076
+ if($filds_finish_filter) {
1077
+ foreach($filds_finish_filter['billing'] as $k_f => $v_f) {
1078
+ $new_key = str_replace('billing_', '' , $k_f);
1079
+ if(in_array($new_key, array('country', 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode' ) )) {
1080
+ $locate[$new_key] = $v_f;
1081
+ if( isset($locate[$new_key]['clear']) && $locate[$new_key]['clear'] == 'on') $locate[$new_key]['clear'] = true;
1082
+ if( isset($locate[$new_key]['required']) && $locate[$new_key]['required'] == 'on') $locate[$new_key]['required'] = true;
1083
+ } elseif(in_array(str_replace('shipping_', '' , $k_f), array('country', 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode' ) )) {
1084
+ $locate[$new_key] = $filds_finish_filter['shipping'][$k_f];
1085
+ if( isset($locate[$new_key]['clear']) && $locate[$new_key]['clear'] == 'on') $locate[$new_key]['clear'] = true;
1086
+ if( isset($locate[$new_key]['required']) && $locate[$new_key]['required'] == 'on') $locate[$new_key]['required'] = true;
1087
+ }
1088
+
1089
+ }
1090
+ if(!update_option('woocommerce_saphali_filds_locate',$locate))add_option('woocommerce_saphali_filds_locate',$locate);
1091
+ }
1092
+ }