2012-04-09 22:57:57 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* My Orders
|
|
|
|
*
|
|
|
|
* Shows recent orders on the account page
|
2012-08-14 18:05:45 +00:00
|
|
|
*
|
|
|
|
* @author WooThemes
|
|
|
|
* @package WooCommerce/Templates
|
|
|
|
* @version 1.6.4
|
2012-04-09 22:57:57 +00:00
|
|
|
*/
|
2012-08-14 18:05:45 +00:00
|
|
|
|
2012-10-15 10:57:58 +00:00
|
|
|
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|
|
|
|
2012-04-09 22:57:57 +00:00
|
|
|
global $woocommerce;
|
|
|
|
|
|
|
|
$customer_id = get_current_user_id();
|
|
|
|
|
|
|
|
$args = array(
|
|
|
|
'numberposts' => $recent_orders,
|
|
|
|
'meta_key' => '_customer_user',
|
|
|
|
'meta_value' => $customer_id,
|
|
|
|
'post_type' => 'shop_order',
|
2012-08-14 18:05:45 +00:00
|
|
|
'post_status' => 'publish'
|
2012-04-09 22:57:57 +00:00
|
|
|
);
|
|
|
|
$customer_orders = get_posts($args);
|
|
|
|
|
|
|
|
if ($customer_orders) :
|
|
|
|
?>
|
|
|
|
<table class="shop_table my_account_orders">
|
2012-08-14 18:05:45 +00:00
|
|
|
|
2012-04-09 22:57:57 +00:00
|
|
|
<thead>
|
|
|
|
<tr>
|
2012-10-16 09:45:33 +00:00
|
|
|
<th class="order-number"><span class="nobr"><?php _e( 'Order', 'woocommerce' ); ?></span></th>
|
|
|
|
<th class="order-shipto"><span class="nobr"><?php _e( 'Ship to', 'woocommerce' ); ?></span></th>
|
|
|
|
<th class="order-total"><span class="nobr"><?php _e( 'Total', 'woocommerce' ); ?></span></th>
|
|
|
|
<th class="order-status" colspan="2"><span class="nobr"><?php _e( 'Status', 'woocommerce' ); ?></span></th>
|
2012-04-09 22:57:57 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
2012-08-14 18:05:45 +00:00
|
|
|
|
2012-04-09 22:57:57 +00:00
|
|
|
<tbody><?php
|
|
|
|
foreach ($customer_orders as $customer_order) :
|
|
|
|
$order = new WC_Order();
|
2012-08-14 18:05:45 +00:00
|
|
|
|
2012-04-09 22:57:57 +00:00
|
|
|
$order->populate( $customer_order );
|
2012-08-14 18:05:45 +00:00
|
|
|
|
2012-04-09 22:57:57 +00:00
|
|
|
$status = get_term_by('slug', $order->status, 'shop_order_status');
|
2012-08-14 18:05:45 +00:00
|
|
|
|
2012-04-09 22:57:57 +00:00
|
|
|
?><tr class="order">
|
|
|
|
<td class="order-number" width="1%">
|
2012-06-20 17:18:16 +00:00
|
|
|
<a href="<?php echo esc_url( add_query_arg('order', $order->id, get_permalink(woocommerce_get_page_id('view_order'))) ); ?>"><?php echo $order->get_order_number(); ?></a> – <time title="<?php echo esc_attr( strtotime($order->order_date) ); ?>"><?php echo date_i18n(get_option('date_format'), strtotime($order->order_date)); ?></time>
|
2012-04-09 22:57:57 +00:00
|
|
|
</td>
|
|
|
|
<td class="order-shipto"><address><?php if ($order->get_formatted_shipping_address()) echo $order->get_formatted_shipping_address(); else echo '–'; ?></address></td>
|
2012-04-27 02:22:19 +00:00
|
|
|
<td class="order-total" width="1%"><?php echo $order->get_formatted_order_total(); ?></td>
|
2012-04-09 22:57:57 +00:00
|
|
|
<td class="order-status" style="text-align:left; white-space:nowrap;">
|
|
|
|
<?php echo ucfirst( __( $status->name, 'woocommerce' ) ); ?>
|
|
|
|
<?php if (in_array($order->status, array('pending', 'failed'))) : ?>
|
2012-10-16 09:45:33 +00:00
|
|
|
<a href="<?php echo esc_url( $order->get_cancel_order_url() ); ?>" class="cancel" title="<?php _e( 'Click to cancel this order', 'woocommerce' ); ?>">(<?php _e( 'Cancel', 'woocommerce' ); ?>)</a>
|
2012-04-09 22:57:57 +00:00
|
|
|
<?php endif; ?>
|
|
|
|
</td>
|
|
|
|
<td class="order-actions" style="text-align:right; white-space:nowrap;">
|
2012-08-14 18:05:45 +00:00
|
|
|
|
2012-04-09 22:57:57 +00:00
|
|
|
<?php if (in_array($order->status, array('pending', 'failed'))) : ?>
|
2012-10-16 09:45:33 +00:00
|
|
|
<a href="<?php echo esc_url( $order->get_checkout_payment_url() ); ?>" class="button pay"><?php _e( 'Pay', 'woocommerce' ); ?></a>
|
2012-04-09 22:57:57 +00:00
|
|
|
<?php endif; ?>
|
2012-08-14 18:05:45 +00:00
|
|
|
|
2012-10-16 09:45:33 +00:00
|
|
|
<a href="<?php echo esc_url( add_query_arg('order', $order->id, get_permalink(woocommerce_get_page_id('view_order'))) ); ?>" class="button"><?php _e( 'View', 'woocommerce' ); ?></a>
|
2012-04-09 22:57:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
</td>
|
|
|
|
</tr><?php
|
|
|
|
endforeach;
|
|
|
|
?></tbody>
|
2012-08-14 18:05:45 +00:00
|
|
|
|
2012-04-09 22:57:57 +00:00
|
|
|
</table>
|
|
|
|
<?php
|
|
|
|
else :
|
|
|
|
?>
|
2012-10-16 09:45:33 +00:00
|
|
|
<p><?php _e( 'You have no recent orders.', 'woocommerce' ); ?></p>
|
2012-04-09 22:57:57 +00:00
|
|
|
<?php
|
|
|
|
endif;
|
|
|
|
?>
|