1. Multiform setup
To create multiple forms, go to “Nop4you/Tickets System/Form Templates”. Here you can add prepare templates (as a file) and set user friendly name.
Files go to:
At this folder you will find default template, which you can use as a base, to create new view of your contact form.
Next, lets create new form, and add it to new location. Go to “Nop4you/Tickets System/My Forms” and click “Add new”.
First, name of your form. Next, choose widget zone in which your custom form should be placed. You may also set response message to customer, and template which you want use to show your final customer. As well, you may also set department and priority to this form. As a final customization, you can use own styles.
Idea of using widget zone is possibility to completely control where to placed forms on the page. If you want on every page that use OneColumn, you can simply add widget zone to that file. In my example, I just need one extra form to use only on home page. To do it, I just copy to my default theme folder “Home” from standard “View” folder.
Open Index.cshtml and add:
For nopCommerce up to 3.90: @Html.Widget("home_contact")
For nopCommerce from 4.00: @await Component.InvokeAsync("Widget", new { widgetZone = "home_contact" })
nopCommerce up to 3.90
nopCommerce 4.00 and up
Now, we can add new form at the admin panel. Just fill it like this:
And result of it will be just a simple form with just one field (which is obligatory for every form):
How custom css works? Simply add to css form:
.form-fields {
background-color: red;
}
And it result:
Now, let`s add some fields to our new custom contact form.
Opens new form to add attributes:
And one more:
And it result:
2. Own fields in ticket (3.80)
If you would like to modify standard ticket view by adding some extra forms, you may do it!
Standard ticket form looks like:
To add extra field go to
And add new field by clicking Add button. It would open new form:
You may specify here, to which form you want assign new field.
Localization option will allow to assign field to specific form:
- All form – to all existing forms on the store
- Ticket Form – only to ticket form
- Contact Form – only to contact form
- Order Form – only to form created from order
- Product form – only to form created from product.
In this case, I chosen Ticket Form, and will need to add some values (chosen drop-down list type). I added two options:
Now, let`s go back to customer`s account, and refresh New Ticket page.
This way you will be able to add to any required form custom values. Just remember to add token to message templates to show custom field to your customer`s mail. By default, admin ticket list (at admin panel) it`s showing all fields.