Order data/fixed keys. Closes #1981.
This commit is contained in:
parent
3af034755b
commit
7976ae8a66
|
@ -49,82 +49,95 @@ function woocommerce_order_data_meta_box($post) {
|
||||||
$order_title = $post->post_title;
|
$order_title = $post->post_title;
|
||||||
?>
|
?>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
#titlediv, #major-publishing-actions, #minor-publishing-actions, #visibility, #submitdiv { display:none }
|
#post-body-content, #titlediv, #major-publishing-actions, #minor-publishing-actions, #visibility, #submitdiv { display:none }
|
||||||
</style>
|
</style>
|
||||||
<div class="panel-wrap woocommerce">
|
<div class="panel-wrap woocommerce">
|
||||||
<input name="post_title" type="hidden" value="<?php echo esc_attr( $order_title ); ?>" />
|
<input name="post_title" type="hidden" value="<?php echo esc_attr( $order_title ); ?>" />
|
||||||
<input name="post_status" type="hidden" value="publish" />
|
<input name="post_status" type="hidden" value="publish" />
|
||||||
<div id="order_data" class="panel">
|
<div id="order_data" class="panel">
|
||||||
|
|
||||||
<div class="order_data_left">
|
<h2><?php _e( 'Order Details', 'woocommerce' ); ?></h2>
|
||||||
|
<p class="order_number"><?php
|
||||||
|
|
||||||
<h2><?php _e( 'Order Details', 'woocommerce' ); ?> — <?php echo esc_html( $order->get_order_number() ); ?></h2>
|
echo __( 'Order number', 'woocommerce' ) . ' ' . esc_html( $order->get_order_number() ) . '. ';
|
||||||
|
|
||||||
<p class="form-field"><label for="order_status"><?php _e( 'Order status:', 'woocommerce' ) ?></label>
|
$ip_address = get_post_meta( $post->ID, '_customer_ip_address', true );
|
||||||
<select id="order_status" name="order_status" class="chosen_select">
|
|
||||||
<?php
|
|
||||||
$statuses = (array) get_terms( 'shop_order_status', array( 'hide_empty' => 0, 'orderby' => 'id' ) );
|
|
||||||
foreach ( $statuses as $status ) {
|
|
||||||
echo '<option value="' . esc_attr( $status->slug ) . '" ' . selected( $status->slug, $order_status, false ) . '>' . esc_html__( $status->name, 'woocommerce' ) . '</option>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select></p>
|
|
||||||
|
|
||||||
<p class="form-field last"><label for="order_date"><?php _e( 'Order Date:', 'woocommerce' ) ?></label>
|
if ( $ip_address )
|
||||||
<input type="text" class="date-picker-field" name="order_date" id="order_date" maxlength="10" value="<?php echo date_i18n( 'Y-m-d', strtotime( $post->post_date ) ); ?>" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" /> @ <input type="text" class="hour" placeholder="<?php _e( 'h', 'woocommerce' ) ?>" name="order_date_hour" id="order_date_hour" maxlength="2" size="2" value="<?php echo date_i18n( 'H', strtotime( $post->post_date ) ); ?>" pattern="\-?\d+(\.\d{0,})?" />:<input type="text" class="minute" placeholder="<?php _e( 'm', 'woocommerce' ) ?>" name="order_date_minute" id="order_date_minute" maxlength="2" size="2" value="<?php echo date_i18n( 'i', strtotime( $post->post_date ) ); ?>" pattern="\-?\d+(\.\d{0,})?" />
|
echo __( 'Customer IP:', 'woocommerce' ) . ' ' . esc_html( $ip_address );
|
||||||
</p>
|
|
||||||
|
|
||||||
<p class="form-field form-field-wide">
|
?></p>
|
||||||
<label for="customer_user"><?php _e( 'Customer:', 'woocommerce' ) ?></label>
|
|
||||||
<select id="customer_user" name="customer_user" class="ajax_chosen_select_customer">
|
<div class="order_data_column_container">
|
||||||
<option value=""><?php _e( 'Guest', 'woocommerce' ) ?></option>
|
<div class="order_data_column">
|
||||||
|
|
||||||
|
<h4><?php _e( 'General Details', 'woocommerce' ); ?></h4>
|
||||||
|
|
||||||
|
<p class="form-field"><label for="order_status"><?php _e( 'Order status:', 'woocommerce' ) ?></label>
|
||||||
|
<select id="order_status" name="order_status" class="chosen_select">
|
||||||
<?php
|
<?php
|
||||||
if ( $customer_user ) {
|
$statuses = (array) get_terms( 'shop_order_status', array( 'hide_empty' => 0, 'orderby' => 'id' ) );
|
||||||
$user = get_user_by( 'id', $customer_user );
|
foreach ( $statuses as $status ) {
|
||||||
echo '<option value="' . esc_attr( $user->ID ) . '" ' . selected( 1, 1, false ) . '>' . esc_html( $user->display_name ) . ' (#' . absint( $user->ID ) . ' – ' . esc_html( $user->user_email ) . ')</option>';
|
echo '<option value="' . esc_attr( $status->slug ) . '" ' . selected( $status->slug, $order_status, false ) . '>' . esc_html__( $status->name, 'woocommerce' ) . '</option>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select>
|
</select></p>
|
||||||
<?php
|
|
||||||
|
|
||||||
// Ajax Chosen Customer Selectors JS
|
<p class="form-field last"><label for="order_date"><?php _e( 'Order Date:', 'woocommerce' ) ?></label>
|
||||||
$woocommerce->add_inline_js( "
|
<input type="text" class="date-picker-field" name="order_date" id="order_date" maxlength="10" value="<?php echo date_i18n( 'Y-m-d', strtotime( $post->post_date ) ); ?>" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" /> @ <input type="text" class="hour" placeholder="<?php _e( 'h', 'woocommerce' ) ?>" name="order_date_hour" id="order_date_hour" maxlength="2" size="2" value="<?php echo date_i18n( 'H', strtotime( $post->post_date ) ); ?>" pattern="\-?\d+(\.\d{0,})?" />:<input type="text" class="minute" placeholder="<?php _e( 'm', 'woocommerce' ) ?>" name="order_date_minute" id="order_date_minute" maxlength="2" size="2" value="<?php echo date_i18n( 'i', strtotime( $post->post_date ) ); ?>" pattern="\-?\d+(\.\d{0,})?" />
|
||||||
jQuery('select.ajax_chosen_select_customer').ajaxChosen({
|
</p>
|
||||||
method: 'GET',
|
|
||||||
url: '" . admin_url('admin-ajax.php') . "',
|
|
||||||
dataType: 'json',
|
|
||||||
afterTypeDelay: 100,
|
|
||||||
minTermLength: 1,
|
|
||||||
data: {
|
|
||||||
action: 'woocommerce_json_search_customers',
|
|
||||||
security: '" . wp_create_nonce("search-customers") . "'
|
|
||||||
}
|
|
||||||
}, function (data) {
|
|
||||||
|
|
||||||
var terms = {};
|
<p class="form-field form-field-wide">
|
||||||
|
<label for="customer_user"><?php _e( 'Customer:', 'woocommerce' ) ?></label>
|
||||||
|
<select id="customer_user" name="customer_user" class="ajax_chosen_select_customer">
|
||||||
|
<option value=""><?php _e( 'Guest', 'woocommerce' ) ?></option>
|
||||||
|
<?php
|
||||||
|
if ( $customer_user ) {
|
||||||
|
$user = get_user_by( 'id', $customer_user );
|
||||||
|
echo '<option value="' . esc_attr( $user->ID ) . '" ' . selected( 1, 1, false ) . '>' . esc_html( $user->display_name ) . ' (#' . absint( $user->ID ) . ' – ' . esc_html( $user->user_email ) . ')</option>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<?php
|
||||||
|
|
||||||
$.each(data, function (i, val) {
|
// Ajax Chosen Customer Selectors JS
|
||||||
terms[i] = val;
|
$woocommerce->add_inline_js( "
|
||||||
});
|
jQuery('select.ajax_chosen_select_customer').ajaxChosen({
|
||||||
|
method: 'GET',
|
||||||
|
url: '" . admin_url('admin-ajax.php') . "',
|
||||||
|
dataType: 'json',
|
||||||
|
afterTypeDelay: 100,
|
||||||
|
minTermLength: 1,
|
||||||
|
data: {
|
||||||
|
action: 'woocommerce_json_search_customers',
|
||||||
|
security: '" . wp_create_nonce("search-customers") . "'
|
||||||
|
}
|
||||||
|
}, function (data) {
|
||||||
|
|
||||||
return terms;
|
var terms = {};
|
||||||
});
|
|
||||||
" );
|
|
||||||
|
|
||||||
?>
|
$.each(data, function (i, val) {
|
||||||
</p>
|
terms[i] = val;
|
||||||
|
});
|
||||||
|
|
||||||
<?php if( get_option( 'woocommerce_enable_order_comments' ) != 'no' ) : ?>
|
return terms;
|
||||||
<p class="form-field form-field-wide"><label for="excerpt"><?php _e( 'Customer Note:', 'woocommerce' ) ?></label>
|
});
|
||||||
<textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt" placeholder="<?php _e( 'Customer\'s notes about the order', 'woocommerce' ); ?>"><?php echo wp_kses_post( $post->post_excerpt ); ?></textarea></p>
|
" );
|
||||||
<?php endif; ?>
|
?>
|
||||||
|
</p>
|
||||||
|
|
||||||
<?php do_action( 'woocommerce_admin_order_data_after_order_details', $order ); ?>
|
<?php if ( get_option( 'woocommerce_enable_order_comments' ) != 'no' ) : ?>
|
||||||
|
|
||||||
</div>
|
<p class="form-field form-field-wide"><label for="excerpt"><?php _e( 'Customer Note:', 'woocommerce' ) ?></label>
|
||||||
<div class="order_data_right">
|
<textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt" placeholder="<?php _e( 'Customer\'s notes about the order', 'woocommerce' ); ?>"><?php echo wp_kses_post( $post->post_excerpt ); ?></textarea></p>
|
||||||
<div class="order_data">
|
|
||||||
<h2><?php _e( 'Billing Details', 'woocommerce' ); ?> <a class="edit_address" href="#">(<?php _e( 'Edit', 'woocommerce' ) ;?>)</a></h2>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php do_action( 'woocommerce_admin_order_data_after_order_details', $order ); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="order_data_column">
|
||||||
|
<h4><?php _e( 'Billing Details', 'woocommerce' ); ?> <a class="edit_address" href="#">(<?php _e( 'Edit', 'woocommerce' ) ;?>)</a></h4>
|
||||||
<?php
|
<?php
|
||||||
$billing_data = apply_filters('woocommerce_admin_billing_fields', array(
|
$billing_data = apply_filters('woocommerce_admin_billing_fields', array(
|
||||||
'first_name' => array(
|
'first_name' => array(
|
||||||
|
@ -182,7 +195,7 @@ function woocommerce_order_data_meta_box($post) {
|
||||||
echo '<p class="none_set"><strong>' . __( 'Address', 'woocommerce' ) . ':</strong> ' . __( 'No billing address set.', 'woocommerce' ) . '</p>';
|
echo '<p class="none_set"><strong>' . __( 'Address', 'woocommerce' ) . ':</strong> ' . __( 'No billing address set.', 'woocommerce' ) . '</p>';
|
||||||
|
|
||||||
foreach ( $billing_data as $key => $field ) {
|
foreach ( $billing_data as $key => $field ) {
|
||||||
if ( empty( $field['show'] ) )
|
if ( isset( $field['show'] ) && $field['show'] === false )
|
||||||
continue;
|
continue;
|
||||||
$field_name = 'billing_' . $key;
|
$field_name = 'billing_' . $key;
|
||||||
if ( $order->$field_name )
|
if ( $order->$field_name )
|
||||||
|
@ -212,9 +225,9 @@ function woocommerce_order_data_meta_box($post) {
|
||||||
do_action( 'woocommerce_admin_order_data_after_billing_address', $order );
|
do_action( 'woocommerce_admin_order_data_after_billing_address', $order );
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<div class="order_data order_data_alt">
|
<div class="order_data_column">
|
||||||
|
|
||||||
<h2><?php _e( 'Shipping Details', 'woocommerce' ); ?> <a class="edit_address" href="#">(<?php _e( 'Edit', 'woocommerce' ) ;?>)</a></h2>
|
<h4><?php _e( 'Shipping Details', 'woocommerce' ); ?> <a class="edit_address" href="#">(<?php _e( 'Edit', 'woocommerce' ) ;?>)</a></h4>
|
||||||
<?php
|
<?php
|
||||||
$shipping_data = apply_filters('woocommerce_admin_shipping_fields', array(
|
$shipping_data = apply_filters('woocommerce_admin_shipping_fields', array(
|
||||||
'first_name' => array(
|
'first_name' => array(
|
||||||
|
@ -266,7 +279,7 @@ function woocommerce_order_data_meta_box($post) {
|
||||||
echo '<p class="none_set"><strong>' . __( 'Address', 'woocommerce' ) . ':</strong> ' . __( 'No shipping address set.', 'woocommerce' ) . '</p>';
|
echo '<p class="none_set"><strong>' . __( 'Address', 'woocommerce' ) . ':</strong> ' . __( 'No shipping address set.', 'woocommerce' ) . '</p>';
|
||||||
|
|
||||||
if ( $shipping_data ) foreach ( $shipping_data as $key => $field ) {
|
if ( $shipping_data ) foreach ( $shipping_data as $key => $field ) {
|
||||||
if ( empty( $field['show'] ) )
|
if ( isset( $field['show'] ) && $field['show'] === false )
|
||||||
continue;
|
continue;
|
||||||
$field_name = 'shipping_' . $key;
|
$field_name = 'shipping_' . $key;
|
||||||
if ( $order->$field_name )
|
if ( $order->$field_name )
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -446,14 +446,48 @@ ul.wc_coupon_list_block {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
#woocommerce-order-data {
|
||||||
|
h3.hndle, .handlediv {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.inside {
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
#order_data {
|
#order_data {
|
||||||
padding: 0 10px 9px;
|
padding: 23px 24px 12px 24px;
|
||||||
.order_data_left {
|
h2 {
|
||||||
width: 48%;
|
margin: 0;
|
||||||
|
font-family: "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif;
|
||||||
|
font-size: 21px;
|
||||||
|
font-weight: normal;
|
||||||
|
line-height: 1.2;
|
||||||
|
text-shadow: 1px 1px 1px white;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
h4 {
|
||||||
|
color: #333;
|
||||||
|
margin: 1.33em 0 0;
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
color: #777;
|
||||||
|
}
|
||||||
|
p.order_number {
|
||||||
|
margin: 0;
|
||||||
|
font-family: "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif;
|
||||||
|
font-weight: normal;
|
||||||
|
line-height: 1.6em;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
.order_data_column_container {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
.order_data_column {
|
||||||
|
width: 32%;
|
||||||
|
padding: 0 2% 0 0;
|
||||||
float: left;
|
float: left;
|
||||||
h2 {
|
&:last-child {
|
||||||
margin-top: 11px;
|
padding-right: 0;
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
}
|
||||||
p {
|
p {
|
||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
|
@ -487,6 +521,11 @@ ul.wc_coupon_list_block {
|
||||||
.hour, .minute {
|
.hour, .minute {
|
||||||
width: 2.5em;
|
width: 2.5em;
|
||||||
}
|
}
|
||||||
|
small {
|
||||||
|
display: block;
|
||||||
|
margin: 5px 0 0 0;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.form-field.last {
|
.form-field.last {
|
||||||
float: right;
|
float: right;
|
||||||
|
@ -501,48 +540,20 @@ ul.wc_coupon_list_block {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.order_data_right {
|
|
||||||
width: 48%;
|
|
||||||
float: right;
|
|
||||||
.order_data {
|
|
||||||
overflow: hidden;
|
|
||||||
zoom: 1;
|
|
||||||
width: 49%;
|
|
||||||
float:left;
|
|
||||||
}
|
|
||||||
.order_data_alt {
|
|
||||||
float:right;
|
|
||||||
}
|
|
||||||
h2 {
|
|
||||||
margin-top: 11px;
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
padding: 0 !important;
|
|
||||||
}
|
|
||||||
p.none_set {
|
p.none_set {
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
.form-field {
|
._billing_first_name_field, ._billing_address_1_field, ._billing_city_field, ._billing_country_field, ._billing_email_field,
|
||||||
|
._shipping_first_name_field, ._shipping_address_1_field, ._shipping_city_field, ._shipping_country_field {
|
||||||
float: left;
|
float: left;
|
||||||
width: 50%;
|
}
|
||||||
padding: 0;
|
._billing_last_name_field, ._billing_address_2_field, ._billing_postcode_field, ._billing_state_field, ._billing_phone_field,
|
||||||
margin: 9px 0 0 0;
|
._shipping_last_name_field, ._shipping_address_2_field, ._shipping_postcode_field, ._shipping_state_field {
|
||||||
label {
|
float: right;
|
||||||
display: block;
|
|
||||||
padding: 0 0 3px;
|
|
||||||
}
|
|
||||||
input, select {
|
|
||||||
width: 95%;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
._billing_company_field, ._shipping_company_field {
|
._billing_company_field, ._shipping_company_field {
|
||||||
clear: both;
|
clear: both;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
input {
|
|
||||||
width: 97.5%;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
._billing_email_field {
|
._billing_email_field {
|
||||||
clear: left
|
clear: left
|
||||||
|
@ -551,6 +562,7 @@ ul.wc_coupon_list_block {
|
||||||
display: none;
|
display: none;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
zoom: 1;
|
zoom: 1;
|
||||||
|
padding-right: 1px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,10 +171,9 @@ jQuery( function($){
|
||||||
});
|
});
|
||||||
|
|
||||||
$('a.edit_address').click(function(event){
|
$('a.edit_address').click(function(event){
|
||||||
|
|
||||||
$(this).hide();
|
$(this).hide();
|
||||||
$(this).closest('.order_data').find('div.address').hide();
|
$(this).closest('.order_data_column').find('div.address').hide();
|
||||||
$(this).closest('.order_data').find('div.edit_address').show();
|
$(this).closest('.order_data_column').find('div.edit_address').show();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue