1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
<?php /** * Order details * * @author WooThemes * @package WooCommerce/Templates * @version 2.2.0 */
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$order = wc_get_order( $order_id ); ?> <h2><?php _e( 'Order Details', 'woocommerce' ); ?></h2> <table class="shop_table order_details"> <thead> <tr> <th class="product-name"><?php _e( 'Product', 'woocommerce' ); ?></th> <th class="product-total"><?php _e( 'Total', 'woocommerce' ); ?></th> </tr> </thead> <tbody> <?php if ( sizeof( $order->get_items() ) > 0 ) {
foreach( $order->get_items() as $item ) { $_product = apply_filters( 'woocommerce_order_item_product', $order->get_product_from_item( $item ), $item ); $item_meta = new WC_Order_Item_Meta( $item['item_meta'], $_product );
?> <tr class="<?php echo esc_attr( apply_filters( 'woocommerce_order_item_class', 'order_item', $item, $order ) ); ?>"> <td class="product-name"> <?php if ( $_product && ! $_product->is_visible() ) echo apply_filters( 'woocommerce_order_item_name', $item['name'], $item ); else echo apply_filters( 'woocommerce_order_item_name', sprintf( '<a href="%s">%s</a>', get_permalink( $item['product_id'] ), $item['name'] ), $item );
echo apply_filters( 'woocommerce_order_item_quantity_html', ' <strong class="product-quantity">' . sprintf( '× %s', $item['qty'] ) . '</strong>', $item );
$item_meta->display();
if ( $_product && $_product->exists() && $_product->is_downloadable() && $order->is_download_permitted() ) {
$download_files = $order->get_item_downloads( $item ); $i = 0; $links = array();
foreach ( $download_files as $download_id => $file ) { $i++;
$links[] = '<small><a href="' . esc_url( $file['download_url'] ) . '">' . sprintf( __( 'Download file%s', 'woocommerce' ), ( count( $download_files ) > 1 ? ' ' . $i . ': ' : ': ' ) ) . esc_html( $file['name'] ) . '</a></small>'; }
echo '<br/>' . implode( '<br/>', $links ); } ?> </td> <td class="product-total"> <?php echo $order->get_formatted_line_subtotal( $item ); ?> </td> </tr> <?php
if ( $order->has_status( array( 'completed', 'processing' ) ) && ( $purchase_note = get_post_meta( $_product->id, '_purchase_note', true ) ) ) { ?> <tr class="product-purchase-note"> <td colspan="3"><?php echo wpautop( do_shortcode( wp_kses_post( $purchase_note ) ) ); ?></td> </tr> <?php } } }
do_action( 'woocommerce_order_items_table', $order ); ?> </tbody> <tfoot> <?php if ( $totals = $order->get_order_item_totals() ) foreach ( $totals as $total ) : ?> <tr> <th scope="row"><?php echo $total['label']; ?></th> <td><?php echo $total['value']; ?></td> </tr> <?php endforeach; ?> </tfoot> </table>
<?php do_action( 'woocommerce_order_details_after_order_table', $order ); ?>
<header> <h2><?php _e( 'Customer details', 'woocommerce' ); ?></h2> </header> <dl class="customer_details"> <?php if ( $order->billing_email ) echo '<dt>' . __( 'Email:', 'woocommerce' ) . '</dt><dd>' . $order->billing_email . '</dd>'; if ( $order->billing_phone ) echo '<dt>' . __( 'Telephone:', 'woocommerce' ) . '</dt><dd>' . $order->billing_phone . '</dd>';
// Additional customer details hook do_action( 'woocommerce_order_details_after_customer_details', $order ); ?> </dl>
<?php if ( ! wc_ship_to_billing_address_only() && $order->needs_shipping_address() && get_option( 'woocommerce_calc_shipping' ) !== 'no' ) : ?>
<div class="col2-set addresses">
<div class="col-1">
<?php endif; ?>
<header class="title"> <h3><?php _e( 'Billing Address', 'woocommerce' ); ?></h3> </header> <address> <?php if ( ! $order->get_formatted_billing_address() ) _e( 'N/A', 'woocommerce' ); else echo $order->get_formatted_billing_address(); ?> </address>
<?php if ( ! wc_ship_to_billing_address_only() && $order->needs_shipping_address() && get_option( 'woocommerce_calc_shipping' ) !== 'no' ) : ?>
</div><!-- /.col-1 -->
<div class="col-2">
<header class="title"> <h3><?php _e( 'Shipping Address', 'woocommerce' ); ?></h3> </header> <address> <?php if ( ! $order->get_formatted_shipping_address() ) _e( 'N/A', 'woocommerce' ); else echo $order->get_formatted_shipping_address(); ?> </address>
</div><!-- /.col-2 -->
</div><!-- /.col2-set -->
<?php endif; ?>
<div class="clear"></div>
|