WC_Meta_Box_Order_Notes

WC_Meta_Box_Order_Notes Class.

Defined (1)

The class is defined in the following location(s).

/includes/admin/meta-boxes/class-wc-meta-box-order-notes.php  
  1. class WC_Meta_Box_Order_Notes { 
  2.  
  3. /** 
  4. * Output the metabox. 
  5. * @param WP_Post $post 
  6. */ 
  7. public static function output( $post ) { 
  8. global $post; 
  9.  
  10. $args = array( 
  11. 'post_id' => $post->ID,  
  12. 'orderby' => 'comment_ID',  
  13. 'order' => 'DESC',  
  14. 'approve' => 'approve',  
  15. 'type' => 'order_note',  
  16. ); 
  17.  
  18. remove_filter( 'comments_clauses', array( 'WC_Comments', 'exclude_order_comments' ), 10, 1 ); 
  19.  
  20. $notes = get_comments( $args ); 
  21.  
  22. add_filter( 'comments_clauses', array( 'WC_Comments', 'exclude_order_comments' ), 10, 1 ); 
  23.  
  24. echo '<ul class="order_notes">'; 
  25.  
  26. if ( $notes ) { 
  27.  
  28. foreach ( $notes as $note ) { 
  29.  
  30. $note_classes = array( 'note' ); 
  31. $note_classes[] = get_comment_meta( $note->comment_ID, 'is_customer_note', true ) ? 'customer-note' : ''; 
  32. $note_classes[] = ( __( 'WooCommerce', 'woocommerce' ) === $note->comment_author ) ? 'system-note' : ''; 
  33. $note_classes = apply_filters( 'woocommerce_order_note_class', array_filter( $note_classes ), $note ); 
  34. ?> 
  35. <li rel="<?php echo absint( $note->comment_ID ); ?>" class="<?php echo esc_attr( implode( ' ', $note_classes ) ); ?>"> 
  36. <div class="note_content"> 
  37. <?php echo wpautop( wptexturize( wp_kses_post( $note->comment_content ) ) ); ?> 
  38. </div> 
  39. <p class="meta"> 
  40. <abbr class="exact-date" title="<?php echo $note->comment_date; ?>"><?php printf( __( 'added on %1$s at %2$s', 'woocommerce' ), date_i18n( wc_date_format(), strtotime( $note->comment_date ) ), date_i18n( wc_time_format(), strtotime( $note->comment_date ) ) ); ?></abbr> 
  41. <?php 
  42. if ( __( 'WooCommerce', 'woocommerce' ) !== $note->comment_author ) : 
  43. /** translators: %s: note author */ 
  44. printf( ' ' . __( 'by %s', 'woocommerce' ), $note->comment_author ); 
  45. endif; 
  46. ?> 
  47. <a href="#" class="delete_note" role="button"><?php _e( 'Delete note', 'woocommerce' ); ?></a> 
  48. </p> 
  49. </li> 
  50. <?php 
  51. } else { 
  52. echo '<li>' . __( 'There are no notes yet.', 'woocommerce' ) . '</li>'; 
  53.  
  54. echo '</ul>'; 
  55. ?> 
  56. <div class="add_note"> 
  57. <p> 
  58. <label for="add_order_note"><?php _e( 'Add note', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Add a note for your reference, or add a customer note (the user will be notified).', 'woocommerce' ) ); ?></label> 
  59. <textarea type="text" name="order_note" id="add_order_note" class="input-text" cols="20" rows="5"></textarea> 
  60. </p> 
  61. <p> 
  62. <label for="order_note_type" class="screen-reader-text"><?php _e( 'Note type', 'woocommerce' ); ?></label> 
  63. <select name="order_note_type" id="order_note_type"> 
  64. <option value=""><?php _e( 'Private note', 'woocommerce' ); ?></option> 
  65. <option value="customer"><?php _e( 'Note to customer', 'woocommerce' ); ?></option> 
  66. </select> 
  67. <button type="button" class="add_note button"><?php _e( 'Add', 'woocommerce' ); ?></button> 
  68. </p> 
  69. </div> 
  70. <?php