| 1 |
<?php |
| 2 |
|
| 3 |
defined( 'ABSPATH' ) || exit; |
| 4 |
use YayMail\Page\Source\CustomPostType; |
| 5 |
$sent_to_admin = ( isset( $sent_to_admin ) ? true : false ); |
| 6 |
$plain_text = ( isset( $plain_text ) ? $plain_text : '' ); |
| 7 |
$email = ( isset( $email ) ? $email : '' ); |
| 8 |
$postID = CustomPostType::postIDByTemplate( $this->template ); |
| 9 |
$order_item_title = get_post_meta( $postID, '_yaymail_email_order_item_title', true ); |
| 10 |
$product_title = false != $order_item_title ? $order_item_title['product_title'] : 'Product'; |
| 11 |
$quantity_title = false != $order_item_title ? $order_item_title['quantity_title'] : 'Quantity'; |
| 12 |
$price_title = false != $order_item_title ? $order_item_title['price_title'] : 'Price'; |
| 13 |
$subtoltal_title = false != $order_item_title ? $order_item_title['subtoltal_title'] : 'Subtotal:'; |
| 14 |
$payment_method_title = false != $order_item_title ? $order_item_title['payment_method_title'] : 'Payment method:'; |
| 15 |
$total_title = false != $order_item_title ? $order_item_title['total_title'] : 'Total:'; |
| 16 |
$get_order_item_totals = array( |
| 17 |
'cart_subtotal' => $subtoltal_title, |
| 18 |
'payment_method' => $payment_method_title, |
| 19 |
'order_total' => $total_title, |
| 20 |
); |
| 21 |
|
| 22 |
$get_order_item_totals_class = array( |
| 23 |
'cart_subtotal' => 'yaymail_item_subtoltal_title', |
| 24 |
'payment_method' => 'yaymail_item_payment_method_title', |
| 25 |
'order_total' => 'yaymail_item_total_title', |
| 26 |
); |
| 27 |
$borderColor = isset( $atts['bordercolor'] ) && $atts['bordercolor'] ? 'border-color:' . html_entity_decode( $atts['bordercolor'], ENT_QUOTES, 'UTF-8' ) : 'border-color:inherit'; |
| 28 |
$textColor = isset( $atts['textcolor'] ) && $atts['textcolor'] ? 'color:' . html_entity_decode( $atts['textcolor'], ENT_QUOTES, 'UTF-8' ) : 'color:inherit'; |
| 29 |
?> |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
<tr style="word-break: normal"> |
| 34 |
<th class="td yaymail_item_product_title" scope="col" style="text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border-width: 1px;border-style: solid;<?php echo esc_attr( $borderColor ); ?>;"> |
| 35 |
<?php esc_html_e( $product_title, 'woocommerce' ); ?> |
| 36 |
</th> |
| 37 |
<th class="td yaymail_item_quantity_title" scope="col" style="text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border-width: 1px;border-style: solid;<?php echo esc_attr( $borderColor ); ?>;"> |
| 38 |
<?php esc_html_e( $quantity_title, 'woocommerce' ); ?> |
| 39 |
</th> |
| 40 |
<th class="td yaymail_item_price_title" scope="col" style="width: 30%;text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border-width: 1px;border-style: solid;<?php echo esc_attr( $borderColor ); ?>;"> |
| 41 |
<?php esc_html_e( $price_title, 'woocommerce' ); ?> |
| 42 |
</th> |
| 43 |
</tr> |
| 44 |
|
| 45 |
<?php |
| 46 |
echo wp_kses_post( |
| 47 |
$this->ordetItemTables( |
| 48 |
$order, |
| 49 |
array( |
| 50 |
'show_sku' => $sent_to_admin, |
| 51 |
'show_image' => false, |
| 52 |
'image_size' => array( 32, 32 ), |
| 53 |
'plain_text' => $plain_text, |
| 54 |
'sent_to_admin' => $sent_to_admin, |
| 55 |
'border_color' => $borderColor, |
| 56 |
'text_color' => $textColor, |
| 57 |
) |
| 58 |
) |
| 59 |
); |
| 60 |
|
| 61 |
?> |
| 62 |
|
| 63 |
<?php |
| 64 |
$totalItem = $order->get_order_item_totals(); |
| 65 |
$i = 0; |
| 66 |
foreach ( $totalItem as $key => $total ) { |
| 67 |
$i++; |
| 68 |
?> |
| 69 |
|
| 70 |
<tr> |
| 71 |
<th class="td |
| 72 |
<?php |
| 73 |
if ( array_key_exists( $key, $get_order_item_totals_class ) ) { |
| 74 |
echo esc_html( $get_order_item_totals_class[ $key ] );} |
| 75 |
?> |
| 76 |
" scope="row" colspan="2" style="text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border-width: 1px;border-style: solid;<?php echo esc_attr( $borderColor ); ?>; <?php echo esc_attr( ( 1 === $i ) ? 'border-top-width: 4px;' : '' ); ?>"> |
| 77 |
<?php |
| 78 |
if ( array_key_exists( $key, $get_order_item_totals ) ) { |
| 79 |
echo esc_html_e( $get_order_item_totals[ $key ], 'woocommerce' ); |
| 80 |
} else { |
| 81 |
echo esc_html_e( $total['label'], 'woocommerce' ); |
| 82 |
} |
| 83 |
?> |
| 84 |
</th> |
| 85 |
<th class="td" style="font-weight: normal;text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border-width: 1px;border-style: solid;<?php echo esc_attr( $borderColor ); ?>; <?php echo esc_attr( ( 1 === $i ) ? 'border-top-width: 4px;' : '' ); ?>"> |
| 86 |
<?php echo wp_kses_post( $total['value'] ); ?> |
| 87 |
</th> |
| 88 |
</tr> |
| 89 |
|
| 90 |
<?php |
| 91 |
} |
| 92 |
|
| 93 |
if ( ! empty( $order->get_customer_note() ) ) { |
| 94 |
$note = $order->get_customer_note(); |
| 95 |
?> |
| 96 |
|
| 97 |
<tr> |
| 98 |
<th class="td" scope="row" colspan="2" style="text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border-width: 1px;border-style: solid;<?php echo esc_attr( $borderColor ); ?>; <?php echo esc_attr( ( 1 === $i ) ? 'border-top-width: 4px;' : '' ); ?>"> |
| 99 |
<?php esc_html_e( 'Note:', 'woocommerce' ); ?> |
| 100 |
</th> |
| 101 |
<th class="td" style="font-weight: normal;text-align:left;vertical-align: middle;padding: 12px;font-size: 14px;border-width: 1px;border-style: solid;<?php echo esc_attr( $borderColor ); ?>; <?php echo esc_attr( ( 1 === $i ) ? 'border-top-width: 4px;' : '' ); ?>"> |
| 102 |
<?php echo esc_html( $note ); ?> |
| 103 |
</th> |
| 104 |
</tr> |
| 105 |
|
| 106 |
<?php } ?> |
| 107 |
|