Update order dates. Closes #845.
This commit is contained in:
parent
f99353a861
commit
2927a52743
|
@ -66,6 +66,10 @@ function woocommerce_order_data_meta_box($post) {
|
|||
?>
|
||||
</select></p>
|
||||
|
||||
<p class="form-field last"><label for="order_date"><?php _e('Order Date:', 'woocommerce') ?></label>
|
||||
<input type="text" class="date-picker-field" name="order_date" id="order_date" maxlength="10" value="<?php echo date('Y-m-d', strtotime( $post->post_date ) ); ?>" /> @ <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('H', strtotime( $post->post_date ) ); ?>" />:<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('i', strtotime( $post->post_date ) ); ?>" />
|
||||
</p>
|
||||
|
||||
<p class="form-field form-field-wide"><label for="customer_user"><?php _e('Customer:', 'woocommerce') ?></label>
|
||||
<select id="customer_user" name="customer_user" class="chosen_select">
|
||||
<option value=""><?php _e('Guest', 'woocommerce') ?></option>
|
||||
|
@ -140,7 +144,7 @@ function woocommerce_order_data_meta_box($post) {
|
|||
|
||||
foreach ( $billing_data as $key => $field ) : if (isset($field['show']) && !$field['show']) continue;
|
||||
$field_name = 'billing_'.$key;
|
||||
echo '<p><strong>'.$field['label'].':</strong> '.$order->$field_name.'</p>';
|
||||
if ( $order->$field_name ) echo '<p><strong>'.$field['label'].':</strong> '.$order->$field_name.'</p>';
|
||||
endforeach;
|
||||
|
||||
echo '</div>';
|
||||
|
@ -215,7 +219,7 @@ function woocommerce_order_data_meta_box($post) {
|
|||
|
||||
foreach ( $shipping_data as $key => $field ) : if (isset($field['show']) && !$field['show']) continue;
|
||||
$field_name = 'shipping_'.$key;
|
||||
echo '<p><strong>'.$field['label'].':</strong> '.$order->$field_name.'</p>';
|
||||
if ( $order->$field_name ) echo '<p><strong>'.$field['label'].':</strong> '.$order->$field_name.'</p>';
|
||||
endforeach;
|
||||
|
||||
echo '</div>';
|
||||
|
@ -666,6 +670,15 @@ function woocommerce_process_shop_order_meta( $post_id, $post ) {
|
|||
update_post_meta( $post_id, '_payment_method_title', stripslashes( $_POST['_payment_method'] ));
|
||||
}
|
||||
|
||||
// Update date
|
||||
if ( empty( $_POST['order_date'] ) ) {
|
||||
$date = current_time('timestamp');
|
||||
} else {
|
||||
$date = strtotime( $_POST['order_date'] . ' ' . (int) $_POST['order_date_hour'] . ':' . (int) $_POST['order_date_minute'] . ':00' );
|
||||
}
|
||||
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_date = %s WHERE ID = %s", date('Y-m-d H:i:s', $date), $post_id ) );
|
||||
|
||||
// Tax rows
|
||||
$order_taxes = array();
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ function woocommerce_admin_scripts() {
|
|||
wp_enqueue_script('farbtastic');
|
||||
wp_enqueue_script( 'ajax-chosen' );
|
||||
wp_enqueue_script( 'chosen' );
|
||||
wp_enqueue_script('jquery-ui-sortable');
|
||||
wp_enqueue_script( 'jquery-ui-sortable' );
|
||||
|
||||
endif;
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -265,7 +265,7 @@ table.wc_status_table {
|
|||
}
|
||||
.form-field {
|
||||
float: left;
|
||||
width: 50%;
|
||||
width: 48%;
|
||||
padding: 0;
|
||||
margin: 9px 0 0 0;
|
||||
label {
|
||||
|
@ -283,10 +283,28 @@ table.wc_status_table {
|
|||
display: none;
|
||||
}
|
||||
}
|
||||
.chzn-container {
|
||||
width: 100% !important;
|
||||
}
|
||||
.date-picker-field {
|
||||
width: 9em;
|
||||
}
|
||||
.hour, .minute {
|
||||
width: 2.5em;
|
||||
}
|
||||
}
|
||||
.form-field.last {
|
||||
float: right;
|
||||
}
|
||||
.form-field-wide {
|
||||
width: 100%;
|
||||
clear: both;
|
||||
input, textarea {
|
||||
width: 100%;
|
||||
}
|
||||
select {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
.order_data_right {
|
||||
|
@ -1937,6 +1955,9 @@ table.bar_chart {
|
|||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
.form-field-wide .chzn-container {
|
||||
width: 100% !important;
|
||||
}
|
||||
.chzn-container .chzn-drop {
|
||||
background: #fff;
|
||||
border: 1px solid #aaa;
|
||||
|
|
|
@ -555,6 +555,12 @@ jQuery( function($){
|
|||
buttonImageOnly: true
|
||||
});
|
||||
|
||||
$( ".date-picker-field" ).datepicker({
|
||||
dateFormat: "yy-mm-dd",
|
||||
numberOfMonths: 1,
|
||||
showButtonPanel: true,
|
||||
});
|
||||
|
||||
// META BOXES
|
||||
|
||||
jQuery('.expand_all').click(function(){
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -213,7 +213,9 @@ class WC_Customer {
|
|||
|
||||
$product_post = get_post( $result->product_id );
|
||||
|
||||
if ($product_post->post_type=='product_variation') :
|
||||
if ( ! $product_post ) continue;
|
||||
|
||||
if ( $product_post->post_type == 'product_variation' ) :
|
||||
$_product = new WC_Product_Variation( $result->product_id );
|
||||
else :
|
||||
$_product = new WC_Product( $result->product_id );
|
||||
|
|
|
@ -150,6 +150,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
|||
* Feature - Local delivery postcode limiting
|
||||
* Feature - Visual editor for except (thanks Andrew Benbow - http://www.chromeorange.co.uk/)
|
||||
* Feature - Allow shortcodes in excerpts
|
||||
* Feature - Update/set order dates
|
||||
* Tweak - get order number function complete with filter
|
||||
* Tweak - View cart link in 'you already have this in your cart' message
|
||||
* Tweak - When viewing a product, give shop menu item a class
|
||||
|
|
Loading…
Reference in New Issue