Tell-a-Friend

warr

No avatar

2006-11-30 08:10

I was wondering if anyone else would be interested in a plugin that allows you to email a page/product info to a friend. This is like a referral thing. I am not a programmer, but I think it should not be too difficult to add a mail form into the Product details page. Problem is, if I did that, it would be a hack and not very portable across various QC versions. Anyone wanna try it?

panos

No avatar

2007-01-04 14:31

hello
I have placement a tell a friend in my QC

you can see here http://p-gr.info/cart/index.php

and you it interests I can you I give this code

panos

idaryl

Avatar: idaryl

2007-01-04 22:08

Make a link to to it please

panos

No avatar

2007-01-04 23:18

WELL you need to make 1 files php

1) sendemail.php

and add this code

<?php

$FriendName = $_POST['FriendName'];
$FriendEmail = $_POST['FriendEmail'];
$Name = $_POST['Name'];
$Email = $_POST['Email'];
$emailtext = $_POST['emailtext'];
$string = $_SERVER['QUERY_STRING'];

?>
<html><head>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
</head>
<body>
<?php
if (!$FriendEmail) {
?>
<br>
<form name="form1" onsubmit="MM_validateForm('Name','','R','Email','','RisEmail','FriendName','','R','FriendEmail','','RisEm ail');return document.MM_returnValue" action="" method="POST">
<div align="center">
<table width="427" border="0" cellspacing="0" cellpadding="3">
<tr>
<td width="69" align="right" valign="top">&nbsp;</td>
<td width="5"><font face="Verdana" size="2">&nbsp;</font></td>
<td width="113"><font face="Verdana" size="2">Name: </font> </td>
<td width="216"> <font face="Verdana" size="2">E-mail:</font></td>
</tr>
<tr>
<td align="right" valign="top"><font face="Verdana" size="2"><b>You:</b></font></td>
<td>&nbsp;</td>
<td>
<font face="Verdana">
<input type="text" name="Name" size="15"><font size="2"> </font></font>
</td>
<td>
<font face="Verdana">
<input type="text" name="Email" size="20"><font size="2"> </font></font>
</td>
</tr>
<tr>
<td align="right" valign="top"><font face="Verdana" size="2"><b>Friend:</b></font></td>
<td>&nbsp;</td>
<td>
<font face="Verdana">
<input type="text" name="FriendName" size="15"><font size="2"> </font>
</font>
</td>
<td>
<font face="Verdana">
<input type="text" name="FriendEmail" size="20"><font size="2"> </font>
</font>
</td>
</tr>
<tr>
<td align="right" valign="top"><font face="Verdana" size="2"><b>Message:</b></font></td>
<td>&nbsp;</td>
<td colspan="2">
<font face="Verdana">
<textarea name="emailtext" cols="38" rows="6" style="font-family: Trebuchet MS; font-size: 10pt">
I found this great website and I believe you would be interested in it.
Here is the link to that page: <?php echo $string ?>
</textarea><font size="2"> </font></font>
</td>
</tr>
<tr>
<td align="right">&nbsp;</td>
<td><font face="Verdana" size="2">&nbsp; </font> </td>
<td>
<font face="Verdana">
<input type="submit" value="Send" name="Submit"><font size="2"> </font>
</font>
</td>
<td>&nbsp;</td>
</tr>
</table>
</div>
</form>
<?php
}
else {
if ($FriendEmail) { mail( $FriendEmail, "Message from $Name", "$FriendName, \n\n".$emailtext ."\n\n$Name", "From: $Email");

}


echo "<center><br><br><font face=Verdana size=2>Thank you <font color=red>$Name</font>. The email has been sent to <font color=red>$FriendName</font>. <br><br><a href='javascript:window.close();'>Close this window</a></font><p>
<font face=Verdana size=2>powered by: <a href=http://www.ergalia.com target=new>Tell A Friend</a></font></p>";
}
?>
<p>&nbsp;</p>
</body>
</html>

panos

panos

No avatar

2007-01-04 23:19

1) copy sendmail.php in the directory with all your .html or .php pages

to place a link just copy the following script between the <head> </head> tags
of the pages

<script language="JavaScript">
function newWindow(mypage,myname,w,h,features) {
if(screen.width){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
}else{winl = 0;wint =0;}
if (winl < 0) winl = 0;
if (wint < 0) wint = 0;
var settings = 'height=' + h + ',';
settings += 'width=' + w + ',';
settings += 'top=' + wint + ',';
settings += 'left=' + winl + ',';
settings += features;
win = window.open(mypage,myname,settings);
win.window.focus();
}
</script>

2) To place a link just use the following html code:

<a href="javascript:newWindow('sendemail.php?'+document.location.href,'email',400,300,'')">Recommend this page to your friend</a>

If you want to send a link to your homepage: replace +document.location.href
with http://www.site.com/

<a
href="javascript:newWindow('sendemail.php?http://www.YOUR SITE.com/','email',400,300,'')">Recommend this page to your friend</a>


3) To change the message of the outgoing email just open sendemail.php in editor and change the msg in the box.

4) Any help email me at info@ergalia.com or use the contact us form.

panos

panos

No avatar

2007-01-04 23:26

if you wont add images in ( Recommend this page to your friend )

add this code with your img URL

<img border="0" src="http://your-site-tell-a-friend.gif"

let me know for Any help or if you make


panos

idaryl

Avatar: idaryl

2007-01-04 23:46

Thanks

panos

No avatar

2007-01-05 15:24

Hello idaryl

et me know You make ??



panos

Back to top
about us | contact