Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ADD {rockitdownloads} TAG FOR USE IN EDD PURCHASE EMAILS
- edd_add_email_tag( 'rockitdownloads', __( 'A linked list of downloads purchased', 'edd' ), 'rockit_edd_email_tag_downloads' );
- function rockit_edd_email_tag_downloads( $payment_id ) {
- $payment_data = edd_get_payment_meta( $payment_id );
- $download_list = '<div>';
- $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 .= " – " . __( 'SKU', 'edd' ) . ': ' . $sku;
- }
- if ( $price_id !== false ) {
- $title .= "" . edd_get_price_option_name( $item['id'], $price_id );
- }
- $download_list .= '<div>' . apply_filters( 'edd_email_receipt_download_title', $title, $item, $price_id, $payment_id ) . '</div>';
- $download_list .= '';
- }
- $files = edd_get_download_files( $item['id'], $price_id );
- if ( $files ) {
- foreach ( $files as $filekey => $file ) {
- $download_list .= '<div style="display:inline-block;padding-bottom:20px;">';
- $file_url = edd_get_download_file_url( $payment_data['key'], $email, $filekey, $item['id'], $price_id );
- $download_list .= '<a style="color:#FFF;background:#1784CB;display:inline-block;padding:4px 10px 4px 10px;border-radius:3px;text-decoration:none;" href="' . esc_url( $file_url ) . '">' . edd_get_file_name( $file ) . '</a>';
- $download_list .= '</div>';
- }
- }
- 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 .= '<div>';
- $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 .= '</div>';
- }
- }
- }
- if ( $show_names ) {
- $download_list .= '';
- }
- if ( '' != edd_get_product_notes( $item['id'] ) ) {
- $download_list .= '<div style="padding-bottom:20px;"><small>' . edd_get_product_notes( $item['id'] ) . '</small></div>';
- }
- if ( $show_names ) {
- $download_list .= '';
- }
- }
- }
- $download_list .= '</div>';
- return $download_list;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement