fixed wc_get_order_status_name() appear as wc 2.1 order status
This commit is contained in:
parent
aee2b62c85
commit
066eb3c5b0
|
@ -2072,7 +2072,7 @@ abstract class WC_Abstract_Order {
|
|||
wp_update_post( array( 'ID' => $this->id, 'post_status' => 'wc-' . $new_status ) );
|
||||
$this->post_status = 'wc-' . $new_status;
|
||||
|
||||
$this->add_order_note( trim( $note . ' ' . sprintf( __( 'Order status changed from %s to %s.', 'woocommerce' ), strtolower( wc_get_order_status_label( $old_status ) ), strtolower( wc_get_order_status_label( $new_status ) ) ) ) );
|
||||
$this->add_order_note( trim( $note . ' ' . sprintf( __( 'Order status changed from %s to %s.', 'woocommerce' ), wc_get_order_status_name( $old_status ), wc_get_order_status_name( $new_status ) ) ) );
|
||||
|
||||
// Status was changed
|
||||
do_action( 'woocommerce_order_status_' . $new_status, $this->id );
|
||||
|
|
|
@ -445,7 +445,7 @@ class WC_Admin_Post_Types {
|
|||
switch ( $column ) {
|
||||
case 'order_status' :
|
||||
|
||||
printf( '<mark class="%s tips" data-tip="%s">%s</mark>', sanitize_title( $the_order->get_status() ), wc_get_order_status_label( $the_order->get_status() ), wc_get_order_status_name( $the_order->get_status() ) );
|
||||
printf( '<mark class="%s tips" data-tip="%s">%s</mark>', sanitize_title( $the_order->get_status() ), wc_get_order_status_name( $the_order->get_status() ), wc_get_order_status_name( $the_order->get_status() ) );
|
||||
|
||||
break;
|
||||
case 'order_date' :
|
||||
|
|
|
@ -31,25 +31,10 @@ function wc_get_order_statuses() {
|
|||
return apply_filters( 'wc_order_statuses', $order_statuses );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the order status label.
|
||||
*
|
||||
* @since 2.2
|
||||
* @param string $status
|
||||
* @return string
|
||||
*/
|
||||
function wc_get_order_status_label( $status ) {
|
||||
$order_statuses = wc_get_order_statuses();
|
||||
|
||||
$status = str_replace( 'wc-', '', $status );
|
||||
$status = isset( $order_statuses[ 'wc-' . $status ] ) ? $order_statuses[ 'wc-' . $status ] : $status;
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main function for returning orders, uses the WC_Order_Factory class.
|
||||
*
|
||||
* @since 2.2
|
||||
* @param mixed $the_order Post object or post ID of the order.
|
||||
* @return WC_Order
|
||||
*/
|
||||
|
@ -58,13 +43,18 @@ function wc_get_order( $the_order = false ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the nice name for an orer status
|
||||
* Get the nice name for an order status
|
||||
*
|
||||
* @since 2.2
|
||||
* @param string $status
|
||||
* @return string
|
||||
*/
|
||||
function wc_get_order_status_name( $status ) {
|
||||
$statuses = wc_get_order_statuses();
|
||||
return isset( $statuses[ $status ] ) ? $statuses[ $status ] : $status;
|
||||
$status = 'wc-' === substr( $status, 0, 3 ) ? substr( $status, 3 ) : $status;
|
||||
$status = isset( $statuses[ 'wc-' . $status ] ) ? $statuses[ 'wc-' . $status ] : $status;
|
||||
|
||||
return strtolower( $status );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,7 +53,7 @@ if ( $customer_orders ) : ?>
|
|||
<time datetime="<?php echo date( 'Y-m-d', strtotime( $order->order_date ) ); ?>" title="<?php echo esc_attr( strtotime( $order->order_date ) ); ?>"><?php echo date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) ); ?></time>
|
||||
</td>
|
||||
<td class="order-status" style="text-align:left; white-space:nowrap;">
|
||||
<?php echo wc_get_order_status_label( $order->get_status() ); ?>
|
||||
<?php echo wc_get_order_status_name( $order->get_status() ); ?>
|
||||
</td>
|
||||
<td class="order-total">
|
||||
<?php echo sprintf( _n( '%s for %s item', '%s for %s items', $item_count, 'woocommerce' ), $order->get_formatted_order_total(), $item_count ); ?>
|
||||
|
|
|
@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
|
||||
<?php wc_print_notices(); ?>
|
||||
|
||||
<p class="order-info"><?php printf( __( 'Order <mark class="order-number">%s</mark> was placed on <mark class="order-date">%s</mark> and is currently <mark class="order-status">%s</mark>.', 'woocommerce' ), $order->get_order_number(), date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) ), wc_get_order_status_label( $order->get_status() ) ); ?></p>
|
||||
<p class="order-info"><?php printf( __( 'Order <mark class="order-number">%s</mark> was placed on <mark class="order-date">%s</mark> and is currently <mark class="order-status">%s</mark>.', 'woocommerce' ), $order->get_order_number(), date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) ), wc_get_order_status_name( $order->get_status() ) ); ?></p>
|
||||
|
||||
<?php if ( $notes = $order->get_customer_order_notes() ) :
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue