if (!is_null($price_id)) {
                    ?>
							<span class="edd_purchase_receipt_price_name">&nbsp;&ndash;&nbsp;<?php 
                    echo edd_get_price_option_name($item['id'], $price_id, $payment->ID);
                    ?>
</span>
							<?php 
                }
                ?>
						</div>

						<?php 
                if ($edd_receipt_args['notes']) {
                    ?>
							<div class="edd_purchase_receipt_product_notes"><?php 
                    echo wpautop(edd_get_product_notes($item['id']));
                    ?>
</div>
						<?php 
                }
                ?>

						<?php 
                if (edd_is_payment_complete($payment->ID) && edd_receipt_show_download_files($item['id'], $edd_receipt_args, $item)) {
                    ?>
						<ul class="edd_purchase_receipt_files">
							<?php 
                    if (!empty($download_files) && is_array($download_files)) {
                        foreach ($download_files as $filekey => $file) {
                            $download_url = edd_get_download_file_url($meta['key'], $email, $filekey, $item['id'], $price_id);
                            ?>
 /**
  * Given a download post object, generate the data for the API output
  *
  * @since  2.3.9
  * @param  object $product_info The Download Post Object
  * @return array                Array of post data to return back in the API
  */
 private function get_product_data($product_info)
 {
     $product = array();
     $product['info']['id'] = $product_info->ID;
     $product['info']['slug'] = $product_info->post_name;
     $product['info']['title'] = $product_info->post_title;
     $product['info']['create_date'] = $product_info->post_date;
     $product['info']['modified_date'] = $product_info->post_modified;
     $product['info']['status'] = $product_info->post_status;
     $product['info']['link'] = html_entity_decode($product_info->guid);
     $product['info']['content'] = $product_info->post_content;
     $product['info']['excerpt'] = $product_info->post_excerpt;
     $product['info']['thumbnail'] = wp_get_attachment_url(get_post_thumbnail_id($product_info->ID));
     $product['info']['category'] = get_the_terms($product_info, 'download_category');
     $product['info']['tags'] = get_the_terms($product_info, 'download_tag');
     if (user_can($this->user_id, 'view_shop_reports') || $this->override) {
         $product['stats']['total']['sales'] = edd_get_download_sales_stats($product_info->ID);
         $product['stats']['total']['earnings'] = edd_get_download_earnings_stats($product_info->ID);
         $product['stats']['monthly_average']['sales'] = edd_get_average_monthly_download_sales($product_info->ID);
         $product['stats']['monthly_average']['earnings'] = edd_get_average_monthly_download_earnings($product_info->ID);
     }
     if (edd_has_variable_prices($product_info->ID)) {
         foreach (edd_get_variable_prices($product_info->ID) as $price) {
             $product['pricing'][sanitize_key($price['name'])] = $price['amount'];
         }
     } else {
         $product['pricing']['amount'] = edd_get_download_price($product_info->ID);
     }
     if (user_can($this->user_id, 'view_shop_sensitive_data') || $this->override) {
         foreach (edd_get_download_files($product_info->ID) as $file) {
             $product['files'][] = $file;
         }
         $product['notes'] = edd_get_product_notes($product_info->ID);
     }
     return apply_filters('edd_api_products_product', $product);
 }
Example #3
0
/**
 * Render Product Notes Field
 *
 * @since 1.2.1
 * @param int $post_id Download (Post) ID
 * @return void
 */
function edd_render_product_notes_field($post_id)
{
    $product_notes = edd_get_product_notes($post_id);
    ?>
	<textarea rows="1" cols="40" class="large-texarea" name="edd_product_notes" id="edd_product_notes_field"><?php 
    echo esc_textarea($product_notes);
    ?>
</textarea>
	<p><?php 
    _e('Special notes or instructions for this product. These notes will be added to the purchase receipt.', 'edd');
    ?>
</p>
<?php 
}
 /**
  * Process Get Products API Request
  *
  * @access public
  * @author Daniel J Griffiths
  * @since 1.5
  * @param int $product Product (Download) ID
  * @return array $customers Multidimensional array of the products
  */
 public function get_products($product = null)
 {
     $products = array();
     if ($product == null) {
         $products['products'] = array();
         $product_list = get_posts(array('post_type' => 'download', 'posts_per_page' => $this->per_page(), 'paged' => $this->get_paged()));
         if ($product_list) {
             $i = 0;
             foreach ($product_list as $product_info) {
                 $products['products'][$i]['info']['id'] = $product_info->ID;
                 $products['products'][$i]['info']['slug'] = $product_info->post_name;
                 $products['products'][$i]['info']['title'] = $product_info->post_title;
                 $products['products'][$i]['info']['create_date'] = $product_info->post_date;
                 $products['products'][$i]['info']['modified_date'] = $product_info->post_modified;
                 $products['products'][$i]['info']['status'] = $product_info->post_status;
                 $products['products'][$i]['info']['link'] = html_entity_decode($product_info->guid);
                 $products['products'][$i]['info']['content'] = $product_info->post_content;
                 $products['products'][$i]['info']['thumbnail'] = wp_get_attachment_url(get_post_thumbnail_id($product_info->ID));
                 $products['products'][$i]['stats']['total']['sales'] = edd_get_download_sales_stats($product_info->ID);
                 $products['products'][$i]['stats']['total']['earnings'] = edd_get_download_earnings_stats($product_info->ID);
                 $products['products'][$i]['stats']['monthly_average']['sales'] = edd_get_average_monthly_download_sales($product_info->ID);
                 $products['products'][$i]['stats']['monthly_average']['earnings'] = edd_get_average_monthly_download_earnings($product_info->ID);
                 if (edd_has_variable_prices($product_info->ID)) {
                     foreach (edd_get_variable_prices($product_info->ID) as $price) {
                         $products['products'][$i]['pricing'][sanitize_key($price['name'])] = $price['amount'];
                     }
                 } else {
                     $products['products'][$i]['pricing']['amount'] = edd_get_download_price($product_info->ID);
                 }
                 foreach (edd_get_download_files($product_info->ID) as $file) {
                     $products['products'][$i]['files'][] = $file;
                 }
                 $products['products'][$i]['notes'] = edd_get_product_notes($product_info->ID);
                 $i++;
             }
         }
     } else {
         if (get_post_type($product) == 'download') {
             $product_info = get_post($product);
             $products['products'][0]['info']['id'] = $product_info->ID;
             $products['products'][0]['info']['slug'] = $product_info->post_name;
             $products['products'][0]['info']['title'] = $product_info->post_title;
             $products['products'][0]['info']['create_date'] = $product_info->post_date;
             $products['products'][0]['info']['modified_date'] = $product_info->post_modified;
             $products['products'][0]['info']['status'] = $product_info->post_status;
             $products['products'][0]['info']['link'] = html_entity_decode($product_info->guid);
             $products['products'][0]['info']['content'] = $product_info->post_content;
             $products['products'][0]['info']['thumbnail'] = wp_get_attachment_url(get_post_thumbnail_id($product_info->ID));
             $products['products'][0]['stats']['total']['sales'] = edd_get_download_sales_stats($product_info->ID);
             $products['products'][0]['stats']['total']['earnings'] = edd_get_download_earnings_stats($product_info->ID);
             $products['products'][0]['stats']['monthly_average']['sales'] = edd_get_average_monthly_download_sales($product_info->ID);
             $products['products'][0]['stats']['monthly_average']['earnings'] = edd_get_average_monthly_download_earnings($product_info->ID);
             if (edd_has_variable_prices($product_info->ID)) {
                 foreach (edd_get_variable_prices($product_info->ID) as $price) {
                     $products['products'][0]['pricing'][sanitize_key($price['name'])] = $price['amount'];
                 }
             } else {
                 $products['products'][0]['pricing']['amount'] = edd_get_download_price($product_info->ID);
             }
             foreach (edd_get_download_files($product_info->ID) as $file) {
                 $products['products'][0]['files'][] = $file;
             }
             $products['products'][0]['notes'] = edd_get_product_notes($product_info->ID);
         } else {
             $error['error'] = sprintf(__('Product %s not found!', 'edd'), $product);
             return $error;
         }
     }
     return $products;
 }
                if (!is_null($price_id)) {
                    ?>
							<span class="edd_purchase_receipt_price_name">&nbsp;&ndash;&nbsp;<?php 
                    echo edd_get_price_option_name($item['id'], $price_id);
                    ?>
</span>
							<?php 
                }
                ?>
						</div>

						<?php 
                if ($edd_receipt_args['notes']) {
                    ?>
							<div class="edd_purchase_receipt_product_notes"><?php 
                    echo edd_get_product_notes($item['id']);
                    ?>
</div>
						<?php 
                }
                ?>

						<?php 
                if (edd_is_payment_complete($payment->ID) && edd_receipt_show_download_files($item['id'], $edd_receipt_args)) {
                    ?>
						<ul class="edd_purchase_receipt_files">
							<?php 
                    if (!empty($download_files) && is_array($download_files)) {
                        foreach ($download_files as $filekey => $file) {
                            $download_url = edd_get_download_file_url($meta['key'], $email, $filekey, $item['id'], $price_id);
                            ?>
/**
 * Email template tag: download_list
 * A list of download links for each download purchased in plaintext
 *
 * @since 2.1.1
 * @param int $payment_id
 *
 * @return string download_list
 */
function edd_email_tag_download_list_plain($payment_id)
{
    $payment_data = edd_get_payment_meta($payment_id);
    $cart_items = edd_get_payment_meta_cart_details($payment_id);
    $email = edd_get_payment_user_email($payment_id);
    $download_list = '';
    if ($cart_items) {
        $show_names = apply_filters('edd_email_show_names', true);
        $show_links = apply_filters('edd_email_show_links', true);
        foreach ($cart_items as $item) {
            if (edd_use_skus()) {
                $sku = edd_get_download_sku($item['id']);
            }
            if (edd_item_quantities_enabled()) {
                $quantity = $item['quantity'];
            }
            $price_id = edd_get_cart_item_price_id($item);
            if ($show_names) {
                $title = get_the_title($item['id']);
                if (!empty($quantity) && $quantity > 1) {
                    $title .= __('Quantity', 'easy-digital-downloads') . ': ' . $quantity;
                }
                if (!empty($sku)) {
                    $title .= __('SKU', 'easy-digital-downloads') . ': ' . $sku;
                }
                if ($price_id !== null) {
                    $title .= edd_get_price_option_name($item['id'], $price_id, $payment_id);
                }
                $download_list .= "\n";
                $download_list .= apply_filters('edd_email_receipt_download_title', $title, $item, $price_id, $payment_id) . "\n";
            }
            $files = edd_get_download_files($item['id'], $price_id);
            if (!empty($files)) {
                foreach ($files as $filekey => $file) {
                    if ($show_links) {
                        $download_list .= "\n";
                        $file_url = edd_get_download_file_url($payment_data['key'], $email, $filekey, $item['id'], $price_id);
                        $download_list .= edd_get_file_name($file) . ': ' . $file_url . "\n";
                    } else {
                        $download_list .= "\n";
                        $download_list .= edd_get_file_name($file) . "\n";
                    }
                }
            } elseif (edd_is_bundled_product($item['id'])) {
                $bundled_products = apply_filters('edd_email_tag_bundled_products', edd_get_bundled_products($item['id']), $item, $payment_id, 'download_list');
                foreach ($bundled_products as $bundle_item) {
                    $download_list .= '<div class="edd_bundled_product"><strong>' . get_the_title($bundle_item) . '</strong></div>';
                    $files = edd_get_download_files($bundle_item);
                    foreach ($files as $filekey => $file) {
                        if ($show_links) {
                            $file_url = edd_get_download_file_url($payment_data['key'], $email, $filekey, $bundle_item, $price_id);
                            $download_list .= $file['name'] . ': ' . $file_url . "\n";
                        } else {
                            $download_list .= $file['name'] . "\n";
                        }
                    }
                }
            }
            if ('' != edd_get_product_notes($item['id'])) {
                $download_list .= "\n";
                $download_list .= edd_get_product_notes($item['id']) . "\n";
            }
        }
    }
    return $download_list;
}
/**
 * Email Template Tags
 *
 * @since 1.0
 *
 * @param string $message Message with the template tags
 * @param array $payment_data Payment Data
 * @param int $payment_id Payment ID
 *
 * @return string $message Fully formatted message
 */
function edd_email_template_tags($message, $payment_data, $payment_id)
{
    global $edd_options;
    $has_tags = strpos($message, '{') !== false;
    if (!$has_tags) {
        return $message;
    }
    $user_info = maybe_unserialize($payment_data['user_info']);
    $fullname = '';
    if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) {
        $user_data = get_userdata($user_info['id']);
        $name = $user_info['first_name'];
        $fullname = $user_info['first_name'] . ' ' . $user_info['last_name'];
        $username = $user_data->user_login;
    } elseif (isset($user_info['first_name'])) {
        $name = $user_info['first_name'];
        $fullname = $user_info['first_name'] . ' ' . $user_info['last_name'];
        $username = $user_info['first_name'];
    } else {
        $name = $user_info['email'];
        $username = $user_info['email'];
    }
    $file_urls = '';
    $download_list = '<ul>';
    $cart_items = edd_get_payment_meta_cart_details($payment_id);
    if ($cart_items) {
        $show_names = apply_filters('edd_email_show_names', true);
        foreach ($cart_items as $item) {
            if (edd_use_skus()) {
                $sku = edd_get_download_sku($item['id']);
            }
            $price_id = edd_get_cart_item_price_id($item);
            if ($show_names) {
                $title = get_the_title($item['id']);
                if (!empty($sku)) {
                    $title .= "&nbsp;&ndash;&nbsp;" . __('SKU', 'edd') . ': ' . $sku;
                }
                if ($price_id !== false) {
                    $title .= "&nbsp;&ndash;&nbsp;" . edd_get_price_option_name($item['id'], $price_id);
                }
                $download_list .= '<li>' . apply_filters('edd_email_receipt_download_title', $title, $item['id'], $price_id) . '<br/>';
                $download_list .= '<ul>';
            }
            $files = edd_get_download_files($item['id'], $price_id);
            if ($files) {
                foreach ($files as $filekey => $file) {
                    $download_list .= '<li>';
                    $file_url = edd_get_download_file_url($payment_data['key'], $payment_data['email'], $filekey, $item['id'], $price_id);
                    $download_list .= '<a href="' . esc_url($file_url) . '">' . $file['name'] . '</a>';
                    $download_list .= '</li>';
                    $file_urls .= esc_html($file_url) . '<br/>';
                }
            }
            if ($show_names) {
                $download_list .= '</ul>';
            }
            if ('' != edd_get_product_notes($item['id'])) {
                $download_list .= ' &mdash; <small>' . edd_get_product_notes($item['id']) . '</small>';
            }
            if ($show_names) {
                $download_list .= '</li>';
            }
        }
    }
    $download_list .= '</ul>';
    $subtotal = isset($payment_data['subtotal']) ? $payment_data['subtotal'] : $payment_data['amount'];
    $subtotal = edd_currency_filter(edd_format_amount($subtotal));
    $tax = isset($payment_data['tax']) ? $payment_data['tax'] : 0;
    $tax = edd_currency_filter(edd_format_amount($tax));
    $price = edd_currency_filter(edd_format_amount($payment_data['amount']));
    $gateway = edd_get_gateway_checkout_label(get_post_meta($payment_id, '_edd_payment_gateway', true));
    $receipt_id = $payment_data['key'];
    $message = str_replace('{name}', $name, $message);
    $message = str_replace('{fullname}', $fullname, $message);
    $message = str_replace('{username}', $username, $message);
    $message = str_replace('{download_list}', $download_list, $message);
    $message = str_replace('{file_urls}', $file_urls, $message);
    $message = str_replace('{date}', date_i18n(get_option('date_format'), strtotime($payment_data['date'])), $message);
    $message = str_replace('{sitename}', get_bloginfo('name'), $message);
    $message = str_replace('{subtotal}', $subtotal, $message);
    $message = str_replace('{tax}', $tax, $message);
    $message = str_replace('{price}', $price, $message);
    $message = str_replace('{payment_method}', $gateway, $message);
    $message = str_replace('{receipt_id}', $receipt_id, $message);
    $message = str_replace('{payment_id}', $payment_id, $message);
    $message = str_replace('{receipt_link}', sprintf(__('%1$sView it in your browser.%2$s', 'edd'), '<a href="' . add_query_arg(array('purchase_key' => $receipt_id, 'edd_action' => 'view_receipt'), home_url()) . '">', '</a>'), $message);
    $message = apply_filters('edd_email_template_tags', $message, $payment_data, $payment_id);
    return $message;
}
/**
 * Email Template Tags
 *
 * @param string $message
 * @param array  $payment_data
 * @param int    $payment_id
 *
 * @access private
 * @since 1.0
 * @return string
 */
function edd_email_template_tags($message, $payment_data, $payment_id)
{
    $user_info = maybe_unserialize($payment_data['user_info']);
    $fullname = '';
    if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) {
        $user_data = get_userdata($user_info['id']);
        $name = $user_info['first_name'];
        $fullname = $user_info['first_name'] . ' ' . $user_info['last_name'];
        $username = $user_data->user_login;
    } elseif (isset($user_info['first_name'])) {
        $name = $user_info['first_name'];
        $fullname = $user_info['first_name'] . ' ' . $user_info['last_name'];
        $username = $user_info['first_name'];
    } else {
        $name = $user_info['email'];
        $username = $user_info['email'];
    }
    $file_urls = '';
    $download_list = '<ul>';
    $downloads = edd_get_payment_meta_downloads($payment_id);
    if ($downloads) {
        $show_names = apply_filters('edd_email_show_names', true);
        foreach ($downloads as $download) {
            $id = isset($payment_data['cart_details']) ? $download['id'] : $download;
            if ($show_names) {
                $download_list .= '<li>' . get_the_title($id) . '<br/>';
                $download_list .= '<ul>';
            }
            $price_id = isset($download['options']['price_id']) ? $download['options']['price_id'] : null;
            $files = edd_get_download_files($id, $price_id);
            if ($files) {
                foreach ($files as $filekey => $file) {
                    $download_list .= '<li>';
                    $file_url = edd_get_download_file_url($payment_data['key'], $payment_data['email'], $filekey, $id);
                    $download_list .= '<a href="' . esc_url($file_url) . '">' . $file['name'] . '</a>';
                    $download_list .= '</li>';
                    $file_urls .= esc_html($file_url) . '<br/>';
                }
            }
            if ($show_names) {
                $download_list .= '</ul>';
            }
            if ('' != edd_get_product_notes($id)) {
                $download_list .= ' &mdash; <small>' . edd_get_product_notes($id) . '</small>';
            }
            if ($show_names) {
                $download_list .= '</li>';
            }
        }
    }
    $download_list .= '</ul>';
    $subtotal = isset($payment_data['subtotal']) ? $payment_data['subtotal'] : $payment_data['amount'];
    $subtotal = edd_currency_filter(edd_format_amount($subtotal));
    $tax = isset($payment_data['tax']) ? $payment_data['tax'] : 0;
    $tax = edd_currency_filter(edd_format_amount($tax));
    $price = edd_currency_filter(edd_format_amount($payment_data['amount']));
    $gateway = edd_get_gateway_checkout_label(get_post_meta($payment_id, '_edd_payment_gateway', true));
    $receipt_id = $payment_data['key'];
    $message = str_replace('{name}', $name, $message);
    $message = str_replace('{fullname}', $fullname, $message);
    $message = str_replace('{username}', $username, $message);
    $message = str_replace('{download_list}', $download_list, $message);
    $message = str_replace('{file_urls}', $file_urls, $message);
    $message = str_replace('{date}', date_i18n(get_option('date_format'), strtotime($payment_data['date'])), $message);
    $message = str_replace('{sitename}', get_bloginfo('name'), $message);
    $message = str_replace('{subtotal}', $subtotal, $message);
    $message = str_replace('{tax}', $tax, $message);
    $message = str_replace('{price}', $price, $message);
    $message = str_replace('{payment_method}', $gateway, $message);
    $message = str_replace('{receipt_id}', $receipt_id, $message);
    $message = apply_filters('edd_email_template_tags', $message, $payment_data, $payment_id);
    return $message;
}
Example #9
0
/**
 * Email template tag: updated_products_links
 * A list of updated products with download links included
 * 
 * @access public
 * @param mixed $payment_id
 * @return void
 */
function edd_pup_products_links_tag_plain($payment_id, $email = null)
{
    // Used to generate accurate tag outputs for preview and test emails
    if (isset($email) && absint($email) != 0) {
        $updated_products = get_post_meta($email, '_edd_pup_updated_products', true);
        $updated_products = is_array($updated_products) ? $updated_products : array($updated_products);
        foreach ($updated_products as $id => $name) {
            $customer_updates[$id] = array('id' => $id, 'name' => $name);
        }
    } else {
        $email = get_transient('edd_pup_sending_email_' . get_current_user_id());
        $updated_products = get_post_meta($email, '_edd_pup_updated_products', true);
        $updated_products = is_array($updated_products) ? $updated_products : array($updated_products);
        $customer_updates = edd_pup_get_customer_updates($payment_id, $email);
        $customer_updates = is_array($customer_updates) ? $customer_updates : array($customer_updates);
    }
    $filters = get_post_meta($email, '_edd_pup_filters', true);
    if ($customer_updates) {
        $show_names = apply_filters('edd_pup_email_show_names', true);
        $payment_data = edd_get_payment_meta($payment_id);
        // Set email to most recent email if it's been changed from initial email
        if (isset($payment_data['user_info']['email']) && $payment_data['user_info']['email'] != $payment_data['email']) {
            $payment_data['email'] = $payment_data['user_info']['email'];
        }
        // Used for detecting when to place commas
        $c = 1;
        $download_list = '';
        foreach ($customer_updates as $item) {
            if (edd_use_skus()) {
                $sku = edd_get_download_sku($item['id']);
            }
            $price_id = edd_get_cart_item_price_id($item);
            if ($show_names) {
                $title = $c == 1 ? $item['name'] : ', ' . $item['name'];
                if (!empty($sku)) {
                    $title .= "&nbsp;&ndash;&nbsp;" . __('SKU', 'edd') . ': ' . $sku;
                }
                $download_list .= apply_filters('edd_pup_email_products_link_title_plain', $title, $item, $price_id, $payment_id);
            }
            $files = edd_get_download_files($item['id'], $price_id);
            if ($files) {
                // $f used for detecting when to place commas
                $f = 1;
                $download_list .= ' (';
                foreach ($files as $filekey => &$file) {
                    $file_url = edd_get_download_file_url($payment_data['key'], $payment_data['email'], $filekey, $item['id'], $price_id);
                    $download_list .= $f == 1 ? edd_get_file_name($file) . ': ' . esc_url($file_url) : ', ' . edd_get_file_name($file) . ': ' . esc_url($file_url);
                    $f++;
                }
                $download_list .= ')';
            }
            if (edd_is_bundled_product($item['id'])) {
                $b = 1;
                $bundled_products = edd_get_bundled_products($item['id']);
                $download_list .= "&nbsp;&ndash;&nbsp;";
                foreach ($bundled_products as $bundle_item) {
                    if ($filters['bundle_1'] == 'all' || isset($updated_products[$bundle_item])) {
                        $download_list .= $b == 1 ? get_the_title($bundle_item) : '; ' . get_the_title($bundle_item);
                        $fb = 1;
                        $bundlefiles = edd_get_download_files($bundle_item);
                        $download_list .= ' (';
                        foreach ($bundlefiles as $bundlefilekey => $bundlefile) {
                            $bundlefile_url = edd_get_download_file_url($payment_data['key'], $payment_data['email'], $bundlefilekey, $bundle_item, $price_id);
                            $download_list .= $fb == 1 ? $bundlefile['name'] . ': ' . esc_url($bundlefile_url) : ', ' . $bundlefile['name'] . ': ' . esc_url($bundlefile_url);
                            $fb++;
                        }
                        $download_list .= ')';
                    }
                    $b++;
                }
            }
            if ('' != edd_get_product_notes($item['id'])) {
                $download_list .= ' &ndash; ' . edd_get_product_notes($item['id']);
            }
            $c++;
        }
        return $download_list;
    }
}
Example #10
0
/**
 * Email template tag: download_list
 * A list of download links for each download purchased
 *
 * @param int $payment_id
 *
 * @return string download_list
 */
function edd_email_tag_download_list($payment_id)
{
    $payment_data = edd_get_payment_meta($payment_id);
    $download_list = '<ul>';
    $cart_items = edd_get_payment_meta_cart_details($payment_id);
    $email = edd_get_payment_user_email($payment_id);
    if ($cart_items) {
        $show_names = apply_filters('edd_email_show_names', true);
        foreach ($cart_items as $item) {
            if (edd_use_skus()) {
                $sku = edd_get_download_sku($item['id']);
            }
            $price_id = edd_get_cart_item_price_id($item);
            if ($show_names) {
                $title = get_the_title($item['id']);
                if (!empty($sku)) {
                    $title .= "&nbsp;&ndash;&nbsp;" . __('SKU', 'edd') . ': ' . $sku;
                }
                if ($price_id !== false) {
                    $title .= "&nbsp;&ndash;&nbsp;" . edd_get_price_option_name($item['id'], $price_id);
                }
                $download_list .= '<li>' . apply_filters('edd_email_receipt_download_title', $title, $item, $price_id, $payment_id) . '<br/>';
                $download_list .= '<ul>';
            }
            $files = edd_get_download_files($item['id'], $price_id);
            if ($files) {
                foreach ($files as $filekey => $file) {
                    $download_list .= '<li>';
                    $file_url = edd_get_download_file_url($payment_data['key'], $email, $filekey, $item['id'], $price_id);
                    $download_list .= '<a href="' . esc_url($file_url) . '">' . edd_get_file_name($file) . '</a>';
                    $download_list .= '</li>';
                }
            } elseif (edd_is_bundled_product($item['id'])) {
                $bundled_products = edd_get_bundled_products($item['id']);
                foreach ($bundled_products as $bundle_item) {
                    $download_list .= '<li class="edd_bundled_product"><strong>' . get_the_title($bundle_item) . '</strong></li>';
                    $files = edd_get_download_files($bundle_item);
                    foreach ($files as $filekey => $file) {
                        $download_list .= '<li>';
                        $file_url = edd_get_download_file_url($payment_data['key'], $email, $filekey, $bundle_item, $price_id);
                        $download_list .= '<a href="' . esc_url($file_url) . '">' . $file['name'] . '</a>';
                        $download_list .= '</li>';
                    }
                }
            }
            if ($show_names) {
                $download_list .= '</ul>';
            }
            if ('' != edd_get_product_notes($item['id'])) {
                $download_list .= ' &mdash; <small>' . edd_get_product_notes($item['id']) . '</small>';
            }
            if ($show_names) {
                $download_list .= '</li>';
            }
        }
    }
    $download_list .= '</ul>';
    return $download_list;
}