1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
|
<?php
defined( 'ABSPATH' ) || exit; use YayMail\Page\Source\CustomPostType; $sent_to_admin = ( isset( $sent_to_admin ) ? $sent_to_admin : false ); $email = ( isset( $email ) ? $email : '' ); $plain_text = ( isset( $plain_text ) ? $plain_text : '' ); $text_align = is_rtl() ? 'right' : 'left'; $postID = CustomPostType::postIDByTemplate( $this->template ); $text_link_color = get_post_meta( $postID, '_yaymail_email_textLinkColor_settings', true ) ? get_post_meta( $postID, '_yaymail_email_textLinkColor_settings', true ) : '#7f54b3'; // instructions payment $paymentGateways = wc_get_payment_gateway_by_order( $order ); $yaymail_settings = get_option( 'yaymail_settings' ); $cash_on_delivery = esc_html__( 'Cash on delivery', 'woocommerce' ); $productItemCost = isset( $yaymail_settings['product_item_cost'] ) ? $yaymail_settings['product_item_cost'] : 0;
if ( ( 'customer_on_hold_order' === $this->template || 'customer_processing_order' === $this->template || 'customer_completed_order' === $this->template || 'customer_refunded_order' === $this->template || 'customer_invoice' === $this->template || 'customer_note' === $this->template || 'customer_partial_shipped_order' === $this->template || 'customer_shipped_order' === $this->template ) && 2 == $yaymail_settings['payment'] || ( isset( $paymentGateways->method_title ) ? $cash_on_delivery == $paymentGateways->method_title : false && 'cancelled_order' != $this->template && 'new_order' != $this->template && 'failed_order' != $this->template && 'customer_new_account' != $this->template && 'customer_reset_password' != $this->template ) ) {?>
<p style="text-align: <?php echo esc_attr( $text_align ); ?>; margin: 0 0 16px;" class="yaymail_builder_instructions"> <?php echo wp_kses_post( isset( $paymentGateways->instructions ) ? $paymentGateways->instructions : '', 'woocommerce' ); ?> </p>
<?php } elseif ( 1 == $yaymail_settings['payment'] ) { ?>
<p style="margin: 0 0 16px;" class="yaymail_builder_instructions"> <?php echo wp_kses_post( isset( $paymentGateways->instructions ) ? $paymentGateways->instructions : '', 'woocommerce' ); ?> </p>
<?php }
/* Our bank details payment: Direct bank transfer */ if ( false != $paymentGateways && isset( $paymentGateways->account_details ) ) { $account_details = $paymentGateways->account_details; $texts = array( 'bank_name' => 'Bank', 'account_number' => 'Account number', 'sort_code' => 'Sort code', 'iban' => 'IBAN', 'bic' => 'BIC', ); $direct_bank_transfer = esc_html__( 'Direct bank transfer', 'woocommerce' );
if ( ( 'customer_on_hold_order' === $this->template || 'customer_processing_order' === $this->template || 'customer_completed_order' === $this->template || 'customer_refunded_order' === $this->template || 'customer_invoice' === $this->template || 'customer_note' === $this->template || 'customer_partial_shipped_order' === $this->template || 'customer_shipped_order' === $this->template ) && $direct_bank_transfer == $paymentGateways->method_title && is_array( $account_details ) && count( $account_details ) > 0 && 1 == $yaymail_settings['payment'] ) { ?>
<section style="text-align: ' . $text_align . '" class="yaymail_builder_wrap_account"> <h2 class="yaymail_builder_bank_details" style="color: #7f54b3;"> <?php esc_html_e( 'Our bank details', 'woocommerce' ); ?> </h2>
<?php foreach ( $account_details as $accounts ) { foreach ( $accounts as $label_name => $infor_account ) { if ( 'account_name' === $label_name && ! empty( $infor_account ) ) { ?> <h3 class="yaymail_builder_account_name" style="color: #7f54b3;"> <?php esc_html_e( $infor_account, 'woocommerce' ); ?> </h3> <?php } } ?>
<ul> <?php foreach ( $accounts as $label_name => $infor_account ) { if ( 'account_name' !== $label_name && ! empty( $infor_account ) ) { ?>
<li><?php esc_html_e( $texts[ $label_name ], 'woocommerce' ); ?>: <strong><?php esc_html_e( $infor_account, 'woocommerce' ); ?></strong> </li>
<?php } } ?> </ul>
<?php } ?>
</section> <?php } } ?>
<!-- Title Table Order Items --> <?php if ( $is_display ) { ?> <div class="yaymail_builder_order" style="color: #7f54b3;font-size: 18px;font-weight: 700;"> <?php if ( $sent_to_admin ) { $before = '<a style="font-weight: normal;color: ' . esc_attr( $text_link_color ) . '" class="yaymail_builder_link" href="' . esc_url( $order->get_edit_order_url() ) . '">'; $after = '</a>'; /* translators: %s: Order ID. */ echo wp_kses_post( $before . sprintf( __( '[Order #%s]', 'woocommerce' ) . $after . ' (<time datetime="%s">%s</time>)', $order->get_order_number(), $order->get_date_created()->format( 'c' ), wc_format_datetime( $order->get_date_created() ) ) ); } else { $before = '<h2 style="font-weight: normal;' . esc_attr( $text_link_color ) . '" class="yaymail_builder_link" >'; $after = '</h2>'; /* translators: %s: Order ID. */ echo wp_kses_post( $before . sprintf( __( '[Order #%s]', 'woocommerce' ) . ' (<time datetime="%s">%s</time>)', $order->get_order_number(), $order->get_date_created() != null ? $order->get_date_created()->format( 'c' ) : '', wc_format_datetime( $order->get_date_created() ) ) . $after ); } ?> </div> <?php } ?>
<!-- Table Items has Border --> <table class="yaymail_builder_table_items_content yaymail-list-order-item" cellspacing="0" cellpadding="6" border="1" style="border-collapse: separate; color: #636363; border: 1px solid #e5e5e5; font-family: Helvetica,Roboto,Arial,sans-serif;" width="100%"> <thead> <tr style="word-break: normal"> <th class="td yaymail-title-item-product" scope="col" style="text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border: 1px solid;border-color: inherit;"> <?php esc_html_e( 'Product', 'woocommerce' ); ?> </th> <?php if ( $productItemCost ) { ?> <th class="td yaymail_item_price_per_item" scope="col" style="text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border: 1px solid;border-color: inherit;"> <?php esc_html_e( 'Cost', 'woocommerce' ); ?> </th> <?php } ?> <th class="td yaymail-title-item-quantity" scope="col" style="text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border: 1px solid;border-color: inherit;"> <?php esc_html_e( 'Quantity', 'woocommerce' ); ?> </th> <th class="td yaymail-title-item-price" scope="col" style="width: 30%;text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border: 1px solid;border-color: inherit;"> <?php esc_html_e( 'Price', 'woocommerce' ); ?> </th> </tr> </thead>
<tbody style="flex-direction:inherit;" > <?php $order_item_html = $this->ordetItemTables( $order, array( 'show_sku' => $sent_to_admin, 'show_image' => false, 'image_size' => array( 32, 32 ), 'plain_text' => $plain_text, 'sent_to_admin' => $sent_to_admin, ) );
if ( ! empty( $order_item_html ) ) { echo wp_kses_post( $order_item_html ); }
?> </tbody>
<tfoot> <?php if ( $is_display ) { $totalItem = $order->get_order_item_totals(); $i = 0; foreach ( $totalItem as $key => $total ) { $i++; ?>
<tr> <th class="td" scope="row" colspan="<?php echo esc_attr( $productItemCost ? 3 : 2 ); ?>" style="text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border: 1px solid;border-color: inherit; <?php echo esc_attr( ( 1 === $i ) ? 'border-top-width: 4px;' : '' ); ?>"> <?php echo esc_html( $total['label'] ); ?> </th> <td class="td" style="text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border: 1px solid;border-color: inherit; <?php echo esc_attr( ( 1 === $i ) ? 'border-top-width: 4px;' : '' ); ?>"> <?php echo wp_kses_post( $total['value'] ); ?> </td> </tr>
<?php }
if ( ! empty( $order->get_customer_note() ) ) { $note = $order->get_customer_note(); ?>
<tr> <th class="td" scope="row" colspan="<?php echo esc_attr( $productItemCost ? 3 : 2 ); ?>" style="text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border: 1px solid;border-color: inherit; <?php echo esc_attr( ( 1 === $i ) ? 'border-top-width: 4px;' : '' ); ?>"> <?php esc_html_e( 'Note:', 'woocommerce' ); ?> </th> <td class="td" style="text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border: 1px solid;border-color: inherit; <?php echo esc_attr( ( 1 === $i ) ? 'border-top-width: 4px;' : '' ); ?>"> <?php echo esc_html( $note ); ?> </td> </tr>
<?php } } ?> </tfoot> </table>
|