From 9ab2193c7a120ee675556ed716388ca835259aba Mon Sep 17 00:00:00 2001
From: Mike Jolley ';
+
+ if ($notes) :
+ foreach($notes as $note) :
+
+ $customer_note = get_comment_meta($note->comment_ID, 'is_customer_note', true);
+
+ echo '
';
+ ?>
+
+
+ – Note: if you edit quantities or remove items from the order you will need to manually change the item\'s stock levels.', 'woothemes'), 'woocommerce_order_items_meta_box', 'shop_order', 'normal', 'high');
add_meta_box( 'woocommerce-order-totals', __('Order Totals', 'woothemes'), 'woocommerce_order_totals_meta_box', 'shop_order', 'side', 'default');
-
+ add_meta_box( 'woocommerce-order-notes', __('Order Notes', 'woothemes'), 'woocommerce_order_notes_meta_box', 'shop_order', 'normal', 'default');
add_meta_box( 'woocommerce-order-actions', __('Order Actions', 'woothemes'), 'woocommerce_order_actions_meta_box', 'shop_order', 'side', 'default');
+ remove_meta_box( 'commentsdiv', 'shop_order' , 'normal' );
remove_meta_box( 'commentstatusdiv', 'shop_order' , 'normal' );
remove_meta_box( 'slugdiv', 'shop_order' , 'normal' );
diff --git a/assets/css/admin.css b/assets/css/admin.css
index 38b995cd8e9..db6f6c32392 100644
--- a/assets/css/admin.css
+++ b/assets/css/admin.css
@@ -1,6 +1,5 @@
-#toplevel_page_woocommerce .wp-menu-image{background:url(../images/icons/menu_icons.png) no-repeat 0px -32px !important;}
+#toplevel_page_woocommerce .wp-menu-image{background:url(../images/icons/menu_icons.png) no-repeat 0px -32px !important;}#toplevel_page_woocommerce .wp-menu-image img{display:none;}
#toplevel_page_woocommerce:hover .wp-menu-image,#toplevel_page_woocommerce.wp-has-current-submenu .wp-menu-image{background:url(../images/icons/menu_icons.png) no-repeat 0px 0px !important;}
-#toplevel_page_woocommerce .wp-menu-image img{display:none;}
#menu-posts-product .wp-menu-image{background:url(../images/icons/menu_icons.png) no-repeat -35px -32px !important;}
#menu-posts-product:hover .wp-menu-image,#menu-posts-product.wp-has-current-submenu .wp-menu-image{background:url(../images/icons/menu_icons.png) no-repeat -35px 0px !important;}
#menu-posts-shop_order .wp-menu-image{background:url(../images/icons/menu_icons.png) no-repeat -70px -32px !important;}
@@ -60,6 +59,14 @@ ul.subsubsub li.completed a{color:green;}
ul.subsubsub li.onhold a{color:red;}
ul.subsubsub li.cancelled a{color:#dfdfdf;}
ul.subsubsub li.refunded a{color:#ccc;}
+ul.order_notes{padding:2px 0 0 0;}ul.order_notes li .note_content{padding:10px;background:#efefef;position:relative;}
+ul.order_notes li p.meta{padding:10px;color:#999;font-size:11px;}
+ul.order_notes li a.delete_note{color:red;}
+ul.order_notes li .note_content:after{content:"";display:block;position:absolute;bottom:-15px;left:30px;width:0;height:0;border-width:15px 15px 0 0;border-style:solid;border-color:#efefef transparent;}
+ul.order_notes li.customer-note .note_content{background:#d7cad2;}
+ul.order_notes li.customer-note .note_content:after{border-color:#d7cad2 transparent;}
+.add_note{border-top:1px solid #ddd;padding:10px;}.add_note h4{margin-top:5px !important;}
+.add_note input#add_order_note{width:50%;}
table.wp-list-table .column-thumb{width:66px;text-align:center;white-space:nowrap;}
table.wp-list-table .column-sku,table.wp-list-table .column-product_type,table.wp-list-table .column-product_cat,table.wp-list-table .column-product_tags,table.wp-list-table .column-is_in_stock,table.wp-list-table .column-price,table.wp-list-table .column-product_date,table.wp-list-table .column-featured{width:9%;}
table.wp-list-table img{margin:1px 2px;}
diff --git a/assets/css/admin.less b/assets/css/admin.less
index faf5d7031c3..e9ee7fbbef2 100644
--- a/assets/css/admin.less
+++ b/assets/css/admin.less
@@ -1,31 +1,30 @@
-#toplevel_page_woocommerce .wp-menu-image {
- background: url(../images/icons/menu_icons.png) no-repeat 0px -32px !important;
+#toplevel_page_woocommerce {
+ .wp-menu-image {
+ background: url(../images/icons/menu_icons.png) no-repeat 0px -32px !important;
+ img {
+ display: none;
+ }
+ }
+ &:hover .wp-menu-image, &.wp-has-current-submenu .wp-menu-image {
+ background: url(../images/icons/menu_icons.png) no-repeat 0px 0px !important;
+ }
}
-#toplevel_page_woocommerce:hover .wp-menu-image,
-#toplevel_page_woocommerce.wp-has-current-submenu .wp-menu-image {
- background: url(../images/icons/menu_icons.png) no-repeat 0px 0px !important;
+#menu-posts-product {
+ .wp-menu-image {
+ background: url(../images/icons/menu_icons.png) no-repeat -35px -32px !important;
+ }
+ &:hover .wp-menu-image, &.wp-has-current-submenu .wp-menu-image {
+ background: url(../images/icons/menu_icons.png) no-repeat -35px 0px !important;
+ }
}
-#toplevel_page_woocommerce .wp-menu-image img {
- display: none;
+#menu-posts-shop_order {
+ .wp-menu-image {
+ background: url(../images/icons/menu_icons.png) no-repeat -70px -32px !important;
+ }
+ &:hover .wp-menu-image, &.wp-has-current-submenu .wp-menu-image {
+ background: url(../images/icons/menu_icons.png) no-repeat -70px 0px !important;
+ }
}
-
-#menu-posts-product .wp-menu-image {
- background: url(../images/icons/menu_icons.png) no-repeat -35px -32px !important;
-}
-#menu-posts-product:hover .wp-menu-image,
-#menu-posts-product.wp-has-current-submenu .wp-menu-image {
- background: url(../images/icons/menu_icons.png) no-repeat -35px 0px !important;
-}
-
-#menu-posts-shop_order .wp-menu-image {
- background: url(../images/icons/menu_icons.png) no-repeat -70px -32px !important;
-}
-#menu-posts-shop_order:hover .wp-menu-image,
-#menu-posts-shop_order.wp-has-current-submenu .wp-menu-image {
- background: url(../images/icons/menu_icons.png) no-repeat -70px 0px !important;
-}
-
-
#icon-woocommerce, .woocommerce_icon, .icon32-posts-product, .icon32-posts-shop_order, .icon32-posts-shop_coupon, .icon32-posts-product_variation {
background-image: url(../images/icons/woocommerce-icons.png) !important;
background-position: -11px -6px;
@@ -234,7 +233,6 @@ dl.totals {
float: left;
}
}
-
.widefat {
.column-order_title {
time {
@@ -304,7 +302,6 @@ dl.totals {
}
}
}
-
ul.subsubsub {
li.pending {
a {
@@ -333,6 +330,56 @@ ul.subsubsub {
}
}
+/* Order notes */
+ul.order_notes {
+ padding: 2px 0 0 0;
+ li {
+ .note_content {
+ padding: 10px;
+ background: #efefef;
+ position: relative;
+ }
+ p.meta {
+ padding: 10px;
+ color: #999;
+ font-size: 11px;
+ }
+ a.delete_note {
+ color: red
+ }
+ .note_content:after {
+ content: "";
+ display: block;
+ position: absolute;
+ bottom: -15px;
+ left: 30px;
+ width: 0;
+ height: 0;
+ border-width: 15px 15px 0 0;
+ border-style: solid;
+ border-color: #efefef transparent;
+ }
+ }
+ li.customer-note {
+ .note_content {
+ background: #d7cad2;
+ }
+ .note_content:after {
+ border-color: #d7cad2 transparent;
+ }
+ }
+}
+.add_note {
+ border-top: 1px solid #ddd;
+ padding: 10px;
+ h4 {
+ margin-top: 5px !important;
+ }
+ input#add_order_note {
+ width: 50%;
+ }
+}
+
/* Product list */
table.wp-list-table {
.column-thumb {
diff --git a/classes/order.class.php b/classes/order.class.php
index 692a83284c4..c7d90d1dbc1 100644
--- a/classes/order.class.php
+++ b/classes/order.class.php
@@ -306,9 +306,9 @@ class woocommerce_order {
* Adds a note (comment) to the order
*
* @param string $note Note to add
- * @param int $private Currently unused
+ * @param int $is_customer_note Is this a note for the customer?
*/
- function add_order_note( $note, $private = 1 ) {
+ function add_order_note( $note, $is_customer_note = 0 ) {
$comment_post_ID = $this->id;
$comment_author = 'WooCommerce';
@@ -328,7 +328,9 @@ class woocommerce_order {
$comment_id = wp_insert_comment( $commentdata );
- add_comment_meta($comment_id, 'private', $private);
+ add_comment_meta($comment_id, 'is_customer_note', $is_customer_note);
+
+ return $comment_id;
}
@@ -453,4 +455,32 @@ class woocommerce_order {
}
+ /**
+ * List order notes (public) for the customer
+ */
+ function get_customer_order_notes() {
+
+ $notes = array();
+
+ $args = array(
+ 'post_id' => $this->id,
+ 'approve' => 'approve',
+ 'type' => ''
+ );
+
+ remove_filter('comments_clauses', 'woocommerce_exclude_order_comments');
+
+ $comments = get_comments( $args );
+
+ foreach ($comments as $comment) :
+ $is_customer_note = get_comment_meta($comment->comment_ID, 'is_customer_note', true);
+ if ($is_customer_note) $notes[] = $comment;
+ endforeach;
+
+ add_filter('comments_clauses', 'woocommerce_exclude_order_comments');
+
+ return (array) $notes;
+
+ }
+
}
\ No newline at end of file
diff --git a/shortcodes/shortcode-my_account.php b/shortcodes/shortcode-my_account.php
index dd040877aec..a330b06a9aa 100644
--- a/shortcodes/shortcode-my_account.php
+++ b/shortcodes/shortcode-my_account.php
@@ -457,8 +457,23 @@ function woocommerce_view_order() {
echo sprintf( __('. Order status: %s', 'woothemes'), $order->status );
echo '.
comment_date)); ?>
comment_content)); ?>