get order number function complete with filter. Tweak the display of order ID's if you use custom numbering.
Had to tweak some localisation strings to dump the '#' symbols.
This commit is contained in:
parent
b6557a4930
commit
659d3ee3b4
|
@ -221,7 +221,7 @@ function woocommerce_dashboard_recent_orders() {
|
|||
|
||||
echo '
|
||||
<li>
|
||||
<span class="order-status '.sanitize_title($this_order->status).'">'.ucwords(__($this_order->status, 'woocommerce')).'</span> <a href="'.admin_url('post.php?post='.$order->ID).'&action=edit">'.get_the_time(__('l jS \of F Y h:i:s A', 'woocommerce'), $order->ID).'</a><br />
|
||||
<span class="order-status '.sanitize_title($this_order->status).'">'.ucwords(__($this_order->status, 'woocommerce')).'</span> <a href="'.admin_url('post.php?post='.$order->ID).'&action=edit">' . get_the_time( __('l jS \of F Y h:i:s A', 'woocommerce' ), $order->ID ) . '</a><br />
|
||||
<small>'.sizeof($this_order->get_items()).' '._n('item', 'items', sizeof($this_order->get_items()), 'woocommerce').' <span class="order-cost">'.__('Total:', 'woocommerce') . ' ' . woocommerce_price($this_order->order_total).'</span></small>
|
||||
</li>';
|
||||
|
||||
|
|
|
@ -230,7 +230,7 @@ class WC_Email {
|
|||
|
||||
$order = $pay_for_order;
|
||||
|
||||
$email_heading = sprintf(__('Invoice for Order #%s', 'woocommerce'), $order->id);
|
||||
$email_heading = sprintf( __('Invoice for Order %s', 'woocommerce'), $order->get_order_number() );
|
||||
|
||||
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
|
||||
|
||||
|
|
|
@ -144,6 +144,19 @@ class WC_Order {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get_order_number function.
|
||||
*
|
||||
* Gets the order number for display (by default, order ID)
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
function get_order_number() {
|
||||
return apply_filters( 'woocommerce_order_number', '#' . $this->id, $this );
|
||||
}
|
||||
|
||||
function get_formatted_billing_address() {
|
||||
if (!$this->formatted_billing_address) :
|
||||
global $woocommerce;
|
||||
|
|
|
@ -251,7 +251,7 @@ class WC_Paypal extends WC_Payment_Gateway {
|
|||
if ($item['qty']) $item_names[] = $item['name'] . ' x ' . $item['qty'];
|
||||
endforeach; endif;
|
||||
|
||||
$paypal_args['item_name_1'] = sprintf(__('Order #%s' , 'woocommerce'), $order->id) . " - " . implode(', ', $item_names);
|
||||
$paypal_args['item_name_1'] = sprintf( __('Order %s' , 'woocommerce'), $order->get_order_number() ) . " - " . implode(', ', $item_names);
|
||||
$paypal_args['quantity_1'] = 1;
|
||||
$paypal_args['amount_1'] = number_format($order->get_order_total() - $order->get_shipping() + $order->get_order_discount(), 2, '.', '');
|
||||
|
||||
|
@ -549,11 +549,11 @@ class WC_Paypal extends WC_Payment_Gateway {
|
|||
|
||||
$message = woocommerce_mail_template(
|
||||
__('Order refunded/reversed', 'woocommerce'),
|
||||
sprintf(__('Order #%s has been marked as refunded - PayPal reason code: %s', 'woocommerce'), $order->id, $posted['reason_code'] )
|
||||
sprintf(__('Order %s has been marked as refunded - PayPal reason code: %s', 'woocommerce'), $order->get_order_number(), $posted['reason_code'] )
|
||||
);
|
||||
|
||||
// Send the mail
|
||||
woocommerce_mail( get_option('woocommerce_new_order_email_recipient'), sprintf(__('Payment for order #%s refunded/reversed', 'woocommerce'), $order->id), $message );
|
||||
woocommerce_mail( get_option('woocommerce_new_order_email_recipient'), sprintf( __('Payment for order %s refunded/reversed', 'woocommerce'), $order->get_order_number() ), $message );
|
||||
|
||||
}
|
||||
|
||||
|
@ -562,15 +562,15 @@ class WC_Paypal extends WC_Payment_Gateway {
|
|||
case "chargeback" :
|
||||
|
||||
// Mark order as refunded
|
||||
$order->update_status('refunded', sprintf(__('Payment %s via IPN.', 'woocommerce'), strtolower($posted['payment_status']) ) );
|
||||
$order->update_status('refunded', sprintf( __('Payment %s via IPN.', 'woocommerce'), strtolower( $posted['payment_status'] ) ) );
|
||||
|
||||
$message = woocommerce_mail_template(
|
||||
__('Order refunded/reversed', 'woocommerce'),
|
||||
sprintf(__('Order #%s has been marked as refunded - PayPal reason code: %s', 'woocommerce'), $order->id, $posted['reason_code'] )
|
||||
sprintf(__('Order %s has been marked as refunded - PayPal reason code: %s', 'woocommerce'), $order->get_order_number(), $posted['reason_code'] )
|
||||
);
|
||||
|
||||
// Send the mail
|
||||
woocommerce_mail( get_option('woocommerce_new_order_email_recipient'), sprintf(__('Payment for order #%s refunded/reversed', 'woocommerce'), $order->id), $message );
|
||||
woocommerce_mail( get_option('woocommerce_new_order_email_recipient'), sprintf( __('Payment for order %s refunded/reversed', 'woocommerce'), $order->get_order_number() ), $message );
|
||||
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -148,6 +148,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
|||
* Feature - Control default catalog sort order from Catalog Settings
|
||||
* Feature - Option to use post instead of get to submit paypal standard - form also has target="_top" to work when in iframes
|
||||
* Feature - Local delivery postcode limiting
|
||||
* 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
|
||||
* Tweak - Layered nav dropdown code to filter displayed terms based on view
|
||||
|
|
|
@ -260,7 +260,7 @@ function woocommerce_view_order() {
|
|||
$status = get_term_by('slug', $order->status, 'shop_order_status');
|
||||
|
||||
echo '<p>'
|
||||
. sprintf( __('Order <mark>#%s</mark> made on <mark>%s</mark>', 'woocommerce'), $order->id, date_i18n(get_option('date_format'), strtotime($order->order_date)) )
|
||||
. sprintf( __('Order <mark>%s</mark> made on <mark>%s</mark>', 'woocommerce'), $order->get_order_number(), date_i18n(get_option('date_format'), strtotime($order->order_date)) )
|
||||
. sprintf( __('. Order status: <mark>%s</mark>', 'woocommerce'), __($status->name, 'woocommerce') )
|
||||
. '.</p>';
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ function woocommerce_pay() {
|
|||
<ul class="order_details">
|
||||
<li class="order">
|
||||
<?php _e('Order:', 'woocommerce'); ?>
|
||||
<strong># <?php echo $order->id; ?></strong>
|
||||
<strong><?php echo $order->get_order_number(); ?></strong>
|
||||
</li>
|
||||
<li class="date">
|
||||
<?php _e('Date:', 'woocommerce'); ?>
|
||||
|
|
|
@ -34,7 +34,7 @@ global $woocommerce;
|
|||
<ul class="order_details">
|
||||
<li class="order">
|
||||
<?php _e('Order:', 'woocommerce'); ?>
|
||||
<strong># <?php echo $order->id; ?></strong>
|
||||
<strong><?php echo $order->get_order_number(); ?></strong>
|
||||
</li>
|
||||
<li class="date">
|
||||
<?php _e('Date:', 'woocommerce'); ?>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<?php do_action('woocommerce_email_before_order_table', $order, true); ?>
|
||||
|
||||
<h2><?php echo __('Order #:', 'woocommerce') . ' ' . $order->id; ?></h2>
|
||||
<h2><?php echo __('Order:', 'woocommerce') . ' ' . $order->get_order_number(); ?></h2>
|
||||
|
||||
<table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
|
||||
<thead>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<?php do_action('woocommerce_email_before_order_table', $order, false); ?>
|
||||
|
||||
<h2><?php echo __('Order #:', 'woocommerce') . ' ' . $order->id; ?></h2>
|
||||
<h2><?php echo __('Order:', 'woocommerce') . ' ' . $order->get_order_number(); ?></h2>
|
||||
|
||||
<table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
|
||||
<thead>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<?php do_action('woocommerce_email_before_order_table', $order, false); ?>
|
||||
|
||||
<h2><?php echo __('Order #', 'woocommerce') . $order->id; ?></h2>
|
||||
<h2><?php echo __('Order:', 'woocommerce') . ' ' . $order->get_order_number(); ?></h2>
|
||||
|
||||
<table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
|
||||
<thead>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<?php do_action('woocommerce_email_before_order_table', $order, false); ?>
|
||||
|
||||
<h2><?php echo __('Order #:', 'woocommerce') . ' ' . $order->id; ?></h2>
|
||||
<h2><?php echo __('Order:', 'woocommerce') . ' ' . $order->get_order_number(); ?></h2>
|
||||
|
||||
<table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
|
||||
<thead>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<?php do_action('woocommerce_email_before_order_table', $order, false); ?>
|
||||
|
||||
<h2><?php echo __('Order #:', 'woocommerce') . ' ' . $order->id; ?></h2>
|
||||
<h2><?php echo __('Order:', 'woocommerce') . ' ' . $order->get_order_number(); ?></h2>
|
||||
|
||||
<table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
|
||||
<thead>
|
||||
|
|
|
@ -52,7 +52,7 @@ if ($customer_orders) :
|
|||
$order = new WC_Order();
|
||||
$order->populate($customer_order);
|
||||
?><tr class="order">
|
||||
<td class="order-number"><?php echo $order->id; ?></td>
|
||||
<td class="order-number"><?php echo $order->get_order_number(); ?></td>
|
||||
<td class="order-date"><time 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-shipto"><address><?php if ($order->get_formatted_shipping_address()) echo $order->get_formatted_shipping_address(); else echo '–'; ?></address></td>
|
||||
<td class="order-total"><?php echo woocommerce_price($order->order_total); ?></td>
|
||||
|
|
|
@ -9,7 +9,7 @@ global $woocommerce;
|
|||
<?php
|
||||
$status = get_term_by('slug', $order->status, 'shop_order_status');
|
||||
|
||||
$order_status_text = sprintf( __('Order #%s which was made %s has the status “%s”', 'woocommerce'), $order->id, human_time_diff(strtotime($order->order_date), current_time('timestamp')).__(' ago', 'woocommerce'), __($status->name, 'woocommerce') );
|
||||
$order_status_text = sprintf( __('Order %s which was made %s has the status “%s”', 'woocommerce'), $order->get_order_number(), human_time_diff(strtotime($order->order_date), current_time('timestamp')).__(' ago', 'woocommerce'), __($status->name, 'woocommerce') );
|
||||
|
||||
if ($order->status == 'completed') $order_status_text .= ' ' . __('and was completed', 'woocommerce') . ' ' . human_time_diff(strtotime($order->completed_date), current_time('timestamp')).__(' ago', 'woocommerce');
|
||||
|
||||
|
|
Loading…
Reference in New Issue