How to sort the field of registration of a new client?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 anos atrás
How to sort the field of registration of a new client?

Thanks
7 anos atrás
gnikitsin wrote:
How to sort the field of registration of a new client?

Thanks


Here, you mean to sort the fields on registration form? Correct?

If you want to change the order of fields on registration page you need to edit register.cshtml file according to your requirments

File Path:
..\presentation\nop.web\views\customer\register.cshtml

For e.g. We want to move email and confirm email fields before date of birth field and just after last name.
here is change.

Before changes:


  <div class="inputs">
                       @Html.LabelFor(model => model.FirstName, new { }, ":")
                        @Html.EditorFor(model => model.FirstName)
                        @Html.RequiredHint()
                        @Html.ValidationMessageFor(model => model.FirstName)
                    </div>
                    <div class="inputs">
                        @Html.LabelFor(model => model.LastName, new { }, ":")
                        @Html.EditorFor(model => model.LastName)
                        @Html.RequiredHint()
                        @Html.ValidationMessageFor(model => model.LastName)
                    </div>
                    @if (Model.DateOfBirthEnabled)
                    {
                        <div class="inputs date-of-birth">
                            <label>@T("Account.Fields.DateOfBirth"):</label>
                            @Html.DatePickerDropDowns(Html.FieldNameFor(x => x.DateOfBirthDay),
                                Html.FieldNameFor(x => x.DateOfBirthMonth),
                                Html.FieldNameFor(x => x.DateOfBirthYear),
                                DateTime.Now.Year - 110,
                                DateTime.Now.Year,
                                Model.DateOfBirthDay,
                                Model.DateOfBirthMonth,
                                Model.DateOfBirthYear)
                            @if (Model.DateOfBirthRequired)
                            {
                                @Html.RequiredHint()
                            }
                            @Html.ValidationMessageFor(model => model.DateOfBirthDay)
                            @Html.ValidationMessageFor(model => model.DateOfBirthMonth)
                            @Html.ValidationMessageFor(model => model.DateOfBirthYear)
                        </div>
                    }
                    <div class="inputs">
                        @Html.LabelFor(model => model.Email, new { }, ":")
                        @Html.EditorFor(model => model.Email)
                        @Html.RequiredHint()
                        @Html.ValidationMessageFor(model => model.Email)
                    </div>
                    @if (Model.EnteringEmailTwice)
                    {
                        <div class="inputs">
                            @Html.LabelFor(model => model.ConfirmEmail, new { }, ":")
                            @Html.EditorFor(model => model.ConfirmEmail)
                            @Html.RequiredHint()
                            @Html.ValidationMessageFor(model => model.ConfirmEmail)
                        </div>
                    }



After changes:



<div class="inputs">
                       @Html.LabelFor(model => model.FirstName, new { }, ":")
                        @Html.EditorFor(model => model.FirstName)
                        @Html.RequiredHint()
                        @Html.ValidationMessageFor(model => model.FirstName)
                    </div>
                    <div class="inputs">
                        @Html.LabelFor(model => model.LastName, new { }, ":")
                        @Html.EditorFor(model => model.LastName)
                        @Html.RequiredHint()
                        @Html.ValidationMessageFor(model => model.LastName)
                    </div>

                    <div class="inputs">
                        @Html.LabelFor(model => model.Email, new { }, ":")
                        @Html.EditorFor(model => model.Email)
                        @Html.RequiredHint()
                        @Html.ValidationMessageFor(model => model.Email)
                    </div>
                    @if (Model.EnteringEmailTwice)
                    {
                        <div class="inputs">
                            @Html.LabelFor(model => model.ConfirmEmail, new { }, ":")
                            @Html.EditorFor(model => model.ConfirmEmail)
                            @Html.RequiredHint()
                            @Html.ValidationMessageFor(model => model.ConfirmEmail)
                        </div>
                    }

                    @if (Model.DateOfBirthEnabled)
                    {
                        <div class="inputs date-of-birth">
                            <label>@T("Account.Fields.DateOfBirth"):</label>
                            @Html.DatePickerDropDowns(Html.FieldNameFor(x => x.DateOfBirthDay),
                                Html.FieldNameFor(x => x.DateOfBirthMonth),
                                Html.FieldNameFor(x => x.DateOfBirthYear),
                                DateTime.Now.Year - 110,
                                DateTime.Now.Year,
                                Model.DateOfBirthDay,
                                Model.DateOfBirthMonth,
                                Model.DateOfBirthYear)
                            @if (Model.DateOfBirthRequired)
                            {
                                @Html.RequiredHint()
                            }
                            @Html.ValidationMessageFor(model => model.DateOfBirthDay)
                            @Html.ValidationMessageFor(model => model.DateOfBirthMonth)
                            @Html.ValidationMessageFor(model => model.DateOfBirthYear)
                        </div>
                    }



Please make sure that your are copying proper block, If those block are with @if conditions then you should exactly copy them with full block and also check that you are putting them in any other conditional code block.

Important : Please backup your existing register.cshtml file before making any changes, so you can revert it back if anything goes wrong.

Hope this helps!
7 anos atrás
gnikitsin wrote:
How to sort the field of registration of a new client?

Thanks

