|
21 | 21 |
|
22 | 22 | defined( 'ABSPATH' ) || exit;
|
23 | 23 |
|
| 24 | +if ( WC()->payment_gateways() ) { |
| 25 | + $payment_gateways = WC()->payment_gateways->payment_gateways(); |
| 26 | +} else { |
| 27 | + $payment_gateways = array(); |
| 28 | +} |
| 29 | + |
| 30 | +$payment_method = $order->get_payment_method(); |
| 31 | + |
24 | 32 | $payment_gateway = wc_get_payment_gateway_by_order( $order );
|
25 | 33 | $line_items = $order->get_items( apply_filters( 'woocommerce_admin_order_item_types', 'line_item' ) );
|
26 | 34 | $discounts = $order->get_items( 'discount' );
|
|
101 | 109 | <div id="woocommerce-order-data" class="postbox">
|
102 | 110 | <div class="inside">
|
103 | 111 | <div id="order_data" class="panel woocommerce-order-data">
|
104 |
| - <h2 class="woocommerce-order-data__heading">Order #<?php echo $order->get_id(); ?> details</h2> |
105 |
| - <p class="woocommerce-order-data__meta order_number"> Payment via <?php echo $order->get_payment_method_title(); ?>. Paid on <?php echo $order->get_date_created()->format ('F j, Y @ g:i a'); ?></p> |
| 112 | + <h2 class="woocommerce-order-data__heading"> |
| 113 | + <h2 class="woocommerce-order-data__heading"> |
| 114 | + <?php |
| 115 | + /* translators: 1: order number */ |
| 116 | + printf( |
| 117 | + esc_html__( 'Order #%1$s details', 'wc-order-view' ), |
| 118 | + esc_html( $order->get_order_number() ) |
| 119 | + ); |
| 120 | + ?> |
| 121 | + </h2> |
| 122 | + </h2> |
| 123 | + <p class="woocommerce-order-data__meta order_number"> |
| 124 | + <?php |
| 125 | + |
| 126 | + $meta_list = array(); |
| 127 | + if ( $payment_method && 'other' !== $payment_method ) { |
| 128 | + /* translators: %s: payment method */ |
| 129 | + $payment_method_string = sprintf( |
| 130 | + __( 'Payment via %s', 'wc-order-view' ), |
| 131 | + esc_html( isset( $payment_gateways[ $payment_method ] ) ? $payment_gateways[ $payment_method ]->get_title() : $payment_method ) |
| 132 | + ); |
| 133 | + if ( $transaction_id = $order->get_transaction_id() ) { |
| 134 | + $payment_method_string .= ' (' . esc_html( $transaction_id ) . ')'; |
| 135 | + } |
| 136 | + $meta_list[] = $payment_method_string; |
| 137 | + } |
| 138 | + if ( $order->get_date_paid() ) { |
| 139 | + /* translators: 1: date 2: time */ |
| 140 | + $meta_list[] = sprintf( |
| 141 | + __( 'Paid on %1$s @ %2$s', 'wc-order-view' ), |
| 142 | + wc_format_datetime( $order->get_date_paid() ), |
| 143 | + wc_format_datetime( $order->get_date_paid(), get_option( 'time_format' ) ) |
| 144 | + ); |
| 145 | + } |
| 146 | + if ( $ip_address = $order->get_customer_ip_address() ) { |
| 147 | + /* translators: %s: IP address */ |
| 148 | + $meta_list[] = sprintf( |
| 149 | + __( 'Customer IP: %s', 'wc-order-view' ), |
| 150 | + '<span class="woocommerce-Order-customerIP">' . esc_html( $ip_address ) . '</span>' |
| 151 | + ); |
| 152 | + } |
| 153 | + echo wp_kses_post( implode( '. ', $meta_list ) ); |
| 154 | + |
| 155 | + ?> |
| 156 | + </p> |
106 | 157 | <div class="order_data_column_container">
|
107 | 158 | <div class="order_data_column">
|
108 | 159 | <h3>General</h3>
|
|
127 | 178 | <div class="order_data_column">
|
128 | 179 | <h3>Billing</h3>
|
129 | 180 | <div class="address">
|
130 |
| - <p><?php echo $order->get_formatted_billing_address(); ?></p> |
| 181 | + <?php if( ! empty( $order->get_formatted_billing_address() ) ) : ?> |
| 182 | + <p><?php echo $order->get_formatted_billing_address(); ?></p> |
| 183 | + <?php else : ?> |
| 184 | + <p class="none_set"><strong>Address:</strong>No billing address set.</p> |
| 185 | + <?php endif; ?> |
131 | 186 | <p>
|
132 | 187 | <strong>Email Address:</strong>
|
133 | 188 | <a href="mailto:<?php echo $order->get_billing_email(); ?>"><?php echo $order->get_billing_email(); ?></a>
|
|
141 | 196 | <div class="order_data_column">
|
142 | 197 | <h3>Shipping</h3>
|
143 | 198 | <div class="address">
|
144 |
| - <?php if( !empty( $order->get_formatted_shipping_address() ) ) : ?> |
| 199 | + <?php if( ! empty( $order->get_formatted_shipping_address() ) ) : ?> |
145 | 200 | <p><?php echo $order->get_formatted_shipping_address(); ?></p>
|
146 | 201 | <?php else : ?>
|
147 | 202 | <p class="none_set"><strong>Address:</strong>No shipping address set.</p>
|
|
0 commit comments