Version Description
- .
- , .
Download this release
Release Info
Developer | Saphali |
Plugin | Saphali Woocommerce Russian |
Version | 1.2.3 |
Comparing to | |
See all releases |
Code changes from version 1.2.2 to 1.2.3
- readme.txt +6 -2
- saphali-woocommerce-lite.php +280 -5
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.4.2
|
9 |
-
Stable tag: 1.2.
|
10 |
-
Version: 1.2.
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
@@ -43,6 +43,10 @@ Saphali - set of additions to Woocommerce.
|
|
43 |
|
44 |
== Changelog ==
|
45 |
|
|
|
|
|
|
|
|
|
46 |
= 1.2.2 =
|
47 |
* На странице управления дополнительными полями и полями доставки в заголовке к атрибутам "Название" и "Класс поля" добавлена подсказка.
|
48 |
* Задан стиль для неактивного поля.
|
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.4.2
|
9 |
+
Stable tag: 1.2.3
|
10 |
+
Version: 1.2.3
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
43 |
|
44 |
== Changelog ==
|
45 |
|
46 |
+
= 1.2.3 =
|
47 |
+
* На странице управления дополнительными полями и полями доставки исправлена ошибка добавления полей.
|
48 |
+
* Добавлен вывод дополнительных полей на странице профиля пользователя, а также на странице редактирования заказа.
|
49 |
+
|
50 |
= 1.2.2 =
|
51 |
* На странице управления дополнительными полями и полями доставки в заголовке к атрибутам "Название" и "Класс поля" добавлена подсказка.
|
52 |
* Задан стиль для неактивного поля.
|
saphali-woocommerce-lite.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Saphali Woocommerce LITE
|
4 |
Plugin URI: http://saphali.com/saphali-woocommerce-plugin-wordpress
|
5 |
Description: Saphali Woocommerce LITE - это бесплатный вордпресс плагин, который добавляет набор дополнений к интернет-магазину на Woocommerce.
|
6 |
-
Version: 1.2.
|
7 |
Author: Saphali
|
8 |
Author URI: http://saphali.com/
|
9 |
*/
|
@@ -58,12 +58,284 @@ function woocommerce_lang() {
|
|
58 |
add_action('admin_menu', 'woocommerce_saphali_admin_menu', 9);
|
59 |
load_plugin_textdomain( 'woocommerce', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
|
60 |
load_plugin_textdomain( 'themewoocommerce', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
|
|
|
61 |
if($_GET['page'] != 'woocommerce_saphali' && $_GET['tab'] !=1) {
|
62 |
// Hook in
|
63 |
add_filter( 'woocommerce_checkout_fields' , 'saphali_custom_override_checkout_fields' );
|
64 |
add_filter( 'woocommerce_billing_fields', 'saphali_custom_billing_fields', 10, 1 );
|
65 |
add_filter( 'woocommerce_shipping_fields', 'saphali_custom_shipping_fields', 10, 1 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
// Our hooked in function - $fields is passed via the filter!
|
68 |
function saphali_custom_override_checkout_fields( $fields ) {
|
69 |
|
@@ -130,6 +402,7 @@ function woocommerce_lang() {
|
|
130 |
if($_POST){
|
131 |
if($_POST["reset"] != 'All') {
|
132 |
// Управление новыми полями
|
|
|
133 |
if(is_array($_POST["billing"]["new_fild"])) {
|
134 |
foreach($_POST["billing"]["new_fild"] as $k_nf => $v_nf) {
|
135 |
if($k_nf == 'name')
|
@@ -146,6 +419,7 @@ function woocommerce_lang() {
|
|
146 |
}
|
147 |
}
|
148 |
unset($_POST["billing"]["new_fild"]);
|
|
|
149 |
}
|
150 |
if(is_array($_POST["shipping"]["new_fild"])) {
|
151 |
foreach($_POST["shipping"]["new_fild"] as $k_nf => $v_nf) {
|
@@ -163,6 +437,7 @@ function woocommerce_lang() {
|
|
163 |
}
|
164 |
}
|
165 |
unset($_POST["shipping"]["new_fild"]);
|
|
|
166 |
}
|
167 |
if(is_array($_POST["order"]["new_fild"])) {
|
168 |
foreach($_POST["order"]["new_fild"] as $k_nf => $v_nf) {
|
@@ -434,7 +709,7 @@ function woocommerce_lang() {
|
|
434 |
</tr>
|
435 |
</tfoot>
|
436 |
<tbody id="the-list" class="myTable">
|
437 |
-
<? $count = 0;
|
438 |
if(is_array($checkout_fields["shipping"])) $f->checkout_fields["shipping"] = $checkout_fields["shipping"];
|
439 |
foreach($f->checkout_fields["shipping"] as $key => $value) {
|
440 |
if( empty($value['public']) && !is_array($checkout_fields["shipping"]) ) $value['public'] = true;
|
@@ -559,19 +834,19 @@ function woocommerce_lang() {
|
|
559 |
});
|
560 |
jQuery('.button#billing').live('click',function() {
|
561 |
var obj = jQuery(this).parent().parent();
|
562 |
-
obj.html('<td><input value="
|
563 |
obj.removeClass('nodrop nodrag');
|
564 |
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>');
|
565 |
});
|
566 |
jQuery('.button#shipping').live('click',function() {
|
567 |
var obj = jQuery(this).parent().parent();
|
568 |
-
obj.html('<td><input value="
|
569 |
obj.removeClass('nodrop nodrag');
|
570 |
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>');
|
571 |
});
|
572 |
jQuery('.button#order').live('click',function() {
|
573 |
var obj = jQuery(this).parent().parent();
|
574 |
-
obj.html('<td><input value="
|
575 |
obj.removeClass('nodrop nodrag');
|
576 |
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>');
|
577 |
});
|
3 |
Plugin Name: Saphali Woocommerce LITE
|
4 |
Plugin URI: http://saphali.com/saphali-woocommerce-plugin-wordpress
|
5 |
Description: Saphali Woocommerce LITE - это бесплатный вордпресс плагин, который добавляет набор дополнений к интернет-магазину на Woocommerce.
|
6 |
+
Version: 1.2.3
|
7 |
Author: Saphali
|
8 |
Author URI: http://saphali.com/
|
9 |
*/
|
58 |
add_action('admin_menu', 'woocommerce_saphali_admin_menu', 9);
|
59 |
load_plugin_textdomain( 'woocommerce', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
|
60 |
load_plugin_textdomain( 'themewoocommerce', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
|
61 |
+
|
62 |
if($_GET['page'] != 'woocommerce_saphali' && $_GET['tab'] !=1) {
|
63 |
// Hook in
|
64 |
add_filter( 'woocommerce_checkout_fields' , 'saphali_custom_override_checkout_fields' );
|
65 |
add_filter( 'woocommerce_billing_fields', 'saphali_custom_billing_fields', 10, 1 );
|
66 |
add_filter( 'woocommerce_shipping_fields', 'saphali_custom_shipping_fields', 10, 1 );
|
67 |
+
add_action('admin_init','woocommerce_customer_meta_fields_action', 20);
|
68 |
+
add_action( 'personal_options_update', 'woocommerce_save_customer_meta_fields_saphali' );
|
69 |
+
add_action( 'edit_user_profile_update', 'woocommerce_save_customer_meta_fields_saphali' );
|
70 |
+
add_action( 'woocommerce_admin_order_data_after_billing_address', 'woocommerce_admin_order_data_after_billing_address_s' );
|
71 |
+
add_action( 'woocommerce_admin_order_data_after_shipping_address', 'woocommerce_admin_order_data_after_shipping_address_s' );
|
72 |
+
add_action( 'woocommerce_admin_order_data_after_order_details', 'woocommerce_admin_order_data_after_order_details_s' );
|
73 |
+
|
74 |
+
}
|
75 |
+
|
76 |
+
/*Начало*/
|
77 |
+
function woocommerce_customer_meta_fields_action() {
|
78 |
+
add_action( 'show_user_profile', 'woocommerce_customer_meta_fields_s');
|
79 |
+
add_action( 'edit_user_profile', 'woocommerce_customer_meta_fields_s' );
|
80 |
+
}
|
81 |
+
function woocommerce_customer_meta_fields_s( $user ) {
|
82 |
+
if ( ! current_user_can( 'manage_woocommerce' ) )
|
83 |
+
return;
|
84 |
+
|
85 |
+
$show_fields = woocommerce_get_customer_meta_fields_saphali();
|
86 |
+
if(!empty($show_fields["billing"])) {
|
87 |
+
$show_field["billing"]['title'] = __('Customer Billing Address', 'woocommerce');
|
88 |
+
$show_field["billing"]['fields'] = $show_fields["billing"];
|
89 |
+
}
|
90 |
+
if(!empty($show_fields["shipping"])) {
|
91 |
+
$show_field["shipping"]['title'] = __('Customer Shipping Address', 'woocommerce');
|
92 |
+
$show_field["shipping"]['fields'] = $show_fields["shipping"];
|
93 |
+
}
|
94 |
+
if(is_array($show_field)) {
|
95 |
+
$count = 0; echo '<fieldset>';
|
96 |
+
foreach( $show_field as $fieldset ) :
|
97 |
+
if(!$count) echo '<h2>Дополнительные поля</h2>';
|
98 |
+
$count++;
|
99 |
+
?>
|
100 |
+
<h3><?php echo $fieldset['title']; ?></h3>
|
101 |
+
<table class="form-table">
|
102 |
+
<?php
|
103 |
+
foreach( $fieldset['fields'] as $key => $field ) :
|
104 |
+
?>
|
105 |
+
<tr>
|
106 |
+
<th><label for="<?php echo $key; ?>"><?php echo $field['label']; ?></label></th>
|
107 |
+
<td>
|
108 |
+
<input type="text" name="<?php echo $key; ?>" id="<?php echo $key; ?>" value="<?php echo esc_attr( get_user_meta( $user->ID, $key, true ) ); ?>" class="regular-text" /><br/>
|
109 |
+
<span class="description"><?php echo $field['description']; ?></span>
|
110 |
+
</td>
|
111 |
+
</tr>
|
112 |
+
<?php
|
113 |
+
endforeach;
|
114 |
+
?>
|
115 |
+
</table>
|
116 |
+
<?php
|
117 |
+
endforeach; echo '</fieldset>';
|
118 |
+
}
|
119 |
+
}
|
120 |
+
function woocommerce_get_customer_meta_fields_saph_ed() {
|
121 |
+
$show_fields = apply_filters('woocommerce_customer_meta_fields', array(
|
122 |
+
'billing' => array(
|
123 |
+
'title' => __('Customer Billing Address', 'woocommerce'),
|
124 |
+
'fields' => array(
|
125 |
+
'billing_first_name' => array(
|
126 |
+
'label' => __('First name', 'woocommerce'),
|
127 |
+
'description' => ''
|
128 |
+
),
|
129 |
+
'billing_last_name' => array(
|
130 |
+
'label' => __('Last name', 'woocommerce'),
|
131 |
+
'description' => ''
|
132 |
+
),
|
133 |
+
'billing_company' => array(
|
134 |
+
'label' => __('Company', 'woocommerce'),
|
135 |
+
'description' => ''
|
136 |
+
),
|
137 |
+
'billing_address_1' => array(
|
138 |
+
'label' => __('Address 1', 'woocommerce'),
|
139 |
+
'description' => ''
|
140 |
+
),
|
141 |
+
'billing_address_2' => array(
|
142 |
+
'label' => __('Address 2', 'woocommerce'),
|
143 |
+
'description' => ''
|
144 |
+
),
|
145 |
+
'billing_city' => array(
|
146 |
+
'label' => __('City', 'woocommerce'),
|
147 |
+
'description' => ''
|
148 |
+
),
|
149 |
+
'billing_postcode' => array(
|
150 |
+
'label' => __('Postcode', 'woocommerce'),
|
151 |
+
'description' => ''
|
152 |
+
),
|
153 |
+
'billing_state' => array(
|
154 |
+
'label' => __('State/County', 'woocommerce'),
|
155 |
+
'description' => __('Country or state code', 'woocommerce'),
|
156 |
+
),
|
157 |
+
'billing_country' => array(
|
158 |
+
'label' => __('Country', 'woocommerce'),
|
159 |
+
'description' => __('2 letter Country code', 'woocommerce'),
|
160 |
+
),
|
161 |
+
'billing_phone' => array(
|
162 |
+
'label' => __('Telephone', 'woocommerce'),
|
163 |
+
'description' => ''
|
164 |
+
),
|
165 |
+
'billing_email' => array(
|
166 |
+
'label' => __('Email', 'woocommerce'),
|
167 |
+
'description' => ''
|
168 |
+
)
|
169 |
+
)
|
170 |
+
),
|
171 |
+
'shipping' => array(
|
172 |
+
'title' => __('Customer Shipping Address', 'woocommerce'),
|
173 |
+
'fields' => array(
|
174 |
+
'shipping_first_name' => array(
|
175 |
+
'label' => __('First name', 'woocommerce'),
|
176 |
+
'description' => ''
|
177 |
+
),
|
178 |
+
'shipping_last_name' => array(
|
179 |
+
'label' => __('Last name', 'woocommerce'),
|
180 |
+
'description' => ''
|
181 |
+
),
|
182 |
+
'shipping_company' => array(
|
183 |
+
'label' => __('Company', 'woocommerce'),
|
184 |
+
'description' => ''
|
185 |
+
),
|
186 |
+
'shipping_address_1' => array(
|
187 |
+
'label' => __('Address 1', 'woocommerce'),
|
188 |
+
'description' => ''
|
189 |
+
),
|
190 |
+
'shipping_address_2' => array(
|
191 |
+
'label' => __('Address 2', 'woocommerce'),
|
192 |
+
'description' => ''
|
193 |
+
),
|
194 |
+
'shipping_city' => array(
|
195 |
+
'label' => __('City', 'woocommerce'),
|
196 |
+
'description' => ''
|
197 |
+
),
|
198 |
+
'shipping_postcode' => array(
|
199 |
+
'label' => __('Postcode', 'woocommerce'),
|
200 |
+
'description' => ''
|
201 |
+
),
|
202 |
+
'shipping_state' => array(
|
203 |
+
'label' => __('State/County', 'woocommerce'),
|
204 |
+
'description' => __('State/County or state code', 'woocommerce')
|
205 |
+
),
|
206 |
+
'shipping_country' => array(
|
207 |
+
'label' => __('Country', 'woocommerce'),
|
208 |
+
'description' => __('2 letter Country code', 'woocommerce')
|
209 |
+
)
|
210 |
+
)
|
211 |
+
)
|
212 |
+
));
|
213 |
+
return $show_fields;
|
214 |
+
}
|
215 |
+
function woocommerce_save_customer_meta_fields_saphali( $user_id ) {
|
216 |
+
if ( ! current_user_can( 'manage_woocommerce' ) )
|
217 |
+
return $columns;
|
218 |
+
|
219 |
+
$show_fields = woocommerce_get_customer_meta_fields_saphali();
|
220 |
+
if(!empty($show_fields["billing"])) {
|
221 |
+
$save_fields["billing"]['title'] = __('Customer Billing Address', 'woocommerce');
|
222 |
+
$save_fields["billing"]['fields'] = $show_fields["billing"];
|
223 |
+
}
|
224 |
+
if(!empty($show_fields["shipping"])) {
|
225 |
+
$save_fields["shipping"]['title'] = __('Customer Shipping Address', 'woocommerce');
|
226 |
+
$save_fields["shipping"]['fields'] = $show_fields["shipping"];
|
227 |
+
}
|
228 |
+
/* if(!empty($show_fields["order"])) {
|
229 |
+
$save_fields["order"]['title'] = __('Дополнительные поля', 'woocommerce');
|
230 |
+
$save_fields["order"]['fields'] = $show_fields["order"];
|
231 |
+
} */
|
232 |
+
foreach( $save_fields as $fieldset )
|
233 |
+
foreach( $fieldset['fields'] as $key => $field )
|
234 |
+
if ( isset( $_POST[ $key ] ) )
|
235 |
+
update_user_meta( $user_id, $key, trim( esc_attr( $_POST[ $key ] ) ) );
|
236 |
}
|
237 |
+
function woocommerce_get_customer_meta_fields_saphali() {
|
238 |
+
$fieldss = get_option('woocommerce_saphali_filds_filters');
|
239 |
+
$show_fields = woocommerce_get_customer_meta_fields_saph_ed();
|
240 |
+
if(is_array($fieldss)) {
|
241 |
+
if(is_array($fieldss["billing"])) {
|
242 |
+
$billing['fields'] = array();
|
243 |
+
foreach($fieldss["billing"] as $key => $value) {
|
244 |
+
if(isset($show_fields["billing"]['fields'][$key])) continue;
|
245 |
+
$billing['fields'] = $billing['fields'] +
|
246 |
+
array( $key => array(
|
247 |
+
'label' => $value["label"],
|
248 |
+
'show' => $value["public"],
|
249 |
+
'description' => ''
|
250 |
+
)
|
251 |
+
);
|
252 |
+
}
|
253 |
+
}
|
254 |
+
if(is_array($fieldss["shipping"])) {
|
255 |
+
$shipping['fields'] = array();
|
256 |
+
foreach($fieldss["shipping"] as $key => $value) {
|
257 |
+
if(isset($show_fields["shipping"]['fields'][$key])) continue;
|
258 |
+
$shipping['fields'] = $shipping['fields'] +
|
259 |
+
array( $key => array(
|
260 |
+
'label' => $value["label"],
|
261 |
+
'show' => $value["public"],
|
262 |
+
'description' => ''
|
263 |
+
)
|
264 |
+
);
|
265 |
+
}
|
266 |
+
}
|
267 |
+
if(is_array($fieldss["order"])) {
|
268 |
+
$orders['fields'] = array();
|
269 |
+
foreach($fieldss["order"] as $key => $value) {
|
270 |
+
if(isset($show_fields["order"]['fields'][$key])) continue;
|
271 |
+
$orders['fields'] = $orders['fields'] +
|
272 |
+
array( $key => array(
|
273 |
+
'label' => $value["label"],
|
274 |
+
'show' => $value["public"],
|
275 |
+
'description' => ''
|
276 |
+
)
|
277 |
+
);
|
278 |
+
}
|
279 |
+
}
|
280 |
+
}
|
281 |
+
if(!is_array($show_fields['billing']['fields'])) { $show_fields['billing']['fields'] = array(); }
|
282 |
+
$show_fields['billing']['title'] = $show_fields['billing']['title'];
|
283 |
+
$show_fields['billing'] = /* $show_fields['billing']['fields'] + */ $billing['fields'];
|
284 |
+
|
285 |
+
if(!is_array($show_fields['shipping']['fields'])) { $show_fields['shipping']['fields'] = array(); }
|
286 |
+
$show_fields['shipping']['title'] = $show_fields['shipping']['title'];
|
287 |
+
$show_fields['shipping'] = /* $show_fields['shipping']['fields'] + */ $shipping['fields'];
|
288 |
+
|
289 |
+
if(!is_array($show_fields['order']['fields'])) { $show_fields['order']['fields'] = array(); $show_fields['order']['title'] = 'Дополнительные поля'; }
|
290 |
+
$show_fields['order'] = /* $show_fields['order']['fields'] + */ $orders['fields'];
|
291 |
+
|
292 |
+
return $show_fields;
|
293 |
+
}
|
294 |
+
function woocommerce_admin_order_data_after_billing_address_s($order) {
|
295 |
+
$billing_data = woocommerce_get_customer_meta_fields_saphali();
|
296 |
+
echo '<div class="address">';
|
297 |
+
if(is_array($billing_data["billing"])) {
|
298 |
+
foreach ( $billing_data["billing"] as $key => $field ) : if (isset($field['show']) && !$field['show']) continue;
|
299 |
+
|
300 |
+
$field_name = '_'.$key;
|
301 |
+
|
302 |
+
if ( $order->order_custom_fields[$field_name][0] ) echo '<p><strong>'.$field['label'].':</strong> '.$order->order_custom_fields[$field_name][0].'</p>';
|
303 |
+
|
304 |
+
endforeach;
|
305 |
+
}
|
306 |
+
echo '</div>';
|
307 |
+
}
|
308 |
+
function woocommerce_admin_order_data_after_shipping_address_s($order) {
|
309 |
+
$billing_data = woocommerce_get_customer_meta_fields_saphali();
|
310 |
+
echo '<div class="address">';
|
311 |
+
if(is_array($billing_data["shipping"])) {
|
312 |
+
foreach ( $billing_data["shipping"] as $key => $field ) : if (isset($field['show']) && !$field['show']) continue;
|
313 |
+
|
314 |
+
$field_name = '_'.$key;
|
315 |
+
|
316 |
+
if ( $order->order_custom_fields[$field_name][0] ) echo '<p><strong>'.$field['label'].':</strong> '.$order->order_custom_fields[$field_name][0].'</p>';
|
317 |
+
|
318 |
+
endforeach;
|
319 |
+
}
|
320 |
+
echo '</div>';
|
321 |
+
}
|
322 |
+
function woocommerce_admin_order_data_after_order_details_s($order) {
|
323 |
+
$billing_data = woocommerce_get_customer_meta_fields_saphali();
|
324 |
+
echo '<div class="address">';
|
325 |
+
if(is_array($billing_data["order"])) {
|
326 |
+
foreach ( $billing_data["order"] as $key => $field ) : if (isset($field['show']) && !$field['show']) continue;
|
327 |
+
|
328 |
+
$field_name = '_'.$key;
|
329 |
+
|
330 |
+
if ( $order->order_custom_fields[$field_name][0] )
|
331 |
+
|
332 |
+
echo '<div class="form-field form-field-wide"><label>'. $field['label']. ':</label>' . $order->order_custom_fields[$field_name][0].'</div>';
|
333 |
+
|
334 |
+
endforeach;
|
335 |
+
}
|
336 |
+
echo '</div>';
|
337 |
+
}
|
338 |
+
/*Конец*/
|
339 |
// Our hooked in function - $fields is passed via the filter!
|
340 |
function saphali_custom_override_checkout_fields( $fields ) {
|
341 |
|
402 |
if($_POST){
|
403 |
if($_POST["reset"] != 'All') {
|
404 |
// Управление новыми полями
|
405 |
+
|
406 |
if(is_array($_POST["billing"]["new_fild"])) {
|
407 |
foreach($_POST["billing"]["new_fild"] as $k_nf => $v_nf) {
|
408 |
if($k_nf == 'name')
|
419 |
}
|
420 |
}
|
421 |
unset($_POST["billing"]["new_fild"]);
|
422 |
+
unset($new_fild);
|
423 |
}
|
424 |
if(is_array($_POST["shipping"]["new_fild"])) {
|
425 |
foreach($_POST["shipping"]["new_fild"] as $k_nf => $v_nf) {
|
437 |
}
|
438 |
}
|
439 |
unset($_POST["shipping"]["new_fild"]);
|
440 |
+
unset($new_fild);
|
441 |
}
|
442 |
if(is_array($_POST["order"]["new_fild"])) {
|
443 |
foreach($_POST["order"]["new_fild"] as $k_nf => $v_nf) {
|
709 |
</tr>
|
710 |
</tfoot>
|
711 |
<tbody id="the-list" class="myTable">
|
712 |
+
<? $count = 0;
|
713 |
if(is_array($checkout_fields["shipping"])) $f->checkout_fields["shipping"] = $checkout_fields["shipping"];
|
714 |
foreach($f->checkout_fields["shipping"] as $key => $value) {
|
715 |
if( empty($value['public']) && !is_array($checkout_fields["shipping"]) ) $value['public'] = true;
|
834 |
});
|
835 |
jQuery('.button#billing').live('click',function() {
|
836 |
var obj = jQuery(this).parent().parent();
|
837 |
+
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><input checked type="checkbox" name="billing[new_fild][required][]" /></td><td><input checked type="checkbox" name="billing[new_fild][public][]" /></td><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>');
|
838 |
obj.removeClass('nodrop nodrag');
|
839 |
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>');
|
840 |
});
|
841 |
jQuery('.button#shipping').live('click',function() {
|
842 |
var obj = jQuery(this).parent().parent();
|
843 |
+
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><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>');
|
844 |
obj.removeClass('nodrop nodrag');
|
845 |
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>');
|
846 |
});
|
847 |
jQuery('.button#order').live('click',function() {
|
848 |
var obj = jQuery(this).parent().parent();
|
849 |
+
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>');
|
850 |
obj.removeClass('nodrop nodrag');
|
851 |
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>');
|
852 |
});
|