From 123d60912bf162992321ed9800e1f744ed0d058e Mon Sep 17 00:00:00 2001 From: Gerhard Date: Tue, 25 Feb 2014 12:48:36 +0200 Subject: [PATCH] Add filenames to Downloads section in My Account --- includes/class-wc-customer.php | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/includes/class-wc-customer.php b/includes/class-wc-customer.php index 734ebe80438..d83135773a2 100644 --- a/includes/class-wc-customer.php +++ b/includes/class-wc-customer.php @@ -633,27 +633,16 @@ class WC_Customer { continue; } + $download_file = $_product->get_file( $result->download_id ); // Download name will be 'Product Name' for products with a single downloadable file, and 'Product Name - File X' for products with multiple files $download_name = apply_filters( 'woocommerce_downloadable_product_name', - $_product->get_title() . ( $file_number > 0 ? ' — ' . sprintf( __( 'File %d', 'woocommerce' ), $file_number + 1 ) : '' ), + $_product->get_title() . ' – ' . $download_file['name'], $_product, $result->download_id, $file_number ); - // Rename previous download with file number if there are multiple files only - if ( $file_number == 1 ) { - $previous_result = $downloads[ count( $downloads ) - 1 ]; - $previous_result['download_name'] = apply_filters( - 'woocommerce_downloadable_product_name', - $previous_result['download_name'] . ' — ' . sprintf( __('File %d', 'woocommerce' ), $file_number ), - $_product, - $previous_result['download_id'], - 0 - ); - } - $downloads[] = array( 'download_url' => add_query_arg( array( 'download_file' => $result->product_id, 'order' => $result->order_key, 'email' => $result->user_email, 'key' => $result->download_id ), home_url( '/', 'http' ) ), 'download_id' => $result->download_id,