How can I display customer IP address in \Administration\Views\Customer\List.cshtml ?

3 weeks ago
3.90

I want to show customer IP address in Administration\Views\Customer\List.cshtml?

I need to have it here (piece of code from \Customer\List.cshtml):
{
field: "Active",
title: "@T("Admin.Customers.Customers.Fields.Active")",
width: 100,
headerAttributes: { style: "text-align:center" },
attributes: { style: "text-align:center" },
template: '# if(Active) {#  #} else {#  #} #'
}, {
field: "CreatedOn",
title: "@T("Admin.Customers.Customers.Fields.CreatedOn")",
width: 200,
type: "date",
format: "{0:G}"
}, {
field: "LastActivityDate",
title: "@T("Admin.Customers.Customers.Fields.LastActivityDate")",
width: 200,
type: "date",
format: "{0:G}"
},


I tried this the same as in OnlineCustomer, but it doesn't work...
{
field: "LastIpAddress",
title: "@T("Admin.Customers.OnlineCustomers.Fields.IPAddress")"
},


Thanks for your help.
3 weeks ago
Hi
you need to add the IP address logic here first

PrepareCustomerListModel
customerModel.LastIpAddress = customer.LastIpAddress;
3 weeks ago
ilyas_patel wrote:
Hi
you need to add the IP address logic here first

PrepareCustomerListModel
customerModel.LastIpAddress = customer.LastIpAddress;


Is it in source code? Or in .cshmtl file?
3 weeks ago
zaf wrote:
Hi
you need to add the IP address logic here first

PrepareCustomerListModel
customerModel.LastIpAddress = customer.LastIpAddress;

Is it in source code? Or in .cshmtl file?


It is in source code. Method name is PrepareCustomModelForList().