I'm currently adding an Order Notes area during the Confirm of an order. The customer requested the ability so the users can let the owners of the site know any special requests. I've placed the text area onto the page but am having issue with getting the model to respond. I noticed that the model is not passed in and added it to the method ConfirmOrder, however, I get a null Order Note. Btw, I modified the OrderNote Table to contain a CustomerId.
Here is what I have thus far:
Confirm.cshtml
...
<div class="order-notes-title">
@T("Checkout.OrderNote")
</div>
<div class="clear">
</div>
<div class="order-notes-body">
@Html.TextAreaFor(model => model.OrderNote, new { style = "width:400px; height:100px" })
</div>
<div class="clear">
</div>
...
CheckoutConfirmModel.cs
...
public string OrderNote { get; set; }
CheckoutController.cs (ConfirmOrder method)
... down to line 847 or so (else to check on _webHelper)
//Check for order note
if (!string.IsNullOrEmpty(model.OrderNote))
{
//Add customer's order note
var orderNote = new OrderNote
{
CustomerId = _workContext.CurrentCustomer.Id,
Note = model.OrderNote,
DisplayToCustomer = true,
CreatedOnUtc = DateTime.Now
};
placeOrderResult.PlacedOrder.OrderNotes.Add(orderNote);
_orderService.UpdateOrder(placeOrderResult.PlacedOrder);
}
...