PluginProbe
YayMail – WooCommerce Email Customizer / 4.3.3
YayMail – WooCommerce Email Customizer v4.3.3
4.4.4 4.4.3 4.4.2 4.4.1 trunk 1.9.6 2.1.4 2.1.5 3.2.2 3.2.6 3.2.7.1 3.2.8.1 3.2.9 3.3 3.3.1 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4 3.4.1 3.4.2 3.4.3 All 55 releases
yaymail / src / Shortcodes / OrderDetails / OrderDetailsRenderer.php

OrderDetailsRenderer.php in YayMail – WooCommerce Email Customizer 4.3.3, at src/Shortcodes/OrderDetails/OrderDetailsRenderer.php

564 lines 27.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace YayMail\Shortcodes\OrderDetails;
4
5 use YayMail\Utils\TemplateHelpers;
6 use YayMail\Utils\Helpers;
7
8 /**
9 * @method: static OrderDetailsRenderer get_instance()
10 */
11 class OrderDetailsRenderer {
12
13 public $item_totals = [];
14
15 public $order = null;
16
17 public $order_note = '';
18
19 public $element_data = null;
20
21 public $is_placeholder = false;
22
23 public $titles = [];
24
25 public $show_product_item_cost = false;
26
27 public $colspan_value = '2';
28
29 public function __construct( $order, $element_data, $is_placeholder ) {
30 $yaymail_settings = yaymail_settings();
31 $this->show_product_item_cost = isset( $yaymail_settings['show_product_item_cost'] ) ? boolval( $yaymail_settings['show_product_item_cost'] ) : false;
32 $this->colspan_value = $is_placeholder ? '{{show_product_item_cost}}' : ( $this->show_product_item_cost ? '3' : '2' );
33 $this->element_data = $element_data;
34 $this->is_placeholder = $is_placeholder;
35 $this->initialize_titles();
36
37 if ( ! Helpers::is_woocommerce_order( $order ) ) {
38 $this->initialize_sample_data();
39 } else {
40 $this->initialize_order_data( $order );
41 }
42 }
43
44 public function initialize_titles() {
45 $this->titles = [
46 'product' => isset( $this->element_data['product_title'] ) ? $this->element_data['product_title'] : TemplateHelpers::get_content_as_placeholder( 'product_title', esc_html__( 'Product', 'woocommerce' ), $this->is_placeholder ),
47 'cost' => isset( $this->element_data['cost_title'] ) ? $this->element_data['cost_title'] : TemplateHelpers::get_content_as_placeholder( 'cost_title', esc_html__( 'Cost', 'woocommerce' ), $this->is_placeholder ),
48 'quantity' => isset( $this->element_data['quantity_title'] ) ? $this->element_data['quantity_title'] : TemplateHelpers::get_content_as_placeholder( 'quantity_title', esc_html__( 'Quantity', 'woocommerce' ), $this->is_placeholder ),
49 'price' => isset( $this->element_data['price_title'] ) ? $this->element_data['price_title'] : TemplateHelpers::get_content_as_placeholder( 'price_title', esc_html__( 'Price', 'woocommerce' ), $this->is_placeholder ),
50 'cart_subtotal' => isset( $this->element_data['cart_subtotal_title'] ) ? $this->element_data['cart_subtotal_title'] : TemplateHelpers::get_content_as_placeholder( 'cart_subtotal_title', esc_html__( 'Subtotal:', 'woocommerce' ), $this->is_placeholder ),
51 'shipping' => isset( $this->element_data['shipping_title'] ) ? $this->element_data['shipping_title'] : TemplateHelpers::get_content_as_placeholder( 'shipping_title', esc_html__( 'Shipping:', 'woocommerce' ), $this->is_placeholder ),
52 'discount' => isset( $this->element_data['discount_title'] ) ? $this->element_data['discount_title'] : TemplateHelpers::get_content_as_placeholder( 'discount_title', esc_html__( 'Discount:', 'woocommerce' ), $this->is_placeholder ),
53 'payment_method' => isset( $this->element_data['payment_method_title'] ) ? $this->element_data['payment_method_title'] : TemplateHelpers::get_content_as_placeholder( 'payment_method_title', esc_html__( 'Payment method:', 'woocommerce' ), $this->is_placeholder ),
54 'order_total' => isset( $this->element_data['order_total_title'] ) ? $this->element_data['order_total_title'] : TemplateHelpers::get_content_as_placeholder( 'order_total_title', esc_html__( 'Total:', 'woocommerce' ), $this->is_placeholder ),
55 'order_note' => isset( $this->element_data['order_note_title'] ) ? $this->element_data['order_note_title'] : TemplateHelpers::get_content_as_placeholder( 'order_note_title', esc_html__( 'Note:', 'woocommerce' ), $this->is_placeholder ),
56 ];
57 }
58
59 private function initialize_sample_data() {
60 $this->item_totals = [
61 'cart_subtotal' => [
62 'label' => $this->titles['cart_subtotal'],
63 'value' => wc_price( 18 ),
64 ],
65 'shipping' => [
66 'label' => $this->titles['shipping'],
67 'value' => __( 'Free shipping', 'yaymail' ),
68 ],
69 'payment_method' => [
70 'label' => $this->titles['payment_method'],
71 'value' => __( 'Direct bank transfer', 'yaymail' ),
72 ],
73 'order_total' => [
74 'label' => $this->titles['order_total'],
75 'value' => wc_price( 18 ),
76 ],
77 ];
78 $this->order_note = 'YayMail';
79 }
80
81 private function initialize_order_data( $order ) {
82 $this->item_totals = $order->get_order_item_totals();
83 $this->order_note = $order->get_customer_note();
84 $this->order = $order;
85 }
86
87 public function get_styles() {
88 return TemplateHelpers::get_style(
89 [
90 'padding' => '12px',
91 'text-align' => yaymail_get_text_align(),
92 'font-family' => TemplateHelpers::get_font_family_value( isset( $this->element_data['font_family'] ) ? $this->element_data['font_family'] : 'inherit' ),
93 'color' => isset( $this->element_data['text_color'] ) ? $this->element_data['text_color'] : 'inherit',
94 'border-width' => '1px',
95 'border-style' => 'solid',
96 'border-color' => isset( $this->element_data['border_color'] ) ? $this->element_data['border_color'] : 'inherit',
97 ]
98 );
99 }
100
101 public function get_styles_product_image() {
102 $direction = yaymail_get_email_direction();
103
104 if ( 'ltr' === $direction ) {
105 $margin_right = '5px';
106 $margin_left = '0';
107 } else {
108 $margin_right = '0';
109 $margin_left = '5px';
110 }
111
112 return TemplateHelpers::get_style(
113 [
114 'margin-bottom' => '5px',
115 'margin-right' => $margin_right,
116 'margin-left' => $margin_left,
117 ]
118 );
119 }
120
121 public function get_structure_table() {
122 return apply_filters(
123 'yaymail_order_details_structure_table',
124 [
125 'items' => [
126 'product' => [
127 'label' => $this->titles['product'],
128 'col_span' => apply_filters( 'yaymail_order_item_product_title_colspan', 1, $this->element_data ),
129 'style' => [
130 'word-wrap' => 'break-word',
131 'width' => $this->show_product_item_cost ? '40%' : '45%',
132 ],
133 ],
134 'cost' => [
135 'label' => $this->titles['cost'],
136 'col_span' => apply_filters( 'yaymail_order_item_cost_colspan', 1, $this->element_data ),
137 'style' => [
138 'min-width' => '65px',
139 ],
140 ],
141 'quantity' => [
142 'label' => $this->titles['quantity'],
143 'col_span' => apply_filters( 'yaymail_order_item_quantity_colspan', 1, $this->element_data ),
144 'style' => [
145 'min-width' => '85px',
146 ],
147 ],
148 'price' => [
149 'label' => $this->titles['price'],
150 'col_span' => apply_filters( 'yaymail_order_item_price_colspan', 1, $this->element_data ),
151 'style' => [
152 'word-wrap' => 'break-word',
153 'min-width' => '100px',
154 'width' => $this->show_product_item_cost ? '28%' : '38%',
155 ],
156
157 ],
158 ],
159 'footer' => [
160 'label_col_span' => $this->colspan_value,
161 'value_col_span' => 1,
162 'hidden_rows' => [],
163 ],
164 ]
165 );
166 }
167
168 public function render() {
169 $style = $this->get_styles() . 'padding: 0;border-collapse: separate;';
170 ?>
171 <table class="yaymail-order-details-table" cellspacing="0" cellpadding="6" width="100%" style="<?php echo esc_attr( $style ); ?>" border="1">
172 <?php
173 $this->render_heading();
174 $this->render_order_items();
175 $this->render_footer();
176 ?>
177 </table>
178 <?php
179 }
180
181 public function render_heading() {
182 $styles = $this->get_styles();
183 $structure_table = $this->get_structure_table();
184 $structure_items = isset( $structure_table['items'] ) ? $structure_table['items'] : [];
185 if ( isset( $structure_items['cost'] ) && ! $this->show_product_item_cost && ! $this->is_placeholder ) {
186 unset( $structure_items['cost'] );
187 }
188 ?>
189 <thead class="yaymail_element_head_order_details yaymail_element_head_order_item">
190 <tr>
191 <?php
192 foreach ( $structure_items as $key => $structure_item ) :
193 if ( isset( $structure_item['width'] ) ) {
194 $width = 'width: ' . $structure_item['width'] . ';';
195 } else {
196 $width = '';
197 }
198 $item_style = isset( $structure_item['style'] ) ? $structure_item['style'] : [];
199 if ( ! empty( $item_style ) ) {
200 $item_style_string = TemplateHelpers::get_style( $item_style );
201 } else {
202 $item_style_string = '';
203 }
204 $column_style = $styles . $width . $item_style_string;
205 echo '<th class="td yaymail_item_' . esc_attr( $key ) . '_title" colspan="' . esc_attr( $structure_item['col_span'] ) . '" scope="col" style="' . esc_attr( $column_style ) . ';"><span>' . esc_html( $structure_item['label'] ) . '</span></th>';
206 endforeach;
207 ?>
208 </tr>
209 </thead>
210 <?php
211 }
212
213 public function render_order_items() {
214 $structure_table = $this->get_structure_table();
215 $structure_items = isset( $structure_table['items'] ) ? $structure_table['items'] : [];
216 if ( isset( $structure_items['cost'] ) && ! $this->show_product_item_cost && ! $this->is_placeholder ) {
217 unset( $structure_items['cost'] );
218 }
219 ?>
220 <tbody class="yaymail_element_body_order_details yaymail_element_body_order_item">
221 <?php
222 if ( null === $this->order || ! ( $this->order instanceof \WC_Order ) || 12345 === $this->order->get_id() ) {
223 $this->render_sample_items( $structure_items );
224 } else {
225 $this->render_real_items( $structure_items );
226 }
227 ?>
228 </tbody>
229 <?php
230 }
231
232 public function render_sample_items( $structure_items ) {
233 $yaymail_settings = yaymail_settings();
234 $direction = yaymail_get_email_direction();
235 $image_position = isset( $yaymail_settings['product_image_position'] ) ? $yaymail_settings['product_image_position'] : 'top';
236
237 $style_image_position_left = TemplateHelpers::get_style(
238 [
239 'float' => 'left' === $image_position && 'rtl' === $direction ? 'right' : 'left',
240 ]
241 );
242
243 $style = $this->get_styles();
244 $is_placeholder = $this->is_placeholder;
245
246 $show_image = isset( $yaymail_settings['show_product_image'] ) ? boolval( $yaymail_settings['show_product_image'] ) : false;
247 $image_height = isset( $yaymail_settings['product_image_height'] ) ? $yaymail_settings['product_image_height'] : '30';
248 $image_width = isset( $yaymail_settings['product_image_width'] ) ? $yaymail_settings['product_image_width'] : '30';
249
250 $show_image = isset( $yaymail_settings['show_product_image'] ) ? boolval( $yaymail_settings['show_product_image'] ) : false;
251 $show_sku = isset( $yaymail_settings['show_product_sku'] ) ? boolval( $yaymail_settings['show_product_sku'] ) : false;
252 $show_des = isset( $yaymail_settings['show_product_description'] ) ? boolval( $yaymail_settings['show_product_description'] ) : false;
253 $show_regular_price = isset( $yaymail_settings['show_product_regular_price'] ) ? boolval( $yaymail_settings['show_product_regular_price'] ) : false;
254 $show_hyper_links = isset( $yaymail_settings['show_product_hyper_links'] ) ? boolval( $yaymail_settings['show_product_hyper_links'] ) : false;
255 $image_style = 'left' === $image_position ? $this->get_styles_product_image() . $style_image_position_left : $this->get_styles_product_image();
256
257 $image_url = wc_placeholder_img_src();
258 $image = $is_placeholder ? "<img style='margin-right:0;' width='{{product_image_width}}px' height='{{product_image_height}}px' src='{$image_url}' alt='product image'/>" : "<img style='margin-right: 0; width: {$image_width}px; height: {$image_height}px;' src='{$image_url}' alt='product image'/>";
259 $sku = __( 'sku', 'yaymail' );
260 $short_description = __( 'Product short description', 'yaymail' );
261 $product_name = __( 'Happy YayCommerce', 'yaymail' );
262 $product_permalink = '#';
263 $product_hyper_link = "<a href='{$product_permalink}' target='_blank'>{$product_name}</a>";
264 $product_cost = 9;
265 $product_quantity = 2;
266 $product_regular_price = 10;
267
268 $is_layout_type_modern = isset( $this->element_data['layout_type'] ) && 'modern' === $this->element_data['layout_type'];
269 ?>
270 <tr class="order_item">
271 <?php foreach ( $structure_items as $key => $structure_item ) : ?>
272 <?php
273 if ( isset( $structure_item['width'] ) ) {
274 $width = 'width: ' . $structure_item['width'] . ';';
275 } else {
276 $width = '';
277 }
278 $item_style = isset( $structure_item['style'] ) ? $structure_item['style'] : [];
279 if ( ! empty( $item_style ) ) {
280 $item_style_string = TemplateHelpers::get_style( $item_style );
281 } else {
282 $item_style_string = '';
283 }
284 $column_style = $style . $width . $item_style_string;
285 ?>
286 <td colspan="<?php echo esc_attr( $structure_item['col_span'] ); ?>" class="td yaymail_item_<?php echo esc_attr( $key ); ?>_content" scope="row" style="<?php echo esc_attr( $column_style ); ?>">
287 <?php
288 switch ( $key ) :
289 case 'product':
290 // Show title/image etc.
291 if ( ( $show_image && 'bottom' !== $image_position ) || $is_placeholder ) {
292 echo wp_kses_post( "<div class='yaymail-product_image_position__top' style='{$image_style}'>" );
293 require YAYMAIL_PLUGIN_PATH . 'templates/shortcodes/order-details/order-items/image-content.php';
294 echo ( '</div>' );
295 }
296 ?>
297
298 <!-- Product details -->
299 <div class='yaymail-product-details'>
300 <?php
301
302 // Product name.
303 require YAYMAIL_PLUGIN_PATH . 'templates/shortcodes/order-details/order-items/product-name-content.php';
304
305 // SKU.
306 if ( ( $show_sku && ! empty( $sku ) ) || ( $is_placeholder && ! empty( $sku ) ) ) {
307 require YAYMAIL_PLUGIN_PATH . 'templates/shortcodes/order-details/order-items/sku-content.php';
308 }
309
310 // Product Description.
311 if ( ( $show_des && ! empty( $short_description ) ) || ( $is_placeholder && ! empty( $short_description ) ) ) {
312 require YAYMAIL_PLUGIN_PATH . 'templates/shortcodes/order-details/order-items/product-short-description-content.php';
313 }
314
315 // Show title/image etc in bottom.
316 if ( ( $show_image && 'bottom' === $image_position ) || $is_placeholder ) {
317 echo wp_kses_post( "<div class='yaymail-product_image_position__bottom' style='{$image_style}'>" );
318 require YAYMAIL_PLUGIN_PATH . 'templates/shortcodes/order-details/order-items/image-content.php';
319 echo ( '</div>' );
320 }
321 ?>
322 </div>
323 <!-- End Product details -->
324 <?php
325 break;
326 case 'cost':
327 echo wp_kses_post( wc_price( $product_cost ) );
328 break;
329 case 'quantity':
330 ?>
331 <?php if ( $is_layout_type_modern || $is_placeholder ) : ?>
332 <span class="yaymail-quantity-type-modern">x</span>
333 <?php endif; ?>
334 <?php
335 echo wp_kses_post( $product_quantity );
336 break;
337 case 'price':
338 // Show product regular price.
339 if ( ( $show_regular_price ) ) {
340 ?>
341 <del class="yaymail-product-regular-price" style="padding-right:5px"> <?php echo wp_kses_post( wc_price( $product_regular_price * $product_quantity ) ); ?> </del>
342 <?php
343 }
344 echo wp_kses_post( wc_price( $product_cost * $product_quantity ) );
345 break;
346 default:
347 echo wp_kses_post( do_action( 'yaymail_order_details_item_' . $key . '_content', null, $this->order, $this->element_data, true ) );
348 break;
349 endswitch;
350 ?>
351 </td>
352 <?php endforeach; ?>
353 </tr>
354 <?php
355 }
356
357 public function render_real_items( $structure_items ) {
358 $yaymail_settings = yaymail_settings();
359 $direction = yaymail_get_email_direction();
360 $image_position = isset( $yaymail_settings['product_image_position'] ) ? $yaymail_settings['product_image_position'] : 'top';
361
362 $style_image_position_left = TemplateHelpers::get_style(
363 [
364 'float' => 'left' === $image_position && 'rtl' === $direction ? 'right' : 'left',
365 ]
366 );
367
368 $args_data = [
369 'order' => $this->order,
370 'text_style' => $this->get_styles(),
371 'styles_product_image' => 'left' === $image_position ? $this->get_styles_product_image() . $style_image_position_left : $this->get_styles_product_image(),
372 'is_placeholder' => $this->is_placeholder,
373 'structure_items' => $structure_items,
374 ];
375
376 // Just has data when send mail
377 if ( ! empty( $this->element_data ) ) {
378 $args_data['element'] = $this->element_data;
379 }
380 $path_data = apply_filters( 'yaymail_order_details_items', 'templates/shortcodes/order-details/order-items/main.php' );
381 $html = yaymail_get_content( $path_data, $args_data );
382 $allowed_html = TemplateHelpers::wp_kses_allowed_html();
383 echo wp_kses( $html, $allowed_html );
384 }
385
386 public function render_footer() {
387 $structure_table = $this->get_structure_table();
388 $structure_footer = isset( $structure_table['footer'] ) ? $structure_table['footer'] : [];
389
390 if ( empty( $structure_footer ) ) {
391 return;
392 }
393 // TODO: change class name
394 ?>
395 <tfoot class="yaymail_element_foot_order_details yaymail_element_foot_order_item">
396 <?php
397 $this->render_item_totals( $structure_footer );
398
399 if ( ! empty( $this->order ) && $this->order->get_customer_note() ) {
400 $this->render_customer_note( $structure_footer );
401 }
402 ?>
403 </tfoot>
404 <?php
405 }
406
407 public function render_item_totals( $structure_footer ) {
408 $custom_rows = isset( $this->element_data['custom_footer_rows'] )
409 ? $this->element_data['custom_footer_rows']
410 : [];
411
412 // Group custom rows by zone
413 $rows_by_zone = [
414 'before_all' => [],
415 'after_subtotal' => [],
416 'before_total' => [],
417 'after_total' => [],
418 ];
419
420 foreach ( $custom_rows as $row ) {
421 // Check if row is enabled - handle both boolean and string values
422 $is_enabled = isset( $row['enabled'] ) ? boolval( $row['enabled'] ) : false;
423
424 if ( $is_enabled && isset( $row['zone'] ) ) {
425 $zone = $row['zone'];
426 if ( isset( $rows_by_zone[ $zone ] ) ) {
427 $rows_by_zone[ $zone ][] = $row;
428 }
429 }
430 }
431
432 // Sort each zone by order
433 foreach ( $rows_by_zone as &$zone_rows ) {
434 usort(
435 $zone_rows,
436 function( $a, $b ) {
437 $order_a = isset( $a['order'] ) ? intval( $a['order'] ) : 0;
438 $order_b = isset( $b['order'] ) ? intval( $b['order'] ) : 0;
439 return $order_a - $order_b;
440 }
441 );
442 }
443
444 $index = 0;
445
446 // ZONE 1: Before all
447 foreach ( $rows_by_zone['before_all'] as $row ) {
448 $this->render_custom_row( $row, $index++, $structure_footer );
449 }
450
451 // Process standard rows
452 foreach ( $this->item_totals as $key => $total ) {
453 if ( in_array( $key, $structure_footer['hidden_rows'] ?? [], true ) ) {
454 continue;
455 }
456
457 // ZONE 2: After subtotal
458 if ( 'cart_subtotal' === $key ) {
459 $this->render_standard_row( $key, $total, $index++, $structure_footer );
460 foreach ( $rows_by_zone['after_subtotal'] as $row ) {
461 $this->render_custom_row( $row, $index++, $structure_footer );
462 }
463 continue;
464 }
465
466 // ZONE 3: Before total
467 if ( 'order_total' === $key ) {
468 foreach ( $rows_by_zone['before_total'] as $row ) {
469 $this->render_custom_row( $row, $index++, $structure_footer );
470 }
471 $this->render_standard_row( $key, $total, $index++, $structure_footer );
472 continue;
473 }
474
475 // Other rows - render normally
476 $this->render_standard_row( $key, $total, $index++, $structure_footer );
477 }//end foreach
478
479 // ZONE 4: After all (after total)
480 foreach ( $rows_by_zone['after_total'] as $row ) {
481 $this->render_custom_row( $row, $index++, $structure_footer );
482 }
483 }
484
485 /**
486 * Render a standard order total row
487 *
488 * @param string $key The order total key.
489 * @param array $total The order total data.
490 * @param int $index The row index.
491 * @param array $structure_footer The footer structure data.
492 */
493 private function render_standard_row( $key, $total, $index, $structure_footer ) {
494 $tr_class = "yaymail-order-detail-row-{$key}";
495 $can_apply_placeholder = $this->is_placeholder && isset( $this->titles[ $key ] );
496 $label = TemplateHelpers::get_content_as_placeholder( "{$key}_title", esc_html( isset( $this->titles[ $key ] ) ? $this->titles[ $key ] : $total['label'] ), $can_apply_placeholder );
497 $style = $this->get_styles() . TemplateHelpers::get_style(
498 [
499 'border-top-width' => 1 === $index ? '4px' : '0',
500 ]
501 );
502 $heading_style = $style . 'font-size: ' . ( isset( $this->element_data['table_heading_font_size'] ) ? $this->element_data['table_heading_font_size'] : '14' ) . 'px;';
503 $content_style = $style . 'font-size: ' . ( isset( $this->element_data['table_content_font_size'] ) ? $this->element_data['table_content_font_size'] : '14' ) . 'px;';
504 ?>
505 <tr class="<?php echo esc_attr( $tr_class ); ?>">
506 <th class="td" scope="row" colspan="<?php echo esc_attr( isset( $structure_footer['label_col_span'] ) ? $structure_footer['label_col_span'] : $this->colspan_value ); ?>" style="<?php echo esc_attr( $heading_style ); ?>"><?php echo wp_kses_post( $label ); ?></th>
507 <td class="td" colspan="<?php echo esc_attr( isset( $structure_footer['value_col_span'] ) ? $structure_footer['value_col_span'] : 1 ); ?>" style="<?php echo esc_attr( $content_style ); ?>"><?php echo wp_kses_post( $total['value'] ); ?></td>
508 </tr>
509 <?php
510 }
511
512 /**
513 * Render a custom footer row
514 *
515 * @param array $custom_row The custom row data.
516 * @param int $index The row index.
517 * @param array $structure_footer The footer structure data.
518 */
519 private function render_custom_row( $custom_row, $index, $structure_footer ) {
520 // Process shortcodes in label and value
521 $label = isset( $custom_row['label'] ) ? do_shortcode( $custom_row['label'] ) : '';
522 $value = isset( $custom_row['value'] ) ? do_shortcode( $custom_row['value'] ) : '';
523
524 if ( empty( $label ) && empty( $value ) ) {
525 return;
526 }
527
528 $style = $this->get_styles() . TemplateHelpers::get_style(
529 [
530 'border-top-width' => 1 === $index ? '4px' : '0',
531 ]
532 );
533
534 $heading_style = $style . 'font-size: ' . ( isset( $this->element_data['table_heading_font_size'] ) ? $this->element_data['table_heading_font_size'] : '14' ) . 'px;';
535 $content_style = $style . 'font-size: ' . ( isset( $this->element_data['table_content_font_size'] ) ? $this->element_data['table_content_font_size'] : '14' ) . 'px;';
536
537 $row_id = isset( $custom_row['id'] ) ? esc_attr( $custom_row['id'] ) : '';
538 ?>
539 <tr class="yaymail-order-detail-row-custom custom-row-<?php echo esc_attr( $row_id ); ?>">
540 <th class="td" scope="row" colspan="<?php echo esc_attr( isset( $structure_footer['label_col_span'] ) ? $structure_footer['label_col_span'] : $this->colspan_value ); ?>"
541 style="<?php echo esc_attr( $heading_style ); ?>">
542 <?php echo wp_kses_post( $label ); ?>
543 </th>
544 <td class="td" colspan="<?php echo esc_attr( isset( $structure_footer['value_col_span'] ) ? $structure_footer['value_col_span'] : 1 ); ?>"
545 style="<?php echo esc_attr( $content_style ); ?>">
546 <?php echo wp_kses_post( $value ); ?>
547 </td>
548 </tr>
549 <?php
550 }
551
552 public function render_customer_note() {
553 if ( ! empty( $this->order_note ) ) :
554 $style = $this->get_styles();
555 ?>
556 <tr class="yaymail-order-detail-row-order_note">
557 <th class="td" scope="row" colspan="<?php echo esc_attr( $this->colspan_value ); ?>" style="<?php echo esc_attr( $style ); ?>;"><?php echo esc_html( $this->titles['order_note'] ); ?></th>
558 <td class="td" style="<?php echo esc_attr( $style ); ?>;"><?php echo wp_kses_post( nl2br( wptexturize( $this->order_note ) ) ); ?></td>
559 </tr>
560 <?php
561 endif;
562 }
563 }
564