how to add new customer attributes in v2.50

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
Anybody please guide me?
11 years ago
Hello Ashish,

Its pretty simple to add new attributes in v 2.50.

First you need to start with Modification under Nop.Core
1. Under Libraries: (We will use this enum afterwards)
   Path : Nop.Core->Domain->Customers
    File Name : SystemCustomerAttributeNames.cs
    Add new attribute name. Make sure the name is unique, it should not be duplicated in any ways.  Also, it always has to be read-only string.

2. You need to change following models Add newly added field/s to the files given below
    Path: Nop.Web->Models->Customer
    Models to Edit : RegisterModel.cs
                           CustomerInfoModel.cs

3. You need to change following views
. Add newly added field/s to the files given below
    Path: Nop.Web->Views->Customer
    Views to Edit :  Info.cshtml
                          Info.Mobile.cshtml
                          Register.cshtml
                          Register.Mobile.cshtml

4. You need to modify following Controllers.
    Path: Nop.Web->Controllers
    File : CustomerController.cs. After Line # : 344
    Under this
public ActionResult Register(RegisterModel model, bool captchaValid)
method you will find code that maps the customer attributes with Model. Just after the Line # : 344
    
Once you are done with these all changes please confirm whether its saving records and customer attributes on the database or not.

Keep posting on this post. As soon as you are done for capturing additional attributes from User when registering on the website let me know so I can explain you further how to manage these information on the admin side and how you can make it visible on admin grid-view etc.



VOTE UP IF THIS REALLY HELPED YOU TO ACHIEVE YOUR GOAL
11 years ago
Thanks elisha

With your help and reference this article: https://www.nopcommerce.com/docs/73/updating-an-existing-entity-how-to-add-a-new-property.aspx - I had things done! :)
11 years ago
elisha wrote:
Keep posting on this post. As soon as you are done for capturing additional attributes from User when registering on the website let me know so I can explain you further how to manage these information on the admin side and how you can make it visible on admin grid-view etc.


Amazing post... can you explain how to implement the above (admin side) in 2.65
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.