posted by  on  

This tutorial covers how to add a property to the "Customer" entity.

Updating an existing entity, or add new column in existing table follow the below steps.

Step 1

Open Customer.cs class from Nop.Core\Domain

Add new property like this.

/// <summary>
/// Gets or sets the confirmEmail
/// </summary>
public string ConfirmEmail { get; set; }

Step 2

Open CustomerModel.cs class from Nop.Admin\Models

Add new property like this.

[NopResourceDisplayName("Admin.Customers.Customers.Fields.ConfirmEmail")]
[AllowHtml]
public string ConfirmEmail { get; set; }

Step 3

Open CustomerController.cs from Nop.Admin\Controller

Modifiy PrepareCustomerModel method like this

PrepareCustomerModel

Step 4

Change in ActionResult Create() in HttpPost Attribute.

CreateCustomer

Step 5

Open _CreateOrUpdate.cshtml from Nop.Admin\Views

Add following code in this file

_CreateOrUpdate

Step 6

Open Customer table from your NopCommerce database.

Add column in this table.

CustomerTable

Note: Manually add this column is necessary.

Step 7

Finally build your solution and run your project.

Login as admin in your project.

Open language under Configuration menu and add ResourceValue and ResourceName.

AddNewCustomer

Thanks.

Lateshtclick Technology Blog
Tags NopCommerce MVC
posted by Latesht Click Latesht Click

Comments
i

ibrahim khattana

 6/12/2017

Thanks for sharing this Post. Can you please guide us how to add select list in customer.

M

MikeinNYC

 7/21/2017

I want to change the Register Page fields BUT not as attributes in Options. Will this work?

F

Filtershop

 12/7/2018

Hi, how can I add a phone number field on 'contact us page'. Please help, I'm a novice at coding.



Leave a Reply

Feel free to contribute!
Comment:
Name*:
Email*: