Adding form fields for partial refund emails

This is not a working solution yet, looking for feedback on ho west to
implement this
This commit is contained in:
davidlenehan 2015-06-22 13:36:47 +01:00
parent 47c18b1947
commit a171407bcb
1 changed files with 42 additions and 18 deletions

View File

@ -24,13 +24,6 @@ class WC_Email_Customer_Refunded_Order extends WC_Email {
*/
function __construct() {
$this->id = 'customer_refunded_order';
$this->title = __( 'Refunded order', 'woocommerce' );
$this->description = __( 'Order refunded emails are sent to customers when their orders are marked refunded.', 'woocommerce' );
$this->template_html = 'emails/customer-refunded-order.php';
$this->template_plain = 'emails/plain/customer-refunded-order.php';
$this->set_email_strings();
// Triggers for this email
@ -43,13 +36,30 @@ class WC_Email_Customer_Refunded_Order extends WC_Email {
}
function set_email_strings( $partial_refund = false ) {
$this->subject_partial = __( 'Your {site_title} order from {order_date} has been partially refunded', 'woocommerce' );
$this->subject_full = __( 'Your {site_title} order from {order_date} has been refunded', 'woocommerce' );
$this->heading_full = __( 'Your order has been fully refunded', 'woocommerce' );
$this->heading_partial = __( 'Your order has been partially refunded', 'woocommerce' );
if ( $partial_refund ) {
$this->heading = __( 'Your order has been partially refunded', 'woocommerce' );
$this->subject = __( 'Your {site_title} order from {order_date} has been partially refunded', 'woocommerce' );
$this->id = 'customer_partially_refunded_order';
$this->title = __( 'Partially Refunded order', 'woocommerce' );
$this->description = __( 'Order partially refunded emails are sent to customers when their orders are partially refunded.', 'woocommerce' );
$this->template_html = 'emails/customer-refunded-order.php';
$this->template_plain = 'emails/plain/customer-refunded-order.php';
$this->heading = $this->heading_partial;
$this->subject = $this->subject_partial;
}
else {
$this->heading = __( 'Your order has been refunded', 'woocommerce' );
$this->subject = __( 'Your {site_title} order from {order_date} has been refunded', 'woocommerce' );
$this->id = 'customer_refunded_order';
$this->title = __( 'Refunded order', 'woocommerce' );
$this->description = __( 'Order refunded emails are sent to customers when their orders are marked refunded.', 'woocommerce' );
$this->template_html = 'emails/customer-refunded-order.php';
$this->template_plain = 'emails/plain/customer-refunded-order.php';
$this->heading = $this->heading_full;
$this->subject = $this->subject_full;
}
}
@ -164,17 +174,31 @@ class WC_Email_Customer_Refunded_Order extends WC_Email {
'label' => __( 'Enable this email notification', 'woocommerce' ),
'default' => 'yes'
),
'subject' => array(
'title' => __( 'Subject', 'woocommerce' ),
'subject_full' => array(
'title' => __( 'Full Refund Subject', 'woocommerce' ),
'type' => 'text',
'description' => sprintf( __( 'Defaults to <code>%s</code>', 'woocommerce' ), $this->subject ),
'description' => sprintf( __( 'Defaults to <code>%s</code>', 'woocommerce' ), $this->subject_full ),
'placeholder' => '',
'default' => ''
'default' => $this->subject_full
),
'heading' => array(
'title' => __( 'Email Heading', 'woocommerce' ),
'subject_partial' => array(
'title' => __( 'Partial Refund Subject', 'woocommerce' ),
'type' => 'text',
'description' => sprintf( __( 'Defaults to <code>%s</code>', 'woocommerce' ), $this->heading ),
'description' => sprintf( __( 'Defaults to <code>%s</code>', 'woocommerce' ), $this->subject_partial ),
'placeholder' => '',
'default' => $this->subject_partial
),
'heading_full' => array(
'title' => __( 'Full Refund Email Heading', 'woocommerce' ),
'type' => 'text',
'description' => sprintf( __( 'Defaults to <code>%s</code>', 'woocommerce' ), $this->heading_full ),
'placeholder' => '',
'default' => $this->heading_full
),
'heading_partial' => array(
'title' => __( 'Partial Refund Email Heading', 'woocommerce' ),
'type' => 'text',
'description' => sprintf( __( 'Defaults to <code>%s</code>', 'woocommerce' ), $this->heading_partial ),
'placeholder' => '',
'default' => ''
),