Second contact form

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
Hello,

I have the contact form working fine, but I want to add another page, something like "Request a demo".

This form would be entirely different to the in built Contact form, but would behave much the same way (user fills out form, clicks submit, email sent, confirmation page displayed).

I would like to know the best way about doing this please.

Should I try and copy the contact form, duplicate it, and use it's methods to send an email that has different fields?

I was thinking maybe make two topics, one form the contact form, one for the confirmation/thank you. Then just have the form submit to a page that processes the email that then redirects to the thank you page. I guess the processing page can be c#? Ideally I can pass variables between the pages, so my confirmation page can say "Thank you [submitters name] for requesting a demo".

I'll make a start and see what I can come up with, but if anyone has any good ideas please?

Thank you
11 years ago
I just found in version 2 there was a "Request a quote" form plugin.

I believe there have been some significant changes since then. Maybe I can take the 2.00 plugin and update it to work with 2.5? What do you think?

Thanks
11 years ago
I will follow

https://www.nopcommerce.com/boards/t/3177/urgent-i-need-to-create-a-new-page-with-a-fill-in-form-how-.aspx?p=1

But try to adapt it for MVC and let you know how I get on. If it's any good I'll try to figure out how to make it into a plugin that I can submit and give something back :)

If anyone has any hints or good ideas in the mean time please say :)

Thanks
11 years ago
Just letting you know your not alone here, i'm trying to do exactly the same just with image upload and attachements.

Let us post our clues we gather in here.
11 years ago
I have managed to replicate the contact form and made a new "RequestADemo" form. It was fairly straightforward to be honest.

I created

Nop.Web/Views/Common/RequestADemo.cshtml (view),
Nop.Web/Models/Common/RequestADemo.cs (model),
RequestADemoValidator.cs (validator)

and expanded  

Nop.Web/Controllers/CommonControllers.cs (controller) and
Nop.Web/Infrastructure/RouteProvider.cs (route) to include the new RequestADemo stuff.

Each time I just copied the equivalent from ContactUs, replacing anywhere it said "ContactUs" with "RequestADemo".

After making sure that worked I then just expanded the view/validator/controller to handle more fields and updated the LocalStringResource database table to add lots of new phrases for my new form. I also added a RequestADemo topic to add content to the top of my form.


My next challenge is figuring out how I do more than just @Html.TextBoxFor and @Html.TextAreaFor?

I have looked for more in @Html, like @Html.Select, but it seems I have to add something like


<select id="selectDemoVersion" runat="server">
   <option value="1">One</option>
   <option value="2">Two</option>
   <option value="3">Three</option>
</select>


which doesn't seem right. Any ideas please? I'm not that hot with ASP.net.

Thanks!
11 years ago
I got it!

@Html.DropDownListFor(
                            model => model.PreviousVersion,
                            new SelectList(
                                    new List<Object>{
                                        new { value = 1 , text = "Yes"  },
                                        new { value = 0 , text = "No" }
                                    },
                                    "value",
                                    "text"
                            )
                        )


and

@Html.CheckBoxFor(model => model.AgreeToTerms, new { @class = "agreetoterms" })


Which work for me, but if there is a better way let me know :)
11 years ago
Russ,

Can you please upload your code to help others ??
11 years ago
Elisha: What are you stuck on specifically? As per my post I basically copied all the files that I listed and renamed the word "Contact" with "RequestADemo" each time :)
11 years ago
Russ,

I just tried setting up default email address for the similar functionality but it never goes through.

Also, I am newbie on this and I do not know much about these all so I was wishing if you can help me out posting your code in zipped format with folder specific so that I can just copy paste and see how it looks on my demo application

Thanks much,
Elisha Cornelius
11 years ago
elisha;

Start by copying

Nop.Web/Views/Common/ContactUs.cshtml (view),
Nop.Web/Models/Common/ContactUs.cs (model),
Nop.Web/Validators/Common/ContactUsValidator.cs (validator)

And replace anything that says "ContactUs" with what you would like to call your form (in my case "RequestADemo").

Then edit

Nop.Web/Controllers/CommonControllers.cs (controller)

(hint: there are two functions, both under "//contact us page" called ContactUs() and ContactUsSend())

Nop.Web/Infrastructure/RouteProvider.cs (route)

(hint: this bit

//contact us
            routes.MapLocalizedRoute("ContactUs",
                            "contactus",
                            new { controller = "Common", action = "ContactUs" },
                            new[] { "Nop.Web.Controllers" });


)

duplicating anything that seems specific to ContactUs to become "RequestADemo".

I'm pretty sure that's literally all I did.

Have a go at that, should be straight forward.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.