1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* My Orders - Deprecated |
4
|
|
|
* |
5
|
|
|
* @deprecated 2.6.0 this template file is no longer used. My Account shortcode uses orders.php. |
6
|
|
|
* @package WooCommerce/Templates |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
defined( 'ABSPATH' ) || exit; |
10
|
|
|
|
11
|
|
|
$my_orders_columns = apply_filters( |
12
|
|
|
'woocommerce_my_account_my_orders_columns', |
13
|
|
|
array( |
14
|
|
|
'order-number' => esc_html__( 'Order', 'woocommerce' ), |
15
|
|
|
'order-date' => esc_html__( 'Date', 'woocommerce' ), |
16
|
|
|
'order-status' => esc_html__( 'Status', 'woocommerce' ), |
17
|
|
|
'order-total' => esc_html__( 'Total', 'woocommerce' ), |
18
|
|
|
'order-actions' => ' ', |
19
|
|
|
) |
20
|
|
|
); |
21
|
|
|
|
22
|
|
|
$customer_orders = get_posts( |
23
|
|
|
apply_filters( |
24
|
|
|
'woocommerce_my_account_my_orders_query', |
25
|
|
|
array( |
26
|
|
|
'numberposts' => $order_count, |
27
|
|
|
'meta_key' => '_customer_user', |
28
|
|
|
'meta_value' => get_current_user_id(), |
29
|
|
|
'post_type' => wc_get_order_types( 'view-orders' ), |
30
|
|
|
'post_status' => array_keys( wc_get_order_statuses() ), |
31
|
|
|
) |
32
|
|
|
) |
33
|
|
|
); |
34
|
|
|
|
35
|
|
|
if ( $customer_orders ) : ?> |
36
|
|
|
|
37
|
|
|
<h2><?php echo apply_filters( 'woocommerce_my_account_my_orders_title', esc_html__( 'Recent orders', 'woocommerce' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></h2> |
38
|
|
|
|
39
|
|
|
<table class="shop_table shop_table_responsive my_account_orders"> |
40
|
|
|
|
41
|
|
|
<thead> |
42
|
|
|
<tr> |
43
|
|
|
<?php foreach ( $my_orders_columns as $column_id => $column_name ) : ?> |
44
|
|
|
<th class="<?php echo esc_attr( $column_id ); ?>"><span class="nobr"><?php echo esc_html( $column_name ); ?></span></th> |
45
|
|
|
<?php endforeach; ?> |
46
|
|
|
</tr> |
47
|
|
|
</thead> |
48
|
|
|
|
49
|
|
|
<tbody> |
50
|
|
|
<?php |
51
|
|
|
foreach ( $customer_orders as $customer_order ) : |
52
|
|
|
$order = wc_get_order( $customer_order ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited |
53
|
|
|
$item_count = $order->get_item_count(); |
54
|
|
|
?> |
55
|
|
|
<tr class="order"> |
56
|
|
|
<?php foreach ( $my_orders_columns as $column_id => $column_name ) : ?> |
57
|
|
|
<td class="<?php echo esc_attr( $column_id ); ?>" data-title="<?php echo esc_attr( $column_name ); ?>"> |
58
|
|
View Code Duplication |
<?php if ( has_action( 'woocommerce_my_account_my_orders_column_' . $column_id ) ) : ?> |
59
|
|
|
<?php do_action( 'woocommerce_my_account_my_orders_column_' . $column_id, $order ); ?> |
60
|
|
|
|
61
|
|
|
<?php elseif ( 'order-number' === $column_id ) : ?> |
62
|
|
|
<a href="<?php echo esc_url( $order->get_view_order_url() ); ?>"> |
63
|
|
|
<?php echo _x( '#', 'hash before order number', 'woocommerce' ) . $order->get_order_number(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
64
|
|
|
</a> |
65
|
|
|
|
66
|
|
|
<?php elseif ( 'order-date' === $column_id ) : ?> |
67
|
|
|
<time datetime="<?php echo esc_attr( $order->get_date_created()->date( 'c' ) ); ?>"><?php echo esc_html( wc_format_datetime( $order->get_date_created() ) ); ?></time> |
68
|
|
|
|
69
|
|
|
<?php elseif ( 'order-status' === $column_id ) : ?> |
70
|
|
|
<?php echo esc_html( wc_get_order_status_name( $order->get_status() ) ); ?> |
71
|
|
|
|
72
|
|
|
<?php elseif ( 'order-total' === $column_id ) : ?> |
73
|
|
|
<?php |
74
|
|
|
/* translators: 1: formatted order total 2: total order items */ |
75
|
|
|
printf( _n( '%1$s for %2$s item', '%1$s for %2$s items', $item_count, 'woocommerce' ), $order->get_formatted_order_total(), $item_count ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
76
|
|
|
?> |
77
|
|
|
|
78
|
|
|
<?php elseif ( 'order-actions' === $column_id ) : ?> |
79
|
|
|
<?php |
80
|
|
|
$actions = wc_get_account_orders_actions( $order ); |
|
|
|
|
81
|
|
|
|
82
|
|
|
if ( ! empty( $actions ) ) { |
83
|
|
|
foreach ( $actions as $key => $action ) { // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited |
84
|
|
|
echo '<a href="' . esc_url( $action['url'] ) . '" class="button ' . sanitize_html_class( $key ) . '">' . esc_html( $action['name'] ) . '</a>'; |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
?> |
88
|
|
|
<?php endif; ?> |
89
|
|
|
</td> |
90
|
|
|
<?php endforeach; ?> |
91
|
|
|
</tr> |
92
|
|
|
<?php endforeach; ?> |
93
|
|
|
</tbody> |
94
|
|
|
</table> |
95
|
|
|
<?php endif; ?> |
96
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: