| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template for displaying order detail. |
| 4 |
* |
| 5 |
* This template can be overridden by copying it to yourtheme/learnpress/checkout/order-received.php. |
| 6 |
* |
| 7 |
* @author ThimPress |
| 8 |
* @package Learnpress/Templates |
| 9 |
* @version 4.0.0 |
| 10 |
*/ |
| 11 |
|
| 12 |
defined( 'ABSPATH' ) || exit(); |
| 13 |
?> |
| 14 |
|
| 15 |
<?php |
| 16 |
/** |
| 17 |
* @var LP_Order $order_received |
| 18 |
*/ |
| 19 |
if ( ! isset( $order_received ) ) { |
| 20 |
echo wp_sprintf( |
| 21 |
'<p>%s</p>', |
| 22 |
esc_html( |
| 23 |
apply_filters( |
| 24 |
'learn-press/order/received-invalid-order-message', |
| 25 |
__( 'Invalid order.', 'learnpress' ) |
| 26 |
) |
| 27 |
) |
| 28 |
); |
| 29 |
|
| 30 |
return; |
| 31 |
} |
| 32 |
|
| 33 |
echo wp_sprintf( |
| 34 |
'<p>%s</p>', |
| 35 |
esc_html( |
| 36 |
apply_filters( |
| 37 |
'learn-press/order/received-order-message', |
| 38 |
__( 'Thank you. Your order has been received.', 'learnpress' ) |
| 39 |
) |
| 40 |
) |
| 41 |
); |
| 42 |
|
| 43 |
?> |
| 44 |
<table class="order_details"> |
| 45 |
<?php if ( isset( $_GET['key'] ) && ! is_user_logged_in() ) : ?> |
| 46 |
<tr class="order-key"> |
| 47 |
<th><?php esc_html_e( 'Order Key', 'learnpress' ); ?></th> |
| 48 |
<td> |
| 49 |
<?php echo esc_html( $_GET['key'] ); ?> |
| 50 |
</td> |
| 51 |
</tr> |
| 52 |
<?php endif; ?> |
| 53 |
<tr class="order"> |
| 54 |
<th><?php esc_html_e( 'Order Number', 'learnpress' ); ?></th> |
| 55 |
<td> |
| 56 |
<?php echo esc_html( $order_received->get_order_number() ); ?> |
| 57 |
</td> |
| 58 |
</tr> |
| 59 |
<tr class="item"> |
| 60 |
<th><?php esc_html_e( 'Item', 'learnpress' ); ?></th> |
| 61 |
<td> |
| 62 |
<?php |
| 63 |
$links = array(); |
| 64 |
$items = $order_received->get_items(); |
| 65 |
$count = count( $items ); |
| 66 |
|
| 67 |
foreach ( $items as $item ) { |
| 68 |
if ( empty( $item['course_id'] ) || get_post_type( $item['course_id'] ) !== LP_COURSE_CPT ) { |
| 69 |
$links[] = apply_filters( |
| 70 |
'learn-press/order-item-not-course-id', |
| 71 |
__( 'The course does not exist', 'learnpress' ), |
| 72 |
$item |
| 73 |
); |
| 74 |
} else { |
| 75 |
$link = '<a href="' . get_the_permalink( $item['course_id'] ) . '">' . get_the_title( $item['course_id'] ) . ' (#' . $item['course_id'] . ')' . '</a>'; |
| 76 |
if ( $count > 1 ) { |
| 77 |
$link = sprintf( '<li>%s</li>', $link ); |
| 78 |
} |
| 79 |
$links[] = apply_filters( 'learn-press/order-received-item-link', $link, $item ); |
| 80 |
} |
| 81 |
} |
| 82 |
|
| 83 |
if ( $count > 1 ) { |
| 84 |
echo sprintf( '<ol>%s</ol>', join( '', $links ) ); |
| 85 |
} elseif ( 1 == $count ) { |
| 86 |
echo wp_kses_post( implode( '', $links ) ); |
| 87 |
} else { |
| 88 |
echo esc_html__( '(No item)', 'learnpress' ); |
| 89 |
} |
| 90 |
?> |
| 91 |
</td> |
| 92 |
</tr> |
| 93 |
<tr class="date"> |
| 94 |
<th><?php esc_html_e( 'Date', 'learnpress' ); ?></th> |
| 95 |
<td> |
| 96 |
<?php |
| 97 |
echo wp_kses_post( |
| 98 |
date_i18n( |
| 99 |
get_option( 'date_format' ), |
| 100 |
strtotime( $order_received->get_order_date() ) |
| 101 |
) |
| 102 |
); |
| 103 |
?> |
| 104 |
</td> |
| 105 |
</tr> |
| 106 |
<tr class="total"> |
| 107 |
<th><?php esc_html_e( 'Total', 'learnpress' ); ?></th> |
| 108 |
<td> |
| 109 |
<?php echo wp_kses_post( $order_received->get_formatted_order_total() ); ?> |
| 110 |
</td> |
| 111 |
</tr> |
| 112 |
<?php |
| 113 |
$method_title = $order_received->get_payment_method_title(); |
| 114 |
if ( $method_title ) : |
| 115 |
?> |
| 116 |
<tr class="method"> |
| 117 |
<th><?php esc_html_e( 'Payment Method', 'learnpress' ); ?></th> |
| 118 |
<td> |
| 119 |
<?php echo esc_html( $method_title ); ?> |
| 120 |
</td> |
| 121 |
</tr> |
| 122 |
<?php endif; ?> |
| 123 |
</table> |
| 124 |
|
| 125 |
<?php do_action( 'learn-press/order/received/' . $order_received->payment_method, $order_received->get_id() ); ?> |
| 126 |
<?php do_action( 'learn-press/order/received', $order_received ); ?> |
| 127 |
|