Sending a Merchant Page Snapshot Unlimited Contact Forms
Beginning with Tool Kit version 5.0920
customers can send a snapshot of almost any page in your store to himself, a friend, or himself and a friend.
To see how it works go to
this storefront. Scroll to the bottom of the page and
fill in the form. You can also create a form with a text input (instead of hidden) so the
customer can choose the page to send, instead of just the one they are on.
The Screen input is the page the customer is forwarded to when the send is successful. The
Return_Screen input is the screen they go back to when there is a problem. Return_Screen value is
usually the page code for the page the form is on. The pagecode input is the code of the page
to send. In most cases these are all the same screen. The other inputs are self explanatory.
Be sure to use &mvte instead of &mvt when displaying
variables which can be controlled or inserted by the customer; in other words, all of these variables.
The default character set is iso-8859-1. If your pages are something else, e.g. utf-8, you can include
a hidden input to change the character set. If you want utf-8, you would put
<input type="hidden" name="charset" value="utf-8"> along with the other form inputs. There are many
security features built into this function to prevent spamming. One of these features is the ability to
use a math challenge input. I suggest you use this. The sendpage function is the same one used by our Mail Manager
module for quite some time now for sendng merchant pages.
Example of the form at
this storefront:
<mvt:if expr="g.to_email">
<mvt:if expr="(g.verifyA LT 3) OR (g.verifyB LT 3)">
<mvt:item name="toolkit" param="sassign|kill_email|1" />
</mvt:if>
<mvt:if expr="(g.verifyA + g.verifyB) EQ g.verifyC">
<mvt:item name="toolkit" param="sassign|tryagain|" />
<mvt:else>
<mvt:item name="toolkit" param="sassign|tryagain|Try Again!" />
<mvt:item name="toolkit" param="sassign|kill_email|1" />
</mvt:if>
<mvt:item name="toolkit" param="sassign|cc_email|abc@yourdomain.com" />
<mvt:if expr="NOT g.kill_email">
<h3>
Email Sent to &mvte:global:to_email;</h3>
</mvt:if>
</mvt:if>
<mvt:if expr="g.tryagain">
<font color="red">
<br>
&mvte:global:tryagain;<br>
</font>
</mvt:if>
<form method="post" action="&mvt:global:sessionurl;">
<input type="hidden" name="Store_Code" value="&mvte:global:Store_Code;">
<input type="hidden" name="Screen" value="SFNT">
<input type="hidden" name="Return_Screen" value="SFNT">
<input type="hidden" name="Action" value="NEW">
<mvt:item name="toolkit" param="sendpage" />
<table border="0">
<tr>
<th align="left" colspan="2">
Send this page to a friend: <input type="hidden" name="pagecode" value="SFNT">
</th>
</tr>
<tr>
<td align="right">
From:</td>
<td align="left">
<input type="text" name="from_email" value="&mvte:global:from_email;" size="30">
</td>
</tr>
<tr>
<td align="right">
To:</td>
<td align="left">
<input type="text" name="to_email" value="&mvte:global:to_email;" size="30">
</td>
</tr>
<tr>
<td align="right">
Subject:</td>
<td align="left">
<input type="text" name="subject" value="&mvte:global:subject;" size="30">
</td>
</tr>
<tr>
<td align="right">
Comment:</td>
<td align="left">
<textarea rows="5" cols="30" name="mycomment">
&mvte:global:mycomment;</textarea>
<br>
No HTML
</td>
</tr>
<tr>
<td align="right">
<mvt:if expr="(NOT g.verifyA AND NOT g.verifyB) OR g.kill_email">
<mvt:item name="toolkit" param="sassign|three|3" />
<mvt:item name="toolkit" param="random|verifyA|9" />
<mvt:item name="toolkit" param="random|verifyB|9" />
<mvt:item name="toolkit" param="math_add|verifyA|verifyA|three" />
<mvt:item name="toolkit" param="math_add|verifyB|verifyB|three" />
</mvt:if>
&mvte:global:verifyA;
+
&mvte:global:verifyB;
=
<input type="hidden" name="verifyA" value="&mvte:global:verifyA;">
<input type="hidden" name="verifyB" value="&mvte:global:verifyB;">
</td>
<td align="left">
<input type="text" name="verifyC" value="" size="10">
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="submit" name="trash" value="Send">
</td>
</tr>
</table>
</form>
In addition to the form, you can include a message at the top of the page to tell the
sender what happened. I put this right after the body token and before the global header token.
<mvt:if expr="mycomment AND NOT g.kill_email">
Sent to: &mvte:global:to_email;
<br>
Comment: &mvte:global:mycomment;
</mvt:if>
<mvt:if expr="g.kill_email">
<font color="red">
&mvte:global:kill_email;<br>
</font>
</mvt:if>
<mvt:if expr="g.tryagain">
<font color="red">
&mvte:global:tryagain;<br>
</font>
</mvt:if>
Example of the choose page form:
<mvt:if expr="g.kill_email">
&mvte:global:kill_email;<br>
</mvt:if>
<form method="post" action="&mvt:global:sessionurl;">
<input type="hidden" name="Store_Code" value="&mvte:global:Store_Code;">
<input type="hidden" name="Screen" value="SENT">
<input type="hidden" name="Return_Screen" value="MISC">
<input type="hidden" name="Action" value="NEW">
<mvt:item name="toolkit" param="sendpage" />
<table border="0">
<tr>
<th align="left" colspan="2">
Send this page: <input type="text" name="pagecode" value="BASK">
</th>
</tr>
<tr>
<td align="right">
From:</td>
<td align="left">
<input type="text" name="from_email" value="&mvte:global:from_email;" size="30">
</td>
</tr>
<tr>
<td align="right">
To:</td>
<td align="left">
<input type="text" name="to_email" value="&mvte:global:to_email;" size="30">
</td>
</tr>
<tr>
<td align="right">
CC:</td>
<td align="left">
<input type="text" name="cc_email" value="&mvte:global:cc_email;" size="30">
</td>
</tr>
<tr>
<td align="right">
Subject:</td>
<td align="left">
<input type="text" name="subject" value="&mvte:global:subject;" size="30">
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="submit" name="trash" value="Send">
</td>
</tr>
</table>
</form>
You can create an unlimited number of contact
forms for Merchant. You simply create a page with the form inputs on it. Then create a page
that receives, interprets and validates the inputs. You can include a random generated math
challenge question to cut down on spammers. You can validate inputs with store morph technology
(Merchant page template) code and send the customer back to the original form if there is a problem
with an input. Using the page sending feature of the Tool Kit, the completed page (from form data) is
then sent via email to the email address of your chosing. You can allow the customer to select the "To"
recipient from a drop down list or you can make it a hidden input. On the receiving form, you can validate that "To"
recipient from the list of allowed "To" emails to prevent customers from using your form for sending spam. Here's
a
simple example of this form. You can make the form as simple or complex as you want with
validation code in the receiving page. The module has a function for killing the email before it is
sent so the customer is sent back to the "Return_Screen". See the usage of the function
<mvt:item name="toolkit" param="sassign|kill_email|1" />
below as it used in the receiving page.
The Screen input is the page the customer is forwarded to when the send is successful. Create a
simple page called SENT with text saying your email was sent. The
Return_Screen input is the screen they go back to when there is a problem. Return_Screen value is
usually the page code for the page the form is on. The pagecode input is the code of the receiving page
to send. The other inputs are self explanatory. Be sure to use &mvte instead of &mvt when displaying
variables which can be controlled or inserted by the customer; in other words, all of these variables. If
you have trouble making this work, start by using my examples below (without the security challenge) and
changing only the email addresses in the RCPT2 page. Then test. Once working, make small changes as needed.
Example of sending form on a page called
FORM2:
<mvt:if expr="g.kill_email">
&mvte:global:kill_email;<br>
</mvt:if>
<form method="post" action="&mvt:global:sessionurl;">
<input type="hidden" name="Store_Code" value="&mvte:global:Store_Code;">
<input type="hidden" name="Screen" value="SENT">
<input type="hidden" name="Return_Screen" value="FORM2">
<input type="hidden" name="Action" value="NEW">
<mvt:item name="toolkit" param="sendpage" />
<table border="0">
<tr>
<th align="left" colspan="2">
<input type="hidden" name="pagecode" value="RCPT2">
</th>
</tr>
<tr>
<td align="right">
From:</td>
<td align="left">
<input type="text" name="from_email" value="&mvte:global:from_email;" size="30">
</td>
</tr>
<tr>
<td align="right">
To:</td>
<td align="left">
<select name="to_email">
<option value="bill">
Bill</option>
<option value="william">
William</option>
</select>
</td>
</tr>
<tr>
<td align="right">
Subject:</td>
<td align="left">
<input type="text" name="subject" value="&mvte:global:subject;" size="30">
</td>
</tr>
<tr>
<td align="left" colspan="2">
Inquiry<br>
<textarea rows="10" cols="40" name="inquiry">
&mvte:global:inquiry;</textarea>
<br>
NO HTML
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="submit" name="trash" value="Send">
</td>
</tr>
</table>
</form>
You can also include a security challenge, for example:
<tr>
<td align="right">
<mvt:item name="toolkit" param="sassign|three|3" />
<mvt:item name="toolkit" param="random|verifyA|9" />
<mvt:item name="toolkit" param="random|verifyB|9" />
<mvt:item name="toolkit" param="math_add|verifyA|verifyA|three" />
<mvt:item name="toolkit" param="math_add|verifyB|verifyB|three" />
&mvte:global:verifyA;
+
&mvte:global:verifyB;
=
<input type="hidden" name="verifyA" value="&mvte:global:verifyA;">
<input type="hidden" name="verifyB" value="&mvte:global:verifyB;">
</td>
<td align="left">
<input type="text" name="verifyC" value="" size="10">
</td>
</tr>
Example receiving code on a page called
RCPT2:
<mvt:if expr="g.to_email EQ 'bill'">
<mvt:item name="toolkit" param="sassign|to_email|wcw@yourdomain.com" />
</mvt:if>
<mvt:if expr="g.to_email EQ 'william'">
<mvt:item name="toolkit" param="sassign|to_email|abc@yourdomain.com" />
</mvt:if>
<mvt:item name="toolkit" param="sassign|cc_email|" />
<mvt:if expr="(g.to_email CIN 'wcw@yourdomain.com|abc@yourdomain.com') EQ 0">
<mvt:item name="toolkit" param="sassign|kill_email|Unauthorized email" />
</mvt:if>
<mvt:if expr="'<' IN g.inquiry">
<mvt:item name="toolkit" param="sassign|inquiry|no html" />
<mvt:item name="toolkit" param="sassign|kill_email|no html allowed" />
</mvt:if>
Customer email: &mvte:global:from_email;<br>
Inquiry: &mvte:global:inquiry;
You can also run a security check before accepting the post.
<mvt:if expr="(g.verifyA LT 3) OR (g.verifyB LT 3)">
<mvt:item name="toolkit" param="sassign|kill_email|math error" />
</mvt:if>
<mvt:if expr="(g.verifyA + g.verifyB) EQ g.verifyC">
<mvt:else>
<mvt:item name="toolkit" param="sassign|kill_email|check your math" />
</mvt:if>