【问题标题】:Adding a note when order status is changed, nopcommerce 3.0 source订单状态更改时添加注释,nopcommerce 3.0 源
【发布时间】:2014-01-22 11:38:04
【问题描述】:

谁能帮我解决这个问题,我试图让它在订单状态更改时向系统添加注释,到目前为止,我已经添加了注释,但它显示为订单状态 ID 号而不是它的字符串引用

代码插入 OrderController.cs

 int osid = order.OrderStatusId;
     //order notes, notifications
     order.OrderNotes.Add(new OrderNote()
     {
         Note = string.Format("Order status has been changed to {0}",  osid.ToString()),
         DisplayToCustomer = false,
         CreatedOnUtc = DateTime.UtcNow
     });

我的下一步是什么?

【问题讨论】:

  • 您的问题不清楚?显示注释的代码在哪里?
  • @Falaque 添加注释的代码是 order.OrderNotes.Add(new OrderNote(),括号内的部分是添加到注释中的信息
  • 我的意思是在 UI 中,您需要查看使用了哪个引用,order.OrderStatusId 或 order.OrderNotes。

标签: c# asp.net asp.net-mvc-4 nopcommerce


【解决方案1】:

我现在已经完成了,

我只需要传递字符串变量 order.OrderStatus 而不是 ID,

修改后的代码

 order.OrderStatusId = model.OrderStatusId;
                 var os = order.OrderStatus;
                 //order notes, notifications
                 order.OrderNotes.Add(new OrderNote()
                 {
                     Note = string.Format("Order status has been changed to {0}", os.ToString()),
                     DisplayToCustomer = false,
                     CreatedOnUtc = DateTime.UtcNow
                 });

【讨论】:

    猜你喜欢
    • 2021-04-08
    • 2018-08-30
    • 2017-05-24
    • 1970-01-01
    • 2020-03-31
    • 2021-11-26
    • 1970-01-01
    • 2022-10-05
    • 2012-08-23
    相关资源
    最近更新 更多