1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) exit;
4
5 if ( ! class_exists( 'WC_Email_Customer_Processing_Order' ) ) :
6
7 8 9 10 11 12 13 14 15 16 17
18 class WC_Email_Customer_Processing_Order extends WC_Email {
19
20 21 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
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
40 parent::__construct();
41 }
42
43 44 45 46 47 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 70 71 72 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 87 88 89 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();