Untitled
unknown
plain_text
a year ago
1.4 kB
6
Indexable
add_action('salesking_my_orders_custom_columns', function(){
?>
<th class="nk-tb-col tb-col-sm"><span class="sub-text"><?php esc_html_e('Order Notes','salesking'); ?></span></th>
<?php
});
add_action('salesking_my_orders_custom_columns_footer', function(){
?>
<th class="nk-tb-col tb-col-md"><?php esc_html_e('order notes','salesking'); ?></th>
<?php
});
add_action('salesking_my_orders_custom_columns_content', function($order){
?><td class="nk-tb-col tb-col-md"> <?php
$order_id = $order->get_id();
$order_notes = get_private_order_notes( $order_id );
foreach($order_notes as $note){
$note_content = $note['note_content'];
// Outputting each note content for the order
echo '<p style="font-size:10px">'.$note_content.'</p>';
}
?></td><?php
}, 10, 1);
function get_private_order_notes( $order_id){
global $wpdb;
$table_perfixed = $wpdb->prefix . 'comments';
$results = $wpdb->get_results("
SELECT *
FROM $table_perfixed
WHERE `comment_post_ID` = $order_id
AND `comment_type` LIKE 'order_note'
");
foreach($results as $note){
$order_note[] = array(
'note_id' => $note->comment_ID,
'note_date' => $note->comment_date,
'note_author' => $note->comment_author,
'note_content' => $note->comment_content,
);
}
return $order_note;
}Editor is loading...
Leave a Comment