| 1 |
<?php |
| 2 |
/** |
| 3 |
* Order history view. |
| 4 |
* |
| 5 |
* @var array $order_histories ; |
| 6 |
*/ |
| 7 |
|
| 8 |
// Exit if accessed directly. |
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; |
| 11 |
} |
| 12 |
|
| 13 |
|
| 14 |
if ( empty( $order_histories ) ) : |
| 15 |
?> |
| 16 |
<p><?php esc_html_e( 'No related orders found.', 'subscription' ); ?></p> |
| 17 |
<?php |
| 18 |
return; |
| 19 |
endif; |
| 20 |
?> |
| 21 |
|
| 22 |
<table class="widefat striped"> |
| 23 |
<thead> |
| 24 |
<tr> |
| 25 |
<th><?php esc_html_e( 'Order', 'subscription' ); ?></th> |
| 26 |
<th><?php esc_html_e( 'Type', 'subscription' ); ?></th> |
| 27 |
<th><?php esc_html_e( 'Date', 'subscription' ); ?></th> |
| 28 |
<th><?php esc_html_e( 'Status', 'subscription' ); ?></th> |
| 29 |
<th><?php esc_html_e( 'Total', 'subscription' ); ?></th> |
| 30 |
</tr> |
| 31 |
</thead> |
| 32 |
<tbody> |
| 33 |
<?php foreach ( $order_histories as $history ) : ?> |
| 34 |
<?php $order = wc_get_order( $history->order_id ); ?> |
| 35 |
<?php if ( $order ) : ?> |
| 36 |
<tr> |
| 37 |
<td> |
| 38 |
<a href="<?php echo esc_url( $order->get_edit_order_url() ); ?>" target="_blank"> |
| 39 |
#<?php echo esc_html( $order->get_order_number() ); ?> |
| 40 |
</a> |
| 41 |
</td> |
| 42 |
<td><?php echo esc_html( ucfirst( str_replace( '-', ' ', $history->type ) ) ); ?></td> |
| 43 |
<td><?php echo esc_html( $order->get_date_created()->date( 'M j, Y - g:i A' ) ); ?></td> |
| 44 |
<td><?php echo esc_html( wc_get_order_status_name( $order->get_status() ) ); ?></td> |
| 45 |
<td><?php echo wp_kses_post( $order->get_formatted_order_total() ); ?></td> |
| 46 |
</tr> |
| 47 |
<?php endif; ?> |
| 48 |
<?php endforeach; ?> |
| 49 |
</tbody> |
| 50 |
</table> |
| 51 |
|