WordPress.org

Ready to get started?Download WordPress

Forums

WP e-Commerce Style Email
[resolved] [closed] admin email (13 posts)

  1. carlyblack
    Member
    Posted 1 year ago #

    Hi Jacob, thanks for a cool plugin!

    I would just like to know if there is a way to just have the email that goes to the customer (that style) go to admin as well. I'd like to receive the exact same email with the exact same styling come to me, it would make it way easier to read from my end.

    if this is possible I'd love to know how, thanks.

    Carly

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

  2. Jacob Schwartz
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Carly,

    I'm glad you're enjoying my plugin!

    There are a few ways you could do what you're after. The most direct ways would require some PHP coding and I'm not sure what your skill level is. My plugin does not yet provide this functionality out of the box (though I've built similar functionality privately, specifically for clients). Do you have any experience in PHP with WordPress?

    There may be an easy way to achieve this, however. Have a look for a plugin that simply CC's emails to your admin address based on subject line matches. If there's something like that out there (I haven't searched), that could be your easiest route.

    Cheers,

    Jacob

  3. carlyblack
    Member
    Posted 1 year ago #

    Hi Jacob,

    thanks so much for your reply. I had a quick look for that kind of plugin but didn't really find anything.

    I have some php knowledge, but definitely not an expert. If you could point me in the right direction I'd be super appreciative!

    Regards,
    Carly

  4. Jacob Schwartz
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Carly,

    Probably the most direct way to do this would be to hook into the wp_mail filter from your theme's functions file. You would then inspect the $subject variable to target specific customer emails and add your admin email address as a BCC recipient in the $headers variable.

    Purchase receipts have the following $subject value:
    __( 'Purchase Receipt', 'wpsc' )
    And each other kind of WPEC email has another specific subject you can target (order pending, etc).

    Here's the reference for the wp_mail function, to give some context:
    http://codex.wordpress.org/Function_Reference/wp_mail

    You could also have a look at the PHPdoc & definition of wp_mail to see the filter being called:
    http://core.trac.wordpress.org/browser/tags/3.6.1/wp-includes/pluggable.php
    Line 216.

    Does this make sense?

    Jacob

  5. carlyblack
    Member
    Posted 1 year ago #

    thanks Jacob,

    I was able to get one of my lovely developers to add some code into functions.php and he got it working wonderfully. thanks for pointing me in the right direction.

    Carly

  6. Everlast00
    Member
    Posted 1 year ago #

    Hi, Carlyblack, could you give me some instructions in how exactly your developer managed to make this? I'd like to have the same possibility ^^

  7. carlyblack
    Member
    Posted 1 year ago #

    Hi Everlast00

    here is the code that he put into my functions.php file. Please note that I still get the standard transaction report, but I also get a styled copy the same as the customer gets, which is the one that i'll use for my records, it also makes it easier for me to read :)

    /**
     * Filter to modify wp_mail header
     */
    add_filter('wp_mail','modify_wpec_mail',12,1);
    
    /**
     * Modify wp_mail header
     */
    function modify_wpec_mail( $vars ) {
    
    	extract($vars);
    
    	if( isset( $subject ) && $subject ) {
    		switch( $subject ) {
    			case __( 'Purchase Report', 'wpsc' ):
    			case __( 'Transaction Report', 'wpsc' ):
    			case __( 'Purchase Receipt', 'wpsc' ):
    			case __( 'Order Pending', 'wpsc' ):
    			case __( 'Order Pending: Payment Required', 'wpsc' ):
    			case get_option( 'wpsc_trackingid_subject' ):
    
    			$headers = modify_wpec_mail_header( $vars );
    		}
    	}
    
    	return compact( 'to', 'subject', 'message', 'headers', 'attachments' );
    }
    
    /**
     * Adds store admin email as BCC
     */
    function modify_wpec_mail_header( $vars ) {
    
    	extract( $vars );
    
    	$headers = $headers."\r\nBcc:".get_option( 'purch_log_email' )."\r\n";
    
    	return $headers;
    }
    /*end*/
  8. Jacob Schwartz
    Member
    Plugin Author

    Posted 1 year ago #

    Good work!

  9. Everlast00
    Member
    Posted 1 year ago #

    Thanks Carlyblack!

  10. lodie
    Member
    Posted 1 year ago #

    I'm a bit confused should I add this code to wp main functions.php, theme functions.php or plugins admin_functions.php?

    This seems to be the best way to send order with SKU code to the admin account (Transaction Report)? Or are there better ways to adjust the content of the Transaction Report and add SKU codes?

    As I understand it now WP e-Commerce Style Email you can style and adjust the content of Purchase receipt, Order pending & Order pending payment required mail. But only the style of the other mails (like Transaction Report) but not the content. Correct?

  11. esmi
    Forum Moderator
    Posted 1 year ago #

    @lodie: If you require assistance then, as per the Forum Welcome, please post your own topic. This topic references a older version of WordPress.

  12. lodie
    Member
    Posted 1 year ago #

    @esmi question is clearly about the code shared in this topic...

    I'm a bit confused should I add the code from carlyblack to wp main functions.php, my theme functions.php or plugins admin_functions.php?

  13. esmi
    Forum Moderator
    Posted 1 year ago #

    Please post your own topic.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic