Clickable transaction IDs

This commit is contained in:
Mike Jolley 2017-11-22 16:31:27 +00:00
parent 29fed057af
commit f0cbaf08b1
1 changed files with 13 additions and 1 deletions

View File

@ -548,6 +548,18 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
if ( ! $order ) {
return array();
}
$payment_via = $order->get_payment_method_title();
$payment_gateways = WC()->payment_gateways() ? WC()->payment_gateways->payment_gateways() : array();
if ( $transaction_id = $order->get_transaction_id() ) {
if ( isset( $$payment_gateways[ $payment_method ] ) && ( $url = $payment_gateways[ $payment_method ]->get_transaction_url( $order ) ) ) {
$payment_via .= ' (<a href="' . esc_url( $url ) . '" target="_blank">' . esc_html( $transaction_id ) . '</a>)';
} else {
$payment_via .= ' (' . esc_html( $transaction_id ) . ')';
}
}
return apply_filters( 'woocommerce_admin_order_preview_get_order_details', array(
'data' => $order->get_data(),
'order_number' => $order->get_order_number(),
@ -558,7 +570,7 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
'formatted_billing_address' => ( $address = $order->get_formatted_billing_address() ) ? $address : __( 'N/A', 'woocommerce' ),
'formatted_shipping_address' => ( $address = $order->get_formatted_shipping_address() ) ? $address: __( 'N/A', 'woocommerce' ),
'shipping_address_map_url' => $order->get_shipping_address_map_url(),
'payment_via' => $order->get_payment_method_title() . ( $order->get_transaction_id() ? ' (' . $order->get_transaction_id() . ')' : '' ),
'payment_via' => $payment_via,
'shipping_via' => $order->get_shipping_method(),
), $order );
}