WordPress.org

Forums

WP eCommerce
[resolved] Receipt to buyer does not include notes (8 posts)

  1. Bloke
    Member
    Posted 1 year ago #

    When I click on an order and email receipt to buyer it does not include notes I have entered. Is it supposed to mail the notes? Or can this be done? I want the buyer to see any updates I have entered.

    http://wordpress.org/plugins/wp-e-commerce/

  2. whitelamp
    Member
    Posted 1 year ago #

    I expect it can be done by taking this plugin (of mine):
    http://www.whitelamp.com/public/q/A/wordpress-plugins
    and modifying it to get the notes and make them available.

  3. Bloke
    Member
    Posted 1 year ago #

    Where can I find the file that sends the receipt to the buyer? When you click on "resend receipt". Then I need to find the variable used for the notes.

  4. Visser Labs
    Member
    Posted 1 year ago #

    Hi Bloke, you would need to modify the Payment Receipt e-mail template, there are several Plugins (free and Premium) that cater to customising the invoice templates sent to customers.

  5. Bloke
    Member
    Posted 1 year ago #

    Ok thanks. I wasn't sure if it was supposed to send the notes or not.

  6. Bloke
    Member
    Posted 1 year ago #

    How would I get the value of the notes? I looked at the code of your plug in.

  7. Bloke
    Member
    Posted 1 year ago #

    I found this and its close to what I am trying to do. He gives a list of item array keys at the bottom and I assume I could retrieve the notes.

    Scroll to the second to last block of code. Just not sure if I would put this in my theme's functions file.Get purchase log data

    Or the example from whitelamps' plugin

    function purchase_log_add_up_included_tax($pln)
    {
        $pl = $pln->get_purchase_log();
        $gwdata = $pl->get_gateway_data();
        $tax_included = 0;
        foreach ($gwdata['items'] as $item) {
            if (isset($item['tax'])) {
                $tax_included += $item['tax'];
            }
        }
        return wpsc_currency_display( $tax_included, array( 'display_as_html' => false ) );
    }

    I was thinking something something like this:

    function get_notes()
    {
    
        $data = $wpdb->get_var( $wpdb->prepare( 'SELECT notes FROM ' . WPSC_TABLE_PURCHASE_LOGS . " WHERE id = %d", $purchase_id ) )
    
        foreach ($data['item'] as $notes) {
            if (isset($item['notes'])) {
                $tax_included += $item['tax'];
            }
        }
    
    }
  8. Bloke
    Member
    Posted 1 year ago #

    I got it figured out and here is how I did it in case anyone needs it because I cannot a free plug in that allows you to add the notes. Its helpful to add the order log notes to emails because when you resend the receipt to the customer it informs them of any changes.

    In my theme's functions file. I added.

    function wpsc_get_notes($purchase_id ) {//$purchase_id
    
    $purchase_log_notes  = $wpdb->get_var( $wpdb->prepare( 'SELECT notes FROM ' . WPSC_TABLE_PURCHASE_LOGS . " WHERE id = %d", $purchase_id ) );
    return $purchase_log_notes;

    And then I created a class that I adapted from what I found here https://gist.github.com/webaware/4964078.

    class WpscExtendCustEmailNotes {
    /**
    * add filter hooks
    */
    public function __construct() {
    add_filter('wpsc_purchase_log_customer_notification_raw_message', array($this, 'customerMessage'), 10, 2);
    }
    
    /**
    * intercept filter hook for customer notification message
    */
    public function customerMessage($msg, $log_notification) {
    
    global $purid;
    $order_notes = wpsc_get_notes($purid);
    $msg .= "\n\n" .str_repeat('=', 85) . "\n";
    $msg .= "\n\n<strong>Order notes:</strong>";
    $msg .= "\n\n$order_notes\n";
    return $msg;
    }
    }
    
    new WpscExtendCustEmailNotes();

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.