Add filenames to Downloads section in My Account

This commit is contained in:
Gerhard 2014-02-25 12:48:36 +02:00
parent c3f514fa0a
commit 123d60912b
1 changed files with 2 additions and 13 deletions

View File

@ -633,27 +633,16 @@ class WC_Customer {
continue; 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 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( $download_name = apply_filters(
'woocommerce_downloadable_product_name', 'woocommerce_downloadable_product_name',
$_product->get_title() . ( $file_number > 0 ? ' — ' . sprintf( __( 'File %d', 'woocommerce' ), $file_number + 1 ) : '' ), $_product->get_title() . ' – ' . $download_file['name'],
$_product, $_product,
$result->download_id, $result->download_id,
$file_number $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( $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_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, 'download_id' => $result->download_id,