In every AspDotNetStorefront site, there is a contact form page that visitors can use to send you a message.
This is set up as a topic, and you can find it by going to www.yourdomain.com/t-contact.aspx.
This page can be modified through the HTML editor just like any other topic by going to Content > Manage Topics in version 8.0 or Misc > Topics in earlier versions.
Here, you can make any changes you like to the layout of the page, but what about modifying the actual email you get in your inbox when the contact form is submitted?
Unfortunately, there's no HTML editor for that. Luckily, we found a great feature built right into AspDotNetStorefront that allows you to customize the contact form! Without this feature, you'll still get your contact form results in your inbox, but using this feature will allow you to change the way it's displayed.
This is especially useful for quoting the original message in an email response to the visitor, but if you don't want those extra strange form tags to show up. What's a 'B1'? Who knows...let's get rid of it!
This tutorial will show you how to turn this:
Name=Nicole Swan Phone=541-201-9965 EMail=nicole@vortx.com Subject=Contact Form Submit Test S1=This is a test message submitted from the Contact Us page. B1=Submit into this:
Name: Nicole Swan Phone Number: 541-201-9965 Email: nicole@vortx.com Subject: Contact Form Submit Test Message: This is a test message submitted from the Contact Us page. This tutorial requires a basic knowledge of HTML and XML Packages. If you know a little HTML but you're not familiar with XML Packages, read on! This tutorial will help you get to know them. So, what's an XML Package? Your AspDotNetStorefront site uses XML Packages for a variety of functions that you would not be able to live without. Your category and product pages need them to display content, your search function uses it to display results, your news, minicart, & customer receipts all depend on them as well. With this tutorial, you will use an XML Package to control the form results sent from your contact page.
- Log in to your admin site, and head over to the AppConfig Parameters. This is located in the Configuration > Advanced menu in AspDotNetStorefront 8.0 or in the Misc menu in earlier versions.
- In the top left, under the "Add New" heading, you'll see two fields for "Config Name" and "Config Value", followed by a drop-down box.
- In the Config Namefield, type in 'SendForm.XmlPackage'.
- In the Config value field, type in 'notification.contactform.xml.config'
- In the drop-down menu, select XMLPACKAGE
- Open the XML Packages folder in the root of your site.
- Open the notification.newmemberwelcome.xml.config file in your favorite text editor*.
- Save this file as 'notification.contactform.xml.config' in the XML Packages directory.
<?xml version="1.0" encoding="utf-8" ?>
<package displayname="Contact Inquiry Form" version="2.1" debug="false">
<!-- ############################################ -->
<!-- Copyright AspDotNetStorefront.com, 1995-2008. All Rights Reserved. -->
<!-- http://www.aspdotnetstorefront.com -->
<!-- For details on this license please visit the product homepage at the URL above. -->
<!-- THE ABOVE NOTICE MUST REMAIN INTACT. -->
<!-- -->
<!-- ############################################ -->
<PackageTransform>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf">
<xsl:output method="html" omit-xml-declaration="yes" encoding="ISO-8859-1" />
<xsl:param name="LocaleSetting" select="/root/Runtime/LocaleSetting" />
<xsl:param name="WebConfigLocaleSetting" select="/root/Runtime/WebConfigLocaleSetting" />
<xsl:param name="StoreURL"><xsl:value-of select="/root/Runtime/StoreUrl" /></xsl:param>
<xsl:param name="StyleURL"><xsl:value-of select="$StoreURL" />skins/skin_<xsl:value-of select="aspdnsf:SkinID()" />/style.css</xsl:param>
<xsl:template match="/">
</xsl:template>
</xsl:stylesheet>
</PackageTransform>
</package> - Name
- Phone Number
- Subject
- Message
<b>Name:</b>
<br />
<b>Phone Number:</b>
<br />
<b>Email Address:</b>
<br />
<b>Subject:</b>
<br />
<b>Message:</b><b>Name:</b> <xsl:value-of select="/root/Form/name" />
<br />
<b>Phone Number:</b> <xsl:value-of select="/root/Form/phone" />
<br />
<b>Email Address:</b> <xsl:value-of select="/root/Form/email" />
<br />
<b>Subject:</b> <xsl:value-of select="/root/Form/subject" />
<br />
<b>Message:</b> <xsl:value-of select="/root/Form/s1" />
Now save your document and test it out! You can easily apply further modifications, just treat the <xsl:template> area of the XML Package like an HTML page. You can add HTML tags, & CSS styles to every element displayed. If you'd like to add your company logo at the bottom of the message, or a special coupon code for visitors sending inquiries, just add the text or image content wherever you'd like it to appear.
You can also add and remove form elements on the contact page, and display them on the page, just make sure your form fields each contain a unique 'name' attribute, and apply that with the value-of element in your Xml Package.
*All custom development of AspDotNetstorefront by Vortx is done with Microsoft Visual Studio. You can download the express edition here. You can also use any text editor such as notepad or wordpad, which both come with the Windows operating system. You can also use Notepad++ or Textpad, which are lightweight versions of Visual Studio, but heavyweight versions of notepad.
Tags: AspDotNetStoreFront, Contact Emails, XML








January 26th, 2009 at 11:59 pm
excellent..!! excellent post and help i have ever seen for ASPDNSF application. Just THE SAME what i want to have!! 1000 thanx to you buddy!!
March 30th, 2009 at 3:35 pm
[...] you may want to change the formatting of the emails you receive from the form. Take a look at this post for instructions on changing the appearance of contact form emails. Written by [...]
April 13th, 2009 at 4:32 pm
Hey – must have missed a step – i’m getting the formatting of the contact message correctly, but none of the content. No name, email or phone number is included in the email i receive after filling out the contact form. Any ideas?
thanks
April 13th, 2009 at 4:36 pm
First, set your Xml Package to debug=true, then run a test form through the site. Check your email, and there should be a bunch of Xml just below the contact form. Check each Xml node that you’re referencing in the form, and make sure it has content…for example, root > Form > name should have the name you put in the contact form. If root > Form > name does not exist, try and find whatever content you put in the form as a test, and see if it exists under another node.
Another thing to check for is case sensitivity. The latest ADSNF releases need to have the exact case used or it will not work, i.e. /root/Form/name is not the same as /root/Form/Name.
April 13th, 2009 at 8:39 pm
Hi
it was a case problem, but in an odd way. On the form, the fields were Name, Phone, EMail, etc. I set the case in the xml package to match the form – no luck. I then changed the field names in the form to all lower case (name, phone, email) and re-set the xml package to match that – and that worked. i don’t understand why that would be the case, but i can move on.
This is ASPDNSF ML 7.1.1.0. thanks for the advice.
October 12th, 2009 at 10:11 am
How do I get to the value of a dropdown selection with the xsl statement?
xsl:value-of select=”/root/Form/natureofrequest
nature of request is a select element in the form with three selection options:
General Inquiry
Order Status
Return