Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

wp-e-commerce purchase receipt emails WordPress

A quick question if anyone happens to know...

In WP E-commerce, I'm trying to customize the email that gets sent out to purchasers as well as the admin report. I would like to display the Category the product is in on the receipt.

I would like to know if anyone knows the tags to be used because I can't find any anywhere! I've tried %category_id% %category% %category_list% and nothing works.

Does anyone know the tage for this?

Thanks!

Answers (2)

2011-08-31

Linda answers:

Hi, as far as I know there are not any tags for this. You will have to edit the transaction_result_functions.php to get the category name put on the receipt.

-Linda


Linda comments:

You could try this in transaction_result_functions.php

add these lines in around line 74

// DATA FROM TABLE FOR CATEGORY NAME
$product_cat_id = $wpdb->get_row("SELECT * FROM ".WPSC_TABLE_ITEM_CATEGORY_ASSOC." WHERE id='{$row['prodid']}' LIMIT 1", ARRAY_A) ;
$product_cat = $wpdb->get_row("SELECT * FROM ".WPSC_TABLE_PRODUCT_CATEGORIES." WHERE id='".$product_cat_id['category_id']."' LIMIT 1", ARRAY_A) ;



then add this line in around line 180 (but position it where you wish it to appear in your email above other $product_list outputs)

//PRINT CATEGORY NAME
$product_list.= "Category: ".$product_cat['name']."/n/r";


That just might do it. :)

2011-09-02

Ajay Chavda answers:

You can first define the following code in the File wpsc-transaction_result_function.php on Line 281.

File location Wp-e-commrce >> Wpsc-core>> wpsc-transaction_result_function.php

$message = str_replace( '%Category%', get_option['category_base'], $message );

and then use %Category% in your store settings.


Emilia Farrace comments:

i tried doing that, but now, when changing the purchase receipt information, it's just blank. so it doesn't pull the category into the receipt, but doesn't show the tag either.

i had to find the functions php page you listed as it wasn't in the core files it was wp-ecommerce > wpsc-theme > functions > wpsc-transaction_result_function.php

was this the right place?

if ( isset( $_GET['ti'] ) ) {
$message.= "\n\r" . __( 'Your Transaction ID', 'wpsc' ) . ": " . $_GET['ti'];
$message_html.= "\n\r" . __( 'Your Transaction ID', 'wpsc' ) . ": " . $_GET['ti'];
$report.= "\n\r" . __( 'Transaction ID', 'wpsc' ) . ": " . $_GET['ti'];
}
$message = str_replace( '%purchase_id%', $report_id, $message );
$message = str_replace( '%product_list%', $product_list, $message );
$message = str_replace( '%total_tax%', $total_tax, $message );
$message = str_replace( '%total_shipping%', $total_shipping_email, $message );
$message = str_replace( '%total_price%', $total_price_email, $message );
$message = str_replace( '%shop_name%', get_option( 'blogname' ), $message );
$message = str_replace( '%find_us%', $purchase_log['find_us'], $message );
$message = str_replace( '%category%', get_option('category_base'), $message );

$report = str_replace( '%purchase_id%', $report_id, $report );
$report = str_replace( '%product_list%', $report_product_list, $report );
$report = str_replace( '%total_tax%', $total_tax, $report );
$report = str_replace( '%total_shipping%', $total_shipping_email, $report );
$report = str_replace( '%total_price%', $total_price_email, $report );
$report = str_replace( '%shop_name%', get_option( 'blogname' ), $report );
$report = str_replace( '%find_us%', $purchase_log['find_us'], $report );
$report = str_replace( '%category%', get_option('category_base'), $report );

$message_html = str_replace( '%purchase_id%', $report_id, $message_html );
$message_html = str_replace( '%product_list%', $product_list_html, $message_html );
$message_html = str_replace( '%total_tax%', $total_tax_html, $message_html );
$message_html = str_replace( '%total_shipping%', $total_shipping_html, $message_html );
$message_html = str_replace( '%total_price%', $total_price_html, $message_html );
$message_html = str_replace( '%shop_name%', get_option( 'blogname' ), $message_html );
$message_html = str_replace( '%find_us%', $purchase_log['find_us'], $message_html );
$message_html = str_replace( '%category%', get_option('category_base'), $message_html );

if ( !empty($email) ) {
add_filter( 'wp_mail_from', 'wpsc_replace_reply_address', 0 );
add_filter( 'wp_mail_from_name', 'wpsc_replace_reply_name', 0 );
$message = apply_filters('wpsc_email_message', $message, $report_id, $product_list, $total_tax, $total_shipping_email, $total_price_email);


i tried to enter the proper additions, but not sure where else to put them.

thanks for the help!