Send Wishlist to Friend#
Description#
Send Wish list to Friend (MVT using Miva’s Wishlist)
Snippet#
<mvt:if expr="g.wishlist_url AND g.email_a_friend">
<mvt:comment> <!-- Empty Check --> </mvt:comment>
<mvt:if expr="ISNULL g.from_name">
<mvt:assign name="g.wishlist_email_error" value="'Please make sure <strong>Your Name</strong> is filled out.'" />
<mvt:elseif expr="ISNULL g.friend_name">
<mvt:assign name="g.wishlist_email_error" value="'Please make sure your <strong>Friend\'s Name</strong> is filled out.'" />
<mvt:elseif expr="ISNULL g.friend_email">
<mvt:assign name="g.wishlist_email_error" value="'Please make sure your <strong>Friends\'s Email</strong> is filled out.'" />
</mvt:if>
<mvt:comment> <!-- Make sure Friend's email is valid --></mvt:comment>
<mvt:if expr="ISNULL g.wishlist_email_error">
<mvt:do name="l.validEmail" file="g.Module_Root $ g.Library_Utilities" value="Email_Validate( g.friend_email )" />
<mvt:if expr="l.validEmail">
<mvt:assign name="g.subject" value="'Check out ' $ g.from_name $ '\'s Wishlist at ' $ g.store:name" />
<mvt:assign name="g.emailheaders" value="'Content-Type: text/html; charset=ISO-8859-1' $ asciichar( 13 ) $ asciichar( 10 ) $ asciichar( 13 ) $ asciichar( 10 )" />
<mvt:comment> <!-- Message in actual email --> </mvt:comment>
<mvt:assign name="g.message" value="'Hello <strong>' $ g.friend_name $ '</strong>!<br/>'" />
<mvt:assign name="g.message" value="g.message $ 'Your friend, ' $ g.from_name $ ', has invited you to view their wishlist. <a href=\"' $ g.wishlist_url $ '\">Click here to view their wishlist</a><br/>'" />
<mvt:if expr="g.additional_message">
<mvt:assign name="g.message" value="g.message $ 'Here is what they have to say:<br />'" />
<mvt:assign name="g.message" value="g.message $ g.additional_message" />
</mvt:if>
<mvt:assign name="g.message" value="g.message $ '<br/><br/>Thank you,<br/>'" />
<mvt:assign name="g.message" value="g.message $ '<a href=\"' $ l.settings:urls:sfnt:auto $ '\">' $ g.store:name $ '</a>'" />
<mvt:comment> <!--/ Message in actual email --> </mvt:comment>
<mvt:do file="g.module_library_utilities" name="g.email_sent" value="SendEmail( g.friend_email, g.store:email,'',g.subject, g.emailheaders,g.message)" />
<mvt:else>
<mvt:assign name="g.wishlist_email_error" value="'Please make sure your friend\'s email is valid.'" />
</mvt:if>
</mvt:if>
</mvt:if>
<div id="wishlist-email-wrap">
<mvt:if expr="ISNULL g.wishlist_email_error AND g.wishlist_url AND g.email_a_friend">
Successfully sent an email to &mvte:global:friend_email;.<br />
<mvt:assign name="g.friend_name" value="''" />
<mvt:assign name="g.friend_email" value="''" />
<mvt:assign name="g.additional_message" value="''" />
<mvt:elseif expr="g.wishlist_email_error">
<div class="error">&mvt:global:wishlist_email_error;</div>
</mvt:if>
<label for="show_wishlist-email" id="show_wishlist-email_label">Email a Friend</label>
<mvt:if expr="l.settings:wishlist:shared">
<mvt:if expr="g.wishlist_email_error">
<input type="checkbox" id="show_wishlist-email" name="show_wishlist-email" style="display:none;" checked="checked" />
<mvt:else>
<input type="checkbox" id="show_wishlist-email" name="show_wishlist-email" style="display:none;" />
</mvt:if>
<div id="wishlist-email">
<form action="&mvte:urls:_self:auto_sep;WishList_ID=&mvta:wishlist:id;" method="POST">
<input type="hidden" name="wishlist_url" value="&mvte:urls:WISH:auto_sep;WishList_ID=&mvta:wishlist:id;" />
<mvt:if expr="ISNULL g.from_name">
<mvt:assign name="g.from_name" value="g.customer:bill_fname $ ' ' $ g.customer:bill_lname" />
</mvt:if>
<div>
<label for="from_name">Your Name:</label>
<input type="text" name="from_name" value="&mvte:global:from_name;" required />
</div>
<div>
<label for="friend_name">Friend's name:</label>
<input type="text" name="friend_name" value="&mvte:global:friend_name;" required />
</div>
<div>
<label for="friend_email">Friend's Email:</label>
<input type="text" name="friend_email" value="&mvte:global:friend_email;" required />
</div>
<div>
<label for="additional_message">Additional Message:</label>
<textarea name="additional_message">&mvte:global:additional_message;</textarea>
</div>
<div>
<input type="submit" name="email_a_friend" value="Send!" />
</div>
</form>
</div>
<mvt:else>
In order to send this to a friend, you must make your wishlist <strong>public</strong>.
</mvt:if>
</div>
Functions Used#
Email_Validate
SendEmail