Today, in most of the e-commerce stores we see "Request a quote" form that needs to be filled by online customer to get price and other details regarding product(s).
Having "Request a quote" form on your online store is an important feature in e-commerce business
Here's the code to add "Request a quote" page in your project...
Add an aspx page and name it as : Requestaquote.aspx
Requestaquote.aspx
<%@ Page Language="C#" MasterPageFile="~/MasterPages/TwoColumn.master" AutoEventWireup="true"
CodeBehind="Requestaquote.aspx.cs" Inherits="NopSolutions.NopCommerce.Web.Requestaquote" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cph1" runat="server">
<asp:Label ID="ResultLabel" ForeColor="Red" runat="server" ></asp:Label><br />
Name: <asp:TextBox ID="NameTextBox" runat="server"></asp:TextBox><br />
Contact Number: <asp:TextBox ID="ContactNumberTextBox" runat="server"></asp:TextBox><br />
E-mail Address: <asp:TextBox ID="EmailTextBox" runat="server"></asp:TextBox><br />
Company: <asp:TextBox ID="CompanyTextBox" runat="server"></asp:TextBox><br />
Company Address: <asp:TextBox ID="AddressTextBox" runat="server"></asp:TextBox><br />
Enquiry (Message Body):
<br />
<asp:TextBox ID="EnquiryTextBox" TextMode="multiline" runat="server"
Height="155px" Width="430px"></asp:TextBox><br /><br />
<asp:Button ID="SubmitButton" runat="server" Text="Submit"
onclick="SubmitButton_Click" />
</asp:Content>
Requestaquote.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;
using NopSolutions.NopCommerce.BusinessLogic.Messages;
namespace NopSolutions.NopCommerce.Web
{
public partial class Requestaquote : BaseNopPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void SubmitButton_Click(object sender, EventArgs e)
{
string mailContent = string.Format("Name: {0}, Contact_Number:{1}, E-mail_Address:{2}, Company_Name:{3}, Company_Address:{4}, Enquiry:{5}", NameTextBox.Text, ContactNumberTextBox.Text, EmailTextBox.Text, CompanyTextBox.Text, AddressTextBox.Text, EnquiryTextBox.Text);
try
{
MailAddress from = new MailAddress(MessageManager.AdminEmailAddress, MessageManager.AdminEmailDisplayName);
MailAddress to = new MailAddress("[email protected]");
MessageManager.SendEmail("Request Quote", mailContent, from, to);
ResultLabel.Text = "We have received your quote... Thank You !!!";
}
catch (Exception ex)
{
ResultLabel.Text = "Error: " + ex.Message;
}
}
}
}
In Requestaquote.aspx.cs file please replace this "[email protected]" with your e-mail address where you want to receive your quotes from your customers...
This code is doing the basic functionality of a "Request Quote" form, you can add / remove any fields from the code and design the form according to your requirements.
Once you are done with the code, save it and add it in your main menu or wherever you want the link "Request Quote" to be displayed...