I did not use custom customer attribute here, since I want to use this new column(future maybe 3-4 new columns) to filte the orders in Admin in the future. This is only the 1st step.
Expection: 1. Display the more new columns in customer registration page, and store the data into the database 2. Use these new columns as query condition in filter in Admin page in the future.
Thanks for the quick response. I am trying to put below code into: Presentation\Nop.Web\Views\Customer\Register.cshtml
@if (Model.groupownerEnabled) { <div class="inputs"> <label asp-for="groupowner" asp-postfix=":"></label> <input asp-for="groupowner" /> @if (Model.groupownerRequired) { <nop-required /> } <span asp-validation-for="groupowner"></span> </div> } rebuild/run, but still no more columns displayed in registration page. any idea? thanks.
in RegisterModel.cs, I also added the following:
public bool groupownerEnabled { get; set; } public bool groupownerRequired { get; set; } // The NopResourceDisplayName provides the "key" used during localization // Keep an eye out for more about localization in future blogs [NopResourceDisplayName("Admin.Customers.Customers.Fields.groupowner")] public string groupowner { get; set; }
as you have added this field bool value so I assume , you are fetching this value from setting ,
so while call the get method of register did you added things in customerFactory if not just add the things into the factory and assign to group owner enable
Yes you are right, after removing: @if (Model.groupownerEnabled) I can see the new column in register page. How can I set the anbled/required? there are 2 places for CustomerFactory: 1. Presentation/Nop.Web/Areas/Admin/Factoryies/CustomerModelFactory.cs 2. Presentation/Nop.Web/Factories/CustomerModelFactory.cs
which one I need to select? what's the difference? and how to change? thanks.