Okie so I'm feeling nice today, hopefully the favor can be returned in some way.
First create a new file called sendtofriend.php under xcart/customer/
Code:
<?php
#
# sendtofriend mod by
www.molotovbliss.com
#
require "../smarty.php";
require "../config.php";
@include "./https.php";
require "./auth.php";
require "../include/categories.php";
if($active_modules["Bestsellers"])
include "../modules/Bestsellers/bestsellers.php";
$product_info = func_select_product($productid, $user_account['membership']);
$cat = $product_info["categoryid"];
$userinfo = func_userinfo($login,$login_type);
if ($REQUEST_METHOD=="POST") {
# phpinfo(); exit();
#
# Send mail to support
#
$HTTP_POST_VARS["body"] = stripslashes($HTTP_POST_VARS["body"]);
while (list($key,$val) = each($HTTP_POST_VARS))
$contact[$key]=$val;
$fillerror = (empty($contact["firstname"]) || empty($contact["lastname"]) || empty($contact["email"]) || empty($contact["sendtoemail"]));
if(!$fillerror) {
$mail_smarty->assign("contact",$contact);
#print $contact["sendtoemail"]; exit();
func_send_mail($contact["sendtoemail"], "mail/sendtofriend_subj.tpl", "mail/sendtofriend.tpl", $contact["email"], true);
$productid = $product_info['productid'];
header("Location: sendtofriend.php?section=sendtofriend&productid=$productid");
exit;
} else {
$userinfo = $HTTP_POST_VARS;
$userinfo["login"] = $userinfo["uname"];
}
}
$smarty->assign("userinfo",$userinfo);
$smarty->assign("fillerror",$fillerror);
$smarty->assign("main","sendtofriend");
$smarty->assign("help_section",$section);
$smarty->assign("location",$location);
$smarty->assign("product",$product_info);
$smarty->display("customer/home.tpl");
?>
Next we need to let smarty know what template to use:
[skin1]/common_templates.tpl add the following after the
first if statement:
Code:
{elseif $main eq "sendtofriend"}
{include file="customer/sendtofriend.tpl"}
Now create a new file under [skin1]/customer/sendtofriend.tpl and paste the following:
Code:
{literal}
<script>
function checkEmailAddress(field) {
var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
if (goodEmail) {
return true;
} else {
alert("E-mail address is invalid! Please correct");
field.focus();
field.select();
return false;
}
}
</script>
{/literal}
{if $smarty.get.mode eq "update"}
The product you have selected currently to send to your friend(s):
<table><tr>
<td><a href=product.php?productid={$smarty.get.productid}&cat={$cat}&page={$navigation_page}>{include file="product_thumbnail.tpl" productid=$smarty.get.productid image_x=70 product=$products[product].product}</a></td>
<td>
Product: <font class="red">{$product.product|escape}</font>
{$product.descr|truncate:255:"...":true}</td>
</tr></table>
{*$lng.txt_contact_us_header*}
{/if}
{capture name=dialog}
{if $smarty.get.mode eq "update"}
<table width=100% border=0 cellspacing=0 cellpadding=2>
<form action="sendtofriend.php?mode=update§ion=sendtofriend&productid={$smarty.get.productid}" action=sendtofriend method=post name=sendtofriendform>
<tr valign=middle>
<td colspan=3 class="red">Friend Information:</td>
</tr>
<tr valign=middle>
<td class="TableCenterCustomerForm">{$lng.lbl_email}</td>
<td><font class=StarStyle>*</font></td>
<td nowrap>
<input type=text name=sendtoemail size=32 maxlength=255>
{if $fillerror ne "" and $userinfo.sendtoemail eq ""}<font class=StarStyle><<</font>{/if}
</td>
</tr>
<!-- <tr><td colspan=3><small>Use , to seperate mutliple friends emails.
example:
bob@bob.com,
smith@smith.com, etc.</td></tr> -->
<tr><td></td></tr>
<tr valign=middle>
<td colspan=3 class="red">Your Information:</td>
</tr>
<tr valign=middle>
<td class="TableCenterCustomerForm">{$lng.lbl_first_name}</td>
<td><font class=StarStyle>*</font></td>
<td nowrap>
<input type=text name=firstname size=32 maxlength=32 value="{$userinfo.firstname}">
{if $fillerror ne "" and $userinfo.firstname eq ""}<font class=StarStyle><<</font>{/if}
</td>
</tr>
<tr valign=middle>
<td class="TableCenterCustomerForm">{$lng.lbl_last_name}</td>
<td><font class=StarStyle>*</font></td>
<td nowrap>
<input type=text name=lastname size=32 maxlength=32 value="{$userinfo.lastname}">
{if $fillerror ne "" and $userinfo.lastname eq ""}<font class=StarStyle><<</font>{/if}
</td>
</tr>
<tr valign=middle>
<td class="TableCenterCustomerForm">{$lng.lbl_email}</td>
<td><font class=StarStyle>*</font></td>
<td nowrap>
<input type=text name=email size=32 maxlength=128 value="{$userinfo.email}">
{if $fillerror ne "" and $userinfo.email eq ""}<font class=StarStyle><<</font>{/if}
</td>
</tr>
<tr valign=top>
<td class="TableCenterCustomerForm">{$lng.lbl_message}</td>
<td></td>
<td nowrap>
<textarea cols=48 rows=12 name=body>{$userinfo.body}</textarea>
</td>
</tr>
<tr valign=middle>
<td></td>
<td></td>
<td nowrap>
{include file="buttons/submit.tpl"}
</td>
</tr>
<input type=hidden name=usertype value="{$usertype}">
<input type=hidden name=productid value="{$smarty.get.productid}">
</form>
</table>
<hr size=1>
Here is the template for the email being sent to your friend:
<UL>
Bob Smith has recommended a product to you.
Look at this cool product I found, I think its what you were looking for!
Checkout the product link below for more details:
http://www.blazingdragon.com/store/customer/product.php?productid=3
--
orders@blazingdragon.com
support@blazingdragon.com
http://www.blazingdragon.com
[/list]
Go Back {include file="buttons/go.tpl"}
{else}
Your message was succesfully sent, your friend has been informed of {$product.product|escape}.
Go Back {include file="buttons/go.tpl"}
{/if}
{/capture}
{include file="dialog.tpl" title="Send to Friend(s)" content=$smarty.capture.dialog extra="width=100%"}
Edit the contents of the template to your liking. And please make a donation as this wasn't a quick easy task, I just see so many are requesting such that would be easier to deal in a mass way, I'm just asking for some help for my time. If you can't get all this working, please email me.