| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template for displaying list orders in orders tab of user profile page. |
| 4 |
* |
| 5 |
* This template can be overridden by copying it to yourtheme/learnpress/orders/list.php. |
| 6 |
* |
| 7 |
* @author ThimPress |
| 8 |
* @package Learnpress/Templates |
| 9 |
* @version 4.0.1 |
| 10 |
*/ |
| 11 |
|
| 12 |
use LearnPress\Helpers\Template; |
| 13 |
|
| 14 |
defined( 'ABSPATH' ) || exit(); |
| 15 |
|
| 16 |
$profile = LP_Profile::instance(); |
| 17 |
|
| 18 |
$query_orders = $profile->query_orders( array( 'fields' => 'ids' ) ); |
| 19 |
if ( ! $query_orders->get_items() ) { |
| 20 |
Template::print_message( __( 'No orders!', 'learnpress' ), 'info' ); |
| 21 |
return; |
| 22 |
} |
| 23 |
?> |
| 24 |
|
| 25 |
<h3 class="profile-heading"><?php esc_html_e( 'My Orders', 'learnpress' ); ?></h3> |
| 26 |
|
| 27 |
<table class="lp-list-table profile-list-orders profile-list-table"> |
| 28 |
<thead> |
| 29 |
<tr class="order-row"> |
| 30 |
<th class="column-order-number"><?php esc_html_e( 'Order', 'learnpress' ); ?></th> |
| 31 |
<th class="column-order-total"><?php esc_html_e( 'Total', 'learnpress' ); ?></th> |
| 32 |
<th class="column-order-status"><?php esc_html_e( 'Status', 'learnpress' ); ?></th> |
| 33 |
<th class="column-order-date"><?php esc_html_e( 'Date', 'learnpress' ); ?></th> |
| 34 |
<th class="column-order-actions"><?php esc_html_e( 'Actions', 'learnpress' ); ?></th> |
| 35 |
</tr> |
| 36 |
</thead> |
| 37 |
|
| 38 |
<tbody> |
| 39 |
<?php |
| 40 |
foreach ( $query_orders->get_items() as $order_id ) { |
| 41 |
$order = learn_press_get_order( $order_id ); |
| 42 |
?> |
| 43 |
|
| 44 |
<tr class="order-row"> |
| 45 |
<td class="column-order-number"> |
| 46 |
<a href="<?php echo esc_html( $order->get_view_order_url() ); ?>"> |
| 47 |
<?php echo esc_html( $order->get_order_number() ); ?> |
| 48 |
</a> |
| 49 |
</td> |
| 50 |
<td class="column-order-total"><?php echo esc_html( $order->get_formatted_order_total() ); ?></td> |
| 51 |
<td class="column-order-status"> |
| 52 |
<span class="lp-label label-<?php echo esc_attr( $order->get_status() ); ?>"> |
| 53 |
<?php echo wp_kses_post( $order->get_order_status_html() ); ?> |
| 54 |
</span> |
| 55 |
</td> |
| 56 |
<td class="column-order-date"><?php echo esc_html( $order->get_order_date() ); ?></td> |
| 57 |
<td class="column-order-actions"> |
| 58 |
<?php |
| 59 |
$actions = $order->get_profile_order_actions(); |
| 60 |
|
| 61 |
if ( $actions ) { |
| 62 |
foreach ( $actions as $action ) { |
| 63 |
printf( '<a href="%s">%s</a>', esc_url_raw( $action['url'] ), $action['text'] ); |
| 64 |
} |
| 65 |
} |
| 66 |
?> |
| 67 |
</td> |
| 68 |
</tr> |
| 69 |
<?php } ?> |
| 70 |
</tbody> |
| 71 |
|
| 72 |
<tfoot> |
| 73 |
<tr class="list-table-nav"> |
| 74 |
<td colspan="3" class="nav-text"><?php echo esc_html( $query_orders->get_offset_text() ); ?></td> |
| 75 |
<td colspan="2" class="nav-pages"><?php $query_orders->get_nav_numbers( true ); ?></td> |
| 76 |
</tr> |
| 77 |
</tfoot> |
| 78 |
</table> |
| 79 |
|