1 <?php
  2 
  3 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
  4 
  5 if ( ! class_exists( 'WC_Email_Customer_Processing_Order' ) ) :
  6 
  7 /**
  8  * Customer Processing Order Email
  9  *
 10  * An email sent to the admin when a new order is received/paid for.
 11  *
 12  * @class       WC_Email_Customer_Processing_Order
 13  * @version     2.0.0
 14  * @package     WooCommerce/Classes/Emails
 15  * @author      WooThemes
 16  * @extends     WC_Email
 17  */
 18 class WC_Email_Customer_Processing_Order extends WC_Email {
 19 
 20     /**
 21      * Constructor
 22      */
 23     function __construct() {
 24 
 25         $this->id               = 'customer_processing_order';
 26         $this->title            = __( 'Processing order', 'woocommerce' );
 27         $this->description      = __( 'This is an order notification sent to the customer after payment containing order details.', 'woocommerce' );
 28 
 29         $this->heading          = __( 'Thank you for your order', 'woocommerce' );
 30         $this->subject          = __( 'Your {site_title} order receipt from {order_date}', 'woocommerce' );
 31 
 32         $this->template_html    = 'emails/customer-processing-order.php';
 33         $this->template_plain   = 'emails/plain/customer-processing-order.php';
 34 
 35         // Triggers for this email
 36         add_action( 'woocommerce_order_status_pending_to_processing_notification', array( $this, 'trigger' ) );
 37         add_action( 'woocommerce_order_status_pending_to_on-hold_notification', array( $this, 'trigger' ) );
 38 
 39         // Call parent constructor
 40         parent::__construct();
 41     }
 42 
 43     /**
 44      * trigger function.
 45      *
 46      * @access public
 47      * @return void
 48      */
 49     function trigger( $order_id ) {
 50 
 51         if ( $order_id ) {
 52             $this->object       = new WC_Order( $order_id );
 53             $this->recipient    = $this->object->billing_email;
 54 
 55             $this->find[] = '{order_date}';
 56             $this->replace[] = date_i18n( wc_date_format(), strtotime( $this->object->order_date ) );
 57 
 58             $this->find[] = '{order_number}';
 59             $this->replace[] = $this->object->get_order_number();
 60         }
 61 
 62         if ( ! $this->is_enabled() || ! $this->get_recipient() )
 63             return;
 64 
 65         $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
 66     }
 67 
 68     /**
 69      * get_content_html function.
 70      *
 71      * @access public
 72      * @return string
 73      */
 74     function get_content_html() {
 75         ob_start();
 76         wc_get_template( $this->template_html, array(
 77             'order'         => $this->object,
 78             'email_heading' => $this->get_heading(),
 79             'sent_to_admin' => false,
 80             'plain_text'    => false
 81         ) );
 82         return ob_get_clean();
 83     }
 84 
 85     /**
 86      * get_content_plain function.
 87      *
 88      * @access public
 89      * @return string
 90      */
 91     function get_content_plain() {
 92         ob_start();
 93         wc_get_template( $this->template_plain, array(
 94             'order'         => $this->object,
 95             'email_heading' => $this->get_heading(),
 96             'sent_to_admin' => false,
 97             'plain_text'    => true
 98         ) );
 99         return ob_get_clean();
100     }
101 }
102 
103 endif;
104 
105 return new WC_Email_Customer_Processing_Order();
WooCommerce API documentation generated by ApiGen 2.8.0