Support » Plugin: WP e-Commerce Style Email » admin email

  • Resolved carlyblack

    (@carlyblack)


    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/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Jacob Schwartz

    (@mightyturtle)

    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

    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

    Plugin Author Jacob Schwartz

    (@mightyturtle)

    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

    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

    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 ^^

    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*/
    Plugin Author Jacob Schwartz

    (@mightyturtle)

    Good work!

    Thanks Carlyblack!

    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?

    esmi

    (@esmi)

    Forum Moderator

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

    @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?

    esmi

    (@esmi)

    Forum Moderator

    Please post your own topic.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘admin email’ is closed to new replies.