Hi.
In what order are u going to sort fieldS in the registration form?
...  just  change the corresponding view.shtml  file.
Best Regards.
... sorry was late.
7 anos atrás
ajaysolanki wrote:
How to sort the field of registration of a new client?

Thanks

Here, you mean to sort the fields on registration form? Correct?

If you want to change the order of fields on registration page you need to edit register.cshtml file according to your requirments

File Path:
..\presentation\nop.web\views\customer\register.cshtml

For e.g. We want to move email and confirm email fields before date of birth field and just after last name.
here is change.

Before changes:


  <div class="inputs">
                       @Html.LabelFor(model => model.FirstName, new { }, ":")
                        @Html.EditorFor(model => model.FirstName)
                        @Html.RequiredHint()
                        @Html.ValidationMessageFor(model => model.FirstName)
                    </div>
                    <div class="inputs">
                        @Html.LabelFor(model => model.LastName, new { }, ":")
                        @Html.EditorFor(model => model.LastName)
                        @Html.RequiredHint()
                        @Html.ValidationMessageFor(model => model.LastName)
                    </div>
                    @if (Model.DateOfBirthEnabled)
                    {
                        <div class="inputs date-of-birth">
                            <label>@T("Account.Fields.DateOfBirth"):</label>
                            @Html.DatePickerDropDowns(Html.FieldNameFor(x => x.DateOfBirthDay),
                                Html.FieldNameFor(x => x.DateOfBirthMonth),
                                Html.FieldNameFor(x => x.DateOfBirthYear),
                                DateTime.Now.Year - 110,
                                DateTime.Now.Year,
                                Model.DateOfBirthDay,
                                Model.DateOfBirthMonth,
                                Model.DateOfBirthYear)
                            @if (Model.DateOfBirthRequired)
                            {
                                @Html.RequiredHint()
                            }
                            @Html.ValidationMessageFor(model => model.DateOfBirthDay)
                            @Html.ValidationMessageFor(model => model.DateOfBirthMonth)
                            @Html.ValidationMessageFor(model => model.DateOfBirthYear)
                        </div>
                    }
                    <div class="inputs">
                        @Html.LabelFor(model => model.Email, new { }, ":")
                        @Html.EditorFor(model => model.Email)
                        @Html.RequiredHint()
                        @Html.ValidationMessageFor(model => model.Email)
                    </div>
                    @if (Model.EnteringEmailTwice)
                    {
                        <div class="inputs">
                            @Html.LabelFor(model => model.ConfirmEmail, new { }, ":")
                            @Html.EditorFor(model => model.ConfirmEmail)
                            @Html.RequiredHint()
                            @Html.ValidationMessageFor(model => model.ConfirmEmail)
                        </div>
                    }



After changes:



<div class="inputs">
                       @Html.LabelFor(model => model.FirstName, new { }, ":")
                        @Html.EditorFor(model => model.FirstName)
                        @Html.RequiredHint()
                        @Html.ValidationMessageFor(model => model.FirstName)
                    </div>
                    <div class="inputs">
                        @Html.LabelFor(model => model.LastName, new { }, ":")
                        @Html.EditorFor(model => model.LastName)
                        @Html.RequiredHint()
                        @Html.ValidationMessageFor(model => model.LastName)
                    </div>

                    <div class="inputs">
                        @Html.LabelFor(model => model.Email, new { }, ":")
                        @Html.EditorFor(model => model.Email)
                        @Html.RequiredHint()
                        @Html.ValidationMessageFor(model => model.Email)
                    </div>
                    @if (Model.EnteringEmailTwice)
                    {
                        <div class="inputs">
                            @Html.LabelFor(model => model.ConfirmEmail, new { }, ":")
                            @Html.EditorFor(model => model.ConfirmEmail)
                            @Html.RequiredHint()
                            @Html.ValidationMessageFor(model => model.ConfirmEmail)
                        </div>
                    }

                    @if (Model.DateOfBirthEnabled)
                    {
                        <div class="inputs date-of-birth">
                            <label>@T("Account.Fields.DateOfBirth"):</label>
                            @Html.DatePickerDropDowns(Html.FieldNameFor(x => x.DateOfBirthDay),
                                Html.FieldNameFor(x => x.DateOfBirthMonth),
                                Html.FieldNameFor(x => x.DateOfBirthYear),
                                DateTime.Now.Year - 110,
                                DateTime.Now.Year,
                                Model.DateOfBirthDay,
                                Model.DateOfBirthMonth,
                                Model.DateOfBirthYear)
                            @if (Model.DateOfBirthRequired)
                            {
                                @Html.RequiredHint()
                            }
                            @Html.ValidationMessageFor(model => model.DateOfBirthDay)
                            @Html.ValidationMessageFor(model => model.DateOfBirthMonth)
                            @Html.ValidationMessageFor(model => model.DateOfBirthYear)
                        </div>
                    }



Please make sure that your are copying proper block, If those block are with @if conditions then you should exactly copy them with full block and also check that you are putting them in any other conditional code block.

Important : Please backup your existing register.cshtml file before making any changes, so you can revert it back if anything goes wrong.

Hope this helps!


Hi. Thanks but i want sort custmer attribute fields.
7 anos atrás
Custom customer attributes have a Display Order field in their configuration.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.