Is it possible to display message token in view?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
In the admin orders section, I have added a new column.

{
                                            field: "SupervisorEmail",
                                            title: "@T("admin.orders.fields.supervisor")",
                                            width: 150,
                                            template: '%Customer.CustomSupervisorEmail%'
                                          
                                        },

The message template works correctly for emails. The token is replaced with the correct email of the supervisor. Is there a way to display this dynamic data in the admin orders list as well? Right now it simply prints out "Customer.CustomSupervisorEmail%".
5 years ago
You need to update the controller as well.

5 years ago
In OrderController.cs, I have:

var gridModel = new DataSourceResult
            {
                Data = orders.Select(x =>
                {
                    var store = _storeService.GetStoreById(x.StoreId);
                    return new OrderModel
                    {
                        Id = x.Id,
                        StoreName = store != null ? store.Name : "Unknown",
                        OrderTotal = _priceFormatter.FormatPrice(x.OrderTotal, true, false),
                        OrderStatus = x.OrderStatus.GetLocalizedEnum(_localizationService, _workContext),
                        OrderStatusId = x.OrderStatusId,
                        PaymentStatus = x.PaymentStatus.GetLocalizedEnum(_localizationService, _workContext),
                        PaymentStatusId = x.PaymentStatusId,
                        ShippingStatus = x.ShippingStatus.GetLocalizedEnum(_localizationService, _workContext),
                        ShippingStatusId = x.ShippingStatusId,
                        CustomerEmail = x.Customer.Email,
                        CustomerFullName = string.Format("{0} {1}", x.BillingAddress.FirstName, x.BillingAddress.LastName),
                        CreatedOn = _dateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc),
                        SupervisorEmail = x.GetAttribute<string>("customer_attribute_5")
                    };
                }),
                Total = orders.TotalCount
            };

In bold is the addition I made. This value is returning NULL.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.