| 1 |
<?php |
| 2 |
|
| 3 |
defined( 'ABSPATH' ) || exit; |
| 4 |
use YayMail\Helper\Helper; |
| 5 |
|
| 6 |
$sent_to_admin = ( isset( $sent_to_admin ) ? true : false ); |
| 7 |
$email = ( isset( $email ) ? $email : '' ); |
| 8 |
$plain_text = ( isset( $plain_text ) ? $plain_text : '' ); |
| 9 |
$text_align = is_rtl() ? 'right' : 'left'; |
| 10 |
// Instructions Payment |
| 11 |
$paymentGateways = wc_get_payment_gateway_by_order( $order ); |
| 12 |
$yaymail_settings = get_option( 'yaymail_settings' ); |
| 13 |
$cash_on_delivery = esc_html__( 'Cash on delivery', 'woocommerce' ); |
| 14 |
if ( 'customer_on_hold_order' === $this->template |
| 15 |
&& 2 == $yaymail_settings['payment'] |
| 16 |
|| ( Helper::checkKeyExist( $paymentGateways, 'method_title', false ) == $cash_on_delivery |
| 17 |
&& 'cancelled_order' != $this->template |
| 18 |
&& 'new_order' != $this->template |
| 19 |
&& 'failed_order' != $this->template |
| 20 |
&& 'customer_refunded_order' != $this->template |
| 21 |
&& 'customer_new_account' != $this->template |
| 22 |
&& 'customer_reset_password' != $this->template ) |
| 23 |
) {?> |
| 24 |
|
| 25 |
<p class="yaymail_builder_instructions"><?php esc_html_e( isset( $paymentGateways->instructions ) ? $paymentGateways->instructions : '', 'woocommerce' ); ?></p> |
| 26 |
|
| 27 |
<?php |
| 28 |
} elseif ( 1 == $yaymail_settings['payment'] ) { |
| 29 |
?> |
| 30 |
|
| 31 |
<p class="yaymail_builder_instructions"><?php esc_html_e( isset( $paymentGateways->instructions ) ? $paymentGateways->instructions : '', 'woocommerce' ); ?></p> |
| 32 |
|
| 33 |
<?php |
| 34 |
} |
| 35 |
|
| 36 |
/* |
| 37 |
Our bank details |
| 38 |
payment: Direct bank transfer |
| 39 |
*/ |
| 40 |
if ( false != $paymentGateways && isset( $paymentGateways->account_details ) ) { |
| 41 |
$account_details = $paymentGateways->account_details; |
| 42 |
$texts = array( |
| 43 |
'bank_name' => 'Bank', |
| 44 |
'account_number' => 'Account number', |
| 45 |
'sort_code' => 'Sort code', |
| 46 |
'iban' => 'IBAN', |
| 47 |
'bic' => 'BIC', |
| 48 |
); |
| 49 |
$direct_bank_transfer = esc_html__( 'Direct bank transfer', 'woocommerce' ); |
| 50 |
if ( 'customer_on_hold_order' === $this->template |
| 51 |
&& Helper::checkKeyExist( $paymentGateways, 'method_title', false ) == $direct_bank_transfer |
| 52 |
&& is_array( $account_details ) |
| 53 |
&& count( $account_details ) > 0 |
| 54 |
&& 1 == $yaymail_settings['payment'] |
| 55 |
) { |
| 56 |
?> |
| 57 |
|
| 58 |
<section class="yaymail_builder_wrap_account"> |
| 59 |
<h2 class="yaymail_builder_bank_details"><?php esc_html_e( 'Our bank details', 'woocommerce' ); ?></h2> |
| 60 |
<?php |
| 61 |
foreach ( $account_details as $accounts ) { |
| 62 |
foreach ( $accounts as $label_name => $infor_account ) { |
| 63 |
if ( 'account_name' === $label_name && ! empty( $infor_account ) ) { |
| 64 |
?> |
| 65 |
<h3 class="yaymail_builder_account_name"> <?php esc_html_e( $infor_account, 'woocommerce' ); ?> </h3> |
| 66 |
<?php |
| 67 |
} |
| 68 |
} |
| 69 |
?> |
| 70 |
|
| 71 |
<ul> |
| 72 |
<?php |
| 73 |
foreach ( $accounts as $label_name => $infor_account ) { |
| 74 |
if ( 'account_name' !== $label_name && ! empty( $infor_account ) ) { |
| 75 |
?> |
| 76 |
<li><?php esc_html_e( $texts[ $label_name ], 'woocommerce' ); ?>: |
| 77 |
<strong><?php esc_html_e( $infor_account, 'woocommerce' ); ?></strong> |
| 78 |
</li> |
| 79 |
<?php |
| 80 |
} |
| 81 |
} |
| 82 |
?> |
| 83 |
</ul> |
| 84 |
|
| 85 |
<?php } ?> |
| 86 |
</section> |
| 87 |
<?php |
| 88 |
} |
| 89 |
} |
| 90 |
?> |
| 91 |
|
| 92 |
<!-- Title Table Order --> |
| 93 |
<h2 class="yaymail_builder_order"> |
| 94 |
<?php |
| 95 |
if ( $sent_to_admin ) { |
| 96 |
$before = '<a class="yaymail_builder_link" href="' . esc_url( $order->get_edit_order_url() ) . '">'; |
| 97 |
$after = '</a>'; |
| 98 |
/* translators: %s: Order ID. */ |
| 99 |
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() ) ) ); |
| 100 |
} else { |
| 101 |
$before = ''; |
| 102 |
$after = ''; |
| 103 |
/* translators: %s: Order ID. */ |
| 104 |
echo wp_kses_post( $before . sprintf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ) ); |
| 105 |
} |
| 106 |
|
| 107 |
?> |
| 108 |
</h2> |
| 109 |
|
| 110 |
<!-- Table Items not border --> |
| 111 |
<table class="yaymail_builder_table_items" cellspacing="0" cellpadding="6" style="width: 100% !important;" width="100%"> |
| 112 |
<thead> |
| 113 |
<tr style="word-break: normal"> |
| 114 |
<th class="td" scope="col" style="text-align:left;"> |
| 115 |
<?php esc_html_e( 'Product', 'woocommerce' ); ?> |
| 116 |
</th> |
| 117 |
<th class="td" scope="col" style="text-align:left;"> |
| 118 |
<?php esc_html_e( 'Quantity', 'woocommerce' ); ?> |
| 119 |
</th> |
| 120 |
<th class="td" scope="col" style="text-align:left; width: 30%;"> |
| 121 |
<?php esc_html_e( 'Price', 'woocommerce' ); ?> |
| 122 |
</th> |
| 123 |
</tr> |
| 124 |
</thead> |
| 125 |
|
| 126 |
<tbody> |
| 127 |
<?php |
| 128 |
echo wp_kses_post( |
| 129 |
$this->ordetItemTables( |
| 130 |
$order, |
| 131 |
array( |
| 132 |
'show_sku' => $sent_to_admin, |
| 133 |
'show_image' => false, |
| 134 |
'image_size' => array( 32, 32 ), |
| 135 |
'plain_text' => $plain_text, |
| 136 |
'sent_to_admin' => $sent_to_admin, |
| 137 |
) |
| 138 |
) |
| 139 |
); |
| 140 |
|
| 141 |
|
| 142 |
?> |
| 143 |
</tbody> |
| 144 |
|
| 145 |
<tfoot> |
| 146 |
<?php |
| 147 |
$totalItem = $order->get_order_item_totals(); |
| 148 |
$i = 0; |
| 149 |
foreach ( $totalItem as $key => $total ) { |
| 150 |
$i++; |
| 151 |
?> |
| 152 |
|
| 153 |
<tr> |
| 154 |
<th class="td" scope="row" colspan="2" style="text-align:left; <?php echo esc_attr( ( 1 === $i ) ? 'border-top-width: 4px;' : '' ); ?>"> |
| 155 |
<?php echo esc_html( $total['label'] ); ?> |
| 156 |
</th> |
| 157 |
<td class="td" style="text-align:left; <?php echo esc_attr( ( 1 === $i ) ? 'border-top-width: 4px;' : '' ); ?>"> |
| 158 |
<?php echo wp_kses_post( $total['value'] ); ?> |
| 159 |
</td> |
| 160 |
</tr> |
| 161 |
|
| 162 |
<?php |
| 163 |
} |
| 164 |
|
| 165 |
|
| 166 |
if ( ! empty( $order->get_customer_note() ) ) { |
| 167 |
$note = $order->get_customer_note(); |
| 168 |
?> |
| 169 |
|
| 170 |
<tr> |
| 171 |
<th class="td" scope="row" colspan="2" style="text-align:left; <?php echo esc_attr( ( 1 === $i ) ? 'border-top-width: 4px;' : '' ); ?>"> |
| 172 |
<?php esc_html_e( 'Note:', 'woocommerce' ); ?> |
| 173 |
</th> |
| 174 |
<td class="td" style="text-align:left; <?php echo esc_attr( ( 1 === $i ) ? 'border-top-width: 4px;' : '' ); ?>"> |
| 175 |
<?php echo esc_html( $note ); ?> |
| 176 |
</td> |
| 177 |
</tr> |
| 178 |
|
| 179 |
<?php } ?> |
| 180 |
</tfoot> |
| 181 |
</table> |
| 182 |
|
| 183 |
<?php do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text, $email ); ?> |
| 184 |
|