| 1 |
<?php |
| 2 |
namespace YayMail\Templates\DefaultTemplate; |
| 3 |
|
| 4 |
defined( 'ABSPATH' ) || exit; |
| 5 |
|
| 6 |
class CustomerInvoice { |
| 7 |
|
| 8 |
protected static $instance = null; |
| 9 |
|
| 10 |
public static function getInstance() { |
| 11 |
if ( null == self::$instance ) { |
| 12 |
self::$instance = new self(); |
| 13 |
} |
| 14 |
|
| 15 |
return self::$instance; |
| 16 |
} |
| 17 |
|
| 18 |
public static function getTemplates() { |
| 19 |
/* |
| 20 |
@@@ Html default send email. |
| 21 |
@@@ Note: Add characters '\' before special characters in a string. |
| 22 |
@@@ Example: font-family: \'Helvetica Neue\'... |
| 23 |
*/ |
| 24 |
$emailTitle = __( 'Your invoice for order #{order_number}', 'woocommerce' ); |
| 25 |
$emailTitle = str_replace( '#{order_number}', '', $emailTitle ); |
| 26 |
$emailHi = esc_html__( 'Hi ', 'woocommerce' ) . esc_html( do_shortcode( '[yaymail_billing_first_name]' ) . ',' ); |
| 27 |
$emailtext = esc_html__( 'Here are the details of your order placed on ', 'woocommerce' ) . esc_html( do_shortcode( '[yaymail_order_date]' ) . ',' ); |
| 28 |
$additionalContent = __( 'Thanks for using {site_url}!', 'woocommerce' ); |
| 29 |
$additionalContent = str_replace( '{site_url}!', '', $additionalContent ); |
| 30 |
$textShippingAddress = __( 'Shipping Address', 'woocommerce' ); |
| 31 |
$textBillingAddress = __( 'Billing Address', 'woocommerce' ); |
| 32 |
|
| 33 |
// Html |
| 34 |
$html = ' |
| 35 |
<html> |
| 36 |
<head> |
| 37 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| 38 |
</head> |
| 39 |
<body style="background: rgb(236, 236, 236); padding: 0;"> |
| 40 |
<table width="605px" cellspacing="0" cellpadding="0" border="0" align="center" id="web8ffa62b5-7258-42cc-ba53-7ae69638c1fe" class="web-main-row" style="display: table; background-color: rgb(236, 236, 236); width: 605px;"> |
| 41 |
<tbody > |
| 42 |
<tr > |
| 43 |
<td id="web8ffa62b5-7258-42cc-ba53-7ae69638c1fe-img" align="center" class="web-img-wrap" style="word-break: break-word; padding: 15px 50px;"><a href="#" target="_blank" style="border: none; text-decoration: none;"><img border="0" tabindex="0" src="' . YAYMAIL_PLUGIN_URL . 'assets/dist/images/woocommerce-logo.png" class="web-img" width="172" height="auto"></a></td> |
| 44 |
</tr> |
| 45 |
</tbody> |
| 46 |
</table> |
| 47 |
<table width="605px" cellspacing="0" cellpadding="0" border="0" align="center" id="web802bfe24-7af8-48af-ac5e-6560a81345b3" class="web-main-row" style="display: table; background-color: #96588a; width: 605px;"> |
| 48 |
<tbody > |
| 49 |
<tr > |
| 50 |
<td id="web802bfe24-7af8-48af-ac5e-6560a81345b3-shipping-address" align="left" class="web-shipping-address" style="font-size: 13px; line-height: 22px; word-break: break-word; font-family: Helvetica, Roboto, Arial, sans-serif; padding: 36px 48px;"> |
| 51 |
<div > |
| 52 |
<h1 style="font-size: 30px; font-weight: 300; line-height: normal; margin: 0; color: #fff;">Your invoice for order: #[yaymail_order_id]</h1> |
| 53 |
</div> |
| 54 |
</td> |
| 55 |
</tr> |
| 56 |
</tbody> |
| 57 |
</table> |
| 58 |
<table width="605px" cellspacing="0" cellpadding="0" border="0" align="center" id="webb035d1f1-0cfe-41c5-b79c-0478f144ef5f" class="web-main-row" style="display: table; background-color: rgb(255, 255, 255); width: 605px;"> |
| 59 |
<tbody > |
| 60 |
<tr > |
| 61 |
<td id="webb035d1f1-0cfe-41c5-b79c-0478f144ef5f-shipping-address" align="left" class="web-shipping-address" style="font-size: 13px; line-height: 22px; word-break: break-word; font-family: Helvetica, Roboto, Arial, sans-serif; padding: 47px 50px 0px;"> |
| 62 |
<div > |
| 63 |
<p style="margin: 0 0 16px;"><span style="color: #636363; font-size: 14px;">' . $emailHi . '</span></p> |
| 64 |
<p style="margin: 0 0 16px;"><span style="color: #636363; font-size: 14px;">Here are the details of your order placed on [yaymail_order_date]</span></p> |
| 65 |
</div> |
| 66 |
</td> |
| 67 |
</tr> |
| 68 |
</tbody> |
| 69 |
</table> |
| 70 |
<table width="605px" cellspacing="0" cellpadding="0" border="0" align="center" id="webad422370-f762-4a26-92de-c4cf3821b8eb" class="web-main-row" style="display: table; background-color: rgb(255, 255, 255); width: 605px;"> |
| 71 |
<tbody > |
| 72 |
<tr > |
| 73 |
<td id="web-ad422370-f762-4a26-92de-c4cf3821b8eb-order-item" align="left" class="web-order-item" style="font-size: 13px; line-height: 22px; word-break: break-word; font-family: Helvetica, Roboto, Arial, sans-serif; padding: 2px 50px 15px;"> |
| 74 |
<div class="yaymail_items_border_default" style="color: rgb(99, 99, 99);border-color: #e5e5e5;"> |
| 75 |
<p></p> |
| 76 |
[yaymail_items_border] |
| 77 |
<p></p> |
| 78 |
</div> |
| 79 |
</td> |
| 80 |
</tr> |
| 81 |
</tbody> |
| 82 |
</table>'; |
| 83 |
if ( class_exists( 'WC_Subscription' ) ) { |
| 84 |
$html .= '<table width="605px" cellspacing="0" cellpadding="0" border="0" align="center" id="weso422370-f762-4a26-92de-c4cf3821b8eb" class="web-main-row" style="display: table; background-color: rgb(255, 255, 255); width: 605px;"> |
| 85 |
<tbody> |
| 86 |
<tr> |
| 87 |
<td id="web-so422370-f762-4a26-92de-c4cf3821b8eb-order-item" align="left" class="web-order-item" style="font-size: 13px; line-height: 22px; word-break: break-word; font-family: Helvetica, Roboto, Arial, sans-serif; padding: 15px 50px;"> |
| 88 |
<div style="color: rgb(99, 99, 99);border-color: #e5e5e5;"> |
| 89 |
<p></p> |
| 90 |
[yaymail_items_subscription_information] |
| 91 |
<p></p> |
| 92 |
</div> |
| 93 |
</td> |
| 94 |
</tr> |
| 95 |
</tbody> |
| 96 |
</table>'; |
| 97 |
} |
| 98 |
$html .= '<table width="605px" cellspacing="0" cellpadding="0" border="0" align="center" id="webf0a42dc3-af51-4452-a9e6-a640ea8829b0" class="web-main-row" style="display: table; background-color: rgb(255, 255, 255); width: 605px;"> |
| 99 |
<tbody > |
| 100 |
<tr > |
| 101 |
<td id="web-f0a42dc3-af51-4452-a9e6-a640ea8829b0-billing-address" align="left" class="web-billing-address" style="font-size: 13px; line-height: 22px; word-break: break-word; font-family: Helvetica, Roboto, Arial, sans-serif; padding: 12px 50px 15px;"> |
| 102 |
<div style="color: rgb(99, 99, 99);"> |
| 103 |
<p></p> |
| 104 |
[yaymail_billing_shipping_address] |
| 105 |
<p></p> |
| 106 |
</div> |
| 107 |
</td> |
| 108 |
</tr> |
| 109 |
</tbody> |
| 110 |
</table> |
| 111 |
<table width="605px" cellspacing="0" cellpadding="0" border="0" align="center" id="webb39bf2e6-8c1a-4384-a5ec-37663da27c8d" class="web-main-row" style="display: table; background-color: rgb(255, 255, 255); width: 605px;"> |
| 112 |
<tbody > |
| 113 |
<tr > |
| 114 |
<td id="webb39bf2e6-8c1a-4384-a5ec-37663da27c8d-shipping-address" align="left" class="web-shipping-address" style="font-size: 13px; line-height: 22px; word-break: break-word; font-family: Helvetica, Roboto, Arial, sans-serif; padding-bottom: 38px; padding-right: 50px; padding-left: 50px;"> |
| 115 |
<div > |
| 116 |
<p><span style="font-size: 14px; color: #636363;">' . $additionalContent . '[yaymail_domain]!</span></p> |
| 117 |
</div> |
| 118 |
</td> |
| 119 |
</tr> |
| 120 |
</tbody> |
| 121 |
</table> |
| 122 |
<table width="605px" cellspacing="0" cellpadding="0" border="0" align="center" id="web964bb3b1-2e11-4eb1-a2b0-440c8da21257" class="web-main-row" style="display: table; background-color: rgb(236, 236, 236); width: 605px;"> |
| 123 |
<tbody > |
| 124 |
<tr > |
| 125 |
<td id="web964bb3b1-2e11-4eb1-a2b0-440c8da21257-shipping-address" align="left" class="web-shipping-address" style="font-size: 13px; line-height: 22px; word-break: break-word; font-family: Verdana, Geneva, sans-serif; padding: 15px 50px;"> |
| 126 |
<div > |
| 127 |
<p style="font-size: 14px; color: #8a8a8a; margin: 0px 0px 16px; text-align: center;">[yaymail_site_name] - Built with <a style="color: #96588a; font-weight: normal; text-decoration: underline;" href="https://woocommerce.com" target="_blank" rel="noopener" draggable="false">WooCommerce</a></p> |
| 128 |
</div> |
| 129 |
</td> |
| 130 |
</tr> |
| 131 |
</tbody> |
| 132 |
</table> |
| 133 |
</body> |
| 134 |
</html> |
| 135 |
'; |
| 136 |
|
| 137 |
/* |
| 138 |
@@@ Elements default when reset template. |
| 139 |
@@@ Note 1: Add characters '\' before special characters in a string. |
| 140 |
@@@ example 1: "family": "\'Helvetica Neue\',Helvetica,Roboto,Arial,sans-serif", |
| 141 |
|
| 142 |
@@@ Note 2: Add characters '\' before special characters in a string. |
| 143 |
@@@ example 2: "<h1 style=\"font-family: \'Helvetica Neue\',...." |
| 144 |
*/ |
| 145 |
|
| 146 |
// Elements |
| 147 |
$elements = |
| 148 |
'[{ |
| 149 |
"id": "8ffa62b5-7258-42cc-ba53-7ae69638c1fe", |
| 150 |
"type": "Logo", |
| 151 |
"nameElement": "Logo", |
| 152 |
"settingRow": { |
| 153 |
"backgroundColor": "#ECECEC", |
| 154 |
"align": "center", |
| 155 |
"pathImg": "", |
| 156 |
"paddingTop": "15", |
| 157 |
"paddingRight": "50", |
| 158 |
"paddingBottom": "15", |
| 159 |
"paddingLeft": "50", |
| 160 |
"width": "172", |
| 161 |
"url": "#" |
| 162 |
} |
| 163 |
}, { |
| 164 |
"id": "802bfe24-7af8-48af-ac5e-6560a81345b3", |
| 165 |
"type": "ElementText", |
| 166 |
"nameElement": "Email Heading", |
| 167 |
"settingRow": { |
| 168 |
"content": "<h1 style=\"font-size: 30px; font-weight: 300; line-height: normal; margin: 0; color: inherit;\">Your invoice for order: #[yaymail_order_id]</h1>", |
| 169 |
"backgroundColor": "#96588A", |
| 170 |
"textColor": "#ffffff", |
| 171 |
"family": "Helvetica,Roboto,Arial,sans-serif", |
| 172 |
"paddingTop": "36", |
| 173 |
"paddingRight": "48", |
| 174 |
"paddingBottom": "36", |
| 175 |
"paddingLeft": "48" |
| 176 |
} |
| 177 |
}, { |
| 178 |
"id": "b035d1f1-0cfe-41c5-b79c-0478f144ef5f", |
| 179 |
"type": "ElementText", |
| 180 |
"nameElement": "Text", |
| 181 |
"settingRow": { |
| 182 |
"content": "<p style=\"margin: 0px;\"><span style=\"font-size: 14px;\">' . $emailHi . '<br /><br /></span></p>\n<p style=\"margin: 0px;\"><span style=\"font-size: 14px;\">Here are the details of your order placed on [yaymail_order_date]</span></p>", |
| 183 |
"backgroundColor": "#fff", |
| 184 |
"textColor": "#636363", |
| 185 |
"family": "Helvetica,Roboto,Arial,sans-serif", |
| 186 |
"paddingTop": "47", |
| 187 |
"paddingRight": "50", |
| 188 |
"paddingBottom": "0", |
| 189 |
"paddingLeft": "50" |
| 190 |
} |
| 191 |
}, |
| 192 |
{ |
| 193 |
"id": "ad422370-f762-4a26-92de-c4cf3878h0oi", |
| 194 |
"type": "OrderItem", |
| 195 |
"nameElement": "Order Item", |
| 196 |
"settingRow": { |
| 197 |
"contentBefore": "[yaymail_items_border_before]", |
| 198 |
"contentAfter": "[yaymail_items_border_after]", |
| 199 |
"contentTitle": "[yaymail_items_border_title]", |
| 200 |
"content": "[yaymail_items_border_content]", |
| 201 |
"backgroundColor": "#fff", |
| 202 |
"titleColor" : "#96588a", |
| 203 |
"textColor": "#636363", |
| 204 |
"borderColor": "#e5e5e5", |
| 205 |
"family": "Helvetica,Roboto,Arial,sans-serif", |
| 206 |
"paddingTop": "15", |
| 207 |
"paddingRight": "50", |
| 208 |
"paddingBottom": "15", |
| 209 |
"paddingLeft": "50" |
| 210 |
} |
| 211 |
},'; |
| 212 |
if ( class_exists( 'WC_Subscription' ) ) { |
| 213 |
$elements .= '{ |
| 214 |
"id": "os422370-f762-4a26-92de-c4cf3878h0oi", |
| 215 |
"type": "OrderSubscription", |
| 216 |
"nameElement": "Order Subscription", |
| 217 |
"settingRow": { |
| 218 |
"content" : "[yaymail_items_subscription_information]", |
| 219 |
"backgroundColor" : "#fff", |
| 220 |
"titleColor" : "#96588a", |
| 221 |
"textColor" : "#636363", |
| 222 |
"borderColor" : "#e5e5e5", |
| 223 |
"family" : "Helvetica,Roboto,Arial,sans-serif", |
| 224 |
"paddingTop" : "15", |
| 225 |
"paddingRight" : "50", |
| 226 |
"paddingBottom" : "15", |
| 227 |
"paddingLeft" : "50" |
| 228 |
} |
| 229 |
},'; |
| 230 |
} |
| 231 |
$elements .= '{ |
| 232 |
"id": "de242956-a617-4213-9107-138842oi4tch", |
| 233 |
"type": "BillingAddress", |
| 234 |
"nameElement": "Billing Shipping Address", |
| 235 |
"settingRow": { |
| 236 |
"nameColumn": "BillingShippingAddress", |
| 237 |
"contentTitle": "[yaymail_billing_shipping_address_title]", |
| 238 |
"checkBillingShipping": "[yaymail_billing_shipping_address_title]", |
| 239 |
"titleBilling": "' . $textBillingAddress . '", |
| 240 |
"titleShipping": "' . $textShippingAddress . '", |
| 241 |
"content": "[yaymail_billing_shipping_address_content]", |
| 242 |
"titleColor" : "#96588a", |
| 243 |
"backgroundColor": "#fff", |
| 244 |
"borderColor": "#e5e5e5", |
| 245 |
"textColor": "#636363", |
| 246 |
"family": "Helvetica,Roboto,Arial,sans-serif", |
| 247 |
"paddingTop": "15", |
| 248 |
"paddingRight": "50", |
| 249 |
"paddingBottom": "15", |
| 250 |
"paddingLeft": "50" |
| 251 |
} |
| 252 |
}, |
| 253 |
{ |
| 254 |
"id": "b39bf2e6-8c1a-4384-a5ec-37663da27c8d", |
| 255 |
"type": "ElementText", |
| 256 |
"nameElement": "Footer", |
| 257 |
"settingRow": { |
| 258 |
"content": "<p><span style=\"font-size: 14px;\">' . $additionalContent . '[yaymail_domain]!</span></p>", |
| 259 |
"backgroundColor": "#fff", |
| 260 |
"textColor": "#636363", |
| 261 |
"family": "Helvetica,Roboto,Arial,sans-serif", |
| 262 |
"paddingTop": "", |
| 263 |
"paddingRight": "50", |
| 264 |
"paddingBottom": "38", |
| 265 |
"paddingLeft": "50" |
| 266 |
} |
| 267 |
}, |
| 268 |
{ |
| 269 |
"id": "b39bf2e6-8c1a-4384-a5ec-37663da27c8ds", |
| 270 |
"type": "ElementText", |
| 271 |
"nameElement": "Footer", |
| 272 |
"settingRow": { |
| 273 |
"content": "<p style=\"font-size: 14px;margin: 0px 0px 16px; text-align: center;\">[yaymail_site_name] - Built with <a style=\"color: #96588a; font-weight: normal; text-decoration: underline;\" href=\"https://woocommerce.com\" target=\"_blank\" rel=\"noopener\">WooCommerce</a></p>", |
| 274 |
"backgroundColor": "#ececec", |
| 275 |
"textColor": "#8a8a8a", |
| 276 |
"family": "Helvetica,Roboto,Arial,sans-serif", |
| 277 |
"paddingTop": "15", |
| 278 |
"paddingRight": "50", |
| 279 |
"paddingBottom": "15", |
| 280 |
"paddingLeft": "50" |
| 281 |
} |
| 282 |
}]'; |
| 283 |
|
| 284 |
// Templates New Order |
| 285 |
$templates = array( |
| 286 |
'customer_invoice' => array(), |
| 287 |
); |
| 288 |
|
| 289 |
$templates['customer_invoice']['html'] = $html; |
| 290 |
$templates['customer_invoice']['elements'] = $elements; |
| 291 |
return $templates; |
| 292 |
} |
| 293 |
} |
| 294 |
|