How to add a dropdownlist in Contact us page?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
10 năm cách đây
Dear all,

I am using Nop 3.1 version, I would like to add a Dropdownlist in Contact us page,
and it could change the Contact us Email Title which I want to seperate the question type.

Does it can be added in the contactus.cshtml? or It will need edit others files?
Please tell me how to add this function, and thank you very much.
10 năm cách đây
You need to change view side and source code as well.
Look into Views/Customer/Register.cshtml
10 năm cách đây
but I am not familiar with CSHTML code,
is there another way to add a simply contact us email post in the nopcommerce pages?
9 năm cách đây
Silver
A little more information , if you would be so kind..
9 năm cách đây
I just did this myself (nop 3.1)
the Model, View and Controller all have to change:

Model - add something like this to ContactUsModel.cs
        
public ContactUsModel()
{
            this.SubjectDD = new List<SelectListItem>();
            SubjectDD.Add(new SelectListItem() { Text = "Order Status Inquiry", Value = "Order Status Inquiry" });
            SubjectDD.Add(new SelectListItem() { Text = "Billing Inquiry", Value = "Billing Inquiry" });
            SubjectDD.Add(new SelectListItem() { Text = "Return Inquiry", Value = "Return Inquiry" });
            SubjectDD.Add(new SelectListItem() { Text = "Other Question", Value = "Other Question" });
}

        
[NopResourceDisplayName("ContactUs.Subject")]
[AllowHtml]
public string Subject { get; set; }
  [NopResourceDisplayName("ContactUs.Subject")]
public IList<SelectListItem> SubjectDD { get; set; }


View -
<div>
  @Html.LabelFor(model => model.SubjectDD)
  @Html.DropDownList("Subject", Model.SubjectDD);
</div>


Controller -- CommonController.ContactSent(...)
String subject = model.Subject ;


No Warranties - your mileage may vary . . .
6 năm cách đây
I found the easiest to have a dropdown by just changing following the following line in Presentation\Nop.Web\Views\Common\ContactUs.cshtml:
@Html.TextBoxFor(model => model.Subject, new { @class = "subject", placeholder = T("ContactUs.Subject.Hint") })

to
                                <select id="Subject" name="Subject">
                                    <option value="volvo">Volvo</option>
                                    <option value="saab">Saab</option>
                                    <option value="mercedes">Mercedes</option>
                                    <option value="audi">Audi</option>
                                </select>
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.