use names, not slugs

This commit is contained in:
Mike Jolley 2012-03-01 12:25:23 +00:00
parent 0ade8bbab0
commit 20fe9850ff
1 changed files with 3 additions and 2 deletions

View File

@ -668,7 +668,8 @@ class WC_Order {
function update_status( $new_status_slug, $note = '' ) { function update_status( $new_status_slug, $note = '' ) {
if ($note) $note .= ' '; if ($note) $note .= ' ';
$old_status = get_term_by( 'slug', sanitize_title( $this->status ), 'shop_order_status');
$new_status = get_term_by( 'slug', sanitize_title( $new_status_slug ), 'shop_order_status'); $new_status = get_term_by( 'slug', sanitize_title( $new_status_slug ), 'shop_order_status');
if ($new_status) { if ($new_status) {
@ -678,7 +679,7 @@ class WC_Order {
// Status was changed // Status was changed
do_action( 'woocommerce_order_status_' . $new_status->slug , $this->id ); do_action( 'woocommerce_order_status_' . $new_status->slug , $this->id );
do_action( 'woocommerce_order_status_' . $this->status . '_to_' . $new_status->slug, $this->id ); do_action( 'woocommerce_order_status_' . $this->status . '_to_' . $new_status->slug, $this->id );
$this->add_order_note( $note . sprintf( __('Order status changed from %s to %s.', 'woocommerce'), $this->status, $new_status->slug ) ); $this->add_order_note( $note . sprintf( __('Order status changed from %s to %s.', 'woocommerce'), $old_status->name, $new_status->name ) );
// Date // Date
if ($new_status->slug=='completed') update_post_meta( $this->id, '_completed_date', current_time('mysql') ); if ($new_status->slug=='completed') update_post_meta( $this->id, '_completed_date', current_time('mysql') );